Files
timebank-cc-public/public/build/assets/network-layout-worker-BKWU_04t.js

332 lines
556 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(){"use strict";function hi(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}function oh(t){if(Array.isArray(t))return t}function sh(t){if(Array.isArray(t))return hi(t)}function ir(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uh(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,Bs(a.key),a)}}function or(t,e,r){return e&&uh(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ot(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ci(t))||e){r&&(t=r);var a=0,n=function(){};return{s:n,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(u){throw u},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||r.return==null||r.return()}finally{if(s)throw i}}}}function Is(t,e,r){return(e=Bs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lh(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function fh(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,n,i,o,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(a=i.call(r)).done)&&(s.push(a.value),s.length!==e);u=!0);}catch(f){l=!0,n=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw n}}return s}}function vh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hh(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vt(t,e){return oh(t)||fh(t,e)||ci(t,e)||vh()}function an(t){return sh(t)||lh(t)||ci(t)||hh()}function ch(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Bs(t){var e=ch(t,"string");return typeof e=="symbol"?e:e+""}function ct(t){"@babel/helpers - typeof";return ct=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ct(t)}function ci(t,e){if(t){if(typeof t=="string")return hi(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?hi(t,e):void 0}}var dt=typeof window>"u"?null:window,Fs=dt?dt.navigator:null;dt&&dt.document;var dh=ct(""),ks=ct({}),gh=ct(function(){}),ph=typeof HTMLElement>"u"?"undefined":ct(HTMLElement),ba=function(e){return e&&e.instanceString&&it(e.instanceString)?e.instanceString():null},Ne=function(e){return e!=null&&ct(e)==dh},it=function(e){return e!=null&&ct(e)===gh},Je=function(e){return!Ft(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Ue=function(e){return e!=null&&ct(e)===ks&&!Je(e)&&e.constructor===Object},yh=function(e){return e!=null&&ct(e)===ks},be=function(e){return e!=null&&ct(e)===ct(1)&&!isNaN(e)},zs=function(e){return be(e)&&Math.floor(e)===e},nn=function(e){if(ph!=="undefined")return e!=null&&e instanceof HTMLElement},Ft=function(e){return wa(e)||Vs(e)},wa=function(e){return ba(e)==="collection"&&e._private.single},Vs=function(e){return ba(e)==="collection"&&!e._private.single},di=function(e){return ba(e)==="core"},Gs=function(e){return ba(e)==="stylesheet"},mh=function(e){return ba(e)==="event"},sr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},bh=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},wh=function(e){return Ue(e)&&be(e.x1)&&be(e.x2)&&be(e.y1)&&be(e.y2)},Eh=function(e){return yh(e)&&it(e.then)},xh=function(){return Fs&&Fs.userAgent.match(/msie|trident|edge/i)},Yr=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var a=function(){var i=this,o=arguments,s,u=r.apply(i,o),l=a.cache;return(s=l[u])||(s=l[u]=e.apply(i,o)),s};return a.cache={},a},gi=Yr(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),on=Yr(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Us=Yr(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),Hs=function(e){return sr(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},ur=function(e,r){return e.slice(-1*r.length)===r},gt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Th="rgb[a]?\\(("+gt+"[%]?)\\s*,\\s*("+gt+"[%]?)\\s*,\\s*("+gt+"[%]?)(?:\\s*,\\s*("+gt+"))?\\)",Ch="rgb[a]?\\((?:"+gt+"[%]?)\\s*,\\s*(?:"+gt+"[%]?)\\s*,\\s*(?:"+gt+"[%]?)(?:\\s*,\\s*(?:"+gt+"))?\\)",Sh="hsl[a]?\\(("+gt+")\\s*,\\s*("+gt+"[%])\\s*,\\s*("+gt+"[%])(?:\\s*,\\s*("+gt+"))?\\)",Ah="hsl[a]?\\((?:"+gt+")\\s*,\\s*(?:"+gt+"[%])\\s*,\\s*(?:"+gt+"[%])(?:\\s*,\\s*(?:"+gt+"))?\\)",Dh="\\#[0-9a-fA-F]{3}",Lh="\\#[0-9a-fA-F]{6}",qs=function(e,r){return e<r?-1:e>r?1:0},Mh=function(e,r){return-1*qs(e,r)},Oe=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var o=n[i];t[o]=a[o]}}return t},Rh=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,o=16;return r?(a=parseInt(e[1]+e[1],o),n=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),n=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[a,n,i]}},Nh=function(e){var r,a,n,i,o,s,u,l;function f(d,p,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?d+(p-d)*6*y:y<1/2?p:y<2/3?d+(p-d)*(2/3-y)*6:d}var v=new RegExp("^"+Sh+"$").exec(e);if(v){if(a=parseInt(v[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(v[2]),n<0||n>100||(n=n/100,i=parseFloat(v[3]),i<0||i>100)||(i=i/100,o=v[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=u=l=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;s=Math.round(255*f(h,c,a+1/3)),u=Math.round(255*f(h,c,a)),l=Math.round(255*f(h,c,a-1/3))}r=[s,u,l,o]}return r},Ph=function(e){var r,a=new RegExp("^"+Th+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var s=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(s&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;r.push(l)}}return r},Oh=function(e){return Ih[e.toLowerCase()]},Ys=function(e){return(Je(e)?e:null)||Oh(e)||Rh(e)||Ph(e)||Nh(e)},Ih={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ws=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Ue(o))throw Error("Tried to set map with object key");i<a.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},Xs=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Ue(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},sn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ea(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pi,$s;function xa(){if($s)return pi;$s=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return pi=t,pi}var yi,Ks;function Bh(){if(Ks)return yi;Ks=1;var t=typeof sn=="object"&&sn&&sn.Object===Object&&sn;return yi=t,yi}var mi,_s;function un(){if(_s)return mi;_s=1;var t=Bh(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return mi=r,mi}var bi,Zs;function Fh(){if(Zs)return bi;Zs=1;var t=un(),e=function(){return t.Date.now()};return bi=e,bi}var wi,Qs;function kh(){if(Qs)return wi;Qs=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return wi=e,wi}var Ei,Js;function zh(){if(Js)return Ei;Js=1;var t=kh(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return Ei=r,Ei}var xi,js;function Ti(){if(js)return xi;js=1;var t=un(),e=t.Symbol;return xi=e,xi}var Ci,eu;function Vh(){if(eu)return Ci;eu=1;var t=Ti(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,n=t?t.toStringTag:void 0;function i(o){var s=r.call(o,n),u=o[n];try{o[n]=void 0;var l=!0}catch{}var f=a.call(o);return l&&(s?o[n]=u:delete o[n]),f}return Ci=i,Ci}var Si,tu;function Gh(){if(tu)return Si;tu=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return Si=r,Si}var Ai,ru;function au(){if(ru)return Ai;ru=1;var t=Ti(),e=Vh(),r=Gh(),a="[object Null]",n="[object Undefined]",i=t?t.toStringTag:void 0;function o(s){return s==null?s===void 0?n:a:i&&i in Object(s)?e(s):r(s)}return Ai=o,Ai}var Di,nu;function Uh(){if(nu)return Di;nu=1;function t(e){return e!=null&&typeof e=="object"}return Di=t,Di}var Li,iu;function Ta(){if(iu)return Li;iu=1;var t=au(),e=Uh(),r="[object Symbol]";function a(n){return typeof n=="symbol"||e(n)&&t(n)==r}return Li=a,Li}var Mi,ou;function Hh(){if(ou)return Mi;ou=1;var t=zh(),e=xa(),r=Ta(),a=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return a;if(e(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=e(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=t(l);var v=i.test(l);return v||o.test(l)?s(l.slice(2),v?2:8):n.test(l)?a:+l}return Mi=u,Mi}var Ri,su;function qh(){if(su)return Ri;su=1;var t=xa(),e=Fh(),r=Hh(),a="Expected a function",n=Math.max,i=Math.min;function o(s,u,l){var f,v,c,h,d,p,y=0,g=!1,b=!1,m=!0;if(typeof s!="function")throw new TypeError(a);u=r(u)||0,t(l)&&(g=!!l.leading,b="maxWait"in l,c=b?n(r(l.maxWait)||0,u):c,m="trailing"in l?!!l.trailing:m);function w(I){var E=f,A=v;return f=v=void 0,y=I,h=s.apply(A,E),h}function T(I){return y=I,d=setTimeout(M,u),g?w(I):h}function D(I){var E=I-p,A=I-y,S=u-E;return b?i(S,c-A):S}function x(I){var E=I-p,A=I-y;return p===void 0||E>=u||E<0||b&&A>=c}function M(){var I=e();if(x(I))return P(I);d=setTimeout(M,D(I))}function P(I){return d=void 0,m&&f?w(I):(f=v=void 0,h)}function N(){d!==void 0&&clearTimeout(d),y=0,f=p=v=d=void 0}function O(){return d===void 0?h:P(e())}function R(){var I=e(),E=x(I);if(f=arguments,v=this,p=I,E){if(d===void 0)return T(p);if(b)return clearTimeout(d),d=setTimeout(M,u),w(p)}return d===void 0&&(d=setTimeout(M,u)),h}return R.cancel=N,R.flush=O,R}return Ri=o,Ri}var Yh=qh(),Ca=Ea(Yh),Ni=dt?dt.performance:null,uu=Ni&&Ni.now?function(){return Ni.now()}:function(){return Date.now()},Wh=function(){if(dt){if(dt.requestAnimationFrame)return function(t){dt.requestAnimationFrame(t)};if(dt.mozRequestAnimationFrame)return function(t){dt.mozRequestAnimationFrame(t)};if(dt.webkitRequestAnimationFrame)return function(t){dt.webkitRequestAnimationFrame(t)};if(dt.msRequestAnimationFrame)return function(t){dt.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(uu())},1e3/60)}}(),ln=function(e){return Wh(e)},jt=uu,Dr=9261,lu=65599,Wr=5381,fu=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dr,a=r,n;n=e.next(),!n.done;)a=a*lu+n.value|0;return a},Sa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dr;return r*lu+e|0},Aa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Wr;return(r<<5)+r+e|0},Xh=function(e,r){return e*2097152+r},lr=function(e){return e[0]*2097152+e[1]},fn=function(e,r){return[Sa(e[0],r[0]),Aa(e[1],r[1])]},vu=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return fu(o,r)},Lr=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return fu(o,r)},hu=function(){return $h(arguments)},$h=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=Lr(n):r=Lr(n,r)}return r};function Kh(t,e,r,a,n){var i=n*Math.PI/180,o=Math.cos(i)*(t-r)-Math.sin(i)*(e-a)+r,s=Math.sin(i)*(t-r)+Math.cos(i)*(e-a)+a;return{x:o,y:s}}var _h=function(e,r,a,n,i,o){return{x:(e-a)*i+a,y:(r-n)*o+n}};function Zh(t,e,r){if(r===0)return t;var a=(e.x1+e.x2)/2,n=(e.y1+e.y2)/2,i=e.w/e.h,o=1/i,s=Kh(t.x,t.y,a,n,r),u=_h(s.x,s.y,a,n,i,o);return{x:u.x,y:u.y}}var cu=!0,Qh=console.warn!=null,Jh=console.trace!=null,Pi=Number.MAX_SAFE_INTEGER||9007199254740991,du=function(){return!0},vn=function(){return!1},gu=function(){return 0},Oi=function(){},at=function(e){throw new Error(e)},pu=function(e){if(e!==void 0)cu=!!e;else return cu},Xe=function(e){pu()&&(Qh?console.warn(e):(console.log(e),Jh&&console.trace()))},jh=function(e){return Oe({},e)},Yt=function(e){return e==null?e:Je(e)?e.slice():Ue(e)?jh(e):e},ec=function(e){return e.slice()},yu=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},tc={},mu=function(){return tc},xt=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var o=r[i],s=a==null?void 0:a[o];n[o]=s===void 0?e[o]:s}return n}},fr=function(e,r,a){for(var n=e.length-1;n>=0;n--)e[n]===r&&e.splice(n,1)},Ii=function(e){e.splice(0,e.length)},rc=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},Mt=function(e,r,a){return a&&(r=Us(a,r)),e[r]},Wt=function(e,r,a,n){a&&(r=Us(a,r)),e[r]=n},ac=function(){function t(){ir(this,t),this._obj={}}return or(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}])}(),er=typeof Map<"u"?Map:ac,nc="undefined",ic=function(){function t(e){if(ir(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return or(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}])}(),Xr=(typeof Set>"u"?"undefined":ct(Set))!==nc?Set:ic,hn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!di(e)){at("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){at("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new Xr,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var o=r.renderedPosition,s=e.pan(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];Je(r.classes)?l=r.classes:Ne(r.classes)&&(l=r.classes.split(/\s+/));for(var f=0,v=l.length;f<v;f++){var c=l[f];!c||c===""||i.classes.add(c)}this.createEmitter(),(a===void 0||a)&&this.restore();var h=r.style||r.css;h&&(Xe("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))},bu=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var o;Ue(a)&&!Ft(a)&&(o=a,a=o.roots||o.root,n=o.visit,i=o.directed),i=arguments.length===2&&!it(n)?n:i,n=it(n)?n:function(){};for(var s=this._private.cy,u=a=Ne(a)?this.filter(a):a,l=[],f=[],v={},c={},h={},d=0,p,y=this.byGroup(),g=y.nodes,b=y.edges,m=0;m<u.length;m++){var w=u[m],T=w.id();w.isNode()&&(l.unshift(w),e.bfs&&(h[T]=!0,f.push(w)),c[T]=0)}for(var D=function(){var I=e.bfs?l.shift():l.pop(),E=I.id();if(e.dfs){if(h[E])return 0;h[E]=!0,f.push(I)}var A=c[E],S=v[E],C=S!=null?S.source():null,L=S!=null?S.target():null,z=S==null?void 0:I.same(C)?L[0]:C[0],k;if(k=n(I,S,z,d++,A),k===!0)return p=I,1;if(k===!1)return 1;for(var F=I.connectedEdges().filter(function(Z){return(!i||Z.source().same(I))&&b.has(Z)}),H=0;H<F.length;H++){var W=F[H],Q=W.connectedNodes().filter(function(Z){return!Z.same(I)&&g.has(Z)}),K=Q.id();Q.length!==0&&!h[K]&&(Q=Q[0],l.push(Q),e.bfs&&(h[K]=!0,f.push(Q)),v[K]=W,c[K]=c[E]+1)}},x;l.length!==0&&(x=D(),!(x!==0&&x===1)););for(var M=s.collection(),P=0;P<f.length;P++){var N=f[P],O=v[N.id()];O!=null&&M.push(O),M.push(N)}return{path:s.collection(M),found:s.collection(p)}}},Da={breadthFirstSearch:bu({bfs:!0}),depthFirstSearch:bu({dfs:!0})};Da.bfs=Da.breadthFirstSearch,Da.dfs=Da.depthFirstSearch;var cn={exports:{}},oc=cn.exports,wu;function sc(){return wu||(wu=1,function(t,e){(function(){var r,a,n,i,o,s,u,l,f,v,c,h,d,p,y;n=Math.floor,v=Math.min,a=function(g,b){return g<b?-1:g>b?1:0},f=function(g,b,m,w,T){var D;if(m==null&&(m=0),T==null&&(T=a),m<0)throw new Error("lo must be non-negative");for(w==null&&(w=g.length);m<w;)D=n((m+w)/2),T(b,g[D])<0?w=D:m=D+1;return[].splice.apply(g,[m,m-m].concat(b)),b},s=function(g,b,m){return m==null&&(m=a),g.push(b),p(g,0,g.length-1,m)},o=function(g,b){var m,w;return b==null&&(b=a),m=g.pop(),g.length?(w=g[0],g[0]=m,y(g,0,b)):w=m,w},l=function(g,b,m){var w;return m==null&&(m=a),w=g[0],g[0]=b,y(g,0,m),w},u=function(g,b,m){var w;return m==null&&(m=a),g.length&&m(g[0],b)<0&&(w=[g[0],b],b=w[0],g[0]=w[1],y(g,0,m)),b},i=function(g,b){var m,w,T,D,x,M;for(b==null&&(b=a),D=(function(){M=[];for(var P=0,N=n(g.length/2);0<=N?P<N:P>N;0<=N?P++:P--)M.push(P);return M}).apply(this).reverse(),x=[],w=0,T=D.length;w<T;w++)m=D[w],x.push(y(g,m,b));return x},d=function(g,b,m){var w;if(m==null&&(m=a),w=g.indexOf(b),w!==-1)return p(g,0,w,m),y(g,w,m)},c=function(g,b,m){var w,T,D,x,M;if(m==null&&(m=a),T=g.slice(0,b),!T.length)return T;for(i(T,m),M=g.slice(b),D=0,x=M.length;D<x;D++)w=M[D],u(T,w,m);return T.sort(m).reverse()},h=function(g,b,m){var w,T,D,x,M,P,N,O,R;if(m==null&&(m=a),b*10<=g.length){if(D=g.slice(0,b).sort(m),!D.length)return D;for(T=D[D.length-1],N=g.slice(b),x=0,P=N.length;x<P;x++)w=N[x],m(w,T)<0&&(f(D,w,0,null,m),D.pop(),T=D[D.length-1]);return D}for(i(g,m),R=[],M=0,O=v(b,g.length);0<=O?M<O:M>O;0<=O?++M:--M)R.push(o(g,m));return R},p=function(g,b,m,w){var T,D,x;for(w==null&&(w=a),T=g[m];m>b;){if(x=m-1>>1,D=g[x],w(T,D)<0){g[m]=D,m=x;continue}break}return g[m]=T},y=function(g,b,m){var w,T,D,x,M;for(m==null&&(m=a),T=g.length,M=b,D=g[b],w=2*b+1;w<T;)x=w+1,x<T&&!(m(g[w],g[x])<0)&&(w=x),g[b]=g[w],b=w,w=2*b+1;return g[b]=D,p(g,M,b,m)},r=function(){g.push=s,g.pop=o,g.replace=l,g.pushpop=u,g.heapify=i,g.updateItem=d,g.nlargest=c,g.nsmallest=h;function g(b){this.cmp=b??a,this.nodes=[]}return g.prototype.push=function(b){return s(this.nodes,b,this.cmp)},g.prototype.pop=function(){return o(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(b){return this.nodes.indexOf(b)!==-1},g.prototype.replace=function(b){return l(this.nodes,b,this.cmp)},g.prototype.pushpop=function(b){return u(this.nodes,b,this.cmp)},g.prototype.heapify=function(){return i(this.nodes,this.cmp)},g.prototype.updateItem=function(b){return d(this.nodes,b,this.cmp)},g.prototype.clear=function(){return this.nodes=[]},g.prototype.empty=function(){return this.nodes.length===0},g.prototype.size=function(){return this.nodes.length},g.prototype.clone=function(){var b;return b=new g,b.nodes=this.nodes.slice(0),b},g.prototype.toArray=function(){return this.nodes.slice(0)},g.prototype.insert=g.prototype.push,g.prototype.top=g.prototype.peek,g.prototype.front=g.prototype.peek,g.prototype.has=g.prototype.contains,g.prototype.copy=g.prototype.clone,g}(),function(g,b){return t.exports=b()}(this,function(){return r})}).call(oc)}(cn)),cn.exports}var Bi,Eu;function uc(){return Eu||(Eu=1,Bi=sc()),Bi}var lc=uc(),La=Ea(lc),fc=xt({root:null,weight:function(e){return 1},directed:!1}),vc={dijkstra:function(e){if(!Ue(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=fc(e),n=a.root,i=a.weight,o=a.directed,s=this,u=i,l=Ne(n)?this.filter(n)[0]:n[0],f={},v={},c={},h=this.byGroup(),d=h.nodes,p=h.edges;p.unmergeBy(function(A){return A.isLoop()});for(var y=function(S){return f[S.id()]},g=function(S,C){f[S.id()]=C,b.updateItem(S)},b=new La(function(A,S){return y(A)-y(S)}),m=0;m<d.length;m++){var w=d[m];f[w.id()]=w.same(l)?0:1/0,b.push(w)}for(var T=function(S,C){for(var L=(o?S.edgesTo(C):S.edgesWith(C)).intersect(p),z=1/0,k,F=0;F<L.length;F++){var H=L[F],W=u(H);(W<z||!k)&&(z=W,k=H)}return{edge:k,dist:z}};b.size()>0;){var D=b.pop(),x=y(D),M=D.id();if(c[M]=x,x!==1/0)for(var P=D.neighborhood().intersect(d),N=0;N<P.length;N++){var O=P[N],R=O.id(),I=T(D,O),E=x+I.dist;E<y(O)&&(g(O,E),v[R]={node:D,edge:I.edge})}}return{distanceTo:function(S){var C=Ne(S)?d.filter(S)[0]:S[0];return c[C.id()]},pathTo:function(S){var C=Ne(S)?d.filter(S)[0]:S[0],L=[],z=C,k=z.id();if(C.length>0)for(L.unshift(C);v[k];){var F=v[k];L.unshift(F.edge),L.unshift(F.node),z=F.node,k=z.id()}return s.spawn(L)}}}},hc={kruskal:function(e){e=e||function(m){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,o=new Array(i),s=a,u=function(w){for(var T=0;T<o.length;T++){var D=o[T];if(D.has(w))return T}},l=0;l<i;l++)o[l]=this.spawn(a[l]);for(var f=n.sort(function(m,w){return e(m)-e(w)}),v=0;v<f.length;v++){var c=f[v],h=c.source()[0],d=c.target()[0],p=u(h),y=u(d),g=o[p],b=o[y];p!==y&&(s.merge(c),g.merge(b),o.splice(y,1))}return s}},cc=xt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),dc={aStar:function(e){var r=this.cy(),a=cc(e),n=a.root,i=a.goal,o=a.heuristic,s=a.directed,u=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var l=n.id(),f=i.id(),v={},c={},h={},d=new La(function(k,F){return c[k.id()]-c[F.id()]}),p=new Xr,y={},g={},b=function(F,H){d.push(F),p.add(H)},m,w,T=function(){m=d.pop(),w=m.id(),p.delete(w)},D=function(F){return p.has(F)};b(n,l),v[l]=0,c[l]=o(n);for(var x=0;d.size()>0;){if(T(),x++,w===f){for(var M=[],P=i,N=f,O=g[N];M.unshift(P),O!=null&&M.unshift(O),P=y[N],P!=null;)N=P.id(),O=g[N];return{found:!0,distance:v[w],path:this.spawn(M),steps:x}}h[w]=!0;for(var R=m._private.edges,I=0;I<R.length;I++){var E=R[I];if(this.hasElementWithId(E.id())&&!(s&&E.data("source")!==w)){var A=E.source(),S=E.target(),C=A.id()!==w?A:S,L=C.id();if(this.hasElementWithId(L)&&!h[L]){var z=v[w]+u(E);if(!D(L)){v[L]=z,c[L]=z+o(C),b(C,L),y[L]=m,g[L]=E;continue}z<v[L]&&(v[L]=z,c[L]=z+o(C),d.updateItem(C),y[L]=m,g[L]=E)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},gc=xt({weight:function(e){return 1},directed:!1}),pc={floydWarshall:function(e){for(var r=this.cy(),a=gc(e),n=a.weight,i=a.directed,o=n,s=this.byGroup(),u=s.nodes,l=s.edges,f=u.length,v=f*f,c=function(W){return u.indexOf(W)},h=function(W){return u[W]},d=new Array(v),p=0;p<v;p++){var y=p%f,g=(p-y)/f;g===y?d[p]=0:d[p]=1/0}for(var b=new Array(v),m=new Array(v),w=0;w<l.length;w++){var T=l[w],D=T.source()[0],x=T.target()[0];if(D!==x){var M=c(D),P=c(x),N=M*f+P,O=o(T);if(d[N]>O&&(d[N]=O,b[N]=P,m[N]=T),!i){var R=P*f+M;!i&&d[R]>O&&(d[R]=O,b[R]=M,m[R]=T)}}}for(var I=0;I<f;I++)for(var E=0;E<f;E++)for(var A=E*f+I,S=0;S<f;S++){var C=E*f+S,L=I*f+S;d[A]+d[L]<d[C]&&(d[C]=d[A]+d[L],b[C]=b[A])}var z=function(W){return(Ne(W)?r.filter(W):W)[0]},k=function(W){return c(z(W))},F={distance:function(W,Q){var K=k(W),Z=k(Q);return d[K*f+Z]},path:function(W,Q){var K=k(W),Z=k(Q),j=h(K);if(K===Z)return j.collection();if(b[K*f+Z]==null)return r.collection();var re=r.collection(),q=K,U;for(re.merge(j);K!==Z;)q=K,K=b[K*f+Z],U=m[q*f+K],re.merge(U),re.merge(h(K));return re}};return F}},yc=xt({weight:function(e){return 1},directed:!1,root:null}),mc={bellmanFord:function(e){var r=this,a=yc(e),n=a.weight,i=a.directed,o=a.root,s=n,u=this,l=this.cy(),f=this.byGroup(),v=f.edges,c=f.nodes,h=c.length,d=new er,p=!1,y=[];o=l.collection(o)[0],v.unmergeBy(function(pe){return pe.isLoop()});for(var g=v.length,b=function(le){var ce=d.get(le.id());return ce||(ce={},d.set(le.id(),ce)),ce},m=function(le){return(Ne(le)?l.$(le):le)[0]},w=function(le){return b(m(le)).dist},T=function(le){for(var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,ve=m(le),de=[],me=ve;;){if(me==null)return r.spawn();var ye=b(me),we=ye.edge,Me=ye.pred;if(de.unshift(me[0]),me.same(ce)&&de.length>0)break;we!=null&&de.unshift(we),me=Me}return u.spawn(de)},D=0;D<h;D++){var x=c[D],M=b(x);x.same(o)?M.dist=0:M.dist=1/0,M.pred=null,M.edge=null}for(var P=!1,N=function(le,ce,ve,de,me,ye){var we=de.dist+ye;we<me.dist&&!ve.same(de.edge)&&(me.dist=we,me.pred=le,me.edge=ve,P=!0)},O=1;O<h;O++){P=!1;for(var R=0;R<g;R++){var I=v[R],E=I.source(),A=I.target(),S=s(I),C=b(E),L=b(A);N(E,A,I,C,L,S),i||N(A,E,I,L,C,S)}if(!P)break}if(P)for(var z=[],k=0;k<g;k++){var F=v[k],H=F.source(),W=F.target(),Q=s(F),K=b(H).dist,Z=b(W).dist;if(K+Q<Z||!i&&Z+Q<K)if(p||(Xe("Graph contains a negative weight cycle for Bellman-Ford"),p=!0),e.findNegativeWeightCycles!==!1){var j=[];K+Q<Z&&j.push(H),!i&&Z+Q<K&&j.push(W);for(var re=j.length,q=0;q<re;q++){var U=j[q],Y=[U];Y.push(b(U).edge);for(var X=b(U).pred;Y.indexOf(X)===-1;)Y.push(X),Y.push(b(X).edge),X=b(X).pred;Y=Y.slice(Y.indexOf(X));for(var ee=Y[0].id(),te=0,ge=2;ge<Y.length;ge+=2)Y[ge].id()<ee&&(ee=Y[ge].id(),te=ge);Y=Y.slice(te).concat(Y.slice(0,te)),Y.push(Y[0]);var Te=Y.map(function(pe){return pe.id()}).join(",");z.indexOf(Te)===-1&&(y.push(u.spawn(Y)),z.push(Te))}}else break}return{distanceTo:w,pathTo:T,hasNegativeWeightCycle:p,negativeWeightCycles:y}}},bc=Math.sqrt(2),wc=function(e,r,a){a.length===0&&at("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],o=n[2],s=r[i],u=r[o],l=a,f=l.length-1;f>=0;f--){var v=l[f],c=v[1],h=v[2];(r[c]===s&&r[h]===u||r[c]===u&&r[h]===s)&&l.splice(f,1)}for(var d=0;d<l.length;d++){var p=l[d];p[1]===u?(l[d]=p.slice(),l[d][1]=s):p[2]===u&&(l[d]=p.slice(),l[d][2]=s)}for(var y=0;y<r.length;y++)r[y]===u&&(r[y]=s);return l},Fi=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=wc(i,e,r),a--}return r},Ec={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(L){return L.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/bc);if(i<2){at("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f<o;f++){var v=n[f];l.push([f,a.indexOf(v.source()),a.indexOf(v.target())])}for(var c=1/0,h=[],d=new Array(i),p=new Array(i),y=new Array(i),g=function(z,k){for(var F=0;F<i;F++)k[F]=z[F]},b=0;b<=s;b++){for(var m=0;m<i;m++)p[m]=m;var w=Fi(p,l.slice(),i,u),T=w.slice();g(p,y);var D=Fi(p,w,u,2),x=Fi(y,T,u,2);D.length<=x.length&&D.length<c?(c=D.length,h=D,g(p,d)):x.length<=D.length&&x.length<c&&(c=x.length,h=x,g(y,d))}for(var M=this.spawn(h.map(function(L){return n[L[0]]})),P=this.spawn(),N=this.spawn(),O=d[0],R=0;R<d.length;R++){var I=d[R],E=a[R];I===O?P.merge(E):N.merge(E)}var A=function(z){var k=e.spawn();return z.forEach(function(F){k.merge(F),F.connectedEdges().forEach(function(H){e.contains(H)&&!M.contains(H)&&k.merge(H)})}),k},S=[A(P),A(N)],C={cut:M,components:S,partition1:P,partition2:N};return C}},ki,xc=function(e){return{x:e.x,y:e.y}},dn=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},xu=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},$r=function(e){return{x:e[0],y:e[1]}},Tc=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.min(o,n))}return n},Cc=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.max(o,n))}return n},Sc=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,o=r;o<a;o++){var s=e[o];isFinite(s)&&(n+=s,i++)}return n/i},Ac=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(c,h){return c-h});var f=e.length,v=Math.floor(f/2);return f%2!==0?e[v+1+s]:(e[v-1+s]+e[v+s])/2},Tu=function(e,r){return r===0?e:Tu(r,e%r)},Dc=function(e){for(var r=e[0],a=0;a<e.length;a++)if(zs(e[a]))a>0&&(r=Tu(r,e[a]));else return 0;return r},Lc=function(e){return Math.PI*e/180},gn=function(e,r){return Math.atan2(r,e)-Math.PI/2},zi=Math.log2||function(t){return Math.log(t)/Math.log(2)},Vi=function(e){return e>0?1:e<0?-1:0},Mr=function(e,r){return Math.sqrt(Rr(e,r))},Rr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},Mc=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},mt=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},Kr=function(e,r,a,n){return{x:mt(e.x,r.x,a.x,n),y:mt(e.y,r.y,a.y,n)}},Rc=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},o=Mr(e,r),s={x:i.x/o,y:i.y/o};return a=a??0,n=n??a*o,{x:e.x+s.x*n,y:e.y+s.y*n}},Ma=function(e,r,a){return Math.max(e,Math.min(a,r))},Rt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Nc=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Pc=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Oc=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},Cu=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},pn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},yn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(r.length===1)a=n=i=o=r[0];else if(r.length===2)a=i=r[0],o=n=r[1];else if(r.length===4){var s=vt(r,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Su=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},Gi=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},vr=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Au=function(e,r){return vr(e,r.x,r.y)},Du=function(e,r){return vr(e,r.x1,r.y1)&&vr(e,r.x2,r.y2)},Ic=(ki=Math.hypot)!==null&&ki!==void 0?ki:function(t,e){return Math.sqrt(t*t+e*e)};function Bc(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(M,P){return{x:M.x+P.x,y:M.y+P.y}},a=function(M,P){return{x:M.x-P.x,y:M.y-P.y}},n=function(M,P){return{x:M.x*P,y:M.y*P}},i=function(M,P){return M.x*P.y-M.y*P.x},o=function(M){var P=Ic(M.x,M.y);return P===0?{x:0,y:0}:{x:M.x/P,y:M.y/P}},s=function(M){for(var P=0,N=0;N<M.length;N++){var O=M[N],R=M[(N+1)%M.length];P+=O.x*R.y-R.x*O.y}return P/2},u=function(M,P,N,O){var R=a(P,M),I=a(O,N),E=i(R,I);if(Math.abs(E)<1e-9)return r(M,n(R,.5));var A=i(a(N,M),I)/E;return r(M,n(R,A))},l=t.map(function(x){return{x:x.x,y:x.y}});s(l)<0&&l.reverse();for(var f=l.length,v=[],c=0;c<f;c++){var h=l[c],d=l[(c+1)%f],p=a(d,h),y=o({x:p.y,y:-p.x});v.push(y)}for(var g=v.map(function(x,M){var P=r(l[M],n(x,e)),N=r(l[(M+1)%f],n(x,e));return{p1:P,p2:N}}),b=[],m=0;m<f;m++){var w=g[(m-1+f)%f],T=g[m],D=u(w.p1,w.p2,T.p1,T.p2);b.push(D)}return b}function Fc(t,e,r,a,n,i){var o=Wc(t,e,r,a,n),s=Bc(o,i),u=Rt();return s.forEach(function(l){return Cu(u,l.x,l.y)}),u}var Lu=function(e,r,a,n,i,o,s){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?cr(i,o):u,f=i/2,v=o/2;l=Math.min(l,f,v);var c=l!==f,h=l!==v,d;if(c){var p=a-f+l-s,y=n-v-s,g=a+f-l+s,b=y;if(d=hr(e,r,a,n,p,y,g,b,!1),d.length>0)return d}if(h){var m=a+f+s,w=n-v+l-s,T=m,D=n+v-l+s;if(d=hr(e,r,a,n,m,w,T,D,!1),d.length>0)return d}if(c){var x=a-f+l-s,M=n+v+s,P=a+f-l+s,N=M;if(d=hr(e,r,a,n,x,M,P,N,!1),d.length>0)return d}if(h){var O=a-f-s,R=n-v+l-s,I=O,E=n+v-l+s;if(d=hr(e,r,a,n,O,R,I,E,!1),d.length>0)return d}var A;{var S=a-f+l,C=n-v+l;if(A=Ra(e,r,a,n,S,C,l+s),A.length>0&&A[0]<=S&&A[1]<=C)return[A[0],A[1]]}{var L=a+f-l,z=n-v+l;if(A=Ra(e,r,a,n,L,z,l+s),A.length>0&&A[0]>=L&&A[1]<=z)return[A[0],A[1]]}{var k=a+f-l,F=n+v-l;if(A=Ra(e,r,a,n,k,F,l+s),A.length>0&&A[0]>=k&&A[1]>=F)return[A[0],A[1]]}{var H=a-f+l,W=n+v-l;if(A=Ra(e,r,a,n,H,W,l+s),A.length>0&&A[0]<=H&&A[1]>=W)return[A[0],A[1]]}return[]},kc=function(e,r,a,n,i,o,s){var u=s,l=Math.min(a,i),f=Math.max(a,i),v=Math.min(n,o),c=Math.max(n,o);return l-u<=e&&e<=f+u&&v-u<=r&&r<=c+u},zc=function(e,r,a,n,i,o,s,u,l){var f={x1:Math.min(a,s,i)-l,x2:Math.max(a,s,i)+l,y1:Math.min(n,u,o)-l,y2:Math.max(n,u,o)+l};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},Vc=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,u=(-r+o)/s,l=(-r-o)/s;return[u,l]},Gc=function(e,r,a,n,i){var o=1e-5;e===0&&(e=o),r/=e,a/=e,n/=e;var s,u,l,f,v,c,h,d;if(u=(3*a-r*r)/9,l=-(27*n)+r*(9*a-2*(r*r)),l/=54,s=u*u*u+l*l,i[1]=0,h=r/3,s>0){v=l+Math.sqrt(s),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),c=l-Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+v+c,h+=(v+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+v)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,s===0){d=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),d=2*Math.sqrt(u),i[0]=-h+d*Math.cos(f/3),i[2]=-h+d*Math.cos((f+2*Math.PI)/3),i[4]=-h+d*Math.cos((f+4*Math.PI)/3)},Uc=function(e,r,a,n,i,o,s,u){var l=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*u+4*o*o-4*o*u+u*u,f=1*9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*u-6*o*o+3*o*u,v=1*3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*u-n*r+2*o*o+2*o*r-u*r,c=1*a*i-a*a+a*e-i*e+n*o-n*n+n*r-o*r,h=[];Gc(l,f,v,c,h);for(var d=1e-7,p=[],y=0;y<6;y+=2)Math.abs(h[y+1])<d&&h[y]>=0&&h[y]<=1&&p.push(h[y]);p.push(1),p.push(0);for(var g=-1,b,m,w,T=0;T<p.length;T++)b=Math.pow(1-p[T],2)*a+2*(1-p[T])*p[T]*i+p[T]*p[T]*s,m=Math.pow(1-p[T],2)*n+2*(1-p[T])*p[T]*o+p[T]*p[T]*u,w=Math.pow(b-e,2)+Math.pow(m-r,2),g>=0?w<g&&(g=w):g=w;return g},Hc=function(e,r,a,n,i,o){var s=[e-a,r-n],u=[i-a,o-n],l=u[0]*u[0]+u[1]*u[1],f=s[0]*s[0]+s[1]*s[1],v=s[0]*u[0]+s[1]*u[1],c=v*v/l;return v<0?f:c>l?(e-i)*(e-i)+(r-o)*(r-o):f-c},It=function(e,r,a){for(var n,i,o,s,u,l=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(o=a[(f+1)*2],s=a[(f+1)*2+1]):(o=a[(f+1-a.length/2)*2],s=a[(f+1-a.length/2)*2+1]),!(n==e&&o==e))if(n>=e&&e>=o||n<=e&&e<=o)u=(e-n)/(o-n)*(s-i)+i,u>r&&l++;else continue;return l%2!==0},tr=function(e,r,a,n,i,o,s,u,l){var f=new Array(a.length),v;u[0]!=null?(v=Math.atan(u[1]/u[0]),u[0]<0?v=v+Math.PI/2:v=-v-Math.PI/2):v=u;for(var c=Math.cos(-v),h=Math.sin(-v),d=0;d<f.length/2;d++)f[d*2]=o/2*(a[d*2]*c-a[d*2+1]*h),f[d*2+1]=s/2*(a[d*2+1]*c+a[d*2]*h),f[d*2]+=n,f[d*2+1]+=i;var p;if(l>0){var y=bn(f,-l);p=mn(y)}else p=f;return It(e,r,p)},qc=function(e,r,a,n,i,o,s,u){for(var l=new Array(a.length*2),f=0;f<u.length;f++){var v=u[f];l[f*4+0]=v.startX,l[f*4+1]=v.startY,l[f*4+2]=v.stopX,l[f*4+3]=v.stopY;var c=Math.pow(v.cx-e,2)+Math.pow(v.cy-r,2);if(c<=Math.pow(v.radius,2))return!0}return It(e,r,l)},mn=function(e){for(var r=new Array(e.length/2),a,n,i,o,s,u,l,f,v=0;v<e.length/4;v++){a=e[v*4],n=e[v*4+1],i=e[v*4+2],o=e[v*4+3],v<e.length/4-1?(s=e[(v+1)*4],u=e[(v+1)*4+1],l=e[(v+1)*4+2],f=e[(v+1)*4+3]):(s=e[0],u=e[1],l=e[2],f=e[3]);var c=hr(a,n,i,o,s,u,l,f,!0);r[v*2]=c[0],r[v*2+1]=c[1]}return r},bn=function(e,r){for(var a=new Array(e.length*2),n,i,o,s,u=0;u<e.length/2;u++){n=e[u*2],i=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],s=e[(u+1)*2+1]):(o=e[0],s=e[1]);var l=s-i,f=-(o-n),v=Math.sqrt(l*l+f*f),c=l/v,h=f/v;a[u*4]=n+c*r,a[u*4+1]=i+h*r,a[u*4+2]=o+c*r,a[u*4+3]=s+h*r}return a},Yc=function(e,r,a,n,i,o){var s=a-e,u=n-r;s/=i,u/=o;var l=Math.sqrt(s*s+u*u),f=l-1;if(f<0)return[];var v=f/l;return[(a-e)*v+e,(n-r)*v+r]},Nr=function(e,r,a,n,i,o,s){return e-=i,r-=o,e/=a/2+s,r/=n/2+s,e*e+r*r<=1},Ra=function(e,r,a,n,i,o,s){var u=[a-e,n-r],l=[e-i,r-o],f=u[0]*u[0]+u[1]*u[1],v=2*(l[0]*u[0]+l[1]*u[1]),c=l[0]*l[0]+l[1]*l[1]-s*s,h=v*v-4*f*c;if(h<0)return[];var d=(-v+Math.sqrt(h))/(2*f),p=(-v-Math.sqrt(h))/(2*f),y=Math.min(d,p),g=Math.max(d,p),b=[];if(y>=0&&y<=1&&b.push(y),g>=0&&g<=1&&b.push(g),b.length===0)return[];var m=b[0]*u[0]+e,w=b[0]*u[1]+r;if(b.length>1){if(b[0]==b[1])return[m,w];var T=b[1]*u[0]+e,D=b[1]*u[1]+r;return[m,w,T,D]}else return[m,w]},Ui=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},hr=function(e,r,a,n,i,o,s,u,l){var f=e-i,v=a-e,c=s-i,h=r-o,d=n-r,p=u-o,y=c*h-p*f,g=v*h-d*f,b=p*v-c*d;if(b!==0){var m=y/b,w=g/b,T=.001,D=0-T,x=1+T;return D<=m&&m<=x&&D<=w&&w<=x?[e+m*v,r+m*d]:l?[e+m*v,r+m*d]:[]}else return y===0||g===0?Ui(e,a,s)===s?[s,u]:Ui(e,a,i)===i?[i,o]:Ui(i,s,a)===a?[a,n]:[]:[]},Wc=function(e,r,a,n,i){var o=[],s=n/2,u=i/2,l=r,f=a;o.push({x:l+s*e[0],y:f+u*e[1]});for(var v=1;v<e.length/2;v++)o.push({x:l+s*e[v*2],y:f+u*e[v*2+1]});return o},Na=function(e,r,a,n,i,o,s,u){var l=[],f,v=new Array(a.length),c=!0;o==null&&(c=!1);var h;if(c){for(var d=0;d<v.length/2;d++)v[d*2]=a[d*2]*o+n,v[d*2+1]=a[d*2+1]*s+i;if(u>0){var p=bn(v,-u);h=mn(p)}else h=v}else h=a;for(var y,g,b,m,w=0;w<h.length/2;w++)y=h[w*2],g=h[w*2+1],w<h.length/2-1?(b=h[(w+1)*2],m=h[(w+1)*2+1]):(b=h[0],m=h[1]),f=hr(e,r,n,i,y,g,b,m),f.length!==0&&l.push(f[0],f[1]);return l},Xc=function(e,r,a,n,i,o,s,u,l){var f=[],v,c=new Array(a.length*2);l.forEach(function(b,m){m===0?(c[c.length-2]=b.startX,c[c.length-1]=b.startY):(c[m*4-2]=b.startX,c[m*4-1]=b.startY),c[m*4]=b.stopX,c[m*4+1]=b.stopY,v=Ra(e,r,n,i,b.cx,b.cy,b.radius),v.length!==0&&f.push(v[0],v[1])});for(var h=0;h<c.length/4;h++)v=hr(e,r,n,i,c[h*4],c[h*4+1],c[h*4+2],c[h*4+3],!1),v.length!==0&&f.push(v[0],v[1]);if(f.length>2){for(var d=[f[0],f[1]],p=Math.pow(d[0]-e,2)+Math.pow(d[1]-r,2),y=1;y<f.length/2;y++){var g=Math.pow(f[y*2]-e,2)+Math.pow(f[y*2+1]-r,2);g<=p&&(d[0]=f[y*2],d[1]=f[y*2+1],p=g)}return d}return f},wn=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),o=(i-a)/i;return o<0&&(o=1e-5),[r[0]+o*n[0],r[1]+o*n[1]]},Nt=function(e,r){var a=Hi(e,r);return a=Mu(a),a},Mu=function(e){for(var r,a,n=e.length/2,i=1/0,o=1/0,s=-1/0,u=-1/0,l=0;l<n;l++)r=e[2*l],a=e[2*l+1],i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);for(var f=2/(s-i),v=2/(u-o),c=0;c<n;c++)r=e[2*c]=e[2*c]*f,a=e[2*c+1]=e[2*c+1]*v,i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);if(o<-1)for(var h=0;h<n;h++)a=e[2*h+1]=e[2*h+1]+(-1-o);return e},Hi=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*a+n,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},cr=function(e,r){return Math.min(e/4,r/4,8)},Ru=function(e,r){return Math.min(e/10,r/10,8)},qi=function(){return 8},$c=function(e,r,a){return[e-2*r+a,2*(r-e),e]},Yi=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Wi(t,e){function r(v){for(var c=[],h=0;h<v.length;h++){var d=v[h],p=v[(h+1)%v.length],y={x:p.x-d.x,y:p.y-d.y},g={x:-y.y,y:y.x},b=Math.sqrt(g.x*g.x+g.y*g.y);c.push({x:g.x/b,y:g.y/b})}return c}function a(v,c){var h=1/0,d=-1/0,p=Ot(v),y;try{for(p.s();!(y=p.n()).done;){var g=y.value,b=g.x*c.x+g.y*c.y;h=Math.min(h,b),d=Math.max(d,b)}}catch(m){p.e(m)}finally{p.f()}return{min:h,max:d}}function n(v,c){return!(v.max<c.min||c.max<v.min)}var i=[].concat(an(r(t)),an(r(e))),o=Ot(i),s;try{for(o.s();!(s=o.n()).done;){var u=s.value,l=a(t,u),f=a(e,u);if(!n(l,f))return!1}}catch(v){o.e(v)}finally{o.f()}return!0}var Kc=xt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),_c={pageRank:function(e){for(var r=Kc(e),a=r.dampingFactor,n=r.precision,i=r.iterations,o=r.weight,s=this._private.cy,u=this.byGroup(),l=u.nodes,f=u.edges,v=l.length,c=v*v,h=f.length,d=new Array(c),p=new Array(v),y=(1-a)/v,g=0;g<v;g++){for(var b=0;b<v;b++){var m=g*v+b;d[m]=0}p[g]=0}for(var w=0;w<h;w++){var T=f[w],D=T.data("source"),x=T.data("target");if(D!==x){var M=l.indexOfId(D),P=l.indexOfId(x),N=o(T),O=P*v+M;d[O]+=N,p[M]+=N}}for(var R=1/v+y,I=0;I<v;I++)if(p[I]===0)for(var E=0;E<v;E++){var A=E*v+I;d[A]=R}else for(var S=0;S<v;S++){var C=S*v+I;d[C]=d[C]/p[I]+y}for(var L=new Array(v),z=new Array(v),k,F=0;F<v;F++)L[F]=1;for(var H=0;H<i;H++){for(var W=0;W<v;W++)z[W]=0;for(var Q=0;Q<v;Q++)for(var K=0;K<v;K++){var Z=Q*v+K;z[Q]+=d[Z]*L[K]}Mc(z),k=L,L=z,z=k;for(var j=0,re=0;re<v;re++){var q=k[re]-L[re];j+=q*q}if(j<n)break}var U={rank:function(X){return X=s.collection(X)[0],L[l.indexOf(X)]}};return U}},Nu=xt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),_r={degreeCentralityNormalized:function(e){e=Nu(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},v={},c=0,h=0,d=0;d<n;d++){var p=a[d],y=p.id();e.root=p;var g=this.degreeCentrality(e);c<g.indegree&&(c=g.indegree),h<g.outdegree&&(h=g.outdegree),f[y]=g.indegree,v[y]=g.outdegree}return{indegree:function(m){return c==0?0:(Ne(m)&&(m=r.filter(m)),f[m.id()]/c)},outdegree:function(m){return h===0?0:(Ne(m)&&(m=r.filter(m)),v[m.id()]/h)}}}else{for(var i={},o=0,s=0;s<n;s++){var u=a[s];e.root=u;var l=this.degreeCentrality(e);o<l.degree&&(o=l.degree),i[u.id()]=l.degree}return{degree:function(m){return o===0?0:(Ne(m)&&(m=r.filter(m)),i[m.id()]/o)}}}},degreeCentrality:function(e){e=Nu(e);var r=this.cy(),a=this,n=e,i=n.root,o=n.weight,s=n.directed,u=n.alpha;if(i=r.collection(i)[0],s){for(var h=i.connectedEdges(),d=h.filter(function(D){return D.target().same(i)&&a.has(D)}),p=h.filter(function(D){return D.source().same(i)&&a.has(D)}),y=d.length,g=p.length,b=0,m=0,w=0;w<d.length;w++)b+=o(d[w]);for(var T=0;T<p.length;T++)m+=o(p[T]);return{indegree:Math.pow(y,1-u)*Math.pow(b,u),outdegree:Math.pow(g,1-u)*Math.pow(m,u)}}else{for(var l=i.connectedEdges().intersection(a),f=l.length,v=0,c=0;c<l.length;c++)v+=o(l[c]);return{degree:Math.pow(f,1-u)*Math.pow(v,u)}}}};_r.dc=_r.degreeCentrality,_r.dcn=_r.degreeCentralityNormalised=_r.degreeCentralityNormalized;var Pu=xt({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Zr={closenessCentralityNormalized:function(e){for(var r=Pu(e),a=r.harmonic,n=r.weight,i=r.directed,o=this.cy(),s={},u=0,l=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),v=0;v<l.length;v++){for(var c=0,h=l[v],d=0;d<l.length;d++)if(v!==d){var p=f.distance(h,l[d]);a?c+=1/p:c+=p}a||(c=1/c),u<c&&(u=c),s[h.id()]=c}return{closeness:function(g){return u==0?0:(Ne(g)?g=o.filter(g)[0].id():g=g.id(),s[g]/u)}}},closenessCentrality:function(e){var r=Pu(e),a=r.root,n=r.weight,i=r.directed,o=r.harmonic;a=this.filter(a)[0];for(var s=this.dijkstra({root:a,weight:n,directed:i}),u=0,l=this.nodes(),f=0;f<l.length;f++){var v=l[f];if(!v.same(a)){var c=s.distanceTo(v);o?u+=1/c:u+=c}}return o?u:1/u}};Zr.cc=Zr.closenessCentrality,Zr.ccn=Zr.closenessCentralityNormalised=Zr.closenessCentralityNormalized;var Zc=xt({weight:null,directed:!1}),Xi={betweennessCentrality:function(e){for(var r=Zc(e),a=r.directed,n=r.weight,i=n!=null,o=this.cy(),s=this.nodes(),u={},l={},f=0,v={set:function(m,w){l[m]=w,w>f&&(f=w)},get:function(m){return l[m]}},c=0;c<s.length;c++){var h=s[c],d=h.id();a?u[d]=h.outgoers().nodes():u[d]=h.openNeighborhood().nodes(),v.set(d,0)}for(var p=function(){for(var m=s[y].id(),w=[],T={},D={},x={},M=new La(function(Q,K){return x[Q]-x[K]}),P=0;P<s.length;P++){var N=s[P].id();T[N]=[],D[N]=0,x[N]=1/0}for(D[m]=1,x[m]=0,M.push(m);!M.empty();){var O=M.pop();if(w.push(O),i)for(var R=0;R<u[O].length;R++){var I=u[O][R],E=o.getElementById(O),A=void 0;E.edgesTo(I).length>0?A=E.edgesTo(I)[0]:A=I.edgesTo(E)[0];var S=n(A);I=I.id(),x[I]>x[O]+S&&(x[I]=x[O]+S,M.nodes.indexOf(I)<0?M.push(I):M.updateItem(I),D[I]=0,T[I]=[]),x[I]==x[O]+S&&(D[I]=D[I]+D[O],T[I].push(O))}else for(var C=0;C<u[O].length;C++){var L=u[O][C].id();x[L]==1/0&&(M.push(L),x[L]=x[O]+1),x[L]==x[O]+1&&(D[L]=D[L]+D[O],T[L].push(O))}}for(var z={},k=0;k<s.length;k++)z[s[k].id()]=0;for(;w.length>0;){for(var F=w.pop(),H=0;H<T[F].length;H++){var W=T[F][H];z[W]=z[W]+D[W]/D[F]*(1+z[F])}F!=s[y].id()&&v.set(F,v.get(F)+z[F])}},y=0;y<s.length;y++)p();var g={betweenness:function(m){var w=o.collection(m).id();return v.get(w)},betweennessNormalized:function(m){if(f==0)return 0;var w=o.collection(m).id();return v.get(w)/f}};return g.betweennessNormalised=g.betweennessNormalized,g}};Xi.bc=Xi.betweennessCentrality;var Qc=xt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),Jc=function(e){return Qc(e)},jc=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},ed=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},Ou=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var o=0;o<r;o++)e[o*r+n]=e[o*r+n]/a}},td=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var o=0;o<a;o++)n[i*a+o]=0;for(var s=0;s<a;s++)for(var u=0;u<a;u++)n[i*a+u]+=e[i*a+s]*r[s*a+u]}return n},rd=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=td(e,n,r);return e},ad=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return Ou(n,r),n},nd=function(e,r,a,n){for(var i=0;i<a;i++){var o=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),s=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(o!==s)return!1}return!0},id=function(e,r,a,n){for(var i=[],o=0;o<r;o++){for(var s=[],u=0;u<r;u++)Math.round(e[o*r+u]*1e3)/1e3>0&&s.push(a[u]);s.length!==0&&i.push(n.collection(s))}return i},od=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},sd=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&od(e[r],e[a])&&e.splice(a,1);return e},Iu=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=Jc(e),o={},s=0;s<r.length;s++)o[r[s].id()]=s;for(var u=r.length,l=u*u,f=new Array(l),v,c=0;c<l;c++)f[c]=0;for(var h=0;h<a.length;h++){var d=a[h],p=o[d.source().id()],y=o[d.target().id()],g=jc(d,i.attributes);f[p*u+y]+=g,f[y*u+p]+=g}ed(f,u,i.multFactor),Ou(f,u);for(var b=!0,m=0;b&&m<i.maxIterations;)b=!1,v=rd(f,u,i.expandFactor),f=ad(v,u,i.inflateFactor),nd(f,v,l,4)||(b=!0),m++;var w=id(f,u,r,n);return w=sd(w),w},ud={markovClustering:Iu,mcl:Iu},ld=function(e){return e},Bu=function(e,r){return Math.abs(r-e)},Fu=function(e,r,a){return e+Bu(r,a)},ku=function(e,r,a){return e+Math.pow(a-r,2)},fd=function(e){return Math.sqrt(e)},vd=function(e,r,a){return Math.max(e,Bu(r,a))},Pa=function(e,r,a,n,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:ld,s=n,u,l,f=0;f<e;f++)u=r(f),l=a(f),s=i(s,u,l);return o(s)},Qr={euclidean:function(e,r,a){return e>=2?Pa(e,r,a,0,ku,fd):Pa(e,r,a,0,Fu)},squaredEuclidean:function(e,r,a){return Pa(e,r,a,0,ku)},manhattan:function(e,r,a){return Pa(e,r,a,0,Fu)},max:function(e,r,a){return Pa(e,r,a,-1/0,vd)}};Qr["squared-euclidean"]=Qr.squaredEuclidean,Qr.squaredeuclidean=Qr.squaredEuclidean;function En(t,e,r,a,n,i){var o;return it(t)?o=t:o=Qr[t]||Qr.euclidean,e===0&&it(t)?o(n,i):o(e,r,a,n,i)}var hd=xt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),$i=function(e){return hd(e)},xn=function(e,r,a,n,i){var o=i!=="kMedoids",s=o?function(v){return a[v]}:function(v){return n[v](a)},u=function(c){return n[c](r)},l=a,f=r;return En(e,n.length,s,u,l,f)},Ki=function(e,r,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(r),u=null,l=0;l<n;l++)i[l]=e.min(a[l]).value,o[l]=e.max(a[l]).value;for(var f=0;f<r;f++){u=[];for(var v=0;v<n;v++)u[v]=Math.random()*(o[v]-i[v])+i[v];s[f]=u}return s},zu=function(e,r,a,n,i){for(var o=1/0,s=0,u=0;u<r.length;u++){var l=xn(a,e,r[u],n,i);l<o&&(o=l,s=u)}return s},Vu=function(e,r,a){for(var n=[],i=null,o=0;o<r.length;o++)i=r[o],a[i.id()]===e&&n.push(i);return n},cd=function(e,r,a){return Math.abs(r-e)<=a},dd=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var o=Math.abs(e[n][i]-r[n][i]);if(o>a)return!1}return!0},gd=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},Gu=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];gd(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var o=0;o<r;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},Uu=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=xn("manhattan",r[i],e,a,"kMedoids");return n},pd=function(e){var r=this.cy(),a=this.nodes(),n=null,i=$i(e),o=new Array(i.k),s={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=Ki(a,i.k,i.attributes)):ct(i.testCentroids)==="object"?u=i.testCentroids:u=Ki(a,i.k,i.attributes):u=Ki(a,i.k,i.attributes);for(var l=!0,f=0;l&&f<i.maxIterations;){for(var v=0;v<a.length;v++)n=a[v],s[n.id()]=zu(n,u,i.distance,i.attributes,"kMeans");l=!1;for(var c=0;c<i.k;c++){var h=Vu(c,a,s);if(h.length!==0){for(var d=i.attributes.length,p=u[c],y=new Array(d),g=new Array(d),b=0;b<d;b++){g[b]=0;for(var m=0;m<h.length;m++)n=h[m],g[b]+=i.attributes[b](n);y[b]=g[b]/h.length,cd(y[b],p[b],i.sensitivityThreshold)||(l=!0)}u[c]=y,o[c]=r.collection(h)}}f++}return o},yd=function(e){var r=this.cy(),a=this.nodes(),n=null,i=$i(e),o=new Array(i.k),s,u={},l,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(ct(i.testCentroids)==="object"?s=i.testCentroids:s=Gu(a,i.k)):s=Gu(a,i.k);for(var v=!0,c=0;v&&c<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],u[n.id()]=zu(n,s,i.distance,i.attributes,"kMedoids");v=!1;for(var d=0;d<s.length;d++){var p=Vu(d,a,u);if(p.length!==0){f[d]=Uu(s[d],p,i.attributes);for(var y=0;y<p.length;y++)l=Uu(p[y],p,i.attributes),l<f[d]&&(f[d]=l,s[d]=p[y],v=!0);o[d]=r.collection(p)}}c++}return o},md=function(e,r,a,n,i){for(var o,s,u=0;u<r.length;u++)for(var l=0;l<e.length;l++)n[u][l]=Math.pow(a[u][l],i.m);for(var f=0;f<e.length;f++)for(var v=0;v<i.attributes.length;v++){o=0,s=0;for(var c=0;c<r.length;c++)o+=n[c][f]*i.attributes[v](r[c]),s+=n[c][f];e[f][v]=o/s}},bd=function(e,r,a,n,i){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var s,u,l,f=2/(i.m-1),v=0;v<a.length;v++)for(var c=0;c<n.length;c++){s=0;for(var h=0;h<a.length;h++)u=xn(i.distance,n[c],a[v],i.attributes,"cmeans"),l=xn(i.distance,n[c],a[h],i.attributes,"cmeans"),s+=Math.pow(u/l,f);e[c][v]=1/s}},wd=function(e,r,a,n){for(var i=new Array(a.k),o=0;o<i.length;o++)i[o]=[];for(var s,u,l=0;l<r.length;l++){s=-1/0,u=-1;for(var f=0;f<r[0].length;f++)r[l][f]>s&&(s=r[l][f],u=f);i[u].push(e[l])}for(var v=0;v<i.length;v++)i[v]=n.collection(i[v]);return i},Hu=function(e){var r=this.cy(),a=this.nodes(),n=$i(e),i,o,s,u,l;u=new Array(a.length);for(var f=0;f<a.length;f++)u[f]=new Array(n.k);s=new Array(a.length);for(var v=0;v<a.length;v++)s[v]=new Array(n.k);for(var c=0;c<a.length;c++){for(var h=0,d=0;d<n.k;d++)s[c][d]=Math.random(),h+=s[c][d];for(var p=0;p<n.k;p++)s[c][p]=s[c][p]/h}o=new Array(n.k);for(var y=0;y<n.k;y++)o[y]=new Array(n.attributes.length);l=new Array(a.length);for(var g=0;g<a.length;g++)l[g]=new Array(n.k);for(var b=!0,m=0;b&&m<n.maxIterations;)b=!1,md(o,a,s,l,n),bd(s,u,o,a,n),dd(s,u,n.sensitivityThreshold)||(b=!0),m++;return i=wd(a,s,n,r),{clusters:i,degreeOfMembership:s}},Ed={kMeans:pd,kMedoids:yd,fuzzyCMeans:Hu,fcm:Hu},xd=xt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Td={single:"min",complete:"max"},Cd=function(e){var r=xd(e),a=Td[r.linkage];return a!=null&&(r.linkage=a),r},qu=function(e,r,a,n,i){for(var o=0,s=1/0,u,l=i.attributes,f=function(P,N){return En(i.distance,l.length,function(O){return l[O](P)},function(O){return l[O](N)},P,N)},v=0;v<e.length;v++){var c=e[v].key,h=a[c][n[c]];h<s&&(o=c,s=h)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[o],p=r[n[o]],y;i.mode==="dendrogram"?y={left:d,right:p,key:d.key}:y={value:d.value.concat(p.value),key:d.key},e[d.index]=y,e.splice(p.index,1),r[d.key]=y;for(var g=0;g<e.length;g++){var b=e[g];d.key===b.key?u=1/0:i.linkage==="min"?(u=a[d.key][b.key],a[d.key][b.key]>a[p.key][b.key]&&(u=a[p.key][b.key])):i.linkage==="max"?(u=a[d.key][b.key],a[d.key][b.key]<a[p.key][b.key]&&(u=a[p.key][b.key])):i.linkage==="mean"?u=(a[d.key][b.key]*d.size+a[p.key][b.key]*p.size)/(d.size+p.size):i.mode==="dendrogram"?u=f(b.value,d.value):u=f(b.value[0],d.value[0]),a[d.key][b.key]=a[b.key][d.key]=u}for(var m=0;m<e.length;m++){var w=e[m].key;if(n[w]===d.key||n[w]===p.key){for(var T=w,D=0;D<e.length;D++){var x=e[D].key;a[w][x]<a[w][T]&&(T=x)}n[w]=T}e[m].index=m}return d.key=p.key=d.index=p.index=null,!0},Jr=function(e,r,a){e&&(e.value?r.push(e.value):(e.left&&Jr(e.left,r),e.right&&Jr(e.right,r)))},_i=function(e,r){if(!e)return"";if(e.left&&e.right){var a=_i(e.left,r),n=_i(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Zi=function(e,r,a){if(!e)return[];var n=[],i=[],o=[];return r===0?(e.left&&Jr(e.left,n),e.right&&Jr(e.right,i),o=n.concat(i),[a.collection(o)]):r===1?e.value?[a.collection(e.value)]:(e.left&&Jr(e.left,n),e.right&&Jr(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=Zi(e.left,r-1,a)),e.right&&(i=Zi(e.right,r-1,a)),n.concat(i))},Yu=function(e){for(var r=this.cy(),a=this.nodes(),n=Cd(e),i=n.attributes,o=function(m,w){return En(n.distance,i.length,function(T){return i[T](m)},function(T){return i[T](w)},m,w)},s=[],u=[],l=[],f=[],v=0;v<a.length;v++){var c={value:n.mode==="dendrogram"?a[v]:[a[v]],key:v,index:v};s[v]=c,f[v]=c,u[v]=[],l[v]=0}for(var h=0;h<s.length;h++)for(var d=0;d<=h;d++){var p=void 0;n.mode==="dendrogram"?p=h===d?1/0:o(s[h].value,s[d].value):p=h===d?1/0:o(s[h].value[0],s[d].value[0]),u[h][d]=p,u[d][h]=p,p<u[h][l[h]]&&(l[h]=d)}for(var y=qu(s,f,u,l,n);y;)y=qu(s,f,u,l,n);var g;return n.mode==="dendrogram"?(g=Zi(s[0],n.dendrogramDepth,r),n.addDendrogram&&_i(s[0],r)):(g=new Array(s.length),s.forEach(function(b,m){b.key=b.index=null,g[m]=r.collection(b.value)})),g},Sd={hierarchicalClustering:Yu,hca:Yu},Ad=xt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Dd=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||at("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||be(a)||at("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),Ad(e)},Ld=function(e,r,a,n){var i=function(s,u){return n[u](s)};return-En(e,n.length,function(o){return i(r,o)},function(o){return i(a,o)},r,a)},Md=function(e,r){var a=null;return r==="median"?a=Ac(e):r==="mean"?a=Sc(e):r==="min"?a=Tc(e):r==="max"?a=Cc(e):a=r,a},Rd=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},Wu=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var o=-1,s=-1/0,u=0;u<a.length;u++){var l=a[u];r[i*e+l]>s&&(o=l,s=r[i*e+l])}o>0&&n.push(o)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},Nd=function(e,r,a){for(var n=Wu(e,r,a),i=0;i<a.length;i++){for(var o=[],s=0;s<n.length;s++)n[s]===a[i]&&o.push(s);for(var u=-1,l=-1/0,f=0;f<o.length;f++){for(var v=0,c=0;c<o.length;c++)v+=r[o[c]*e+o[f]];v>l&&(u=f,l=v)}a[i]=o[u]}return n=Wu(e,r,a),n},Xu=function(e){for(var r=this.cy(),a=this.nodes(),n=Dd(e),i={},o=0;o<a.length;o++)i[a[o].id()]=o;var s,u,l,f,v,c;s=a.length,u=s*s,l=new Array(u);for(var h=0;h<u;h++)l[h]=-1/0;for(var d=0;d<s;d++)for(var p=0;p<s;p++)d!==p&&(l[d*s+p]=Ld(n.distance,a[d],a[p],n.attributes));f=Md(l,n.preference);for(var y=0;y<s;y++)l[y*s+y]=f;v=new Array(u);for(var g=0;g<u;g++)v[g]=0;c=new Array(u);for(var b=0;b<u;b++)c[b]=0;for(var m=new Array(s),w=new Array(s),T=new Array(s),D=0;D<s;D++)m[D]=0,w[D]=0,T[D]=0;for(var x=new Array(s*n.minIterations),M=0;M<x.length;M++)x[M]=0;var P;for(P=0;P<n.maxIterations;P++){for(var N=0;N<s;N++){for(var O=-1/0,R=-1/0,I=-1,E=0,A=0;A<s;A++)m[A]=v[N*s+A],E=c[N*s+A]+l[N*s+A],E>=O?(R=O,O=E,I=A):E>R&&(R=E);for(var S=0;S<s;S++)v[N*s+S]=(1-n.damping)*(l[N*s+S]-O)+n.damping*m[S];v[N*s+I]=(1-n.damping)*(l[N*s+I]-R)+n.damping*m[I]}for(var C=0;C<s;C++){for(var L=0,z=0;z<s;z++)m[z]=c[z*s+C],w[z]=Math.max(0,v[z*s+C]),L+=w[z];L-=w[C],w[C]=v[C*s+C],L+=w[C];for(var k=0;k<s;k++)c[k*s+C]=(1-n.damping)*Math.min(0,L-w[k])+n.damping*m[k];c[C*s+C]=(1-n.damping)*(L-w[C])+n.damping*m[C]}for(var F=0,H=0;H<s;H++){var W=c[H*s+H]+v[H*s+H]>0?1:0;x[P%n.minIterations*s+H]=W,F+=W}if(F>0&&(P>=n.minIterations-1||P==n.maxIterations-1)){for(var Q=0,K=0;K<s;K++){T[K]=0;for(var Z=0;Z<n.minIterations;Z++)T[K]+=x[Z*s+K];(T[K]===0||T[K]===n.minIterations)&&Q++}if(Q===s)break}}for(var j=Rd(s,v,c),re=Nd(s,l,j),q={},U=0;U<j.length;U++)q[j[U]]=[];for(var Y=0;Y<a.length;Y++){var X=i[a[Y].id()],ee=re[X];ee!=null&&q[ee].push(a[Y])}for(var te=new Array(j.length),ge=0;ge<j.length;ge++)te[ge]=r.collection(q[j[ge]]);return te},Pd={affinityPropagation:Xu,ap:Xu},Od=xt({root:void 0,directed:!1}),Id={hierholzer:function(e){if(!Ue(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=Od(e),n=a.root,i=a.directed,o=this,s=!1,u,l,f;n&&(f=Ne(n)?this.filter(n)[0].id():n[0].id());var v={},c={};i?o.forEach(function(b){var m=b.id();if(b.isNode()){var w=b.indegree(!0),T=b.outdegree(!0),D=w-T,x=T-w;D==1?u?s=!0:u=m:x==1?l?s=!0:l=m:(x>1||D>1)&&(s=!0),v[m]=[],b.outgoers().forEach(function(M){M.isEdge()&&v[m].push(M.id())})}else c[m]=[void 0,b.target().id()]}):o.forEach(function(b){var m=b.id();if(b.isNode()){var w=b.degree(!0);w%2&&(u?l?s=!0:l=m:u=m),v[m]=[],b.connectedEdges().forEach(function(T){return v[m].push(T.id())})}else c[m]=[b.source().id(),b.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(l&&u)if(i){if(f&&l!=f)return h;f=l}else{if(f&&l!=f&&u!=f)return h;f||(f=l)}else f||(f=o[0].id());var d=function(m){for(var w=m,T=[m],D,x,M;v[w].length;)D=v[w].shift(),x=c[D][0],M=c[D][1],w!=M?(v[M]=v[M].filter(function(P){return P!=D}),w=M):!i&&w!=x&&(v[x]=v[x].filter(function(P){return P!=D}),w=x),T.unshift(D),T.unshift(w);return T},p=[],y=[];for(y=d(f);y.length!=1;)v[y[0]].length==0?(p.unshift(o.getElementById(y.shift())),p.unshift(o.getElementById(y.shift()))):y=d(y.shift()).concat(y);p.unshift(o.getElementById(y.shift()));for(var g in v)if(v[g].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Tn=function(){var e=this,r={},a=0,n=0,i=[],o=[],s={},u=function(c,h){for(var d=o.length-1,p=[],y=e.spawn();o[d].x!=c||o[d].y!=h;)p.push(o.pop().edge),d--;p.push(o.pop().edge),p.forEach(function(g){var b=g.connectedNodes().intersection(e);y.merge(g),b.forEach(function(m){var w=m.id(),T=m.connectedEdges().intersection(e);y.merge(m),r[w].cutVertex?y.merge(T.filter(function(D){return D.isLoop()})):y.merge(T)})}),i.push(y)},l=function(c,h,d){c===d&&(n+=1),r[h]={id:a,low:a++,cutVertex:!1};var p=e.getElementById(h).connectedEdges().intersection(e);if(p.size()===0)i.push(e.spawn(e.getElementById(h)));else{var y,g,b,m;p.forEach(function(w){y=w.source().id(),g=w.target().id(),b=y===h?g:y,b!==d&&(m=w.id(),s[m]||(s[m]=!0,o.push({x:h,y:b,edge:w})),b in r?r[h].low=Math.min(r[h].low,r[b].id):(l(c,b,h),r[h].low=Math.min(r[h].low,r[b].low),r[h].id<=r[b].low&&(r[h].cutVertex=!0,u(h,b))))})}};e.forEach(function(v){if(v.isNode()){var c=v.id();c in r||(n=0,l(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(v){return r[v].cutVertex}).map(function(v){return e.getElementById(v)});return{cut:e.spawn(f),components:i}},Bd={hopcroftTarjanBiconnected:Tn,htbc:Tn,htb:Tn,hopcroftTarjanBiconnectedComponents:Tn},Cn=function(){var e=this,r={},a=0,n=[],i=[],o=e.spawn(e),s=function(l){i.push(l),r[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(p){var y=p.target().id();y!==l&&(y in r||s(y),r[y].explored||(r[l].low=Math.min(r[l].low,r[y].low)))}),r[l].index===r[l].low){for(var v=e.spawn();;){var c=i.pop();if(v.merge(e.getElementById(c)),r[c].low=r[l].index,r[c].explored=!0,c===l)break}var h=v.edgesWith(v),d=v.merge(h);n.push(d),o=o.difference(d)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in r||s(l)}}),{cut:o,components:n}},Fd={tarjanStronglyConnected:Cn,tsc:Cn,tscc:Cn,tarjanStronglyConnectedComponents:Cn},$u={};[Da,vc,hc,dc,pc,mc,Ec,_c,_r,Zr,Xi,ud,Ed,Sd,Pd,Id,Bd,Fd].forEach(function(t){Oe($u,t)});/*!
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 Ku=0,_u=1,Zu=2,Ut=function(e){if(!(this instanceof Ut))return new Ut(e);this.id="Thenable/1.0.7",this.state=Ku,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Ut.prototype={fulfill:function(e){return Qu(this,_u,"fulfillValue",e)},reject:function(e){return Qu(this,Zu,"rejectReason",e)},then:function(e,r){var a=this,n=new Ut;return a.onFulfilled.push(el(e,n,"fulfill")),a.onRejected.push(el(r,n,"reject")),Ju(a),n.proxy}};var Qu=function(e,r,a,n){return e.state===Ku&&(e.state=r,e[a]=n,Ju(e)),e},Ju=function(e){e.state===_u?ju(e,"onFulfilled",e.fulfillValue):e.state===Zu&&ju(e,"onRejected",e.rejectReason)},ju=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var s=0;s<n.length;s++)n[s](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},el=function(e,r,a){return function(n){if(typeof e!="function")r[a].call(r,n);else{var i;try{i=e(n)}catch(o){r.reject(o);return}tl(r,i)}}},tl=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(ct(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(r,function(i){n||(n=!0,i===r?e.reject(new TypeError("circular thenable chain")):tl(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(r)};Ut.all=function(t){return new Ut(function(e,r){for(var a=new Array(t.length),n=0,i=function(u,l){a[u]=l,n++,n===t.length&&e(a)},o=0;o<t.length;o++)(function(s){var u=t[s],l=u!=null&&u.then!=null;if(l)u.then(function(v){i(s,v)},function(v){r(v)});else{var f=u;i(s,f)}})(o)})},Ut.resolve=function(t){return new Ut(function(e,r){e(t)})},Ut.reject=function(t){return new Ut(function(e,r){r(t)})};var jr=typeof Promise<"u"?Promise:Ut,Qi=function(e,r,a){var n=di(e),i=!n,o=this._private=Oe({duration:1e3},r,a);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&it(o.complete)&&o.completes.push(o.complete),i){var s=e.position();o.startPosition=o.startPosition||{x:s.x,y:s.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(n){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},Pr=Qi.prototype;Oe(Pr,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),Ft(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(l,f){var v=e[l];v!=null&&(e[l]=e[f],e[f]=v)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[n]=s}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new jr(function(n,i){a.push(function(){n()})})}}),Pr.complete=Pr.completed,Pr.run=Pr.play,Pr.running=Pr.playing;var kd={animated:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=n[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<n.length;o++){var s=n[o];s._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this,u=!i,l=!u;if(!s.styleEnabled())return this;var f=s.style();r=Oe({},r,a);var v=Object.keys(r).length===0;if(v)return new Qi(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(l&&(r.style=f.getPropsList(r.style||r.css),r.css=void 0),l&&r.renderedPosition!=null){var c=r.renderedPosition,h=s.pan(),d=s.zoom();r.position=xu(c,d,h)}if(u&&r.panBy!=null){var p=r.panBy,y=s.pan();r.pan={x:y.x+p.x,y:y.y+p.y}}var g=r.center||r.centre;if(u&&g!=null){var b=s.getCenterPan(g.eles,r.zoom);b!=null&&(r.pan=b)}if(u&&r.fit!=null){var m=r.fit,w=s.getFitViewport(m.eles||m.boundingBox,m.padding);w!=null&&(r.pan=w.pan,r.zoom=w.zoom)}if(u&&Ue(r.zoom)){var T=s.getZoomedViewport(r.zoom);T!=null?(T.zoomed&&(r.zoom=T.zoom),T.panned&&(r.pan=T.pan)):r.zoom=null}return new Qi(o[0],r)}},animate:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;a&&(r=Oe({},r,a));for(var u=0;u<o.length;u++){var l=o[u],f=l.animated()&&(r.queue===void 0||r.queue),v=l.animation(r,f?{queue:!0}:void 0);v.play()}return this}},stop:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var u=0;u<o.length;u++){for(var l=o[u],f=l._private,v=f.animation.current,c=0;c<v.length;c++){var h=v[c],d=h._private;a&&(d.duration=0)}r&&(f.animation.queue=[]),a||(f.animation.current=[])}return s.notify("draw"),this}}},Ji,rl;function Sn(){if(rl)return Ji;rl=1;var t=Array.isArray;return Ji=t,Ji}var ji,al;function zd(){if(al)return ji;al=1;var t=Sn(),e=Ta(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function n(i,o){if(t(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:a.test(i)||!r.test(i)||o!=null&&i in Object(o)}return ji=n,ji}var eo,nl;function Vd(){if(nl)return eo;nl=1;var t=au(),e=xa(),r="[object AsyncFunction]",a="[object Function]",n="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=t(s);return u==a||u==n||u==r||u==i}return eo=o,eo}var to,il;function Gd(){if(il)return to;il=1;var t=un(),e=t["__core-js_shared__"];return to=e,to}var ro,ol;function Ud(){if(ol)return ro;ol=1;var t=Gd(),e=function(){var a=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""}();function r(a){return!!e&&e in a}return ro=r,ro}var ao,sl;function Hd(){if(sl)return ao;sl=1;var t=Function.prototype,e=t.toString;function r(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return ao=r,ao}var no,ul;function qd(){if(ul)return no;ul=1;var t=Vd(),e=Ud(),r=xa(),a=Hd(),n=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,f=RegExp("^"+u.call(l).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function v(c){if(!r(c)||e(c))return!1;var h=t(c)?f:i;return h.test(a(c))}return no=v,no}var io,ll;function Yd(){if(ll)return io;ll=1;function t(e,r){return e==null?void 0:e[r]}return io=t,io}var oo,fl;function so(){if(fl)return oo;fl=1;var t=qd(),e=Yd();function r(a,n){var i=e(a,n);return t(i)?i:void 0}return oo=r,oo}var uo,vl;function An(){if(vl)return uo;vl=1;var t=so(),e=t(Object,"create");return uo=e,uo}var lo,hl;function Wd(){if(hl)return lo;hl=1;var t=An();function e(){this.__data__=t?t(null):{},this.size=0}return lo=e,lo}var fo,cl;function Xd(){if(cl)return fo;cl=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return fo=t,fo}var vo,dl;function $d(){if(dl)return vo;dl=1;var t=An(),e="__lodash_hash_undefined__",r=Object.prototype,a=r.hasOwnProperty;function n(i){var o=this.__data__;if(t){var s=o[i];return s===e?void 0:s}return a.call(o,i)?o[i]:void 0}return vo=n,vo}var ho,gl;function Kd(){if(gl)return ho;gl=1;var t=An(),e=Object.prototype,r=e.hasOwnProperty;function a(n){var i=this.__data__;return t?i[n]!==void 0:r.call(i,n)}return ho=a,ho}var co,pl;function _d(){if(pl)return co;pl=1;var t=An(),e="__lodash_hash_undefined__";function r(a,n){var i=this.__data__;return this.size+=this.has(a)?0:1,i[a]=t&&n===void 0?e:n,this}return co=r,co}var go,yl;function Zd(){if(yl)return go;yl=1;var t=Wd(),e=Xd(),r=$d(),a=Kd(),n=_d();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,go=i,go}var po,ml;function Qd(){if(ml)return po;ml=1;function t(){this.__data__=[],this.size=0}return po=t,po}var yo,bl;function wl(){if(bl)return yo;bl=1;function t(e,r){return e===r||e!==e&&r!==r}return yo=t,yo}var mo,El;function Dn(){if(El)return mo;El=1;var t=wl();function e(r,a){for(var n=r.length;n--;)if(t(r[n][0],a))return n;return-1}return mo=e,mo}var bo,xl;function Jd(){if(xl)return bo;xl=1;var t=Dn(),e=Array.prototype,r=e.splice;function a(n){var i=this.__data__,o=t(i,n);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():r.call(i,o,1),--this.size,!0}return bo=a,bo}var wo,Tl;function jd(){if(Tl)return wo;Tl=1;var t=Dn();function e(r){var a=this.__data__,n=t(a,r);return n<0?void 0:a[n][1]}return wo=e,wo}var Eo,Cl;function eg(){if(Cl)return Eo;Cl=1;var t=Dn();function e(r){return t(this.__data__,r)>-1}return Eo=e,Eo}var xo,Sl;function tg(){if(Sl)return xo;Sl=1;var t=Dn();function e(r,a){var n=this.__data__,i=t(n,r);return i<0?(++this.size,n.push([r,a])):n[i][1]=a,this}return xo=e,xo}var To,Al;function rg(){if(Al)return To;Al=1;var t=Qd(),e=Jd(),r=jd(),a=eg(),n=tg();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,To=i,To}var Co,Dl;function ag(){if(Dl)return Co;Dl=1;var t=so(),e=un(),r=t(e,"Map");return Co=r,Co}var So,Ll;function ng(){if(Ll)return So;Ll=1;var t=Zd(),e=rg(),r=ag();function a(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return So=a,So}var Ao,Ml;function ig(){if(Ml)return Ao;Ml=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Ao=t,Ao}var Do,Rl;function Ln(){if(Rl)return Do;Rl=1;var t=ig();function e(r,a){var n=r.__data__;return t(a)?n[typeof a=="string"?"string":"hash"]:n.map}return Do=e,Do}var Lo,Nl;function og(){if(Nl)return Lo;Nl=1;var t=Ln();function e(r){var a=t(this,r).delete(r);return this.size-=a?1:0,a}return Lo=e,Lo}var Mo,Pl;function sg(){if(Pl)return Mo;Pl=1;var t=Ln();function e(r){return t(this,r).get(r)}return Mo=e,Mo}var Ro,Ol;function ug(){if(Ol)return Ro;Ol=1;var t=Ln();function e(r){return t(this,r).has(r)}return Ro=e,Ro}var No,Il;function lg(){if(Il)return No;Il=1;var t=Ln();function e(r,a){var n=t(this,r),i=n.size;return n.set(r,a),this.size+=n.size==i?0:1,this}return No=e,No}var Po,Bl;function fg(){if(Bl)return Po;Bl=1;var t=ng(),e=og(),r=sg(),a=ug(),n=lg();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,Po=i,Po}var Oo,Fl;function vg(){if(Fl)return Oo;Fl=1;var t=fg(),e="Expected a function";function r(a,n){if(typeof a!="function"||n!=null&&typeof n!="function")throw new TypeError(e);var i=function(){var o=arguments,s=n?n.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=a.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(r.Cache||t),i}return r.Cache=t,Oo=r,Oo}var Io,kl;function hg(){if(kl)return Io;kl=1;var t=vg(),e=500;function r(a){var n=t(a,function(o){return i.size===e&&i.clear(),o}),i=n.cache;return n}return Io=r,Io}var Bo,zl;function Vl(){if(zl)return Bo;zl=1;var t=hg(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=t(function(n){var i=[];return n.charCodeAt(0)===46&&i.push(""),n.replace(e,function(o,s,u,l){i.push(u?l.replace(r,"$1"):s||o)}),i});return Bo=a,Bo}var Fo,Gl;function Ul(){if(Gl)return Fo;Gl=1;function t(e,r){for(var a=-1,n=e==null?0:e.length,i=Array(n);++a<n;)i[a]=r(e[a],a,e);return i}return Fo=t,Fo}var ko,Hl;function cg(){if(Hl)return ko;Hl=1;var t=Ti(),e=Ul(),r=Sn(),a=Ta(),n=t?t.prototype:void 0,i=n?n.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return e(s,o)+"";if(a(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return ko=o,ko}var zo,ql;function Yl(){if(ql)return zo;ql=1;var t=cg();function e(r){return r==null?"":t(r)}return zo=e,zo}var Vo,Wl;function Xl(){if(Wl)return Vo;Wl=1;var t=Sn(),e=zd(),r=Vl(),a=Yl();function n(i,o){return t(i)?i:e(i,o)?[i]:r(a(i))}return Vo=n,Vo}var Go,$l;function Uo(){if($l)return Go;$l=1;var t=Ta();function e(r){if(typeof r=="string"||t(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return Go=e,Go}var Ho,Kl;function dg(){if(Kl)return Ho;Kl=1;var t=Xl(),e=Uo();function r(a,n){n=t(n,a);for(var i=0,o=n.length;a!=null&&i<o;)a=a[e(n[i++])];return i&&i==o?a:void 0}return Ho=r,Ho}var qo,_l;function gg(){if(_l)return qo;_l=1;var t=dg();function e(r,a,n){var i=r==null?void 0:t(r,a);return i===void 0?n:i}return qo=e,qo}var pg=gg(),yg=Ea(pg),Yo,Zl;function mg(){if(Zl)return Yo;Zl=1;var t=so(),e=function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}}();return Yo=e,Yo}var Wo,Ql;function bg(){if(Ql)return Wo;Ql=1;var t=mg();function e(r,a,n){a=="__proto__"&&t?t(r,a,{configurable:!0,enumerable:!0,value:n,writable:!0}):r[a]=n}return Wo=e,Wo}var Xo,Jl;function wg(){if(Jl)return Xo;Jl=1;var t=bg(),e=wl(),r=Object.prototype,a=r.hasOwnProperty;function n(i,o,s){var u=i[o];(!(a.call(i,o)&&e(u,s))||s===void 0&&!(o in i))&&t(i,o,s)}return Xo=n,Xo}var $o,jl;function Eg(){if(jl)return $o;jl=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(a,n){var i=typeof a;return n=n??t,!!n&&(i=="number"||i!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<n}return $o=r,$o}var Ko,ef;function xg(){if(ef)return Ko;ef=1;var t=wg(),e=Xl(),r=Eg(),a=xa(),n=Uo();function i(o,s,u,l){if(!a(o))return o;s=e(s,o);for(var f=-1,v=s.length,c=v-1,h=o;h!=null&&++f<v;){var d=n(s[f]),p=u;if(d==="__proto__"||d==="constructor"||d==="prototype")return o;if(f!=c){var y=h[d];p=l?l(y,d,h):void 0,p===void 0&&(p=a(y)?y:r(s[f+1])?[]:{})}t(h,d,p),h=h[d]}return o}return Ko=i,Ko}var _o,tf;function Tg(){if(tf)return _o;tf=1;var t=xg();function e(r,a,n){return r==null?r:t(r,a,n)}return _o=e,_o}var Cg=Tg(),Sg=Ea(Cg),Zo,rf;function Ag(){if(rf)return Zo;rf=1;function t(e,r){var a=-1,n=e.length;for(r||(r=Array(n));++a<n;)r[a]=e[a];return r}return Zo=t,Zo}var Qo,af;function Dg(){if(af)return Qo;af=1;var t=Ul(),e=Ag(),r=Sn(),a=Ta(),n=Vl(),i=Uo(),o=Yl();function s(u){return r(u)?t(u,i):a(u)?[u]:e(n(o(u)))}return Qo=s,Qo}var Lg=Dg(),Mg=Ea(Lg),Rg={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,i){},onSet:function(n){},canSet:function(n){return!0}};return e=Oe({},r,e),function(n,i){var o=e,s=this,u=s.length!==void 0,l=u?s:[s],f=u?s[0]:s;if(Ne(n)){var v=n.indexOf(".")!==-1,c=v&&Mg(n);if(o.allowGetting&&i===void 0){var h;return f&&(o.beforeGet(f),c&&f._private[o.field][n]===void 0?h=yg(f._private[o.field],c):h=f._private[o.field][n]),h}else if(o.allowSetting&&i!==void 0){var d=!o.immutableKeys[n];if(d){var p=Is({},n,i);o.beforeSet(s,p);for(var y=0,g=l.length;y<g;y++){var b=l[y];o.canSet(b)&&(c&&f._private[o.field][n]===void 0?Sg(b._private[o.field],c,i):b._private[o.field][n]=i)}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&Ue(n)){var m=n,w,T,D=Object.keys(m);o.beforeSet(s,m);for(var x=0;x<D.length;x++){w=D[x],T=m[w];var M=!o.immutableKeys[w];if(M)for(var P=0;P<l.length;P++){var N=l[P];o.canSet(N)&&(N._private[o.field][w]=T)}}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&it(n)){var O=n;s.on(o.bindingEvent,O)}else if(o.allowGetting&&n===void 0){var R;return f&&(o.beforeGet(f),R=f._private[o.field]),R}return s}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=Oe({},r,e),function(n){var i=e,o=this,s=o.length!==void 0,u=s?o:[o];if(Ne(n)){for(var l=n.split(/\s+/),f=l.length,v=0;v<f;v++){var c=l[v];if(!sr(c)){var h=!i.immutableKeys[c];if(h)for(var d=0,p=u.length;d<p;d++)u[d]._private[i.field][c]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(n===void 0){for(var y=0,g=u.length;y<g;y++)for(var b=u[y]._private[i.field],m=Object.keys(b),w=0;w<m.length;w++){var T=m[w],D=!i.immutableKeys[T];D&&(b[T]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},Ng={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,n){var i=this,o=Array.prototype.slice.call(arguments,0);return new jr(function(s,u){var l=function(h){i.off.apply(i,v),s(h)},f=o.concat([l]),v=f.concat([]);i.on.apply(i,f)})}}},$e={};[kd,Rg,Ng].forEach(function(t){Oe($e,t)});var Pg={animate:$e.animate(),animation:$e.animation(),animated:$e.animated(),clearQueue:$e.clearQueue(),delay:$e.delay(),delayAnimation:$e.delayAnimation(),stop:$e.stop()},Mn={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(d){return a.push(d)}),a}else Je(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new Xr(e),o=0;o<r.length;o++){for(var s=r[o],u=s._private,l=u.classes,f=!1,v=0;v<e.length;v++){var c=e[v],h=l.has(c);if(!h){f=!0;break}}f||(f=l.size!==e.length),f&&(u.classes=i,n.push(s))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){Je(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],o=0,s=a.length;o<s;o++)for(var u=a[o],l=u._private.classes,f=!1,v=0;v<e.length;v++){var c=e[v],h=l.has(c),d=!1;r||n&&!h?(l.add(c),d=!0):(!r||n&&h)&&(l.delete(c),d=!0),!f&&d&&(i.push(u),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};Mn.className=Mn.classNames=Mn.classes;var He={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:gt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};He.variable="(?:[\\w-.]|(?:\\\\"+He.metaChar+"))+",He.className="(?:[\\w-]|(?:\\\\"+He.metaChar+"))+",He.value=He.string+"|"+He.number,He.id=He.variable,function(){var t,e,r;for(t=He.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],He.comparatorOp+="|@"+e;for(t=He.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(He.comparatorOp+="|\\!"+e)}();var Ze=function(){return{checks:[]}},Le={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Jo=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return Mh(t.selector,e.selector)}),Og=function(){for(var t={},e,r=0;r<Jo.length;r++)e=Jo[r],t[e.selector]=e.matches;return t}(),Ig=function(e,r){return Og[e](r)},Bg="("+Jo.map(function(t){return t.selector}).join("|")+")",ea=function(e){return e.replace(new RegExp("\\\\("+He.metaChar+")","g"),function(r,a){return a})},dr=function(e,r,a){e[e.length-1]=a},jo=[{name:"group",query:!0,regex:"("+He.group+")",populate:function(e,r,a){var n=vt(a,1),i=n[0];r.checks.push({type:Le.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:Bg,populate:function(e,r,a){var n=vt(a,1),i=n[0];r.checks.push({type:Le.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+He.id+")",populate:function(e,r,a){var n=vt(a,1),i=n[0];r.checks.push({type:Le.ID,value:ea(i)})}},{name:"className",query:!0,regex:"\\.("+He.className+")",populate:function(e,r,a){var n=vt(a,1),i=n[0];r.checks.push({type:Le.CLASS,value:ea(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+He.variable+")\\s*\\]",populate:function(e,r,a){var n=vt(a,1),i=n[0];r.checks.push({type:Le.DATA_EXIST,field:ea(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+He.variable+")\\s*("+He.comparatorOp+")\\s*("+He.value+")\\s*\\]",populate:function(e,r,a){var n=vt(a,3),i=n[0],o=n[1],s=n[2],u=new RegExp("^"+He.string+"$").exec(s)!=null;u?s=s.substring(1,s.length-1):s=parseFloat(s),r.checks.push({type:Le.DATA_COMPARE,field:ea(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+He.boolOp+")\\s*("+He.variable+")\\s*\\]",populate:function(e,r,a){var n=vt(a,2),i=n[0],o=n[1];r.checks.push({type:Le.DATA_BOOL,field:ea(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+He.meta+")\\s*("+He.comparatorOp+")\\s*("+He.number+")\\s*\\]\\]",populate:function(e,r,a){var n=vt(a,3),i=n[0],o=n[1],s=n[2];r.checks.push({type:Le.META_COMPARE,field:ea(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:He.separator,populate:function(e,r){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,o=e[e.length-1];a!=null&&(o.subject=a,e.currentSubject=null),o.edgeCount=n,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var s=e[e.length++]=Ze();return s}},{name:"directedEdge",separator:!0,regex:He.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Ze(),n=r,i=Ze();return a.checks.push({type:Le.DIRECTED_EDGE,source:n,target:i}),dr(e,r,a),e.edgeCount++,i}else{var o=Ze(),s=r,u=Ze();return o.checks.push({type:Le.NODE_SOURCE,source:s,target:u}),dr(e,r,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:He.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Ze(),n=r,i=Ze();return a.checks.push({type:Le.UNDIRECTED_EDGE,nodes:[n,i]}),dr(e,r,a),e.edgeCount++,i}else{var o=Ze(),s=r,u=Ze();return o.checks.push({type:Le.NODE_NEIGHBOR,node:s,neighbor:u}),dr(e,r,o),u}}},{name:"child",separator:!0,regex:He.child,populate:function(e,r){if(e.currentSubject==null){var a=Ze(),n=Ze(),i=e[e.length-1];return a.checks.push({type:Le.CHILD,parent:i,child:n}),dr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=Ze(),s=e[e.length-1],u=Ze(),l=Ze(),f=Ze(),v=Ze();return o.checks.push({type:Le.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:Le.TRUE}],v.checks.push({type:Le.TRUE}),u.checks.push({type:Le.PARENT,parent:v,child:f}),dr(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var c=Ze(),h=Ze(),d=[{type:Le.PARENT,parent:c,child:h}];return c.checks=r.checks,r.checks=d,e.compoundCount++,h}}},{name:"descendant",separator:!0,regex:He.descendant,populate:function(e,r){if(e.currentSubject==null){var a=Ze(),n=Ze(),i=e[e.length-1];return a.checks.push({type:Le.DESCENDANT,ancestor:i,descendant:n}),dr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=Ze(),s=e[e.length-1],u=Ze(),l=Ze(),f=Ze(),v=Ze();return o.checks.push({type:Le.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:Le.TRUE}],v.checks.push({type:Le.TRUE}),u.checks.push({type:Le.ANCESTOR,ancestor:v,descendant:f}),dr(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var c=Ze(),h=Ze(),d=[{type:Le.ANCESTOR,ancestor:c,descendant:h}];return c.checks=r.checks,r.checks=d,e.compoundCount++,h}}},{name:"subject",modifier:!0,regex:He.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Xe("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===Le.DIRECTED_EDGE?n.type=Le.NODE_TARGET:i===Le.UNDIRECTED_EDGE&&(n.type=Le.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];jo.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var Fg=function(e){for(var r,a,n,i=0;i<jo.length;i++){var o=jo[i],s=o.name,u=e.match(o.regexObj);if(u!=null){a=u,r=o,n=s;var l=u[0];e=e.substring(l.length);break}}return{expr:r,match:a,name:n,remaining:e}},kg=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},zg=function(e){var r=this,a=r.inputText=e,n=r[0]=Ze();for(r.length=1,a=kg(a);;){var i=Fg(a);if(i.expr==null)return Xe("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(r,n,o);if(s===!1)return!1;if(s!=null&&(n=s),a=i.remaining,a.match(/^\s*$/))break}var u=r[r.length-1];r.currentSubject!=null&&(u.subject=r.currentSubject),u.edgeCount=r.edgeCount,u.compoundCount=r.compoundCount;for(var l=0;l<r.length;l++){var f=r[l];if(f.compoundCount>0&&f.edgeCount>0)return Xe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Xe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Xe("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},Vg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},r=function(f){return Ne(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,v){var c=f.type,h=f.value;switch(c){case Le.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case Le.DATA_COMPARE:{var p=f.field,y=f.operator;return"["+p+a(e(y))+r(h)+"]"}case Le.DATA_BOOL:{var g=f.operator,b=f.field;return"["+e(g)+b+"]"}case Le.DATA_EXIST:{var m=f.field;return"["+m+"]"}case Le.META_COMPARE:{var w=f.operator,T=f.field;return"[["+T+a(e(w))+r(h)+"]]"}case Le.STATE:return h;case Le.ID:return"#"+h;case Le.CLASS:return"."+h;case Le.PARENT:case Le.CHILD:return i(f.parent,v)+a(">")+i(f.child,v);case Le.ANCESTOR:case Le.DESCENDANT:return i(f.ancestor,v)+" "+i(f.descendant,v);case Le.COMPOUND_SPLIT:{var D=i(f.left,v),x=i(f.subject,v),M=i(f.right,v);return D+(D.length>0?" ":"")+x+M}case Le.TRUE:return""}},i=function(f,v){return f.checks.reduce(function(c,h,d){return c+(v===f&&d===0?"$":"")+n(h,v)},"")},o="",s=0;s<this.length;s++){var u=this[s];o+=i(u,u.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o},Gg={parse:zg,toString:Vg},nf=function(e,r,a){var n,i=Ne(e),o=be(e),s=Ne(a),u,l,f=!1,v=!1,c=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),v=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||s||f)&&(u=!i&&!o?"":""+e,l=""+a),f&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),r){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e<a;break;case"<=":c=!0,n=e<=a;break;default:n=!1;break}return v&&(e!=null||!c)&&(n=!n),n},Ug=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},Hg=function(e){return e!==void 0},es=function(e,r){return e.data(r)},qg=function(e,r){return e[r]()},ot=[],tt=function(e,r){return e.checks.every(function(a){return ot[a.type](a,r)})};ot[Le.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()},ot[Le.STATE]=function(t,e){var r=t.value;return Ig(r,e)},ot[Le.ID]=function(t,e){var r=t.value;return e.id()===r},ot[Le.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)},ot[Le.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return nf(qg(e,r),a,n)},ot[Le.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return nf(es(e,r),a,n)},ot[Le.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return Ug(es(e,r),a)},ot[Le.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,Hg(es(e,r))},ot[Le.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],n=e.source(),i=e.target();return tt(r,n)&&tt(a,i)||tt(a,n)&&tt(r,i)},ot[Le.NODE_NEIGHBOR]=function(t,e){return tt(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&tt(t.neighbor,r)})},ot[Le.DIRECTED_EDGE]=function(t,e){return tt(t.source,e.source())&&tt(t.target,e.target())},ot[Le.NODE_SOURCE]=function(t,e){return tt(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&tt(t.target,r)})},ot[Le.NODE_TARGET]=function(t,e){return tt(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&tt(t.source,r)})},ot[Le.CHILD]=function(t,e){return tt(t.child,e)&&tt(t.parent,e.parent())},ot[Le.PARENT]=function(t,e){return tt(t.parent,e)&&e.children().some(function(r){return tt(t.child,r)})},ot[Le.DESCENDANT]=function(t,e){return tt(t.descendant,e)&&e.ancestors().some(function(r){return tt(t.ancestor,r)})},ot[Le.ANCESTOR]=function(t,e){return tt(t.ancestor,e)&&e.descendants().some(function(r){return tt(t.descendant,r)})},ot[Le.COMPOUND_SPLIT]=function(t,e){return tt(t.subject,e)&&tt(t.left,e)&&tt(t.right,e)},ot[Le.TRUE]=function(){return!0},ot[Le.COLLECTION]=function(t,e){var r=t.value;return r.has(e)},ot[Le.FILTER]=function(t,e){var r=t.value;return r(e)};var Yg=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===Le.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(i){for(var o=0;o<r.length;o++){var s=r[o];if(tt(s,i))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},Wg=function(e){for(var r=this,a=0;a<r.length;a++){var n=r[a];if(tt(n,e))return!0}return!1},Xg={matches:Wg,filter:Yg},gr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||Ne(e)&&e.match(/^\s*$/)||(Ft(e)?this.addQuery({checks:[{type:Le.COLLECTION,value:e.collection()}]}):it(e)?this.addQuery({checks:[{type:Le.FILTER,value:e}]}):Ne(e)?this.parse(e)||(this.invalid=!0):at("A selector must be created from a string; found "))},pr=gr.prototype;[Gg,Xg].forEach(function(t){return Oe(pr,t)}),pr.text=function(){return this.inputText},pr.size=function(){return this.length},pr.eq=function(t){return this[t]},pr.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()},pr.addQuery=function(t){this[this.length++]=t},pr.selector=pr.toString;var yr={allAre:function(e){var r=new gr(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new gr(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};yr.allAreNeighbours=yr.allAreNeighbors,yr.has=yr.contains,yr.equal=yr.equals=yr.same;var kt=function(e,r){return function(n,i,o,s){var u=n,l=this,f;if(u==null?f="":Ft(u)&&u.length===1&&(f=u.id()),l.length===1&&f){var v=l[0]._private,c=v.traversalCache=v.traversalCache||{},h=c[r]=c[r]||[],d=Lr(f),p=h[d];return p||(h[d]=e.call(l,n,i,o,s))}else return e.call(l,n,i,o,s)}},ta={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],o=i._private.parent;o&&r.push(o)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];r.push(i)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var n=this[a],i=n.parents();r=r||i,r=r.intersect(i)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:kt(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function a(n){for(var i=0;i<n.length;i++){var o=n[i];r.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function ts(t,e,r,a){for(var n=[],i=new Xr,o=t.cy(),s=o.hasCompoundNodes(),u=0;u<t.length;u++){var l=t[u];r?n.push(l):s&&a(n,i,l)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),s&&a(n,i,f)}return t}function of(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||t.push(i)}}ta.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ts(this,t,e,of)};function sf(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}ta.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ts(this,t,e,sf)};function $g(t,e,r){sf(t,e,r),of(t,e,r)}ta.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ts(this,t,e,$g)},ta.ancestors=ta.parents;var Oa,uf;Oa=uf={data:$e.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:$e.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:$e.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:$e.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:$e.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:$e.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Oa.attr=Oa.data,Oa.removeAttr=Oa.removeData;var Kg=uf,Rn={};function rs(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(a+=t(n,s))}return a}else return}}Oe(Rn,{degree:rs(function(t,e){return e.source().same(e.target())?2:1}),indegree:rs(function(t,e){return e.target().same(t)?1:0}),outdegree:rs(function(t,e){return e.source().same(t)?1:0})});function ra(t,e){return function(r){for(var a,n=this.nodes(),i=0;i<n.length;i++){var o=n[i],s=o[t](r);s!==void 0&&(a===void 0||e(s,a))&&(a=s)}return a}}Oe(Rn,{minDegree:ra("degree",function(t,e){return t<e}),maxDegree:ra("degree",function(t,e){return t>e}),minIndegree:ra("indegree",function(t,e){return t<e}),maxIndegree:ra("indegree",function(t,e){return t>e}),minOutdegree:ra("outdegree",function(t,e){return t<e}),maxOutdegree:ra("outdegree",function(t,e){return t>e})}),Oe(Rn,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n<a.length;n++)r+=a[n].degree(e);return r}});var Ht,lf,ff=function(e,r,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var o=i._private.position,s={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};i.isParent()&&!(s.x===0&&s.y===0)&&i.children().shift(s,a),i.dirtyBoundingBoxCache()}}},vf={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){ff(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Ht=lf={position:$e.data(vf),silentPosition:$e.data(Oe({},vf,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){ff(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Ue(e))r?this.silentPosition(e):this.position(e);else if(it(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=a(o,i))&&(r?o.silentPosition(s):o.position(s))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var n;if(Ue(e)?(n={x:be(e.x)?e.x:0,y:be(e.y)?e.y:0},a=r):Ne(e)&&be(r)&&(n={x:0,y:0},n[e]=r),n!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var u=s.position(),l={x:u.x+n.x,y:u.y+n.y};a?s.silentPosition(l):s.position(l)}}i.endBatch()}return this},silentShift:function(e,r){return Ue(e)?this.shift(e,!0):Ne(e)&&be(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],n=this.cy(),i=n.zoom(),o=n.pan(),s=Ue(e)?e:void 0,u=s!==void 0||r!==void 0&&Ne(e);if(a&&a.isNode())if(u)for(var l=0;l<this.length;l++){var f=this[l];r!==void 0?f.position(e,(r-o[e])/i):s!==void 0&&f.position(xu(s,i,o))}else{var v=a.position();return s=dn(v,i,o),e===void 0?s:s[e]}else if(!u)return;return this},relativePosition:function(e,r){var a=this[0],n=this.cy(),i=Ue(e)?e:void 0,o=i!==void 0||r!==void 0&&Ne(e),s=n.hasCompoundNodes();if(a&&a.isNode())if(o)for(var u=0;u<this.length;u++){var l=this[u],f=s?l.parent():null,v=f&&f.length>0,c=v;v&&(f=f[0]);var h=c?f.position():{x:0,y:0};r!==void 0?l.position(e,r+h[e]):i!==void 0&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),p=s?a.parent():null,y=p&&p.length>0,g=y;y&&(p=p[0]);var b=g?p.position():{x:0,y:0};return i={x:d.x-b.x,y:d.y-b.y},e===void 0?i:i[e]}else if(!o)return;return this}},Ht.modelPosition=Ht.point=Ht.position,Ht.modelPositions=Ht.points=Ht.positions,Ht.renderedPoint=Ht.renderedPosition,Ht.relativePoint=Ht.relativePosition;var _g=lf,aa=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},na=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},Zg=function(e){switch(e){case"left":return"right";case"right":return"left";case"left-inside":return"left";case"right-inside":return"right";default:return"center"}},ia,mr;ia=mr={},mr.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}},mr.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)},mr.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},v=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),c=s.position;(v.w===0||v.h===0)&&(v={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},v.x1=c.x-v.w/2,v.x2=c.x+v.w/2,v.y1=c.y-v.h/2,v.y2=c.y+v.h/2);function h(P,N,O){var R=0,I=0,E=N+O;return P>0&&E>0&&(R=N/E*P,I=O/E*P),{biasDiff:R,biasComplementDiff:I}}function d(P,N,O,R){if(O.units==="%")switch(R){case"width":return P>0?O.pfValue*P:0;case"height":return N>0?O.pfValue*N:0;case"average":return P>0&&N>0?O.pfValue*(P+N)/2:0;case"min":return P>0&&N>0?P>N?O.pfValue*N:O.pfValue*P:0;case"max":return P>0&&N>0?P>N?O.pfValue*P:O.pfValue*N:0;default:return 0}else return O.units==="px"?O.pfValue:0}var p=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(p=p*100/f.width.val);var y=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(y=y*100/f.width.val);var g=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(g=g*100/f.height.val);var b=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(b=b*100/f.height.val);var m=h(f.width.val-v.w,p,y),w=m.biasDiff,T=m.biasComplementDiff,D=h(f.height.val-v.h,g,b),x=D.biasDiff,M=D.biasComplementDiff;s.autoPadding=d(v.w,v.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(v.w,f.width.val),c.x=(-w+v.x1+v.x2+T)/2,s.autoHeight=Math.max(v.h,f.height.val),c.y=(-x+v.y1+v.y2+M)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||t)&&(r(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var zt=function(e){return e===1/0||e===-1/0?0:e},qt=function(e,r,a,n,i){n-r===0||i-a===0||r==null||a==null||n==null||i==null||(e.x1=r<e.x1?r:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},br=function(e,r){return r==null?e:qt(e,r.x1,r.y1,r.x2,r.y2)},Ia=function(e,r,a){return Mt(e,r,a)},Nn=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,o=i.arrowWidth/2,s=r.pstyle(a+"-arrow-shape").value,u,l;if(s!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=n.arrowBounds=n.arrowBounds||{},v=f[a]=f[a]||{};v.x1=u-o,v.y1=l-o,v.x2=u+o,v.y2=l+o,v.w=v.x2-v.x1,v.h=v.y2-v.y1,pn(v,1),qt(e,v.x1,v.y1,v.x2,v.y2)}}},as=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,o=i.rstyle,s=r.pstyle(n+"label").strValue;if(s){var u=r.pstyle("text-halign"),l=r.pstyle("text-valign"),f=Ia(o,"labelWidth",a),v=Ia(o,"labelHeight",a),c=Ia(o,"labelX",a),h=Ia(o,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,p=r.pstyle(n+"text-margin-y").pfValue,y=r.isEdge(),g=r.pstyle(n+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,m=r.pstyle("text-border-width").pfValue,w=m/2,T=r.pstyle("text-background-padding").pfValue,D=2,x=v,M=f,P=M/2,N=x/2,O,R,I,E;if(y)O=c-P,R=c+P,I=h-N,E=h+N;else{switch(aa(u.value)){case"left":O=c-M,R=c;break;case"center":O=c-P,R=c+P;break;case"right":O=c,R=c+M;break}switch(na(l.value)){case"top":I=h-x,E=h;break;case"center":I=h-N,E=h+N;break;case"bottom":I=h,E=h+x;break}}var A=d-Math.max(b,w)-T-D,S=d+Math.max(b,w)+T+D,C=p-Math.max(b,w)-T-D,L=p+Math.max(b,w)+T+D;O+=A,R+=S,I+=C,E+=L;var z=a||"main",k=i.labelBounds,F=k[z]=k[z]||{};F.x1=O,F.y1=I,F.x2=R,F.y2=E,F.w=R-O,F.h=E-I,F.leftPad=A,F.rightPad=S,F.topPad=C,F.botPad=L;var H=y&&g.strValue==="autorotate",W=g.pfValue!=null&&g.pfValue!==0;if(H||W){var Q=H?Ia(i.rstyle,"labelAngle",a):g.pfValue,K=Math.cos(Q),Z=Math.sin(Q),j=(O+R)/2,re=(I+E)/2;if(!y){switch(aa(u.value)){case"left":j=R;break;case"right":j=O;break}switch(na(l.value)){case"top":re=E;break;case"bottom":re=I;break}}var q=function(pe,le){return pe=pe-j,le=le-re,{x:pe*K-le*Z+j,y:pe*Z+le*K+re}},U=q(O,I),Y=q(O,E),X=q(R,I),ee=q(R,E);O=Math.min(U.x,Y.x,X.x,ee.x),R=Math.max(U.x,Y.x,X.x,ee.x),I=Math.min(U.y,Y.y,X.y,ee.y),E=Math.max(U.y,Y.y,X.y,ee.y)}var te=z+"Rot",ge=k[te]=k[te]||{};ge.x1=O,ge.y1=I,ge.x2=R,ge.y2=E,ge.w=R-O,ge.h=E-I,qt(e,O,I,R,E),qt(i.labelBounds.all,O,I,R,E)}return e}},hf=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value,i=r.pstyle("outline-offset").value,o=n+i;cf(e,r,a,o,"outside",o/2)}},cf=function(e,r,a,n,i,o){if(!(a===0||n<=0||i==="inside")){var s=r.cy(),u=s.renderer(),l=u.nodeShapes[u.getNodeShape(r)];if(l){var f=r.position(),v=f.x,c=f.y,h=r.width(),d=r.height();if(l.hasMiterBounds){i==="center"&&(n/=2);var p=l.miterBounds(v,c,h,d,n);br(e,p)}else o!=null&&o>0&&yn(e,[o,o,o,o])}}},Qg=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,n=r.pstyle("border-width").pfValue,i=r.pstyle("border-position").value;cf(e,r,a,n,i)}},Jg=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=Rt(),s=e._private,u=e.isNode(),l=e.isEdge(),f,v,c,h,d,p,y=s.rstyle,g=u&&n?e.pstyle("bounds-expansion").pfValue:[0],b=function(Te){return Te.pstyle("display").value!=="none"},m=!n||b(e)&&(!l||b(e.source())&&b(e.target()));if(m){var w=0,T=0;n&&r.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(T=e.pstyle("overlay-padding").value));var D=0,x=0;n&&r.includeUnderlays&&(D=e.pstyle("underlay-opacity").value,D!==0&&(x=e.pstyle("underlay-padding").value));var M=Math.max(T,x),P=0,N=0;if(n&&(P=e.pstyle("width").pfValue,N=P/2),u&&r.includeNodes){var O=e.position();d=O.x,p=O.y;var R=e.outerWidth(),I=R/2,E=e.outerHeight(),A=E/2;f=d-I,v=d+I,c=p-A,h=p+A,qt(o,f,c,v,h),n&&hf(o,e),n&&r.includeOutlines&&!i&&hf(o,e),n&&Qg(o,e)}else if(l&&r.includeEdges)if(n&&!i){var S=e.pstyle("curve-style").strValue;if(f=Math.min(y.srcX,y.midX,y.tgtX),v=Math.max(y.srcX,y.midX,y.tgtX),c=Math.min(y.srcY,y.midY,y.tgtY),h=Math.max(y.srcY,y.midY,y.tgtY),f-=N,v+=N,c-=N,h+=N,qt(o,f,c,v,h),S==="haystack"){var C=y.haystackPts;if(C&&C.length===2){if(f=C[0].x,c=C[0].y,v=C[1].x,h=C[1].y,f>v){var L=f;f=v,v=L}if(c>h){var z=c;c=h,h=z}qt(o,f-N,c-N,v+N,h+N)}}else if(S==="bezier"||S==="unbundled-bezier"||ur(S,"segments")||ur(S,"taxi")){var k;switch(S){case"bezier":case"unbundled-bezier":k=y.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":k=y.linePts;break}if(k!=null)for(var F=0;F<k.length;F++){var H=k[F];f=H.x-N,v=H.x+N,c=H.y-N,h=H.y+N,qt(o,f,c,v,h)}}}else{var W=e.source(),Q=W.position(),K=e.target(),Z=K.position();if(f=Q.x,v=Z.x,c=Q.y,h=Z.y,f>v){var j=f;f=v,v=j}if(c>h){var re=c;c=h,h=re}f-=N,v+=N,c-=N,h+=N,qt(o,f,c,v,h)}if(n&&r.includeEdges&&l&&(Nn(o,e,"mid-source"),Nn(o,e,"mid-target"),Nn(o,e,"source"),Nn(o,e,"target")),n){var q=e.pstyle("ghost").value==="yes";if(q){var U=e.pstyle("ghost-offset-x").pfValue,Y=e.pstyle("ghost-offset-y").pfValue;qt(o,o.x1+U,o.y1+Y,o.x2+U,o.y2+Y)}}var X=s.bodyBounds=s.bodyBounds||{};Su(X,o),yn(X,g),pn(X,1),n&&(f=o.x1,v=o.x2,c=o.y1,h=o.y2,qt(o,f-M,c-M,v+M,h+M));var ee=s.overlayBounds=s.overlayBounds||{};Su(ee,o),yn(ee,g),pn(ee,1);var te=s.labelBounds=s.labelBounds||{};te.all!=null?Pc(te.all):te.all=Rt(),n&&r.includeLabels&&(r.includeMainLabels&&as(o,e,null),l&&(r.includeSourceLabels&&as(o,e,"source"),r.includeTargetLabels&&as(o,e,"target")))}return o.x1=zt(o.x1),o.y1=zt(o.y1),o.x2=zt(o.x2),o.y2=zt(o.y2),o.w=zt(o.x2-o.x1),o.h=zt(o.y2-o.y1),o.w>0&&o.h>0&&m&&(yn(o,g),pn(o,1)),o},df=function(e){var r=0,a=function(o){return(o?1:0)<<r++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},gf=function(e){var r=function(s){return Math.round(s)};if(e.isEdge()){var a=e.source().position(),n=e.target().position();return vu([r(a.x),r(a.y),r(n.x),r(n.y)])}else{var i=e.position();return vu([r(i.x),r(i.y)])}},pf=function(e,r){var a=e._private,n,i=e.isEdge(),o=r==null?yf:df(r),s=o===yf;if(a.bbCache==null?(n=Jg(e,Ba),a.bbCache=n,a.bbCachePosKey=gf(e)):n=a.bbCache,!s){var u=e.isNode();n=Rt(),(r.includeNodes&&u||r.includeEdges&&!u)&&(r.includeOverlays?br(n,a.overlayBounds):br(n,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?br(n,a.labelBounds.all):(r.includeMainLabels&&br(n,a.labelBounds.mainRot),r.includeSourceLabels&&br(n,a.labelBounds.sourceRot),r.includeTargetLabels&&br(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Ba={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},yf=df(Ba),mf=xt(Ba);mr.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,a=Yr(function(f){var v=f._private;return v.bbCache==null||v.styleDirty||v.bbCachePosKey!==gf(f)},function(f){return f.id()});if(r&&this.length===1&&!a(this[0]))t===void 0?t=Ba:t=mf(t),e=pf(this[0],t);else{e=Rt(),t=t||Ba;var n=mf(t),i=this,o=i.cy(),s=o.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),s&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var u=0;u<i.length;u++){var l=i[u];a(l)&&l.dirtyBoundingBoxCache(),br(e,pf(l,n))}}return e.x1=zt(e.x1),e.y1=zt(e.y1),e.x2=zt(e.x2),e.y2=zt(e.y2),e.w=zt(e.x2-e.x1),e.h=zt(e.y2-e.y1),e},mr.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},mr.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),n=r.collection();if(a&&(n=e.filter(function(l){return l.isParent()}),e=e.not(n)),Ue(t)){var i=t;t=function(){return i}}var o=function(f,v){return f._private.bbAtOldPos=t(f,v)},s=function(f){return f._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var u=Nc(this.boundingBox({useCache:!1}));return e.silentPositions(s),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),r.endBatch(),u},ia.boundingbox=ia.bb=ia.boundingBox,ia.renderedBoundingbox=ia.renderedBoundingBox;var jg=mr,Fa,ka;Fa=ka={};var bf=function(e){e.uppercaseName=Hs(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Hs(e.outerName),Fa[e.name]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var s=a.pstyle(e.name);switch(s.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return s.pfValue}}else return 1},Fa["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){var s=a[e.name](),u=a.pstyle("border-position").value,l;u==="center"?l=a.pstyle("border-width").pfValue:u==="outside"?l=2*a.pstyle("border-width").pfValue:l=0;var f=2*a.padding();return s+l+f}else return 1},Fa["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},Fa["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};bf({name:"width"}),bf({name:"height"}),ka.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue},ka.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()},ka.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var ep=ka,tp=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},rp=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return dn(r(e),a.zoom(),a.pan())}},ap=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),n=a.pan(),i=a.zoom();return r(e).map(function(o){return dn(o,i,n)})}},np=function(e){return e.renderer().getControlPoints(e)},ip=function(e){return e.renderer().getSegmentPoints(e)},op=function(e){return e.renderer().getSourceEndpoint(e)},sp=function(e){return e.renderer().getTargetEndpoint(e)},up=function(e){return e.renderer().getEdgeMidpoint(e)},wf={controlPoints:{get:np,mult:!0},segmentPoints:{get:ip,mult:!0},sourceEndpoint:{get:op},targetEndpoint:{get:sp},midpoint:{get:up}},lp=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},fp=Object.keys(wf).reduce(function(t,e){var r=wf[e],a=lp(e);return t[e]=function(){return tp(this,r.get)},r.mult?t[a]=function(){return ap(this,r.get)}:t[a]=function(){return rp(this,r.get)},t},{}),vp=Oe({},_g,jg,ep,fp);/*!
Event object based on jQuery events, MIT license
https://jquery.org/license/
https://tldrlegal.com/license/mit-license
https://github.com/jquery/jquery/blob/master/src/event.js
*/var Ef=function(e,r){this.recycle(e,r)};function za(){return!1}function Pn(){return!0}Ef.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=za,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Pn:za):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Pn;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Pn;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Pn,this.stopPropagation()},isDefaultPrevented:za,isPropagationStopped:za,isImmediatePropagationStopped:za};var xf=/^([^.]+)(\.(?:[^.]+))?$/,hp=".*",Tf={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Cf=Object.keys(Tf),cp={};function On(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:cp,e=arguments.length>1?arguments[1]:void 0,r=0;r<Cf.length;r++){var a=Cf[r];this[a]=t[a]||Tf[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var wr=On.prototype,Sf=function(e,r,a,n,i,o,s){it(n)&&(i=n,n=null),s&&(o==null?o=s:o=Oe({},o,s));for(var u=Je(a)?a:a.split(/\s+/),l=0;l<u.length;l++){var f=u[l];if(!sr(f)){var v=f.match(xf);if(v){var c=v[1],h=v[2]?v[2]:null,d=r(e,f,c,h,n,i,o);if(d===!1)break}}}},Af=function(e,r){return e.addEventFields(e.context,r),new Ef(r.type,r)},dp=function(e,r,a){if(mh(a)){r(e,a);return}else if(Ue(a)){r(e,Af(e,a));return}for(var n=Je(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var o=n[i];if(!sr(o)){var s=o.match(xf);if(s){var u=s[1],l=s[2]?s[2]:null,f=Af(e,{type:u,namespace:l,target:e.context});r(e,f)}}}};wr.on=wr.addListener=function(t,e,r,a,n){return Sf(this,function(i,o,s,u,l,f,v){it(f)&&i.listeners.push({event:o,callback:f,type:s,namespace:u,qualifier:l,conf:v})},t,e,r,a,n),this},wr.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})},wr.removeListener=wr.off=function(t,e,r,a){var n=this;this.emitting!==0&&(this.listeners=ec(this.listeners));for(var i=this.listeners,o=function(l){var f=i[l];Sf(n,function(v,c,h,d,p,y){if((f.type===h||t==="*")&&(!d&&f.namespace!==".*"||f.namespace===d)&&(!p||v.qualifierCompare(f.qualifier,p))&&(!y||f.callback===y))return i.splice(l,1),!1},t,e,r,a)},s=i.length-1;s>=0;s--)o(s);return this},wr.removeAllListeners=function(){return this.removeListener("*")},wr.emit=wr.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,Je(e)||(e=[e]),dp(this,function(i,o){r!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],n=a.length);for(var s=function(){var f=a[u];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===hp)&&i.eventMatches(i.context,f,o)){var v=[o];e!=null&&rc(v,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(d){return d!==f}));var c=i.callbackContext(i.context,f,o),h=f.callback.apply(c,v);i.afterEmit(i.context,f,o),h===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<n;u++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},t),this.emitting--,this};var gp={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&wa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},In=function(e){return Ne(e)?new gr(e):e},Df={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new On(gp,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var n=In(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a)}return this},removeListener:function(e,r,a){for(var n=In(r),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var n=In(r),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,n,a)}return this},once:function(e,r,a){for(var n=In(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var n=this[a];n.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};$e.eventAliasesOn(Df);var Lf={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):r.push(n)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(Ne(e)||Ft(e))return new gr(e).filter(this);if(it(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var o=n[i],s=r?e.apply(r,[o,i,n]):e(o,i,n);s&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){Ne(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||r.push(n)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(Ne(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),n=this,i=e,o=this.length<e.length,s=o?n:i,u=o?i:n,l=0;l<s.length;l++){var f=s[l];u.has(f)&&a.push(f)}return a},xor:function(e){var r=this._private.cy;Ne(e)&&(e=r.$(e));var a=this.spawn(),n=this,i=e,o=function(u,l){for(var f=0;f<u.length;f++){var v=u[f],c=v._private.data.id,h=l.hasElementWithId(c);h||a.push(v)}};return o(n,i),o(i,n),a},diff:function(e){var r=this._private.cy;Ne(e)&&(e=r.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),o=this,s=e,u=function(f,v,c){for(var h=0;h<f.length;h++){var d=f[h],p=d._private.data.id,y=v.hasElementWithId(p);y?i.merge(d):c.push(d)}};return u(o,s,a),u(s,o,n),{left:a,right:n,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(Ne(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],s=!this.has(o);s&&n.push(o)}return n},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&Ne(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=r.map,o=0;o<e.length;o++){var s=e[o],u=s._private.data.id,l=!i.has(u);if(l){var f=this.length++;this[f]=s,i.set(u,{ele:s,index:f})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var o=e===this.length-1;if(this.length>1&&!o){var s=this.length-1,u=this[s],l=u._private.data.id;this[s]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&Ne(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,i=0;i<n.length;i++){var o=n[i],s=r?e.apply(r,[o,i,n]):e(o,i,n);a.push(s)}return a},reduce:function(e,r){for(var a=r,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,r){for(var a=-1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u>a&&(a=u,n=s)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u<a&&(a=u,n=s)}return{value:a,ele:n}}},Ye=Lf;Ye.u=Ye["|"]=Ye["+"]=Ye.union=Ye.or=Ye.add,Ye["\\"]=Ye["!"]=Ye["-"]=Ye.difference=Ye.relativeComplement=Ye.subtract=Ye.not,Ye.n=Ye["&"]=Ye["."]=Ye.and=Ye.intersection=Ye.intersect,Ye["^"]=Ye["(+)"]=Ye["(-)"]=Ye.symmetricDifference=Ye.symdiff=Ye.xor,Ye.fnFilter=Ye.filterFn=Ye.stdFilter=Ye.filter,Ye.complement=Ye.abscomp=Ye.absoluteComplement;var pp={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Mf=function(e,r){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var v=f.pstyle("z-compound-depth");return v.value==="auto"?n?f.zDepth():0:v.value==="bottom"?-1:v.value==="top"?Pi:0}var o=i(e)-i(r);if(o!==0)return o;function s(f){var v=f.pstyle("z-index-compare");return v.value==="auto"&&f.isNode()?1:0}var u=s(e)-s(r);if(u!==0)return u;var l=e.pstyle("z-index").value-r.pstyle("z-index").value;return l!==0?l:e.poolIndex()-r.poolIndex()},Bn={forEach:function(e,r){if(it(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],o=r?e.apply(r,[i,n,this]):e(i,n,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],n=this.length;r==null&&(r=n),e==null&&(e=0),e<0&&(e=n+e),r<0&&(r=n+r);for(var i=e;i>=0&&i<r&&i<n;i++)a.push(this[i]);return this.spawn(a)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!it(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(Mf)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var n=r.data.parent?e.parents().size():0;return e.isParent()?n:Pi-1}else{var i=r.source,o=r.target,s=i.zDepth(),u=o.zDepth();return Math.max(s,u,0)}}}};Bn.each=Bn.forEach;var yp=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":ct(Symbol))!=e&&ct(Symbol.iterator)!=e;r&&(Bn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,o=this.length;return Is({next:function(){return i<o?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};yp();var mp=xt({nodeDimensionsIncludeLabels:!1}),Fn={layoutDimensions:function(e){e=mp(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var n=this.nodes().filter(function(T){return!T.isParent()}),i=this.cy(),o=r.eles,s=function(D){return D.id()},u=Yr(a,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(D,x,M){var P={x:x.x1+x.w/2,y:x.y1+x.h/2},N={x:(M.x-P.x)*D,y:(M.y-P.y)*D};return{x:P.x+N.x,y:P.y+N.y}},f=r.spacingFactor&&r.spacingFactor!==1,v=function(){if(!f)return null;for(var D=Rt(),x=0;x<n.length;x++){var M=n[x],P=u(M,x);Cu(D,P.x,P.y)}return D},c=v(),h=Yr(function(T,D){var x=u(T,D);if(f){var M=Math.abs(r.spacingFactor);x=l(M,c,x)}return r.transform!=null&&(x=r.transform(T,x)),x},s);if(r.animate){for(var d=0;d<n.length;d++){var p=n[d],y=h(p,d),g=r.animateFilter==null||r.animateFilter(p,d);if(g){var b=p.animation({position:y,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else p.position(y)}if(r.fit){var m=i.animation({fit:{boundingBox:o.boundingBoxAt(h),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(m)}else if(r.zoom!==void 0&&r.pan!==void 0){var w=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(w)}e.animations.forEach(function(T){return T.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),jr.all(e.animations.map(function(T){return T.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(h),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(Oe({},e,{eles:this}))}};Fn.createLayout=Fn.makeLayout=Fn.layout;function Rf(t,e,r){var a=r._private,n=a.styleCache=a.styleCache||[],i;return(i=n[t])!=null||(i=n[t]=e(r)),i}function kn(t,e){return t=Lr(t),function(a){return Rf(t,e,a)}}function zn(t,e){t=Lr(t);var r=function(n){return e.call(n)};return function(){var n=this[0];if(n)return Rf(t,r,n)}}var Tt={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),n=r.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(n){r(n),n.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var n=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(s){return s._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(r?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Ue(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(Ne(e))if(r===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];n.removeAllBypasses(s,a)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];n.removeBypasses(l,e,a)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!r)return i;var o=n.data.parent?a.parents():null;if(o)for(var s=0;s<o.length;s++){var u=o[s],l=u.pstyle("opacity").value;i=l*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function ns(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function is(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],o=n.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||ns(i,a);var u=s.source,l=s.target;return r(u)&&(!o||ns(u,r))&&(u===l||r(l)&&(!o||ns(l,r)))}}}var oa=kn("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Tt.takesUpSpace=zn("takesUpSpace",is({ok:oa}));var bp=kn("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&oa(t)}),wp=kn("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&oa(t)});Tt.interactive=zn("interactive",is({ok:bp,parentOk:wp,edgeOkViaNode:oa})),Tt.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var Ep=kn("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&oa(t)}),xp=oa;Tt.visible=zn("visible",is({ok:Ep,edgeOkViaNode:xp})),Tt.hidden=function(){var t=this[0];if(t)return!t.visible()},Tt.isBundledBezier=zn("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1}),Tt.bypass=Tt.css=Tt.style,Tt.renderedCss=Tt.renderedStyle,Tt.removeBypass=Tt.removeCss=Tt.removeStyle,Tt.pstyle=Tt.parsedStyle;var Er={};function Nf(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],n=e[1];this.on(t.event,a,n)}else if(e.length===1&&it(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&Je(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var u=this[s],l=!t.ableField||u._private[t.ableField],f=u._private[t.field]!=t.value;if(t.overrideAble){var v=t.overrideAble(u);if(v!==void 0&&(l=v,!v))return this}l&&(u._private[t.field]=t.value,f&&r.push(u))}var c=this.spawn(r);c.updateStyle(),c.emit(t.event),o&&c.emit(o)}return this}}function sa(t){Er[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},Er[t.on]=Nf({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),Er[t.off]=Nf({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}sa({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"}),sa({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"}),sa({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"}),sa({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"}),Er.deselect=Er.unselect,Er.grabbed=function(){var t=this[0];if(t)return t._private.grabbed},sa({field:"active",on:"activate",off:"unactivate"}),sa({field:"pannable",on:"panify",off:"unpanify"}),Er.inactive=function(){var t=this[0];if(t)return!t._private.active};var At={},Pf=function(e){return function(a){for(var n=this,i=[],o=0;o<n.length;o++){var s=n[o];if(s.isNode()){for(var u=!1,l=s.connectedEdges(),f=0;f<l.length;f++){var v=l[f],c=v.source(),h=v.target();if(e.noIncomingEdges&&h===s&&c!==s||e.noOutgoingEdges&&c===s&&h!==s){u=!0;break}}u||i.push(s)}}return this.spawn(i,!0).filter(a)}},Of=function(e){return function(r){for(var a=this,n=[],i=0;i<a.length;i++){var o=a[i];if(o.isNode())for(var s=o.connectedEdges(),u=0;u<s.length;u++){var l=s[u],f=l.source(),v=l.target();e.outgoing&&f===o?(n.push(l),n.push(v)):e.incoming&&v===o&&(n.push(l),n.push(f))}}return this.spawn(n,!0).filter(r)}},If=function(e){return function(r){for(var a=this,n=[],i={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var s=!1,u=0;u<o.length;u++){var l=o[u],f=l.id();i[f]||(i[f]=!0,n.push(l),s=!0)}if(!s)break;a=o}return this.spawn(n,!0).filter(r)}};At.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null},Oe(At,{roots:Pf({noIncomingEdges:!0}),leaves:Pf({noOutgoingEdges:!0}),outgoers:kt(Of({outgoing:!0}),"outgoers"),successors:If({outgoing:!0}),incomers:kt(Of({incoming:!0}),"incomers"),predecessors:If({})}),Oe(At,{neighborhood:kt(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var n=r[a],i=n.connectedEdges(),o=0;o<i.length;o++){var s=i[o],u=s.source(),l=s.target(),f=n===u?l:u;f.length>0&&e.push(f[0]),e.push(s[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),At.neighbourhood=At.neighborhood,At.closedNeighbourhood=At.closedNeighborhood,At.openNeighbourhood=At.openNeighborhood,Oe(At,{source:kt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:kt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Bf({attr:"source"}),targets:Bf({attr:"target"})});function Bf(t){return function(r){for(var a=[],n=0;n<this.length;n++){var i=this[n],o=i._private[t.attr];o&&a.push(o)}return this.spawn(a,!0).filter(r)}}Oe(At,{edgesWith:kt(Ff(),"edgesWith"),edgesTo:kt(Ff({thisIsSrc:!0}),"edgesTo")});function Ff(t){return function(r){var a=[],n=this._private.cy,i=t||{};Ne(r)&&(r=n.$(r));for(var o=0;o<r.length;o++)for(var s=r[o]._private.edges,u=0;u<s.length;u++){var l=s[u],f=l._private.data,v=this.hasElementWithId(f.source)&&r.hasElementWithId(f.target),c=r.hasElementWithId(f.source)&&this.hasElementWithId(f.target),h=v||c;h&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!v||i.thisIsTgt&&!c)||a.push(l))}return this.spawn(a,!0)}}Oe(At,{connectedEdges:kt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];if(n.isNode())for(var i=n._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:kt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:kt(kf(),"parallelEdges"),codirectedEdges:kt(kf({codirected:!0}),"codirectedEdges")});function kf(t){var e={codirected:!1};return t=Oe({},e,t),function(a){for(var n=[],i=this.edges(),o=t,s=0;s<i.length;s++)for(var u=i[s],l=u._private,f=l.source,v=f._private.data.id,c=l.data.target,h=f._private.edges,d=0;d<h.length;d++){var p=h[d],y=p._private.data,g=y.target,b=y.source,m=g===c&&b===v,w=v===g&&c===b;(o.codirected&&m||!o.codirected&&(m||w))&&n.push(p)}return this.spawn(n,!0).filter(a)}}Oe(At,{components:function(e){var r=this,a=r.cy(),n=a.collection(),i=e==null?r.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(f,v){n.merge(f),i.unmerge(f),v.merge(f)};if(i.empty())return r.spawn();var u=function(){var f=a.collection();o.push(f);var v=i[0];s(v,f),r.bfs({directed:!1,roots:v,visit:function(h){return s(h,f)}}),f.forEach(function(c){c.connectedEdges().forEach(function(h){r.has(h)&&f.has(h.source())&&f.has(h.target())&&f.merge(h)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),At.componentsOf=At.components;var Ct=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){at("A collection must have a reference to the core");return}var i=new er,o=!1;if(!r)r=[];else if(r.length>0&&Ue(r[0])&&!wa(r[0])){o=!0;for(var s=[],u=new Xr,l=0,f=r.length;l<f;l++){var v=r[l];v.data==null&&(v.data={});var c=v.data;if(c.id==null)c.id=yu();else if(e.hasElementWithId(c.id)||u.has(c.id))continue;var h=new hn(e,v,!1);s.push(h),u.add(c.id)}r=s}this.length=0;for(var d=0,p=r.length;d<p;d++){var y=r[d][0];if(y!=null){var g=y._private.data.id;(!a||!i.has(g))&&(a&&i.set(g,{index:this.length,ele:y}),this[this.length]=y,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(b){this.lazyMap=b},rebuildMap:function(){for(var m=this.lazyMap=new er,w=this.eles,T=0;T<w.length;T++){var D=w[T];m.set(D.id(),{index:T,ele:D})}}},a&&(this._private.map=i),o&&!n&&this.restore()},je=hn.prototype=Ct.prototype=Object.create(Array.prototype);je.instanceString=function(){return"collection"},je.spawn=function(t,e){return new Ct(this.cy(),t,e)},je.spawnSelf=function(){return this.spawn(this)},je.cy=function(){return this._private.cy},je.renderer=function(){return this._private.cy.renderer()},je.element=function(){return this[0]},je.collection=function(){return Vs(this)?this:new Ct(this._private.cy,[this])},je.unique=function(){return new Ct(this._private.cy,this,!0)},je.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)},je.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new Ct(e)},je.$id=je.getElementById,je.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index},je.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index},je.indexOfId=function(t){return t=""+t,this._private.map.get(t).index},je.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(Ue(t)){if(r.startBatch(),t.data){e.data(t.data);var n=a.data;if(e.isEdge()){var i=!1,o={},s=t.data.source,u=t.data.target;s!=null&&s!=n.source&&(o.source=""+s,i=!0),u!=null&&u!=n.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var l="parent"in t.data,f=t.data.parent;l&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}t.position&&e.position(t.position);var v=function(p,y,g){var b=t[p];b!=null&&b!==a[p]&&(b?e[y]():e[g]())};return v("removed","remove","restore"),v("selected","select","unselect"),v("selectable","selectify","unselectify"),v("locked","lock","unlock"),v("grabbable","grabify","ungrabify"),v("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var c={data:Yt(a.data),position:Yt(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};c.classes="";var h=0;return a.classes.forEach(function(d){return c.classes+=h++===0?d:" "+d}),c}}},je.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t},je.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],n=a.json(),i=new hn(t,n,!1);e.push(i)}return new Ct(t,e)},je.copy=je.clone,je.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],o=[],s,u=0,l=r.length;u<l;u++){var f=r[u];e&&!f.removed()||(f.isNode()?i.push(f):o.push(f))}s=i.concat(o);var v,c=function(){s.splice(v,1),v--};for(v=0;v<s.length;v++){var h=s[v],d=h._private,p=d.data;if(h.clearTraversalCache(),!(!e&&!d.removed)){if(p.id===void 0)p.id=yu();else if(be(p.id))p.id=""+p.id;else if(sr(p.id)||!Ne(p.id)){at("Can not create element with invalid string ID `"+p.id+"`"),c();continue}else if(a.hasElementWithId(p.id)){at("Can not create second element with ID `"+p.id+"`"),c();continue}}var y=p.id;if(h.isNode()){var g=d.position;g.x==null&&(g.x=0),g.y==null&&(g.y=0)}if(h.isEdge()){for(var b=h,m=["source","target"],w=m.length,T=!1,D=0;D<w;D++){var x=m[D],M=p[x];be(M)&&(M=p[x]=""+p[x]),M==null||M===""?(at("Can not create edge `"+y+"` with unspecified "+x),T=!0):a.hasElementWithId(M)||(at("Can not create edge `"+y+"` with nonexistent "+x+" `"+M+"`"),T=!0)}if(T){c();continue}var P=a.getElementById(p.source),N=a.getElementById(p.target);P.same(N)?P._private.edges.push(b):(P._private.edges.push(b),N._private.edges.push(b)),b._private.source=P,b._private.target=N}d.map=new er,d.map.set(y,{ele:h,index:0}),d.removed=!1,e&&a.addToPool(h)}for(var O=0;O<i.length;O++){var R=i[O],I=R._private.data;be(I.parent)&&(I.parent=""+I.parent);var E=I.parent,A=E!=null;if(A||R._private.parent){var S=R._private.parent?a.collection().merge(R._private.parent):a.getElementById(E);if(S.empty())I.parent=void 0;else if(S[0].removed())Xe("Node added with missing parent, reference to parent removed"),I.parent=void 0,R._private.parent=null;else{for(var C=!1,L=S;!L.empty();){if(R.same(L)){C=!0,I.parent=void 0;break}L=L.parent()}C||(S[0]._private.children.push(R),R._private.parent=S[0],n.hasCompoundNodes=!0)}}}if(s.length>0){for(var z=s.length===r.length?r:new Ct(a,s),k=0;k<z.length;k++){var F=z[k];F.isNode()||(F.parallelEdges().clearTraversalCache(),F.source().clearTraversalCache(),F.target().clearTraversalCache())}var H;n.hasCompoundNodes?H=a.collection().merge(z).merge(z.connectedNodes()).merge(z.parent()):H=z,H.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?z.emitAndNotify("add"):e&&z.emit("add")}return r},je.removed=function(){var t=this[0];return t&&t._private.removed},je.inside=function(){var t=this[0];return t&&!t._private.removed},je.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function o(E){for(var A=E._private.edges,S=0;S<A.length;S++)u(A[S])}function s(E){for(var A=E._private.children,S=0;S<A.length;S++)u(A[S])}function u(E){var A=n[E.id()];e&&E.removed()||A||(n[E.id()]=!0,E.isNode()?(a.push(E),o(E),s(E)):a.unshift(E))}for(var l=0,f=r.length;l<f;l++){var v=r[l];u(v)}function c(E,A){var S=E._private.edges;fr(S,A),E.clearTraversalCache()}function h(E){E.clearTraversalCache()}var d=[];d.ids={};function p(E,A){A=A[0],E=E[0];var S=E._private.children,C=E.id();fr(S,A),A._private.parent=null,d.ids[C]||(d.ids[C]=!0,d.push(E))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var y=0;y<a.length;y++){var g=a[y];if(g.isEdge()){var b=g.source()[0],m=g.target()[0];c(b,g),c(m,g);for(var w=g.parallelEdges(),T=0;T<w.length;T++){var D=w[T];h(D),D.isBundledBezier()&&D.dirtyBoundingBoxCache()}}else{var x=g.parent();x.length!==0&&p(x,g)}e&&(g._private.removed=!0)}var M=i._private.elements;i._private.hasCompoundNodes=!1;for(var P=0;P<M.length;P++){var N=M[P];if(N.isParent()){i._private.hasCompoundNodes=!0;break}}var O=new Ct(this.cy(),a);O.size()>0&&(t?O.emitAndNotify("remove"):e&&O.emit("remove"));for(var R=0;R<d.length;R++){var I=d[R];(!e||!I.removed())&&I.updateStyle()}return O},je.move=function(t){var e=this._private.cy,r=this,a=!1,n=!1,i=function(d){return d==null?d:""+d};if(t.source!==void 0||t.target!==void 0){var o=i(t.source),s=i(t.target),u=o!=null&&e.hasElementWithId(o),l=s!=null&&e.hasElementWithId(s);(u||l)&&(e.batch(function(){r.remove(a,n),r.emitAndNotify("moveout");for(var h=0;h<r.length;h++){var d=r[h],p=d._private.data;d.isEdge()&&(u&&(p.source=o),l&&(p.target=s))}r.restore(a,n)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var f=i(t.parent),v=f===null||e.hasElementWithId(f);if(v){var c=f===null?void 0:f;e.batch(function(){var h=r.remove(a,n);h.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var p=r[d],y=p._private.data;p.isNode()&&(y.parent=c)}h.restore(a,n)}),r.emitAndNotify("move")}}return this},[$u,Pg,Mn,yr,ta,Kg,Rn,vp,Df,Lf,pp,Bn,Fn,Tt,Er,At].forEach(function(t){Oe(je,t)});var Tp={add:function(e){var r,a=this;if(Ft(e)){var n=e;if(n._private.cy===a)r=n.restore();else{for(var i=[],o=0;o<n.length;o++){var s=n[o];i.push(s.json())}r=new Ct(a,i)}}else if(Je(e)){var u=e;r=new Ct(a,u)}else if(Ue(e)&&(Je(e.nodes)||Je(e.edges))){for(var l=e,f=[],v=["nodes","edges"],c=0,h=v.length;c<h;c++){var d=v[c],p=l[d];if(Je(p))for(var y=0,g=p.length;y<g;y++){var b=Oe({group:d},p[y]);f.push(b)}}r=new Ct(a,f)}else{var m=e;r=new hn(a,m).collection()}return r},remove:function(e){if(!Ft(e)){if(Ne(e)){var r=e;e=this.$(r)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function Cp(t,e,r,a){var n=4,i=.001,o=1e-7,s=10,u=11,l=1/(u-1),f=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var v=0;v<4;++v)if(typeof arguments[v]!="number"||isNaN(arguments[v])||!isFinite(arguments[v]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var c=f?new Float32Array(u):new Array(u);function h(N,O){return 1-3*O+3*N}function d(N,O){return 3*O-6*N}function p(N){return 3*N}function y(N,O,R){return((h(O,R)*N+d(O,R))*N+p(O))*N}function g(N,O,R){return 3*h(O,R)*N*N+2*d(O,R)*N+p(O)}function b(N,O){for(var R=0;R<n;++R){var I=g(O,t,r);if(I===0)return O;var E=y(O,t,r)-N;O-=E/I}return O}function m(){for(var N=0;N<u;++N)c[N]=y(N*l,t,r)}function w(N,O,R){var I,E,A=0;do E=O+(R-O)/2,I=y(E,t,r)-N,I>0?R=E:O=E;while(Math.abs(I)>o&&++A<s);return E}function T(N){for(var O=0,R=1,I=u-1;R!==I&&c[R]<=N;++R)O+=l;--R;var E=(N-c[R])/(c[R+1]-c[R]),A=O+E*l,S=g(A,t,r);return S>=i?b(N,A):S===0?A:w(N,O,O+l)}var D=!1;function x(){D=!0,(t!==e||r!==a)&&m()}var M=function(O){return D||x(),t===e&&r===a?O:O===0?0:O===1?1:y(T(O),e,a)};M.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var P="generateBezier("+[t,e,r,a]+")";return M.toString=function(){return P},M}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Sp=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var o={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:o.v,dv:t(o)}}function r(a,n){var i={dx:a.v,dv:t(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),u=e(a,n,s),l=1/6*(i.dx+2*(o.dx+s.dx)+u.dx),f=1/6*(i.dv+2*(o.dv+s.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+f*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,v=16/1e3,c,h,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,o=o||null,s.tension=n,s.friction=i,c=o!==null,c?(l=a(n,i),h=l/o*v):h=v;d=r(d||s,h),u.push(1+d.x),l+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return c?function(p){return u[p*(u.length-1)|0]}:l}}(),et=function(e,r,a,n){var i=Cp(e,r,a,n);return function(o,s,u){return o+(s-o)*i(u)}},Vn={linear:function(e,r,a){return e+(r-e)*a},ease:et(.25,.1,.25,1),"ease-in":et(.42,0,1,1),"ease-out":et(0,0,.58,1),"ease-in-out":et(.42,0,.58,1),"ease-in-sine":et(.47,0,.745,.715),"ease-out-sine":et(.39,.575,.565,1),"ease-in-out-sine":et(.445,.05,.55,.95),"ease-in-quad":et(.55,.085,.68,.53),"ease-out-quad":et(.25,.46,.45,.94),"ease-in-out-quad":et(.455,.03,.515,.955),"ease-in-cubic":et(.55,.055,.675,.19),"ease-out-cubic":et(.215,.61,.355,1),"ease-in-out-cubic":et(.645,.045,.355,1),"ease-in-quart":et(.895,.03,.685,.22),"ease-out-quart":et(.165,.84,.44,1),"ease-in-out-quart":et(.77,0,.175,1),"ease-in-quint":et(.755,.05,.855,.06),"ease-out-quint":et(.23,1,.32,1),"ease-in-out-quint":et(.86,0,.07,1),"ease-in-expo":et(.95,.05,.795,.035),"ease-out-expo":et(.19,1,.22,1),"ease-in-out-expo":et(1,0,0,1),"ease-in-circ":et(.6,.04,.98,.335),"ease-out-circ":et(.075,.82,.165,1),"ease-in-out-circ":et(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return Vn.linear;var n=Sp(e,r,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":et};function zf(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function Vf(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function ua(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var o=Vf(t,n),s=Vf(e,n);if(be(o)&&be(s))return zf(i,o,s,r,a);if(Je(o)&&Je(s)){for(var u=[],l=0;l<s.length;l++){var f=o[l],v=s[l];if(f!=null&&v!=null){var c=zf(i,f,v,r,a);u.push(c)}else u.push(v)}return u}}function Ap(t,e,r,a){var n=!a,i=t._private,o=e._private,s=o.easing,u=o.startTime,l=a?t:t.cy(),f=l.style();if(!o.easingImpl)if(s==null)o.easingImpl=Vn.linear;else{var v;if(Ne(s)){var c=f.parse("transition-timing-function",s);v=c.value}else v=s;var h,d;Ne(v)?(h=v,d=[]):(h=v[1],d=v.slice(2).map(function(z){return+z})),d.length>0?(h==="spring"&&d.push(o.duration),o.easingImpl=Vn[h].apply(null,d)):o.easingImpl=Vn[h]}var p=o.easingImpl,y;if(o.duration===0?y=1:y=(r-u)/o.duration,o.applying&&(y=o.progress),y<0?y=0:y>1&&(y=1),o.delay==null){var g=o.startPosition,b=o.position;if(b&&n&&!t.locked()){var m={};Va(g.x,b.x)&&(m.x=ua(g.x,b.x,y,p)),Va(g.y,b.y)&&(m.y=ua(g.y,b.y,y,p)),t.position(m)}var w=o.startPan,T=o.pan,D=i.pan,x=T!=null&&a;x&&(Va(w.x,T.x)&&(D.x=ua(w.x,T.x,y,p)),Va(w.y,T.y)&&(D.y=ua(w.y,T.y,y,p)),t.emit("pan"));var M=o.startZoom,P=o.zoom,N=P!=null&&a;N&&(Va(M,P)&&(i.zoom=Ma(i.minZoom,ua(M,P,y,p),i.maxZoom)),t.emit("zoom")),(x||N)&&t.emit("viewport");var O=o.style;if(O&&O.length>0&&n){for(var R=0;R<O.length;R++){var I=O[R],E=I.name,A=I,S=o.startStyle[E],C=f.properties[S.name],L=ua(S,A,y,p,C);f.overrideBypass(t,E,L)}t.emit("style")}}return o.progress=y,y}function Va(t,e){return t==null||e==null?!1:be(t)&&be(e)?!0:!!(t&&e)}function Dp(t,e,r,a){var n=e._private;n.started=!0,n.startTime=r-n.progress*n.duration}function Gf(t,e){var r=e._private.aniEles,a=[];function n(f,v){var c=f._private,h=c.animation.current,d=c.animation.queue,p=!1;if(h.length===0){var y=d.shift();y&&h.push(y)}for(var g=function(D){for(var x=D.length-1;x>=0;x--){var M=D[x];M()}D.splice(0,D.length)},b=h.length-1;b>=0;b--){var m=h[b],w=m._private;if(w.stopped){h.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Dp(f,m,t),Ap(f,m,t,v),w.applying&&(w.applying=!1),g(w.frames),w.step!=null&&w.step(t),m.completed()&&(h.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.completes)),p=!0)}return!v&&h.length===0&&d.length===0&&a.push(f),p}for(var i=!1,o=0;o<r.length;o++){var s=r[o],u=n(s);i=i||u}var l=n(e,!0);(i||l)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var Lp={animate:$e.animate(),animation:$e.animation(),animated:$e.animated(),clearQueue:$e.clearQueue(),delay:$e.delay(),delayAnimation:$e.delayAnimation(),stop:$e.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&ln(function(i){Gf(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){Gf(o,e)},a.beforeRenderPriorities.animations):r()}},Mp={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&wa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},Gn=function(e){return Ne(e)?new gr(e):e},Uf={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new On(Mp,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,Gn(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,Gn(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,Gn(r),a),this},once:function(e,r,a){return this.emitter().one(e,Gn(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};$e.eventAliasesOn(Uf);var os={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};os.jpeg=os.jpg;var Un={layout:function(e){var r=this;if(e==null){at("Layout options must be specified to make a layout");return}if(e.name==null){at("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){at("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;Ne(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var o=new n(Oe({},e,{cy:r,eles:i}));return o}};Un.createLayout=Un.makeLayout=Un.layout;var Rp={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],o=e[i],s=r.getElementById(i);s.data(o)}})}},Np=xt({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),ss={renderTo:function(e,r,a,n){var i=this._private.renderer;return i.renderTo(e,r,a,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var r=this,a=r.extension("renderer",e.name);if(a==null){at("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Xe("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=Np(e);n.cy=r,r._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};ss.invalidateDimensions=ss.resize;var Hn={collection:function(e,r){return Ne(e)?this.$(e):Ft(e)?e.collection():Je(e)?(r||(r={}),new Ct(this,e,r.unique,r.removed)):new Ct(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};Hn.elements=Hn.filter=Hn.$;var bt={},Ga="t",Pp="f";bt.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i<t.length;i++){var o=t[i],s=e.getContextMeta(o);if(!s.empty){var u=e.getContextStyle(s),l=e.applyContextStyle(s,u,o);o._private.appliedInitStyle?e.updateTransitions(o,l.diffProps):o._private.appliedInitStyle=!0;var f=e.updateStyleHints(o);f&&n.push(o)}}return n},bt.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},n=t+"-"+e,i=a[n];if(i)return i;for(var o=[],s={},u=0;u<r.length;u++){var l=r[u],f=t[u]===Ga,v=e[u]===Ga,c=f!==v,h=l.mappedProperties.length>0;if(c||v&&h){var d=void 0;c&&h||c?d=l.properties:h&&(d=l.mappedProperties);for(var p=0;p<d.length;p++){for(var y=d[p],g=y.name,b=!1,m=u+1;m<r.length;m++){var w=r[m],T=e[m]===Ga;if(T&&(b=w.properties[y.name]!=null,b))break}!s[g]&&!b&&(s[g]=!0,o.push(g))}}}return a[n]=o,o},bt.getContextMeta=function(t){for(var e=this,r="",a,n=t._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],s=o.selector&&o.selector.matches(t);s?r+=Ga:r+=Pp}return a=e.getPropertiesDiff(n,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}},bt.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<r.length;i++){var o=r[i],s=e[i]===Ga;if(s)for(var u=0;u<o.properties.length;u++){var l=o.properties[u];n[l.name]=l}}return a[e]=n,n},bt.applyContextStyle=function(t,e,r){for(var a=this,n=t.diffPropNames,i={},o=a.types,s=0;s<n.length;s++){var u=n[s],l=e[u],f=r.pstyle(u);if(!l)if(f)f.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(f!==l){if(l.mapped===o.fn&&f!=null&&f.mapping!=null&&f.mapping.value===l.value){var v=f.mapping,c=v.fnValue=l.value(r);if(c===v.prevFnValue)continue}var h=i[u]={prev:f};a.applyParsedProperty(r,l),h.next=r.pstyle(u),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},bt.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,n=r.propertyGroupKeys,i=function(X,ee,te){return r.getPropertiesHash(X,ee,te)},o=e.styleKey;if(t.removed())return!1;var s=e.group==="nodes",u=t._private.style;a=Object.keys(u);for(var l=0;l<n.length;l++){var f=n[l];e.styleKeys[f]=[Dr,Wr]}for(var v=function(X,ee){return e.styleKeys[ee][0]=Sa(X,e.styleKeys[ee][0])},c=function(X,ee){return e.styleKeys[ee][1]=Aa(X,e.styleKeys[ee][1])},h=function(X,ee){v(X,ee),c(X,ee)},d=function(X,ee){for(var te=0;te<X.length;te++){var ge=X.charCodeAt(te);v(ge,ee),c(ge,ee)}},p=2e9,y=function(X){return-128<X&&X<128&&Math.floor(X)!==X?p-(X*1024|0):X},g=0;g<a.length;g++){var b=a[g],m=u[b];if(m!=null){var w=this.properties[b],T=w.type,D=w.groupKey,x=void 0;w.hashOverride!=null?x=w.hashOverride(t,m):m.pfValue!=null&&(x=m.pfValue);var M=w.enums==null?m.value:null,P=x!=null,N=M!=null,O=P||N,R=m.units;if(T.number&&O&&!T.multiple){var I=P?x:M;h(y(I),D),!P&&R!=null&&d(R,D)}else d(m.strValue,D)}}for(var E=[Dr,Wr],A=0;A<n.length;A++){var S=n[A],C=e.styleKeys[S];E[0]=Sa(C[0],E[0]),E[1]=Aa(C[1],E[1])}e.styleKey=Xh(E[0],E[1]);var L=e.styleKeys;e.labelDimsKey=lr(L.labelDimensions);var z=i(t,["label"],L.labelDimensions);if(e.labelKey=lr(z),e.labelStyleKey=lr(fn(L.commonLabel,z)),!s){var k=i(t,["source-label"],L.labelDimensions);e.sourceLabelKey=lr(k),e.sourceLabelStyleKey=lr(fn(L.commonLabel,k));var F=i(t,["target-label"],L.labelDimensions);e.targetLabelKey=lr(F),e.targetLabelStyleKey=lr(fn(L.commonLabel,F))}if(s){var H=e.styleKeys,W=H.nodeBody,Q=H.nodeBorder,K=H.nodeOutline,Z=H.backgroundImage,j=H.compound,re=H.pie,q=H.stripe,U=[W,Q,K,Z,j,re,q].filter(function(Y){return Y!=null}).reduce(fn,[Dr,Wr]);e.nodeKey=lr(U),e.hasPie=re!=null&&re[0]!==Dr&&re[1]!==Wr,e.hasStripe=q!=null&&q[0]!==Dr&&q[1]!==Wr}return o!==e.styleKey},bt.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null},bt.applyParsedProperty=function(t,e){var r=this,a=e,n=t._private.style,i,o=r.types,s=r.properties[a.name].type,u=a.bypass,l=n[a.name],f=l&&l.bypass,v=t._private,c="mapping",h=function(W){return W==null?null:W.pfValue!=null?W.pfValue:W.value},d=function(){var W=h(l),Q=h(a);r.checkTriggers(t,a.name,W,Q)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",u)),a.delete)return n[a.name]=void 0,d(),!0;if(a.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,d(),!0):!1:(d(),!0);if(a.deleteBypass)return l?l.bypass?(n[a.name]=l.bypassed,d(),!0):!1:(d(),!0);var p=function(){Xe("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:{for(var y=a.field.split("."),g=v.data,b=0;b<y.length&&g;b++){var m=y[b];g=g[m]}if(g==null)return p(),!1;var w;if(be(g)){var T=a.fieldMax-a.fieldMin;T===0?w=0:w=(g-a.fieldMin)/T}else return Xe("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+g+"` for `"+t.id()+"` is non-numeric)"),!1;if(w<0?w=0:w>1&&(w=1),s.color){var D=a.valueMin[0],x=a.valueMax[0],M=a.valueMin[1],P=a.valueMax[1],N=a.valueMin[2],O=a.valueMax[2],R=a.valueMin[3]==null?1:a.valueMin[3],I=a.valueMax[3]==null?1:a.valueMax[3],E=[Math.round(D+(x-D)*w),Math.round(M+(P-M)*w),Math.round(N+(O-N)*w),Math.round(R+(I-R)*w)];i={bypass:a.bypass,name:a.name,value:E,strValue:"rgb("+E[0]+", "+E[1]+", "+E[2]+")"}}else if(s.number){var A=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,A,a.bypass,c)}else return!1;if(!i)return p(),!1;i.mapping=a,a=i;break}case o.data:{for(var S=a.field.split("."),C=v.data,L=0;L<S.length&&C;L++){var z=S[L];C=C[z]}if(C!=null&&(i=this.parse(a.name,C,a.bypass,c)),!i)return p(),!1;i.mapping=a,a=i;break}case o.fn:{var k=a.value,F=a.fnValue!=null?a.fnValue:k(t);if(a.prevFnValue=F,F==null)return Xe("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(a.name,F,a.bypass,c),!i)return Xe("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=Yt(a),a=i;break}case void 0:break;default:return!1}return u?(f?a.bypassed=l.bypassed:a.bypassed=l,n[a.name]=a):f?l.bypassed=a:n[a.name]=a,d(),!0},bt.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],u=n[s];u!=null&&(u.bypass?u.bypassed=null:n[s]=null)}}},bt.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()},bt.updateTransitions=function(t,e){var r=this,a=t._private,n=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var s={},u=!1,l=0;l<n.length;l++){var f=n[l],v=t.pstyle(f),c=e[f];if(c){var h=c.prev,d=h,p=c.next!=null?c.next:v,y=!1,g=void 0,b=1e-6;d&&(be(d.pfValue)&&be(p.pfValue)?(y=p.pfValue-d.pfValue,g=d.pfValue+b*y):be(d.value)&&be(p.value)?(y=p.value-d.value,g=d.value+b*y):Je(d.value)&&Je(p.value)&&(y=d.value[0]!==p.value[0]||d.value[1]!==p.value[1]||d.value[2]!==p.value[2],g=d.strValue),y&&(s[f]=p.strValue,this.applyBypass(t,f,g),u=!0))}}if(!u)return;a.transitioning=!0,new jr(function(m){o>0?t.delayAnimation(o).play().promise().then(m):m()}).then(function(){return t.animation({style:s,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)},bt.checkTrigger=function(t,e,r,a,n,i){var o=this.properties[e],s=n(o);t.removed()||s!=null&&s(r,a,t)&&i(o)},bt.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})},bt.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})},bt.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},bt.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){t.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},bt.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a),this.checkConnectedEdgesBoundsTrigger(t,e,r,a),this.checkParallelEdgesBoundsTrigger(t,e,r,a)};var Ua={};Ua.applyBypass=function(t,e,r,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var s=0;s<n.properties.length;s++){var u=n.properties[s],l=u.name,f=this.parse(l,r,!0);f&&i.push(f)}}else if(Ne(e)){var v=this.parse(e,r,!0);v&&i.push(v)}else if(Ue(e)){var c=e;a=r;for(var h=Object.keys(c),d=0;d<h.length;d++){var p=h[d],y=c[p];if(y===void 0&&(y=c[on(p)]),y!==void 0){var g=this.parse(p,y,!0);g&&i.push(g)}}}else return!1;if(i.length===0)return!1;for(var b=!1,m=0;m<t.length;m++){for(var w=t[m],T={},D=void 0,x=0;x<i.length;x++){var M=i[x];if(a){var P=w.pstyle(M.name);D=T[M.name]={prev:P}}b=this.applyParsedProperty(w,Yt(M))||b,a&&(D.next=w.pstyle(M.name))}b&&this.updateStyleHints(w),a&&this.updateTransitions(w,T,o)}return b},Ua.overrideBypass=function(t,e,r){e=gi(e);for(var a=0;a<t.length;a++){var n=t[a],i=n._private.style[e],o=this.properties[e].type,s=o.color,u=o.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),s?i.strValue="rgb("+r.join(",")+")":u?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(n)),this.checkTriggers(n,e,l,r)}},Ua.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)},Ua.removeBypasses=function(t,e,r){for(var a=!0,n=0;n<t.length;n++){for(var i=t[n],o={},s=0;s<e.length;s++){var u=e[s],l=this.properties[u],f=i.pstyle(l.name);if(!(!f||!f.bypass)){var v="",c=this.parse(u,v,!0),h=o[l.name]={prev:f};this.applyParsedProperty(i,c),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,o,a)}};var us={};us.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1},us.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var Xt={};Xt.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)},Xt.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},n=0;n<r.properties.length;n++){var i=r.properties[n],o=r.getStylePropertyValue(t,i.name,e);o!=null&&(a[i.name]=o,a[on(i.name)]=o)}return a}},Xt.getIndexedStyle=function(t,e,r,a){var n=t.pstyle(e)[r][a];return n??t.cy().style().getDefaultProperty(e)[r][0]},Xt.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,o=t.pstyle(n.name);if(o){var s=o.value,u=o.units,l=o.strValue;if(r&&i.number&&s!=null&&be(s)){var f=t.cy().zoom(),v=function(y){return y*f},c=function(y,g){return v(y)+g},h=Je(s),d=h?u.every(function(p){return p!=null}):u!=null;return d?h?s.map(function(p,y){return c(p,u[y])}).join(" "):c(s,u):h?s.map(function(p){return Ne(p)?p:""+v(p)}).join(" "):""+v(s)}else if(l!=null)return l}return null}},Xt.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var n=e[a],i=n.name,o=t.pstyle(i);o!==void 0&&(Ue(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(r[i]=o)}return r},Xt.getPropsList=function(t){var e=this,r=[],a=t,n=e.properties;if(a)for(var i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],u=a[s],l=n[s]||n[gi(s)],f=this.parse(l.name,u);f&&r.push(f)}return r},Xt.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),n,i,o,s,u,l;for(u=0;u<e.length;u++)if(n=e[u],i=t.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=Sa(s,a[0]),a[1]=Aa(s,a[1]);else for(o=i.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),a[0]=Sa(s,a[0]),a[1]=Aa(s,a[1]);return a},Xt.getPropertiesHash=Xt.getNonDefaultPropertiesHash;var qn={};qn.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],n=a.selector,i=a.style||a.css,o=Object.keys(i);e.selector(n);for(var s=0;s<o.length;s++){var u=o[s],l=i[u];e.css(u,l)}}return e},qn.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e},qn.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,n=r.properties,i={},o=0;o<n.length;o++){var s=n[o];i[s.name]=s.strValue}t.push({selector:a?a.toString():"core",style:i})}return t};var ls={};ls.appendFromString=function(t){var e=this,r=this,a=""+t,n,i,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){a.length>n.length?a=a.substr(n.length):a=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var l=a.match(/^\s*$/);if(l)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Xe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var v=f[1];if(v!=="core"){var c=new gr(v);if(c.invalid){Xe("Skipping parsing of block: Invalid selector found in string stylesheet: "+v),s();continue}}var h=f[2],d=!1;i=h;for(var p=[];;){var y=i.match(/^\s*$/);if(y)break;var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Xe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}o=g[0];var b=g[1],m=g[2],w=e.properties[b];if(!w){Xe("Skipping property: Invalid property name in: "+o),u();continue}var T=r.parse(b,m);if(!T){Xe("Skipping property: Invalid property definition in: "+o),u();continue}p.push({name:b,val:m}),u()}if(d){s();break}r.selector(v);for(var D=0;D<p.length;D++){var x=p[D];r.css(x.name,x.val)}s()}return r},ls.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var ht={};(function(){var t=gt,e=Ch,r=Ah,a=Dh,n=Lh,i=function(Y){return"^"+Y+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(Y){var X=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+n;return"^"+Y+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+X+")\\s*\\,\\s*("+X+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];ht.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","top-inside","center","bottom","bottom-inside"]},halign:{enums:["left","left-inside","center","right","right-inside"]},justification:{enums:["left","center","right","auto"]},textMetrics:{enums:["font","glyph"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(Y,X){switch(Y.length){case 2:return X[0]!=="deg"&&X[0]!=="rad"&&X[1]!=="deg"&&X[1]!=="rad";case 1:return Ne(Y[0])||X[0]==="deg"||X[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(Y){var X=Y.length;return X===1||X===2||X===4}}};var u={zeroNonZero:function(Y,X){return(Y==null||X==null)&&Y!==X||Y==0&&X!=0?!0:Y!=0&&X==0},any:function(Y,X){return Y!=X},emptyNonEmpty:function(Y,X){var ee=sr(Y),te=sr(X);return ee&&!te||!ee&&te}},l=ht.types,f=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],v=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],c=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],h=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],d=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"text-metrics",type:l.textMetrics},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],p=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any},{name:"box-selection",type:l.boxSelection,triggersZOrder:u.any}],y=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(Y,X,ee){return Y===X?!1:ee.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],g=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],b=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],m=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],w=function(Y,X){return X.value==="label"?-Y.poolIndex():X.pfValue},T=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],D=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],x=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],M=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],P=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],N=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(Y,X){return Y===X?!1:Y==="bezier"||X==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],O=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],R=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],I=[];ht.pieBackgroundN=16,I.push({name:"pie-size",type:l.sizeMaybePercent}),I.push({name:"pie-hole",type:l.sizeMaybePercent}),I.push({name:"pie-start-angle",type:l.angle});for(var E=1;E<=ht.pieBackgroundN;E++)I.push({name:"pie-"+E+"-background-color",type:l.color}),I.push({name:"pie-"+E+"-background-size",type:l.percent}),I.push({name:"pie-"+E+"-background-opacity",type:l.zeroOneNumber});var A=[];ht.stripeBackgroundN=16,A.push({name:"stripe-size",type:l.sizeMaybePercent}),A.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var S=1;S<=ht.stripeBackgroundN;S++)A.push({name:"stripe-"+S+"-background-color",type:l.color}),A.push({name:"stripe-"+S+"-background-size",type:l.percent}),A.push({name:"stripe-"+S+"-background-opacity",type:l.zeroOneNumber});var C=[],L=ht.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(U){L.forEach(function(Y){var X=Y+"-"+U.name,ee=U.type,te=U.triggersBounds;C.push({name:X,type:ee,triggersBounds:te})})},{});var z=ht.properties=[].concat(p,m,y,g,b,O,d,h,f,v,c,T,D,x,M,I,A,P,N,C,R),k=ht.propertyGroups={behavior:p,transition:m,visibility:y,overlay:g,underlay:b,ghost:O,commonLabel:d,labelDimensions:h,mainLabel:f,sourceLabel:v,targetLabel:c,nodeBody:T,nodeBorder:D,nodeOutline:x,backgroundImage:M,pie:I,stripe:A,compound:P,edgeLine:N,edgeArrow:C,core:R},F=ht.propertyGroupNames={},H=ht.propertyGroupKeys=Object.keys(k);H.forEach(function(U){F[U]=k[U].map(function(Y){return Y.name}),k[U].forEach(function(Y){return Y.groupKey=U})});var W=ht.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];ht.propertyNames=z.map(function(U){return U.name});for(var Q=0;Q<z.length;Q++){var K=z[Q];z[K.name]=K}for(var Z=0;Z<W.length;Z++){var j=W[Z],re=z[j.pointsTo],q={name:j.name,alias:!0,pointsTo:re};z.push(q),z[j.name]=q}})(),ht.getDefaultProperty=function(t){return this.getDefaultProperties()[t]},ht.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=Oe({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","text-metrics":"font","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=ht.pieBackgroundN;f++){var v=l.name.replace("{{i}}",f),c=l.value;u[v]=c}return u},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=ht.stripeBackgroundN;f++){var v=l.name.replace("{{i}}",f),c=l.value;u[v]=c}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return ht.arrowPrefixes.forEach(function(f){var v=f+"-"+l.name,c=l.value;u[v]=c}),u},{})),r={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,o=e[i],s=this.parse(i,o);r[i]=s}}return t.defaultProperties=r,t.defaultProperties},ht.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Yn={};Yn.parse=function(t,e,r,a){var n=this;if(it(e))return n.parseImplWarn(t,e,r,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=r?"t":"f",s=""+e,u=hu(t,s,o,i),l=n.propCache=n.propCache||[],f;return(f=l[u])||(f=l[u]=n.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(f=Yt(f),f&&(f.value=Yt(f.value))),f},Yn.parseImplWarn=function(t,e,r,a){var n=this.parseImpl(t,e,r,a);return!n&&e!=null&&Xe("The style property `".concat(t,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Xe("The style value of `label` is deprecated for `"+n.name+"`"),n},Yn.parseImpl=function(t,e,r,a){var n=this;t=gi(t);var i=n.properties[t],o=e,s=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var u=Ne(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(it(e))return{name:t,value:e,strValue:"fn",mapped:s.fn,bypass:r};var f,v;if(!(!u||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(s.data.regex).exec(e))){if(r)return!1;var c=s.data;return{name:t,value:f,strValue:""+e,mapped:c,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(v=new RegExp(s.mapData.regex).exec(e))){if(r||l.multiple)return!1;var h=s.mapData;if(!(l.color||l.number))return!1;var d=this.parse(t,v[4]);if(!d||d.mapped)return!1;var p=this.parse(t,v[5]);if(!p||p.mapped)return!1;if(d.pfValue===p.pfValue||d.strValue===p.strValue)return Xe("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+d.strValue+"`"),this.parse(t,d.strValue);if(l.color){var y=d.value,g=p.value,b=y[0]===g[0]&&y[1]===g[1]&&y[2]===g[2]&&(y[3]===g[3]||(y[3]==null||y[3]===1)&&(g[3]==null||g[3]===1));if(b)return!1}return{name:t,value:v,strValue:""+e,mapped:h,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:d.value,valueMax:p.value,bypass:r}}}if(l.multiple&&a!=="multiple"){var m;if(u?m=e.split(/\s+/):Je(e)?m=e:m=[e],l.evenMultiple&&m.length%2!==0)return null;for(var w=[],T=[],D=[],x="",M=!1,P=0;P<m.length;P++){var N=n.parse(t,m[P],r,"multiple");M=M||Ne(N.value),w.push(N.value),D.push(N.pfValue!=null?N.pfValue:N.value),T.push(N.units),x+=(P>0?" ":"")+N.strValue}return l.validate&&!l.validate(w,T)?null:l.singleEnum&&M?w.length===1&&Ne(w[0])?{name:t,value:w[0],strValue:w[0],bypass:r}:null:{name:t,value:w,pfValue:D,strValue:x,bypass:r,units:T}}var O=function(){for(var q=0;q<l.enums.length;q++){var U=l.enums[q];if(U===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(l.number){var R,I="px";if(l.units&&(R=l.units),l.implicitUnits&&(I=l.implicitUnits),!l.unitless)if(u){var E="px|em"+(l.allowPercent?"|\\%":"");R&&(E=R);var A=e.match("^("+gt+")("+E+")?$");A&&(e=A[1],R=A[2]||I)}else(!R||l.implicitUnits)&&(R=I);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=o,O();if(l.integer&&!zs(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var S={name:t,value:e,strValue:""+e+(R||""),units:R,bypass:r};return l.unitless||R!=="px"&&R!=="em"?S.pfValue=e:S.pfValue=R==="px"||!R?e:this.getEmSizeInPixels()*e,(R==="ms"||R==="s")&&(S.pfValue=R==="ms"?e:1e3*e),(R==="deg"||R==="rad")&&(S.pfValue=R==="rad"?e:Lc(e)),R==="%"&&(S.pfValue=e/100),S}else if(l.propList){var C=[],L=""+e;if(L!=="none"){for(var z=L.split(/\s*,\s*|\s+/),k=0;k<z.length;k++){var F=z[k].trim();n.properties[F]?C.push(F):Xe("`"+F+"` is not a valid property name")}if(C.length===0)return null}return{name:t,value:C,strValue:C.length===0?"none":C.join(" "),bypass:r}}else if(l.color){var H=Ys(e);return H?{name:t,value:H,pfValue:H,strValue:"rgb("+H[0]+","+H[1]+","+H[2]+")",bypass:r}:null}else if(l.regex||l.regexes){if(l.enums){var W=O();if(W)return W}for(var Q=l.regexes?l.regexes:[l.regex],K=0;K<Q.length;K++){var Z=new RegExp(Q[K]),j=Z.exec(e);if(j)return{name:t,value:l.singleRegexMatchValue?j[1]:j,strValue:""+e,bypass:r}}return null}else return l.string?{name:t,value:""+e,strValue:""+e,bypass:r}:l.enums?O():null};var wt=function(e){if(!(this instanceof wt))return new wt(e);if(!di(e)){at("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Dt=wt.prototype;Dt.instanceString=function(){return"style"},Dt.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this},Dt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Dt.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)},Dt.selector=function(t){var e=t==="core"?null:new gr(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this},Dt.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var n=t.properties[a],i=r[n.name];i===void 0&&(i=r[on(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this},Dt.style=Dt.css,Dt.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[a].mappedProperties.push(r);var n=!this[a].selector;n&&(this._private.coreStyle[r.name]=r)}return this},Dt.append=function(t){return Gs(t)?t.appendToStyle(this):Je(t)?this.appendFromJson(t):Ne(t)&&this.appendFromString(t),this},wt.fromJson=function(t,e){var r=new wt(t);return r.fromJson(e),r},wt.fromString=function(t,e){return new wt(t).fromString(e)},[bt,Ua,us,Xt,qn,ls,ht,Yn].forEach(function(t){Oe(Dt,t)}),wt.types=Dt.types,wt.properties=Dt.properties,wt.propertyGroups=Dt.propertyGroups,wt.propertyGroupNames=Dt.propertyGroupNames,wt.propertyGroupKeys=Dt.propertyGroupKeys;var Op={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return Gs(e)?r.style=e.generateStyle(this):Je(e)?r.style=wt.fromJson(this,e):Ne(e)?r.style=wt.fromString(this,e):r.style=wt(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},Ip="single",Or={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=Ip),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,a,n,i,o,s;switch(e.length){case 0:return r;case 1:if(Ne(e[0]))return a=e[0],r[a];if(Ue(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,s=i.y,be(o)&&(r.x=o),be(s)&&(r.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&be(n)&&(r[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,n=this._private.pan,i,o,s,u,l;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Ue(e)&&(s=a[0],u=s.x,l=s.y,be(u)&&(n.x+=u),be(l)&&(n.y+=l),this.emit("pan viewport"));break;case 2:i=e,o=r,(i==="x"||i==="y")&&be(o)&&(n[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,r){var a=this.getFitViewport(e,r);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(be(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(Ne(e)){var n=e;e=this.$(n)}else if(wh(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else Ft(e)||(e=this.mutableElements());if(!(Ft(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),s=this.height(),u;if(r=be(r)?r:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((o-2*r)/a.w,(s-2*r)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(o-u*(a.x1+a.x2))/2,y:(s-u*(a.y1+a.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var n=e;e=n.min,r=n.max}return be(e)&&be(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):be(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:be(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,n=r.zoom,i,o,s=!1;if(r.zoomingEnabled||(s=!0),be(e)?o=e:Ue(e)&&(o=e.level,e.position!=null?i=dn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(s=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,s||!be(o)||o===n||i!=null&&(!be(i.x)||!be(i.y)))return null;if(i!=null){var u=a,l=n,f=o,v={x:-f/l*(i.x-u.x)+i.x,y:-f/l*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:v}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,n=!0,i=[],o=!1,s=!1;if(!e)return this;if(be(e.zoom)||(a=!1),Ue(e.pan)||(n=!1),!a&&!n)return this;if(a){var u=e.zoom;u<r.minZoom||u>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=u,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var l=e.pan;be(l.x)&&(r.pan.x=l.x,s=!1),be(l.y)&&(r.pan.y=l.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(Ne(e)){var a=e;e=this.mutableElements().filter(a)}else Ft(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var s={x:(i-r*(n.x1+n.x2))/2,y:(o-r*(n.y1+n.y2))/2};return s}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?function(){var n=a.window().getComputedStyle(r),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Or.centre=Or.center,Or.autolockNodes=Or.autolock,Or.autoungrabifyNodes=Or.autoungrabify;var Ha={data:$e.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:$e.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:$e.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:$e.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ha.attr=Ha.data,Ha.removeAttr=Ha.removeData;var qa=function(e){var r=this;e=Oe({},e);var a=e.container;a&&!nn(a)&&nn(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var o=dt!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=Oe({name:o?"grid":"null"},s.layout),s.renderer=Oe({name:o?"canvas":"null"},s.renderer);var u=function(d,p,y){return p!==void 0?p:y!==void 0?y:d},l=this._private={container:a,ready:!1,options:s,elements:new Ct(this),listeners:[],aniEles:new Ct(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,s.zoomingEnabled),userZoomingEnabled:u(!0,s.userZoomingEnabled),panningEnabled:u(!0,s.panningEnabled),userPanningEnabled:u(!0,s.userPanningEnabled),boxSelectionEnabled:u(!0,s.boxSelectionEnabled),autolock:u(!1,s.autolock,s.autolockNodes),autoungrabify:u(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:u(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:be(s.zoom)?s.zoom:1,pan:{x:Ue(s.pan)&&be(s.pan.x)?s.pan.x:0,y:Ue(s.pan)&&be(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var f=function(d,p){var y=d.some(Eh);if(y)return jr.all(d).then(p);p(d)};l.styleEnabled&&r.setStyle([]);var v=Oe({},s,s.renderer);r.initRenderer(v);var c=function(d,p,y){r.notifications(!1);var g=r.mutableElements();g.length>0&&g.remove(),d!=null&&(Ue(d)||Je(d))&&r.add(d),r.one("layoutready",function(m){r.notifications(!0),r.emit(m),r.one("load",p),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",y),r.emit("done")});var b=Oe({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};f([s.style,s.elements],function(h){var d=h[0],p=h[1];l.styleEnabled&&r.style().append(d),c(p,function(){r.startAnimationLoop(),l.ready=!0,it(s.ready)&&r.on("ready",s.ready);for(var y=0;y<i.length;y++){var g=i[y];r.on("ready",g)}n&&(n.readies=[]),r.emit("ready")},s.done)})},Wn=qa.prototype;Oe(Wn,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return dt;var r=this._private.container.ownerDocument;return r===void 0||r==null?dt:r.defaultView||dt},mount:function(e){if(e!=null){var r=this,a=r._private,n=a.options;return!nn(e)&&nn(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(Oe({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),r.startAnimationLoop(),r.style(n.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Yt(this._private.options)},json:function(e){var r=this,a=r._private,n=r.mutableElements(),i=function(w){return r.getElementById(w.id())};if(Ue(e)){if(r.startBatch(),e.elements){var o={},s=function(w,T){for(var D=[],x=[],M=0;M<w.length;M++){var P=w[M];if(!P.data.id){Xe("cy.json() cannot handle elements without an ID attribute");continue}var N=""+P.data.id,O=r.getElementById(N);o[N]=!0,O.length!==0?x.push({ele:O,json:P}):(T&&(P.group=T),D.push(P))}r.add(D);for(var R=0;R<x.length;R++){var I=x[R],E=I.ele,A=I.json;E.json(A)}};if(Je(e.elements))s(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var f=u[l],v=e.elements[f];Je(v)&&s(v,f)}var c=r.collection();n.filter(function(m){return!o[m.id()]}).forEach(function(m){m.isParent()?c.merge(m):m.remove()}),c.forEach(function(m){return m.children().move({parent:null})}),c.forEach(function(m){return i(m).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<h.length;d++){var p=h[d];e[p]!=null&&r[p](e[p])}return r.endBatch(),this}else{var y=!!e,g={};y?g.elements=this.elements().map(function(m){return m.json()}):(g.elements={},n.forEach(function(m){var w=m.group();g.elements[w]||(g.elements[w]=[]),g.elements[w].push(m.json())})),this._private.styleEnabled&&(g.style=r.style().json()),g.data=Yt(r.data());var b=a.options;return g.zoomingEnabled=a.zoomingEnabled,g.userZoomingEnabled=a.userZoomingEnabled,g.zoom=a.zoom,g.minZoom=a.minZoom,g.maxZoom=a.maxZoom,g.panningEnabled=a.panningEnabled,g.userPanningEnabled=a.userPanningEnabled,g.pan=Yt(a.pan),g.boxSelectionEnabled=a.boxSelectionEnabled,g.renderer=Yt(b.renderer),g.hideEdgesOnViewport=b.hideEdgesOnViewport,g.textureOnViewport=b.textureOnViewport,g.wheelSensitivity=b.wheelSensitivity,g.motionBlur=b.motionBlur,g.multiClickDebounceTime=b.multiClickDebounceTime,g}}}),Wn.$id=Wn.getElementById,[Tp,Lp,Uf,os,Un,Rp,ss,Hn,Op,Or,Ha].forEach(function(t){Oe(Wn,t)});var Bp={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},Fp={maximal:!1,acyclic:!1},la=function(e){return e.scratch("breadthfirst")},Hf=function(e,r){return e.scratch("breadthfirst",r)};function qf(t){this.options=Oe({},Bp,Fp,t)}qf.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=r.nodes().filter(function(ce){return ce.isChildless()}),n=r,i=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=!!t.boundingBox,u=Rt(s?t.boundingBox:structuredClone(e.extent())),l;if(Ft(t.roots))l=t.roots;else if(Je(t.roots)){for(var f=[],v=0;v<t.roots.length;v++){var c=t.roots[v],h=e.getElementById(c);f.push(h)}l=e.collection(f)}else if(Ne(t.roots))l=e.$(t.roots);else if(i)l=a.roots();else{var d=r.components();l=e.collection();for(var p=function(){var ve=d[y],de=ve.maxDegree(!1),me=ve.filter(function(ye){return ye.degree(!1)===de});l=l.add(me)},y=0;y<d.length;y++)p()}var g=[],b={},m=function(ve,de){g[de]==null&&(g[de]=[]);var me=g[de].length;g[de].push(ve),Hf(ve,{index:me,depth:de})},w=function(ve,de){var me=la(ve),ye=me.depth,we=me.index;g[ye][we]=null,ve.isChildless()&&m(ve,de)};n.bfs({roots:l,directed:t.directed,visit:function(ve,de,me,ye,we){var Me=ve[0],Ie=Me.id();Me.isChildless()&&m(Me,we),b[Ie]=!0}});for(var T=[],D=0;D<a.length;D++){var x=a[D];b[x.id()]||T.push(x)}var M=function(ve){for(var de=g[ve],me=0;me<de.length;me++){var ye=de[me];if(ye==null){de.splice(me,1),me--;continue}Hf(ye,{depth:ve,index:me})}},P=function(ve,de){for(var me=la(ve),ye=ve.incomers().filter(function(B){return B.isNode()&&r.has(B)}),we=-1,Me=ve.id(),Ie=0;Ie<ye.length;Ie++){var Be=ye[Ie],Fe=la(Be);we=Math.max(we,Fe.depth)}if(me.depth<=we){if(!t.acyclic&&de[Me])return null;var oe=we+1;return w(ve,oe),de[Me]=oe,!0}return!1};if(i&&o){var N=[],O={},R=function(ve){return N.push(ve)},I=function(){return N.shift()};for(a.forEach(function(ce){return N.push(ce)});N.length>0;){var E=I(),A=P(E,O);if(A)E.outgoers().filter(function(ce){return ce.isNode()&&r.has(ce)}).forEach(R);else if(A===null){Xe("Detected double maximal shift for node `"+E.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var S=0;if(t.avoidOverlap)for(var C=0;C<a.length;C++){var L=a[C],z=L.layoutDimensions(t),k=z.w,F=z.h;S=Math.max(S,k,F)}var H={},W=function(ve){if(H[ve.id()])return H[ve.id()];for(var de=la(ve).depth,me=ve.neighborhood(),ye=0,we=0,Me=0;Me<me.length;Me++){var Ie=me[Me];if(!(Ie.isEdge()||Ie.isParent()||!a.has(Ie))){var Be=la(Ie);if(Be!=null){var Fe=Be.index,oe=Be.depth;if(!(Fe==null||oe==null)){var B=g[oe].length;oe<de&&(ye+=Fe/B,we++)}}}}return we=Math.max(1,we),ye=ye/we,we===0&&(ye=0),H[ve.id()]=ye,ye},Q=function(ve,de){var me=W(ve),ye=W(de),we=me-ye;return we===0?qs(ve.id(),de.id()):we};t.depthSort!==void 0&&(Q=t.depthSort);for(var K=g.length,Z=0;Z<K;Z++)g[Z].sort(Q),M(Z);for(var j=[],re=0;re<T.length;re++)j.push(T[re]);var q=function(){for(var ve=0;ve<K;ve++)M(ve)};j.length&&(g.unshift(j),K=g.length,q());for(var U=0,Y=0;Y<K;Y++)U=Math.max(g[Y].length,U);var X={x:u.x1+u.w/2,y:u.y1+u.h/2},ee=a.reduce(function(ce,ve){return function(de){return{w:ce.w===-1?de.w:(ce.w+de.w)/2,h:ce.h===-1?de.h:(ce.h+de.h)/2}}(ve.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),te=Math.max(K===1?0:s?(u.h-t.padding*2-ee.h)/(K-1):(u.h-t.padding*2-ee.h)/(K+1),S),ge=g.reduce(function(ce,ve){return Math.max(ce,ve.length)},0),Te=function(ve){var de=la(ve),me=de.depth,ye=de.index;if(t.circle){var we=Math.min(u.w/2/K,u.h/2/K);we=Math.max(we,S);var Me=we*me+we-(K>0&&g[0].length<=3?we/2:0),Ie=2*Math.PI/g[me].length*ye;return me===0&&g[0].length===1&&(Me=1),{x:X.x+Me*Math.cos(Ie),y:X.y+Me*Math.sin(Ie)}}else{var Be=g[me].length,Fe=Math.max(Be===1?0:s?(u.w-t.padding*2-ee.w)/((t.grid?ge:Be)-1):(u.w-t.padding*2-ee.w)/((t.grid?ge:Be)+1),S),oe={x:X.x+(ye+1-(Be+1)/2)*Fe,y:X.y+(me+1-(K+1)/2)*te};return oe}},pe={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(pe).indexOf(t.direction)===-1&&at("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(pe).join(", ")));var le=function(ve){return Zh(Te(ve),u,pe[t.direction])};return r.nodes().layoutPositions(this,t,le),this};var kp={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Yf(t){this.options=Oe({},kp,t)}Yf.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=Rt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,v=0,c=0;c<i.length;c++){var h=i[c],d=h.layoutDimensions(e),p=d.w,y=d.h;v=Math.max(v,p,y)}if(be(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(o.h,o.w)/2-v,i.length>1&&e.avoidOverlap){v*=1.75;var g=Math.cos(l)-Math.cos(0),b=Math.sin(l)-Math.sin(0),m=Math.sqrt(v*v/(g*g+b*b));f=Math.max(m,f)}var w=function(D,x){var M=e.startAngle+x*l*(n?1:-1),P=f*Math.cos(M),N=f*Math.sin(M),O={x:s.x+P,y:s.y+N};return O};return a.nodes().layoutPositions(this,e,w),this};var zp={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Wf(t){this.options=Oe({},zp,t)}Wf.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),o=Rt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,f=0;f<i.length;f++){var v=i[f],c=void 0;c=e.concentric(v),u.push({value:c,node:v}),v._private.scratch.concentric=c}i.updateStyle();for(var h=0;h<i.length;h++){var d=i[h],p=d.layoutDimensions(e);l=Math.max(l,p.w,p.h)}u.sort(function(te,ge){return ge.value-te.value});for(var y=e.levelWidth(i),g=[[]],b=g[0],m=0;m<u.length;m++){var w=u[m];if(b.length>0){var T=Math.abs(b[0].value-w.value);T>=y&&(b=[],g.push(b))}b.push(w)}var D=l+e.minNodeSpacing;if(!e.avoidOverlap){var x=g.length>0&&g[0].length>1,M=Math.min(o.w,o.h)/2-D,P=M/(g.length+x?1:0);D=Math.min(D,P)}for(var N=0,O=0;O<g.length;O++){var R=g[O],I=e.sweep===void 0?2*Math.PI-2*Math.PI/R.length:e.sweep,E=R.dTheta=I/Math.max(1,R.length-1);if(R.length>1&&e.avoidOverlap){var A=Math.cos(E)-Math.cos(0),S=Math.sin(E)-Math.sin(0),C=Math.sqrt(D*D/(A*A+S*S));N=Math.max(C,N)}R.r=N,N+=D}if(e.equidistant){for(var L=0,z=0,k=0;k<g.length;k++){var F=g[k],H=F.r-z;L=Math.max(L,H)}z=0;for(var W=0;W<g.length;W++){var Q=g[W];W===0&&(z=Q.r),Q.r=z,z+=L}}for(var K={},Z=0;Z<g.length;Z++)for(var j=g[Z],re=j.dTheta,q=j.r,U=0;U<j.length;U++){var Y=j[U],X=e.startAngle+(r?1:-1)*re*U,ee={x:s.x+q*Math.cos(X),y:s.y+q*Math.sin(X)};K[Y.node.id()]=ee}return n.nodes().layoutPositions(this,e,function(te){var ge=te.id();return K[ge]}),this};var fs,Vp={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Xn(t){this.options=Oe({},Vp,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(n){var i=n.source().data("id"),o=n.target().data("id"),s=e.some(function(l){return l.data("id")===i}),u=e.some(function(l){return l.data("id")===o});return!s||!u});this.options.eles=this.options.eles.not(a)}Xn.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?fs=!0:fs=!1;var a=Gp(e,r,t);fs&&Hp(a),t.randomize&&qp(a);var n=jt(),i=function(){Yp(a,e,t),t.fit===!0&&e.fit(t.padding)},o=function(c){return!(r.stopped||c>=t.numIter||(Wp(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},s=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var c=t.eles.nodes(),h=$f(a,t,c);c.layoutPositions(r,t,h)}},u=0,l=!0;if(t.animate===!0){var f=function(){for(var c=0;l&&c<t.refresh;)l=o(u),u++,c++;if(!l)Zf(a,t),s();else{var h=jt();h-n>=t.animationThreshold&&i(),ln(f)}};f()}else{for(;l;)l=o(u),u++;Zf(a,t),s()}return this},Xn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Xn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Gp=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=Rt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=a.eles.components(),l={},f=0;f<u.length;f++)for(var v=u[f],c=0;c<v.length;c++){var h=v[c];l[h.id()]=f}for(var f=0;f<s.nodeSize;f++){var d=i[f],p=d.layoutDimensions(a),y={};y.isLocked=d.locked(),y.id=d.data("id"),y.parentId=d.data("parent"),y.cmptId=l[d.id()],y.children=[],y.positionX=d.position("x"),y.positionY=d.position("y"),y.offsetX=0,y.offsetY=0,y.height=p.w,y.width=p.h,y.maxX=y.positionX+y.width/2,y.minX=y.positionX-y.width/2,y.maxY=y.positionY+y.height/2,y.minY=y.positionY-y.height/2,y.padLeft=parseFloat(d.style("padding")),y.padRight=parseFloat(d.style("padding")),y.padTop=parseFloat(d.style("padding")),y.padBottom=parseFloat(d.style("padding")),y.nodeRepulsion=it(a.nodeRepulsion)?a.nodeRepulsion(d):a.nodeRepulsion,s.layoutNodes.push(y),s.idToIndex[y.id]=f}for(var g=[],b=0,m=-1,w=[],f=0;f<s.nodeSize;f++){var d=s.layoutNodes[f],T=d.parentId;T!=null?s.layoutNodes[s.idToIndex[T]].children.push(d.id):(g[++m]=d.id,w.push(d.id))}for(s.graphSet.push(w);b<=m;){var D=g[b++],x=s.idToIndex[D],h=s.layoutNodes[x],M=h.children;if(M.length>0){s.graphSet.push(M);for(var f=0;f<M.length;f++)g[++m]=M[f]}}for(var f=0;f<s.graphSet.length;f++)for(var P=s.graphSet[f],c=0;c<P.length;c++){var N=s.idToIndex[P[c]];s.indexToGraph[N]=f}for(var f=0;f<s.edgeSize;f++){var O=n[f],R={};R.id=O.data("id"),R.sourceId=O.data("source"),R.targetId=O.data("target");var I=it(a.idealEdgeLength)?a.idealEdgeLength(O):a.idealEdgeLength,E=it(a.edgeElasticity)?a.edgeElasticity(O):a.edgeElasticity,A=s.idToIndex[R.sourceId],S=s.idToIndex[R.targetId],C=s.indexToGraph[A],L=s.indexToGraph[S];if(C!=L){for(var z=Up(R.sourceId,R.targetId,s),k=s.graphSet[z],F=0,y=s.layoutNodes[A];k.indexOf(y.id)===-1;)y=s.layoutNodes[s.idToIndex[y.parentId]],F++;for(y=s.layoutNodes[S];k.indexOf(y.id)===-1;)y=s.layoutNodes[s.idToIndex[y.parentId]],F++;I*=F*a.nestingFactor}R.idealLength=I,R.elasticity=E,s.layoutEdges.push(R)}return s},Up=function(e,r,a){var n=Xf(e,r,0,a);return 2>n.count?0:n.graph},Xf=function(e,r,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:a};for(var o=0,s=0;s<i.length;s++){var u=i[s],l=n.idToIndex[u],f=n.layoutNodes[l].children;if(f.length!==0){var v=n.indexToGraph[n.idToIndex[f[0]]],c=Xf(e,r,v,n);if(c.count!==0)if(c.count===1){if(o++,o===2)break}else return c}}return{count:o,graph:a}},Hp,qp=function(e,r){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*a,o.positionY=Math.random()*n)}},$f=function(e,r,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(o){var s=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,s.positionX),i.x2=Math.max(i.x2,s.positionX),i.y1=Math.min(i.y1,s.positionY),i.y2=Math.max(i.y2,s.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,s){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var l=i.w===0?.5:(u.positionX-i.x1)/i.w,f=i.h===0?.5:(u.positionY-i.y1)/i.h;return{x:n.x1+l*n.w,y:n.y1+f*n.h}}else return{x:u.positionX,y:u.positionY}}},Yp=function(e,r,a){var n=a.layout,i=a.eles.nodes(),o=$f(e,a,i);i.positions(o),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},Wp=function(e,r,a){Xp(e,r),_p(e),Zp(e,r),Qp(e),Jp(e)},Xp=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[n[o]]],u=o+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[n[u]]];$p(s,l,e,r)}},Kf=function(e){return-e+2*e*Math.random()},$p=function(e,r,a,n){var i=e.cmptId,o=r.cmptId;if(!(i!==o&&!a.isCompound)){var s=r.positionX-e.positionX,u=r.positionY-e.positionY,l=1;s===0&&u===0&&(s=Kf(l),u=Kf(l));var f=Kp(e,r,s,u);if(f>0)var v=n.nodeOverlap*f,c=Math.sqrt(s*s+u*u),h=v*s/c,d=v*u/c;else var p=$n(e,s,u),y=$n(r,-1*s,-1*u),g=y.x-p.x,b=y.y-p.y,m=g*g+b*b,c=Math.sqrt(m),v=(e.nodeRepulsion+r.nodeRepulsion)/m,h=v*g/c,d=v*b/c;e.isLocked||(e.offsetX-=h,e.offsetY-=d),r.isLocked||(r.offsetX+=h,r.offsetY+=d)}},Kp=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},$n=function(e,r,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,u=a/r,l=o/s,f={};return r===0&&0<a||r===0&&0>a?(f.x=n,f.y=i+o/2,f):0<r&&-1*l<=u&&u<=l?(f.x=n+s/2,f.y=i+s*a/2/r,f):0>r&&-1*l<=u&&u<=l?(f.x=n-s/2,f.y=i-s*a/2/r,f):0<a&&(u<=-1*l||u>=l)?(f.x=n+o*r/2/a,f.y=i+o/2,f):(0>a&&(u<=-1*l||u>=l)&&(f.x=n-o*r/2/a,f.y=i-o/2),f)},_p=function(e,r){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],o=e.layoutNodes[i],s=e.idToIndex[n.targetId],u=e.layoutNodes[s],l=u.positionX-o.positionX,f=u.positionY-o.positionY;if(!(l===0&&f===0)){var v=$n(o,l,f),c=$n(u,-1*l,-1*f),h=c.x-v.x,d=c.y-v.y,p=Math.sqrt(h*h+d*d),y=Math.pow(n.idealLength-p,2)/n.elasticity;if(p!==0)var g=y*h/p,b=y*d/p;else var g=0,b=0;o.isLocked||(o.offsetX+=g,o.offsetY+=b),u.isLocked||(u.offsetX-=g,u.offsetY-=b)}}},Zp=function(e,r){if(r.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],o=i.length;if(n===0)var s=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[l.parentId]],s=f.positionX,u=f.positionY;for(var v=0;v<o;v++){var c=e.layoutNodes[e.idToIndex[i[v]]];if(!c.isLocked){var h=s-c.positionX,d=u-c.positionY,p=Math.sqrt(h*h+d*d);if(p>a){var y=r.gravity*h/p,g=r.gravity*d/p;c.offsetX+=y,c.offsetY+=g}}}}},Qp=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var o=a[n++],s=e.idToIndex[o],u=e.layoutNodes[s],l=u.children;if(0<l.length&&!u.isLocked){for(var f=u.offsetX,v=u.offsetY,c=0;c<l.length;c++){var h=e.layoutNodes[e.idToIndex[l[c]]];h.offsetX+=f,h.offsetY+=v,a[++i]=l[c]}u.offsetX=0,u.offsetY=0}}},Jp=function(e,r){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=jp(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,_f(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},jp=function(e,r,a){var n=Math.sqrt(e*e+r*r);if(n>a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},_f=function(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return _f(n,r)}},Zf=function(e,r){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var o=a[i],s=o.cmptId,u=n[s]=n[s]||[];u.push(o)}for(var l=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var v=0;v<f.length;v++){var c=f[v];f.x1=Math.min(f.x1,c.positionX-c.width/2),f.x2=Math.max(f.x2,c.positionX+c.width/2),f.y1=Math.min(f.y1,c.positionY-c.height/2),f.y2=Math.max(f.y2,c.positionY+c.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,l+=f.w*f.h}}n.sort(function(b,m){return m.w*m.h-b.w*b.h});for(var h=0,d=0,p=0,y=0,g=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var v=0;v<f.length;v++){var c=f[v];c.isLocked||(c.positionX+=h-f.x1,c.positionY+=d-f.y1)}h+=f.w+r.componentSpacing,p+=f.w+r.componentSpacing,y=Math.max(y,f.h),p>g&&(d+=y+r.componentSpacing,h=0,p=0,y=0)}}},ey={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Qf(t){this.options=Oe({},ey,t)}Qf.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=Rt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(W){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),f=function(Q){if(Q==null)return Math.min(u,l);var K=Math.min(u,l);K==u?u=Q:l=Q},v=function(Q){if(Q==null)return Math.max(u,l);var K=Math.max(u,l);K==u?u=Q:l=Q},c=e.rows,h=e.cols!=null?e.cols:e.columns;if(c!=null&&h!=null)u=c,l=h;else if(c!=null&&h==null)u=c,l=Math.ceil(o/u);else if(c==null&&h!=null)l=h,u=Math.ceil(o/l);else if(l*u>o){var d=f(),p=v();(d-1)*p>=o?f(d-1):(p-1)*d>=o&&v(p-1)}else for(;l*u<o;){var y=f(),g=v();(g+1)*y>=o?v(g+1):f(y+1)}var b=i.w/l,m=i.h/u;if(e.condense&&(b=0,m=0),e.avoidOverlap)for(var w=0;w<n.length;w++){var T=n[w],D=T._private.position;(D.x==null||D.y==null)&&(D.x=0,D.y=0);var x=T.layoutDimensions(e),M=e.avoidOverlapPadding,P=x.w+M,N=x.h+M;b=Math.max(b,P),m=Math.max(m,N)}for(var O={},R=function(Q,K){return!!O["c-"+Q+"-"+K]},I=function(Q,K){O["c-"+Q+"-"+K]=!0},E=0,A=0,S=function(){A++,A>=l&&(A=0,E++)},C={},L=0;L<n.length;L++){var z=n[L],k=e.position(z);if(k&&(k.row!==void 0||k.col!==void 0)){var F={row:k.row,col:k.col};if(F.col===void 0)for(F.col=0;R(F.row,F.col);)F.col++;else if(F.row===void 0)for(F.row=0;R(F.row,F.col);)F.row++;C[z.id()]=F,I(F.row,F.col)}}var H=function(Q,K){var Z,j;if(Q.locked()||Q.isParent())return!1;var re=C[Q.id()];if(re)Z=re.col*b+b/2+i.x1,j=re.row*m+m/2+i.y1;else{for(;R(E,A);)S();Z=A*b+b/2+i.x1,j=E*m+m/2+i.y1,I(E,A),S()}return{x:Z,y:j}};n.layoutPositions(this,e,H)}return this};var ty={ready:function(){},stop:function(){}};function vs(t){this.options=Oe({},ty,t)}vs.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this},vs.prototype.stop=function(){return this};var ry={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Jf(t){this.options=Oe({},ry,t)}Jf.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=it(t.positions);function n(i){if(t.positions==null)return xc(i.position());if(a)return t.positions(i);var o=t.positions[i._private.data.id];return o??null}return r.layoutPositions(this,t,function(i,o){var s=n(i);return i.locked()||s==null?!1:s}),this};var ay={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function jf(t){this.options=Oe({},ay,t)}jf.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=Rt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(o,s){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,n),this};var ny=[{name:"breadthfirst",impl:qf},{name:"circle",impl:Yf},{name:"concentric",impl:Wf},{name:"cose",impl:Xn},{name:"grid",impl:Qf},{name:"null",impl:vs},{name:"preset",impl:Jf},{name:"random",impl:jf}];function ev(t){this.options=t,this.notifications=0}var tv=function(){},rv=function(){throw new Error("A headless instance can not render images")};ev.prototype={recalculateRenderedStyle:tv,notify:function(){this.notifications++},init:tv,isHeadless:function(){return!0},png:rv,jpg:rv};var hs={};hs.arrowShapeWidth=.3,hs.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(l,f,v,c,h,d,p){var y=h.x-v/2-p,g=h.x+v/2+p,b=h.y-v/2-p,m=h.y+v/2+p,w=y<=l&&l<=g&&b<=f&&f<=m;return w},a=function(l,f,v,c,h){var d=l*Math.cos(c)-f*Math.sin(c),p=l*Math.sin(c)+f*Math.cos(c),y=d*v,g=p*v,b=y+h.x,m=g+h.y;return{x:b,y:m}},n=function(l,f,v,c){for(var h=[],d=0;d<l.length;d+=2){var p=l[d],y=l[d+1];h.push(a(p,y,f,v,c))}return h},i=function(l){for(var f=[],v=0;v<l.length;v++){var c=l[v];f.push(c.x,c.y)}return f},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,f){Ne(f)&&(f=t[f]),t[l]=Oe({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,h,d,p,y,g){var b=i(n(this.points,d+2*g,p,y)),m=It(c,h,b);return m},roughCollide:r,draw:function(c,h,d,p){var y=n(this.points,h,d,p);e.arrowShapeImpl("polygon")(c,y)},spacing:function(c){return 0},gap:o},f)};s("none",{collide:vn,roughCollide:vn,draw:Oi,spacing:gu,gap:gu}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(l,f,v,c,h){var d=n(this.points,f,v,c),p=this.controlPoint,y=a(p[0],p[1],f,v,c);e.arrowShapeImpl(this.name)(l,d,y)},gap:function(l){return o(l)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,f,v,c,h,d,p){var y=i(n(this.points,v+2*p,c,h)),g=i(n(this.pointsTee,v+2*p,c,h)),b=It(l,f,y)||It(l,f,g);return b},draw:function(l,f,v,c,h){var d=n(this.points,f,v,c),p=n(this.pointsTee,f,v,c);e.arrowShapeImpl(this.name)(l,d,p)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,f,v,c,h,d,p){var y=h,g=Math.pow(y.x-l,2)+Math.pow(y.y-f,2)<=Math.pow((v+2*p)*this.radius,2),b=i(n(this.points,v+2*p,c,h));return It(l,f,b)||g},draw:function(l,f,v,c,h){var d=n(this.pointsTr,f,v,c);e.arrowShapeImpl(this.name)(l,d,c.x,c.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,f){var v=this.baseCrossLinePts.slice(),c=f/l,h=3,d=5;return v[h]=v[h]-c,v[d]=v[d]-c,v},collide:function(l,f,v,c,h,d,p){var y=i(n(this.points,v+2*p,c,h)),g=i(n(this.crossLinePts(v,d),v+2*p,c,h)),b=It(l,f,y)||It(l,f,g);return b},draw:function(l,f,v,c,h){var d=n(this.points,f,v,c),p=n(this.crossLinePts(f,h),f,v,c);e.arrowShapeImpl(this.name)(l,d,p)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return o(l)*.525}}),s("circle",{radius:.15,collide:function(l,f,v,c,h,d,p){var y=h,g=Math.pow(y.x-l,2)+Math.pow(y.y-f,2)<=Math.pow((v+2*p)*this.radius,2);return g},draw:function(l,f,v,c,h){e.arrowShapeImpl(this.name)(l,c.x,c.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var Ir={};Ir.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],o=a[4],s=r.pan(),u=r.zoom(),l=((t-n)/o-s.x)/u,f=((e-i)/o-s.y)/u;return[l,f]},Ir.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(g){return parseFloat(r.getPropertyValue(g))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=t.clientWidth,s=t.clientHeight,u=n.left+n.right,l=n.top+n.bottom,f=i.left+i.right,v=e.width/(o+f),c=o-u,h=s-l,d=e.left+n.left+i.left,p=e.top+n.top+i.top;return this.containerBB=[d,p,c,h,v]},Ir.invalidateContainerClientCoordsCache=function(){this.containerBB=null},Ir.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]},Ir.findNearestElements=function(t,e,r,a){var n=this,i=this,o=i.getCachedZSortedEles(),s=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),f=(a?24:8)/u,v=(a?8:2)/u,c=(a?8:2)/u,h=1/0,d,p;r&&(o=o.interactive);function y(x,M){if(x.isNode()){if(p)return;p=x,s.push(x)}if(x.isEdge()&&(M==null||M<h))if(d){if(d.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value&&d.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value){for(var P=0;P<s.length;P++)if(s[P].isEdge()){s[P]=x,d=x,h=M??h;break}}}else s.push(x),d=x,h=M??h}function g(x){var M=x.outerWidth()+2*v,P=x.outerHeight()+2*v,N=M/2,O=P/2,R=x.position(),I=x.pstyle("corner-radius").value==="auto"?"auto":x.pstyle("corner-radius").pfValue,E=x._private.rscratch;if(R.x-N<=t&&t<=R.x+N&&R.y-O<=e&&e<=R.y+O){var A=i.nodeShapes[n.getNodeShape(x)];if(A.checkPoint(t,e,0,M,P,R.x,R.y,I,E))return y(x,0),!0}}function b(x){var M=x._private,P=M.rscratch,N=x.pstyle("width").pfValue,O=x.pstyle("arrow-scale").value,R=N/2+f,I=R*R,E=R*2,L=M.source,z=M.target,A;if(P.edgeType==="segments"||P.edgeType==="straight"||P.edgeType==="haystack"){for(var S=P.allpts,C=0;C+3<S.length;C+=2)if(kc(t,e,S[C],S[C+1],S[C+2],S[C+3],E)&&I>(A=Hc(t,e,S[C],S[C+1],S[C+2],S[C+3])))return y(x,A),!0}else if(P.edgeType==="bezier"||P.edgeType==="multibezier"||P.edgeType==="self"||P.edgeType==="compound"){for(var S=P.allpts,C=0;C+5<P.allpts.length;C+=4)if(zc(t,e,S[C],S[C+1],S[C+2],S[C+3],S[C+4],S[C+5],E)&&I>(A=Uc(t,e,S[C],S[C+1],S[C+2],S[C+3],S[C+4],S[C+5])))return y(x,A),!0}for(var L=L||M.source,z=z||M.target,k=n.getArrowWidth(N,O),F=[{name:"source",x:P.arrowStartX,y:P.arrowStartY,angle:P.srcArrowAngle},{name:"target",x:P.arrowEndX,y:P.arrowEndY,angle:P.tgtArrowAngle},{name:"mid-source",x:P.midX,y:P.midY,angle:P.midsrcArrowAngle},{name:"mid-target",x:P.midX,y:P.midY,angle:P.midtgtArrowAngle}],C=0;C<F.length;C++){var H=F[C],W=i.arrowShapes[x.pstyle(H.name+"-arrow-shape").value],Q=x.pstyle("width").pfValue;if(W.roughCollide(t,e,k,H.angle,{x:H.x,y:H.y},Q,f)&&W.collide(t,e,k,H.angle,{x:H.x,y:H.y},Q,f))return y(x),!0}l&&s.length>0&&(g(L),g(z))}function m(x,M,P){return Mt(x,M,P)}function w(x,M){var P=x._private,N=c,O;M?O=M+"-":O="",x.boundingBox();var R=P.labelBounds[M||"main"],I=x.pstyle(O+"label").value,E=x.pstyle("text-events").strValue==="yes";if(!(!E||!I)){var A=m(P.rscratch,"labelX",M),S=m(P.rscratch,"labelY",M),C=m(P.rscratch,"labelAngle",M),L=x.pstyle(O+"text-margin-x").pfValue,z=x.pstyle(O+"text-margin-y").pfValue,k=R.x1-N-L,F=R.x2+N-L,H=R.y1-N-z,W=R.y2+N-z;if(C){var Q=Math.cos(C),K=Math.sin(C),Z=function(ee,te){return ee=ee-A,te=te-S,{x:ee*Q-te*K+A,y:ee*K+te*Q+S}},j=Z(k,H),re=Z(k,W),q=Z(F,H),U=Z(F,W),Y=[j.x+L,j.y+z,q.x+L,q.y+z,U.x+L,U.y+z,re.x+L,re.y+z];if(It(t,e,Y))return y(x),!0}else if(vr(R,t,e))return y(x),!0}}for(var T=o.length-1;T>=0;T--){var D=o[T];D.isNode()?g(D)||w(D):b(D)||w(D)||w(D,"source")||w(D,"target")}return s},Ir.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),o=2/i,s=[],u=Math.min(t,r),l=Math.max(t,r),f=Math.min(e,a),v=Math.max(e,a);t=u,r=l,e=f,a=v;var c=Rt({x1:t,y1:e,x2:r,y2:a}),h=[{x:c.x1,y:c.y1},{x:c.x2,y:c.y1},{x:c.x2,y:c.y2},{x:c.x1,y:c.y2}],d=[[h[0],h[1]],[h[1],h[2]],[h[2],h[3]],[h[3],h[0]]];function p(ee,te,ge){return Mt(ee,te,ge)}function y(ee,te){var ge=ee._private,Te=o,pe="";ee.boundingBox();var le=ge.labelBounds.main;if(!le)return null;var ce=p(ge.rscratch,"labelX",te),ve=p(ge.rscratch,"labelY",te),de=p(ge.rscratch,"labelAngle",te),me=ee.pstyle(pe+"text-margin-x").pfValue,ye=ee.pstyle(pe+"text-margin-y").pfValue,we=le.x1-Te-me,Me=le.x2+Te-me,Ie=le.y1-Te-ye,Be=le.y2+Te-ye;if(de){var Fe=Math.cos(de),oe=Math.sin(de),B=function(V,G){return V=V-ce,G=G-ve,{x:V*Fe-G*oe+ce,y:V*oe+G*Fe+ve}};return[B(we,Ie),B(Me,Ie),B(Me,Be),B(we,Be)]}else return[{x:we,y:Ie},{x:Me,y:Ie},{x:Me,y:Be},{x:we,y:Be}]}function g(ee,te,ge,Te){function pe(le,ce,ve){return(ve.y-le.y)*(ce.x-le.x)>(ce.y-le.y)*(ve.x-le.x)}return pe(ee,ge,Te)!==pe(te,ge,Te)&&pe(ee,te,ge)!==pe(ee,te,Te)}for(var b=0;b<n.length;b++){var m=n[b];if(m.isNode()){var w=m,T=w.pstyle("text-events").strValue==="yes",D=w.pstyle("box-selection").strValue,x=w.pstyle("box-select-labels").strValue==="yes";if(D==="none")continue;var M=(D==="overlap"||x)&&T,P=w.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:M});if(D==="contain"){var N=!1;if(x&&T){var O=y(w);O&&Wi(O,h)&&(s.push(w),N=!0)}!N&&Du(c,P)&&s.push(w)}else if(D==="overlap"&&Gi(c,P)){var R=w.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),I=[{x:R.x1,y:R.y1},{x:R.x2,y:R.y1},{x:R.x2,y:R.y2},{x:R.x1,y:R.y2}];if(Wi(I,h))s.push(w);else{var E=y(w);E&&Wi(E,h)&&s.push(w)}}}else{var A=m,S=A._private,C=S.rscratch,L=A.pstyle("box-selection").strValue;if(L==="none")continue;if(L==="contain"){if(C.startX!=null&&C.startY!=null&&!vr(c,C.startX,C.startY)||C.endX!=null&&C.endY!=null&&!vr(c,C.endX,C.endY))continue;if(C.edgeType==="bezier"||C.edgeType==="multibezier"||C.edgeType==="self"||C.edgeType==="compound"||C.edgeType==="segments"||C.edgeType==="haystack"){for(var z=S.rstyle.bezierPts||S.rstyle.linePts||S.rstyle.haystackPts,k=!0,F=0;F<z.length;F++)if(!Au(c,z[F])){k=!1;break}k&&s.push(A)}else C.edgeType==="straight"&&s.push(A)}else if(L==="overlap"){var H=!1;if(C.startX!=null&&C.startY!=null&&C.endX!=null&&C.endY!=null&&(vr(c,C.startX,C.startY)||vr(c,C.endX,C.endY)))s.push(A),H=!0;else if(!H&&C.edgeType==="haystack"){for(var W=S.rstyle.haystackPts,Q=0;Q<W.length;Q++)if(Au(c,W[Q])){s.push(A),H=!0;break}}if(!H){var K=S.rstyle.bezierPts||S.rstyle.linePts||S.rstyle.haystackPts;if((!K||K.length<2)&&C.edgeType==="straight"&&C.startX!=null&&C.startY!=null&&C.endX!=null&&C.endY!=null&&(K=[{x:C.startX,y:C.startY},{x:C.endX,y:C.endY}]),!K||K.length<2)continue;for(var Z=0;Z<K.length-1;Z++){for(var j=K[Z],re=K[Z+1],q=0;q<d.length;q++){var U=vt(d[q],2),Y=U[0],X=U[1];if(g(j,re,Y,X)){s.push(A),H=!0;break}}if(H)break}}}}}return s};var Kn={};Kn.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",u,l,f,v,c,h,g,b;if(r?(f=e.haystackPts[0],v=e.haystackPts[1],c=e.haystackPts[2],h=e.haystackPts[3]):(f=e.arrowStartX,v=e.arrowStartY,c=e.arrowEndX,h=e.arrowEndY),g=e.midX,b=e.midY,i)u=f-e.segpts[0],l=v-e.segpts[1];else if(n||o||s||a){var d=e.allpts,p=mt(d[0],d[2],d[4],.1),y=mt(d[1],d[3],d[5],.1);u=f-p,l=v-y}else u=f-g,l=v-b;e.srcArrowAngle=gn(u,l);var g=e.midX,b=e.midY;if(r&&(g=(f+c)/2,b=(v+h)/2),u=c-f,l=h-v,i){var d=e.allpts;if(d.length/2%2===0){var m=d.length/2,w=m-2;u=d[m]-d[w],l=d[m+1]-d[w+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var m=d.length/2-1,w=m-2;u=d[m]-d[w],l=d[m+1]-d[w+1]}}else if(n||o||s){var d=e.allpts,T=e.ctrlpts,D,x,M,P;if(T.length/2%2===0){var N=d.length/2-1,O=N+2,R=O+2;D=mt(d[N],d[O],d[R],0),x=mt(d[N+1],d[O+1],d[R+1],0),M=mt(d[N],d[O],d[R],1e-4),P=mt(d[N+1],d[O+1],d[R+1],1e-4)}else{var O=d.length/2-1,N=O-2,R=O+2;D=mt(d[N],d[O],d[R],.4999),x=mt(d[N+1],d[O+1],d[R+1],.4999),M=mt(d[N],d[O],d[R],.5),P=mt(d[N+1],d[O+1],d[R+1],.5)}u=M-D,l=P-x}if(e.midtgtArrowAngle=gn(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var d=e.allpts;if(d.length/2%2!==0){if(!e.isRound){var m=d.length/2-1,I=m+2;u=-(d[I]-d[m]),l=-(d[I+1]-d[m+1])}}}if(e.midsrcArrowAngle=gn(u,l),i)u=c-e.segpts[e.segpts.length-2],l=h-e.segpts[e.segpts.length-1];else if(n||o||s||a){var d=e.allpts,E=d.length,p=mt(d[E-6],d[E-4],d[E-2],.9),y=mt(d[E-5],d[E-3],d[E-1],.9);u=c-p,l=h-y}else u=c-g,l=h-b;e.tgtArrowAngle=gn(u,l)},Kn.getArrowWidth=Kn.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var cs,ds,$t={},Vt={},av,nv,Br,_n,rr,Fr,kr,Kt,fa,Zn,iv,ov,gs,ps,sv,uv=function(e,r,a){a.x=r.x-e.x,a.y=r.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},iy=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},oy=function(e,r,a,n,i){if(e!==sv?uv(r,e,$t):iy(Vt,$t),uv(r,a,Vt),av=$t.nx*Vt.ny-$t.ny*Vt.nx,nv=$t.nx*Vt.nx-$t.ny*-Vt.ny,rr=Math.asin(Math.max(-1,Math.min(1,av))),Math.abs(rr)<1e-6){cs=r.x,ds=r.y,kr=fa=0;return}Br=1,_n=!1,nv<0?rr<0?rr=Math.PI+rr:(rr=Math.PI-rr,Br=-1,_n=!0):rr>0&&(Br=-1,_n=!0),r.radius!==void 0?fa=r.radius:fa=n,Fr=rr/2,Zn=Math.min($t.len/2,Vt.len/2),i?(Kt=Math.abs(Math.cos(Fr)*fa/Math.sin(Fr)),Kt>Zn?(Kt=Zn,kr=Math.abs(Kt*Math.sin(Fr)/Math.cos(Fr))):kr=fa):(Kt=Math.min(Zn,fa),kr=Math.abs(Kt*Math.sin(Fr)/Math.cos(Fr))),gs=r.x+Vt.nx*Kt,ps=r.y+Vt.ny*Kt,cs=gs-Vt.ny*kr*Br,ds=ps+Vt.nx*kr*Br,iv=r.x+$t.nx*Kt,ov=r.y+$t.ny*Kt,sv=r};function lv(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function ys(t,e,r,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(oy(t,e,r,a,n),{cx:cs,cy:ds,radius:kr,startX:iv,startY:ov,stopX:gs,stopY:ps,startAngle:$t.ang+Math.PI/2*Br,endAngle:Vt.ang-Math.PI/2*Br,counterClockwise:_n})}var Ya=.01,sy=Math.sqrt(2*Ya),Lt={};Lt.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=t.pstyle("source-endpoint"),s=t.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(T,D,x,M){var P=M-D,N=x-T,O=Math.sqrt(N*N+P*P);return{x:-P/O,y:N/O}},f=t.pstyle("edge-distances").value;switch(f){case"node-position":i=r;break;case"intersection":i=a;break;case"endpoints":{if(u){var v=this.manualEndptToPx(t.source()[0],o),c=vt(v,2),h=c[0],d=c[1],p=this.manualEndptToPx(t.target()[0],s),y=vt(p,2),g=y[0],b=y[1],m={x1:h,y1:d,x2:g,y2:b};n=l(h,d,g,b),i=m}else Xe("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}},Lt.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var o=a.source,s=a.target,u=o.position(),l=s.position(),f=o.width(),v=s.width(),c=o.height(),h=s.height(),d=r.pstyle("haystack-radius").value,p=d/2;n.haystackPts=n.allpts=[n.source.x*f*p+u.x,n.source.y*c*p+u.y,n.target.x*v*p+l.x,n.target.y*h*p+l.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}},Lt.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),n=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),s=Math.min(a.pfValue.length,n.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var f=0;f<s;f++){var v=a.pfValue[f],c=n.pfValue[f],h=1-v,d=v,p=this.findMidptPtsEtc(t,e),y=p.midptPts,g=p.vectorNormInverse,b={x:y.x1*h+y.x2*d,y:y.y1*h+y.y2*d};r.segpts.push(b.x+g.x*c,b.y+g.y*c),r.radii.push(i.pfValue[f]!==void 0?i.pfValue[f]:u),r.isArcRadius.push((o.pfValue[f]!==void 0?o.pfValue[f]:l)==="arc-radius")}},Lt.findLoopPoints=function(t,e,r,a){var n=t._private.rscratch,i=e.dirCounts,o=e.srcPos,s=t.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=t.pstyle("loop-direction").pfValue,f=t.pstyle("loop-sweep").pfValue,v=t.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=r,h=v;a&&(c=0,h=u);var d=l-Math.PI/2,p=d-f/2,y=d+f/2,g=l+"_"+f;c=i[g]===void 0?i[g]=0:++i[g],n.ctrlpts=[o.x+Math.cos(p)*1.4*h*(c/3+1),o.y+Math.sin(p)*1.4*h*(c/3+1),o.x+Math.cos(y)*1.4*h*(c/3+1),o.y+Math.sin(y)*1.4*h*(c/3+1)]},Lt.findCompoundLoopPoints=function(t,e,r,a){var n=t._private.rscratch;n.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,u=e.srcH,l=e.tgtW,f=e.tgtH,v=t.pstyle("control-point-step-size").pfValue,c=t.pstyle("control-point-distances"),h=c?c.pfValue[0]:void 0,d=r,p=v;a&&(d=0,p=h);var y=50,g={x:i.x-s/2,y:i.y-u/2},b={x:o.x-l/2,y:o.y-f/2},m={x:Math.min(g.x,b.x),y:Math.min(g.y,b.y)},w=.5,T=Math.max(w,Math.log(s*Ya)),D=Math.max(w,Math.log(l*Ya));n.ctrlpts=[m.x,m.y-(1+Math.pow(y,1.12)/100)*p*(d/3+1)*T,m.x-(1+Math.pow(y,1.12)/100)*p*(d/3+1)*D,m.y]},Lt.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"},Lt.findBezierPoints=function(t,e,r,a,n){var i=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,s=t.pstyle("control-point-distances"),u=t.pstyle("control-point-weights"),l=s&&u?Math.min(s.value.length,u.value.length):1,f=s?s.pfValue[0]:void 0,v=u.value[0],c=a;i.edgeType=c?"multibezier":"bezier",i.ctrlpts=[];for(var h=0;h<l;h++){var d=(.5-e.eles.length/2+r)*o*(n?-1:1),p=void 0,y=Vi(d);c&&(f=s?s.pfValue[h]:o,v=u.value[h]),a?p=f:p=f!==void 0?y*f:void 0;var g=p!==void 0?p:d,b=1-v,m=v,w=this.findMidptPtsEtc(t,e),T=w.midptPts,D=w.vectorNormInverse,x={x:T.x1*b+T.x2*m,y:T.y1*b+T.y2*m};i.ctrlpts.push(x.x+D.x*g,x.y+D.y*g)}},Lt.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",n="horizontal",i="leftward",o="rightward",s="downward",u="upward",l="auto",f=e.posPts,v=e.srcW,c=e.srcH,h=e.tgtW,d=e.tgtH,p=t.pstyle("edge-distances").value,y=p!=="node-position",g=t.pstyle("taxi-direction").value,b=g,m=t.pstyle("taxi-turn"),w=m.units==="%",T=m.pfValue,D=T<0,x=t.pstyle("taxi-turn-min-distance").pfValue,M=y?(v+h)/2:0,P=y?(c+d)/2:0,N=f.x2-f.x1,O=f.y2-f.y1,R=function(G,$){return G>0?Math.max(G-$,0):Math.min(G+$,0)},I=R(N,M),E=R(O,P),A=!1;b===l?g=Math.abs(I)>Math.abs(E)?n:a:b===u||b===s?(g=a,A=!0):(b===i||b===o)&&(g=n,A=!0);var S=g===a,C=S?E:I,L=S?O:N,z=Vi(L),k=!1;!(A&&(w||D))&&(b===s&&L<0||b===u&&L>0||b===i&&L>0||b===o&&L<0)&&(z*=-1,C=z*Math.abs(C),k=!0);var F;if(w){var H=T<0?1+T:T;F=H*C}else{var W=T<0?C:0;F=W+T*z}var Q=function(G){return Math.abs(G)<x||Math.abs(G)>=Math.abs(C)},K=Q(F),Z=Q(Math.abs(C)-Math.abs(F)),j=K||Z;if(j&&!k)if(S){var re=Math.abs(L)<=c/2,q=Math.abs(N)<=h/2;if(re){var U=(f.x1+f.x2)/2,Y=f.y1,X=f.y2;r.segpts=[U,Y,U,X]}else if(q){var ee=(f.y1+f.y2)/2,te=f.x1,ge=f.x2;r.segpts=[te,ee,ge,ee]}else r.segpts=[f.x1,f.y2]}else{var Te=Math.abs(L)<=v/2,pe=Math.abs(O)<=d/2;if(Te){var le=(f.y1+f.y2)/2,ce=f.x1,ve=f.x2;r.segpts=[ce,le,ve,le]}else if(pe){var de=(f.x1+f.x2)/2,me=f.y1,ye=f.y2;r.segpts=[de,me,de,ye]}else r.segpts=[f.x2,f.y1]}else if(S){var we=f.y1+F+(y?c/2*z:0),Me=f.x1,Ie=f.x2;r.segpts=[Me,we,Ie,we]}else{var Be=f.x1+F+(y?v/2*z:0),Fe=f.y1,oe=f.y2;r.segpts=[Be,Fe,Be,oe]}if(r.isRound){var B=t.pstyle("taxi-radius").value,_=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(B),r.isArcRadius=new Array(r.segpts.length/2).fill(_)}},Lt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,v=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,p=!be(r.startX)||!be(r.startY),y=!be(r.arrowStartX)||!be(r.arrowStartY),g=!be(r.endX)||!be(r.endY),b=!be(r.arrowEndX)||!be(r.arrowEndY),m=3,w=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,T=m*w,D=Mr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),x=D<T,M=Mr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),P=M<T,N=!1;if(p||y||x){N=!0;var O={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},R=Math.sqrt(O.x*O.x+O.y*O.y),I={x:O.x/R,y:O.y/R},E=Math.max(i,o),A={x:r.ctrlpts[0]+I.x*2*E,y:r.ctrlpts[1]+I.y*2*E},S=l.intersectLine(a.x,a.y,i,o,A.x,A.y,0,v,h);x?(r.ctrlpts[0]=r.ctrlpts[0]+I.x*(T-D),r.ctrlpts[1]=r.ctrlpts[1]+I.y*(T-D)):(r.ctrlpts[0]=S[0]+I.x*T,r.ctrlpts[1]=S[1]+I.y*T)}if(g||b||P){N=!0;var C={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},L=Math.sqrt(C.x*C.x+C.y*C.y),z={x:C.x/L,y:C.y/L},k=Math.max(i,o),F={x:r.ctrlpts[0]+z.x*2*k,y:r.ctrlpts[1]+z.y*2*k},H=f.intersectLine(n.x,n.y,s,u,F.x,F.y,0,c,d);P?(r.ctrlpts[0]=r.ctrlpts[0]+z.x*(T-M),r.ctrlpts[1]=r.ctrlpts[1]+z.y*(T-M)):(r.ctrlpts[0]=H[0]+z.x*T,r.ctrlpts[1]=H[1]+z.y*T)}N&&this.findEndpoints(t)}},Lt.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=mt(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=mt(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],s=e.isArcRadius[i/2-1];e.roundCorners.push(ys({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,s))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var f=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[f],e.midY=e.segpts[f+1];else{var v={x:e.segpts[f],y:e.segpts[f+1]},c=e.roundCorners[f/2];if(c.radius===0){var h={x:e.segpts[f+2],y:e.segpts[f+3]};e.midX=v.x,e.midY=v.y,e.midVector=[v.y-h.y,h.x-v.x]}else{var d=[v.x-c.cx,v.y-c.cy],p=c.radius/Math.sqrt(Math.pow(d[0],2)+Math.pow(d[1],2));d=d.map(function(y){return y*p}),e.midX=c.cx+d[0],e.midY=c.cy+d[1],e.midVector=d}}}}},Lt.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||be(e.startX)&&be(e.startY)&&be(e.endX)&&be(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Xe("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},Lt.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,n=a.hasCompoundNodes(),i=new er,o=function(P,N){return[].concat(an(P),[N?1:0]).join("-")},s=[],u=[],l=0;l<t.length;l++){var f=t[l],v=f._private,c=f.pstyle("curve-style").value;if(!(f.removed()||!f.takesUpSpace())){if(c==="haystack"){u.push(f);continue}var h=c==="unbundled-bezier"||ur(c,"segments")||c==="straight"||c==="straight-triangle"||ur(c,"taxi"),d=c==="unbundled-bezier"||c==="bezier",p=v.source,y=v.target,g=p.poolIndex(),b=y.poolIndex(),m=[g,b].sort(),w=o(m,h),T=i.get(w);T==null&&(T={eles:[]},s.push({pairId:m,edgeIsUnbundled:h}),i.set(w,T)),T.eles.push(f),h&&(T.hasUnbundled=!0),d&&(T.hasBezier=!0)}}for(var D=function(){var P=s[x],N=P.pairId,O=P.edgeIsUnbundled,R=o(N,O),I=i.get(R),E;if(!I.hasUnbundled){var A=I.eles[0].parallelEdges().filter(function(_){return _.isBundledBezier()});Ii(I.eles),A.forEach(function(_){return I.eles.push(_)}),I.eles.sort(function(_,V){return _.poolIndex()-V.poolIndex()})}var S=I.eles[0],C=S.source(),L=S.target();if(C.poolIndex()>L.poolIndex()){var z=C;C=L,L=z}var k=I.srcPos=C.position(),F=I.tgtPos=L.position(),H=I.srcW=C.outerWidth(),W=I.srcH=C.outerHeight(),Q=I.tgtW=L.outerWidth(),K=I.tgtH=L.outerHeight(),Z=I.srcShape=r.nodeShapes[e.getNodeShape(C)],j=I.tgtShape=r.nodeShapes[e.getNodeShape(L)],re=I.srcCornerRadius=C.pstyle("corner-radius").value==="auto"?"auto":C.pstyle("corner-radius").pfValue,q=I.tgtCornerRadius=L.pstyle("corner-radius").value==="auto"?"auto":L.pstyle("corner-radius").pfValue,U=I.tgtRs=L._private.rscratch,Y=I.srcRs=C._private.rscratch;I.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var X=0;X<I.eles.length;X++){var ee=I.eles[X],te=ee[0]._private.rscratch,ge=ee.pstyle("curve-style").value,Te=ge==="unbundled-bezier"||ur(ge,"segments")||ur(ge,"taxi"),pe=!C.same(ee.source());if(!I.calculatedIntersection&&C!==L&&(I.hasBezier||I.hasUnbundled)){I.calculatedIntersection=!0;var le=Z.intersectLine(k.x,k.y,H,W,F.x,F.y,0,re,Y),ce=I.srcIntn=le,ve=j.intersectLine(F.x,F.y,Q,K,k.x,k.y,0,q,U),de=I.tgtIntn=ve,me=I.intersectionPts={x1:le[0],x2:ve[0],y1:le[1],y2:ve[1]},ye=I.posPts={x1:k.x,x2:F.x,y1:k.y,y2:F.y},we=ve[1]-le[1],Me=ve[0]-le[0],Ie=Math.sqrt(Me*Me+we*we);be(Ie)&&Ie>=sy||(Ie=Math.sqrt(Math.max(Me*Me,Ya)+Math.max(we*we,Ya)));var Be=I.vector={x:Me,y:we},Fe=I.vectorNorm={x:Be.x/Ie,y:Be.y/Ie},oe={x:-Fe.y,y:Fe.x};I.nodesOverlap=!be(Ie)||j.checkPoint(le[0],le[1],0,Q,K,F.x,F.y,q,U)||Z.checkPoint(ve[0],ve[1],0,H,W,k.x,k.y,re,Y),I.vectorNormInverse=oe,E={nodesOverlap:I.nodesOverlap,dirCounts:I.dirCounts,calculatedIntersection:!0,hasBezier:I.hasBezier,hasUnbundled:I.hasUnbundled,eles:I.eles,srcPos:F,srcRs:U,tgtPos:k,tgtRs:Y,srcW:Q,srcH:K,tgtW:H,tgtH:W,srcIntn:de,tgtIntn:ce,srcShape:j,tgtShape:Z,posPts:{x1:ye.x2,y1:ye.y2,x2:ye.x1,y2:ye.y1},intersectionPts:{x1:me.x2,y1:me.y2,x2:me.x1,y2:me.y1},vector:{x:-Be.x,y:-Be.y},vectorNorm:{x:-Fe.x,y:-Fe.y},vectorNormInverse:{x:-oe.x,y:-oe.y}}}var B=pe?E:I;te.nodesOverlap=B.nodesOverlap,te.srcIntn=B.srcIntn,te.tgtIntn=B.tgtIntn,te.isRound=ge.startsWith("round"),n&&(C.isParent()||C.isChild()||L.isParent()||L.isChild())&&(C.parents().anySame(L)||L.parents().anySame(C)||C.same(L)&&C.isParent())?e.findCompoundLoopPoints(ee,B,X,Te):C===L?e.findLoopPoints(ee,B,X,Te):ge.endsWith("segments")?e.findSegmentsPoints(ee,B):ge.endsWith("taxi")?e.findTaxiPoints(ee,B):ge==="straight"||!Te&&I.eles.length%2===1&&X===Math.floor(I.eles.length/2)?e.findStraightEdgePoints(ee):e.findBezierPoints(ee,B,X,Te,pe),e.findEndpoints(ee),e.tryToCorrectInvalidPoints(ee,B),e.checkForInvalidEdgeWarning(ee),e.storeAllpts(ee),e.storeEdgeProjections(ee),e.calculateArrowAngles(ee),e.recalculateEdgeLabelProjections(ee),e.calculateLabelAngles(ee)}},x=0;x<s.length;x++)D();this.findHaystackPoints(u)}};function fv(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],n=t[r+1];e.push({x:a,y:n})}return e}}Lt.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return fv(e.segpts)},Lt.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return fv(e.ctrlpts)},Lt.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Wa={};Wa.manualEndptToPx=function(t,e){var r=this,a=t.position(),n=t.outerWidth(),i=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*n),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=a.x,s[1]+=a.y,s}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(n,i),f=[a.x+Math.cos(u)*l,a.y+Math.sin(u)*l];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,n,i,f[0],f[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}},Wa.findEndpoints=function(t){var e,r,a,n,i=this,o,s=t.source()[0],u=t.target()[0],l=s.position(),f=u.position(),v=t.pstyle("target-arrow-shape").value,c=t.pstyle("source-arrow-shape").value,h=t.pstyle("target-distance-from-node").pfValue,d=t.pstyle("source-distance-from-node").pfValue,p=s._private.rscratch,y=u._private.rscratch,g=t.pstyle("curve-style").value,b=t._private.rscratch,m=b.edgeType,w=ur(g,"taxi"),T=m==="self"||m==="compound",D=m==="bezier"||m==="multibezier"||T,x=m!=="bezier",M=m==="straight"||m==="segments",P=m==="segments",N=D||x||M,O=T||w,R=t.pstyle("source-endpoint"),I=O?"outside-to-node":R.value,E=s.pstyle("corner-radius").value==="auto"?"auto":s.pstyle("corner-radius").pfValue,A=t.pstyle("target-endpoint"),S=O?"outside-to-node":A.value,C=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;b.srcManEndpt=R,b.tgtManEndpt=A;var L,z,k,F,H=(e=(A==null||(r=A.pfValue)===null||r===void 0?void 0:r.length)===2?A.pfValue:null)!==null&&e!==void 0?e:[0,0],W=(a=(R==null||(n=R.pfValue)===null||n===void 0?void 0:n.length)===2?R.pfValue:null)!==null&&a!==void 0?a:[0,0];if(D){var Q=[b.ctrlpts[0],b.ctrlpts[1]],K=x?[b.ctrlpts[b.ctrlpts.length-2],b.ctrlpts[b.ctrlpts.length-1]]:Q;L=K,z=Q}else if(M){var Z=P?b.segpts.slice(0,2):[f.x+H[0],f.y+H[1]],j=P?b.segpts.slice(b.segpts.length-2):[l.x+W[0],l.y+W[1]];L=j,z=Z}if(S==="inside-to-node")o=[f.x,f.y];else if(A.units)o=this.manualEndptToPx(u,A);else if(S==="outside-to-line")o=b.tgtIntn;else if(S==="outside-to-node"||S==="outside-to-node-or-label"?k=L:(S==="outside-to-line"||S==="outside-to-line-or-label")&&(k=[l.x,l.y]),o=i.nodeShapes[this.getNodeShape(u)].intersectLine(f.x,f.y,u.outerWidth(),u.outerHeight(),k[0],k[1],0,C,y),S==="outside-to-node-or-label"||S==="outside-to-line-or-label"){var re=u._private.rscratch,q=re.labelWidth,U=re.labelHeight,Y=re.labelX,X=re.labelY,ee=q/2,te=U/2,ge=u.pstyle("text-valign").value;ge=na(ge),ge==="top"?X-=te:ge==="bottom"&&(X+=te);var Te=u.pstyle("text-halign").value;Te=aa(Te),Te==="left"?Y-=ee:Te==="right"&&(Y+=ee);var pe=Na(k[0],k[1],[Y-ee,X-te,Y+ee,X-te,Y+ee,X+te,Y-ee,X+te],f.x,f.y);if(pe.length>0){var le=l,ce=Rr(le,$r(o)),ve=Rr(le,$r(pe)),de=ce;if(ve<ce&&(o=pe,de=ve),pe.length>2){var me=Rr(le,{x:pe[2],y:pe[3]});me<de&&(o=[pe[2],pe[3]])}}}var ye=wn(o,L,i.arrowShapes[v].spacing(t)+h),we=wn(o,L,i.arrowShapes[v].gap(t)+h);if(b.endX=we[0],b.endY=we[1],b.arrowEndX=ye[0],b.arrowEndY=ye[1],I==="inside-to-node")o=[l.x,l.y];else if(R.units)o=this.manualEndptToPx(s,R);else if(I==="outside-to-line")o=b.srcIntn;else if(I==="outside-to-node"||I==="outside-to-node-or-label"?F=z:(I==="outside-to-line"||I==="outside-to-line-or-label")&&(F=[f.x,f.y]),o=i.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),F[0],F[1],0,E,p),I==="outside-to-node-or-label"||I==="outside-to-line-or-label"){var Me=s._private.rscratch,Ie=Me.labelWidth,Be=Me.labelHeight,Fe=Me.labelX,oe=Me.labelY,B=Ie/2,_=Be/2,V=s.pstyle("text-valign").value;V=na(V),V==="top"?oe-=_:V==="bottom"&&(oe+=_);var G=s.pstyle("text-halign").value;G=aa(G),G==="left"?Fe-=B:G==="right"&&(Fe+=B);var $=Na(F[0],F[1],[Fe-B,oe-_,Fe+B,oe-_,Fe+B,oe+_,Fe-B,oe+_],l.x,l.y);if($.length>0){var ae=f,J=Rr(ae,$r(o)),ne=Rr(ae,$r($)),ie=J;if(ne<J&&(o=[$[0],$[1]],ie=ne),$.length>2){var ue=Rr(ae,{x:$[2],y:$[3]});ue<ie&&(o=[$[2],$[3]])}}}var fe=wn(o,z,i.arrowShapes[c].spacing(t)+d),se=wn(o,z,i.arrowShapes[c].gap(t)+d);b.startX=se[0],b.startY=se[1],b.arrowStartX=fe[0],b.arrowStartY=fe[1],N&&(!be(b.startX)||!be(b.startY)||!be(b.endX)||!be(b.endY)?b.badLine=!0:b.badLine=!1)},Wa.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}},Wa.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var ms={};function uy(t,e,r){for(var a=function(l,f,v,c){return mt(l,f,v,c)},n=e._private,i=n.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var s=t.bezierProjPcts[o];i.push({x:a(r[0],r[2],r[4],s),y:a(r[1],r[3],r[5],s)})}}ms.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<r.allpts.length;n+=4)uy(this,t,r.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<r.allpts.length;n+=2)i.push({x:r.allpts[n],y:r.allpts[n+1]});else if(a==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth},ms.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var _t={};_t.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!sr(e)){var r,a,n=t._private,i=t.width(),o=t.height(),s=t.padding(),u=t.position(),l=t.pstyle("text-halign").strValue,f=t.pstyle("text-valign").strValue,v=n.rscratch,c=n.rstyle;switch(l){case"left":r=u.x-i/2-s;break;case"left-inside":r=u.x-i/2+s;break;case"right":r=u.x+i/2+s;break;case"right-inside":r=u.x+i/2-s;break;default:r=u.x}switch(f){case"top":a=u.y-o/2-s;break;case"top-inside":a=u.y-o/2+s;break;case"bottom":a=u.y+o/2+s;break;case"bottom-inside":a=u.y+o/2-s;break;default:a=u.y}v.labelX=r,v.labelY=a,c.labelX=r,c.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var vv=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},hv=function(e,r){var a=r.x-e.x,n=r.y-e.y;return vv(a,n)},ly=function(e,r,a,n){var i=Ma(0,n-.001,1),o=Ma(0,n+.001,1),s=Kr(e,r,a,i),u=Kr(e,r,a,o);return hv(s,u)};_t.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,n=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var o=function(v,c,h){Wt(r.rscratch,v,c,h),Wt(r.rstyle,v,c,h)};o("labelX",null,e.x),o("labelY",null,e.y);var s=vv(a.midDispX,a.midDispY);o("labelAutoAngle",null,s);var u=function(){if(u.cache)return u.cache;for(var v=[],c=0;c+5<a.allpts.length;c+=4){var h={x:a.allpts[c],y:a.allpts[c+1]},d={x:a.allpts[c+2],y:a.allpts[c+3]},p={x:a.allpts[c+4],y:a.allpts[c+5]};v.push({p0:h,p1:d,p2:p,startDist:0,length:0,segments:[]})}var y=r.rstyle.bezierPts,g=n.bezierProjPcts.length;function b(x,M,P,N,O){var R=Mr(M,P),I=x.segments[x.segments.length-1],E={p0:M,p1:P,t0:N,t1:O,startDist:I?I.startDist+I.length:0,length:R};x.segments.push(E),x.length+=R}for(var m=0;m<v.length;m++){var w=v[m],T=v[m-1];T&&(w.startDist=T.startDist+T.length),b(w,w.p0,y[m*g],0,n.bezierProjPcts[0]);for(var D=0;D<g-1;D++)b(w,y[m*g+D],y[m*g+D+1],n.bezierProjPcts[D],n.bezierProjPcts[D+1]);b(w,y[m*g+g-1],w.p2,n.bezierProjPcts[g-1],1)}return u.cache=v},l=function(v){var c,h=v==="source";if(i[v]){var d=t.pstyle(v+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var p=u(),y,g=0,b=0,m=0;m<p.length;m++){for(var w=p[h?m:p.length-1-m],T=0;T<w.segments.length;T++){var D=w.segments[h?T:w.segments.length-1-T],x=m===p.length-1&&T===w.segments.length-1;if(g=b,b+=D.length,b>=d||x){y={cp:w,segment:D};break}}if(y)break}var M=y.cp,P=y.segment,N=(d-g)/P.length,O=P.t1-P.t0,R=h?P.t0+O*N:P.t1-O*N;R=Ma(0,R,1),e=Kr(M.p0,M.p1,M.p2,R),c=ly(M.p0,M.p1,M.p2,R);break}case"straight":case"segments":case"haystack":{for(var I=0,E,A,S,C,L=a.allpts.length,z=0;z+3<L&&(h?(S={x:a.allpts[z],y:a.allpts[z+1]},C={x:a.allpts[z+2],y:a.allpts[z+3]}):(S={x:a.allpts[L-2-z],y:a.allpts[L-1-z]},C={x:a.allpts[L-4-z],y:a.allpts[L-3-z]}),E=Mr(S,C),A=I,I+=E,!(I>=d));z+=2);var k=d-A,F=k/E;F=Ma(0,F,1),e=Rc(S,C,F),c=hv(S,C);break}}o("labelX",v,e.x),o("labelY",v,e.y),o("labelAutoAngle",v,c)}};l("source"),l("target"),this.applyLabelDimensions(t)}},_t.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))},_t.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=Lr(a,t._private.labelDimsKey);if(Mt(r.rscratch,"prefixedLabelDimsKey",e)!==n){Wt(r.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,s=t.pstyle("font-size").pfValue,u=t.pstyle("text-wrap").strValue,l=Mt(r.rscratch,"labelWrapCachedLines",e)||[],f=u!=="wrap"?1:Math.max(l.length,1),v=s*o,c=i.width,h=i.height+(f-1)*(o-1)*s;Wt(r.rstyle,"labelWidth",e,c),Wt(r.rscratch,"labelWidth",e,c),Wt(r.rstyle,"labelHeight",e,h),Wt(r.rscratch,"labelHeight",e,h),Wt(r.rscratch,"labelLineHeight",e,v),Wt(r.rscratch,"labelActualDescent",e,i.labelActualDescent)}},_t.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,o=function(W,Q){return Q?(Wt(r.rscratch,W,e,Q),Q):Mt(r.rscratch,W,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=t.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="​",f=n.split(`
`),v=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value,h=c==="anywhere",d=[],p=/[\s\u200b]+|$/g,y=0;y<f.length;y++){var g=f[y],b=this.calculateLabelDimensions(t,g),m=b.width;if(h){var w=g.split("").join(l);g=w}if(m>v){var T=g.matchAll(p),D="",x=0,M=Ot(T),P;try{for(M.s();!(P=M.n()).done;){var N=P.value,O=N[0],R=g.substring(x,N.index);x=N.index+O.length;var I=D.length===0?R:D+R+O,E=this.calculateLabelDimensions(t,I),A=E.width;A<=v?D+=R+O:(D&&d.push(D),D=R+O)}}catch(H){M.e(H)}finally{M.f()}D.match(/^[\s\u200b]+$/)||d.push(D)}else d.push(g)}o("labelWrapCachedLines",d),n=o("labelWrapCachedText",d.join(`
`)),o("labelWrapKey",u)}else if(s==="ellipsis"){var S=t.pstyle("text-max-width").pfValue,C="",L="…",z=!1;if(this.calculateLabelDimensions(t,n).width<S)return n;for(var k=0;k<n.length;k++){var F=this.calculateLabelDimensions(t,C+n[k]+L).width;if(F>S)break;C+=n[k],k===n.length-1&&(z=!0)}return z||(C+=L),C}return n},_t.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;return e==="auto"?t.isNode()?Zg(r):"center":e},_t.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),n=a.document,i=0,o=t.pstyle("font-style").strValue,s=t.pstyle("font-size").pfValue,u=t.pstyle("font-family").strValue,l=t.pstyle("font-weight").strValue,f=t.pstyle("text-metrics").strValue||"font",v=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=n.createElement("canvas"),c=this.labelCalcCanvasContext=v.getContext("2d");var h=v.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}c.font="".concat(o," ").concat(l," ").concat(s,"px ").concat(u);for(var d=0,p=0,y=e.split(`
`),g=y.length,b=0,m=0,w=0;w<g;w++){var T=y[w],D=c.measureText(T),x=Math.ceil(D.width),M=s;f==="glyph"&&(w===0&&(m=D.actualBoundingBoxAscent),w===g-1&&(b=D.actualBoundingBoxDescent)),d=Math.max(x,d),p+=M}return f==="glyph"&&(p-=s-m-b),d+=i,p+=i,{width:d,height:p,labelActualAscent:m,labelActualDescent:b}},_t.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,n=t.isEdge(),i=e?e+"-":"",o=t.pstyle(i+"text-rotation"),s=o.strValue;return s==="none"?0:n&&s==="autorotate"?a.labelAutoAngle:s==="autorotate"?0:o.pfValue},_t.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(t),r&&(n.sourceLabelAngle=e.calculateLabelAngle(t,"source"),n.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var cv={},dv=28,gv=!1;cv.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<dv||t.height()<dv))return gv||(Xe("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),gv=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var Qn={};Qn.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var u=0;u<o.length;u++){var l=o[u],f=l._private,v=f.rstyle;v.clean=!1,v.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var s=o.target;a(s)}).on("style.* background.*",function(o){var s=o.target;a(s,!1)});var n=function(o){if(o){var s=r.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],f=l._private.rstyle;l.isNode()&&!f.cleanConnected&&(a(l.connectedEdges()),f.cleanConnected=!0)}if(s)for(var v=0;v<s.length;v++){var c=s[v];c(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)},Qn.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)},Qn.recalculateRenderedStyle=function(t,e){var r=function(w){return w._private.rstyle.cleanConnected};if(t.length!==0){var a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var o=t[i],s=o._private,u=s.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(u.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(m){return!m._private.rstyle.clean&&m.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?n.push(o):a.push(o),u.clean=!0)}for(var l=0;l<n.length;l++){var f=n[l],v=f._private,c=v.rstyle,h=f.position();this.recalculateNodeLabelProjection(f),c.nodeX=h.x,c.nodeY=h.y,c.nodeW=f.pstyle("width").pfValue,c.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var p=a[d],y=p._private,g=y.rstyle,b=y.rscratch;g.srcX=b.arrowStartX,g.srcY=b.arrowStartY,g.tgtX=b.arrowEndX,g.tgtY=b.arrowEndY,g.midX=b.midX,g.midY=b.midY,g.labelAngle=b.labelAngle,g.sourceLabelAngle=b.sourceLabelAngle,g.targetLabelAngle=b.targetLabelAngle}}}};var Jn={};Jn.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}},Jn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},Jn.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(Mf),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var pv={};[Ir,Kn,Lt,Wa,ms,_t,cv,Qn,Jn].forEach(function(t){Oe(pv,t)});var yv={};yv.getCachedImage=function(t,e,r){var a=this,n=a.imageCache=a.imageCache||{},i=n[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=n[t]=n[t]||{};var o=i.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var s="data:",u=t.substring(0,s.length).toLowerCase()===s;return u||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var mv=function(e,r){var a=e[0];!a||a._private.grabbed===r||(a._private.grabbed=r,e.updateStyle(!1))},fy=function(e){mv(e,!0)},vy=function(e){mv(e,!1)},va={};va.registerBinding=function(t,e,r,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var i=[],o=0;o<t.length;o++){var s=t[o];if(s!==void 0){var u=this.binder(s);i.push(u.on.apply(u,n))}}return i}var u=this.binder(t);return u.on.apply(u,n)},va.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||bh(t);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});r.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var o=function(u,l,f){var v=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(v[2]={capture:f??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:v}),(t.addEventListener||t.on).apply(t,v),this};return{on:o,addEventListener:o,addListener:o,bind:o}},va.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()},va.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()},va.load=function(){var t=this,e=t.cy.window(),r=function(B){return B.selected()},a=function(B){var _=B.getRootNode();if(_&&_.nodeType===11&&_.host!==void 0)return _},n=function(B,_,V,G){B==null&&(B=t.cy);for(var $=0;$<_.length;$++){var ae=_[$];B.emit({originalEvent:V,type:ae,position:G})}},i=function(B){return B.shiftKey||B.metaKey||B.ctrlKey},o=function(B,_){var V=!0;if(t.cy.hasCompoundNodes()&&B&&B.pannable())for(var G=0;_&&G<_.length;G++){var B=_[G];if(B.isNode()&&B.isParent()&&!B.pannable()){V=!1;break}}else V=!0;return V},s=function(B){B[0]._private.rscratch.inDragLayer=!0},u=function(B){B[0]._private.rscratch.inDragLayer=!1},l=function(B){B[0]._private.rscratch.isGrabTarget=!0},f=function(B){B[0]._private.rscratch.isGrabTarget=!1},v=function(B,_){var V=_.addToList,G=V.has(B);!G&&B.grabbable()&&!B.locked()&&(V.merge(B),fy(B))},c=function(B,_){if(B.cy().hasCompoundNodes()&&!(_.inDragLayer==null&&_.addToList==null)){var V=B.descendants();_.inDragLayer&&(V.forEach(s),V.connectedEdges().forEach(s)),_.addToList&&v(V,_)}},h=function(B,_){_=_||{};var V=B.cy().hasCompoundNodes();_.inDragLayer&&(B.forEach(s),B.neighborhood().stdFilter(function(G){return!V||G.isEdge()}).forEach(s)),_.addToList&&B.forEach(function(G){v(G,_)}),c(B,_),y(B,{inDragLayer:_.inDragLayer}),t.updateCachedGrabbedEles()},d=h,p=function(B){B&&(t.getCachedZSortedEles().forEach(function(_){vy(_),u(_),f(_)}),t.updateCachedGrabbedEles())},y=function(B,_){if(!(_.inDragLayer==null&&_.addToList==null)&&B.cy().hasCompoundNodes()){var V=B.ancestors().orphans();if(!V.same(B)){var G=V.descendants().spawnSelf().merge(V).unmerge(B).unmerge(B.descendants()),$=G.connectedEdges();_.inDragLayer&&($.forEach(s),G.forEach(s)),_.addToList&&G.forEach(function(ae){v(ae,_)})}}},g=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},b=typeof MutationObserver<"u",m=typeof ResizeObserver<"u";b?(t.removeObserver=new MutationObserver(function(oe){for(var B=0;B<oe.length;B++){var _=oe[B],V=_.removedNodes;if(V)for(var G=0;G<V.length;G++){var $=V[G];if($===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(oe){t.destroy()});var w=Ca(function(){t.cy.resize()},100);b&&(t.styleObserver=new MutationObserver(w),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",w),m&&(t.resizeObserver=new ResizeObserver(w),t.resizeObserver.observe(t.container));var T=function(B,_){for(;B!=null;)_(B),B=B.parentNode},D=function(){t.invalidateContainerClientCoordsCache()};T(t.container,function(oe){t.registerBinding(oe,"transitionend",D),t.registerBinding(oe,"animationend",D),t.registerBinding(oe,"scroll",D)}),t.registerBinding(t.container,"contextmenu",function(oe){oe.preventDefault()});var x=function(){return t.selection[4]!==0},M=function(B){for(var _=t.findContainerClientCoords(),V=_[0],G=_[1],$=_[2],ae=_[3],J=B.touches?B.touches:[B],ne=!1,ie=0;ie<J.length;ie++){var ue=J[ie];if(V<=ue.clientX&&ue.clientX<=V+$&&G<=ue.clientY&&ue.clientY<=G+ae){ne=!0;break}}if(!ne)return!1;for(var fe=t.container,se=B.target,he=se.parentNode,Ce=!1;he;){if(he===fe){Ce=!0;break}he=he.parentNode}return!!Ce};t.registerBinding(t.container,"mousedown",function(B){if(M(B)&&!(t.hoverData.which===1&&B.which!==1)){B.preventDefault(),g(),t.hoverData.capture=!0,t.hoverData.which=B.which;var _=t.cy,V=[B.clientX,B.clientY],G=t.projectIntoViewport(V[0],V[1]),$=t.selection,ae=t.findNearestElements(G[0],G[1],!0,!1),J=ae[0],ne=t.dragData.possibleDragElements;t.hoverData.mdownPos=G,t.hoverData.mdownGPos=V;var ie=function(Ee){return{originalEvent:B,type:Ee,position:{x:G[0],y:G[1]}}},ue=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var Ee=t.hoverData.down;Ee?Ee.emit(ie("taphold")):_.emit(ie("taphold"))}},t.tapholdDuration)};if(B.which==3){t.hoverData.cxtStarted=!0;var fe={originalEvent:B,type:"cxttapstart",position:{x:G[0],y:G[1]}};J?(J.activate(),J.emit(fe),t.hoverData.down=J):_.emit(fe),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(B.which==1){J&&J.activate();{if(J!=null&&t.nodeIsGrabbable(J)){var se=function(Ee){Ee.emit(ie("grab"))};if(l(J),!J.selected())ne=t.dragData.possibleDragElements=_.collection(),d(J,{addToList:ne}),J.emit(ie("grabon")).emit(ie("grab"));else{ne=t.dragData.possibleDragElements=_.collection();var he=_.$(function(Ce){return Ce.isNode()&&Ce.selected()&&t.nodeIsGrabbable(Ce)});h(he,{addToList:ne}),J.emit(ie("grabon")),he.forEach(se)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=J,t.hoverData.downs=ae,t.hoverData.downTime=new Date().getTime()}n(J,["mousedown","tapstart","vmousedown"],B,{x:G[0],y:G[1]}),J==null?($[4]=1,t.data.bgActivePosistion={x:G[0],y:G[1]},t.redrawHint("select",!0),t.redraw()):J.pannable()&&($[4]=1),ue()}$[0]=$[2]=G[0],$[1]=$[3]=G[1]}},!1);var P=a(t.container);t.registerBinding([e,P],"mousemove",function(B){var _=t.hoverData.capture;if(!(!_&&!M(B))){var V=!1,G=t.cy,$=G.zoom(),ae=[B.clientX,B.clientY],J=t.projectIntoViewport(ae[0],ae[1]),ne=t.hoverData.mdownPos,ie=t.hoverData.mdownGPos,ue=t.selection,fe=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(fe=t.findNearestElement(J[0],J[1],!0,!1));var se=t.hoverData.last,he=t.hoverData.down,Ce=[J[0]-ue[2],J[1]-ue[3]],Ee=t.dragData.possibleDragElements,Ve;if(ie){var Ae=ae[0]-ie[0],Se=Ae*Ae,Pe=ae[1]-ie[1],De=Pe*Pe,xe=Se+De;t.hoverData.isOverThresholdDrag=Ve=xe>=t.desktopTapThreshold2}var qe=i(B);Ve&&(t.hoverData.tapholdCancelled=!0);var ke=function(){var yt=t.hoverData.dragDelta=t.hoverData.dragDelta||[];yt.length===0?(yt.push(Ce[0]),yt.push(Ce[1])):(yt[0]+=Ce[0],yt[1]+=Ce[1])};V=!0,n(fe,["mousemove","vmousemove","tapdrag"],B,{x:J[0],y:J[1]});var Re=function(yt){return{originalEvent:B,type:yt,position:{x:J[0],y:J[1]}}},rt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||G.emit(Re("boxstart")),ue[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Ve){var Ke=Re("cxtdrag");he?he.emit(Ke):G.emit(Ke),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||fe!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(Re("cxtdragout")),t.hoverData.cxtOver=fe,fe&&fe.emit(Re("cxtdragover")))}}else if(t.hoverData.dragging){if(V=!0,G.panningEnabled()&&G.userPanningEnabled()){var st;if(t.hoverData.justStartedPan){var Qe=t.hoverData.mdownPos;st={x:(J[0]-Qe[0])*$,y:(J[1]-Qe[1])*$},t.hoverData.justStartedPan=!1}else st={x:Ce[0]*$,y:Ce[1]*$};G.panBy(st),G.emit(Re("dragpan")),t.hoverData.dragged=!0}J=t.projectIntoViewport(B.clientX,B.clientY)}else if(ue[4]==1&&(he==null||he.pannable())){if(Ve){if(!t.hoverData.dragging&&G.boxSelectionEnabled()&&(qe||!G.panningEnabled()||!G.userPanningEnabled()))rt();else if(!t.hoverData.selecting&&G.panningEnabled()&&G.userPanningEnabled()){var Et=o(he,t.hoverData.downs);Et&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,ue[4]=0,t.data.bgActivePosistion=$r(ne),t.redrawHint("select",!0),t.redraw())}he&&he.pannable()&&he.active()&&he.unactivate()}}else{if(he&&he.pannable()&&he.active()&&he.unactivate(),(!he||!he.grabbed())&&fe!=se&&(se&&n(se,["mouseout","tapdragout"],B,{x:J[0],y:J[1]}),fe&&n(fe,["mouseover","tapdragover"],B,{x:J[0],y:J[1]}),t.hoverData.last=fe),he)if(Ve){if(G.boxSelectionEnabled()&&qe)he&&he.grabbed()&&(p(Ee),he.emit(Re("freeon")),Ee.emit(Re("free")),t.dragData.didDrag&&(he.emit(Re("dragfreeon")),Ee.emit(Re("dragfree")))),rt();else if(he&&he.grabbed()&&t.nodeIsDraggable(he)){var ft=!t.dragData.didDrag;ft&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||h(Ee,{inDragLayer:!0});var ut={x:0,y:0};if(be(Ce[0])&&be(Ce[1])&&(ut.x+=Ce[0],ut.y+=Ce[1],ft)){var lt=t.hoverData.dragDelta;lt&&be(lt[0])&&be(lt[1])&&(ut.x+=lt[0],ut.y+=lt[1])}t.hoverData.draggingEles=!0,Ee.silentShift(ut).emit(Re("position")).emit(Re("drag")),t.redrawHint("drag",!0),t.redraw()}}else ke();V=!0}if(ue[2]=J[0],ue[3]=J[1],V)return B.stopPropagation&&B.stopPropagation(),B.preventDefault&&B.preventDefault(),!1}},!1);var N,O,R;t.registerBinding(e,"mouseup",function(B){if(!(t.hoverData.which===1&&B.which!==1&&t.hoverData.capture)){var _=t.hoverData.capture;if(_){t.hoverData.capture=!1;var V=t.cy,G=t.projectIntoViewport(B.clientX,B.clientY),$=t.selection,ae=t.findNearestElement(G[0],G[1],!0,!1),J=t.dragData.possibleDragElements,ne=t.hoverData.down,ie=i(B);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ne&&ne.unactivate();var ue=function(Ae){return{originalEvent:B,type:Ae,position:{x:G[0],y:G[1]}}};if(t.hoverData.which===3){var fe=ue("cxttapend");if(ne?ne.emit(fe):V.emit(fe),!t.hoverData.cxtDragged){var se=ue("cxttap");ne?ne.emit(se):V.emit(se)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(n(ae,["mouseup","tapend","vmouseup"],B,{x:G[0],y:G[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(n(ne,["click","tap","vclick"],B,{x:G[0],y:G[1]}),O=!1,B.timeStamp-R<=V.multiClickDebounceTime()?(N&&clearTimeout(N),O=!0,R=null,n(ne,["dblclick","dbltap","vdblclick"],B,{x:G[0],y:G[1]})):(N=setTimeout(function(){O||n(ne,["oneclick","onetap","voneclick"],B,{x:G[0],y:G[1]})},V.multiClickDebounceTime()),R=B.timeStamp)),ne==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!i(B)&&(V.$(r).unselect(["tapunselect"]),J.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=J=V.collection()),ae==ne&&!t.dragData.didDrag&&!t.hoverData.selecting&&ae!=null&&ae._private.selectable&&(t.hoverData.dragging||(V.selectionType()==="additive"||ie?ae.selected()?ae.unselect(["tapunselect"]):ae.select(["tapselect"]):ie||(V.$(r).unmerge(ae).unselect(["tapunselect"]),ae.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var he=V.collection(t.getAllInBox($[0],$[1],$[2],$[3]));t.redrawHint("select",!0),he.length>0&&t.redrawHint("eles",!0),V.emit(ue("boxend"));var Ce=function(Ae){return Ae.selectable()&&!Ae.selected()};V.selectionType()==="additive"||ie||V.$(r).unmerge(he).unselect(),he.emit(ue("box")).stdFilter(Ce).select().emit(ue("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!$[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Ee=ne&&ne.grabbed();p(J),Ee&&(ne.emit(ue("freeon")),J.emit(ue("free")),t.dragData.didDrag&&(ne.emit(ue("dragfreeon")),J.emit(ue("dragfree"))))}}$[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var I=[],E=4,A,S=1e5,C=function(B){for(var _=Math.abs(B[0]),V=1;V<B.length;V++)if(Math.abs(B[V])!==_)return!1;return!0},L=function(B){var _=!1,V=B.deltaY;if(V==null&&(B.wheelDeltaY!=null?V=B.wheelDeltaY/4:B.wheelDelta!=null&&(V=B.wheelDelta/4)),V!==0){if(A==null)if(I.length>=E){A=!1;var G=I;if(G[0]>=5){var $;C(G)?$=G[0]:$=Dc(G),$>1&&(A=!0,S=$)}}else I.push(Math.abs(V)),_=!0;else A&&(S=Math.min(Math.abs(V),S));if(!t.scrollingPage){var ae=t.cy,J=ae.zoom(),ne=ae.pan(),ie=t.projectIntoViewport(B.clientX,B.clientY),ue=[ie[0]*J+ne.x,ie[1]*J+ne.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||x()){B.preventDefault();return}if(ae.panningEnabled()&&ae.userPanningEnabled()&&ae.zoomingEnabled()&&ae.userZoomingEnabled()){B.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var fe;_&&Math.abs(V)>5&&(V=Vi(V)*5),fe=V/-250,A&&(fe/=S,fe*=3),fe=fe*t.wheelSensitivity;var se=B.deltaMode===1;se&&(fe*=33);var he=ae.zoom()*Math.pow(10,fe);B.type==="gesturechange"&&(he=t.gestureStartZoom*B.scale),ae.zoom({level:he,renderedPosition:{x:ue[0],y:ue[1]}}),ae.emit({type:B.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:B,position:{x:ie[0],y:ie[1]}})}}}};t.registerBinding(t.container,"wheel",L,!0),t.registerBinding(e,"scroll",function(B){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(B){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||B.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(oe){t.hasTouchStarted||L(oe)},!0),t.registerBinding(t.container,"mouseout",function(B){var _=t.projectIntoViewport(B.clientX,B.clientY);t.cy.emit({originalEvent:B,type:"mouseout",position:{x:_[0],y:_[1]}})},!1),t.registerBinding(t.container,"mouseover",function(B){var _=t.projectIntoViewport(B.clientX,B.clientY);t.cy.emit({originalEvent:B,type:"mouseover",position:{x:_[0],y:_[1]}})},!1);var z,k,F,H,W,Q,K,Z,j,re,q,U,Y,X=function(B,_,V,G){return Math.sqrt((V-B)*(V-B)+(G-_)*(G-_))},ee=function(B,_,V,G){return(V-B)*(V-B)+(G-_)*(G-_)},te;t.registerBinding(t.container,"touchstart",te=function(B){if(t.hasTouchStarted=!0,!!M(B)){g(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var _=t.cy,V=t.touchData.now,G=t.touchData.earlier;if(B.touches[0]){var $=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);V[0]=$[0],V[1]=$[1]}if(B.touches[1]){var $=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);V[2]=$[0],V[3]=$[1]}if(B.touches[2]){var $=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);V[4]=$[0],V[5]=$[1]}var ae=function(qe){return{originalEvent:B,type:qe,position:{x:V[0],y:V[1]}}};if(B.touches[1]){t.touchData.singleTouchMoved=!0,p(t.dragData.touchDragEles);var J=t.findContainerClientCoords();j=J[0],re=J[1],q=J[2],U=J[3],z=B.touches[0].clientX-j,k=B.touches[0].clientY-re,F=B.touches[1].clientX-j,H=B.touches[1].clientY-re,Y=0<=z&&z<=q&&0<=F&&F<=q&&0<=k&&k<=U&&0<=H&&H<=U;var ne=_.pan(),ie=_.zoom();W=X(z,k,F,H),Q=ee(z,k,F,H),K=[(z+F)/2,(k+H)/2],Z=[(K[0]-ne.x)/ie,(K[1]-ne.y)/ie];var ue=200,fe=ue*ue;if(Q<fe&&!B.touches[2]){var se=t.findNearestElement(V[0],V[1],!0,!0),he=t.findNearestElement(V[2],V[3],!0,!0);se&&se.isNode()?(se.activate().emit(ae("cxttapstart")),t.touchData.start=se):he&&he.isNode()?(he.activate().emit(ae("cxttapstart")),t.touchData.start=he):_.emit(ae("cxttapstart")),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(B.touches[2])_.boxSelectionEnabled()&&B.preventDefault();else if(!B.touches[1]){if(B.touches[0]){var Ce=t.findNearestElements(V[0],V[1],!0,!0),Ee=Ce[0];if(Ee!=null&&(Ee.activate(),t.touchData.start=Ee,t.touchData.starts=Ce,t.nodeIsGrabbable(Ee))){var Ve=t.dragData.touchDragEles=_.collection(),Ae=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),Ee.selected()?(Ae=_.$(function(xe){return xe.selected()&&t.nodeIsGrabbable(xe)}),h(Ae,{addToList:Ve})):d(Ee,{addToList:Ve}),l(Ee),Ee.emit(ae("grabon")),Ae?Ae.forEach(function(xe){xe.emit(ae("grab"))}):Ee.emit(ae("grab"))}n(Ee,["touchstart","tapstart","vmousedown"],B,{x:V[0],y:V[1]}),Ee==null&&(t.data.bgActivePosistion={x:$[0],y:$[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&n(t.touchData.start,["taphold"],B,{x:V[0],y:V[1]})},t.tapholdDuration)}}if(B.touches.length>=1){for(var Se=t.touchData.startPosition=[null,null,null,null,null,null],Pe=0;Pe<V.length;Pe++)Se[Pe]=G[Pe]=V[Pe];var De=B.touches[0];t.touchData.startGPosition=[De.clientX,De.clientY]}}},!1);var ge;t.registerBinding(e,"touchmove",ge=function(B){var _=t.touchData.capture;if(!(!_&&!M(B))){var V=t.selection,G=t.cy,$=t.touchData.now,ae=t.touchData.earlier,J=G.zoom();if(B.touches[0]){var ne=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);$[0]=ne[0],$[1]=ne[1]}if(B.touches[1]){var ne=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);$[2]=ne[0],$[3]=ne[1]}if(B.touches[2]){var ne=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);$[4]=ne[0],$[5]=ne[1]}var ie=function(Zm){return{originalEvent:B,type:Zm,position:{x:$[0],y:$[1]}}},ue=t.touchData.startGPosition,fe;if(_&&B.touches[0]&&ue){for(var se=[],he=0;he<$.length;he++)se[he]=$[he]-ae[he];var Ce=B.touches[0].clientX-ue[0],Ee=Ce*Ce,Ve=B.touches[0].clientY-ue[1],Ae=Ve*Ve,Se=Ee+Ae;fe=Se>=t.touchTapThreshold2}if(_&&t.touchData.cxt){B.preventDefault();var Pe=B.touches[0].clientX-j,De=B.touches[0].clientY-re,xe=B.touches[1].clientX-j,qe=B.touches[1].clientY-re,ke=ee(Pe,De,xe,qe),Re=ke/Q,rt=150,Ke=rt*rt,st=1.5,Qe=st*st;if(Re>=Qe||ke>=Ke){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Et=ie("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(Et),t.touchData.start=null):G.emit(Et)}}if(_&&t.touchData.cxt){var Et=ie("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Et):G.emit(Et),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var ft=t.findNearestElement($[0],$[1],!0,!0);(!t.touchData.cxtOver||ft!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(ie("cxtdragout")),t.touchData.cxtOver=ft,ft&&ft.emit(ie("cxtdragover")))}else if(_&&B.touches[2]&&G.boxSelectionEnabled())B.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||G.emit(ie("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,V[4]=1,!V||V.length===0||V[0]===void 0?(V[0]=($[0]+$[2]+$[4])/3,V[1]=($[1]+$[3]+$[5])/3,V[2]=($[0]+$[2]+$[4])/3+1,V[3]=($[1]+$[3]+$[5])/3+1):(V[2]=($[0]+$[2]+$[4])/3,V[3]=($[1]+$[3]+$[5])/3),t.redrawHint("select",!0),t.redraw();else if(_&&B.touches[1]&&!t.touchData.didSelect&&G.zoomingEnabled()&&G.panningEnabled()&&G.userZoomingEnabled()&&G.userPanningEnabled()){B.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ut=t.dragData.touchDragEles;if(ut){t.redrawHint("drag",!0);for(var lt=0;lt<ut.length;lt++){var Gt=ut[lt]._private;Gt.grabbed=!1,Gt.rscratch.inDragLayer=!1}}var yt=t.touchData.start,Pe=B.touches[0].clientX-j,De=B.touches[0].clientY-re,xe=B.touches[1].clientX-j,qe=B.touches[1].clientY-re,Jt=X(Pe,De,xe,qe),ya=Jt/W;if(Y){var Sr=Pe-z,Ar=De-k,li=xe-F,en=qe-H,fi=(Sr+li)/2,tn=(Ar+en)/2,Ur=G.zoom(),Hr=Ur*ya,qr=G.pan(),rn=Z[0]*Ur+qr.x,ma=Z[1]*Ur+qr.y,vi={x:-Hr/Ur*(rn-qr.x-fi)+rn,y:-Hr/Ur*(ma-qr.y-tn)+ma};if(yt&&yt.active()){var ut=t.dragData.touchDragEles;p(ut),t.redrawHint("drag",!0),t.redrawHint("eles",!0),yt.unactivate().emit(ie("freeon")),ut&&ut.emit(ie("free")),t.dragData.didDrag&&(yt.emit(ie("dragfreeon")),ut&&ut.emit(ie("dragfree")))}G.viewport({zoom:Hr,pan:vi,cancelOnFailedZoom:!0}),G.emit(ie("pinchzoom")),W=Jt,z=Pe,k=De,F=xe,H=qe,t.pinching=!0}if(B.touches[0]){var ne=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);$[0]=ne[0],$[1]=ne[1]}if(B.touches[1]){var ne=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);$[2]=ne[0],$[3]=ne[1]}if(B.touches[2]){var ne=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);$[4]=ne[0],$[5]=ne[1]}}else if(B.touches[0]&&!t.touchData.didSelect){var _e=t.touchData.start,ze=t.touchData.last,ft;if(!t.hoverData.draggingEles&&!t.swipePanning&&(ft=t.findNearestElement($[0],$[1],!0,!0)),_&&_e!=null&&B.preventDefault(),_&&_e!=null&&t.nodeIsDraggable(_e))if(fe){var ut=t.dragData.touchDragEles,We=!t.dragData.didDrag;We&&h(ut,{inDragLayer:!0}),t.dragData.didDrag=!0;var Bt={x:0,y:0};if(be(se[0])&&be(se[1])&&(Bt.x+=se[0],Bt.y+=se[1],We)){t.redrawHint("eles",!0);var nt=t.touchData.dragDelta;nt&&be(nt[0])&&be(nt[1])&&(Bt.x+=nt[0],Bt.y+=nt[1])}t.hoverData.draggingEles=!0,ut.silentShift(Bt).emit(ie("position")).emit(ie("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==ae[0]&&t.touchData.startPosition[1]==ae[1]&&t.redrawHint("eles",!0),t.redraw()}else{var nt=t.touchData.dragDelta=t.touchData.dragDelta||[];nt.length===0?(nt.push(se[0]),nt.push(se[1])):(nt[0]+=se[0],nt[1]+=se[1])}if(n(_e||ft,["touchmove","tapdrag","vmousemove"],B,{x:$[0],y:$[1]}),(!_e||!_e.grabbed())&&ft!=ze&&(ze&&ze.emit(ie("tapdragout")),ft&&ft.emit(ie("tapdragover"))),t.touchData.last=ft,_)for(var lt=0;lt<$.length;lt++)$[lt]&&t.touchData.startPosition[lt]&&fe&&(t.touchData.singleTouchMoved=!0);if(_&&(_e==null||_e.pannable())&&G.panningEnabled()&&G.userPanningEnabled()){var _m=o(_e,t.touchData.starts);_m&&(B.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=$r(t.touchData.startPosition)),t.swipePanning?(G.panBy({x:se[0]*J,y:se[1]*J}),G.emit(ie("dragpan"))):fe&&(t.swipePanning=!0,G.panBy({x:Ce*J,y:Ve*J}),G.emit(ie("dragpan")),_e&&(_e.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ne=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);$[0]=ne[0],$[1]=ne[1]}}for(var he=0;he<$.length;he++)ae[he]=$[he];_&&B.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var Te;t.registerBinding(e,"touchcancel",Te=function(B){var _=t.touchData.start;t.touchData.capture=!1,_&&_.unactivate()});var pe,le,ce,ve;if(t.registerBinding(e,"touchend",pe=function(B){var _=t.touchData.start,V=t.touchData.capture;if(V)B.touches.length===0&&(t.touchData.capture=!1),B.preventDefault();else return;var G=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var $=t.cy,ae=$.zoom(),J=t.touchData.now,ne=t.touchData.earlier;if(B.touches[0]){var ie=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);J[0]=ie[0],J[1]=ie[1]}if(B.touches[1]){var ie=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);J[2]=ie[0],J[3]=ie[1]}if(B.touches[2]){var ie=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);J[4]=ie[0],J[5]=ie[1]}var ue=function(Ke){return{originalEvent:B,type:Ke,position:{x:J[0],y:J[1]}}};_&&_.unactivate();var fe;if(t.touchData.cxt){if(fe=ue("cxttapend"),_?_.emit(fe):$.emit(fe),!t.touchData.cxtDragged){var se=ue("cxttap");_?_.emit(se):$.emit(se)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!B.touches[2]&&$.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var he=$.collection(t.getAllInBox(G[0],G[1],G[2],G[3]));G[0]=void 0,G[1]=void 0,G[2]=void 0,G[3]=void 0,G[4]=0,t.redrawHint("select",!0),$.emit(ue("boxend"));var Ce=function(Ke){return Ke.selectable()&&!Ke.selected()};he.emit(ue("box")).stdFilter(Ce).select().emit(ue("boxselect")),he.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(_!=null&&_.unactivate(),B.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!B.touches[1]){if(!B.touches[0]){if(!B.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ee=t.dragData.touchDragEles;if(_!=null){var Ve=_._private.grabbed;p(Ee),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ve&&(_.emit(ue("freeon")),Ee.emit(ue("free")),t.dragData.didDrag&&(_.emit(ue("dragfreeon")),Ee.emit(ue("dragfree")))),n(_,["touchend","tapend","vmouseup","tapdragout"],B,{x:J[0],y:J[1]}),_.unactivate(),t.touchData.start=null}else{var Ae=t.findNearestElement(J[0],J[1],!0,!0);n(Ae,["touchend","tapend","vmouseup","tapdragout"],B,{x:J[0],y:J[1]})}var Se=t.touchData.startPosition[0]-J[0],Pe=Se*Se,De=t.touchData.startPosition[1]-J[1],xe=De*De,qe=Pe+xe,ke=qe*ae*ae;t.touchData.singleTouchMoved||(_||$.$(":selected").unselect(["tapunselect"]),n(_,["tap","vclick"],B,{x:J[0],y:J[1]}),le=!1,B.timeStamp-ve<=$.multiClickDebounceTime()?(ce&&clearTimeout(ce),le=!0,ve=null,n(_,["dbltap","vdblclick"],B,{x:J[0],y:J[1]})):(ce=setTimeout(function(){le||n(_,["onetap","voneclick"],B,{x:J[0],y:J[1]})},$.multiClickDebounceTime()),ve=B.timeStamp)),_!=null&&!t.dragData.didDrag&&_._private.selectable&&ke<t.touchTapThreshold2&&!t.pinching&&($.selectionType()==="single"?($.$(r).unmerge(_).unselect(["tapunselect"]),_.select(["tapselect"])):_.selected()?_.unselect(["tapunselect"]):_.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Re=0;Re<J.length;Re++)ne[Re]=J[Re];t.dragData.didDrag=!1,B.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),B.touches.length<2&&(B.touches.length===1&&(t.touchData.startGPosition=[B.touches[0].clientX,B.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var de=[],me=function(B){return{clientX:B.clientX,clientY:B.clientY,force:1,identifier:B.pointerId,pageX:B.pageX,pageY:B.pageY,radiusX:B.width/2,radiusY:B.height/2,screenX:B.screenX,screenY:B.screenY,target:B.target}},ye=function(B){return{event:B,touch:me(B)}},we=function(B){de.push(ye(B))},Me=function(B){for(var _=0;_<de.length;_++){var V=de[_];if(V.event.pointerId===B.pointerId){de.splice(_,1);return}}},Ie=function(B){var _=de.filter(function(V){return V.event.pointerId===B.pointerId})[0];_.event=B,_.touch=me(B)},Be=function(B){B.touches=de.map(function(_){return _.touch})},Fe=function(B){return B.pointerType==="mouse"||B.pointerType===4};t.registerBinding(t.container,"pointerdown",function(oe){Fe(oe)||(oe.preventDefault(),we(oe),Be(oe),te(oe))}),t.registerBinding(t.container,"pointerup",function(oe){Fe(oe)||(Me(oe),Be(oe),pe(oe))}),t.registerBinding(t.container,"pointercancel",function(oe){Fe(oe)||(Me(oe),Be(oe),Te(oe))}),t.registerBinding(t.container,"pointermove",function(oe){Fe(oe)||(oe.preventDefault(),Ie(oe),Be(oe),ge(oe))})}};var ar={};ar.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,o,s,u){this.renderer.nodeShapeImpl("polygon",a,n,i,o,s,this.points)},intersectLine:function(a,n,i,o,s,u,l,f){return Na(s,u,this.points,a,n,i/2,o/2,l)},checkPoint:function(a,n,i,o,s,u,l,f){return tr(a,n,this.points,u,l,o,s,[0,-1],i)},hasMiterBounds:t!=="rectangle",miterBounds:function(a,n,i,o,s,u){return Fc(this.points,a,n,i,o,s)}}},ar.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){return Yc(i,o,e,r,a/2+s,n/2+s)},checkPoint:function(e,r,a,n,i,o,s,u){return Nr(e,r,n,i,o,s,a)}}},ar.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,n,i,o,s,u,l){if(u[l]!==void 0&&u[l+"-cx"]===a&&u[l+"-cy"]===n&&u[l+"-w"]===i&&u[l+"-h"]===o&&u[l+"-corner-radius"]===s)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=a,u[l+"-cy"]=n,u[l+"-w"]=i,u[l+"-h"]=o,u[l+"-corner-radius"]=s;var f=i/2,v=o/2;s=s==="auto"?Ru(i,o):s;for(var c=new Array(e.length/2),h=0;h<e.length/2;h++)c[h]={x:a+f*e[h*2],y:n+v*e[h*2+1]};var d,p,y,g,b=c.length;for(p=c[b-1],d=0;d<b;d++)y=c[d%b],g=c[(d+1)%b],u[l][d]=ys(p,y,g,s),p=y,y=g;return u[l]},draw:function(a,n,i,o,s,u,l){this.renderer.nodeShapeImpl("round-polygon",a,n,i,o,s,this.points,this.getOrCreateCorners(n,i,o,s,u,l,"drawCorners"))},intersectLine:function(a,n,i,o,s,u,l,f,v){return Xc(s,u,this.points,a,n,i,o,l,this.getOrCreateCorners(a,n,i,o,f,v,"corners"))},checkPoint:function(a,n,i,o,s,u,l,f,v){return qc(a,n,this.points,u,l,o,s,this.getOrCreateCorners(u,l,o,s,f,v,"corners"))}}},ar.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Nt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){return Lu(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){var l=n/2,f=i/2;u=u==="auto"?cr(n,i):u,u=Math.min(l,f,u);var v=u*2;return!!(tr(e,r,this.points,o,s,n,i-v,[0,-1],a)||tr(e,r,this.points,o,s,n-v,i,[0,-1],a)||Nr(e,r,v,v,o-l+u,s-f+u,a)||Nr(e,r,v,v,o+l-u,s-f+u,a)||Nr(e,r,v,v,o+l-u,s+f-u,a)||Nr(e,r,v,v,o-l+u,s+f-u,a))}}},ar.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:qi(),points:Nt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,null,o)},generateCutTrianglePts:function(e,r,a,n,i){var o=i==="auto"?this.cornerLength:i,s=r/2,u=e/2,l=a-u,f=a+u,v=n-s,c=n+s;return{topLeft:[l,v+o,l+o,v,l+o,v+o],topRight:[f-o,v,f,v+o,f-o,v+o],bottomRight:[f,c-o,f-o,c,f-o,c-o],bottomLeft:[l+o,c,l,c-o,l+o,c-o]}},intersectLine:function(e,r,a,n,i,o,s,u){var l=this.generateCutTrianglePts(a+2*s,n+2*s,e,r,u),f=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Na(i,o,f,e,r)},checkPoint:function(e,r,a,n,i,o,s,u){var l=u==="auto"?this.cornerLength:u;if(tr(e,r,this.points,o,s,n,i-2*l,[0,-1],a)||tr(e,r,this.points,o,s,n-2*l,i,[0,-1],a))return!0;var f=this.generateCutTrianglePts(n,i,o,s);return It(e,r,f.topLeft)||It(e,r,f.topRight)||It(e,r,f.bottomRight)||It(e,r,f.bottomLeft)}}},ar.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Nt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){var l=.15,f=.5,v=.85,c=this.generateBarrelBezierPts(a+2*s,n+2*s,e,r),h=function(y){var g=Kr({x:y[0],y:y[1]},{x:y[2],y:y[3]},{x:y[4],y:y[5]},l),b=Kr({x:y[0],y:y[1]},{x:y[2],y:y[3]},{x:y[4],y:y[5]},f),m=Kr({x:y[0],y:y[1]},{x:y[2],y:y[3]},{x:y[4],y:y[5]},v);return[y[0],y[1],g.x,g.y,b.x,b.y,m.x,m.y,y[4],y[5]]},d=[].concat(h(c.topLeft),h(c.topRight),h(c.bottomRight),h(c.bottomLeft));return Na(i,o,d,e,r)},generateBarrelBezierPts:function(e,r,a,n){var i=r/2,o=e/2,s=a-o,u=a+o,l=n-i,f=n+i,v=Yi(e,r),c=v.heightOffset,h=v.widthOffset,d=v.ctrlPtOffsetPct*e,p={topLeft:[s,l+c,s+d,l,s+h,l],topRight:[u-h,l,u-d,l,u,l+c],bottomRight:[u,f-c,u-d,f,u-h,f],bottomLeft:[s+h,f,s+d,f,s,f-c]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,r,a,n,i,o,s,u){var l=Yi(n,i),f=l.heightOffset,v=l.widthOffset;if(tr(e,r,this.points,o,s,n,i-2*f,[0,-1],a)||tr(e,r,this.points,o,s,n-2*v,i,[0,-1],a))return!0;for(var c=this.generateBarrelBezierPts(n,i,o,s),h=function(M,P,N){var O=N[4],R=N[2],I=N[0],E=N[5],A=N[1],S=Math.min(O,I),C=Math.max(O,I),L=Math.min(E,A),z=Math.max(E,A);if(S<=M&&M<=C&&L<=P&&P<=z){var k=$c(O,R,I),F=Vc(k[0],k[1],k[2],M),H=F.filter(function(W){return 0<=W&&W<=1});if(H.length>0)return H[0]}return null},d=Object.keys(c),p=0;p<d.length;p++){var y=d[p],g=c[y],b=h(e,r,g);if(b!=null){var m=g[5],w=g[3],T=g[1],D=mt(m,w,T,b);if(g.isTop&&D<=r||g.isBottom&&r<=D)return!0}}return!1}}},ar.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Nt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){var l=e-(a/2+s),f=r-(n/2+s),v=f,c=e+(a/2+s),h=hr(i,o,e,r,l,f,c,v,!1);return h.length>0?h:Lu(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){u=u==="auto"?cr(n,i):u;var l=2*u;if(tr(e,r,this.points,o,s,n,i-l,[0,-1],a)||tr(e,r,this.points,o,s,n-l,i,[0,-1],a))return!0;var f=n/2+2*a,v=i/2+2*a,c=[o-f,s-v,o-f,s,o+f,s,o+f,s-v];return!!(It(e,r,c)||Nr(e,r,l,l,o+n/2-u,s+i/2-u,a)||Nr(e,r,l,l,o-n/2+u,s+i/2-u,a))}}},ar.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Nt(3,0)),this.generateRoundPolygon("round-triangle",Nt(3,0)),this.generatePolygon("rectangle",Nt(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",Nt(5,0)),this.generateRoundPolygon("round-pentagon",Nt(5,0)),this.generatePolygon("hexagon",Nt(6,0)),this.generateRoundPolygon("round-hexagon",Nt(6,0)),this.generatePolygon("heptagon",Nt(7,0)),this.generateRoundPolygon("round-heptagon",Nt(7,0)),this.generatePolygon("octagon",Nt(8,0)),this.generateRoundPolygon("round-octagon",Nt(8,0));var a=new Array(20);{var n=Hi(5,0),i=Hi(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[s*2]*=o,i[s*2+1]*=o;for(var s=0;s<20/4;s++)a[s*4]=n[s*2],a[s*4+1]=n[s*2+1],a[s*4+2]=i[s*2],a[s*4+3]=i[s*2+1]}a=Mu(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}t.makePolygon=function(l){var f=l.join("$"),v="polygon-"+f,c;return(c=this[v])?c:e.generatePolygon(v,l)}};var Xa={};Xa.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},Xa.redraw=function(t){t=t||mu();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t},Xa.beforeRender=function(t,e){if(!this.destroyed){e==null&&at("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,n){return n.priority-a.priority})}};var bv=function(e,r,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(r,a)};Xa.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function(n){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){bv(t,!0,n);var i=jt();t.render(t.renderOptions);var o=t.lastDrawTime=jt();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var s=o-i;t.redrawTotalTime+=s,t.lastRedrawTime=s,t.averageRedrawTime=t.averageRedrawTime/2+s/2,t.requestedFrame=!1}else bv(t,!1,n);t.skipFrame=!1,ln(r)}};ln(r)}};var hy=function(e){this.init(e)},wv=hy,ha=wv.prototype;ha.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],ha.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",u=n.getElementById(o)!=null;if(r.className.indexOf(s)<0&&(r.className=(r.className||"")+" "+s),!u){var l=n.createElement("style");l.id=o,l.textContent="."+s+" { position: relative; }",i.insertBefore(l,i.children[0])}var f=a.getComputedStyle(r),v=f.getPropertyValue("position");v==="static"&&Xe("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.webgl=t.webgl,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=be(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()},ha.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),t==="gc"&&r.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},ha.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}},ha.isHeadless=function(){return!1},[hs,pv,yv,va,ar,Xa].forEach(function(t){Oe(ha,t)});var bs=1e3/60,Ev={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=Ca(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),o=function(l,f){var v=jt(),c=n.averageRedrawTime,h=n.lastRedrawTime,d=[],p=n.cy.extent(),y=n.getPixelRatio();for(l||n.flushRenderedStyleQueue();;){var g=jt(),b=g-v,m=g-f;if(h<bs){var w=bs-(l?c:0);if(m>=e.deqFastCost*w)break}else if(l){if(b>=e.deqCost*h||b>=e.deqAvgCost*c)break}else if(m>=e.deqNoDrawCost*bs)break;var T=e.deq(a,y,p);if(T.length>0)for(var D=0;D<T.length;D++)d.push(T[D]);else break}d.length>0&&(e.onDeqd(a,d),!l&&e.shouldRedraw(a,d,y,p)&&i())},s=e.priority||Oi;n.beforeRender(o,s(a))}}}},cy=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vn;ir(this,t),this.idsByKey=new er,this.keyForId=new er,this.cachesByLvl=new er,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return or(t,[{key:"getIdsFor",value:function(r){r==null&&at("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new Xr,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new er,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])}(),xv=25,jn=50,ei=-4,ws=3,Tv=7.99,dy=8,gy=1024,py=1024,yy=1024,my=.2,by=.8,wy=10,Ey=.15,xy=.1,Ty=.9,Cy=.9,Sy=100,Ay=1,ca={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Dy=xt({getKey:null,doesEleInvalidateKey:vn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:du,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),$a=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=Dy(r);Oe(a,n),a.lookup=new cy(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},pt=$a.prototype;pt.reasons=ca,pt.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]},pt.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a},pt.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new La(function(r,a){return a.reqs-r.reqs});return e},pt.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e},pt.getElement=function(t,e,r,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(zi(s*r))),a<ei)a=ei;else if(s>=Tv||a>ws)return null;var l=Math.pow(2,a),f=e.h*l,v=e.w*l,c=o.eleTextBiggerThanMin(t,l);if(!this.isVisible(t,c))return null;var h=u.get(t,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(f<=xv?d=xv:f<=jn?d=jn:d=Math.ceil(f/jn)*jn,f>yy||v>py)return null;var p=i.getTextureQueue(d),y=p[p.length-2],g=function(){return i.recycleTexture(d,v)||i.addTexture(d,v)};y||(y=p[p.length-1]),y||(y=g()),y.width-y.usedWidth<v&&(y=g());for(var b=function(S){return S&&S.scaledLabelShown===c},m=n&&n===ca.dequeue,w=n&&n===ca.highQuality,T=n&&n===ca.downscale,D,x=a+1;x<=ws;x++){var M=u.get(t,x);if(M){D=M;break}}var P=D&&D.level===a+1?D:null,N=function(){y.context.drawImage(P.texture.canvas,P.x,0,P.width,P.height,y.usedWidth,0,v,f)};if(y.context.setTransform(1,0,0,1,0,0),y.context.clearRect(y.usedWidth,0,v,d),b(P))N();else if(b(D))if(w){for(var O=D.level;O>a;O--)P=i.getElement(t,e,r,O,ca.downscale);N()}else return i.queueElement(t,D.level-1),D;else{var R;if(!m&&!w&&!T)for(var I=a-1;I>=ei;I--){var E=u.get(t,I);if(E){R=E;break}}if(b(R))return i.queueElement(t,a),R;y.context.translate(y.usedWidth,0),y.context.scale(l,l),this.drawElement(y.context,t,e,c,!1),y.context.scale(1/l,1/l),y.context.translate(-y.usedWidth,0)}return h={x:y.usedWidth,texture:y,level:a,scale:l,width:v,height:f,scaledLabelShown:c},y.usedWidth+=Math.ceil(v+dy),y.eleCaches.push(h),u.set(t,a,h),i.checkTextureFullness(y),h},pt.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])},pt.invalidateElement=function(t){var e=this,r=e.lookup,a=[],n=r.isInvalid(t);if(n){for(var i=ei;i<=ws;i++){var o=r.getForCachedKey(t,i);o&&a.push(o)}var s=r.invalidate(t);if(s)for(var u=0;u<a.length;u++){var l=a[u],f=l.texture;f.invalidatedWidth+=l.width,l.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(t)}},pt.checkTextureUtility=function(t){t.invalidatedWidth>=my*t.width&&this.retireTexture(t)},pt.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>by&&t.fullnessChecks>=wy?fr(r,t):t.fullnessChecks++},pt.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;fr(a,t),t.retired=!0;for(var i=t.eleCaches,o=0;o<i.length;o++){var s=i[o];n.deleteCache(s.key,s.level)}Ii(i);var u=e.getRetiredTextureQueue(r);u.push(t)},pt.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),n={};return a.push(n),n.eleCaches=[],n.height=t,n.width=Math.max(gy,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=r.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},pt.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),n=r.getRetiredTextureQueue(t),i=0;i<n.length;i++){var o=n[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Ii(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),fr(n,o),a.push(o),o}},pt.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,a.updateItem(o);else{var s={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(s),n[i]=s}},pt.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o<Ay&&r.size()>0;o++){var s=r.pop(),u=s.key,l=s.eles[0],f=i.hasCache(l,s.level);if(a[u]=null,f)continue;n.push(s);var v=e.getBoundingBox(l);e.getElement(l,v,t,s.level,ca.dequeue)}return n},pt.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=Pi,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))},pt.onDequeue=function(t){this.onDequeues.push(t)},pt.offDequeue=function(t){fr(this.onDequeues,t)},pt.setupDequeueing=Ev.setupDequeueing({deqRedrawThreshold:Sy,deqCost:Ey,deqAvgCost:xy,deqNoDrawCost:Ty,deqFastCost:Cy,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(r)}},shouldRedraw:function(e,r,a,n){for(var i=0;i<r.length;i++)for(var o=r[i].eles,s=0;s<o.length;s++){var u=o[s].boundingBox();if(Gi(u,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Ly=1,Ka=-4,ti=2,My=3.99,Ry=50,Ny=50,Py=.15,Oy=.1,Iy=.9,By=.9,Fy=1,Cv=250,ky=4e3*4e3,Sv=32767,zy=!0,Av=function(e){var r=this,a=r.renderer=e,n=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=jt()-2*Cv,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=Ca(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},Ny),a.beforeRender(function(o,s){s-r.lastInvalidationTime<=Cv?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(s,u){return u.reqs-s.reqs};r.layersQueue=new La(i),r.setupDequeueing()},St=Av.prototype,Dv=0,Vy=Math.pow(2,53)-1;St.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),n=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(a,n),o={id:Dv=++Dv%Vy,bb:t,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(r,r),s.translate(u,l),o},St.getLayers=function(t,e,r){var a=this,n=a.renderer,i=n.cy,o=i.zoom(),s=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(zi(o*e)),r<Ka)r=Ka;else if(o>=My||r>ti)return null}a.validateLayersElesOrdering(r,t);var u=a.layersByLevel,l=Math.pow(2,r),f=u[r]=u[r]||[],v,c=a.levelIsComplete(r,t),h,d=function(){var N=function(A){if(a.validateLayersElesOrdering(A,t),a.levelIsComplete(A,t))return h=u[A],!0},O=function(A){if(!h)for(var S=r+A;Ka<=S&&S<=ti&&!N(S);S+=A);};O(1),O(-1);for(var R=f.length-1;R>=0;R--){var I=f[R];I.invalid&&fr(f,I)}};if(!c)d();else return f;var p=function(){if(!v){v=Rt();for(var N=0;N<t.length;N++)Oc(v,t[N].boundingBox())}return v},y=function(N){N=N||{};var O=N.after;p();var R=Math.ceil(v.w*l),I=Math.ceil(v.h*l);if(R>Sv||I>Sv)return null;var E=R*I;if(E>ky)return null;var A=a.makeLayer(v,r);if(O!=null){var S=f.indexOf(O)+1;f.splice(S,0,A)}else(N.insert===void 0||N.insert)&&f.unshift(A);return A};if(a.skipping&&!s)return null;for(var g=null,b=t.length/Ly,m=!s,w=0;w<t.length;w++){var T=t[w],D=T._private.rscratch,x=D.imgLayerCaches=D.imgLayerCaches||{},M=x[r];if(M){g=M;continue}if((!g||g.eles.length>=b||!Du(g.bb,T.boundingBox()))&&(g=y({insert:!0,after:g}),!g))return null;h||m?a.queueLayer(g,T):a.drawEleInLayer(g,T,r,e),g.eles.push(T),x[r]=g}return h||(m?null:f)},St.getEleLevelForLayerLevel=function(t,e){return t},St.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,o=t.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,r,zy),i.setImgSmoothing(o,!0))},St.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var o=a[i];if(o.reqs>0||o.invalid)return!1;n+=o.eles.length}return n===e.length},St.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var n=r[a],i=-1,o=0;o<e.length;o++)if(n.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(n);continue}for(var s=i,o=0;o<n.eles.length;o++)if(n.eles[o]!==e[s+o]){this.invalidateLayer(n);break}}},St.updateElementsInLayers=function(t,e){for(var r=this,a=wa(t[0]),n=0;n<t.length;n++)for(var i=a?null:t[n],o=a?t[n]:t[n].ele,s=o._private.rscratch,u=s.imgLayerCaches=s.imgLayerCaches||{},l=Ka;l<=ti;l++){var f=u[l];f&&(i&&r.getEleLevelForLayerLevel(f.level)!==i.level||e(f,o,i))}},St.haveLayers=function(){for(var t=this,e=!1,r=Ka;r<=ti;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e},St.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=jt(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))},St.invalidateLayer=function(t){if(this.lastInvalidationTime=jt(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];fr(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}},St.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,n,i){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})},St.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()},St.queueLayer=function(t,e){var r=this,a=r.layersQueue,n=t.elesQueue,i=n.hasId=n.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}},St.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],n=0;n<Fy&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,t),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a},St.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,n=r.indexOf(a);if(!(n<0||a.invalid)){r[n]=t;for(var i=0;i<t.eles.length;i++){var o=t.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[t.level]=t)}e.requestRedraw()}},St.requestRedraw=Ca(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100),St.setupDequeueing=Ev.setupDequeueing({deqRedrawThreshold:Ry,deqCost:Py,deqAvgCost:Oy,deqNoDrawCost:Iy,deqFastCost:By,deq:function(e,r){return e.dequeue(r)},onDeqd:Oi,shouldRedraw:du,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Lv={},Mv;function Gy(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function Uy(t,e,r){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function Rv(t,e,r){t.beginPath&&t.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];t.lineTo(i.x,i.y)}var o=r,s=r[0];t.moveTo(s.x,s.y);for(var n=1;n<o.length;n++){var i=o[n];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function Hy(t,e,r,a,n){t.beginPath&&t.beginPath(),t.arc(r,a,n,0,Math.PI*2,!1);var i=e,o=i[0];t.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var u=i[s];t.lineTo(u.x,u.y)}t.closePath&&t.closePath()}function qy(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}Lv.arrowShapeImpl=function(t){return(Mv||(Mv={polygon:Gy,"triangle-backcurve":Uy,"triangle-tee":Rv,"circle-triangle":Hy,"triangle-cross":Rv,circle:qy}))[t]};var Zt={};Zt.drawElement=function(t,e,r,a,n,i){var o=this;e.isNode()?o.drawNode(t,e,r,a,n,i):o.drawEdge(t,e,r,a,n,i)},Zt.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)},Zt.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)},Zt.drawCachedElementPortion=function(t,e,r,a,n,i,o,s){var u=this,l=r.getBoundingBox(e);if(!(l.w===0||l.h===0)){var f=r.getElement(e,l,a,n,i);if(f!=null){var v=s(u,e);if(v===0)return;var c=o(u,e),h=l.x1,d=l.y1,p=l.w,y=l.h,g,b,m,w,T;if(c!==0){var D=r.getRotationPoint(e);m=D.x,w=D.y,t.translate(m,w),t.rotate(c),T=u.getImgSmoothing(t),T||u.setImgSmoothing(t,!0);var x=r.getRotationOffset(e);g=x.x,b=x.y}else g=h,b=d;var M;v!==1&&(M=t.globalAlpha,t.globalAlpha=M*v),t.drawImage(f.texture.canvas,f.x,0,f.width,f.height,g,b,p,y),v!==1&&(t.globalAlpha=M),c!==0&&(t.rotate(-c),t.translate(-m,-w),T||u.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var Yy=function(){return 0},Wy=function(e,r){return e.getTextAngle(r,null)},Xy=function(e,r){return e.getTextAngle(r,"source")},$y=function(e,r){return e.getTextAngle(r,"target")},Ky=function(e,r){return r.effectiveOpacity()},Es=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};Zt.drawCachedElement=function(t,e,r,a,n,i){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,f=s.slbTxrCache,v=s.tlbTxrCache,c=e.boundingBox(),h=i===!0?u.reasons.highQuality:null;if(!(c.w===0||c.h===0||!e.visible())&&(!a||Gi(c,a))){var d=e.isEdge(),p=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,u,r,n,h,Yy,Ky),(!d||!p)&&o.drawCachedElementPortion(t,e,l,r,n,h,Wy,Es),d&&!p&&(o.drawCachedElementPortion(t,e,f,r,n,h,Xy,Es),o.drawCachedElementPortion(t,e,v,r,n,h,$y,Es)),o.drawElementOverlay(t,e)}},Zt.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var n=e[a];r.drawElement(t,n)}},Zt.drawCachedElements=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];n.drawCachedElement(t,o,r,a)}},Zt.drawCachedNodes=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&n.drawCachedElement(t,o,r,a)}},Zt.drawLayeredElements=function(t,e,r,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,r);if(i)for(var o=0;o<i.length;o++){var s=i[o],u=s.bb;u.w===0||u.h===0||t.drawImage(s.canvas,u.x1,u.y1,u.w,u.h)}else n.drawCachedElements(t,e,r,a)};var nr={};nr.drawEdge=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,v=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,p=e.pstyle("line-outline-width").value,y=e.pstyle("line-outline-color").value,g=l*f,b=l*f,m=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;v==="straight-triangle"?(o.eleStrokeStyle(t,e,A),o.drawEdgeTrianglePath(e,t,s.allpts)):(t.lineWidth=h,t.lineCap=d,o.eleStrokeStyle(t,e,A),o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},w=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;if(t.lineWidth=h+p,t.lineCap=d,p>0)o.colorStrokeStyle(t,y[0],y[1],y[2],A);else{t.lineCap="butt";return}v==="straight-triangle"?o.drawEdgeTrianglePath(e,t,s.allpts):(o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},T=function(){n&&o.drawEdgeOverlay(t,e)},D=function(){n&&o.drawEdgeUnderlay(t,e)},x=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;o.drawArrowheads(t,e,A)},M=function(){o.drawElementText(t,e,null,a)};t.lineJoin="round";var P=e.pstyle("ghost").value==="yes";if(P){var N=e.pstyle("ghost-offset-x").pfValue,O=e.pstyle("ghost-offset-y").pfValue,R=e.pstyle("ghost-opacity").value,I=g*R;t.translate(N,O),m(I),x(I),t.translate(-N,-O)}else w();D(),m(),x(),T(),M(),r&&t.translate(u.x1,u.y1)}};var Nv=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,o=i.usePaths(),s=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=l,s.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,s.allpts,"solid")}}}};nr.drawEdgeOverlay=Nv("overlay"),nr.drawEdgeUnderlay=Nv("underlay"),nr.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,o,s=!1,u=this.usePaths(),l=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(u){var v=r.join("$"),c=n.pathCacheKey&&n.pathCacheKey===v;c?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=v,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<r.length;h+=4)e.quadraticCurveTo(r[h],r[h+1],r[h+2],r[h+3]);break;case"straight":case"haystack":for(var d=2;d+1<r.length;d+=2)e.lineTo(r[d],r[d+1]);break;case"segments":if(n.isRound){var p=Ot(n.roundCorners),y;try{for(p.s();!(y=p.n()).done;){var g=y.value;lv(e,g)}}catch(m){p.e(m)}finally{p.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var b=2;b+1<r.length;b+=2)e.lineTo(r[b],r[b+1]);break}e=i,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])},nr.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,n=0;n+1<r.length;n+=2){var i=[r[n+2]-r[n],r[n+3]-r[n+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],u=[s[0]*a/2,s[1]*a/2];e.beginPath(),e.moveTo(r[n]-u[0],r[n+1]-u[1]),e.lineTo(r[n]+u[0],r[n+1]+u[1]),e.lineTo(r[n+2],r[n+3]),e.closePath(),e.fill()}},nr.drawArrowheads=function(t,e,r){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),n||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)},nr.drawArrowhead=function(t,e,r,a,n,i,o){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var s=this,u=e.pstyle(r+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(r+"-arrow-fill").value,v=e.pstyle("width").pfValue,c=e.pstyle(r+"-arrow-width"),h=c.value==="match-line"?v:c.pfValue;c.units==="%"&&(h*=v);var d=e.pstyle("opacity").value;o===void 0&&(o=d);var p=t.globalCompositeOperation;(o!==1||f==="hollow")&&(t.globalCompositeOperation="destination-out",s.colorFillStyle(t,255,255,255,1),s.colorStrokeStyle(t,255,255,255,1),s.drawArrowShape(e,t,l,v,u,h,a,n,i),t.globalCompositeOperation=p);var y=e.pstyle(r+"-arrow-color").value;s.colorFillStyle(t,y[0],y[1],y[2],o),s.colorStrokeStyle(t,y[0],y[1],y[2],o),s.drawArrowShape(e,t,f,v,u,h,a,n,i)}}},nr.drawArrowShape=function(t,e,r,a,n,i,o,s,u){var l=this,f=this.usePaths()&&n!=="triangle-cross",v=!1,c,h=e,d={x:o,y:s},p=t.pstyle("arrow-scale").value,y=this.getArrowWidth(a,p),g=l.arrowShapes[n];if(f){var b=l.arrowPathCache=l.arrowPathCache||[],m=Lr(n),w=b[m];w!=null?(c=e=w,v=!0):(c=e=new Path2D,b[m]=c)}v||(e.beginPath&&e.beginPath(),f?g.draw(e,1,0,{x:0,y:0},1):g.draw(e,y,u,d,a),e.closePath&&e.closePath()),e=h,f&&(e.translate(o,s),e.rotate(u),e.scale(y,y)),(r==="filled"||r==="both")&&(f?e.fill(c):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(f?y:1),e.lineJoin="miter",f?e.stroke(c):e.stroke()),f&&(e.scale(1/y,1/y),e.rotate(-u),e.translate(-o,-s))};var xs={};xs.safeDrawImage=function(t,e,r,a,n,i,o,s,u,l){if(!(n<=0||i<=0||u<=0||l<=0))try{t.drawImage(e,r,a,n,i,o,s,u,l)}catch(f){Xe(f)}},xs.drawInscribedImage=function(t,e,r,a,n){var i=this,o=r.position(),s=o.x,u=o.y,l=r.cy().style(),f=l.getIndexedStyle.bind(l),v=f(r,"background-fit","value",a),c=f(r,"background-repeat","value",a),h=r.width(),d=r.height(),p=r.padding()*2,y=h+(f(r,"background-width-relative-to","value",a)==="inner"?0:p),g=d+(f(r,"background-height-relative-to","value",a)==="inner"?0:p),b=r._private.rscratch,m=f(r,"background-clip","value",a),w=m==="node",T=f(r,"background-image-opacity","value",a)*n,D=f(r,"background-image-smoothing","value",a),x=r.pstyle("corner-radius").value;x!=="auto"&&(x=r.pstyle("corner-radius").pfValue);var M=e.width||e.cachedW,P=e.height||e.cachedH;(M==null||P==null)&&(document.body.appendChild(e),M=e.cachedW=e.width||e.offsetWidth,P=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var N=M,O=P;if(f(r,"background-width","value",a)!=="auto"&&(f(r,"background-width","units",a)==="%"?N=f(r,"background-width","pfValue",a)*y:N=f(r,"background-width","pfValue",a)),f(r,"background-height","value",a)!=="auto"&&(f(r,"background-height","units",a)==="%"?O=f(r,"background-height","pfValue",a)*g:O=f(r,"background-height","pfValue",a)),!(N===0||O===0)){if(v==="contain"){var R=Math.min(y/N,g/O);N*=R,O*=R}else if(v==="cover"){var R=Math.max(y/N,g/O);N*=R,O*=R}var I=s-y/2,E=f(r,"background-position-x","units",a),A=f(r,"background-position-x","pfValue",a);E==="%"?I+=(y-N)*A:I+=A;var S=f(r,"background-offset-x","units",a),C=f(r,"background-offset-x","pfValue",a);S==="%"?I+=(y-N)*C:I+=C;var L=u-g/2,z=f(r,"background-position-y","units",a),k=f(r,"background-position-y","pfValue",a);z==="%"?L+=(g-O)*k:L+=k;var F=f(r,"background-offset-y","units",a),H=f(r,"background-offset-y","pfValue",a);F==="%"?L+=(g-O)*H:L+=H,b.pathCache&&(I-=s,L-=u,s=0,u=0);var W=t.globalAlpha;t.globalAlpha=T;var Q=i.getImgSmoothing(t),K=!1;if(D==="no"&&Q?(i.setImgSmoothing(t,!1),K=!0):D==="yes"&&!Q&&(i.setImgSmoothing(t,!0),K=!0),c==="no-repeat")w&&(t.save(),b.pathCache?t.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,y,g,x,b),t.clip())),i.safeDrawImage(t,e,0,0,M,P,I,L,N,O),w&&t.restore();else{var Z=t.createPattern(e,c);t.fillStyle=Z,i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,y,g,x,b),t.translate(I,L),t.fill(),t.translate(-I,-L)}t.globalAlpha=W,K&&i.setImgSmoothing(t,Q)}};var zr={};zr.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(zi(r*a));e=Math.pow(2,n)}var i=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(i<o)},zr.drawElementText=function(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(e),l=e.pstyle("text-metrics").strValue==="glyph";t.textAlign=u,t.textBaseline=l?"alphabetic":"bottom"}else{var f=e.element()._private.rscratch.badLine,v=e.pstyle("label"),c=e.pstyle("source-label"),h=e.pstyle("target-label");if(f||(!v||!v.value)&&(!c||!c.value)&&(!h||!h.value))return;t.textAlign="center",t.textBaseline="bottom"}var d=!r,p;r&&(p=r,t.translate(-p.x1,-p.y1)),n==null?(o.drawText(t,e,null,d,i),e.isEdge()&&(o.drawText(t,e,"source",d,i),o.drawText(t,e,"target",d,i))):o.drawText(t,e,n,d,i),r&&t.translate(p.x1,p.y1)},zr.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e},zr.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*s,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+o+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,l[0],l[1],l[2],s),this.colorStrokeStyle(t,f[0],f[1],f[2],u)};function _y(t,e,r,a,n){var i=Math.min(a,n),o=i/2,s=e+a/2,u=r+n/2;t.beginPath(),t.arc(s,u,o,0,Math.PI*2),t.closePath()}function Pv(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(i,a/2,n/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+a-o,r),t.quadraticCurveTo(e+a,r,e+a,r+o),t.lineTo(e+a,r+n-o),t.quadraticCurveTo(e+a,r+n,e+a-o,r+n),t.lineTo(e+o,r+n),t.quadraticCurveTo(e,r+n,e,r+n-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath()}zr.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",o=t.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var s=Mt(n,"labelAngle",e);r=t.isEdge()?s:0}else o.strValue==="none"?r=0:r=o.pfValue;return r},zr.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=n?e.effectiveOpacity():1;if(!(n&&(s===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=Mt(o,"labelX",r),l=Mt(o,"labelY",r),f,v,c=this.getLabelText(e,r);if(c!=null&&c!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(t,e,n);var h=r?r+"-":"",d=Mt(o,"labelWidth",r),p=Mt(o,"labelHeight",r),y=Mt(o,"labelActualDescent",r),g=e.pstyle(h+"text-margin-x").pfValue,b=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),w=e.pstyle("text-halign").value,T=e.pstyle("text-valign").value;m&&(w="center",T="center"),u+=g,l+=b;var D;a?D=this.getTextAngle(e,r):D=0,D!==0&&(f=u,v=l,t.translate(f,v),t.rotate(D),u=0,l=0);var x=aa(w),M=na(T);switch(M){case"top":break;case"center":l+=p/2;break;case"bottom":l+=p;break}var P=e.pstyle("text-background-opacity").value,N=e.pstyle("text-border-opacity").value,O=e.pstyle("text-border-width").pfValue,R=e.pstyle("text-background-padding").pfValue,I=e.pstyle("text-background-shape").strValue,E=I==="round-rectangle"||I==="roundrectangle",A=I==="circle",S=2;if(P>0||O>0&&N>0){var C=t.fillStyle,L=t.strokeStyle,z=t.lineWidth,k=e.pstyle("text-background-color").value,F=e.pstyle("text-border-color").value,H=e.pstyle("text-border-style").value,W=P>0,Q=O>0&&N>0,K=u-R;switch(x){case"left":K-=d;break;case"center":K-=d/2;break}var Z=l-p-R,j=d+2*R,re=p+2*R;if(W&&(t.fillStyle="rgba(".concat(k[0],",").concat(k[1],",").concat(k[2],",").concat(P*s,")")),Q&&(t.strokeStyle="rgba(".concat(F[0],",").concat(F[1],",").concat(F[2],",").concat(N*s,")"),t.lineWidth=O,t.setLineDash))switch(H){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=O/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if(E?(t.beginPath(),Pv(t,K,Z,j,re,S)):A?(t.beginPath(),_y(t,K,Z,j,re)):(t.beginPath(),t.rect(K,Z,j,re)),W&&t.fill(),Q&&t.stroke(),Q&&H==="double"){var q=O/2;t.beginPath(),E?Pv(t,K+q,Z+q,j-2*q,re-2*q,S):t.rect(K+q,Z+q,j-2*q,re-2*q),t.stroke()}t.fillStyle=C,t.strokeStyle=L,t.lineWidth=z,t.setLineDash&&t.setLineDash([])}var U=2*e.pstyle("text-outline-width").pfValue;if(U>0&&(t.lineWidth=U),l-=y,e.pstyle("text-wrap").value==="wrap"){var Y=Mt(o,"labelWrapCachedLines",r),X=Mt(o,"labelLineHeight",r),ee=d/2,te=this.getLabelJustification(e);switch(te==="auto"||(x==="left"?te==="left"?u+=-d:te==="center"&&(u+=-ee):x==="center"?te==="left"?u+=-ee:te==="right"&&(u+=ee):x==="right"&&(te==="center"?u+=ee:te==="right"&&(u+=d))),M){case"top":l-=(Y.length-1)*X;break;case"center":case"bottom":l-=(Y.length-1)*X;break}for(var ge=0;ge<Y.length;ge++)U>0&&t.strokeText(Y[ge],u,l),t.fillText(Y[ge],u,l),l+=X}else U>0&&t.strokeText(c,u,l),t.fillText(c,u,l);D!==0&&(t.rotate(-D),t.translate(-f,-v))}}};var xr={};xr.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,u,l=e._private,f=l.rscratch,v=e.position();if(!(!be(v.x)||!be(v.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,h=o.usePaths(),d,p=!1,y=e.padding();s=e.width()+2*y,u=e.height()+2*y;var g;r&&(g=r,t.translate(-g.x1,-g.y1));for(var b=e.pstyle("background-image"),m=b.value,w=new Array(m.length),T=new Array(m.length),D=0,x=0;x<m.length;x++){var M=m[x],P=w[x]=M!=null&&M!=="none";if(P){var N=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",x);D++,T[x]=o.getCachedImage(M,N,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var O=e.pstyle("background-blacken").value,R=e.pstyle("border-width").pfValue,I=e.pstyle("background-opacity").value*c,E=e.pstyle("border-color").value,A=e.pstyle("border-style").value,S=e.pstyle("border-join").value,C=e.pstyle("border-cap").value,L=e.pstyle("border-position").value,z=e.pstyle("border-dash-pattern").pfValue,k=e.pstyle("border-dash-offset").pfValue,F=e.pstyle("border-opacity").value*c,H=e.pstyle("outline-width").pfValue,W=e.pstyle("outline-color").value,Q=e.pstyle("outline-style").value,K=e.pstyle("outline-opacity").value*c,Z=e.pstyle("outline-offset").value,j=e.pstyle("corner-radius").value;j!=="auto"&&(j=e.pstyle("corner-radius").pfValue);var re=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:I;o.eleFillStyle(t,e,_)},q=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(t,E[0],E[1],E[2],_)},U=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:K;o.colorStrokeStyle(t,W[0],W[1],W[2],_)},Y=function(_,V,G,$){var ae=o.nodePathCache=o.nodePathCache||[],J=hu(G==="polygon"?G+","+$.join(","):G,""+V,""+_,""+j),ne=ae[J],ie,ue=!1;return ne!=null?(ie=ne,ue=!0,f.pathCache=ie):(ie=new Path2D,ae[J]=f.pathCache=ie),{path:ie,cacheHit:ue}},X=e.pstyle("shape").strValue,ee=e.pstyle("shape-polygon-points").pfValue;if(h){t.translate(v.x,v.y);var te=Y(s,u,X,ee);d=te.path,p=te.cacheHit}var ge=function(){if(!p){var _=v;h&&(_={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(d||t,_.x,_.y,s,u,j,f)}h?t.fill(d):t.fill()},Te=function(){for(var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,G=l.backgrounding,$=0,ae=0;ae<T.length;ae++){var J=e.cy().style().getIndexedStyle(e,"background-image-containment","value",ae);if(V&&J==="over"||!V&&J==="inside"){$++;continue}w[ae]&&T[ae].complete&&!T[ae].error&&($++,o.drawInscribedImage(t,T[ae],e,ae,_))}l.backgrounding=$!==D,G!==l.backgrounding&&e.updateStyle(!1)},pe=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasPie(e)&&(o.drawPie(t,e,V),_&&(h||o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,j,f)))},le=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasStripe(e)&&(t.save(),h?t.clip(f.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,j,f),t.clip()),o.drawStripe(t,e,V),t.restore(),_&&(h||o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,j,f)))},ce=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,V=(O>0?O:-O)*_,G=O>0?0:255;O!==0&&(o.colorFillStyle(t,G,G,G,V),h?t.fill(d):t.fill())},ve=function(){if(R>0){if(t.lineWidth=R,t.lineCap=C,t.lineJoin=S,t.setLineDash)switch(A){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(z),t.lineDashOffset=k;break;case"solid":case"double":t.setLineDash([]);break}if(L!=="center"){if(t.save(),t.lineWidth*=2,L==="inside")h?t.clip(d):t.clip();else{var _=new Path2D;_.rect(-s/2-R,-u/2-R,s+2*R,u+2*R),_.addPath(d),t.clip(_,"evenodd")}h?t.stroke(d):t.stroke(),t.restore()}else h?t.stroke(d):t.stroke();if(A==="double"){t.lineWidth=R/3;var V=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",h?t.stroke(d):t.stroke(),t.globalCompositeOperation=V}t.setLineDash&&t.setLineDash([])}},de=function(){if(H>0){if(t.lineWidth=H,t.lineCap="butt",t.setLineDash)switch(Q){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var _=v;h&&(_={x:0,y:0});var V=o.getNodeShape(e),G=R;L==="inside"&&(G=0),L==="outside"&&(G*=2);var $=(s+G+(H+Z))/s,ae=(u+G+(H+Z))/u,J=s*$,ne=u*ae,ie=o.nodeShapes[V].points,ue;if(h){var fe=Y(J,ne,V,ie);ue=fe.path}if(V==="ellipse")o.drawEllipsePath(ue||t,_.x,_.y,J,ne);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(V)){var se=0,he=0,Ce=0;V==="round-diamond"?se=(G+Z+H)*1.4:V==="round-heptagon"?(se=(G+Z+H)*1.075,Ce=-(G/2+Z+H)/35):V==="round-hexagon"?se=(G+Z+H)*1.12:V==="round-pentagon"?(se=(G+Z+H)*1.13,Ce=-(G/2+Z+H)/15):V==="round-tag"?(se=(G+Z+H)*1.12,he=(G/2+H+Z)*.07):V==="round-triangle"&&(se=(G+Z+H)*(Math.PI/2),Ce=-(G+Z/2+H)/Math.PI),se!==0&&($=(s+se)/s,J=s*$,["round-hexagon","round-tag"].includes(V)||(ae=(u+se)/u,ne=u*ae)),j=j==="auto"?Ru(J,ne):j;for(var Ee=J/2,Ve=ne/2,Ae=j+(G+H+Z)/2,Se=new Array(ie.length/2),Pe=new Array(ie.length/2),De=0;De<ie.length/2;De++)Se[De]={x:_.x+he+Ee*ie[De*2],y:_.y+Ce+Ve*ie[De*2+1]};var xe,qe,ke,Re,rt=Se.length;for(qe=Se[rt-1],xe=0;xe<rt;xe++)ke=Se[xe%rt],Re=Se[(xe+1)%rt],Pe[xe]=ys(qe,ke,Re,Ae),qe=ke,ke=Re;o.drawRoundPolygonPath(ue||t,_.x+he,_.y+Ce,s*$,u*ae,ie,Pe)}else if(["roundrectangle","round-rectangle"].includes(V))j=j==="auto"?cr(J,ne):j,o.drawRoundRectanglePath(ue||t,_.x,_.y,J,ne,j+(G+H+Z)/2);else if(["cutrectangle","cut-rectangle"].includes(V))j=j==="auto"?qi():j,o.drawCutRectanglePath(ue||t,_.x,_.y,J,ne,null,j+(G+H+Z)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(V))j=j==="auto"?cr(J,ne):j,o.drawBottomRoundRectanglePath(ue||t,_.x,_.y,J,ne,j+(G+H+Z)/2);else if(V==="barrel")o.drawBarrelPath(ue||t,_.x,_.y,J,ne);else if(V.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(V)){var Ke=(G+H+Z)/s;ie=mn(bn(ie,Ke)),o.drawPolygonPath(ue||t,_.x,_.y,s,u,ie)}else{var st=(G+H+Z)/s;ie=mn(bn(ie,-st)),o.drawPolygonPath(ue||t,_.x,_.y,s,u,ie)}if(h?t.stroke(ue):t.stroke(),Q==="double"){t.lineWidth=G/3;var Qe=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",h?t.stroke(ue):t.stroke(),t.globalCompositeOperation=Qe}t.setLineDash&&t.setLineDash([])}},me=function(){n&&o.drawNodeOverlay(t,e,v,s,u)},ye=function(){n&&o.drawNodeUnderlay(t,e,v,s,u)},we=function(){o.drawElementText(t,e,null,a)},Me=e.pstyle("ghost").value==="yes";if(Me){var Ie=e.pstyle("ghost-offset-x").pfValue,Be=e.pstyle("ghost-offset-y").pfValue,Fe=e.pstyle("ghost-opacity").value,oe=Fe*c;t.translate(Ie,Be),U(),de(),re(Fe*I),ge(),Te(oe,!0),q(Fe*F),ve(),pe(O!==0||R!==0),le(O!==0||R!==0),Te(oe,!1),ce(oe),t.translate(-Ie,-Be)}h&&t.translate(-v.x,-v.y),ye(),h&&t.translate(v.x,v.y),U(),de(),re(),ge(),Te(c,!0),q(),ve(),pe(O!==0||R!==0),le(O!==0||R!==0),Te(c,!1),ce(),h&&t.translate(-v.x,-v.y),we(),me(),r&&t.translate(g.x1,g.y1)}};var Ov=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,o){var s=this;if(a.visible()){var u=a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,v=a.pstyle("".concat(e,"-shape")).value,c=a.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(n=n||a.position(),i==null||o==null){var h=a.padding();i=a.width()+2*h,o=a.height()+2*h}s.colorFillStyle(r,f[0],f[1],f[2],l),s.nodeShapes[v].draw(r,n.x,n.y,i+u*2,o+u*2,c),r.fill()}}}};xr.drawNodeOverlay=Ov("overlay"),xr.drawNodeUnderlay=Ov("underlay"),xr.hasPie=function(t){return t=t[0],t._private.hasPie},xr.hasStripe=function(t){return t=t[0],t._private.hasStripe},xr.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),s=e.pstyle("pie-start-angle").pfValue,u=a.x,l=a.y,f=e.width(),v=e.height(),c=Math.min(f,v)/2,h,d=0,p=this.usePaths();if(p&&(u=0,l=0),i.units==="%"?c=c*i.pfValue:i.pfValue!==void 0&&(c=i.pfValue/2),o.units==="%"?h=c*o.pfValue:o.pfValue!==void 0&&(h=o.pfValue/2),!(h>=c))for(var y=1;y<=n.pieBackgroundN;y++){var g=e.pstyle("pie-"+y+"-background-size").value,b=e.pstyle("pie-"+y+"-background-color").value,m=e.pstyle("pie-"+y+"-background-opacity").value*r,w=g/100;w+d>1&&(w=1-d);var T=1.5*Math.PI+2*Math.PI*d;T+=s;var D=2*Math.PI*w,x=T+D;g===0||d>=1||d+w>1||(h===0?(t.beginPath(),t.moveTo(u,l),t.arc(u,l,c,T,x),t.closePath()):(t.beginPath(),t.arc(u,l,c,T,x),t.arc(u,l,h,x,T,!0),t.closePath()),this.colorFillStyle(t,b[0],b[1],b[2],m),t.fill(),d+=w)}},xr.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,o=a.y,s=e.width(),u=e.height(),l=0,f=this.usePaths();t.save();var v=e.pstyle("stripe-direction").value,c=e.pstyle("stripe-size");switch(v){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var h=s,d=u;c.units==="%"?(h=h*c.pfValue,d=d*c.pfValue):c.pfValue!==void 0&&(h=c.pfValue,d=c.pfValue),f&&(i=0,o=0),o-=h/2,i-=d/2;for(var p=1;p<=n.stripeBackgroundN;p++){var y=e.pstyle("stripe-"+p+"-background-size").value,g=e.pstyle("stripe-"+p+"-background-color").value,b=e.pstyle("stripe-"+p+"-background-opacity").value*r,m=y/100;m+l>1&&(m=1-l),!(y===0||l>=1||l+m>1)&&(t.beginPath(),t.rect(i,o+d*l,h,d*m),t.closePath(),this.colorFillStyle(t,g[0],g[1],g[2],b),t.fill(),l+=m)}t.restore()};var Pt={},Zy=100;Pt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r},Pt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a},Pt.createGradientStyleFor=function(t,e,r,a,n){var i,o=this.usePaths(),s=r.pstyle(e+"-gradient-stop-colors").value,u=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var l=r.sourceEndpoint(),f=r.targetEndpoint(),v=r.midpoint(),c=Mr(l,v),h=Mr(f,v);i=t.createRadialGradient(v.x,v.y,0,v.x,v.y,Math.max(c,h))}else{var d=o?{x:0,y:0}:r.position(),p=r.paddedWidth(),y=r.paddedHeight();i=t.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(p,y))}else if(r.isEdge()){var g=r.sourceEndpoint(),b=r.targetEndpoint();i=t.createLinearGradient(g.x,g.y,b.x,b.y)}else{var m=o?{x:0,y:0}:r.position(),w=r.paddedWidth(),T=r.paddedHeight(),D=w/2,x=T/2,M=r.pstyle("background-gradient-direction").value;switch(M){case"to-bottom":i=t.createLinearGradient(m.x,m.y-x,m.x,m.y+x);break;case"to-top":i=t.createLinearGradient(m.x,m.y+x,m.x,m.y-x);break;case"to-left":i=t.createLinearGradient(m.x+D,m.y,m.x-D,m.y);break;case"to-right":i=t.createLinearGradient(m.x-D,m.y,m.x+D,m.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(m.x-D,m.y-x,m.x+D,m.y+x);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(m.x-D,m.y+x,m.x+D,m.y-x);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(m.x+D,m.y-x,m.x-D,m.y+x);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(m.x+D,m.y+x,m.x-D,m.y-x);break}}if(!i)return null;for(var P=u.length===s.length,N=s.length,O=0;O<N;O++)i.addColorStop(P?u[O]:O/(N-1),"rgba("+s[O][0]+","+s[O][1]+","+s[O][2]+","+n+")");return i},Pt.gradientFillStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"background",e,r,a);if(!n)return null;t.fillStyle=n},Pt.colorFillStyle=function(t,e,r,a,n){t.fillStyle="rgba("+e+","+r+","+a+","+n+")"},Pt.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var n=e.pstyle("background-color").value;this.colorFillStyle(t,n[0],n[1],n[2],r)}},Pt.gradientStrokeStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"line",e,r,a);if(!n)return null;t.strokeStyle=n},Pt.colorStrokeStyle=function(t,e,r,a,n){t.strokeStyle="rgba("+e+","+r+","+a+","+n+")"},Pt.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(t,n[0],n[1],n[2],r)}},Pt.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],o=e.getPixelRatio(),s=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var u=n*o,l=i*o,f;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var v=r.canvasContainer;v.style.width=n+"px",v.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)f=r.canvases[c],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.BUFFER_COUNT;c++)f=r.bufferCanvases[c],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,o<=1&&(f=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=u*e.textureMult,f.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=o}},Pt.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})},Pt.clearCanvas=function(){var t=this,e=t.data;function r(a){a.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])},Pt.render=function(t){var e=this;t=t||mu();var r=e.cy,a=t.forcedContext,n=t.drawAllLayers,i=t.drawOnlyNodeLayer,o=t.forcedZoom,s=t.forcedPan,u=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,l=e.data,f=l.canvasNeedsRedraw,v=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),c=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,h=e.motionBlurPxRatio,d=r.hasCompoundNodes(),p=e.hoverData.draggingEles,y=!!(e.hoverData.selecting||e.touchData.selecting);c=c&&!a&&e.motionBlurEnabled&&!y;var g=c;a||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),c&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(g=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!v&&(f[e.NODE]=!0,f[e.SELECT_BOX]=!0);var b=r.style(),m=r.zoom(),w=o!==void 0?o:m,T=r.pan(),D={x:T.x,y:T.y},x={zoom:m,pan:{x:T.x,y:T.y}},M=e.prevViewport,P=M===void 0||x.zoom!==M.zoom||x.pan.x!==M.pan.x||x.pan.y!==M.pan.y;!P&&!(p&&!d)&&(e.motionBlurPxRatio=1),s&&(D=s),w*=u,D.x*=u,D.y*=u;var N=e.getCachedZSortedEles();function O(q,U,Y,X,ee){var te=q.globalCompositeOperation;q.globalCompositeOperation="destination-out",e.colorFillStyle(q,255,255,255,e.motionBlurTransparency),q.fillRect(U,Y,X,ee),q.globalCompositeOperation=te}function R(q,U){var Y,X,ee,te;!e.clearingMotionBlur&&(q===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||q===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(Y={x:T.x*h,y:T.y*h},X=m*h,ee=e.canvasWidth*h,te=e.canvasHeight*h):(Y=D,X=w,ee=e.canvasWidth,te=e.canvasHeight),q.setTransform(1,0,0,1,0,0),U==="motionBlur"?O(q,0,0,ee,te):!a&&(U===void 0||U)&&q.clearRect(0,0,ee,te),n||(q.translate(Y.x,Y.y),q.scale(X,X)),s&&q.translate(s.x,s.y),o&&q.scale(o,o)}if(v||(e.textureDrawLastFrame=!1),v){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var I=e.data.bufferContexts[e.TEXTURE_BUFFER];I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:I,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var x=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}f[e.DRAG]=!1,f[e.NODE]=!1;var E=l.contexts[e.NODE],A=e.textureCache.texture,x=e.textureCache.viewport;E.setTransform(1,0,0,1,0,0),c?O(E,0,0,x.width,x.height):E.clearRect(0,0,x.width,x.height);var S=b.core("outside-texture-bg-color").value,C=b.core("outside-texture-bg-opacity").value;e.colorFillStyle(E,S[0],S[1],S[2],C),E.fillRect(0,0,x.width,x.height);var m=r.zoom();R(E,!1),E.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u),E.drawImage(A,x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u)}else e.textureOnViewport&&!a&&(e.textureCache=null);var L=r.extent(),z=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),k=e.hideEdgesOnViewport&&z,F=[];if(F[e.NODE]=!f[e.NODE]&&c&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,F[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),F[e.DRAG]=!f[e.DRAG]&&c&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,F[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),f[e.NODE]||n||i||F[e.NODE]){var H=c&&!F[e.NODE]&&h!==1,E=a||(H?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),W=c&&!H?"motionBlur":void 0;R(E,W),k?e.drawCachedNodes(E,N.nondrag,u,L):e.drawLayeredElements(E,N.nondrag,u,L),e.debug&&e.drawDebugPoints(E,N.nondrag),!n&&!c&&(f[e.NODE]=!1)}if(!i&&(f[e.DRAG]||n||F[e.DRAG])){var H=c&&!F[e.DRAG]&&h!==1,E=a||(H?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);R(E,c&&!H?"motionBlur":void 0),k?e.drawCachedNodes(E,N.drag,u,L):e.drawCachedElements(E,N.drag,u,L),e.debug&&e.drawDebugPoints(E,N.drag),!n&&!c&&(f[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,R),c&&h!==1){var Q=l.contexts[e.NODE],K=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Z=l.contexts[e.DRAG],j=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],re=function(U,Y,X){U.setTransform(1,0,0,1,0,0),X||!g?U.clearRect(0,0,e.canvasWidth,e.canvasHeight):O(U,0,0,e.canvasWidth,e.canvasHeight);var ee=h;U.drawImage(Y,0,0,e.canvasWidth*ee,e.canvasHeight*ee,0,0,e.canvasWidth,e.canvasHeight)};(f[e.NODE]||F[e.NODE])&&(re(Q,K,F[e.NODE]),f[e.NODE]=!1),(f[e.DRAG]||F[e.DRAG])&&(re(Z,j,F[e.DRAG]),f[e.DRAG]=!1)}e.prevViewport=x,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),c&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!v,e.mbFrames=0,f[e.NODE]=!0,f[e.DRAG]=!0,e.redraw()},Zy)),a||r.emit("render")};var _a;Pt.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,n=r.data,i=a.style(),o=t.drawOnlyNodeLayer,s=t.drawAllLayers,u=n.canvasNeedsRedraw,l=t.forcedContext;if(r.showFps||!o&&u[r.SELECT_BOX]&&!s){var f=l||n.contexts[r.SELECT_BOX];if(e(f),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var v=r.cy.zoom(),c=i.core("selection-box-border-width").value/v;f.lineWidth=c,f.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",f.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),c>0&&(f.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",f.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(n.bgActivePosistion&&!r.hoverData.selecting){var v=r.cy.zoom(),h=n.bgActivePosistion;f.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",f.beginPath(),f.arc(h.x,h.y,i.core("active-bg-size").pfValue/v,0,2*Math.PI),f.fill()}var d=r.lastRedrawTime;if(r.showFps&&d){d=Math.round(d);var p=Math.round(1e3/d),y="1 frame = "+d+" ms = "+p+" fps";if(f.setTransform(1,0,0,1,0,0),f.fillStyle="rgba(255, 0, 0, 0.75)",f.strokeStyle="rgba(255, 0, 0, 0.75)",f.font="30px Arial",!_a){var g=f.measureText(y);_a=g.actualBoundingBoxAscent}f.fillText(y,0,_a);var b=60;f.strokeRect(0,_a+10,250,20),f.fillRect(0,_a+10,250*Math.min(p/b,1),20)}s||(u[r.SELECT_BOX]=!1)}};function Iv(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(a));return a}function Qy(t,e,r){var a=Iv(t,t.VERTEX_SHADER,e),n=Iv(t,t.FRAGMENT_SHADER,r),i=t.createProgram();if(t.attachShader(i,a),t.attachShader(i,n),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function Jy(t,e,r){r===void 0&&(r=e);var a=t.makeOffscreenCanvas(e,r),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function Ts(t){var e=t.pixelRatio,r=t.cy.zoom(),a=t.cy.pan();return{zoom:r*e,pan:{x:a.x*e,y:a.y*e}}}function jy(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function em(t,e,r,a,n){var i=a*r+e.x,o=n*r+e.y;return o=Math.round(t.canvasHeight-o),[i,o]}function tm(t,e){return e.picking?!0:t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function rm(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function Vr(t,e,r){var a=t[0]/255,n=t[1]/255,i=t[2]/255,o=e,s=r||new Array(4);return s[0]=a*o,s[1]=n*o,s[2]=i*o,s[3]=o,s}function da(t,e){var r=e||new Array(4);return r[0]=(t>>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function am(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function nm(t,e){var r=t.createTexture();return r.buffer=function(a){t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function Bv(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function Fv(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function im(t,e,r,a,n,i){switch(e){case t.FLOAT:return new Float32Array(r.buffer,i*a,n);case t.INT:return new Int32Array(r.buffer,i*a,n)}}function om(t,e,r,a){var n=Bv(t,e),i=vt(n,2),o=i[0],s=i[1],u=Fv(t,s,a),l=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,u,t.STATIC_DRAW),s===t.FLOAT?t.vertexAttribPointer(r,o,s,!1,0,0):s===t.INT&&t.vertexAttribIPointer(r,o,s,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),l}function Qt(t,e,r,a){var n=Bv(t,r),i=vt(n,3),o=i[0],s=i[1],u=i[2],l=Fv(t,s,e*o),f=o*u,v=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,v),t.bufferData(t.ARRAY_BUFFER,e*f,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),s===t.FLOAT?t.vertexAttribPointer(a,o,s,!1,f,0):s===t.INT&&t.vertexAttribIPointer(a,o,s,f,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var c=new Array(e),h=0;h<e;h++)c[h]=im(t,s,l,f,o,h);return v.dataArray=l,v.stride=f,v.size=o,v.getView=function(d){return c[d]},v.setPoint=function(d,p,y){var g=c[d];g[0]=p,g[1]=y},v.bufferSubData=function(d){t.bindBuffer(t.ARRAY_BUFFER,v),d?t.bufferSubData(t.ARRAY_BUFFER,0,l,0,d*o):t.bufferSubData(t.ARRAY_BUFFER,0,l)},v}function sm(t,e,r){for(var a=9,n=new Float32Array(e*a),i=new Array(e),o=0;o<e;o++){var s=o*a*4;i[o]=new Float32Array(n.buffer,s,a)}var u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,n.byteLength,t.DYNAMIC_DRAW);for(var l=0;l<3;l++){var f=r+l;t.enableVertexAttribArray(f),t.vertexAttribPointer(f,3,t.FLOAT,!1,3*12,l*12),t.vertexAttribDivisor(f,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),u.getMatrixView=function(v){return i[v]},u.setData=function(v,c){i[c].set(v,0)},u.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferSubData(t.ARRAY_BUFFER,0,n)},u}function um(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,n){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,a,n,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var kv=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Cs(){var t=new kv(9);return kv!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function zv(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function lm(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],v=e[8],c=r[0],h=r[1],d=r[2],p=r[3],y=r[4],g=r[5],b=r[6],m=r[7],w=r[8];return t[0]=c*a+h*o+d*l,t[1]=c*n+h*s+d*f,t[2]=c*i+h*u+d*v,t[3]=p*a+y*o+g*l,t[4]=p*n+y*s+g*f,t[5]=p*i+y*u+g*v,t[6]=b*a+m*o+w*l,t[7]=b*n+m*s+w*f,t[8]=b*i+m*u+w*v,t}function ri(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],v=e[8],c=r[0],h=r[1];return t[0]=a,t[1]=n,t[2]=i,t[3]=o,t[4]=s,t[5]=u,t[6]=c*a+h*o+l,t[7]=c*n+h*s+f,t[8]=c*i+h*u+v,t}function Vv(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],v=e[8],c=Math.sin(r),h=Math.cos(r);return t[0]=h*a+c*o,t[1]=h*n+c*s,t[2]=h*i+c*u,t[3]=h*o-c*a,t[4]=h*s-c*n,t[5]=h*u-c*i,t[6]=l,t[7]=f,t[8]=v,t}function Ss(t,e,r){var a=r[0],n=r[1];return t[0]=a*e[0],t[1]=a*e[1],t[2]=a*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function fm(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var vm=function(){function t(e,r,a,n){ir(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=n(e,r,r),this.scratch=n(e,r,this.texHeight,"scratch")}return or(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var a=r.w,n=r.h,i=this.texHeight,o=this.texSize,s=i/n,u=a*s,l=n*s;return u>o&&(s=o/a,u=a*s,l=n*s),{scale:s,texW:u,texH:l}}},{key:"draw",value:function(r,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,u=this.texHeight,l=this.getScale(a),f=l.scale,v=l.texW,c=l.texH,h=function(m,w){if(n&&w){var T=w.context,D=m.x,x=m.row,M=D,P=u*x;T.save(),T.translate(M,P),T.scale(f,f),n(T,a),T.restore()}},d=[null,null],p=function(){h(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:v,h:c},d[1]={x:i.freePointer.x+v,y:i.freePointer.row*u,w:0,h:c},i.freePointer.x+=v,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},y=function(){var m=i.scratch,w=i.canvas;m.clear(),h({x:0,row:0},m);var T=o-i.freePointer.x,D=v-T,x=u;{var M=i.freePointer.x,P=i.freePointer.row*u,N=T;w.context.drawImage(m,0,0,N,x,M,P,N,x),d[0]={x:M,y:P,w:N,h:c}}{var O=T,R=(i.freePointer.row+1)*u,I=D;w&&w.context.drawImage(m,O,0,I,x,0,R,I,x),d[1]={x:0,y:R,w:I,h:c}}i.freePointer.x=D,i.freePointer.row++},g=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+v<=o)p();else{if(this.freePointer.row>=s-1)return!1;this.freePointer.x===o?(g(),p()):this.enableWrapping?y():(g(),p())}return this.keyToLocation.set(r,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(r),o=i.texW;return this.freePointer.x+o>a?this.freePointer.row<n-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=nm(r,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),hm=function(){function t(e,r,a,n){ir(this,t),this.r=e,this.texSize=r,this.texRows=a,this.createTextureCanvas=n,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return or(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new vm(r,a,n,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas,o=Math.floor(a/n);this.scratch=i(r,a,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,a,n){var i=this.styleKeyToAtlas.get(r);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(a))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(r,a,n),this.styleKeyToAtlas.set(r,i)),i}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"markKeyForGC",value:function(r){this.markedKeys.add(r)}},{key:"gc",value:function(){var r=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var n=[],i=new Map,o=null,s=Ot(this.atlases),u;try{var l=function(){var v=u.value,c=v.getKeys(),h=cm(a,c);if(h.size===0)return n.push(v),c.forEach(function(T){return i.set(T,v)}),1;o||(o=r._createAtlas(),n.push(o));var d=Ot(c),p;try{for(d.s();!(p=d.n()).done;){var y=p.value;if(!h.has(y)){var g=v.getOffsets(y),b=vt(g,2),m=b[0],w=b[1];o.canFit({w:m.w+w.w,h:m.h})||(o.lock(),o=r._createAtlas(),n.push(o)),v.canvas&&(r._copyTextureToNewAtlas(y,v,o),i.set(y,o))}}}catch(T){d.e(T)}finally{d.f()}v.dispose()};for(s.s();!(u=s.n()).done;)l()}catch(f){s.e(f)}finally{s.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,a,n){var i=a.getOffsets(r),o=vt(i,2),s=o[0],u=o[1];if(u.w===0)n.draw(r,s,function(c){c.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h),l.context.drawImage(a.canvas,u.x,u.y,u.w,u.h,s.w,0,u.w,u.h);var f=s.w+u.w,v=s.h;n.draw(r,{w:f,h:v},function(c){c.drawImage(l,0,0,f,v,0,0,f,v)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function cm(t,e){return t.intersection?t.intersection(e):new Set(an(t).filter(function(r){return e.has(r)}))}var dm=function(){function t(e,r){ir(this,t),this.r=e,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return or(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,a){var n=this.globalOptions,i=n.webglTexSize,o=n.createTextureCanvas,s=a.texRows,u=this._cacheScratchCanvas(o),l=new hm(this.r,i,s,u);this.collections.set(r,l)}},{key:"addRenderType",value:function(r,a){var n=a.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var i=this.collections.get(n),o=Oe({type:r,atlasCollection:i},a);this.renderTypes.set(r,o)}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"getAtlasCollection",value:function(r){return this.collections.get(r)}},{key:"_cacheScratchCanvas",value:function(r){var a=-1,n=-1,i=null;return function(o,s,u,l){return l?((!i||s!=a||u!=n)&&(a=s,n=u,i=r(o,s,u)),i):r(o,s,u)}}},{key:"_key",value:function(r,a){return"".concat(r,"-").concat(a)}},{key:"invalidate",value:function(r){var a=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,o=i===void 0?!1:i,s=n.filterEle,u=s===void 0?function(){return!0}:s,l=n.filterType,f=l===void 0?function(){return!0}:l,v=!1,c=!1,h=Ot(r),d;try{for(h.s();!(d=h.n()).done;){var p=d.value;if(u(p)){var y=Ot(this.renderTypes.values()),g;try{var b=function(){var w=g.value,T=w.type;if(f(T)){var D=a.collections.get(w.collection),x=w.getKey(p),M=Array.isArray(x)?x:[x];if(o)M.forEach(function(R){return D.markKeyForGC(R)}),c=!0;else{var P=w.getID?w.getID(p):p.id(),N=a._key(T,P),O=a.typeAndIdToKey.get(N);O!==void 0&&!rm(M,O)&&(v=!0,a.typeAndIdToKey.delete(N),O.forEach(function(R){return D.markKeyForGC(R)}))}}};for(y.s();!(g=y.n()).done;)b()}catch(m){y.e(m)}finally{y.f()}}}}catch(m){h.e(m)}finally{h.f()}return c&&(this.gc(),v=!1),v}},{key:"gc",value:function(){var r=Ot(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;){var n=a.value;n.gc()}}catch(i){r.e(i)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,n,i){var o=this.renderTypes.get(a),s=this.collections.get(o.collection),u=!1,l=s.draw(i,n,function(c){o.drawClipped?(c.save(),c.beginPath(),c.rect(0,0,n.w,n.h),c.clip(),o.drawElement(c,r,n,!0,!0),c.restore()):o.drawElement(c,r,n,!0,!0),u=!0});if(u){var f=o.getID?o.getID(r):r.id(),v=this._key(a,f);this.typeAndIdToKey.has(v)?this.typeAndIdToKey.get(v).push(i):this.typeAndIdToKey.set(v,[i])}return l}},{key:"getAtlasInfo",value:function(r,a){var n=this,i=this.renderTypes.get(a),o=i.getKey(r),s=Array.isArray(o)?o:[o];return s.map(function(u){var l=i.getBoundingBox(r,u),f=n.getOrCreateAtlas(r,a,l,u),v=f.getOffsets(u),c=vt(v,2),h=c[0],d=c[1];return{atlas:f,tex:h,tex1:h,tex2:d,bb:l}})}},{key:"getDebugInfo",value:function(){var r=[],a=Ot(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=vt(n.value,2),o=i[0],s=i[1],u=s.getCounts(),l=u.keyCount,f=u.atlasCount;r.push({type:o,keyCount:l,atlasCount:f})}}catch(v){a.e(v)}finally{a.f()}return r}}])}(),gm=function(){function t(e){ir(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return or(t,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,a){return a})}},{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(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}}])}(),pm=`
float circleSD(vec2 p, float r) {
return distance(vec2(0), p) - r; // signed distance
}
`,ym=`
float rectangleSD(vec2 p, vec2 b) {
vec2 d = abs(p)-b;
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
}
`,mm=`
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
cr.x = (p.y > 0.0) ? cr.x : cr.y;
vec2 q = abs(p) - b + cr.x;
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
}
`,bm=`
float ellipseSD(vec2 p, vec2 ab) {
p = abs( p ); // symmetry
// find root with Newton solver
vec2 q = ab*(p-ab);
float w = (q.x<q.y)? 1.570796327 : 0.0;
for( int i=0; i<5; i++ ) {
vec2 cs = vec2(cos(w),sin(w));
vec2 u = ab*vec2( cs.x,cs.y);
vec2 v = ab*vec2(-cs.y,cs.x);
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
}
// compute final point and distance
float d = length(p-ab*vec2(cos(w),sin(w)));
// return signed distance
return (dot(p/ab,p/ab)>1.0) ? d : -d;
}
`,Za={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},ai={IGNORE:1,USE_BB:2},As=0,Gv=1,Uv=2,Ds=3,ga=4,ni=5,Qa=6,Ja=7,wm=function(){function t(e,r,a){ir(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=Jy,this.atlasManager=new dm(e,a),this.batchManager=new gm(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Za.SCREEN),this.pickingProgram=this._createShaderProgram(Za.PICKING),this.vao=this._createVAO()}return or(t,[{key:"addAtlasCollection",value:function(r,a){this.atlasManager.addAtlasCollection(r,a)}},{key:"addTextureAtlasRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"addSimpleShapeRenderType",value:function(r,a){this.simpleShapeOptions.set(r,a)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(r,{filterType:function(s){return s===n},forceRedraw:!0}):i.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=this.gl,n=`#version 300 es
precision highp float;
uniform mat3 uPanZoomMatrix;
uniform int uAtlasSize;
// instanced
in vec2 aPosition; // a vertex from the unit square
in mat3 aTransform; // used to transform verticies, eg into a bounding box
in int aVertType; // the type of thing we are rendering
// the z-index that is output when using picking mode
in vec4 aIndex;
// For textures
in int aAtlasId; // which shader unit/atlas to use
in vec4 aTex; // x/y/w/h of texture in atlas
// for edges
in vec4 aPointAPointB;
in vec4 aPointCPointD;
in vec2 aLineWidth; // also used for node border width
// simple shapes
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
in vec4 aColor; // also used for edges
in vec4 aBorderColor; // aLineWidth is used for border width
// output values passed to the fragment shader
out vec2 vTexCoord;
out vec4 vColor;
out vec2 vPosition;
// flat values are not interpolated
flat out int vAtlasId;
flat out int vVertType;
flat out vec2 vTopRight;
flat out vec2 vBotLeft;
flat out vec4 vCornerRadius;
flat out vec4 vBorderColor;
flat out vec2 vBorderWidth;
flat out vec4 vIndex;
void main(void) {
int vid = gl_VertexID;
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
if(aVertType == `.concat(As,`) {
float texX = aTex.x; // texture coordinates
float texY = aTex.y;
float texW = aTex.z;
float texH = aTex.w;
if(vid == 1 || vid == 2 || vid == 4) {
texX += texW;
}
if(vid == 2 || vid == 4 || vid == 5) {
texY += texH;
}
float d = float(uAtlasSize);
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
}
else if(aVertType == `).concat(ga," || aVertType == ").concat(Ja,`
|| aVertType == `).concat(ni," || aVertType == ").concat(Qa,`) { // simple shapes
// the bounding box is needed by the fragment shader
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
// calculations are done in the fragment shader, just pass these along
vColor = aColor;
vCornerRadius = aCornerRadius;
vBorderColor = aBorderColor;
vBorderWidth = aLineWidth;
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
}
else if(aVertType == `).concat(Gv,`) {
vec2 source = aPointAPointB.xy;
vec2 target = aPointAPointB.zw;
// adjust the geometry so that the line is centered on the edge
position.y = position.y - 0.5;
// stretch the unit square into a long skinny rectangle
vec2 xBasis = target - source;
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
vColor = aColor;
}
else if(aVertType == `).concat(Uv,`) {
vec2 pointA = aPointAPointB.xy;
vec2 pointB = aPointAPointB.zw;
vec2 pointC = aPointCPointD.xy;
vec2 pointD = aPointCPointD.zw;
// adjust the geometry so that the line is centered on the edge
position.y = position.y - 0.5;
vec2 p0, p1, p2, pos;
if(position.x == 0.0) { // The left side of the unit square
p0 = pointA;
p1 = pointB;
p2 = pointC;
pos = position;
} else { // The right side of the unit square, use same approach but flip the geometry upside down
p0 = pointD;
p1 = pointC;
p2 = pointB;
pos = vec2(0.0, -position.y);
}
vec2 p01 = p1 - p0;
vec2 p12 = p2 - p1;
vec2 p21 = p1 - p2;
// Find the normal vector.
vec2 tangent = normalize(normalize(p12) + normalize(p01));
vec2 normal = vec2(-tangent.y, tangent.x);
// Find the vector perpendicular to p0 -> p1.
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
// Determine the bend direction.
float sigma = sign(dot(p01 + p21, normal));
float width = aLineWidth[0];
if(sign(pos.y) == -sigma) {
// This is an intersecting vertex. Adjust the position so that there's no overlap.
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
} else {
// This is a non-intersecting vertex. Treat it like a mitre join.
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
}
vColor = aColor;
}
else if(aVertType == `).concat(Ds,` && vid < 3) {
// massage the first triangle into an edge arrow
if(vid == 0)
position = vec2(-0.15, -0.3);
if(vid == 1)
position = vec2( 0.0, 0.0);
if(vid == 2)
position = vec2( 0.15, -0.3);
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
vColor = aColor;
}
else {
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
}
vAtlasId = aAtlasId;
vVertType = aVertType;
vIndex = aIndex;
}
`),i=this.batchManager.getIndexArray(),o=`#version 300 es
precision highp float;
// declare texture unit for each texture atlas in the batch
`.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
`),`
uniform vec4 uBGColor;
uniform float uZoom;
in vec2 vTexCoord;
in vec4 vColor;
in vec2 vPosition; // model coordinates
flat in int vAtlasId;
flat in vec4 vIndex;
flat in int vVertType;
flat in vec2 vTopRight;
flat in vec2 vBotLeft;
flat in vec4 vCornerRadius;
flat in vec4 vBorderColor;
flat in vec2 vBorderWidth;
out vec4 outColor;
`).concat(pm,`
`).concat(ym,`
`).concat(mm,`
`).concat(bm,`
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
return vec4(
top.rgb + (bot.rgb * (1.0 - top.a)),
top.a + (bot.a * (1.0 - top.a))
);
}
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
// scale to the zoom level so that borders don't look blurry when zoomed in
// note 1.5 is an aribitrary value chosen because it looks good
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
}
void main(void) {
if(vVertType == `).concat(As,`) {
// look up the texel from the texture unit
`).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
else `),`
}
else if(vVertType == `).concat(Ds,`) {
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
outColor = blend(vColor, uBGColor);
outColor.a = 1.0; // make opaque, masks out line under arrow
}
else if(vVertType == `).concat(ga,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
}
else if(vVertType == `).concat(ga," || vVertType == ").concat(Ja,`
|| vVertType == `).concat(ni," || vVertType == ").concat(Qa,`) { // use SDF
float outerBorder = vBorderWidth[0];
float innerBorder = vBorderWidth[1];
float borderPadding = outerBorder * 2.0;
float w = vTopRight.x - vBotLeft.x - borderPadding;
float h = vTopRight.y - vBotLeft.y - borderPadding;
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
float d; // signed distance
if(vVertType == `).concat(ga,`) {
d = rectangleSD(p, b);
} else if(vVertType == `).concat(Ja,` && w == h) {
d = circleSD(p, b.x); // faster than ellipse
} else if(vVertType == `).concat(Ja,`) {
d = ellipseSD(p, b);
} else {
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
}
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
if(d > 0.0) {
if(d > outerBorder) {
discard;
} else {
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
}
} else {
if(d > innerBorder) {
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
vec4 innerBorderColor = blend(vBorderColor, vColor);
outColor = distInterp(innerBorderColor, outerColor, d);
}
else {
vec4 outerColor;
if(innerBorder == 0.0 && outerBorder == 0.0) {
outerColor = vec4(0);
} else if(innerBorder == 0.0) {
outerColor = vBorderColor;
} else {
outerColor = blend(vBorderColor, vColor);
}
outColor = distInterp(vColor, outerColor, d - innerBorder);
}
}
}
else {
outColor = vColor;
}
`).concat(r.picking?`if(outColor.a == 0.0) discard;
else outColor = vIndex;`:"",`
}
`),s=Qy(a,n,o);s.aPosition=a.getAttribLocation(s,"aPosition"),s.aIndex=a.getAttribLocation(s,"aIndex"),s.aVertType=a.getAttribLocation(s,"aVertType"),s.aTransform=a.getAttribLocation(s,"aTransform"),s.aAtlasId=a.getAttribLocation(s,"aAtlasId"),s.aTex=a.getAttribLocation(s,"aTex"),s.aPointAPointB=a.getAttribLocation(s,"aPointAPointB"),s.aPointCPointD=a.getAttribLocation(s,"aPointCPointD"),s.aLineWidth=a.getAttribLocation(s,"aLineWidth"),s.aColor=a.getAttribLocation(s,"aColor"),s.aCornerRadius=a.getAttribLocation(s,"aCornerRadius"),s.aBorderColor=a.getAttribLocation(s,"aBorderColor"),s.uPanZoomMatrix=a.getUniformLocation(s,"uPanZoomMatrix"),s.uAtlasSize=a.getUniformLocation(s,"uAtlasSize"),s.uBGColor=a.getUniformLocation(s,"uBGColor"),s.uZoom=a.getUniformLocation(s,"uZoom"),s.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)s.uTextures.push(a.getUniformLocation(s,"uTexture".concat(u)));return s}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var a=this.maxInstances,n=this.gl,i=this.program,o=n.createVertexArray();return n.bindVertexArray(o),om(n,"vec2",i.aPosition,r),this.transformBuffer=sm(n,a,i.aTransform),this.indexBuffer=Qt(n,a,"vec4",i.aIndex),this.vertTypeBuffer=Qt(n,a,"int",i.aVertType),this.atlasIdBuffer=Qt(n,a,"int",i.aAtlasId),this.texBuffer=Qt(n,a,"vec4",i.aTex),this.pointAPointBBuffer=Qt(n,a,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Qt(n,a,"vec4",i.aPointCPointD),this.lineWidthBuffer=Qt(n,a,"vec2",i.aLineWidth),this.colorBuffer=Qt(n,a,"vec4",i.aColor),this.cornerRadiusBuffer=Qt(n,a,"vec4",i.aCornerRadius),this.borderColorBuffer=Qt(n,a,"vec4",i.aBorderColor),n.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return ur(a,"Buffer")}).map(function(a){return r[a]})),this._buffers}},{key:"startFrame",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Za.SCREEN;this.panZoomMatrix=r,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,a){return r.visible()?a&&a.isVisible?a.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,a,n){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(n);if(this._isVisible(r,s)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(r);if(u===ai.IGNORE)return;if(u==ai.USE_BB){this.drawPickingRectangle(r,a,n);return}}var l=i.getAtlasInfo(r,n),f=Ot(l),v;try{for(f.s();!(v=f.n()).done;){var c=v.value,h=c.atlas,d=c.tex1,p=c.tex2;o.canAddToCurrentBatch(h)||this.endBatch();for(var y=o.getAtlasIndexForBatch(h),g=0,b=[[d,!0],[p,!1]];g<b.length;g++){var m=vt(b[g],2),w=m[0],T=m[1];if(w.w!=0){var D=this.instanceCount;this.vertTypeBuffer.getView(D)[0]=As;var x=this.indexBuffer.getView(D);da(a,x);var M=this.atlasIdBuffer.getView(D);M[0]=y;var P=this.texBuffer.getView(D);P[0]=w.x,P[1]=w.y,P[2]=w.w,P[3]=w.h;var N=this.transformBuffer.getMatrixView(D);this.setTransformMatrix(r,N,s,c,T),this.instanceCount++,T||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(O){f.e(O)}finally{f.f()}}}},{key:"setTransformMatrix",value:function(r,a,n,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;if(n.shapeProps&&n.shapeProps.padding&&(s=r.pstyle(n.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,f=i.tex2,v=l.w/(l.w+f.w);o||(v=1-v);var c=this._getAdjustedBB(u,s,o,v);this._applyTransformMatrix(a,c,n,r)}else{var h=n.getBoundingBox(r),d=this._getAdjustedBB(h,s,!0,1);this._applyTransformMatrix(a,d,n,r)}}},{key:"_applyTransformMatrix",value:function(r,a,n,i){var o,s;zv(r);var u=n.getRotation?n.getRotation(i):0;if(u!==0){var l=n.getRotationPoint(i),f=l.x,v=l.y;ri(r,r,[f,v]),Vv(r,r,u);var c=n.getRotationOffset(i);o=c.x+(a.xOffset||0),s=c.y+(a.yOffset||0)}else o=a.x1,s=a.y1;ri(r,r,[o,s]),Ss(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,n,i){var o=r.x1,s=r.y1,u=r.w,l=r.h,f=r.yOffset;a&&(o-=a,s-=a,u+=2*a,l+=2*a);var v=0,c=u*i;return n&&i<1?u=c:!n&&i<1&&(v=u-c,o+=v,u=c),{x1:o,y1:s,w:u,h:l,xOffset:v,yOffset:f}}},{key:"drawPickingRectangle",value:function(r,a,n){var i=this.atlasManager.getRenderTypeOpts(n),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=ga;var s=this.indexBuffer.getView(o);da(a,s);var u=this.colorBuffer.getView(o);Vr([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(r,i)){var o=i.shapeProps,s=this._getVertTypeForShape(r,o.shape);if(s===void 0||i.isSimple&&!i.isSimple(r,this.renderTarget)){this.drawTexture(r,a,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=s,s===ni||s===Qa){var l=i.getBoundingBox(r),f=this._getCornerRadius(r,o.radius,l),v=this.cornerRadiusBuffer.getView(u);v[0]=f,v[1]=f,v[2]=f,v[3]=f,s===Qa&&(v[0]=0,v[2]=0)}var c=this.indexBuffer.getView(u);da(a,c);var h=this.renderTarget.picking?1:n==="node-body"?r.effectiveOpacity():1,d=this.renderTarget.picking?1:r.pstyle(o.opacity).value*h,p=r.pstyle(o.color).value,y=this.colorBuffer.getView(u);Vr(p,d,y);var g=this.lineWidthBuffer.getView(u);if(g[0]=0,g[1]=0,o.border){var b=r.pstyle("border-width").value;if(b>0){var m=r.pstyle("border-color").value,w=h*r.pstyle("border-opacity").value,T=this.borderColorBuffer.getView(u);Vr(m,w,T);var D=r.pstyle("border-position").value;if(D==="inside")g[0]=0,g[1]=-b;else if(D==="outside")g[0]=b,g[1]=0;else{var x=b/2;g[0]=x,g[1]=-x}}}var M=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(r,M,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,a){var n=r.pstyle(a).value;switch(n){case"rectangle":return ga;case"ellipse":return Ja;case"roundrectangle":case"round-rectangle":return ni;case"bottom-round-rectangle":return Qa;default:return}}},{key:"_getCornerRadius",value:function(r,a,n){var i=n.w,o=n.h;if(r.pstyle(a).value==="auto")return cr(i,o);var s=r.pstyle(a).pfValue,u=i/2,l=o/2;return Math.min(s,l,u)}},{key:"drawEdgeArrow",value:function(r,a,n){if(r.visible()){var i=r._private.rscratch,o,s,u;if(n==="source"?(o=i.arrowStartX,s=i.arrowStartY,u=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(u)||u==null)){var l=r.pstyle(n+"-arrow-shape").value;if(l!=="none"){var f=r.pstyle(n+"-arrow-color").value,v=r.pstyle("opacity").value,c=r.pstyle("line-opacity").value,h=v*c,d=r.pstyle("width").pfValue,p=r.pstyle("arrow-scale").value,y=this.r.getArrowWidth(d,p),g=this.instanceCount,b=this.transformBuffer.getMatrixView(g);zv(b),ri(b,b,[o,s]),Ss(b,b,[y,y]),Vv(b,b,u),this.vertTypeBuffer.getView(g)[0]=Ds;var m=this.indexBuffer.getView(g);da(a,m);var w=this.colorBuffer.getView(g);Vr(f,h,w),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,a){if(r.visible()){var n=this._getEdgePoints(r);if(n){var i=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,s=r.pstyle("width").pfValue,u=r.pstyle("line-color").value,l=i*o;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=Gv;var v=this.indexBuffer.getView(f);da(a,v);var c=this.colorBuffer.getView(f);Vr(u,l,c);var h=this.lineWidthBuffer.getView(f);h[0]=s;var d=this.pointAPointBBuffer.getView(f);d[0]=n[0],d[1]=n[1],d[2]=n[2],d[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var p=0;p<n.length-2;p+=2){var y=this.instanceCount;this.vertTypeBuffer.getView(y)[0]=Uv;var g=this.indexBuffer.getView(y);da(a,g);var b=this.colorBuffer.getView(y);Vr(u,l,b);var m=this.lineWidthBuffer.getView(y);m[0]=s;var w=n[p-2],T=n[p-1],D=n[p],x=n[p+1],M=n[p+2],P=n[p+3],N=n[p+4],O=n[p+5];p==0&&(w=2*D-M+.001,T=2*x-P+.001),p==n.length-4&&(N=2*M-D+.001,O=2*P-x+.001);var R=this.pointAPointBBuffer.getView(y);R[0]=w,R[1]=T,R[2]=D,R[3]=x;var I=this.pointCPointDBuffer.getView(y);I[0]=M,I[1]=P,I[2]=N,I[3]=O,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var a=r._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var a=r._private.rscratch;if(this._isValidEdge(r)){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(r);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(r){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,a){if(r.length==4)return r;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=r[0],n[1]=r[1];else if(i==a)n[i*2]=r[r.length-2],n[i*2+1]=r[r.length-1];else{var o=i/a;this._setCurvePoint(r,o,n,i*2)}return n}},{key:"_setCurvePoint",value:function(r,a,n,i){if(r.length<=2)n[i]=r[0],n[i+1]=r[1];else{for(var o=Array(r.length-2),s=0;s<o.length;s+=2){var u=(1-a)*r[s]+a*r[s+2],l=(1-a)*r[s+1]+a*r[s+3];o[s]=u,o[s+1]=l}return this._setCurvePoint(o,a,n,i)}}},{key:"endBatch",value:function(){var r=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(o),r.bindVertexArray(a);var s=Ot(this.buffers),u;try{for(s.s();!(u=s.n()).done;){var l=u.value;l.bufferSubData(i)}}catch(d){s.e(d)}finally{s.f()}for(var f=this.batchManager.getAtlases(),v=0;v<f.length;v++)f[v].bufferIfNeeded(r);for(var c=0;c<f.length;c++)r.activeTexture(r.TEXTURE0+c),r.bindTexture(r.TEXTURE_2D,f[c].texture),r.uniform1i(o.uTextures[c],c);r.uniform1f(o.uZoom,jy(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var h=Vr(this.bgColor,1);r.uniform4fv(o.uBGColor,h),r.drawArraysInstanced(r.TRIANGLES,0,n,i),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:f.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),a=r.reduce(function(o,s){return o+s.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(o,s){return o+s.count},0);return{atlasInfo:r,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:i}}}])}(),Hv={};Hv.initWebgl=function(t,e){var r=this,a=r.data.contexts[r.WEBGL];t.bgColor=Em(r),t.webglTexSize=Math.min(t.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=um(a),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new wm(r,a,t);var n=function(v){return function(c){return r.getTextAngle(c,v)}},i=function(v){return function(c){var h=c.pstyle(v);return h&&h.value}},o=function(v){return function(c){return c.pstyle("".concat(v,"-opacity")).value>0}},s=function(v){var c=v.pstyle("text-events").strValue==="yes";return c?ai.USE_BB:ai.IGNORE},u=function(v){var c=v.position(),h=c.x,d=c.y,p=v.outerWidth(),y=v.outerHeight();return{w:p,h:y,x1:h-p/2,y1:d-y/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:tm,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:Ls(e.getLabelKey,null),getBoundingBox:Ms(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:Ls(e.getSourceLabelKey,"source"),getBoundingBox:Ms(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:Ls(e.getTargetLabelKey,"target"),getBoundingBox:Ms(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=Ca(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(f,v){var c=!1;v&&v.length>0&&(c|=r.drawing.invalidate(v)),c&&l()}),xm(r)};function Em(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return Ys(r)}function qv(t,e){var r=t._private.rscratch;return Mt(r,"labelWrapCachedLines",e)||[]}var Ls=function(e,r){return function(a){var n=e(a),i=qv(a,r);return i.length>1?i.map(function(o,s){return"".concat(n,"_").concat(s)}):n}},Ms=function(e,r){return function(a,n){var i=e(a);if(typeof n=="string"){var o=n.indexOf("_");if(o>0){var s=Number(n.substring(o+1)),u=qv(a,r),l=i.h/u.length,f=l*s,v=i.y1+f;return{x1:i.x1,w:i.w,y1:v,h:l,yOffset:f}}}return i}};function xm(t){{var e=t.render;t.render=function(i){i=i||{};var o=t.cy;t.webgl&&(o.zoom()>Tv?(Tm(t),e.call(t,i)):(Cm(t),Wv(t,i,Za.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(i){r.call(t,i),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(i,o,s,u){return Rm(t,i,o)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var n=t.notify;t.notify=function(i,o){n.call(t,i,o),i==="viewport"||i==="bounds"?t.pickingFrameBuffer.needsDraw=!0:i==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}}function Tm(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function Cm(t){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.canvasWidth,t.canvasHeight),a.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function Sm(t){var e=t.canvasWidth,r=t.canvasHeight,a=Ts(t),n=a.pan,i=a.zoom,o=Cs();ri(o,o,[n.x,n.y]),Ss(o,o,[i,i]);var s=Cs();fm(s,e,r);var u=Cs();return lm(u,s,o),u}function Yv(t,e){var r=t.canvasWidth,a=t.canvasHeight,n=Ts(t),i=n.pan,o=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(i.x,i.y),e.scale(o,o)}function Am(t,e){t.drawSelectionRectangle(e,function(r){return Yv(t,r)})}function Dm(t){var e=t.data.contexts[t.NODE];e.save(),Yv(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function Lm(t){var e=function(n,i,o){for(var s=n.atlasManager.getAtlasCollection(i),u=t.data.contexts[t.NODE],l=s.atlases,f=0;f<l.length;f++){var v=l[f],c=v.canvas;if(c){var h=c.width,d=c.height,p=h*f,y=c.height*o,g=.4;u.save(),u.scale(g,g),u.drawImage(c,p,y),u.strokeStyle="black",u.rect(p,y,h,d),u.stroke(),u.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function Mm(t,e,r,a,n){var i,o,s,u,l=Ts(t),f=l.pan,v=l.zoom;{var c=em(t,f,v,e,r),h=vt(c,2),d=h[0],p=h[1],y=6;i=d-y/2,o=p-y/2,s=y,u=y}if(s===0||u===0)return[];var g=t.data.contexts[t.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),Wv(t,null,Za.PICKING),t.pickingFrameBuffer.needsDraw=!1);var b=s*u,m=new Uint8Array(b*4);g.readPixels(i,o,s,u,g.RGBA,g.UNSIGNED_BYTE,m),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var w=new Set,T=0;T<b;T++){var D=m.slice(T*4,T*4+4),x=am(D)-1;x>=0&&w.add(x)}return w}function Rm(t,e,r){var a=Mm(t,e,r),n=t.getCachedZSortedEles(),i,o,s=Ot(a),u;try{for(s.s();!(u=s.n()).done;){var l=u.value,f=n[l];if(!i&&f.isNode()&&(i=f),!o&&f.isEdge()&&(o=f),i&&o)break}}catch(v){s.e(v)}finally{s.f()}return[i,o].filter(Boolean)}function Rs(t,e,r){var a=t.drawing;e+=1,r.isNode()?(a.drawNode(r,e,"node-underlay"),a.drawNode(r,e,"node-body"),a.drawTexture(r,e,"label"),a.drawNode(r,e,"node-overlay")):(a.drawEdgeLine(r,e),a.drawEdgeArrow(r,e,"source"),a.drawEdgeArrow(r,e,"target"),a.drawTexture(r,e,"label"),a.drawTexture(r,e,"edge-source-label"),a.drawTexture(r,e,"edge-target-label"))}function Wv(t,e,r){var a;t.webglDebug&&(a=performance.now());var n=t.drawing,i=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&Am(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=Sm(t),u=t.getCachedZSortedEles();if(i=u.length,n.startFrame(s,r),r.screen){for(var l=0;l<u.nondrag.length;l++)Rs(t,l,u.nondrag[l]);for(var f=0;f<u.drag.length;f++)Rs(t,f,u.drag[f])}else if(r.picking)for(var v=0;v<u.length;v++)Rs(t,v,u[v]);n.endFrame(),r.screen&&t.webglDebugShowAtlases&&(Dm(t),Lm(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var c=performance.now(),h=!1,d=Math.ceil(c-a),p=n.getDebugInfo(),y=["".concat(i," elements"),"".concat(p.totalInstances," instances"),"".concat(p.batchCount," batches"),"".concat(p.totalAtlases," atlases"),"".concat(p.wrappedCount," wrapped textures"),"".concat(p.simpleCount," simple shapes")].join(", ");if(h)console.log("WebGL (".concat(r.name,") - time ").concat(d,"ms, ").concat(y));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(d,"ms")),console.log("Totals:"),console.log(" ".concat(y)),console.log("Texture Atlases Used:");var g=p.atlasInfo,b=Ot(g),m;try{for(b.s();!(m=b.n()).done;){var w=m.value;console.log(" ".concat(w.type,": ").concat(w.keyCount," keys, ").concat(w.atlasCount," atlases"))}}catch(T){b.e(T)}finally{b.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,n.gc())}var Tr={};Tr.drawPolygonPath=function(t,e,r,a,n,i){var o=a/2,s=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*i[0],r+s*i[1]);for(var u=1;u<i.length/2;u++)t.lineTo(e+o*i[u*2],r+s*i[u*2+1]);t.closePath()},Tr.drawRoundPolygonPath=function(t,e,r,a,n,i,o){o.forEach(function(s){return lv(t,s)}),t.closePath()},Tr.drawRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?cr(a,n):Math.min(i,s,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.arcTo(e+o,r-s,e+o,r,u),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.arcTo(e-o,r-s,e,r-s,u),t.lineTo(e,r-s),t.closePath()},Tr.drawBottomRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?cr(a,n):i;t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.lineTo(e+o,r-s),t.lineTo(e+o,r),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.lineTo(e-o,r-s),t.lineTo(e,r-s),t.closePath()},Tr.drawCutRectanglePath=function(t,e,r,a,n,i,o){var s=a/2,u=n/2,l=o==="auto"?qi():o;t.beginPath&&t.beginPath(),t.moveTo(e-s+l,r-u),t.lineTo(e+s-l,r-u),t.lineTo(e+s,r-u+l),t.lineTo(e+s,r+u-l),t.lineTo(e+s-l,r+u),t.lineTo(e-s+l,r+u),t.lineTo(e-s,r+u-l),t.lineTo(e-s,r-u+l),t.closePath()},Tr.drawBarrelPath=function(t,e,r,a,n){var i=a/2,o=n/2,s=e-i,u=e+i,l=r-o,f=r+o,v=Yi(a,n),c=v.widthOffset,h=v.heightOffset,d=v.ctrlPtOffsetPct*c;t.beginPath&&t.beginPath(),t.moveTo(s,l+h),t.lineTo(s,f-h),t.quadraticCurveTo(s+d,f,s+c,f),t.lineTo(u-c,f),t.quadraticCurveTo(u-d,f,u,f-h),t.lineTo(u,l+h),t.quadraticCurveTo(u-d,l,u-c,l),t.lineTo(s+c,l),t.quadraticCurveTo(s+d,l,s,l+h),t.closePath()};for(var Xv=Math.sin(0),$v=Math.cos(0),Ns={},Ps={},Kv=Math.PI/40,pa=0*Math.PI;pa<2*Math.PI;pa+=Kv)Ns[pa]=Math.sin(pa),Ps[pa]=Math.cos(pa);Tr.drawEllipsePath=function(t,e,r,a,n){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,n/2,0,0,2*Math.PI);else for(var i,o,s=a/2,u=n/2,l=0*Math.PI;l<2*Math.PI;l+=Kv)i=e-s*Ns[l]*Xv+s*Ps[l]*$v,o=r+u*Ps[l]*Xv+u*Ns[l]*$v,l===0?t.moveTo(i,o):t.lineTo(i,o);t.closePath()};var ja={};ja.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]},ja.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),n=this.findContainerClientCoords(),i=t.full?Math.ceil(a.w):n[2],o=t.full?Math.ceil(a.h):n[3],s=be(t.maxWidth)||be(t.maxHeight),u=this.getPixelRatio(),l=1;if(t.scale!==void 0)i*=t.scale,o*=t.scale,l=t.scale;else if(s){var f=1/0,v=1/0;be(t.maxWidth)&&(f=l*t.maxWidth/i),be(t.maxHeight)&&(v=l*t.maxHeight/o),l=Math.min(f,v),i*=l,o*=l}s||(i*=u,o*=u,l*=u);var c=document.createElement("canvas");c.width=i,c.height=o,c.style.width=i+"px",c.style.height=o+"px";var h=c.getContext("2d");if(i>0&&o>0){h.clearRect(0,0,i,o),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)h.translate(-a.x1*l,-a.y1*l),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(a.x1*l,a.y1*l);else{var p=e.pan(),y={x:p.x*l,y:p.y*l};l*=e.zoom(),h.translate(y.x,y.y),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(-y.x,-y.y)}t.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=t.bg,h.rect(0,0,i,o),h.fill())}return c};function Nm(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new Blob([a],{type:e})}function _v(t){var e=t.indexOf(",");return t.substr(e+1)}function Zv(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new jr(function(n,i){try{e.toBlob(function(o){o!=null?n(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){i(o)}});case"blob":return Nm(_v(a()),r);case"base64":return _v(a());case"base64uri":default:return a()}}ja.png=function(t){return Zv(t,this.bufferCanvasImage(t),"image/png")},ja.jpg=function(t){return Zv(t,this.bufferCanvasImage(t),"image/jpeg")};var Qv={};Qv.nodeShapeImpl=function(t,e,r,a,n,i,o,s){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,n,i);case"polygon":return this.drawPolygonPath(e,r,a,n,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,n,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,n,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,n,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,n,i,s);case"barrel":return this.drawBarrelPath(e,r,a,n,i)}};var Pm=Jv,Ge=Jv.prototype;Ge.CANVAS_LAYERS=3,Ge.SELECT_BOX=0,Ge.DRAG=1,Ge.NODE=2,Ge.WEBGL=3,Ge.CANVAS_TYPES=["2d","2d","2d","webgl2"],Ge.BUFFER_COUNT=3,Ge.TEXTURE_BUFFER=0,Ge.MOTIONBLUR_BUFFER_NODE=1,Ge.MOTIONBLUR_BUFFER_DRAG=2;function Jv(t){var e=this,r=e.cy.window(),a=r.document;t.webgl&&(Ge.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(Ge.CANVAS_LAYERS),contexts:new Array(Ge.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Ge.CANVAS_LAYERS),bufferCanvases:new Array(Ge.BUFFER_COUNT),bufferContexts:new Array(Ge.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=t.cy.container();s.appendChild(e.data.canvasContainer),s.style[n]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};xh()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<Ge.CANVAS_LAYERS;l++){var f=e.data.canvases[l]=a.createElement("canvas"),v=Ge.CANVAS_TYPES[l];e.data.contexts[l]=f.getContext(v),e.data.contexts[l]||at("Could not create canvas of type "+v),Object.keys(u).forEach(function(q){f.style[q]=u[q]}),f.style.position="absolute",f.setAttribute("data-id","layer"+l),f.style.zIndex=String(Ge.CANVAS_LAYERS-l),e.data.canvasContainer.appendChild(f),e.data.canvasNeedsRedraw[l]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Ge.NODE].setAttribute("data-id","layer"+Ge.NODE+"-node"),e.data.canvases[Ge.SELECT_BOX].setAttribute("data-id","layer"+Ge.SELECT_BOX+"-selectbox"),e.data.canvases[Ge.DRAG].setAttribute("data-id","layer"+Ge.DRAG+"-drag"),e.data.canvases[Ge.WEBGL]&&e.data.canvases[Ge.WEBGL].setAttribute("data-id","layer"+Ge.WEBGL+"-webgl");for(var l=0;l<Ge.BUFFER_COUNT;l++)e.data.bufferCanvases[l]=a.createElement("canvas"),e.data.bufferContexts[l]=e.data.bufferCanvases[l].getContext("2d"),e.data.bufferCanvases[l].style.position="absolute",e.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),e.data.bufferCanvases[l].style.zIndex=String(-l-1),e.data.bufferCanvases[l].style.visibility="hidden";e.pathsEnabled=!0;var c=Rt(),h=function(U){return{x:(U.x1+U.x2)/2,y:(U.y1+U.y2)/2}},d=function(U){return{x:-U.w/2,y:-U.h/2}},p=function(U){var Y=U[0]._private,X=Y.oldBackgroundTimestamp===Y.backgroundTimestamp;return!X},y=function(U){return U[0]._private.nodeKey},g=function(U){return U[0]._private.labelStyleKey},b=function(U){return U[0]._private.sourceLabelStyleKey},m=function(U){return U[0]._private.targetLabelStyleKey},w=function(U,Y,X,ee,te){return e.drawElement(U,Y,X,!1,!1,te)},T=function(U,Y,X,ee,te){return e.drawElementText(U,Y,X,ee,"main",te)},D=function(U,Y,X,ee,te){return e.drawElementText(U,Y,X,ee,"source",te)},x=function(U,Y,X,ee,te){return e.drawElementText(U,Y,X,ee,"target",te)},M=function(U){return U.boundingBox(),U[0]._private.bodyBounds},P=function(U){return U.boundingBox(),U[0]._private.labelBounds.main||c},N=function(U){return U.boundingBox(),U[0]._private.labelBounds.source||c},O=function(U){return U.boundingBox(),U[0]._private.labelBounds.target||c},R=function(U,Y){return Y},I=function(U){return h(M(U))},E=function(U,Y,X){var ee=U?U+"-":"";return{x:Y.x+X.pstyle(ee+"text-margin-x").pfValue,y:Y.y+X.pstyle(ee+"text-margin-y").pfValue}},A=function(U,Y,X){var ee=U[0]._private.rscratch;return{x:ee[Y],y:ee[X]}},S=function(U){return E("",A(U,"labelX","labelY"),U)},C=function(U){return E("source",A(U,"sourceLabelX","sourceLabelY"),U)},L=function(U){return E("target",A(U,"targetLabelX","targetLabelY"),U)},z=function(U){return d(M(U))},k=function(U){return d(N(U))},F=function(U){return d(O(U))},H=function(U){var Y=P(U),X=d(P(U));if(U.isNode()){switch(aa(U.pstyle("text-halign").value)){case"left":X.x=-Y.w-(Y.leftPad||0);break;case"right":X.x=-(Y.rightPad||0);break}switch(na(U.pstyle("text-valign").value)){case"top":X.y=-Y.h-(Y.topPad||0);break;case"bottom":X.y=-(Y.botPad||0);break}}return X},W=e.data.eleTxrCache=new $a(e,{getKey:y,doesEleInvalidateKey:p,drawElement:w,getBoundingBox:M,getRotationPoint:I,getRotationOffset:z,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),Q=e.data.lblTxrCache=new $a(e,{getKey:g,drawElement:T,getBoundingBox:P,getRotationPoint:S,getRotationOffset:H,isVisible:R}),K=e.data.slbTxrCache=new $a(e,{getKey:b,drawElement:D,getBoundingBox:N,getRotationPoint:C,getRotationOffset:k,isVisible:R}),Z=e.data.tlbTxrCache=new $a(e,{getKey:m,drawElement:x,getBoundingBox:O,getRotationPoint:L,getRotationOffset:F,isVisible:R}),j=e.data.lyrTxrCache=new Av(e);e.onUpdateEleCalcs(function(U,Y){W.invalidateElements(Y),Q.invalidateElements(Y),K.invalidateElements(Y),Z.invalidateElements(Y),j.invalidateElements(Y);for(var X=0;X<Y.length;X++){var ee=Y[X]._private;ee.oldBackgroundTimestamp=ee.backgroundTimestamp}});var re=function(U){for(var Y=0;Y<U.length;Y++)j.enqueueElementRefinement(U[Y].ele)};W.onDequeue(re),Q.onDequeue(re),K.onDequeue(re),Z.onDequeue(re),t.webgl&&e.initWebgl(t,{getStyleKey:y,getLabelKey:g,getSourceLabelKey:b,getTargetLabelKey:m,drawElement:w,drawLabel:T,drawSourceLabel:D,drawTargetLabel:x,getElementBox:M,getLabelBox:P,getSourceLabelBox:N,getTargetLabelBox:O,getElementRotationPoint:I,getElementRotationOffset:z,getLabelRotationPoint:S,getSourceLabelRotationPoint:C,getTargetLabelRotationPoint:L,getLabelRotationOffset:H,getSourceLabelRotationOffset:k,getTargetLabelRotationOffset:F})}Ge.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Ge.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Ge.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Ge.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var Om=typeof Path2D<"u";Ge.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t},Ge.usePaths=function(){return Om&&this.pathsEnabled},Ge.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)},Ge.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled},Ge.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":ct(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),n=a.document;r=n.createElement("canvas"),r.width=t,r.height=e}return r},[Lv,Zt,nr,xs,zr,xr,Pt,Hv,Tr,ja,Qv].forEach(function(t){Oe(Ge,t)});var Im=[{name:"null",impl:ev},{name:"base",impl:wv},{name:"canvas",impl:Pm}],Bm=[{type:"layout",extensions:ny},{type:"renderer",extensions:Im}],jv={},eh={};function th(t,e,r){var a=r,n=function(M){Xe("Can not register `"+e+"` for `"+t+"` since `"+M+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(qa.prototype[e])return n(e);qa.prototype[e]=r}else if(t==="collection"){if(Ct.prototype[e])return n(e);Ct.prototype[e]=r}else if(t==="layout"){for(var i=function(M){this.options=M,r.call(this,M),Ue(this._private)||(this._private={}),this._private.cy=M.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var f=r.prototype.stop;o.stop=function(){var x=this.options;if(x&&x.animate){var M=this.animations;if(M)for(var P=0;P<M.length;P++)M[P].stop()}return f?f.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var v=function(M){return M._private.cy},c={addEventFields:function(M,P){P.layout=M,P.cy=v(M),P.target=M},bubble:function(){return!0},parent:function(M){return v(M)}};Oe(o,{createEmitter:function(){return this._private.emitter=new On(c,this),this},emitter:function(){return this._private.emitter},on:function(M,P){return this.emitter().on(M,P),this},one:function(M,P){return this.emitter().one(M,P),this},once:function(M,P){return this.emitter().one(M,P),this},removeListener:function(M,P){return this.emitter().removeListener(M,P),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(M,P){return this.emitter().emit(M,P),this}}),$e.eventAliasesOn(o),a=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var h=rh("renderer","base"),d=h.prototype,p=r,y=r.prototype,g=function(){h.apply(this,arguments),p.apply(this,arguments)},b=g.prototype;for(var m in d){var w=d[m],T=y[m]!=null;if(T)return n(m);b[m]=w}for(var D in y)b[D]=y[D];d.clientFunctions.forEach(function(x){b[x]=b[x]||function(){at("Renderer does not implement `renderer."+x+"()` on its prototype")}}),a=g}else if(t==="__proto__"||t==="constructor"||t==="prototype")return at(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return Ws({map:jv,keys:[t,e],value:a})}function rh(t,e){return Xs({map:jv,keys:[t,e]})}function Fm(t,e,r,a,n){return Ws({map:eh,keys:[t,e,r,a],value:n})}function km(t,e,r,a){return Xs({map:eh,keys:[t,e,r,a]})}var Os=function(){if(arguments.length===2)return rh.apply(null,arguments);if(arguments.length===3)return th.apply(null,arguments);if(arguments.length===4)return km.apply(null,arguments);if(arguments.length===5)return Fm.apply(null,arguments);at("Invalid extension access syntax")};qa.prototype.extension=Os,Bm.forEach(function(t){t.extensions.forEach(function(e){th(t.type,e.name,e.impl)})});var ii=function(){if(!(this instanceof ii))return new ii;this.length=0},Gr=ii.prototype;Gr.instanceString=function(){return"stylesheet"},Gr.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this},Gr.css=function(t,e){var r=this.length-1;if(Ne(t))this[r].properties.push({name:t,value:e});else if(Ue(t))for(var a=t,n=Object.keys(a),i=0;i<n.length;i++){var o=n[i],s=a[o];if(s!=null){var u=wt.properties[o]||wt.properties[on(o)];if(u!=null){var l=u.name,f=s;this[r].properties.push({name:l,value:f})}}}return this},Gr.style=Gr.css,Gr.generateStyle=function(t){var e=new wt(t);return this.appendToStyle(e)},Gr.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,n=r.properties;t.selector(a);for(var i=0;i<n.length;i++){var o=n[i];t.css(o.name,o.value)}}return t};var zm="3.34.3",Cr=function(e){if(e===void 0&&(e={}),Ue(e))return new qa(e);if(Ne(e))return Os.apply(Os,arguments)};Cr.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Cr),t.apply(null,e),this},Cr.warnings=function(t){return pu(t)},Cr.version=zm,Cr.stylesheet=Cr.Stylesheet=ii;function Vm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var oi={exports:{}},si={exports:{}},ui={exports:{}},Gm=ui.exports,ah;function Um(){return ah||(ah=1,function(t,e){(function(a,n){t.exports=n()})(Gm,function(){return function(r){var a={};function n(i){if(a[i])return a[i].exports;var o=a[i]={i,l:!1,exports:{}};return r[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=r,n.c=a,n.i=function(i){return i},n.d=function(i,o,s){n.o(i,o)||Object.defineProperty(i,o,{configurable:!1,enumerable:!0,get:s})},n.n=function(i){var o=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(o,"a",o),o},n.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},n.p="",n(n.s=28)}([function(r,a,n){function i(){}i.QUALITY=1,i.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,i.DEFAULT_INCREMENTAL=!1,i.DEFAULT_ANIMATION_ON_LAYOUT=!0,i.DEFAULT_ANIMATION_DURING_LAYOUT=!1,i.DEFAULT_ANIMATION_PERIOD=50,i.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,i.DEFAULT_GRAPH_MARGIN=15,i.NODE_DIMENSIONS_INCLUDE_LABELS=!1,i.SIMPLE_NODE_SIZE=40,i.SIMPLE_NODE_HALF_SIZE=i.SIMPLE_NODE_SIZE/2,i.EMPTY_COMPOUND_NODE_SIZE=40,i.MIN_EDGE_LENGTH=1,i.WORLD_BOUNDARY=1e6,i.INITIAL_WORLD_BOUNDARY=i.WORLD_BOUNDARY/1e3,i.WORLD_CENTER_X=1200,i.WORLD_CENTER_Y=900,r.exports=i},function(r,a,n){var i=n(2),o=n(8),s=n(9);function u(f,v,c){i.call(this,c),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=c,this.bendpoints=[],this.source=f,this.target=v}u.prototype=Object.create(i.prototype);for(var l in i)u[l]=i[l];u.prototype.getSource=function(){return this.source},u.prototype.getTarget=function(){return this.target},u.prototype.isInterGraph=function(){return this.isInterGraph},u.prototype.getLength=function(){return this.length},u.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},u.prototype.getBendpoints=function(){return this.bendpoints},u.prototype.getLca=function(){return this.lca},u.prototype.getSourceInLca=function(){return this.sourceInLca},u.prototype.getTargetInLca=function(){return this.targetInLca},u.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},u.prototype.getOtherEndInGraph=function(f,v){for(var c=this.getOtherEnd(f),h=v.getGraphManager().getRoot();;){if(c.getOwner()==v)return c;if(c.getOwner()==h)break;c=c.getOwner().getParent()}return null},u.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=o.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=s.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=s.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},u.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=s.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=s.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},r.exports=u},function(r,a,n){function i(o){this.vGraphObject=o}r.exports=i},function(r,a,n){var i=n(2),o=n(10),s=n(13),u=n(0),l=n(16),f=n(5);function v(h,d,p,y){p==null&&y==null&&(y=d),i.call(this,y),h.graphManager!=null&&(h=h.graphManager),this.estimatedSize=o.MIN_VALUE,this.inclusionTreeDepth=o.MAX_VALUE,this.vGraphObject=y,this.edges=[],this.graphManager=h,p!=null&&d!=null?this.rect=new s(d.x,d.y,p.width,p.height):this.rect=new s}v.prototype=Object.create(i.prototype);for(var c in i)v[c]=i[c];v.prototype.getEdges=function(){return this.edges},v.prototype.getChild=function(){return this.child},v.prototype.getOwner=function(){return this.owner},v.prototype.getWidth=function(){return this.rect.width},v.prototype.setWidth=function(h){this.rect.width=h},v.prototype.getHeight=function(){return this.rect.height},v.prototype.setHeight=function(h){this.rect.height=h},v.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},v.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},v.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},v.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},v.prototype.getRect=function(){return this.rect},v.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},v.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},v.prototype.setRect=function(h,d){this.rect.x=h.x,this.rect.y=h.y,this.rect.width=d.width,this.rect.height=d.height},v.prototype.setCenter=function(h,d){this.rect.x=h-this.rect.width/2,this.rect.y=d-this.rect.height/2},v.prototype.setLocation=function(h,d){this.rect.x=h,this.rect.y=d},v.prototype.moveBy=function(h,d){this.rect.x+=h,this.rect.y+=d},v.prototype.getEdgeListToNode=function(h){var d=[],p=this;return p.edges.forEach(function(y){if(y.target==h){if(y.source!=p)throw"Incorrect edge source!";d.push(y)}}),d},v.prototype.getEdgesBetween=function(h){var d=[],p=this;return p.edges.forEach(function(y){if(!(y.source==p||y.target==p))throw"Incorrect edge source and/or target";(y.target==h||y.source==h)&&d.push(y)}),d},v.prototype.getNeighborsList=function(){var h=new Set,d=this;return d.edges.forEach(function(p){if(p.source==d)h.add(p.target);else{if(p.target!=d)throw"Incorrect incidency!";h.add(p.source)}}),h},v.prototype.withChildren=function(){var h=new Set,d,p;if(h.add(this),this.child!=null)for(var y=this.child.getNodes(),g=0;g<y.length;g++)d=y[g],p=d.withChildren(),p.forEach(function(b){h.add(b)});return h},v.prototype.getNoOfChildren=function(){var h=0,d;if(this.child==null)h=1;else for(var p=this.child.getNodes(),y=0;y<p.length;y++)d=p[y],h+=d.getNoOfChildren();return h==0&&(h=1),h},v.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},v.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},v.prototype.scatter=function(){var h,d,p=-u.INITIAL_WORLD_BOUNDARY,y=u.INITIAL_WORLD_BOUNDARY;h=u.WORLD_CENTER_X+l.nextDouble()*(y-p)+p;var g=-u.INITIAL_WORLD_BOUNDARY,b=u.INITIAL_WORLD_BOUNDARY;d=u.WORLD_CENTER_Y+l.nextDouble()*(b-g)+g,this.rect.x=h,this.rect.y=d},v.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var h=this.getChild();if(h.updateBounds(!0),this.rect.x=h.getLeft(),this.rect.y=h.getTop(),this.setWidth(h.getRight()-h.getLeft()),this.setHeight(h.getBottom()-h.getTop()),u.NODE_DIMENSIONS_INCLUDE_LABELS){var d=h.getRight()-h.getLeft(),p=h.getBottom()-h.getTop();this.labelWidth&&(this.labelPosHorizontal=="left"?(this.rect.x-=this.labelWidth,this.setWidth(d+this.labelWidth)):this.labelPosHorizontal=="center"&&this.labelWidth>d?(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(d+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(p+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>p?(this.rect.y-=(this.labelHeight-p)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(p+this.labelHeight))}}},v.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},v.prototype.transform=function(h){var d=this.rect.x;d>u.WORLD_BOUNDARY?d=u.WORLD_BOUNDARY:d<-u.WORLD_BOUNDARY&&(d=-u.WORLD_BOUNDARY);var p=this.rect.y;p>u.WORLD_BOUNDARY?p=u.WORLD_BOUNDARY:p<-u.WORLD_BOUNDARY&&(p=-u.WORLD_BOUNDARY);var y=new f(d,p),g=h.inverseTransformPoint(y);this.setLocation(g.x,g.y)},v.prototype.getLeft=function(){return this.rect.x},v.prototype.getRight=function(){return this.rect.x+this.rect.width},v.prototype.getTop=function(){return this.rect.y},v.prototype.getBottom=function(){return this.rect.y+this.rect.height},v.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=v},function(r,a,n){var i=n(0);function o(){}for(var s in i)o[s]=i[s];o.MAX_ITERATIONS=2500,o.DEFAULT_EDGE_LENGTH=50,o.DEFAULT_SPRING_STRENGTH=.45,o.DEFAULT_REPULSION_STRENGTH=4500,o.DEFAULT_GRAVITY_STRENGTH=.4,o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,o.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,o.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,o.COOLING_ADAPTATION_FACTOR=.33,o.ADAPTATION_LOWER_NODE_LIMIT=1e3,o.ADAPTATION_UPPER_NODE_LIMIT=5e3,o.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,o.MAX_NODE_DISPLACEMENT=o.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,o.MIN_REPULSION_DIST=o.DEFAULT_EDGE_LENGTH/10,o.CONVERGENCE_CHECK_PERIOD=100,o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,o.MIN_EDGE_LENGTH=1,o.GRID_CALCULATION_CHECK_PERIOD=10,r.exports=o},function(r,a,n){function i(o,s){o==null&&s==null?(this.x=0,this.y=0):(this.x=o,this.y=s)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.setX=function(o){this.x=o},i.prototype.setY=function(o){this.y=o},i.prototype.getDifference=function(o){return new DimensionD(this.x-o.x,this.y-o.y)},i.prototype.getCopy=function(){return new i(this.x,this.y)},i.prototype.translate=function(o){return this.x+=o.width,this.y+=o.height,this},r.exports=i},function(r,a,n){var i=n(2),o=n(10),s=n(0),u=n(7),l=n(3),f=n(1),v=n(13),c=n(12),h=n(11);function d(y,g,b){i.call(this,b),this.estimatedSize=o.MIN_VALUE,this.margin=s.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=y,g!=null&&g instanceof u?this.graphManager=g:g!=null&&g instanceof Layout&&(this.graphManager=g.graphManager)}d.prototype=Object.create(i.prototype);for(var p in i)d[p]=i[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(y,g,b){if(g==null&&b==null){var m=y;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(m)>-1)throw"Node already in graph!";return m.owner=this,this.getNodes().push(m),m}else{var w=y;if(!(this.getNodes().indexOf(g)>-1&&this.getNodes().indexOf(b)>-1))throw"Source or target not in graph!";if(!(g.owner==b.owner&&g.owner==this))throw"Both owners must be this graph!";return g.owner!=b.owner?null:(w.source=g,w.target=b,w.isInterGraph=!1,this.getEdges().push(w),g.edges.push(w),b!=g&&b.edges.push(w),w)}},d.prototype.remove=function(y){var g=y;if(y instanceof l){if(g==null)throw"Node is null!";if(!(g.owner!=null&&g.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var b=g.edges.slice(),m,w=b.length,T=0;T<w;T++)m=b[T],m.isInterGraph?this.graphManager.remove(m):m.source.owner.remove(m);var D=this.nodes.indexOf(g);if(D==-1)throw"Node not in owner node list!";this.nodes.splice(D,1)}else if(y instanceof f){var m=y;if(m==null)throw"Edge is null!";if(!(m.source!=null&&m.target!=null))throw"Source and/or target is null!";if(!(m.source.owner!=null&&m.target.owner!=null&&m.source.owner==this&&m.target.owner==this))throw"Source and/or target owner is invalid!";var x=m.source.edges.indexOf(m),M=m.target.edges.indexOf(m);if(!(x>-1&&M>-1))throw"Source and/or target doesn't know this edge!";m.source.edges.splice(x,1),m.target!=m.source&&m.target.edges.splice(M,1);var D=m.source.owner.getEdges().indexOf(m);if(D==-1)throw"Not in owner's edge list!";m.source.owner.getEdges().splice(D,1)}},d.prototype.updateLeftTop=function(){for(var y=o.MAX_VALUE,g=o.MAX_VALUE,b,m,w,T=this.getNodes(),D=T.length,x=0;x<D;x++){var M=T[x];b=M.getTop(),m=M.getLeft(),y>b&&(y=b),g>m&&(g=m)}return y==o.MAX_VALUE?null:(T[0].getParent().paddingLeft!=null?w=T[0].getParent().paddingLeft:w=this.margin,this.left=g-w,this.top=y-w,new c(this.left,this.top))},d.prototype.updateBounds=function(y){for(var g=o.MAX_VALUE,b=-o.MAX_VALUE,m=o.MAX_VALUE,w=-o.MAX_VALUE,T,D,x,M,P,N=this.nodes,O=N.length,R=0;R<O;R++){var I=N[R];y&&I.child!=null&&I.updateBounds(),T=I.getLeft(),D=I.getRight(),x=I.getTop(),M=I.getBottom(),g>T&&(g=T),b<D&&(b=D),m>x&&(m=x),w<M&&(w=M)}var E=new v(g,m,b-g,w-m);g==o.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),N[0].getParent().paddingLeft!=null?P=N[0].getParent().paddingLeft:P=this.margin,this.left=E.x-P,this.right=E.x+E.width+P,this.top=E.y-P,this.bottom=E.y+E.height+P},d.calculateBounds=function(y){for(var g=o.MAX_VALUE,b=-o.MAX_VALUE,m=o.MAX_VALUE,w=-o.MAX_VALUE,T,D,x,M,P=y.length,N=0;N<P;N++){var O=y[N];T=O.getLeft(),D=O.getRight(),x=O.getTop(),M=O.getBottom(),g>T&&(g=T),b<D&&(b=D),m>x&&(m=x),w<M&&(w=M)}var R=new v(g,m,b-g,w-m);return R},d.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){for(var y=0,g=this.nodes,b=g.length,m=0;m<b;m++){var w=g[m];y+=w.calcEstimatedSize()}return y==0?this.estimatedSize=s.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=y/Math.sqrt(this.nodes.length),this.estimatedSize},d.prototype.updateConnected=function(){var y=this;if(this.nodes.length==0){this.isConnected=!0;return}var g=new h,b=new Set,m=this.nodes[0],w,T,D=m.withChildren();for(D.forEach(function(R){g.push(R),b.add(R)});g.length!==0;){m=g.shift(),w=m.getEdges();for(var x=w.length,M=0;M<x;M++){var P=w[M];if(T=P.getOtherEndInGraph(m,this),T!=null&&!b.has(T)){var N=T.withChildren();N.forEach(function(R){g.push(R),b.add(R)})}}}if(this.isConnected=!1,b.size>=this.nodes.length){var O=0;b.forEach(function(R){R.owner==y&&O++}),O==this.nodes.length&&(this.isConnected=!0)}},r.exports=d},function(r,a,n){var i,o=n(1);function s(u){i=n(6),this.layout=u,this.graphs=[],this.edges=[]}s.prototype.addRoot=function(){var u=this.layout.newGraph(),l=this.layout.newNode(null),f=this.add(u,l);return this.setRootGraph(f),this.rootGraph},s.prototype.add=function(u,l,f,v,c){if(f==null&&v==null&&c==null){if(u==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(u)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(u),u.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return u.parent=l,l.child=u,u}else{c=f,v=l,f=u;var h=v.getOwner(),d=c.getOwner();if(!(h!=null&&h.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(h==d)return f.isInterGraph=!1,h.add(f,v,c);if(f.isInterGraph=!0,f.source=v,f.target=c,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},s.prototype.remove=function(u){if(u instanceof i){var l=u;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(l.getEdges());for(var v,c=f.length,h=0;h<c;h++)v=f[h],l.remove(v);var d=[];d=d.concat(l.getNodes());var p;c=d.length;for(var h=0;h<c;h++)p=d[h],l.remove(p);l==this.rootGraph&&this.setRootGraph(null);var y=this.graphs.indexOf(l);this.graphs.splice(y,1),l.parent=null}else if(u instanceof o){if(v=u,v==null)throw"Edge is null!";if(!v.isInterGraph)throw"Not an inter-graph edge!";if(!(v.source!=null&&v.target!=null))throw"Source and/or target is null!";if(!(v.source.edges.indexOf(v)!=-1&&v.target.edges.indexOf(v)!=-1))throw"Source and/or target doesn't know this edge!";var y=v.source.edges.indexOf(v);if(v.source.edges.splice(y,1),y=v.target.edges.indexOf(v),v.target.edges.splice(y,1),!(v.source.owner!=null&&v.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(v.source.owner.getGraphManager().edges.indexOf(v)==-1)throw"Not in owner graph manager's edge list!";var y=v.source.owner.getGraphManager().edges.indexOf(v);v.source.owner.getGraphManager().edges.splice(y,1)}},s.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},s.prototype.getGraphs=function(){return this.graphs},s.prototype.getAllNodes=function(){if(this.allNodes==null){for(var u=[],l=this.getGraphs(),f=l.length,v=0;v<f;v++)u=u.concat(l[v].getNodes());this.allNodes=u}return this.allNodes},s.prototype.resetAllNodes=function(){this.allNodes=null},s.prototype.resetAllEdges=function(){this.allEdges=null},s.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},s.prototype.getAllEdges=function(){if(this.allEdges==null){var u=[],l=this.getGraphs();l.length;for(var f=0;f<l.length;f++)u=u.concat(l[f].getEdges());u=u.concat(this.edges),this.allEdges=u}return this.allEdges},s.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},s.prototype.setAllNodesToApplyGravitation=function(u){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=u},s.prototype.getRoot=function(){return this.rootGraph},s.prototype.setRootGraph=function(u){if(u.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=u,u.parent==null&&(u.parent=this.layout.newNode("Root node"))},s.prototype.getLayout=function(){return this.layout},s.prototype.isOneAncestorOfOther=function(u,l){if(!(u!=null&&l!=null))throw"assert failed";if(u==l)return!0;var f=u.getOwner(),v;do{if(v=f.getParent(),v==null)break;if(v==l)return!0;if(f=v.getOwner(),f==null)break}while(!0);f=l.getOwner();do{if(v=f.getParent(),v==null)break;if(v==u)return!0;if(f=v.getOwner(),f==null)break}while(!0);return!1},s.prototype.calcLowestCommonAncestors=function(){for(var u,l,f,v,c,h=this.getAllEdges(),d=h.length,p=0;p<d;p++){if(u=h[p],l=u.source,f=u.target,u.lca=null,u.sourceInLca=l,u.targetInLca=f,l==f){u.lca=l.getOwner();continue}for(v=l.getOwner();u.lca==null;){for(u.targetInLca=f,c=f.getOwner();u.lca==null;){if(c==v){u.lca=c;break}if(c==this.rootGraph)break;if(u.lca!=null)throw"assert failed";u.targetInLca=c.getParent(),c=u.targetInLca.getOwner()}if(v==this.rootGraph)break;u.lca==null&&(u.sourceInLca=v.getParent(),v=u.sourceInLca.getOwner())}if(u.lca==null)throw"assert failed"}},s.prototype.calcLowestCommonAncestor=function(u,l){if(u==l)return u.getOwner();var f=u.getOwner();do{if(f==null)break;var v=l.getOwner();do{if(v==null)break;if(v==f)return v;v=v.getParent().getOwner()}while(!0);f=f.getParent().getOwner()}while(!0);return f},s.prototype.calcInclusionTreeDepths=function(u,l){u==null&&l==null&&(u=this.rootGraph,l=1);for(var f,v=u.getNodes(),c=v.length,h=0;h<c;h++)f=v[h],f.inclusionTreeDepth=l,f.child!=null&&this.calcInclusionTreeDepths(f.child,l+1)},s.prototype.includesInvalidEdge=function(){for(var u,l=[],f=this.edges.length,v=0;v<f;v++)u=this.edges[v],this.isOneAncestorOfOther(u.source,u.target)&&l.push(u);for(var v=0;v<l.length;v++)this.remove(l[v]);return!1},r.exports=s},function(r,a,n){var i=n(12);function o(){}o.calcSeparationAmount=function(s,u,l,f){if(!s.intersects(u))throw"assert failed";var v=new Array(2);this.decideDirectionsForOverlappingNodes(s,u,v),l[0]=Math.min(s.getRight(),u.getRight())-Math.max(s.x,u.x),l[1]=Math.min(s.getBottom(),u.getBottom())-Math.max(s.y,u.y),s.getX()<=u.getX()&&s.getRight()>=u.getRight()?l[0]+=Math.min(u.getX()-s.getX(),s.getRight()-u.getRight()):u.getX()<=s.getX()&&u.getRight()>=s.getRight()&&(l[0]+=Math.min(s.getX()-u.getX(),u.getRight()-s.getRight())),s.getY()<=u.getY()&&s.getBottom()>=u.getBottom()?l[1]+=Math.min(u.getY()-s.getY(),s.getBottom()-u.getBottom()):u.getY()<=s.getY()&&u.getBottom()>=s.getBottom()&&(l[1]+=Math.min(s.getY()-u.getY(),u.getBottom()-s.getBottom()));var c=Math.abs((u.getCenterY()-s.getCenterY())/(u.getCenterX()-s.getCenterX()));u.getCenterY()===s.getCenterY()&&u.getCenterX()===s.getCenterX()&&(c=1);var h=c*l[0],d=l[1]/c;l[0]<d?d=l[0]:h=l[1],l[0]=-1*v[0]*(d/2+f),l[1]=-1*v[1]*(h/2+f)},o.decideDirectionsForOverlappingNodes=function(s,u,l){s.getCenterX()<u.getCenterX()?l[0]=-1:l[0]=1,s.getCenterY()<u.getCenterY()?l[1]=-1:l[1]=1},o.getIntersection2=function(s,u,l){var f=s.getCenterX(),v=s.getCenterY(),c=u.getCenterX(),h=u.getCenterY();if(s.intersects(u))return l[0]=f,l[1]=v,l[2]=c,l[3]=h,!0;var d=s.getX(),p=s.getY(),y=s.getRight(),g=s.getX(),b=s.getBottom(),m=s.getRight(),w=s.getWidthHalf(),T=s.getHeightHalf(),D=u.getX(),x=u.getY(),M=u.getRight(),P=u.getX(),N=u.getBottom(),O=u.getRight(),R=u.getWidthHalf(),I=u.getHeightHalf(),E=!1,A=!1;if(f===c){if(v>h)return l[0]=f,l[1]=p,l[2]=c,l[3]=N,!1;if(v<h)return l[0]=f,l[1]=b,l[2]=c,l[3]=x,!1}else if(v===h){if(f>c)return l[0]=d,l[1]=v,l[2]=M,l[3]=h,!1;if(f<c)return l[0]=y,l[1]=v,l[2]=D,l[3]=h,!1}else{var S=s.height/s.width,C=u.height/u.width,L=(h-v)/(c-f),z=void 0,k=void 0,F=void 0,H=void 0,W=void 0,Q=void 0;if(-S===L?f>c?(l[0]=g,l[1]=b,E=!0):(l[0]=y,l[1]=p,E=!0):S===L&&(f>c?(l[0]=d,l[1]=p,E=!0):(l[0]=m,l[1]=b,E=!0)),-C===L?c>f?(l[2]=P,l[3]=N,A=!0):(l[2]=M,l[3]=x,A=!0):C===L&&(c>f?(l[2]=D,l[3]=x,A=!0):(l[2]=O,l[3]=N,A=!0)),E&&A)return!1;if(f>c?v>h?(z=this.getCardinalDirection(S,L,4),k=this.getCardinalDirection(C,L,2)):(z=this.getCardinalDirection(-S,L,3),k=this.getCardinalDirection(-C,L,1)):v>h?(z=this.getCardinalDirection(-S,L,1),k=this.getCardinalDirection(-C,L,3)):(z=this.getCardinalDirection(S,L,2),k=this.getCardinalDirection(C,L,4)),!E)switch(z){case 1:H=p,F=f+-T/L,l[0]=F,l[1]=H;break;case 2:F=m,H=v+w*L,l[0]=F,l[1]=H;break;case 3:H=b,F=f+T/L,l[0]=F,l[1]=H;break;case 4:F=g,H=v+-w*L,l[0]=F,l[1]=H;break}if(!A)switch(k){case 1:Q=x,W=c+-I/L,l[2]=W,l[3]=Q;break;case 2:W=O,Q=h+R*L,l[2]=W,l[3]=Q;break;case 3:Q=N,W=c+I/L,l[2]=W,l[3]=Q;break;case 4:W=P,Q=h+-R*L,l[2]=W,l[3]=Q;break}}return!1},o.getCardinalDirection=function(s,u,l){return s>u?l:1+l%4},o.getIntersection=function(s,u,l,f){if(f==null)return this.getIntersection2(s,u,l);var v=s.x,c=s.y,h=u.x,d=u.y,p=l.x,y=l.y,g=f.x,b=f.y,m=void 0,w=void 0,T=void 0,D=void 0,x=void 0,M=void 0,P=void 0,N=void 0,O=void 0;return T=d-c,x=v-h,P=h*c-v*d,D=b-y,M=p-g,N=g*y-p*b,O=T*M-D*x,O===0?null:(m=(x*N-M*P)/O,w=(D*P-T*N)/O,new i(m,w))},o.angleOfVector=function(s,u,l,f){var v=void 0;return s!==l?(v=Math.atan((f-u)/(l-s)),l<s?v+=Math.PI:f<u&&(v+=this.TWO_PI)):f<u?v=this.ONE_AND_HALF_PI:v=this.HALF_PI,v},o.doIntersect=function(s,u,l,f){var v=s.x,c=s.y,h=u.x,d=u.y,p=l.x,y=l.y,g=f.x,b=f.y,m=(h-v)*(b-y)-(g-p)*(d-c);if(m===0)return!1;var w=((b-y)*(g-v)+(p-g)*(b-c))/m,T=((c-d)*(g-v)+(h-v)*(b-c))/m;return 0<w&&w<1&&0<T&&T<1},o.findCircleLineIntersections=function(s,u,l,f,v,c,h){var d=(l-s)*(l-s)+(f-u)*(f-u),p=2*((s-v)*(l-s)+(u-c)*(f-u)),y=(s-v)*(s-v)+(u-c)*(u-c)-h*h,g=p*p-4*d*y;if(g>=0){var b=(-p+Math.sqrt(p*p-4*d*y))/(2*d),m=(-p-Math.sqrt(p*p-4*d*y))/(2*d),w=null;return b>=0&&b<=1?[b]:m>=0&&m<=1?[m]:w}else return null},o.HALF_PI=.5*Math.PI,o.ONE_AND_HALF_PI=1.5*Math.PI,o.TWO_PI=2*Math.PI,o.THREE_PI=3*Math.PI,r.exports=o},function(r,a,n){function i(){}i.sign=function(o){return o>0?1:o<0?-1:0},i.floor=function(o){return o<0?Math.ceil(o):Math.floor(o)},i.ceil=function(o){return o<0?Math.floor(o):Math.ceil(o)},r.exports=i},function(r,a,n){function i(){}i.MAX_VALUE=2147483647,i.MIN_VALUE=-2147483648,r.exports=i},function(r,a,n){var i=function(){function v(c,h){for(var d=0;d<h.length;d++){var p=h[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(c,p.key,p)}}return function(c,h,d){return h&&v(c.prototype,h),d&&v(c,d),c}}();function o(v,c){if(!(v instanceof c))throw new TypeError("Cannot call a class as a function")}var s=function(c){return{value:c,next:null,prev:null}},u=function(c,h,d,p){return c!==null?c.next=h:p.head=h,d!==null?d.prev=h:p.tail=h,h.prev=c,h.next=d,p.length++,h},l=function(c,h){var d=c.prev,p=c.next;return d!==null?d.next=p:h.head=p,p!==null?p.prev=d:h.tail=d,c.prev=c.next=null,h.length--,c},f=function(){function v(c){var h=this;o(this,v),this.length=0,this.head=null,this.tail=null,c!=null&&c.forEach(function(d){return h.push(d)})}return i(v,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(h,d){return u(d.prev,s(h),d,this)}},{key:"insertAfter",value:function(h,d){return u(d,s(h),d.next,this)}},{key:"insertNodeBefore",value:function(h,d){return u(d.prev,h,d,this)}},{key:"insertNodeAfter",value:function(h,d){return u(d,h,d.next,this)}},{key:"push",value:function(h){return u(this.tail,s(h),null,this)}},{key:"unshift",value:function(h){return u(null,s(h),this.head,this)}},{key:"remove",value:function(h){return l(h,this)}},{key:"pop",value:function(){return l(this.tail,this).value}},{key:"popNode",value:function(){return l(this.tail,this)}},{key:"shift",value:function(){return l(this.head,this).value}},{key:"shiftNode",value:function(){return l(this.head,this)}},{key:"get_object_at",value:function(h){if(h<=this.length()){for(var d=1,p=this.head;d<h;)p=p.next,d++;return p.value}}},{key:"set_object_at",value:function(h,d){if(h<=this.length()){for(var p=1,y=this.head;p<h;)y=y.next,p++;y.value=d}}}]),v}();r.exports=f},function(r,a,n){function i(o,s,u){this.x=null,this.y=null,o==null&&s==null&&u==null?(this.x=0,this.y=0):typeof o=="number"&&typeof s=="number"&&u==null?(this.x=o,this.y=s):o.constructor.name=="Point"&&s==null&&u==null&&(u=o,this.x=u.x,this.y=u.y)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.getLocation=function(){return new i(this.x,this.y)},i.prototype.setLocation=function(o,s,u){o.constructor.name=="Point"&&s==null&&u==null?(u=o,this.setLocation(u.x,u.y)):typeof o=="number"&&typeof s=="number"&&u==null&&(parseInt(o)==o&&parseInt(s)==s?this.move(o,s):(this.x=Math.floor(o+.5),this.y=Math.floor(s+.5)))},i.prototype.move=function(o,s){this.x=o,this.y=s},i.prototype.translate=function(o,s){this.x+=o,this.y+=s},i.prototype.equals=function(o){if(o.constructor.name=="Point"){var s=o;return this.x==s.x&&this.y==s.y}return this==o},i.prototype.toString=function(){return new i().constructor.name+"[x="+this.x+",y="+this.y+"]"},r.exports=i},function(r,a,n){function i(o,s,u,l){this.x=0,this.y=0,this.width=0,this.height=0,o!=null&&s!=null&&u!=null&&l!=null&&(this.x=o,this.y=s,this.width=u,this.height=l)}i.prototype.getX=function(){return this.x},i.prototype.setX=function(o){this.x=o},i.prototype.getY=function(){return this.y},i.prototype.setY=function(o){this.y=o},i.prototype.getWidth=function(){return this.width},i.prototype.setWidth=function(o){this.width=o},i.prototype.getHeight=function(){return this.height},i.prototype.setHeight=function(o){this.height=o},i.prototype.getRight=function(){return this.x+this.width},i.prototype.getBottom=function(){return this.y+this.height},i.prototype.intersects=function(o){return!(this.getRight()<o.x||this.getBottom()<o.y||o.getRight()<this.x||o.getBottom()<this.y)},i.prototype.getCenterX=function(){return this.x+this.width/2},i.prototype.getMinX=function(){return this.getX()},i.prototype.getMaxX=function(){return this.getX()+this.width},i.prototype.getCenterY=function(){return this.y+this.height/2},i.prototype.getMinY=function(){return this.getY()},i.prototype.getMaxY=function(){return this.getY()+this.height},i.prototype.getWidthHalf=function(){return this.width/2},i.prototype.getHeightHalf=function(){return this.height/2},r.exports=i},function(r,a,n){var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};function o(){}o.lastID=0,o.createID=function(s){return o.isPrimitive(s)?s:(s.uniqueID!=null||(s.uniqueID=o.getString(),o.lastID++),s.uniqueID)},o.getString=function(s){return s==null&&(s=o.lastID),"Object#"+s},o.isPrimitive=function(s){var u=typeof s>"u"?"undefined":i(s);return s==null||u!="object"&&u!="function"},r.exports=o},function(r,a,n){function i(p){if(Array.isArray(p)){for(var y=0,g=Array(p.length);y<p.length;y++)g[y]=p[y];return g}else return Array.from(p)}var o=n(0),s=n(7),u=n(3),l=n(1),f=n(6),v=n(5),c=n(17),h=n(29);function d(p){h.call(this),this.layoutQuality=o.QUALITY,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=o.DEFAULT_INCREMENTAL,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new s(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,p!=null&&(this.isRemoteUse=p)}d.RANDOM_SEED=1,d.prototype=Object.create(h.prototype),d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},d.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},d.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},d.prototype.newGraphManager=function(){var p=new s(this);return this.graphManager=p,p},d.prototype.newGraph=function(p){return new f(null,this.graphManager,p)},d.prototype.newNode=function(p){return new u(this.graphManager,p)},d.prototype.newEdge=function(p){return new l(null,null,p)},d.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},d.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var p;return this.checkLayoutSuccess()?p=!1:p=this.layout(),o.ANIMATE==="during"?!1:(p&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,p)},d.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},d.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var p=this.graphManager.getAllEdges(),y=0;y<p.length;y++)p[y];for(var g=this.graphManager.getRoot().getNodes(),y=0;y<g.length;y++)g[y];this.update(this.graphManager.getRoot())}},d.prototype.update=function(p){if(p==null)this.update2();else if(p instanceof u){var y=p;if(y.getChild()!=null)for(var g=y.getChild().getNodes(),b=0;b<g.length;b++)update(g[b]);if(y.vGraphObject!=null){var m=y.vGraphObject;m.update(y)}}else if(p instanceof l){var w=p;if(w.vGraphObject!=null){var T=w.vGraphObject;T.update(w)}}else if(p instanceof f){var D=p;if(D.vGraphObject!=null){var x=D.vGraphObject;x.update(D)}}},d.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=o.QUALITY,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=o.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},d.prototype.transform=function(p){if(p==null)this.transform(new v(0,0));else{var y=new c,g=this.graphManager.getRoot().updateLeftTop();if(g!=null){y.setWorldOrgX(p.x),y.setWorldOrgY(p.y),y.setDeviceOrgX(g.x),y.setDeviceOrgY(g.y);for(var b=this.getAllNodes(),m,w=0;w<b.length;w++)m=b[w],m.transform(y)}}},d.prototype.positionNodesRandomly=function(p){if(p==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var y,g,b=p.getNodes(),m=0;m<b.length;m++)y=b[m],g=y.getChild(),g==null||g.getNodes().length==0?y.scatter():(this.positionNodesRandomly(g),y.updateBounds())},d.prototype.getFlatForest=function(){for(var p=[],y=!0,g=this.graphManager.getRoot().getNodes(),b=!0,m=0;m<g.length;m++)g[m].getChild()!=null&&(b=!1);if(!b)return p;var w=new Set,T=[],D=new Map,x=[];for(x=x.concat(g);x.length>0&&y;){for(T.push(x[0]);T.length>0&&y;){var M=T[0];T.splice(0,1),w.add(M);for(var P=M.getEdges(),m=0;m<P.length;m++){var N=P[m].getOtherEnd(M);if(D.get(M)!=N)if(!w.has(N))T.push(N),D.set(N,M);else{y=!1;break}}}if(!y)p=[];else{var O=[].concat(i(w));p.push(O);for(var m=0;m<O.length;m++){var R=O[m],I=x.indexOf(R);I>-1&&x.splice(I,1)}w=new Set,D=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var y=[],g=p.source,b=this.graphManager.calcLowestCommonAncestor(p.source,p.target),m=0;m<p.bendpoints.length;m++){var w=this.newNode(null);w.setRect(new Point(0,0),new Dimension(1,1)),b.add(w);var T=this.newEdge(null);this.graphManager.add(T,g,w),y.add(w),g=w}var T=this.newEdge(null);return this.graphManager.add(T,g,p.target),this.edgeToDummyNodes.set(p,y),p.isInterGraph()?this.graphManager.remove(p):b.remove(p),y},d.prototype.createBendpointsFromDummyNodes=function(){var p=[];p=p.concat(this.graphManager.getAllEdges()),p=[].concat(i(this.edgeToDummyNodes.keys())).concat(p);for(var y=0;y<p.length;y++){var g=p[y];if(g.bendpoints.length>0){for(var b=this.edgeToDummyNodes.get(g),m=0;m<b.length;m++){var w=b[m],T=new v(w.getCenterX(),w.getCenterY()),D=g.bendpoints.get(m);D.x=T.x,D.y=T.y,w.getOwner().remove(w)}this.graphManager.add(g,g.source,g.target)}}},d.transform=function(p,y,g,b){if(g!=null&&b!=null){var m=y;if(p<=50){var w=y/g;m-=(y-w)/50*(50-p)}else{var T=y*b;m+=(T-y)/50*(p-50)}return m}else{var D,x;return p<=50?(D=9*y/500,x=y/10):(D=9*y/50,x=-8*y),D*p+x}},d.findCenterOfTree=function(p){var y=[];y=y.concat(p);var g=[],b=new Map,m=!1,w=null;(y.length==1||y.length==2)&&(m=!0,w=y[0]);for(var T=0;T<y.length;T++){var D=y[T],x=D.getNeighborsList().size;b.set(D,D.getNeighborsList().size),x==1&&g.push(D)}var M=[];for(M=M.concat(g);!m;){var P=[];P=P.concat(M),M=[];for(var T=0;T<y.length;T++){var D=y[T],N=y.indexOf(D);N>=0&&y.splice(N,1);var O=D.getNeighborsList();O.forEach(function(E){if(g.indexOf(E)<0){var A=b.get(E),S=A-1;S==1&&M.push(E),b.set(E,S)}})}g=g.concat(M),(y.length==1||y.length==2)&&(m=!0,w=y[0])}return w},d.prototype.setGraphManager=function(p){this.graphManager=p},r.exports=d},function(r,a,n){function i(){}i.seed=1,i.x=0,i.nextDouble=function(){return i.x=Math.sin(i.seed++)*1e4,i.x-Math.floor(i.x)},r.exports=i},function(r,a,n){var i=n(5);function o(s,u){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o.prototype.getWorldOrgX=function(){return this.lworldOrgX},o.prototype.setWorldOrgX=function(s){this.lworldOrgX=s},o.prototype.getWorldOrgY=function(){return this.lworldOrgY},o.prototype.setWorldOrgY=function(s){this.lworldOrgY=s},o.prototype.getWorldExtX=function(){return this.lworldExtX},o.prototype.setWorldExtX=function(s){this.lworldExtX=s},o.prototype.getWorldExtY=function(){return this.lworldExtY},o.prototype.setWorldExtY=function(s){this.lworldExtY=s},o.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},o.prototype.setDeviceOrgX=function(s){this.ldeviceOrgX=s},o.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},o.prototype.setDeviceOrgY=function(s){this.ldeviceOrgY=s},o.prototype.getDeviceExtX=function(){return this.ldeviceExtX},o.prototype.setDeviceExtX=function(s){this.ldeviceExtX=s},o.prototype.getDeviceExtY=function(){return this.ldeviceExtY},o.prototype.setDeviceExtY=function(s){this.ldeviceExtY=s},o.prototype.transformX=function(s){var u=0,l=this.lworldExtX;return l!=0&&(u=this.ldeviceOrgX+(s-this.lworldOrgX)*this.ldeviceExtX/l),u},o.prototype.transformY=function(s){var u=0,l=this.lworldExtY;return l!=0&&(u=this.ldeviceOrgY+(s-this.lworldOrgY)*this.ldeviceExtY/l),u},o.prototype.inverseTransformX=function(s){var u=0,l=this.ldeviceExtX;return l!=0&&(u=this.lworldOrgX+(s-this.ldeviceOrgX)*this.lworldExtX/l),u},o.prototype.inverseTransformY=function(s){var u=0,l=this.ldeviceExtY;return l!=0&&(u=this.lworldOrgY+(s-this.ldeviceOrgY)*this.lworldExtY/l),u},o.prototype.inverseTransformPoint=function(s){var u=new i(this.inverseTransformX(s.x),this.inverseTransformY(s.y));return u},r.exports=o},function(r,a,n){function i(h){if(Array.isArray(h)){for(var d=0,p=Array(h.length);d<h.length;d++)p[d]=h[d];return p}else return Array.from(h)}var o=n(15),s=n(4),u=n(0),l=n(8),f=n(9);function v(){o.call(this),this.useSmartIdealEdgeLengthCalculation=s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=s.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=s.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=s.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*s.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=s.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=s.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=s.MAX_ITERATIONS}v.prototype=Object.create(o.prototype);for(var c in o)v[c]=o[c];v.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},v.prototype.calcIdealEdgeLengths=function(){for(var h,d,p,y,g,b,m,w=this.getGraphManager().getAllEdges(),T=0;T<w.length;T++)h=w[T],d=h.idealLength,h.isInterGraph&&(y=h.getSource(),g=h.getTarget(),b=h.getSourceInLca().getEstimatedSize(),m=h.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(h.idealLength+=b+m-2*u.SIMPLE_NODE_SIZE),p=h.getLca().getInclusionTreeDepth(),h.idealLength+=d*s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(y.getInclusionTreeDepth()+g.getInclusionTreeDepth()-2*p))},v.prototype.initSpringEmbedder=function(){var h=this.getAllNodes().length;this.incremental?(h>s.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*s.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(h-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-s.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT_INCREMENTAL):(h>s.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(s.COOLING_ADAPTATION_FACTOR,1-(h-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*(1-s.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*s.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},v.prototype.calcSpringForces=function(){for(var h=this.getAllEdges(),d,p=0;p<h.length;p++)d=h[p],this.calcSpringForce(d,d.idealLength)},v.prototype.calcRepulsionForces=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,y,g,b,m=this.getAllNodes(),w;if(this.useFRGridVariant)for(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&h&&this.updateGrid(),w=new Set,p=0;p<m.length;p++)g=m[p],this.calculateRepulsionForceOfANode(g,w,h,d),w.add(g);else for(p=0;p<m.length;p++)for(g=m[p],y=p+1;y<m.length;y++)b=m[y],g.getOwner()==b.getOwner()&&this.calcRepulsionForce(g,b)},v.prototype.calcGravitationalForces=function(){for(var h,d=this.getAllNodesToApplyGravitation(),p=0;p<d.length;p++)h=d[p],this.calcGravitationalForce(h)},v.prototype.moveNodes=function(){for(var h=this.getAllNodes(),d,p=0;p<h.length;p++)d=h[p],d.move()},v.prototype.calcSpringForce=function(h,d){var p=h.getSource(),y=h.getTarget(),g,b,m,w;if(this.uniformLeafNodeSizes&&p.getChild()==null&&y.getChild()==null)h.updateLengthSimple();else if(h.updateLength(),h.isOverlapingSourceAndTarget)return;g=h.getLength(),g!=0&&(b=h.edgeElasticity*(g-d),m=b*(h.lengthX/g),w=b*(h.lengthY/g),p.springForceX+=m,p.springForceY+=w,y.springForceX-=m,y.springForceY-=w)},v.prototype.calcRepulsionForce=function(h,d){var p=h.getRect(),y=d.getRect(),g=new Array(2),b=new Array(4),m,w,T,D,x,M,P;if(p.intersects(y)){l.calcSeparationAmount(p,y,g,s.DEFAULT_EDGE_LENGTH/2),M=2*g[0],P=2*g[1];var N=h.noOfChildren*d.noOfChildren/(h.noOfChildren+d.noOfChildren);h.repulsionForceX-=N*M,h.repulsionForceY-=N*P,d.repulsionForceX+=N*M,d.repulsionForceY+=N*P}else this.uniformLeafNodeSizes&&h.getChild()==null&&d.getChild()==null?(m=y.getCenterX()-p.getCenterX(),w=y.getCenterY()-p.getCenterY()):(l.getIntersection(p,y,b),m=b[2]-b[0],w=b[3]-b[1]),Math.abs(m)<s.MIN_REPULSION_DIST&&(m=f.sign(m)*s.MIN_REPULSION_DIST),Math.abs(w)<s.MIN_REPULSION_DIST&&(w=f.sign(w)*s.MIN_REPULSION_DIST),T=m*m+w*w,D=Math.sqrt(T),x=(h.nodeRepulsion/2+d.nodeRepulsion/2)*h.noOfChildren*d.noOfChildren/T,M=x*m/D,P=x*w/D,h.repulsionForceX-=M,h.repulsionForceY-=P,d.repulsionForceX+=M,d.repulsionForceY+=P},v.prototype.calcGravitationalForce=function(h){var d,p,y,g,b,m,w,T;d=h.getOwner(),p=(d.getRight()+d.getLeft())/2,y=(d.getTop()+d.getBottom())/2,g=h.getCenterX()-p,b=h.getCenterY()-y,m=Math.abs(g)+h.getWidth()/2,w=Math.abs(b)+h.getHeight()/2,h.getOwner()==this.graphManager.getRoot()?(T=d.getEstimatedSize()*this.gravityRangeFactor,(m>T||w>T)&&(h.gravitationForceX=-this.gravityConstant*g,h.gravitationForceY=-this.gravityConstant*b)):(T=d.getEstimatedSize()*this.compoundGravityRangeFactor,(m>T||w>T)&&(h.gravitationForceX=-this.gravityConstant*g*this.compoundGravityConstant,h.gravitationForceY=-this.gravityConstant*b*this.compoundGravityConstant))},v.prototype.isConverged=function(){var h,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),h=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,h||d},v.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},v.prototype.calcNoOfChildrenForAllNodes=function(){for(var h,d=this.graphManager.getAllNodes(),p=0;p<d.length;p++)h=d[p],h.noOfChildren=h.getNoOfChildren()},v.prototype.calcGrid=function(h){var d=0,p=0;d=parseInt(Math.ceil((h.getRight()-h.getLeft())/this.repulsionRange)),p=parseInt(Math.ceil((h.getBottom()-h.getTop())/this.repulsionRange));for(var y=new Array(d),g=0;g<d;g++)y[g]=new Array(p);for(var g=0;g<d;g++)for(var b=0;b<p;b++)y[g][b]=new Array;return y},v.prototype.addNodeToGrid=function(h,d,p){var y=0,g=0,b=0,m=0;y=parseInt(Math.floor((h.getRect().x-d)/this.repulsionRange)),g=parseInt(Math.floor((h.getRect().width+h.getRect().x-d)/this.repulsionRange)),b=parseInt(Math.floor((h.getRect().y-p)/this.repulsionRange)),m=parseInt(Math.floor((h.getRect().height+h.getRect().y-p)/this.repulsionRange));for(var w=y;w<=g;w++)for(var T=b;T<=m;T++)this.grid[w][T].push(h),h.setGridCoordinates(y,g,b,m)},v.prototype.updateGrid=function(){var h,d,p=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),h=0;h<p.length;h++)d=p[h],this.addNodeToGrid(d,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},v.prototype.calculateRepulsionForceOfANode=function(h,d,p,y){if(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&p||y){var g=new Set;h.surrounding=new Array;for(var b,m=this.grid,w=h.startX-1;w<h.finishX+2;w++)for(var T=h.startY-1;T<h.finishY+2;T++)if(!(w<0||T<0||w>=m.length||T>=m[0].length)){for(var D=0;D<m[w][T].length;D++)if(b=m[w][T][D],!(h.getOwner()!=b.getOwner()||h==b)&&!d.has(b)&&!g.has(b)){var x=Math.abs(h.getCenterX()-b.getCenterX())-(h.getWidth()/2+b.getWidth()/2),M=Math.abs(h.getCenterY()-b.getCenterY())-(h.getHeight()/2+b.getHeight()/2);x<=this.repulsionRange&&M<=this.repulsionRange&&g.add(b)}}h.surrounding=[].concat(i(g))}for(w=0;w<h.surrounding.length;w++)this.calcRepulsionForce(h,h.surrounding[w])},v.prototype.calcRepulsionRange=function(){return 0},r.exports=v},function(r,a,n){var i=n(1),o=n(4);function s(l,f,v){i.call(this,l,f,v),this.idealLength=o.DEFAULT_EDGE_LENGTH,this.edgeElasticity=o.DEFAULT_SPRING_STRENGTH}s.prototype=Object.create(i.prototype);for(var u in i)s[u]=i[u];r.exports=s},function(r,a,n){var i=n(3),o=n(4);function s(l,f,v,c){i.call(this,l,f,v,c),this.nodeRepulsion=o.DEFAULT_REPULSION_STRENGTH,this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}s.prototype=Object.create(i.prototype);for(var u in i)s[u]=i[u];s.prototype.setGridCoordinates=function(l,f,v,c){this.startX=l,this.finishX=f,this.startY=v,this.finishY=c},r.exports=s},function(r,a,n){function i(o,s){this.width=0,this.height=0,o!==null&&s!==null&&(this.height=s,this.width=o)}i.prototype.getWidth=function(){return this.width},i.prototype.setWidth=function(o){this.width=o},i.prototype.getHeight=function(){return this.height},i.prototype.setHeight=function(o){this.height=o},r.exports=i},function(r,a,n){var i=n(14);function o(){this.map={},this.keys=[]}o.prototype.put=function(s,u){var l=i.createID(s);this.contains(l)||(this.map[l]=u,this.keys.push(s))},o.prototype.contains=function(s){return i.createID(s),this.map[s]!=null},o.prototype.get=function(s){var u=i.createID(s);return this.map[u]},o.prototype.keySet=function(){return this.keys},r.exports=o},function(r,a,n){var i=n(14);function o(){this.set={}}o.prototype.add=function(s){var u=i.createID(s);this.contains(u)||(this.set[u]=s)},o.prototype.remove=function(s){delete this.set[i.createID(s)]},o.prototype.clear=function(){this.set={}},o.prototype.contains=function(s){return this.set[i.createID(s)]==s},o.prototype.isEmpty=function(){return this.size()===0},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAllTo=function(s){for(var u=Object.keys(this.set),l=u.length,f=0;f<l;f++)s.push(this.set[u[f]])},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAll=function(s){for(var u=s.length,l=0;l<u;l++){var f=s[l];this.add(f)}},r.exports=o},function(r,a,n){function i(){}i.multMat=function(o,s){for(var u=[],l=0;l<o.length;l++){u[l]=[];for(var f=0;f<s[0].length;f++){u[l][f]=0;for(var v=0;v<o[0].length;v++)u[l][f]+=o[l][v]*s[v][f]}}return u},i.transpose=function(o){for(var s=[],u=0;u<o[0].length;u++){s[u]=[];for(var l=0;l<o.length;l++)s[u][l]=o[l][u]}return s},i.multCons=function(o,s){for(var u=[],l=0;l<o.length;l++)u[l]=o[l]*s;return u},i.minusOp=function(o,s){for(var u=[],l=0;l<o.length;l++)u[l]=o[l]-s[l];return u},i.dotProduct=function(o,s){for(var u=0,l=0;l<o.length;l++)u+=o[l]*s[l];return u},i.mag=function(o){return Math.sqrt(this.dotProduct(o,o))},i.normalize=function(o){for(var s=[],u=this.mag(o),l=0;l<o.length;l++)s[l]=o[l]/u;return s},i.multGamma=function(o){for(var s=[],u=0,l=0;l<o.length;l++)u+=o[l];u*=-1/o.length;for(var f=0;f<o.length;f++)s[f]=u+o[f];return s},i.multL=function(o,s,u){for(var l=[],f=[],v=[],c=0;c<s[0].length;c++){for(var h=0,d=0;d<s.length;d++)h+=-.5*s[d][c]*o[d];f[c]=h}for(var p=0;p<u.length;p++){for(var y=0,g=0;g<u.length;g++)y+=u[p][g]*f[g];v[p]=y}for(var b=0;b<s.length;b++){for(var m=0,w=0;w<s[0].length;w++)m+=s[b][w]*v[w];l[b]=m}return l},r.exports=i},function(r,a,n){var i=function(){function l(f,v){for(var c=0;c<v.length;c++){var h=v[c];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}return function(f,v,c){return v&&l(f.prototype,v),c&&l(f,c),f}}();function o(l,f){if(!(l instanceof f))throw new TypeError("Cannot call a class as a function")}var s=n(11),u=function(){function l(f,v){o(this,l),(v!==null||v!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var c=void 0;f instanceof s?c=f.size():c=f.length,this._quicksort(f,0,c-1)}return i(l,[{key:"_quicksort",value:function(v,c,h){if(c<h){var d=this._partition(v,c,h);this._quicksort(v,c,d),this._quicksort(v,d+1,h)}}},{key:"_partition",value:function(v,c,h){for(var d=this._get(v,c),p=c,y=h;;){for(;this.compareFunction(d,this._get(v,y));)y--;for(;this.compareFunction(this._get(v,p),d);)p++;if(p<y)this._swap(v,p,y),p++,y--;else return y}}},{key:"_get",value:function(v,c){return v instanceof s?v.get_object_at(c):v[c]}},{key:"_set",value:function(v,c,h){v instanceof s?v.set_object_at(c,h):v[c]=h}},{key:"_swap",value:function(v,c,h){var d=this._get(v,c);this._set(v,c,this._get(v,h)),this._set(v,h,d)}},{key:"_defaultCompareFunction",value:function(v,c){return c>v}}]),l}();r.exports=u},function(r,a,n){function i(){}i.svd=function(o){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=o.length,this.n=o[0].length;var s=Math.min(this.m,this.n);this.s=function(ke){for(var Re=[];ke-- >0;)Re.push(0);return Re}(Math.min(this.m+1,this.n)),this.U=function(ke){var Re=function rt(Ke){if(Ke.length==0)return 0;for(var st=[],Qe=0;Qe<Ke[0];Qe++)st.push(rt(Ke.slice(1)));return st};return Re(ke)}([this.m,s]),this.V=function(ke){var Re=function rt(Ke){if(Ke.length==0)return 0;for(var st=[],Qe=0;Qe<Ke[0];Qe++)st.push(rt(Ke.slice(1)));return st};return Re(ke)}([this.n,this.n]);for(var u=function(ke){for(var Re=[];ke-- >0;)Re.push(0);return Re}(this.n),l=function(ke){for(var Re=[];ke-- >0;)Re.push(0);return Re}(this.m),f=!0,v=Math.min(this.m-1,this.n),c=Math.max(0,Math.min(this.n-2,this.m)),h=0;h<Math.max(v,c);h++){if(h<v){this.s[h]=0;for(var d=h;d<this.m;d++)this.s[h]=i.hypot(this.s[h],o[d][h]);if(this.s[h]!==0){o[h][h]<0&&(this.s[h]=-this.s[h]);for(var p=h;p<this.m;p++)o[p][h]/=this.s[h];o[h][h]+=1}this.s[h]=-this.s[h]}for(var y=h+1;y<this.n;y++){if(function(ke,Re){return ke&&Re}(h<v,this.s[h]!==0)){for(var g=0,b=h;b<this.m;b++)g+=o[b][h]*o[b][y];g=-g/o[h][h];for(var m=h;m<this.m;m++)o[m][y]+=g*o[m][h]}u[y]=o[h][y]}if(function(ke,Re){return Re}(f,h<v))for(var w=h;w<this.m;w++)this.U[w][h]=o[w][h];if(h<c){u[h]=0;for(var T=h+1;T<this.n;T++)u[h]=i.hypot(u[h],u[T]);if(u[h]!==0){u[h+1]<0&&(u[h]=-u[h]);for(var D=h+1;D<this.n;D++)u[D]/=u[h];u[h+1]+=1}if(u[h]=-u[h],function(ke,Re){return ke&&Re}(h+1<this.m,u[h]!==0)){for(var x=h+1;x<this.m;x++)l[x]=0;for(var M=h+1;M<this.n;M++)for(var P=h+1;P<this.m;P++)l[P]+=u[M]*o[P][M];for(var N=h+1;N<this.n;N++)for(var O=-u[N]/u[h+1],R=h+1;R<this.m;R++)o[R][N]+=O*l[R]}for(var I=h+1;I<this.n;I++)this.V[I][h]=u[I]}}var E=Math.min(this.n,this.m+1);v<this.n&&(this.s[v]=o[v][v]),this.m<E&&(this.s[E-1]=0),c+1<E&&(u[c]=o[c][E-1]),u[E-1]=0;{for(var A=v;A<s;A++){for(var S=0;S<this.m;S++)this.U[S][A]=0;this.U[A][A]=1}for(var C=v-1;C>=0;C--)if(this.s[C]!==0){for(var L=C+1;L<s;L++){for(var z=0,k=C;k<this.m;k++)z+=this.U[k][C]*this.U[k][L];z=-z/this.U[C][C];for(var F=C;F<this.m;F++)this.U[F][L]+=z*this.U[F][C]}for(var H=C;H<this.m;H++)this.U[H][C]=-this.U[H][C];this.U[C][C]=1+this.U[C][C];for(var W=0;W<C-1;W++)this.U[W][C]=0}else{for(var Q=0;Q<this.m;Q++)this.U[Q][C]=0;this.U[C][C]=1}}for(var K=this.n-1;K>=0;K--){if(function(ke,Re){return ke&&Re}(K<c,u[K]!==0))for(var Z=K+1;Z<s;Z++){for(var j=0,re=K+1;re<this.n;re++)j+=this.V[re][K]*this.V[re][Z];j=-j/this.V[K+1][K];for(var q=K+1;q<this.n;q++)this.V[q][Z]+=j*this.V[q][K]}for(var U=0;U<this.n;U++)this.V[U][K]=0;this.V[K][K]=1}for(var Y=E-1,X=Math.pow(2,-52),ee=Math.pow(2,-966);E>0;){var te=void 0,ge=void 0;for(te=E-2;te>=-1&&te!==-1;te--)if(Math.abs(u[te])<=ee+X*(Math.abs(this.s[te])+Math.abs(this.s[te+1]))){u[te]=0;break}if(te===E-2)ge=4;else{var Te=void 0;for(Te=E-1;Te>=te&&Te!==te;Te--){var pe=(Te!==E?Math.abs(u[Te]):0)+(Te!==te+1?Math.abs(u[Te-1]):0);if(Math.abs(this.s[Te])<=ee+X*pe){this.s[Te]=0;break}}Te===te?ge=3:Te===E-1?ge=1:(ge=2,te=Te)}switch(te++,ge){case 1:{var le=u[E-2];u[E-2]=0;for(var ce=E-2;ce>=te;ce--){var ve=i.hypot(this.s[ce],le),de=this.s[ce]/ve,me=le/ve;this.s[ce]=ve,ce!==te&&(le=-me*u[ce-1],u[ce-1]=de*u[ce-1]);for(var ye=0;ye<this.n;ye++)ve=de*this.V[ye][ce]+me*this.V[ye][E-1],this.V[ye][E-1]=-me*this.V[ye][ce]+de*this.V[ye][E-1],this.V[ye][ce]=ve}}break;case 2:{var we=u[te-1];u[te-1]=0;for(var Me=te;Me<E;Me++){var Ie=i.hypot(this.s[Me],we),Be=this.s[Me]/Ie,Fe=we/Ie;this.s[Me]=Ie,we=-Fe*u[Me],u[Me]=Be*u[Me];for(var oe=0;oe<this.m;oe++)Ie=Be*this.U[oe][Me]+Fe*this.U[oe][te-1],this.U[oe][te-1]=-Fe*this.U[oe][Me]+Be*this.U[oe][te-1],this.U[oe][Me]=Ie}}break;case 3:{var B=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[E-1]),Math.abs(this.s[E-2])),Math.abs(u[E-2])),Math.abs(this.s[te])),Math.abs(u[te])),_=this.s[E-1]/B,V=this.s[E-2]/B,G=u[E-2]/B,$=this.s[te]/B,ae=u[te]/B,J=((V+_)*(V-_)+G*G)/2,ne=_*G*(_*G),ie=0;(function(ke,Re){return ke||Re})(J!==0,ne!==0)&&(ie=Math.sqrt(J*J+ne),J<0&&(ie=-ie),ie=ne/(J+ie));for(var ue=($+_)*($-_)+ie,fe=$*ae,se=te;se<E-1;se++){var he=i.hypot(ue,fe),Ce=ue/he,Ee=fe/he;se!==te&&(u[se-1]=he),ue=Ce*this.s[se]+Ee*u[se],u[se]=Ce*u[se]-Ee*this.s[se],fe=Ee*this.s[se+1],this.s[se+1]=Ce*this.s[se+1];for(var Ve=0;Ve<this.n;Ve++)he=Ce*this.V[Ve][se]+Ee*this.V[Ve][se+1],this.V[Ve][se+1]=-Ee*this.V[Ve][se]+Ce*this.V[Ve][se+1],this.V[Ve][se]=he;if(he=i.hypot(ue,fe),Ce=ue/he,Ee=fe/he,this.s[se]=he,ue=Ce*u[se]+Ee*this.s[se+1],this.s[se+1]=-Ee*u[se]+Ce*this.s[se+1],fe=Ee*u[se+1],u[se+1]=Ce*u[se+1],se<this.m-1)for(var Ae=0;Ae<this.m;Ae++)he=Ce*this.U[Ae][se]+Ee*this.U[Ae][se+1],this.U[Ae][se+1]=-Ee*this.U[Ae][se]+Ce*this.U[Ae][se+1],this.U[Ae][se]=he}u[E-2]=ue}break;case 4:{if(this.s[te]<=0){this.s[te]=this.s[te]<0?-this.s[te]:0;for(var Se=0;Se<=Y;Se++)this.V[Se][te]=-this.V[Se][te]}for(;te<Y&&!(this.s[te]>=this.s[te+1]);){var Pe=this.s[te];if(this.s[te]=this.s[te+1],this.s[te+1]=Pe,te<this.n-1)for(var De=0;De<this.n;De++)Pe=this.V[De][te+1],this.V[De][te+1]=this.V[De][te],this.V[De][te]=Pe;if(te<this.m-1)for(var xe=0;xe<this.m;xe++)Pe=this.U[xe][te+1],this.U[xe][te+1]=this.U[xe][te],this.U[xe][te]=Pe;te++}E--}break}}var qe={U:this.U,V:this.V,S:this.s};return qe},i.hypot=function(o,s){var u=void 0;return Math.abs(o)>Math.abs(s)?(u=s/o,u=Math.abs(o)*Math.sqrt(1+u*u)):s!=0?(u=o/s,u=Math.abs(s)*Math.sqrt(1+u*u)):u=0,u},r.exports=i},function(r,a,n){var i=function(){function u(l,f){for(var v=0;v<f.length;v++){var c=f[v];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(l,c.key,c)}}return function(l,f,v){return f&&u(l.prototype,f),v&&u(l,v),l}}();function o(u,l){if(!(u instanceof l))throw new TypeError("Cannot call a class as a function")}var s=function(){function u(l,f){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;o(this,u),this.sequence1=l,this.sequence2=f,this.match_score=v,this.mismatch_penalty=c,this.gap_penalty=h,this.iMax=l.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var d=0;d<this.iMax;d++){this.grid[d]=new Array(this.jMax);for(var p=0;p<this.jMax;p++)this.grid[d][p]=0}this.tracebackGrid=new Array(this.iMax);for(var y=0;y<this.iMax;y++){this.tracebackGrid[y]=new Array(this.jMax);for(var g=0;g<this.jMax;g++)this.tracebackGrid[y][g]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return i(u,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var f=1;f<this.jMax;f++)this.grid[0][f]=this.grid[0][f-1]+this.gap_penalty,this.tracebackGrid[0][f]=[!1,!1,!0];for(var v=1;v<this.iMax;v++)this.grid[v][0]=this.grid[v-1][0]+this.gap_penalty,this.tracebackGrid[v][0]=[!1,!0,!1];for(var c=1;c<this.iMax;c++)for(var h=1;h<this.jMax;h++){var d=void 0;this.sequence1[c-1]===this.sequence2[h-1]?d=this.grid[c-1][h-1]+this.match_score:d=this.grid[c-1][h-1]+this.mismatch_penalty;var p=this.grid[c-1][h]+this.gap_penalty,y=this.grid[c][h-1]+this.gap_penalty,g=[d,p,y],b=this.arrayAllMaxIndexes(g);this.grid[c][h]=g[b[0]],this.tracebackGrid[c][h]=[b.includes(0),b.includes(1),b.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var f=[];for(f.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});f[0];){var v=f[0],c=this.tracebackGrid[v.pos[0]][v.pos[1]];c[0]&&f.push({pos:[v.pos[0]-1,v.pos[1]-1],seq1:this.sequence1[v.pos[0]-1]+v.seq1,seq2:this.sequence2[v.pos[1]-1]+v.seq2}),c[1]&&f.push({pos:[v.pos[0]-1,v.pos[1]],seq1:this.sequence1[v.pos[0]-1]+v.seq1,seq2:"-"+v.seq2}),c[2]&&f.push({pos:[v.pos[0],v.pos[1]-1],seq1:"-"+v.seq1,seq2:this.sequence2[v.pos[1]-1]+v.seq2}),v.pos[0]===0&&v.pos[1]===0&&this.alignments.push({sequence1:v.seq1,sequence2:v.seq2}),f.shift()}return this.alignments}},{key:"getAllIndexes",value:function(f,v){for(var c=[],h=-1;(h=f.indexOf(v,h+1))!==-1;)c.push(h);return c}},{key:"arrayAllMaxIndexes",value:function(f){return this.getAllIndexes(f,Math.max.apply(null,f))}}]),u}();r.exports=s},function(r,a,n){var i=function(){};i.FDLayout=n(18),i.FDLayoutConstants=n(4),i.FDLayoutEdge=n(19),i.FDLayoutNode=n(20),i.DimensionD=n(21),i.HashMap=n(22),i.HashSet=n(23),i.IGeometry=n(8),i.IMath=n(9),i.Integer=n(10),i.Point=n(12),i.PointD=n(5),i.RandomSeed=n(16),i.RectangleD=n(13),i.Transform=n(17),i.UniqueIDGeneretor=n(14),i.Quicksort=n(25),i.LinkedList=n(11),i.LGraphObject=n(2),i.LGraph=n(6),i.LEdge=n(1),i.LGraphManager=n(7),i.LNode=n(3),i.Layout=n(15),i.LayoutConstants=n(0),i.NeedlemanWunsch=n(27),i.Matrix=n(24),i.SVD=n(26),r.exports=i},function(r,a,n){function i(){this.listeners=[]}var o=i.prototype;o.addListener=function(s,u){this.listeners.push({event:s,callback:u})},o.removeListener=function(s,u){for(var l=this.listeners.length;l>=0;l--){var f=this.listeners[l];f.event===s&&f.callback===u&&this.listeners.splice(l,1)}},o.emit=function(s,u){for(var l=0;l<this.listeners.length;l++){var f=this.listeners[l];s===f.event&&f.callback(u)}},r.exports=i}])})}(ui)),ui.exports}var Hm=si.exports,nh;function qm(){return nh||(nh=1,function(t,e){(function(a,n){t.exports=n(Um())})(Hm,function(r){return(()=>{var a={45:(s,u,l)=>{var f={};f.layoutBase=l(551),f.CoSEConstants=l(806),f.CoSEEdge=l(767),f.CoSEGraph=l(880),f.CoSEGraphManager=l(578),f.CoSELayout=l(765),f.CoSENode=l(991),f.ConstraintHandler=l(902),s.exports=f},806:(s,u,l)=>{var f=l(551).FDLayoutConstants;function v(){}for(var c in f)v[c]=f[c];v.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,v.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,v.DEFAULT_COMPONENT_SEPERATION=60,v.TILE=!0,v.TILING_PADDING_VERTICAL=10,v.TILING_PADDING_HORIZONTAL=10,v.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,v.ENFORCE_CONSTRAINTS=!0,v.APPLY_LAYOUT=!0,v.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,v.TREE_REDUCTION_ON_INCREMENTAL=!0,v.PURE_INCREMENTAL=v.DEFAULT_INCREMENTAL,s.exports=v},767:(s,u,l)=>{var f=l(551).FDLayoutEdge;function v(h,d,p){f.call(this,h,d,p)}v.prototype=Object.create(f.prototype);for(var c in f)v[c]=f[c];s.exports=v},880:(s,u,l)=>{var f=l(551).LGraph;function v(h,d,p){f.call(this,h,d,p)}v.prototype=Object.create(f.prototype);for(var c in f)v[c]=f[c];s.exports=v},578:(s,u,l)=>{var f=l(551).LGraphManager;function v(h){f.call(this,h)}v.prototype=Object.create(f.prototype);for(var c in f)v[c]=f[c];s.exports=v},765:(s,u,l)=>{var f=l(551).FDLayout,v=l(578),c=l(880),h=l(991),d=l(767),p=l(806),y=l(902),g=l(551).FDLayoutConstants,b=l(551).LayoutConstants,m=l(551).Point,w=l(551).PointD,T=l(551).DimensionD,D=l(551).Layout,x=l(551).Integer,M=l(551).IGeometry,P=l(551).LGraph,N=l(551).Transform,O=l(551).LinkedList;function R(){f.call(this),this.toBeTiled={},this.constraints={}}R.prototype=Object.create(f.prototype);for(var I in f)R[I]=f[I];R.prototype.newGraphManager=function(){var E=new v(this);return this.graphManager=E,E},R.prototype.newGraph=function(E){return new c(null,this.graphManager,E)},R.prototype.newNode=function(E){return new h(this.graphManager,E)},R.prototype.newEdge=function(E){return new d(null,null,E)},R.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(p.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=p.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=p.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=g.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=g.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},R.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/g.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},R.prototype.layout=function(){var E=b.DEFAULT_CREATE_BENDS_AS_NEEDED;return E&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},R.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(p.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var A=new Set(this.getAllNodes()),S=this.nodesWithGravity.filter(function(z){return A.has(z)});this.graphManager.setAllNodesToApplyGravitation(S)}}else{var E=this.getFlatForest();if(E.length>0)this.positionNodesRadially(E);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var A=new Set(this.getAllNodes()),S=this.nodesWithGravity.filter(function(C){return A.has(C)});this.graphManager.setAllNodesToApplyGravitation(S),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(y.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),p.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},R.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%g.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),A=this.nodesWithGravity.filter(function(L){return E.has(L)});this.graphManager.setAllNodesToApplyGravitation(A),this.graphManager.updateBounds(),this.updateGrid(),p.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=g.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()),p.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var S=!this.isTreeGrowing&&!this.isGrowthFinished,C=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(S,C),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},R.prototype.getPositionsData=function(){for(var E=this.graphManager.getAllNodes(),A={},S=0;S<E.length;S++){var C=E[S].rect,L=E[S].id;A[L]={id:L,x:C.getCenterX(),y:C.getCenterY(),w:C.width,h:C.height}}return A},R.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var E=!1;if(g.ANIMATE==="during")this.emit("layoutstarted");else{for(;!E;)E=this.tick();this.graphManager.updateBounds()}},R.prototype.moveNodes=function(){for(var E=this.getAllNodes(),A,S=0;S<E.length;S++)A=E[S],A.calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var S=0;S<E.length;S++)A=E[S],A.move()},R.prototype.initConstraintVariables=function(){var E=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var A=this.graphManager.getAllNodes(),S=0;S<A.length;S++){var C=A[S];this.idToNodeMap.set(C.id,C)}var L=function q(U){for(var Y=U.getChild().getNodes(),X,ee=0,te=0;te<Y.length;te++)X=Y[te],X.getChild()==null?E.fixedNodeSet.has(X.id)&&(ee+=100):ee+=q(X);return ee};if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(Y){E.fixedNodeSet.add(Y.nodeId)});for(var A=this.graphManager.getAllNodes(),C,S=0;S<A.length;S++)if(C=A[S],C.getChild()!=null){var z=L(C);z>0&&(C.fixedNodeWeight=z)}}if(this.constraints.relativePlacementConstraint){var k=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(q){E.fixedNodesOnHorizontal.add(q),E.fixedNodesOnVertical.add(q)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var H=this.constraints.alignmentConstraint.vertical,S=0;S<H.length;S++)this.dummyToNodeForVerticalAlignment.set("dummy"+S,[]),H[S].forEach(function(U){k.set(U,"dummy"+S),E.dummyToNodeForVerticalAlignment.get("dummy"+S).push(U),E.fixedNodeSet.has(U)&&E.fixedNodesOnHorizontal.add("dummy"+S)});if(this.constraints.alignmentConstraint.horizontal)for(var W=this.constraints.alignmentConstraint.horizontal,S=0;S<W.length;S++)this.dummyToNodeForHorizontalAlignment.set("dummy"+S,[]),W[S].forEach(function(U){F.set(U,"dummy"+S),E.dummyToNodeForHorizontalAlignment.get("dummy"+S).push(U),E.fixedNodeSet.has(U)&&E.fixedNodesOnVertical.add("dummy"+S)})}if(p.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(q){var U,Y,X;for(X=q.length-1;X>=2*q.length/3;X--)U=Math.floor(Math.random()*(X+1)),Y=q[X],q[X]=q[U],q[U]=Y;return q},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(q){if(q.left){var U=k.has(q.left)?k.get(q.left):q.left,Y=k.has(q.right)?k.get(q.right):q.right;E.nodesInRelativeHorizontal.includes(U)||(E.nodesInRelativeHorizontal.push(U),E.nodeToRelativeConstraintMapHorizontal.set(U,[]),E.dummyToNodeForVerticalAlignment.has(U)?E.nodeToTempPositionMapHorizontal.set(U,E.idToNodeMap.get(E.dummyToNodeForVerticalAlignment.get(U)[0]).getCenterX()):E.nodeToTempPositionMapHorizontal.set(U,E.idToNodeMap.get(U).getCenterX())),E.nodesInRelativeHorizontal.includes(Y)||(E.nodesInRelativeHorizontal.push(Y),E.nodeToRelativeConstraintMapHorizontal.set(Y,[]),E.dummyToNodeForVerticalAlignment.has(Y)?E.nodeToTempPositionMapHorizontal.set(Y,E.idToNodeMap.get(E.dummyToNodeForVerticalAlignment.get(Y)[0]).getCenterX()):E.nodeToTempPositionMapHorizontal.set(Y,E.idToNodeMap.get(Y).getCenterX())),E.nodeToRelativeConstraintMapHorizontal.get(U).push({right:Y,gap:q.gap}),E.nodeToRelativeConstraintMapHorizontal.get(Y).push({left:U,gap:q.gap})}else{var X=F.has(q.top)?F.get(q.top):q.top,ee=F.has(q.bottom)?F.get(q.bottom):q.bottom;E.nodesInRelativeVertical.includes(X)||(E.nodesInRelativeVertical.push(X),E.nodeToRelativeConstraintMapVertical.set(X,[]),E.dummyToNodeForHorizontalAlignment.has(X)?E.nodeToTempPositionMapVertical.set(X,E.idToNodeMap.get(E.dummyToNodeForHorizontalAlignment.get(X)[0]).getCenterY()):E.nodeToTempPositionMapVertical.set(X,E.idToNodeMap.get(X).getCenterY())),E.nodesInRelativeVertical.includes(ee)||(E.nodesInRelativeVertical.push(ee),E.nodeToRelativeConstraintMapVertical.set(ee,[]),E.dummyToNodeForHorizontalAlignment.has(ee)?E.nodeToTempPositionMapVertical.set(ee,E.idToNodeMap.get(E.dummyToNodeForHorizontalAlignment.get(ee)[0]).getCenterY()):E.nodeToTempPositionMapVertical.set(ee,E.idToNodeMap.get(ee).getCenterY())),E.nodeToRelativeConstraintMapVertical.get(X).push({bottom:ee,gap:q.gap}),E.nodeToRelativeConstraintMapVertical.get(ee).push({top:X,gap:q.gap})}});else{var Q=new Map,K=new Map;this.constraints.relativePlacementConstraint.forEach(function(q){if(q.left){var U=k.has(q.left)?k.get(q.left):q.left,Y=k.has(q.right)?k.get(q.right):q.right;Q.has(U)?Q.get(U).push(Y):Q.set(U,[Y]),Q.has(Y)?Q.get(Y).push(U):Q.set(Y,[U])}else{var X=F.has(q.top)?F.get(q.top):q.top,ee=F.has(q.bottom)?F.get(q.bottom):q.bottom;K.has(X)?K.get(X).push(ee):K.set(X,[ee]),K.has(ee)?K.get(ee).push(X):K.set(ee,[X])}});var Z=function(U,Y){var X=[],ee=[],te=new O,ge=new Set,Te=0;return U.forEach(function(pe,le){if(!ge.has(le)){X[Te]=[],ee[Te]=!1;var ce=le;for(te.push(ce),ge.add(ce),X[Te].push(ce);te.length!=0;){ce=te.shift(),Y.has(ce)&&(ee[Te]=!0);var ve=U.get(ce);ve.forEach(function(de){ge.has(de)||(te.push(de),ge.add(de),X[Te].push(de))})}Te++}}),{components:X,isFixed:ee}},j=Z(Q,E.fixedNodesOnHorizontal);this.componentsOnHorizontal=j.components,this.fixedComponentsOnHorizontal=j.isFixed;var re=Z(K,E.fixedNodesOnVertical);this.componentsOnVertical=re.components,this.fixedComponentsOnVertical=re.isFixed}}},R.prototype.updateDisplacements=function(){var E=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(re){var q=E.idToNodeMap.get(re.nodeId);q.displacementX=0,q.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var A=this.constraints.alignmentConstraint.vertical,S=0;S<A.length;S++){for(var C=0,L=0;L<A[S].length;L++){if(this.fixedNodeSet.has(A[S][L])){C=0;break}C+=this.idToNodeMap.get(A[S][L]).displacementX}for(var z=C/A[S].length,L=0;L<A[S].length;L++)this.idToNodeMap.get(A[S][L]).displacementX=z}if(this.constraints.alignmentConstraint.horizontal)for(var k=this.constraints.alignmentConstraint.horizontal,S=0;S<k.length;S++){for(var F=0,L=0;L<k[S].length;L++){if(this.fixedNodeSet.has(k[S][L])){F=0;break}F+=this.idToNodeMap.get(k[S][L]).displacementY}for(var H=F/k[S].length,L=0;L<k[S].length;L++)this.idToNodeMap.get(k[S][L]).displacementY=H}}if(this.constraints.relativePlacementConstraint)if(p.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(re){if(!E.fixedNodesOnHorizontal.has(re)){var q=0;E.dummyToNodeForVerticalAlignment.has(re)?q=E.idToNodeMap.get(E.dummyToNodeForVerticalAlignment.get(re)[0]).displacementX:q=E.idToNodeMap.get(re).displacementX,E.nodeToRelativeConstraintMapHorizontal.get(re).forEach(function(U){if(U.right){var Y=E.nodeToTempPositionMapHorizontal.get(U.right)-E.nodeToTempPositionMapHorizontal.get(re)-q;Y<U.gap&&(q-=U.gap-Y)}else{var Y=E.nodeToTempPositionMapHorizontal.get(re)-E.nodeToTempPositionMapHorizontal.get(U.left)+q;Y<U.gap&&(q+=U.gap-Y)}}),E.nodeToTempPositionMapHorizontal.set(re,E.nodeToTempPositionMapHorizontal.get(re)+q),E.dummyToNodeForVerticalAlignment.has(re)?E.dummyToNodeForVerticalAlignment.get(re).forEach(function(U){E.idToNodeMap.get(U).displacementX=q}):E.idToNodeMap.get(re).displacementX=q}}),this.nodesInRelativeVertical.forEach(function(re){if(!E.fixedNodesOnHorizontal.has(re)){var q=0;E.dummyToNodeForHorizontalAlignment.has(re)?q=E.idToNodeMap.get(E.dummyToNodeForHorizontalAlignment.get(re)[0]).displacementY:q=E.idToNodeMap.get(re).displacementY,E.nodeToRelativeConstraintMapVertical.get(re).forEach(function(U){if(U.bottom){var Y=E.nodeToTempPositionMapVertical.get(U.bottom)-E.nodeToTempPositionMapVertical.get(re)-q;Y<U.gap&&(q-=U.gap-Y)}else{var Y=E.nodeToTempPositionMapVertical.get(re)-E.nodeToTempPositionMapVertical.get(U.top)+q;Y<U.gap&&(q+=U.gap-Y)}}),E.nodeToTempPositionMapVertical.set(re,E.nodeToTempPositionMapVertical.get(re)+q),E.dummyToNodeForHorizontalAlignment.has(re)?E.dummyToNodeForHorizontalAlignment.get(re).forEach(function(U){E.idToNodeMap.get(U).displacementY=q}):E.idToNodeMap.get(re).displacementY=q}});else{for(var S=0;S<this.componentsOnHorizontal.length;S++){var W=this.componentsOnHorizontal[S];if(this.fixedComponentsOnHorizontal[S])for(var L=0;L<W.length;L++)this.dummyToNodeForVerticalAlignment.has(W[L])?this.dummyToNodeForVerticalAlignment.get(W[L]).forEach(function(U){E.idToNodeMap.get(U).displacementX=0}):this.idToNodeMap.get(W[L]).displacementX=0;else{for(var Q=0,K=0,L=0;L<W.length;L++)if(this.dummyToNodeForVerticalAlignment.has(W[L])){var Z=this.dummyToNodeForVerticalAlignment.get(W[L]);Q+=Z.length*this.idToNodeMap.get(Z[0]).displacementX,K+=Z.length}else Q+=this.idToNodeMap.get(W[L]).displacementX,K++;for(var j=Q/K,L=0;L<W.length;L++)this.dummyToNodeForVerticalAlignment.has(W[L])?this.dummyToNodeForVerticalAlignment.get(W[L]).forEach(function(U){E.idToNodeMap.get(U).displacementX=j}):this.idToNodeMap.get(W[L]).displacementX=j}}for(var S=0;S<this.componentsOnVertical.length;S++){var W=this.componentsOnVertical[S];if(this.fixedComponentsOnVertical[S])for(var L=0;L<W.length;L++)this.dummyToNodeForHorizontalAlignment.has(W[L])?this.dummyToNodeForHorizontalAlignment.get(W[L]).forEach(function(Y){E.idToNodeMap.get(Y).displacementY=0}):this.idToNodeMap.get(W[L]).displacementY=0;else{for(var Q=0,K=0,L=0;L<W.length;L++)if(this.dummyToNodeForHorizontalAlignment.has(W[L])){var Z=this.dummyToNodeForHorizontalAlignment.get(W[L]);Q+=Z.length*this.idToNodeMap.get(Z[0]).displacementY,K+=Z.length}else Q+=this.idToNodeMap.get(W[L]).displacementY,K++;for(var j=Q/K,L=0;L<W.length;L++)this.dummyToNodeForHorizontalAlignment.has(W[L])?this.dummyToNodeForHorizontalAlignment.get(W[L]).forEach(function(te){E.idToNodeMap.get(te).displacementY=j}):this.idToNodeMap.get(W[L]).displacementY=j}}}},R.prototype.calculateNodesToApplyGravitationTo=function(){var E=[],A,S=this.graphManager.getGraphs(),C=S.length,L;for(L=0;L<C;L++)A=S[L],A.updateConnected(),A.isConnected||(E=E.concat(A.getNodes()));return E},R.prototype.createBendpoints=function(){var E=[];E=E.concat(this.graphManager.getAllEdges());var A=new Set,S;for(S=0;S<E.length;S++){var C=E[S];if(!A.has(C)){var L=C.getSource(),z=C.getTarget();if(L==z)C.getBendpoints().push(new w),C.getBendpoints().push(new w),this.createDummyNodesForBendpoints(C),A.add(C);else{var k=[];if(k=k.concat(L.getEdgeListToNode(z)),k=k.concat(z.getEdgeListToNode(L)),!A.has(k[0])){if(k.length>1){var F;for(F=0;F<k.length;F++){var H=k[F];H.getBendpoints().push(new w),this.createDummyNodesForBendpoints(H)}}k.forEach(function(W){A.add(W)})}}}if(A.size==E.length)break}},R.prototype.positionNodesRadially=function(E){for(var A=new m(0,0),S=Math.ceil(Math.sqrt(E.length)),C=0,L=0,z=0,k=new w(0,0),F=0;F<E.length;F++){F%S==0&&(z=0,L=C,F!=0&&(L+=p.DEFAULT_COMPONENT_SEPERATION),C=0);var H=E[F],W=D.findCenterOfTree(H);A.x=z,A.y=L,k=R.radialLayout(H,W,A),k.y>C&&(C=Math.floor(k.y)),z=Math.floor(k.x+p.DEFAULT_COMPONENT_SEPERATION)}this.transform(new w(b.WORLD_CENTER_X-k.x/2,b.WORLD_CENTER_Y-k.y/2))},R.radialLayout=function(E,A,S){var C=Math.max(this.maxDiagonalInTree(E),p.DEFAULT_RADIAL_SEPARATION);R.branchRadialLayout(A,null,0,359,0,C);var L=P.calculateBounds(E),z=new N;z.setDeviceOrgX(L.getMinX()),z.setDeviceOrgY(L.getMinY()),z.setWorldOrgX(S.x),z.setWorldOrgY(S.y);for(var k=0;k<E.length;k++){var F=E[k];F.transform(z)}var H=new w(L.getMaxX(),L.getMaxY());return z.inverseTransformPoint(H)},R.branchRadialLayout=function(E,A,S,C,L,z){var k=(C-S+1)/2;k<0&&(k+=180);var F=(k+S)%360,H=F*M.TWO_PI/360,W=L*Math.cos(H),Q=L*Math.sin(H);E.setCenter(W,Q);var K=[];K=K.concat(E.getEdges());var Z=K.length;A!=null&&Z--;for(var j=0,re=K.length,q,U=E.getEdgesBetween(A);U.length>1;){var Y=U[0];U.splice(0,1);var X=K.indexOf(Y);X>=0&&K.splice(X,1),re--,Z--}A!=null?q=(K.indexOf(U[0])+1)%re:q=0;for(var ee=Math.abs(C-S)/Z,te=q;j!=Z;te=++te%re){var ge=K[te].getOtherEnd(E);if(ge!=A){var Te=(S+j*ee)%360,pe=(Te+ee)%360;R.branchRadialLayout(ge,E,Te,pe,L+z,z),j++}}},R.maxDiagonalInTree=function(E){for(var A=x.MIN_VALUE,S=0;S<E.length;S++){var C=E[S],L=C.getDiagonal();L>A&&(A=L)}return A},R.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},R.prototype.groupZeroDegreeMembers=function(){var E=this,A={};this.memberGroups={},this.idToDummyNode={};for(var S=[],C=this.graphManager.getAllNodes(),L=0;L<C.length;L++){var z=C[L],k=z.getParent();this.getNodeDegreeWithChildren(z)===0&&(k.id==null||!this.getToBeTiled(k))&&S.push(z)}for(var L=0;L<S.length;L++){var z=S[L],F=z.getParent().id;typeof A[F]>"u"&&(A[F]=[]),A[F]=A[F].concat(z)}Object.keys(A).forEach(function(H){if(A[H].length>1){var W="DummyCompound_"+H;E.memberGroups[W]=A[H];var Q=A[H][0].getParent(),K=new h(E.graphManager);K.id=W,K.paddingLeft=Q.paddingLeft||0,K.paddingRight=Q.paddingRight||0,K.paddingBottom=Q.paddingBottom||0,K.paddingTop=Q.paddingTop||0,E.idToDummyNode[W]=K;var Z=E.getGraphManager().add(E.newGraph(),K),j=Q.getChild();j.add(K);for(var re=0;re<A[H].length;re++){var q=A[H][re];j.remove(q),Z.add(q)}}})},R.prototype.clearCompounds=function(){var E={},A={};this.performDFSOnCompounds();for(var S=0;S<this.compoundOrder.length;S++)A[this.compoundOrder[S].id]=this.compoundOrder[S],E[this.compoundOrder[S].id]=[].concat(this.compoundOrder[S].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[S].getChild()),this.compoundOrder[S].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(E,A)},R.prototype.clearZeroDegreeMembers=function(){var E=this,A=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(S){var C=E.idToDummyNode[S];if(A[S]=E.tileNodes(E.memberGroups[S],C.paddingLeft+C.paddingRight),C.rect.width=A[S].width,C.rect.height=A[S].height,C.setCenter(A[S].centerX,A[S].centerY),C.labelMarginLeft=0,C.labelMarginTop=0,p.NODE_DIMENSIONS_INCLUDE_LABELS){var L=C.rect.width,z=C.rect.height;C.labelWidth&&(C.labelPosHorizontal=="left"?(C.rect.x-=C.labelWidth,C.setWidth(L+C.labelWidth),C.labelMarginLeft=C.labelWidth):C.labelPosHorizontal=="center"&&C.labelWidth>L?(C.rect.x-=(C.labelWidth-L)/2,C.setWidth(C.labelWidth),C.labelMarginLeft=(C.labelWidth-L)/2):C.labelPosHorizontal=="right"&&C.setWidth(L+C.labelWidth)),C.labelHeight&&(C.labelPosVertical=="top"?(C.rect.y-=C.labelHeight,C.setHeight(z+C.labelHeight),C.labelMarginTop=C.labelHeight):C.labelPosVertical=="center"&&C.labelHeight>z?(C.rect.y-=(C.labelHeight-z)/2,C.setHeight(C.labelHeight),C.labelMarginTop=(C.labelHeight-z)/2):C.labelPosVertical=="bottom"&&C.setHeight(z+C.labelHeight))}})},R.prototype.repopulateCompounds=function(){for(var E=this.compoundOrder.length-1;E>=0;E--){var A=this.compoundOrder[E],S=A.id,C=A.paddingLeft,L=A.paddingTop,z=A.labelMarginLeft,k=A.labelMarginTop;this.adjustLocations(this.tiledMemberPack[S],A.rect.x,A.rect.y,C,L,z,k)}},R.prototype.repopulateZeroDegreeMembers=function(){var E=this,A=this.tiledZeroDegreePack;Object.keys(A).forEach(function(S){var C=E.idToDummyNode[S],L=C.paddingLeft,z=C.paddingTop,k=C.labelMarginLeft,F=C.labelMarginTop;E.adjustLocations(A[S],C.rect.x,C.rect.y,L,z,k,F)})},R.prototype.getToBeTiled=function(E){var A=E.id;if(this.toBeTiled[A]!=null)return this.toBeTiled[A];var S=E.getChild();if(S==null)return this.toBeTiled[A]=!1,!1;for(var C=S.getNodes(),L=0;L<C.length;L++){var z=C[L];if(this.getNodeDegree(z)>0)return this.toBeTiled[A]=!1,!1;if(z.getChild()==null){this.toBeTiled[z.id]=!1;continue}if(!this.getToBeTiled(z))return this.toBeTiled[A]=!1,!1}return this.toBeTiled[A]=!0,!0},R.prototype.getNodeDegree=function(E){E.id;for(var A=E.getEdges(),S=0,C=0;C<A.length;C++){var L=A[C];L.getSource().id!==L.getTarget().id&&(S=S+1)}return S},R.prototype.getNodeDegreeWithChildren=function(E){var A=this.getNodeDegree(E);if(E.getChild()==null)return A;for(var S=E.getChild().getNodes(),C=0;C<S.length;C++){var L=S[C];A+=this.getNodeDegreeWithChildren(L)}return A},R.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},R.prototype.fillCompexOrderByDFS=function(E){for(var A=0;A<E.length;A++){var S=E[A];S.getChild()!=null&&this.fillCompexOrderByDFS(S.getChild().getNodes()),this.getToBeTiled(S)&&this.compoundOrder.push(S)}},R.prototype.adjustLocations=function(E,A,S,C,L,z,k){A+=C+z,S+=L+k;for(var F=A,H=0;H<E.rows.length;H++){var W=E.rows[H];A=F;for(var Q=0,K=0;K<W.length;K++){var Z=W[K];Z.rect.x=A,Z.rect.y=S,A+=Z.rect.width+E.horizontalPadding,Z.rect.height>Q&&(Q=Z.rect.height)}S+=Q+E.verticalPadding}},R.prototype.tileCompoundMembers=function(E,A){var S=this;this.tiledMemberPack=[],Object.keys(E).forEach(function(C){var L=A[C];if(S.tiledMemberPack[C]=S.tileNodes(E[C],L.paddingLeft+L.paddingRight),L.rect.width=S.tiledMemberPack[C].width,L.rect.height=S.tiledMemberPack[C].height,L.setCenter(S.tiledMemberPack[C].centerX,S.tiledMemberPack[C].centerY),L.labelMarginLeft=0,L.labelMarginTop=0,p.NODE_DIMENSIONS_INCLUDE_LABELS){var z=L.rect.width,k=L.rect.height;L.labelWidth&&(L.labelPosHorizontal=="left"?(L.rect.x-=L.labelWidth,L.setWidth(z+L.labelWidth),L.labelMarginLeft=L.labelWidth):L.labelPosHorizontal=="center"&&L.labelWidth>z?(L.rect.x-=(L.labelWidth-z)/2,L.setWidth(L.labelWidth),L.labelMarginLeft=(L.labelWidth-z)/2):L.labelPosHorizontal=="right"&&L.setWidth(z+L.labelWidth)),L.labelHeight&&(L.labelPosVertical=="top"?(L.rect.y-=L.labelHeight,L.setHeight(k+L.labelHeight),L.labelMarginTop=L.labelHeight):L.labelPosVertical=="center"&&L.labelHeight>k?(L.rect.y-=(L.labelHeight-k)/2,L.setHeight(L.labelHeight),L.labelMarginTop=(L.labelHeight-k)/2):L.labelPosVertical=="bottom"&&L.setHeight(k+L.labelHeight))}})},R.prototype.tileNodes=function(E,A){var S=this.tileNodesByFavoringDim(E,A,!0),C=this.tileNodesByFavoringDim(E,A,!1),L=this.getOrgRatio(S),z=this.getOrgRatio(C),k;return z<L?k=C:k=S,k},R.prototype.getOrgRatio=function(E){var A=E.width,S=E.height,C=A/S;return C<1&&(C=1/C),C},R.prototype.calcIdealRowWidth=function(E,A){var S=p.TILING_PADDING_VERTICAL,C=p.TILING_PADDING_HORIZONTAL,L=E.length,z=0,k=0,F=0;E.forEach(function(re){z+=re.getWidth(),k+=re.getHeight(),re.getWidth()>F&&(F=re.getWidth())});var H=z/L,W=k/L,Q=Math.pow(S-C,2)+4*(H+C)*(W+S)*L,K=(C-S+Math.sqrt(Q))/(2*(H+C)),Z;A?(Z=Math.ceil(K),Z==K&&Z++):Z=Math.floor(K);var j=Z*(H+C)-C;return F>j&&(j=F),j+=C*2,j},R.prototype.tileNodesByFavoringDim=function(E,A,S){var C=p.TILING_PADDING_VERTICAL,L=p.TILING_PADDING_HORIZONTAL,z=p.TILING_COMPARE_BY,k={rows:[],rowWidth:[],rowHeight:[],width:0,height:A,verticalPadding:C,horizontalPadding:L,centerX:0,centerY:0};z&&(k.idealRowWidth=this.calcIdealRowWidth(E,S));var F=function(q){return q.rect.width*q.rect.height},H=function(q,U){return F(U)-F(q)};E.sort(function(re,q){var U=H;return k.idealRowWidth?(U=z,U(re.id,q.id)):U(re,q)});for(var W=0,Q=0,K=0;K<E.length;K++){var Z=E[K];W+=Z.getCenterX(),Q+=Z.getCenterY()}k.centerX=W/E.length,k.centerY=Q/E.length;for(var K=0;K<E.length;K++){var Z=E[K];if(k.rows.length==0)this.insertNodeToRow(k,Z,0,A);else if(this.canAddHorizontal(k,Z.rect.width,Z.rect.height)){var j=k.rows.length-1;k.idealRowWidth||(j=this.getShortestRowIndex(k)),this.insertNodeToRow(k,Z,j,A)}else this.insertNodeToRow(k,Z,k.rows.length,A);this.shiftToLastRow(k)}return k},R.prototype.insertNodeToRow=function(E,A,S,C){var L=C;if(S==E.rows.length){var z=[];E.rows.push(z),E.rowWidth.push(L),E.rowHeight.push(0)}var k=E.rowWidth[S]+A.rect.width;E.rows[S].length>0&&(k+=E.horizontalPadding),E.rowWidth[S]=k,E.width<k&&(E.width=k);var F=A.rect.height;S>0&&(F+=E.verticalPadding);var H=0;F>E.rowHeight[S]&&(H=E.rowHeight[S],E.rowHeight[S]=F,H=E.rowHeight[S]-H),E.height+=H,E.rows[S].push(A)},R.prototype.getShortestRowIndex=function(E){for(var A=-1,S=Number.MAX_VALUE,C=0;C<E.rows.length;C++)E.rowWidth[C]<S&&(A=C,S=E.rowWidth[C]);return A},R.prototype.getLongestRowIndex=function(E){for(var A=-1,S=Number.MIN_VALUE,C=0;C<E.rows.length;C++)E.rowWidth[C]>S&&(A=C,S=E.rowWidth[C]);return A},R.prototype.canAddHorizontal=function(E,A,S){if(E.idealRowWidth){var C=E.rows.length-1,L=E.rowWidth[C];return L+A+E.horizontalPadding<=E.idealRowWidth}var z=this.getShortestRowIndex(E);if(z<0)return!0;var k=E.rowWidth[z];if(k+E.horizontalPadding+A<=E.width)return!0;var F=0;E.rowHeight[z]<S&&z>0&&(F=S+E.verticalPadding-E.rowHeight[z]);var H;E.width-k>=A+E.horizontalPadding?H=(E.height+F)/(k+A+E.horizontalPadding):H=(E.height+F)/E.width,F=S+E.verticalPadding;var W;return E.width<A?W=(E.height+F)/A:W=(E.height+F)/E.width,W<1&&(W=1/W),H<1&&(H=1/H),H<W},R.prototype.shiftToLastRow=function(E){var A=this.getLongestRowIndex(E),S=E.rowWidth.length-1,C=E.rows[A],L=C[C.length-1],z=L.width+E.horizontalPadding;if(E.width-E.rowWidth[S]>z&&A!=S){C.splice(-1,1),E.rows[S].push(L),E.rowWidth[A]=E.rowWidth[A]-z,E.rowWidth[S]=E.rowWidth[S]+z,E.width=E.rowWidth[instance.getLongestRowIndex(E)];for(var k=Number.MIN_VALUE,F=0;F<C.length;F++)C[F].height>k&&(k=C[F].height);A>0&&(k+=E.verticalPadding);var H=E.rowHeight[A]+E.rowHeight[S];E.rowHeight[A]=k,E.rowHeight[S]<L.height+E.verticalPadding&&(E.rowHeight[S]=L.height+E.verticalPadding);var W=E.rowHeight[A]+E.rowHeight[S];E.height+=W-H,this.shiftToLastRow(E)}},R.prototype.tilingPreLayout=function(){p.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},R.prototype.tilingPostLayout=function(){p.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},R.prototype.reduceTrees=function(){for(var E=[],A=!0,S;A;){var C=this.graphManager.getAllNodes(),L=[];A=!1;for(var z=0;z<C.length;z++)if(S=C[z],S.getEdges().length==1&&!S.getEdges()[0].isInterGraph&&S.getChild()==null){if(p.PURE_INCREMENTAL){var k=S.getEdges()[0].getOtherEnd(S),F=new T(S.getCenterX()-k.getCenterX(),S.getCenterY()-k.getCenterY());L.push([S,S.getEdges()[0],S.getOwner(),F])}else L.push([S,S.getEdges()[0],S.getOwner()]);A=!0}if(A==!0){for(var H=[],W=0;W<L.length;W++)L[W][0].getEdges().length==1&&(H.push(L[W]),L[W][0].getOwner().remove(L[W][0]));E.push(H),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=E},R.prototype.growTree=function(E){for(var A=E.length,S=E[A-1],C,L=0;L<S.length;L++)C=S[L],this.findPlaceforPrunedNode(C),C[2].add(C[0]),C[2].add(C[1],C[1].source,C[1].target);E.splice(E.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},R.prototype.findPlaceforPrunedNode=function(E){var A,S,C=E[0];if(C==E[1].source?S=E[1].target:S=E[1].source,p.PURE_INCREMENTAL)C.setCenter(S.getCenterX()+E[3].getWidth(),S.getCenterY()+E[3].getHeight());else{var L=S.startX,z=S.finishX,k=S.startY,F=S.finishY,H=0,W=0,Q=0,K=0,Z=[H,Q,W,K];if(k>0)for(var j=L;j<=z;j++)Z[0]+=this.grid[j][k-1].length+this.grid[j][k].length-1;if(z<this.grid.length-1)for(var j=k;j<=F;j++)Z[1]+=this.grid[z+1][j].length+this.grid[z][j].length-1;if(F<this.grid[0].length-1)for(var j=L;j<=z;j++)Z[2]+=this.grid[j][F+1].length+this.grid[j][F].length-1;if(L>0)for(var j=k;j<=F;j++)Z[3]+=this.grid[L-1][j].length+this.grid[L][j].length-1;for(var re=x.MAX_VALUE,q,U,Y=0;Y<Z.length;Y++)Z[Y]<re?(re=Z[Y],q=1,U=Y):Z[Y]==re&&q++;if(q==3&&re==0)Z[0]==0&&Z[1]==0&&Z[2]==0?A=1:Z[0]==0&&Z[1]==0&&Z[3]==0?A=0:Z[0]==0&&Z[2]==0&&Z[3]==0?A=3:Z[1]==0&&Z[2]==0&&Z[3]==0&&(A=2);else if(q==2&&re==0){var X=Math.floor(Math.random()*2);Z[0]==0&&Z[1]==0?X==0?A=0:A=1:Z[0]==0&&Z[2]==0?X==0?A=0:A=2:Z[0]==0&&Z[3]==0?X==0?A=0:A=3:Z[1]==0&&Z[2]==0?X==0?A=1:A=2:Z[1]==0&&Z[3]==0?X==0?A=1:A=3:X==0?A=2:A=3}else if(q==4&&re==0){var X=Math.floor(Math.random()*4);A=X}else A=U;A==0?C.setCenter(S.getCenterX(),S.getCenterY()-S.getHeight()/2-g.DEFAULT_EDGE_LENGTH-C.getHeight()/2):A==1?C.setCenter(S.getCenterX()+S.getWidth()/2+g.DEFAULT_EDGE_LENGTH+C.getWidth()/2,S.getCenterY()):A==2?C.setCenter(S.getCenterX(),S.getCenterY()+S.getHeight()/2+g.DEFAULT_EDGE_LENGTH+C.getHeight()/2):C.setCenter(S.getCenterX()-S.getWidth()/2-g.DEFAULT_EDGE_LENGTH-C.getWidth()/2,S.getCenterY())}},s.exports=R},991:(s,u,l)=>{var f=l(551).FDLayoutNode,v=l(551).IMath;function c(d,p,y,g){f.call(this,d,p,y,g)}c.prototype=Object.create(f.prototype);for(var h in f)c[h]=f[h];c.prototype.calculateDisplacement=function(){var d=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementX=d.coolingFactor*d.maxNodeDisplacement*v.sign(this.displacementX)),Math.abs(this.displacementY)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementY=d.coolingFactor*d.maxNodeDisplacement*v.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},c.prototype.propogateDisplacementToChildren=function(d,p){for(var y=this.getChild().getNodes(),g,b=0;b<y.length;b++)g=y[b],g.getChild()==null?(g.displacementX+=d,g.displacementY+=p):g.propogateDisplacementToChildren(d,p)},c.prototype.move=function(){var d=this.graphManager.getLayout();(this.child==null||this.child.getNodes().length==0)&&(this.moveBy(this.displacementX,this.displacementY),d.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},c.prototype.setPred1=function(d){this.pred1=d},c.prototype.getPred1=function(){return pred1},c.prototype.getPred2=function(){return pred2},c.prototype.setNext=function(d){this.next=d},c.prototype.getNext=function(){return next},c.prototype.setProcessed=function(d){this.processed=d},c.prototype.isProcessed=function(){return processed},s.exports=c},902:(s,u,l)=>{function f(y){if(Array.isArray(y)){for(var g=0,b=Array(y.length);g<y.length;g++)b[g]=y[g];return b}else return Array.from(y)}var v=l(806),c=l(551).LinkedList,h=l(551).Matrix,d=l(551).SVD;function p(){}p.handleConstraints=function(y){var g={};g.fixedNodeConstraint=y.constraints.fixedNodeConstraint,g.alignmentConstraint=y.constraints.alignmentConstraint,g.relativePlacementConstraint=y.constraints.relativePlacementConstraint;for(var b=new Map,m=new Map,w=[],T=[],D=y.getAllNodes(),x=0,M=0;M<D.length;M++){var P=D[M];P.getChild()==null&&(m.set(P.id,x++),w.push(P.getCenterX()),T.push(P.getCenterY()),b.set(P.id,P))}g.relativePlacementConstraint&&g.relativePlacementConstraint.forEach(function(V){!V.gap&&V.gap!=0&&(V.left?V.gap=v.DEFAULT_EDGE_LENGTH+b.get(V.left).getWidth()/2+b.get(V.right).getWidth()/2:V.gap=v.DEFAULT_EDGE_LENGTH+b.get(V.top).getHeight()/2+b.get(V.bottom).getHeight()/2)});var N=function(G,$){return{x:G.x-$.x,y:G.y-$.y}},O=function(G){var $=0,ae=0;return G.forEach(function(J){$+=w[m.get(J)],ae+=T[m.get(J)]}),{x:$/G.size,y:ae/G.size}},R=function(G,$,ae,J,ne){function ie(Ae,Se){var Pe=new Set(Ae),De=!0,xe=!1,qe=void 0;try{for(var ke=Se[Symbol.iterator](),Re;!(De=(Re=ke.next()).done);De=!0){var rt=Re.value;Pe.add(rt)}}catch(Ke){xe=!0,qe=Ke}finally{try{!De&&ke.return&&ke.return()}finally{if(xe)throw qe}}return Pe}var ue=new Map;G.forEach(function(Ae,Se){ue.set(Se,0)}),G.forEach(function(Ae,Se){Ae.forEach(function(Pe){ue.set(Pe.id,ue.get(Pe.id)+1)})});var fe=new Map,se=new Map,he=new c;ue.forEach(function(Ae,Se){Ae==0?(he.push(Se),ae||($=="horizontal"?fe.set(Se,m.has(Se)?w[m.get(Se)]:J.get(Se)):fe.set(Se,m.has(Se)?T[m.get(Se)]:J.get(Se)))):fe.set(Se,Number.NEGATIVE_INFINITY),ae&&se.set(Se,new Set([Se]))}),ae&&ne.forEach(function(Ae){var Se=[];if(Ae.forEach(function(xe){ae.has(xe)&&Se.push(xe)}),Se.length>0){var Pe=0;Se.forEach(function(xe){$=="horizontal"?(fe.set(xe,m.has(xe)?w[m.get(xe)]:J.get(xe)),Pe+=fe.get(xe)):(fe.set(xe,m.has(xe)?T[m.get(xe)]:J.get(xe)),Pe+=fe.get(xe))}),Pe=Pe/Se.length,Ae.forEach(function(xe){ae.has(xe)||fe.set(xe,Pe)})}else{var De=0;Ae.forEach(function(xe){$=="horizontal"?De+=m.has(xe)?w[m.get(xe)]:J.get(xe):De+=m.has(xe)?T[m.get(xe)]:J.get(xe)}),De=De/Ae.length,Ae.forEach(function(xe){fe.set(xe,De)})}});for(var Ce=function(){var Se=he.shift(),Pe=G.get(Se);Pe.forEach(function(De){if(fe.get(De.id)<fe.get(Se)+De.gap)if(ae&&ae.has(De.id)){var xe=void 0;if($=="horizontal"?xe=m.has(De.id)?w[m.get(De.id)]:J.get(De.id):xe=m.has(De.id)?T[m.get(De.id)]:J.get(De.id),fe.set(De.id,xe),xe<fe.get(Se)+De.gap){var qe=fe.get(Se)+De.gap-xe;se.get(Se).forEach(function(ke){fe.set(ke,fe.get(ke)-qe)})}}else fe.set(De.id,fe.get(Se)+De.gap);ue.set(De.id,ue.get(De.id)-1),ue.get(De.id)==0&&he.push(De.id),ae&&se.set(De.id,ie(se.get(Se),se.get(De.id)))})};he.length!=0;)Ce();if(ae){var Ee=new Set;G.forEach(function(Ae,Se){Ae.length==0&&Ee.add(Se)});var Ve=[];se.forEach(function(Ae,Se){if(Ee.has(Se)){var Pe=!1,De=!0,xe=!1,qe=void 0;try{for(var ke=Ae[Symbol.iterator](),Re;!(De=(Re=ke.next()).done);De=!0){var rt=Re.value;ae.has(rt)&&(Pe=!0)}}catch(Qe){xe=!0,qe=Qe}finally{try{!De&&ke.return&&ke.return()}finally{if(xe)throw qe}}if(!Pe){var Ke=!1,st=void 0;Ve.forEach(function(Qe,Et){Qe.has([].concat(f(Ae))[0])&&(Ke=!0,st=Et)}),Ke?Ae.forEach(function(Qe){Ve[st].add(Qe)}):Ve.push(new Set(Ae))}}}),Ve.forEach(function(Ae,Se){var Pe=Number.POSITIVE_INFINITY,De=Number.POSITIVE_INFINITY,xe=Number.NEGATIVE_INFINITY,qe=Number.NEGATIVE_INFINITY,ke=!0,Re=!1,rt=void 0;try{for(var Ke=Ae[Symbol.iterator](),st;!(ke=(st=Ke.next()).done);ke=!0){var Qe=st.value,Et=void 0;$=="horizontal"?Et=m.has(Qe)?w[m.get(Qe)]:J.get(Qe):Et=m.has(Qe)?T[m.get(Qe)]:J.get(Qe);var ft=fe.get(Qe);Et<Pe&&(Pe=Et),Et>xe&&(xe=Et),ft<De&&(De=ft),ft>qe&&(qe=ft)}}catch(Ar){Re=!0,rt=Ar}finally{try{!ke&&Ke.return&&Ke.return()}finally{if(Re)throw rt}}var ut=(Pe+xe)/2-(De+qe)/2,lt=!0,Gt=!1,yt=void 0;try{for(var Jt=Ae[Symbol.iterator](),ya;!(lt=(ya=Jt.next()).done);lt=!0){var Sr=ya.value;fe.set(Sr,fe.get(Sr)+ut)}}catch(Ar){Gt=!0,yt=Ar}finally{try{!lt&&Jt.return&&Jt.return()}finally{if(Gt)throw yt}}})}return fe},I=function(G){var $=0,ae=0,J=0,ne=0;if(G.forEach(function(se){se.left?w[m.get(se.left)]-w[m.get(se.right)]>=0?$++:ae++:T[m.get(se.top)]-T[m.get(se.bottom)]>=0?J++:ne++}),$>ae&&J>ne)for(var ie=0;ie<m.size;ie++)w[ie]=-1*w[ie],T[ie]=-1*T[ie];else if($>ae)for(var ue=0;ue<m.size;ue++)w[ue]=-1*w[ue];else if(J>ne)for(var fe=0;fe<m.size;fe++)T[fe]=-1*T[fe]},E=function(G){var $=[],ae=new c,J=new Set,ne=0;return G.forEach(function(ie,ue){if(!J.has(ue)){$[ne]=[];var fe=ue;for(ae.push(fe),J.add(fe),$[ne].push(fe);ae.length!=0;){fe=ae.shift();var se=G.get(fe);se.forEach(function(he){J.has(he.id)||(ae.push(he.id),J.add(he.id),$[ne].push(he.id))})}ne++}}),$},A=function(G){var $=new Map;return G.forEach(function(ae,J){$.set(J,[])}),G.forEach(function(ae,J){ae.forEach(function(ne){$.get(J).push(ne),$.get(ne.id).push({id:J,gap:ne.gap,direction:ne.direction})})}),$},S=function(G){var $=new Map;return G.forEach(function(ae,J){$.set(J,[])}),G.forEach(function(ae,J){ae.forEach(function(ne){$.get(ne.id).push({id:J,gap:ne.gap,direction:ne.direction})})}),$},C=[],L=[],z=!1,k=!1,F=new Set,H=new Map,W=new Map,Q=[];if(g.fixedNodeConstraint&&g.fixedNodeConstraint.forEach(function(V){F.add(V.nodeId)}),g.relativePlacementConstraint&&(g.relativePlacementConstraint.forEach(function(V){V.left?(H.has(V.left)?H.get(V.left).push({id:V.right,gap:V.gap,direction:"horizontal"}):H.set(V.left,[{id:V.right,gap:V.gap,direction:"horizontal"}]),H.has(V.right)||H.set(V.right,[])):(H.has(V.top)?H.get(V.top).push({id:V.bottom,gap:V.gap,direction:"vertical"}):H.set(V.top,[{id:V.bottom,gap:V.gap,direction:"vertical"}]),H.has(V.bottom)||H.set(V.bottom,[]))}),W=A(H),Q=E(W)),v.TRANSFORM_ON_CONSTRAINT_HANDLING){if(g.fixedNodeConstraint&&g.fixedNodeConstraint.length>1)g.fixedNodeConstraint.forEach(function(V,G){C[G]=[V.position.x,V.position.y],L[G]=[w[m.get(V.nodeId)],T[m.get(V.nodeId)]]}),z=!0;else if(g.alignmentConstraint)(function(){var V=0;if(g.alignmentConstraint.vertical){for(var G=g.alignmentConstraint.vertical,$=function(fe){var se=new Set;G[fe].forEach(function(Ee){se.add(Ee)});var he=new Set([].concat(f(se)).filter(function(Ee){return F.has(Ee)})),Ce=void 0;he.size>0?Ce=w[m.get(he.values().next().value)]:Ce=O(se).x,G[fe].forEach(function(Ee){C[V]=[Ce,T[m.get(Ee)]],L[V]=[w[m.get(Ee)],T[m.get(Ee)]],V++})},ae=0;ae<G.length;ae++)$(ae);z=!0}if(g.alignmentConstraint.horizontal){for(var J=g.alignmentConstraint.horizontal,ne=function(fe){var se=new Set;J[fe].forEach(function(Ee){se.add(Ee)});var he=new Set([].concat(f(se)).filter(function(Ee){return F.has(Ee)})),Ce=void 0;he.size>0?Ce=w[m.get(he.values().next().value)]:Ce=O(se).y,J[fe].forEach(function(Ee){C[V]=[w[m.get(Ee)],Ce],L[V]=[w[m.get(Ee)],T[m.get(Ee)]],V++})},ie=0;ie<J.length;ie++)ne(ie);z=!0}g.relativePlacementConstraint&&(k=!0)})();else if(g.relativePlacementConstraint){for(var K=0,Z=0,j=0;j<Q.length;j++)Q[j].length>K&&(K=Q[j].length,Z=j);if(K<W.size/2)I(g.relativePlacementConstraint),z=!1,k=!1;else{var re=new Map,q=new Map,U=[];Q[Z].forEach(function(V){H.get(V).forEach(function(G){G.direction=="horizontal"?(re.has(V)?re.get(V).push(G):re.set(V,[G]),re.has(G.id)||re.set(G.id,[]),U.push({left:V,right:G.id})):(q.has(V)?q.get(V).push(G):q.set(V,[G]),q.has(G.id)||q.set(G.id,[]),U.push({top:V,bottom:G.id}))})}),I(U),k=!1;var Y=R(re,"horizontal"),X=R(q,"vertical");Q[Z].forEach(function(V,G){L[G]=[w[m.get(V)],T[m.get(V)]],C[G]=[],Y.has(V)?C[G][0]=Y.get(V):C[G][0]=w[m.get(V)],X.has(V)?C[G][1]=X.get(V):C[G][1]=T[m.get(V)]}),z=!0}}if(z){for(var ee=void 0,te=h.transpose(C),ge=h.transpose(L),Te=0;Te<te.length;Te++)te[Te]=h.multGamma(te[Te]),ge[Te]=h.multGamma(ge[Te]);var pe=h.multMat(te,h.transpose(ge)),le=d.svd(pe);ee=h.multMat(le.V,h.transpose(le.U));for(var ce=0;ce<m.size;ce++){var ve=[w[ce],T[ce]],de=[ee[0][0],ee[1][0]],me=[ee[0][1],ee[1][1]];w[ce]=h.dotProduct(ve,de),T[ce]=h.dotProduct(ve,me)}k&&I(g.relativePlacementConstraint)}}if(v.ENFORCE_CONSTRAINTS){if(g.fixedNodeConstraint&&g.fixedNodeConstraint.length>0){var ye={x:0,y:0};g.fixedNodeConstraint.forEach(function(V,G){var $={x:w[m.get(V.nodeId)],y:T[m.get(V.nodeId)]},ae=V.position,J=N(ae,$);ye.x+=J.x,ye.y+=J.y}),ye.x/=g.fixedNodeConstraint.length,ye.y/=g.fixedNodeConstraint.length,w.forEach(function(V,G){w[G]+=ye.x}),T.forEach(function(V,G){T[G]+=ye.y}),g.fixedNodeConstraint.forEach(function(V){w[m.get(V.nodeId)]=V.position.x,T[m.get(V.nodeId)]=V.position.y})}if(g.alignmentConstraint){if(g.alignmentConstraint.vertical)for(var we=g.alignmentConstraint.vertical,Me=function(G){var $=new Set;we[G].forEach(function(ne){$.add(ne)});var ae=new Set([].concat(f($)).filter(function(ne){return F.has(ne)})),J=void 0;ae.size>0?J=w[m.get(ae.values().next().value)]:J=O($).x,$.forEach(function(ne){F.has(ne)||(w[m.get(ne)]=J)})},Ie=0;Ie<we.length;Ie++)Me(Ie);if(g.alignmentConstraint.horizontal)for(var Be=g.alignmentConstraint.horizontal,Fe=function(G){var $=new Set;Be[G].forEach(function(ne){$.add(ne)});var ae=new Set([].concat(f($)).filter(function(ne){return F.has(ne)})),J=void 0;ae.size>0?J=T[m.get(ae.values().next().value)]:J=O($).y,$.forEach(function(ne){F.has(ne)||(T[m.get(ne)]=J)})},oe=0;oe<Be.length;oe++)Fe(oe)}g.relativePlacementConstraint&&function(){var V=new Map,G=new Map,$=new Map,ae=new Map,J=new Map,ne=new Map,ie=new Set,ue=new Set;if(F.forEach(function(_e){ie.add(_e),ue.add(_e)}),g.alignmentConstraint){if(g.alignmentConstraint.vertical)for(var fe=g.alignmentConstraint.vertical,se=function(ze){$.set("dummy"+ze,[]),fe[ze].forEach(function(We){V.set(We,"dummy"+ze),$.get("dummy"+ze).push(We),F.has(We)&&ie.add("dummy"+ze)}),J.set("dummy"+ze,w[m.get(fe[ze][0])])},he=0;he<fe.length;he++)se(he);if(g.alignmentConstraint.horizontal)for(var Ce=g.alignmentConstraint.horizontal,Ee=function(ze){ae.set("dummy"+ze,[]),Ce[ze].forEach(function(We){G.set(We,"dummy"+ze),ae.get("dummy"+ze).push(We),F.has(We)&&ue.add("dummy"+ze)}),ne.set("dummy"+ze,T[m.get(Ce[ze][0])])},Ve=0;Ve<Ce.length;Ve++)Ee(Ve)}var Ae=new Map,Se=new Map,Pe=function(ze){H.get(ze).forEach(function(We){var Bt=void 0,nt=void 0;We.direction=="horizontal"?(Bt=V.get(ze)?V.get(ze):ze,V.get(We.id)?nt={id:V.get(We.id),gap:We.gap,direction:We.direction}:nt=We,Ae.has(Bt)?Ae.get(Bt).push(nt):Ae.set(Bt,[nt]),Ae.has(nt.id)||Ae.set(nt.id,[])):(Bt=G.get(ze)?G.get(ze):ze,G.get(We.id)?nt={id:G.get(We.id),gap:We.gap,direction:We.direction}:nt=We,Se.has(Bt)?Se.get(Bt).push(nt):Se.set(Bt,[nt]),Se.has(nt.id)||Se.set(nt.id,[]))})},De=!0,xe=!1,qe=void 0;try{for(var ke=H.keys()[Symbol.iterator](),Re;!(De=(Re=ke.next()).done);De=!0){var rt=Re.value;Pe(rt)}}catch(_e){xe=!0,qe=_e}finally{try{!De&&ke.return&&ke.return()}finally{if(xe)throw qe}}var Ke=A(Ae),st=A(Se),Qe=E(Ke),Et=E(st),ft=S(Ae),ut=S(Se),lt=[],Gt=[];Qe.forEach(function(_e,ze){lt[ze]=[],_e.forEach(function(We){ft.get(We).length==0&&lt[ze].push(We)})}),Et.forEach(function(_e,ze){Gt[ze]=[],_e.forEach(function(We){ut.get(We).length==0&&Gt[ze].push(We)})});var yt=R(Ae,"horizontal",ie,J,lt),Jt=R(Se,"vertical",ue,ne,Gt),ya=function(ze){$.get(ze)?$.get(ze).forEach(function(We){w[m.get(We)]=yt.get(ze)}):w[m.get(ze)]=yt.get(ze)},Sr=!0,Ar=!1,li=void 0;try{for(var en=yt.keys()[Symbol.iterator](),fi;!(Sr=(fi=en.next()).done);Sr=!0){var tn=fi.value;ya(tn)}}catch(_e){Ar=!0,li=_e}finally{try{!Sr&&en.return&&en.return()}finally{if(Ar)throw li}}var Ur=function(ze){ae.get(ze)?ae.get(ze).forEach(function(We){T[m.get(We)]=Jt.get(ze)}):T[m.get(ze)]=Jt.get(ze)},Hr=!0,qr=!1,rn=void 0;try{for(var ma=Jt.keys()[Symbol.iterator](),vi;!(Hr=(vi=ma.next()).done);Hr=!0){var tn=vi.value;Ur(tn)}}catch(_e){qr=!0,rn=_e}finally{try{!Hr&&ma.return&&ma.return()}finally{if(qr)throw rn}}}()}for(var B=0;B<D.length;B++){var _=D[B];_.getChild()==null&&_.setCenter(w[m.get(_.id)],T[m.get(_.id)])}},s.exports=p},551:s=>{s.exports=r}},n={};function i(s){var u=n[s];if(u!==void 0)return u.exports;var l=n[s]={exports:{}};return a[s](l,l.exports,i),l.exports}var o=i(45);return o})()})}(si)),si.exports}var Ym=oi.exports,ih;function Wm(){return ih||(ih=1,function(t,e){(function(a,n){t.exports=n(qm())})(Ym,function(r){return(()=>{var a={658:s=>{s.exports=Object.assign!=null?Object.assign.bind(Object):function(u){for(var l=arguments.length,f=Array(l>1?l-1:0),v=1;v<l;v++)f[v-1]=arguments[v];return f.forEach(function(c){Object.keys(c).forEach(function(h){return u[h]=c[h]})}),u}},548:(s,u,l)=>{var f=function(){function h(d,p){var y=[],g=!0,b=!1,m=void 0;try{for(var w=d[Symbol.iterator](),T;!(g=(T=w.next()).done)&&(y.push(T.value),!(p&&y.length===p));g=!0);}catch(D){b=!0,m=D}finally{try{!g&&w.return&&w.return()}finally{if(b)throw m}}return y}return function(d,p){if(Array.isArray(d))return d;if(Symbol.iterator in Object(d))return h(d,p);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),v=l(140).layoutBase.LinkedList,c={};c.getTopMostNodes=function(h){for(var d={},p=0;p<h.length;p++)d[h[p].id()]=!0;var y=h.filter(function(g,b){typeof g=="number"&&(g=b);for(var m=g.parent()[0];m!=null;){if(d[m.id()])return!1;m=m.parent()[0]}return!0});return y},c.connectComponents=function(h,d,p,y){var g=new v,b=new Set,m=[],w=void 0,T=void 0,D=void 0,x=!1,M=1,P=[],N=[],O=function(){var I=h.collection();N.push(I);var E=p[0],A=h.collection();A.merge(E).merge(E.descendants().intersection(d)),m.push(E),A.forEach(function(L){g.push(L),b.add(L),I.merge(L)});for(var S=function(){E=g.shift();var z=h.collection();E.neighborhood().nodes().forEach(function(W){d.intersection(E.edgesWith(W)).length>0&&z.merge(W)});for(var k=0;k<z.length;k++){var F=z[k];if(w=p.intersection(F.union(F.ancestors())),w!=null&&!b.has(w[0])){var H=w.union(w.descendants());H.forEach(function(W){g.push(W),b.add(W),I.merge(W),p.has(W)&&m.push(W)})}}};g.length!=0;)S();if(I.forEach(function(L){d.intersection(L.connectedEdges()).forEach(function(z){I.has(z.source())&&I.has(z.target())&&I.merge(z)})}),m.length==p.length&&(x=!0),!x||x&&M>1){T=m[0],D=T.connectedEdges().length,m.forEach(function(L){L.connectedEdges().length<D&&(D=L.connectedEdges().length,T=L)}),P.push(T.id());var C=h.collection();C.merge(m[0]),m.forEach(function(L){C.merge(L)}),m=[],p=p.difference(C),M++}};do O();while(!x);return y&&P.length>0&&y.set("dummy"+(y.size+1),P),N},c.relocateComponent=function(h,d,p){if(!p.fixedNodeConstraint){var y=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,b=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY;if(p.quality=="draft"){var w=!0,T=!1,D=void 0;try{for(var x=d.nodeIndexes[Symbol.iterator](),M;!(w=(M=x.next()).done);w=!0){var P=M.value,N=f(P,2),O=N[0],R=N[1],I=p.cy.getElementById(O);if(I){var E=I.boundingBox(),A=d.xCoords[R]-E.w/2,S=d.xCoords[R]+E.w/2,C=d.yCoords[R]-E.h/2,L=d.yCoords[R]+E.h/2;A<y&&(y=A),S>g&&(g=S),C<b&&(b=C),L>m&&(m=L)}}}catch(W){T=!0,D=W}finally{try{!w&&x.return&&x.return()}finally{if(T)throw D}}var z=h.x-(g+y)/2,k=h.y-(m+b)/2;d.xCoords=d.xCoords.map(function(W){return W+z}),d.yCoords=d.yCoords.map(function(W){return W+k})}else{Object.keys(d).forEach(function(W){var Q=d[W],K=Q.getRect().x,Z=Q.getRect().x+Q.getRect().width,j=Q.getRect().y,re=Q.getRect().y+Q.getRect().height;K<y&&(y=K),Z>g&&(g=Z),j<b&&(b=j),re>m&&(m=re)});var F=h.x-(g+y)/2,H=h.y-(m+b)/2;Object.keys(d).forEach(function(W){var Q=d[W];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+H)})}}},c.calcBoundingBox=function(h,d,p,y){for(var g=Number.MAX_SAFE_INTEGER,b=Number.MIN_SAFE_INTEGER,m=Number.MAX_SAFE_INTEGER,w=Number.MIN_SAFE_INTEGER,T=void 0,D=void 0,x=void 0,M=void 0,P=h.descendants().not(":parent"),N=P.length,O=0;O<N;O++){var R=P[O];T=d[y.get(R.id())]-R.width()/2,D=d[y.get(R.id())]+R.width()/2,x=p[y.get(R.id())]-R.height()/2,M=p[y.get(R.id())]+R.height()/2,g>T&&(g=T),b<D&&(b=D),m>x&&(m=x),w<M&&(w=M)}var I={};return I.topLeftX=g,I.topLeftY=m,I.width=b-g,I.height=w-m,I},c.calcParentsWithoutChildren=function(h,d){var p=h.collection();return d.nodes(":parent").forEach(function(y){var g=!1;y.children().forEach(function(b){b.css("display")!="none"&&(g=!0)}),g||p.merge(y)}),p},s.exports=c},816:(s,u,l)=>{var f=l(548),v=l(140).CoSELayout,c=l(140).CoSENode,h=l(140).layoutBase.PointD,d=l(140).layoutBase.DimensionD,p=l(140).layoutBase.LayoutConstants,y=l(140).layoutBase.FDLayoutConstants,g=l(140).CoSEConstants,b=function(w,T){var D=w.cy,x=w.eles,M=x.nodes(),P=x.edges(),N=void 0,O=void 0,R=void 0,I={};w.randomize&&(N=T.nodeIndexes,O=T.xCoords,R=T.yCoords);var E=function(W){return typeof W=="function"},A=function(W,Q){return E(W)?W(Q):W},S=f.calcParentsWithoutChildren(D,x),C=function H(W,Q,K,Z){for(var j=Q.length,re=0;re<j;re++){var q=Q[re],U=null;q.intersection(S).length==0&&(U=q.children());var Y=void 0,X=q.layoutDimensions({nodeDimensionsIncludeLabels:Z.nodeDimensionsIncludeLabels});if(q.outerWidth()!=null&&q.outerHeight()!=null)if(Z.randomize)if(!q.isParent())Y=W.add(new c(K.graphManager,new h(O[N.get(q.id())]-X.w/2,R[N.get(q.id())]-X.h/2),new d(parseFloat(X.w),parseFloat(X.h))));else{var ee=f.calcBoundingBox(q,O,R,N);q.intersection(S).length==0?Y=W.add(new c(K.graphManager,new h(ee.topLeftX,ee.topLeftY),new d(ee.width,ee.height))):Y=W.add(new c(K.graphManager,new h(ee.topLeftX,ee.topLeftY),new d(parseFloat(X.w),parseFloat(X.h))))}else Y=W.add(new c(K.graphManager,new h(q.position("x")-X.w/2,q.position("y")-X.h/2),new d(parseFloat(X.w),parseFloat(X.h))));else Y=W.add(new c(this.graphManager));if(Y.id=q.data("id"),Y.nodeRepulsion=A(Z.nodeRepulsion,q),Y.paddingLeft=parseInt(q.css("padding")),Y.paddingTop=parseInt(q.css("padding")),Y.paddingRight=parseInt(q.css("padding")),Y.paddingBottom=parseInt(q.css("padding")),Z.nodeDimensionsIncludeLabels&&(Y.labelWidth=q.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,Y.labelHeight=q.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,Y.labelPosVertical=q.css("text-valign"),Y.labelPosHorizontal=q.css("text-halign")),I[q.data("id")]=Y,isNaN(Y.rect.x)&&(Y.rect.x=0),isNaN(Y.rect.y)&&(Y.rect.y=0),U!=null&&U.length>0){var te=void 0;te=K.getGraphManager().add(K.newGraph(),Y),H(te,U,K,Z)}}},L=function(W,Q,K){for(var Z=0,j=0,re=0;re<K.length;re++){var q=K[re],U=I[q.data("source")],Y=I[q.data("target")];if(U&&Y&&U!==Y&&U.getEdgesBetween(Y).length==0){var X=Q.add(W.newEdge(),U,Y);X.id=q.id(),X.idealLength=A(w.idealEdgeLength,q),X.edgeElasticity=A(w.edgeElasticity,q),Z+=X.idealLength,j++}}w.idealEdgeLength!=null&&(j>0?g.DEFAULT_EDGE_LENGTH=y.DEFAULT_EDGE_LENGTH=Z/j:E(w.idealEdgeLength)?g.DEFAULT_EDGE_LENGTH=y.DEFAULT_EDGE_LENGTH=50:g.DEFAULT_EDGE_LENGTH=y.DEFAULT_EDGE_LENGTH=w.idealEdgeLength,g.MIN_REPULSION_DIST=y.MIN_REPULSION_DIST=y.DEFAULT_EDGE_LENGTH/10,g.DEFAULT_RADIAL_SEPARATION=y.DEFAULT_EDGE_LENGTH)},z=function(W,Q){Q.fixedNodeConstraint&&(W.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(W.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(W.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};w.nestingFactor!=null&&(g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=y.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=w.nestingFactor),w.gravity!=null&&(g.DEFAULT_GRAVITY_STRENGTH=y.DEFAULT_GRAVITY_STRENGTH=w.gravity),w.numIter!=null&&(g.MAX_ITERATIONS=y.MAX_ITERATIONS=w.numIter),w.gravityRange!=null&&(g.DEFAULT_GRAVITY_RANGE_FACTOR=y.DEFAULT_GRAVITY_RANGE_FACTOR=w.gravityRange),w.gravityCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=y.DEFAULT_COMPOUND_GRAVITY_STRENGTH=w.gravityCompound),w.gravityRangeCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=y.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=w.gravityRangeCompound),w.initialEnergyOnIncremental!=null&&(g.DEFAULT_COOLING_FACTOR_INCREMENTAL=y.DEFAULT_COOLING_FACTOR_INCREMENTAL=w.initialEnergyOnIncremental),w.tilingCompareBy!=null&&(g.TILING_COMPARE_BY=w.tilingCompareBy),w.quality=="proof"?p.QUALITY=2:p.QUALITY=0,g.NODE_DIMENSIONS_INCLUDE_LABELS=y.NODE_DIMENSIONS_INCLUDE_LABELS=p.NODE_DIMENSIONS_INCLUDE_LABELS=w.nodeDimensionsIncludeLabels,g.DEFAULT_INCREMENTAL=y.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!w.randomize,g.ANIMATE=y.ANIMATE=p.ANIMATE=w.animate,g.TILE=w.tile,g.TILING_PADDING_VERTICAL=typeof w.tilingPaddingVertical=="function"?w.tilingPaddingVertical.call():w.tilingPaddingVertical,g.TILING_PADDING_HORIZONTAL=typeof w.tilingPaddingHorizontal=="function"?w.tilingPaddingHorizontal.call():w.tilingPaddingHorizontal,g.DEFAULT_INCREMENTAL=y.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!0,g.PURE_INCREMENTAL=!w.randomize,p.DEFAULT_UNIFORM_LEAF_NODE_SIZES=w.uniformNodeDimensions,w.step=="transformed"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!1),w.step=="enforced"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!1),w.step=="cose"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!0),w.step=="all"&&(w.randomize?g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!0),w.fixedNodeConstraint||w.alignmentConstraint||w.relativePlacementConstraint?g.TREE_REDUCTION_ON_INCREMENTAL=!1:g.TREE_REDUCTION_ON_INCREMENTAL=!0;var k=new v,F=k.newGraphManager();return C(F.addRoot(),f.getTopMostNodes(M),k,w),L(k,F,P),z(k,w),k.runLayout(),I};s.exports={coseLayout:b}},212:(s,u,l)=>{var f=function(){function w(T,D){for(var x=0;x<D.length;x++){var M=D[x];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(T,M.key,M)}}return function(T,D,x){return D&&w(T.prototype,D),x&&w(T,x),T}}();function v(w,T){if(!(w instanceof T))throw new TypeError("Cannot call a class as a function")}var c=l(658),h=l(548),d=l(657),p=d.spectralLayout,y=l(816),g=y.coseLayout,b=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(T){return 4500},idealEdgeLength:function(T){return 50},edgeElasticity:function(T){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),m=function(){function w(T){v(this,w),this.options=c({},b,T)}return f(w,[{key:"run",value:function(){var D=this,x=this.options,M=x.cy,P=x.eles,N=[],O=[],R=void 0,I=[];x.fixedNodeConstraint&&(!Array.isArray(x.fixedNodeConstraint)||x.fixedNodeConstraint.length==0)&&(x.fixedNodeConstraint=void 0),x.alignmentConstraint&&(x.alignmentConstraint.vertical&&(!Array.isArray(x.alignmentConstraint.vertical)||x.alignmentConstraint.vertical.length==0)&&(x.alignmentConstraint.vertical=void 0),x.alignmentConstraint.horizontal&&(!Array.isArray(x.alignmentConstraint.horizontal)||x.alignmentConstraint.horizontal.length==0)&&(x.alignmentConstraint.horizontal=void 0)),x.relativePlacementConstraint&&(!Array.isArray(x.relativePlacementConstraint)||x.relativePlacementConstraint.length==0)&&(x.relativePlacementConstraint=void 0);var E=x.fixedNodeConstraint||x.alignmentConstraint||x.relativePlacementConstraint;E&&(x.tile=!1,x.packComponents=!1);var A=void 0,S=!1;if(M.layoutUtilities&&x.packComponents&&(A=M.layoutUtilities("get"),A||(A=M.layoutUtilities()),S=!0),P.nodes().length>0)if(S){var z=h.getTopMostNodes(x.eles.nodes());if(R=h.connectComponents(M,x.eles,z),R.forEach(function(pe){var le=pe.boundingBox();I.push({x:le.x1+le.w/2,y:le.y1+le.h/2})}),x.randomize&&R.forEach(function(pe){x.eles=pe,N.push(p(x))}),x.quality=="default"||x.quality=="proof"){var k=M.collection();if(x.tile){var F=new Map,H=[],W=[],Q=0,K={nodeIndexes:F,xCoords:H,yCoords:W},Z=[];if(R.forEach(function(pe,le){pe.edges().length==0&&(pe.nodes().forEach(function(ce,ve){k.merge(pe.nodes()[ve]),ce.isParent()||(K.nodeIndexes.set(pe.nodes()[ve].id(),Q++),K.xCoords.push(pe.nodes()[0].position().x),K.yCoords.push(pe.nodes()[0].position().y))}),Z.push(le))}),k.length>1){var j=k.boundingBox();I.push({x:j.x1+j.w/2,y:j.y1+j.h/2}),R.push(k),N.push(K);for(var re=Z.length-1;re>=0;re--)R.splice(Z[re],1),N.splice(Z[re],1),I.splice(Z[re],1)}}R.forEach(function(pe,le){x.eles=pe,O.push(g(x,N[le])),h.relocateComponent(I[le],O[le],x)})}else R.forEach(function(pe,le){h.relocateComponent(I[le],N[le],x)});var q=new Set;if(R.length>1){var U=[],Y=P.filter(function(pe){return pe.css("display")=="none"});R.forEach(function(pe,le){var ce=void 0;if(x.quality=="draft"&&(ce=N[le].nodeIndexes),pe.nodes().not(Y).length>0){var ve={};ve.edges=[],ve.nodes=[];var de=void 0;pe.nodes().not(Y).forEach(function(me){if(x.quality=="draft")if(!me.isParent())de=ce.get(me.id()),ve.nodes.push({x:N[le].xCoords[de]-me.boundingbox().w/2,y:N[le].yCoords[de]-me.boundingbox().h/2,width:me.boundingbox().w,height:me.boundingbox().h});else{var ye=h.calcBoundingBox(me,N[le].xCoords,N[le].yCoords,ce);ve.nodes.push({x:ye.topLeftX,y:ye.topLeftY,width:ye.width,height:ye.height})}else O[le][me.id()]&&ve.nodes.push({x:O[le][me.id()].getLeft(),y:O[le][me.id()].getTop(),width:O[le][me.id()].getWidth(),height:O[le][me.id()].getHeight()})}),pe.edges().forEach(function(me){var ye=me.source(),we=me.target();if(ye.css("display")!="none"&&we.css("display")!="none")if(x.quality=="draft"){var Me=ce.get(ye.id()),Ie=ce.get(we.id()),Be=[],Fe=[];if(ye.isParent()){var oe=h.calcBoundingBox(ye,N[le].xCoords,N[le].yCoords,ce);Be.push(oe.topLeftX+oe.width/2),Be.push(oe.topLeftY+oe.height/2)}else Be.push(N[le].xCoords[Me]),Be.push(N[le].yCoords[Me]);if(we.isParent()){var B=h.calcBoundingBox(we,N[le].xCoords,N[le].yCoords,ce);Fe.push(B.topLeftX+B.width/2),Fe.push(B.topLeftY+B.height/2)}else Fe.push(N[le].xCoords[Ie]),Fe.push(N[le].yCoords[Ie]);ve.edges.push({startX:Be[0],startY:Be[1],endX:Fe[0],endY:Fe[1]})}else O[le][ye.id()]&&O[le][we.id()]&&ve.edges.push({startX:O[le][ye.id()].getCenterX(),startY:O[le][ye.id()].getCenterY(),endX:O[le][we.id()].getCenterX(),endY:O[le][we.id()].getCenterY()})}),ve.nodes.length>0&&(U.push(ve),q.add(le))}});var X=A.packComponents(U,x.randomize).shifts;if(x.quality=="draft")N.forEach(function(pe,le){var ce=pe.xCoords.map(function(de){return de+X[le].dx}),ve=pe.yCoords.map(function(de){return de+X[le].dy});pe.xCoords=ce,pe.yCoords=ve});else{var ee=0;q.forEach(function(pe){Object.keys(O[pe]).forEach(function(le){var ce=O[pe][le];ce.setCenter(ce.getCenterX()+X[ee].dx,ce.getCenterY()+X[ee].dy)}),ee++})}}}else{var C=x.eles.boundingBox();if(I.push({x:C.x1+C.w/2,y:C.y1+C.h/2}),x.randomize){var L=p(x);N.push(L)}x.quality=="default"||x.quality=="proof"?(O.push(g(x,N[0])),h.relocateComponent(I[0],O[0],x)):h.relocateComponent(I[0],N[0],x)}var te=function(le,ce){if(x.quality=="default"||x.quality=="proof"){typeof le=="number"&&(le=ce);var ve=void 0,de=void 0,me=le.data("id");return O.forEach(function(we){me in we&&(ve={x:we[me].getRect().getCenterX(),y:we[me].getRect().getCenterY()},de=we[me])}),x.nodeDimensionsIncludeLabels&&(de.labelWidth&&(de.labelPosHorizontal=="left"?ve.x+=de.labelWidth/2:de.labelPosHorizontal=="right"&&(ve.x-=de.labelWidth/2)),de.labelHeight&&(de.labelPosVertical=="top"?ve.y+=de.labelHeight/2:de.labelPosVertical=="bottom"&&(ve.y-=de.labelHeight/2))),ve==null&&(ve={x:le.position("x"),y:le.position("y")}),{x:ve.x,y:ve.y}}else{var ye=void 0;return N.forEach(function(we){var Me=we.nodeIndexes.get(le.id());Me!=null&&(ye={x:we.xCoords[Me],y:we.yCoords[Me]})}),ye==null&&(ye={x:le.position("x"),y:le.position("y")}),{x:ye.x,y:ye.y}}};if(x.quality=="default"||x.quality=="proof"||x.randomize){var ge=h.calcParentsWithoutChildren(M,P),Te=P.filter(function(pe){return pe.css("display")=="none"});x.eles=P.not(Te),P.nodes().not(":parent").not(Te).layoutPositions(D,x,te),ge.length>0&&ge.forEach(function(pe){pe.position(te(pe))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),w}();s.exports=m},657:(s,u,l)=>{var f=l(548),v=l(140).layoutBase.Matrix,c=l(140).layoutBase.SVD,h=function(p){var y=p.cy,g=p.eles,b=g.nodes(),m=g.nodes(":parent"),w=new Map,T=new Map,D=new Map,x=[],M=[],P=[],N=[],O=[],R=[],I=[],E=[],A=void 0,S=1e8,C=1e-9,L=p.piTol,z=p.samplingType,k=p.nodeSeparation,F=void 0,H=function(){for(var G=0,$=0,ae=!1;$<F;){G=Math.floor(Math.random()*A),ae=!1;for(var J=0;J<$;J++)if(N[J]==G){ae=!0;break}if(!ae)N[$]=G,$++;else continue}},W=function(G,$,ae){for(var J=[],ne=0,ie=0,ue=0,fe=void 0,se=[],he=0,Ce=1,Ee=0;Ee<A;Ee++)se[Ee]=S;for(J[ie]=G,se[G]=0;ie>=ne;){ue=J[ne++];for(var Ve=x[ue],Ae=0;Ae<Ve.length;Ae++)fe=T.get(Ve[Ae]),se[fe]==S&&(se[fe]=se[ue]+1,J[++ie]=fe);R[ue][$]=se[ue]*k}if(ae){for(var Se=0;Se<A;Se++)R[Se][$]<O[Se]&&(O[Se]=R[Se][$]);for(var Pe=0;Pe<A;Pe++)O[Pe]>he&&(he=O[Pe],Ce=Pe)}return Ce},Q=function(G){var $=void 0;if(G){$=Math.floor(Math.random()*A);for(var J=0;J<A;J++)O[J]=S;for(var ne=0;ne<F;ne++)N[ne]=$,$=W($,ne,G)}else{H();for(var ae=0;ae<F;ae++)W(N[ae],ae,G)}for(var ie=0;ie<A;ie++)for(var ue=0;ue<F;ue++)R[ie][ue]*=R[ie][ue];for(var fe=0;fe<F;fe++)I[fe]=[];for(var se=0;se<F;se++)for(var he=0;he<F;he++)I[se][he]=R[N[he]][se]},K=function(){for(var G=c.svd(I),$=G.S,ae=G.U,J=G.V,ne=$[0]*$[0]*$[0],ie=[],ue=0;ue<F;ue++){ie[ue]=[];for(var fe=0;fe<F;fe++)ie[ue][fe]=0,ue==fe&&(ie[ue][fe]=$[ue]/($[ue]*$[ue]+ne/($[ue]*$[ue])))}E=v.multMat(v.multMat(J,ie),v.transpose(ae))},Z=function(){for(var G=void 0,$=void 0,ae=[],J=[],ne=[],ie=[],ue=0;ue<A;ue++)ae[ue]=Math.random(),J[ue]=Math.random();ae=v.normalize(ae),J=v.normalize(J);for(var fe=C,se=C,he=void 0;;){for(var Ce=0;Ce<A;Ce++)ne[Ce]=ae[Ce];if(ae=v.multGamma(v.multL(v.multGamma(ne),R,E)),G=v.dotProduct(ne,ae),ae=v.normalize(ae),fe=v.dotProduct(ne,ae),he=Math.abs(fe/se),he<=1+L&&he>=1)break;se=fe}for(var Ee=0;Ee<A;Ee++)ne[Ee]=ae[Ee];for(se=C;;){for(var Ve=0;Ve<A;Ve++)ie[Ve]=J[Ve];if(ie=v.minusOp(ie,v.multCons(ne,v.dotProduct(ne,ie))),J=v.multGamma(v.multL(v.multGamma(ie),R,E)),$=v.dotProduct(ie,J),J=v.normalize(J),fe=v.dotProduct(ie,J),he=Math.abs(fe/se),he<=1+L&&he>=1)break;se=fe}for(var Ae=0;Ae<A;Ae++)ie[Ae]=J[Ae];M=v.multCons(ne,Math.sqrt(Math.abs(G))),P=v.multCons(ie,Math.sqrt(Math.abs($)))};f.connectComponents(y,g,f.getTopMostNodes(b),w),m.forEach(function(V){f.connectComponents(y,g,f.getTopMostNodes(V.descendants().intersection(g)),w)});for(var j=0,re=0;re<b.length;re++)b[re].isParent()||T.set(b[re].id(),j++);var q=!0,U=!1,Y=void 0;try{for(var X=w.keys()[Symbol.iterator](),ee;!(q=(ee=X.next()).done);q=!0){var te=ee.value;T.set(te,j++)}}catch(V){U=!0,Y=V}finally{try{!q&&X.return&&X.return()}finally{if(U)throw Y}}for(var ge=0;ge<T.size;ge++)x[ge]=[];m.forEach(function(V){for(var G=V.children().intersection(g);G.nodes(":childless").length==0;)G=G.nodes()[0].children().intersection(g);var $=0,ae=G.nodes(":childless")[0].connectedEdges().length;G.nodes(":childless").forEach(function(J,ne){J.connectedEdges().length<ae&&(ae=J.connectedEdges().length,$=ne)}),D.set(V.id(),G.nodes(":childless")[$].id())}),b.forEach(function(V){var G=void 0;V.isParent()?G=T.get(D.get(V.id())):G=T.get(V.id()),V.neighborhood().nodes().forEach(function($){g.intersection(V.edgesWith($)).length>0&&($.isParent()?x[G].push(D.get($.id())):x[G].push($.id()))})});var Te=function(G){var $=T.get(G),ae=void 0;w.get(G).forEach(function(J){y.getElementById(J).isParent()?ae=D.get(J):ae=J,x[$].push(ae),x[T.get(ae)].push(G)})},pe=!0,le=!1,ce=void 0;try{for(var ve=w.keys()[Symbol.iterator](),de;!(pe=(de=ve.next()).done);pe=!0){var me=de.value;Te(me)}}catch(V){le=!0,ce=V}finally{try{!pe&&ve.return&&ve.return()}finally{if(le)throw ce}}A=T.size;var ye=void 0;if(A>2){F=A<p.sampleSize?A:p.sampleSize;for(var we=0;we<A;we++)R[we]=[];for(var Me=0;Me<F;Me++)E[Me]=[];return p.quality=="draft"||p.step=="all"?(Q(z),K(),Z(),ye={nodeIndexes:T,xCoords:M,yCoords:P}):(T.forEach(function(V,G){M.push(y.getElementById(G).position("x")),P.push(y.getElementById(G).position("y"))}),ye={nodeIndexes:T,xCoords:M,yCoords:P}),ye}else{var Ie=T.keys(),Be=y.getElementById(Ie.next().value),Fe=Be.position(),oe=Be.outerWidth();if(M.push(Fe.x),P.push(Fe.y),A==2){var B=y.getElementById(Ie.next().value),_=B.outerWidth();M.push(Fe.x+oe/2+_/2+p.idealEdgeLength),P.push(Fe.y)}return ye={nodeIndexes:T,xCoords:M,yCoords:P},ye}};s.exports={spectralLayout:h}},579:(s,u,l)=>{var f=l(212),v=function(h){h&&h("layout","fcose",f)};typeof cytoscape<"u"&&v(cytoscape),s.exports=v},140:s=>{s.exports=r}},n={};function i(s){var u=n[s];if(u!==void 0)return u.exports;var l=n[s]={exports:{}};return a[s](l,l.exports,i),l.exports}var o=i(579);return o})()})}(oi)),oi.exports}var Xm=Wm(),$m=Vm(Xm);function Km(t,{nodes:e,edges:r,options:a}){return new Promise((n,i)=>{let o=null;try{o=t({headless:!0,styleEnabled:!0,style:[{selector:"node",style:{width:"data(size)",height:"data(size)"}}],elements:[...e.map(u=>({data:{id:u.id,size:u.size||8}})),...r.map(u=>({data:{id:u.id,source:u.source,target:u.target}}))]});const s=o.layout({...a,animate:!1});s.one("layoutstop",()=>{const u={};o.nodes().forEach(l=>{const f=l.position();u[l.id()]={x:f.x,y:f.y}}),o.destroy(),n(u)}),s.run()}catch(s){o&&!o.destroyed()&&o.destroy(),i(s)}})}Cr.use($m),self.onmessage=t=>{const{id:e,nodes:r,edges:a,options:n}=t.data||{};Km(Cr,{nodes:r,edges:a,options:n}).then(i=>self.postMessage({id:e,positions:i})).catch(i=>self.postMessage({id:e,error:String(i&&i.message||i)}))}})();