You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
422 KiB
1 line
422 KiB
"use strict";(self.webpackChunkjupyter_web=self.webpackChunkjupyter_web||[]).push([[574],{90574:(bm,Nf,zf)=>{function Yn(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t<e;t++)a[t]=r[t];return a}function Jr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function jr(r,e,t){return e&&function qf(r,e){for(var t=0;t<e.length;t++){var a=e[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,mo(a.key),a)}}(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function br(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Xn(r))||e){t&&(r=t);var a=0,n=function(){};return{s:n,n:function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(l){throw l},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,o=!1;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return s=l.done,l},e:function(l){o=!0,i=l},f:function(){try{s||null==t.return||t.return()}finally{if(o)throw i}}}}function yo(r,e,t){return(e=mo(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qe(r,e){return function Ff(r){if(Array.isArray(r))return r}(r)||function Gf(r,e){var t=null==r?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var a,n,i,s,o=[],l=!0,u=!1;try{if(i=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;l=!1}else for(;!(l=(a=i.call(t)).done)&&(o.push(a.value),o.length!==e);l=!0);}catch(v){u=!0,n=v}finally{try{if(!l&&null!=t.return&&(s=t.return(),Object(s)!==s))return}finally{if(u)throw n}}return o}}(r,e)||Xn(r,e)||function Hf(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ga(r){return function Vf(r){if(Array.isArray(r))return Yn(r)}(r)||function _f(r){if(typeof Symbol<"u"&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||Xn(r)||function Wf(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mo(r){var e=function Uf(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var a=t.call(r,e);if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}(r,"string");return"symbol"==typeof e?e:e+""}function Je(r){return(Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function Xn(r,e){if(r){if("string"==typeof r)return Yn(r,e);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Yn(r,e):void 0}}zf.d(Nf,{Z:()=>At});var je=typeof window>"u"?null:window,bo=je?je.navigator:null;je&&je.document;var Jn,Po,jn,Ao,ei,Ro,ri,Mo,ti,Lo,ai,Io,ni,Oo,si,No,oi,zo,ui,Fo,li,qo,vi,_o,fi,Go,ci,Ho,$f=Je(""),wo=Je({}),Kf=Je(function(){}),Yf=typeof HTMLElement>"u"?"undefined":Je(HTMLElement),ia=function(e){return e&&e.instanceString&&He(e.instanceString)?e.instanceString():null},ve=function(e){return null!=e&&Je(e)==$f},He=function(e){return null!=e&&Je(e)===Kf},ze=function(e){return!Dr(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},ke=function(e){return null!=e&&Je(e)===wo&&!ze(e)&&e.constructor===Object},te=function(e){return null!=e&&Je(e)===Je(1)&&!isNaN(e)},Ha=function(e){if("undefined"!==Yf)return null!=e&&e instanceof HTMLElement},Dr=function(e){return sa(e)||xo(e)},sa=function(e){return"collection"===ia(e)&&e._private.single},xo=function(e){return"collection"===ia(e)&&!e._private.single},Zn=function(e){return"core"===ia(e)},Eo=function(e){return"stylesheet"===ia(e)},et=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},ec=function(e){return function(e){return null!=e&&Je(e)===wo}(e)&&He(e.then)},Mt=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")});var a=function(){var o,i=this,s=arguments,l=t.apply(i,s),u=a.cache;return(o=u[l])||(o=u[l]=e.apply(i,s)),o};return a.cache={},a},Qn=Mt(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Wa=Mt(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Co=Mt(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),To=function(e){return et(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},er="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",So=function(e,t){return e<t?-1:e>t?1:0},he=null!=Object.assign?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t<e.length;t++){var a=e[t];if(null!=a)for(var n=Object.keys(a),i=0;i<n.length;i++){var s=n[i];r[s]=a[s]}}return r},Do=function(e){return(ze(e)?e:null)||function(e){return dc[e.toLowerCase()]}(e)||function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var a,n,i,s=16;return 4===e.length?(a=parseInt(e[1]+e[1],s),n=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(a=parseInt(e[1]+e[2],s),n=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[a,n,i]}}(e)||function(e){var t,a=new RegExp("^rgb[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(a){t=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if("%"===s[s.length-1]&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;t.push(Math.floor(s))}var o=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(o&&!l)return;var u=a[4];if(void 0!==u){if((u=parseFloat(u))<0||u>1)return;t.push(u)}}return t}(e)||function(e){var t,a,n,i,s,o,l,u;function v(d,y,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?d+6*(y-d)*g:g<.5?y:g<2/3?d+(y-d)*(2/3-g)*6:d}var f=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(f){if((a=parseInt(f[1]))<0?a=(360- -1*a%360)%360:a>360&&(a%=360),a/=360,(n=parseFloat(f[2]))<0||n>100||(n/=100,(i=parseFloat(f[3]))<0||i>100)||(i/=100,void 0!==(s=f[4])&&((s=parseFloat(s))<0||s>1)))return;if(0===n)o=l=u=Math.round(255*i);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;o=Math.round(255*v(h,c,a+1/3)),l=Math.round(255*v(h,c,a)),u=Math.round(255*v(h,c,a-1/3))}t=[o,l,u,s]}return t}(e)},dc={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]},ko=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(ke(s))throw Error("Tried to set map with object key");i<a.length-1?(null==t[s]&&(t[s]={}),t=t[s]):t[s]=e.value}},Bo=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(ke(s))throw Error("Tried to get map with object key");if(null==(t=t[s]))return t}return t},Ua=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oa(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ua(){if(Po)return Jn;return Po=1,Jn=function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function $a(){if(Ro)return ei;Ro=1;var r=function hc(){if(Ao)return jn;Ao=1;var r="object"==typeof Ua&&Ua&&Ua.Object===Object&&Ua;return jn=r}(),e="object"==typeof self&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return ei=t}function yc(){if(Io)return ai;Io=1;var r=function pc(){if(Lo)return ti;Lo=1;var r=/\s/;return ti=function e(t){for(var a=t.length;a--&&r.test(t.charAt(a)););return a}}(),e=/^\s+/;return ai=function t(a){return a&&a.slice(0,r(a)+1).replace(e,"")}}function ii(){if(Oo)return ni;Oo=1;var e=$a().Symbol;return ni=e}function Vo(){if(Fo)return ui;Fo=1;var r=ii(),e=function mc(){if(No)return si;No=1;var r=ii(),e=Object.prototype,t=e.hasOwnProperty,a=e.toString,n=r?r.toStringTag:void 0;return si=function i(s){var o=t.call(s,n),l=s[n];try{s[n]=void 0;var u=!0}catch{}var v=a.call(s);return u&&(o?s[n]=l:delete s[n]),v}}(),t=function bc(){if(zo)return oi;zo=1;var e=Object.prototype.toString;return oi=function t(a){return e.call(a)}}(),i=r?r.toStringTag:void 0;return ui=function s(o){return null==o?void 0===o?"[object Undefined]":"[object Null]":i&&i in Object(o)?e(o):t(o)}}function la(){if(_o)return vi;_o=1;var r=Vo(),e=function wc(){return qo?li:(qo=1,li=function r(e){return null!=e&&"object"==typeof e})}();return vi=function a(n){return"symbol"==typeof n||e(n)&&"[object Symbol]"==r(n)}}var Cc=function Ec(){if(Ho)return ci;Ho=1;var r=ua(),e=function gc(){if(Mo)return ri;Mo=1;var r=$a();return ri=function(){return r.Date.now()}}(),t=function xc(){if(Go)return fi;Go=1;var r=yc(),e=ua(),t=la(),n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;return fi=function l(u){if("number"==typeof u)return u;if(t(u))return NaN;if(e(u)){var v="function"==typeof u.valueOf?u.valueOf():u;u=e(v)?v+"":v}if("string"!=typeof u)return 0===u?u:+u;u=r(u);var f=i.test(u);return f||s.test(u)?o(u.slice(2),f?2:8):n.test(u)?NaN:+u}}(),n=Math.max,i=Math.min;return ci=function s(o,l,u){var v,f,c,h,d,y,g=0,p=!1,m=!1,b=!0;if("function"!=typeof o)throw new TypeError("Expected a function");function w(B){var R=v,M=f;return v=f=void 0,g=B,h=o.apply(M,R)}function E(B){return g=B,d=setTimeout(k,l),p?w(B):h}function x(B){var R=B-y;return void 0===y||R>=l||R<0||m&&B-g>=c}function k(){var B=e();if(x(B))return S(B);d=setTimeout(k,function C(B){var I=l-(B-y);return m?i(I,c-(B-g)):I}(B))}function S(B){return d=void 0,b&&v?w(B):(v=f=void 0,h)}function A(){var B=e(),R=x(B);if(v=arguments,f=this,y=B,R){if(void 0===d)return E(y);if(m)return clearTimeout(d),d=setTimeout(k,l),w(y)}return void 0===d&&(d=setTimeout(k,l)),h}return l=t(l)||0,r(u)&&(p=!!u.leading,c=(m="maxWait"in u)?n(t(u.maxWait)||0,l):c,b="trailing"in u?!!u.trailing:b),A.cancel=function P(){void 0!==d&&clearTimeout(d),g=0,v=y=f=d=void 0},A.flush=function D(){return void 0===d?h:S(e())},A},ci}(),va=oa(Cc),di=je?je.performance:null,Wo=di&&di.now?function(){return di.now()}:function(){return Date.now()},Tc=function(){if(je){if(je.requestAnimationFrame)return function(r){je.requestAnimationFrame(r)};if(je.mozRequestAnimationFrame)return function(r){je.mozRequestAnimationFrame(r)};if(je.webkitRequestAnimationFrame)return function(r){je.webkitRequestAnimationFrame(r)};if(je.msRequestAnimationFrame)return function(r){je.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(Wo())},1e3/60)}}(),Ka=function(e){return Tc(e)},Wr=Wo,gt=9261,Uo=65599,Lt=5381,$o=function(e){for(var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt,a=t;!(n=e.next()).done;)a=a*Uo+n.value|0;return a},fa=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt;return t*Uo+e|0},ca=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Lt;return(t<<5)+t+e|0},rt=function(e){return 2097152*e[0]+e[1]},Ya=function(e,t){return[fa(e[0],t[0]),ca(e[1],t[1])]},Ko=function(e,t){var a={value:0,done:!1},n=0,i=e.length;return $o({next:function(){return n<i?a.value=e[n++]:a.done=!0,a}},t)},pt=function(e,t){var a={value:0,done:!1},n=0,i=e.length;return $o({next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}},t)},Yo=function(){return Dc(arguments)},Dc=function(e){for(var t,a=0;a<e.length;a++){var n=e[a];t=0===a?pt(n):pt(n,t)}return t},Xo=!0,kc=null!=console.warn,Bc=null!=console.trace,hi=Number.MAX_SAFE_INTEGER||9007199254740991,Zo=function(){return!0},Xa=function(){return!1},Qo=function(){return 0},gi=function(){},We=function(e){throw new Error(e)},Jo=function(e){if(void 0===e)return Xo;Xo=!!e},Me=function(e){!Jo()||(kc?console.warn(e):(console.log(e),Bc&&console.trace()))},Or=function(e){return null==e?e:ze(e)?e.slice():ke(e)?function(e){return he({},e)}(e):e},jo=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},Rc={},eu=function(){return Rc},or=function(e){var t=Object.keys(e);return function(a){for(var n={},i=0;i<t.length;i++){var s=t[i],o=null==a?void 0:a[s];n[s]=void 0===o?e[s]:o}return n}},tt=function(e,t,a){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)},pi=function(e){e.splice(0,e.length)},wr=function(e,t,a){return a&&(t=Co(a,t)),e[t]},Ur=function(e,t,a,n){a&&(t=Co(a,t)),e[t]=n},$r=typeof Map<"u"?Map:function(){return jr(function r(){Jr(this,r),this._obj={}},[{key:"set",value:function(t,a){return this._obj[t]=a,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return void 0!==this._obj[t]}},{key:"get",value:function(t){return this._obj[t]}}])}(),Oc=function(){return jr(function r(e){if(Jr(this,r),this._obj=Object.create(null),this.size=0,null!=e){var t;t=null!=e.instanceString&&e.instanceString()===this.instanceString()?e.toArray():e;for(var a=0;a<t.length;a++)this.add(t[a])}},[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var a=this._obj;1!==a[t]&&(a[t]=1,this.size++)}},{key:"delete",value:function(t){var a=this._obj;1===a[t]&&(a[t]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(t){return 1===this._obj[t]}},{key:"toArray",value:function(){var t=this;return Object.keys(this._obj).filter(function(a){return t.has(a)})}},{key:"forEach",value:function(t,a){return this.toArray().forEach(t,a)}}])}(),It="undefined"!==(typeof Set>"u"?"undefined":Je(Set))?Set:Oc,Za=function(e,t){var a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&Zn(e)){var n=t.group;if(null==n&&(n=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===n||"edges"===n){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===n:!!t.pannable,active:!1,classes:new It,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var s=t.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];ze(t.classes)?u=t.classes:ve(t.classes)&&(u=t.classes.split(/\s+/));for(var v=0,f=u.length;v<f;v++){var c=u[v];!c||""===c||i.classes.add(c)}this.createEmitter(),(void 0===a||a)&&this.restore();var h=t.style||t.css;h&&(Me("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))}else We("An element must be of type `nodes` or `edges`; you specified `"+n+"`")}else We("An element must have a core reference and parameters set")},ru=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var s;ke(a)&&!Dr(a)&&(a=(s=a).roots||s.root,n=s.visit,i=s.directed),i=2!==arguments.length||He(n)?i:n,n=He(n)?n:function(){};for(var y,o=this._private.cy,l=a=ve(a)?this.filter(a):a,u=[],v=[],f={},c={},h={},d=0,g=this.byGroup(),p=g.nodes,m=g.edges,b=0;b<l.length;b++){var w=l[b],E=w.id();w.isNode()&&(u.unshift(w),e.bfs&&(h[E]=!0,v.push(w)),c[E]=0)}for(var x,C=function(){var B=e.bfs?u.shift():u.pop(),R=B.id();if(e.dfs){if(h[R])return 0;h[R]=!0,v.push(B)}var G,M=c[R],I=f[R],L=null!=I?I.source():null,O=null!=I?I.target():null,V=null==I?void 0:B.same(L)?O[0]:L[0];if(!0===(G=n(B,I,V,d++,M)))return y=B,1;if(!1===G)return 1;for(var N=B.connectedEdges().filter(function(Z){return(!i||Z.source().same(B))&&m.has(Z)}),F=0;F<N.length;F++){var K=N[F],X=K.connectedNodes().filter(function(Z){return!Z.same(B)&&p.has(Z)}),Q=X.id();0!==X.length&&!h[Q]&&(X=X[0],u.push(X),e.bfs&&(h[Q]=!0,v.push(X)),f[Q]=K,c[Q]=c[R]+1)}};0!==u.length&&(0===(x=C())||1!==x););for(var k=o.collection(),S=0;S<v.length;S++){var P=v[S],D=f[P.id()];null!=D&&k.push(D),k.push(P)}return{path:o.collection(k),found:o.collection(y)}}},da={breadthFirstSearch:ru({bfs:!0}),depthFirstSearch:ru({dfs:!0})};da.bfs=da.breadthFirstSearch,da.dfs=da.depthFirstSearch;var tu,yi,au,Qa={exports:{}},Nc=Qa.exports;function zc(){return tu||(tu=1,r=Qa,function(){var t,a,n,i,s,o,l,u,v,f,c,h,d,y,g;n=Math.floor,f=Math.min,a=function(p,m){return p<m?-1:p>m?1:0},v=function(p,m,b,w,E){var C;if(null==b&&(b=0),null==E&&(E=a),b<0)throw new Error("lo must be non-negative");for(null==w&&(w=p.length);b<w;)E(m,p[C=n((b+w)/2)])<0?w=C:b=C+1;return[].splice.apply(p,[b,b-b].concat(m)),m},o=function(p,m,b){return null==b&&(b=a),p.push(m),y(p,0,p.length-1,b)},s=function(p,m){var b,w;return null==m&&(m=a),b=p.pop(),p.length?(w=p[0],p[0]=b,g(p,0,m)):w=b,w},u=function(p,m,b){var w;return null==b&&(b=a),w=p[0],p[0]=m,g(p,0,b),w},l=function(p,m,b){var w;return null==b&&(b=a),p.length&&b(p[0],m)<0&&(m=(w=[p[0],m])[0],p[0]=w[1],g(p,0,b)),m},i=function(p,m){var b,w,E,C,x,k;for(null==m&&(m=a),x=[],w=0,E=(C=function(){k=[];for(var S=0,P=n(p.length/2);0<=P?S<P:S>P;0<=P?S++:S--)k.push(S);return k}.apply(this).reverse()).length;w<E;w++)b=C[w],x.push(g(p,b,m));return x},d=function(p,m,b){var w;if(null==b&&(b=a),-1!==(w=p.indexOf(m)))return y(p,0,w,b),g(p,w,b)},c=function(p,m,b){var w,E,C,x,k;if(null==b&&(b=a),!(E=p.slice(0,m)).length)return E;for(i(E,b),C=0,x=(k=p.slice(m)).length;C<x;C++)w=k[C],l(E,w,b);return E.sort(b).reverse()},h=function(p,m,b){var w,E,C,x,k,S,P,D,A;if(null==b&&(b=a),10*m<=p.length){if(!(C=p.slice(0,m).sort(b)).length)return C;for(E=C[C.length-1],x=0,S=(P=p.slice(m)).length;x<S;x++)b(w=P[x],E)<0&&(v(C,w,0,null,b),C.pop(),E=C[C.length-1]);return C}for(i(p,b),A=[],k=0,D=f(m,p.length);0<=D?k<D:k>D;0<=D?++k:--k)A.push(s(p,b));return A},y=function(p,m,b,w){var E,C,x;for(null==w&&(w=a),E=p[b];b>m&&w(E,C=p[x=b-1>>1])<0;)p[b]=C,b=x;return p[b]=E},g=function(p,m,b){var w,E,C,x,k;for(null==b&&(b=a),E=p.length,k=m,C=p[m],w=2*m+1;w<E;)(x=w+1)<E&&!(b(p[w],p[x])<0)&&(w=x),p[m]=p[w],w=2*(m=w)+1;return p[m]=C,y(p,k,m,b)},t=function(){function p(m){this.cmp=m??a,this.nodes=[]}return p.push=o,p.pop=s,p.replace=u,p.pushpop=l,p.heapify=i,p.updateItem=d,p.nlargest=c,p.nsmallest=h,p.prototype.push=function(m){return o(this.nodes,m,this.cmp)},p.prototype.pop=function(){return s(this.nodes,this.cmp)},p.prototype.peek=function(){return this.nodes[0]},p.prototype.contains=function(m){return-1!==this.nodes.indexOf(m)},p.prototype.replace=function(m){return u(this.nodes,m,this.cmp)},p.prototype.pushpop=function(m){return l(this.nodes,m,this.cmp)},p.prototype.heapify=function(){return i(this.nodes,this.cmp)},p.prototype.updateItem=function(m){return d(this.nodes,m,this.cmp)},p.prototype.clear=function(){return this.nodes=[]},p.prototype.empty=function(){return 0===this.nodes.length},p.prototype.size=function(){return this.nodes.length},p.prototype.clone=function(){var m;return(m=new p).nodes=this.nodes.slice(0),m},p.prototype.toArray=function(){return this.nodes.slice(0)},p.prototype.insert=p.prototype.push,p.prototype.top=p.prototype.peek,p.prototype.front=p.prototype.peek,p.prototype.has=p.prototype.contains,p.prototype.copy=p.prototype.clone,p}(),r.exports=t}.call(Nc)),Qa.exports;var r}var ha=oa(function Fc(){return au||(au=1,yi=zc()),yi}()),qc=or({root:null,weight:function(e){return 1},directed:!1}),_c={dijkstra:function(e){if(!ke(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var a=qc(e),n=a.root,i=a.weight,s=a.directed,o=this,l=i,u=ve(n)?this.filter(n)[0]:n[0],v={},f={},c={},h=this.byGroup(),d=h.nodes,y=h.edges;y.unmergeBy(function(M){return M.isLoop()});for(var g=function(I){return v[I.id()]},p=function(I,L){v[I.id()]=L,m.updateItem(I)},m=new ha(function(M,I){return g(M)-g(I)}),b=0;b<d.length;b++){var w=d[b];v[w.id()]=w.same(u)?0:1/0,m.push(w)}for(var E=function(I,L){for(var G,O=(s?I.edgesTo(L):I.edgesWith(L)).intersect(y),V=1/0,N=0;N<O.length;N++){var F=O[N],K=l(F);(K<V||!G)&&(V=K,G=F)}return{edge:G,dist:V}};m.size()>0;){var C=m.pop(),x=g(C),k=C.id();if(c[k]=x,x!==1/0)for(var S=C.neighborhood().intersect(d),P=0;P<S.length;P++){var D=S[P],A=D.id(),B=E(C,D),R=x+B.dist;R<g(D)&&(p(D,R),f[A]={node:C,edge:B.edge})}}return{distanceTo:function(I){var L=ve(I)?d.filter(I)[0]:I[0];return c[L.id()]},pathTo:function(I){var L=ve(I)?d.filter(I)[0]:I[0],O=[],V=L,G=V.id();if(L.length>0)for(O.unshift(L);f[G];){var N=f[G];O.unshift(N.edge),O.unshift(N.node),G=(V=N.node).id()}return o.spawn(O)}}}},Gc={kruskal:function(e){e=e||function(b){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,s=new Array(i),o=a,l=function(w){for(var E=0;E<s.length;E++){if(s[E].has(w))return E}},u=0;u<i;u++)s[u]=this.spawn(a[u]);for(var v=n.sort(function(b,w){return e(b)-e(w)}),f=0;f<v.length;f++){var c=v[f],h=c.source()[0],d=c.target()[0],y=l(h),g=l(d),p=s[y],m=s[g];y!==g&&(o.merge(c),p.merge(m),s.splice(g,1))}return o}},Hc=or({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Wc={aStar:function(e){var t=this.cy(),a=Hc(e),n=a.root,i=a.goal,s=a.heuristic,o=a.directed,l=a.weight;n=t.collection(n)[0],i=t.collection(i)[0];var b,w,N,u=n.id(),v=i.id(),f={},c={},h={},d=new ha(function(G,N){return c[G.id()]-c[N.id()]}),y=new It,g={},p={},m=function(N,F){d.push(N),y.add(F)};m(n,u),f[u]=0,c[u]=s(n);for(var x=0;d.size()>0;){if(b=d.pop(),w=b.id(),y.delete(w),x++,w===v){for(var k=[],S=i,P=v,D=p[P];k.unshift(S),null!=D&&k.unshift(D),null!=(S=g[P]);)D=p[P=S.id()];return{found:!0,distance:f[w],path:this.spawn(k),steps:x}}h[w]=!0;for(var A=b._private.edges,B=0;B<A.length;B++){var R=A[B];if(this.hasElementWithId(R.id())&&(!o||R.data("source")===w)){var M=R.source(),I=R.target(),L=M.id()!==w?M:I,O=L.id();if(this.hasElementWithId(O)&&!h[O]){var V=f[w]+l(R);if(N=O,!y.has(N)){f[O]=V,c[O]=V+s(L),m(L,O),g[O]=b,p[O]=R;continue}V<f[O]&&(f[O]=V,c[O]=V+s(L),g[O]=b,p[O]=R)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},Uc=or({weight:function(e){return 1},directed:!1}),$c={floydWarshall:function(e){for(var t=this.cy(),a=Uc(e),n=a.weight,i=a.directed,s=n,o=this.byGroup(),l=o.nodes,u=o.edges,v=l.length,f=v*v,c=function(K){return l.indexOf(K)},h=function(K){return l[K]},d=new Array(f),y=0;y<f;y++){var g=y%v,p=(y-g)/v;d[y]=p===g?0:1/0}for(var m=new Array(f),b=new Array(f),w=0;w<u.length;w++){var E=u[w],C=E.source()[0],x=E.target()[0];if(C!==x){var k=c(C),S=c(x),P=k*v+S,D=s(E);if(d[P]>D&&(d[P]=D,m[P]=S,b[P]=E),!i){var A=S*v+k;!i&&d[A]>D&&(d[A]=D,m[A]=k,b[A]=E)}}}for(var B=0;B<v;B++)for(var R=0;R<v;R++)for(var M=R*v+B,I=0;I<v;I++){var L=R*v+I,O=B*v+I;d[M]+d[O]<d[L]&&(d[L]=d[M]+d[O],m[L]=m[M])}var G=function(K){return c(function(K){return(ve(K)?t.filter(K):K)[0]}(K))};return{distance:function(K,X){var Q=G(K),Z=G(X);return d[Q*v+Z]},path:function(K,X){var Q=G(K),Z=G(X),re=h(Q);if(Q===Z)return re.collection();if(null==m[Q*v+Z])return t.collection();var z,ae=t.collection(),J=Q;for(ae.merge(re);Q!==Z;)J=Q,Q=m[Q*v+Z],z=b[J*v+Q],ae.merge(z),ae.merge(h(Q));return ae}}}},Kc=or({weight:function(e){return 1},directed:!1,root:null}),Yc={bellmanFord:function(e){var t=this,a=Kc(e),n=a.weight,i=a.directed,s=a.root,o=n,l=this,u=this.cy(),v=this.byGroup(),f=v.edges,c=v.nodes,h=c.length,d=new $r,y=!1,g=[];s=u.collection(s)[0],f.unmergeBy(function(Ie){return Ie.isLoop()});for(var p=f.length,m=function(se){var oe=d.get(se.id());return oe||(oe={},d.set(se.id(),oe)),oe},b=function(se){return(ve(se)?u.$(se):se)[0]},C=0;C<h;C++){var x=c[C],k=m(x);x.same(s)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var S=!1,P=function(se,oe,ce,ge,de,ye){var we=ge.dist+ye;we<de.dist&&!ce.same(ge.edge)&&(de.dist=we,de.pred=se,de.edge=ce,S=!0)},D=1;D<h;D++){S=!1;for(var A=0;A<p;A++){var B=f[A],R=B.source(),M=B.target(),I=o(B),L=m(R),O=m(M);P(R,0,B,L,O,I),i||P(M,0,B,O,L,I)}if(!S)break}if(S)for(var V=[],G=0;G<p;G++){var N=f[G],F=N.source(),K=N.target(),X=o(N),Q=m(F).dist,Z=m(K).dist;if(Q+X<Z||!i&&Z+X<Q){if(y||(Me("Graph contains a negative weight cycle for Bellman-Ford"),y=!0),!1===e.findNegativeWeightCycles)break;var re=[];Q+X<Z&&re.push(F),!i&&Z+X<Q&&re.push(K);for(var ae=re.length,J=0;J<ae;J++){var z=re[J],q=[z];q.push(m(z).edge);for(var H=m(z).pred;-1===q.indexOf(H);)q.push(H),q.push(m(H).edge),H=m(H).pred;for(var ee=(q=q.slice(q.indexOf(H)))[0].id(),ne=0,be=2;be<q.length;be+=2)q[be].id()<ee&&(ee=q[be].id(),ne=be);(q=q.slice(ne).concat(q.slice(0,ne))).push(q[0]);var Ge=q.map(function(Ie){return Ie.id()}).join(",");-1===V.indexOf(Ge)&&(g.push(l.spawn(q)),V.push(Ge))}}}return{distanceTo:function(se){return m(b(se)).dist},pathTo:function(se){for(var oe=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,ce=b(se),ge=[],de=ce;;){if(null==de)return t.spawn();var ye=m(de),we=ye.edge,De=ye.pred;if(ge.unshift(de[0]),de.same(oe)&&ge.length>0)break;null!=we&&ge.unshift(we),de=De}return l.spawn(ge)},hasNegativeWeightCycle:y,negativeWeightCycles:g}}},Xc=Math.sqrt(2),Zc=function(e,t,a){0===a.length&&We("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],s=n[2],o=t[i],l=t[s],u=a,v=u.length-1;v>=0;v--){var f=u[v],c=f[1],h=f[2];(t[c]===o&&t[h]===l||t[c]===l&&t[h]===o)&&u.splice(v,1)}for(var d=0;d<u.length;d++){var y=u[d];y[1]===l?(u[d]=y.slice(),u[d][1]=o):y[2]===l&&(u[d]=y.slice(),u[d][2]=o)}for(var g=0;g<t.length;g++)t[g]===l&&(t[g]=o);return u},mi=function(e,t,a,n){for(;a>n;){var i=Math.floor(Math.random()*t.length);t=Zc(i,e,t),a--}return t},Qc={kargerStein:function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(O){return O.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/Xc);if(!(i<2)){for(var u=[],v=0;v<s;v++){var f=n[v];u.push([v,a.indexOf(f.source()),a.indexOf(f.target())])}for(var c=1/0,h=[],d=new Array(i),y=new Array(i),g=new Array(i),p=function(V,G){for(var N=0;N<i;N++)G[N]=V[N]},m=0;m<=o;m++){for(var b=0;b<i;b++)y[b]=b;var w=mi(y,u.slice(),i,l),E=w.slice();p(y,g);var C=mi(y,w,l,2),x=mi(g,E,l,2);C.length<=x.length&&C.length<c?(c=C.length,h=C,p(y,d)):x.length<=C.length&&x.length<c&&(c=x.length,h=x,p(g,d))}for(var k=this.spawn(h.map(function(O){return n[O[0]]})),S=this.spawn(),P=this.spawn(),D=d[0],A=0;A<d.length;A++){var B=d[A],R=a[A];B===D?S.merge(R):P.merge(R)}var M=function(V){var G=e.spawn();return V.forEach(function(N){G.merge(N),N.connectedEdges().forEach(function(F){e.contains(F)&&!k.contains(F)&&G.merge(F)})}),G},I=[M(S),M(P)];return{cut:k,components:I,partition1:S,partition2:P}}We("At least 2 nodes are required for Karger-Stein algorithm")}},Ja=function(e,t,a){return{x:e.x*t+a.x,y:e.y*t+a.y}},nu=function(e,t,a){return{x:(e.x-a.x)/t,y:(e.y-a.y)/t}},Ot=function(e){return{x:e[0],y:e[1]}},ja=function(e,t){return Math.atan2(t,e)-Math.PI/2},bi=Math.log2||function(r){return Math.log(r)/Math.log(2)},wi=function(e){return e>0?1:e<0?-1:0},yt=function(e,t){return Math.sqrt(mt(e,t))},mt=function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},nd=function(e){for(var t=e.length,a=0,n=0;n<t;n++)a+=e[n];for(var i=0;i<t;i++)e[i]=e[i]/a;return e},ar=function(e,t,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*a},Nt=function(e,t,a,n){return{x:ar(e.x,t.x,a.x,n),y:ar(e.y,t.y,a.y,n)}},ga=function(e,t,a){return Math.max(e,Math.min(a,t))},xr=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},iu=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},ld=function(e,t,a){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},en=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},rn=function(e){var a,n,i,s,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===t.length)a=n=i=s=t[0];else if(2===t.length)a=i=t[0],s=n=t[1];else if(4===t.length){var o=Qe(t,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},su=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},xi=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},zt=function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},vd=function(e,t){return zt(e,t.x,t.y)},fd=function(e,t){return zt(e,t.x1,t.y1)&&zt(e,t.x2,t.y2)},ou=function(e,t,a,n,i,s,o){var d,M,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",u="auto"===l?nt(i,s):l,v=i/2,f=s/2,c=(u=Math.min(u,v,f))!==v,h=u!==f;if(c){var y=a-v+u-o,g=n-f-o,p=a+v-u+o,m=g;if((d=at(e,t,a,n,y,g,p,m,!1)).length>0)return d}if(h){var b=a+v+o,w=n-f+u-o,E=b,C=n+f-u+o;if((d=at(e,t,a,n,b,w,E,C,!1)).length>0)return d}if(c){var x=a-v+u-o,k=n+f+o,S=a+v-u+o,P=k;if((d=at(e,t,a,n,x,k,S,P,!1)).length>0)return d}if(h){var D=a-v-o,A=n-f+u-o,B=D,R=n+f-u+o;if((d=at(e,t,a,n,D,A,B,R,!1)).length>0)return d}var I=a-v+u,L=n-f+u;if((M=pa(e,t,a,n,I,L,u+o)).length>0&&M[0]<=I&&M[1]<=L)return[M[0],M[1]];var O=a+v-u,V=n-f+u;if((M=pa(e,t,a,n,O,V,u+o)).length>0&&M[0]>=O&&M[1]<=V)return[M[0],M[1]];var G=a+v-u,N=n+f-u;if((M=pa(e,t,a,n,G,N,u+o)).length>0&&M[0]>=G&&M[1]>=N)return[M[0],M[1]];var F=a-v+u,K=n+f-u;return(M=pa(e,t,a,n,F,K,u+o)).length>0&&M[0]<=F&&M[1]>=K?[M[0],M[1]]:[]},cd=function(e,t,a,n,i,s,o){var l=o,u=Math.min(a,i),v=Math.max(a,i),f=Math.min(n,s),c=Math.max(n,s);return u-l<=e&&e<=v+l&&f-l<=t&&t<=c+l},dd=function(e,t,a,n,i,s,o,l,u){var v_x1=Math.min(a,o,i)-u,v_x2=Math.max(a,o,i)+u,v_y1=Math.min(n,l,s)-u,v_y2=Math.max(n,l,s)+u;return!(e<v_x1||e>v_x2||t<v_y1||t>v_y2)},pd=function(e,t,a,n,i,s,o,l){var h=[];!function(e,t,a,n,i){var o,l,u,v,f,c,h,d;0===e&&(e=1e-5),u=-27*(n/=e)+(t/=e)*(9*(a/=e)-t*t*2),o=(l=(3*a-t*t)/9)*l*l+(u/=54)*u,i[1]=0,h=t/3,o>0?(f=(f=u+Math.sqrt(o))<0?-Math.pow(-f,1/3):Math.pow(f,1/3),c=(c=u-Math.sqrt(o))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+f+c,h+=(f+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+f)/2,i[3]=h,i[5]=-h):(i[5]=i[3]=0,0===o?(d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=2*d-h,i[4]=i[2]=-(d+h)):(v=(l=-l)*l*l,v=Math.acos(u/Math.sqrt(v)),d=2*Math.sqrt(l),i[0]=-h+d*Math.cos(v/3),i[2]=-h+d*Math.cos((v+2*Math.PI)/3),i[4]=-h+d*Math.cos((v+4*Math.PI)/3)))}(1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*l+4*s*s-4*s*l+l*l,9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*l-6*s*s+3*s*l,3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*l-n*t+2*s*s+2*s*t-l*t,1*a*i-a*a+a*e-i*e+n*s-n*n+n*t-s*t,h);for(var y=[],g=0;g<6;g+=2)Math.abs(h[g+1])<1e-7&&h[g]>=0&&h[g]<=1&&y.push(h[g]);y.push(1),y.push(0);for(var m,b,w,p=-1,E=0;E<y.length;E++)m=Math.pow(1-y[E],2)*a+2*(1-y[E])*y[E]*i+y[E]*y[E]*o,b=Math.pow(1-y[E],2)*n+2*(1-y[E])*y[E]*s+y[E]*y[E]*l,w=Math.pow(m-e,2)+Math.pow(b-t,2),p>=0?w<p&&(p=w):p=w;return p},yd=function(e,t,a,n,i,s){var o=[e-a,t-n],l=[i-a,s-n],u=l[0]*l[0]+l[1]*l[1],v=o[0]*o[0]+o[1]*o[1],f=o[0]*l[0]+o[1]*l[1],c=f*f/u;return f<0?v:c>u?(e-i)*(e-i)+(t-s)*(t-s):v-c},Er=function(e,t,a){for(var n,i,s,o,u=0,v=0;v<a.length/2;v++)if(n=a[2*v],i=a[2*v+1],v+1<a.length/2?(s=a[2*(v+1)],o=a[2*(v+1)+1]):(s=a[2*(v+1-a.length/2)],o=a[2*(v+1-a.length/2)+1]),n!=e||s!=e){if(!(n>=e&&e>=s||n<=e&&e<=s))continue;(e-n)/(s-n)*(o-i)+i>t&&u++}return u%2!=0},Kr=function(e,t,a,n,i,s,o,l,u){var f,y,v=new Array(a.length);null!=l[0]?(f=Math.atan(l[1]/l[0]),l[0]<0?f+=Math.PI/2:f=-f-Math.PI/2):f=l;for(var c=Math.cos(-f),h=Math.sin(-f),d=0;d<v.length/2;d++)v[2*d]=s/2*(a[2*d]*c-a[2*d+1]*h),v[2*d+1]=o/2*(a[2*d+1]*c+a[2*d]*h),v[2*d]+=n,v[2*d+1]+=i;if(u>0){var g=an(v,-u);y=tn(g)}else y=v;return Er(e,t,y)},tn=function(e){for(var a,n,i,s,o,l,u,v,t=new Array(e.length/2),f=0;f<e.length/4;f++){a=e[4*f],n=e[4*f+1],i=e[4*f+2],s=e[4*f+3],f<e.length/4-1?(o=e[4*(f+1)],l=e[4*(f+1)+1],u=e[4*(f+1)+2],v=e[4*(f+1)+3]):(o=e[0],l=e[1],u=e[2],v=e[3]);var c=at(a,n,i,s,o,l,u,v,!0);t[2*f]=c[0],t[2*f+1]=c[1]}return t},an=function(e,t){for(var n,i,s,o,a=new Array(2*e.length),l=0;l<e.length/2;l++){n=e[2*l],i=e[2*l+1],l<e.length/2-1?(s=e[2*(l+1)],o=e[2*(l+1)+1]):(s=e[0],o=e[1]);var u=o-i,v=-(s-n),f=Math.sqrt(u*u+v*v),c=u/f,h=v/f;a[4*l]=n+c*t,a[4*l+1]=i+h*t,a[4*l+2]=s+c*t,a[4*l+3]=o+h*t}return a},bt=function(e,t,a,n,i,s,o){return e-=i,t-=s,(e/=a/2+o)*e+(t/=n/2+o)*t<=1},pa=function(e,t,a,n,i,s,o){var l=[a-e,n-t],u=[e-i,t-s],v=l[0]*l[0]+l[1]*l[1],f=2*(u[0]*l[0]+u[1]*l[1]),h=f*f-4*v*(u[0]*u[0]+u[1]*u[1]-o*o);if(h<0)return[];var d=(-f+Math.sqrt(h))/(2*v),y=(-f-Math.sqrt(h))/(2*v),g=Math.min(d,y),p=Math.max(d,y),m=[];if(g>=0&&g<=1&&m.push(g),p>=0&&p<=1&&m.push(p),0===m.length)return[];var b=m[0]*l[0]+e,w=m[0]*l[1]+t;return m.length>1?m[0]==m[1]?[b,w]:[b,w,m[1]*l[0]+e,m[1]*l[1]+t]:[b,w]},Ei=function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},at=function(e,t,a,n,i,s,o,l,u){var v=e-i,f=a-e,c=o-i,h=t-s,d=n-t,y=l-s,g=c*h-y*v,p=f*h-d*v,m=y*f-c*d;if(0!==m){var b=g/m,w=p/m,C=-.001;return C<=b&&b<=1.001&&C<=w&&w<=1.001||u?[e+b*f,t+b*d]:[]}return 0===g||0===p?Ei(e,a,o)===o?[o,l]:Ei(e,a,i)===i?[i,s]:Ei(i,o,a)===a?[a,n]:[]:[]},ya=function(e,t,a,n,i,s,o,l){var v,h,u=[],f=new Array(a.length),c=!0;if(null==s&&(c=!1),c){for(var d=0;d<f.length/2;d++)f[2*d]=a[2*d]*s+n,f[2*d+1]=a[2*d+1]*o+i;if(l>0){var y=an(f,-l);h=tn(y)}else h=f}else h=a;for(var g,p,m,b,w=0;w<h.length/2;w++)g=h[2*w],p=h[2*w+1],w<h.length/2-1?(m=h[2*(w+1)],b=h[2*(w+1)+1]):(m=h[0],b=h[1]),0!==(v=at(e,t,n,i,g,p,m,b)).length&&u.push(v[0],v[1]);return u},nn=function(e,t,a){var n=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),s=(i-a)/i;return s<0&&(s=1e-5),[t[0]+s*n[0],t[1]+s*n[1]]},yr=function(e,t){var a=Ci(e,t);return a=uu(a)},uu=function(e){for(var t,a,n=e.length/2,i=1/0,s=1/0,o=-1/0,l=-1/0,u=0;u<n;u++)t=e[2*u],a=e[2*u+1],i=Math.min(i,t),o=Math.max(o,t),s=Math.min(s,a),l=Math.max(l,a);for(var v=2/(o-i),f=2/(l-s),c=0;c<n;c++)t=e[2*c]=e[2*c]*v,a=e[2*c+1]=e[2*c+1]*f,i=Math.min(i,t),o=Math.max(o,t),s=Math.min(s,a),l=Math.max(l,a);if(s<-1)for(var h=0;h<n;h++)a=e[2*h+1]=e[2*h+1]+(-1-s);return e},Ci=function(e,t){var a=1/e*2*Math.PI,n=e%2==0?Math.PI/2+a/2:Math.PI/2;n+=t;for(var s,i=new Array(2*e),o=0;o<e;o++)s=o*a+n,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},nt=function(e,t){return Math.min(e/4,t/4,8)},lu=function(e,t){return Math.min(e/10,t/10,8)},Si=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Ed(r,e){function t(f){for(var c=[],h=0;h<f.length;h++){var d=f[h],y=f[(h+1)%f.length],g={x:y.x-d.x,y:y.y-d.y},p={x:-g.y,y:g.x},m=Math.sqrt(p.x*p.x+p.y*p.y);c.push({x:p.x/m,y:p.y/m})}return c}function a(f,c){var g,h=1/0,d=-1/0,y=br(f);try{for(y.s();!(g=y.n()).done;){var p=g.value,m=p.x*c.x+p.y*c.y;h=Math.min(h,m),d=Math.max(d,m)}}catch(b){y.e(b)}finally{y.f()}return{min:h,max:d}}var o,f,c,s=br([].concat(Ga(t(r)),Ga(t(e))));try{for(s.s();!(o=s.n()).done;){var l=o.value,u=a(r,l),v=a(e,l);if(c=v,(f=u).max<c.min||c.max<f.min)return!1}}catch(f){s.e(f)}finally{s.f()}return!0}var Cd=or({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Td={pageRank:function(e){for(var t=Cd(e),a=t.dampingFactor,n=t.precision,i=t.iterations,s=t.weight,o=this._private.cy,l=this.byGroup(),u=l.nodes,v=l.edges,f=u.length,c=f*f,h=v.length,d=new Array(c),y=new Array(f),g=(1-a)/f,p=0;p<f;p++){for(var m=0;m<f;m++){d[p*f+m]=0}y[p]=0}for(var w=0;w<h;w++){var E=v[w],C=E.data("source"),x=E.data("target");if(C!==x){var k=u.indexOfId(C),S=u.indexOfId(x),P=s(E);d[S*f+k]+=P,y[k]+=P}}for(var A=1/f+g,B=0;B<f;B++)if(0===y[B])for(var R=0;R<f;R++){d[R*f+B]=A}else for(var I=0;I<f;I++){var L=I*f+B;d[L]=d[L]/y[B]+g}for(var G,O=new Array(f),V=new Array(f),N=0;N<f;N++)O[N]=1;for(var F=0;F<i;F++){for(var K=0;K<f;K++)V[K]=0;for(var X=0;X<f;X++)for(var Q=0;Q<f;Q++){var Z=X*f+Q;V[X]+=d[Z]*O[Q]}nd(V),G=O,O=V,V=G;for(var re=0,ae=0;ae<f;ae++){var J=G[ae]-O[ae];re+=J*J}if(re<n)break}return{rank:function(H){return H=o.collection(H)[0],O[u.indexOf(H)]}}}},vu=or({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Ft={degreeCentralityNormalized:function(e){e=vu(e);var t=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var v={},f={},c=0,h=0,d=0;d<n;d++){var y=a[d],g=y.id();e.root=y;var p=this.degreeCentrality(e);c<p.indegree&&(c=p.indegree),h<p.outdegree&&(h=p.outdegree),v[g]=p.indegree,f[g]=p.outdegree}return{indegree:function(b){return 0==c?0:(ve(b)&&(b=t.filter(b)),v[b.id()]/c)},outdegree:function(b){return 0===h?0:(ve(b)&&(b=t.filter(b)),f[b.id()]/h)}}}for(var i={},s=0,o=0;o<n;o++){var l=a[o];e.root=l;var u=this.degreeCentrality(e);s<u.degree&&(s=u.degree),i[l.id()]=u.degree}return{degree:function(b){return 0===s?0:(ve(b)&&(b=t.filter(b)),i[b.id()]/s)}}},degreeCentrality:function(e){e=vu(e);var t=this.cy(),a=this,n=e,i=n.root,s=n.weight,o=n.directed,l=n.alpha;if(i=t.collection(i)[0],o){for(var h=i.connectedEdges(),d=h.filter(function(C){return C.target().same(i)&&a.has(C)}),y=h.filter(function(C){return C.source().same(i)&&a.has(C)}),g=d.length,p=y.length,m=0,b=0,w=0;w<d.length;w++)m+=s(d[w]);for(var E=0;E<y.length;E++)b+=s(y[E]);return{indegree:Math.pow(g,1-l)*Math.pow(m,l),outdegree:Math.pow(p,1-l)*Math.pow(b,l)}}for(var u=i.connectedEdges().intersection(a),v=u.length,f=0,c=0;c<u.length;c++)f+=s(u[c]);return{degree:Math.pow(v,1-l)*Math.pow(f,l)}}};Ft.dc=Ft.degreeCentrality,Ft.dcn=Ft.degreeCentralityNormalised=Ft.degreeCentralityNormalized;var fu=or({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Vt={closenessCentralityNormalized:function(e){for(var t=fu(e),a=t.harmonic,n=t.weight,i=t.directed,s=this.cy(),o={},l=0,u=this.nodes(),v=this.floydWarshall({weight:n,directed:i}),f=0;f<u.length;f++){for(var c=0,h=u[f],d=0;d<u.length;d++)if(f!==d){var y=v.distance(h,u[d]);c+=a?1/y:y}a||(c=1/c),l<c&&(l=c),o[h.id()]=c}return{closeness:function(p){return 0==l?0:(p=ve(p)?s.filter(p)[0].id():p.id(),o[p]/l)}}},closenessCentrality:function(e){var t=fu(e),a=t.root,n=t.weight,i=t.directed,s=t.harmonic;a=this.filter(a)[0];for(var o=this.dijkstra({root:a,weight:n,directed:i}),l=0,u=this.nodes(),v=0;v<u.length;v++){var f=u[v];if(!f.same(a)){var c=o.distanceTo(f);l+=s?1/c:c}}return s?l:1/l}};Vt.cc=Vt.closenessCentrality,Vt.ccn=Vt.closenessCentralityNormalised=Vt.closenessCentralityNormalized;var Sd=or({weight:null,directed:!1}),Di={betweennessCentrality:function(e){for(var t=Sd(e),a=t.directed,n=t.weight,i=null!=n,s=this.cy(),o=this.nodes(),l={},u={},v=0,f={set:function(b,w){u[b]=w,w>v&&(v=w)},get:function(b){return u[b]}},c=0;c<o.length;c++){var h=o[c],d=h.id();l[d]=a?h.outgoers().nodes():h.openNeighborhood().nodes(),f.set(d,0)}for(var y=function(){for(var b=o[g].id(),w=[],E={},C={},x={},k=new ha(function(X,Q){return x[X]-x[Q]}),S=0;S<o.length;S++){var P=o[S].id();E[P]=[],C[P]=0,x[P]=1/0}for(C[b]=1,x[b]=0,k.push(b);!k.empty();){var D=k.pop();if(w.push(D),i)for(var A=0;A<l[D].length;A++){var B=l[D][A],R=s.getElementById(D),M=void 0;M=R.edgesTo(B).length>0?R.edgesTo(B)[0]:B.edgesTo(R)[0];var I=n(M);B=B.id(),x[B]>x[D]+I&&(x[B]=x[D]+I,k.nodes.indexOf(B)<0?k.push(B):k.updateItem(B),C[B]=0,E[B]=[]),x[B]==x[D]+I&&(C[B]=C[B]+C[D],E[B].push(D))}else for(var L=0;L<l[D].length;L++){var O=l[D][L].id();x[O]==1/0&&(k.push(O),x[O]=x[D]+1),x[O]==x[D]+1&&(C[O]=C[O]+C[D],E[O].push(D))}}for(var V={},G=0;G<o.length;G++)V[o[G].id()]=0;for(;w.length>0;){for(var N=w.pop(),F=0;F<E[N].length;F++){var K=E[N][F];V[K]=V[K]+C[K]/C[N]*(1+V[N])}N!=o[g].id()&&f.set(N,f.get(N)+V[N])}},g=0;g<o.length;g++)y();var p={betweenness:function(b){var w=s.collection(b).id();return f.get(w)},betweennessNormalized:function(b){if(0==v)return 0;var w=s.collection(b).id();return f.get(w)/v}};return p.betweennessNormalised=p.betweennessNormalized,p}};Di.bc=Di.betweennessCentrality;var Dd=or({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),Bd=function(e,t){for(var a=0,n=0;n<t.length;n++)a+=t[n](e);return a},cu=function(e,t){for(var a,n=0;n<t;n++){a=0;for(var i=0;i<t;i++)a+=e[i*t+n];for(var s=0;s<t;s++)e[s*t+n]=e[s*t+n]/a}},Ad=function(e,t,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var s=0;s<a;s++)n[i*a+s]=0;for(var o=0;o<a;o++)for(var l=0;l<a;l++)n[i*a+l]+=e[i*a+o]*t[o*a+l]}return n},Rd=function(e,t,a){for(var n=e.slice(0),i=1;i<a;i++)e=Ad(e,n,t);return e},Md=function(e,t,a){for(var n=new Array(t*t),i=0;i<t*t;i++)n[i]=Math.pow(e[i],a);return cu(n,t),n},Ld=function(e,t,a,n){for(var i=0;i<a;i++){if(Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n)!==Math.round(t[i]*Math.pow(10,n))/Math.pow(10,n))return!1}return!0},Od=function(e,t){for(var a=0;a<e.length;a++)if(!t[a]||e[a].id()!==t[a].id())return!1;return!0},du=function(e){for(var t=this.nodes(),a=this.edges(),n=this.cy(),i=function(e){return Dd(e)}(e),s={},o=0;o<t.length;o++)s[t[o].id()]=o;for(var f,l=t.length,u=l*l,v=new Array(u),c=0;c<u;c++)v[c]=0;for(var h=0;h<a.length;h++){var d=a[h],y=s[d.source().id()],g=s[d.target().id()],p=Bd(d,i.attributes);v[y*l+g]+=p,v[g*l+y]+=p}(function(e,t,a){for(var n=0;n<t;n++)e[n*t+n]=a})(v,l,i.multFactor),cu(v,l);for(var m=!0,b=0;m&&b<i.maxIterations;)m=!1,f=Rd(v,l,i.expandFactor),v=Md(f,l,i.inflateFactor),Ld(v,f,u,4)||(m=!0),b++;var w=function(e,t,a,n){for(var i=[],s=0;s<t;s++){for(var o=[],l=0;l<t;l++)Math.round(1e3*e[s*t+l])/1e3>0&&o.push(a[l]);0!==o.length&&i.push(n.collection(o))}return i}(v,l,t,n);return w=function(e){for(var t=0;t<e.length;t++)for(var a=0;a<e.length;a++)t!=a&&Od(e[t],e[a])&&e.splice(a,1);return e}(w),w},zd={markovClustering:du,mcl:du},Fd=function(e){return e},hu=function(e,t){return Math.abs(t-e)},gu=function(e,t,a){return e+hu(t,a)},pu=function(e,t,a){return e+Math.pow(a-t,2)},Vd=function(e){return Math.sqrt(e)},qd=function(e,t,a){return Math.max(e,hu(t,a))},ma=function(e,t,a,n,i){for(var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Fd,o=n,v=0;v<e;v++)o=i(o,t(v),a(v));return s(o)},qt={euclidean:function(e,t,a){return e>=2?ma(e,t,a,0,pu,Vd):ma(e,t,a,0,gu)},squaredEuclidean:function(e,t,a){return ma(e,t,a,0,pu)},manhattan:function(e,t,a){return ma(e,t,a,0,gu)},max:function(e,t,a){return ma(e,t,a,-1/0,qd)}};function sn(r,e,t,a,n,i){var s;return s=He(r)?r:qt[r]||qt.euclidean,0===e&&He(r)?s(n,i):s(e,t,a,n,i)}qt["squared-euclidean"]=qt.squaredEuclidean,qt.squaredeuclidean=qt.squaredEuclidean;var _d=or({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ki=function(e){return _d(e)},on=function(e,t,a,n,i){var o="kMedoids"!==i?function(f){return a[f]}:function(f){return n[f](a)},u=a,v=t;return sn(e,n.length,o,function(c){return n[c](t)},u,v)},Bi=function(e,t,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(t),l=null,u=0;u<n;u++)i[u]=e.min(a[u]).value,s[u]=e.max(a[u]).value;for(var v=0;v<t;v++){l=[];for(var f=0;f<n;f++)l[f]=Math.random()*(s[f]-i[f])+i[f];o[v]=l}return o},yu=function(e,t,a,n,i){for(var s=1/0,o=0,l=0;l<t.length;l++){var u=on(a,e,t[l],n,i);u<s&&(s=u,o=l)}return o},mu=function(e,t,a){for(var n=[],i=null,s=0;s<t.length;s++)a[(i=t[s]).id()]===e&&n.push(i);return n},Gd=function(e,t,a){return Math.abs(t-e)<=a},Hd=function(e,t,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){if(Math.abs(e[n][i]-t[n][i])>a)return!1}return!0},Wd=function(e,t,a){for(var n=0;n<a;n++)if(e===t[n])return!0;return!1},bu=function(e,t){var a=new Array(t);if(e.length<50)for(var n=0;n<t;n++){for(var i=e[Math.floor(Math.random()*e.length)];Wd(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var s=0;s<t;s++)a[s]=e[Math.floor(Math.random()*e.length)];return a},wu=function(e,t,a){for(var n=0,i=0;i<t.length;i++)n+=on("manhattan",t[i],e,a,"kMedoids");return n},Kd=function(e,t,a,n,i){for(var s,o,l=0;l<t.length;l++)for(var u=0;u<e.length;u++)n[l][u]=Math.pow(a[l][u],i.m);for(var v=0;v<e.length;v++)for(var f=0;f<i.attributes.length;f++){s=0,o=0;for(var c=0;c<t.length;c++)s+=n[c][v]*i.attributes[f](t[c]),o+=n[c][v];e[v][f]=s/o}},Yd=function(e,t,a,n,i){for(var s=0;s<e.length;s++)t[s]=e[s].slice();for(var o,l,u,v=2/(i.m-1),f=0;f<a.length;f++)for(var c=0;c<n.length;c++){o=0;for(var h=0;h<a.length;h++)l=on(i.distance,n[c],a[f],i.attributes,"cmeans"),u=on(i.distance,n[c],a[h],i.attributes,"cmeans"),o+=Math.pow(l/u,v);e[c][f]=1/o}},xu=function(e){var i,s,o,l,u,t=this.cy(),a=this.nodes(),n=ki(e);l=new Array(a.length);for(var v=0;v<a.length;v++)l[v]=new Array(n.k);o=new Array(a.length);for(var f=0;f<a.length;f++)o[f]=new Array(n.k);for(var c=0;c<a.length;c++){for(var h=0,d=0;d<n.k;d++)o[c][d]=Math.random(),h+=o[c][d];for(var y=0;y<n.k;y++)o[c][y]=o[c][y]/h}s=new Array(n.k);for(var g=0;g<n.k;g++)s[g]=new Array(n.attributes.length);u=new Array(a.length);for(var p=0;p<a.length;p++)u[p]=new Array(n.k);for(var m=!0,b=0;m&&b<n.maxIterations;)m=!1,Kd(s,a,o,u,n),Yd(o,l,s,a,n),Hd(o,l,n.sensitivityThreshold)||(m=!0),b++;return i=function(e,t,a,n){for(var i=new Array(a.k),s=0;s<i.length;s++)i[s]=[];for(var o,l,u=0;u<t.length;u++){o=-1/0,l=-1;for(var v=0;v<t[0].length;v++)t[u][v]>o&&(o=t[u][v],l=v);i[l].push(e[u])}for(var f=0;f<i.length;f++)i[f]=n.collection(i[f]);return i}(a,o,n,t),{clusters:i,degreeOfMembership:o}},Zd={kMeans:function(e){var l,t=this.cy(),a=this.nodes(),n=null,i=ki(e),s=new Array(i.k),o={};i.testMode?"number"==typeof i.testCentroids?(i.testCentroids,l=Bi(a,i.k,i.attributes)):l="object"===Je(i.testCentroids)?i.testCentroids:Bi(a,i.k,i.attributes):l=Bi(a,i.k,i.attributes);for(var u=!0,v=0;u&&v<i.maxIterations;){for(var f=0;f<a.length;f++)o[(n=a[f]).id()]=yu(n,l,i.distance,i.attributes,"kMeans");u=!1;for(var c=0;c<i.k;c++){var h=mu(c,a,o);if(0!==h.length){for(var d=i.attributes.length,y=l[c],g=new Array(d),p=new Array(d),m=0;m<d;m++){p[m]=0;for(var b=0;b<h.length;b++)n=h[b],p[m]+=i.attributes[m](n);g[m]=p[m]/h.length,Gd(g[m],y[m],i.sensitivityThreshold)||(u=!0)}l[c]=g,s[c]=t.collection(h)}}v++}return s},kMedoids:function(e){var o,u,t=this.cy(),a=this.nodes(),n=null,i=ki(e),s=new Array(i.k),l={},v=new Array(i.k);i.testMode?"number"==typeof i.testCentroids||(o="object"===Je(i.testCentroids)?i.testCentroids:bu(a,i.k)):o=bu(a,i.k);for(var f=!0,c=0;f&&c<i.maxIterations;){for(var h=0;h<a.length;h++)l[(n=a[h]).id()]=yu(n,o,i.distance,i.attributes,"kMedoids");f=!1;for(var d=0;d<o.length;d++){var y=mu(d,a,l);if(0!==y.length){v[d]=wu(o[d],y,i.attributes);for(var g=0;g<y.length;g++)(u=wu(y[g],y,i.attributes))<v[d]&&(v[d]=u,o[d]=y[g],f=!0);s[d]=t.collection(y)}}c++}return s},fuzzyCMeans:xu,fcm:xu},Qd=or({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Jd={single:"min",complete:"max"},Eu=function(e,t,a,n,i){for(var l,s=0,o=1/0,u=i.attributes,v=function(S,P){return sn(i.distance,u.length,function(D){return u[D](S)},function(D){return u[D](P)},S,P)},f=0;f<e.length;f++){var c=e[f].key,h=a[c][n[c]];h<o&&(s=c,o=h)}if("threshold"===i.mode&&o>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var g,d=t[s],y=t[n[s]];g="dendrogram"===i.mode?{left:d,right:y,key:d.key}:{value:d.value.concat(y.value),key:d.key},e[d.index]=g,e.splice(y.index,1),t[d.key]=g;for(var p=0;p<e.length;p++){var m=e[p];d.key===m.key?l=1/0:"min"===i.linkage?(l=a[d.key][m.key],a[d.key][m.key]>a[y.key][m.key]&&(l=a[y.key][m.key])):"max"===i.linkage?(l=a[d.key][m.key],a[d.key][m.key]<a[y.key][m.key]&&(l=a[y.key][m.key])):l="mean"===i.linkage?(a[d.key][m.key]*d.size+a[y.key][m.key]*y.size)/(d.size+y.size):"dendrogram"===i.mode?v(m.value,d.value):v(m.value[0],d.value[0]),a[d.key][m.key]=a[m.key][d.key]=l}for(var b=0;b<e.length;b++){var w=e[b].key;if(n[w]===d.key||n[w]===y.key){for(var E=w,C=0;C<e.length;C++){var x=e[C].key;a[w][x]<a[w][E]&&(E=x)}n[w]=E}e[b].index=b}return d.key=y.key=d.index=y.index=null,!0},_t=function(e,t,a){!e||(e.value?t.push(e.value):(e.left&&_t(e.left,t),e.right&&_t(e.right,t)))},Pi=function(e,t){if(!e)return"";if(e.left&&e.right){var a=Pi(e.left,t),n=Pi(e.right,t),i=t.add({group:"nodes",data:{id:a+","+n}});return t.add({group:"edges",data:{source:a,target:i.id()}}),t.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}return e.value?e.value.id():void 0},Ai=function(e,t,a){if(!e)return[];var n=[],i=[],s=[];return 0===t?(e.left&&_t(e.left,n),e.right&&_t(e.right,i),s=n.concat(i),[a.collection(s)]):1===t?e.value?[a.collection(e.value)]:(e.left&&_t(e.left,n),e.right&&_t(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=Ai(e.left,t-1,a)),e.right&&(i=Ai(e.right,t-1,a)),n.concat(i))},Cu=function(e){for(var t=this.cy(),a=this.nodes(),n=function(e){var t=Qd(e),a=Jd[t.linkage];return null!=a&&(t.linkage=a),t}(e),i=n.attributes,s=function(b,w){return sn(n.distance,i.length,function(E){return i[E](b)},function(E){return i[E](w)},b,w)},o=[],l=[],u=[],v=[],f=0;f<a.length;f++){var c={value:"dendrogram"===n.mode?a[f]:[a[f]],key:f,index:f};o[f]=c,v[f]=c,l[f]=[],u[f]=0}for(var h=0;h<o.length;h++)for(var d=0;d<=h;d++){var y=void 0;y="dendrogram"===n.mode?h===d?1/0:s(o[h].value,o[d].value):h===d?1/0:s(o[h].value[0],o[d].value[0]),l[h][d]=y,l[d][h]=y,y<l[h][u[h]]&&(u[h]=d)}for(var g=Eu(o,v,l,u,n);g;)g=Eu(o,v,l,u,n);var p;return"dendrogram"===n.mode?(p=Ai(o[0],n.dendrogramDepth,t),n.addDendrogram&&Pi(o[0],t)):(p=new Array(o.length),o.forEach(function(m,b){m.key=m.index=null,p[b]=t.collection(m.value)})),p},eh={hierarchicalClustering:Cu,hca:Cu},rh=or({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),ah=function(e,t,a,n){var i=function(o,l){return n[l](o)};return-sn(e,n.length,function(s){return i(t,s)},function(s){return i(a,s)},t,a)},nh=function(e,t){var a=null;return a="median"===t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];n?e=e.slice(t,a):(a<e.length&&e.splice(a,e.length-a),t>0&&e.splice(0,t));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(c,h){return c-h});var v=e.length,f=Math.floor(v/2);return v%2!=0?e[f+1+o]:(e[f-1+o]+e[f+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=0,i=0,s=t;s<a;s++){var o=e[s];isFinite(o)&&(n+=o,i++)}return n/i}(e):"min"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=1/0,i=t;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.min(s,n))}return n}(e):"max"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=-1/0,i=t;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.max(s,n))}return n}(e):t,a},Tu=function(e,t,a){for(var n=[],i=0;i<e;i++){for(var s=-1,o=-1/0,l=0;l<a.length;l++){var u=a[l];t[i*e+u]>o&&(s=u,o=t[i*e+u])}s>0&&n.push(s)}for(var v=0;v<a.length;v++)n[a[v]]=a[v];return n},Su=function(e){for(var t=this.cy(),a=this.nodes(),n=function(e){var t=e.damping,a=e.preference;.5<=t&&t<1||We("Damping must range on [0.5, 1). Got: ".concat(t));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||te(a)||We("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),rh(e)}(e),i={},s=0;s<a.length;s++)i[a[s].id()]=s;var o,l,u,v,f,c,S;l=(o=a.length)*o,u=new Array(l);for(var h=0;h<l;h++)u[h]=-1/0;for(var d=0;d<o;d++)for(var y=0;y<o;y++)d!==y&&(u[d*o+y]=ah(n.distance,a[d],a[y],n.attributes));v=nh(u,n.preference);for(var g=0;g<o;g++)u[g*o+g]=v;f=new Array(l);for(var p=0;p<l;p++)f[p]=0;c=new Array(l);for(var m=0;m<l;m++)c[m]=0;for(var b=new Array(o),w=new Array(o),E=new Array(o),C=0;C<o;C++)b[C]=0,w[C]=0,E[C]=0;for(var x=new Array(o*n.minIterations),k=0;k<x.length;k++)x[k]=0;for(S=0;S<n.maxIterations;S++){for(var P=0;P<o;P++){for(var D=-1/0,A=-1/0,B=-1,R=0,M=0;M<o;M++)b[M]=f[P*o+M],(R=c[P*o+M]+u[P*o+M])>=D?(A=D,D=R,B=M):R>A&&(A=R);for(var I=0;I<o;I++)f[P*o+I]=(1-n.damping)*(u[P*o+I]-D)+n.damping*b[I];f[P*o+B]=(1-n.damping)*(u[P*o+B]-A)+n.damping*b[B]}for(var L=0;L<o;L++){for(var O=0,V=0;V<o;V++)b[V]=c[V*o+L],w[V]=Math.max(0,f[V*o+L]),O+=w[V];O-=w[L],w[L]=f[L*o+L],O+=w[L];for(var G=0;G<o;G++)c[G*o+L]=(1-n.damping)*Math.min(0,O-w[G])+n.damping*b[G];c[L*o+L]=(1-n.damping)*(O-w[L])+n.damping*b[L]}for(var N=0,F=0;F<o;F++){var K=c[F*o+F]+f[F*o+F]>0?1:0;x[S%n.minIterations*o+F]=K,N+=K}if(N>0&&(S>=n.minIterations-1||S==n.maxIterations-1)){for(var X=0,Q=0;Q<o;Q++){E[Q]=0;for(var Z=0;Z<n.minIterations;Z++)E[Q]+=x[Z*o+Q];(0===E[Q]||E[Q]===n.minIterations)&&X++}if(X===o)break}}for(var re=function(e,t,a){for(var n=[],i=0;i<e;i++)t[i*e+i]+a[i*e+i]>0&&n.push(i);return n}(o,f,c),ae=function(e,t,a){for(var n=Tu(e,t,a),i=0;i<a.length;i++){for(var s=[],o=0;o<n.length;o++)n[o]===a[i]&&s.push(o);for(var l=-1,u=-1/0,v=0;v<s.length;v++){for(var f=0,c=0;c<s.length;c++)f+=t[s[c]*e+s[v]];f>u&&(l=v,u=f)}a[i]=s[l]}return Tu(e,t,a)}(o,u,re),J={},z=0;z<re.length;z++)J[re[z]]=[];for(var q=0;q<a.length;q++){var ee=ae[i[a[q].id()]];null!=ee&&J[ee].push(a[q])}for(var ne=new Array(re.length),be=0;be<re.length;be++)ne[be]=t.collection(J[re[be]]);return ne},oh={affinityPropagation:Su,ap:Su},uh=or({root:void 0,directed:!1}),lh={hierholzer:function(e){if(!ke(e)){var t=arguments;e={root:t[0],directed:t[1]}}var l,u,v,a=uh(e),n=a.root,i=a.directed,s=this,o=!1;n&&(v=ve(n)?this.filter(n)[0].id():n[0].id());var f={},c={};i?s.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.indegree(!0),E=m.outdegree(!0),C=w-E,x=E-w;1==C?l?o=!0:l=b:1==x?u?o=!0:u=b:(x>1||C>1)&&(o=!0),f[b]=[],m.outgoers().forEach(function(k){k.isEdge()&&f[b].push(k.id())})}else c[b]=[void 0,m.target().id()]}):s.forEach(function(m){var b=m.id();m.isNode()?(m.degree(!0)%2&&(l?u?o=!0:u=b:l=b),f[b]=[],m.connectedEdges().forEach(function(E){return f[b].push(E.id())})):c[b]=[m.source().id(),m.target().id()]});var h={found:!1,trail:void 0};if(o)return h;if(u&&l)if(i){if(v&&u!=v)return h;v=u}else{if(v&&u!=v&&l!=v)return h;v||(v=u)}else v||(v=s[0].id());var d=function(b){for(var C,x,k,w=b,E=[b];f[w].length;)C=f[w].shift(),x=c[C][0],w!=(k=c[C][1])?(f[k]=f[k].filter(function(S){return S!=C}),w=k):!i&&w!=x&&(f[x]=f[x].filter(function(S){return S!=C}),w=x),E.unshift(C),E.unshift(w);return E},y=[],g=[];for(g=d(v);1!=g.length;)0==f[g[0]].length?(y.unshift(s.getElementById(g.shift())),y.unshift(s.getElementById(g.shift()))):g=d(g.shift()).concat(g);for(var p in y.unshift(s.getElementById(g.shift())),f)if(f[p].length)return h;return h.found=!0,h.trail=this.spawn(y,!0),h}},un=function(){var e=this,t={},a=0,n=0,i=[],s=[],o={},u=function(c,h,d){c===d&&(n+=1),t[h]={id:a,low:a++,cutVertex:!1};var g,p,m,b,y=e.getElementById(h).connectedEdges().intersection(e);0===y.size()?i.push(e.spawn(e.getElementById(h))):y.forEach(function(w){g=w.source().id(),p=w.target().id(),(m=g===h?p:g)!==d&&(b=w.id(),o[b]||(o[b]=!0,s.push({x:h,y:m,edge:w})),m in t?t[h].low=Math.min(t[h].low,t[m].id):(u(c,m,h),t[h].low=Math.min(t[h].low,t[m].low),t[h].id<=t[m].low&&(t[h].cutVertex=!0,function(c,h){for(var d=s.length-1,y=[],g=e.spawn();s[d].x!=c||s[d].y!=h;)y.push(s.pop().edge),d--;y.push(s.pop().edge),y.forEach(function(p){var m=p.connectedNodes().intersection(e);g.merge(p),m.forEach(function(b){var w=b.id(),E=b.connectedEdges().intersection(e);g.merge(b),t[w].cutVertex?g.merge(E.filter(function(C){return C.isLoop()})):g.merge(E)})}),i.push(g)}(h,m))))})};e.forEach(function(f){if(f.isNode()){var c=f.id();c in t||(n=0,u(c,c),t[c].cutVertex=n>1)}});var v=Object.keys(t).filter(function(f){return t[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(v),components:i}},ln=function(){var e=this,t={},a=0,n=[],i=[],s=e.spawn(e),o=function(u){if(i.push(u),t[u]={index:a,low:a++,explored:!1},e.getElementById(u).connectedEdges().intersection(e).forEach(function(y){var g=y.target().id();g!==u&&(g in t||o(g),t[g].explored||(t[u].low=Math.min(t[u].low,t[g].low)))}),t[u].index===t[u].low){for(var f=e.spawn();;){var c=i.pop();if(f.merge(e.getElementById(c)),t[c].low=t[u].index,t[c].explored=!0,c===u)break}var h=f.edgesWith(f),d=f.merge(h);n.push(d),s=s.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in t||o(u)}}),{cut:s,components:n}},Du={};[da,_c,Gc,Wc,$c,Yc,Qc,Td,Ft,Vt,Di,zd,Zd,eh,oh,lh,{hopcroftTarjanBiconnected:un,htbc:un,htb:un,hopcroftTarjanBiconnectedComponents:un},{tarjanStronglyConnected:ln,tsc:ln,tscc:ln,tarjanStronglyConnectedComponents:ln}].forEach(function(r){he(Du,r)});var Ar=function(e){if(!(this instanceof Ar))return new Ar(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Ar.prototype={fulfill:function(e){return Au(this,1,"fulfillValue",e)},reject:function(e){return Au(this,2,"rejectReason",e)},then:function(e,t){var a=this,n=new Ar;return a.onFulfilled.push(Lu(e,n,"fulfill")),a.onRejected.push(Lu(t,n,"reject")),Ru(a),n.proxy}};var Au=function(e,t,a,n){return 0===e.state&&(e.state=t,e[a]=n,Ru(e)),e},Ru=function(e){1===e.state?Mu(e,"onFulfilled",e.fulfillValue):2===e.state&&Mu(e,"onRejected",e.rejectReason)},Mu=function(e,t,a){if(0!==e[t].length){var n=e[t];e[t]=[];var i=function(){for(var o=0;o<n.length;o++)n[o](a)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},Lu=function(e,t,a){return function(n){if("function"!=typeof e)t[a].call(t,n);else{var i;try{i=e(n)}catch(s){return void t.reject(s)}Iu(t,i)}}},Iu=function(e,t){if(e!==t&&e.proxy!==t){var a;if("object"===Je(t)&&null!==t||"function"==typeof t)try{a=t.then}catch(i){return void e.reject(i)}if("function"!=typeof a)e.fulfill(t);else{var n=!1;try{a.call(t,function(i){n||(n=!0,i===t?e.reject(new TypeError("circular thenable chain")):Iu(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}}}else e.reject(new TypeError("cannot resolve promise with itself"))};Ar.all=function(r){return new Ar(function(e,t){for(var a=new Array(r.length),n=0,i=function(l,u){a[l]=u,++n===r.length&&e(a)},s=0;s<r.length;s++)!function(o){var l=r[o];null!=l&&null!=l.then?l.then(function(f){i(o,f)},function(f){t(f)}):i(o,l)}(s)})},Ar.resolve=function(r){return new Ar(function(e,t){e(r)})},Ar.reject=function(r){return new Ar(function(e,t){t(r)})};var Gt=typeof Promise<"u"?Promise:Ar,Ri=function(e,t,a){var n=Zn(e),i=!n,s=this._private=he({duration:1e3},t,a);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&He(s.complete)&&s.completes.push(s.complete),i){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(n){var l=e.pan();s.startPan={x:l.x,y:l.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},wt=Ri.prototype;he(wt,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var a=e.target._private.animation;(e.queue?a.queue:a.current).push(this),Dr(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,a=t.playing;return void 0===e?t.progress:(a&&this.pause(),t.progress=e,t.started=!1,a&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(u,v){var f=e[u];null!=f&&(e[u]=e[v],e[v]=f)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],s=i.name,o=e.startStyle[s];e.startStyle[s]=i,e.style[n]=o}return t&&this.play(),this},promise:function(e){var a,t=this._private;if("frame"===e)a=t.frames;else a=t.completes;return new Gt(function(n,i){a.push(function(){n()})})}}),wt.complete=wt.completed,wt.run=wt.play,wt.running=wt.playing;var Mi,Ou,Li,Nu,Ii,zu,Oi,Fu,Ni,Vu,zi,qu,Fi,_u,Vi,Gu,qi,Hu,Gi,Wu,Hi,Uu,Wi,$u,Ui,Ku,$i,Yu,Ki,Xu,Yi,Zu,Xi,Qu,Zi,Ju,Qi,el,Ji,rl,ji,tl,es,al,rs,nl,ts,il,as,sl,ns,ol,is,ul,ss,ll,os,vl,us,fl,ls,cl,vs,dl,fs,hl,cs,gl,ds,pl,hs,yl,gs,bl,ps,xl,ys,El,ms,Tl,bs,Dl,xs,kl,Es,Bl,ch={animated:function(){return function(){var t=this,n=void 0!==t.length?t:[t];if(!(this._private.cy||this).styleEnabled())return!1;var s=n[0];return s?s._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var t=this,n=void 0!==t.length?t:[t];if(!(this._private.cy||this).styleEnabled())return this;for(var s=0;s<n.length;s++){n[s]._private.animation.queue=[]}return this}},delay:function(){return function(t,a){return(this._private.cy||this).styleEnabled()?this.animate({delay:t,duration:t,complete:a}):this}},delayAnimation:function(){return function(t,a){return(this._private.cy||this).styleEnabled()?this.animation({delay:t,duration:t,complete:a}):this}},animation:function(){return function(t,a){var n=this,i=void 0!==n.length,s=i?n:[n],o=this._private.cy||this,l=!i,u=!l;if(!o.styleEnabled())return this;var v=o.style();if(t=he({},t,a),0===Object.keys(t).length)return new Ri(s[0],t);switch(void 0===t.duration&&(t.duration=400),t.duration){case"slow":t.duration=600;break;case"fast":t.duration=200}if(u&&(t.style=v.getPropsList(t.style||t.css),t.css=void 0),u&&null!=t.renderedPosition){var c=t.renderedPosition,h=o.pan(),d=o.zoom();t.position=nu(c,d,h)}if(l&&null!=t.panBy){var y=t.panBy,g=o.pan();t.pan={x:g.x+y.x,y:g.y+y.y}}var p=t.center||t.centre;if(l&&null!=p){var m=o.getCenterPan(p.eles,t.zoom);null!=m&&(t.pan=m)}if(l&&null!=t.fit){var b=t.fit,w=o.getFitViewport(b.eles||b.boundingBox,b.padding);null!=w&&(t.pan=w.pan,t.zoom=w.zoom)}if(l&&ke(t.zoom)){var E=o.getZoomedViewport(t.zoom);null!=E?(E.zoomed&&(t.zoom=E.zoom),E.panned&&(t.pan=E.pan)):t.zoom=null}return new Ri(s[0],t)}},animate:function(){return function(t,a){var n=this,s=void 0!==n.length?n:[n];if(!(this._private.cy||this).styleEnabled())return this;a&&(t=he({},t,a));for(var l=0;l<s.length;l++){var u=s[l],v=u.animated()&&(void 0===t.queue||t.queue);u.animation(t,v?{queue:!0}:void 0).play()}return this}},stop:function(){return function(t,a){var n=this,s=void 0!==n.length?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var l=0;l<s.length;l++){for(var v=s[l]._private,f=v.animation.current,c=0;c<f.length;c++){var d=f[c]._private;a&&(d.duration=0)}t&&(v.animation.queue=[]),a||(v.animation.current=[])}return o.notify("draw"),this}}};function vn(){if(Ou)return Mi;Ou=1;var r=Array.isArray;return Mi=r}function ph(){if(Vu)return Ni;Vu=1;var a,r=function gh(){if(Fu)return Oi;Fu=1;var e=$a()["__core-js_shared__"];return Oi=e}(),e=(a=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+a:"";return Ni=function t(a){return!!e&&e in a},Ni}function mh(){if(_u)return Fi;_u=1;var r=function hh(){if(zu)return Ii;zu=1;var r=Vo(),e=ua();return Ii=function s(o){if(!e(o))return!1;var l=r(o);return"[object Function]"==l||"[object GeneratorFunction]"==l||"[object AsyncFunction]"==l||"[object Proxy]"==l}}(),e=ph(),t=ua(),a=function yh(){if(qu)return zi;qu=1;var e=Function.prototype.toString;return zi=function t(a){if(null!=a){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}}(),i=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,v=RegExp("^"+l.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Fi=function f(c){return!(!t(c)||e(c))&&(r(c)?v:i).test(a(c))}}function _i(){if(Hu)return qi;Hu=1;var r=mh(),e=function bh(){return Gu?Vi:(Gu=1,Vi=function r(e,t){return null==e?void 0:e[t]})}();return qi=function t(a,n){var i=e(a,n);return r(i)?i:void 0}}function fn(){if(Wu)return Gi;Wu=1;var e=_i()(Object,"create");return Gi=e}function Sh(){if(Zu)return Yi;Zu=1;var r=function wh(){if(Uu)return Hi;Uu=1;var r=fn();return Hi=function e(){this.__data__=r?r(null):{},this.size=0}}(),e=function xh(){return $u?Wi:($u=1,Wi=function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t})}(),t=function Eh(){if(Ku)return Ui;Ku=1;var r=fn(),a=Object.prototype.hasOwnProperty;return Ui=function n(i){var s=this.__data__;if(r){var o=s[i];return"__lodash_hash_undefined__"===o?void 0:o}return a.call(s,i)?s[i]:void 0}}(),a=function Ch(){if(Yu)return $i;Yu=1;var r=fn(),t=Object.prototype.hasOwnProperty;return $i=function a(n){var i=this.__data__;return r?void 0!==i[n]:t.call(i,n)}}(),n=function Th(){if(Xu)return Ki;Xu=1;var r=fn();return Ki=function t(a,n){var i=this.__data__;return this.size+=this.has(a)?0:1,i[a]=r&&void 0===n?"__lodash_hash_undefined__":n,this}}();function i(s){var o=-1,l=null==s?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,Yi=i}function ju(){if(Ju)return Zi;return Ju=1,Zi=function r(e,t){return e===t||e!=e&&t!=t}}function cn(){if(el)return Qi;el=1;var r=ju();return Qi=function e(t,a){for(var n=t.length;n--;)if(r(t[n][0],a))return n;return-1}}function Rh(){if(il)return ts;il=1;var r=function Dh(){return Qu?Xi:(Qu=1,Xi=function r(){this.__data__=[],this.size=0})}(),e=function kh(){if(rl)return Ji;rl=1;var r=cn(),t=Array.prototype.splice;return Ji=function a(n){var i=this.__data__,s=r(i,n);return!(s<0||(s==i.length-1?i.pop():t.call(i,s,1),--this.size,0))}}(),t=function Bh(){if(tl)return ji;tl=1;var r=cn();return ji=function e(t){var a=this.__data__,n=r(a,t);return n<0?void 0:a[n][1]}}(),a=function Ph(){if(al)return es;al=1;var r=cn();return es=function e(t){return r(this.__data__,t)>-1}}(),n=function Ah(){if(nl)return rs;nl=1;var r=cn();return rs=function e(t,a){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,a])):n[i][1]=a,this}}();function i(s){var o=-1,l=null==s?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,ts=i}function Lh(){if(ol)return ns;ol=1;var r=Sh(),e=Rh(),t=function Mh(){if(sl)return as;sl=1;var t=_i()($a(),"Map");return as=t}();return ns=function a(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}}function dn(){if(ll)return ss;ll=1;var r=function Ih(){return ul?is:(ul=1,is=function r(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e})}();return ss=function e(t,a){var n=t.__data__;return r(a)?n["string"==typeof a?"string":"hash"]:n.map}}function Vh(){if(hl)return fs;hl=1;var r=Lh(),e=function Oh(){if(vl)return os;vl=1;var r=dn();return os=function e(t){var a=r(this,t).delete(t);return this.size-=a?1:0,a}}(),t=function Nh(){if(fl)return us;fl=1;var r=dn();return us=function e(t){return r(this,t).get(t)}}(),a=function zh(){if(cl)return ls;cl=1;var r=dn();return ls=function e(t){return r(this,t).has(t)}}(),n=function Fh(){if(dl)return vs;dl=1;var r=dn();return vs=function e(t,a){var n=r(this,t),i=n.size;return n.set(t,a),this.size+=n.size==i?0:1,this}}();function i(s){var o=-1,l=null==s?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,fs=i}function _h(){if(pl)return ds;pl=1;var r=function qh(){if(gl)return cs;gl=1;var r=Vh();function t(a,n){if("function"!=typeof a||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var i=function(){var s=arguments,o=n?n.apply(this,s):s[0],l=i.cache;if(l.has(o))return l.get(o);var u=a.apply(this,s);return i.cache=l.set(o,u)||l,u};return i.cache=new(t.Cache||r),i}return t.Cache=r,cs=t}();return ds=function t(a){var n=r(a,function(s){return 500===i.size&&i.clear(),s}),i=n.cache;return n}}function ml(){if(yl)return hs;yl=1;var r=_h(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,a=r(function(n){var i=[];return 46===n.charCodeAt(0)&&i.push(""),n.replace(e,function(s,o,l,u){i.push(l?u.replace(t,"$1"):o||s)}),i});return hs=a}function wl(){if(bl)return gs;return bl=1,gs=function r(e,t){for(var a=-1,n=null==e?0:e.length,i=Array(n);++a<n;)i[a]=t(e[a],a,e);return i}}function Cl(){if(El)return ys;El=1;var r=function Gh(){if(xl)return ps;xl=1;var r=ii(),e=wl(),t=vn(),a=la(),n=r?r.prototype:void 0,i=n?n.toString:void 0;return ps=function s(o){if("string"==typeof o)return o;if(t(o))return e(o,s)+"";if(a(o))return i?i.call(o):"";var l=o+"";return"0"==l&&1/o==-1/0?"-0":l}}();return ys=function e(t){return null==t?"":r(t)}}function Sl(){if(Tl)return ms;Tl=1;var r=vn(),e=function dh(){if(Nu)return Li;Nu=1;var r=vn(),e=la(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;return Li=function n(i,s){if(r(i))return!1;var o=typeof i;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=i&&!e(i))||a.test(i)||!t.test(i)||null!=s&&i in Object(s)}}(),t=ml(),a=Cl();return ms=function n(i,s){return r(i)?i:e(i,s)?[i]:t(a(i))}}function ws(){if(Dl)return bs;Dl=1;var r=la();return bs=function e(t){if("string"==typeof t||r(t))return t;var a=t+"";return"0"==a&&1/t==-1/0?"-0":a}}var Cs,Pl,Ts,Al,Ss,Rl,Ds,Ml,ks,Ll,Bs,Il,Uh=function Wh(){if(Bl)return Es;Bl=1;var r=function Hh(){if(kl)return xs;kl=1;var r=Sl(),e=ws();return xs=function t(a,n){for(var i=0,s=(n=r(n,a)).length;null!=a&&i<s;)a=a[e(n[i++])];return i&&i==s?a:void 0}}();return Es=function e(t,a,n){var i=null==t?void 0:r(t,a);return void 0===i?n:i}}(),$h=oa(Uh);function Yh(){if(Al)return Ts;Al=1;var r=function Kh(){if(Pl)return Cs;Pl=1;var r=_i(),e=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}}();return Cs=e}();return Ts=function e(t,a,n){"__proto__"==a&&r?r(t,a,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[a]=n}}function Qh(){if(Ll)return ks;Ll=1;var r=function Xh(){if(Rl)return Ss;Rl=1;var r=Yh(),e=ju(),a=Object.prototype.hasOwnProperty;return Ss=function n(i,s,o){var l=i[s];(!a.call(i,s)||!e(l,o)||void 0===o&&!(s in i))&&r(i,s,o)}}(),e=Sl(),t=function Zh(){if(Ml)return Ds;Ml=1;var e=/^(?:0|[1-9]\d*)$/;return Ds=function t(a,n){var i=typeof a;return!!(n=n??9007199254740991)&&("number"==i||"symbol"!=i&&e.test(a))&&a>-1&&a%1==0&&a<n}}(),a=ua(),n=ws();return ks=function i(s,o,l,u){if(!a(s))return s;for(var v=-1,f=(o=e(o,s)).length,c=f-1,h=s;null!=h&&++v<f;){var d=n(o[v]),y=l;if("__proto__"===d||"constructor"===d||"prototype"===d)return s;if(v!=c){var g=h[d];void 0===(y=u?u(g,d,h):void 0)&&(y=a(g)?g:t(o[v+1])?[]:{})}r(h,d,y),h=h[d]}return s}}var Ps,Ol,As,Nl,eg=oa(function Jh(){if(Il)return Bs;Il=1;var r=Qh();return Bs=function e(t,a,n){return null==t?t:r(t,a,n)}}());var ag=function tg(){if(Nl)return As;Nl=1;var r=wl(),e=function rg(){return Ol?Ps:(Ol=1,Ps=function r(e,t){var a=-1,n=e.length;for(t||(t=Array(n));++a<n;)t[a]=e[a];return t})}(),t=vn(),a=la(),n=ml(),i=ws(),s=Cl();return As=function o(l){return t(l)?r(l,i):a(l)?[l]:e(n(s(l)))}}(),ng=oa(ag),ig={data:function(e){return e=he({},{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}},e),function(n,i){var s=e,o=this,l=void 0!==o.length,u=l?o:[o],v=l?o[0]:o;if(ve(n)){var h,c=-1!==n.indexOf(".")&&ng(n);if(s.allowGetting&&void 0===i)return v&&(s.beforeGet(v),h=c&&void 0===v._private[s.field][n]?$h(v._private[s.field],c):v._private[s.field][n]),h;if(s.allowSetting&&void 0!==i&&!s.immutableKeys[n]){var y=yo({},n,i);s.beforeSet(o,y);for(var g=0,p=u.length;g<p;g++){var m=u[g];s.canSet(m)&&(c&&void 0===v._private[s.field][n]?eg(m._private[s.field],c,i):m._private[s.field][n]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}else if(s.allowSetting&&ke(n)){var w,E,b=n,C=Object.keys(b);s.beforeSet(o,b);for(var x=0;x<C.length;x++){if(E=b[w=C[x]],!s.immutableKeys[w])for(var S=0;S<u.length;S++){var P=u[S];s.canSet(P)&&(P._private[s.field][w]=E)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&He(n)){var D=n;o.on(s.bindingEvent,D)}else if(s.allowGetting&&void 0===n){var A;return v&&(s.beforeGet(v),A=v._private[s.field]),A}return o}},removeData:function(e){return e=he({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(n){var i=e,s=this,l=void 0!==s.length?s:[s];if(ve(n)){for(var u=n.split(/\s+/),v=u.length,f=0;f<v;f++){var c=u[f];if(!et(c))if(!i.immutableKeys[c])for(var d=0,y=l.length;d<y;d++)l[d]._private[i.field][c]=void 0}i.triggerEvent&&s[i.triggerFnName](i.event)}else if(void 0===n){for(var g=0,p=l.length;g<p;g++)for(var m=l[g]._private[i.field],b=Object.keys(m),w=0;w<b.length;w++){var E=b[w];!i.immutableKeys[E]&&(m[E]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s}}},sg={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(a,n){var i=this,s=Array.prototype.slice.call(arguments,0);return new Gt(function(o,l){var v=s.concat([function(h){i.off.apply(i,f),o(h)}]),f=v.concat([]);i.on.apply(i,v)})}}},Le={};[ch,ig,sg].forEach(function(r){he(Le,r)});var og={animate:Le.animate(),animation:Le.animation(),animated:Le.animated(),clearQueue:Le.clearQueue(),delay:Le.delay(),delayAnimation:Le.delayAnimation(),stop:Le.stop()},hn={classes:function(e){var t=this;if(void 0===e){var a=[];return t[0]._private.classes.forEach(function(d){return a.push(d)}),a}ze(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new It(e),s=0;s<t.length;s++){for(var o=t[s],l=o._private,u=l.classes,v=!1,f=0;f<e.length;f++){var c=e[f];if(!u.has(c)){v=!0;break}}v||(v=u.size!==e.length),v&&(l.classes=i,n.push(o))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){ze(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=void 0===t,i=[],s=0,o=a.length;s<o;s++)for(var l=a[s],u=l._private.classes,v=!1,f=0;f<e.length;f++){var c=e[f],h=u.has(c),d=!1;t||n&&!h?(u.add(c),d=!0):(!t||n&&h)&&(u.delete(c),d=!0),!v&&d&&(i.push(l),v=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var a=this;if(null==t)t=250;else if(0===t)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},t),a}};hn.className=hn.classNames=hn.classes;var Be={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:er,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Be.variable="(?:[\\w-.]|(?:\\\\"+Be.metaChar+"))+",Be.className="(?:[\\w-]|(?:\\\\"+Be.metaChar+"))+",Be.value=Be.string+"|"+Be.number,Be.id=Be.variable,function(){var r,e,t;for(r=Be.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],Be.comparatorOp+="|@"+e;for(r=Be.comparatorOp.split("|"),t=0;t<r.length;t++)!((e=r[t]).indexOf("!")>=0)&&"="!==e&&(Be.comparatorOp+="|\\!"+e)}();var ie_GROUP=0,ie_COLLECTION=1,ie_FILTER=2,ie_DATA_COMPARE=3,ie_DATA_EXIST=4,ie_DATA_BOOL=5,ie_META_COMPARE=6,ie_STATE=7,ie_ID=8,ie_CLASS=9,ie_UNDIRECTED_EDGE=10,ie_DIRECTED_EDGE=11,ie_NODE_SOURCE=12,ie_NODE_TARGET=13,ie_NODE_NEIGHBOR=14,ie_CHILD=15,ie_DESCENDANT=16,ie_PARENT=17,ie_ANCESTOR=18,ie_COMPOUND_SPLIT=19,ie_TRUE=20,Rs=[{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(r,e){return function(e,t){return-1*So(e,t)}(r.selector,e.selector)}),ug=function(){for(var e,r={},t=0;t<Rs.length;t++)r[(e=Rs[t]).selector]=e.matches;return r}(),vg="("+Rs.map(function(r){return r.selector}).join("|")+")",Ht=function(e){return e.replace(new RegExp("\\\\("+Be.metaChar+")","g"),function(t,a){return a})},it=function(e,t,a){e[e.length-1]=a},Ms=[{name:"group",query:!0,regex:"("+Be.group+")",populate:function(e,t,a){var i=Qe(a,1)[0];t.checks.push({type:ie_GROUP,value:"*"===i?i:i+"s"})}},{name:"state",query:!0,regex:vg,populate:function(e,t,a){var i=Qe(a,1)[0];t.checks.push({type:ie_STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Be.id+")",populate:function(e,t,a){var i=Qe(a,1)[0];t.checks.push({type:ie_ID,value:Ht(i)})}},{name:"className",query:!0,regex:"\\.("+Be.className+")",populate:function(e,t,a){var i=Qe(a,1)[0];t.checks.push({type:ie_CLASS,value:Ht(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Be.variable+")\\s*\\]",populate:function(e,t,a){var i=Qe(a,1)[0];t.checks.push({type:ie_DATA_EXIST,field:Ht(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Be.variable+")\\s*("+Be.comparatorOp+")\\s*("+Be.value+")\\s*\\]",populate:function(e,t,a){var n=Qe(a,3),i=n[0],s=n[1],o=n[2];o=null!=new RegExp("^"+Be.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:ie_DATA_COMPARE,field:Ht(i),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Be.boolOp+")\\s*("+Be.variable+")\\s*\\]",populate:function(e,t,a){var n=Qe(a,2),i=n[0],s=n[1];t.checks.push({type:ie_DATA_BOOL,field:Ht(s),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Be.meta+")\\s*("+Be.comparatorOp+")\\s*("+Be.number+")\\s*\\]\\]",populate:function(e,t,a){var n=Qe(a,3),i=n[0],s=n[1],o=n[2];t.checks.push({type:ie_META_COMPARE,field:Ht(i),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Be.separator,populate:function(e,t){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,s=e[e.length-1];return null!=a&&(s.subject=a,e.currentSubject=null),s.edgeCount=n,s.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]={checks:[]}}},{name:"directedEdge",separator:!0,regex:Be.directedEdge,populate:function(e,t){if(null==e.currentSubject){var a={checks:[]},n=t,i={checks:[]};return a.checks.push({type:ie_DIRECTED_EDGE,source:n,target:i}),it(e,0,a),e.edgeCount++,i}var s={checks:[]},o=t,l={checks:[]};return s.checks.push({type:ie_NODE_SOURCE,source:o,target:l}),it(e,0,s),e.edgeCount++,l}},{name:"undirectedEdge",separator:!0,regex:Be.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var a={checks:[]},n=t,i={checks:[]};return a.checks.push({type:ie_UNDIRECTED_EDGE,nodes:[n,i]}),it(e,0,a),e.edgeCount++,i}var s={checks:[]},o=t,l={checks:[]};return s.checks.push({type:ie_NODE_NEIGHBOR,node:o,neighbor:l}),it(e,0,s),l}},{name:"child",separator:!0,regex:Be.child,populate:function(e,t){if(null==e.currentSubject){var a={checks:[]},n={checks:[]},i=e[e.length-1];return a.checks.push({type:ie_CHILD,parent:i,child:n}),it(e,0,a),e.compoundCount++,n}if(e.currentSubject===t){var s={checks:[]},o=e[e.length-1],l={checks:[]},u={checks:[]},v={checks:[]},f={checks:[]};return s.checks.push({type:ie_COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=t.checks,t.checks=[{type:ie_TRUE}],f.checks.push({type:ie_TRUE}),l.checks.push({type:ie_PARENT,parent:f,child:v}),it(e,0,s),e.currentSubject=u,e.compoundCount++,v}var c={checks:[]},h={checks:[]},d=[{type:ie_PARENT,parent:c,child:h}];return c.checks=t.checks,t.checks=d,e.compoundCount++,h}},{name:"descendant",separator:!0,regex:Be.descendant,populate:function(e,t){if(null==e.currentSubject){var a={checks:[]},n={checks:[]},i=e[e.length-1];return a.checks.push({type:ie_DESCENDANT,ancestor:i,descendant:n}),it(e,0,a),e.compoundCount++,n}if(e.currentSubject===t){var s={checks:[]},o=e[e.length-1],l={checks:[]},u={checks:[]},v={checks:[]},f={checks:[]};return s.checks.push({type:ie_COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=t.checks,t.checks=[{type:ie_TRUE}],f.checks.push({type:ie_TRUE}),l.checks.push({type:ie_ANCESTOR,ancestor:f,descendant:v}),it(e,0,s),e.currentSubject=u,e.compoundCount++,v}var c={checks:[]},h={checks:[]},d=[{type:ie_ANCESTOR,ancestor:c,descendant:h}];return c.checks=t.checks,t.checks=d,e.compoundCount++,h}},{name:"subject",modifier:!0,regex:Be.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return Me("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],i=null==n?null:n.type;i===ie_DIRECTED_EDGE?n.type=ie_NODE_TARGET:i===ie_UNDIRECTED_EDGE&&(n.type=ie_NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Ms.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var fg=function(e){for(var t,a,n,i=0;i<Ms.length;i++){var s=Ms[i],o=s.name,l=e.match(s.regexObj);if(null!=l){a=l,t=s,n=o;var u=l[0];e=e.substring(u.length);break}}return{expr:t,match:a,name:n,remaining:e}},gg={parse:function(e){var t=this,a=t.inputText=e,n=t[0]={checks:[]};for(t.length=1,a=function(e){var t=e.match(/^\s+/);if(t){var a=t[0];e=e.substring(a.length)}return e}(a);;){var i=fg(a);if(null==i.expr)return Me("The selector `"+e+"`is invalid"),!1;var s=i.match.slice(1),o=i.expr.populate(t,n,s);if(!1===o)return!1;if(null!=o&&(n=o),(a=i.remaining).match(/^\s*$/))break}var l=t[t.length-1];null!=t.currentSubject&&(l.subject=t.currentSubject),l.edgeCount=t.edgeCount,l.compoundCount=t.compoundCount;for(var u=0;u<t.length;u++){var v=t[u];if(v.compoundCount>0&&v.edgeCount>0)return Me("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(v.edgeCount>1)return Me("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===v.edgeCount&&Me("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(v){return v??""},t=function(v){return ve(v)?'"'+v+'"':e(v)},a=function(v){return" "+v+" "},i=function(v,f){return v.checks.reduce(function(c,h,d){return c+(f===v&&0===d?"$":"")+function(v,f){var c=v.type,h=v.value;switch(c){case ie_GROUP:var d=e(h);return d.substring(0,d.length-1);case ie_DATA_COMPARE:var y=v.field,g=v.operator;return"["+y+a(e(g))+t(h)+"]";case ie_DATA_BOOL:var p=v.operator,m=v.field;return"["+e(p)+m+"]";case ie_DATA_EXIST:return"["+v.field+"]";case ie_META_COMPARE:var w=v.operator;return"[["+v.field+a(e(w))+t(h)+"]]";case ie_STATE:return h;case ie_ID:return"#"+h;case ie_CLASS:return"."+h;case ie_PARENT:case ie_CHILD:return i(v.parent,f)+a(">")+i(v.child,f);case ie_ANCESTOR:case ie_DESCENDANT:return i(v.ancestor,f)+" "+i(v.descendant,f);case ie_COMPOUND_SPLIT:var C=i(v.left,f),x=i(v.subject,f),k=i(v.right,f);return C+(C.length>0?" ":"")+x+k;case ie_TRUE:return""}}(h,f)},"")},s="",o=0;o<this.length;o++){var l=this[o];s+=i(l,l.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s}},zl=function(e,t,a){var n,l,u,i=ve(e),s=te(e),o=ve(a),v=!1,f=!1,c=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),v=!0),(i||o||v)&&(l=i||s?""+e:"",u=""+a),v&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),t){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=0===l.indexOf(u);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}return f&&(null!=e||!c)&&(n=!n),n},Ls=function(e,t){return e.data(t)},Ue=[],_e=function(e,t){return e.checks.every(function(a){return Ue[a.type](a,t)})};Ue[ie_GROUP]=function(r,e){var t=r.value;return"*"===t||t===e.group()},Ue[ie_STATE]=function(r,e){return function(e,t){return ug[e](t)}(r.value,e)},Ue[ie_ID]=function(r,e){var t=r.value;return e.id()===t},Ue[ie_CLASS]=function(r,e){var t=r.value;return e.hasClass(t)},Ue[ie_META_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return zl(function(e,t){return e[t]()}(e,t),a,n)},Ue[ie_DATA_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return zl(Ls(e,t),a,n)},Ue[ie_DATA_BOOL]=function(r,e){var t=r.field,a=r.operator;return function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}}(Ls(e,t),a)},Ue[ie_DATA_EXIST]=function(r,e){var t=r.field;return r.operator,function(e){return void 0!==e}(Ls(e,t))},Ue[ie_UNDIRECTED_EDGE]=function(r,e){var t=r.nodes[0],a=r.nodes[1],n=e.source(),i=e.target();return _e(t,n)&&_e(a,i)||_e(a,n)&&_e(t,i)},Ue[ie_NODE_NEIGHBOR]=function(r,e){return _e(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&_e(r.neighbor,t)})},Ue[ie_DIRECTED_EDGE]=function(r,e){return _e(r.source,e.source())&&_e(r.target,e.target())},Ue[ie_NODE_SOURCE]=function(r,e){return _e(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&_e(r.target,t)})},Ue[ie_NODE_TARGET]=function(r,e){return _e(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&_e(r.source,t)})},Ue[ie_CHILD]=function(r,e){return _e(r.child,e)&&_e(r.parent,e.parent())},Ue[ie_PARENT]=function(r,e){return _e(r.parent,e)&&e.children().some(function(t){return _e(r.child,t)})},Ue[ie_DESCENDANT]=function(r,e){return _e(r.descendant,e)&&e.ancestors().some(function(t){return _e(r.ancestor,t)})},Ue[ie_ANCESTOR]=function(r,e){return _e(r.ancestor,e)&&e.descendants().some(function(t){return _e(r.descendant,t)})},Ue[ie_COMPOUND_SPLIT]=function(r,e){return _e(r.subject,e)&&_e(r.left,e)&&_e(r.right,e)},Ue[ie_TRUE]=function(){return!0},Ue[ie_COLLECTION]=function(r,e){return r.value.has(e)},Ue[ie_FILTER]=function(r,e){return(0,r.value)(e)};var xg={matches:function(e){for(var a=0;a<this.length;a++){var n=this[a];if(_e(n,e))return!0}return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===ie_ID)return e.getElementById(t[0].checks[0].value).collection();var a=function(i){for(var s=0;s<t.length;s++){var o=t[s];if(_e(o,i))return!0}return!1};return null==t.text()&&(a=function(){return!0}),e.filter(a)}},st=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||ve(e)&&e.match(/^\s*$/)||(Dr(e)?this.addQuery({checks:[{type:ie_COLLECTION,value:e.collection()}]}):He(e)?this.addQuery({checks:[{type:ie_FILTER,value:e}]}):ve(e)?this.parse(e)||(this.invalid=!0):We("A selector must be created from a string; found "))},ot=st.prototype;[gg,xg].forEach(function(r){return he(ot,r)}),ot.text=function(){return this.inputText},ot.size=function(){return this.length},ot.eq=function(r){return this[r]},ot.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()},ot.addQuery=function(r){this[this.length++]=r},ot.selector=ot.toString;var ut={allAre:function(e){var t=new st(e);return this.every(function(a){return t.matches(a)})},is:function(e){var t=new st(e);return this.some(function(a){return t.matches(a)})},some:function(e,t){for(var a=0;a<this.length;a++){if(t?e.apply(t,[this[a],a,this]):e(this[a],a,this))return!0}return!1},every:function(e,t){for(var a=0;a<this.length;a++){if(!(t?e.apply(t,[this[a],a,this]):e(this[a],a,this)))return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(a){return t.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(a){return t.hasElementWithId(a.id())})}};ut.allAreNeighbours=ut.allAreNeighbors,ut.has=ut.contains,ut.equal=ut.equals=ut.same;var ba,ql,kr=function(e,t){return function(n,i,s,o){var v,l=n,u=this;if(null==l?v="":Dr(l)&&1===l.length&&(v=l.id()),1===u.length&&v){var f=u[0]._private,c=f.traversalCache=f.traversalCache||{},h=c[t]=c[t]||[],d=pt(v);return h[d]||(h[d]=e.call(u,n,i,s,o))}return e.call(u,n,i,s,o)}},Wt={parent:function(e){var t=[];if(1===this.length){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var s=this[n]._private.parent;s&&t.push(s)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];t.push(i)}a=a.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,a=0;a<this.length;a++){var i=this[a].parents();t=(t=t||i).intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:kr(function(r){for(var e=[],t=0;t<this.length;t++)for(var n=this[t]._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(r)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return function a(n){for(var i=0;i<n.length;i++){var s=n[i];t.push(s),s.children().nonempty()&&a(s.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function Is(r,e,t,a){for(var n=[],i=new It,o=r.cy().hasCompoundNodes(),l=0;l<r.length;l++){var u=r[l];t?n.push(u):o&&a(n,i,u)}for(;n.length>0;){var v=n.shift();e(v),i.add(v.id()),o&&a(n,i,v)}return r}function Fl(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||r.push(i)}}function Vl(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}function Eg(r,e,t){Vl(r,e,t),Fl(r,e,t)}Wt.forEachDown=function(r){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Is(this,r,e,Fl)},Wt.forEachUp=function(r){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Is(this,r,e,Vl)},Wt.forEachUpAndDown=function(r){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Is(this,r,e,Eg)},Wt.ancestors=Wt.parents,ba=ql={data:Le.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:Le.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Le.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Le.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Le.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Le.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},ba.attr=ba.data,ba.removeAttr=ba.removeData;var Cg=ql,gn={};function Os(r){return function(e){var t=this;if(void 0===e&&(e=!0),0===t.length);else if(t.isNode()&&!t.removed()){for(var a=0,n=t[0],i=n._private.edges,s=0;s<i.length;s++){var o=i[s];!e&&o.isLoop()||(a+=r(n,o))}return a}}}function Ut(r,e){return function(t){for(var a,n=this.nodes(),i=0;i<n.length;i++){var o=n[i][r](t);void 0!==o&&(void 0===a||e(o,a))&&(a=o)}return a}}he(gn,{degree:Os(function(r,e){return e.source().same(e.target())?2:1}),indegree:Os(function(r,e){return e.target().same(r)?1:0}),outdegree:Os(function(r,e){return e.source().same(r)?1:0})}),he(gn,{minDegree:Ut("degree",function(r,e){return r<e}),maxDegree:Ut("degree",function(r,e){return r>e}),minIndegree:Ut("indegree",function(r,e){return r<e}),maxIndegree:Ut("indegree",function(r,e){return r>e}),minOutdegree:Ut("outdegree",function(r,e){return r<e}),maxOutdegree:Ut("outdegree",function(r,e){return r>e})}),he(gn,{totalDegree:function(e){for(var t=0,a=this.nodes(),n=0;n<a.length;n++)t+=a[n].degree(e);return t}});var Rr,_l,Gl=function(e,t,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var s=i._private.position,o={x:null!=t.x?t.x-s.x:0,y:null!=t.y?t.y-s.y:0};i.isParent()&&!(0===o.x&&0===o.y)&&i.children().shift(o,a),i.dirtyBoundingBoxCache()}}},Hl={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){Gl(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Rr=_l={position:Le.data(Hl),silentPosition:Le.data(he({},Hl,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Gl(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(ke(e))t?this.silentPosition(e):this.position(e);else if(He(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var o,s=this[i];(o=a(s,i))&&(t?s.silentPosition(o):s.position(o))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,a){var n;if(ke(e)?(n={x:te(e.x)?e.x:0,y:te(e.y)?e.y:0},a=t):ve(e)&&te(t)&&((n={x:0,y:0})[e]=t),null!=n){var i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var l=o.position(),u={x:l.x+n.x,y:l.y+n.y};a?o.silentPosition(u):o.position(u)}}i.endBatch()}return this},silentShift:function(e,t){return ke(e)?this.shift(e,!0):ve(e)&&te(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var a=this[0],n=this.cy(),i=n.zoom(),s=n.pan(),o=ke(e)?e:void 0,l=void 0!==o||void 0!==t&&ve(e);if(a&&a.isNode()){if(!l){var f=a.position();return o=Ja(f,i,s),void 0===e?o:o[e]}for(var u=0;u<this.length;u++){var v=this[u];void 0!==t?v.position(e,(t-s[e])/i):void 0!==o&&v.position(nu(o,i,s))}}else if(!l)return;return this},relativePosition:function(e,t){var a=this[0],n=this.cy(),i=ke(e)?e:void 0,s=void 0!==i||void 0!==t&&ve(e),o=n.hasCompoundNodes();if(a&&a.isNode()){if(!s){var d=a.position(),y=o?a.parent():null,g=y&&y.length>0,p=g;g&&(y=y[0]);var m=p?y.position():{x:0,y:0};return i={x:d.x-m.x,y:d.y-m.y},void 0===e?i:i[e]}for(var l=0;l<this.length;l++){var u=this[l],v=o?u.parent():null,f=v&&v.length>0,c=f;f&&(v=v[0]);var h=c?v.position():{x:0,y:0};void 0!==t?u.position(e,t+h[e]):void 0!==i&&u.position({x:i.x+h.x,y:i.y+h.y})}}else if(!s)return;return this}},Rr.modelPosition=Rr.point=Rr.position,Rr.modelPositions=Rr.points=Rr.positions,Rr.renderedPoint=Rr.renderedPosition,Rr.relativePoint=Rr.relativePosition;var $t,lt,Tg=_l;$t=lt={},lt.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}},lt.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.cy();return e.styleEnabled()&&e.hasCompoundNodes()?(this.forEachUp(function(t){if(t.isParent()){var a=t._private;a.compoundBoundsClean=!1,a.bbCache=null,r||t.emitAndNotify("bounds")}}),this):this},lt.updateCompoundBounds=function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(s){if(s.isParent()){var o=s._private,l=s.children(),u="include"===s.pstyle("compound-sizing-wrt-labels").value,v={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=o.position;(0===f.w||0===f.h)&&((f={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue}).x1=c.x-f.w/2,f.x2=c.x+f.w/2,f.y1=c.y-f.h/2,f.y2=c.y+f.h/2);var y=v.width.left.value;"px"===v.width.left.units&&v.width.val>0&&(y=100*y/v.width.val);var g=v.width.right.value;"px"===v.width.right.units&&v.width.val>0&&(g=100*g/v.width.val);var p=v.height.top.value;"px"===v.height.top.units&&v.height.val>0&&(p=100*p/v.height.val);var m=v.height.bottom.value;"px"===v.height.bottom.units&&v.height.val>0&&(m=100*m/v.height.val);var b=h(v.width.val-f.w,y,g),w=b.biasDiff,E=b.biasComplementDiff,C=h(v.height.val-f.h,p,m),x=C.biasDiff,k=C.biasComplementDiff;o.autoPadding=function d(S,P,D,A){if("%"!==D.units)return"px"===D.units?D.pfValue:0;switch(A){case"width":return S>0?D.pfValue*S:0;case"height":return P>0?D.pfValue*P:0;case"average":return S>0&&P>0?D.pfValue*(S+P)/2:0;case"min":return S>0&&P>0?S>P?D.pfValue*P:D.pfValue*S:0;case"max":return S>0&&P>0?S>P?D.pfValue*S:D.pfValue*P:0;default:return 0}}(f.w,f.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(f.w,v.width.val),c.x=(-w+f.x1+f.x2+E)/2,o.autoHeight=Math.max(f.h,v.height.val),c.y=(-x+f.y1+f.y2+k)/2}function h(S,P,D){var A=0,B=0,R=P+D;return S>0&&R>0&&(A=P/R*S,B=D/R*S),{biasDiff:A,biasComplementDiff:B}}}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||r)&&(t(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var Br=function(e){return e===1/0||e===-1/0?0:e},Mr=function(e,t,a,n,i){n-t==0||i-a==0||null==t||null==a||null==n||null==i||(e.x1=t<e.x1?t: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)},xt=function(e,t){return null==t?e:Mr(e,t.x1,t.y1,t.x2,t.y2)},wa=function(e,t,a){return wr(e,t,a)},pn=function(e,t,a){if(!t.cy().headless()){var l,u,n=t._private,i=n.rstyle,s=i.arrowWidth/2;if("none"!==t.pstyle(a+"-arrow-shape").value){"source"===a?(l=i.srcX,u=i.srcY):"target"===a?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var v=n.arrowBounds=n.arrowBounds||{},f=v[a]=v[a]||{};f.x1=l-s,f.y1=u-s,f.x2=l+s,f.y2=u+s,f.w=f.x2-f.x1,f.h=f.y2-f.y1,en(f,1),Mr(e,f.x1,f.y1,f.x2,f.y2)}}},Ns=function(e,t,a){if(!t.cy().headless()){var n;n=a?a+"-":"";var i=t._private,s=i.rstyle;if(t.pstyle(n+"label").strValue){var D,A,B,R,l=t.pstyle("text-halign"),u=t.pstyle("text-valign"),v=wa(s,"labelWidth",a),f=wa(s,"labelHeight",a),c=wa(s,"labelX",a),h=wa(s,"labelY",a),d=t.pstyle(n+"text-margin-x").pfValue,y=t.pstyle(n+"text-margin-y").pfValue,g=t.isEdge(),p=t.pstyle(n+"text-rotation"),m=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,x=f,k=v,S=k/2,P=x/2;if(g)D=c-S,A=c+S,B=h-P,R=h+P;else{switch(l.value){case"left":D=c-k,A=c;break;case"center":D=c-S,A=c+S;break;case"right":D=c,A=c+k}switch(u.value){case"top":B=h-x,R=h;break;case"center":B=h-P,R=h+P;break;case"bottom":B=h,R=h+x}}var M=d-Math.max(m,w)-E-2,I=d+Math.max(m,w)+E+2,L=y-Math.max(m,w)-E-2,O=y+Math.max(m,w)+E+2;D+=M,A+=I,B+=L,R+=O;var V=a||"main",G=i.labelBounds,N=G[V]=G[V]||{};N.x1=D,N.y1=B,N.x2=A,N.y2=R,N.w=A-D,N.h=R-B,N.leftPad=M,N.rightPad=I,N.topPad=L,N.botPad=O;var F=g&&"autorotate"===p.strValue,K=null!=p.pfValue&&0!==p.pfValue;if(F||K){var X=F?wa(i.rstyle,"labelAngle",a):p.pfValue,Q=Math.cos(X),Z=Math.sin(X),re=(D+A)/2,ae=(B+R)/2;if(!g){switch(l.value){case"left":re=A;break;case"right":re=D}switch(u.value){case"top":ae=R;break;case"bottom":ae=B}}var J=function(Ie,se){return{x:(Ie-=re)*Q-(se-=ae)*Z+re,y:Ie*Z+se*Q+ae}},z=J(D,B),q=J(D,R),H=J(A,B),ee=J(A,R);D=Math.min(z.x,q.x,H.x,ee.x),A=Math.max(z.x,q.x,H.x,ee.x),B=Math.min(z.y,q.y,H.y,ee.y),R=Math.max(z.y,q.y,H.y,ee.y)}var ne=V+"Rot",be=G[ne]=G[ne]||{};be.x1=D,be.y1=B,be.x2=A,be.y2=R,be.w=A-D,be.h=R-B,Mr(e,D,B,A,R),Mr(i.labelBounds.all,D,B,A,R)}return e}},Dg=function(e,t){var v,f,c,h,d,y,a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=xr(),o=e._private,l=e.isNode(),u=e.isEdge(),g=o.rstyle,p=l&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(Ge){return"none"!==Ge.pstyle("display").value},b=!n||m(e)&&(!u||m(e.source())&&m(e.target()));if(b){var E=0;n&&t.includeOverlays&&(0!==e.pstyle("overlay-opacity").value&&(E=e.pstyle("overlay-padding").value));var x=0;n&&t.includeUnderlays&&(0!==e.pstyle("underlay-opacity").value&&(x=e.pstyle("underlay-padding").value));var k=Math.max(E,x),P=0;if(n&&(P=e.pstyle("width").pfValue/2),l&&t.includeNodes){var D=e.position();d=D.x,y=D.y;var B=e.outerWidth()/2,M=e.outerHeight()/2;Mr(s,v=d-B,c=y-M,f=d+B,h=y+M),n&&t.includeOutlines&&function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value;if(a>0&&n>0){var i=t.pstyle("outline-offset").value,s=t.pstyle("shape").value,o=n+i,l=(e.w+2*o)/e.w,u=(e.h+2*o)/e.h,f=0;["diamond","pentagon","round-triangle"].includes(s)?(l=(e.w+2.4*o)/e.w,f=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?l=(e.w+2.4*o)/e.w:"star"===s?(l=(e.w+2.8*o)/e.w,u=(e.h+2.6*o)/e.h,f=-o/3.8):"triangle"===s?(l=(e.w+2.8*o)/e.w,u=(e.h+2.4*o)/e.h,f=-o/1.4):"vee"===s&&(l=(e.w+4.4*o)/e.w,u=(e.h+3.8*o)/e.h,f=.5*-o);var c=e.h*u-e.h,h=e.w*l-e.w;if(rn(e,[Math.ceil(c/2),Math.ceil(h/2)]),0!==f){var d=function(e,t,a){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}}(e,0,f);iu(e,d)}}}}(s,e)}else if(u&&t.includeEdges)if(n&&!i){var I=e.pstyle("curve-style").strValue;if(v=Math.min(g.srcX,g.midX,g.tgtX),f=Math.max(g.srcX,g.midX,g.tgtX),c=Math.min(g.srcY,g.midY,g.tgtY),h=Math.max(g.srcY,g.midY,g.tgtY),Mr(s,v-=P,c-=P,f+=P,h+=P),"haystack"===I){var L=g.haystackPts;if(L&&2===L.length){if(v=L[0].x,c=L[0].y,v>(f=L[1].x)){var O=v;v=f,f=O}if(c>(h=L[1].y)){var V=c;c=h,h=V}Mr(s,v-P,c-P,f+P,h+P)}}else if("bezier"===I||"unbundled-bezier"===I||I.endsWith("segments")||I.endsWith("taxi")){var G;switch(I){case"bezier":case"unbundled-bezier":G=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":G=g.linePts}if(null!=G)for(var N=0;N<G.length;N++){var F=G[N];v=F.x-P,f=F.x+P,c=F.y-P,h=F.y+P,Mr(s,v,c,f,h)}}}else{var X=e.source().position(),Z=e.target().position();if((v=X.x)>(f=Z.x)){var re=v;v=f,f=re}if((c=X.y)>(h=Z.y)){var ae=c;c=h,h=ae}Mr(s,v-=P,c-=P,f+=P,h+=P)}if(n&&t.includeEdges&&u&&(pn(s,e,"mid-source"),pn(s,e,"mid-target"),pn(s,e,"source"),pn(s,e,"target")),n)if("yes"===e.pstyle("ghost").value){var z=e.pstyle("ghost-offset-x").pfValue,q=e.pstyle("ghost-offset-y").pfValue;Mr(s,s.x1+z,s.y1+q,s.x2+z,s.y2+q)}var H=o.bodyBounds=o.bodyBounds||{};su(H,s),rn(H,p),en(H,1),n&&(v=s.x1,f=s.x2,c=s.y1,h=s.y2,Mr(s,v-k,c-k,f+k,h+k));var ee=o.overlayBounds=o.overlayBounds||{};su(ee,s),rn(ee,p),en(ee,1);var ne=o.labelBounds=o.labelBounds||{};null!=ne.all?function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0}(ne.all):ne.all=xr(),n&&t.includeLabels&&(t.includeMainLabels&&Ns(s,e,null),u&&(t.includeSourceLabels&&Ns(s,e,"source"),t.includeTargetLabels&&Ns(s,e,"target")))}return s.x1=Br(s.x1),s.y1=Br(s.y1),s.x2=Br(s.x2),s.y2=Br(s.y2),s.w=Br(s.x2-s.x1),s.h=Br(s.y2-s.y1),s.w>0&&s.h>0&&b&&(rn(s,p),en(s,1)),s},Wl=function(e){var t=0,a=function(s){return(s?1:0)<<t++},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)},Ul=function(e){var t=function(o){return Math.round(o)};if(e.isEdge()){var a=e.source().position(),n=e.target().position();return Ko([t(a.x),t(a.y),t(n.x),t(n.y)])}var i=e.position();return Ko([t(i.x),t(i.y)])},$l=function(e,t){var n,a=e._private,i=e.isEdge(),o=(null==t?Kl:Wl(t))===Kl;if(null==a.bbCache?(n=Dg(e,xa),a.bbCache=n,a.bbCachePosKey=Ul(e)):n=a.bbCache,!o){var l=e.isNode();n=xr(),(t.includeNodes&&l||t.includeEdges&&!l)&&(t.includeOverlays?xt(n,a.overlayBounds):xt(n,a.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?xt(n,a.labelBounds.all):(t.includeMainLabels&&xt(n,a.labelBounds.mainRot),t.includeSourceLabels&&xt(n,a.labelBounds.sourceRot),t.includeTargetLabels&&xt(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},xa={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Kl=Wl(xa),Yl=or(xa);lt.boundingBox=function(r){var e,t=void 0===r||void 0===r.useCache||!0===r.useCache,a=Mt(function(v){var f=v._private;return null==f.bbCache||f.styleDirty||f.bbCachePosKey!==Ul(v)},function(v){return v.id()});if(t&&1===this.length&&!a(this[0]))r=void 0===r?xa:Yl(r),e=$l(this[0],r);else{e=xr();var n=Yl(r=r||xa),i=this,o=i.cy().styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),o&&this.recalculateRenderedStyle(t),this.updateCompoundBounds(!t);for(var l=0;l<i.length;l++){var u=i[l];a(u)&&u.dirtyBoundingBoxCache(),xt(e,$l(u,n))}}return e.x1=Br(e.x1),e.y1=Br(e.y1),e.x2=Br(e.x2),e.y2=Br(e.y2),e.w=Br(e.x2-e.x1),e.h=Br(e.y2-e.y1),e},lt.dirtyBoundingBoxCache=function(){for(var r=0;r<this.length;r++){var e=this[r]._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},lt.boundingBoxAt=function(r){var e=this.nodes(),t=this.cy(),a=t.hasCompoundNodes(),n=t.collection();if(a&&(n=e.filter(function(u){return u.isParent()}),e=e.not(n)),ke(r)){var i=r;r=function(){return i}}t.startBatch(),e.forEach(function(v,f){return v._private.bbAtOldPos=r(v,f)}).silentPositions(r),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var l=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}}(this.boundingBox({useCache:!1}));return e.silentPositions(function(v){return v._private.bbAtOldPos}),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),t.endBatch(),l},$t.boundingbox=$t.bb=$t.boundingBox,$t.renderedBoundingbox=$t.renderedBoundingBox;var Ea,Ca,kg=lt;Ea=Ca={};var Xl=function(e){e.uppercaseName=To(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=To(e.outerName),Ea[e.name]=function(){var a=this[0],n=a._private,s=n.cy._private.styleEnabled;if(a){if(s){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var o=a.pstyle(e.name);return"label"===o.strValue?(a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):o.pfValue}return 1}},Ea["outer"+e.uppercaseName]=function(){var a=this[0],s=a._private.cy._private.styleEnabled;if(a){if(s){var o=a[e.name](),l=a.pstyle("border-position").value;return o+("center"===l?a.pstyle("border-width").pfValue:"outside"===l?2*a.pstyle("border-width").pfValue:0)+2*a.padding()}return 1}},Ea["rendered"+e.uppercaseName]=function(){var a=this[0];if(a)return a[e.name]()*this.cy().zoom()},Ea["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a)return a[e.outerName]()*this.cy().zoom()}};Xl({name:"width"}),Xl({name:"height"}),Ca.padding=function(){var r=this[0],e=r._private;return r.isParent()?(r.updateCompoundBounds(),void 0!==e.autoPadding?e.autoPadding:r.pstyle("padding").pfValue):r.pstyle("padding").pfValue},Ca.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()},Ca.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var Bg=Ca,Zl={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},Fg=Object.keys(Zl).reduce(function(r,e){var t=Zl[e],a=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)}(e);return r[e]=function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)}(this,t.get)},t.mult?r[a]=function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),n=a.pan(),i=a.zoom();return t(e).map(function(s){return Ja(s,i,n)})}}(this,t.get)}:r[a]=function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return Ja(t(e),a.zoom(),a.pan())}}(this,t.get)},r},{}),Vg=he({},Tg,kg,Bg,Fg),Ql=function(e,t){this.recycle(e,t)};function Ta(){return!1}function yn(){return!0}Ql.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Ta,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?yn:Ta):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var 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=yn;var e=this.originalEvent;!e||e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=yn;var e=this.originalEvent;!e||e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=yn,this.stopPropagation()},isDefaultPrevented:Ta,isPropagationStopped:Ta,isImmediatePropagationStopped:Ta};var Jl=/^([^.]+)(\.(?:[^.]+))?$/,jl={qualifierCompare:function(e,t){return e===t},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},ev=Object.keys(jl),_g={};function mn(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_g,e=arguments.length>1?arguments[1]:void 0,t=0;t<ev.length;t++){var a=ev[t];this[a]=r[a]||jl[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var vt=mn.prototype,rv=function(e,t,a,n,i,s,o){He(n)&&(i=n,n=null),o&&(s=null==s?o:he({},s,o));for(var l=ze(a)?a:a.split(/\s+/),u=0;u<l.length;u++){var v=l[u];if(!et(v)){var f=v.match(Jl);if(f)if(!1===t(e,v,f[1],f[2]?f[2]:null,n,i,s))break}}},tv=function(e,t){return e.addEventFields(e.context,t),new Ql(t.type,t)},Gg=function(e,t,a){if(function(e){return"event"===ia(e)}(a))t(e,a);else if(ke(a))t(e,tv(e,a));else for(var n=ze(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var s=n[i];if(!et(s)){var o=s.match(Jl);if(o){var l=o[1],u=o[2]?o[2]:null;t(e,tv(e,{type:l,namespace:u,target:e.context}))}}}};vt.on=vt.addListener=function(r,e,t,a,n){return rv(this,function(i,s,o,l,u,v,f){He(v)&&i.listeners.push({event:s,callback:v,type:o,namespace:l,qualifier:u,conf:f})},r,e,t,a,n),this},vt.one=function(r,e,t,a){return this.on(r,e,t,a,{one:!0})},vt.removeListener=vt.off=function(r,e,t,a){var n=this;0!==this.emitting&&(this.listeners=function(e){return e.slice()}(this.listeners));for(var i=this.listeners,s=function(u){var v=i[u];rv(n,function(f,c,h,d,y,g){if((v.type===h||"*"===r)&&(!d&&".*"!==v.namespace||v.namespace===d)&&(!y||f.qualifierCompare(v.qualifier,y))&&(!g||v.callback===g))return i.splice(u,1),!1},r,e,t,a)},o=i.length-1;o>=0;o--)s(o);return this},vt.removeAllListeners=function(){return this.removeListener("*")},vt.emit=vt.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,ze(e)||(e=[e]),Gg(this,function(i,s){null!=t&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:t}],n=a.length);for(var o=function(){var v=a[l];if(v.type===s.type&&(!v.namespace||v.namespace===s.namespace||".*"===v.namespace)&&i.eventMatches(i.context,v,s)){var f=[s];null!=e&&function(e,t){for(var a=0;a<t.length;a++){var n=t[a];e.push(n)}}(f,e),i.beforeEmit(i.context,v,s),v.conf&&v.conf.one&&(i.listeners=i.listeners.filter(function(d){return d!==v}));var c=i.callbackContext(i.context,v,s),h=v.callback.apply(c,f);i.afterEmit(i.context,v,s),!1===h&&(s.stopPropagation(),s.preventDefault())}},l=0;l<n;l++)o();i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,e)},r),this.emitting--,this};var Hg={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return null==n||e!==a.target&&sa(a.target)&&n.matches(a.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,a){return null!=t.qualifier?a.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},bn=function(e){return ve(e)?new st(e):e},av={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],a=t._private;a.emitter||(a.emitter=new mn(Hg,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,a){for(var n=bn(t),i=0;i<this.length;i++){this[i].emitter().on(e,n,a)}return this},removeListener:function(e,t,a){for(var n=bn(t),i=0;i<this.length;i++){this[i].emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){this[e].emitter().removeAllListeners()}return this},one:function(e,t,a){for(var n=bn(t),i=0;i<this.length;i++){this[i].emitter().one(e,n,a)}return this},once:function(e,t,a){for(var n=bn(t),i=0;i<this.length;i++){this[i].emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,t){for(var a=0;a<this.length;a++){this[a].emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};Le.eventAliasesOn(av);var nv={nodes:function(e){return this.filter(function(t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):t.push(n)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(ve(e)||Dr(e))return new st(e).filter(this);if(He(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var s=n[i];(t?e.apply(t,[s,i,n]):e(s,i,n))&&a.push(s)}return a}return this.spawn()},not:function(e){if(e){ve(e)&&(e=this.filter(e));for(var t=this.spawn(),a=0;a<this.length;a++){var n=this[a];e.has(n)||t.push(n)}return t}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(ve(e)){var t=e;return this.filter(t)}for(var a=this.spawn(),i=e,s=this.length<e.length,o=s?this:i,l=s?i:this,u=0;u<o.length;u++){var v=o[u];l.has(v)&&a.push(v)}return a},xor:function(e){var t=this._private.cy;ve(e)&&(e=t.$(e));var a=this.spawn(),i=e,s=function(l,u){for(var v=0;v<l.length;v++){var f=l[v],c=f._private.data.id;u.hasElementWithId(c)||a.push(f)}};return s(this,i),s(i,this),a},diff:function(e){var t=this._private.cy;ve(e)&&(e=t.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),o=e,l=function(v,f,c){for(var h=0;h<v.length;h++){var d=v[h],y=d._private.data.id;f.hasElementWithId(y)?i.merge(d):c.push(d)}};return l(this,o,a),l(o,this,n),{left:a,right:n,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(ve(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var s=e[i];!this.has(s)&&n.push(s)}return n},merge:function(e){var t=this._private,a=t.cy;if(!e)return this;if(e&&ve(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=t.map,s=0;s<e.length;s++){var o=e[s],l=o._private.data.id;if(!i.has(l)){var v=this.length++;this[v]=o,i.set(l,{ele:o,index:v})}}return this},unmergeAt:function(e){var a=this[e].id(),i=this._private.map;this[e]=void 0,i.delete(a);var s=e===this.length-1;if(this.length>1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,a=e._private.data.id,i=t.map.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&ve(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var a=[],n=this,i=0;i<n.length;i++){var s=n[i],o=t?e.apply(t,[s,i,n]):e(s,i,n);a.push(o)}return a},reduce:function(e,t){for(var a=t,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,t){for(var n,a=-1/0,i=this,s=0;s<i.length;s++){var o=i[s],l=t?e.apply(t,[o,s,i]):e(o,s,i);l>a&&(a=l,n=o)}return{value:a,ele:n}},min:function(e,t){for(var n,a=1/0,i=this,s=0;s<i.length;s++){var o=i[s],l=t?e.apply(t,[o,s,i]):e(o,s,i);l<a&&(a=l,n=o)}return{value:a,ele:n}}},Ae=nv;Ae.u=Ae["|"]=Ae["+"]=Ae.union=Ae.or=Ae.add,Ae["\\"]=Ae["!"]=Ae["-"]=Ae.difference=Ae.relativeComplement=Ae.subtract=Ae.not,Ae.n=Ae["&"]=Ae["."]=Ae.and=Ae.intersection=Ae.intersect,Ae["^"]=Ae["(+)"]=Ae["(-)"]=Ae.symmetricDifference=Ae.symdiff=Ae.xor,Ae.fnFilter=Ae.filterFn=Ae.stdFilter=Ae.filter,Ae.complement=Ae.abscomp=Ae.absoluteComplement;var iv=function(e,t){var n=e.cy().hasCompoundNodes();function i(v){var f=v.pstyle("z-compound-depth");return"auto"===f.value?n?v.zDepth():0:"bottom"===f.value?-1:"top"===f.value?hi:0}var s=i(e)-i(t);if(0!==s)return s;function o(v){return"auto"===v.pstyle("z-index-compare").value&&v.isNode()?1:0}var l=o(e)-o(t);if(0!==l)return l;var u=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==u?u:e.poolIndex()-t.poolIndex()},wn={forEach:function(e,t){if(He(e))for(var a=this.length,n=0;n<a;n++){var i=this[n];if(!1===(t?e.apply(t,[i,n,this]):e(i,n,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var a=[],n=this.length;null==t&&(t=n),null==e&&(e=0),e<0&&(e=n+e),t<0&&(t=n+t);for(var i=e;i>=0&&i<t&&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 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!He(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(iv)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:hi-1}var i=t.source,s=t.target,o=i.zDepth(),l=s.zDepth();return Math.max(o,l,0)}}};wn.each=wn.forEach;var e;e="undefined",(typeof Symbol>"u"?"undefined":Je(Symbol))!=e&&Je(Symbol.iterator)!=e&&(wn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return yo({next:function(){return i<s?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})});var $g=or({nodeDimensionsIncludeLabels:!1}),xn={layoutDimensions:function(e){var t;if(e=$g(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();t={w:a.w,h:a.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return(0===t.w||0===t.h)&&(t.w=t.h=1),t},layoutPositions:function(e,t,a){var n=this.nodes().filter(function(E){return!E.isParent()}),i=this.cy(),s=t.eles,o=function(C){return C.id()},l=Mt(a,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var v=t.spacingFactor&&1!==t.spacingFactor,c=function(){if(!v)return null;for(var C=xr(),x=0;x<n.length;x++){var k=n[x],S=l(k,x);ld(C,S.x,S.y)}return C}(),h=Mt(function(E,C){var x=l(E,C);v&&(x=function(C,x,k){var S_x=x.x1+x.w/2,S_y=x.y1+x.h/2;return{x:S_x+(k.x-S_x)*C,y:S_y+(k.y-S_y)*C}}(Math.abs(t.spacingFactor),c,x));return null!=t.transform&&(x=t.transform(E,x)),x},o);if(t.animate){for(var d=0;d<n.length;d++){var y=n[d],g=h(y,d);if(null==t.animateFilter||t.animateFilter(y,d)){var m=y.animation({position:g,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(m)}else y.position(g)}if(t.fit){var b=i.animation({fit:{boundingBox:s.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}else if(void 0!==t.zoom&&void 0!==t.pan){var w=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(w)}e.animations.forEach(function(E){return E.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Gt.all(e.animations.map(function(E){return E.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(h),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(he({},e,{eles:this}))}};function sv(r,e,t){var i,a=t._private,n=a.styleCache=a.styleCache||[];return null!=(i=n[r])||(i=n[r]=e(t)),i}function En(r,e){return r=pt(r),function(a){return sv(r,e,a)}}function Cn(r,e){r=pt(r);var t=function(n){return e.call(n)};return function(){var n=this[0];if(n)return sv(r,t,n)}}xn.createLayout=xn.makeLayout=xn.layout;var ur={recalculateRenderedStyle:function(e){var t=this.cy(),a=t.renderer(),n=t.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var a,e=this.cy(),t=function(i){return i._private.styleCache=null};e.hasCompoundNodes()?((a=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(a.connectedEdges()),a.forEach(t)):this.forEach(function(n){t(n),n.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var i=this;e=!(!e&&void 0!==e),t.hasCompoundNodes()&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=i;return e?s.emitAndNotify("style"):s.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var a=this[t];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],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??(t?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var a=t.pstyle(e);return void 0!==a.pfValue?a.pfValue:a.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=this[0];return a?t.style().getRenderedStyle(a,e):void 0},style:function(e,t){var a=this.cy();if(!a.styleEnabled())return this;var i=a.style();if(ke(e)){var s=e;i.applyBypass(this,s,false),this.emitAndNotify("style")}else if(ve(e)){if(void 0===t){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}i.applyBypass(this,e,t,false),this.emitAndNotify("style")}else if(void 0===e){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style(),i=this;if(void 0===e)for(var s=0;s<i.length;s++){var o=i[s];n.removeAllBypasses(o,false)}else{e=e.split(/\s+/);for(var l=0;l<i.length;l++){var u=i[l];n.removeBypasses(u,e,false)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!t)return i;var s=n.data.parent?a.parents():null;if(s)for(var o=0;o<s.length;o++){i*=s[o].pstyle("opacity").value}return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var t=this[0],a=t.cy().hasCompoundNodes();return t?a?0===t.effectiveOpacity():0===t.pstyle("opacity").value:void 0},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function zs(r,e){var a=r._private.data.parent?r.parents():null;if(a)for(var n=0;n<a.length;n++){if(!e(a[n]))return!1}return!0}function Fs(r){var e=r.ok,t=r.edgeOkViaNode||r.ok,a=r.parentOk||r.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],s=n.hasCompoundNodes();if(i){var o=i._private;if(!e(i))return!1;if(i.isNode())return!s||zs(i,a);var l=o.source,u=o.target;return t(l)&&(!s||zs(l,t))&&(l===u||t(u)&&(!s||zs(u,t)))}}}var Kt=En("eleTakesUpSpace",function(r){return"element"===r.pstyle("display").value&&0!==r.width()&&(!r.isNode()||0!==r.height())});ur.takesUpSpace=Cn("takesUpSpace",Fs({ok:Kt}));var Kg=En("eleInteractive",function(r){return"yes"===r.pstyle("events").value&&"visible"===r.pstyle("visibility").value&&Kt(r)}),Yg=En("parentInteractive",function(r){return"visible"===r.pstyle("visibility").value&&Kt(r)});ur.interactive=Cn("interactive",Fs({ok:Kg,parentOk:Yg,edgeOkViaNode:Kt})),ur.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var Xg=En("eleVisible",function(r){return"visible"===r.pstyle("visibility").value&&0!==r.pstyle("opacity").pfValue&&Kt(r)}),Zg=Kt;ur.visible=Cn("visible",Fs({ok:Xg,edgeOkViaNode:Zg})),ur.hidden=function(){var r=this[0];if(r)return!r.visible()},ur.isBundledBezier=Cn("isBundledBezier",function(){return!!this.cy().styleEnabled()&&(!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace())}),ur.bypass=ur.css=ur.style,ur.renderedCss=ur.renderedStyle,ur.removeBypass=ur.removeCss=ur.removeStyle,ur.pstyle=ur.parsedStyle;var ft={};function ov(r){return function(){var e=arguments,t=[];if(2===e.length){var a=e[0],n=e[1];this.on(r.event,a,n)}else if(1===e.length&&He(e[0])){var i=e[0];this.on(r.event,i)}else if(0===e.length||1===e.length&&ze(e[0])){for(var s=1===e.length?e[0]:null,o=0;o<this.length;o++){var l=this[o],u=!r.ableField||l._private[r.ableField],v=l._private[r.field]!=r.value;if(r.overrideAble){var f=r.overrideAble(l);if(void 0!==f&&(u=f,!f))return this}u&&(l._private[r.field]=r.value,v&&t.push(l))}var c=this.spawn(t);c.updateStyle(),c.emit(r.event),s&&c.emit(s)}return this}}function Yt(r){ft[r.field]=function(){var e=this[0];if(e){if(r.overrideField){var t=r.overrideField(e);if(void 0!==t)return t}return e._private[r.field]}},ft[r.on]=ov({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),ft[r.off]=ov({event:r.off,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!1})}Yt({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),Yt({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),Yt({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),Yt({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),ft.deselect=ft.unselect,ft.grabbed=function(){var r=this[0];if(r)return r._private.grabbed},Yt({field:"active",on:"activate",off:"unactivate"}),Yt({field:"pannable",on:"panify",off:"unpanify"}),ft.inactive=function(){var r=this[0];if(r)return!r._private.active};var dr={},uv=function(e){return function(a){for(var i=[],s=0;s<this.length;s++){var o=this[s];if(o.isNode()){for(var l=!1,u=o.connectedEdges(),v=0;v<u.length;v++){var f=u[v],c=f.source(),h=f.target();if(e.noIncomingEdges&&h===o&&c!==o||e.noOutgoingEdges&&c===o&&h!==o){l=!0;break}}l||i.push(o)}}return this.spawn(i,!0).filter(a)}},lv=function(e){return function(t){for(var n=[],i=0;i<this.length;i++){var s=this[i];if(s.isNode())for(var o=s.connectedEdges(),l=0;l<o.length;l++){var u=o[l],v=u.source(),f=u.target();e.outgoing&&v===s?(n.push(u),n.push(f)):e.incoming&&f===s&&(n.push(u),n.push(v))}}return this.spawn(n,!0).filter(t)}},vv=function(e){return function(t){for(var a=this,n=[],i={};;){var s=e.outgoing?a.outgoers():a.incomers();if(0===s.length)break;for(var o=!1,l=0;l<s.length;l++){var u=s[l],v=u.id();i[v]||(i[v]=!0,n.push(u),o=!0)}if(!o)break;a=s}return this.spawn(n,!0).filter(t)}};function fv(r){return function(t){for(var a=[],n=0;n<this.length;n++){var s=this[n]._private[r.attr];s&&a.push(s)}return this.spawn(a,!0).filter(t)}}function cv(r){return function(t){var a=[],n=this._private.cy,i=r||{};ve(t)&&(t=n.$(t));for(var s=0;s<t.length;s++)for(var o=t[s]._private.edges,l=0;l<o.length;l++){var u=o[l],v=u._private.data,f=this.hasElementWithId(v.source)&&t.hasElementWithId(v.target),c=t.hasElementWithId(v.source)&&this.hasElementWithId(v.target);!(f||c)||(i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!f||i.thisIsTgt&&!c)||a.push(u)}return this.spawn(a,!0)}}function dv(r){return r=he({},{codirected:!1},r),function(a){for(var n=[],i=this.edges(),s=r,o=0;o<i.length;o++)for(var u=i[o]._private,v=u.source,f=v._private.data.id,c=u.data.target,h=v._private.edges,d=0;d<h.length;d++){var y=h[d],g=y._private.data,p=g.target,m=g.source,b=p===c&&m===f,w=f===p&&c===m;(s.codirected&&b||!s.codirected&&(b||w))&&n.push(y)}return this.spawn(n,!0).filter(a)}}dr.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null},he(dr,{roots:uv({noIncomingEdges:!0}),leaves:uv({noOutgoingEdges:!0}),outgoers:kr(lv({outgoing:!0}),"outgoers"),successors:vv({outgoing:!0}),incomers:kr(lv({incoming:!0}),"incomers"),predecessors:vv({})}),he(dr,{neighborhood:kr(function(r){for(var e=[],t=this.nodes(),a=0;a<t.length;a++)for(var n=t[a],i=n.connectedEdges(),s=0;s<i.length;s++){var o=i[s],l=o.source(),u=o.target(),v=n===l?u:l;v.length>0&&e.push(v[0]),e.push(o[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),dr.neighbourhood=dr.neighborhood,dr.closedNeighbourhood=dr.closedNeighborhood,dr.openNeighbourhood=dr.openNeighborhood,he(dr,{source:kr(function(e){var a,t=this[0];return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"source"),target:kr(function(e){var a,t=this[0];return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"target"),sources:fv({attr:"source"}),targets:fv({attr:"target"})}),he(dr,{edgesWith:kr(cv(),"edgesWith"),edgesTo:kr(cv({thisIsSrc:!0}),"edgesTo")}),he(dr,{connectedEdges:kr(function(r){for(var e=[],a=0;a<this.length;a++){var n=this[a];if(n.isNode())for(var i=n._private.edges,s=0;s<i.length;s++){var o=i[s];e.push(o)}}return this.spawn(e,!0).filter(r)},"connectedEdges"),connectedNodes:kr(function(r){for(var e=[],a=0;a<this.length;a++){var n=this[a];!n.isEdge()||(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(r)},"connectedNodes"),parallelEdges:kr(dv(),"parallelEdges"),codirectedEdges:kr(dv({codirected:!0}),"codirectedEdges")}),he(dr,{components:function(e){var t=this,a=t.cy(),n=a.collection(),i=null==e?t.nodes():e.nodes(),s=[];null!=e&&i.empty()&&(i=e.sources());var o=function(v,f){n.merge(v),i.unmerge(v),f.merge(v)};if(i.empty())return t.spawn();var l=function(){var v=a.collection();s.push(v);var f=i[0];o(f,v),t.bfs({directed:!1,roots:f,visit:function(h){return o(h,v)}}),v.forEach(function(c){c.connectedEdges().forEach(function(h){t.has(h)&&v.has(h.source())&&v.has(h.target())&&v.merge(h)})})};do{l()}while(i.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),dr.componentsOf=dr.components;var lr=function(e,t){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new $r,s=!1;if(t){if(t.length>0&&ke(t[0])&&!sa(t[0])){s=!0;for(var o=[],l=new It,u=0,v=t.length;u<v;u++){var f=t[u];null==f.data&&(f.data={});var c=f.data;if(null==c.id)c.id=jo();else if(e.hasElementWithId(c.id)||l.has(c.id))continue;var h=new Za(e,f,!1);o.push(h),l.add(c.id)}t=o}}else t=[];this.length=0;for(var d=0,y=t.length;d<y;d++){var g=t[d][0];if(null!=g){var p=g._private.data.id;(!a||!i.has(p))&&(a&&i.set(p,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var b=this.lazyMap=new $r,w=this.eles,E=0;E<w.length;E++){var C=w[E];b.set(C.id(),{index:E,ele:C})}}},a&&(this._private.map=i),s&&!n&&this.restore()}else We("A collection must have a reference to the core")},Ve=Za.prototype=lr.prototype=Object.create(Array.prototype);Ve.instanceString=function(){return"collection"},Ve.spawn=function(r,e){return new lr(this.cy(),r,e)},Ve.spawnSelf=function(){return this.spawn(this)},Ve.cy=function(){return this._private.cy},Ve.renderer=function(){return this._private.cy.renderer()},Ve.element=function(){return this[0]},Ve.collection=function(){return xo(this)?this:new lr(this._private.cy,[this])},Ve.unique=function(){return new lr(this._private.cy,this,!0)},Ve.hasElementWithId=function(r){return r=""+r,this._private.map.has(r)},Ve.getElementById=function(r){r=""+r;var e=this._private.cy,t=this._private.map.get(r);return t?t.ele:new lr(e)},Ve.$id=Ve.getElementById,Ve.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},Ve.indexOf=function(r){var e=r[0]._private.data.id;return this._private.map.get(e).index},Ve.indexOfId=function(r){return r=""+r,this._private.map.get(r).index},Ve.json=function(r){var e=this.element(),t=this.cy();if(null==e&&r)return this;if(null!=e){var a=e._private;if(ke(r)){if(t.startBatch(),r.data){e.data(r.data);var n=a.data;if(e.isEdge()){var i=!1,s={},o=r.data.source,l=r.data.target;null!=o&&o!=n.source&&(s.source=""+o,i=!0),null!=l&&l!=n.target&&(s.target=""+l,i=!0),i&&(e=e.move(s))}else{var u="parent"in r.data,v=r.data.parent;u&&(null!=v||null!=n.parent)&&v!=n.parent&&(void 0===v&&(v=null),null!=v&&(v=""+v),e=e.move({parent:v}))}}r.position&&e.position(r.position);var f=function(y,g,p){var m=r[y];null!=m&&m!==a[y]&&(m?e[g]():e[p]())};return f("removed","remove","restore"),f("selected","select","unselect"),f("selectable","selectify","unselectify"),f("locked","lock","unlock"),f("grabbable","grabify","ungrabify"),f("pannable","panify","unpanify"),null!=r.classes&&e.classes(r.classes),t.endBatch(),this}if(void 0===r){var c={data:Or(a.data),position:Or(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,"")},h=0;return a.classes.forEach(function(d){return c.classes+=0==h++?d:" "+d}),c}}},Ve.jsons=function(){for(var r=[],e=0;e<this.length;e++){var a=this[e].json();r.push(a)}return r},Ve.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var n=this[t].json(),i=new Za(r,n,!1);e.push(i)}return new lr(r,e)},Ve.copy=Ve.clone,Ve.restore=function(){for(var o,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this,a=t.cy(),n=a._private,i=[],s=[],l=0,u=t.length;l<u;l++){var v=t[l];e&&!v.removed()||(v.isNode()?i.push(v):s.push(v))}o=i.concat(s);var f,c=function(){o.splice(f,1),f--};for(f=0;f<o.length;f++){var h=o[f],d=h._private,y=d.data;if(h.clearTraversalCache(),e||d.removed)if(void 0===y.id)y.id=jo();else if(te(y.id))y.id=""+y.id;else{if(et(y.id)||!ve(y.id)){We("Can not create element with invalid string ID `"+y.id+"`"),c();continue}if(a.hasElementWithId(y.id)){We("Can not create second element with ID `"+y.id+"`"),c();continue}}var g=y.id;if(h.isNode()){var p=d.position;null==p.x&&(p.x=0),null==p.y&&(p.y=0)}if(h.isEdge()){for(var m=h,b=["source","target"],w=b.length,E=!1,C=0;C<w;C++){var x=b[C],k=y[x];te(k)&&(k=y[x]=""+y[x]),null==k||""===k?(We("Can not create edge `"+g+"` with unspecified "+x),E=!0):a.hasElementWithId(k)||(We("Can not create edge `"+g+"` with nonexistant "+x+" `"+k+"`"),E=!0)}if(E){c();continue}var S=a.getElementById(y.source),P=a.getElementById(y.target);S.same(P)?S._private.edges.push(m):(S._private.edges.push(m),P._private.edges.push(m)),m._private.source=S,m._private.target=P}d.map=new $r,d.map.set(g,{ele:h,index:0}),d.removed=!1,e&&a.addToPool(h)}for(var D=0;D<i.length;D++){var A=i[D],B=A._private.data;te(B.parent)&&(B.parent=""+B.parent);var R=B.parent,M=null!=R;if(M||A._private.parent){var I=A._private.parent?a.collection().merge(A._private.parent):a.getElementById(R);if(I.empty())B.parent=void 0;else if(I[0].removed())Me("Node added with missing parent, reference to parent removed"),B.parent=void 0,A._private.parent=null;else{for(var L=!1,O=I;!O.empty();){if(A.same(O)){L=!0,B.parent=void 0;break}O=O.parent()}L||(I[0]._private.children.push(A),A._private.parent=I[0],n.hasCompoundNodes=!0)}}}if(o.length>0){for(var V=o.length===t.length?t:new lr(a,o),G=0;G<V.length;G++){var N=V[G];N.isNode()||(N.parallelEdges().clearTraversalCache(),N.source().clearTraversalCache(),N.target().clearTraversalCache())}(n.hasCompoundNodes?a.collection().merge(V).merge(V.connectedNodes()).merge(V.parent()):V).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?V.emitAndNotify("add"):e&&V.emit("add")}return t},Ve.removed=function(){var r=this[0];return r&&r._private.removed},Ve.inside=function(){var r=this[0];return r&&!r._private.removed},Ve.remove=function(){var r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this,a=[],n={},i=t._private.cy;function s(R){for(var M=R._private.edges,I=0;I<M.length;I++)l(M[I])}function o(R){for(var M=R._private.children,I=0;I<M.length;I++)l(M[I])}function l(R){var M=n[R.id()];e&&R.removed()||M||(n[R.id()]=!0,R.isNode()?(a.push(R),s(R),o(R)):a.unshift(R))}for(var u=0,v=t.length;u<v;u++){var f=t[u];l(f)}function c(R,M){var I=R._private.edges;tt(I,M),R.clearTraversalCache()}function h(R){R.clearTraversalCache()}var d=[];function y(R,M){M=M[0];var I=(R=R[0])._private.children,L=R.id();tt(I,M),M._private.parent=null,d.ids[L]||(d.ids[L]=!0,d.push(R))}d.ids={},t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var g=0;g<a.length;g++){var p=a[g];if(p.isEdge()){var m=p.source()[0],b=p.target()[0];c(m,p),c(b,p);for(var w=p.parallelEdges(),E=0;E<w.length;E++){var C=w[E];h(C),C.isBundledBezier()&&C.dirtyBoundingBoxCache()}}else{var x=p.parent();0!==x.length&&y(x,p)}e&&(p._private.removed=!0)}var k=i._private.elements;i._private.hasCompoundNodes=!1;for(var S=0;S<k.length;S++){var P=k[S];if(P.isParent()){i._private.hasCompoundNodes=!0;break}}var D=new lr(this.cy(),a);D.size()>0&&(r?D.emitAndNotify("remove"):e&&D.emit("remove"));for(var A=0;A<d.length;A++){var B=d[A];(!e||!B.removed())&&B.updateStyle()}return D},Ve.move=function(r){var e=this._private.cy,t=this,a=!1,n=!1,i=function(d){return null==d?d:""+d};if(void 0!==r.source||void 0!==r.target){var s=i(r.source),o=i(r.target),l=null!=s&&e.hasElementWithId(s),u=null!=o&&e.hasElementWithId(o);(l||u)&&(e.batch(function(){t.remove(a,n),t.emitAndNotify("moveout");for(var h=0;h<t.length;h++){var d=t[h],y=d._private.data;d.isEdge()&&(l&&(y.source=s),u&&(y.target=o))}t.restore(a,n)}),t.emitAndNotify("move"))}else if(void 0!==r.parent){var v=i(r.parent);if(null===v||e.hasElementWithId(v)){var c=null===v?void 0:v;e.batch(function(){var h=t.remove(a,n);h.emitAndNotify("moveout");for(var d=0;d<t.length;d++){var y=t[d],g=y._private.data;y.isNode()&&(g.parent=c)}h.restore(a,n)}),t.emitAndNotify("move")}}return this},[Du,og,hn,ut,Wt,Cg,gn,Vg,av,nv,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},wn,xn,ur,ft,dr].forEach(function(r){he(Ve,r)});var Qg={add:function(e){var t,a=this;if(Dr(e)){var n=e;if(n._private.cy===a)t=n.restore();else{for(var i=[],s=0;s<n.length;s++){var o=n[s];i.push(o.json())}t=new lr(a,i)}}else if(ze(e)){t=new lr(a,e)}else if(ke(e)&&(ze(e.nodes)||ze(e.edges))){for(var u=e,v=[],f=["nodes","edges"],c=0,h=f.length;c<h;c++){var d=f[c],y=u[d];if(ze(y))for(var g=0,p=y.length;g<p;g++){var m=he({group:d},y[g]);v.push(m)}}t=new lr(a,v)}else{t=new Za(a,e).collection()}return t},remove:function(e){if(!Dr(e)&&ve(e)){var t=e;e=this.$(t)}return e.remove()}};var jg=function(){function r(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:r(s)}}function t(a,n){var i={dx:a.v,dv:r(a)},s=e(a,.5*n,i),o=e(a,.5*n,s),l=e(a,n,o),u=1/6*(i.dx+2*(s.dx+o.dx)+l.dx),v=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+v*n,a}return function a(n,i,s){var c,h,d,o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,v=1e-4;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,(c=null!==s)?h=(u=a(n,i))/s*.016:h=.016;d=t(d||o,h),l.push(1+d.x),u+=16,Math.abs(d.x)>v&&Math.abs(d.v)>v;);return c?function(y){return l[y*(l.length-1)|0]}:u}}(),qe=function(e,t,a,n){var i=function Jg(r,e,t,a){var n=4,i=.001,s=1e-7,o=10,l=11,u=1/(l-1),v=typeof Float32Array<"u";if(4!==arguments.length)return!1;for(var f=0;f<4;++f)if("number"!=typeof arguments[f]||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;r=Math.min(r,1),t=Math.min(t,1),r=Math.max(r,0),t=Math.max(t,0);var c=v?new Float32Array(l):new Array(l);function h(P,D){return 1-3*D+3*P}function d(P,D){return 3*D-6*P}function y(P){return 3*P}function g(P,D,A){return((h(D,A)*P+d(D,A))*P+y(D))*P}function p(P,D,A){return 3*h(D,A)*P*P+2*d(D,A)*P+y(D)}function m(P,D){for(var A=0;A<n;++A){var B=p(D,r,t);if(0===B)return D;D-=(g(D,r,t)-P)/B}return D}function b(){for(var P=0;P<l;++P)c[P]=g(P*u,r,t)}function w(P,D,A){var B,R,M=0;do{(B=g(R=D+(A-D)/2,r,t)-P)>0?A=R:D=R}while(Math.abs(B)>s&&++M<o);return R}function E(P){for(var D=0,A=1,B=l-1;A!==B&&c[A]<=P;++A)D+=u;--A;var M=D+(P-c[A])/(c[A+1]-c[A])*u,I=p(M,r,t);return I>=i?m(P,M):0===I?M:w(P,D,D+u)}var C=!1;function x(){C=!0,(r!==e||t!==a)&&b()}var k=function(D){return C||x(),r===e&&t===a?D:0===D?0:1===D?1:g(E(D),e,a)};k.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var S="generateBezier("+[r,e,t,a]+")";return k.toString=function(){return S},k}(e,t,a,n);return function(s,o,l){return s+(o-s)*i(l)}},Tn={linear:function(e,t,a){return e+(t-e)*a},ease:qe(.25,.1,.25,1),"ease-in":qe(.42,0,1,1),"ease-out":qe(0,0,.58,1),"ease-in-out":qe(.42,0,.58,1),"ease-in-sine":qe(.47,0,.745,.715),"ease-out-sine":qe(.39,.575,.565,1),"ease-in-out-sine":qe(.445,.05,.55,.95),"ease-in-quad":qe(.55,.085,.68,.53),"ease-out-quad":qe(.25,.46,.45,.94),"ease-in-out-quad":qe(.455,.03,.515,.955),"ease-in-cubic":qe(.55,.055,.675,.19),"ease-out-cubic":qe(.215,.61,.355,1),"ease-in-out-cubic":qe(.645,.045,.355,1),"ease-in-quart":qe(.895,.03,.685,.22),"ease-out-quart":qe(.165,.84,.44,1),"ease-in-out-quart":qe(.77,0,.175,1),"ease-in-quint":qe(.755,.05,.855,.06),"ease-out-quint":qe(.23,1,.32,1),"ease-in-out-quint":qe(.86,0,.07,1),"ease-in-expo":qe(.95,.05,.795,.035),"ease-out-expo":qe(.19,1,.22,1),"ease-in-out-expo":qe(1,0,0,1),"ease-in-circ":qe(.6,.04,.98,.335),"ease-out-circ":qe(.075,.82,.165,1),"ease-in-out-circ":qe(.785,.135,.15,.86),spring:function(e,t,a){if(0===a)return Tn.linear;var n=jg(e,t,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":qe};function hv(r,e,t,a,n){if(1===a||e===t)return t;var i=n(e,t,a);return null==r||((r.roundValue||r.color)&&(i=Math.round(i)),void 0!==r.min&&(i=Math.max(i,r.min)),void 0!==r.max&&(i=Math.min(i,r.max))),i}function gv(r,e){return null!=r.pfValue||null!=r.value?null==r.pfValue||null!=e&&"%"===e.type.units?r.value:r.pfValue:r}function Xt(r,e,t,a,n){var i=null!=n?n.type:null;t<0?t=0:t>1&&(t=1);var s=gv(r,n),o=gv(e,n);if(te(s)&&te(o))return hv(i,s,o,t,a);if(ze(s)&&ze(o)){for(var l=[],u=0;u<o.length;u++){var v=s[u],f=o[u];if(null!=v&&null!=f){var c=hv(i,v,f,t,a);l.push(c)}else l.push(f)}return l}}function ep(r,e,t,a){var n=!a,i=r._private,s=e._private,o=s.easing,l=s.startTime,v=(a?r:r.cy()).style();if(!s.easingImpl)if(null==o)s.easingImpl=Tn.linear;else{var f,h,d;if(ve(o))f=v.parse("transition-timing-function",o).value;else f=o;ve(f)?(h=f,d=[]):(h=f[1],d=f.slice(2).map(function(V){return+V})),d.length>0?("spring"===h&&d.push(s.duration),s.easingImpl=Tn[h].apply(null,d)):s.easingImpl=Tn[h]}var g,y=s.easingImpl;if(g=0===s.duration?1:(t-l)/s.duration,s.applying&&(g=s.progress),g<0?g=0:g>1&&(g=1),null==s.delay){var p=s.startPosition,m=s.position;if(m&&n&&!r.locked()){var b={};Sa(p.x,m.x)&&(b.x=Xt(p.x,m.x,g,y)),Sa(p.y,m.y)&&(b.y=Xt(p.y,m.y,g,y)),r.position(b)}var w=s.startPan,E=s.pan,C=i.pan,x=null!=E&&a;x&&(Sa(w.x,E.x)&&(C.x=Xt(w.x,E.x,g,y)),Sa(w.y,E.y)&&(C.y=Xt(w.y,E.y,g,y)),r.emit("pan"));var k=s.startZoom,S=s.zoom,P=null!=S&&a;P&&(Sa(k,S)&&(i.zoom=ga(i.minZoom,Xt(k,S,g,y),i.maxZoom)),r.emit("zoom")),(x||P)&&r.emit("viewport");var D=s.style;if(D&&D.length>0&&n){for(var A=0;A<D.length;A++){var B=D[A],R=B.name,M=B,I=s.startStyle[R],O=Xt(I,M,g,y,v.properties[I.name]);v.overrideBypass(r,R,O)}r.emit("style")}}return s.progress=g,g}function Sa(r,e){return null!=r&&null!=e&&(!(!te(r)||!te(e))||!(!r||!e))}function rp(r,e,t,a){var n=e._private;n.started=!0,n.startTime=t-n.progress*n.duration}function pv(r,e){var t=e._private.aniEles,a=[];function n(v,f){var c=v._private,h=c.animation.current,d=c.animation.queue,y=!1;if(0===h.length){var g=d.shift();g&&h.push(g)}for(var p=function(C){for(var x=C.length-1;x>=0;x--){(0,C[x])()}C.splice(0,C.length)},m=h.length-1;m>=0;m--){var b=h[m],w=b._private;w.stopped?(h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.frames)):!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||rp(0,b,r),ep(v,b,r,f),w.applying&&(w.applying=!1),p(w.frames),null!=w.step&&w.step(r),b.completed()&&(h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.completes)),y=!0)}return!f&&0===h.length&&0===d.length&&a.push(v),y}for(var i=!1,s=0;s<t.length;s++){var l=n(t[s]);i=i||l}var u=n(e,!0);(i||u)&&(t.length>0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}var tp={animate:Le.animate(),animation:Le.animation(),animated:Le.animated(),clearQueue:Le.clearQueue(),delay:Le.delay(),delayAnimation:Le.delayAnimation(),stop:Le.stop(),addToAnimationPool:function(e){!this.styleEnabled()||this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){pv(s,e)},a.beforeRenderPriorities.animations):function t(){!e._private.animationsRunning||Ka(function(i){pv(i,e),t()})}()}}},ap={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return null==n||e!==a.target&&sa(a.target)&&n.matches(a.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,a){return null!=t.qualifier?a.target:e}},Sn=function(e){return ve(e)?new st(e):e},yv={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new mn(ap,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,a){return this.emitter().on(e,Sn(t),a),this},removeListener:function(e,t,a){return this.emitter().removeListener(e,Sn(t),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,a){return this.emitter().one(e,Sn(t),a),this},once:function(e,t,a){return this.emitter().one(e,Sn(t),a),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Le.eventAliasesOn(yv);var Vs={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Vs.jpeg=Vs.jpg;var Dn={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var i,a=e.name,n=t.extension("layout",a);if(null!=n)return i=ve(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$(),new n(he({},e,{cy:t,eles:i}));We("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?")}else We("A `name` must be specified to make a layout");else We("Layout options must be specified to make a layout")}};Dn.createLayout=Dn.makeLayout=Dn.layout;var np={notify:function(e,t){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();null!=t&&n.merge(t)}else if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?t.notify(a):t.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],s=e[i];t.getElementById(i).data(s)}})}},ip=or({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]}),qs={renderTo:function(e,t,a,n){return this._private.renderer.renderTo(e,t,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 t=this,a=t.extension("renderer",e.name);if(null!=a){void 0!==e.wheelSensitivity&&Me("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=ip(e);n.cy=t,t._private.renderer=new a(n),this.notify("init")}else We("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.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)}};qs.invalidateDimensions=qs.resize;var kn={collection:function(e,t){return ve(e)?this.$(e):Dr(e)?e.collection():ze(e)?(t||(t={}),new lr(this,e,t.unique,t.removed)):new lr(this)},nodes:function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(a){return a.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};kn.elements=kn.filter=kn.$;var nr={};nr.apply=function(r){for(var e=this,n=e._private.cy.collection(),i=0;i<r.length;i++){var s=r[i],o=e.getContextMeta(s);if(!o.empty){var l=e.getContextStyle(o),u=e.applyContextStyle(o,l,s);s._private.appliedInitStyle?e.updateTransitions(s,u.diffProps):s._private.appliedInitStyle=!0,e.updateStyleHints(s)&&n.push(s)}}return n},nr.getPropertiesDiff=function(r,e){var t=this,a=t._private.propDiffs=t._private.propDiffs||{},n=r+"-"+e,i=a[n];if(i)return i;for(var s=[],o={},l=0;l<t.length;l++){var u=t[l],v="t"===r[l],f="t"===e[l],c=v!==f,h=u.mappedProperties.length>0;if(c||f&&h){var d=void 0;c&&h||c?d=u.properties:h&&(d=u.mappedProperties);for(var y=0;y<d.length;y++){for(var g=d[y],p=g.name,m=!1,b=l+1;b<t.length;b++){var w=t[b];if("t"===e[b]&&(m=null!=w.properties[g.name]))break}!o[p]&&!m&&(o[p]=!0,s.push(p))}}}return a[n]=s,s},nr.getContextMeta=function(r){for(var a,e=this,t="",n=r._private.styleCxtKey||"",i=0;i<e.length;i++){var s=e[i];t+=s.selector&&s.selector.matches(r)?"t":"f"}return a=e.getPropertiesDiff(n,t),r._private.styleCxtKey=t,{key:t,diffPropNames:a,empty:0===a.length}},nr.getContextStyle=function(r){var e=r.key,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<this.length;i++){var s=this[i];if("t"===e[i])for(var l=0;l<s.properties.length;l++){var u=s.properties[l];n[u.name]=u}}return a[e]=n,n},nr.applyContextStyle=function(r,e,t){for(var n=r.diffPropNames,i={},s=this.types,o=0;o<n.length;o++){var l=n[o],u=e[l],v=t.pstyle(l);if(!u){if(!v)continue;u=v.bypass?{name:l,deleteBypassed:!0}:{name:l,delete:!0}}if(v!==u){if(u.mapped===s.fn&&null!=v&&null!=v.mapping&&v.mapping.value===u.value){var f=v.mapping;if((f.fnValue=u.value(t))===f.prevFnValue)continue}var h=i[l]={prev:v};this.applyParsedProperty(t,u),h.next=t.pstyle(l),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},nr.updateStyleHints=function(r){var e=r._private,t=this,a=t.propertyGroupNames,n=t.propertyGroupKeys,i=function(H,ee,ne){return t.getPropertiesHash(H,ee,ne)},s=e.styleKey;if(r.removed())return!1;var H,o="nodes"===e.group,l=r._private.style;a=Object.keys(l);for(var u=0;u<n.length;u++){var v=n[u];e.styleKeys[v]=[gt,Lt]}for(var f=function(H,ee){return e.styleKeys[ee][0]=fa(H,e.styleKeys[ee][0])},c=function(H,ee){return e.styleKeys[ee][1]=ca(H,e.styleKeys[ee][1])},h=function(H,ee){f(H,ee),c(H,ee)},d=function(H,ee){for(var ne=0;ne<H.length;ne++){var be=H.charCodeAt(ne);f(be,ee),c(be,ee)}},p=0;p<a.length;p++){var m=a[p],b=l[m];if(null!=b){var w=this.properties[m],E=w.type,C=w.groupKey,x=void 0;null!=w.hashOverride?x=w.hashOverride(r,b):null!=b.pfValue&&(x=b.pfValue);var k=null==w.enums?b.value:null,S=null!=x,D=S||null!=k,A=b.units;if(E.number&&D&&!E.multiple)h(-128<(H=S?x:k)&&H<128&&Math.floor(H)!==H?2e9-(1024*H|0):H,C),!S&&null!=A&&d(A,C);else d(b.strValue,C)}}for(var R=[gt,Lt],M=0;M<n.length;M++){var I=n[M],L=e.styleKeys[I];R[0]=fa(L[0],R[0]),R[1]=ca(L[1],R[1])}e.styleKey=function(e,t){return 2097152*e+t}(R[0],R[1]);var O=e.styleKeys;e.labelDimsKey=rt(O.labelDimensions);var V=i(r,["label"],O.labelDimensions);if(e.labelKey=rt(V),e.labelStyleKey=rt(Ya(O.commonLabel,V)),!o){var G=i(r,["source-label"],O.labelDimensions);e.sourceLabelKey=rt(G),e.sourceLabelStyleKey=rt(Ya(O.commonLabel,G));var N=i(r,["target-label"],O.labelDimensions);e.targetLabelKey=rt(N),e.targetLabelStyleKey=rt(Ya(O.commonLabel,N))}if(o){var F=e.styleKeys,K=F.nodeBody,X=F.nodeBorder,Q=F.nodeOutline,Z=F.backgroundImage,re=F.compound,ae=F.pie,J=F.stripe,z=[K,X,Q,Z,re,ae,J].filter(function(q){return null!=q}).reduce(Ya,[gt,Lt]);e.nodeKey=rt(z),e.hasPie=null!=ae&&ae[0]!==gt&&ae[1]!==Lt,e.hasStripe=null!=J&&J[0]!==gt&&J[1]!==Lt}return s!==e.styleKey},nr.clearStyleHints=function(r){var e=r._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},nr.applyParsedProperty=function(r,e){var i,t=this,a=e,n=r._private.style,s=t.types,o=t.properties[a.name].type,l=a.bypass,u=n[a.name],v=u&&u.bypass,f=r._private,c="mapping",h=function(K){return null==K?null:null!=K.pfValue?K.pfValue:K.value},d=function(){var K=h(u),X=h(a);t.checkTriggers(r,a.name,K,X)};if("curve-style"===e.name&&r.isEdge()&&("bezier"!==e.value&&r.isLoop()||"haystack"===e.value&&(r.source().isParent()||r.target().isParent()))&&(a=e=this.parse(e.name,"bezier",l)),a.delete)return n[a.name]=void 0,d(),!0;if(a.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,d(),!0):(d(),!0);if(a.deleteBypass)return u?!!u.bypass&&(n[a.name]=u.bypassed,d(),!0):(d(),!0);var y=function(){Me("Do not assign mappings to elements without corresponding data (i.e. ele `"+r.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case s.mapData:for(var g=a.field.split("."),p=f.data,m=0;m<g.length&&p;m++){p=p[g[m]]}if(null==p)return y(),!1;var w;if(!te(p))return Me("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+p+"` for `"+r.id()+"` is non-numeric)"),!1;var E=a.fieldMax-a.fieldMin;if((w=0===E?0:(p-a.fieldMin)/E)<0?w=0:w>1&&(w=1),o.color){var C=a.valueMin[0],x=a.valueMax[0],k=a.valueMin[1],S=a.valueMax[1],P=a.valueMin[2],D=a.valueMax[2],A=null==a.valueMin[3]?1:a.valueMin[3],B=null==a.valueMax[3]?1:a.valueMax[3],R=[Math.round(C+(x-C)*w),Math.round(k+(S-k)*w),Math.round(P+(D-P)*w),Math.round(A+(B-A)*w)];i={bypass:a.bypass,name:a.name,value:R,strValue:"rgb("+R[0]+", "+R[1]+", "+R[2]+")"}}else{if(!o.number)return!1;var M=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,M,a.bypass,c)}if(!i)return y(),!1;i.mapping=a,a=i;break;case s.data:for(var I=a.field.split("."),L=f.data,O=0;O<I.length&&L;O++){L=L[I[O]]}if(null!=L&&(i=this.parse(a.name,L,a.bypass,c)),!i)return y(),!1;i.mapping=a,a=i;break;case s.fn:var G=a.value,N=null!=a.fnValue?a.fnValue:G(r);if(a.prevFnValue=N,null==N)return Me("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+r.id()+"` is null)"),!1;if(!(i=this.parse(a.name,N,a.bypass,c)))return Me("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+r.id()+"` is invalid)"),!1;i.mapping=Or(a),a=i;break;case void 0:break;default:return!1}return l?(a.bypassed=v?u.bypassed:u,n[a.name]=a):v?u.bypassed=a:n[a.name]=a,d(),!0},nr.cleanElements=function(r,e){for(var t=0;t<r.length;t++){var a=r[t];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),e)for(var n=a._private.style,i=Object.keys(n),s=0;s<i.length;s++){var o=i[s],l=n[o];null!=l&&(l.bypass?l.bypassed=null:n[o]=null)}else a._private.style={}}},nr.update=function(){this._private.cy.mutableElements().updateStyle()},nr.updateTransitions=function(r,e){var t=this,a=r._private,n=r.pstyle("transition-property").value,i=r.pstyle("transition-duration").pfValue,s=r.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var o={},l=!1,u=0;u<n.length;u++){var v=n[u],f=r.pstyle(v),c=e[v];if(c){var d=c.prev,y=null!=c.next?c.next:f,g=!1,p=void 0,m=1e-6;!d||(te(d.pfValue)&&te(y.pfValue)?(g=y.pfValue-d.pfValue,p=d.pfValue+m*g):te(d.value)&&te(y.value)?(g=y.value-d.value,p=d.value+m*g):ze(d.value)&&ze(y.value)&&(g=d.value[0]!==y.value[0]||d.value[1]!==y.value[1]||d.value[2]!==y.value[2],p=d.strValue),g&&(o[v]=y.strValue,this.applyBypass(r,v,p),l=!0))}}if(!l)return;a.transitioning=!0,new Gt(function(b){s>0?r.delayAnimation(s).play().promise().then(b):b()}).then(function(){return r.animation({style:o,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1)},nr.checkTrigger=function(r,e,t,a,n,i){var s=this.properties[e],o=n(s);r.removed()||null!=o&&o(t,a,r)&&i(s)},nr.checkZOrderTrigger=function(r,e,t,a){var n=this;this.checkTrigger(r,e,t,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",r)})},nr.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})},nr.checkConnectedEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},nr.checkParallelEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},nr.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a),this.checkConnectedEdgesBoundsTrigger(r,e,t,a),this.checkParallelEdgesBoundsTrigger(r,e,t,a)};var ka={applyBypass:function(r,e,t,a){var i=[];if("*"===e||"**"===e){if(void 0!==t)for(var o=0;o<this.properties.length;o++){var u=this.properties[o].name,v=this.parse(u,t,!0);v&&i.push(v)}}else if(ve(e)){var f=this.parse(e,t,!0);f&&i.push(f)}else{if(!ke(e))return!1;var c=e;a=t;for(var h=Object.keys(c),d=0;d<h.length;d++){var y=h[d],g=c[y];if(void 0===g&&(g=c[Wa(y)]),void 0!==g){var p=this.parse(y,g,!0);p&&i.push(p)}}}if(0===i.length)return!1;for(var m=!1,b=0;b<r.length;b++){for(var w=r[b],E={},C=void 0,x=0;x<i.length;x++){var k=i[x];if(a){var S=w.pstyle(k.name);C=E[k.name]={prev:S}}m=this.applyParsedProperty(w,Or(k))||m,a&&(C.next=w.pstyle(k.name))}m&&this.updateStyleHints(w),a&&this.updateTransitions(w,E,true)}return m},overrideBypass:function(r,e,t){e=Qn(e);for(var a=0;a<r.length;a++){var n=r[a],i=n._private.style[e],s=this.properties[e].type,o=s.color,l=s.mutiple,u=i?null!=i.pfValue?i.pfValue:i.value:null;i&&i.bypass?(i.value=t,null!=i.pfValue&&(i.pfValue=t),i.strValue=o?"rgb("+t.join(",")+")":l?t.join(" "):""+t,this.updateStyleHints(n)):this.applyBypass(n,e,t),this.checkTriggers(n,e,u,t)}},removeAllBypasses:function(r,e){return this.removeBypasses(r,this.propertyNames,e)},removeBypasses:function(r,e,t){for(var n=0;n<r.length;n++){for(var i=r[n],s={},o=0;o<e.length;o++){var l=e[o],u=this.properties[l],v=i.pstyle(u.name);if(v&&v.bypass){var c=this.parse(l,"",!0),h=s[u.name]={prev:v};this.applyParsedProperty(i,c),h.next=i.pstyle(u.name)}}this.updateStyleHints(i),t&&this.updateTransitions(i,s,true)}}},_s={getEmSizeInPixels:function(){var r=this.containerCss("font-size");return null!=r?parseFloat(r):1},containerCss:function(r){var e=this._private.cy,t=e.container(),a=e.window();if(a&&t&&a.getComputedStyle)return a.getComputedStyle(t).getPropertyValue(r)}},Nr={getRenderedStyle:function(r,e){return e?this.getStylePropertyValue(r,e,!0):this.getRawStyle(r,!0)},getRawStyle:function(r,e){var t=this;if(r=r[0]){for(var a={},n=0;n<t.properties.length;n++){var i=t.properties[n],s=t.getStylePropertyValue(r,i.name,e);null!=s&&(a[i.name]=s,a[Wa(i.name)]=s)}return a}},getIndexedStyle:function(r,e,t,a){return r.pstyle(e)[t][a]??r.cy().style().getDefaultProperty(e)[t][0]},getStylePropertyValue:function(r,e,t){if(r=r[0]){var n=this.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,s=r.pstyle(n.name);if(s){var o=s.value,l=s.units,u=s.strValue;if(t&&i.number&&null!=o&&te(o)){var v=r.cy().zoom(),f=function(g){return g*v},c=function(g,p){return f(g)+p},h=ze(o);return(h?l.every(function(y){return null!=y}):null!=l)?h?o.map(function(y,g){return c(y,l[g])}).join(" "):c(o,l):h?o.map(function(y){return ve(y)?y:""+f(y)}).join(" "):""+f(o)}if(null!=u)return u}return null}},getAnimationStartStyle:function(r,e){for(var t={},a=0;a<e.length;a++){var i=e[a].name,s=r.pstyle(i);void 0!==s&&(s=ke(s)?this.parse(i,s.strValue):this.parse(i,s)),s&&(t[i]=s)}return t},getPropsList:function(r){var t=[],a=r,n=this.properties;if(a)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],l=a[o],u=n[o]||n[Qn(o)],v=this.parse(u.name,l);v&&t.push(v)}return t},getNonDefaultPropertiesHash:function(r,e,t){var n,i,s,o,l,u,a=t.slice();for(l=0;l<e.length;l++)if(n=e[l],null!=(i=r.pstyle(n,!1)))if(null!=i.pfValue)a[0]=fa(o,a[0]),a[1]=ca(o,a[1]);else for(s=i.strValue,u=0;u<s.length;u++)o=s.charCodeAt(u),a[0]=fa(o,a[0]),a[1]=ca(o,a[1]);return a}};Nr.getPropertiesHash=Nr.getNonDefaultPropertiesHash;var Bn={appendFromJson:function(r){for(var e=this,t=0;t<r.length;t++){var a=r[t],n=a.selector,i=a.style||a.css,s=Object.keys(i);e.selector(n);for(var o=0;o<s.length;o++){var l=s[o],u=i[l];e.css(l,u)}}return e},fromJson:function(r){var e=this;return e.resetToDefault(),e.appendFromJson(r),e},json:function(){for(var r=[],e=this.defaultLength;e<this.length;e++){for(var t=this[e],a=t.selector,n=t.properties,i={},s=0;s<n.length;s++){var o=n[s];i[o.name]=o.strValue}r.push({selector:a?a.toString():"core",style:i})}return r}},Gs={appendFromString:function(r){var n,i,s,t=this,a=""+r;function o(){a=a.length>n.length?a.substr(n.length):""}function l(){i=i.length>s.length?i.substr(s.length):""}for(a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(a.match(/^\s*$/))break;var v=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!v){Me("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=v[0];var f=v[1];if("core"!==f)if(new st(f).invalid){Me("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),o();continue}var h=v[2],d=!1;i=h;for(var y=[];;){if(i.match(/^\s*$/))break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){Me("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}s=p[0];var m=p[1],b=p[2];if(this.properties[m])t.parse(m,b)?(y.push({name:m,val:b}),l()):(Me("Skipping property: Invalid property definition in: "+s),l());else Me("Skipping property: Invalid property name in: "+s),l()}if(d){o();break}t.selector(f);for(var C=0;C<y.length;C++){var x=y[C];t.css(x.name,x.val)}o()}return t},fromString:function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e}},Ye={};(function(){var r=er,i=function(q){return"^"+q+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(q){var H=r+"|\\w+|rgb[a]?\\((?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)(?:\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)|hsl[a]?\\((?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+q+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+H+")\\s*\\,\\s*("+H+")\\)$"},o=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];Ye.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},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(q,H){switch(q.length){case 2:return"deg"!==H[0]&&"rad"!==H[0]&&"deg"!==H[1]&&"rad"!==H[1];case 1:return ve(q[0])||"deg"===H[0]||"rad"===H[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(q){var H=q.length;return 1===H||2===H||4===H}}};var l={zeroNonZero:function(q,H){return(null==q||null==H)&&q!==H||0==q&&0!=H||0!=q&&0==H},any:function(q,H){return q!=H},emptyNonEmpty:function(q,H){var ee=et(q),ne=et(H);return ee&&!ne||!ee&&ne}},u=Ye.types,v=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],f=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],c=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],h=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],d=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification},{name:"box-select-labels",type:u.bool,triggersBounds:l.any}],y=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any}],g=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(q,H,ee){return q!==H&&"bezier"===ee.pstyle("curve-style").value}},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],p=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],m=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],b=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],w=function(q,H){return"label"===H.value?-q.poolIndex():H.pfValue},E=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],C=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],x=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],k=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],S=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],P=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelEdges:function(q,H){return q!==H&&("bezier"===q||"bezier"===H)}},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],D=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],A=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],B=[];Ye.pieBackgroundN=16,B.push({name:"pie-size",type:u.sizeMaybePercent}),B.push({name:"pie-hole",type:u.sizeMaybePercent}),B.push({name:"pie-start-angle",type:u.angle});for(var R=1;R<=Ye.pieBackgroundN;R++)B.push({name:"pie-"+R+"-background-color",type:u.color}),B.push({name:"pie-"+R+"-background-size",type:u.percent}),B.push({name:"pie-"+R+"-background-opacity",type:u.zeroOneNumber});var M=[];Ye.stripeBackgroundN=16,M.push({name:"stripe-size",type:u.sizeMaybePercent}),M.push({name:"stripe-direction",type:u.axisDirectionPrimary});for(var I=1;I<=Ye.stripeBackgroundN;I++)M.push({name:"stripe-"+I+"-background-color",type:u.color}),M.push({name:"stripe-"+I+"-background-size",type:u.percent}),M.push({name:"stripe-"+I+"-background-opacity",type:u.zeroOneNumber});var L=[],O=Ye.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(z){O.forEach(function(q){var H=q+"-"+z.name,ee=z.type,ne=z.triggersBounds;L.push({name:H,type:ee,triggersBounds:ne})})},{});var V=Ye.properties=[].concat(y,b,g,p,m,D,d,h,v,f,c,E,C,x,k,B,M,S,P,L,A),G=Ye.propertyGroups={behavior:y,transition:b,visibility:g,overlay:p,underlay:m,ghost:D,commonLabel:d,labelDimensions:h,mainLabel:v,sourceLabel:f,targetLabel:c,nodeBody:E,nodeBorder:C,nodeOutline:x,backgroundImage:k,pie:B,stripe:M,compound:S,edgeLine:P,edgeArrow:L,core:A},N=Ye.propertyGroupNames={};(Ye.propertyGroupKeys=Object.keys(G)).forEach(function(z){N[z]=G[z].map(function(q){return q.name}),G[z].forEach(function(q){return q.groupKey=z})});var K=Ye.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"}];Ye.propertyNames=V.map(function(z){return z.name});for(var X=0;X<V.length;X++){var Q=V[X];V[Q.name]=Q}for(var Z=0;Z<K.length;Z++){var re=K[Z],ae=V[re.pointsTo],J={name:re.name,alias:!0,pointsTo:ae};V.push(J),V[re.name]=J}})(),Ye.getDefaultProperty=function(r){return this.getDefaultProperties()[r]},Ye.getDefaultProperties=function(){var r=this._private;if(null!=r.defaultProperties)return r.defaultProperties;for(var e=he({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","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(l,u){for(var v=1;v<=Ye.pieBackgroundN;v++){var f=u.name.replace("{{i}}",v),c=u.value;l[f]=c}return l},{}),{"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(l,u){for(var v=1;v<=Ye.stripeBackgroundN;v++){var f=u.name.replace("{{i}}",v),c=u.value;l[f]=c}return l},{}),{"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(l,u){return Ye.arrowPrefixes.forEach(function(v){var f=v+"-"+u.name,c=u.value;l[f]=c}),l},{})),t={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,s=e[i],o=this.parse(i,s);t[i]=o}}return r.defaultProperties=t,r.defaultProperties},Ye.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 Pn={parse:function(r,e,t,a){var n=this;if(He(e))return n.parseImplWarn(r,e,t,a);var v,l=Yo(r,""+e,t?"t":"f","mapping"===a||!0===a||!1===a||null==a?"dontcare":a),u=n.propCache=n.propCache||[];return(v=u[l])||(v=u[l]=n.parseImplWarn(r,e,t,a)),(t||"mapping"===a)&&((v=Or(v))&&(v.value=Or(v.value))),v},parseImplWarn:function(r,e,t,a){var n=this.parseImpl(r,e,t,a);return!n&&null!=e&&Me("The style property `".concat(r,": ").concat(e,"` is invalid")),n&&("width"===n.name||"height"===n.name)&&"label"===e&&Me("The style value of `label` is deprecated for `"+n.name+"`"),n}};Pn.parseImpl=function(r,e,t,a){var n=this;r=Qn(r);var i=n.properties[r],s=e,o=n.types;if(!i||void 0===e)return null;i.alias&&(i=i.pointsTo,r=i.name);var l=ve(e);l&&(e=e.trim());var v,f,u=i.type;if(!u)return null;if(t&&(""===e||null===e))return{name:r,value:e,bypass:!0,deleteBypass:!0};if(He(e))return{name:r,value:e,strValue:"fn",mapped:o.fn,bypass:t};if(!(!l||a||e.length<7||"a"!==e[1])){if(e.length>=7&&"d"===e[0]&&(v=new RegExp(o.data.regex).exec(e))){if(t)return!1;var c=o.data;return{name:r,value:v,strValue:""+e,mapped:c,field:v[1],bypass:t}}if(e.length>=10&&"m"===e[0]&&(f=new RegExp(o.mapData.regex).exec(e))){if(t||u.multiple)return!1;var h=o.mapData;if(!u.color&&!u.number)return!1;var d=this.parse(r,f[4]);if(!d||d.mapped)return!1;var y=this.parse(r,f[5]);if(!y||y.mapped)return!1;if(d.pfValue===y.pfValue||d.strValue===y.strValue)return Me("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+d.strValue+"`"),this.parse(r,d.strValue);if(u.color){var g=d.value,p=y.value;if(!(g[0]!==p[0]||g[1]!==p[1]||g[2]!==p[2]||g[3]!==p[3]&&(null!=g[3]&&1!==g[3]||null!=p[3]&&1!==p[3])))return!1}return{name:r,value:f,strValue:""+e,mapped:h,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:d.value,valueMax:y.value,bypass:t}}}if(u.multiple&&"multiple"!==a){var b;if(b=l?e.split(/\s+/):ze(e)?e:[e],u.evenMultiple&&b.length%2!=0)return null;for(var w=[],E=[],C=[],x="",k=!1,S=0;S<b.length;S++){var P=n.parse(r,b[S],t,"multiple");k=k||ve(P.value),w.push(P.value),C.push(null!=P.pfValue?P.pfValue:P.value),E.push(P.units),x+=(S>0?" ":"")+P.strValue}return u.validate&&!u.validate(w,E)?null:u.singleEnum&&k?1===w.length&&ve(w[0])?{name:r,value:w[0],strValue:w[0],bypass:t}:null:{name:r,value:w,pfValue:C,strValue:x,bypass:t,units:E}}var D=function(){for(var J=0;J<u.enums.length;J++){if(u.enums[J]===e)return{name:r,value:e,strValue:""+e,bypass:t}}return null};if(u.number){var A,B="px";if(u.units&&(A=u.units),u.implicitUnits&&(B=u.implicitUnits),!u.unitless)if(l){var R="px|em"+(u.allowPercent?"|\\%":"");A&&(R=A);var M=e.match("^("+er+")("+R+")?$");M&&(e=M[1],A=M[2]||B)}else(!A||u.implicitUnits)&&(A=B);if(e=parseFloat(e),isNaN(e)&&void 0===u.enums)return null;if(isNaN(e)&&void 0!==u.enums)return e=s,D();if(u.integer&&!function(e){return te(e)&&Math.floor(e)===e}(e)||void 0!==u.min&&(e<u.min||u.strictMin&&e===u.min)||void 0!==u.max&&(e>u.max||u.strictMax&&e===u.max))return null;var I={name:r,value:e,strValue:""+e+(A||""),units:A,bypass:t};return u.unitless||"px"!==A&&"em"!==A?I.pfValue=e:I.pfValue="px"!==A&&A?this.getEmSizeInPixels()*e:e,("ms"===A||"s"===A)&&(I.pfValue="ms"===A?e:1e3*e),("deg"===A||"rad"===A)&&(I.pfValue="rad"===A?e:function(e){return Math.PI*e/180}(e)),"%"===A&&(I.pfValue=e/100),I}if(u.propList){var L=[],O=""+e;if("none"!==O){for(var V=O.split(/\s*,\s*|\s+/),G=0;G<V.length;G++){var N=V[G].trim();n.properties[N]?L.push(N):Me("`"+N+"` is not a valid property name")}if(0===L.length)return null}return{name:r,value:L,strValue:0===L.length?"none":L.join(" "),bypass:t}}if(u.color){var F=Do(e);return F?{name:r,value:F,pfValue:F,strValue:"rgb("+F[0]+","+F[1]+","+F[2]+")",bypass:t}:null}if(u.regex||u.regexes){if(u.enums){var K=D();if(K)return K}for(var X=u.regexes?u.regexes:[u.regex],Q=0;Q<X.length;Q++){var re=new RegExp(X[Q]).exec(e);if(re)return{name:r,value:u.singleRegexMatchValue?re[1]:re,strValue:""+e,bypass:t}}return null}return u.string?{name:r,value:""+e,strValue:""+e,bypass:t}:u.enums?D():null};var ir=function(e){if(!(this instanceof ir))return new ir(e);Zn(e)?(this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()):We("A style must have a core reference")},hr=ir.prototype;hr.instanceString=function(){return"style"},hr.clear=function(){for(var r=this._private,t=r.cy.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,r.contextStyles={},r.propDiffs={},this.cleanElements(t,!0),t.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this},hr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},hr.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)},hr.selector=function(r){var e="core"===r?null:new st(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this},hr.css=function(){var r=this,e=arguments;if(1===e.length)for(var t=e[0],a=0;a<r.properties.length;a++){var n=r.properties[a],i=t[n.name];void 0===i&&(i=t[Wa(n.name)]),void 0!==i&&this.cssRule(n.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},hr.style=hr.css,hr.cssRule=function(r,e){var t=this.parse(r,e);if(t){var a=this.length-1;this[a].properties.push(t),this[a].properties[t.name]=t,t.name.match(/pie-(\d+)-background-size/)&&t.value&&(this._private.hasPie=!0),t.name.match(/stripe-(\d+)-background-size/)&&t.value&&(this._private.hasStripe=!0),t.mapped&&this[a].mappedProperties.push(t),!this[a].selector&&(this._private.coreStyle[t.name]=t)}return this},hr.append=function(r){return Eo(r)?r.appendToStyle(this):ze(r)?this.appendFromJson(r):ve(r)&&this.appendFromString(r),this},ir.fromJson=function(r,e){var t=new ir(r);return t.fromJson(e),t},ir.fromString=function(r,e){return new ir(r).fromString(e)},[nr,ka,_s,Nr,Bn,Gs,Ye,Pn].forEach(function(r){he(hr,r)}),ir.types=hr.types,ir.properties=hr.properties,ir.propertyGroups=hr.propertyGroups,ir.propertyGroupNames=hr.propertyGroupNames,ir.propertyGroupKeys=hr.propertyGroupKeys;var op={style:function(e){e&&this.setStyle(e).update();return this._private.style},setStyle:function(e){var t=this._private;return Eo(e)?t.style=e.generateStyle(this):ze(e)?t.style=ir.fromJson(this,e):ve(e)?t.style=ir.fromString(this,e):t.style=ir(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Et={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return null==t.selectionType&&(t.selectionType="single"),void 0===e?t.selectionType:(("additive"===e||"single"===e)&&(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var a,n,i,s,o,e=arguments,t=this._private.pan;switch(e.length){case 0:return t;case 1:if(ve(e[0]))return t[a=e[0]];if(ke(e[0])){if(!this._private.panningEnabled)return this;s=(i=e[0]).x,o=i.y,te(s)&&(t.x=s),te(o)&&(t.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],("x"===a||"y"===a)&&te(n)&&(t[a]=n),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var i,s,o,l,u,a=arguments,n=this._private.pan;if(!this._private.panningEnabled)return this;switch(a.length){case 1:ke(e)&&(l=(o=a[0]).x,u=o.y,te(l)&&(n.x+=l),te(u)&&(n.y+=u),this.emit("pan viewport"));break;case 2:s=t,("x"===(i=e)||"y"===i)&&te(s)&&(n[i]+=s),this.emit("pan viewport")}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var a=this.getFitViewport(e,t);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,t){if(te(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var a;if(ve(e)){var n=e;e=this.$(n)}else if(function(e){return ke(e)&&te(e.x1)&&te(e.x2)&&te(e.y1)&&te(e.y2)}(e)){var i=e;(a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}).w=a.x2-a.x1,a.h=a.y2-a.y1}else Dr(e)||(e=this.mutableElements());if(!Dr(e)||!e.empty()){a=a||e.boundingBox();var l,s=this.width(),o=this.height();if(t=te(t)?t:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0)return{zoom:l=(l=(l=Math.min((s-2*t)/a.w,(o-2*t)/a.h))>this._private.maxZoom?this._private.maxZoom:l)<this._private.minZoom?this._private.minZoom:l,pan:{x:(s-l*(a.x1+a.x2))/2,y:(o-l*(a.y1+a.y2))/2}}}}},zoomRange:function(e,t){var a=this._private;if(null==t){var n=e;e=n.min,t=n.max}return te(e)&&te(t)&&e<=t?(a.minZoom=e,a.maxZoom=t):te(e)&&void 0===t&&e<=a.maxZoom?a.minZoom=e:te(t)&&void 0===e&&t>=a.minZoom&&(a.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var i,s,t=this._private,a=t.pan,n=t.zoom,o=!1;if(t.zoomingEnabled||(o=!0),te(e)?s=e:ke(e)&&(s=e.level,null!=e.position?i=Ja(e.position,n,a):null!=e.renderedPosition&&(i=e.renderedPosition),null!=i&&!t.panningEnabled&&(o=!0)),s=(s=s>t.maxZoom?t.maxZoom:s)<t.minZoom?t.minZoom:s,o||!te(s)||s===n||null!=i&&(!te(i.x)||!te(i.y)))return null;if(null!=i){var l=a,u=n,v=s;return{zoomed:!0,panned:!0,zoom:v,pan:{x:-v/u*(i.x-l.x)+i.x,y:-v/u*(i.y-l.y)+i.y}}}return{zoomed:!0,panned:!1,zoom:s,pan:a}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),a=this._private;return null!=t&&t.zoomed?(a.zoom=t.zoom,t.panned&&(a.pan.x=t.pan.x,a.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this):this},viewport:function(e){var t=this._private,a=!0,n=!0,i=[],s=!1,o=!1;if(!e)return this;if(te(e.zoom)||(a=!1),ke(e.pan)||(n=!1),!a&&!n)return this;if(a){var l=e.zoom;l<t.minZoom||l>t.maxZoom||!t.zoomingEnabled?s=!0:(t.zoom=l,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;te(u.x)&&(t.pan.x=u.x,o=!1),te(u.y)&&(t.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(ve(e)){var a=e;e=this.mutableElements().filter(a)}else Dr(e)||(e=this.mutableElements());if(0!==e.length){var n=e.boundingBox(),i=this.width(),s=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(n.x1+n.x2))/2,y:(s-t*(n.y1+n.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var n,i,e=this._private,t=e.container,a=this;return e.sizeCache=e.sizeCache||(t?(n=a.window().getComputedStyle(t),i=function(o){return parseFloat(n.getPropertyValue(o))},{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.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,t=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/t,x2:(a.x2-e.x)/t,y1:(a.y1-e.y)/t,y2:(a.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Et.centre=Et.center,Et.autolockNodes=Et.autolock,Et.autoungrabifyNodes=Et.autoungrabify;var Ba={data:Le.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Le.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Le.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Le.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ba.attr=Ba.data,Ba.removeAttr=Ba.removeData;var Pa=function(e){var t=this,a=(e=he({},e)).container;a&&!Ha(a)&&Ha(a[0])&&(a=a[0]);var n=a?a._cyreg:null;(n=n||{})&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=t;var s=void 0!==je&&void 0!==a&&!e.headless,o=e;o.layout=he({name:s?"grid":"null"},o.layout),o.renderer=he({name:s?"canvas":"null"},o.renderer);var l=function(d,y,g){return void 0!==y?y:void 0!==g?g:d},u=this._private={container:a,ready:!1,options:o,elements:new lr(this),listeners:[],aniEles:new lr(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?s:o.styleEnabled,zoom:te(o.zoom)?o.zoom:1,pan:{x:ke(o.pan)&&te(o.pan.x)?o.pan.x:0,y:ke(o.pan)&&te(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});u.styleEnabled&&t.setStyle([]);var f=he({},o,o.renderer);t.initRenderer(f);!function(d,y){if(d.some(ec))return Gt.all(d).then(y);y(d)}([o.style,o.elements],function(h){var d=h[0],y=h[1];u.styleEnabled&&t.style().append(d),function(d,y,g){t.notifications(!1);var p=t.mutableElements();p.length>0&&p.remove(),null!=d&&(ke(d)||ze(d))&&t.add(d),t.one("layoutready",function(b){t.notifications(!0),t.emit(b),t.one("load",y),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",g),t.emit("done")});var m=he({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()}(y,function(){t.startAnimationLoop(),u.ready=!0,He(o.ready)&&t.on("ready",o.ready);for(var g=0;g<i.length;g++){var p=i[g];t.on("ready",p)}n&&(n.readies=[]),t.emit("ready")},o.done)})},An=Pa.prototype;he(An,{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(){if(null==this._private.container)return je;var t=this._private.container.ownerDocument;return void 0===t||null==t?je:t.defaultView||je},mount:function(e){if(null!=e){var t=this,a=t._private,n=a.options;return!Ha(e)&&Ha(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),a.container=e,a.styleEnabled=!0,t.invalidateSize(),t.initRenderer(he({},n,n.renderer,{name:"null"===n.renderer.name?"canvas":n.renderer.name})),t.startAnimationLoop(),t.style(n.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Or(this._private.options)},json:function(e){var t=this,a=t._private,n=t.mutableElements();if(ke(e)){if(t.startBatch(),e.elements){var s={},o=function(w,E){for(var C=[],x=[],k=0;k<w.length;k++){var S=w[k];if(S.data.id){var P=""+S.data.id,D=t.getElementById(P);s[P]=!0,0!==D.length?x.push({ele:D,json:S}):(E&&(S.group=E),C.push(S))}else Me("cy.json() cannot handle elements without an ID attribute")}t.add(C);for(var A=0;A<x.length;A++){var B=x[A],R=B.ele,M=B.json;R.json(M)}};if(ze(e.elements))o(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var v=l[u],f=e.elements[v];ze(f)&&o(f,v)}var c=t.collection();n.filter(function(b){return!s[b.id()]}).forEach(function(b){b.isParent()?c.merge(b):b.remove()}),c.forEach(function(b){return b.children().move({parent:null})}),c.forEach(function(b){return(w=b,t.getElementById(w.id())).remove();var w})}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==a.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<h.length;d++){var y=h[d];null!=e[y]&&t[y](e[y])}return t.endBatch(),this}var p={};!!e?p.elements=this.elements().map(function(b){return b.json()}):(p.elements={},n.forEach(function(b){var w=b.group();p.elements[w]||(p.elements[w]=[]),p.elements[w].push(b.json())})),this._private.styleEnabled&&(p.style=t.style().json()),p.data=Or(t.data());var m=a.options;return p.zoomingEnabled=a.zoomingEnabled,p.userZoomingEnabled=a.userZoomingEnabled,p.zoom=a.zoom,p.minZoom=a.minZoom,p.maxZoom=a.maxZoom,p.panningEnabled=a.panningEnabled,p.userPanningEnabled=a.userPanningEnabled,p.pan=Or(a.pan),p.boxSelectionEnabled=a.boxSelectionEnabled,p.renderer=Or(m.renderer),p.hideEdgesOnViewport=m.hideEdgesOnViewport,p.textureOnViewport=m.textureOnViewport,p.wheelSensitivity=m.wheelSensitivity,p.motionBlur=m.motionBlur,p.multiClickDebounceTime=m.multiClickDebounceTime,p}}),An.$id=An.getElementById,[Qg,tp,yv,Vs,Dn,np,qs,kn,op,Et,Ba].forEach(function(r){he(An,r)});var lp={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},vp={maximal:!1,acyclic:!1},Zt=function(e){return e.scratch("breadthfirst")},mv=function(e,t){return e.scratch("breadthfirst",t)};function bv(r){this.options=he({},lp,vp,r)}bv.prototype.run=function(){var v,r=this.options,e=r.cy,t=r.eles,a=t.nodes().filter(function(se){return se.isChildless()}),n=t,i=r.directed,s=r.acyclic||r.maximal||r.maximalAdjustments>0,o=!!r.boundingBox,l=e.extent(),u=xr(o?r.boundingBox:{x1:l.x1,y1:l.y1,w:l.w,h:l.h});if(Dr(r.roots))v=r.roots;else if(ze(r.roots)){for(var f=[],c=0;c<r.roots.length;c++){var h=r.roots[c],d=e.getElementById(h);f.push(d)}v=e.collection(f)}else if(ve(r.roots))v=e.$(r.roots);else if(i)v=a.roots();else{var y=t.components();v=e.collection();for(var g=function(){var oe=y[p],ce=oe.maxDegree(!1),ge=oe.filter(function(de){return de.degree(!1)===ce});v=v.add(ge)},p=0;p<y.length;p++)g()}var m=[],b={},w=function(oe,ce){null==m[ce]&&(m[ce]=[]);var ge=m[ce].length;m[ce].push(oe),mv(oe,{index:ge,depth:ce})};n.bfs({roots:v,directed:r.directed,visit:function(oe,ce,ge,de,ye){var we=oe[0],De=we.id();we.isChildless()&&w(we,ye),b[De]=!0}});for(var C=[],x=0;x<a.length;x++){var k=a[x];b[k.id()]||C.push(k)}var S=function(oe){for(var ce=m[oe],ge=0;ge<ce.length;ge++){var de=ce[ge];null!=de?mv(de,{depth:oe,index:ge}):(ce.splice(ge,1),ge--)}},P=function(oe,ce){for(var ge=Zt(oe),de=oe.incomers().filter(function(Xe){return Xe.isNode()&&t.has(Xe)}),ye=-1,we=oe.id(),De=0;De<de.length;De++){var Fe=de[De],$e=Zt(Fe);ye=Math.max(ye,$e.depth)}if(ge.depth<=ye){if(!r.acyclic&&ce[we])return null;var Re=ye+1;return function(oe,ce){var ge=Zt(oe),de=ge.depth,ye=ge.index;m[de][ye]=null,oe.isChildless()&&w(oe,ce)}(oe,Re),ce[we]=Re,!0}return!1};if(i&&s){var D=[],A={},B=function(oe){return D.push(oe)};for(a.forEach(function(se){return D.push(se)});D.length>0;){var M=D.shift(),I=P(M,A);if(I)M.outgoers().filter(function(se){return se.isNode()&&t.has(se)}).forEach(B);else if(null===I){Me("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var L=0;if(r.avoidOverlap)for(var O=0;O<a.length;O++){var G=a[O].layoutDimensions(r),N=G.w,F=G.h;L=Math.max(L,N,F)}var K={},X=function(oe){if(K[oe.id()])return K[oe.id()];for(var ce=Zt(oe).depth,ge=oe.neighborhood(),de=0,ye=0,we=0;we<ge.length;we++){var De=ge[we];if(!De.isEdge()&&!De.isParent()&&a.has(De)){var Fe=Zt(De);if(null!=Fe){var $e=Fe.index,Re=Fe.depth;if(null!=$e&&null!=Re){var Xe=m[Re].length;Re<ce&&(de+=$e/Xe,ye++)}}}}return de/=ye=Math.max(1,ye),0===ye&&(de=0),K[oe.id()]=de,de},Q=function(oe,ce){var ye=X(oe)-X(ce);return 0===ye?So(oe.id(),ce.id()):ye};void 0!==r.depthSort&&(Q=r.depthSort);for(var Z=m.length,re=0;re<Z;re++)m[re].sort(Q),S(re);for(var ae=[],J=0;J<C.length;J++)ae.push(C[J]);ae.length&&(m.unshift(ae),Z=m.length,function(){for(var oe=0;oe<Z;oe++)S(oe)}());for(var q=0,H=0;H<Z;H++)q=Math.max(m[H].length,q);var ee_x=u.x1+u.w/2,ee_y=u.y1+u.h/2,ne=a.reduce(function(se,oe){return ce=oe.boundingBox({includeLabels:r.nodeDimensionsIncludeLabels}),{w:-1===se.w?ce.w:(se.w+ce.w)/2,h:-1===se.h?ce.h:(se.h+ce.h)/2};var ce},{w:-1,h:-1}),be=Math.max(1===Z?0:o?(u.h-2*r.padding-ne.h)/(Z-1):(u.h-2*r.padding-ne.h)/(Z+1),L),Ge=m.reduce(function(se,oe){return Math.max(se,oe.length)},0);return t.nodes().layoutPositions(this,r,function(oe){var ce=Zt(oe),ge=ce.depth,de=ce.index;if(r.circle){var ye=Math.min(u.w/2/Z,u.h/2/Z),we=(ye=Math.max(ye,L))*ge+ye-(Z>0&&m[0].length<=3?ye/2:0),De=2*Math.PI/m[ge].length*de;return 0===ge&&1===m[0].length&&(we=1),{x:ee_x+we*Math.cos(De),y:ee_y+we*Math.sin(De)}}var Fe=m[ge].length,$e=Math.max(1===Fe?0:o?(u.w-2*r.padding-ne.w)/((r.grid?Ge:Fe)-1):(u.w-2*r.padding-ne.w)/((r.grid?Ge:Fe)+1),L);return{x:ee_x+(de+1-(Fe+1)/2)*$e,y:ee_y+(ge+1-(Z+1)/2)*be}}),this};var fp={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function wv(r){this.options=he({},fp,r)}wv.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var v,s=xr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=(void 0===e.sweep?2*Math.PI-2*Math.PI/i.length:e.sweep)/Math.max(1,i.length-1),f=0,c=0;c<i.length;c++){var d=i[c].layoutDimensions(e),y=d.w,g=d.h;f=Math.max(f,y,g)}if(v=te(e.radius)?e.radius:i.length<=1?0:Math.min(s.h,s.w)/2-f,i.length>1&&e.avoidOverlap){f*=1.75;var p=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),b=Math.sqrt(f*f/(p*p+m*m));v=Math.max(b,v)}return a.nodes().layoutPositions(this,e,function(C,x){var k=e.startAngle+x*u*(n?1:-1),S=v*Math.cos(k),P=v*Math.sin(k);return{x:o.x+S,y:o.y+P}}),this};var cp={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function xv(r){this.options=he({},cp,r)}xv.prototype.run=function(){for(var r=this.options,e=r,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,a=r.cy,n=e.eles,i=n.nodes().not(":parent"),s=xr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,v=0;v<i.length;v++){var c,f=i[v];c=e.concentric(f),l.push({value:c,node:f}),f._private.scratch.concentric=c}i.updateStyle();for(var h=0;h<i.length;h++){var y=i[h].layoutDimensions(e);u=Math.max(u,y.w,y.h)}l.sort(function(ne,be){return be.value-ne.value});for(var g=e.levelWidth(i),p=[[]],m=p[0],b=0;b<l.length;b++){var w=l[b];if(m.length>0)Math.abs(m[0].value-w.value)>=g&&(m=[],p.push(m));m.push(w)}var C=u+e.minNodeSpacing;if(!e.avoidOverlap){var x=p.length>0&&p[0].length>1,S=(Math.min(s.w,s.h)/2-C)/(p.length+x?1:0);C=Math.min(C,S)}for(var P=0,D=0;D<p.length;D++){var A=p[D],B=void 0===e.sweep?2*Math.PI-2*Math.PI/A.length:e.sweep,R=A.dTheta=B/Math.max(1,A.length-1);if(A.length>1&&e.avoidOverlap){var M=Math.cos(R)-Math.cos(0),I=Math.sin(R)-Math.sin(0),L=Math.sqrt(C*C/(M*M+I*I));P=Math.max(L,P)}A.r=P,P+=C}if(e.equidistant){for(var O=0,V=0,G=0;G<p.length;G++){var F=p[G].r-V;O=Math.max(O,F)}V=0;for(var K=0;K<p.length;K++){var X=p[K];0===K&&(V=X.r),X.r=V,V+=O}}for(var Q={},Z=0;Z<p.length;Z++)for(var re=p[Z],ae=re.dTheta,J=re.r,z=0;z<re.length;z++){var q=re[z],H=e.startAngle+(t?1:-1)*ae*z,ee={x:o.x+J*Math.cos(H),y:o.y+J*Math.sin(H)};Q[q.node.id()]=ee}return n.nodes().layoutPositions(this,e,function(ne){var be=ne.id();return Q[be]}),this};var Hs,dp={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Rn(r){this.options=he({},dp,r),this.options.layout=this;var e=this.options.eles.nodes(),a=this.options.eles.edges().filter(function(n){var i=n.source().data("id"),s=n.target().data("id"),o=e.some(function(u){return u.data("id")===i}),l=e.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(a)}Rn.prototype.run=function(){var r=this.options,e=r.cy,t=this;t.stopped=!1,(!0===r.animate||!1===r.animate)&&t.emit({type:"layoutstart",layout:t}),Hs=!0===r.debug;var a=hp(e,t,r);Hs&&undefined(a),r.randomize&&yp(a);var n=Wr(),i=function(){mp(a,e,r),!0===r.fit&&e.fit(r.padding)},s=function(c){return!(t.stopped||c>=r.numIter||(bp(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature<r.minTemp))},o=function(){if(!0===r.animate||!1===r.animate)i(),t.one("layoutstop",r.stop),t.emit({type:"layoutstop",layout:t});else{var c=r.eles.nodes(),h=Cv(a,r,c);c.layoutPositions(t,r,h)}},l=0,u=!0;if(!0===r.animate){var v=function(){for(var c=0;u&&c<r.refresh;)u=s(l),l++,c++;u?(Wr()-n>=r.animationThreshold&&i(),Ka(v)):(Dv(a,r),o())};v()}else{for(;u;)u=s(l),l++;Dv(a,r),o()}return this},Rn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Rn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var hp=function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=xr(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=a.eles.components(),u={},v=0;v<l.length;v++)for(var f=l[v],c=0;c<f.length;c++){u[f[c].id()]=v}for(v=0;v<o.nodeSize;v++){var y=(d=i[v]).layoutDimensions(a);(g={}).isLocked=d.locked(),g.id=d.data("id"),g.parentId=d.data("parent"),g.cmptId=u[d.id()],g.children=[],g.positionX=d.position("x"),g.positionY=d.position("y"),g.offsetX=0,g.offsetY=0,g.height=y.w,g.width=y.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(d.style("padding")),g.padRight=parseFloat(d.style("padding")),g.padTop=parseFloat(d.style("padding")),g.padBottom=parseFloat(d.style("padding")),g.nodeRepulsion=He(a.nodeRepulsion)?a.nodeRepulsion(d):a.nodeRepulsion,o.layoutNodes.push(g),o.idToIndex[g.id]=v}var p=[],m=0,b=-1,w=[];for(v=0;v<o.nodeSize;v++){var d,E=(d=o.layoutNodes[v]).parentId;null!=E?o.layoutNodes[o.idToIndex[E]].children.push(d.id):(p[++b]=d.id,w.push(d.id))}for(o.graphSet.push(w);m<=b;){var C=p[m++],x=o.idToIndex[C],k=o.layoutNodes[x].children;if(k.length>0){o.graphSet.push(k);for(v=0;v<k.length;v++)p[++b]=k[v]}}for(v=0;v<o.graphSet.length;v++){var S=o.graphSet[v];for(c=0;c<S.length;c++){var P=o.idToIndex[S[c]];o.indexToGraph[P]=v}}for(v=0;v<o.edgeSize;v++){var D=n[v],A={};A.id=D.data("id"),A.sourceId=D.data("source"),A.targetId=D.data("target");var B=He(a.idealEdgeLength)?a.idealEdgeLength(D):a.idealEdgeLength,R=He(a.edgeElasticity)?a.edgeElasticity(D):a.edgeElasticity,M=o.idToIndex[A.sourceId],I=o.idToIndex[A.targetId];if(o.indexToGraph[M]!=o.indexToGraph[I]){for(var V=gp(A.sourceId,A.targetId,o),G=o.graphSet[V],N=0,g=o.layoutNodes[M];-1===G.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],N++;for(g=o.layoutNodes[I];-1===G.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],N++;B*=N*a.nestingFactor}A.idealLength=B,A.elasticity=R,o.layoutEdges.push(A)}return o},gp=function(e,t,a){var n=Ev(e,t,0,a);return 2>n.count?0:n.graph},Ev=function(e,t,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:a};for(var s=0,o=0;o<i.length;o++){var l=i[o],u=n.idToIndex[l],v=n.layoutNodes[u].children;if(0!==v.length){var f=n.indexToGraph[n.idToIndex[v[0]]],c=Ev(e,t,f,n);if(0!==c.count){if(1!==c.count)return c;if(2===++s)break}}}return{count:s,graph:a}},yp=function(e,t){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var s=e.layoutNodes[i];0===s.children.length&&!s.isLocked&&(s.positionX=Math.random()*a,s.positionY=Math.random()*n)}},Cv=function(e,t,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(a.forEach(function(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(s,o){var l=e.layoutNodes[e.idToIndex[s.data("id")]];if(t.boundingBox){var u=(l.positionX-i.x1)/i.w,v=(l.positionY-i.y1)/i.h;return{x:n.x1+u*n.w,y:n.y1+v*n.h}}return{x:l.positionX,y:l.positionY}}},mp=function(e,t,a){var n=a.layout,i=a.eles.nodes(),s=Cv(e,a,i);i.positions(s),!0!==e.ready&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},bp=function(e,t,a){wp(e,t),Cp(e),Tp(e,t),Sp(e),Dp(e)},wp=function(e,t){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,s=0;s<i;s++)for(var o=e.layoutNodes[e.idToIndex[n[s]]],l=s+1;l<i;l++){var u=e.layoutNodes[e.idToIndex[n[l]]];xp(o,u,e,t)}},Tv=function(e){return 2*e*Math.random()-1},xp=function(e,t,a,n){if(e.cmptId===t.cmptId||a.isCompound){var o=t.positionX-e.positionX,l=t.positionY-e.positionY;0===o&&0===l&&(o=Tv(1),l=Tv(1));var v=Ep(e,t,o,l);if(v>0)var h=(f=n.nodeOverlap*v)*o/(c=Math.sqrt(o*o+l*l)),d=f*l/c;else{var f,y=Mn(e,o,l),g=Mn(t,-1*o,-1*l),p=g.x-y.x,m=g.y-y.y,b=p*p+m*m,c=Math.sqrt(b);h=(f=(e.nodeRepulsion+t.nodeRepulsion)/b)*p/c,d=f*m/c}e.isLocked||(e.offsetX-=h,e.offsetY-=d),t.isLocked||(t.offsetX+=h,t.offsetY+=d)}},Ep=function(e,t,a,n){if(a>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(n>0)var s=e.maxY-t.minY;else s=t.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Mn=function(e,t,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=a/t,u=s/o,v={};return 0===t&&0<a||0===t&&0>a?(v.x=n,v.y=i+s/2,v):0<t&&-1*u<=l&&l<=u?(v.x=n+o/2,v.y=i+o*a/2/t,v):0>t&&-1*u<=l&&l<=u?(v.x=n-o/2,v.y=i-o*a/2/t,v):0<a&&(l<=-1*u||l>=u)?(v.x=n+s*t/2/a,v.y=i+s/2,v):(0>a&&(l<=-1*u||l>=u)&&(v.x=n-s*t/2/a,v.y=i-s/2),v)},Cp=function(e,t){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],s=e.layoutNodes[i],o=e.idToIndex[n.targetId],l=e.layoutNodes[o],u=l.positionX-s.positionX,v=l.positionY-s.positionY;if(0!==u||0!==v){var f=Mn(s,u,v),c=Mn(l,-1*u,-1*v),h=c.x-f.x,d=c.y-f.y,y=Math.sqrt(h*h+d*d),g=Math.pow(n.idealLength-y,2)/n.elasticity;if(0!==y)var p=g*h/y,m=g*d/y;else p=0,m=0;s.isLocked||(s.offsetX+=p,s.offsetY+=m),l.isLocked||(l.offsetX-=p,l.offsetY-=m)}}},Tp=function(e,t){if(0!==t.gravity)for(var n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],s=i.length;if(0===n)var o=e.clientHeight/2,l=e.clientWidth/2;else{var u=e.layoutNodes[e.idToIndex[i[0]]],v=e.layoutNodes[e.idToIndex[u.parentId]];o=v.positionX,l=v.positionY}for(var f=0;f<s;f++){var c=e.layoutNodes[e.idToIndex[i[f]]];if(!c.isLocked){var h=o-c.positionX,d=l-c.positionY,y=Math.sqrt(h*h+d*d);if(y>1){var g=t.gravity*h/y,p=t.gravity*d/y;c.offsetX+=g,c.offsetY+=p}}}}},Sp=function(e,t){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0<u.length&&!l.isLocked){for(var v=l.offsetX,f=l.offsetY,c=0;c<u.length;c++){var h=e.layoutNodes[e.idToIndex[u[c]]];h.offsetX+=v,h.offsetY+=f,a[++i]=u[c]}l.offsetX=0,l.offsetY=0}}},Dp=function(e,t){for(var a=0;a<e.nodeSize;a++){0<(n=e.layoutNodes[a]).children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(a=0;a<e.nodeSize;a++){if(!(0<(n=e.layoutNodes[a]).children.length||n.isLocked)){var i=kp(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,Sv(n,e)}}for(a=0;a<e.nodeSize;a++){var n;0<(n=e.layoutNodes[a]).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)}},kp=function(e,t,a){var n=Math.sqrt(e*e+t*t);if(n>a)var i={x:a*e/n,y:a*t/n};else i={x:e,y:t};return i},Sv=function(e,t){var a=e.parentId;if(null!=a){var n=t.layoutNodes[t.idToIndex[a]],i=!1;if((null==n.maxX||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(null==n.minX||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(null==n.maxY||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(null==n.minY||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return Sv(n,t)}},Dv=function(e,t){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var s=a[i],o=s.cmptId;(n[o]=n[o]||[]).push(s)}var u=0;for(i=0;i<n.length;i++){if(v=n[i]){v.x1=1/0,v.x2=-1/0,v.y1=1/0,v.y2=-1/0;for(var f=0;f<v.length;f++){var c=v[f];v.x1=Math.min(v.x1,c.positionX-c.width/2),v.x2=Math.max(v.x2,c.positionX+c.width/2),v.y1=Math.min(v.y1,c.positionY-c.height/2),v.y2=Math.max(v.y2,c.positionY+c.height/2)}v.w=v.x2-v.x1,v.h=v.y2-v.y1,u+=v.w*v.h}}n.sort(function(m,b){return b.w*b.h-m.w*m.h});var h=0,d=0,y=0,g=0,p=Math.sqrt(u)*e.clientWidth/e.clientHeight;for(i=0;i<n.length;i++){var v;if(v=n[i]){for(f=0;f<v.length;f++){(c=v[f]).isLocked||(c.positionX+=h-v.x1,c.positionY+=d-v.y1)}h+=v.w+t.componentSpacing,y+=v.w+t.componentSpacing,g=Math.max(g,v.h),y>p&&(d+=g+t.componentSpacing,h=0,y=0,g=0)}}},Bp={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function kv(r){this.options=he({},Bp,r)}kv.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=xr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===i.h||0===i.w)a.nodes().layoutPositions(this,e,function(K){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),l=Math.round(o),u=Math.round(i.w/i.h*o),v=function(X){if(null==X)return Math.min(l,u);Math.min(l,u)==l?l=X:u=X},f=function(X){if(null==X)return Math.max(l,u);Math.max(l,u)==l?l=X:u=X},c=e.rows,h=null!=e.cols?e.cols:e.columns;if(null!=c&&null!=h)l=c,u=h;else if(null!=c&&null==h)l=c,u=Math.ceil(s/l);else if(null==c&&null!=h)u=h,l=Math.ceil(s/u);else if(u*l>s){var d=v(),y=f();(d-1)*y>=s?v(d-1):(y-1)*d>=s&&f(y-1)}else for(;u*l<s;){var g=v(),p=f();(p+1)*g>=s?f(p+1):v(g+1)}var m=i.w/u,b=i.h/l;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var w=0;w<n.length;w++){var E=n[w],C=E._private.position;(null==C.x||null==C.y)&&(C.x=0,C.y=0);var x=E.layoutDimensions(e),k=e.avoidOverlapPadding,S=x.w+k,P=x.h+k;m=Math.max(m,S),b=Math.max(b,P)}for(var D={},A=function(X,Q){return!!D["c-"+X+"-"+Q]},B=function(X,Q){D["c-"+X+"-"+Q]=!0},R=0,M=0,I=function(){++M>=u&&(M=0,R++)},L={},O=0;O<n.length;O++){var V=n[O],G=e.position(V);if(G&&(void 0!==G.row||void 0!==G.col)){var N={row:G.row,col:G.col};if(void 0===N.col)for(N.col=0;A(N.row,N.col);)N.col++;else if(void 0===N.row)for(N.row=0;A(N.row,N.col);)N.row++;L[V.id()]=N,B(N.row,N.col)}}n.layoutPositions(this,e,function(X,Q){var Z,re;if(X.locked()||X.isParent())return!1;var ae=L[X.id()];if(ae)Z=ae.col*m+m/2+i.x1,re=ae.row*b+b/2+i.y1;else{for(;A(R,M);)I();Z=M*m+m/2+i.x1,re=R*b+b/2+i.y1,B(R,M),I()}return{x:Z,y:re}})}return this};var Pp={ready:function(){},stop:function(){}};function Ws(r){this.options=he({},Pp,r)}Ws.prototype.run=function(){var r=this.options,e=r.eles,t=this;return r.cy,t.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),t.one("layoutready",r.ready),t.emit("layoutready"),t.one("layoutstop",r.stop),t.emit("layoutstop"),this},Ws.prototype.stop=function(){return this};var Ap={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Bv(r){this.options=he({},Ap,r)}Bv.prototype.run=function(){var r=this.options,t=r.eles.nodes(),a=He(r.positions);return t.layoutPositions(this,r,function(i,s){var o=function n(i){return null==r.positions?function(e){return{x:e.x,y:e.y}}(i.position()):a?r.positions(i):r.positions[i._private.data.id]??null}(i);return!i.locked()&&null!=o&&o}),this};var Rp={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Pv(r){this.options=he({},Rp,r)}Pv.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,a=xr(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()});return t.nodes().layoutPositions(this,r,function(s,o){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}}),this};var Mp=[{name:"breadthfirst",impl:bv},{name:"circle",impl:wv},{name:"concentric",impl:xv},{name:"cose",impl:Rn},{name:"grid",impl:kv},{name:"null",impl:Ws},{name:"preset",impl:Bv},{name:"random",impl:Pv}];function Av(r){this.options=r,this.notifications=0}var Rv=function(){},Mv=function(){throw new Error("A headless instance can not render images")};Av.prototype={recalculateRenderedStyle:Rv,notify:function(){this.notifications++},init:Rv,isHeadless:function(){return!0},png:Mv,jpg:Mv};var Us={arrowShapeWidth:.3,registerArrowShapes:function(){var r=this.arrowShapes={},e=this,t=function(u,v,f,c,h,d,y){var g=h.x-f/2-y,p=h.x+f/2+y,m=h.y-f/2-y,b=h.y+f/2+y;return g<=u&&u<=p&&m<=v&&v<=b},a=function(u,v,f,c,h){var d=u*Math.cos(c)-v*Math.sin(c),p=(u*Math.sin(c)+v*Math.cos(c))*f;return{x:d*f+h.x,y:p+h.y}},n=function(u,v,f,c){for(var h=[],d=0;d<u.length;d+=2){var y=u[d],g=u[d+1];h.push(a(y,g,v,f,c))}return h},i=function(u){for(var v=[],f=0;f<u.length;f++){var c=u[f];v.push(c.x,c.y)}return v},s=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},o=function(u,v){ve(v)&&(v=r[v]),r[u]=he({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,h,d,y,g,p){var m=i(n(this.points,d+2*p,y,g));return Er(c,h,m)},roughCollide:t,draw:function(c,h,d,y){var g=n(this.points,h,d,y);e.arrowShapeImpl("polygon")(c,g)},spacing:function(c){return 0},gap:s},v)};o("none",{collide:Xa,roughCollide:Xa,draw:gi,spacing:Qo,gap:Qo}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:r.triangle.points,controlPoint:[0,-.15],roughCollide:t,draw:function(u,v,f,c,h){var d=n(this.points,v,f,c),y=this.controlPoint,g=a(y[0],y[1],v,f,c);e.arrowShapeImpl(this.name)(u,d,g)},gap:function(u){return.8*s(u)}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,v,f,c,h,d,y){var g=i(n(this.points,f+2*y,c,h)),p=i(n(this.pointsTee,f+2*y,c,h));return Er(u,v,g)||Er(u,v,p)},draw:function(u,v,f,c,h){var d=n(this.points,v,f,c),y=n(this.pointsTee,v,f,c);e.arrowShapeImpl(this.name)(u,d,y)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,v,f,c,h,d,y){var g=h,p=Math.pow(g.x-u,2)+Math.pow(g.y-v,2)<=Math.pow((f+2*y)*this.radius,2),m=i(n(this.points,f+2*y,c,h));return Er(u,v,m)||p},draw:function(u,v,f,c,h){var d=n(this.pointsTr,v,f,c);e.arrowShapeImpl(this.name)(u,d,c.x,c.y,this.radius*v)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,v){var f=this.baseCrossLinePts.slice(),c=v/u;return f[3]=f[3]-c,f[5]=f[5]-c,f},collide:function(u,v,f,c,h,d,y){var g=i(n(this.points,f+2*y,c,h)),p=i(n(this.crossLinePts(f,d),f+2*y,c,h));return Er(u,v,g)||Er(u,v,p)},draw:function(u,v,f,c,h){var d=n(this.points,v,f,c),y=n(this.crossLinePts(v,h),v,f,c);e.arrowShapeImpl(this.name)(u,d,y)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return.525*s(u)}}),o("circle",{radius:.15,collide:function(u,v,f,c,h,d,y){var g=h;return Math.pow(g.x-u,2)+Math.pow(g.y-v,2)<=Math.pow((f+2*y)*this.radius,2)},draw:function(u,v,f,c,h){e.arrowShapeImpl(this.name)(u,c.x,c.y,this.radius*v)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return.95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})}},Ct={projectIntoViewport:function(r,e){var t=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],s=a[4],o=t.pan(),l=t.zoom();return[((r-n)/s-o.x)/l,((e-i)/s-o.y)/l]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var r=this.container,e=r.getBoundingClientRect(),t=this.cy.window().getComputedStyle(r),a=function(p){return parseFloat(t.getPropertyValue(p))},n_left=a("padding-left"),n_right=a("padding-right"),n_top=a("padding-top"),n_bottom=a("padding-bottom"),i_left=a("border-left-width"),i_right=a("border-right-width"),i_top=a("border-top-width"),s=(a("border-bottom-width"),r.clientWidth),o=r.clientHeight,l=n_left+n_right,u=n_top+n_bottom,v=i_left+i_right,f=e.width/(s+v),c=s-l,h=o-u,d=e.left+n_left+i_left,y=e.top+n_top+i_top;return this.containerBB=[d,y,c,h,f]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(r,e,t,a){return this.findNearestElements(r,e,t,a)[0]},findNearestElements:function(r,e,t,a){var d,y,n=this,i=this,s=i.getCachedZSortedEles(),o=[],l=i.cy.zoom(),u=i.cy.hasCompoundNodes(),v=(a?24:8)/l,f=(a?8:2)/l,c=(a?8:2)/l,h=1/0;function g(x,k){if(x.isNode()){if(y)return;y=x,o.push(x)}if(x.isEdge()&&(null==k||k<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 S=0;S<o.length;S++)if(o[S].isEdge()){o[S]=x,d=x,h=k??h;break}}else o.push(x),d=x,h=k??h}function p(x){var k=x.outerWidth()+2*f,S=x.outerHeight()+2*f,P=k/2,D=S/2,A=x.position(),B="auto"===x.pstyle("corner-radius").value?"auto":x.pstyle("corner-radius").pfValue,R=x._private.rscratch;if(A.x-P<=r&&r<=A.x+P&&A.y-D<=e&&e<=A.y+D&&i.nodeShapes[n.getNodeShape(x)].checkPoint(r,e,0,k,S,A.x,A.y,B,R))return g(x,0),!0}function m(x){var M,k=x._private,S=k.rscratch,P=x.pstyle("width").pfValue,D=x.pstyle("arrow-scale").value,A=P/2+v,B=A*A,R=2*A,O=k.source,V=k.target;if("segments"===S.edgeType||"straight"===S.edgeType||"haystack"===S.edgeType){for(var I=S.allpts,L=0;L+3<I.length;L+=2)if(cd(r,e,I[L],I[L+1],I[L+2],I[L+3],R)&&B>(M=yd(r,e,I[L],I[L+1],I[L+2],I[L+3])))return g(x,M),!0}else if("bezier"===S.edgeType||"multibezier"===S.edgeType||"self"===S.edgeType||"compound"===S.edgeType)for(I=S.allpts,L=0;L+5<S.allpts.length;L+=4)if(dd(r,e,I[L],I[L+1],I[L+2],I[L+3],I[L+4],I[L+5],R)&&B>(M=pd(r,e,I[L],I[L+1],I[L+2],I[L+3],I[L+4],I[L+5])))return g(x,M),!0;O=O||k.source,V=V||k.target;var G=n.getArrowWidth(P,D),N=[{name:"source",x:S.arrowStartX,y:S.arrowStartY,angle:S.srcArrowAngle},{name:"target",x:S.arrowEndX,y:S.arrowEndY,angle:S.tgtArrowAngle},{name:"mid-source",x:S.midX,y:S.midY,angle:S.midsrcArrowAngle},{name:"mid-target",x:S.midX,y:S.midY,angle:S.midtgtArrowAngle}];for(L=0;L<N.length;L++){var F=N[L],K=i.arrowShapes[x.pstyle(F.name+"-arrow-shape").value],X=x.pstyle("width").pfValue;if(K.roughCollide(r,e,G,F.angle,{x:F.x,y:F.y},X,v)&&K.collide(r,e,G,F.angle,{x:F.x,y:F.y},X,v))return g(x),!0}u&&o.length>0&&(p(O),p(V))}function b(x,k,S){return wr(x,k,S)}function w(x,k){var D,S=x._private,P=c;D=k?k+"-":"",x.boundingBox();var A=S.labelBounds[k||"main"],B=x.pstyle(D+"label").value;if("yes"===x.pstyle("text-events").strValue&&B){var M=b(S.rscratch,"labelX",k),I=b(S.rscratch,"labelY",k),L=b(S.rscratch,"labelAngle",k),O=x.pstyle(D+"text-margin-x").pfValue,V=x.pstyle(D+"text-margin-y").pfValue,G=A.x1-P-O,N=A.x2+P-O,F=A.y1-P-V,K=A.y2+P-V;if(L){var X=Math.cos(L),Q=Math.sin(L),Z=function(ee,ne){return{x:(ee-=M)*X-(ne-=I)*Q+M,y:ee*Q+ne*X+I}},re=Z(G,F),ae=Z(G,K),J=Z(N,F),z=Z(N,K),q=[re.x+O,re.y+V,J.x+O,J.y+V,z.x+O,z.y+V,ae.x+O,ae.y+V];if(Er(r,e,q))return g(x),!0}else if(zt(A,r,e))return g(x),!0}}t&&(s=s.interactive);for(var E=s.length-1;E>=0;E--){var C=s[E];C.isNode()?p(C)||w(C):m(C)||w(C)||w(C,"source")||w(C,"target")}return o},getAllInBox:function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,s=2/this.cy.zoom(),o=[],l=Math.min(r,t),u=Math.max(r,t),v=Math.min(e,a),f=Math.max(e,a),c=xr({x1:r=l,y1:e=v,x2:t=u,y2:a=f});function h(B,R,M){return wr(B,R,M)}function d(B,R){var M=B._private,I=s;B.boundingBox();var O=M.labelBounds.main,V=h(M.rscratch,"labelX",R),G=h(M.rscratch,"labelY",R),N=h(M.rscratch,"labelAngle",R),F=B.pstyle("text-margin-x").pfValue,K=B.pstyle("text-margin-y").pfValue,X=O.x1-I-F,Q=O.x2+I-F,Z=O.y1-I-K,re=O.y2+I-K;if(N){var ae=Math.cos(N),J=Math.sin(N),z=function(H,ee){return{x:(H-=V)*ae-(ee-=G)*J+V,y:H*J+ee*ae+G}};return[z(X,Z),z(Q,Z),z(Q,re),z(X,re)]}return[{x:X,y:Z},{x:Q,y:Z},{x:Q,y:re},{x:X,y:re}]}for(var y=0;y<n.length;y++){var g=n[y];if(g.isNode()){var p=g,m="yes"===p.pstyle("text-events").strValue,b="yes"===p.pstyle("box-select-labels").strValue,w=p.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:b&&m});if(xi(c,w))Ed(d(p),[{x:c.x1,y:c.y1},{x:c.x2,y:c.y1},{x:c.x2,y:c.y2},{x:c.x1,y:c.y2}])&&o.push(p)}else{var x=g,k=x._private,S=k.rscratch;if(null!=S.startX&&null!=S.startY&&!zt(c,S.startX,S.startY)||null!=S.endX&&null!=S.endY&&!zt(c,S.endX,S.endY))continue;if("bezier"===S.edgeType||"multibezier"===S.edgeType||"self"===S.edgeType||"compound"===S.edgeType||"segments"===S.edgeType||"haystack"===S.edgeType){for(var P=k.rstyle.bezierPts||k.rstyle.linePts||k.rstyle.haystackPts,D=!0,A=0;A<P.length;A++)if(!vd(c,P[A])){D=!1;break}D&&o.push(x)}else("haystack"===S.edgeType||"straight"===S.edgeType)&&o.push(x)}}return o}},Ln={calculateArrowAngles:function(r){var l,u,v,f,c,h,e=r._private.rscratch,t="haystack"===e.edgeType,a="bezier"===e.edgeType,n="multibezier"===e.edgeType,i="segments"===e.edgeType,s="compound"===e.edgeType,o="self"===e.edgeType;if(t?(v=e.haystackPts[0],f=e.haystackPts[1],c=e.haystackPts[2],h=e.haystackPts[3]):(v=e.arrowStartX,f=e.arrowStartY,c=e.arrowEndX,h=e.arrowEndY),p=e.midX,m=e.midY,i)l=v-e.segpts[0],u=f-e.segpts[1];else if(n||s||o||a){var d=e.allpts;l=v-ar(d[0],d[2],d[4],.1),u=f-ar(d[1],d[3],d[5],.1)}else l=v-p,u=f-m;e.srcArrowAngle=ja(l,u);var p=e.midX,m=e.midY;if(t&&(p=(v+c)/2,m=(f+h)/2),l=c-v,u=h-f,i)if((d=e.allpts).length/2%2==0){var w=(b=d.length/2)-2;l=d[b]-d[w],u=d[b+1]-d[w+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{w=(b=d.length/2-1)-2;l=d[b]-d[w],u=d[b+1]-d[w+1]}else if(n||s||o){var C,x,k,S,d=e.allpts;if(e.ctrlpts.length/2%2==0){var A=(D=(P=d.length/2-1)+2)+2;C=ar(d[P],d[D],d[A],0),x=ar(d[P+1],d[D+1],d[A+1],0),k=ar(d[P],d[D],d[A],1e-4),S=ar(d[P+1],d[D+1],d[A+1],1e-4)}else{var D,P;A=(D=d.length/2-1)+2;C=ar(d[P=D-2],d[D],d[A],.4999),x=ar(d[P+1],d[D+1],d[A+1],.4999),k=ar(d[P],d[D],d[A],.5),S=ar(d[P+1],d[D+1],d[A+1],.5)}l=k-C,u=S-x}if((e.midtgtArrowAngle=ja(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i)&&((d=e.allpts).length/2%2!=0&&!e.isRound)){var b,B=(b=d.length/2-1)+2;l=-(d[B]-d[b]),u=-(d[B+1]-d[b+1])}if(e.midsrcArrowAngle=ja(l,u),i)l=c-e.segpts[e.segpts.length-2],u=h-e.segpts[e.segpts.length-1];else if(n||s||o||a){var R=(d=e.allpts).length;l=c-ar(d[R-6],d[R-4],d[R-2],.9),u=h-ar(d[R-5],d[R-3],d[R-1],.9)}else l=c-p,u=h-m;e.tgtArrowAngle=ja(l,u)}};Ln.getArrowWidth=Ln.getArrowHeight=function(r,e){var t=this.arrowWidthCache=this.arrowWidthCache||{},a=t[r+", "+e];return a||(a=Math.max(Math.pow(13.37*r,.9),29)*e,t[r+", "+e]=a,a)};var $s,Ks,Lv,Iv,Tt,In,Yr,St,Dt,Fr,Qt,On,Ov,Nv,Ys,Xs,zv,zr={},Pr={},Fv=function(e,t,a){a.x=t.x-e.x,a.y=t.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)},Ip=function(e,t,a,n,i){if(e!==zv?Fv(t,e,zr):function(e,t){t.x=-1*e.x,t.y=-1*e.y,t.nx=-1*e.nx,t.ny=-1*e.ny,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang}(Pr,zr),Fv(t,a,Pr),Lv=zr.nx*Pr.ny-zr.ny*Pr.nx,Iv=zr.nx*Pr.nx-zr.ny*-Pr.ny,Yr=Math.asin(Math.max(-1,Math.min(1,Lv))),Math.abs(Yr)<1e-6)return $s=t.x,Ks=t.y,void(Dt=Qt=0);Tt=1,In=!1,Iv<0?Yr<0?Yr=Math.PI+Yr:(Yr=Math.PI-Yr,Tt=-1,In=!0):Yr>0&&(Tt=-1,In=!0),Qt=void 0!==t.radius?t.radius:n,St=Yr/2,On=Math.min(zr.len/2,Pr.len/2),i?(Fr=Math.abs(Math.cos(St)*Qt/Math.sin(St)))>On?(Fr=On,Dt=Math.abs(Fr*Math.sin(St)/Math.cos(St))):Dt=Qt:(Fr=Math.min(On,Qt),Dt=Math.abs(Fr*Math.sin(St)/Math.cos(St))),Ys=t.x+Pr.nx*Fr,Xs=t.y+Pr.ny*Fr,$s=Ys-Pr.ny*Dt*Tt,Ks=Xs+Pr.nx*Dt*Tt,Ov=t.x+zr.nx*Fr,Nv=t.y+zr.ny*Fr,zv=t};function Vv(r,e){0===e.radius?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Zs(r,e,t,a){var n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===a||0===e.radius?{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}:(Ip(r,e,t,a,n),{cx:$s,cy:Ks,radius:Dt,startX:Ov,startY:Nv,stopX:Ys,stopY:Xs,startAngle:zr.ang+Math.PI/2*Tt,endAngle:Pr.ang-Math.PI/2*Tt,counterClockwise:In})}var Aa=.01,Op=Math.sqrt(.02),gr={};function qv(r){var e=[];if(null!=r){for(var t=0;t<r.length;t+=2){var a=r[t],n=r[t+1];e.push({x:a,y:n})}return e}}gr.findMidptPtsEtc=function(r,e){var i,S,P,D,t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,s=r.pstyle("source-endpoint"),o=r.pstyle("target-endpoint"),l=null!=s.units&&null!=o.units;switch(r.pstyle("edge-distances").value){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":if(l){var c=Qe(this.manualEndptToPx(r.source()[0],s),2),h=c[0],d=c[1],g=Qe(this.manualEndptToPx(r.target()[0],o),2),p=g[0],m=g[1],b={x1:h,y1:d,x2:p,y2:m};S=m-d,P=p-h,D=Math.sqrt(P*P+S*S),n={x:-S/D,y:P/D},i=b}else Me("Edge ".concat(r.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}return{midptPts:i,vectorNormInverse:n}},gr.findHaystackPoints=function(r){for(var e=0;e<r.length;e++){var t=r[e],a=t._private,n=a.rscratch;if(!n.haystack){var i=2*Math.random()*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=2*Math.random()*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var s=a.source,o=a.target,l=s.position(),u=o.position(),v=s.width(),f=o.width(),c=s.height(),h=o.height(),y=t.pstyle("haystack-radius").value/2;n.haystackPts=n.allpts=[n.source.x*v*y+l.x,n.source.y*c*y+l.y,n.target.x*f*y+u.x,n.target.y*h*y+u.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(t),this.calculateArrowAngles(t),this.recalculateEdgeLabelProjections(t),this.calculateLabelAngles(t)}},gr.findSegmentsPoints=function(r,e){var t=r._private.rscratch,a=r.pstyle("segment-weights"),n=r.pstyle("segment-distances"),i=r.pstyle("segment-radii"),s=r.pstyle("radius-type"),o=Math.min(a.pfValue.length,n.pfValue.length),l=i.pfValue[i.pfValue.length-1],u=s.pfValue[s.pfValue.length-1];t.edgeType="segments",t.segpts=[],t.radii=[],t.isArcRadius=[];for(var v=0;v<o;v++){var f=a.pfValue[v],c=n.pfValue[v],h=1-f,d=f,y=this.findMidptPtsEtc(r,e),g=y.midptPts,p=y.vectorNormInverse,m={x:g.x1*h+g.x2*d,y:g.y1*h+g.y2*d};t.segpts.push(m.x+p.x*c,m.y+p.y*c),t.radii.push(void 0!==i.pfValue[v]?i.pfValue[v]:l),t.isArcRadius.push("arc-radius"===(void 0!==s.pfValue[v]?s.pfValue[v]:u))}},gr.findLoopPoints=function(r,e,t,a){var n=r._private.rscratch,i=e.dirCounts,s=e.srcPos,o=r.pstyle("control-point-distances"),l=o?o.pfValue[0]:void 0,u=r.pstyle("loop-direction").pfValue,v=r.pstyle("loop-sweep").pfValue,f=r.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=t,h=f;a&&(c=0,h=l);var d=u-Math.PI/2,y=d-v/2,g=d+v/2,p=String(u+"_"+v);c=void 0===i[p]?i[p]=0:++i[p],n.ctrlpts=[s.x+1.4*Math.cos(y)*h*(c/3+1),s.y+1.4*Math.sin(y)*h*(c/3+1),s.x+1.4*Math.cos(g)*h*(c/3+1),s.y+1.4*Math.sin(g)*h*(c/3+1)]},gr.findCompoundLoopPoints=function(r,e,t,a){var n=r._private.rscratch;n.edgeType="compound";var i=e.srcPos,s=e.tgtPos,o=e.srcW,l=e.srcH,u=e.tgtW,v=e.tgtH,f=r.pstyle("control-point-step-size").pfValue,c=r.pstyle("control-point-distances"),h=c?c.pfValue[0]:void 0,d=t,y=f;a&&(d=0,y=h);var p={x:i.x-o/2,y:i.y-l/2},m={x:s.x-u/2,y:s.y-v/2},b={x:Math.min(p.x,m.x),y:Math.min(p.y,m.y)},E=Math.max(.5,Math.log(o*Aa)),C=Math.max(.5,Math.log(u*Aa));n.ctrlpts=[b.x,b.y-(1+Math.pow(50,1.12)/100)*y*(d/3+1)*E,b.x-(1+Math.pow(50,1.12)/100)*y*(d/3+1)*C,b.y]},gr.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"},gr.findBezierPoints=function(r,e,t,a,n){var i=r._private.rscratch,s=r.pstyle("control-point-step-size").pfValue,o=r.pstyle("control-point-distances"),l=r.pstyle("control-point-weights"),u=o&&l?Math.min(o.value.length,l.value.length):1,v=o?o.pfValue[0]:void 0,f=l.value[0],c=a;i.edgeType=c?"multibezier":"bezier",i.ctrlpts=[];for(var h=0;h<u;h++){var d=(.5-e.eles.length/2+t)*s*(n?-1:1),y=void 0,g=wi(d);c&&(v=o?o.pfValue[h]:s,f=l.value[h]);var p=void 0!==(y=a?v:void 0!==v?g*v:void 0)?y:d,m=1-f,b=f,w=this.findMidptPtsEtc(r,e),E=w.midptPts,C=w.vectorNormInverse,x={x:E.x1*m+E.x2*b,y:E.y1*m+E.y2*b};i.ctrlpts.push(x.x+C.x*p,x.y+C.y*p)}},gr.findTaxiPoints=function(r,e){var t=r._private.rscratch;t.edgeType="segments";var a="vertical",n="horizontal",i="leftward",s="rightward",o="downward",l="upward",v=e.posPts,f=e.srcW,c=e.srcH,h=e.tgtW,d=e.tgtH,g="node-position"!==r.pstyle("edge-distances").value,p=r.pstyle("taxi-direction").value,m=p,b=r.pstyle("taxi-turn"),w="%"===b.units,E=b.pfValue,C=E<0,x=r.pstyle("taxi-turn-min-distance").pfValue,k=g?(f+h)/2:0,S=g?(c+d)/2:0,P=v.x2-v.x1,D=v.y2-v.y1,A=function(T,_){return T>0?Math.max(T-_,0):Math.min(T+_,0)},B=A(P,k),R=A(D,S),M=!1;"auto"===m?p=Math.abs(B)>Math.abs(R)?n:a:m===l||m===o?(p=a,M=!0):(m===i||m===s)&&(p=n,M=!0);var N,I=p===a,L=I?R:B,O=I?D:P,V=wi(O),G=!1;((!M||!w&&!C)&&(m===o&&O<0||m===l&&O>0||m===i&&O>0||m===s&&O<0)&&(L=(V*=-1)*Math.abs(L),G=!0),w)?N=(E<0?1+E:E)*L:N=(E<0?L:0)+E*V;var X=function(T){return Math.abs(T)<x||Math.abs(T)>=Math.abs(L)},Q=X(N),Z=X(Math.abs(L)-Math.abs(N));if((Q||Z)&&!G)if(I){var ae=Math.abs(O)<=c/2,J=Math.abs(P)<=h/2;if(ae){var z=(v.x1+v.x2)/2,q=v.y1,H=v.y2;t.segpts=[z,q,z,H]}else if(J){var ee=(v.y1+v.y2)/2,ne=v.x1,be=v.x2;t.segpts=[ne,ee,be,ee]}else t.segpts=[v.x1,v.y2]}else{var Ge=Math.abs(O)<=f/2,Ie=Math.abs(D)<=d/2;if(Ge){var se=(v.y1+v.y2)/2,oe=v.x1,ce=v.x2;t.segpts=[oe,se,ce,se]}else if(Ie){var ge=(v.x1+v.x2)/2,de=v.y1,ye=v.y2;t.segpts=[ge,de,ge,ye]}else t.segpts=[v.x2,v.y1]}else if(I){var we=v.y1+N+(g?c/2*V:0),De=v.x1,Fe=v.x2;t.segpts=[De,we,Fe,we]}else{var $e=v.x1+N+(g?f/2*V:0),Re=v.y1,Xe=v.y2;t.segpts=[$e,Re,$e,Xe]}if(t.isRound){var Pe=r.pstyle("taxi-radius").value,le="arc-radius"===r.pstyle("radius-type").value[0];t.radii=new Array(t.segpts.length/2).fill(Pe),t.isArcRadius=new Array(t.segpts.length/2).fill(le)}},gr.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if("bezier"===t.edgeType){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,v=e.tgtShape,f=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,y=!te(t.startX)||!te(t.startY),g=!te(t.arrowStartX)||!te(t.arrowStartY),p=!te(t.endX)||!te(t.endY),m=!te(t.arrowEndX)||!te(t.arrowEndY),E=3*(this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth),C=yt({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),x=C<E,k=yt({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),S=k<E,P=!1;if(y||g||x){P=!0;var D={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},A=Math.sqrt(D.x*D.x+D.y*D.y),B={x:D.x/A,y:D.y/A},R=Math.max(i,s),M={x:t.ctrlpts[0]+2*B.x*R,y:t.ctrlpts[1]+2*B.y*R},I=u.intersectLine(a.x,a.y,i,s,M.x,M.y,0,f,h);x?(t.ctrlpts[0]=t.ctrlpts[0]+B.x*(E-C),t.ctrlpts[1]=t.ctrlpts[1]+B.y*(E-C)):(t.ctrlpts[0]=I[0]+B.x*E,t.ctrlpts[1]=I[1]+B.y*E)}if(p||m||S){P=!0;var L={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},O=Math.sqrt(L.x*L.x+L.y*L.y),V={x:L.x/O,y:L.y/O},G=Math.max(i,s),N={x:t.ctrlpts[0]+2*V.x*G,y:t.ctrlpts[1]+2*V.y*G},F=v.intersectLine(n.x,n.y,o,l,N.x,N.y,0,c,d);S?(t.ctrlpts[0]=t.ctrlpts[0]+V.x*(E-k),t.ctrlpts[1]=t.ctrlpts[1]+V.y*(E-k)):(t.ctrlpts[0]=F[0]+V.x*E,t.ctrlpts[1]=F[1]+V.y*E)}P&&this.findEndpoints(r)}},gr.storeAllpts=function(r){var e=r._private.rscratch;if("multibezier"===e.edgeType||"bezier"===e.edgeType||"self"===e.edgeType||"compound"===e.edgeType){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var t=0;t+1<e.ctrlpts.length;t+=2)e.allpts.push(e.ctrlpts[t],e.ctrlpts[t+1]),t+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[t]+e.ctrlpts[t+2])/2,(e.ctrlpts[t+1]+e.ctrlpts[t+3])/2);var a;e.allpts.push(e.endX,e.endY),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,.5,e.midX=ar(e.allpts[a],e.allpts[a+2],e.allpts[a+4],.5),e.midY=ar(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],.5))}else if("straight"===e.edgeType)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("segments"===e.edgeType){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var s=e.radii[i/2-1],o=e.isArcRadius[i/2-1];e.roundCorners.push(Zs({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:s},{x:e.allpts[i+2],y:e.allpts[i+3]},s,o))}}if(e.segpts.length%4==0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var v=e.segpts.length/2-1;if(e.isRound){var f={x:e.segpts[v],y:e.segpts[v+1]},c=e.roundCorners[v/2];if(0===c.radius){var h={x:e.segpts[v+2],y:e.segpts[v+3]};e.midX=f.x,e.midY=f.y,e.midVector=[f.y-h.y,h.x-f.x]}else{var d=[f.x-c.cx,f.y-c.cy],y=c.radius/Math.sqrt(Math.pow(d[0],2)+Math.pow(d[1],2));d=d.map(function(g){return g*y}),e.midX=c.cx+d[0],e.midY=c.cy+d[1],e.midVector=d}}else e.midX=e.segpts[v],e.midY=e.segpts[v+1]}}},gr.checkForInvalidEdgeWarning=function(r){var e=r[0]._private.rscratch;e.nodesOverlap||te(e.startX)&&te(e.startY)&&te(e.endX)&&te(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Me("Edge `"+r.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."))},gr.findEdgeControlPoints=function(r){var e=this;if(r&&0!==r.length){for(var t=this,n=t.cy.hasCompoundNodes(),i=new $r,s=function(S,P){return[].concat(Ga(S),[P?1:0]).join("-")},o=[],l=[],u=0;u<r.length;u++){var v=r[u],f=v._private,c=v.pstyle("curve-style").value;if(!v.removed()&&v.takesUpSpace()){if("haystack"===c){l.push(v);continue}var h="unbundled-bezier"===c||c.endsWith("segments")||"straight"===c||"straight-triangle"===c||c.endsWith("taxi"),d="unbundled-bezier"===c||"bezier"===c,y=f.source,g=f.target,b=[y.poolIndex(),g.poolIndex()].sort(),w=s(b,h),E=i.get(w);null==E&&(E={eles:[]},o.push({pairId:b,edgeIsUnbundled:h}),i.set(w,E)),E.eles.push(v),h&&(E.hasUnbundled=!0),d&&(E.hasBezier=!0)}}for(var C=function(){var R,S=o[x],P=S.pairId,D=S.edgeIsUnbundled,A=s(P,D),B=i.get(A);if(!B.hasUnbundled){var M=B.eles[0].parallelEdges().filter(function(le){return le.isBundledBezier()});pi(B.eles),M.forEach(function(le){return B.eles.push(le)}),B.eles.sort(function(le,Y){return le.poolIndex()-Y.poolIndex()})}var I=B.eles[0],L=I.source(),O=I.target();if(L.poolIndex()>O.poolIndex()){var V=L;L=O,O=V}var G=B.srcPos=L.position(),N=B.tgtPos=O.position(),F=B.srcW=L.outerWidth(),K=B.srcH=L.outerHeight(),X=B.tgtW=O.outerWidth(),Q=B.tgtH=O.outerHeight(),Z=B.srcShape=t.nodeShapes[e.getNodeShape(L)],re=B.tgtShape=t.nodeShapes[e.getNodeShape(O)],ae=B.srcCornerRadius="auto"===L.pstyle("corner-radius").value?"auto":L.pstyle("corner-radius").pfValue,J=B.tgtCornerRadius="auto"===O.pstyle("corner-radius").value?"auto":O.pstyle("corner-radius").pfValue,z=B.tgtRs=O._private.rscratch,q=B.srcRs=L._private.rscratch;B.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var H=0;H<B.eles.length;H++){var ee=B.eles[H],ne=ee[0]._private.rscratch,be=ee.pstyle("curve-style").value,Ge="unbundled-bezier"===be||be.endsWith("segments")||be.endsWith("taxi"),Ie=!L.same(ee.source());if(!B.calculatedIntersection&&L!==O&&(B.hasBezier||B.hasUnbundled)){B.calculatedIntersection=!0;var se=Z.intersectLine(G.x,G.y,F,K,N.x,N.y,0,ae,q),oe=B.srcIntn=se,ce=re.intersectLine(N.x,N.y,X,Q,G.x,G.y,0,J,z),ge=B.tgtIntn=ce,de=B.intersectionPts={x1:se[0],x2:ce[0],y1:se[1],y2:ce[1]},ye=B.posPts={x1:G.x,x2:N.x,y1:G.y,y2:N.y},we=ce[1]-se[1],De=ce[0]-se[0],Fe=Math.sqrt(De*De+we*we);te(Fe)&&Fe>=Op||(Fe=Math.sqrt(Math.max(De*De,Aa)+Math.max(we*we,Aa)));var $e=B.vector={x:De,y:we},Re=B.vectorNorm={x:$e.x/Fe,y:$e.y/Fe},Xe={x:-Re.y,y:Re.x};B.nodesOverlap=!te(Fe)||re.checkPoint(se[0],se[1],0,X,Q,N.x,N.y,J,z)||Z.checkPoint(ce[0],ce[1],0,F,K,G.x,G.y,ae,q),B.vectorNormInverse=Xe,R={nodesOverlap:B.nodesOverlap,dirCounts:B.dirCounts,calculatedIntersection:!0,hasBezier:B.hasBezier,hasUnbundled:B.hasUnbundled,eles:B.eles,srcPos:N,srcRs:z,tgtPos:G,tgtRs:q,srcW:X,srcH:Q,tgtW:F,tgtH:K,srcIntn:ge,tgtIntn:oe,srcShape:re,tgtShape:Z,posPts:{x1:ye.x2,y1:ye.y2,x2:ye.x1,y2:ye.y1},intersectionPts:{x1:de.x2,y1:de.y2,x2:de.x1,y2:de.y1},vector:{x:-$e.x,y:-$e.y},vectorNorm:{x:-Re.x,y:-Re.y},vectorNormInverse:{x:-Xe.x,y:-Xe.y}}}var Pe=Ie?R:B;ne.nodesOverlap=Pe.nodesOverlap,ne.srcIntn=Pe.srcIntn,ne.tgtIntn=Pe.tgtIntn,ne.isRound=be.startsWith("round"),n&&(L.isParent()||L.isChild()||O.isParent()||O.isChild())&&(L.parents().anySame(O)||O.parents().anySame(L)||L.same(O)&&L.isParent())?e.findCompoundLoopPoints(ee,Pe,H,Ge):L===O?e.findLoopPoints(ee,Pe,H,Ge):be.endsWith("segments")?e.findSegmentsPoints(ee,Pe):be.endsWith("taxi")?e.findTaxiPoints(ee,Pe):"straight"===be||!Ge&&B.eles.length%2==1&&H===Math.floor(B.eles.length/2)?e.findStraightEdgePoints(ee):e.findBezierPoints(ee,Pe,H,Ge,Ie),e.findEndpoints(ee),e.tryToCorrectInvalidPoints(ee,Pe),e.checkForInvalidEdgeWarning(ee),e.storeAllpts(ee),e.storeEdgeProjections(ee),e.calculateArrowAngles(ee),e.recalculateEdgeLabelProjections(ee),e.calculateLabelAngles(ee)}},x=0;x<o.length;x++)C();this.findHaystackPoints(l)}},gr.getSegmentPoints=function(r){var e=r[0]._private.rscratch;if(this.recalculateRenderedStyle(r),"segments"===e.edgeType)return qv(e.segpts)},gr.getControlPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if("bezier"===t||"multibezier"===t||"self"===t||"compound"===t)return qv(e.ctrlpts)},gr.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var Ra={manualEndptToPx:function(r,e){var a=r.position(),n=r.outerWidth(),i=r.outerHeight(),s=r._private.rscratch;if(2===e.value.length){var o=[e.pfValue[0],e.pfValue[1]];return"%"===e.units[0]&&(o[0]=o[0]*n),"%"===e.units[1]&&(o[1]=o[1]*i),o[0]+=a.x,o[1]+=a.y,o}var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(n,i),v=[a.x+Math.cos(l)*u,a.y+Math.sin(l)*u];return this.nodeShapes[this.getNodeShape(r)].intersectLine(a.x,a.y,n,i,v[0],v[1],0,"auto"===r.pstyle("corner-radius").value?"auto":r.pstyle("corner-radius").pfValue,s)},findEndpoints:function(r){var t,R,M,I,L,e=this,a=r.source()[0],n=r.target()[0],i=a.position(),s=n.position(),o=r.pstyle("target-arrow-shape").value,l=r.pstyle("source-arrow-shape").value,u=r.pstyle("target-distance-from-node").pfValue,v=r.pstyle("source-distance-from-node").pfValue,f=a._private.rscratch,c=n._private.rscratch,h=r.pstyle("curve-style").value,d=r._private.rscratch,y=d.edgeType,p="self"===y||"compound"===y,m="bezier"===y||"multibezier"===y||p,b="bezier"!==y,w="straight"===y||"segments"===y,E="segments"===y,C=m||b||w,x=p||"taxi"===h,k=r.pstyle("source-endpoint"),S=x?"outside-to-node":k.value,P="auto"===a.pstyle("corner-radius").value?"auto":a.pstyle("corner-radius").pfValue,D=r.pstyle("target-endpoint"),A=x?"outside-to-node":D.value,B="auto"===n.pstyle("corner-radius").value?"auto":n.pstyle("corner-radius").pfValue;if(d.srcManEndpt=k,d.tgtManEndpt=D,m){var O=[d.ctrlpts[0],d.ctrlpts[1]];R=b?[d.ctrlpts[d.ctrlpts.length-2],d.ctrlpts[d.ctrlpts.length-1]]:O,M=O}else if(w){var G=E?d.segpts.slice(0,2):[s.x,s.y];R=E?d.segpts.slice(d.segpts.length-2):[i.x,i.y],M=G}if("inside-to-node"===A)t=[s.x,s.y];else if(D.units)t=this.manualEndptToPx(n,D);else if("outside-to-line"===A)t=d.tgtIntn;else if("outside-to-node"===A||"outside-to-node-or-label"===A?I=R:("outside-to-line"===A||"outside-to-line-or-label"===A)&&(I=[i.x,i.y]),t=e.nodeShapes[this.getNodeShape(n)].intersectLine(s.x,s.y,n.outerWidth(),n.outerHeight(),I[0],I[1],0,B,c),"outside-to-node-or-label"===A||"outside-to-line-or-label"===A){var F=n._private.rscratch,K=F.labelWidth,X=F.labelHeight,Q=F.labelX,Z=F.labelY,re=K/2,ae=X/2,J=n.pstyle("text-valign").value;"top"===J?Z-=ae:"bottom"===J&&(Z+=ae);var z=n.pstyle("text-halign").value;"left"===z?Q-=re:"right"===z&&(Q+=re);var q=ya(I[0],I[1],[Q-re,Z-ae,Q+re,Z-ae,Q+re,Z+ae,Q-re,Z+ae],s.x,s.y);if(q.length>0){var H=i,ee=mt(H,Ot(t)),ne=mt(H,Ot(q)),be=ee;if(ne<ee&&(t=q,be=ne),q.length>2)mt(H,{x:q[2],y:q[3]})<be&&(t=[q[2],q[3]])}}var Ie=nn(t,R,e.arrowShapes[o].spacing(r)+u),se=nn(t,R,e.arrowShapes[o].gap(r)+u);if(d.endX=se[0],d.endY=se[1],d.arrowEndX=Ie[0],d.arrowEndY=Ie[1],"inside-to-node"===S)t=[i.x,i.y];else if(k.units)t=this.manualEndptToPx(a,k);else if("outside-to-line"===S)t=d.srcIntn;else if("outside-to-node"===S||"outside-to-node-or-label"===S?L=M:("outside-to-line"===S||"outside-to-line-or-label"===S)&&(L=[s.x,s.y]),t=e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x,i.y,a.outerWidth(),a.outerHeight(),L[0],L[1],0,P,f),"outside-to-node-or-label"===S||"outside-to-line-or-label"===S){var oe=a._private.rscratch,ce=oe.labelWidth,ge=oe.labelHeight,de=oe.labelX,ye=oe.labelY,we=ce/2,De=ge/2,Fe=a.pstyle("text-valign").value;"top"===Fe?ye-=De:"bottom"===Fe&&(ye+=De);var $e=a.pstyle("text-halign").value;"left"===$e?de-=we:"right"===$e&&(de+=we);var Re=ya(L[0],L[1],[de-we,ye-De,de+we,ye-De,de+we,ye+De,de-we,ye+De],i.x,i.y);if(Re.length>0){var Xe=s,Pe=mt(Xe,Ot(t)),le=mt(Xe,Ot(Re)),Y=Pe;if(le<Pe&&(t=[Re[0],Re[1]],Y=le),Re.length>2)mt(Xe,{x:Re[2],y:Re[3]})<Y&&(t=[Re[2],Re[3]])}}var _=nn(t,M,e.arrowShapes[l].spacing(r)+v),W=nn(t,M,e.arrowShapes[l].gap(r)+v);d.startX=W[0],d.startY=W[1],d.arrowStartX=_[0],d.arrowStartY=_[1],C&&(te(d.startX)&&te(d.startY)&&te(d.endX)&&te(d.endY)?d.badLine=!1:d.badLine=!0)},getSourceEndpoint:function(r){var e=r[0]._private.rscratch;return"haystack"===(this.recalculateRenderedStyle(r),e.edgeType)?{x:e.haystackPts[0],y:e.haystackPts[1]}:{x:e.arrowStartX,y:e.arrowStartY}},getTargetEndpoint:function(r){var e=r[0]._private.rscratch;return"haystack"===(this.recalculateRenderedStyle(r),e.edgeType)?{x:e.haystackPts[2],y:e.haystackPts[3]}:{x:e.arrowEndX,y:e.arrowEndY}}},Qs={};function Np(r,e,t){for(var a=function(u,v,f,c){return ar(u,v,f,c)},i=e._private.rstyle.bezierPts,s=0;s<r.bezierProjPcts.length;s++){var o=r.bezierProjPcts[s];i.push({x:a(t[0],t[2],t[4],o),y:a(t[1],t[3],t[5],o)})}}Qs.storeEdgeProjections=function(r){var e=r._private,t=e.rscratch,a=t.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,"multibezier"===a||"bezier"===a||"self"===a||"compound"===a){e.rstyle.bezierPts=[];for(var n=0;n+5<t.allpts.length;n+=4)Np(this,r,t.allpts.slice(n,n+6))}else if("segments"===a){var i=e.rstyle.linePts=[];for(n=0;n+1<t.allpts.length;n+=2)i.push({x:t.allpts[n],y:t.allpts[n+1]})}else if("haystack"===a){var s=t.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth},Qs.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var Vr={recalculateNodeLabelProjection:function(r){var e=r.pstyle("label").strValue;if(!et(e)){var t,a,n=r._private,i=r.width(),s=r.height(),o=r.padding(),l=r.position(),u=r.pstyle("text-halign").strValue,v=r.pstyle("text-valign").strValue,f=n.rscratch,c=n.rstyle;switch(u){case"left":t=l.x-i/2-o;break;case"right":t=l.x+i/2+o;break;default:t=l.x}switch(v){case"top":a=l.y-s/2-o;break;case"bottom":a=l.y+s/2+o;break;default:a=l.y}f.labelX=t,f.labelY=a,c.labelX=t,c.labelY=a,this.calculateLabelAngles(r),this.applyLabelDimensions(r)}}},_v=function(e,t){var a=Math.atan(t/e);return 0===e&&a<0&&(a*=-1),a},Gv=function(e,t){var a=t.x-e.x,n=t.y-e.y;return _v(a,n)};Vr.recalculateEdgeLabelProjections=function(r){var e,t=r._private,a=t.rscratch,n=this,i={mid:r.pstyle("label").strValue,source:r.pstyle("source-label").strValue,target:r.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var s=function(f,c,h){Ur(t.rscratch,f,c,h),Ur(t.rstyle,f,c,h)};s("labelX",null,e.x),s("labelY",null,e.y);var o=_v(a.midDispX,a.midDispY);s("labelAutoAngle",null,o);var l=function(){if(l.cache)return l.cache;for(var f=[],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]},y={x:a.allpts[c+4],y:a.allpts[c+5]};f.push({p0:h,p1:d,p2:y,startDist:0,length:0,segments:[]})}var g=t.rstyle.bezierPts,p=n.bezierProjPcts.length;function m(x,k,S,P,D){var A=yt(k,S),B=x.segments[x.segments.length-1],R={p0:k,p1:S,t0:P,t1:D,startDist:B?B.startDist+B.length:0,length:A};x.segments.push(R),x.length+=A}for(var b=0;b<f.length;b++){var w=f[b],E=f[b-1];E&&(w.startDist=E.startDist+E.length),m(w,w.p0,g[b*p],0,n.bezierProjPcts[0]);for(var C=0;C<p-1;C++)m(w,g[b*p+C],g[b*p+C+1],n.bezierProjPcts[C],n.bezierProjPcts[C+1]);m(w,g[b*p+p-1],w.p2,n.bezierProjPcts[p-1],1)}return l.cache=f},u=function(f){var c,h="source"===f;if(i[f]){var d=r.pstyle(f+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var g,y=l(),p=0,m=0,b=0;b<y.length;b++){for(var w=y[h?b:y.length-1-b],E=0;E<w.segments.length;E++){var C=w.segments[h?E:w.segments.length-1-E],x=b===y.length-1&&E===w.segments.length-1;if(p=m,(m+=C.length)>=d||x){g={cp:w,segment:C};break}}if(g)break}var k=g.cp,S=g.segment,P=(d-p)/S.length,D=S.t1-S.t0,A=h?S.t0+D*P:S.t1-D*P;A=ga(0,A,1),e=Nt(k.p0,k.p1,k.p2,A),c=function(e,t,a,n){var i=ga(0,n-.001,1),s=ga(0,n+.001,1),o=Nt(e,t,a,i),l=Nt(e,t,a,s);return Gv(o,l)}(k.p0,k.p1,k.p2,A);break;case"straight":case"segments":case"haystack":for(var R,M,I,L,B=0,O=a.allpts.length,V=0;V+3<O&&(h?(I={x:a.allpts[V],y:a.allpts[V+1]},L={x:a.allpts[V+2],y:a.allpts[V+3]}):(I={x:a.allpts[O-2-V],y:a.allpts[O-1-V]},L={x:a.allpts[O-4-V],y:a.allpts[O-3-V]}),M=B,!((B+=R=yt(I,L))>=d));V+=2);var N=(d-M)/R;N=ga(0,N,1),e=function(e,t,a,n){var i_x=t.x-e.x,i_y=t.y-e.y,s=yt(e,t),o_x=i_x/s,o_y=i_y/s;return a=a??0,n=n??a*s,{x:e.x+o_x*n,y:e.y+o_y*n}}(I,L,N),c=Gv(I,L)}s("labelX",f,e.x),s("labelY",f,e.y),s("labelAutoAngle",f,c)}};u("source"),u("target"),this.applyLabelDimensions(r)}},Vr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))},Vr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=pt(a,r._private.labelDimsKey);if(wr(t.rscratch,"prefixedLabelDimsKey",e)!==n){Ur(t.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(r,a),s=r.pstyle("line-height").pfValue,o=r.pstyle("text-wrap").strValue,l=wr(t.rscratch,"labelWrapCachedLines",e)||[],u="wrap"!==o?1:Math.max(l.length,1),v=i.height/u,f=v*s,c=i.width,h=i.height+(u-1)*(s-1)*v;Ur(t.rstyle,"labelWidth",e,c),Ur(t.rscratch,"labelWidth",e,c),Ur(t.rstyle,"labelHeight",e,h),Ur(t.rscratch,"labelHeight",e,h),Ur(t.rscratch,"labelLineHeight",e,f)}},Vr.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,s=function(K,X){return X?(Ur(t.rscratch,K,e,X),X):wr(t.rscratch,K,e)};if(!n)return"";"none"==i||("uppercase"==i?n=n.toUpperCase():"lowercase"==i&&(n=n.toLowerCase()));var o=r.pstyle("text-wrap").value;if("wrap"===o){var l=s("labelKey");if(null!=l&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var v=n.split("\n"),f=r.pstyle("text-max-width").pfValue,h="anywhere"===r.pstyle("text-overflow-wrap").value,d=[],y=/[\s\u200b]+|$/g,g=0;g<v.length;g++){var p=v[g],b=this.calculateLabelDimensions(r,p).width;if(h){var w=p.split("").join("\u200b");p=w}if(b>f){var S,C="",x=0,k=br(p.matchAll(y));try{for(k.s();!(S=k.n()).done;){var P=S.value,D=P[0],A=p.substring(x,P.index);x=P.index+D.length;var B=0===C.length?A:C+A+D;this.calculateLabelDimensions(r,B).width<=f?C+=A+D:(C&&d.push(C),C=A+D)}}catch(F){k.e(F)}finally{k.f()}C.match(/^[\s\u200b]+$/)||d.push(C)}else d.push(p)}s("labelWrapCachedLines",d),n=s("labelWrapCachedText",d.join("\n")),s("labelWrapKey",l)}else if("ellipsis"===o){var I=r.pstyle("text-max-width").pfValue,L="",V=!1;if(this.calculateLabelDimensions(r,n).width<I)return n;for(var G=0;G<n.length;G++){if(this.calculateLabelDimensions(r,L+n[G]+"\u2026").width>I)break;L+=n[G],G===n.length-1&&(V=!0)}return V||(L+="\u2026"),L}return n},Vr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if("auto"!==e)return e;if(!r.isNode())return"center";switch(t){case"left":return"right";case"right":return"left";default:return"center"}},Vr.calculateLabelDimensions=function(r,e){var n=this.cy.window().document,s=r.pstyle("font-style").strValue,o=r.pstyle("font-size").pfValue,l=r.pstyle("font-family").strValue,u=r.pstyle("font-weight").strValue,v=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=n.createElement("canvas"),f=this.labelCalcCanvasContext=v.getContext("2d");var c=v.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}f.font="".concat(s," ").concat(u," ").concat(o,"px ").concat(l);for(var h=0,d=0,y=e.split("\n"),g=0;g<y.length;g++){var p=y[g],m=f.measureText(p),b=Math.ceil(m.width),w=o;h=Math.max(b,h),d+=w}return{width:h+=0,height:d+=0}},Vr.calculateLabelAngle=function(r,e){var a=r._private.rscratch,n=r.isEdge(),i=e?e+"-":"",s=r.pstyle(i+"text-rotation"),o=s.strValue;return"none"===o?0:n&&"autorotate"===o?a.labelAutoAngle:"autorotate"===o?0:s.pfValue},Vr.calculateLabelAngles=function(r){var e=this,t=r.isEdge(),n=r._private.rscratch;n.labelAngle=e.calculateLabelAngle(r),t&&(n.sourceLabelAngle=e.calculateLabelAngle(r,"source"),n.targetLabelAngle=e.calculateLabelAngle(r,"target"))};var Hv={},Uv=!1;Hv.getNodeShape=function(r){var t=r.pstyle("shape").value;if("cutrectangle"===t&&(r.width()<28||r.height()<28))return Uv||(Me("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Uv=!0),"rectangle";if(r.isParent())return"rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var a=r.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(a).name}return t};var Nn={registerCalculationListeners:function(){var r=this.cy,e=r.collection(),t=this,a=function(s){var o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.merge(s),o)for(var l=0;l<s.length;l++){var u=s[l],v=u._private,f=v.rstyle;f.clean=!1,f.cleanConnected=!1}};t.binder(r).on("bounds.* dirty.*",function(s){var o=s.target;a(o)}).on("style.* background.*",function(s){var o=s.target;a(o,!1)});var n=function(s){if(s){var o=t.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],v=u._private.rstyle;u.isNode()&&!v.cleanConnected&&(a(u.connectedEdges()),v.cleanConnected=!0)}if(o)for(var f=0;f<o.length;f++){(0,o[f])(s,e)}t.recalculateRenderedStyle(e),e=r.collection()}};t.flushRenderedStyleQueue=function(){n(!0)},t.beforeRender(n,t.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(r){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(r)},recalculateRenderedStyle:function(r,e){var t=function(w){return w._private.rstyle.cleanConnected};if(0!==r.length){var a=[],n=[];if(!this.destroyed){void 0===e&&(e=!0);for(var i=0;i<r.length;i++){var s=r[i],o=s._private,l=o.rstyle;s.isEdge()&&(!t(s.source())||!t(s.target()))&&(l.clean=!1),s.isEdge()&&s.isBundledBezier()&&s.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(l.clean=!1),!(e&&l.clean||s.removed())&&"none"!==s.pstyle("display").value&&("nodes"===o.group?n.push(s):a.push(s),l.clean=!0)}for(var u=0;u<n.length;u++){var v=n[u],c=v._private.rstyle,h=v.position();this.recalculateNodeLabelProjection(v),c.nodeX=h.x,c.nodeY=h.y,c.nodeW=v.pstyle("width").pfValue,c.nodeH=v.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var g=a[d]._private,p=g.rstyle,m=g.rscratch;p.srcX=m.arrowStartX,p.srcY=m.arrowStartY,p.tgtX=m.arrowEndX,p.tgtY=m.arrowEndY,p.midX=m.midX,p.midY=m.midY,p.labelAngle=m.labelAngle,p.sourceLabelAngle=m.sourceLabelAngle,p.targetLabelAngle=m.targetLabelAngle}}}}},zn={updateCachedGrabbedEles:function(){var r=this.cachedZSortedEles;if(r){r.drag=[],r.nondrag=[];for(var e=[],t=0;t<r.length;t++){var n=(a=r[t])._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?r.drag.push(a):r.nondrag.push(a)}for(t=0;t<e.length;t++){var a=e[t];r.drag.push(a)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(r){if(r||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(iv),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e}},$v={};[Ct,Ln,gr,Ra,Qs,Vr,Hv,Nn,zn].forEach(function(r){he($v,r)});var Kv={getCachedImage:function(r,e,t){var n=this.imageCache=this.imageCache||{},i=n[r];if(i)return i.image.complete||i.image.addEventListener("load",t),i.image;var s=(i=n[r]=n[r]||{}).image=new Image;s.addEventListener("load",t),s.addEventListener("error",function(){s.error=!0});var o="data:";return r.substring(0,o.length).toLowerCase()===o||(e="null"===e?null:e,s.crossOrigin=e),s.src=r,s}},Jt={registerBinding:function(r,e,t,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(r)){for(var i=[],s=0;s<r.length;s++){var o=r[s];if(void 0!==o){var l=this.binder(o);i.push(l.on.apply(l,n))}}return i}return(l=this.binder(r)).on.apply(l,n)}};Jt.binder=function(r){var e=this,t=e.cy.window(),a=r===t||r===t.document||r===t.document.body||function(e){return!(typeof HTMLElement>"u")&&e instanceof HTMLElement}(r);if(null==e.supportsPassiveEvents){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});t.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var s=function(l,u,v){var f=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(f[2]={capture:v??!1,passive:!1,once:!1}),e.bindings.push({target:r,args:f}),(r.addEventListener||r.on).apply(r,f),this};return{on:s,addEventListener:s,addListener:s,bind:s}},Jt.nodeIsDraggable=function(r){return r&&r.isNode()&&!r.locked()&&r.grabbable()},Jt.nodeIsGrabbable=function(r){return this.nodeIsDraggable(r)&&r.interactive()},Jt.load=function(){var r=this,e=r.cy.window(),t=function(T){return T.selected()},n=function(T,_,W,U){null==T&&(T=r.cy);for(var $=0;$<_.length;$++){var ue=_[$];T.emit({originalEvent:W,type:ue,position:U})}},i=function(T){return T.shiftKey||T.metaKey||T.ctrlKey},s=function(T,_){var W=!0;if(r.cy.hasCompoundNodes()&&T&&T.pannable())for(var U=0;_&&U<_.length;U++){if((T=_[U]).isNode()&&T.isParent()&&!T.pannable()){W=!1;break}}else W=!0;return W},u=function(T){T[0]._private.rscratch.inDragLayer=!0},f=function(T){T[0]._private.rscratch.isGrabTarget=!0},h=function(T,_){var W=_.addToList;!W.has(T)&&T.grabbable()&&!T.locked()&&(W.merge(T),function(T){T[0]._private.grabbed=!0}(T))},y=function(T,_){_=_||{};var W=T.cy().hasCompoundNodes();_.inDragLayer&&(T.forEach(u),T.neighborhood().stdFilter(function(U){return!W||U.isEdge()}).forEach(u)),_.addToList&&T.forEach(function(U){h(U,_)}),function(T,_){if(T.cy().hasCompoundNodes()&&(null!=_.inDragLayer||null!=_.addToList)){var W=T.descendants();_.inDragLayer&&(W.forEach(u),W.connectedEdges().forEach(u)),_.addToList&&h(W,_)}}(T,_),m(T,{inDragLayer:_.inDragLayer}),r.updateCachedGrabbedEles()},g=y,p=function(T){!T||(r.getCachedZSortedEles().forEach(function(_){(function(T){T[0]._private.grabbed=!1})(_),function(T){T[0]._private.rscratch.inDragLayer=!1}(_),function(T){T[0]._private.rscratch.isGrabTarget=!1}(_)}),r.updateCachedGrabbedEles())},m=function(T,_){if((null!=_.inDragLayer||null!=_.addToList)&&T.cy().hasCompoundNodes()){var W=T.ancestors().orphans();if(!W.same(T)){var U=W.descendants().spawnSelf().merge(W).unmerge(T).unmerge(T.descendants()),$=U.connectedEdges();_.inDragLayer&&($.forEach(u),U.forEach(u)),_.addToList&&U.forEach(function(ue){h(ue,_)})}}},b=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},w=typeof MutationObserver<"u",E=typeof ResizeObserver<"u";w?(r.removeObserver=new MutationObserver(function(Y){for(var T=0;T<Y.length;T++){var W=Y[T].removedNodes;if(W)for(var U=0;U<W.length;U++){if(W[U]===r.container){r.destroy();break}}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(Y){r.destroy()});var C=va(function(){r.cy.resize()},100);w&&(r.styleObserver=new MutationObserver(C),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",C),E&&(r.resizeObserver=new ResizeObserver(C),r.resizeObserver.observe(r.container));var k=function(){r.invalidateContainerClientCoordsCache()};(function(T,_){for(;null!=T;)_(T),T=T.parentNode})(r.container,function(Y){r.registerBinding(Y,"transitionend",k),r.registerBinding(Y,"animationend",k),r.registerBinding(Y,"scroll",k)}),r.registerBinding(r.container,"contextmenu",function(Y){Y.preventDefault()});var P=function(T){for(var _=r.findContainerClientCoords(),W=_[0],U=_[1],$=_[2],ue=_[3],j=T.touches?T.touches:[T],fe=!1,Ee=0;Ee<j.length;Ee++){var Se=j[Ee];if(W<=Se.clientX&&Se.clientX<=W+$&&U<=Se.clientY&&Se.clientY<=U+ue){fe=!0;break}}if(!fe)return!1;for(var pe=r.container,me=T.target.parentNode,xe=!1;me;){if(me===pe){xe=!0;break}me=me.parentNode}return!!xe};r.registerBinding(r.container,"mousedown",function(T){if(P(T)&&(1!==r.hoverData.which||1===T.which)){T.preventDefault(),b(),r.hoverData.capture=!0,r.hoverData.which=T.which;var _=r.cy,W=[T.clientX,T.clientY],U=r.projectIntoViewport(W[0],W[1]),$=r.selection,ue=r.findNearestElements(U[0],U[1],!0,!1),j=ue[0],fe=r.dragData.possibleDragElements;r.hoverData.mdownPos=U,r.hoverData.mdownGPos=W;if(3==T.which){r.hoverData.cxtStarted=!0;var Se={originalEvent:T,type:"cxttapstart",position:{x:U[0],y:U[1]}};j?(j.activate(),j.emit(Se),r.hoverData.down=j):_.emit(Se),r.hoverData.downTime=(new Date).getTime(),r.hoverData.cxtDragged=!1}else if(1==T.which){if(j&&j.activate(),null!=j&&r.nodeIsGrabbable(j)){var pe=function(Ne){return{originalEvent:T,type:Ne,position:{x:U[0],y:U[1]}}};if(f(j),j.selected()){fe=r.dragData.possibleDragElements=_.collection();var me=_.$(function(xe){return xe.isNode()&&xe.selected()&&r.nodeIsGrabbable(xe)});y(me,{addToList:fe}),j.emit(pe("grabon")),me.forEach(function(Ne){Ne.emit(pe("grab"))})}else fe=r.dragData.possibleDragElements=_.collection(),g(j,{addToList:fe}),j.emit(pe("grabon")).emit(pe("grab"));r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=j,r.hoverData.downs=ue,r.hoverData.downTime=(new Date).getTime(),n(j,["mousedown","tapstart","vmousedown"],T,{x:U[0],y:U[1]}),null==j?($[4]=1,r.data.bgActivePosistion={x:U[0],y:U[1]},r.redrawHint("select",!0),r.redraw()):j.pannable()&&($[4]=1),r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var Ne=r.hoverData.down;Ne?Ne.emit({originalEvent:T,type:"taphold",position:{x:U[0],y:U[1]}}):_.emit({originalEvent:T,type:"taphold",position:{x:U[0],y:U[1]}})}},r.tapholdDuration)}$[0]=$[2]=U[0],$[1]=$[3]=U[1]}},!1);var A,B,R,D=function(T){var _=T.getRootNode();if(_&&11===_.nodeType&&void 0!==_.host)return _}(r.container);r.registerBinding([e,D],"mousemove",function(T){var Hr;if(r.hoverData.capture||P(T)){var W=!1,U=r.cy,$=U.zoom(),ue=[T.clientX,T.clientY],j=r.projectIntoViewport(ue[0],ue[1]),fe=r.hoverData.mdownPos,Ee=r.hoverData.mdownGPos,Se=r.selection,pe=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(pe=r.findNearestElement(j[0],j[1],!0,!1));var Ze,Ce=r.hoverData.last,me=r.hoverData.down,xe=[j[0]-Se[2],j[1]-Se[3]],Ne=r.dragData.possibleDragElements;if(Ee){var fr=ue[0]-Ee[0],sr=fr*fr,Ke=ue[1]-Ee[1],tr=sr+Ke*Ke;r.hoverData.isOverThresholdDrag=Ze=tr>=r.desktopTapThreshold2}var Cr=i(T);Ze&&(r.hoverData.tapholdCancelled=!0);W=!0,n(pe,["mousemove","vmousemove","tapdrag"],T,{x:j[0],y:j[1]});var ht=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||U.emit({originalEvent:T,type:"boxstart",position:{x:j[0],y:j[1]}}),Se[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(3===r.hoverData.which){if(Ze){var Qr={originalEvent:T,type:"cxtdrag",position:{x:j[0],y:j[1]}};me?me.emit(Qr):U.emit(Qr),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||pe!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:j[0],y:j[1]}}),r.hoverData.cxtOver=pe,pe&&pe.emit({originalEvent:T,type:"cxtdragover",position:{x:j[0],y:j[1]}}))}}else if(r.hoverData.dragging){if(W=!0,U.panningEnabled()&&U.userPanningEnabled()){var na;if(r.hoverData.justStartedPan){var Un=r.hoverData.mdownPos;na={x:(j[0]-Un[0])*$,y:(j[1]-Un[1])*$},r.hoverData.justStartedPan=!1}else na={x:xe[0]*$,y:xe[1]*$};U.panBy(na),U.emit("dragpan"),r.hoverData.dragged=!0}j=r.projectIntoViewport(T.clientX,T.clientY)}else if(1!=Se[4]||null!=me&&!me.pannable()){if(me&&me.pannable()&&me.active()&&me.unactivate(),(!me||!me.grabbed())&&pe!=Ce&&(Ce&&n(Ce,["mouseout","tapdragout"],T,{x:j[0],y:j[1]}),pe&&n(pe,["mouseover","tapdragover"],T,{x:j[0],y:j[1]}),r.hoverData.last=pe),me)if(Ze){if(U.boxSelectionEnabled()&&Cr)me&&me.grabbed()&&(p(Ne),me.emit("freeon"),Ne.emit("free"),r.dragData.didDrag&&(me.emit("dragfreeon"),Ne.emit("dragfree"))),ht();else if(me&&me.grabbed()&&r.nodeIsDraggable(me)){var Tr=!r.dragData.didDrag;Tr&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||y(Ne,{inDragLayer:!0});var pr={x:0,y:0};if(te(xe[0])&&te(xe[1])&&(pr.x+=xe[0],pr.y+=xe[1],Tr)){var Sr=r.hoverData.dragDelta;Sr&&te(Sr[0])&&te(Sr[1])&&(pr.x+=Sr[0],pr.y+=Sr[1])}r.hoverData.draggingEles=!0,Ne.silentShift(pr).emit("position drag"),r.redrawHint("drag",!0),r.redraw()}}else 0===(Hr=r.hoverData.dragDelta=r.hoverData.dragDelta||[]).length?(Hr.push(xe[0]),Hr.push(xe[1])):(Hr[0]+=xe[0],Hr[1]+=xe[1]);W=!0}else if(Ze){if(r.hoverData.dragging||!U.boxSelectionEnabled()||!Cr&&U.panningEnabled()&&U.userPanningEnabled()){if(!r.hoverData.selecting&&U.panningEnabled()&&U.userPanningEnabled()){s(me,r.hoverData.downs)&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,Se[4]=0,r.data.bgActivePosistion=Ot(fe),r.redrawHint("select",!0),r.redraw())}}else ht();me&&me.pannable()&&me.active()&&me.unactivate()}if(Se[2]=j[0],Se[3]=j[1],W)return T.stopPropagation&&T.stopPropagation(),T.preventDefault&&T.preventDefault(),!1}},!1),r.registerBinding(e,"mouseup",function(T){if((1!==r.hoverData.which||1===T.which||!r.hoverData.capture)&&r.hoverData.capture){r.hoverData.capture=!1;var W=r.cy,U=r.projectIntoViewport(T.clientX,T.clientY),$=r.selection,ue=r.findNearestElement(U[0],U[1],!0,!1),j=r.dragData.possibleDragElements,fe=r.hoverData.down,Ee=i(T);if(r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,fe&&fe.unactivate(),3===r.hoverData.which){var Se={originalEvent:T,type:"cxttapend",position:{x:U[0],y:U[1]}};if(fe?fe.emit(Se):W.emit(Se),!r.hoverData.cxtDragged){var pe={originalEvent:T,type:"cxttap",position:{x:U[0],y:U[1]}};fe?fe.emit(pe):W.emit(pe)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(1===r.hoverData.which){if(n(ue,["mouseup","tapend","vmouseup"],T,{x:U[0],y:U[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(n(fe,["click","tap","vclick"],T,{x:U[0],y:U[1]}),B=!1,T.timeStamp-R<=W.multiClickDebounceTime()?(A&&clearTimeout(A),B=!0,R=null,n(fe,["dblclick","dbltap","vdblclick"],T,{x:U[0],y:U[1]})):(A=setTimeout(function(){B||n(fe,["oneclick","onetap","voneclick"],T,{x:U[0],y:U[1]})},W.multiClickDebounceTime()),R=T.timeStamp)),null==fe&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(T)&&(W.$(t).unselect(["tapunselect"]),j.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=j=W.collection()),ue==fe&&!r.dragData.didDrag&&!r.hoverData.selecting&&null!=ue&&ue._private.selectable&&(r.hoverData.dragging||("additive"===W.selectionType()||Ee?ue.selected()?ue.unselect(["tapunselect"]):ue.select(["tapselect"]):Ee||(W.$(t).unmerge(ue).unselect(["tapunselect"]),ue.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var Ce=W.collection(r.getAllInBox($[0],$[1],$[2],$[3]));r.redrawHint("select",!0),Ce.length>0&&r.redrawHint("eles",!0),W.emit({type:"boxend",originalEvent:T,position:{x:U[0],y:U[1]}});"additive"===W.selectionType()||Ee||W.$(t).unmerge(Ce).unselect(),Ce.emit("box").stdFilter(function(Ze){return Ze.selectable()&&!Ze.selected()}).select().emit("boxselect"),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!$[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var xe=fe&&fe.grabbed();p(j),xe&&(fe.emit("freeon"),j.emit("free"),r.dragData.didDrag&&(fe.emit("dragfreeon"),j.emit("dragfree")))}}$[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}},!1);var L,M=[],O=1e5,N=function(T){var _=!1,W=T.deltaY;if(null==W&&(null!=T.wheelDeltaY?W=T.wheelDeltaY/4:null!=T.wheelDelta&&(W=T.wheelDelta/4)),null==L)if(M.length>=4){var U=M;if(L=function(T,_){for(var W=0;W<T.length;W++)if(T[W]%_!=0)return!1;return!0}(U,5),!L){var $=Math.abs(U[0]);L=function(T){for(var _=Math.abs(T[0]),W=1;W<T.length;W++)if(Math.abs(T[W])!==_)return!1;return!0}(U)&&$>5}if(L)for(var ue=0;ue<U.length;ue++)O=Math.min(Math.abs(U[ue]),O)}else M.push(W),_=!0;else L&&(O=Math.min(Math.abs(W),O));if(!r.scrollingPage){var j=r.cy,fe=j.zoom(),Ee=j.pan(),Se=r.projectIntoViewport(T.clientX,T.clientY),pe=[Se[0]*fe+Ee.x,Se[1]*fe+Ee.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||0!==r.selection[4])return void T.preventDefault();if(j.panningEnabled()&&j.userPanningEnabled()&&j.zoomingEnabled()&&j.userZoomingEnabled()){var Ce;T.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150),_&&Math.abs(W)>5&&(W=5*wi(W)),Ce=W/-250,L&&(Ce/=O,Ce*=3),Ce*=r.wheelSensitivity,1===T.deltaMode&&(Ce*=33);var xe=j.zoom()*Math.pow(10,Ce);"gesturechange"===T.type&&(xe=r.gestureStartZoom*T.scale),j.zoom({level:xe,renderedPosition:{x:pe[0],y:pe[1]}}),j.emit("gesturechange"===T.type?"pinchzoom":"scrollzoom")}}};r.registerBinding(r.container,"wheel",N,!0),r.registerBinding(e,"scroll",function(T){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(T){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||T.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(Y){r.hasTouchStarted||N(Y)},!0),r.registerBinding(r.container,"mouseout",function(T){var _=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseout",position:{x:_[0],y:_[1]}})},!1),r.registerBinding(r.container,"mouseover",function(T){var _=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseover",position:{x:_[0],y:_[1]}})},!1);var F,K,X,Q,Z,re,ae,J,z,q,H,ee,ne,Ie,se,oe,ce,ge,de,ye,be=function(T,_,W,U){return Math.sqrt((W-T)*(W-T)+(U-_)*(U-_))},Ge=function(T,_,W,U){return(W-T)*(W-T)+(U-_)*(U-_)};if(r.registerBinding(r.container,"touchstart",Ie=function(T){if(r.hasTouchStarted=!0,P(T)){b(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var _=r.cy,W=r.touchData.now,U=r.touchData.earlier;if(T.touches[0]){var $=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);W[0]=$[0],W[1]=$[1]}if(T.touches[1]){$=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);W[2]=$[0],W[3]=$[1]}if(T.touches[2]){$=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);W[4]=$[0],W[5]=$[1]}if(T.touches[1]){r.touchData.singleTouchMoved=!0,p(r.dragData.touchDragEles);var ue=r.findContainerClientCoords();z=ue[0],q=ue[1],H=ue[2],ee=ue[3],F=T.touches[0].clientX-z,K=T.touches[0].clientY-q,X=T.touches[1].clientX-z,Q=T.touches[1].clientY-q,ne=0<=F&&F<=H&&0<=X&&X<=H&&0<=K&&K<=ee&&0<=Q&&Q<=ee;var j=_.pan(),fe=_.zoom();Z=be(F,K,X,Q),re=Ge(F,K,X,Q),J=[((ae=[(F+X)/2,(K+Q)/2])[0]-j.x)/fe,(ae[1]-j.y)/fe];if(re<4e4&&!T.touches[2]){var pe=r.findNearestElement(W[0],W[1],!0,!0),Ce=r.findNearestElement(W[2],W[3],!0,!0);return pe&&pe.isNode()?(pe.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:W[0],y:W[1]}}),r.touchData.start=pe):Ce&&Ce.isNode()?(Ce.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:W[0],y:W[1]}}),r.touchData.start=Ce):_.emit({originalEvent:T,type:"cxttapstart",position:{x:W[0],y:W[1]}}),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!0,r.touchData.cxtDragged=!1,r.data.bgActivePosistion=void 0,void r.redraw()}}if(T.touches[2])_.boxSelectionEnabled()&&T.preventDefault();else if(!T.touches[1]&&T.touches[0]){var me=r.findNearestElements(W[0],W[1],!0,!0),xe=me[0];if(null!=xe&&(xe.activate(),r.touchData.start=xe,r.touchData.starts=me,r.nodeIsGrabbable(xe))){var Ne=r.dragData.touchDragEles=_.collection(),Ze=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),xe.selected()?(Ze=_.$(function(tr){return tr.selected()&&r.nodeIsGrabbable(tr)}),y(Ze,{addToList:Ne})):g(xe,{addToList:Ne}),f(xe);var fr=function(Cr){return{originalEvent:T,type:Cr,position:{x:W[0],y:W[1]}}};xe.emit(fr("grabon")),Ze?Ze.forEach(function(tr){tr.emit(fr("grab"))}):xe.emit(fr("grab"))}n(xe,["touchstart","tapstart","vmousedown"],T,{x:W[0],y:W[1]}),null==xe&&(r.data.bgActivePosistion={x:$[0],y:$[1]},r.redrawHint("select",!0),r.redraw()),r.touchData.singleTouchMoved=!1,r.touchData.singleTouchStartTime=+new Date,clearTimeout(r.touchData.tapholdTimeout),r.touchData.tapholdTimeout=setTimeout(function(){!1===r.touchData.singleTouchMoved&&!r.pinching&&!r.touchData.selecting&&n(r.touchData.start,["taphold"],T,{x:W[0],y:W[1]})},r.tapholdDuration)}if(T.touches.length>=1){for(var sr=r.touchData.startPosition=[null,null,null,null,null,null],Ke=0;Ke<W.length;Ke++)sr[Ke]=U[Ke]=W[Ke];var cr=T.touches[0];r.touchData.startGPosition=[cr.clientX,cr.clientY]}}},!1),r.registerBinding(e,"touchmove",se=function(T){var _=r.touchData.capture;if(_||P(T)){var W=r.selection,U=r.cy,$=r.touchData.now,ue=r.touchData.earlier,j=U.zoom();if(T.touches[0]){var fe=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);$[0]=fe[0],$[1]=fe[1]}if(T.touches[1]){fe=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);$[2]=fe[0],$[3]=fe[1]}if(T.touches[2]){fe=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);$[4]=fe[0],$[5]=fe[1]}var Se,Ee=r.touchData.startGPosition;if(_&&T.touches[0]&&Ee){for(var pe=[],Ce=0;Ce<$.length;Ce++)pe[Ce]=$[Ce]-ue[Ce];var me=T.touches[0].clientX-Ee[0],xe=me*me,Ne=T.touches[0].clientY-Ee[1];Se=xe+Ne*Ne>=r.touchTapThreshold2}if(_&&r.touchData.cxt){T.preventDefault();var sr=T.touches[0].clientX-z,Ke=T.touches[0].clientY-q,cr=T.touches[1].clientX-z,tr=T.touches[1].clientY-q,Cr=Ge(sr,Ke,cr,tr);if(Cr/re>=2.25||Cr>=22500){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Rt={originalEvent:T,type:"cxttapend",position:{x:$[0],y:$[1]}};r.touchData.start?(r.touchData.start.unactivate().emit(Rt),r.touchData.start=null):U.emit(Rt)}}if(_&&r.touchData.cxt){Rt={originalEvent:T,type:"cxtdrag",position:{x:$[0],y:$[1]}};r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(Rt):U.emit(Rt),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var Tr=r.findNearestElement($[0],$[1],!0,!0);(!r.touchData.cxtOver||Tr!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:$[0],y:$[1]}}),r.touchData.cxtOver=Tr,Tr&&Tr.emit({originalEvent:T,type:"cxtdragover",position:{x:$[0],y:$[1]}}))}else if(_&&T.touches[2]&&U.boxSelectionEnabled())T.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||U.emit({originalEvent:T,type:"boxstart",position:{x:$[0],y:$[1]}}),r.touchData.selecting=!0,r.touchData.didSelect=!0,W[4]=1,W&&0!==W.length&&void 0!==W[0]?(W[2]=($[0]+$[2]+$[4])/3,W[3]=($[1]+$[3]+$[5])/3):(W[0]=($[0]+$[2]+$[4])/3,W[1]=($[1]+$[3]+$[5])/3,W[2]=($[0]+$[2]+$[4])/3+1,W[3]=($[1]+$[3]+$[5])/3+1),r.redrawHint("select",!0),r.redraw();else if(_&&T.touches[1]&&!r.touchData.didSelect&&U.zoomingEnabled()&&U.panningEnabled()&&U.userZoomingEnabled()&&U.userPanningEnabled()){if(T.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),pr=r.dragData.touchDragEles){r.redrawHint("drag",!0);for(var Sr=0;Sr<pr.length;Sr++){var $n=pr[Sr]._private;$n.grabbed=!1,$n.rscratch.inDragLayer=!1}}var Hr=r.touchData.start,Mf=(sr=T.touches[0].clientX-z,Ke=T.touches[0].clientY-q,cr=T.touches[1].clientX-z,tr=T.touches[1].clientY-q,be(sr,Ke,cr,tr)),vm=Mf/Z;if(ne){var gm=(sr-F+(cr-X))/2,pm=(Ke-K+(tr-Q))/2,qa=U.zoom(),go=qa*vm,Kn=U.pan(),Lf=J[0]*qa+Kn.x,If=J[1]*qa+Kn.y,ym={x:-go/qa*(Lf-Kn.x-gm)+Lf,y:-go/qa*(If-Kn.y-pm)+If};if(Hr&&Hr.active()){var pr=r.dragData.touchDragEles;p(pr),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Hr.unactivate().emit("freeon"),pr.emit("free"),r.dragData.didDrag&&(Hr.emit("dragfreeon"),pr.emit("dragfree"))}U.viewport({zoom:go,pan:ym,cancelOnFailedZoom:!0}),U.emit("pinchzoom"),Z=Mf,F=sr,K=Ke,X=cr,Q=tr,r.pinching=!0}if(T.touches[0]){fe=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);$[0]=fe[0],$[1]=fe[1]}if(T.touches[1]){fe=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);$[2]=fe[0],$[3]=fe[1]}if(T.touches[2]){fe=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);$[4]=fe[0],$[5]=fe[1]}}else if(T.touches[0]&&!r.touchData.didSelect){var Lr=r.touchData.start,po=r.touchData.last;if(!r.hoverData.draggingEles&&!r.swipePanning&&(Tr=r.findNearestElement($[0],$[1],!0,!0)),_&&null!=Lr&&T.preventDefault(),_&&null!=Lr&&r.nodeIsDraggable(Lr))if(Se){pr=r.dragData.touchDragEles;var Of=!r.dragData.didDrag;Of&&y(pr,{inDragLayer:!0}),r.dragData.didDrag=!0;var _a={x:0,y:0};if(te(pe[0])&&te(pe[1])&&(_a.x+=pe[0],_a.y+=pe[1],Of))r.redrawHint("eles",!0),(Ir=r.touchData.dragDelta)&&te(Ir[0])&&te(Ir[1])&&(_a.x+=Ir[0],_a.y+=Ir[1]);r.hoverData.draggingEles=!0,pr.silentShift(_a).emit("position drag"),r.redrawHint("drag",!0),r.touchData.startPosition[0]==ue[0]&&r.touchData.startPosition[1]==ue[1]&&r.redrawHint("eles",!0),r.redraw()}else{var Ir;0===(Ir=r.touchData.dragDelta=r.touchData.dragDelta||[]).length?(Ir.push(pe[0]),Ir.push(pe[1])):(Ir[0]+=pe[0],Ir[1]+=pe[1])}if(n(Lr||Tr,["touchmove","tapdrag","vmousemove"],T,{x:$[0],y:$[1]}),(!Lr||!Lr.grabbed())&&Tr!=po&&(po&&po.emit({originalEvent:T,type:"tapdragout",position:{x:$[0],y:$[1]}}),Tr&&Tr.emit({originalEvent:T,type:"tapdragover",position:{x:$[0],y:$[1]}})),r.touchData.last=Tr,_)for(Sr=0;Sr<$.length;Sr++)$[Sr]&&r.touchData.startPosition[Sr]&&Se&&(r.touchData.singleTouchMoved=!0);if(_&&(null==Lr||Lr.pannable())&&U.panningEnabled()&&U.userPanningEnabled()){s(Lr,r.touchData.starts)&&(T.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=Ot(r.touchData.startPosition)),r.swipePanning?(U.panBy({x:pe[0]*j,y:pe[1]*j}),U.emit("dragpan")):Se&&(r.swipePanning=!0,U.panBy({x:me*j,y:Ne*j}),U.emit("dragpan"),Lr&&(Lr.unactivate(),r.redrawHint("select",!0),r.touchData.start=null)));fe=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);$[0]=fe[0],$[1]=fe[1]}}for(Ce=0;Ce<$.length;Ce++)ue[Ce]=$[Ce];_&&T.touches.length>0&&!r.hoverData.draggingEles&&!r.swipePanning&&null!=r.data.bgActivePosistion&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1),r.registerBinding(e,"touchcancel",oe=function(T){var _=r.touchData.start;r.touchData.capture=!1,_&&_.unactivate()}),r.registerBinding(e,"touchend",ce=function(T){var _=r.touchData.start;if(r.touchData.capture){0===T.touches.length&&(r.touchData.capture=!1),T.preventDefault();var U=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var Se,$=r.cy,ue=$.zoom(),j=r.touchData.now,fe=r.touchData.earlier;if(T.touches[0]){var Ee=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);j[0]=Ee[0],j[1]=Ee[1]}if(T.touches[1]){Ee=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);j[2]=Ee[0],j[3]=Ee[1]}if(T.touches[2]){Ee=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);j[4]=Ee[0],j[5]=Ee[1]}if(_&&_.unactivate(),r.touchData.cxt){if(Se={originalEvent:T,type:"cxttapend",position:{x:j[0],y:j[1]}},_?_.emit(Se):$.emit(Se),!r.touchData.cxtDragged){var pe={originalEvent:T,type:"cxttap",position:{x:j[0],y:j[1]}};_?_.emit(pe):$.emit(pe)}return r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,void r.redraw()}if(!T.touches[2]&&$.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var Ce=$.collection(r.getAllInBox(U[0],U[1],U[2],U[3]));U[0]=void 0,U[1]=void 0,U[2]=void 0,U[3]=void 0,U[4]=0,r.redrawHint("select",!0),$.emit({type:"boxend",originalEvent:T,position:{x:j[0],y:j[1]}});Ce.emit("box").stdFilter(function(Qr){return Qr.selectable()&&!Qr.selected()}).select().emit("boxselect"),Ce.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(null!=_&&_.unactivate(),T.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!T.touches[1]&&!T.touches[0]&&!T.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var xe=r.dragData.touchDragEles;if(null!=_){var Ne=_._private.grabbed;p(xe),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Ne&&(_.emit("freeon"),xe.emit("free"),r.dragData.didDrag&&(_.emit("dragfreeon"),xe.emit("dragfree"))),n(_,["touchend","tapend","vmouseup","tapdragout"],T,{x:j[0],y:j[1]}),_.unactivate(),r.touchData.start=null}else{var Ze=r.findNearestElement(j[0],j[1],!0,!0);n(Ze,["touchend","tapend","vmouseup","tapdragout"],T,{x:j[0],y:j[1]})}var fr=r.touchData.startPosition[0]-j[0],sr=fr*fr,Ke=r.touchData.startPosition[1]-j[1],Cr=(sr+Ke*Ke)*ue*ue;r.touchData.singleTouchMoved||(_||$.$(":selected").unselect(["tapunselect"]),n(_,["tap","vclick"],T,{x:j[0],y:j[1]}),ge=!1,T.timeStamp-ye<=$.multiClickDebounceTime()?(de&&clearTimeout(de),ge=!0,ye=null,n(_,["dbltap","vdblclick"],T,{x:j[0],y:j[1]})):(de=setTimeout(function(){ge||n(_,["onetap","voneclick"],T,{x:j[0],y:j[1]})},$.multiClickDebounceTime()),ye=T.timeStamp)),null!=_&&!r.dragData.didDrag&&_._private.selectable&&Cr<r.touchTapThreshold2&&!r.pinching&&("single"===$.selectionType()?($.$(t).unmerge(_).unselect(["tapunselect"]),_.select(["tapselect"])):_.selected()?_.unselect(["tapunselect"]):_.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}for(var Gr=0;Gr<j.length;Gr++)fe[Gr]=j[Gr];r.dragData.didDrag=!1,0===T.touches.length&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),T.touches.length<2&&(1===T.touches.length&&(r.touchData.startGPosition=[T.touches[0].clientX,T.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())}},!1),typeof TouchEvent>"u"){var we=[],De=function(T){return{clientX:T.clientX,clientY:T.clientY,force:1,identifier:T.pointerId,pageX:T.pageX,pageY:T.pageY,radiusX:T.width/2,radiusY:T.height/2,screenX:T.screenX,screenY:T.screenY,target:T.target}},$e=function(T){we.push(function(T){return{event:T,touch:De(T)}}(T))},Re=function(T){for(var _=0;_<we.length;_++){if(we[_].event.pointerId===T.pointerId)return void we.splice(_,1)}},Pe=function(T){T.touches=we.map(function(_){return _.touch})},le=function(T){return"mouse"===T.pointerType||4===T.pointerType};r.registerBinding(r.container,"pointerdown",function(Y){le(Y)||(Y.preventDefault(),$e(Y),Pe(Y),Ie(Y))}),r.registerBinding(r.container,"pointerup",function(Y){le(Y)||(Re(Y),Pe(Y),ce(Y))}),r.registerBinding(r.container,"pointercancel",function(Y){le(Y)||(Re(Y),Pe(Y),oe())}),r.registerBinding(r.container,"pointermove",function(Y){var T,_;le(Y)||(Y.preventDefault(),T=Y,(_=we.filter(function(W){return W.event.pointerId===T.pointerId})[0]).event=T,_.touch=De(T),Pe(Y),se(Y))})}};var Xr={generatePolygon:function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,draw:function(a,n,i,s,o,l){this.renderer.nodeShapeImpl("polygon",a,n,i,s,o,this.points)},intersectLine:function(a,n,i,s,o,l,u,v){return ya(o,l,this.points,a,n,i/2,s/2,u)},checkPoint:function(a,n,i,s,o,l,u,v){return Kr(a,n,this.points,l,u,s,o,[0,-1],i)}}}};Xr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},intersectLine:function(e,t,a,n,i,s,o,l){return function(e,t,a,n,i,s){var o=a-e,l=n-t;o/=i,l/=s;var u=Math.sqrt(o*o+l*l),v=u-1;if(v<0)return[];var f=v/u;return[(a-e)*f+e,(n-t)*f+t]}(i,s,e,t,a/2+o,n/2+o)},checkPoint:function(e,t,a,n,i,s,o,l){return bt(e,t,n,i,s,o,a)}}},Xr.generateRoundPolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,getOrCreateCorners:function(a,n,i,s,o,l,u){if(void 0!==l[u]&&l[u+"-cx"]===a&&l[u+"-cy"]===n)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=a,l[u+"-cy"]=n;var v=i/2,f=s/2;o="auto"===o?lu(i,s):o;for(var c=new Array(e.length/2),h=0;h<e.length/2;h++)c[h]={x:a+v*e[2*h],y:n+f*e[2*h+1]};var d,y,g,p,m=c.length;for(y=c[m-1],d=0;d<m;d++)g=c[d%m],p=c[(d+1)%m],l[u][d]=Zs(y,g,p,o),y=g,g=p;return l[u]},draw:function(a,n,i,s,o,l,u){this.renderer.nodeShapeImpl("round-polygon",a,n,i,s,o,this.points,this.getOrCreateCorners(n,i,s,o,l,u,"drawCorners"))},intersectLine:function(a,n,i,s,o,l,u,v,f){return function(e,t,a,n,i,s,o,l,u){var f,v=[],c=new Array(2*a.length);u.forEach(function(m,b){0===b?(c[c.length-2]=m.startX,c[c.length-1]=m.startY):(c[4*b-2]=m.startX,c[4*b-1]=m.startY),c[4*b]=m.stopX,c[4*b+1]=m.stopY,0!==(f=pa(e,t,n,i,m.cx,m.cy,m.radius)).length&&v.push(f[0],f[1])});for(var h=0;h<c.length/4;h++)0!==(f=at(e,t,n,i,c[4*h],c[4*h+1],c[4*h+2],c[4*h+3],!1)).length&&v.push(f[0],f[1]);if(v.length>2){for(var d=[v[0],v[1]],y=Math.pow(d[0]-e,2)+Math.pow(d[1]-t,2),g=1;g<v.length/2;g++){var p=Math.pow(v[2*g]-e,2)+Math.pow(v[2*g+1]-t,2);p<=y&&(d[0]=v[2*g],d[1]=v[2*g+1],y=p)}return d}return v}(o,l,this.points,a,n,0,0,0,this.getOrCreateCorners(a,n,i,s,v,f,"corners"))},checkPoint:function(a,n,i,s,o,l,u,v,f){return function(e,t,a,n,i,s,o,l){for(var u=new Array(2*a.length),v=0;v<l.length;v++){var f=l[v];if(u[4*v+0]=f.startX,u[4*v+1]=f.startY,u[4*v+2]=f.stopX,u[4*v+3]=f.stopY,Math.pow(f.cx-e,2)+Math.pow(f.cy-t,2)<=Math.pow(f.radius,2))return!0}return Er(e,t,u)}(a,n,this.points,0,0,0,0,this.getOrCreateCorners(l,u,s,o,v,f,"corners"))}}},Xr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:yr(4,0),draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,s)},intersectLine:function(e,t,a,n,i,s,o,l){return ou(i,s,e,t,a,n,o,l)},checkPoint:function(e,t,a,n,i,s,o,l){var u=n/2,v=i/2;l="auto"===l?nt(n,i):l;var f=2*(l=Math.min(u,v,l));return!!(Kr(e,t,this.points,s,o,n,i-f,[0,-1],a)||Kr(e,t,this.points,s,o,n-f,i,[0,-1],a)||bt(e,t,f,f,s-u+l,o-v+l,a)||bt(e,t,f,f,s+u-l,o-v+l,a)||bt(e,t,f,f,s+u-l,o+v-l,a)||bt(e,t,f,f,s-u+l,o+v-l,a))}}},Xr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:8,points:yr(4,0),draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,null,s)},generateCutTrianglePts:function(e,t,a,n,i){var s="auto"===i?this.cornerLength:i,o=t/2,l=e/2,u=a-l,v=a+l,f=n-o,c=n+o;return{topLeft:[u,f+s,u+s,f,u+s,f+s],topRight:[v-s,f,v,f+s,v-s,f+s],bottomRight:[v,c-s,v-s,c,v-s,c-s],bottomLeft:[u+s,c,u,c-s,u+s,c-s]}},intersectLine:function(e,t,a,n,i,s,o,l){var u=this.generateCutTrianglePts(a+2*o,n+2*o,e,t,l),v=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return ya(i,s,v,e,t)},checkPoint:function(e,t,a,n,i,s,o,l){var u="auto"===l?this.cornerLength:l;if(Kr(e,t,this.points,s,o,n,i-2*u,[0,-1],a)||Kr(e,t,this.points,s,o,n-2*u,i,[0,-1],a))return!0;var v=this.generateCutTrianglePts(n,i,s,o);return Er(e,t,v.topLeft)||Er(e,t,v.topRight)||Er(e,t,v.bottomRight)||Er(e,t,v.bottomLeft)}}},Xr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:yr(4,0),draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},intersectLine:function(e,t,a,n,i,s,o,l){var c=this.generateBarrelBezierPts(a+2*o,n+2*o,e,t),h=function(g){var p=Nt({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},.15),m=Nt({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},.5),b=Nt({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},.85);return[g[0],g[1],p.x,p.y,m.x,m.y,b.x,b.y,g[4],g[5]]},d=[].concat(h(c.topLeft),h(c.topRight),h(c.bottomRight),h(c.bottomLeft));return ya(i,s,d,e,t)},generateBarrelBezierPts:function(e,t,a,n){var i=t/2,s=e/2,o=a-s,l=a+s,u=n-i,v=n+i,f=Si(e,t),c=f.heightOffset,h=f.widthOffset,d=f.ctrlPtOffsetPct*e,y={topLeft:[o,u+c,o+d,u,o+h,u],topRight:[l-h,u,l-d,u,l,u+c],bottomRight:[l,v-c,l-d,v,l-h,v],bottomLeft:[o+h,v,o+d,v,o,v-c]};return y.topLeft.isTop=!0,y.topRight.isTop=!0,y.bottomLeft.isBottom=!0,y.bottomRight.isBottom=!0,y},checkPoint:function(e,t,a,n,i,s,o,l){var u=Si(n,i),v=u.heightOffset,f=u.widthOffset;if(Kr(e,t,this.points,s,o,n,i-2*v,[0,-1],a)||Kr(e,t,this.points,s,o,n-2*f,i,[0,-1],a))return!0;for(var c=this.generateBarrelBezierPts(n,i,s,o),h=function(k,S,P){var D=P[4],A=P[2],B=P[0],R=P[5],M=P[1],I=Math.min(D,B),L=Math.max(D,B),O=Math.min(R,M),V=Math.max(R,M);if(I<=k&&k<=L&&O<=S&&S<=V){var G=function(e,t,a){return[e-2*t+a,2*(t-e),e]}(D,A,B),N=function(e,t,a,n){var i=t*t-4*e*(a-=n);if(i<0)return[];var s=Math.sqrt(i),o=2*e;return[(-t+s)/o,(-t-s)/o]}(G[0],G[1],G[2],k),F=N.filter(function(K){return 0<=K&&K<=1});if(F.length>0)return F[0]}return null},d=Object.keys(c),y=0;y<d.length;y++){var p=c[d[y]],m=h(e,t,p);if(null!=m){var b=p[5],w=p[3],E=p[1],C=ar(b,w,E,m);if(p.isTop&&C<=t||p.isBottom&&t<=C)return!0}}return!1}}},Xr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:yr(4,0),draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,s)},intersectLine:function(e,t,a,n,i,s,o,l){var v=t-(n/2+o),h=at(i,s,e,t,e-(a/2+o),v,e+(a/2+o),v,!1);return h.length>0?h:ou(i,s,e,t,a,n,o,l)},checkPoint:function(e,t,a,n,i,s,o,l){var u=2*(l="auto"===l?nt(n,i):l);if(Kr(e,t,this.points,s,o,n,i-u,[0,-1],a)||Kr(e,t,this.points,s,o,n-u,i,[0,-1],a))return!0;var v=n/2+2*a,f=i/2+2*a;return!!(Er(e,t,[s-v,o-f,s-v,o,s+v,o,s+v,o-f])||bt(e,t,u,u,s+n/2-l,o+i/2-l,a)||bt(e,t,u,u,s-n/2+l,o+i/2-l,a))}}},Xr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",yr(3,0)),this.generateRoundPolygon("round-triangle",yr(3,0)),this.generatePolygon("rectangle",yr(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t),this.generatePolygon("pentagon",yr(5,0)),this.generateRoundPolygon("round-pentagon",yr(5,0)),this.generatePolygon("hexagon",yr(6,0)),this.generateRoundPolygon("round-hexagon",yr(6,0)),this.generatePolygon("heptagon",yr(7,0)),this.generateRoundPolygon("round-heptagon",yr(7,0)),this.generatePolygon("octagon",yr(8,0)),this.generateRoundPolygon("round-octagon",yr(8,0));var a=new Array(20),n=Ci(5,0),i=Ci(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<i.length/2;o++)i[2*o]*=s,i[2*o+1]*=s;for(o=0;o<5;o++)a[4*o]=n[2*o],a[4*o+1]=n[2*o+1],a[4*o+2]=i[2*o],a[4*o+3]=i[2*o+1];a=uu(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),r.makePolygon=function(u){var c,f="polygon-"+u.join("$");return(c=this[f])?c:e.generatePolygon(f,u)}};var Ma={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(r){r=r||eu();var e=this;void 0===e.averageRedrawTime&&(e.averageRedrawTime=0),void 0===e.lastRedrawTime&&(e.lastRedrawTime=0),void 0===e.lastDrawTime&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=r},beforeRender:function(r,e){if(!this.destroyed){null==e&&We("Priority is not optional for beforeRender");var t=this.beforeRenderCallbacks;t.push({fn:r,priority:e}),t.sort(function(a,n){return n.priority-a.priority})}}},Yv=function(e,t,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(t,a)};Ma.startRenderLoop=function(){var r=this,e=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var t=function(n){if(!r.destroyed){if(!e.batching())if(r.requestedFrame&&!r.skipFrame){Yv(r,!0,n);var i=Wr();r.render(r.renderOptions);var s=r.lastDrawTime=Wr();void 0===r.averageRedrawTime&&(r.averageRedrawTime=s-i),void 0===r.redrawCount&&(r.redrawCount=0),r.redrawCount++,void 0===r.redrawTotalTime&&(r.redrawTotalTime=0);var o=s-i;r.redrawTotalTime+=o,r.lastRedrawTime=o,r.averageRedrawTime=r.averageRedrawTime/2+o/2,r.requestedFrame=!1}else Yv(r,!1,n);r.skipFrame=!1,Ka(t)}};Ka(t)}};var Xv=function(e){this.init(e)},jt=Xv.prototype;jt.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],jt.init=function(r){var e=this;e.options=r,e.cy=r.cy;var t=e.container=r.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",l=null!=n.getElementById(s);if(t.className.indexOf(o)<0&&(t.className=(t.className||"")+" "+o),!l){var u=n.createElement("style");u.id=s,u.textContent="."+o+" { position: relative; }",i.insertBefore(u,i.children[0])}"static"===a.getComputedStyle(t).getPropertyValue("position")&&Me("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=r.showFps,e.debug=r.debug,e.webgl=r.webgl,e.hideEdgesOnViewport=r.hideEdgesOnViewport,e.textureOnViewport=r.textureOnViewport,e.wheelSensitivity=r.wheelSensitivity,e.motionBlurEnabled=r.motionBlur,e.forcedPixelRatio=te(r.pixelRatio)?r.pixelRatio:null,e.motionBlur=r.motionBlur,e.motionBlurOpacity=r.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=r.desktopTapThreshold,e.desktopTapThreshold2=r.desktopTapThreshold*r.desktopTapThreshold,e.touchTapThreshold=r.touchTapThreshold,e.touchTapThreshold2=r.touchTapThreshold*r.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()},jt.notify=function(r,e){var t=this,a=t.cy;if(!this.destroyed){if("init"===r)return void t.load();if("destroy"===r)return void t.destroy();("add"===r||"remove"===r||"move"===r&&a.hasCompoundNodes()||"load"===r||"zorder"===r||"mount"===r)&&t.invalidateCachedZSortedEles(),"viewport"===r&&t.redrawHint("select",!0),"gc"===r&&t.redrawHint("gc",!0),("load"===r||"resize"===r||"mount"===r)&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container)),t.redrawHint("eles",!0),t.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},jt.destroy=function(){var r=this;r.destroyed=!0,r.cy.stopAnimationLoop();for(var e=0;e<r.bindings.length;e++){var a=r.bindings[e],n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(r.bindings=[],r.beforeRenderCallbacks=[],r.onUpdateEleCalcsFns=[],r.removeObserver&&r.removeObserver.disconnect(),r.styleObserver&&r.styleObserver.disconnect(),r.resizeObserver&&r.resizeObserver.disconnect(),r.labelCalcDiv)try{document.body.removeChild(r.labelCalcDiv)}catch{}},jt.isHeadless=function(){return!1},[Us,$v,Kv,Jt,Xr,Ma].forEach(function(r){he(jt,r)});var Js=1e3/60,Zv_setupDequeueing=function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=va(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),o=e.priority||gi;n.beforeRender(function(u,v){var f=Wr(),c=n.averageRedrawTime,h=n.lastRedrawTime,d=[],y=n.cy.extent(),g=n.getPixelRatio();for(u||n.flushRenderedStyleQueue();;){var p=Wr(),m=p-f,b=p-v;if(h<Js){var w=Js-(u?c:0);if(b>=e.deqFastCost*w)break}else if(u){if(m>=e.deqCost*h||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*Js)break;var E=e.deq(a,g,y);if(!(E.length>0))break;for(var C=0;C<E.length;C++)d.push(E[C])}d.length>0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,g,y)&&i())},o(a))}}},Vp=function(){return jr(function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xa;Jr(this,r),this.idsByKey=new $r,this.keyForId=new $r,this.cachesByLvl=new $r,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t},[{key:"getIdsFor",value:function(t){null==t&&We("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new It,a.set(t,n)),n}},{key:"addIdForKey",value:function(t,a){null!=t&&this.getIdsFor(t).add(a)}},{key:"deleteIdForKey",value:function(t,a){null!=t&&this.getIdsFor(t).delete(a)}},{key:"getNumberOfIdsForKey",value:function(t){return null==t?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(t){var a=t.id();return this.keyForId.get(a)!==this.getKey(t)}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new $r,a.set(t,i),n.push(t)),i}},{key:"getCache",value:function(t,a){return this.getCachesAt(a).get(t)}},{key:"get",value:function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return null!=i&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,a){var n=this.keyForId.get(t.id());return this.getCache(n,a)}},{key:"hasCache",value:function(t,a){return this.getCachesAt(a).has(t)}},{key:"has",value:function(t,a){var n=this.getKey(t);return this.hasCache(n,a)}},{key:"setCache",value:function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)}},{key:"set",value:function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,a){this.getCachesAt(a).delete(t)}},{key:"delete",value:function(t,a){var n=this.getKey(t);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})}},{key:"invalidate",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||0===this.getNumberOfIdsForKey(n)}}])}(),ea={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},jp=or({getKey:null,doesEleInvalidateKey:Xa,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Zo,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),La=function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=jp(t);he(a,n),a.lookup=new Vp(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},rr=La.prototype;rr.reasons=ea,rr.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]},rr.getRetiredTextureQueue=function(r){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[r]=t[r]||[]},rr.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new ha(function(t,a){return a.reqs-t.reqs})},rr.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},rr.getElement=function(r,e,t,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||0===e.w||0===e.h||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(null==a&&(a=Math.ceil(bi(o*t))),a<-4)a=-4;else if(o>=7.99||a>3)return null;var u=Math.pow(2,a),v=e.h*u,f=e.w*u,c=s.eleTextBiggerThanMin(r,u);if(!this.isVisible(r,c))return null;var d,h=l.get(r,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;if(d=v<=25?25:v<=50?50:50*Math.ceil(v/50),v>1024||f>1024)return null;var y=i.getTextureQueue(d),g=y[y.length-2],p=function(){return i.recycleTexture(d,f)||i.addTexture(d,f)};g||(g=y[y.length-1]),g||(g=p()),g.width-g.usedWidth<f&&(g=p());for(var C,m=function(I){return I&&I.scaledLabelShown===c},b=n&&n===ea.dequeue,w=n&&n===ea.highQuality,E=n&&n===ea.downscale,x=a+1;x<=3;x++){var k=l.get(r,x);if(k){C=k;break}}var S=C&&C.level===a+1?C:null,P=function(){g.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,g.usedWidth,0,f,v)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,f,d),m(S))P();else if(m(C)){if(!w)return i.queueElement(r,C.level-1),C;for(var D=C.level;D>a;D--)S=i.getElement(r,e,t,D,ea.downscale);P()}else{var A;if(!b&&!w&&!E)for(var B=a-1;B>=-4;B--){var R=l.get(r,B);if(R){A=R;break}}if(m(A))return i.queueElement(r,a),A;g.context.translate(g.usedWidth,0),g.context.scale(u,u),this.drawElement(g.context,r,e,c,!1),g.context.scale(1/u,1/u),g.context.translate(-g.usedWidth,0)}return h={x:g.usedWidth,texture:g,level:a,scale:u,width:f,height:v,scaledLabelShown:c},g.usedWidth+=Math.ceil(f+8),g.eleCaches.push(h),l.set(r,a,h),i.checkTextureFullness(g),h},rr.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])},rr.invalidateElement=function(r){var e=this,t=e.lookup,a=[];if(t.isInvalid(r)){for(var i=-4;i<=3;i++){var s=t.getForCachedKey(r,i);s&&a.push(s)}if(t.invalidate(r))for(var l=0;l<a.length;l++){var u=a[l],v=u.texture;v.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(v)}e.removeFromQueue(r)}},rr.checkTextureUtility=function(r){r.invalidatedWidth>=.2*r.width&&this.retireTexture(r)},rr.checkTextureFullness=function(r){var t=this.getTextureQueue(r.height);r.usedWidth/r.width>.8&&r.fullnessChecks>=10?tt(t,r):r.fullnessChecks++},rr.retireTexture=function(r){var t=r.height,a=this.getTextureQueue(t),n=this.lookup;tt(a,r),r.retired=!0;for(var i=r.eleCaches,s=0;s<i.length;s++){var o=i[s];n.deleteCache(o.key,o.level)}pi(i),this.getRetiredTextureQueue(t).push(r)},rr.addTexture=function(r,e){var n={};return this.getTextureQueue(r).push(n),n.eleCaches=[],n.height=r,n.width=Math.max(1024,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=this.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},rr.recycleTexture=function(r,e){for(var a=this.getTextureQueue(r),n=this.getRetiredTextureQueue(r),i=0;i<n.length;i++){var s=n[i];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,pi(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),tt(n,s),a.push(s),s}},rr.queueElement=function(r,e){var a=this.getElementQueue(),n=this.getElementKeyToQueue(),i=this.getKey(r),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(r),s.reqs++,a.updateItem(s);else{var o={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(o),n[i]=o}},rr.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s<1&&t.size()>0;s++){var o=t.pop(),l=o.key,u=o.eles[0],v=i.hasCache(u,o.level);if(a[l]=null,!v){n.push(o);var f=e.getBoundingBox(u);e.getElement(u,f,r,o.level,ea.dequeue)}}return n},rr.removeFromQueue=function(r){var t=this.getElementQueue(),a=this.getElementKeyToQueue(),n=this.getKey(r),i=a[n];null!=i&&(1===i.eles.length?(i.reqs=hi,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))},rr.onDequeue=function(r){this.onDequeues.push(r)},rr.offDequeue=function(r){tt(this.onDequeues,r)},rr.setupDequeueing=Zv_setupDequeueing({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,a){return e.dequeue(t,a)},onDeqd:function(e,t){for(var a=0;a<e.onDequeues.length;a++){(0,e.onDequeues[a])(t)}},shouldRedraw:function(e,t,a,n){for(var i=0;i<t.length;i++)for(var s=t[i].eles,o=0;o<s.length;o++){var l=s[o].boundingBox();if(xi(l,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var rf=function(e){var t=this,a=t.renderer=e,n=a.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Wr()-500,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=va(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),a.beforeRender(function(s,o){o-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);t.layersQueue=new ha(function(o,l){return l.reqs-o.reqs}),t.setupDequeueing()},vr=rf.prototype,tf=0,fy=Math.pow(2,53)-1;vr.makeLayer=function(r,e){var t=Math.pow(2,e),a=Math.ceil(r.w*t),n=Math.ceil(r.h*t),i=this.renderer.makeOffscreenCanvas(a,n),s={id:tf=++tf%fy,bb:r,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,l=-s.bb.x1,u=-s.bb.y1;return o.scale(t,t),o.translate(l,u),s},vr.getLayers=function(r,e,t){var a=this,s=a.renderer.cy.zoom(),o=a.firstGet;if(a.firstGet=!1,null==t)if((t=Math.ceil(bi(s*e)))<-4)t=-4;else if(s>=3.99||t>2)return null;a.validateLayersElesOrdering(t,r);var f,h,l=a.layersByLevel,u=Math.pow(2,t),v=l[t]=l[t]||[];if(a.levelIsComplete(t,r))return v;!function(){var P=function(M){if(a.validateLayersElesOrdering(M,r),a.levelIsComplete(M,r))return h=l[M],!0},D=function(M){if(!h)for(var I=t+M;-4<=I&&I<=2&&!P(I);I+=M);};D(1),D(-1);for(var A=v.length-1;A>=0;A--){var B=v[A];B.invalid&&tt(v,B)}}();var g=function(P){var D=(P=P||{}).after;!function(){if(!f){f=xr();for(var P=0;P<r.length;P++)iu(f,r[P].boundingBox())}}();var A=Math.ceil(f.w*u),B=Math.ceil(f.h*u);if(A>32767||B>32767)return null;if(A*B>16e6)return null;var M=a.makeLayer(f,t);if(null!=D){var I=v.indexOf(D)+1;v.splice(I,0,M)}else(void 0===P.insert||P.insert)&&v.unshift(M);return M};if(a.skipping&&!o)return null;for(var p=null,m=r.length/1,b=!o,w=0;w<r.length;w++){var E=r[w],C=E._private.rscratch,x=C.imgLayerCaches=C.imgLayerCaches||{},k=x[t];if(k)p=k;else{if((!p||p.eles.length>=m||!fd(p.bb,E.boundingBox()))&&!(p=g({insert:!0,after:p})))return null;h||b?a.queueLayer(p,E):a.drawEleInLayer(p,E,t,e),p.eles.push(E),x[t]=p}}return h||(b?null:v)},vr.getEleLevelForLayerLevel=function(r,e){return r},vr.drawEleInLayer=function(r,e,t,a){var i=this.renderer,s=r.context,o=e.boundingBox();0===o.w||0===o.h||!e.visible()||(t=this.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,t,true),i.setImgSmoothing(s,!0))},vr.levelIsComplete=function(r,e){var a=this.layersByLevel[r];if(!a||0===a.length)return!1;for(var n=0,i=0;i<a.length;i++){var s=a[i];if(s.reqs>0||s.invalid)return!1;n+=s.eles.length}return n===e.length},vr.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a<t.length;a++){for(var n=t[a],i=-1,s=0;s<e.length;s++)if(n.eles[0]===e[s]){i=s;break}if(i<0)this.invalidateLayer(n);else{var o=i;for(s=0;s<n.eles.length;s++)if(n.eles[s]!==e[o+s]){this.invalidateLayer(n);break}}}},vr.updateElementsInLayers=function(r,e){for(var a=sa(r[0]),n=0;n<r.length;n++)for(var i=a?null:r[n],s=a?r[n]:r[n].ele,o=s._private.rscratch,l=o.imgLayerCaches=o.imgLayerCaches||{},u=-4;u<=2;u++){var v=l[u];!v||i&&this.getEleLevelForLayerLevel(v.level)!==i.level||e(v,s,i)}},vr.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var a=this.layersByLevel[t];if(a&&a.length>0){e=!0;break}}return e},vr.invalidateElements=function(r){var e=this;0!==r.length&&(e.lastInvalidationTime=Wr(),0!==r.length&&e.haveLayers()&&e.updateElementsInLayers(r,function(a,n,i){e.invalidateLayer(a)}))},vr.invalidateLayer=function(r){if(this.lastInvalidationTime=Wr(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];tt(a,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var n=0;n<t.length;n++){var i=t[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}},vr.refineElementTextures=function(r){var e=this;e.updateElementsInLayers(r,function(a,n,i){var s=a.replacement;if(s||((s=a.replacement=e.makeLayer(a.bb,a.level)).replaces=a,s.eles=a.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])})},vr.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()},vr.queueLayer=function(r,e){var a=this.layersQueue,n=r.elesQueue,i=n.hasId=n.hasId||{};if(!r.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}r.reqs?(r.reqs++,a.updateItem(r)):(r.reqs=1,a.push(r))}},vr.dequeue=function(r){for(var e=this,t=e.layersQueue,a=[],n=0;n<1&&0!==t.size();){var i=t.peek();if(i.replacement)t.pop();else if(i.replaces&&i!==i.replaces.replacement)t.pop();else if(i.invalid)t.pop();else{var s=i.elesQueue.shift();s&&(e.drawEleInLayer(i,s,i.level,r),n++),0===a.length&&a.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}}return a},vr.applyLayerReplacement=function(r){var t=this.layersByLevel[r.level],a=r.replaces,n=t.indexOf(a);if(!(n<0||a.invalid)){t[n]=r;for(var i=0;i<r.eles.length;i++){var s=r.eles[i]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[r.level]=r)}this.requestRedraw()}},vr.requestRedraw=va(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100),vr.setupDequeueing=Zv_setupDequeueing({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:gi,shouldRedraw:Zo,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var nf,af={};function cy(r,e){for(var t=0;t<e.length;t++){var a=e[t];r.lineTo(a.x,a.y)}}function dy(r,e,t){for(var a,n=0;n<e.length;n++){var i=e[n];0===n&&(a=i),r.lineTo(i.x,i.y)}r.quadraticCurveTo(t.x,t.y,a.x,a.y)}function sf(r,e,t){r.beginPath&&r.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];r.lineTo(i.x,i.y)}var s=t,o=t[0];r.moveTo(o.x,o.y);for(n=1;n<s.length;n++){i=s[n];r.lineTo(i.x,i.y)}r.closePath&&r.closePath()}function hy(r,e,t,a,n){r.beginPath&&r.beginPath(),r.arc(t,a,n,0,2*Math.PI,!1);var i=e,s=i[0];r.moveTo(s.x,s.y);for(var o=0;o<i.length;o++){var l=i[o];r.lineTo(l.x,l.y)}r.closePath&&r.closePath()}function gy(r,e,t,a){r.arc(e,t,a,0,2*Math.PI,!1)}af.arrowShapeImpl=function(r){return(nf||(nf={polygon:cy,"triangle-backcurve":dy,"triangle-tee":sf,"circle-triangle":hy,"triangle-cross":sf,circle:gy}))[r]};var qr={drawElement:function(r,e,t,a,n,i){e.isNode()?this.drawNode(r,e,t,a,n,i):this.drawEdge(r,e,t,a,n,i)},drawElementOverlay:function(r,e){e.isNode()?this.drawNodeOverlay(r,e):this.drawEdgeOverlay(r,e)},drawElementUnderlay:function(r,e){e.isNode()?this.drawNodeUnderlay(r,e):this.drawEdgeUnderlay(r,e)},drawCachedElementPortion:function(r,e,t,a,n,i,s,o){var l=this,u=t.getBoundingBox(e);if(0!==u.w&&0!==u.h){var v=t.getElement(e,u,a,n,i);if(null!=v){var f=o(l,e);if(0===f)return;var p,m,b,w,E,k,c=s(l,e),h=u.x1,d=u.y1,y=u.w,g=u.h;if(0!==c){var C=t.getRotationPoint(e);b=C.x,w=C.y,r.translate(b,w),r.rotate(c),(E=l.getImgSmoothing(r))||l.setImgSmoothing(r,!0);var x=t.getRotationOffset(e);p=x.x,m=x.y}else p=h,m=d;1!==f&&(k=r.globalAlpha,r.globalAlpha=k*f),r.drawImage(v.texture.canvas,v.x,0,v.width,v.height,p,m,y,g),1!==f&&(r.globalAlpha=k),0!==c&&(r.rotate(-c),r.translate(-b,-w),E||l.setImgSmoothing(r,!1))}else t.drawElement(r,e)}}},py=function(){return 0},yy=function(e,t){return e.getTextAngle(t,null)},my=function(e,t){return e.getTextAngle(t,"source")},by=function(e,t){return e.getTextAngle(t,"target")},wy=function(e,t){return t.effectiveOpacity()},eo=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};qr.drawCachedElement=function(r,e,t,a,n,i){var s=this,o=s.data,l=o.eleTxrCache,u=o.lblTxrCache,v=o.slbTxrCache,f=o.tlbTxrCache,c=e.boundingBox(),h=!0===i?l.reasons.highQuality:null;if(0!==c.w&&0!==c.h&&e.visible()&&(!a||xi(c,a))){var d=e.isEdge(),y=e.element()._private.rscratch.badLine;s.drawElementUnderlay(r,e),s.drawCachedElementPortion(r,e,l,t,n,h,py,wy),(!d||!y)&&s.drawCachedElementPortion(r,e,u,t,n,h,yy,eo),d&&!y&&(s.drawCachedElementPortion(r,e,v,t,n,h,my,eo),s.drawCachedElementPortion(r,e,f,t,n,h,by,eo)),s.drawElementOverlay(r,e)}},qr.drawElements=function(r,e){for(var a=0;a<e.length;a++){var n=e[a];this.drawElement(r,n)}},qr.drawCachedElements=function(r,e,t,a){for(var i=0;i<e.length;i++){var s=e[i];this.drawCachedElement(r,s,t,a)}},qr.drawCachedNodes=function(r,e,t,a){for(var i=0;i<e.length;i++){var s=e[i];!s.isNode()||this.drawCachedElement(r,s,t,a)}},qr.drawLayeredElements=function(r,e,t,a){var i=this.data.lyrTxrCache.getLayers(e,t);if(i)for(var s=0;s<i.length;s++){var o=i[s],l=o.bb;0===l.w||0===l.h||r.drawImage(o.canvas,l.x1,l.y1,l.w,l.h)}else this.drawCachedElements(r,e,t,a)};var Zr={drawEdge:function(r,e,t){var a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=this,o=e._private.rscratch;if((!i||e.visible())&&!o.badLine&&null!=o.allpts&&!isNaN(o.allpts[0])){var l;t&&(l=t,r.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,v=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,p=u*v,m=u*v,b=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;"straight-triangle"===f?(s.eleStrokeStyle(r,e,M),s.drawEdgeTrianglePath(e,r,o.allpts)):(r.lineWidth=h,r.lineCap=d,s.eleStrokeStyle(r,e,M),s.drawEdgePath(e,r,o.allpts,c),r.lineCap="butt")},w=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;r.lineWidth=h+y,r.lineCap=d,y>0?(s.colorStrokeStyle(r,g[0],g[1],g[2],M),"straight-triangle"===f?s.drawEdgeTrianglePath(e,r,o.allpts):(s.drawEdgePath(e,r,o.allpts,c),r.lineCap="butt")):r.lineCap="butt"},E=function(){!n||s.drawEdgeOverlay(r,e)},C=function(){!n||s.drawEdgeUnderlay(r,e)},x=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;s.drawArrowheads(r,e,M)},k=function(){s.drawElementText(r,e,null,a)};r.lineJoin="round";var S="yes"===e.pstyle("ghost").value;if(S){var P=e.pstyle("ghost-offset-x").pfValue,D=e.pstyle("ghost-offset-y").pfValue,A=e.pstyle("ghost-opacity").value,B=p*A;r.translate(P,D),b(B),x(B),r.translate(-P,-D)}else w();C(),b(),x(),E(),k(),t&&r.translate(l.x1,l.y1)}}},of=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(0!==n){var i=this,s=i.usePaths(),o=a._private.rscratch,u=2*a.pstyle("".concat(e,"-padding")).pfValue,v=a.pstyle("".concat(e,"-color")).value;t.lineWidth=u,"self"!==o.edgeType||s?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,v[0],v[1],v[2],n),i.drawEdgePath(a,t,o.allpts,"solid")}}}};Zr.drawEdgeOverlay=of("overlay"),Zr.drawEdgeUnderlay=of("underlay"),Zr.drawEdgePath=function(r,e,t,a){var s,n=r._private.rscratch,i=e,o=!1,l=this.usePaths(),u=r.pstyle("line-dash-pattern").pfValue,v=r.pstyle("line-dash-offset").pfValue;if(l){var f=t.join("$");n.pathCacheKey&&n.pathCacheKey===f?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=f,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=v;break;case"solid":i.setLineDash([])}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<t.length;h+=4)e.quadraticCurveTo(t[h],t[h+1],t[h+2],t[h+3]);break;case"straight":case"haystack":for(var d=2;d+1<t.length;d+=2)e.lineTo(t[d],t[d+1]);break;case"segments":if(n.isRound){var g,y=br(n.roundCorners);try{for(y.s();!(g=y.n()).done;){Vv(e,g.value)}}catch(b){y.e(b)}finally{y.f()}e.lineTo(t[t.length-2],t[t.length-1])}else for(var m=2;m+1<t.length;m+=2)e.lineTo(t[m],t[m+1])}e=i,l?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])},Zr.drawEdgeTrianglePath=function(r,e,t){e.fillStyle=e.strokeStyle;for(var a=r.pstyle("width").pfValue,n=0;n+1<t.length;n+=2){var i=[t[n+2]-t[n],t[n+3]-t[n+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/s,-i[0]/s],l=[o[0]*a/2,o[1]*a/2];e.beginPath(),e.moveTo(t[n]-l[0],t[n+1]-l[1]),e.lineTo(t[n]+l[0],t[n+1]+l[1]),e.lineTo(t[n+2],t[n+3]),e.closePath(),e.fill()}},Zr.drawArrowheads=function(r,e,t){var a=e._private.rscratch,n="haystack"===a.edgeType;n||this.drawArrowhead(r,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,t),this.drawArrowhead(r,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,t),this.drawArrowhead(r,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,t),n||this.drawArrowhead(r,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,t)},Zr.drawArrowhead=function(r,e,t,a,n,i,s){if(!(isNaN(a)||null==a||isNaN(n)||null==n||isNaN(i)||null==i)){var o=this,l=e.pstyle(t+"-arrow-shape").value;if("none"!==l){var u="hollow"===e.pstyle(t+"-arrow-fill").value?"both":"filled",v=e.pstyle(t+"-arrow-fill").value,f=e.pstyle("width").pfValue,c=e.pstyle(t+"-arrow-width"),h="match-line"===c.value?f:c.pfValue;"%"===c.units&&(h*=f);var d=e.pstyle("opacity").value;void 0===s&&(s=d);var y=r.globalCompositeOperation;(1!==s||"hollow"===v)&&(r.globalCompositeOperation="destination-out",o.colorFillStyle(r,255,255,255,1),o.colorStrokeStyle(r,255,255,255,1),o.drawArrowShape(e,r,u,f,l,h,a,n,i),r.globalCompositeOperation=y);var g=e.pstyle(t+"-arrow-color").value;o.colorFillStyle(r,g[0],g[1],g[2],s),o.colorStrokeStyle(r,g[0],g[1],g[2],s),o.drawArrowShape(e,r,v,f,l,h,a,n,i)}}},Zr.drawArrowShape=function(r,e,t,a,n,i,s,o,l){var c,u=this,v=this.usePaths()&&"triangle-cross"!==n,f=!1,h=e,d={x:s,y:o},y=r.pstyle("arrow-scale").value,g=this.getArrowWidth(a,y),p=u.arrowShapes[n];if(v){var m=u.arrowPathCache=u.arrowPathCache||[],b=pt(n),w=m[b];null!=w?(c=e=w,f=!0):(c=e=new Path2D,m[b]=c)}f||(e.beginPath&&e.beginPath(),v?p.draw(e,1,0,{x:0,y:0},1):p.draw(e,g,l,d,a),e.closePath&&e.closePath()),e=h,v&&(e.translate(s,o),e.rotate(l),e.scale(g,g)),("filled"===t||"both"===t)&&(v?e.fill(c):e.fill()),("hollow"===t||"both"===t)&&(e.lineWidth=i/(v?g:1),e.lineJoin="miter",v?e.stroke(c):e.stroke()),v&&(e.scale(1/g,1/g),e.rotate(-l),e.translate(-s,-o))};var ro={safeDrawImage:function(r,e,t,a,n,i,s,o,l,u){if(!(n<=0||i<=0||l<=0||u<=0))try{r.drawImage(e,t,a,n,i,s,o,l,u)}catch(v){Me(v)}},drawInscribedImage:function(r,e,t,a,n){var i=this,s=t.position(),o=s.x,l=s.y,u=t.cy().style(),v=u.getIndexedStyle.bind(u),f=v(t,"background-fit","value",a),c=v(t,"background-repeat","value",a),h=t.width(),d=t.height(),y=2*t.padding(),g=h+("inner"===v(t,"background-width-relative-to","value",a)?0:y),p=d+("inner"===v(t,"background-height-relative-to","value",a)?0:y),m=t._private.rscratch,w="node"===v(t,"background-clip","value",a),E=v(t,"background-image-opacity","value",a)*n,C=v(t,"background-image-smoothing","value",a),x=t.pstyle("corner-radius").value;"auto"!==x&&(x=t.pstyle("corner-radius").pfValue);var k=e.width||e.cachedW,S=e.height||e.cachedH;(null==k||null==S)&&(document.body.appendChild(e),k=e.cachedW=e.width||e.offsetWidth,S=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var P=k,D=S;if("auto"!==v(t,"background-width","value",a)&&(P="%"===v(t,"background-width","units",a)?v(t,"background-width","pfValue",a)*g:v(t,"background-width","pfValue",a)),"auto"!==v(t,"background-height","value",a)&&(D="%"===v(t,"background-height","units",a)?v(t,"background-height","pfValue",a)*p:v(t,"background-height","pfValue",a)),0!==P&&0!==D){if("contain"===f)P*=A=Math.min(g/P,p/D),D*=A;else if("cover"===f){var A;P*=A=Math.max(g/P,p/D),D*=A}var B=o-g/2,R=v(t,"background-position-x","units",a),M=v(t,"background-position-x","pfValue",a);B+="%"===R?(g-P)*M:M;var I=v(t,"background-offset-x","units",a),L=v(t,"background-offset-x","pfValue",a);B+="%"===I?(g-P)*L:L;var O=l-p/2,V=v(t,"background-position-y","units",a),G=v(t,"background-position-y","pfValue",a);O+="%"===V?(p-D)*G:G;var N=v(t,"background-offset-y","units",a),F=v(t,"background-offset-y","pfValue",a);O+="%"===N?(p-D)*F:F,m.pathCache&&(B-=o,O-=l,o=0,l=0);var K=r.globalAlpha;r.globalAlpha=E;var X=i.getImgSmoothing(r),Q=!1;if("no"===C&&X?(i.setImgSmoothing(r,!1),Q=!0):"yes"===C&&!X&&(i.setImgSmoothing(r,!0),Q=!0),"no-repeat"===c)w&&(r.save(),m.pathCache?r.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,o,l,g,p,x,m),r.clip())),i.safeDrawImage(r,e,0,0,k,S,B,O,P,D),w&&r.restore();else{var Z=r.createPattern(e,c);r.fillStyle=Z,i.nodeShapes[i.getNodeShape(t)].draw(r,o,l,g,p,x,m),r.translate(B,O),r.fill(),r.translate(-B,-O)}r.globalAlpha=K,Q&&i.setImgSmoothing(r,X)}}},kt={};function to(r,e,t,a,n){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;r.beginPath(),r.moveTo(e+i,t),r.lineTo(e+a-i,t),r.quadraticCurveTo(e+a,t,e+a,t+i),r.lineTo(e+a,t+n-i),r.quadraticCurveTo(e+a,t+n,e+a-i,t+n),r.lineTo(e+i,t+n),r.quadraticCurveTo(e,t+n,e,t+n-i),r.lineTo(e,t+i),r.quadraticCurveTo(e,t,e+i,t),r.closePath(),s?r.stroke():r.fill()}kt.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(bi(t*a));e=Math.pow(2,n)}return!(r.pstyle("font-size").pfValue*e<r.pstyle("min-zoomed-font-size").pfValue)},kt.drawElementText=function(r,e,t,a,n){var i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=this;if(null==a){if(i&&!s.eleTextBiggerThanMin(e))return}else if(!1===a)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e);r.textAlign=l,r.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,v=e.pstyle("label"),f=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!v||!v.value)&&(!f||!f.value)&&(!c||!c.value))return;r.textAlign="center",r.textBaseline="bottom"}var d,h=!t;t&&(d=t,r.translate(-d.x1,-d.y1)),null==n?(s.drawText(r,e,null,h,i),e.isEdge()&&(s.drawText(r,e,"source",h,i),s.drawText(r,e,"target",h,i))):s.drawText(r,e,n,h,i),t&&r.translate(d.x1,d.y1)},kt.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t<this.fontCaches.length;t++)if((e=this.fontCaches[t]).context===r)return e;return e={context:r},this.fontCaches.push(e),e},kt.setupTextStyle=function(r,e){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,v=e.pstyle("text-outline-color").value;r.font=a+" "+s+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,u[0],u[1],u[2],o),this.colorStrokeStyle(r,v[0],v[1],v[2],l)},kt.getTextAngle=function(r,e){var t,n=r._private.rscratch,i=e?e+"-":"",s=r.pstyle(i+"text-rotation");if("autorotate"===s.strValue){var o=wr(n,"labelAngle",e);t=r.isEdge()?o:0}else t="none"===s.strValue?0:s.pfValue;return t},kt.drawText=function(r,e,t){var a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!n||0!==o&&0!==e.pstyle("text-opacity").value){"main"===t&&(t=null);var v,f,l=wr(s,"labelX",t),u=wr(s,"labelY",t),c=this.getLabelText(e,t);if(null!=c&&""!==c&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(r,e,n);var E,h=t?t+"-":"",d=wr(s,"labelWidth",t),y=wr(s,"labelHeight",t),g=e.pstyle(h+"text-margin-x").pfValue,p=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,w=e.pstyle("text-valign").value;switch(m&&(b="center",w="center"),l+=g,u+=p,0!==(E=a?this.getTextAngle(e,t):0)&&(v=l,f=u,r.translate(v,f),r.rotate(E),l=0,u=0),w){case"top":break;case"center":u+=y/2;break;case"bottom":u+=y}var C=e.pstyle("text-background-opacity").value,x=e.pstyle("text-border-opacity").value,k=e.pstyle("text-border-width").pfValue,S=e.pstyle("text-background-padding").pfValue,P=e.pstyle("text-background-shape").strValue,D=0===P.indexOf("round"),A=2;if(C>0||k>0&&x>0){var B=l-S;switch(b){case"left":B-=d;break;case"center":B-=d/2}var R=u-y-S,M=d+2*S,I=y+2*S;if(C>0){var L=r.fillStyle,O=e.pstyle("text-background-color").value;r.fillStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+C*o+")",D?to(r,B,R,M,I,A):r.fillRect(B,R,M,I),r.fillStyle=L}if(k>0&&x>0){var V=r.strokeStyle,G=r.lineWidth,N=e.pstyle("text-border-color").value,F=e.pstyle("text-border-style").value;if(r.strokeStyle="rgba("+N[0]+","+N[1]+","+N[2]+","+x*o+")",r.lineWidth=k,r.setLineDash)switch(F){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=k/4,r.setLineDash([]);break;case"solid":r.setLineDash([])}if(D?to(r,B,R,M,I,A,"stroke"):r.strokeRect(B,R,M,I),"double"===F){var K=k/2;D?to(r,B+K,R+K,M-2*K,I-2*K,A,"stroke"):r.strokeRect(B+K,R+K,M-2*K,I-2*K)}r.setLineDash&&r.setLineDash([]),r.lineWidth=G,r.strokeStyle=V}}var X=2*e.pstyle("text-outline-width").pfValue;if(X>0&&(r.lineWidth=X),"wrap"===e.pstyle("text-wrap").value){var Q=wr(s,"labelWrapCachedLines",t),Z=wr(s,"labelLineHeight",t),re=d/2,ae=this.getLabelJustification(e);switch("auto"===ae||("left"===b?"left"===ae?l+=-d:"center"===ae&&(l+=-re):"center"===b?"left"===ae?l+=-re:"right"===ae&&(l+=re):"right"===b&&("center"===ae?l+=re:"right"===ae&&(l+=d))),w){case"top":case"center":case"bottom":u-=(Q.length-1)*Z}for(var J=0;J<Q.length;J++)X>0&&r.strokeText(Q[J],l,u),r.fillText(Q[J],l,u),u+=Z}else X>0&&r.strokeText(c,l,u),r.fillText(c,l,u);0!==E&&(r.rotate(-E),r.translate(-v,-f))}}};var ct={drawNode:function(r,e,t){var o,l,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=this,u=e._private,v=u.rscratch,f=e.position();if(te(f.x)&&te(f.y)&&(!i||e.visible())){var d,p,c=i?e.effectiveOpacity():1,h=s.usePaths(),y=!1,g=e.padding();o=e.width()+2*g,l=e.height()+2*g,t&&(p=t,r.translate(-p.x1,-p.y1));for(var m=e.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),C=0,x=0;x<b.length;x++){var k=b[x],S=w[x]=null!=k&&"none"!==k;if(S){var P=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",x);C++,E[x]=s.getCachedImage(k,P,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var D=e.pstyle("background-blacken").value,A=e.pstyle("border-width").pfValue,B=e.pstyle("background-opacity").value*c,R=e.pstyle("border-color").value,M=e.pstyle("border-style").value,I=e.pstyle("border-join").value,L=e.pstyle("border-cap").value,O=e.pstyle("border-position").value,V=e.pstyle("border-dash-pattern").pfValue,G=e.pstyle("border-dash-offset").pfValue,N=e.pstyle("border-opacity").value*c,F=e.pstyle("outline-width").pfValue,K=e.pstyle("outline-color").value,X=e.pstyle("outline-style").value,Q=e.pstyle("outline-opacity").value*c,Z=e.pstyle("outline-offset").value,re=e.pstyle("corner-radius").value;"auto"!==re&&(re=e.pstyle("corner-radius").pfValue);var ae=function(){var le=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B;s.eleFillStyle(r,e,le)},J=function(){var le=arguments.length>0&&void 0!==arguments[0]?arguments[0]:N;s.colorStrokeStyle(r,R[0],R[1],R[2],le)},z=function(){var le=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q;s.colorStrokeStyle(r,K[0],K[1],K[2],le)},q=function(le,Y,T,_){var ue,W=s.nodePathCache=s.nodePathCache||[],U=Yo("polygon"===T?T+","+_.join(","):T,""+Y,""+le,""+re),$=W[U],j=!1;return null!=$?(ue=$,j=!0,v.pathCache=ue):(ue=new Path2D,W[U]=v.pathCache=ue),{path:ue,cacheHit:j}},H=e.pstyle("shape").strValue,ee=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(f.x,f.y);var ne=q(o,l,H,ee);d=ne.path,y=ne.cacheHit}var be=function(){if(!y){var le=f;h&&(le={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||r,le.x,le.y,o,l,re,v)}h?r.fill(d):r.fill()},Ge=function(){for(var le=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,Y=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],T=u.backgrounding,_=0,W=0;W<E.length;W++){var U=e.cy().style().getIndexedStyle(e,"background-image-containment","value",W);Y&&"over"===U||!Y&&"inside"===U?_++:w[W]&&E[W].complete&&!E[W].error&&(_++,s.drawInscribedImage(r,E[W],e,W,le))}u.backgrounding=_!==C,T!==u.backgrounding&&e.updateStyle(!1)},Ie=function(){var le=arguments.length>0&&void 0!==arguments[0]&&arguments[0],Y=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;s.hasPie(e)&&(s.drawPie(r,e,Y),le&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,f.x,f.y,o,l,re,v)))},se=function(){var le=arguments.length>0&&void 0!==arguments[0]&&arguments[0],Y=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;s.hasStripe(e)&&(r.save(),h?r.clip(v.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(r,f.x,f.y,o,l,re,v),r.clip()),s.drawStripe(r,e,Y),r.restore(),le&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,f.x,f.y,o,l,re,v)))},oe=function(){var le=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,Y=(D>0?D:-D)*le,T=D>0?0:255;0!==D&&(s.colorFillStyle(r,T,T,T,Y),h?r.fill(d):r.fill())},ce=function(){if(A>0){if(r.lineWidth=A,r.lineCap=L,r.lineJoin=I,r.setLineDash)switch(M){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(V),r.lineDashOffset=G;break;case"solid":case"double":r.setLineDash([])}if("center"!==O){if(r.save(),r.lineWidth*=2,"inside"===O)h?r.clip(d):r.clip();else{var le=new Path2D;le.rect(-o/2-A,-l/2-A,o+2*A,l+2*A),le.addPath(d),r.clip(le,"evenodd")}h?r.stroke(d):r.stroke(),r.restore()}else h?r.stroke(d):r.stroke();if("double"===M){r.lineWidth=A/3;var Y=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(d):r.stroke(),r.globalCompositeOperation=Y}r.setLineDash&&r.setLineDash([])}},ge=function(){if(F>0){if(r.lineWidth=F,r.lineCap="butt",r.setLineDash)switch(X){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([])}var le=f;h&&(le={x:0,y:0});var Y=s.getNodeShape(e),T=A;"inside"===O&&(T=0),"outside"===O&&(T*=2);var j,_=(o+T+(F+Z))/o,W=(l+T+(F+Z))/l,U=o*_,$=l*W,ue=s.nodeShapes[Y].points;if(h)j=q(U,$,Y,ue).path;if("ellipse"===Y)s.drawEllipsePath(j||r,le.x,le.y,U,$);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(Y)){var Ee=0,Se=0,pe=0;"round-diamond"===Y?Ee=1.4*(T+Z+F):"round-heptagon"===Y?(Ee=1.075*(T+Z+F),pe=-(T/2+Z+F)/35):"round-hexagon"===Y?Ee=1.12*(T+Z+F):"round-pentagon"===Y?(Ee=1.13*(T+Z+F),pe=-(T/2+Z+F)/15):"round-tag"===Y?(Ee=1.12*(T+Z+F),Se=.07*(T/2+F+Z)):"round-triangle"===Y&&(Ee=(T+Z+F)*(Math.PI/2),pe=-(T+Z/2+F)/Math.PI),0!==Ee&&(U=o*(_=(o+Ee)/o),["round-hexagon","round-tag"].includes(Y)||($=l*(W=(l+Ee)/l)));for(var Ce=U/2,me=$/2,xe=(re="auto"===re?lu(U,$):re)+(T+F+Z)/2,Ne=new Array(ue.length/2),Ze=new Array(ue.length/2),fr=0;fr<ue.length/2;fr++)Ne[fr]={x:le.x+Se+Ce*ue[2*fr],y:le.y+pe+me*ue[2*fr+1]};var sr,Ke,cr,tr,Cr=Ne.length;for(Ke=Ne[Cr-1],sr=0;sr<Cr;sr++)cr=Ne[sr%Cr],tr=Ne[(sr+1)%Cr],Ze[sr]=Zs(Ke,cr,tr,xe),Ke=cr,cr=tr;s.drawRoundPolygonPath(j||r,le.x+Se,le.y+pe,o*_,l*W,ue,Ze)}else if(["roundrectangle","round-rectangle"].includes(Y))re="auto"===re?nt(U,$):re,s.drawRoundRectanglePath(j||r,le.x,le.y,U,$,re+(T+F+Z)/2);else if(["cutrectangle","cut-rectangle"].includes(Y))re="auto"===re?8:re,s.drawCutRectanglePath(j||r,le.x,le.y,U,$,null,re+(T+F+Z)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(Y))re="auto"===re?nt(U,$):re,s.drawBottomRoundRectanglePath(j||r,le.x,le.y,U,$,re+(T+F+Z)/2);else if("barrel"===Y)s.drawBarrelPath(j||r,le.x,le.y,U,$);else if(Y.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(Y)){ue=tn(an(ue,(T+F+Z)/o)),s.drawPolygonPath(j||r,le.x,le.y,o,l,ue)}else{ue=tn(an(ue,-((T+F+Z)/o))),s.drawPolygonPath(j||r,le.x,le.y,o,l,ue)}if(h?r.stroke(j):r.stroke(),"double"===X){r.lineWidth=T/3;var Qr=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(j):r.stroke(),r.globalCompositeOperation=Qr}r.setLineDash&&r.setLineDash([])}},de=function(){n&&s.drawNodeOverlay(r,e,f,o,l)},ye=function(){n&&s.drawNodeUnderlay(r,e,f,o,l)},we=function(){s.drawElementText(r,e,null,a)},De="yes"===e.pstyle("ghost").value;if(De){var Fe=e.pstyle("ghost-offset-x").pfValue,$e=e.pstyle("ghost-offset-y").pfValue,Re=e.pstyle("ghost-opacity").value,Xe=Re*c;r.translate(Fe,$e),z(),ge(),ae(Re*B),be(),Ge(Xe,!0),J(Re*N),ce(),Ie(0!==D||0!==A),se(0!==D||0!==A),Ge(Xe,!1),oe(Xe),r.translate(-Fe,-$e)}h&&r.translate(-f.x,-f.y),ye(),h&&r.translate(f.x,f.y),z(),ge(),ae(),be(),Ge(c,!0),J(),ce(),Ie(0!==D||0!==A),se(0!==D||0!==A),Ge(c,!1),oe(),h&&r.translate(-f.x,-f.y),we(),de(),t&&r.translate(p.x1,p.y1)}}},uf=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a,n,i,s){if(a.visible()){var l=a.pstyle("".concat(e,"-padding")).pfValue,u=a.pstyle("".concat(e,"-opacity")).value,v=a.pstyle("".concat(e,"-color")).value,f=a.pstyle("".concat(e,"-shape")).value,c=a.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(n=n||a.position(),null==i||null==s){var h=a.padding();i=a.width()+2*h,s=a.height()+2*h}this.colorFillStyle(t,v[0],v[1],v[2],u),this.nodeShapes[f].draw(t,n.x,n.y,i+2*l,s+2*l,c),t.fill()}}}};ct.drawNodeOverlay=uf("overlay"),ct.drawNodeUnderlay=uf("underlay"),ct.hasPie=function(r){return(r=r[0])._private.hasPie},ct.hasStripe=function(r){return(r=r[0])._private.hasStripe},ct.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var h,n=e.cy().style(),i=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),o=e.pstyle("pie-start-angle").pfValue,l=a.x,u=a.y,v=e.width(),f=e.height(),c=Math.min(v,f)/2,d=0;if(this.usePaths()&&(l=0,u=0),"%"===i.units?c*=i.pfValue:void 0!==i.pfValue&&(c=i.pfValue/2),"%"===s.units?h=c*s.pfValue:void 0!==s.pfValue&&(h=s.pfValue/2),!(h>=c))for(var g=1;g<=n.pieBackgroundN;g++){var p=e.pstyle("pie-"+g+"-background-size").value,m=e.pstyle("pie-"+g+"-background-color").value,b=e.pstyle("pie-"+g+"-background-opacity").value*t,w=p/100;w+d>1&&(w=1-d);var E=1.5*Math.PI+2*Math.PI*d,x=(E+=o)+2*Math.PI*w;0===p||d>=1||d+w>1||(0===h?(r.beginPath(),r.moveTo(l,u),r.arc(l,u,c,E,x),r.closePath()):(r.beginPath(),r.arc(l,u,c,E,x),r.arc(l,u,h,x,E,!0),r.closePath()),this.colorFillStyle(r,m[0],m[1],m[2],b),r.fill(),d+=w)}},ct.drawStripe=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,s=a.y,o=e.width(),l=e.height(),u=0,v=this.usePaths();r.save();var f=e.pstyle("stripe-direction").value,c=e.pstyle("stripe-size");switch(f){case"vertical":break;case"righward":r.rotate(-Math.PI/2)}var h=o,d=l;"%"===c.units?(h*=c.pfValue,d*=c.pfValue):void 0!==c.pfValue&&(h=c.pfValue,d=c.pfValue),v&&(i=0,s=0),s-=h/2,i-=d/2;for(var y=1;y<=n.stripeBackgroundN;y++){var g=e.pstyle("stripe-"+y+"-background-size").value,p=e.pstyle("stripe-"+y+"-background-color").value,m=e.pstyle("stripe-"+y+"-background-opacity").value*t,b=g/100;b+u>1&&(b=1-u),!(0===g||u>=1||u+b>1)&&(r.beginPath(),r.rect(i,s+d*u,h,d*b),r.closePath(),this.colorFillStyle(r,p[0],p[1],p[2],m),r.fill(),u+=b)}r.restore()};var Oa,mr={};function lf(r,e,t){var a=r.createShader(e);if(r.shaderSource(a,t),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(a));return a}function Cy(r,e,t){void 0===t&&(t=e);var a=r.makeOffscreenCanvas(e,t),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function ao(r){var e=r.pixelRatio,t=r.cy.zoom(),a=r.cy.pan();return{zoom:t*e,pan:{x:a.x*e,y:a.y*e}}}function Dy(r){return"solid"===r.pstyle("background-fill").value&&"none"===r.pstyle("background-image").strValue&&(0===r.pstyle("border-width").value||0===r.pstyle("border-opacity").value||"solid"===r.pstyle("border-style").value)}function ky(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function Bt(r,e,t){var a=r[0]/255,n=r[1]/255,i=r[2]/255,s=e,o=t||new Array(4);return o[0]=a*s,o[1]=n*s,o[2]=i*s,o[3]=s,o}function ra(r,e){var t=e||new Array(4);return t[0]=(r>>0&255)/255,t[1]=(r>>8&255)/255,t[2]=(r>>16&255)/255,t[3]=(r>>24&255)/255,t}function By(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function vf(r,e){switch(e){case"float":return[1,r.FLOAT,4];case"vec2":return[2,r.FLOAT,4];case"vec3":return[3,r.FLOAT,4];case"vec4":return[4,r.FLOAT,4];case"int":return[1,r.INT,4];case"ivec2":return[2,r.INT,4]}}function ff(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function Ay(r,e,t,a,n,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*a,n);case r.INT:return new Int32Array(t.buffer,i*a,n)}}function _r(r,e,t,a){var i=Qe(vf(r,t),3),s=i[0],o=i[1],l=i[2],u=ff(r,o,e*s),v=s*l,f=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,f),r.bufferData(r.ARRAY_BUFFER,e*v,r.DYNAMIC_DRAW),r.enableVertexAttribArray(a),o===r.FLOAT?r.vertexAttribPointer(a,s,o,!1,v,0):o===r.INT&&r.vertexAttribIPointer(a,s,o,v,0),r.vertexAttribDivisor(a,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var c=new Array(e),h=0;h<e;h++)c[h]=Ay(r,o,u,v,s,h);return f.dataArray=u,f.stride=v,f.size=s,f.getView=function(d){return c[d]},f.setPoint=function(d,y,g){var p=c[d];p[0]=y,p[1]=g},f.bufferSubData=function(d){r.bindBuffer(r.ARRAY_BUFFER,f),d?r.bufferSubData(r.ARRAY_BUFFER,0,u,0,d*s):r.bufferSubData(r.ARRAY_BUFFER,0,u)},f}mr.getPixelRatio=function(){var r=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t},mr.paintCache=function(r){for(var a,e=this.paintCaches=this.paintCaches||[],t=!0,n=0;n<e.length;n++)if((a=e[n]).context===r){t=!1;break}return t&&(a={context:r},e.push(a)),a},mr.createGradientStyleFor=function(r,e,t,a,n){var i,s=this.usePaths(),o=t.pstyle(e+"-gradient-stop-colors").value,l=t.pstyle(e+"-gradient-stop-positions").pfValue;if("radial-gradient"===a)if(t.isEdge()){var u=t.sourceEndpoint(),v=t.targetEndpoint(),f=t.midpoint(),c=yt(u,f),h=yt(v,f);i=r.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(c,h))}else{var d=s?{x:0,y:0}:t.position(),y=t.paddedWidth(),g=t.paddedHeight();i=r.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(y,g))}else if(t.isEdge()){var p=t.sourceEndpoint(),m=t.targetEndpoint();i=r.createLinearGradient(p.x,p.y,m.x,m.y)}else{var b=s?{x:0,y:0}:t.position(),C=t.paddedWidth()/2,x=t.paddedHeight()/2;switch(t.pstyle("background-gradient-direction").value){case"to-bottom":i=r.createLinearGradient(b.x,b.y-x,b.x,b.y+x);break;case"to-top":i=r.createLinearGradient(b.x,b.y+x,b.x,b.y-x);break;case"to-left":i=r.createLinearGradient(b.x+C,b.y,b.x-C,b.y);break;case"to-right":i=r.createLinearGradient(b.x-C,b.y,b.x+C,b.y);break;case"to-bottom-right":case"to-right-bottom":i=r.createLinearGradient(b.x-C,b.y-x,b.x+C,b.y+x);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(b.x-C,b.y+x,b.x+C,b.y-x);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(b.x+C,b.y-x,b.x-C,b.y+x);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(b.x+C,b.y+x,b.x-C,b.y-x)}}if(!i)return null;for(var S=l.length===o.length,P=o.length,D=0;D<P;D++)i.addColorStop(S?l[D]:D/(P-1),"rgba("+o[D][0]+","+o[D][1]+","+o[D][2]+","+n+")");return i},mr.gradientFillStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"background",e,t,a);if(!n)return null;r.fillStyle=n},mr.colorFillStyle=function(r,e,t,a,n){r.fillStyle="rgba("+e+","+t+","+a+","+n+")"},mr.eleFillStyle=function(r,e,t){var a=e.pstyle("background-fill").value;if("linear-gradient"===a||"radial-gradient"===a)this.gradientFillStyle(r,e,a,t);else{var n=e.pstyle("background-color").value;this.colorFillStyle(r,n[0],n[1],n[2],t)}},mr.gradientStrokeStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"line",e,t,a);if(!n)return null;r.strokeStyle=n},mr.colorStrokeStyle=function(r,e,t,a,n){r.strokeStyle="rgba("+e+","+t+","+a+","+n+")"},mr.eleStrokeStyle=function(r,e,t){var a=e.pstyle("line-fill").value;if("linear-gradient"===a||"radial-gradient"===a)this.gradientStrokeStyle(r,e,a,t);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(r,n[0],n[1],n[2],t)}},mr.matchCanvasSize=function(r){var e=this,t=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],s=e.getPixelRatio(),o=e.motionBlurPxRatio;(r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var v,l=n*s,u=i*s;if(l!==e.canvasWidth||u!==e.canvasHeight){e.fontCaches=null;var f=t.canvasContainer;f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)(v=t.canvases[c]).width=l,v.height=u,v.style.width=n+"px",v.style.height=i+"px";for(c=0;c<e.BUFFER_COUNT;c++)(v=t.bufferCanvases[c]).width=l,v.height=u,v.style.width=n+"px",v.style.height=i+"px";e.textureMult=1,s<=1&&(v=t.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,v.width=l*e.textureMult,v.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u,e.pixelRatio=s}},mr.renderTo=function(r,e,t,a){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:a})},mr.clearCanvas=function(){var r=this,e=r.data;function t(a){a.clearRect(0,0,r.canvasWidth,r.canvasHeight)}t(e.contexts[r.NODE]),t(e.contexts[r.DRAG])},mr.render=function(r){var e=this;r=r||eu();var t=e.cy,a=r.forcedContext,n=r.drawAllLayers,i=r.drawOnlyNodeLayer,s=r.forcedZoom,o=r.forcedPan,l=void 0===r.forcedPxRatio?this.getPixelRatio():r.forcedPxRatio,u=e.data,v=u.canvasNeedsRedraw,f=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),c=void 0!==r.motionBlur?r.motionBlur:e.motionBlur,h=e.motionBlurPxRatio,d=t.hasCompoundNodes(),y=e.hoverData.draggingEles,g=!(!e.hoverData.selecting&&!e.touchData.selecting),p=c=c&&!a&&e.motionBlurEnabled&&!g;a||(e.prevPxRatio!==l&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=l),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),c&&(null==e.mbFrames&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(p=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!f&&(v[e.NODE]=!0,v[e.SELECT_BOX]=!0);var m=t.style(),b=t.zoom(),w=void 0!==s?s:b,E=t.pan(),C={x:E.x,y:E.y},x={zoom:b,pan:{x:E.x,y:E.y}},k=e.prevViewport;!(void 0===k||x.zoom!==k.zoom||x.pan.x!==k.pan.x||x.pan.y!==k.pan.y)&&!(y&&!d)&&(e.motionBlurPxRatio=1),o&&(C=o),w*=l,C.x*=l,C.y*=l;var P=e.getCachedZSortedEles();function D(J,z,q,H,ee){var ne=J.globalCompositeOperation;J.globalCompositeOperation="destination-out",e.colorFillStyle(J,255,255,255,e.motionBlurTransparency),J.fillRect(z,q,H,ee),J.globalCompositeOperation=ne}function A(J,z){var q,H,ee,ne;e.clearingMotionBlur||J!==u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]&&J!==u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]?(q=C,H=w,ee=e.canvasWidth,ne=e.canvasHeight):(q={x:E.x*h,y:E.y*h},H=b*h,ee=e.canvasWidth*h,ne=e.canvasHeight*h),J.setTransform(1,0,0,1,0,0),"motionBlur"===z?D(J,0,0,ee,ne):!a&&(void 0===z||z)&&J.clearRect(0,0,ee,ne),n||(J.translate(q.x,q.y),J.scale(H,H)),o&&J.translate(o.x,o.y),s&&J.scale(s,s)}if(f||(e.textureDrawLastFrame=!1),f){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=t.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var B=e.data.bufferContexts[e.TEXTURE_BUFFER];B.setTransform(1,0,0,1,0,0),B.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:B,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult}),(x=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight}).mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}v[e.DRAG]=!1,v[e.NODE]=!1;var R=u.contexts[e.NODE],M=e.textureCache.texture;x=e.textureCache.viewport;R.setTransform(1,0,0,1,0,0),c?D(R,0,0,x.width,x.height):R.clearRect(0,0,x.width,x.height);var I=m.core("outside-texture-bg-color").value,L=m.core("outside-texture-bg-opacity").value;e.colorFillStyle(R,I[0],I[1],I[2],L),R.fillRect(0,0,x.width,x.height);b=t.zoom();A(R,!1),R.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l),R.drawImage(M,x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l)}else e.textureOnViewport&&!a&&(e.textureCache=null);var O=t.extent(),V=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),G=e.hideEdgesOnViewport&&V,N=[];if(N[e.NODE]=!v[e.NODE]&&c&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,N[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),N[e.DRAG]=!v[e.DRAG]&&c&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,N[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),v[e.NODE]||n||i||N[e.NODE]){var F=c&&!N[e.NODE]&&1!==h;A(R=a||(F?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),c&&!F?"motionBlur":void 0),G?e.drawCachedNodes(R,P.nondrag,l,O):e.drawLayeredElements(R,P.nondrag,l,O),e.debug&&e.drawDebugPoints(R,P.nondrag),!n&&!c&&(v[e.NODE]=!1)}if(!i&&(v[e.DRAG]||n||N[e.DRAG])){F=c&&!N[e.DRAG]&&1!==h;A(R=a||(F?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]),c&&!F?"motionBlur":void 0),G?e.drawCachedNodes(R,P.drag,l,O):e.drawCachedElements(R,P.drag,l,O),e.debug&&e.drawDebugPoints(R,P.drag),!n&&!c&&(v[e.DRAG]=!1)}if(this.drawSelectionRectangle(r,A),c&&1!==h){var X=u.contexts[e.NODE],Q=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Z=u.contexts[e.DRAG],re=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],ae=function(z,q,H){z.setTransform(1,0,0,1,0,0),H||!p?z.clearRect(0,0,e.canvasWidth,e.canvasHeight):D(z,0,0,e.canvasWidth,e.canvasHeight);var ee=h;z.drawImage(q,0,0,e.canvasWidth*ee,e.canvasHeight*ee,0,0,e.canvasWidth,e.canvasHeight)};(v[e.NODE]||N[e.NODE])&&(ae(X,Q,N[e.NODE]),v[e.NODE]=!1),(v[e.DRAG]||N[e.DRAG])&&(ae(Z,re,N[e.DRAG]),v[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=!f,e.mbFrames=0,v[e.NODE]=!0,v[e.DRAG]=!0,e.redraw()},100)),a||t.emit("render")},mr.drawSelectionRectangle=function(r,e){var t=this,a=t.cy,n=t.data,i=a.style(),s=r.drawOnlyNodeLayer,o=r.drawAllLayers,l=n.canvasNeedsRedraw,u=r.forcedContext;if(t.showFps||!s&&l[t.SELECT_BOX]&&!o){var v=u||n.contexts[t.SELECT_BOX];if(e(v),1==t.selection[4]&&(t.hoverData.selecting||t.touchData.selecting)){var f=t.cy.zoom(),c=i.core("selection-box-border-width").value/f;v.lineWidth=c,v.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+")",v.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),c>0&&(v.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+")",v.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(n.bgActivePosistion&&!t.hoverData.selecting){f=t.cy.zoom();var h=n.bgActivePosistion;v.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+")",v.beginPath(),v.arc(h.x,h.y,i.core("active-bg-size").pfValue/f,0,2*Math.PI),v.fill()}var d=t.lastRedrawTime;if(t.showFps&&d){d=Math.round(d);var y=Math.round(1e3/d),g="1 frame = "+d+" ms = "+y+" fps";if(v.setTransform(1,0,0,1,0,0),v.fillStyle="rgba(255, 0, 0, 0.75)",v.strokeStyle="rgba(255, 0, 0, 0.75)",v.font="30px Arial",!Oa){var p=v.measureText(g);Oa=p.actualBoundingBoxAscent}v.fillText(g,0,Oa);v.strokeRect(0,Oa+10,250,20),v.fillRect(0,Oa+10,250*Math.min(y/60,1),20)}o||(l[t.SELECT_BOX]=!1)}};var cf=typeof Float32Array<"u"?Float32Array:Array;function no(){var r=new cf(9);return cf!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function df(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function _n(r,e,t){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],v=e[7],f=e[8],c=t[0],h=t[1];return r[0]=a,r[1]=n,r[2]=i,r[3]=s,r[4]=o,r[5]=l,r[6]=c*a+h*s+u,r[7]=c*n+h*o+v,r[8]=c*i+h*l+f,r}function hf(r,e,t){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],v=e[7],f=e[8],c=Math.sin(t),h=Math.cos(t);return r[0]=h*a+c*s,r[1]=h*n+c*o,r[2]=h*i+c*l,r[3]=h*s-c*a,r[4]=h*o-c*n,r[5]=h*l-c*i,r[6]=u,r[7]=v,r[8]=f,r}function io(r,e,t){var a=t[0],n=t[1];return r[0]=a*e[0],r[1]=a*e[1],r[2]=a*e[2],r[3]=n*e[3],r[4]=n*e[4],r[5]=n*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var Ny=function(){return jr(function r(e,t,a,n){Jr(this,r),this.debugID=Math.floor(1e4*Math.random()),this.r=e,this.texSize=t,this.texRows=a,this.texHeight=Math.floor(t/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,t,t),this.scratch=n(e,t,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(t){var a=t.w,n=t.h,i=this.texHeight,s=this.texSize,o=i/n,l=a*o,u=n*o;return l>s&&(l=a*(o=s/a),u=n*o),{scale:o,texW:l,texH:u}}},{key:"draw",value:function(t,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,l=this.texHeight,u=this.getScale(a),v=u.scale,f=u.texW,c=u.texH,h=function(b,w){if(n&&w){var E=w.context,C=b.x,x=b.row,k=C,S=l*x;E.save(),E.translate(k,S),E.scale(v,v),n(E,a),E.restore()}},d=[null,null],y=function(){h(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*l,w:f,h:c},d[1]={x:i.freePointer.x+f,y:i.freePointer.row*l,w:0,h:c},i.freePointer.x+=f,i.freePointer.x==s&&(i.freePointer.x=0,i.freePointer.row++)},p=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+f<=s)y();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(p(),y()):this.enableWrapping?function(){var b=i.scratch,w=i.canvas;b.clear(),h({x:0,row:0},b);var E=s-i.freePointer.x,C=f-E,x=l,k=i.freePointer.x,S=i.freePointer.row*l,P=E;w.context.drawImage(b,0,0,P,x,k,S,P,x),d[0]={x:k,y:S,w:P,h:c};var D=E,A=(i.freePointer.row+1)*l,B=C;w&&w.context.drawImage(b,D,0,B,x,0,A,B,x),d[1]={x:0,y:A,w:B,h:c},i.freePointer.x=C,i.freePointer.row++}():(p(),y())}return this.keyToLocation.set(t,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(t){return this.keyToLocation.get(t)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(t){if(this.locked)return!1;var a=this.texSize,n=this.texRows,s=this.getScale(t).texW;return!(this.freePointer.x+s>a)||this.freePointer.row<n-1}},{key:"bufferIfNeeded",value:function(t){this.texture||(this.texture=function Py(r,e){var t=r.createTexture();return t.buffer=function(a){r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,a),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}(t,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}}])}(),zy=function(){return jr(function r(e,t,a,n){Jr(this,r),this.r=e,this.texSize=t,this.texRows=a,this.createTextureCanvas=n,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set},[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var t=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new Ny(t,a,n,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var t=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas,s=Math.floor(a/n);this.scratch=i(t,a,s,"scratch")}return this.scratch}},{key:"draw",value:function(t,a,n){var i=this.styleKeyToAtlas.get(t);return i||((!(i=this.atlases[this.atlases.length-1])||!i.canFit(a))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(t,a,n),this.styleKeyToAtlas.set(t,i)),i}},{key:"getAtlas",value:function(t){return this.styleKeyToAtlas.get(t)}},{key:"hasAtlas",value:function(t){return this.styleKeyToAtlas.has(t)}},{key:"markKeyForGC",value:function(t){this.markedKeys.add(t)}},{key:"gc",value:function(){var t=this,a=this.markedKeys;if(0!==a.size){var l,n=[],i=new Map,s=null,o=br(this.atlases);try{var u=function(){var f=l.value,c=f.getKeys(),h=function Fy(r,e){return r.intersection?r.intersection(e):new Set(Ga(r).filter(function(t){return e.has(t)}))}(a,c);if(0===h.size)return n.push(f),c.forEach(function(E){return i.set(E,f)}),1;s||(s=t._createAtlas(),n.push(s));var y,d=br(c);try{for(d.s();!(y=d.n()).done;){var g=y.value;if(!h.has(g)){var m=Qe(f.getOffsets(g),2),b=m[0],w=m[1];s.canFit({w:b.w+w.w,h:b.h})||(s.lock(),s=t._createAtlas(),n.push(s)),f.canvas&&(t._copyTextureToNewAtlas(g,f,s),i.set(g,s))}}}catch(E){d.e(E)}finally{d.f()}f.dispose()};for(o.s();!(l=o.n()).done;)u()}catch(v){o.e(v)}finally{o.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set}else console.log("nothing to garbage collect")}},{key:"_copyTextureToNewAtlas",value:function(t,a,n){var s=Qe(a.getOffsets(t),2),o=s[0],l=s[1];if(0===l.w)n.draw(t,o,function(c){c.drawImage(a.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var u=this._getScratchCanvas();u.clear(),u.context.drawImage(a.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),u.context.drawImage(a.canvas,l.x,l.y,l.w,l.h,o.w,0,l.w,l.h);var v=o.w+l.w,f=o.h;n.draw(t,{w:v,h:f},function(c){c.drawImage(u,0,0,v,f,0,0,v,f)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();var Vy=function(){return jr(function r(e,t){Jr(this,r),this.r=e,this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map},[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(t,a){var n=this.globalOptions,i=n.webglTexSize,s=n.createTextureCanvas,o=a.texRows,l=this._cacheScratchCanvas(s),u=new zy(this.r,i,o,l);this.collections.set(t,u)}},{key:"addRenderType",value:function(t,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),s=he({type:t,atlasCollection:i},a);this.renderTypes.set(t,s)}},{key:"getRenderTypeOpts",value:function(t){return this.renderTypes.get(t)}},{key:"getAtlasCollection",value:function(t){return this.collections.get(t)}},{key:"_cacheScratchCanvas",value:function(t){var a=-1,n=-1,i=null;return function(s,o,l,u){return u?((!i||o!=a||l!=n)&&(a=o,n=l,i=t(s,o,l)),i):t(s,o,l)}}},{key:"_key",value:function(t,a){return"".concat(t,"-").concat(a)}},{key:"invalidate",value:function(t){var d,a=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.forceRedraw,s=void 0!==i&&i,o=n.filterEle,l=void 0===o?function(){return!0}:o,u=n.filterType,v=void 0===u?function(){return!0}:u,f=!1,c=!1,h=br(t);try{for(h.s();!(d=h.n()).done;){var y=d.value;if(l(y)){var p,g=br(this.renderTypes.values());try{var m=function(){var w=p.value,E=w.type;if(v(E)){var C=a.collections.get(w.collection),x=w.getKey(y),k=Array.isArray(x)?x:[x];if(s)k.forEach(function(A){return C.markKeyForGC(A)}),c=!0;else{var S=w.getID?w.getID(y):y.id(),P=a._key(E,S),D=a.typeAndIdToKey.get(P);void 0!==D&&!ky(k,D)&&(f=!0,a.typeAndIdToKey.delete(P),D.forEach(function(A){return C.markKeyForGC(A)}))}}};for(g.s();!(p=g.n()).done;)m()}catch(b){g.e(b)}finally{g.f()}}}}catch(b){h.e(b)}finally{h.f()}return c&&(this.gc(),f=!1),f}},{key:"gc",value:function(){var a,t=br(this.collections.values());try{for(t.s();!(a=t.n()).done;){a.value.gc()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,a,n,i){var s=this.renderTypes.get(a),o=this.collections.get(s.collection),l=!1,u=o.draw(i,n,function(c){s.drawClipped?(c.save(),c.beginPath(),c.rect(0,0,n.w,n.h),c.clip(),s.drawElement(c,t,n,!0,!0),c.restore()):s.drawElement(c,t,n,!0,!0),l=!0});if(l){var v=s.getID?s.getID(t):t.id(),f=this._key(a,v);this.typeAndIdToKey.has(f)?this.typeAndIdToKey.get(f).push(i):this.typeAndIdToKey.set(f,[i])}return u}},{key:"getAtlasInfo",value:function(t,a){var n=this,i=this.renderTypes.get(a),s=i.getKey(t);return(Array.isArray(s)?s:[s]).map(function(l){var u=i.getBoundingBox(t,l),v=n.getOrCreateAtlas(t,a,u,l),c=Qe(v.getOffsets(l),2),h=c[0];return{atlas:v,tex:h,tex1:h,tex2:c[1],bb:u}})}},{key:"getDebugInfo",value:function(){var n,t=[],a=br(this.collections);try{for(a.s();!(n=a.n()).done;){var i=Qe(n.value,2),s=i[0],l=i[1].getCounts(),u=l.keyCount,v=l.atlasCount;t.push({type:s,keyCount:u,atlasCount:v})}}catch(f){a.e(f)}finally{a.f()}return t}}])}(),qy=function(){return jr(function r(e){Jr(this,r),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]},[{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(t,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(t){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(t)}},{key:"getAtlasIndexForBatch",value:function(t){var a=this.batchAtlases.indexOf(t);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),a=this.batchAtlases.length-1}return a}}])}(),Na={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Gn_IGNORE=1,Gn_USE_BB=2,Uy=function(){return jr(function r(e,t,a){Jr(this,r),this.r=e,this.gl=t,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=Cy,this.atlasManager=new Vy(e,a),this.batchManager=new qy(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Na.SCREEN),this.pickingProgram=this._createShaderProgram(Na.PICKING),this.vao=this._createVAO()},[{key:"addAtlasCollection",value:function(t,a){this.atlasManager.addAtlasCollection(t,a)}},{key:"addTextureAtlasRenderType",value:function(t,a){this.atlasManager.addRenderType(t,a)}},{key:"addSimpleShapeRenderType",value:function(t,a){this.simpleShapeOptions.set(t,a)}},{key:"invalidate",value:function(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(t,{filterType:function(o){return o===n},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var a=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),i=this.batchManager.getIndexArray(),o=function Ey(r,e,t){var a=lf(r,r.VERTEX_SHADER,e),n=lf(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,a),r.attachShader(i,n),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}(a,n,"#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(i.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join("\n\t"),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x<q.y)? 1.570796327 : 0.0;\n for( int i=0; i<5; i++ ) {\n vec2 cs = vec2(cos(w),sin(w));\n vec2 u = ab*vec2( cs.x,cs.y);\n vec2 v = ab*vec2(-cs.y,cs.x);\n w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));\n }\n \n // compute final point and distance\n float d = length(p-ab*vec2(cos(w),sin(w)));\n \n // return signed distance\n return (dot(p/ab,p/ab)>1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(i.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join("\n\telse "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(t.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "));o.aPosition=a.getAttribLocation(o,"aPosition"),o.aIndex=a.getAttribLocation(o,"aIndex"),o.aVertType=a.getAttribLocation(o,"aVertType"),o.aTransform=a.getAttribLocation(o,"aTransform"),o.aAtlasId=a.getAttribLocation(o,"aAtlasId"),o.aTex=a.getAttribLocation(o,"aTex"),o.aPointAPointB=a.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=a.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=a.getAttribLocation(o,"aLineWidth"),o.aColor=a.getAttribLocation(o,"aColor"),o.aCornerRadius=a.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=a.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=a.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=a.getUniformLocation(o,"uAtlasSize"),o.uBGColor=a.getUniformLocation(o,"uBGColor"),o.uZoom=a.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var l=0;l<this.batchManager.getMaxAtlasesPerBatch();l++)o.uTextures.push(a.getUniformLocation(o,"uTexture".concat(l)));return o}},{key:"_createVAO",value:function(){var t=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=t.length/2;var a=this.maxInstances,n=this.gl,i=this.program,s=n.createVertexArray();return n.bindVertexArray(s),function Ry(r,e,t,a){var i=Qe(vf(r,e),2),s=i[0],o=i[1],l=ff(r,o,a),u=r.createBuffer();return r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,l,r.STATIC_DRAW),o===r.FLOAT?r.vertexAttribPointer(t,s,o,!1,0,0):o===r.INT&&r.vertexAttribIPointer(t,s,o,0,0),r.enableVertexAttribArray(t),r.bindBuffer(r.ARRAY_BUFFER,null),u}(n,"vec2",i.aPosition,t),this.transformBuffer=function My(r,e,t){for(var n=new Float32Array(9*e),i=new Array(e),s=0;s<e;s++){var o=9*s*4;i[s]=new Float32Array(n.buffer,o,9)}var l=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,n.byteLength,r.DYNAMIC_DRAW);for(var u=0;u<3;u++){var v=t+u;r.enableVertexAttribArray(v),r.vertexAttribPointer(v,3,r.FLOAT,!1,36,12*u),r.vertexAttribDivisor(v,1)}return r.bindBuffer(r.ARRAY_BUFFER,null),l.getMatrixView=function(f){return i[f]},l.setData=function(f,c){i[c].set(f,0)},l.bufferSubData=function(){r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferSubData(r.ARRAY_BUFFER,0,n)},l}(n,a,i.aTransform),this.indexBuffer=_r(n,a,"vec4",i.aIndex),this.vertTypeBuffer=_r(n,a,"int",i.aVertType),this.atlasIdBuffer=_r(n,a,"int",i.aAtlasId),this.texBuffer=_r(n,a,"vec4",i.aTex),this.pointAPointBBuffer=_r(n,a,"vec4",i.aPointAPointB),this.pointCPointDBuffer=_r(n,a,"vec4",i.aPointCPointD),this.lineWidthBuffer=_r(n,a,"vec2",i.aLineWidth),this.colorBuffer=_r(n,a,"vec4",i.aColor),this.cornerRadiusBuffer=_r(n,a,"vec4",i.aCornerRadius),this.borderColorBuffer=_r(n,a,"vec4",i.aBorderColor),n.bindVertexArray(null),s}},{key:"buffers",get:function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return a.endsWith("Buffer")}).map(function(a){return t[a]})),this._buffers}},{key:"startFrame",value:function(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Na.SCREEN;this.panZoomMatrix=t,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(t,a){return!!t.visible()&&(!a||!a.isVisible||a.isVisible(t))}},{key:"drawTexture",value:function(t,a,n){var i=this.atlasManager,s=this.batchManager,o=i.getRenderTypeOpts(n);if(this._isVisible(t,o)){if(this.renderTarget.picking&&o.getTexPickingMode){var l=o.getTexPickingMode(t);if(l===Gn_IGNORE)return;if(l==Gn_USE_BB)return void this.drawPickingRectangle(t,a,n)}var f,v=br(i.getAtlasInfo(t,n));try{for(v.s();!(f=v.n()).done;){var c=f.value,h=c.atlas,d=c.tex1,y=c.tex2;s.canAddToCurrentBatch(h)||this.endBatch();for(var g=s.getAtlasIndexForBatch(h),p=0,m=[[d,!0],[y,!1]];p<m.length;p++){var b=Qe(m[p],2),w=b[0],E=b[1];if(0!=w.w){var C=this.instanceCount;this.vertTypeBuffer.getView(C)[0]=0,ra(a,this.indexBuffer.getView(C)),this.atlasIdBuffer.getView(C)[0]=g;var S=this.texBuffer.getView(C);S[0]=w.x,S[1]=w.y,S[2]=w.w,S[3]=w.h;var P=this.transformBuffer.getMatrixView(C);this.setTransformMatrix(t,P,o,c,E),this.instanceCount++,E||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(D){v.e(D)}finally{v.f()}}}},{key:"setTransformMatrix",value:function(t,a,n,i){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=0;if(n.shapeProps&&n.shapeProps.padding&&(o=t.pstyle(n.shapeProps.padding).pfValue),i){var l=i.bb,u=i.tex1,v=i.tex2,f=u.w/(u.w+v.w);s||(f=1-f);var c=this._getAdjustedBB(l,o,s,f);this._applyTransformMatrix(a,c,n,t)}else{var h=n.getBoundingBox(t),d=this._getAdjustedBB(h,o,!0,1);this._applyTransformMatrix(a,d,n,t)}}},{key:"_applyTransformMatrix",value:function(t,a,n,i){var s,o;df(t);var l=n.getRotation?n.getRotation(i):0;if(0!==l){var u=n.getRotationPoint(i);_n(t,t,[u.x,u.y]),hf(t,t,l);var c=n.getRotationOffset(i);s=c.x+(a.xOffset||0),o=c.y+(a.yOffset||0)}else s=a.x1,o=a.y1;_n(t,t,[s,o]),io(t,t,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(t,a,n,i){var s=t.x1,o=t.y1,l=t.w,u=t.h;a&&(s-=a,o-=a,l+=2*a,u+=2*a);var f=0,c=l*i;return n&&i<1?l=c:!n&&i<1&&(s+=f=l-c,l=c),{x1:s,y1:o,w:l,h:u,xOffset:f,yOffset:t.yOffset}}},{key:"drawPickingRectangle",value:function(t,a,n){var i=this.atlasManager.getRenderTypeOpts(n),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=4,ra(a,this.indexBuffer.getView(s)),Bt([0,0,0],1,this.colorBuffer.getView(s));var u=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(t,u,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(t,i)){var s=i.shapeProps,o=this._getVertTypeForShape(t,s.shape);if(void 0===o||i.isSimple&&!i.isSimple(t))return void this.drawTexture(t,a,n);var l=this.instanceCount;if(this.vertTypeBuffer.getView(l)[0]=o,5===o||6===o){var u=i.getBoundingBox(t),v=this._getCornerRadius(t,s.radius,u),f=this.cornerRadiusBuffer.getView(l);f[0]=v,f[1]=v,f[2]=v,f[3]=v,6===o&&(f[0]=0,f[2]=0)}ra(a,this.indexBuffer.getView(l)),Bt(t.pstyle(s.color).value,t.pstyle(s.opacity).value,this.colorBuffer.getView(l));var g=this.lineWidthBuffer.getView(l);if(g[0]=0,g[1]=0,s.border){var p=t.pstyle("border-width").value;if(p>0){Bt(t.pstyle("border-color").value,t.pstyle("border-opacity").value,this.borderColorBuffer.getView(l));var E=t.pstyle("border-position").value;if("inside"===E)g[0]=0,g[1]=-p;else if("outside"===E)g[0]=p,g[1]=0;else{var C=p/2;g[0]=C,g[1]=-C}}}var x=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(t,x,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,a){switch(t.pstyle(a).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(t,a,n){var i=n.w,s=n.h;if("auto"===t.pstyle(a).value)return nt(i,s);var o=t.pstyle(a).pfValue,l=i/2,u=s/2;return Math.min(o,u,l)}},{key:"drawEdgeArrow",value:function(t,a,n){if(t.visible()){var s,o,l,i=t._private.rscratch;if("source"===n?(s=i.arrowStartX,o=i.arrowStartY,l=i.srcArrowAngle):(s=i.arrowEndX,o=i.arrowEndY,l=i.tgtArrowAngle),!(isNaN(s)||null==s||isNaN(o)||null==o||isNaN(l)||null==l))if("none"!==t.pstyle(n+"-arrow-shape").value){var v=t.pstyle(n+"-arrow-color").value,h=t.pstyle("opacity").value*t.pstyle("line-opacity").value,d=t.pstyle("width").pfValue,y=t.pstyle("arrow-scale").value,g=this.r.getArrowWidth(d,y),p=this.instanceCount,m=this.transformBuffer.getMatrixView(p);df(m),_n(m,m,[s,o]),io(m,m,[g,g]),hf(m,m,l),this.vertTypeBuffer.getView(p)[0]=3,ra(a,this.indexBuffer.getView(p)),Bt(v,h,this.colorBuffer.getView(p)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(t,a){if(t.visible()){var n=this._getEdgePoints(t);if(n){var i=t.pstyle("opacity").value,s=t.pstyle("line-opacity").value,o=t.pstyle("width").pfValue,l=t.pstyle("line-color").value,u=i*s;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=1,ra(a,this.indexBuffer.getView(v)),Bt(l,u,this.colorBuffer.getView(v)),this.lineWidthBuffer.getView(v)[0]=o;var d=this.pointAPointBBuffer.getView(v);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 y=0;y<n.length-2;y+=2){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=2,ra(a,this.indexBuffer.getView(g)),Bt(l,u,this.colorBuffer.getView(g)),this.lineWidthBuffer.getView(g)[0]=o;var w=n[y-2],E=n[y-1],C=n[y],x=n[y+1],k=n[y+2],S=n[y+3],P=n[y+4],D=n[y+5];0==y&&(w=2*C-k+.001,E=2*x-S+.001),y==n.length-4&&(P=2*k-C+.001,D=2*S-x+.001);var A=this.pointAPointBBuffer.getView(g);A[0]=w,A[1]=E,A[2]=C,A[3]=x;var B=this.pointCPointDBuffer.getView(g);B[0]=k,B[1]=S,B[2]=P,B[3]=D,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_getEdgePoints",value:function(t){var a=t._private.rscratch;if(!a.badLine&&null!=a.allpts&&!isNaN(a.allpts[0])){var n=a.allpts;if(4==n.length)return n;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(t){return Math.min(Math.max(15,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,a){if(4==t.length)return t;for(var n=Array(2*(a+1)),i=0;i<=a;i++)if(0==i)n[0]=t[0],n[1]=t[1];else if(i==a)n[2*i]=t[t.length-2],n[2*i+1]=t[t.length-1];else{var s=i/a;this._setCurvePoint(t,s,n,2*i)}return n}},{key:"_setCurvePoint",value:function(t,a,n,i){if(!(t.length<=2)){for(var s=Array(t.length-2),o=0;o<s.length;o+=2){var l=(1-a)*t[o]+a*t[o+2],u=(1-a)*t[o+1]+a*t[o+3];s[o]=l,s[o+1]=u}return this._setCurvePoint(s,a,n,i)}n[i]=t[0],n[i+1]=t[1]}},{key:"endBatch",value:function(){var t=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(0!==i){var s=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(s),t.bindVertexArray(a);var l,o=br(this.buffers);try{for(o.s();!(l=o.n()).done;){l.value.bufferSubData(i)}}catch(d){o.e(d)}finally{o.f()}for(var v=this.batchManager.getAtlases(),f=0;f<v.length;f++)v[f].bufferIfNeeded(t);for(var c=0;c<v.length;c++)t.activeTexture(t.TEXTURE0+c),t.bindTexture(t.TEXTURE_2D,v[c].texture),t.uniform1i(s.uTextures[c],c);t.uniform1f(s.uZoom,function Ty(r){var e=r.pixelRatio;return r.cy.zoom()*e}(this.r)),t.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(s.uAtlasSize,this.batchManager.getAtlasSize());var h=Bt(this.bgColor,1);t.uniform4fv(s.uBGColor,h),t.drawArraysInstanced(t.TRIANGLES,0,n,i),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:v.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var t=this.atlasManager.getDebugInfo(),a=t.reduce(function(s,o){return s+o.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(s,o){return s+o.count},0);return{atlasInfo:t,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:i}}}])}(),yf={};function mf(r,e){var t=r._private.rscratch;return wr(t,"labelWrapCachedLines",e)||[]}yf.initWebgl=function(r,e){var t=this,a=t.data.contexts[t.WEBGL];r.bgColor=function $y(r){var e=r.cy.container(),t=e&&e.style&&e.style.backgroundColor||"white";return Do(t)}(t),r.webglTexSize=Math.min(r.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),r.webglTexRows=Math.min(r.webglTexRows,54),r.webglTexRowsNodes=Math.min(r.webglTexRowsNodes,54),r.webglBatchSize=Math.min(r.webglBatchSize,16384),r.webglTexPerBatch=Math.min(r.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),t.webglDebug=r.webglDebug,t.webglDebugShowAtlases=r.webglDebugShowAtlases,t.pickingFrameBuffer=function Ly(r){var e=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,e);var t=r.createTexture();return r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),r.bindFramebuffer(r.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,n){r.bindTexture(r.TEXTURE_2D,t),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,a,n,0,r.RGBA,r.UNSIGNED_BYTE,null)},e}(a),t.pickingFrameBuffer.needsDraw=!0,t.drawing=new Uy(t,a,r);var n=function(f){return function(c){return t.getTextAngle(c,f)}},i=function(f){return function(c){var h=c.pstyle(f);return h&&h.value}},s=function(f){return function(c){return c.pstyle("".concat(f,"-opacity")).value>0}},o=function(f){return"yes"===f.pstyle("text-events").strValue?Gn_USE_BB:Gn_IGNORE},l=function(f){var c=f.position(),h=c.x,d=c.y,y=f.outerWidth(),g=f.outerHeight();return{w:y,h:g,x1:h-y/2,y1:d-g/2}};t.drawing.addAtlasCollection("node",{texRows:r.webglTexRowsNodes}),t.drawing.addAtlasCollection("label",{texRows:r.webglTexRows}),t.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),t.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:Dy,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),t.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),t.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),t.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:uo(e.getLabelKey,null),getBoundingBox:lo(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),t.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:uo(e.getSourceLabelKey,"source"),getBoundingBox:lo(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),t.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:uo(e.getTargetLabelKey,"target"),getBoundingBox:lo(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var u=va(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(v,f){var c=!1;f&&f.length>0&&(c|=t.drawing.invalidate(f)),c&&u()}),function Ky(r){var e=r.render;r.render=function(i){i=i||{};var s=r.cy;r.webgl&&(s.zoom()>7.99?(function Yy(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}(r),e.call(r,i)):(function Xy(r){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.canvasWidth,r.canvasHeight),a.restore()};e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}(r),wf(r,i,Na.SCREEN)))};var t=r.matchCanvasSize;r.matchCanvasSize=function(i){t.call(r,i),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0},r.findNearestElements=function(i,s,o,l){return function rm(r,e,t){var i,s,l,a=function em(r,e,t,a,n){var i,s,o,l,u=ao(r),v=u.pan,f=u.zoom,h=Qe(function Sy(r,e,t,a,n){var i=a*t+e.x,s=n*t+e.y;return[i,s=Math.round(r.canvasHeight-s)]}(r,v,f,e,t),2),d=h[0],y=h[1],g=6;if(i=d-g/2,s=y-g/2,l=g,0===(o=g)||0===l)return[];var p=r.data.contexts[r.WEBGL];p.bindFramebuffer(p.FRAMEBUFFER,r.pickingFrameBuffer),r.pickingFrameBuffer.needsDraw&&(p.viewport(0,0,p.canvas.width,p.canvas.height),wf(r,null,Na.PICKING),r.pickingFrameBuffer.needsDraw=!1);var m=o*l,b=new Uint8Array(4*m);p.readPixels(i,s,o,l,p.RGBA,p.UNSIGNED_BYTE,b),p.bindFramebuffer(p.FRAMEBUFFER,null);for(var w=new Set,E=0;E<m;E++){var x=By(b.slice(4*E,4*E+4))-1;x>=0&&w.add(x)}return w}(r,e,t),n=r.getCachedZSortedEles(),o=br(a);try{for(o.s();!(l=o.n()).done;){var v=n[l.value];if(!i&&v.isNode()&&(i=v),!s&&v.isEdge()&&(s=v),i&&s)break}}catch(f){o.e(f)}finally{o.f()}return[i,s].filter(Boolean)}(r,i,s)};var a=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){a.call(r),r.pickingFrameBuffer.needsDraw=!0};var n=r.notify;r.notify=function(i,s){n.call(r,i,s),"viewport"===i||"bounds"===i?r.pickingFrameBuffer.needsDraw=!0:"background"===i&&r.drawing.invalidate(s,{type:"node-body"})}}(t)};var uo=function(e,t){return function(a){var n=e(a),i=mf(a,t);return i.length>1?i.map(function(s,o){return"".concat(n,"_").concat(o)}):n}},lo=function(e,t){return function(a,n){var i=e(a);if("string"==typeof n){var s=n.indexOf("_");if(s>0){var o=Number(n.substring(s+1)),l=mf(a,t),u=i.h/l.length,v=u*o,f=i.y1+v;return{x1:i.x1,w:i.w,y1:f,h:u,yOffset:v}}}return i}};function bf(r,e){var t=r.canvasWidth,a=r.canvasHeight,n=ao(r),i=n.pan,s=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,a),e.translate(i.x,i.y),e.scale(s,s)}function vo(r,e,t){var a=r.drawing;e+=1,t.isNode()?(a.drawNode(t,e,"node-underlay"),a.drawNode(t,e,"node-body"),a.drawTexture(t,e,"label"),a.drawNode(t,e,"node-overlay")):(a.drawEdgeLine(t,e),a.drawEdgeArrow(t,e,"source"),a.drawEdgeArrow(t,e,"target"),a.drawTexture(t,e,"label"),a.drawTexture(t,e,"edge-source-label"),a.drawTexture(t,e,"edge-target-label"))}function wf(r,e,t){var a;r.webglDebug&&(a=performance.now());var n=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&function Qy(r,e){r.drawSelectionRectangle(e,function(t){return bf(r,t)})}(r,e),r.data.canvasNeedsRedraw[r.NODE]||t.picking){var s=r.data.contexts[r.WEBGL];t.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=function Zy(r){var e=r.canvasWidth,t=r.canvasHeight,a=ao(r),n=a.pan,i=a.zoom,s=no();_n(s,s,[n.x,n.y]),io(s,s,[i,i]);var o=no();!function Oy(r,e,t){r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1}(o,e,t);var l=no();return function Iy(r,e,t){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],v=e[7],f=e[8],c=t[0],h=t[1],d=t[2],y=t[3],g=t[4],p=t[5],m=t[6],b=t[7],w=t[8];r[0]=c*a+h*s+d*u,r[1]=c*n+h*o+d*v,r[2]=c*i+h*l+d*f,r[3]=y*a+g*s+p*u,r[4]=y*n+g*o+p*v,r[5]=y*i+g*l+p*f,r[6]=m*a+b*s+w*u,r[7]=m*n+b*o+w*v,r[8]=m*i+b*l+w*f}(l,o,s),l}(r),l=r.getCachedZSortedEles();if(i=l.length,n.startFrame(o,t),t.screen){for(var u=0;u<l.nondrag.length;u++)vo(r,u,l.nondrag[u]);for(var v=0;v<l.drag.length;v++)vo(r,v,l.drag[v])}else if(t.picking)for(var f=0;f<l.length;f++)vo(r,f,l[f]);n.endFrame(),t.screen&&r.webglDebugShowAtlases&&(function Jy(r){var e=r.data.contexts[r.NODE];e.save(),bf(r,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()}(r),function jy(r){var e=function(n,i,s){for(var o=n.atlasManager.getAtlasCollection(i),l=r.data.contexts[r.NODE],u=o.atlases,v=0;v<u.length;v++){var c=u[v].canvas;if(c){var h=c.width,d=c.height,y=h*v,g=c.height*s;l.save(),l.scale(.4,.4),l.drawImage(c,y,g),l.strokeStyle="black",l.rect(y,g,h,d),l.stroke(),l.restore()}}},t=0;e(r.drawing,"node",t++),e(r.drawing,"label",t++)}(r)),r.data.canvasNeedsRedraw[r.NODE]=!1,r.data.canvasNeedsRedraw[r.DRAG]=!1}if(r.webglDebug){var c=performance.now(),d=Math.ceil(c-a),y=n.getDebugInfo(),g=["".concat(i," elements"),"".concat(y.totalInstances," instances"),"".concat(y.batchCount," batches"),"".concat(y.totalAtlases," atlases"),"".concat(y.wrappedCount," wrapped textures"),"".concat(y.simpleCount," simple shapes")].join(", ");console.log("WebGL (".concat(t.name,") - frame time ").concat(d,"ms")),console.log("Totals:"),console.log(" ".concat(g)),console.log("Texture Atlases Used:");var b,m=br(y.atlasInfo);try{for(m.s();!(b=m.n()).done;){var w=b.value;console.log(" ".concat(w.type,": ").concat(w.keyCount," keys, ").concat(w.atlasCount," atlases"))}}catch(E){m.e(E)}finally{m.f()}console.log("")}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,n.gc())}for(var dt={drawPolygonPath:function(r,e,t,a,n,i){var s=a/2,o=n/2;r.beginPath&&r.beginPath(),r.moveTo(e+s*i[0],t+o*i[1]);for(var l=1;l<i.length/2;l++)r.lineTo(e+s*i[2*l],t+o*i[2*l+1]);r.closePath()},drawRoundPolygonPath:function(r,e,t,a,n,i,s){s.forEach(function(o){return Vv(r,o)}),r.closePath()},drawRoundRectanglePath:function(r,e,t,a,n,i){var s=a/2,o=n/2,l="auto"===i?nt(a,n):Math.min(i,o,s);r.beginPath&&r.beginPath(),r.moveTo(e,t-o),r.arcTo(e+s,t-o,e+s,t,l),r.arcTo(e+s,t+o,e,t+o,l),r.arcTo(e-s,t+o,e-s,t,l),r.arcTo(e-s,t-o,e,t-o,l),r.lineTo(e,t-o),r.closePath()},drawBottomRoundRectanglePath:function(r,e,t,a,n,i){var s=a/2,o=n/2,l="auto"===i?nt(a,n):i;r.beginPath&&r.beginPath(),r.moveTo(e,t-o),r.lineTo(e+s,t-o),r.lineTo(e+s,t),r.arcTo(e+s,t+o,e,t+o,l),r.arcTo(e-s,t+o,e-s,t,l),r.lineTo(e-s,t-o),r.lineTo(e,t-o),r.closePath()},drawCutRectanglePath:function(r,e,t,a,n,i,s){var o=a/2,l=n/2,u="auto"===s?8:s;r.beginPath&&r.beginPath(),r.moveTo(e-o+u,t-l),r.lineTo(e+o-u,t-l),r.lineTo(e+o,t-l+u),r.lineTo(e+o,t+l-u),r.lineTo(e+o-u,t+l),r.lineTo(e-o+u,t+l),r.lineTo(e-o,t+l-u),r.lineTo(e-o,t-l+u),r.closePath()},drawBarrelPath:function(r,e,t,a,n){var i=a/2,s=n/2,o=e-i,l=e+i,u=t-s,v=t+s,f=Si(a,n),c=f.widthOffset,h=f.heightOffset,d=f.ctrlPtOffsetPct*c;r.beginPath&&r.beginPath(),r.moveTo(o,u+h),r.lineTo(o,v-h),r.quadraticCurveTo(o+d,v,o+c,v),r.lineTo(l-c,v),r.quadraticCurveTo(l-d,v,l,v-h),r.lineTo(l,u+h),r.quadraticCurveTo(l-d,u,l-c,u),r.lineTo(o+c,u),r.quadraticCurveTo(o+d,u,o,u+h),r.closePath()}},xf=Math.sin(0),Ef=Math.cos(0),fo={},co={},Cf=Math.PI/40,aa=0*Math.PI;aa<2*Math.PI;aa+=Cf)fo[aa]=Math.sin(aa),co[aa]=Math.cos(aa);dt.drawEllipsePath=function(r,e,t,a,n){if(r.beginPath&&r.beginPath(),r.ellipse)r.ellipse(e,t,a/2,n/2,0,0,2*Math.PI);else for(var i,s,o=a/2,l=n/2,u=0*Math.PI;u<2*Math.PI;u+=Cf)i=e-o*fo[u]*xf+o*co[u]*Ef,s=t+l*co[u]*xf+l*fo[u]*Ef,0===u?r.moveTo(i,s):r.lineTo(i,s);r.closePath()};var Va={};function Tf(r){var e=r.indexOf(",");return r.substr(e+1)}function Sf(r,e,t){var a=function(){return e.toDataURL(t,r.quality)};switch(r.output){case"blob-promise":return new Gt(function(n,i){try{e.toBlob(function(s){null!=s?n(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},t,r.quality)}catch(s){i(s)}});case"blob":return function tm(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new Blob([a],{type:e})}(Tf(a()),t);case"base64":return Tf(a());default:return a()}}Va.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]},Va.bufferCanvasImage=function(r){var e=this.cy,a=e.mutableElements().boundingBox(),n=this.findContainerClientCoords(),i=r.full?Math.ceil(a.w):n[2],s=r.full?Math.ceil(a.h):n[3],o=te(r.maxWidth)||te(r.maxHeight),l=this.getPixelRatio(),u=1;if(void 0!==r.scale)i*=r.scale,s*=r.scale,u=r.scale;else if(o){var v=1/0,f=1/0;te(r.maxWidth)&&(v=u*r.maxWidth/i),te(r.maxHeight)&&(f=u*r.maxHeight/s),i*=u=Math.min(v,f),s*=u}o||(i*=l,s*=l,u*=l);var c=document.createElement("canvas");c.width=i,c.height=s,c.style.width=i+"px",c.style.height=s+"px";var h=c.getContext("2d");if(i>0&&s>0){h.clearRect(0,0,i,s),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(r.full)h.translate(-a.x1*u,-a.y1*u),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(a.x1*u,a.y1*u);else{var y=e.pan(),g={x:y.x*u,y:y.y*u};u*=e.zoom(),h.translate(g.x,g.y),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(-g.x,-g.y)}r.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=r.bg,h.rect(0,0,i,s),h.fill())}return c},Va.png=function(r){return Sf(r,this.bufferCanvasImage(r),"image/png")},Va.jpg=function(r){return Sf(r,this.bufferCanvasImage(r),"image/jpeg")};var Df={nodeShapeImpl:function(r,e,t,a,n,i,s,o){switch(r){case"ellipse":return this.drawEllipsePath(e,t,a,n,i);case"polygon":return this.drawPolygonPath(e,t,a,n,i,s);case"round-polygon":return this.drawRoundPolygonPath(e,t,a,n,i,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,t,a,n,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,t,a,n,i,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,t,a,n,i,o);case"barrel":return this.drawBarrelPath(e,t,a,n,i)}}},am=kf,Te=kf.prototype;function kf(r){var e=this,a=e.cy.window().document;r.webgl&&(Te.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(Te.CANVAS_LAYERS),contexts:new Array(Te.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Te.CANVAS_LAYERS),bufferCanvases:new Array(Te.BUFFER_COUNT),bufferContexts:new Array(Te.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,s.position="relative",s.zIndex="0",s.overflow="hidden";var o=r.cy.container();o.appendChild(e.data.canvasContainer),o.style[n]=i;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};bo&&bo.userAgent.match(/msie|trident|edge/i)&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<Te.CANVAS_LAYERS;u++){var v=e.data.canvases[u]=a.createElement("canvas"),f=Te.CANVAS_TYPES[u];e.data.contexts[u]=v.getContext(f),e.data.contexts[u]||We("Could not create canvas of type "+f),Object.keys(l).forEach(function(J){v.style[J]=l[J]}),v.style.position="absolute",v.setAttribute("data-id","layer"+u),v.style.zIndex=String(Te.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(v),e.data.canvasNeedsRedraw[u]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Te.NODE].setAttribute("data-id","layer"+Te.NODE+"-node"),e.data.canvases[Te.SELECT_BOX].setAttribute("data-id","layer"+Te.SELECT_BOX+"-selectbox"),e.data.canvases[Te.DRAG].setAttribute("data-id","layer"+Te.DRAG+"-drag"),e.data.canvases[Te.WEBGL]&&e.data.canvases[Te.WEBGL].setAttribute("data-id","layer"+Te.WEBGL+"-webgl");for(u=0;u<Te.BUFFER_COUNT;u++)e.data.bufferCanvases[u]=a.createElement("canvas"),e.data.bufferContexts[u]=e.data.bufferCanvases[u].getContext("2d"),e.data.bufferCanvases[u].style.position="absolute",e.data.bufferCanvases[u].setAttribute("data-id","buffer"+u),e.data.bufferCanvases[u].style.zIndex=String(-u-1),e.data.bufferCanvases[u].style.visibility="hidden";e.pathsEnabled=!0;var c=xr(),d=function(z){return{x:-z.w/2,y:-z.h/2}},g=function(z){return z[0]._private.nodeKey},p=function(z){return z[0]._private.labelStyleKey},m=function(z){return z[0]._private.sourceLabelStyleKey},b=function(z){return z[0]._private.targetLabelStyleKey},w=function(z,q,H,ee,ne){return e.drawElement(z,q,H,!1,!1,ne)},E=function(z,q,H,ee,ne){return e.drawElementText(z,q,H,ee,"main",ne)},C=function(z,q,H,ee,ne){return e.drawElementText(z,q,H,ee,"source",ne)},x=function(z,q,H,ee,ne){return e.drawElementText(z,q,H,ee,"target",ne)},k=function(z){return z.boundingBox(),z[0]._private.bodyBounds},S=function(z){return z.boundingBox(),z[0]._private.labelBounds.main||c},P=function(z){return z.boundingBox(),z[0]._private.labelBounds.source||c},D=function(z){return z.boundingBox(),z[0]._private.labelBounds.target||c},A=function(z,q){return q},B=function(z){return function(z){return{x:(z.x1+z.x2)/2,y:(z.y1+z.y2)/2}}(k(z))},R=function(z,q,H){var ee=z?z+"-":"";return{x:q.x+H.pstyle(ee+"text-margin-x").pfValue,y:q.y+H.pstyle(ee+"text-margin-y").pfValue}},M=function(z,q,H){var ee=z[0]._private.rscratch;return{x:ee[q],y:ee[H]}},I=function(z){return R("",M(z,"labelX","labelY"),z)},L=function(z){return R("source",M(z,"sourceLabelX","sourceLabelY"),z)},O=function(z){return R("target",M(z,"targetLabelX","targetLabelY"),z)},V=function(z){return d(k(z))},G=function(z){return d(P(z))},N=function(z){return d(D(z))},F=function(z){var q=S(z),H=d(S(z));if(z.isNode()){switch(z.pstyle("text-halign").value){case"left":H.x=-q.w-(q.leftPad||0);break;case"right":H.x=-(q.rightPad||0)}switch(z.pstyle("text-valign").value){case"top":H.y=-q.h-(q.topPad||0);break;case"bottom":H.y=-(q.botPad||0)}}return H},K=e.data.eleTxrCache=new La(e,{getKey:g,doesEleInvalidateKey:function(z){var q=z[0]._private;return!(q.oldBackgroundTimestamp===q.backgroundTimestamp)},drawElement:w,getBoundingBox:k,getRotationPoint:B,getRotationOffset:V,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),X=e.data.lblTxrCache=new La(e,{getKey:p,drawElement:E,getBoundingBox:S,getRotationPoint:I,getRotationOffset:F,isVisible:A}),Q=e.data.slbTxrCache=new La(e,{getKey:m,drawElement:C,getBoundingBox:P,getRotationPoint:L,getRotationOffset:G,isVisible:A}),Z=e.data.tlbTxrCache=new La(e,{getKey:b,drawElement:x,getBoundingBox:D,getRotationPoint:O,getRotationOffset:N,isVisible:A}),re=e.data.lyrTxrCache=new rf(e);e.onUpdateEleCalcs(function(z,q){K.invalidateElements(q),X.invalidateElements(q),Q.invalidateElements(q),Z.invalidateElements(q),re.invalidateElements(q);for(var H=0;H<q.length;H++){var ee=q[H]._private;ee.oldBackgroundTimestamp=ee.backgroundTimestamp}});var ae=function(z){for(var q=0;q<z.length;q++)re.enqueueElementRefinement(z[q].ele)};K.onDequeue(ae),X.onDequeue(ae),Q.onDequeue(ae),Z.onDequeue(ae),r.webgl&&e.initWebgl(r,{getStyleKey:g,getLabelKey:p,getSourceLabelKey:m,getTargetLabelKey:b,drawElement:w,drawLabel:E,drawSourceLabel:C,drawTargetLabel:x,getElementBox:k,getLabelBox:S,getSourceLabelBox:P,getTargetLabelBox:D,getElementRotationPoint:B,getElementRotationOffset:V,getLabelRotationPoint:I,getSourceLabelRotationPoint:L,getTargetLabelRotationPoint:O,getLabelRotationOffset:F,getSourceLabelRotationOffset:G,getTargetLabelRotationOffset:N})}Te.CANVAS_LAYERS=3,Te.SELECT_BOX=0,Te.DRAG=1,Te.NODE=2,Te.WEBGL=3,Te.CANVAS_TYPES=["2d","2d","2d","webgl2"],Te.BUFFER_COUNT=3,Te.TEXTURE_BUFFER=0,Te.MOTIONBLUR_BUFFER_NODE=1,Te.MOTIONBLUR_BUFFER_DRAG=2,Te.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[Te.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[Te.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[Te.SELECT_BOX]=e;break;case"gc":t.data.gc=!0}};var nm=typeof Path2D<"u";Te.path2dEnabled=function(r){if(void 0===r)return this.pathsEnabled;this.pathsEnabled=!!r},Te.usePaths=function(){return nm&&this.pathsEnabled},Te.setImgSmoothing=function(r,e){null!=r.imageSmoothingEnabled?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)},Te.getImgSmoothing=function(r){return null!=r.imageSmoothingEnabled?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled},Te.makeOffscreenCanvas=function(r,e){var t;"undefined"!==(typeof OffscreenCanvas>"u"?"undefined":Je(OffscreenCanvas))?t=new OffscreenCanvas(r,e):((t=this.cy.window().document.createElement("canvas")).width=r,t.height=e);return t},[af,qr,Zr,ro,kt,ct,mr,yf,dt,Va,Df].forEach(function(r){he(Te,r)});var sm=[{type:"layout",extensions:Mp},{type:"renderer",extensions:[{name:"null",impl:Av},{name:"base",impl:Xv},{name:"canvas",impl:am}]}],Bf={},Pf={};function Af(r,e,t){var a=t,n=function(k){Me("Can not register `"+e+"` for `"+r+"` since `"+k+"` already exists in the prototype and can not be overridden")};if("core"===r){if(Pa.prototype[e])return n(e);Pa.prototype[e]=t}else if("collection"===r){if(lr.prototype[e])return n(e);lr.prototype[e]=t}else if("layout"===r){for(var i=function(k){this.options=k,t.call(this,k),ke(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(t.prototype),o=[],l=0;l<o.length;l++){var u=o[l];s[u]=s[u]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var v=t.prototype.stop;s.stop=function(){var x=this.options;if(x&&x.animate){var k=this.animations;if(k)for(var S=0;S<k.length;S++)k[S].stop()}return v?v.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var f=function(k){return k._private.cy},c={addEventFields:function(k,S){S.layout=k,S.cy=f(k),S.target=k},bubble:function(){return!0},parent:function(k){return f(k)}};he(s,{createEmitter:function(){return this._private.emitter=new mn(c,this),this},emitter:function(){return this._private.emitter},on:function(k,S){return this.emitter().on(k,S),this},one:function(k,S){return this.emitter().one(k,S),this},once:function(k,S){return this.emitter().one(k,S),this},removeListener:function(k,S){return this.emitter().removeListener(k,S),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(k,S){return this.emitter().emit(k,S),this}}),Le.eventAliasesOn(s),a=i}else if("renderer"===r&&"null"!==e&&"base"!==e){var h=Rf("renderer","base"),d=h.prototype,y=t,g=t.prototype,p=function(){h.apply(this,arguments),y.apply(this,arguments)},m=p.prototype;for(var b in d){var w=d[b];if(null!=g[b])return n(b);m[b]=w}for(var C in g)m[C]=g[C];d.clientFunctions.forEach(function(x){m[x]=m[x]||function(){We("Renderer does not implement `renderer."+x+"()` on its prototype")}}),a=p}else if("__proto__"===r||"constructor"===r||"prototype"===r)return We(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return ko({map:Bf,keys:[r,e],value:a})}function Rf(r,e){return Bo({map:Bf,keys:[r,e]})}function om(r,e,t,a,n){return ko({map:Pf,keys:[r,e,t,a],value:n})}function um(r,e,t,a){return Bo({map:Pf,keys:[r,e,t,a]})}var ho=function(){return 2===arguments.length?Rf.apply(null,arguments):3===arguments.length?Af.apply(null,arguments):4===arguments.length?um.apply(null,arguments):5===arguments.length?om.apply(null,arguments):void We("Invalid extension access syntax")};Pa.prototype.extension=ho,sm.forEach(function(r){r.extensions.forEach(function(e){Af(r.type,e.name,e.impl)})});var Wn=function(){if(!(this instanceof Wn))return new Wn;this.length=0},Pt=Wn.prototype;Pt.instanceString=function(){return"stylesheet"},Pt.selector=function(r){return this[this.length++]={selector:r,properties:[]},this},Pt.css=function(r,e){var t=this.length-1;if(ve(r))this[t].properties.push({name:r,value:e});else if(ke(r))for(var a=r,n=Object.keys(a),i=0;i<n.length;i++){var s=n[i],o=a[s];if(null!=o){var l=ir.properties[s]||ir.properties[Wa(s)];if(null!=l){var u=l.name,v=o;this[t].properties.push({name:u,value:v})}}}return this},Pt.style=Pt.css,Pt.generateStyle=function(r){var e=new ir(r);return this.appendToStyle(e)},Pt.appendToStyle=function(r){for(var e=0;e<this.length;e++){var t=this[e],a=t.selector,n=t.properties;r.selector(a);for(var i=0;i<n.length;i++){var s=n[i];r.css(s.name,s.value)}}return r};var At=function(e){return void 0===e&&(e={}),ke(e)?new Pa(e):ve(e)?ho.apply(ho,arguments):void 0};At.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(At),r.apply(null,e),this},At.warnings=function(r){return Jo(r)},At.version="3.32.0",At.stylesheet=At.Stylesheet=Wn}}]); |