khoj 1.36.7.dev22__py3-none-any.whl → 1.36.7.dev25__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- khoj/database/migrations/0086_alter_texttoimagemodelconfig_model_type.py +26 -0
- khoj/database/models/__init__.py +4 -3
- khoj/interface/compiled/404/index.html +2 -2
- khoj/interface/compiled/_next/static/chunks/{1199-80c79778c44ad4ec.js → 1199-73b3a84de8752d5d.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/2327-759b19a673b5aecf.js +1 -0
- khoj/interface/compiled/_next/static/chunks/3072.00280770bc15e09f.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{4357-73c05a7c905ffc9f.js → 4357-d86d3401f6f6f802.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{4363-9870bda67c2cf031.js → 4363-4efaf12abe696251.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/4986-130a93adbd4aee1f.js +1 -0
- khoj/interface/compiled/_next/static/chunks/5473-921e17a6177f9729.js +1 -0
- khoj/interface/compiled/_next/static/chunks/6663-133d5db72d2d5f24.js +1 -0
- khoj/interface/compiled/_next/static/chunks/7200-cabc57d26c4b32da.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{8155-87b4d2ea2cf725cc.js → 8515-f305779d95dd5780.js} +8 -8
- khoj/interface/compiled/_next/static/chunks/90542734.9e6e44b1b45b30fe.js +1 -0
- khoj/interface/compiled/_next/static/chunks/9259-d8bcd9da9e80c81e.js +1 -0
- khoj/interface/compiled/_next/static/chunks/94ca1967.1b3402358e0e1255.js +1 -0
- khoj/interface/compiled/_next/static/chunks/964ecbae.d5be7c49c320d695.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/agents/{layout-447b58869479276c.js → layout-5961c3717e1d8813.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/agents/{page-fbe2c1c661cd14ac.js → page-013290d1487a8879.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/automations/{page-ad620b194fd508fe.js → page-03ba7391a044d9c7.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/{layout-4d0b1ba93124fccb.js → layout-603285e3b1400e74.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/page-53cab1cceb3cf72b.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/{layout-6dba801826c4fe59.js → layout-bd8210ff1de491d7.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/{page-f91e6a6a849baf5e.js → page-a6f9c95dd4e3fe49.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/search/{layout-ab5dbb69fb914900.js → layout-9ccd090dcc2aa58a.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/search/{page-30e231665f1f3796.js → page-cc57aeac88ca2e26.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/{layout-bef0e00bb3873a84.js → layout-a7262b2bb8c7ae64.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/{page-c580520d59d92267.js → page-2e7b5c20a07b00da.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{layout-2ce0cb95b1219d97.js → layout-991b6deed2f9eae2.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-ffcb3ce5c6af9988.js → page-df6bbbb0f2010e76.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/d3ac728e-07f1976c92cfb109.js +1 -0
- khoj/interface/compiled/_next/static/chunks/webpack-9081d211e77f6283.js +1 -0
- khoj/interface/compiled/_next/static/css/{a3411982c232c7be.css → 09214671efd6003c.css} +1 -1
- khoj/interface/compiled/_next/static/css/55d4a822f8d94b67.css +1 -0
- khoj/interface/compiled/_next/static/css/{8051073dc55b92b3.css → 804ceddd6c935d4a.css} +1 -1
- khoj/interface/compiled/agents/index.html +2 -2
- khoj/interface/compiled/agents/index.txt +3 -3
- khoj/interface/compiled/automations/index.html +2 -2
- khoj/interface/compiled/automations/index.txt +4 -4
- khoj/interface/compiled/chat/index.html +2 -2
- khoj/interface/compiled/chat/index.txt +3 -3
- khoj/interface/compiled/index.html +2 -2
- khoj/interface/compiled/index.txt +3 -3
- khoj/interface/compiled/search/index.html +2 -2
- khoj/interface/compiled/search/index.txt +3 -3
- khoj/interface/compiled/settings/index.html +2 -2
- khoj/interface/compiled/settings/index.txt +5 -5
- khoj/interface/compiled/share/chat/index.html +2 -2
- khoj/interface/compiled/share/chat/index.txt +3 -3
- khoj/processor/conversation/google/utils.py +4 -4
- khoj/processor/image/generate.py +35 -0
- khoj/routers/helpers.py +5 -1
- {khoj-1.36.7.dev22.dist-info → khoj-1.36.7.dev25.dist-info}/METADATA +3 -3
- {khoj-1.36.7.dev22.dist-info → khoj-1.36.7.dev25.dist-info}/RECORD +66 -67
- khoj/interface/compiled/_next/static/chunks/0d8bff65.4b1018183a8be7c2.js +0 -1
- khoj/interface/compiled/_next/static/chunks/2327-36d17f2483e80f60.js +0 -1
- khoj/interface/compiled/_next/static/chunks/3727.dcea8f2193111552.js +0 -1
- khoj/interface/compiled/_next/static/chunks/3861-8662fce65c02717d.js +0 -1
- khoj/interface/compiled/_next/static/chunks/4986-d19b9ab0079521d7.js +0 -1
- khoj/interface/compiled/_next/static/chunks/5473-02d1709b2a3f4a4b.js +0 -1
- khoj/interface/compiled/_next/static/chunks/6663-61c3f91791968671.js +0 -1
- khoj/interface/compiled/_next/static/chunks/90542734.fecd4dc1a89ed166.js +0 -1
- khoj/interface/compiled/_next/static/chunks/9259-fa40e7cf2ca28e04.js +0 -1
- khoj/interface/compiled/_next/static/chunks/94ca1967.1d9b42d929a1ee8c.js +0 -1
- khoj/interface/compiled/_next/static/chunks/9597.83583248dfbf6e73.js +0 -1
- khoj/interface/compiled/_next/static/chunks/964ecbae.51d6faf8801d15e6.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/page-4108f46796c1c606.js +0 -1
- khoj/interface/compiled/_next/static/chunks/d3ac728e-953b1c3bad7316d7.js +0 -1
- khoj/interface/compiled/_next/static/chunks/webpack-f83765a7accac982.js +0 -1
- khoj/interface/compiled/_next/static/css/f29752d6e1be7624.css +0 -1
- /khoj/interface/compiled/_next/static/{w25ObnntxL_4D4MY2j-Yc → XLZb8V8RokZAEGkgKpBmx}/_buildManifest.js +0 -0
- /khoj/interface/compiled/_next/static/{w25ObnntxL_4D4MY2j-Yc → XLZb8V8RokZAEGkgKpBmx}/_ssgManifest.js +0 -0
- /khoj/interface/compiled/_next/static/chunks/{1915-233ac8a122732d6b.js → 1915-ab4353eaca76f690.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2117-ce1f0a4598f5e4fe.js → 2117-f99825f0a867a42d.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2509-79b3ce8040bc0bcf.js → 2509-fe7409b49255d54a.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{4447-6e47461d1100c3cc.js → 4447-5d44807c40355b1a.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{7647-469de84d236fc7fd.js → 7647-2aa4cf0e69b7a84d.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{8667-8136f74e9a086fca.js → 8667-adbe6017a66cef10.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{9334-3047e20b503f086b.js → 9334-b22127fe2d39bc60.js} +0 -0
- {khoj-1.36.7.dev22.dist-info → khoj-1.36.7.dev25.dist-info}/WHEEL +0 -0
- {khoj-1.36.7.dev22.dist-info → khoj-1.36.7.dev25.dist-info}/entry_points.txt +0 -0
- {khoj-1.36.7.dev22.dist-info → khoj-1.36.7.dev25.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1264],{59516:function(e,t,n){function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function a(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=d(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function s(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}(e,t)||d(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){if(e){if("string"==typeof e)return r(e,t);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}n.d(t,{Z:function(){return u8}});var f,p,g,v,y,b,x,w="undefined"==typeof window?null:window,E=w?w.navigator:null;w&&w.document;var T=h(""),k=h({}),C=h(function(){}),P="undefined"==typeof HTMLElement?"undefined":h(HTMLElement),S=function(e){return e&&e.instanceString&&B(e.instanceString)?e.instanceString():null},D=function(e){return null!=e&&h(e)==T},B=function(e){return null!=e&&h(e)===C},A=function(e){return!I(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},_=function(e){return null!=e&&h(e)===k&&!A(e)&&e.constructor===Object},M=function(e){return null!=e&&h(e)===h(1)&&!isNaN(e)},R=function(e){if("undefined"!==P)return null!=e&&e instanceof HTMLElement},I=function(e){return N(e)||L(e)},N=function(e){return"collection"===S(e)&&e._private.single},L=function(e){return"collection"===S(e)&&!e._private.single},O=function(e){return"core"===S(e)},z=function(e){return"stylesheet"===S(e)},F=function(e){return null==e||!!(""===e||e.match(/^\s+$/))},V=function(e){return null!=e&&h(e)===k&&B(e.then)},X=function(e,t){t||(t=function(){if(1==arguments.length)return arguments[0];if(0==arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function(){var r,i=arguments,a=t.apply(this,i),o=n.cache;return(r=o[a])||(r=o[a]=e.apply(this,i)),r};return n.cache={},n},j=X(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Y=X(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),q=X(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),W=function(e){return F(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},U="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",H="rgb[a]?\\(("+U+"[%]?)\\s*,\\s*("+U+"[%]?)\\s*,\\s*("+U+"[%]?)(?:\\s*,\\s*("+U+"))?\\)",G="rgb[a]?\\((?:"+U+"[%]?)\\s*,\\s*(?:"+U+"[%]?)\\s*,\\s*(?:"+U+"[%]?)(?:\\s*,\\s*(?:"+U+"))?\\)",K="hsl[a]?\\(("+U+")\\s*,\\s*("+U+"[%])\\s*,\\s*("+U+"[%])(?:\\s*,\\s*("+U+"))?\\)",Z="hsl[a]?\\((?:"+U+")\\s*,\\s*(?:"+U+"[%])\\s*,\\s*(?:"+U+"[%])(?:\\s*,\\s*(?:"+U+"))?\\)",$=function(e,t){return e<t?-1:e>t?1:0},Q=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},J=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r;return 4===e.length?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),r=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16)),[t,n,r]}},ee=function(e){function t(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var n,r,i,a,o,s,l,u,c=RegExp("^"+K+"$").exec(e);if(c){if((r=parseInt(c[1]))<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(i=parseFloat(c[2]))<0||i>100||(i/=100,(a=parseFloat(c[3]))<0||a>100)||(a/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1)))return;if(0===i)s=l=u=Math.round(255*a);else{var h=a<.5?a*(1+i):a+i-a*i,d=2*a-h;s=Math.round(255*t(d,h,r+1/3)),l=Math.round(255*t(d,h,r)),u=Math.round(255*t(d,h,r-1/3))}n=[s,l,u,o]}return n},et=function(e){var t,n=RegExp("^"+H+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},en=function(e){return(A(e)?e:null)||er[e.toLowerCase()]||J(e)||et(e)||ee(e)},er={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]},ei=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(_(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},ea=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(_(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))break}return t},eo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function es(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function el(){return a5?a2:(a5=1,a2=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)})}function eu(){if(a6)return a9;a6=1;var e=a4?a3:(a4=1,a3="object"==typeof eo&&eo&&eo.Object===Object&&eo),t="object"==typeof self&&self&&self.Object===Object&&self;return a9=e||t||Function("return this")()}function ec(){return oa?oi:(oa=1,oi=eu().Symbol)}function eh(){if(oh)return oc;oh=1;var e=ec(),t=function(){if(os)return oo;os=1;var e=ec(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;return oo=function(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch(e){}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}}(),n=function(){if(ou)return ol;ou=1;var e=Object.prototype.toString;return ol=function(t){return e.call(t)}}(),r=e?e.toStringTag:void 0;return oc=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?t(e):n(e)}}function ed(){if(og)return op;og=1;var e=eh(),t=of?od:(of=1,od=function(e){return null!=e&&"object"==typeof e});return op=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)}}var ef=es(function(){if(ob)return om;ob=1;var e=el(),t=function(){if(a7)return a8;a7=1;var e=eu();return a8=function(){return e.Date.now()}}(),n=function(){if(oy)return ov;oy=1;var e=function(){if(or)return on;or=1;var e=function(){if(ot)return oe;ot=1;var e=/\s/;return oe=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}}(),t=/^\s+/;return on=function(n){return n?n.slice(0,e(n)+1).replace(t,""):n}}(),t=el(),n=ed(),r=0/0,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;return ov=function(l){if("number"==typeof l)return l;if(n(l))return r;if(t(l)){var u="function"==typeof l.valueOf?l.valueOf():l;l=t(u)?u+"":u}if("string"!=typeof l)return 0===l?l:+l;l=e(l);var c=a.test(l);return c||o.test(l)?s(l.slice(2),c?2:8):i.test(l)?r:+l}}(),r=Math.max,i=Math.min;return om=function(a,o,s){var l,u,c,h,d,f,p=0,g=!1,v=!1,y=!0;if("function"!=typeof a)throw TypeError("Expected a function");function b(e){var t=l,n=u;return l=u=void 0,p=e,h=a.apply(n,t)}function x(e){var t=e-f,n=e-p;return void 0===f||t>=o||t<0||v&&n>=c}function w(){var e,n,r,a=t();if(x(a))return E(a);d=setTimeout(w,(e=a-f,n=a-p,r=o-e,v?i(r,c-n):r))}function E(e){return(d=void 0,y&&l)?b(e):(l=u=void 0,h)}function T(){var e,n=t(),r=x(n);if(l=arguments,u=this,f=n,r){if(void 0===d)return p=e=f,d=setTimeout(w,o),g?b(e):h;if(v)return clearTimeout(d),d=setTimeout(w,o),b(f)}return void 0===d&&(d=setTimeout(w,o)),h}return o=n(o)||0,e(s)&&(g=!!s.leading,c=(v="maxWait"in s)?r(n(s.maxWait)||0,o):c,y="trailing"in s?!!s.trailing:y),T.cancel=function(){void 0!==d&&clearTimeout(d),p=0,l=f=u=d=void 0},T.flush=function(){return void 0===d?h:E(t())},T}}()),ep=w?w.performance:null,eg=ep&&ep.now?function(){return ep.now()}:function(){return Date.now()},ev=function(){if(w){if(w.requestAnimationFrame)return function(e){w.requestAnimationFrame(e)};if(w.mozRequestAnimationFrame)return function(e){w.mozRequestAnimationFrame(e)};if(w.webkitRequestAnimationFrame)return function(e){w.webkitRequestAnimationFrame(e)};if(w.msRequestAnimationFrame)return function(e){w.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(eg())},1e3/60)}}(),ey=function(e){return ev(e)},em=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=65599*r+t.value|0;return r},eb=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},ex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},ew=function(e){return 2097152*e[0]+e[1]},eE=function(e,t){return[eb(e[0],t[0]),ex(e[1],t[1])]},eT=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return em({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},ek=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return em({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},eC=function(){return eP(arguments)},eP=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?ek(r):ek(r,t)}return t},eS=!0,eD=null!=console.warn,eB=null!=console.trace,eA=Number.MAX_SAFE_INTEGER||9007199254740991,e_=function(){return!0},eM=function(){return!1},eR=function(){return 0},eI=function(){},eN=function(e){throw Error(e)},eL=function(e){if(void 0===e)return eS;eS=!!e},eO=function(e){eL()&&(eD?console.warn(e):(console.log(e),eB&&console.trace()))},ez=function(e){return null==e?e:A(e)?e.slice():_(e)?Q({},e):e},eF=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},eV={},eX=function(){return eV},ej=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},eY=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},eq=function(e){e.splice(0,e.length)},eW=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},eU=function(e,t,n){return n&&(t=q(n,t)),e[t]},eH=function(e,t,n,r){n&&(t=q(n,t)),e[t]=r},eG=a(function e(){i(this,e),this._obj={}},[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),eK="undefined"!=typeof Map?Map:eG,eZ=a(function e(t){if(i(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r<n.length;r++)this.add(n[r])}},[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),e$=("undefined"==typeof Set?"undefined":h(Set))!=="undefined"?Set:eZ,eQ=function(e,t){var n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!O(e)){eN("An element must have a core reference and parameters set");return}var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==r&&"edges"!==r){eN("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new e$,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 a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];A(t.classes)?l=t.classes:D(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var h=l[u];h&&""!==h&&i.classes.add(h)}this.createEmitter(),(void 0===n||n)&&this.restore();var d=t.style||t.css;d&&(eO("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d))},eJ=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){_(t)&&!I(t)&&(t=(i=t).roots||i.root,n=i.visit,r=i.directed),r=2!=arguments.length||B(n)?r:n,n=B(n)?n:function(){};for(var i,a,o,s=this._private.cy,l=t=D(t)?this.filter(t):t,u=[],c=[],h={},d={},f={},p=0,g=this.byGroup(),v=g.nodes,y=g.edges,b=0;b<l.length;b++){var x=l[b],w=x.id();x.isNode()&&(u.unshift(x),e.bfs&&(f[w]=!0,c.push(x)),d[w]=0)}for(;0!==u.length&&(0===(o=function(){var t,i=e.bfs?u.shift():u.pop(),o=i.id();if(e.dfs){if(f[o])return 0;f[o]=!0,c.push(i)}var s=d[o],l=h[o],g=null!=l?l.source():null,b=null!=l?l.target():null,x=null==l?void 0:i.same(g)?b[0]:g[0];if(!0===(t=n(i,l,x,p++,s)))return a=i,1;if(!1===t)return 1;for(var w=i.connectedEdges().filter(function(e){return(!r||e.source().same(i))&&y.has(e)}),E=0;E<w.length;E++){var T=w[E],k=T.connectedNodes().filter(function(e){return!e.same(i)&&v.has(e)}),C=k.id();0===k.length||f[C]||(k=k[0],u.push(k),e.bfs&&(f[C]=!0,c.push(k)),h[C]=T,d[C]=d[o]+1)}}())||1!==o););for(var E=s.collection(),T=0;T<c.length;T++){var k=c[T],C=h[k.id()];null!=C&&E.push(C),E.push(k)}return{path:s.collection(E),found:s.collection(a)}}},e0={breadthFirstSearch:eJ({bfs:!0}),depthFirstSearch:eJ({dfs:!0})};e0.bfs=e0.breadthFirstSearch,e0.dfs=e0.depthFirstSearch;var e1={exports:{}},e2=e1.exports,e5=es(oE?ow:(oE=1,ox||(ox=1,function(e,t){(function(){var t,n,r,i,a,o,s,l,u,c,h,d,f,p,g,v;r=Math.floor,c=Math.min,n=function(e,t){return e<t?-1:e>t?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw Error("lo must be non-negative");for(null==a&&(a=e.length);i<a;)0>o(t,e[s=r((i+a)/2)])?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return null==r&&(r=n),e.push(t),p(e,0,e.length-1,r)},a=function(e,t){var r,i;return null==t&&(t=n),r=e.pop(),e.length?(i=e[0],e[0]=r,g(e,0,t)):i=r,i},l=function(e,t,r){var i;return null==r&&(r=n),i=e[0],e[0]=t,g(e,0,r),i},s=function(e,t,r){var i;return null==r&&(r=n),e.length&&0>r(e[0],t)&&(t=(i=[e[0],t])[0],e[0]=i[1],g(e,0,r)),t},i=function(e,t){var i,a,o,s,l,u;for(null==t&&(t=n),s=(function(){u=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)u.push(t);return u}).apply(this).reverse(),l=[],a=0,o=s.length;a<o;a++)i=s[a],l.push(g(e,i,t));return l},f=function(e,t,r){var i;if(null==r&&(r=n),-1!==(i=e.indexOf(t)))return p(e,0,i,r),g(e,i,r)},h=function(e,t,r){var a,o,l,u;if(null==r&&(r=n),!(a=e.slice(0,t)).length)return a;for(i(a,r),o=0,l=(u=e.slice(t)).length;o<l;o++)s(a,u[o],r);return a.sort(r).reverse()},d=function(e,t,r){var o,s,l,h,d,f,p,g,v;if(null==r&&(r=n),10*t<=e.length){if(!(l=e.slice(0,t).sort(r)).length)return l;for(h=0,s=l[l.length-1],f=(p=e.slice(t)).length;h<f;h++)0>r(o=p[h],s)&&(u(l,o,0,null,r),l.pop(),s=l[l.length-1]);return l}for(i(e,r),v=[],d=0,g=c(t,e.length);0<=g?d<g:d>g;0<=g?++d:--d)v.push(a(e,r));return v},p=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t;){if(0>i(a,o=e[s=r-1>>1])){e[r]=o,r=s;continue}break}return e[r]=a},g=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i<a;)(s=i+1)<a&&!(0>r(e[i],e[s]))&&(i=s),e[t]=e[i],i=2*(t=i)+1;return e[t]=o,p(e,l,t,r)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=o,e.pop=a,e.replace=l,e.pushpop=s,e.heapify=i,e.updateItem=f,e.nlargest=h,e.nsmallest=d,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return f(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),v=function(){return t},e.exports=v()}).call(e2)}(e1)),ow=e1.exports)),e3=ej({root:null,weight:function(e){return 1},directed:!1}),e4=ej({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),e9=ej({weight:function(e){return 1},directed:!1}),e6=ej({weight:function(e){return 1},directed:!1,root:null}),e8=Math.sqrt(2),e7=function(e,t,n){0===n.length&&eN("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n.length-1;l>=0;l--){var u=n[l],c=u[1],h=u[2];(t[c]===o&&t[h]===s||t[c]===s&&t[h]===o)&&n.splice(l,1)}for(var d=0;d<n.length;d++){var f=n[d];f[1]===s?(n[d]=f.slice(),n[d][1]=o):f[2]===s&&(n[d]=f.slice(),n[d][2]=o)}for(var p=0;p<t.length;p++)t[p]===s&&(t[p]=o);return n},te=function(e,t,n,r){for(;n>r;)t=e7(Math.floor(Math.random()*t.length),e,t),n--;return t},tt=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},tn=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},tr=function(e){return{x:e[0],y:e[1]}},ti=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},ta=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},to=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},ts=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=!(arguments.length>5)||void 0===arguments[5]||arguments[5];r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?!isFinite(l)&&(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},tl=function(e,t){return Math.atan2(t,e)-Math.PI/2},tu=Math.log2||function(e){return Math.log(e)/Math.log(2)},tc=function(e){return e>0?1:e<0?-1:0},th=function(e,t){return Math.sqrt(td(e,t))},td=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},tf=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},tp=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},tg=function(e,t,n,r){return{x:tp(e.x,t.x,n.x,r),y:tp(e.y,t.y,n.y,r)}},tv=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=th(e,t),o={x:i.x/a,y:i.y/a};return n=null==n?0:n,r=null!=r?r:n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},ty=function(e,t,n){return Math.max(e,Math.min(n,t))},tm=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}}},tb=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},tx=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},tw=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},tE=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},tT=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=l(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tk=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},tC=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)},tP=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},tS=function(e,t){return tP(e,t.x1,t.y1)&&tP(e,t.x2,t.y2)},tD=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?t$(i,a):u,h=i/2,d=a/2,f=(c=Math.min(c,h,d))!==h,p=c!==d;if(f){var g=n-h+c-o,v=r-d-o,y=n+h-c+o;if((s=tq(e,t,n,r,g,v,y,v,!1)).length>0)return s}if(p){var b=n+h+o,x=r-d+c-o,w=r+d-c+o;if((s=tq(e,t,n,r,b,x,b,w,!1)).length>0)return s}if(f){var E=n-h+c-o,T=r+d+o,k=n+h-c+o;if((s=tq(e,t,n,r,E,T,k,T,!1)).length>0)return s}if(p){var C=n-h-o,P=r-d+c-o,S=r+d-c+o;if((s=tq(e,t,n,r,C,P,C,S,!1)).length>0)return s}var D=n-h+c,B=r-d+c;if((l=tj(e,t,n,r,D,B,c+o)).length>0&&l[0]<=D&&l[1]<=B)return[l[0],l[1]];var A=n+h-c,_=r-d+c;if((l=tj(e,t,n,r,A,_,c+o)).length>0&&l[0]>=A&&l[1]<=_)return[l[0],l[1]];var M=n+h-c,R=r+d-c;if((l=tj(e,t,n,r,M,R,c+o)).length>0&&l[0]>=M&&l[1]>=R)return[l[0],l[1]];var I=n-h+c,N=r+d-c;return(l=tj(e,t,n,r,I,N,c+o)).length>0&&l[0]<=I&&l[1]>=N?[l[0],l[1]]:[]},tB=function(e,t,n,r,i,a,o){var s=Math.min(n,i),l=Math.max(n,i),u=Math.min(r,a),c=Math.max(r,a);return s-o<=e&&e<=l+o&&u-o<=t&&t<=c+o},tA=function(e,t,n,r,i,a,o,s,l){var u={x1:Math.min(n,o,i)-l,x2:Math.max(n,o,i)+l,y1:Math.min(r,s,a)-l,y2:Math.max(r,s,a)+l};return!(e<u.x1)&&!(e>u.x2)&&!(t<u.y1)&&!(t>u.y2)},t_=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},tM=function(e,t,n,r,i){var a,o,s,l,u,c,h,d;if(0===e&&(e=1e-5),t/=e,n/=e,r/=e,a=(o=(3*n-t*t)/9)*o*o+(s=(-(27*r)+t*(9*n-t*t*2))/54)*s,i[1]=0,h=t/3,a>0){u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,0===a){d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}l=Math.acos(s/Math.sqrt(l=(o=-o)*o*o)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),i[4]=-h+d*Math.cos((l+4*Math.PI)/3)},tR=function(e,t,n,r,i,a,o,s){var l,u=[];tM(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,u);for(var c=[],h=0;h<6;h+=2)1e-7>Math.abs(u[h+1])&&u[h]>=0&&u[h]<=1&&c.push(u[h]);c.push(1),c.push(0);for(var d=-1,f=0;f<c.length;f++)l=Math.pow(Math.pow(1-c[f],2)*n+2*(1-c[f])*c[f]*i+c[f]*c[f]*o-e,2)+Math.pow(Math.pow(1-c[f],2)*r+2*(1-c[f])*c[f]*a+c[f]*c[f]*s-t,2),d>=0?l<d&&(d=l):d=l;return d},tI=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],h=c*c/l;return c<0?u:h>l?(e-i)*(e-i)+(t-a)*(t-a):u-h},tN=function(e,t,n){for(var r,i,a,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],i=n[2*l+1],l+1<n.length/2?(a=n[(l+1)*2],o=n[(l+1)*2+1]):(a=n[(l+1-n.length/2)*2],o=n[(l+1-n.length/2)*2+1]),r==e&&a==e);else{if((!(r>=e)||!(e>=a))&&(!(r<=e)||!(e<=a)))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},tL=function(e,t,n,r,i,a,o,s,l){var u,c=Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h=Math.cos(-u),d=Math.sin(-u),f=0;f<c.length/2;f++)c[2*f]=a/2*(n[2*f]*h-n[2*f+1]*d),c[2*f+1]=o/2*(n[2*f+1]*h+n[2*f]*d),c[2*f]+=r,c[2*f+1]+=i;return tN(e,t,l>0?tz(tF(c,-l)):c)},tO=function(e,t,n,r,i,a,o,s){for(var l=Array(2*n.length),u=0;u<s.length;u++){var c=s[u];if(l[4*u+0]=c.startX,l[4*u+1]=c.startY,l[4*u+2]=c.stopX,l[4*u+3]=c.stopY,Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2)<=Math.pow(c.radius,2))return!0}return tN(e,t,l)},tz=function(e){for(var t,n,r,i,a,o,s,l,u=Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],n=e[4*c+1],r=e[4*c+2],i=e[4*c+3],c<e.length/4-1?(a=e[(c+1)*4],o=e[(c+1)*4+1],s=e[(c+1)*4+2],l=e[(c+1)*4+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var h=tq(t,n,r,i,a,o,s,l,!0);u[2*c]=h[0],u[2*c+1]=h[1]}return u},tF=function(e,t){for(var n,r,i,a,o=Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(i=e[(s+1)*2],a=e[(s+1)*2+1]):(i=e[0],a=e[1]);var l=a-r,u=-(i-n),c=Math.sqrt(l*l+u*u),h=l/c,d=u/c;o[4*s]=n+h*t,o[4*s+1]=r+d*t,o[4*s+2]=i+h*t,o[4*s+3]=a+d*t}return o},tV=function(e,t,n,r,i,a){var o=n-e,s=r-t,l=Math.sqrt((o/=i)*o+(s/=a)*s),u=l-1;if(u<0)return[];var c=u/l;return[(n-e)*c+e,(r-t)*c+t]},tX=function(e,t,n,r,i,a,o){return e-=i,t-=a,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},tj=function(e,t,n,r,i,a,o){var s=[n-e,r-t],l=[e-i,t-a],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),h=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(h<0)return[];var d=(-c+Math.sqrt(h))/(2*u),f=(-c-Math.sqrt(h))/(2*u),p=Math.min(d,f),g=Math.max(d,f),v=[];if(p>=0&&p<=1&&v.push(p),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,b=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,b]:[y,b,v[1]*s[0]+e,v[1]*s[1]+t]:[y,b]},tY=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},tq=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,f=r-t,p=s-a,g=h*d-p*u,v=c*d-f*u,y=p*c-h*f;if(0!==y){var b=g/y,x=v/y;return -.001<=b&&b<=1.001&&-.001<=x&&x<=1.001?[e+b*c,t+b*f]:l?[e+b*c,t+b*f]:[]}return 0!==g&&0!==v?[]:tY(e,n,o)===o?[o,s]:tY(e,n,i)===i?[i,a]:tY(i,o,n)===n?[n,r]:[]},tW=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,f,p=[],g=Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y<g.length/2;y++)g[2*y]=n[2*y]*a+r,g[2*y+1]=n[2*y+1]*o+i;u=s>0?tz(tF(g,-s)):g}else u=n;for(var b=0;b<u.length/2;b++)c=u[2*b],h=u[2*b+1],b<u.length/2-1?(d=u[(b+1)*2],f=u[(b+1)*2+1]):(d=u[0],f=u[1]),0!==(l=tq(e,t,r,i,c,h,d,f)).length&&p.push(l[0],l[1]);return p},tU=function(e,t,n,r,i,a,o,s,l){var u,c=[],h=Array(2*n.length);l.forEach(function(n,a){0===a?(h[h.length-2]=n.startX,h[h.length-1]=n.startY):(h[4*a-2]=n.startX,h[4*a-1]=n.startY),h[4*a]=n.stopX,h[4*a+1]=n.stopY,0!==(u=tj(e,t,r,i,n.cx,n.cy,n.radius)).length&&c.push(u[0],u[1])});for(var d=0;d<h.length/4;d++)0!==(u=tq(e,t,r,i,h[4*d],h[4*d+1],h[4*d+2],h[4*d+3],!1)).length&&c.push(u[0],u[1]);if(c.length>2){for(var f=[c[0],c[1]],p=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),g=1;g<c.length/2;g++){var v=Math.pow(c[2*g]-e,2)+Math.pow(c[2*g+1]-t,2);v<=p&&(f[0]=c[2*g],f[1]=c[2*g+1],p=v)}return f}return c},tH=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},tG=function(e,t){return tK(tZ(e,t))},tK=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var u=2/(o-i),c=2/(s-a),h=0;h<r;h++)t=e[2*h]=e[2*h]*u,n=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var d=0;d<r;d++)n=e[2*d+1]=e[2*d+1]+(-1-a);return e},tZ=function(e,t){var n,r=1/e*2*Math.PI,i=e%2==0?Math.PI/2+r/2:Math.PI/2;i+=t;for(var a=Array(2*e),o=0;o<e;o++)n=o*r+i,a[2*o]=Math.cos(n),a[2*o+1]=Math.sin(-n);return a},t$=function(e,t){return Math.min(e/4,t/4,8)},tQ=function(e,t){return Math.min(e/10,t/10,8)},tJ=function(){return 8},t0=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},t1=ej({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),t2=ej({root:null,weight:function(e){return 1},directed:!1,alpha:0}),t5={degreeCentralityNormalized:function(e){e=t2(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<r;l++){var u=n[l],c=u.id();e.root=u;var h=this.degreeCentrality(e);o<h.indegree&&(o=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,a[c]=h.outdegree}return{indegree:function(e){return 0==o?0:(D(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(D(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var d={},f=0,p=0;p<r;p++){var g=n[p];e.root=g;var v=this.degreeCentrality(e);f<v.degree&&(f=v.degree),d[g.id()]=v.degree}return{degree:function(e){return 0===f?0:(D(e)&&(e=t.filter(e)),d[e.id()]/f)}}},degreeCentrality:function(e){e=t2(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),u=l.filter(function(e){return e.target().same(i)&&n.has(e)}),c=l.filter(function(e){return e.source().same(i)&&n.has(e)}),h=u.length,d=c.length,f=0,p=0,g=0;g<u.length;g++)f+=a(u[g]);for(var v=0;v<c.length;v++)p+=a(c[v]);return{indegree:Math.pow(h,1-s)*Math.pow(f,s),outdegree:Math.pow(d,1-s)*Math.pow(p,s)}}for(var y=i.connectedEdges().intersection(n),b=y.length,x=0,w=0;w<y.length;w++)x+=a(y[w]);return{degree:Math.pow(b,1-s)*Math.pow(x,s)}}};t5.dc=t5.degreeCentrality,t5.dcn=t5.degreeCentralityNormalised=t5.degreeCentralityNormalized;var t3=ej({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),t4={closenessCentralityNormalized:function(e){for(var t=t3(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:i}),c=0;c<l.length;c++){for(var h=0,d=l[c],f=0;f<l.length;f++)if(c!==f){var p=u.distance(d,l[f]);n?h+=1/p:h+=p}n||(h=1/h),s<h&&(s=h),o[d.id()]=h}return{closeness:function(e){return 0==s?0:o[e=D(e)?a.filter(e)[0].id():e.id()]/s}}},closenessCentrality:function(e){var t=t3(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var h=o.distanceTo(c);a?s+=1/h:s+=h}}return a?s:1/s}};t4.cc=t4.closenessCentrality,t4.ccn=t4.closenessCentralityNormalised=t4.closenessCentralityNormalized;var t9=ej({weight:null,directed:!1}),t6={betweennessCentrality:function(e){for(var t=t9(e),n=t.directed,r=t.weight,i=null!=r,a=this.cy(),o=this.nodes(),s={},l={},u=0,c={set:function(e,t){l[e]=t,t>u&&(u=t)},get:function(e){return l[e]}},h=0;h<o.length;h++){var d=o[h],f=d.id();n?s[f]=d.outgoers().nodes():s[f]=d.openNeighborhood().nodes(),c.set(f,0)}for(var p=0;p<o.length;p++)!function(){for(var e=o[p].id(),t=[],n={},l={},u={},h=new e5(function(e,t){return u[e]-u[t]}),d=0;d<o.length;d++){var f=o[d].id();n[f]=[],l[f]=0,u[f]=1/0}for(l[e]=1,u[e]=0,h.push(e);!h.empty();){var g=h.pop();if(t.push(g),i)for(var v=0;v<s[g].length;v++){var y=s[g][v],b=a.getElementById(g),x=r(b.edgesTo(y).length>0?b.edgesTo(y)[0]:y.edgesTo(b)[0]);u[y=y.id()]>u[g]+x&&(u[y]=u[g]+x,0>h.nodes.indexOf(y)?h.push(y):h.updateItem(y),l[y]=0,n[y]=[]),u[y]==u[g]+x&&(l[y]=l[y]+l[g],n[y].push(g))}else for(var w=0;w<s[g].length;w++){var E=s[g][w].id();u[E]==1/0&&(h.push(E),u[E]=u[g]+1),u[E]==u[g]+1&&(l[E]=l[E]+l[g],n[E].push(g))}}for(var T={},k=0;k<o.length;k++)T[o[k].id()]=0;for(;t.length>0;){for(var C=t.pop(),P=0;P<n[C].length;P++){var S=n[C][P];T[S]=T[S]+l[S]/l[C]*(1+T[C])}C!=o[p].id()&&c.set(C,c.get(C)+T[C])}}();var g={betweenness:function(e){var t=a.collection(e).id();return c.get(t)},betweennessNormalized:function(e){if(0==u)return 0;var t=a.collection(e).id();return c.get(t)/u}};return g.betweennessNormalised=g.betweennessNormalized,g}};t6.bc=t6.betweennessCentrality;var t8=ej({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),t7=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},ne=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},nt=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},nn=function(e,t,n){for(var r=Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},nr=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=nn(e,r,t);return e},ni=function(e,t,n){for(var r=Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return nt(r,t),r},na=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r)!=Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r))return!1;return!0},no=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},ns=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},nl=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&ns(e[t],e[n])&&e.splice(n,1);return e},nu=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=t8(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=Array(u),h=0;h<u;h++)c[h]=0;for(var d=0;d<n.length;d++){var f=n[d],p=a[f.source().id()],g=a[f.target().id()],v=t7(f,i.attributes);c[p*l+g]+=v,c[g*l+p]+=v}ne(c,l,i.multFactor),nt(c,l);for(var y=!0,b=0;y&&b<i.maxIterations;)y=!1,na(c=ni(s=nr(c,l,i.expandFactor),l,i.inflateFactor),s,u,4)||(y=!0),b++;return nl(no(c,l,t,r))},nc=function(e){return e},nh=function(e,t){return Math.abs(t-e)},nd=function(e,t,n){return e+nh(t,n)},nf=function(e,t,n){return e+Math.pow(n-t,2)},np=function(e){return Math.sqrt(e)},ng=function(e,t,n){return Math.max(e,nh(t,n))},nv=function(e,t,n,r,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:nc,o=r,s=0;s<e;s++)o=i(o,t(s),n(s));return a(o)},ny={euclidean:function(e,t,n){return e>=2?nv(e,t,n,0,nf,np):nv(e,t,n,0,nd)},squaredEuclidean:function(e,t,n){return nv(e,t,n,0,nf)},manhattan:function(e,t,n){return nv(e,t,n,0,nd)},max:function(e,t,n){return nv(e,t,n,-1/0,ng)}};function nm(e,t,n,r,i,a){var o;return(o=B(e)?e:ny[e]||ny.euclidean,0===t&&B(e))?o(i,a):o(t,n,r,i,a)}ny["squared-euclidean"]=ny.squaredEuclidean,ny.squaredeuclidean=ny.squaredEuclidean;var nb=ej({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),nx=function(e){return nb(e)},nw=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)};return nm(e,r.length,a,function(e){return r[e](t)},n,t)},nE=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,a[l]=e.max(n[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[u]=s}return o},nT=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=nw(n,e,t[s],r,i);l<a&&(a=l,o=s)}return o},nk=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)n[(i=t[a]).id()]===e&&r.push(i);return r},nC=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(Math.abs(e[r][i]-t[r][i])>n)return!1;return!0},nP=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},nS=function(e,t){var n=Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];nP(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},nD=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=nw("manhattan",t[i],e,n,"kMedoids");return r},nB=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],i.m);for(var u=0;u<e.length;u++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var h=0;h<t.length;h++)a+=r[h][u]*i.attributes[c](t[h]),o+=r[h][u];e[u][c]=a/o}},nA=function(e,t,n,r,i){for(var a,o=0;o<e.length;o++)t[o]=e[o].slice();for(var s=2/(i.m-1),l=0;l<n.length;l++)for(var u=0;u<r.length;u++){a=0;for(var c=0;c<n.length;c++)a+=Math.pow(nw(i.distance,r[u],n[l],i.attributes,"cmeans")/nw(i.distance,r[u],n[c],i.attributes,"cmeans"),s);e[u][l]=1/a}},n_=function(e,t,n,r){for(var i,a,o=Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var u=0;u<t[0].length;u++)t[l][u]>i&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c<o.length;c++)o[c]=r.collection(o[c]);return o},nM=function(e){var t,n,r,i,a=this.cy(),o=this.nodes(),s=nx(e);r=Array(o.length);for(var l=0;l<o.length;l++)r[l]=Array(s.k);n=Array(o.length);for(var u=0;u<o.length;u++)n[u]=Array(s.k);for(var c=0;c<o.length;c++){for(var h=0,d=0;d<s.k;d++)n[c][d]=Math.random(),h+=n[c][d];for(var f=0;f<s.k;f++)n[c][f]=n[c][f]/h}t=Array(s.k);for(var p=0;p<s.k;p++)t[p]=Array(s.attributes.length);i=Array(o.length);for(var g=0;g<o.length;g++)i[g]=Array(s.k);for(var v=!0,y=0;v&&y<s.maxIterations;)v=!1,nB(t,o,n,i,s),nA(n,r,t,o,s),nC(n,r,s.sensitivityThreshold)||(v=!0),y++;return{clusters:n_(o,n,s,a),degreeOfMembership:n}},nR=ej({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),nI={single:"min",complete:"max"},nN=function(e){var t=nR(e),n=nI[t.linkage];return null!=n&&(t.linkage=n),t},nL=function(e,t,n,r,i){for(var a,o,s=0,l=1/0,u=i.attributes,c=function(e,t){return nm(i.distance,u.length,function(t){return u[t](e)},function(e){return u[e](t)},e,t)},h=0;h<e.length;h++){var d=e[h].key,f=n[d][r[d]];f<l&&(s=d,l=f)}if("threshold"===i.mode&&l>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p=t[s],g=t[r[s]];o="dendrogram"===i.mode?{left:p,right:g,key:p.key}:{value:p.value.concat(g.value),key:p.key},e[p.index]=o,e.splice(g.index,1),t[p.key]=o;for(var v=0;v<e.length;v++){var y=e[v];p.key===y.key?a=1/0:"min"===i.linkage?(a=n[p.key][y.key],n[p.key][y.key]>n[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[p.key][y.key],n[p.key][y.key]<n[g.key][y.key]&&(a=n[g.key][y.key])):a="mean"===i.linkage?(n[p.key][y.key]*p.size+n[g.key][y.key]*g.size)/(p.size+g.size):"dendrogram"===i.mode?c(y.value,p.value):c(y.value[0],p.value[0]),n[p.key][y.key]=n[y.key][p.key]=a}for(var b=0;b<e.length;b++){var x=e[b].key;if(r[x]===p.key||r[x]===g.key){for(var w=x,E=0;E<e.length;E++){var T=e[E].key;n[x][T]<n[x][w]&&(w=T)}r[x]=w}e[b].index=b}return p.key=g.key=p.index=g.index=null,!0},nO=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&nO(e.left,t),e.right&&nO(e.right,t)))},nz=function(e,t){if(!e)return"";if(e.left&&e.right){var n=nz(e.left,t),r=nz(e.right,t),i=t.add({group:"nodes",data:{id:n+","+r}});return t.add({group:"edges",data:{source:n,target:i.id()}}),t.add({group:"edges",data:{source:r,target:i.id()}}),i.id()}if(e.value)return e.value.id()},nF=function(e,t,n){if(!e)return[];var r=[],i=[],a=[];return 0===t?(e.left&&nO(e.left,r),e.right&&nO(e.right,i),a=r.concat(i),[n.collection(a)]):1===t?e.value?[n.collection(e.value)]:(e.left&&nO(e.left,r),e.right&&nO(e.right,i),[n.collection(r),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(r=nF(e.left,t-1,n)),e.right&&(i=nF(e.right,t-1,n)),r.concat(i))},nV=function(e){for(var t,n=this.cy(),r=this.nodes(),i=nN(e),a=i.attributes,o=function(e,t){return nm(i.distance,a.length,function(t){return a[t](e)},function(e){return a[e](t)},e,t)},s=[],l=[],u=[],c=[],h=0;h<r.length;h++){var d={value:"dendrogram"===i.mode?r[h]:[r[h]],key:h,index:h};s[h]=d,c[h]=d,l[h]=[],u[h]=0}for(var f=0;f<s.length;f++)for(var p=0;p<=f;p++){var g=void 0;g="dendrogram"===i.mode?f===p?1/0:o(s[f].value,s[p].value):f===p?1/0:o(s[f].value[0],s[p].value[0]),l[f][p]=g,l[p][f]=g,g<l[f][u[f]]&&(u[f]=p)}for(var v=nL(s,c,l,u,i);v;)v=nL(s,c,l,u,i);return"dendrogram"===i.mode?(t=nF(s[0],i.dendrogramDepth,n),i.addDendrogram&&nz(s[0],n)):(t=Array(s.length),s.forEach(function(e,r){e.key=e.index=null,t[r]=n.collection(e.value)})),t},nX=ej({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),nj=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||eN("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some(function(e){return e===n})||M(n)||eN("Preference must be one of [".concat(r.map(function(e){return"'".concat(e,"'")}).join(", "),"] or a number. Got: ").concat(n)),nX(e)},nY=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-nm(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},nq=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},nW=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},nU=function(e,t,n){for(var r=nW(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,l=-1/0,u=0;u<a.length;u++){for(var c=0,h=0;h<a.length;h++)c+=t[a[h]*e+a[u]];c>l&&(s=u,l=c)}n[i]=a[s]}return nW(e,t,n)},nH=function(e){for(var t,n,r,i,a,o,s,l,u,c=this.cy(),h=this.nodes(),d=nj(e),f={},p=0;p<h.length;p++)f[h[p].id()]=p;a=Array(i=(r=h.length)*r);for(var g=0;g<i;g++)a[g]=-1/0;for(var v=0;v<r;v++)for(var y=0;y<r;y++)v!==y&&(a[v*r+y]=nY(d.distance,h[v],h[y],d.attributes));t=a,o="median"===(n=d.preference)?ts(t):"mean"===n?to(t):"min"===n?ti(t):"max"===n?ta(t):n;for(var b=0;b<r;b++)a[b*r+b]=o;s=Array(i);for(var x=0;x<i;x++)s[x]=0;l=Array(i);for(var w=0;w<i;w++)l[w]=0;for(var E=Array(r),T=Array(r),k=Array(r),C=0;C<r;C++)E[C]=0,T[C]=0,k[C]=0;for(var P=Array(r*d.minIterations),S=0;S<P.length;S++)P[S]=0;for(u=0;u<d.maxIterations;u++){for(var D=0;D<r;D++){for(var B=-1/0,A=-1/0,_=-1,M=0,R=0;R<r;R++)E[R]=s[D*r+R],(M=l[D*r+R]+a[D*r+R])>=B?(A=B,B=M,_=R):M>A&&(A=M);for(var I=0;I<r;I++)s[D*r+I]=(1-d.damping)*(a[D*r+I]-B)+d.damping*E[I];s[D*r+_]=(1-d.damping)*(a[D*r+_]-A)+d.damping*E[_]}for(var N=0;N<r;N++){for(var L=0,O=0;O<r;O++)E[O]=l[O*r+N],T[O]=Math.max(0,s[O*r+N]),L+=T[O];L-=T[N],T[N]=s[N*r+N],L+=T[N];for(var z=0;z<r;z++)l[z*r+N]=(1-d.damping)*Math.min(0,L-T[z])+d.damping*E[z];l[N*r+N]=(1-d.damping)*(L-T[N])+d.damping*E[N]}for(var F=0,V=0;V<r;V++){var X=l[V*r+V]+s[V*r+V]>0?1:0;P[u%d.minIterations*r+V]=X,F+=X}if(F>0&&(u>=d.minIterations-1||u==d.maxIterations-1)){for(var j=0,Y=0;Y<r;Y++){k[Y]=0;for(var q=0;q<d.minIterations;q++)k[Y]+=P[q*r+Y];(0===k[Y]||k[Y]===d.minIterations)&&j++}if(j===r)break}}for(var W=nq(r,s,l),U=nU(r,a,W),H={},G=0;G<W.length;G++)H[W[G]]=[];for(var K=0;K<h.length;K++){var Z=U[f[h[K].id()]];null!=Z&&H[Z].push(h[K])}for(var $=Array(W.length),Q=0;Q<W.length;Q++)$[Q]=c.collection(H[W[Q]]);return $},nG=ej({root:void 0,directed:!1}),nK=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],l=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach(function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter(function(e){return e.isLoop()})):l.merge(i)})}),i.push(l)},l=function(u,c,h){u===h&&(r+=1),t[c]={id:n,low:n++,cutVertex:!1};var d,f,p,g,v=e.getElementById(c).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(c))):v.forEach(function(e){d=e.source().id(),f=e.target().id(),(p=d===c?f:d)!==h&&(o[g=e.id()]||(o[g]=!0,a.push({x:c,y:p,edge:e})),p in t?t[c].low=Math.min(t[c].low,t[p].id):(l(u,p,c),t[c].low=Math.min(t[c].low,t[p].low),t[c].id<=t[p].low&&(t[c].cutVertex=!0,s(c,p))))})};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,l(n,n),t[n].cutVertex=r>1)}});var u=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(u),components:i}},nZ=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n===s||(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),h=l.merge(c);r.push(h),a=a.difference(h)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},n$={};[e0,{dijkstra:function(e){if(!_(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=e3(e),r=n.root,i=n.weight,a=n.directed,o=this,s=D(r)?this.filter(r)[0]:r[0],l={},u={},c={},h=this.byGroup(),d=h.nodes,f=h.edges;f.unmergeBy(function(e){return e.isLoop()});for(var p=function(e){return l[e.id()]},g=new e5(function(e,t){return p(e)-p(t)}),v=0;v<d.length;v++){var y=d[v];l[y.id()]=y.same(s)?0:1/0,g.push(y)}for(;g.size()>0;){var b=g.pop(),x=p(b);if(c[b.id()]=x,x!==1/0)for(var w=b.neighborhood().intersect(d),E=0;E<w.length;E++){var T=w[E],k=T.id(),C=function(e,t){for(var n,r=(a?e.edgesTo(t):e.edgesWith(t)).intersect(f),o=1/0,s=0;s<r.length;s++){var l=r[s],u=i(l);(u<o||!n)&&(o=u,n=l)}return{edge:n,dist:o}}(b,T),P=x+C.dist;P<p(T)&&(l[T.id()]=P,g.updateItem(T),u[k]={node:b,edge:C.edge})}}return{distanceTo:function(e){return c[(D(e)?d.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=D(e)?d.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);u[i];){var a=u[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},{kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},s=0;s<i;s++)a[s]=this.spawn(n[s]);for(var l=r.sort(function(t,n){return e(t)-e(n)}),u=0;u<l.length;u++){var c=l[u],h=c.source()[0],d=c.target()[0],f=o(h),p=o(d),g=a[f],v=a[p];f!==p&&(n.merge(c),g.merge(v),a.splice(p,1))}return n}},{aStar:function(e){var t,n,r=this.cy(),i=e4(e),a=i.root,o=i.goal,s=i.heuristic,l=i.directed,u=i.weight;a=r.collection(a)[0],o=r.collection(o)[0];var c=a.id(),h=o.id(),d={},f={},p={},g=new e5(function(e,t){return f[e.id()]-f[t.id()]}),v=new e$,y={},b={},x=function(e,t){g.push(e),v.add(t)};x(a,c),d[c]=0,f[c]=s(a);for(var w=0;g.size()>0;){if(n=(t=g.pop()).id(),v.delete(n),w++,n===h){for(var E=[],T=o,k=h,C=b[k];E.unshift(T),null!=C&&E.unshift(C),null!=(T=y[k]);)C=b[k=T.id()];return{found:!0,distance:d[n],path:this.spawn(E),steps:w}}p[n]=!0;for(var P=t._private.edges,S=0;S<P.length;S++){var D=P[S];if(this.hasElementWithId(D.id())&&(!l||D.data("source")===n)){var B=D.source(),A=D.target(),_=B.id()!==n?B:A,M=_.id();if(this.hasElementWithId(M)&&!p[M]){var R=d[n]+u(D);if(!v.has(M)){d[M]=R,f[M]=R+s(_),x(_,M),y[M]=t,b[M]=D;continue}R<d[M]&&(d[M]=R,f[M]=R+s(_),y[M]=t,b[M]=D)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},{floydWarshall:function(e){for(var t=this.cy(),n=e9(e),r=n.weight,i=n.directed,a=this.byGroup(),o=a.nodes,s=a.edges,l=o.length,u=l*l,c=function(e){return o.indexOf(e)},h=function(e){return o[e]},d=Array(u),f=0;f<u;f++){var p=f%l;(f-p)/l===p?d[f]=0:d[f]=1/0}for(var g=Array(u),v=Array(u),y=0;y<s.length;y++){var b=s[y],x=b.source()[0],w=b.target()[0];if(x!==w){var E=c(x),T=c(w),k=E*l+T,C=r(b);if(d[k]>C&&(d[k]=C,g[k]=T,v[k]=b),!i){var P=T*l+E;!i&&d[P]>C&&(d[P]=C,g[P]=E,v[P]=b)}}}for(var S=0;S<l;S++)for(var B=0;B<l;B++)for(var A=B*l+S,_=0;_<l;_++){var M=B*l+_,R=S*l+_;d[A]+d[R]<d[M]&&(d[M]=d[A]+d[R],g[M]=g[A])}var I=function(e){return c((D(e)?t.filter(e):e)[0])};return{distance:function(e,t){return d[I(e)*l+I(t)]},path:function(e,n){var r,i=I(e),a=I(n),o=h(i);if(i===a)return o.collection();if(null==g[i*l+a])return t.collection();var s=t.collection(),u=i;for(s.merge(o);i!==a;)u=i,i=g[i*l+a],r=v[u*l+i],s.merge(r),s.merge(h(i));return s}}}},{bellmanFord:function(e){var t=this,n=e6(e),r=n.weight,i=n.directed,a=n.root,o=this,s=this.cy(),l=this.byGroup(),u=l.edges,c=l.nodes,h=c.length,d=new eK,f=!1,p=[];a=s.collection(a)[0],u.unmergeBy(function(e){return e.isLoop()});for(var g=u.length,v=function(e){var t=d.get(e.id());return t||(t={},d.set(e.id(),t)),t},y=function(e){return(D(e)?s.$(e):e)[0]},b=0;b<h;b++){var x=c[b],w=v(x);x.same(a)?w.dist=0:w.dist=1/0,w.pred=null,w.edge=null}for(var E=!1,T=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,E=!0)},k=1;k<h;k++){E=!1;for(var C=0;C<g;C++){var P=u[C],S=P.source(),B=P.target(),A=r(P),_=v(S),M=v(B);T(S,B,P,_,M,A),i||T(B,S,P,M,_,A)}if(!E)break}if(E)for(var R=[],I=0;I<g;I++){var N=u[I],L=N.source(),O=N.target(),z=r(N),F=v(L).dist,V=v(O).dist;if(F+z<V||!i&&V+z<F){if(f||(eO("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),!1!==e.findNegativeWeightCycles){var X=[];F+z<V&&X.push(L),!i&&V+z<F&&X.push(O);for(var j=X.length,Y=0;Y<j;Y++){var q=X[Y],W=[q];W.push(v(q).edge);for(var U=v(q).pred;-1===W.indexOf(U);)W.push(U),W.push(v(U).edge),U=v(U).pred;for(var H=(W=W.slice(W.indexOf(U)))[0].id(),G=0,K=2;K<W.length;K+=2)W[K].id()<H&&(H=W[K].id(),G=K);(W=W.slice(G).concat(W.slice(0,G))).push(W[0]);var Z=W.map(function(e){return e.id()}).join(",");-1===R.indexOf(Z)&&(p.push(o.spawn(W)),R.push(Z))}}else break}}return{distanceTo:function(e){return v(y(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=y(e),i=[],s=r;;){if(null==s)return t.spawn();var l=v(s),u=l.edge,c=l.pred;if(i.unshift(s[0]),s.same(n)&&i.length>0)break;null!=u&&i.unshift(u),s=c}return o.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:p}}},{kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/e8);if(i<2){eN("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],u=0;u<a;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}for(var h=1/0,d=[],f=Array(i),p=Array(i),g=Array(i),v=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},y=0;y<=o;y++){for(var b=0;b<i;b++)p[b]=b;var x=te(p,l.slice(),i,s),w=x.slice();v(p,g);var E=te(p,x,s,2),T=te(g,w,s,2);E.length<=T.length&&E.length<h?(h=E.length,d=E,v(p,f)):T.length<=E.length&&T.length<h&&(h=T.length,d=T,v(g,f))}for(var k=this.spawn(d.map(function(e){return r[e[0]]})),C=this.spawn(),P=this.spawn(),S=f[0],D=0;D<f.length;D++){var B=f[D],A=n[D];B===S?C.merge(A):P.merge(A)}var _=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!k.contains(t)&&n.merge(t)})}),n};return{cut:k,components:[_(C),_(P)],partition1:C,partition2:P}}},{pageRank:function(e){for(var t,n=t1(e),r=n.dampingFactor,i=n.precision,a=n.iterations,o=n.weight,s=this._private.cy,l=this.byGroup(),u=l.nodes,c=l.edges,h=u.length,d=h*h,f=c.length,p=Array(d),g=Array(h),v=(1-r)/h,y=0;y<h;y++){for(var b=0;b<h;b++)p[y*h+b]=0;g[y]=0}for(var x=0;x<f;x++){var w=c[x],E=w.data("source"),T=w.data("target");if(E!==T){var k=u.indexOfId(E),C=u.indexOfId(T),P=o(w),S=C*h+k;p[S]+=P,g[k]+=P}}for(var D=1/h+v,B=0;B<h;B++)if(0===g[B])for(var A=0;A<h;A++)p[A*h+B]=D;else for(var _=0;_<h;_++){var M=_*h+B;p[M]=p[M]/g[B]+v}for(var R=Array(h),I=Array(h),N=0;N<h;N++)R[N]=1;for(var L=0;L<a;L++){for(var O=0;O<h;O++)I[O]=0;for(var z=0;z<h;z++)for(var F=0;F<h;F++){var V=z*h+F;I[z]+=p[V]*R[F]}tf(I),t=R,R=I,I=t;for(var X=0,j=0;j<h;j++){var Y=t[j]-R[j];X+=Y*Y}if(X<i)break}return{rank:function(e){return e=s.collection(e)[0],R[u.indexOf(e)]}}}},t5,t4,t6,{markovClustering:nu,mcl:nu},{kMeans:function(e){var t,n=this.cy(),r=this.nodes(),i=null,a=nx(e),o=Array(a.k),s={};a.testMode?"number"==typeof a.testCentroids?(a.testCentroids,t=nE(r,a.k,a.attributes)):t="object"===h(a.testCentroids)?a.testCentroids:nE(r,a.k,a.attributes):t=nE(r,a.k,a.attributes);for(var l=!0,u=0;l&&u<a.maxIterations;){for(var c=0;c<r.length;c++)s[(i=r[c]).id()]=nT(i,t,a.distance,a.attributes,"kMeans");l=!1;for(var d=0;d<a.k;d++){var f=nk(d,r,s);if(0!==f.length){for(var p=a.attributes.length,g=t[d],v=Array(p),y=Array(p),b=0;b<p;b++){y[b]=0;for(var x,w=0;w<f.length;w++)i=f[w],y[b]+=a.attributes[b](i);v[b]=y[b]/f.length,x=v[b],Math.abs(g[b]-x)<=a.sensitivityThreshold||(l=!0)}t[d]=v,o[d]=n.collection(f)}}u++}return o},kMedoids:function(e){var t,n,r=this.cy(),i=this.nodes(),a=null,o=nx(e),s=Array(o.k),l={},u=Array(o.k);o.testMode?"number"==typeof o.testCentroids||(t="object"===h(o.testCentroids)?o.testCentroids:nS(i,o.k)):t=nS(i,o.k);for(var c=!0,d=0;c&&d<o.maxIterations;){for(var f=0;f<i.length;f++)l[(a=i[f]).id()]=nT(a,t,o.distance,o.attributes,"kMedoids");c=!1;for(var p=0;p<t.length;p++){var g=nk(p,i,l);if(0!==g.length){u[p]=nD(t[p],g,o.attributes);for(var v=0;v<g.length;v++)(n=nD(g[v],g,o.attributes))<u[p]&&(u[p]=n,t[p]=g[v],c=!0);s[p]=r.collection(g)}}d++}return s},fuzzyCMeans:nM,fcm:nM},{hierarchicalClustering:nV,hca:nV},{affinityPropagation:nH,ap:nH},{hierholzer:function(e){if(!_(e)){var t,n,r,i=arguments;e={root:i[0],directed:i[1]}}var a=nG(e),o=a.root,s=a.directed,l=!1;o&&(r=D(o)?this.filter(o)[0].id():o[0].id());var u={},c={};s?this.forEach(function(e){var r=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?t?l=!0:t=r:1==s?n?l=!0:n=r:(s>1||o>1)&&(l=!0),u[r]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[r].push(e.id())})}else c[r]=[void 0,e.target().id()]}):this.forEach(function(e){var r=e.id();e.isNode()?(e.degree(!0)%2&&(t?n?l=!0:n=r:t=r),u[r]=[],e.connectedEdges().forEach(function(e){return u[r].push(e.id())})):c[r]=[e.source().id(),e.target().id()]});var h={found:!1,trail:void 0};if(l)return h;if(n&&t){if(s){if(r&&n!=r)return h;r=n}else{if(r&&n!=r&&t!=r)return h;r||(r=n)}}else r||(r=this[0].id());var d=function(e){for(var t,n,r,i=e,a=[e];u[i].length;)n=c[t=u[i].shift()][0],i!=(r=c[t][1])?(u[r]=u[r].filter(function(e){return e!=t}),i=r):s||i==n||(u[n]=u[n].filter(function(e){return e!=t}),i=n),a.unshift(t),a.unshift(i);return a},f=[],p=[];for(p=d(r);1!=p.length;)0==u[p[0]].length?(f.unshift(this.getElementById(p.shift())),f.unshift(this.getElementById(p.shift()))):p=d(p.shift()).concat(p);for(var g in f.unshift(this.getElementById(p.shift())),u)if(u[g].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:nK,htbc:nK,htb:nK,hopcroftTarjanBiconnectedComponents:nK},{tarjanStronglyConnected:nZ,tsc:nZ,tscc:nZ,tarjanStronglyConnectedComponents:nZ}].forEach(function(e){Q(n$,e)});var nQ=function(e){if(!(this instanceof nQ))return new nQ(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))};nQ.prototype={fulfill:function(e){return nJ(this,1,"fulfillValue",e)},reject:function(e){return nJ(this,2,"rejectReason",e)},then:function(e,t){var n=new nQ;return this.onFulfilled.push(n2(e,n,"fulfill")),this.onRejected.push(n2(t,n,"reject")),n0(this),n.proxy}};var nJ=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,n0(e)),e},n0=function(e){1===e.state?n1(e,"onFulfilled",e.fulfillValue):2===e.state&&n1(e,"onRejected",e.rejectReason)},n1=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},n2=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){t.reject(e);return}n5(t,i)}}},n5=function(e,t){if(e===t||e.proxy===t){e.reject(TypeError("cannot resolve promise with itself"));return}if("object"===h(t)&&null!==t||"function"==typeof t)try{n=t.then}catch(t){e.reject(t);return}if("function"==typeof n){var n,r=!1;try{n.call(t,function(n){r||(r=!0,n===t?e.reject(TypeError("circular thenable chain")):n5(e,n))},function(t){r||(r=!0,e.reject(t))})}catch(t){r||e.reject(t)}return}e.fulfill(t)};nQ.all=function(e){return new nQ(function(t,n){for(var r=Array(e.length),i=0,a=function(n,a){r[n]=a,++i===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then(function(e){a(t,e)},function(e){n(e)}):a(t,r)}(o)})},nQ.resolve=function(e){return new nQ(function(t,n){t(e)})},nQ.reject=function(e){return new nQ(function(t,n){n(e)})};var n3="undefined"!=typeof Promise?Promise:nQ,n4=function(e,t,n){var r=O(e),i=this._private=Q({duration:1e3},t,n);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&B(i.complete)&&i.completes.push(i.complete),!r){var a=e.position();i.startPosition=i.startPosition||{x:a.x,y:a.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(r){var o=e.pan();i.startPan={x:o.x,y:o.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},n9=n4.prototype;function n6(){return ok?oT:(ok=1,oT=Array.isArray)}function n8(){if(oV)return oF;oV=1;var e=function(){if(oL)return oN;oL=1;var e=function(){if(oD)return oS;oD=1;var e=eh(),t=el();return oS=function(n){if(!t(n))return!1;var r=e(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}(),t=function(){if(oM)return o_;oM=1;var e,t=oA?oB:(oA=1,oB=eu()["__core-js_shared__"]),n=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return o_=function(e){return!!n&&n in e}}(),n=el(),r=function(){if(oI)return oR;oI=1;var e=Function.prototype.toString;return oR=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}(),i=/^\[object .+?Constructor\]$/,a=Object.prototype,o=Function.prototype.toString,s=a.hasOwnProperty,l=RegExp("^"+o.call(s).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return oN=function(a){return!(!n(a)||t(a))&&(e(a)?l:i).test(r(a))}}(),t=oz?oO:(oz=1,oO=function(e,t){return null==e?void 0:e[t]});return oF=function(n,r){var i=t(n,r);return e(i)?i:void 0}}function n7(){return oj?oX:(oj=1,oX=n8()(Object,"create"))}function re(){return o3?o5:(o3=1,o5=function(e,t){return e===t||e!=e&&t!=t})}function rt(){if(o9)return o4;o9=1;var e=re();return o4=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return -1}}function rn(){if(sp)return sf;sp=1;var e=sd?sh:(sd=1,sh=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return sf=function(t,n){var r=t.__data__;return e(n)?r["string"==typeof n?"string":"hash"]:r.map}}function rr(){if(sA)return sB;sA=1;var e=function(){if(sD)return sS;sD=1;var e=function(){if(sP)return sC;sP=1;var e=function(){if(sk)return sT;sk=1;var e=function(){if(sc)return su;sc=1;var e=function(){if(o0)return oJ;o0=1;var e=function(){if(oq)return oY;oq=1;var e=n7();return oY=function(){this.__data__=e?e(null):{},this.size=0}}(),t=oU?oW:(oU=1,oW=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}),n=function(){if(oG)return oH;oG=1;var e=n7(),t=Object.prototype.hasOwnProperty;return oH=function(n){var r=this.__data__;if(e){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return t.call(r,n)?r[n]:void 0}}(),r=function(){if(oZ)return oK;oZ=1;var e=n7(),t=Object.prototype.hasOwnProperty;return oK=function(n){var r=this.__data__;return e?void 0!==r[n]:t.call(r,n)}}(),i=function(){if(oQ)return o$;oQ=1;var e=n7();return o$=function(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=e&&void 0===n?"__lodash_hash_undefined__":n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,oJ=a}(),t=function(){if(so)return sa;so=1;var e=o2?o1:(o2=1,o1=function(){this.__data__=[],this.size=0}),t=function(){if(o8)return o6;o8=1;var e=rt(),t=Array.prototype.splice;return o6=function(n){var r=this.__data__,i=e(r,n);return!(i<0)&&(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}}(),n=function(){if(se)return o7;se=1;var e=rt();return o7=function(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}}(),r=function(){if(sn)return st;sn=1;var e=rt();return st=function(t){return e(this.__data__,t)>-1}}(),i=function(){if(si)return sr;si=1;var e=rt();return sr=function(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,sa=a}(),n=sl?ss:(sl=1,ss=n8()(eu(),"Map"));return su=function(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}}(),t=function(){if(sv)return sg;sv=1;var e=rn();return sg=function(t){var n=e(this,t).delete(t);return this.size-=n?1:0,n}}(),n=function(){if(sm)return sy;sm=1;var e=rn();return sy=function(t){return e(this,t).get(t)}}(),r=function(){if(sx)return sb;sx=1;var e=rn();return sb=function(t){return e(this,t).has(t)}}(),i=function(){if(sE)return sw;sE=1;var e=rn();return sw=function(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,sT=a}();function t(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw TypeError("Expected a function");var i=function(){var e=arguments,t=r?r.apply(this,e):e[0],a=i.cache;if(a.has(t))return a.get(t);var o=n.apply(this,e);return i.cache=a.set(t,o)||a,o};return i.cache=new(t.Cache||e),i}return t.Cache=e,sC=t}();return sS=function(t){var n=e(t,function(e){return 500===r.size&&r.clear(),e}),r=n.cache;return n}}(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return sB=e(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,"$1"):t||e)}),r})}function ri(){return sM?s_:(sM=1,s_=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i})}function ra(){if(sL)return sN;sL=1;var e=function(){if(sI)return sR;sI=1;var e=ec(),t=ri(),n=n6(),r=ed(),i=e?e.prototype:void 0,a=i?i.toString:void 0;return sR=function e(i){if("string"==typeof i)return i;if(n(i))return t(i,e)+"";if(r(i))return a?a.call(i):"";var o=i+"";return"0"==o&&1/i==-1/0?"-0":o}}();return sN=function(t){return null==t?"":e(t)}}function ro(){if(sz)return sO;sz=1;var e=n6(),t=function(){if(oP)return oC;oP=1;var e=n6(),t=ed(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return oC=function(i,a){if(e(i))return!1;var o=typeof i;return!!("number"==o||"symbol"==o||"boolean"==o||null==i||t(i))||r.test(i)||!n.test(i)||null!=a&&i in Object(a)}}(),n=rr(),r=ra();return sO=function(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}}function rs(){if(sV)return sF;sV=1;var e=ed();return sF=function(t){if("string"==typeof t||e(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}}Q(n9,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),I(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;return t="frame"===e?n.frames:n.completes,new n3(function(e,n){t.push(function(){e()})})}}),n9.complete=n9.completed,n9.run=n9.play,n9.running=n9.playing;var rl=es(function(){if(sq)return sY;sq=1;var e=function(){if(sj)return sX;sj=1;var e=ro(),t=rs();return sX=function(n,r){r=e(r,n);for(var i=0,a=r.length;null!=n&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}}();return sY=function(t,n,r){var i=null==t?void 0:e(t,n);return void 0===i?r:i}}()),ru=es(function(){if(s2)return s1;s2=1;var e=function(){if(s0)return sJ;s0=1;var e=function(){if(sZ)return sK;sZ=1;var e=function(){if(sG)return sH;sG=1;var e=function(){if(sU)return sW;sU=1;var e=n8();return sW=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(e){}}()}();return sH=function(t,n,r){"__proto__"==n&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}}(),t=re(),n=Object.prototype.hasOwnProperty;return sK=function(r,i,a){var o=r[i];n.call(r,i)&&t(o,a)&&(void 0!==a||i in r)||e(r,i,a)}}(),t=ro(),n=function(){if(sQ)return s$;sQ=1;var e=/^(?:0|[1-9]\d*)$/;return s$=function(t,n){var r=typeof t;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&e.test(t))&&t>-1&&t%1==0&&t<n}}(),r=el(),i=rs();return sJ=function(a,o,s,l){if(!r(a))return a;o=t(o,a);for(var u=-1,c=o.length,h=c-1,d=a;null!=d&&++u<c;){var f=i(o[u]),p=s;if("__proto__"===f||"constructor"===f||"prototype"===f)break;if(u!=h){var g=d[f];void 0===(p=l?l(g,f,d):void 0)&&(p=r(g)?g:n(o[u+1])?[]:{})}e(d,f,p),d=d[f]}return a}}();return s1=function(t,n,r){return null==t?t:e(t,n,r)}}()),rc=es(function(){if(s9)return s4;s9=1;var e=ri(),t=s3?s5:(s3=1,s5=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}),n=n6(),r=ed(),i=rr(),a=rs(),o=ra();return s4=function(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}}()),rh={};[{animated:function(){return function(){var e=void 0!==this.length;if(!(this._private.cy||this).styleEnabled())return!1;var t=(e?this:[this])[0];if(t)return t._private.animation.current.length>0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t<e.length;t++)e[t]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=void 0!==this.length,r=n?this:[this],i=this._private.cy||this,a=!n,o=!a;if(!i.styleEnabled())return this;var s=i.style();if(0===Object.keys(e=Q({},e,t)).length)return new n4(r[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(o&&(e.style=s.getPropsList(e.style||e.css),e.css=void 0),o&&null!=e.renderedPosition){var l=e.renderedPosition,u=i.pan(),c=i.zoom();e.position=tn(l,c,u)}if(a&&null!=e.panBy){var h=e.panBy,d=i.pan();e.pan={x:d.x+h.x,y:d.y+h.y}}var f=e.center||e.centre;if(a&&null!=f){var p=i.getCenterPan(f.eles,e.zoom);null!=p&&(e.pan=p)}if(a&&null!=e.fit){var g=e.fit,v=i.getFitViewport(g.eles||g.boundingBox,g.padding);null!=v&&(e.pan=v.pan,e.zoom=v.zoom)}if(a&&_(e.zoom)){var y=i.getZoomedViewport(e.zoom);null!=y?(y.zoomed&&(e.zoom=y.zoom),y.panned&&(e.pan=y.pan)):e.zoom=null}return new n4(r[0],e)}},animate:function(){return function(e,t){var n=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=Q({},e,t));for(var r=0;r<n.length;r++){var i=n[r],a=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,a?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=void 0!==this.length?this:[this],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var i=0;i<n.length;i++){for(var a=n[i]._private,o=a.animation.current,s=0;s<o.length;s++){var l=o[s]._private;t&&(l.duration=0)}e&&(a.animation.queue=[]),t||(a.animation.current=[])}return r.notify("draw"),this}}},{data:function(e){return e=Q({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r,i=e,a=void 0!==this.length,o=a?this:[this],l=a?this[0]:this;if(D(t)){var u,c=-1!==t.indexOf(".")&&rc(t);if(i.allowGetting&&void 0===n)return l&&(i.beforeGet(l),u=c&&void 0===l._private[i.field][t]?rl(l._private[i.field],c):l._private[i.field][t]),u;if(i.allowSetting&&void 0!==n&&!i.immutableKeys[t]){var h=s({},t,n);i.beforeSet(this,h);for(var d=0,f=o.length;d<f;d++){var p=o[d];i.canSet(p)&&(c&&void 0===l._private[i.field][t]?ru(p._private[i.field],c,n):p._private[i.field][t]=n)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}}else if(i.allowSetting&&_(t)){var g,v,y=Object.keys(t);i.beforeSet(this,t);for(var b=0;b<y.length;b++)if(v=t[g=y[b]],!i.immutableKeys[g])for(var x=0;x<o.length;x++){var w=o[x];i.canSet(w)&&(w._private[i.field][g]=v)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}else if(i.allowBinding&&B(t))this.on(i.bindingEvent,t);else if(i.allowGetting&&void 0===t)return l&&(i.beforeGet(l),r=l._private[i.field]),r;return this}},removeData:function(e){return e=Q({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=void 0!==this.length?this:[this];if(D(t)){for(var i=t.split(/\s+/),a=i.length,o=0;o<a;o++){var s=i[o];if(!F(s)&&!n.immutableKeys[s])for(var l=0,u=r.length;l<u;l++)r[l]._private[n.field][s]=void 0}n.triggerEvent&&this[n.triggerFnName](n.event)}else if(void 0===t){for(var c=0,h=r.length;c<h;c++)for(var d=r[c]._private[n.field],f=Object.keys(d),p=0;p<f.length;p++){var g=f[p];n.immutableKeys[g]||(d[g]=void 0)}n.triggerEvent&&this[n.triggerFnName](n.event)}return this}}},{eventAliasesOn:function(e){e.addListener=e.listen=e.bind=e.on,e.unlisten=e.unbind=e.off=e.removeListener,e.trigger=e.emit,e.pon=e.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new n3(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}}].forEach(function(e){Q(rh,e)});var rd={animate:rh.animate(),animation:rh.animation(),animated:rh.animated(),clearQueue:rh.clearQueue(),delay:rh.delay(),delayAnimation:rh.delayAnimation(),stop:rh.stop()},rf={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach(function(e){return t.push(e)}),t}A(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],r=new e$(e),i=0;i<this.length;i++){for(var a=this[i],o=a._private,s=o.classes,l=!1,u=0;u<e.length;u++){var c=e[u];if(!s.has(c)){l=!0;break}}l||(l=s.size!==e.length),l&&(o.classes=r,n.push(a))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){A(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i<a;i++)for(var o=this[i],s=o._private.classes,l=!1,u=0;u<e.length;u++){var c=e[u],h=s.has(c),d=!1;t||n&&!h?(s.add(c),d=!0):(!t||n&&h)&&(s.delete(c),d=!0),!l&&d&&(r.push(o),l=!0)}return r.length>0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};rf.className=rf.classNames=rf.classes;var rp={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:U,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};rp.variable="(?:[\\w-.]|(?:\\\\"+rp.metaChar+"))+",rp.className="(?:[\\w-]|(?:\\\\"+rp.metaChar+"))+",rp.value=rp.string+"|"+rp.number,rp.id=rp.variable,function(){var e,t,n;for(n=0,e=rp.comparatorOp.split("|");n<e.length;n++)t=e[n],rp.comparatorOp+="|@"+t;for(n=0,e=rp.comparatorOp.split("|");n<e.length;n++)(t=e[n]).indexOf("!")>=0||"="===t||(rp.comparatorOp+="|\\!"+t)}();var rg=function(){return{checks:[]}},rv={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},ry=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return -1*$(e.selector,t.selector)}),rm=function(){for(var e,t={},n=0;n<ry.length;n++)t[(e=ry[n]).selector]=e.matches;return t}(),rb="("+ry.map(function(e){return e.selector}).join("|")+")",rx=function(e){return e.replace(RegExp("\\\\("+rp.metaChar+")","g"),function(e,t){return t})},rw=function(e,t,n){e[e.length-1]=n},rE=[{name:"group",query:!0,regex:"("+rp.group+")",populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:rv.GROUP,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:rb,populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:rv.STATE,value:r})}},{name:"id",query:!0,regex:"\\#("+rp.id+")",populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:rv.ID,value:rx(r)})}},{name:"className",query:!0,regex:"\\.("+rp.className+")",populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:rv.CLASS,value:rx(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+rp.variable+")\\s*\\]",populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:rv.DATA_EXIST,field:rx(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+rp.variable+")\\s*("+rp.comparatorOp+")\\s*("+rp.value+")\\s*\\]",populate:function(e,t,n){var r=l(n,3),i=r[0],a=r[1],o=r[2];o=null!=RegExp("^"+rp.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:rv.DATA_COMPARE,field:rx(i),operator:a,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+rp.boolOp+")\\s*("+rp.variable+")\\s*\\]",populate:function(e,t,n){var r=l(n,2),i=r[0],a=r[1];t.checks.push({type:rv.DATA_BOOL,field:rx(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+rp.meta+")\\s*("+rp.comparatorOp+")\\s*("+rp.number+")\\s*\\]\\]",populate:function(e,t,n){var r=l(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:rv.META_COMPARE,field:rx(i),operator:a,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:rp.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=rg()}},{name:"directedEdge",separator:!0,regex:rp.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n=rg(),r=rg();return n.checks.push({type:rv.DIRECTED_EDGE,source:t,target:r}),rw(e,t,n),e.edgeCount++,r}var i=rg(),a=rg();return i.checks.push({type:rv.NODE_SOURCE,source:t,target:a}),rw(e,t,i),e.edgeCount++,a}},{name:"undirectedEdge",separator:!0,regex:rp.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n=rg(),r=rg();return n.checks.push({type:rv.UNDIRECTED_EDGE,nodes:[t,r]}),rw(e,t,n),e.edgeCount++,r}var i=rg(),a=rg();return i.checks.push({type:rv.NODE_NEIGHBOR,node:t,neighbor:a}),rw(e,t,i),a}},{name:"child",separator:!0,regex:rp.child,populate:function(e,t){if(null==e.currentSubject){var n=rg(),r=rg(),i=e[e.length-1];return n.checks.push({type:rv.CHILD,parent:i,child:r}),rw(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=rg(),o=e[e.length-1],s=rg(),l=rg(),u=rg(),c=rg();return a.checks.push({type:rv.COMPOUND_SPLIT,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:rv.TRUE}],c.checks.push({type:rv.TRUE}),s.checks.push({type:rv.PARENT,parent:c,child:u}),rw(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=rg(),d=rg(),f=[{type:rv.PARENT,parent:h,child:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"descendant",separator:!0,regex:rp.descendant,populate:function(e,t){if(null==e.currentSubject){var n=rg(),r=rg(),i=e[e.length-1];return n.checks.push({type:rv.DESCENDANT,ancestor:i,descendant:r}),rw(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=rg(),o=e[e.length-1],s=rg(),l=rg(),u=rg(),c=rg();return a.checks.push({type:rv.COMPOUND_SPLIT,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:rv.TRUE}],c.checks.push({type:rv.TRUE}),s.checks.push({type:rv.ANCESTOR,ancestor:c,descendant:u}),rw(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=rg(),d=rg(),f=[{type:rv.ANCESTOR,ancestor:h,descendant:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"subject",modifier:!0,regex:rp.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return eO("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=null==n?null:n.type;r===rv.DIRECTED_EDGE?n.type=rv.NODE_TARGET:r===rv.UNDIRECTED_EDGE&&(n.type=rv.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];rE.forEach(function(e){return e.regexObj=RegExp("^"+e.regex)});var rT=function(e){for(var t,n,r,i=0;i<rE.length;i++){var a=rE[i],o=a.name,s=e.match(a.regexObj);if(null!=s){n=s,t=a,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},rk=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},rC=function(e,t,n){var r,i,a,o=D(e),s=M(e),l=D(n),u=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e<n;break;case"<=":h=!0,r=e<=n;break;default:r=!1}return c&&(null!=e||!h)&&(r=!r),r},rP=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},rS=function(e,t){return e.data(t)},rD=[],rB=function(e,t){return e.checks.every(function(e){return rD[e.type](e,t)})};rD[rv.GROUP]=function(e,t){var n=e.value;return"*"===n||n===t.group()},rD[rv.STATE]=function(e,t){return rm[e.value](t)},rD[rv.ID]=function(e,t){var n=e.value;return t.id()===n},rD[rv.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},rD[rv.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return rC(t[n](),r,i)},rD[rv.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return rC(rS(t,n),r,i)},rD[rv.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return rP(rS(t,n),r)},rD[rv.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,void 0!==rS(t,n)},rD[rv.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return rB(n,i)&&rB(r,a)||rB(r,i)&&rB(n,a)},rD[rv.NODE_NEIGHBOR]=function(e,t){return rB(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&rB(e.neighbor,t)})},rD[rv.DIRECTED_EDGE]=function(e,t){return rB(e.source,t.source())&&rB(e.target,t.target())},rD[rv.NODE_SOURCE]=function(e,t){return rB(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&rB(e.target,t)})},rD[rv.NODE_TARGET]=function(e,t){return rB(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&rB(e.source,t)})},rD[rv.CHILD]=function(e,t){return rB(e.child,t)&&rB(e.parent,t.parent())},rD[rv.PARENT]=function(e,t){return rB(e.parent,t)&&t.children().some(function(t){return rB(e.child,t)})},rD[rv.DESCENDANT]=function(e,t){return rB(e.descendant,t)&&t.ancestors().some(function(t){return rB(e.ancestor,t)})},rD[rv.ANCESTOR]=function(e,t){return rB(e.ancestor,t)&&t.descendants().some(function(t){return rB(e.descendant,t)})},rD[rv.COMPOUND_SPLIT]=function(e,t){return rB(e.subject,t)&&rB(e.left,t)&&rB(e.right,t)},rD[rv.TRUE]=function(){return!0},rD[rv.COLLECTION]=function(e,t){return e.value.has(t)},rD[rv.FILTER]=function(e,t){return(0,e.value)(t)};var rA=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||D(e)&&e.match(/^\s*$/)||(I(e)?this.addQuery({checks:[{type:rv.COLLECTION,value:e.collection()}]}):B(e)?this.addQuery({checks:[{type:rv.FILTER,value:e}]}):D(e)?this.parse(e)||(this.invalid=!0):eN("A selector must be created from a string; found "))},r_=rA.prototype;[{parse:function(e){var t=this.inputText=e,n=this[0]=rg();for(this.length=1,t=rk(t);;){var r=rT(t);if(null==r.expr)return eO("The selector `"+e+"`is invalid"),!1;var i=r.match.slice(1),a=r.expr.populate(this,n,i);if(!1===a)return!1;if(null!=a&&(n=a),(t=r.remaining).match(/^\s*$/))break}var o=this[this.length-1];null!=this.currentSubject&&(o.subject=this.currentSubject),o.edgeCount=this.edgeCount,o.compoundCount=this.compoundCount;for(var s=0;s<this.length;s++){var l=this[s];if(l.compoundCount>0&&l.edgeCount>0)return eO("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return eO("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&eO("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return D(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case rv.GROUP:var l=e(s);return l.substring(0,l.length-1);case rv.DATA_COMPARE:return"["+r.field+n(e(r.operator))+t(s)+"]";case rv.DATA_BOOL:var u=r.operator,c=r.field;return"["+e(u)+c+"]";case rv.DATA_EXIST:return"["+r.field+"]";case rv.META_COMPARE:var h=r.operator;return"[["+r.field+n(e(h))+t(s)+"]]";case rv.STATE:return s;case rv.ID:return"#"+s;case rv.CLASS:return"."+s;case rv.PARENT:case rv.CHILD:return i(r.parent,a)+n(">")+i(r.child,a);case rv.ANCESTOR:case rv.DESCENDANT:return i(r.ancestor,a)+" "+i(r.descendant,a);case rv.COMPOUND_SPLIT:var d=i(r.left,a),f=i(r.subject,a),p=i(r.right,a);return d+(d.length>0?" ":"")+f+p;case rv.TRUE:return""}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)},"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},{matches:function(e){for(var t=0;t<this.length;t++)if(rB(this[t],e))return!0;return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===rv.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++)if(rB(t[n],e))return!0;return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}}].forEach(function(e){return Q(r_,e)}),r_.text=function(){return this.inputText},r_.size=function(){return this.length},r_.eq=function(e){return this[e]},r_.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},r_.addQuery=function(e){this[this.length++]=e},r_.selector=r_.toString;var rM={allAre:function(e){var t=new rA(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new rA(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};rM.allAreNeighbours=rM.allAreNeighbors,rM.has=rM.contains,rM.equal=rM.equals=rM.same;var rR=function(e,t){return function(n,r,i,a){if(null==n?o="":I(n)&&1===n.length&&(o=n.id()),1!==this.length||!o)return e.call(this,n,r,i,a);var o,s=this[0]._private,l=s.traversalCache=s.traversalCache||{},u=l[t]=l[t]||[],c=ek(o);return u[c]||(u[c]=e.call(this,n,r,i,a))}},rI={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:rR(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return!function e(n){for(var r=0;r<n.length;r++){var i=n[r];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function rN(e,t,n,r){for(var i=[],a=new e$,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?i.push(l):o&&r(i,a,l)}for(;i.length>0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function rL(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function rO(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function rz(e,t,n){rO(e,t,n),rL(e,t,n)}rI.forEachDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return rN(this,e,t,rL)},rI.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return rN(this,e,t,rO)},rI.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return rN(this,e,t,rz)},rI.ancestors=rI.parents,(s6=s8={data:rh.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:rh.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:rh.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:rh.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:rh.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:rh.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=s6.data,s6.removeAttr=s6.removeData;var rF={};function rV(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&!(!this.isNode()||this.removed())){for(var n=0,r=this[0],i=r._private.edges,a=0;a<i.length;a++){var o=i[a];!t&&o.isLoop()||(n+=e(r,o))}return n}}}function rX(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);void 0!==o&&(void 0===r||t(o,r))&&(r=o)}return r}}Q(rF,{degree:rV(function(e,t){return t.source().same(t.target())?2:1}),indegree:rV(function(e,t){return t.target().same(e)?1:0}),outdegree:rV(function(e,t){return t.source().same(e)?1:0})}),Q(rF,{minDegree:rX("degree",function(e,t){return e<t}),maxDegree:rX("degree",function(e,t){return e>t}),minIndegree:rX("indegree",function(e,t){return e<t}),maxIndegree:rX("indegree",function(e,t){return e>t}),minOutdegree:rX("outdegree",function(e,t){return e<t}),maxOutdegree:rX("outdegree",function(e,t){return e>t})}),Q(rF,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var rj=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};i.isParent()&&!(0===o.x&&0===o.y)&&i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},rY={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){rj(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(s7=le={position:rh.data(rY),silentPosition:rh.data(Q({},rY,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){rj(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(_(e))t?this.silentPosition(e):this.position(e);else if(B(e)){var n=this.cy();n.startBatch();for(var r=0;r<this.length;r++){var i=this[r],a=void 0;(a=e(i,r))&&(t?i.silentPosition(a):i.position(a))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(_(e)?(r={x:M(e.x)?e.x:0,y:M(e.y)?e.y:0},n=t):D(e)&&M(t)&&((r={x:0,y:0})[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return _(e)?this.shift(e,!0):D(e)&&M(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=_(e)?e:void 0,s=void 0!==o||void 0!==t&&D(e);if(n&&n.isNode()){if(!s)return(o=tt(n.position(),i,a),void 0===e)?o:o[e];for(var l=0;l<this.length;l++){var u=this[l];void 0!==t?u.position(e,(t-a[e])/i):void 0!==o&&u.position(tn(o,i,a))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=_(e)?e:void 0,a=void 0!==i||void 0!==t&&D(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(a)for(var s=0;s<this.length;s++){var l=this[s],u=o?l.parent():null,c=u&&u.length>0;c&&(u=u[0]);var h=c?u.position():{x:0,y:0};void 0!==t?l.position(e,t+h[e]):void 0!==i&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=n.position(),f=o?n.parent():null,p=f&&f.length>0;p&&(f=f[0]);var g=p?f.position():{x:0,y:0};return(i={x:d.x-g.x,y:d.y-g.y},void 0===e)?i:i[e]}}else if(!a)return;return this}}).modelPosition=s7.point=s7.position,s7.modelPositions=s7.points=s7.positions,s7.renderedPoint=s7.renderedPosition,s7.relativePoint=s7.relativePosition,lt=ln={},ln.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},ln.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()&&this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}}),this},ln.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;for(var n=0;n<this.length;n++){var r=this[n],i=r._private;i.compoundBoundsClean&&!e||(function(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;(0===a.w||0===a.h)&&((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,f=h.biasComplementDiff,p=y(i.height.val-a.h,u,c),g=p.biasDiff,v=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"===n.units)switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}else if("px"===n.units)return n.pfValue;else return 0}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+f)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}(r),t.batching()||(i.compoundBoundsClean=!0))}return this};var rq=function(e){return e===1/0||e===-1/0?0:e},rW=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},rU=function(e,t){return null==t?e:rW(e,t.x1,t.y1,t.x2,t.y2)},rH=function(e,t,n){return eU(e,t,n)},rG=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,tE(u,1),rW(e,u.x1,u.y1,u.x2,u.y2)}}},rK=function(e,t,n){if(!t.cy().headless()){a=n?n+"-":"";var r=t._private,i=r.rstyle;if(t.pstyle(a+"label").strValue){var a,o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=rH(i,"labelWidth",n),f=rH(i,"labelHeight",n),p=rH(i,"labelX",n),g=rH(i,"labelY",n),v=t.pstyle(a+"text-margin-x").pfValue,y=t.pstyle(a+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle(a+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,E=t.pstyle("text-border-width").pfValue/2,T=t.pstyle("text-background-padding").pfValue,k=d/2,C=f/2;if(b)o=p-k,s=p+k,l=g-C,u=g+C;else{switch(c.value){case"left":o=p-d,s=p;break;case"center":o=p-k,s=p+k;break;case"right":o=p,s=p+d}switch(h.value){case"top":l=g-f,u=g;break;case"center":l=g-C,u=g+C;break;case"bottom":l=g,u=g+f}}var P=v-Math.max(w,E)-T-2,S=v+Math.max(w,E)+T+2,D=y-Math.max(w,E)-T-2,B=y+Math.max(w,E)+T+2;o+=P,s+=S,l+=D,u+=B;var A=n||"main",_=r.labelBounds,M=_[A]=_[A]||{};M.x1=o,M.y1=l,M.x2=s,M.y2=u,M.w=s-o,M.h=u-l,M.leftPad=P,M.rightPad=S,M.topPad=D,M.botPad=B;var R=b&&"autorotate"===x.strValue,I=null!=x.pfValue&&0!==x.pfValue;if(R||I){var N=R?rH(r.rstyle,"labelAngle",n):x.pfValue,L=Math.cos(N),O=Math.sin(N),z=(o+s)/2,F=(l+u)/2;if(!b){switch(c.value){case"left":z=s;break;case"right":z=o}switch(h.value){case"top":F=u;break;case"bottom":F=l}}var V=function(e,t){return{x:(e-=z)*L-(t-=F)*O+z,y:e*O+t*L+F}},X=V(o,l),j=V(o,u),Y=V(s,l),q=V(s,u);o=Math.min(X.x,j.x,Y.x,q.x),s=Math.max(X.x,j.x,Y.x,q.x),l=Math.min(X.y,j.y,Y.y,q.y),u=Math.max(X.y,j.y,Y.y,q.y)}var W=A+"Rot",U=_[W]=_[W]||{};U.x1=o,U.y1=l,U.x2=s,U.y2=u,U.w=s-o,U.h=u-l,rW(e,o,l,s,u),rW(r.labelBounds.all,o,l,s,u)}return e}},rZ=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value;if(n>0&&r>0){var i=t.pstyle("outline-offset").value,a=t.pstyle("shape").value,o=r+i,s=(e.w+2*o)/e.w,l=(e.h+2*o)/e.h,u=0;["diamond","pentagon","round-triangle"].includes(a)?(s=(e.w+2.4*o)/e.w,u=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(a)?s=(e.w+2.4*o)/e.w:"star"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.6*o)/e.h,u=-o/3.8):"triangle"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.4*o)/e.h,u=-o/1.4):"vee"===a&&(s=(e.w+4.4*o)/e.w,l=(e.h+3.8*o)/e.h,u=-(.5*o));var c=e.h*l-e.h,h=e.w*s-e.w;if(tT(e,[Math.ceil(c/2),Math.ceil(h/2)]),0!==u){var d,f=(d=u,{x1:e.x1+0,x2:e.x2+0,y1:e.y1+d,y2:e.y2+d,w:e.w,h:e.h});tx(e,f)}}}},r$=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=tm(),o=e._private,s=e.isNode(),l=e.isEdge(),u=o.rstyle,c=s&&r?e.pstyle("bounds-expansion").pfValue:[0],h=function(e){return"none"!==e.pstyle("display").value},d=!r||h(e)&&(!l||h(e.source())&&h(e.target()));if(d){var f=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(f=e.pstyle("overlay-padding").value);var p=0;r&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(p=e.pstyle("underlay-padding").value);var g=Math.max(f,p),v=0;if(r&&(v=e.pstyle("width").pfValue/2),s&&t.includeNodes){var y=e.position();C=y.x,P=y.y;var b=e.outerWidth()/2,x=e.outerHeight()/2;w=C-b,E=C+b,rW(a,w,T=P-x,E,k=P+x),r&&t.includeOutlines&&rZ(a,e)}else if(l&&t.includeEdges){if(r&&!i){var w,E,T,k,C,P,S,D=e.pstyle("curve-style").strValue;if(w=Math.min(u.srcX,u.midX,u.tgtX),E=Math.max(u.srcX,u.midX,u.tgtX),T=Math.min(u.srcY,u.midY,u.tgtY),k=Math.max(u.srcY,u.midY,u.tgtY),w-=v,E+=v,rW(a,w,T-=v,E,k+=v),"haystack"===D){var B=u.haystackPts;if(B&&2===B.length){if(w=B[0].x,T=B[0].y,E=B[1].x,k=B[1].y,w>E){var A=w;w=E,E=A}if(T>k){var _=T;T=k,k=_}rW(a,w-v,T-v,E+v,k+v)}}else if("bezier"===D||"unbundled-bezier"===D||D.endsWith("segments")||D.endsWith("taxi")){switch(D){case"bezier":case"unbundled-bezier":S=u.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":S=u.linePts}if(null!=S)for(var M=0;M<S.length;M++){var R=S[M];w=R.x-v,E=R.x+v,rW(a,w,T=R.y-v,E,k=R.y+v)}}}else{var I=e.source().position(),N=e.target().position();if(w=I.x,E=N.x,T=I.y,k=N.y,w>E){var L=w;w=E,E=L}if(T>k){var O=T;T=k,k=O}w-=v,E+=v,rW(a,w,T-=v,E,k+=v)}}if(r&&t.includeEdges&&l&&(rG(a,e,"mid-source"),rG(a,e,"mid-target"),rG(a,e,"source"),rG(a,e,"target")),r&&"yes"===e.pstyle("ghost").value){var z=e.pstyle("ghost-offset-x").pfValue,F=e.pstyle("ghost-offset-y").pfValue;rW(a,a.x1+z,a.y1+F,a.x2+z,a.y2+F)}var V=o.bodyBounds=o.bodyBounds||{};tk(V,a),tT(V,c),tE(V,1),r&&(w=a.x1,E=a.x2,T=a.y1,k=a.y2,rW(a,w-g,T-g,E+g,k+g));var X=o.overlayBounds=o.overlayBounds||{};tk(X,a),tT(X,c),tE(X,1);var j=o.labelBounds=o.labelBounds||{};null!=j.all?tb(j.all):j.all=tm(),r&&t.includeLabels&&(t.includeMainLabels&&rK(a,e,null),l&&(t.includeSourceLabels&&rK(a,e,"source"),t.includeTargetLabels&&rK(a,e,"target")))}return a.x1=rq(a.x1),a.y1=rq(a.y1),a.x2=rq(a.x2),a.y2=rq(a.y2),a.w=rq(a.x2-a.x1),a.h=rq(a.y2-a.y1),a.w>0&&a.h>0&&d&&(tT(a,c),tE(a,1)),a},rQ=function(e){var t=0,n=function(e){return(e?1:0)<<t++};return 0+n(e.incudeNodes)+n(e.includeEdges)+n(e.includeLabels)+n(e.includeMainLabels)+n(e.includeSourceLabels)+n(e.includeTargetLabels)+n(e.includeOverlays)+n(e.includeOutlines)},rJ=function(e){if(!e.isEdge())return 0;var t=e.source().position(),n=e.target().position(),r=function(e){return Math.round(e)};return eT([r(t.x),r(t.y),r(n.x),r(n.y)])},r0=function(e,t){var n,r=e._private,i=e.isEdge(),a=null==t?r2:rQ(t),o=rJ(e),s=r.bbCachePosKey===o,l=t.useCache,u=function(e){return null==e._private.bbCache||e._private.styleDirty};if(!l||u(e)||i&&(u(e.source())||u(e.target()))?(s||e.recalculateRenderedStyle(l),n=r$(e,r1),r.bbCache=n,r.bbCachePosKey=o):n=r.bbCache,a!==r2){var c=e.isNode();n=tm(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?rU(n,r.overlayBounds):rU(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?rU(n,r.labelBounds.all):(t.includeMainLabels&&rU(n,r.labelBounds.mainRot),t.includeSourceLabels&&rU(n,r.labelBounds.sourceRot),t.includeTargetLabels&&rU(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},r1={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},r2=rQ(r1),r5=ej(r1);ln.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=tm();var n=r5(e=e||r1);if(this.cy().styleEnabled())for(var r=0;r<this.length;r++){var i=this[r],a=i._private,o=rJ(i),s=a.bbCachePosKey===o,l=n.useCache&&s&&!a.styleDirty;i.recalculateRenderedStyle(l)}this.updateCompoundBounds(!e.useCache);for(var u=0;u<this.length;u++)rU(t,r0(this[u],n))}else e=void 0===e?r1:r5(e),t=r0(this[0],e);return t.x1=rq(t.x1),t.y1=rq(t.y1),t.x2=rq(t.x2),t.y2=rq(t.y2),t.w=rq(t.x2-t.x1),t.h=rq(t.y2-t.y1),t},ln.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},ln.boundingBoxAt=function(e){var t,n=this.nodes(),r=this.cy(),i=r.hasCompoundNodes(),a=r.collection();if(i&&(a=n.filter(function(e){return e.isParent()}),n=n.not(a)),_(e)){var o=e;e=function(){return o}}r.startBatch(),n.forEach(function(t,n){return t._private.bbAtOldPos=e(t,n)}).silentPositions(e),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var s={x1:(t=this.boundingBox({useCache:!1})).x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h};return n.silentPositions(function(e){return e._private.bbAtOldPos}),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),r.endBatch(),s},lt.boundingbox=lt.bb=lt.boundingBox,lt.renderedBoundingbox=lt.renderedBoundingBox,lr=li={};var r3=function(e){e.uppercaseName=W(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=W(e.outerName),lr[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t){if(!r)return 1;if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);return"label"===i.strValue?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):i.pfValue}},lr["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)return n?t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding():1},lr["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},lr["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};r3({name:"width"}),r3({name:"height"}),li.padding=function(){var e=this[0],t=e._private;return e.isParent()&&(e.updateCompoundBounds(),void 0!==t.autoPadding)?t.autoPadding:e.pstyle("padding").pfValue},li.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},li.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var r4=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},r9=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return tt(t(e),n.zoom(),n.pan())}},r6=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return tt(e,i,r)})}},r8={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)}}},r7=Q({},le,ln,li,Object.keys(r8).reduce(function(e,t){var n=r8[t],r="rendered"+t[0].toUpperCase()+t.substr(1);return e[t]=function(){return r4(this,n.get)},n.mult?e[r]=function(){return r6(this,n.get)}:e[r]=function(){return r9(this,n.get)},e},{})),ie=function(e,t){this.recycle(e,t)};function it(){return!1}function ir(){return!0}ie.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=it,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ir:it):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=ir;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=ir;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ir,this.stopPropagation()},isDefaultPrevented:it,isPropagationStopped:it,isImmediatePropagationStopped:it};var ii=/^([^.]+)(\.(?:[^.]+))?$/,ia={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},io=Object.keys(ia),is={};function il(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:is,t=arguments.length>1?arguments[1]:void 0,n=0;n<io.length;n++){var r=io[n];this[r]=e[r]||ia[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var iu=il.prototype,ic=function(e,t,n,r,i,a,o){B(r)&&(i=r,r=null),o&&(a=null==a?o:Q({},a,o));for(var s=A(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!F(u)){var c=u.match(ii);if(c&&!1===t(e,u,c[1],c[2]?c[2]:null,r,i,a))break}}},ih=function(e,t){return e.addEventFields(e.context,t),new ie(t.type,t)},id=function(e,t,n){if("event"===S(n)){t(e,n);return}if(_(n)){t(e,ih(e,n));return}for(var r=A(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!F(a)){var o=a.match(ii);if(o){var s=ih(e,{type:o[1],namespace:o[2]?o[2]:null,target:e.context});t(e,s)}}}};iu.on=iu.addListener=function(e,t,n,r,i){return ic(this,function(e,t,n,r,i,a,o){B(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},iu.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},iu.removeListener=iu.off=function(e,t,n,r){var i=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var a=this.listeners,o=function(o){var s=a[o];ic(i,function(t,n,r,i,l,u){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},iu.removeAllListeners=function(){return this.removeListener("*")},iu.emit=iu.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,A(t)||(t=[t]),id(this,function(e,a){null!=n&&(i=(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}]).length);for(var o=0;o<i;o++)!function(){var n=r[o];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||".*"===n.namespace)&&e.eventMatches(e.context,n,a)){var i=[a];null!=t&&eW(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==n}));var s=e.callbackContext(e.context,n,a),l=n.callback.apply(s,i);e.afterEmit(e.context,n,a),!1===l&&(a.stopPropagation(),a.preventDefault())}}();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var ip={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&N(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},ig=function(e){return D(e)?new rA(e):e},iv={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new il(ip,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=ig(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=ig(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=ig(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=ig(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};rh.eventAliasesOn(iv);var iy={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(D(e)||I(e))return new rA(e).filter(this);if(B(e)){for(var n=this.spawn(),r=0;r<this.length;r++){var i=this[r];(t?e.apply(t,[i,r,this]):e(i,r,this))&&n.push(i)}return n}return this.spawn()},not:function(e){if(!e)return this;D(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(D(e))return this.filter(e);for(var t=this.spawn(),n=this.length<e.length,r=n?this:e,i=n?e:this,a=0;a<r.length;a++){var o=r[a];i.has(o)&&t.push(o)}return t},xor:function(e){var t=this._private.cy;D(e)&&(e=t.$(e));var n=this.spawn(),r=e,i=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return i(this,r),i(r,this),n},diff:function(e){var t=this._private.cy;D(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=e,o=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return o(this,a,n),o(a,this,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(D(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&D(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var l=this.length++;this[l]=o,i.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&D(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=0;r<this.length;r++){var i=this[r],a=t?e.apply(t,[i,r,this]):e(i,r,this);n.push(a)}return n},reduce:function(e,t){for(var n=t,r=0;r<this.length;r++)n=e(n,this[r],r,this);return n},max:function(e,t){for(var n,r=-1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o>r&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o<r&&(r=o,n=a)}return{value:r,ele:n}}};iy.u=iy["|"]=iy["+"]=iy.union=iy.or=iy.add,iy["\\"]=iy["!"]=iy["-"]=iy.difference=iy.relativeComplement=iy.subtract=iy.not,iy.n=iy["&"]=iy["."]=iy.and=iy.intersection=iy.intersect,iy["^"]=iy["(+)"]=iy["(-)"]=iy.symmetricDifference=iy.symdiff=iy.xor,iy.fnFilter=iy.filterFn=iy.stdFilter=iy.filter,iy.complement=iy.abscomp=iy.absoluteComplement;var im=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?eA:0}var i=r(e)-r(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1:0}var o=a(e)-a(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},ib={forEach:function(e,t){if(B(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if(!1===(t?e.apply(t,[i,r,this]):e(i,r,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!B(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(im)},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:eA-1}var r=t.source,i=t.target;return Math.max(r.zDepth(),i.zDepth(),0)}}};ib.each=ib.forEach,a1="undefined",("undefined"==typeof Symbol?"undefined":h(Symbol))!=a1&&h(Symbol.iterator)!=a1&&(ib[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return s({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})});var ix=ej({nodeDimensionsIncludeLabels:!1}),iw={layoutDimensions:function(e){if(e=ix(e),this.takesUpSpace()){if(e.nodeDimensionsIncludeLabels){var t,n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()}}else t={w:0,h:0};return(0===t.w||0===t.h)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=X(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},u=t.spacingFactor&&1!==t.spacingFactor,c=function(){if(!u)return null;for(var e=tm(),t=0;t<r.length;t++){var n=s(r[t],t);tw(e,n.x,n.y)}return e}(),h=X(function(e,n){var r=s(e,n);return u&&(r=l(Math.abs(t.spacingFactor),c,r)),null!=t.transform&&(r=t.transform(e,r)),r},o);if(t.animate){for(var d=0;d<r.length;d++){var f=r[d],p=h(f,d);if(null==t.animateFilter||t.animateFilter(f,d)){var g=f.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else f.position(p)}if(t.fit){var v=i.animation({fit:{boundingBox:a.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else if(void 0!==t.zoom&&void 0!==t.pan){var y=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}e.animations.forEach(function(e){return e.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),n3.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else r.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(Q({},e,{eles:this}))}};function iE(e,t,n){var r,i=n._private,a=i.styleCache=i.styleCache||[];return null!=(r=a[e])?r:r=a[e]=t(n)}function iT(e,t){return e=ek(e),function(n){return iE(e,t,n)}}function ik(e,t){e=ek(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return iE(e,n,t)}}iw.createLayout=iw.makeLayout=iw.layout;var iC={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach(function(e){n(e),e.connectedEdges().forEach(n)}),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=this;e=!!e||void 0===e,n&&(r=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=r;return e?i.emitAndNotify("style"):i.emit("style"),r.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(_(e))r.applyBypass(this,e,!1),this.emitAndNotify("style");else if(D(e)){if(void 0===t){var i=this[0];return i?r.getStylePropertyValue(i,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var a=this[0];return a?r.getRawStyle(a):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r<this.length;r++){var i=this[r];n.removeAllBypasses(i,!1)}else{e=e.split(/\s+/);for(var a=0;a<this.length;a++){var o=this[a];n.removeBypasses(o,e,!1)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle("opacity").value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++)i*=a[o].pstyle("opacity").value;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)return t?0===e.effectiveOpacity():0===e.pstyle("opacity").value},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function iP(e,t){var n=e._private.data.parent?e.parents():null;if(n){for(var r=0;r<n.length;r++)if(!t(n[r]))return!1}return!0}function iS(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||iP(i,r);var s=o.source,l=o.target;return n(s)&&(!a||iP(s,n))&&(s===l||n(l)&&(!a||iP(l,n)))}}}var iD=iT("eleTakesUpSpace",function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())});iC.takesUpSpace=ik("takesUpSpace",iS({ok:iD}));var iB=iT("eleInteractive",function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&iD(e)}),iA=iT("parentInteractive",function(e){return"visible"===e.pstyle("visibility").value&&iD(e)});iC.interactive=ik("interactive",iS({ok:iB,parentOk:iA,edgeOkViaNode:iD})),iC.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var i_=iT("eleVisible",function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&iD(e)});iC.visible=ik("visible",iS({ok:i_,edgeOkViaNode:iD})),iC.hidden=function(){var e=this[0];if(e)return!e.visible()},iC.isBundledBezier=ik("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()}),iC.bypass=iC.css=iC.style,iC.renderedCss=iC.renderedStyle,iC.removeBypass=iC.removeCss=iC.removeStyle,iC.pstyle=iC.parsedStyle;var iM={};function iR(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(1===t.length&&B(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&A(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(l);if(void 0!==h&&(u=h,!h))return this}u&&(l._private[e.field]=e.value,c&&n.push(l))}var d=this.spawn(n);d.updateStyle(),d.emit(e.event),o&&d.emit(o)}return this}}function iI(e){iM[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},iM[e.on]=iR({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),iM[e.off]=iR({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}iI({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),iI({field:"grabbable",overrideField:function(e){return!(e.cy().autoungrabify()||e.pannable())&&void 0},on:"grabify",off:"ungrabify"}),iI({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),iI({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),iM.deselect=iM.unselect,iM.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},iI({field:"active",on:"activate",off:"unactivate"}),iI({field:"pannable",on:"panify",off:"unpanify"}),iM.inactive=function(){var e=this[0];if(e)return!e._private.active};var iN={},iL=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();if(e.noIncomingEdges&&c===i&&u!==i||e.noOutgoingEdges&&u===i&&c!==i){a=!0;break}}a||n.push(i)}}return this.spawn(n,!0).filter(t)}},iO=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target();e.outgoing&&l===i?(n.push(s),n.push(u)):e.incoming&&u===i&&(n.push(s),n.push(l))}}return this.spawn(n,!0).filter(t)}},iz=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],u=l.id();i[u]||(i[u]=!0,r.push(l),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};function iF(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}function iV(e){return function(t){var n=[],r=this._private.cy,i=e||{};D(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),h=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);(c||h)&&(!i.thisIsSrc&&!i.thisIsTgt||(!i.thisIsSrc||c)&&(!i.thisIsTgt||h))&&n.push(l)}return this.spawn(n,!0)}}function iX(e){return e=Q({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,h=0;h<c.length;h++){var d=c[h],f=d._private.data,p=f.target,g=f.source,v=p===u&&g===l,y=l===p&&u===g;(i.codirected&&v||!i.codirected&&(v||y))&&n.push(d)}return this.spawn(n,!0).filter(t)}}iN.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},Q(iN,{roots:iL({noIncomingEdges:!0}),leaves:iL({noOutgoingEdges:!0}),outgoers:rR(iO({outgoing:!0}),"outgoers"),successors:iz({outgoing:!0}),incomers:rR(iO({incoming:!0}),"incomers"),predecessors:iz({})}),Q(iN,{neighborhood:rR(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target(),c=i===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),iN.neighbourhood=iN.neighborhood,iN.closedNeighbourhood=iN.closedNeighborhood,iN.openNeighbourhood=iN.openNeighborhood,Q(iN,{source:rR(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:rR(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:iF({attr:"source"}),targets:iF({attr:"target"})}),Q(iN,{edgesWith:rR(iV(),"edgesWith"),edgesTo:rR(iV({thisIsSrc:!0}),"edgesTo")}),Q(iN,{connectedEdges:rR(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var i=r._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:rR(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];r.isEdge()&&(t.push(r.source()[0]),t.push(r.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:rR(iX(),"parallelEdges"),codirectedEdges:rR(iX({codirected:!0}),"codirectedEdges")}),Q(iN,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();do!function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach(function(n){n.connectedEdges().forEach(function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)})})}();while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),iN.componentsOf=iN.components;var ij=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0===e){eN("A collection must have a reference to the core");return}var i=new eK,a=!1;if(t){if(t.length>0&&_(t[0])&&!N(t[0])){a=!0;for(var o=[],s=new e$,l=0,u=t.length;l<u;l++){var c=t[l];null==c.data&&(c.data={});var h=c.data;if(null==h.id)h.id=eF();else if(e.hasElementWithId(h.id)||s.has(h.id))continue;var d=new eQ(e,c,!1);o.push(d),s.add(h.id)}t=o}}else t=[];this.length=0;for(var f=0,p=t.length;f<p;f++){var g=t[f][0];if(null!=g){var v=g._private.data.id;(!n||!i.has(v))&&(n&&i.set(v,{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 e=this.lazyMap=new eK,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()},iY=eQ.prototype=ij.prototype=Object.create(Array.prototype);iY.instanceString=function(){return"collection"},iY.spawn=function(e,t){return new ij(this.cy(),e,t)},iY.spawnSelf=function(){return this.spawn(this)},iY.cy=function(){return this._private.cy},iY.renderer=function(){return this._private.cy.renderer()},iY.element=function(){return this[0]},iY.collection=function(){return L(this)?this:new ij(this._private.cy,[this])},iY.unique=function(){return new ij(this._private.cy,this,!0)},iY.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},iY.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new ij(t)},iY.$id=iY.getElementById,iY.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},iY.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},iY.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},iY.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(_(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;u&&(null!=c||null!=i.parent)&&c!=i.parent&&(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var h=function(n,i,a){var o=e[n];null!=o&&o!==r[n]&&(o?t[i]():t[a]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var d={data:ez(r.data),position:ez(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};d.classes="";var f=0;return r.classes.forEach(function(e){return d.classes+=0==f++?e:" "+e}),d}}},iY.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},iY.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=new eQ(e,this[n].json(),!1);t.push(r)}return new ij(e,t)},iY.copy=iY.clone,iY.restore=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.cy(),r=n._private,i=[],a=[],o=0,s=this.length;o<s;o++){var l=this[o];(!t||l.removed())&&(l.isNode()?i.push(l):a.push(l))}R=i.concat(a);var u=function(){R.splice(I,1),I--};for(I=0;I<R.length;I++){var c=R[I],h=c._private,d=h.data;if(c.clearTraversalCache(),t||h.removed){if(void 0===d.id)d.id=eF();else if(M(d.id))d.id=""+d.id;else if(F(d.id)||!D(d.id)){eN("Can not create element with invalid string ID `"+d.id+"`"),u();continue}else if(n.hasElementWithId(d.id)){eN("Can not create second element with ID `"+d.id+"`"),u();continue}}var f=d.id;if(c.isNode()){var p=h.position;null==p.x&&(p.x=0),null==p.y&&(p.y=0)}if(c.isEdge()){for(var g=["source","target"],v=g.length,y=!1,b=0;b<v;b++){var x=g[b],w=d[x];M(w)&&(w=d[x]=""+d[x]),null==w||""===w?(eN("Can not create edge `"+f+"` with unspecified "+x),y=!0):n.hasElementWithId(w)||(eN("Can not create edge `"+f+"` with nonexistant "+x+" `"+w+"`"),y=!0)}if(y){u();continue}var E=n.getElementById(d.source),T=n.getElementById(d.target);E.same(T)?E._private.edges.push(c):(E._private.edges.push(c),T._private.edges.push(c)),c._private.source=E,c._private.target=T}h.map=new eK,h.map.set(f,{ele:c,index:0}),h.removed=!1,t&&n.addToPool(c)}for(var k=0;k<i.length;k++){var C=i[k],P=C._private.data;M(P.parent)&&(P.parent=""+P.parent);var S=P.parent;if(null!=S||C._private.parent){var B=C._private.parent?n.collection().merge(C._private.parent):n.getElementById(S);if(B.empty())P.parent=void 0;else if(B[0].removed())eO("Node added with missing parent, reference to parent removed"),P.parent=void 0,C._private.parent=null;else{for(var A=!1,_=B;!_.empty();){if(C.same(_)){A=!0,P.parent=void 0;break}_=_.parent()}A||(B[0]._private.children.push(C),C._private.parent=B[0],r.hasCompoundNodes=!0)}}}if(R.length>0){for(var R,I,N=R.length===this.length?this:new ij(n,R),L=0;L<N.length;L++){var O=N[L];O.isNode()||(O.parallelEdges().clearTraversalCache(),O.source().clearTraversalCache(),O.target().clearTraversalCache())}(r.hasCompoundNodes?n.collection().merge(N).merge(N.connectedNodes()).merge(N.parent()):N).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?N.emitAndNotify("add"):t&&N.emit("add")}return this},iY.removed=function(){var e=this[0];return e&&e._private.removed},iY.inside=function(){var e=this[0];return e&&!e._private.removed},iY.remove=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=[],r={},i=this._private.cy,a=0,o=this.length;a<o;a++)(function e(i){var a=r[i.id()];t&&i.removed()||a||(r[i.id()]=!0,i.isNode()?(n.push(i),function(t){for(var n=t._private.edges,r=0;r<n.length;r++)e(n[r])}(i),function(t){for(var n=t._private.children,r=0;r<n.length;r++)e(n[r])}(i)):n.unshift(i))})(this[a]);function s(e,t){eY(e._private.edges,t),e.clearTraversalCache()}var l=[];l.ids={},this.dirtyCompoundBoundsCache(),t&&i.removeFromPool(n);for(var u=0;u<n.length;u++){var c=n[u];if(c.isEdge()){var h=c.source()[0],d=c.target()[0];s(h,c),s(d,c);for(var f=c.parallelEdges(),p=0;p<f.length;p++){var g=f[p];(function(e){e.clearTraversalCache()})(g),g.isBundledBezier()&&g.dirtyBoundingBoxCache()}}else{var v=c.parent();0!==v.length&&function(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();eY(n,t),t._private.parent=null,l.ids[r]||(l.ids[r]=!0,l.push(e))}(v,c)}t&&(c._private.removed=!0)}var y=i._private.elements;i._private.hasCompoundNodes=!1;for(var b=0;b<y.length;b++)if(y[b].isParent()){i._private.hasCompoundNodes=!0;break}var x=new ij(this.cy(),n);x.size()>0&&(e?x.emitAndNotify("remove"):t&&x.emit("remove"));for(var w=0;w<l.length;w++){var E=l[w];t&&E.removed()||E.updateStyle()}return x},iY.move=function(e){var t=this._private.cy,n=this,r=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var i=r(e.source),a=r(e.target),o=null!=i&&t.hasElementWithId(i),s=null!=a&&t.hasElementWithId(a);(o||s)&&(t.batch(function(){n.remove(!1,!1),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],r=t._private.data;t.isEdge()&&(o&&(r.source=i),s&&(r.target=a))}n.restore(!1,!1)}),n.emitAndNotify("move"))}else if(void 0!==e.parent){var l=r(e.parent);if(null===l||t.hasElementWithId(l)){var u=null===l?void 0:l;t.batch(function(){var e=n.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var r=n[t],i=r._private.data;r.isNode()&&(i.parent=u)}e.restore(!1,!1)}),n.emitAndNotify("move")}}return this},[n$,rd,rf,rM,rI,s8,rF,r7,iv,iy,{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}},ib,iw,iC,iM,iN].forEach(function(e){Q(iY,e)});var iq=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}return function n(r,i,a){var o,s,l,u,c,h,d,f,p,g,v={x:-1,v:0,tension:null,friction:null},y=[0],b=0;for(r=parseFloat(r)||500,i=parseFloat(i)||20,a=a||null,v.tension=r,v.friction=i,p=(f=null!==a)?(b=n(r,i))/a*.016:.016;s={dx:(o=g||v).v,dv:e(o)},l=t(o,.5*p,s),u=t(o,.5*p,l),c=t(o,p,u),h=1/6*(s.dx+2*(l.dx+u.dx)+c.dx),d=1/6*(s.dv+2*(l.dv+u.dv)+c.dv),o.x=o.x+h*p,o.v=o.v+d*p,g=o,y.push(1+g.x),b+=16,Math.abs(g.x)>1e-4&&Math.abs(g.v)>1e-4;);return f?function(e){return y[e*(y.length-1)|0]}:b}}(),iW=function(e,t,n,r){var i=function(e,t,n,r){var i="undefined"!=typeof Float32Array;if(4!=arguments.length)return!1;for(var a=0;a<4;++a)if("number"!=typeof arguments[a]||isNaN(arguments[a])||!isFinite(arguments[a]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var o=i?new Float32Array(11):Array(11);function s(e,t,n){return(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e}function l(e,t,n){return 3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t}var u=!1,c=function(i){return(u||(u=!0,(e!==t||n!==r)&&function(){for(var t=0;t<11;++t)o[t]=s(.1*t,e,n)}()),e===t&&n===r)?i:0===i?0:1===i?1:s(function(t){for(var r=0,i=1;10!==i&&o[i]<=t;++i)r+=.1;var a=r+(t-o[--i])/(o[i+1]-o[i])*.1,u=l(a,e,n);return u>=.001?function(t,r){for(var i=0;i<4;++i){var a=l(r,e,n);if(0===a)break;var o=s(r,e,n)-t;r-=o/a}return r}(t,a):0===u?a:function(t,r,i){var a,o,l=0;do(a=s(o=r+(i-r)/2,e,n)-t)>0?i=o:r=o;while(Math.abs(a)>1e-7&&++l<10);return o}(t,r,r+.1)}(i),t,r)};c.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var h="generateBezier("+[e,t,n,r]+")";return c.toString=function(){return h},c}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},iU={linear:function(e,t,n){return e+(t-e)*n},ease:iW(.25,.1,.25,1),"ease-in":iW(.42,0,1,1),"ease-out":iW(0,0,.58,1),"ease-in-out":iW(.42,0,.58,1),"ease-in-sine":iW(.47,0,.745,.715),"ease-out-sine":iW(.39,.575,.565,1),"ease-in-out-sine":iW(.445,.05,.55,.95),"ease-in-quad":iW(.55,.085,.68,.53),"ease-out-quad":iW(.25,.46,.45,.94),"ease-in-out-quad":iW(.455,.03,.515,.955),"ease-in-cubic":iW(.55,.055,.675,.19),"ease-out-cubic":iW(.215,.61,.355,1),"ease-in-out-cubic":iW(.645,.045,.355,1),"ease-in-quart":iW(.895,.03,.685,.22),"ease-out-quart":iW(.165,.84,.44,1),"ease-in-out-quart":iW(.77,0,.175,1),"ease-in-quint":iW(.755,.05,.855,.06),"ease-out-quint":iW(.23,1,.32,1),"ease-in-out-quint":iW(.86,0,.07,1),"ease-in-expo":iW(.95,.05,.795,.035),"ease-out-expo":iW(.19,1,.22,1),"ease-in-out-expo":iW(1,0,0,1),"ease-in-circ":iW(.6,.04,.98,.335),"ease-out-circ":iW(.075,.82,.165,1),"ease-in-out-circ":iW(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return iU.linear;var r=iq(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":iW};function iH(e,t,n,r,i){if(1===r||t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function iG(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function iK(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=iG(e,i),s=iG(t,i);if(M(o)&&M(s))return iH(a,o,s,n,r);if(A(o)&&A(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],h=s[u];if(null!=c&&null!=h){var d=iH(a,c,h,n,r);l.push(d)}else l.push(h)}return l}}function iZ(e,t){return null!=e&&null!=t&&(!!(M(e)&&M(t))||!!e&&!!t)}function i$(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.push(l)}for(var u=function(e){for(var t=e.length-1;t>=0;t--)(0,e[t])();e.splice(0,e.length)},c=a.length-1;c>=0;c--){var h=a[c],d=h._private;if(d.stopped){a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames);continue}(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||function(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}(0,h,e),function(e,t,n,r){var i,a,o,s,l=!r,u=e._private,c=t._private,h=c.easing,d=c.startTime,f=(r?e:e.cy()).style();c.easingImpl||(null==h?c.easingImpl=iU.linear:(i=D(h)?f.parse("transition-timing-function",h).value:h,D(i)?(a=i,o=[]):(a=i[1],o=i.slice(2).map(function(e){return+e})),o.length>0?("spring"===a&&o.push(c.duration),c.easingImpl=iU[a].apply(null,o)):c.easingImpl=iU[a]));var p=c.easingImpl;if(s=0===c.duration?1:(n-d)/c.duration,c.applying&&(s=c.progress),s<0?s=0:s>1&&(s=1),null==c.delay){var g=c.startPosition,v=c.position;if(v&&l&&!e.locked()){var y={};iZ(g.x,v.x)&&(y.x=iK(g.x,v.x,s,p)),iZ(g.y,v.y)&&(y.y=iK(g.y,v.y,s,p)),e.position(y)}var b=c.startPan,x=c.pan,w=u.pan,E=null!=x&&r;E&&(iZ(b.x,x.x)&&(w.x=iK(b.x,x.x,s,p)),iZ(b.y,x.y)&&(w.y=iK(b.y,x.y,s,p)),e.emit("pan"));var T=c.startZoom,k=c.zoom,C=null!=k&&r;C&&(iZ(T,k)&&(u.zoom=ty(u.minZoom,iK(T,k,s,p),u.maxZoom)),e.emit("zoom")),(E||C)&&e.emit("viewport");var P=c.style;if(P&&P.length>0&&l){for(var S=0;S<P.length;S++){var B=P[S],A=B.name,_=c.startStyle[A],M=f.properties[_.name],R=iK(_,B,s,p,M);f.overrideBypass(e,A,R)}e.emit("style")}}c.progress=s}(t,h,e,n),d.applying&&(d.applying=!1),u(d.frames),null!=d.step&&d.step(e),h.completed()&&(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=i(n[o]);a=a||s}var l=i(t,!0);(a||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var iQ={animate:rh.animate(),animation:rh.animation(),animated:rh.animated(),clearQueue:rh.clearQueue(),delay:rh.delay(),delayAnimation:rh.delayAnimation(),stop:rh.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,n){i$(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&ey(function(n){i$(n,e),t()})}()}}},iJ={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&N(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},i0=function(e){return D(e)?new rA(e):e},i1={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new il(iJ,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,i0(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,i0(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,i0(t),n),this},once:function(e,t,n){return this.emitter().one(e,i0(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};rh.eventAliasesOn(i1);var i2={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)}};i2.jpeg=i2.jpg;var i5={layout:function(e){if(null==e){eN("Layout options must be specified to make a layout");return}if(null==e.name){eN("A `name` must be specified to make a layout");return}var t,n=e.name,r=this.extension("layout",n);if(null==r){eN("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}return t=D(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new r(Q({},e,{cy:this,eles:t}))}};i5.createLayout=i5.makeLayout=i5.layout;var i3=ej({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]}),i4={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null==t){eN("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}void 0!==e.wheelSensitivity&&eO("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=i3(e);n.cy=this,this._private.renderer=new t(n),this.notify("init")},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};i4.invalidateDimensions=i4.resize;var i9={collection:function(e,t){return D(e)?this.$(e):I(e)?e.collection():A(e)?(t||(t={}),new ij(this,e,t.unique,t.removed)):new ij(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};i9.elements=i9.filter=i9.$;var i6={};i6.apply=function(e){for(var t=this._private.cy.collection(),n=0;n<e.length;n++){var r=e[n],i=this.getContextMeta(r);if(!i.empty){var a=this.getContextStyle(i),o=this.applyContextStyle(i,a,r);r._private.appliedInitStyle?this.updateTransitions(r,o.diffProps):r._private.appliedInitStyle=!0,this.updateStyleHints(r)&&t.push(r)}}return t},i6.getPropertiesDiff=function(e,t){var n=this._private.propDiffs=this._private.propDiffs||{},r=e+"-"+t,i=n[r];if(i)return i;for(var a=[],o={},s=0;s<this.length;s++){var l=this[s],u="t"===e[s],c="t"===t[s],h=u!==c,d=l.mappedProperties.length>0;if(h||c&&d){var f=void 0;h&&d?f=l.properties:h?f=l.properties:d&&(f=l.mappedProperties);for(var p=0;p<f.length;p++){for(var g=f[p],v=g.name,y=!1,b=s+1;b<this.length;b++){var x=this[b];if("t"===t[b]&&(y=null!=x.properties[g.name]))break}o[v]||y||(o[v]=!0,a.push(v))}}}return n[r]=a,a},i6.getContextMeta=function(e){for(var t,n="",r=e._private.styleCxtKey||"",i=0;i<this.length;i++){var a=this[i];a.selector&&a.selector.matches(e)?n+="t":n+="f"}return t=this.getPropertiesDiff(r,n),e._private.styleCxtKey=n,{key:n,diffPropNames:t,empty:0===t.length}},i6.getContextStyle=function(e){var t=e.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var r={_private:{key:t}},i=0;i<this.length;i++){var a=this[i];if("t"===t[i])for(var o=0;o<a.properties.length;o++){var s=a.properties[o];r[s.name]=s}}return n[t]=r,r},i6.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,i={},a=this.types,o=0;o<r.length;o++){var s=r[o],l=t[s],u=n.pstyle(s);if(!l){if(!u)continue;l=u.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0}}if(u!==l){if(l.mapped===a.fn&&null!=u&&null!=u.mapping&&u.mapping.value===l.value){var c=u.mapping;if((c.fnValue=l.value(n))===c.prevFnValue)continue}var h=i[s]={prev:u};this.applyParsedProperty(n,l),h.next=n.pstyle(s),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},i6.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;r=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];t.styleKeys[c]=[9261,5381]}for(var h=function(e,n){return t.styleKeys[n][0]=eb(e,t.styleKeys[n][0])},d=function(e,n){return t.styleKeys[n][1]=ex(e,t.styleKeys[n][1])},f=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);h(r,t),d(r,t)}},p=0;p<r.length;p++){var g,v,y=r[p],b=l[y];if(null!=b){var x=this.properties[y],w=x.type,E=x.groupKey,T=void 0;null!=x.hashOverride?T=x.hashOverride(e,b):null!=b.pfValue&&(T=b.pfValue);var k=null==x.enums?b.value:null,C=null!=T,P=null!=k,S=C||P,D=b.units;w.number&&S&&!w.multiple?(h(v=-128<(g=C?T:k)&&g<128&&Math.floor(g)!==g?2e9-(1024*g|0):g,E),d(v,E),C||null==D||f(D,E)):f(b.strValue,E)}}for(var B=[9261,5381],A=0;A<i.length;A++){var _=i[A],M=t.styleKeys[_];B[0]=eb(M[0],B[0]),B[1]=ex(M[1],B[1])}t.styleKey=2097152*B[0]+B[1];var R=t.styleKeys;t.labelDimsKey=ew(R.labelDimensions);var I=a(e,["label"],R.labelDimensions);if(t.labelKey=ew(I),t.labelStyleKey=ew(eE(R.commonLabel,I)),!s){var N=a(e,["source-label"],R.labelDimensions);t.sourceLabelKey=ew(N),t.sourceLabelStyleKey=ew(eE(R.commonLabel,N));var L=a(e,["target-label"],R.labelDimensions);t.targetLabelKey=ew(L),t.targetLabelStyleKey=ew(eE(R.commonLabel,L))}if(s){var O=t.styleKeys,z=O.nodeBody,F=O.nodeBorder,V=O.nodeOutline,X=O.backgroundImage,j=O.compound,Y=O.pie,q=[z,F,V,X,j,Y].filter(function(e){return null!=e}).reduce(eE,[9261,5381]);t.nodeKey=ew(q),t.hasPie=null!=Y&&9261!==Y[0]&&5381!==Y[1]}return o!==t.styleKey},i6.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},i6.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,a=n.types,o=n.properties[r.name].type,s=r.bypass,l=i[r.name],u=l&&l.bypass,c=e._private,h="mapping",d=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=d(l),i=d(r);n.checkTriggers(e,r.name,t,i)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",s)),r.delete)return i[r.name]=void 0,f(),!0;if(r.deleteBypassed)return l?!!l.bypass&&(l.bypassed=void 0,f(),!0):(f(),!0);if(r.deleteBypass)return l?!!l.bypass&&(i[r.name]=l.bypassed,f(),!0):(f(),!0);var p=function(){eO("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case a.mapData:for(var g,v,y=r.field.split("."),b=c.data,x=0;x<y.length&&b;x++)b=b[y[x]];if(null==b)return p(),!1;if(!M(b))return eO("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+b+"` for `"+e.id()+"` is non-numeric)"),!1;var w=r.fieldMax-r.fieldMin;if((v=0===w?0:(b-r.fieldMin)/w)<0?v=0:v>1&&(v=1),o.color){var E=r.valueMin[0],T=r.valueMax[0],k=r.valueMin[1],C=r.valueMax[1],P=r.valueMin[2],S=r.valueMax[2],D=null==r.valueMin[3]?1:r.valueMin[3],B=[Math.round(E+(T-E)*v),Math.round(k+(C-k)*v),Math.round(P+(S-P)*v),Math.round(D+((null==r.valueMax[3]?1:r.valueMax[3])-D)*v)];g={bypass:r.bypass,name:r.name,value:B,strValue:"rgb("+B[0]+", "+B[1]+", "+B[2]+")"}}else{if(!o.number)return!1;var A=r.valueMin+(r.valueMax-r.valueMin)*v;g=this.parse(r.name,A,r.bypass,h)}if(!g)return p(),!1;g.mapping=r,r=g;break;case a.data:for(var _=r.field.split("."),R=c.data,I=0;I<_.length&&R;I++)R=R[_[I]];if(null!=R&&(g=this.parse(r.name,R,r.bypass,h)),!g)return p(),!1;g.mapping=r,r=g;break;case a.fn:var N=r.value,L=null!=r.fnValue?r.fnValue:N(e);if(r.prevFnValue=L,null==L)return eO("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(g=this.parse(r.name,L,r.bypass,h)))return eO("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;g.mapping=ez(r),r=g;break;case void 0:break;default:return!1}return s?(u?r.bypassed=l.bypassed:r.bypassed=l,i[r.name]=r):u?l.bypassed=r:i[r.name]=r,f(),!0},i6.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),t)for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else r._private.style={}}},i6.update=function(){this._private.cy.mutableElements().updateStyle()},i6.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,u=0;u<i.length;u++){var c=i[u],h=e.pstyle(c),d=t[c];if(d){var f=d.prev,p=null!=d.next?d.next:h,g=!1,v=void 0;f&&(M(f.pfValue)&&M(p.pfValue)?(g=p.pfValue-f.pfValue,v=f.pfValue+1e-6*g):M(f.value)&&M(p.value)?(g=p.value-f.value,v=f.value+1e-6*g):A(f.value)&&A(p.value)&&(g=f.value[0]!==p.value[0]||f.value[1]!==p.value[1]||f.value[2]!==p.value[2],v=f.strValue),g&&(s[c]=p.strValue,this.applyBypass(e,c,v),l=!0))}}if(!l)return;r.transitioning=!0,new n3(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},i6.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);!e.removed()&&null!=s&&s(n,r,e)&&a(o)},i6.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},i6.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},i6.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},i6.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},i6.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var i8={};i8.applyBypass=function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name,s=this.parse(o,n,!0);s&&i.push(s)}}else if(D(t)){var l=this.parse(t,n,!0);l&&i.push(l)}else{if(!_(t))return!1;r=n;for(var u=Object.keys(t),c=0;c<u.length;c++){var h=u[c],d=t[h];if(void 0===d&&(d=t[Y(h)]),void 0!==d){var f=this.parse(h,d,!0);f&&i.push(f)}}}if(0===i.length)return!1;for(var p=!1,g=0;g<e.length;g++){for(var v=e[g],y={},b=void 0,x=0;x<i.length;x++){var w=i[x];if(r){var E=v.pstyle(w.name);b=y[w.name]={prev:E}}p=this.applyParsedProperty(v,ez(w))||p,r&&(b.next=v.pstyle(w.name))}p&&this.updateStyleHints(v),r&&this.updateTransitions(v,y,!0)}return p},i8.overrideBypass=function(e,t,n){t=j(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),s?a.strValue="rgb("+n.join(",")+")":l?a.strValue=n.join(" "):a.strValue=""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,t,u,n)}},i8.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},i8.removeBypasses=function(e,t,n){for(var r=0;r<e.length;r++){for(var i=e[r],a={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=i.pstyle(l.name);if(u&&u.bypass){var c=this.parse(s,"",!0),h=a[l.name]={prev:u};this.applyParsedProperty(i,c),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,a,!0)}};var i7={};i7.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},i7.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var ae={};ae.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},ae.getRawStyle=function(e,t){if(e=e[0]){for(var n={},r=0;r<this.properties.length;r++){var i=this.properties[r],a=this.getStylePropertyValue(e,i.name,t);null!=a&&(n[i.name]=a,n[Y(i.name)]=a)}return n}},ae.getIndexedStyle=function(e,t,n,r){var i=e.pstyle(t)[n][r];return null!=i?i:e.cy().style().getDefaultProperty(t)[n][0]},ae.getStylePropertyValue=function(e,t,n){if(e=e[0]){var r=this.properties[t];r.alias&&(r=r.pointsTo);var i=r.type,a=e.pstyle(r.name);if(a){var o=a.value,s=a.units,l=a.strValue;if(n&&i.number&&null!=o&&M(o)){var u=e.cy().zoom(),c=function(e){return e*u},h=function(e,t){return c(e)+t},d=A(o);return(d?s.every(function(e){return null!=e}):null!=s)?d?o.map(function(e,t){return h(e,s[t])}).join(" "):h(o,s):d?o.map(function(e){return D(e)?e:""+c(e)}).join(" "):""+c(o)}if(null!=l)return l}return null}},ae.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);void 0!==a&&(a=_(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},ae.getPropsList=function(e){var t=[],n=this.properties;if(e)for(var r=Object.keys(e),i=0;i<r.length;i++){var a=r[i],o=e[a],s=n[a]||n[j(a)],l=this.parse(s.name,o);l&&t.push(l)}return t},ae.getNonDefaultPropertiesHash=function(e,t,n){var r,i,a,o,s,l,u=n.slice();for(s=0;s<t.length;s++)if(r=t[s],null!=(i=e.pstyle(r,!1))){if(null!=i.pfValue)u[0]=eb(o,u[0]),u[1]=ex(o,u[1]);else for(l=0,a=i.strValue;l<a.length;l++)o=a.charCodeAt(l),u[0]=eb(o,u[0]),u[1]=ex(o,u[1])}return u},ae.getPropertiesHash=ae.getNonDefaultPropertiesHash;var at={};at.appendFromJson=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n.selector,i=n.style||n.css,a=Object.keys(i);this.selector(r);for(var o=0;o<a.length;o++){var s=a[o],l=i[s];this.css(s,l)}}return this},at.fromJson=function(e){return this.resetToDefault(),this.appendFromJson(e),this},at.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e};var an={};an.appendFromString=function(e){var t,n,r,i=""+e;function a(){i=i.length>t.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){eO("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l&&new rA(l).invalid){eO("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var h=[];!n.match(/^\s*$/);){var d=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!d){eO("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=d[0];var f=d[1],p=d[2];if(!this.properties[f]){eO("Skipping property: Invalid property name in: "+r),o();continue}if(!this.parse(f,p)){eO("Skipping property: Invalid property definition in: "+r),o();continue}h.push({name:f,val:p}),o()}if(c){a();break}this.selector(l);for(var g=0;g<h.length;g++){var v=h[g];this.css(v.name,v.val)}a()}return this},an.fromString=function(e){return this.resetToDefault(),this.appendFromString(e),this};var ar={};!function(){var e=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},t=function(e){var t=U+"|\\w+|"+G+"|"+Z+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+e+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+U+")\\s*\\,\\s*("+U+")\\s*,\\s*("+t+")\\s*\\,\\s*("+t+")\\)$"},n=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];ar.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},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:e("data")},layoutData:{mapping:!0,regex:e("layoutData")},scratch:{mapping:!0,regex:e("scratch")},mapData:{mapping:!0,regex:t("mapData")},mapLayoutData:{mapping:!0,regex:t("mapLayoutData")},mapScratch:{mapping:!0,regex:t("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:n,singleRegexMatchValue:!0},urls:{regexes:n,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return D(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+U+")\\s*,\\s*("+U+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+U+")\\s*,\\s*("+U+")\\s*,\\s*("+U+")\\s*,\\s*("+U+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return 1===t||2===t||4===t}}};var r=function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},i=function(e,t){return e!=t},a=ar.types,o=[{name:"label",type:a.text,triggersBounds:i,triggersZOrder:function(e,t){var n=F(e),r=F(t);return n&&!r||!n&&r}},{name:"text-rotation",type:a.textRotation,triggersBounds:i},{name:"text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"text-margin-y",type:a.bidirectionalSize,triggersBounds:i}],s=[{name:"source-label",type:a.text,triggersBounds:i},{name:"source-text-rotation",type:a.textRotation,triggersBounds:i},{name:"source-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-offset",type:a.size,triggersBounds:i}],l=[{name:"target-label",type:a.text,triggersBounds:i},{name:"target-text-rotation",type:a.textRotation,triggersBounds:i},{name:"target-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-offset",type:a.size,triggersBounds:i}],u=[{name:"font-family",type:a.fontFamily,triggersBounds:i},{name:"font-style",type:a.fontStyle,triggersBounds:i},{name:"font-weight",type:a.fontWeight,triggersBounds:i},{name:"font-size",type:a.size,triggersBounds:i},{name:"text-transform",type:a.textTransform,triggersBounds:i},{name:"text-wrap",type:a.textWrap,triggersBounds:i},{name:"text-overflow-wrap",type:a.textOverflowWrap,triggersBounds:i},{name:"text-max-width",type:a.size,triggersBounds:i},{name:"text-outline-width",type:a.size,triggersBounds:i},{name:"line-height",type:a.positiveNumber,triggersBounds:i}],c=[{name:"text-valign",type:a.valign,triggersBounds:i},{name:"text-halign",type:a.halign,triggersBounds:i},{name:"color",type:a.color},{name:"text-outline-color",type:a.color},{name:"text-outline-opacity",type:a.zeroOneNumber},{name:"text-background-color",type:a.color},{name:"text-background-opacity",type:a.zeroOneNumber},{name:"text-background-padding",type:a.size,triggersBounds:i},{name:"text-border-opacity",type:a.zeroOneNumber},{name:"text-border-color",type:a.color},{name:"text-border-width",type:a.size,triggersBounds:i},{name:"text-border-style",type:a.borderStyle,triggersBounds:i},{name:"text-background-shape",type:a.textBackgroundShape,triggersBounds:i},{name:"text-justification",type:a.justification}],h=[{name:"events",type:a.bool,triggersZOrder:i},{name:"text-events",type:a.bool,triggersZOrder:i}],d=[{name:"display",type:a.display,triggersZOrder:i,triggersBounds:i,triggersBoundsOfConnectedEdges:i,triggersBoundsOfParallelEdges:function(e,t,n){return e!==t&&"bezier"===n.pstyle("curve-style").value}},{name:"visibility",type:a.visibility,triggersZOrder:i},{name:"opacity",type:a.zeroOneNumber,triggersZOrder:r},{name:"text-opacity",type:a.zeroOneNumber},{name:"min-zoomed-font-size",type:a.size},{name:"z-compound-depth",type:a.zCompoundDepth,triggersZOrder:i},{name:"z-index-compare",type:a.zIndexCompare,triggersZOrder:i},{name:"z-index",type:a.number,triggersZOrder:i}],f=[{name:"overlay-padding",type:a.size,triggersBounds:i},{name:"overlay-color",type:a.color},{name:"overlay-opacity",type:a.zeroOneNumber,triggersBounds:r},{name:"overlay-shape",type:a.overlayShape,triggersBounds:i},{name:"overlay-corner-radius",type:a.cornerRadius}],p=[{name:"underlay-padding",type:a.size,triggersBounds:i},{name:"underlay-color",type:a.color},{name:"underlay-opacity",type:a.zeroOneNumber,triggersBounds:r},{name:"underlay-shape",type:a.overlayShape,triggersBounds:i},{name:"underlay-corner-radius",type:a.cornerRadius}],g=[{name:"transition-property",type:a.propList},{name:"transition-duration",type:a.time},{name:"transition-delay",type:a.time},{name:"transition-timing-function",type:a.easing}],v=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},y=[{name:"height",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"width",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"shape",type:a.nodeShape,triggersBounds:i},{name:"shape-polygon-points",type:a.polygonPointList,triggersBounds:i},{name:"corner-radius",type:a.cornerRadius},{name:"background-color",type:a.color},{name:"background-fill",type:a.fill},{name:"background-opacity",type:a.zeroOneNumber},{name:"background-blacken",type:a.nOneOneNumber},{name:"background-gradient-stop-colors",type:a.colors},{name:"background-gradient-stop-positions",type:a.percentages},{name:"background-gradient-direction",type:a.gradientDirection},{name:"padding",type:a.sizeMaybePercent,triggersBounds:i},{name:"padding-relative-to",type:a.paddingRelativeTo,triggersBounds:i},{name:"bounds-expansion",type:a.boundsExpansion,triggersBounds:i}],b=[{name:"border-color",type:a.color},{name:"border-opacity",type:a.zeroOneNumber},{name:"border-width",type:a.size,triggersBounds:i},{name:"border-style",type:a.borderStyle},{name:"border-cap",type:a.lineCap},{name:"border-join",type:a.lineJoin},{name:"border-dash-pattern",type:a.numbers},{name:"border-dash-offset",type:a.number},{name:"border-position",type:a.linePosition}],x=[{name:"outline-color",type:a.color},{name:"outline-opacity",type:a.zeroOneNumber},{name:"outline-width",type:a.size,triggersBounds:i},{name:"outline-style",type:a.borderStyle},{name:"outline-offset",type:a.size,triggersBounds:i}],w=[{name:"background-image",type:a.urls},{name:"background-image-crossorigin",type:a.bgCrossOrigin},{name:"background-image-opacity",type:a.zeroOneNumbers},{name:"background-image-containment",type:a.bgContainment},{name:"background-image-smoothing",type:a.bools},{name:"background-position-x",type:a.bgPos},{name:"background-position-y",type:a.bgPos},{name:"background-width-relative-to",type:a.bgRelativeTo},{name:"background-height-relative-to",type:a.bgRelativeTo},{name:"background-repeat",type:a.bgRepeat},{name:"background-fit",type:a.bgFit},{name:"background-clip",type:a.bgClip},{name:"background-width",type:a.bgWH},{name:"background-height",type:a.bgWH},{name:"background-offset-x",type:a.bgPos},{name:"background-offset-y",type:a.bgPos}],E=[{name:"position",type:a.position,triggersBounds:i},{name:"compound-sizing-wrt-labels",type:a.compoundIncludeLabels,triggersBounds:i},{name:"min-width",type:a.size,triggersBounds:i},{name:"min-width-bias-left",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-width-bias-right",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height",type:a.size,triggersBounds:i},{name:"min-height-bias-top",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height-bias-bottom",type:a.sizeMaybePercent,triggersBounds:i}],T=[{name:"line-style",type:a.lineStyle},{name:"line-color",type:a.color},{name:"line-fill",type:a.fill},{name:"line-cap",type:a.lineCap},{name:"line-opacity",type:a.zeroOneNumber},{name:"line-dash-pattern",type:a.numbers},{name:"line-dash-offset",type:a.number},{name:"line-outline-width",type:a.size},{name:"line-outline-color",type:a.color},{name:"line-gradient-stop-colors",type:a.colors},{name:"line-gradient-stop-positions",type:a.percentages},{name:"curve-style",type:a.curveStyle,triggersBounds:i,triggersBoundsOfParallelEdges:function(e,t){return e!==t&&("bezier"===e||"bezier"===t)}},{name:"haystack-radius",type:a.zeroOneNumber,triggersBounds:i},{name:"source-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"target-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"control-point-step-size",type:a.size,triggersBounds:i},{name:"control-point-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"control-point-weights",type:a.numbers,triggersBounds:i},{name:"segment-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"segment-weights",type:a.numbers,triggersBounds:i},{name:"segment-radii",type:a.numbers,triggersBounds:i},{name:"radius-type",type:a.radiusType,triggersBounds:i},{name:"taxi-turn",type:a.bidirectionalSizeMaybePercent,triggersBounds:i},{name:"taxi-turn-min-distance",type:a.size,triggersBounds:i},{name:"taxi-direction",type:a.axisDirection,triggersBounds:i},{name:"taxi-radius",type:a.number,triggersBounds:i},{name:"edge-distances",type:a.edgeDistances,triggersBounds:i},{name:"arrow-scale",type:a.positiveNumber,triggersBounds:i},{name:"loop-direction",type:a.angle,triggersBounds:i},{name:"loop-sweep",type:a.angle,triggersBounds:i},{name:"source-distance-from-node",type:a.size,triggersBounds:i},{name:"target-distance-from-node",type:a.size,triggersBounds:i}],k=[{name:"ghost",type:a.bool,triggersBounds:i},{name:"ghost-offset-x",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-offset-y",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-opacity",type:a.zeroOneNumber}],C=[{name:"selection-box-color",type:a.color},{name:"selection-box-opacity",type:a.zeroOneNumber},{name:"selection-box-border-color",type:a.color},{name:"selection-box-border-width",type:a.size},{name:"active-bg-color",type:a.color},{name:"active-bg-opacity",type:a.zeroOneNumber},{name:"active-bg-size",type:a.size},{name:"outside-texture-bg-color",type:a.color},{name:"outside-texture-bg-opacity",type:a.zeroOneNumber}],P=[];ar.pieBackgroundN=16,P.push({name:"pie-size",type:a.sizeMaybePercent});for(var S=1;S<=ar.pieBackgroundN;S++)P.push({name:"pie-"+S+"-background-color",type:a.color}),P.push({name:"pie-"+S+"-background-size",type:a.percent}),P.push({name:"pie-"+S+"-background-opacity",type:a.zeroOneNumber});var B=[],A=ar.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:a.arrowShape,triggersBounds:i},{name:"arrow-color",type:a.color},{name:"arrow-fill",type:a.arrowFill},{name:"arrow-width",type:a.arrowWidth}].forEach(function(e){A.forEach(function(t){var n=t+"-"+e.name,r=e.type,i=e.triggersBounds;B.push({name:n,type:r,triggersBounds:i})})},{});var _=ar.properties=[].concat(h,g,d,f,p,k,c,u,o,s,l,y,b,x,w,P,E,T,B,C),M=ar.propertyGroups={behavior:h,transition:g,visibility:d,overlay:f,underlay:p,ghost:k,commonLabel:c,labelDimensions:u,mainLabel:o,sourceLabel:s,targetLabel:l,nodeBody:y,nodeBorder:b,nodeOutline:x,backgroundImage:w,pie:P,compound:E,edgeLine:T,edgeArrow:B,core:C},R=ar.propertyGroupNames={};(ar.propertyGroupKeys=Object.keys(M)).forEach(function(e){R[e]=M[e].map(function(e){return e.name}),M[e].forEach(function(t){return t.groupKey=e})});var I=ar.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"}];ar.propertyNames=_.map(function(e){return e.name});for(var N=0;N<_.length;N++){var L=_[N];_[L.name]=L}for(var O=0;O<I.length;O++){var z=I[O],V=_[z.pointsTo],X={name:z.name,alias:!0,pointsTo:V};_.push(X),_[z.name]=X}}(),ar.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},ar.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=Q({"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","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%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(e,t){for(var n=1;n<=ar.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e},{}),{"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(e,t){return ar.arrowPrefixes.forEach(function(n){var r=n+"-"+t.name,i=t.value;e[r]=i}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);n[a]=s}}return e.defaultProperties=n,e.defaultProperties},ar.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 ai={};ai.parse=function(e,t,n,r){if(B(t))return this.parseImplWarn(e,t,n,r);var i,a=eC(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),o=this.propCache=this.propCache||[];return(i=o[a])||(i=o[a]=this.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(i=ez(i))&&(i.value=ez(i.value)),i},ai.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return i||null==t||eO("The style property `".concat(e,": ").concat(t,"` is invalid")),i&&("width"===i.name||"height"===i.name)&&"label"===t&&eO("The style value of `label` is deprecated for `"+i.name+"`"),i},ai.parseImpl=function(e,t,n,r){e=j(e);var i=this.properties[e],a=t,o=this.types;if(!i||void 0===t)return null;i.alias&&(e=(i=i.pointsTo).name);var s=D(t);s&&(t=t.trim());var l=i.type;if(!l)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(B(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};if(!s||r||t.length<7||"a"!==t[1]);else if(t.length>=7&&"d"===t[0]&&(g=new RegExp(o.data.regex).exec(t))){if(n)return!1;var u=o.data;return{name:e,value:g,strValue:""+t,mapped:u,field:g[1],bypass:n}}else if(t.length>=10&&"m"===t[0]&&(v=new RegExp(o.mapData.regex).exec(t))){if(n||l.multiple)return!1;var c=o.mapData;if(!(l.color||l.number))return!1;var h=this.parse(e,v[4]);if(!h||h.mapped)return!1;var d=this.parse(e,v[5]);if(!d||d.mapped)return!1;if(h.pfValue===d.pfValue||h.strValue===d.strValue)return eO("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+h.strValue+"`"),this.parse(e,h.strValue);if(l.color){var f=h.value,p=d.value;if(f[0]===p[0]&&f[1]===p[1]&&f[2]===p[2]&&(f[3]===p[3]||(null==f[3]||1===f[3])&&(null==p[3]||1===p[3])))return!1}return{name:e,value:v,strValue:""+t,mapped:c,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:h.value,valueMax:d.value,bypass:n}}if(l.multiple&&"multiple"!==r){if(y=s?t.split(/\s+/):A(t)?t:[t],l.evenMultiple&&y.length%2!=0)return null;for(var g,v,y,b=[],x=[],w=[],E="",T=!1,k=0;k<y.length;k++){var C=this.parse(e,y[k],n,"multiple");T=T||D(C.value),b.push(C.value),w.push(null!=C.pfValue?C.pfValue:C.value),x.push(C.units),E+=(k>0?" ":"")+C.strValue}return l.validate&&!l.validate(b,x)?null:l.singleEnum&&T?1===b.length&&D(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var P=function(){for(var r=0;r<l.enums.length;r++)if(l.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n};return null};if(l.number){var S,_,R="px";if(l.units&&(_=l.units),l.implicitUnits&&(R=l.implicitUnits),!l.unitless){if(s){var I="px|em"+(l.allowPercent?"|\\%":"");_&&(I=_);var N=t.match("^("+U+")("+I+")?$");N&&(t=N[1],_=N[2]||R)}else(!_||l.implicitUnits)&&(_=R)}if(isNaN(t=parseFloat(t))&&void 0===l.enums)return null;if(isNaN(t)&&void 0!==l.enums)return t=a,P();if(l.integer&&!(M(S=t)&&Math.floor(S)===S)||void 0!==l.min&&(t<l.min||l.strictMin&&t===l.min)||void 0!==l.max&&(t>l.max||l.strictMax&&t===l.max))return null;var L={name:e,value:t,strValue:""+t+(_||""),units:_,bypass:n};return l.unitless||"px"!==_&&"em"!==_?L.pfValue=t:L.pfValue="px"!==_&&_?this.getEmSizeInPixels()*t:t,("ms"===_||"s"===_)&&(L.pfValue="ms"===_?t:1e3*t),("deg"===_||"rad"===_)&&(L.pfValue="rad"===_?t:Math.PI*t/180),"%"===_&&(L.pfValue=t/100),L}if(l.propList){var O=[],z=""+t;if("none"===z);else{for(var F=z.split(/\s*,\s*|\s+/),V=0;V<F.length;V++){var X=F[V].trim();this.properties[X]?O.push(X):eO("`"+X+"` is not a valid property name")}if(0===O.length)return null}return{name:e,value:O,strValue:0===O.length?"none":O.join(" "),bypass:n}}if(l.color){var Y=en(t);return Y?{name:e,value:Y,pfValue:Y,strValue:"rgb("+Y[0]+","+Y[1]+","+Y[2]+")",bypass:n}:null}if(l.regex||l.regexes){if(l.enums){var q=P();if(q)return q}for(var W=l.regexes?l.regexes:[l.regex],H=0;H<W.length;H++){var G=new RegExp(W[H]).exec(t);if(G)return{name:e,value:l.singleRegexMatchValue?G[1]:G,strValue:""+t,bypass:n}}return null}return l.string?{name:e,value:""+t,strValue:""+t,bypass:n}:l.enums?P():null};var aa=function(e){if(!(this instanceof aa))return new aa(e);if(!O(e)){eN("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},ao=aa.prototype;ao.instanceString=function(){return"style"},ao.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},ao.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},ao.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},ao.selector=function(e){var t="core"===e?null:new rA(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},ao.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],n=0;n<this.properties.length;n++){var r=this.properties[n],i=t[r.name];void 0===i&&(i=t[Y(r.name)]),void 0!==i&&this.cssRule(r.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},ao.style=ao.css,ao.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n),this[r].selector||(this._private.coreStyle[n.name]=n)}return this},ao.append=function(e){return z(e)?e.appendToStyle(this):A(e)?this.appendFromJson(e):D(e)&&this.appendFromString(e),this},aa.fromJson=function(e,t){var n=new aa(e);return n.fromJson(t),n},aa.fromString=function(e,t){return new aa(e).fromString(t)},[i6,i8,i7,ae,at,an,ar,ai].forEach(function(e){Q(ao,e)}),aa.types=ao.types,aa.properties=ao.properties,aa.propertyGroups=ao.propertyGroups,aa.propertyGroupNames=ao.propertyGroupNames,aa.propertyGroupKeys=ao.propertyGroupKeys;var as={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return(null==t.selectionType&&(t.selectionType="single"),void 0===e)?t.selectionType:(("additive"===e||"single"===e)&&(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(D(a[0]))return o[e=a[0]];if(_(a[0])){if(!this._private.panningEnabled)return this;r=(n=a[0]).x,i=n.y,M(r)&&(o.x=r),M(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],("x"===e||"y"===e)&&M(t)&&(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a=arguments,o=this._private.pan;if(!this._private.panningEnabled)return this;switch(a.length){case 1:_(e)&&(r=(n=a[0]).x,i=n.y,M(r)&&(o.x+=r),M(i)&&(o.y+=i),this.emit("pan viewport"));break;case 2:("x"===e||"y"===e)&&M(t)&&(o[e]+=t),this.emit("pan viewport")}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(M(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){if(D(e)){var n,r,i,a=e;e=this.$(a)}else if(_(n=e)&&M(n.x1)&&M(n.x2)&&M(n.y1)&&M(n.y2)){var o=e;(r={x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2}).w=r.x2-r.x1,r.h=r.y2-r.y1}else I(e)||(e=this.mutableElements());if(!(I(e)&&e.empty())){r=r||e.boundingBox();var s=this.width(),l=this.height();if(t=M(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){i=(i=(i=Math.min((s-2*t)/r.w,(l-2*t)/r.h))>this._private.maxZoom?this._private.maxZoom:i)<this._private.minZoom?this._private.minZoom:i;var u={x:(s-i*(r.x1+r.x2))/2,y:(l-i*(r.y1+r.y2))/2};return{zoom:i,pan:u}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return M(e)&&M(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):M(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:M(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),M(e)?n=e:_(e)&&(n=e.level,null!=e.position?t=tt(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!M(n)||n===a||null!=t&&(!M(t.x)||!M(t.y)))return null;if(null==t)return{zoomed:!0,panned:!1,zoom:n,pan:i};var s=n,l={x:-s/a*(t.x-i.x)+t.x,y:-s/a*(t.y-i.y)+t.y};return{zoomed:!0,panned:!0,zoom:s,pan:l}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed&&(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport")),this},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e||(M(e.zoom)||(n=!1),_(e.pan)||(r=!1),!n&&!r))return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;M(l.x)&&(t.pan.x=l.x,o=!1),M(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(D(e)){var n=e;e=this.mutableElements().filter(n)}else I(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled&&this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=this.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};as.centre=as.center,as.autolockNodes=as.autolock,as.autoungrabifyNodes=as.autoungrabify;var al={data:rh.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:rh.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:rh.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:rh.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};al.attr=al.data,al.removeAttr=al.removeData;var au=function(e){var t=this,n=(e=Q({},e)).container;n&&!R(n)&&R(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{}).cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==w&&void 0!==n&&!e.headless,o=e;o.layout=Q({name:a?"grid":"null"},o.layout),o.renderer=Q({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new ij(this),listeners:[],aniEles:new ij(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:M(o.zoom)?o.zoom:1,pan:{x:_(o.pan)&&M(o.pan.x)?o.pan.x:0,y:_(o.pan)&&M(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=Q({},o,o.renderer);t.initRenderer(u);var c=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(_(e)||A(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var a=Q({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};!function(e,t){if(e.some(V))return n3.all(e).then(t);t(e)}([o.style,o.elements],function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),c(a,function(){t.startAnimationLoop(),l.ready=!0,B(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")},o.done)})},ac=au.prototype;Q(ac,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){if(!this.destroyed())return this.stopAnimationLoop(),this.destroyRenderer(),this.emit("destroy"),this._private.destroyed=!0,this},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(null==this._private.container)return w;var e=this._private.container.ownerDocument;return void 0===e||null==e?w:e.defaultView||w},mount:function(e){if(null!=e){var t=this._private,n=t.options;return!R(e)&&R(e[0])&&(e=e[0]),this.stopAnimationLoop(),this.destroyRenderer(),t.container=e,t.styleEnabled=!0,this.invalidateSize(),this.initRenderer(Q({},n,n.renderer,{name:"null"===n.renderer.name?"canvas":n.renderer.name})),this.startAnimationLoop(),this.style(n.style),this.emit("mount"),this}},unmount:function(){return this.stopAnimationLoop(),this.destroyRenderer(),this.initRenderer({name:"null"}),this.emit("unmount"),this},options:function(){return ez(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements();if(_(e)){if(t.startBatch(),e.elements){var i={},a=function(e,n){for(var r=[],a=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){eO("cy.json() cannot handle elements without an ID attribute");continue}var l=""+s.data.id,u=t.getElementById(l);i[l]=!0,0!==u.length?a.push({ele:u,json:s}):(n&&(s.group=n),r.push(s))}t.add(r);for(var c=0;c<a.length;c++){var h=a[c],d=h.ele,f=h.json;d.json(f)}};if(A(e.elements))a(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];A(u)&&a(u,l)}var c=t.collection();r.filter(function(e){return!i[e.id()]}).forEach(function(e){e.isParent()?c.merge(e):e.remove()}),c.forEach(function(e){return e.children().move({parent:null})}),c.forEach(function(e){return t.getElementById(e.id()).remove()})}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<h.length;d++){var f=h[d];null!=e[f]&&t[f](e[f])}return t.endBatch(),this}var p={};e?p.elements=this.elements().map(function(e){return e.json()}):(p.elements={},r.forEach(function(e){var t=e.group();p.elements[t]||(p.elements[t]=[]),p.elements[t].push(e.json())})),this._private.styleEnabled&&(p.style=t.style().json()),p.data=ez(t.data());var g=n.options;return p.zoomingEnabled=n.zoomingEnabled,p.userZoomingEnabled=n.userZoomingEnabled,p.zoom=n.zoom,p.minZoom=n.minZoom,p.maxZoom=n.maxZoom,p.panningEnabled=n.panningEnabled,p.userPanningEnabled=n.userPanningEnabled,p.pan=ez(n.pan),p.boxSelectionEnabled=n.boxSelectionEnabled,p.renderer=ez(g.renderer),p.hideEdgesOnViewport=g.hideEdgesOnViewport,p.textureOnViewport=g.textureOnViewport,p.wheelSensitivity=g.wheelSensitivity,p.motionBlur=g.motionBlur,p.multiClickDebounceTime=g.multiClickDebounceTime,p}}),ac.$id=ac.getElementById,[{add:function(e){var t;if(I(e)){if(e._private.cy===this)t=e.restore();else{for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(i.json())}t=new ij(this,n)}}else if(A(e))t=new ij(this,e);else if(_(e)&&(A(e.nodes)||A(e.edges))){for(var a=[],o=["nodes","edges"],s=0,l=o.length;s<l;s++){var u=o[s],c=e[u];if(A(c))for(var h=0,d=c.length;h<d;h++){var f=Q({group:u},c[h]);a.push(f)}}t=new ij(this,a)}else t=new eQ(this,e).collection();return t},remove:function(e){if(I(e));else if(D(e)){var t=e;e=this.$(t)}return e.remove()}},iQ,i1,i2,i5,{notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}})}},i4,i9,{style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return z(e)?t.style=e.generateStyle(this):A(e)?t.style=aa.fromJson(this,e):D(e)?t.style=aa.fromString(this,e):t.style=aa(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},as,al].forEach(function(e){Q(ac,e)});var ah={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}},ad={maximal:!1,acyclic:!1},af=function(e){return e.scratch("breadthfirst")},ap=function(e,t){return e.scratch("breadthfirst",t)};function ag(e){this.options=Q({},ah,ad,e)}ag.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=r.nodes().filter(function(e){return e.isChildless()}),a=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=!!t.boundingBox,l=n.extent(),u=tm(s?t.boundingBox:{x1:l.x1,y1:l.y1,w:l.w,h:l.h});if(I(t.roots))e=t.roots;else if(A(t.roots)){for(var c=[],h=0;h<t.roots.length;h++){var d=t.roots[h],f=n.getElementById(d);c.push(f)}e=n.collection(c)}else if(D(t.roots))e=n.$(t.roots);else if(a)e=i.roots();else{var p=r.components();e=n.collection();for(var g=0;g<p.length;g++)!function(){var t=p[g],n=t.maxDegree(!1),r=t.filter(function(e){return e.degree(!1)===n});e=e.add(r)}()}var v=[],y={},b=function(e,t){null==v[t]&&(v[t]=[]);var n=v[t].length;v[t].push(e),ap(e,{index:n,depth:t})},x=function(e,t){var n=af(e),r=n.depth,i=n.index;v[r][i]=null,e.isChildless()&&b(e,t)};r.bfs({roots:e,directed:t.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&b(a,i),y[o]=!0}});for(var w=[],E=0;E<i.length;E++){var T=i[E];y[T.id()]||w.push(T)}var k=function(e){for(var t=v[e],n=0;n<t.length;n++){var r=t[n];if(null==r){t.splice(n,1),n--;continue}ap(r,{depth:e,index:n})}};if(a&&o){var C=[],P={},S=function(e){return C.push(e)};for(i.forEach(function(e){return C.push(e)});C.length>0;){var B=C.shift(),_=function(e,n){for(var i=af(e),a=e.incomers().filter(function(e){return e.isNode()&&r.has(e)}),o=-1,s=e.id(),l=0;l<a.length;l++)o=Math.max(o,af(a[l]).depth);if(i.depth<=o){if(!t.acyclic&&n[s])return null;var u=o+1;return x(e,u),n[s]=u,!0}return!1}(B,P);if(_)B.outgoers().filter(function(e){return e.isNode()&&r.has(e)}).forEach(S);else if(null===_){eO("Detected double maximal shift for node `"+B.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var M=0;if(t.avoidOverlap)for(var R=0;R<i.length;R++){var N=i[R].layoutDimensions(t),L=N.w,O=N.h;M=Math.max(M,L,O)}var z={},F=function(e){if(z[e.id()])return z[e.id()];for(var t=af(e).depth,n=e.neighborhood(),r=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!(s.isEdge()||s.isParent())&&i.has(s)){var l=af(s);if(null!=l){var u=l.index,c=l.depth;if(null!=u&&null!=c){var h=v[c].length;c<t&&(r+=u/h,a++)}}}}return r/=a=Math.max(1,a),0===a&&(r=0),z[e.id()]=r,r},V=function(e,t){var n=F(e)-F(t);return 0===n?$(e.id(),t.id()):n};void 0!==t.depthSort&&(V=t.depthSort);for(var X=v.length,j=0;j<X;j++)v[j].sort(V),k(j);for(var Y=[],q=0;q<w.length;q++)Y.push(w[q]);Y.length&&(v.unshift(Y),X=v.length,function(){for(var e=0;e<X;e++)k(e)}());for(var W=0,U=0;U<X;U++)W=Math.max(v[U].length,W);var H={x:u.x1+u.w/2,y:u.y1+u.h/2},G=i.reduce(function(e,n){var r;return r=n.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}),{w:-1===e.w?r.w:(e.w+r.w)/2,h:-1===e.h?r.h:(e.h+r.h)/2}},{w:-1,h:-1}),K=Math.max(1===X?0:s?(u.h-2*t.padding-G.h)/(X-1):(u.h-2*t.padding-G.h)/(X+1),M),Z=v.reduce(function(e,t){return Math.max(e,t.length)},0);return r.nodes().layoutPositions(this,t,function(e){var n=af(e),r=n.depth,i=n.index;if(t.circle){var a=Math.min(u.w/2/X,u.h/2/X),o=(a=Math.max(a,M))*r+a-(X>0&&v[0].length<=3?a/2:0),l=2*Math.PI/v[r].length*i;return 0===r&&1===v[0].length&&(o=1),{x:H.x+o*Math.cos(l),y:H.y+o*Math.sin(l)}}var c=v[r].length,h=Math.max(1===c?0:s?(u.w-2*t.padding-G.w)/((t.grid?Z:c)-1):(u.w-2*t.padding-G.w)/((t.grid?Z:c)+1),M);return{x:H.x+(i+1-(c+1)/2)*h,y:H.y+(r+1-(X+1)/2)*K}}),this};var av={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 ay(e){this.options=Q({},av,e)}ay.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o=tm(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),u=0,c=0;c<a.length;c++){var h=a[c].layoutDimensions(t);u=Math.max(u,h.w,h.h)}if(e=M(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-u,a.length>1&&t.avoidOverlap){var d=Math.cos(l)-1,f=Math.sin(l)-0;e=Math.max(Math.sqrt((u*=1.75)*u/(d*d+f*f)),e)}return r.nodes().layoutPositions(this,t,function(n,r){var a=t.startAngle+r*l*(i?1:-1),o=e*Math.cos(a),u=e*Math.sin(a);return{x:s.x+o,y:s.y+u}}),this};var am={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 ab(e){this.options=Q({},am,e)}ab.prototype.run=function(){for(var e=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,n=e.cy,r=e.eles,i=r.nodes().not(":parent"),a=tm(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:a.x1+a.w/2,y:a.y1+a.h/2},s=[],l=0,u=0;u<i.length;u++){var c=i[u],h=void 0;h=e.concentric(c),s.push({value:h,node:c}),c._private.scratch.concentric=h}i.updateStyle();for(var d=0;d<i.length;d++){var f=i[d].layoutDimensions(e);l=Math.max(l,f.w,f.h)}s.sort(function(e,t){return t.value-e.value});for(var p=e.levelWidth(i),g=[[]],v=g[0],y=0;y<s.length;y++){var b=s[y];v.length>0&&Math.abs(v[0].value-b.value)>=p&&(v=[],g.push(v)),v.push(b)}var x=l+e.minNodeSpacing;if(!e.avoidOverlap){var w=g.length>0&&g[0].length>1,E=(Math.min(a.w,a.h)/2-x)/(g.length+w?1:0);x=Math.min(x,E)}for(var T=0,k=0;k<g.length;k++){var C=g[k],P=void 0===e.sweep?2*Math.PI-2*Math.PI/C.length:e.sweep,S=C.dTheta=P/Math.max(1,C.length-1);if(C.length>1&&e.avoidOverlap){var D=Math.cos(S)-1,B=Math.sin(S)-0;T=Math.max(Math.sqrt(x*x/(D*D+B*B)),T)}C.r=T,T+=x}if(e.equidistant){for(var A=0,_=0,M=0;M<g.length;M++)A=Math.max(A,g[M].r-_);_=0;for(var R=0;R<g.length;R++){var I=g[R];0===R&&(_=I.r),I.r=_,_+=A}}for(var N={},L=0;L<g.length;L++)for(var O=g[L],z=O.dTheta,F=O.r,V=0;V<O.length;V++){var X=O[V],j=e.startAngle+(t?1:-1)*z*V,Y={x:o.x+F*Math.cos(j),y:o.y+F*Math.sin(j)};N[X.node.id()]=Y}return r.nodes().layoutPositions(this,e,function(e){return N[e.id()]}),this};var ax={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 aw(e){this.options=Q({},ax,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(e){var n=e.source().data("id"),r=e.target().data("id"),i=t.some(function(e){return e.data("id")===n}),a=t.some(function(e){return e.data("id")===r});return!i||!a});this.options.eles=this.options.eles.not(n)}aw.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(!0===e.animate||!1===e.animate)&&n.emit({type:"layoutstart",layout:n}),la=!0===e.debug;var r=aE(t,n,e);la&&lo(r),e.randomize&&aC(r);var i=eg(),a=function(){aS(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!n.stopped&&!(t>=e.numIter)&&(aD(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),i=aP(r,e,t);t.layoutPositions(n,e,i)}},l=0,u=!0;if(!0===e.animate){var c=function(){for(var t=0;u&&t<e.refresh;)u=o(l),l++,t++;u?(eg()-i>=e.animationThreshold&&a(),ey(c)):(aV(r,e),s())};c()}else{for(;u;)u=o(l),l++;aV(r,e),s()}return this},aw.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},aw.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var aE=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=tm(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],h=0;h<c.length;h++){var d=c[h];l[d.id()]=u}for(var u=0;u<o.nodeSize;u++){var f=i[u],p=f.layoutDimensions(n),g={};g.isLocked=f.locked(),g.id=f.data("id"),g.parentId=f.data("parent"),g.cmptId=l[f.id()],g.children=[],g.positionX=f.position("x"),g.positionY=f.position("y"),g.offsetX=0,g.offsetY=0,g.height=p.w,g.width=p.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(f.style("padding")),g.padRight=parseFloat(f.style("padding")),g.padTop=parseFloat(f.style("padding")),g.padBottom=parseFloat(f.style("padding")),g.nodeRepulsion=B(n.nodeRepulsion)?n.nodeRepulsion(f):n.nodeRepulsion,o.layoutNodes.push(g),o.idToIndex[g.id]=u}for(var v=[],y=0,b=-1,x=[],u=0;u<o.nodeSize;u++){var f=o.layoutNodes[u],w=f.parentId;null!=w?o.layoutNodes[o.idToIndex[w]].children.push(f.id):(v[++b]=f.id,x.push(f.id))}for(o.graphSet.push(x);y<=b;){var E=v[y++],T=o.idToIndex[E],d=o.layoutNodes[T],k=d.children;if(k.length>0){o.graphSet.push(k);for(var u=0;u<k.length;u++)v[++b]=k[u]}}for(var u=0;u<o.graphSet.length;u++)for(var C=o.graphSet[u],h=0;h<C.length;h++){var P=o.idToIndex[C[h]];o.indexToGraph[P]=u}for(var u=0;u<o.edgeSize;u++){var S=r[u],D={};D.id=S.data("id"),D.sourceId=S.data("source"),D.targetId=S.data("target");var A=B(n.idealEdgeLength)?n.idealEdgeLength(S):n.idealEdgeLength,_=B(n.edgeElasticity)?n.edgeElasticity(S):n.edgeElasticity,M=o.idToIndex[D.sourceId],R=o.idToIndex[D.targetId];if(o.indexToGraph[M]!=o.indexToGraph[R]){for(var I=aT(D.sourceId,D.targetId,o),N=o.graphSet[I],L=0,g=o.layoutNodes[M];-1===N.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],L++;for(g=o.layoutNodes[R];-1===N.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],L++;A*=L*n.nestingFactor}D.idealLength=A,D.elasticity=_,o.layoutEdges.push(D)}return o},aT=function(e,t,n){var r=ak(e,t,0,n);return 2>r.count?0:r.graph},ak=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o],l=r.idToIndex[s],u=r.layoutNodes[l].children;if(0!==u.length){var c=ak(e,t,r.indexToGraph[r.idToIndex[u[0]]],r);if(0!==c.count){if(1!==c.count)return c;if(2==++a)break}}}return{count:a,graph:n}},aC=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},aP=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(!t.boundingBox)return{x:o.positionX,y:o.positionY};var s=(o.positionX-i.x1)/i.w,l=(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}},aS=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=aP(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},aD=function(e,t,n){aB(e,t),aI(e),aN(e,t),aL(e),aO(e)},aB=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++)a_(o,e.layoutNodes[e.idToIndex[r[s]]],e,t)},aA=function(e){return -1+2*e*Math.random()},a_=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY;0===i&&0===a&&(i=aA(1),a=aA(1));var o=aM(e,t,i,a);if(o>0)var s=r.nodeOverlap*o,l=Math.sqrt(i*i+a*a),u=s*i/l,c=s*a/l;else var h=aR(e,i,a),d=aR(t,-1*i,-1*a),f=d.x-h.x,p=d.y-h.y,g=f*f+p*p,l=Math.sqrt(g),s=(e.nodeRepulsion+t.nodeRepulsion)/g,u=s*f/l,c=s*p/l;e.isLocked||(e.offsetX-=u,e.offsetY-=c),t.isLocked||(t.offsetX+=u,t.offsetY+=c)}},aM=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},aR=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0<n||0===t&&0>n?(u.x=r,u.y=i+a/2):0<t&&-1*l<=s&&s<=l?(u.x=r+o/2,u.y=i+o*n/2/t):0>t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t):0<n&&(s<=-1*l||s>=l)?(u.x=r+a*t/2/n,u.y=i+a/2):0>n&&(s<=-1*l||s>=l)&&(u.x=r-a*t/2/n,u.y=i-a/2),u},aI=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,u=s.positionY-a.positionY;if(0!==l||0!==u){var c=aR(a,l,u),h=aR(s,-1*l,-1*u),d=h.x-c.x,f=h.y-c.y,p=Math.sqrt(d*d+f*f),g=Math.pow(r.idealLength-p,2)/r.elasticity;if(0!==p)var v=g*d/p,y=g*f/p;else var v=0,y=0;a.isLocked||(a.offsetX+=v,a.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},aN=function(e,t){if(0!==t.gravity)for(var n=0;n<e.graphSet.length;n++){var r=e.graphSet[n],i=r.length;if(0===n)var a=e.clientHeight/2,o=e.clientWidth/2;else var s=e.layoutNodes[e.idToIndex[r[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]],a=l.positionX,o=l.positionY;for(var u=0;u<i;u++){var c=e.layoutNodes[e.idToIndex[r[u]]];if(!c.isLocked){var h=a-c.positionX,d=o-c.positionY,f=Math.sqrt(h*h+d*d);if(f>1){var p=t.gravity*h/f,g=t.gravity*d/f;c.offsetX+=p,c.offsetY+=g}}}}},aL=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,h=0;h<l.length;h++){var d=e.layoutNodes[e.idToIndex[l[h]]];d.offsetX+=u,d.offsetY+=c,n[++i]=l[h]}s.offsetX=0,s.offsetY=0}}},aO=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length)&&!r.isLocked){var i=az(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,aF(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},az=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},aF=function(e,t){var n=e.parentId;if(null!=n){var r=t.layoutNodes[t.idToIndex[n]],i=!1;if((null==r.maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(null==r.minX||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,i=!0),(null==r.maxY||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(null==r.minY||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,i=!0),i)return aF(r,t)}},aV=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}for(var s=0,i=0;i<r.length;i++){var l=r[i];if(l){l.x1=1/0,l.x2=-1/0,l.y1=1/0,l.y2=-1/0;for(var u=0;u<l.length;u++){var c=l[u];l.x1=Math.min(l.x1,c.positionX-c.width/2),l.x2=Math.max(l.x2,c.positionX+c.width/2),l.y1=Math.min(l.y1,c.positionY-c.height/2),l.y2=Math.max(l.y2,c.positionY+c.height/2)}l.w=l.x2-l.x1,l.h=l.y2-l.y1,s+=l.w*l.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var h=0,d=0,f=0,p=0,g=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<r.length;i++){var l=r[i];if(l){for(var u=0;u<l.length;u++){var c=l[u];c.isLocked||(c.positionX+=h-l.x1,c.positionY+=d-l.y1)}h+=l.w+t.componentSpacing,f+=l.w+t.componentSpacing,p=Math.max(p,l.h),f>g&&(d+=p+t.componentSpacing,h=0,f=0,p=0)}}},aX={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 aj(e){this.options=Q({},aX,e)}aj.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().not(":parent");e.sort&&(r=r.sort(e.sort));var i=tm(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===i.h||0===i.w)n.nodes().layoutPositions(this,e,function(e){return{x:i.x1,y:i.y1}});else{var a=r.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),l=Math.round(i.w/i.h*o),u=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},c=function(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e},h=e.rows,d=null!=e.cols?e.cols:e.columns;if(null!=h&&null!=d)s=h,l=d;else if(null!=h&&null==d)l=Math.ceil(a/(s=h));else if(null==h&&null!=d)s=Math.ceil(a/(l=d));else if(l*s>a){var f=u(),p=c();(f-1)*p>=a?u(f-1):(p-1)*f>=a&&c(p-1)}else for(;l*s<a;){var g=u(),v=c();(v+1)*g>=a?c(v+1):u(g+1)}var y=i.w/l,b=i.h/s;if(e.condense&&(y=0,b=0),e.avoidOverlap)for(var x=0;x<r.length;x++){var w=r[x],E=w._private.position;(null==E.x||null==E.y)&&(E.x=0,E.y=0);var T=w.layoutDimensions(e),k=e.avoidOverlapPadding,C=T.w+k,P=T.h+k;y=Math.max(y,C),b=Math.max(b,P)}for(var S={},D=function(e,t){return!!S["c-"+e+"-"+t]},B=function(e,t){S["c-"+e+"-"+t]=!0},A=0,_=0,M=function(){++_>=l&&(_=0,A++)},R={},I=0;I<r.length;I++){var N=r[I],L=e.position(N);if(L&&(void 0!==L.row||void 0!==L.col)){var O={row:L.row,col:L.col};if(void 0===O.col)for(O.col=0;D(O.row,O.col);)O.col++;else if(void 0===O.row)for(O.row=0;D(O.row,O.col);)O.row++;R[N.id()]=O,B(O.row,O.col)}}r.layoutPositions(this,e,function(e,t){if(e.locked()||e.isParent())return!1;var n,r,a=R[e.id()];if(a)n=a.col*y+y/2+i.x1,r=a.row*b+b/2+i.y1;else{for(;D(A,_);)M();n=_*y+y/2+i.x1,r=A*b+b/2+i.y1,B(A,_),M()}return{x:n,y:r}})}return this};var aY={ready:function(){},stop:function(){}};function aq(e){this.options=Q({},aY,e)}aq.prototype.run=function(){var e=this.options,t=e.eles;return e.cy,this.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this},aq.prototype.stop=function(){return this};var aW={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 aU(e){this.options=Q({},aW,e)}aU.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=B(e.positions);return t.layoutPositions(this,e,function(t,r){var i=function(t){if(null==e.positions){var r;return{x:(r=t.position()).x,y:r.y}}if(n)return e.positions(t);var i=e.positions[t._private.data.id];return null==i?null:i}(t);return!t.locked()&&null!=i&&i}),this};var aH={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 aG(e){this.options=Q({},aH,e)}function aK(e){this.options=e,this.notifications=0}aG.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=tm(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var aZ=function(){},a$=function(){throw Error("A headless instance can not render images")};aK.prototype={recalculateRenderedStyle:aZ,notify:function(){this.notifications++},init:aZ,isHeadless:function(){return!0},png:a$,jpg:a$};var aQ={};aQ.arrowShapeWidth=.3,aQ.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,u=i.y-n/2-o,c=i.y+n/2+o;return s<=e&&e<=l&&u<=t&&t<=c},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=e*Math.sin(r)+t*Math.cos(r);return{x:a*n+i.x,y:o*n+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(r(s,l,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){D(s)&&(s=e[s]),e[r]=Q({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){return tN(e,t,a(i(this.points,n+2*s,r,o)))},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:eM,roughCollide:eM,draw:eI,spacing:eR,gap:eR}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var l=i(this.points,n,a,o),u=this.controlPoint,c=r(u[0],u[1],n,a,o);t.arrowShapeImpl(this.name)(e,l,c)},gap:function(e){return .8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.pointsTee,n+2*l,r,o));return tN(e,t,u)||tN(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,l){var u=Math.pow(o.x-e,2)+Math.pow(o.y-t,2)<=Math.pow((n+2*l)*this.radius,2);return tN(e,t,a(i(this.points,n+2*l,r,o)))||u},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e;return n[3]=n[3]-r,n[5]=n[5]-r,n},collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.crossLinePts(n,s),n+2*l,r,o));return tN(e,t,u)||tN(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return .525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,n,r,i,a,o){return Math.pow(i.x-e,2)+Math.pow(i.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})};var aJ={};aJ.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-i)/o-s.x)/l,((t-a)/o-s.y)/l]},aJ.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},a={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=a.left+a.right,h=t.width/(o+c),d=t.left+i.left+a.left,f=t.top+i.top+a.top;return this.containerBB=[d,f,o-l,s-u,h]},aJ.invalidateContainerClientCoordsCache=function(){this.containerBB=null},aJ.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},aJ.findNearestElements=function(e,t,n,r){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),h=s.cy.hasCompoundNodes(),d=(r?24:8)/c,f=(r?8:2)/c,p=(r?8:2)/c,g=1/0;function v(e,t){if(e.isNode()){if(a)return;a=e,u.push(e)}if(e.isEdge()&&(null==t||t<g)){if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value){for(var n=0;n<u.length;n++)if(u[n].isEdge()){u[n]=e,i=e,g=null!=t?t:g;break}}}else u.push(e),i=e,g=null!=t?t:g}}function y(n){var r=n.outerWidth()+2*f,i=n.outerHeight()+2*f,a=r/2,l=i/2,u=n.position(),c="auto"===n.pstyle("corner-radius").value?"auto":n.pstyle("corner-radius").pfValue,h=n._private.rscratch;if(u.x-a<=e&&e<=u.x+a&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,i,u.x,u.y,c,h))return v(n,0),!0}function b(n,r){var i,a=n._private;i=r?r+"-":"",n.boundingBox();var o=a.labelBounds[r||"main"],s=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&s){var l=eU(a.rscratch,"labelX",r),u=eU(a.rscratch,"labelY",r),c=eU(a.rscratch,"labelAngle",r),h=n.pstyle(i+"text-margin-x").pfValue,d=n.pstyle(i+"text-margin-y").pfValue,f=o.x1-p-h,g=o.x2+p-h,y=o.y1-p-d,b=o.y2+p-d;if(c){var x=Math.cos(c),w=Math.sin(c),E=function(e,t){return{x:(e-=l)*x-(t-=u)*w+l,y:e*w+t*x+u}},T=E(f,y),k=E(f,b),C=E(g,y),P=E(g,b);if(tN(e,t,[T.x+h,T.y+d,C.x+h,C.y+d,P.x+h,P.y+d,k.x+h,k.y+d]))return v(n),!0}else if(tP(o,e,t))return v(n),!0}}n&&(l=l.interactive);for(var x=l.length-1;x>=0;x--){var w=l[x];w.isNode()?y(w)||b(w):function(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,f=l/2+d,p=f*f,g=2*f,b=i.source,x=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var w=a.allpts,E=0;E+3<w.length;E+=2)if(tB(e,t,w[E],w[E+1],w[E+2],w[E+3],g)&&p>(r=tI(e,t,w[E],w[E+1],w[E+2],w[E+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType){for(var w=a.allpts,E=0;E+5<a.allpts.length;E+=4)if(tA(e,t,w[E],w[E+1],w[E+2],w[E+3],w[E+4],w[E+5],g)&&p>(r=tR(e,t,w[E],w[E+1],w[E+2],w[E+3],w[E+4],w[E+5])))return v(n,r),!0}for(var b=b||i.source,x=x||i.target,T=o.getArrowWidth(l,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}],E=0;E<k.length;E++){var C=k[E],P=s.arrowShapes[n.pstyle(C.name+"-arrow-shape").value],S=n.pstyle("width").pfValue;if(P.roughCollide(e,t,T,C.angle,{x:C.x,y:C.y},S,d)&&P.collide(e,t,T,C.angle,{x:C.x,y:C.y},S,d))return v(n),!0}h&&u.length>0&&(y(b),y(x))}(w)||b(w)||b(w,"source")||b(w,"target")}return u},aJ.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=o,n=s;for(var c=tm({x1:e,y1:t=l,x2:n,y2:r=u}),h=0;h<i.length;h++){var d=i[h];if(d.isNode()){var f=d.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});tC(c,f)&&!tS(f,c)&&a.push(d)}else{var p=d._private,g=p.rscratch;if(null!=g.startX&&null!=g.startY&&!tP(c,g.startX,g.startY)||null!=g.endX&&null!=g.endY&&!tP(c,g.endX,g.endY))continue;if("bezier"===g.edgeType||"multibezier"===g.edgeType||"self"===g.edgeType||"compound"===g.edgeType||"segments"===g.edgeType||"haystack"===g.edgeType){for(var v,y=p.rstyle.bezierPts||p.rstyle.linePts||p.rstyle.haystackPts,b=!0,x=0;x<y.length;x++)if(!tP(c,(v=y[x]).x,v.y)){b=!1;break}b&&a.push(d)}else("haystack"===g.edgeType||"straight"===g.edgeType)&&a.push(d)}}return a};var a0={};a0.calculateArrowAngles=function(e){var t=e._private.rscratch,n="haystack"===t.edgeType,r="bezier"===t.edgeType,i="multibezier"===t.edgeType,a="segments"===t.edgeType,o="compound"===t.edgeType,s="self"===t.edgeType;if(n?(y=t.haystackPts[0],b=t.haystackPts[1],x=t.haystackPts[2],w=t.haystackPts[3]):(y=t.arrowStartX,b=t.arrowStartY,x=t.arrowEndX,w=t.arrowEndY),h=t.midX,d=t.midY,a)g=y-t.segpts[0],v=b-t.segpts[1];else if(i||o||s||r){var l=t.allpts,u=tp(l[0],l[2],l[4],.1),c=tp(l[1],l[3],l[5],.1);g=y-u,v=b-c}else g=y-h,v=b-d;t.srcArrowAngle=tl(g,v);var h=t.midX,d=t.midY;if(n&&(h=(y+x)/2,d=(b+w)/2),g=x-y,v=w-b,a){var l=t.allpts;if(l.length/2%2==0){var f=l.length/2,p=f-2;g=l[f]-l[p],v=l[f+1]-l[p+1]}else if(t.isRound)g=t.midVector[1],v=-t.midVector[0];else{var f=l.length/2-1,p=f-2;g=l[f]-l[p],v=l[f+1]-l[p+1]}}else if(i||o||s){var g,v,y,b,x,w,h,d,E,T,k,C,l=t.allpts;if(t.ctrlpts.length/2%2==0){var P=l.length/2-1,S=P+2,D=S+2;E=tp(l[P],l[S],l[D],0),T=tp(l[P+1],l[S+1],l[D+1],0),k=tp(l[P],l[S],l[D],1e-4),C=tp(l[P+1],l[S+1],l[D+1],1e-4)}else{var S=l.length/2-1,P=S-2,D=S+2;E=tp(l[P],l[S],l[D],.4999),T=tp(l[P+1],l[S+1],l[D+1],.4999),k=tp(l[P],l[S],l[D],.5),C=tp(l[P+1],l[S+1],l[D+1],.5)}g=k-E,v=C-T}if(t.midtgtArrowAngle=tl(g,v),t.midDispX=g,t.midDispY=v,g*=-1,v*=-1,a){var l=t.allpts;if(l.length/2%2==0);else if(!t.isRound){var f=l.length/2-1,B=f+2;g=-(l[B]-l[f]),v=-(l[B+1]-l[f+1])}}if(t.midsrcArrowAngle=tl(g,v),a)g=x-t.segpts[t.segpts.length-2],v=w-t.segpts[t.segpts.length-1];else if(i||o||s||r){var l=t.allpts,A=l.length,u=tp(l[A-6],l[A-4],l[A-2],.9),c=tp(l[A-5],l[A-3],l[A-1],.9);g=x-u,v=w-c}else g=x-h,v=w-d;t.tgtArrowAngle=tl(g,v)},a0.getArrowWidth=a0.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r),r};var a1,a2,a5,a3,a4,a9,a6,a8,a7,oe,ot,on,or,oi,oa,oo,os,ol,ou,oc,oh,od,of,op,og,ov,oy,om,ob,ox,ow,oE,oT,ok,oC,oP,oS,oD,oB,oA,o_,oM,oR,oI,oN,oL,oO,oz,oF,oV,oX,oj,oY,oq,oW,oU,oH,oG,oK,oZ,o$,oQ,oJ,o0,o1,o2,o5,o3,o4,o9,o6,o8,o7,se,st,sn,sr,si,sa,so,ss,sl,su,sc,sh,sd,sf,sp,sg,sv,sy,sm,sb,sx,sw,sE,sT,sk,sC,sP,sS,sD,sB,sA,s_,sM,sR,sI,sN,sL,sO,sz,sF,sV,sX,sj,sY,sq,sW,sU,sH,sG,sK,sZ,s$,sQ,sJ,s0,s1,s2,s5,s3,s4,s9,s6,s8,s7,le,lt,ln,lr,li,la,lo,ls,ll,lu,lc,lh,ld,lf,lp,lg,lv,ly,lm,lb={},lx={},lw=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},lE=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},lT=function(e,t,n,r,i){if(e!==y?lw(t,e,lb):lE(lx,lb),lw(t,n,lx),lu=lb.nx*lx.ny-lb.ny*lx.nx,lc=lb.nx*lx.nx- -(lb.ny*lx.ny),1e-6>Math.abs(lf=Math.asin(Math.max(-1,Math.min(1,lu))))){ls=t.x,ll=t.y,lg=ly=0;return}lh=1,ld=!1,lc<0?lf<0?lf=Math.PI+lf:(lf=Math.PI-lf,lh=-1,ld=!0):lf>0&&(lh=-1,ld=!0),ly=void 0!==t.radius?t.radius:r,lp=lf/2,lm=Math.min(lb.len/2,lx.len/2),lg=i?(lv=Math.abs(Math.cos(lp)*ly/Math.sin(lp)))>lm?Math.abs((lv=lm)*Math.sin(lp)/Math.cos(lp)):ly:Math.abs((lv=Math.min(lm,ly))*Math.sin(lp)/Math.cos(lp)),g=t.x+lx.nx*lv,v=t.y+lx.ny*lv,ls=g-lx.ny*lg*lh,ll=v+lx.nx*lg*lh,f=t.x+lb.nx*lv,p=t.y+lb.ny*lv,y=t};function lk(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function lC(e,t,n,r){var i=!(arguments.length>4)||void 0===arguments[4]||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(lT(e,t,n,r,i),{cx:ls,cy:ll,radius:lg,startX:f,startY:p,stopX:g,stopY:v,startAngle:lb.ang+Math.PI/2*lh,endAngle:lx.ang-Math.PI/2*lh,counterClockwise:ld})}var lP={};function lS(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}lP.findMidptPtsEtc=function(e,t){var n,r=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,o=e.pstyle("source-endpoint"),s=e.pstyle("target-endpoint"),u=null!=o.units&&null!=s.units;switch(e.pstyle("edge-distances").value){case"node-position":n=r;break;case"intersection":n=i;break;case"endpoints":if(u){var c,h,d,f=l(this.manualEndptToPx(e.source()[0],o),2),p=f[0],g=f[1],v=l(this.manualEndptToPx(e.target()[0],s),2),y=v[0],b=v[1];c=b-g,d=Math.sqrt((h=y-p)*h+c*c),a={x:-c/d,y:h/d},n={x1:p,y1:g,x2:y,y2:b}}else eO("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),n=i}return{midptPts:n,vectorNormInverse:a}},lP.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=2*Math.random()*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,l=o.position(),u=s.position(),c=o.width(),h=s.width(),d=o.height(),f=s.height(),p=n.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*c*p+l.x,i.source.y*d*p+l.y,i.target.x*h*p+u.x,i.target.y*f*p+u.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},lP.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(r.pfValue.length,i.pfValue.length),l=a.pfValue[a.pfValue.length-1],u=o.pfValue[o.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var c=0;c<s;c++){var h=r.pfValue[c],d=i.pfValue[c],f=1-h,p=this.findMidptPtsEtc(e,t),g=p.midptPts,v=p.vectorNormInverse,y={x:g.x1*f+g.x2*h,y:g.y1*f+g.y2*h};n.segpts.push(y.x+v.x*d,y.y+v.y*d),n.radii.push(void 0!==a.pfValue[c]?a.pfValue[c]:l),n.isArcRadius.push((void 0!==o.pfValue[c]?o.pfValue[c]:u)==="arc-radius")}},lP.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var d=n,f=h;r&&(d=0,f=l);var p=u-Math.PI/2,g=p-c/2,v=p+c/2,y=String(u+"_"+c);d=void 0===a[y]?a[y]=0:++a[y],i.ctrlpts=[o.x+1.4*Math.cos(g)*f*(d/3+1),o.y+1.4*Math.sin(g)*f*(d/3+1),o.x+1.4*Math.cos(v)*f*(d/3+1),o.y+1.4*Math.sin(v)*f*(d/3+1)]},lP.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),f=d?d.pfValue[0]:void 0,p=n,g=h;r&&(p=0,g=f);var v={x:a.x-s/2,y:a.y-l/2},y={x:o.x-u/2,y:o.y-c/2},b={x:Math.min(v.x,y.x),y:Math.min(v.y,y.y)},x=Math.max(.5,Math.log(.01*s)),w=Math.max(.5,Math.log(.01*u));i.ctrlpts=[b.x,b.y-1.7995514309304248*g*(p/3+1)*x,b.x-1.7995514309304248*g*(p/3+1)*w,b.y]},lP.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},lP.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,c=s?s.pfValue[0]:void 0,h=l.value[0];a.edgeType=r?"multibezier":"bezier",a.ctrlpts=[];for(var d=0;d<u;d++){var f=(.5-t.eles.length/2+n)*o*(i?-1:1),p=void 0,g=tc(f);r&&(c=s?s.pfValue[d]:o,h=l.value[d]);var v=void 0!==(p=r?c:void 0!==c?g*c:void 0)?p:f,y=1-h,b=h,x=this.findMidptPtsEtc(e,t),w=x.midptPts,E=x.vectorNormInverse,T={x:w.x1*y+w.x2*b,y:w.y1*y+w.y2*b};a.ctrlpts.push(T.x+E.x*v,T.y+E.y*v)}},lP.findTaxiPoints=function(e,t){var n,r=e._private.rscratch;r.edgeType="segments";var i="vertical",a="horizontal",o="leftward",s="rightward",l="downward",u="upward",c=t.posPts,h=t.srcW,d=t.srcH,f=t.tgtW,p=t.tgtH,g="node-position"!==e.pstyle("edge-distances").value,v=e.pstyle("taxi-direction").value,y=v,b=e.pstyle("taxi-turn"),x="%"===b.units,w=b.pfValue,E=e.pstyle("taxi-turn-min-distance").pfValue,T=c.x2-c.x1,k=c.y2-c.y1,C=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},P=C(T,g?(h+f)/2:0),S=C(k,g?(d+p)/2:0),D=!1;"auto"===y?v=Math.abs(P)>Math.abs(S)?a:i:y===u||y===l?(v=i,D=!0):(y===o||y===s)&&(v=a,D=!0);var B=v===i,A=B?S:P,_=B?k:T,M=tc(_),R=!1;!(D&&(x||w<0))&&(y===l&&_<0||y===u&&_>0||y===o&&_>0||y===s&&_<0)&&(M*=-1,A=M*Math.abs(A),R=!0);var I=function(e){return Math.abs(e)<E||Math.abs(e)>=Math.abs(A)},N=I(n=x?(w<0?1+w:w)*A:(w<0?A:0)+w*M),L=I(Math.abs(A)-Math.abs(n));if((N||L)&&!R){if(B){var O=Math.abs(T)<=f/2;if(Math.abs(_)<=d/2){var z=(c.x1+c.x2)/2,F=c.y1,V=c.y2;r.segpts=[z,F,z,V]}else if(O){var X=(c.y1+c.y2)/2,j=c.x1,Y=c.x2;r.segpts=[j,X,Y,X]}else r.segpts=[c.x1,c.y2]}else{var q=Math.abs(k)<=p/2;if(Math.abs(_)<=h/2){var W=(c.y1+c.y2)/2,U=c.x1,H=c.x2;r.segpts=[U,W,H,W]}else if(q){var G=(c.x1+c.x2)/2,K=c.y1,Z=c.y2;r.segpts=[G,K,G,Z]}else r.segpts=[c.x2,c.y1]}}else if(B){var $=c.y1+n+(g?d/2*M:0),Q=c.x1,J=c.x2;r.segpts=[Q,$,J,$]}else{var ee=c.x1+n+(g?h/2*M:0),et=c.y1,en=c.y2;r.segpts=[ee,et,ee,en]}if(r.isRound){var er=e.pstyle("taxi-radius").value,ei="arc-radius"===e.pstyle("radius-type").value[0];r.radii=Array(r.segpts.length/2).fill(er),r.isArcRadius=Array(r.segpts.length/2).fill(ei)}},lP.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=t.srcCornerRadius,d=t.tgtCornerRadius,f=t.srcRs,p=t.tgtRs,g=!M(n.startX)||!M(n.startY),v=!M(n.arrowStartX)||!M(n.arrowStartY),y=!M(n.endX)||!M(n.endY),b=!M(n.arrowEndX)||!M(n.arrowEndY),x=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,w=th({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=w<x,T=th({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),k=T<x,C=!1;if(g||v||E){C=!0;var P={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},S=Math.sqrt(P.x*P.x+P.y*P.y),D={x:P.x/S,y:P.y/S},B=Math.max(a,o),A={x:n.ctrlpts[0]+2*D.x*B,y:n.ctrlpts[1]+2*D.y*B},_=u.intersectLine(r.x,r.y,a,o,A.x,A.y,0,h,f);E?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(x-w),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(x-w)):(n.ctrlpts[0]=_[0]+D.x*x,n.ctrlpts[1]=_[1]+D.y*x)}if(y||b||k){C=!0;var R={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},I=Math.sqrt(R.x*R.x+R.y*R.y),N={x:R.x/I,y:R.y/I},L=Math.max(a,o),O={x:n.ctrlpts[0]+2*N.x*L,y:n.ctrlpts[1]+2*N.y*L},z=c.intersectLine(i.x,i.y,s,l,O.x,O.y,0,d,p);k?(n.ctrlpts[0]=n.ctrlpts[0]+N.x*(x-T),n.ctrlpts[1]=n.ctrlpts[1]+N.y*(x-T)):(n.ctrlpts[0]=z[0]+N.x*x,n.ctrlpts[1]=z[1]+N.y*x)}C&&this.findEndpoints(e)}},lP.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n,r=0;r+1<t.ctrlpts.length;r+=2)t.allpts.push(t.ctrlpts[r],t.ctrlpts[r+1]),r+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[r]+t.ctrlpts[r+2])/2,(t.ctrlpts[r+1]+t.ctrlpts[r+3])/2);(t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0)?(n=t.allpts.length/2-1,t.midX=t.allpts[n],t.midY=t.allpts[n+1]):(n=t.allpts.length/2-3,t.midX=tp(t.allpts[n],t.allpts[n+2],t.allpts[n+4],.5),t.midY=tp(t.allpts[n+1],t.allpts[n+3],t.allpts[n+5],.5))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var i=2;i+3<t.allpts.length;i+=2){var a=t.radii[i/2-1],o=t.isArcRadius[i/2-1];t.roundCorners.push(lC({x:t.allpts[i-2],y:t.allpts[i-1]},{x:t.allpts[i],y:t.allpts[i+1],radius:a},{x:t.allpts[i+2],y:t.allpts[i+3]},a,o))}}if(t.segpts.length%4==0){var s=t.segpts.length/2,l=s-2;t.midX=(t.segpts[l]+t.segpts[s])/2,t.midY=(t.segpts[l+1]+t.segpts[s+1])/2}else{var u=t.segpts.length/2-1;if(t.isRound){var c={x:t.segpts[u],y:t.segpts[u+1]},h=t.roundCorners[u/2];if(0===h.radius){var d={x:t.segpts[u+2],y:t.segpts[u+3]};t.midX=c.x,t.midY=c.y,t.midVector=[c.y-d.y,d.x-c.x]}else{var f=[c.x-h.cx,c.y-h.cy],p=h.radius/Math.sqrt(Math.pow(f[0],2)+Math.pow(f[1],2));f=f.map(function(e){return e*p}),t.midX=h.cx+f[0],t.midY=h.cy+f[1],t.midVector=f}}else t.midX=t.segpts[u],t.midY=t.segpts[u+1]}}},lP.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||M(t.startX)&&M(t.startY)&&M(t.endX)&&M(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,eO("Edge `"+e.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."))},lP.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),i=new eK,a=function(e,t){return[].concat(u(e),[t?1:0]).join("-")},o=[],s=[],l=0;l<e.length;l++){var c=e[l],h=c._private,d=c.pstyle("curve-style").value;if(!c.removed()&&c.takesUpSpace()){if("haystack"===d){s.push(c);continue}var f="unbundled-bezier"===d||d.endsWith("segments")||"straight"===d||"straight-triangle"===d||d.endsWith("taxi"),p="unbundled-bezier"===d||"bezier"===d,g=h.source,v=h.target,y=[g.poolIndex(),v.poolIndex()].sort(),b=a(y,f),x=i.get(b);null==x&&(x={eles:[]},o.push({pairId:y,edgeIsUnbundled:f}),i.set(b,x)),x.eles.push(c),f&&(x.hasUnbundled=!0),p&&(x.hasBezier=!0)}}for(var w=0;w<o.length;w++)!function(){var e,s=o[w],l=a(s.pairId,s.edgeIsUnbundled),u=i.get(l);if(!u.hasUnbundled){var c=u.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});eq(u.eles),c.forEach(function(e){return u.eles.push(e)}),u.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var h=u.eles[0],d=h.source(),f=h.target();if(d.poolIndex()>f.poolIndex()){var p=d;d=f,f=p}var g=u.srcPos=d.position(),v=u.tgtPos=f.position(),y=u.srcW=d.outerWidth(),b=u.srcH=d.outerHeight(),x=u.tgtW=f.outerWidth(),E=u.tgtH=f.outerHeight(),T=u.srcShape=n.nodeShapes[t.getNodeShape(d)],k=u.tgtShape=n.nodeShapes[t.getNodeShape(f)],C=u.srcCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,P=u.tgtCornerRadius="auto"===f.pstyle("corner-radius").value?"auto":f.pstyle("corner-radius").pfValue,S=u.tgtRs=f._private.rscratch,D=u.srcRs=d._private.rscratch;u.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var B=0;B<u.eles.length;B++){var A=u.eles[B],_=A[0]._private.rscratch,R=A.pstyle("curve-style").value,I="unbundled-bezier"===R||R.endsWith("segments")||R.endsWith("taxi"),N=!d.same(A.source());if(!u.calculatedIntersection&&d!==f&&(u.hasBezier||u.hasUnbundled)){u.calculatedIntersection=!0;var L=T.intersectLine(g.x,g.y,y,b,v.x,v.y,0,C,D),O=u.srcIntn=L,z=k.intersectLine(v.x,v.y,x,E,g.x,g.y,0,P,S),F=u.tgtIntn=z,V=u.intersectionPts={x1:L[0],x2:z[0],y1:L[1],y2:z[1]},X=u.posPts={x1:g.x,x2:v.x,y1:g.y,y2:v.y},j=z[1]-L[1],Y=z[0]-L[0],q=Math.sqrt(Y*Y+j*j),W=u.vector={x:Y,y:j},U=u.vectorNorm={x:W.x/q,y:W.y/q},H={x:-U.y,y:U.x};u.nodesOverlap=!M(q)||k.checkPoint(L[0],L[1],0,x,E,v.x,v.y,P,S)||T.checkPoint(z[0],z[1],0,y,b,g.x,g.y,C,D),u.vectorNormInverse=H,e={nodesOverlap:u.nodesOverlap,dirCounts:u.dirCounts,calculatedIntersection:!0,hasBezier:u.hasBezier,hasUnbundled:u.hasUnbundled,eles:u.eles,srcPos:v,srcRs:S,tgtPos:g,tgtRs:D,srcW:x,srcH:E,tgtW:y,tgtH:b,srcIntn:F,tgtIntn:O,srcShape:k,tgtShape:T,posPts:{x1:X.x2,y1:X.y2,x2:X.x1,y2:X.y1},intersectionPts:{x1:V.x2,y1:V.y2,x2:V.x1,y2:V.y1},vector:{x:-W.x,y:-W.y},vectorNorm:{x:-U.x,y:-U.y},vectorNormInverse:{x:-H.x,y:-H.y}}}var G=N?e:u;_.nodesOverlap=G.nodesOverlap,_.srcIntn=G.srcIntn,_.tgtIntn=G.tgtIntn,_.isRound=R.startsWith("round"),r&&(d.isParent()||d.isChild()||f.isParent()||f.isChild())&&(d.parents().anySame(f)||f.parents().anySame(d)||d.same(f)&&d.isParent())?t.findCompoundLoopPoints(A,G,B,I):d===f?t.findLoopPoints(A,G,B,I):R.endsWith("segments")?t.findSegmentsPoints(A,G):R.endsWith("taxi")?t.findTaxiPoints(A,G):"straight"!==R&&(I||u.eles.length%2!=1||B!==Math.floor(u.eles.length/2))?t.findBezierPoints(A,G,B,I,N):t.findStraightEdgePoints(A),t.findEndpoints(A),t.tryToCorrectInvalidPoints(A,G),t.checkForInvalidEdgeWarning(A),t.storeAllpts(A),t.storeEdgeProjections(A),t.calculateArrowAngles(A),t.recalculateEdgeLabelProjections(A),t.calculateLabelAngles(A)}}();this.findHaystackPoints(s)}},lP.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),"segments"===t.edgeType)return lS(t.segpts)},lP.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return lS(t.ctrlpts)},lP.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var lD={};lD.manualEndptToPx=function(e,t){var n=e.position(),r=e.outerWidth(),i=e.outerHeight(),a=e._private.rscratch;if(2===t.value.length){var o=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(o[0]=o[0]*r),"%"===t.units[1]&&(o[1]=o[1]*i),o[0]+=n.x,o[1]+=n.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(r,i),u=[n.x+Math.cos(s)*l,n.y+Math.sin(s)*l];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,r,i,u[0],u[1],0,"auto"===e.pstyle("corner-radius").value?"auto":e.pstyle("corner-radius").pfValue,a)},lD.findEndpoints=function(e){var t,n,r,i,a,o=e.source()[0],s=e.target()[0],l=o.position(),u=s.position(),c=e.pstyle("target-arrow-shape").value,h=e.pstyle("source-arrow-shape").value,d=e.pstyle("target-distance-from-node").pfValue,f=e.pstyle("source-distance-from-node").pfValue,p=o._private.rscratch,g=s._private.rscratch,v=e.pstyle("curve-style").value,y=e._private.rscratch,b=y.edgeType,x="self"===b||"compound"===b,w="bezier"===b||"multibezier"===b||x,E="bezier"!==b,T="straight"===b||"segments"===b,k="segments"===b,C=x||"taxi"===v,P=e.pstyle("source-endpoint"),S=C?"outside-to-node":P.value,D="auto"===o.pstyle("corner-radius").value?"auto":o.pstyle("corner-radius").pfValue,B=e.pstyle("target-endpoint"),A=C?"outside-to-node":B.value,_="auto"===s.pstyle("corner-radius").value?"auto":s.pstyle("corner-radius").pfValue;if(y.srcManEndpt=P,y.tgtManEndpt=B,w){var R=[y.ctrlpts[0],y.ctrlpts[1]];n=E?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:R,r=R}else if(T){var I=k?y.segpts.slice(0,2):[u.x,u.y];n=k?y.segpts.slice(y.segpts.length-2):[l.x,l.y],r=I}if("inside-to-node"===A)t=[u.x,u.y];else if(B.units)t=this.manualEndptToPx(s,B);else if("outside-to-line"===A)t=y.tgtIntn;else if("outside-to-node"===A||"outside-to-node-or-label"===A?i=n:("outside-to-line"===A||"outside-to-line-or-label"===A)&&(i=[l.x,l.y]),t=this.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),i[0],i[1],0,_,g),"outside-to-node-or-label"===A||"outside-to-line-or-label"===A){var N=s._private.rscratch,L=N.labelWidth,O=N.labelHeight,z=N.labelX,F=N.labelY,V=L/2,X=O/2,j=s.pstyle("text-valign").value;"top"===j?F-=X:"bottom"===j&&(F+=X);var Y=s.pstyle("text-halign").value;"left"===Y?z-=V:"right"===Y&&(z+=V);var q=tW(i[0],i[1],[z-V,F-X,z+V,F-X,z+V,F+X,z-V,F+X],u.x,u.y);if(q.length>0){var W=td(l,tr(t)),U=td(l,tr(q)),H=W;U<W&&(t=q,H=U),q.length>2&&td(l,{x:q[2],y:q[3]})<H&&(t=[q[2],q[3]])}}var G=tH(t,n,this.arrowShapes[c].spacing(e)+d),K=tH(t,n,this.arrowShapes[c].gap(e)+d);if(y.endX=K[0],y.endY=K[1],y.arrowEndX=G[0],y.arrowEndY=G[1],"inside-to-node"===S)t=[l.x,l.y];else if(P.units)t=this.manualEndptToPx(o,P);else if("outside-to-line"===S)t=y.srcIntn;else if("outside-to-node"===S||"outside-to-node-or-label"===S?a=r:("outside-to-line"===S||"outside-to-line-or-label"===S)&&(a=[u.x,u.y]),t=this.nodeShapes[this.getNodeShape(o)].intersectLine(l.x,l.y,o.outerWidth(),o.outerHeight(),a[0],a[1],0,D,p),"outside-to-node-or-label"===S||"outside-to-line-or-label"===S){var Z=o._private.rscratch,$=Z.labelWidth,Q=Z.labelHeight,J=Z.labelX,ee=Z.labelY,et=$/2,en=Q/2,er=o.pstyle("text-valign").value;"top"===er?ee-=en:"bottom"===er&&(ee+=en);var ei=o.pstyle("text-halign").value;"left"===ei?J-=et:"right"===ei&&(J+=et);var ea=tW(a[0],a[1],[J-et,ee-en,J+et,ee-en,J+et,ee+en,J-et,ee+en],l.x,l.y);if(ea.length>0){var eo=td(u,tr(t)),es=td(u,tr(ea)),el=eo;es<eo&&(t=[ea[0],ea[1]],el=es),ea.length>2&&td(u,{x:ea[2],y:ea[3]})<el&&(t=[ea[2],ea[3]])}}var eu=tH(t,r,this.arrowShapes[h].spacing(e)+f),ec=tH(t,r,this.arrowShapes[h].gap(e)+f);y.startX=ec[0],y.startY=ec[1],y.arrowStartX=eu[0],y.arrowStartY=eu[1],(w||E||T)&&(M(y.startX)&&M(y.startY)&&M(y.endX)&&M(y.endY)?y.badLine=!1:y.badLine=!0)},lD.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},lD.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}};var lB={};lB.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)!function(e,t,n){for(var r=function(e,t,n,r){return tp(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}(this,e,n.allpts.slice(i,i+6))}else if("segments"===r)for(var a=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]});else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},lB.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var lA={};lA.recalculateNodeLabelProjection=function(e){if(!F(e.pstyle("label").strValue)){var t,n,r=e._private,i=e.width(),a=e.height(),o=e.padding(),s=e.position(),l=e.pstyle("text-halign").strValue,u=e.pstyle("text-valign").strValue,c=r.rscratch,h=r.rstyle;switch(l){case"left":t=s.x-i/2-o;break;case"right":t=s.x+i/2+o;break;default:t=s.x}switch(u){case"top":n=s.y-a/2-o;break;case"bottom":n=s.y+a/2+o;break;default:n=s.y}c.labelX=t,c.labelY=n,h.labelX=t,h.labelY=n,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var l_=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},lM=function(e,t){return l_(t.x-e.x,t.y-e.y)},lR=function(e,t,n,r){var i=ty(0,r-.001,1),a=ty(0,r+.001,1);return lM(tg(e,t,n,i),tg(e,t,n,a))};lA.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){eH(n.rscratch,e,t,r),eH(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y),o("labelAutoAngle",null,l_(r.midDispX,r.midDispY));var s=function(){if(s.cache)return s.cache;for(var e=[],t=0;t+5<r.allpts.length;t+=4){var a={x:r.allpts[t],y:r.allpts[t+1]},o={x:r.allpts[t+2],y:r.allpts[t+3]},l={x:r.allpts[t+4],y:r.allpts[t+5]};e.push({p0:a,p1:o,p2:l,startDist:0,length:0,segments:[]})}var u=n.rstyle.bezierPts,c=i.bezierProjPcts.length;function h(e,t,n,r,i){var a=th(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var d=0;d<e.length;d++){var f=e[d],p=e[d-1];p&&(f.startDist=p.startDist+p.length),h(f,f.p0,u[d*c],0,i.bezierProjPcts[0]);for(var g=0;g<c-1;g++)h(f,u[d*c+g],u[d*c+g+1],i.bezierProjPcts[g],i.bezierProjPcts[g+1]);h(f,u[d*c+c-1],f.p2,i.bezierProjPcts[c-1],1)}return s.cache=e},l=function(n){var i="source"===n;if(a[n]){var l=e.pstyle(n+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var u,c,h=s(),d=0,f=0,p=0;p<h.length;p++){for(var g=h[i?p:h.length-1-p],v=0;v<g.segments.length;v++){var y=g.segments[i?v:g.segments.length-1-v],b=p===h.length-1&&v===g.segments.length-1;if(d=f,(f+=y.length)>=l||b){c={cp:g,segment:y};break}}if(c)break}var x=c.cp,w=c.segment,E=(l-d)/w.length,T=w.t1-w.t0,k=i?w.t0+T*E:w.t1-T*E;k=ty(0,k,1),t=tg(x.p0,x.p1,x.p2,k),u=lR(x.p0,x.p1,x.p2,k);break;case"straight":case"segments":case"haystack":for(var C,P,S,D,B=0,A=r.allpts.length,_=0;_+3<A&&(i?(C={x:r.allpts[_],y:r.allpts[_+1]},P={x:r.allpts[_+2],y:r.allpts[_+3]}):(C={x:r.allpts[A-2-_],y:r.allpts[A-1-_]},P={x:r.allpts[A-4-_],y:r.allpts[A-3-_]}),S=th(C,P),D=B,!((B+=S)>=l));_+=2);var M=(l-D)/S;t=tv(C,P,M=ty(0,M,1)),u=lM(C,P)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,u)}};l("source"),l("target"),this.applyLabelDimensions(e)}},lA.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},lA.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=eU(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=i.width,h=i.height+(l-1)*(a-1)*u;eH(n.rstyle,"labelWidth",t,c),eH(n.rscratch,"labelWidth",t,c),eH(n.rstyle,"labelHeight",t,h),eH(n.rscratch,"labelHeight",t,h),eH(n.rscratch,"labelLineHeight",t,u*a)},lA.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,s=function(e,r){return r?(eH(n.rscratch,e,t,r),r):eU(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var l=e.pstyle("text-wrap").value;if("wrap"===l){var u=s("labelKey");if(null!=u&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var c=i.split("\n"),h=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,f=[],p=/[\s\u200b]+|$/g,g=0;g<c.length;g++){var v=c[g],y=this.calculateLabelDimensions(e,v).width;if(d&&(v=v.split("").join("")),y>h){var b,x=v.matchAll(p),w="",E=0,T=o(x);try{for(T.s();!(b=T.n()).done;){var k=b.value,C=k[0],P=v.substring(E,k.index);E=k.index+C.length;var S=0===w.length?P:w+P+C;this.calculateLabelDimensions(e,S).width<=h?w+=P+C:(w&&f.push(w),w=P+C)}}catch(e){T.e(e)}finally{T.f()}w.match(/^[\s\u200b]+$/)||f.push(w)}else f.push(v)}s("labelWrapCachedLines",f),i=s("labelWrapCachedText",f.join("\n")),s("labelWrapKey",u)}else if("ellipsis"===l){var D=e.pstyle("text-max-width").pfValue,B="",A=!1;if(this.calculateLabelDimensions(e,i).width<D)return i;for(var _=0;_<i.length&&!(this.calculateLabelDimensions(e,B+i[_]+"…").width>D);_++)B+=i[_],_===i.length-1&&(A=!0);return A||(B+="…"),B}return i},lA.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},lA.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=ek(t,e._private.labelDimsKey),i=this.labelDimCache||(this.labelDimCache=[]),a=i[r];if(null!=a)return a;var o=e.pstyle("font-style").strValue,s=e.pstyle("font-size").pfValue,l=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,c=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=n.createElement("canvas"),h=this.labelCalcCanvasContext=c.getContext("2d");var d=c.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}h.font="".concat(o," ").concat(u," ").concat(s,"px ").concat(l);for(var f=0,p=0,g=t.split("\n"),v=0;v<g.length;v++){var y=g[v];f=Math.max(Math.ceil(h.measureText(y).width),f),p+=s}return f+=0,p+=0,i[r]={width:f,height:p}},lA.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=e.pstyle((t?t+"-":"")+"text-rotation"),a=i.strValue;return"none"===a?0:r&&"autorotate"===a?n.labelAutoAngle:"autorotate"===a?0:i.pfValue},lA.calculateLabelAngles=function(e){var t=e.isEdge(),n=e._private.rscratch;n.labelAngle=this.calculateLabelAngle(e),t&&(n.sourceLabelAngle=this.calculateLabelAngle(e,"source"),n.targetLabelAngle=this.calculateLabelAngle(e,"target"))};var lI={},lN=!1;lI.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(28>e.width()||28>e.height()))return lN||(eO("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),lN=!0),"rectangle";if(e.isParent())return"rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var lL={};lL.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(e){r(e.target)}).on("style.* background.*",function(e){r(e.target,!1)});var i=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(r(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var u=0;u<a.length;u++)(0,a[u])(i,t);n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},lL.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},lL.recalculateRenderedStyle=function(e,t){var n=function(e){return e._private.rstyle.cleanConnected};if(0!==e.length){var r=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(l.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(e){return!e._private.rstyle.clean&&e.isBundledBezier()})&&(l.clean=!1),t&&l.clean||o.removed()||"none"===o.pstyle("display").value||("nodes"===s.group?i.push(o):r.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private.rstyle,d=c.position();this.recalculateNodeLabelProjection(c),h.nodeX=d.x,h.nodeY=d.y,h.nodeW=c.pstyle("width").pfValue,h.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var f=0;f<r.length;f++){var p=r[f]._private,g=p.rstyle,v=p.rscratch;g.srcX=v.arrowStartX,g.srcY=v.arrowStartY,g.tgtX=v.arrowEndX,g.tgtY=v.arrowEndY,g.midX=v.midX,g.midY=v.midY,g.labelAngle=v.labelAngle,g.sourceLabelAngle=v.sourceLabelAngle,g.targetLabelAngle=v.targetLabelAngle}}}};var lO={};lO.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},lO.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},lO.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(im),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var lz={};[aJ,a0,lP,lD,lB,lA,lI,lL,lO].forEach(function(e){Q(lz,e)});var lF={};lF.getCachedImage=function(e,t,n){var r=this.imageCache=this.imageCache||{},i=r[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;var a=(i=r[e]=r[e]||{}).image=new Image;a.addEventListener("load",n),a.addEventListener("error",function(){a.error=!0});var o="data:";return e.substring(0,o.length).toLowerCase()!==o&&(t="null"===t?null:t,a.crossOrigin=t),a.src=e,a};var lV={};lV.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(void 0!==s){var l=this.binder(s);a.push(l.on.apply(l,i))}}return a}var l=this.binder(e);return l.on.apply(l,i)},lV.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||"undefined"!=typeof HTMLElement&&e instanceof HTMLElement;if(null==t.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});n.addEventListener("test",null,a)}catch(e){}t.supportsPassiveEvents=i}var o=function(n,i,a){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},lV.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},lV.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},lV.load=function(){var e,t,n,r,i,a,o,s,l,u,c,h,d,f,p,g,v,y,b,x,w,E,T,k=this,C=k.cy.window(),P=function(e){return e.selected()},S=function(e,t,n,r){null==e&&(e=k.cy);for(var i=0;i<t.length;i++){var a=t[i];e.emit({originalEvent:n,type:a,position:r})}},D=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},B=function(e,t){var n=!0;if(k.cy.hasCompoundNodes()&&e&&e.pannable())for(var r=0;t&&r<t.length;r++){var e=t[r];if(e.isNode()&&e.isParent()&&!e.pannable()){n=!1;break}}else n=!0;return n},A=function(e){e[0]._private.grabbed=!0},_=function(e){e[0]._private.grabbed=!1},R=function(e){e[0]._private.rscratch.inDragLayer=!0},I=function(e){e[0]._private.rscratch.inDragLayer=!1},N=function(e){e[0]._private.rscratch.isGrabTarget=!0},L=function(e){e[0]._private.rscratch.isGrabTarget=!1},O=function(e,t){var n=t.addToList;!n.has(e)&&e.grabbable()&&!e.locked()&&(n.merge(e),A(e))},z=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(R),n.connectedEdges().forEach(R)),t.addToList&&O(n,t)}},F=function(e,t){t=t||{};var n=e.cy().hasCompoundNodes();t.inDragLayer&&(e.forEach(R),e.neighborhood().stdFilter(function(e){return!n||e.isEdge()}).forEach(R)),t.addToList&&e.forEach(function(e){O(e,t)}),z(e,t),X(e,{inDragLayer:t.inDragLayer}),k.updateCachedGrabbedEles()},V=function(e){e&&(k.getCachedZSortedEles().forEach(function(e){_(e),I(e),L(e)}),k.updateCachedGrabbedEles())},X=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(R),r.forEach(R)),t.addToList&&r.forEach(function(e){O(e,t)})}}},j=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},Y="undefined"!=typeof MutationObserver,q="undefined"!=typeof ResizeObserver;Y?(k.removeObserver=new MutationObserver(function(e){for(var t=0;t<e.length;t++){var n=e[t].removedNodes;if(n){for(var r=0;r<n.length;r++)if(n[r]===k.container){k.destroy();break}}}}),k.container.parentNode&&k.removeObserver.observe(k.container.parentNode,{childList:!0})):k.registerBinding(k.container,"DOMNodeRemoved",function(e){k.destroy()});var W=ef(function(){k.cy.resize()},100);Y&&(k.styleObserver=new MutationObserver(W),k.styleObserver.observe(k.container,{attributes:!0})),k.registerBinding(C,"resize",W),q&&(k.resizeObserver=new ResizeObserver(W),k.resizeObserver.observe(k.container));var U=function(){k.invalidateContainerClientCoordsCache()};(function(e,t){for(;null!=e;)t(e),e=e.parentNode})(k.container,function(e){k.registerBinding(e,"transitionend",U),k.registerBinding(e,"animationend",U),k.registerBinding(e,"scroll",U)}),k.registerBinding(k.container,"contextmenu",function(e){e.preventDefault()});var H=function(e){for(var t=k.findContainerClientCoords(),n=t[0],r=t[1],i=t[2],a=t[3],o=e.touches?e.touches:[e],s=!1,l=0;l<o.length;l++){var u=o[l];if(n<=u.clientX&&u.clientX<=n+i&&r<=u.clientY&&u.clientY<=r+a){s=!0;break}}if(!s)return!1;for(var c=k.container,h=e.target.parentNode,d=!1;h;){if(h===c){d=!0;break}h=h.parentNode}return!!d};k.registerBinding(k.container,"mousedown",function(e){if(H(e)&&(1!==k.hoverData.which||1===e.which)){e.preventDefault(),j(),k.hoverData.capture=!0,k.hoverData.which=e.which;var t=k.cy,n=[e.clientX,e.clientY],r=k.projectIntoViewport(n[0],n[1]),i=k.selection,a=k.findNearestElements(r[0],r[1],!0,!1),o=a[0],s=k.dragData.possibleDragElements;if(k.hoverData.mdownPos=r,k.hoverData.mdownGPos=n,3==e.which){k.hoverData.cxtStarted=!0;var l={originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}};o?(o.activate(),o.emit(l),k.hoverData.down=o):t.emit(l),k.hoverData.downTime=new Date().getTime(),k.hoverData.cxtDragged=!1}else if(1==e.which){if(o&&o.activate(),null!=o&&k.nodeIsGrabbable(o)){var u=function(t){return{originalEvent:e,type:t,position:{x:r[0],y:r[1]}}};if(N(o),o.selected()){s=k.dragData.possibleDragElements=t.collection();var c=t.$(function(e){return e.isNode()&&e.selected()&&k.nodeIsGrabbable(e)});F(c,{addToList:s}),o.emit(u("grabon")),c.forEach(function(e){e.emit(u("grab"))})}else F(o,{addToList:s=k.dragData.possibleDragElements=t.collection()}),o.emit(u("grabon")).emit(u("grab"));k.redrawHint("eles",!0),k.redrawHint("drag",!0)}k.hoverData.down=o,k.hoverData.downs=a,k.hoverData.downTime=new Date().getTime(),S(o,["mousedown","tapstart","vmousedown"],e,{x:r[0],y:r[1]}),null==o?(i[4]=1,k.data.bgActivePosistion={x:r[0],y:r[1]},k.redrawHint("select",!0),k.redraw()):o.pannable()&&(i[4]=1),k.hoverData.tapholdCancelled=!1,clearTimeout(k.hoverData.tapholdTimeout),k.hoverData.tapholdTimeout=setTimeout(function(){if(!k.hoverData.tapholdCancelled){var n=k.hoverData.down;n?n.emit({originalEvent:e,type:"taphold",position:{x:r[0],y:r[1]}}):t.emit({originalEvent:e,type:"taphold",position:{x:r[0],y:r[1]}})}},k.tapholdDuration)}i[0]=i[2]=r[0],i[1]=i[3]=r[1]}},!1);var G=function(e){var t=e.getRootNode();if(t&&11===t.nodeType&&void 0!==t.host)return t}(k.container);k.registerBinding([C,G],"mousemove",function(e){if(k.hoverData.capture||H(e)){var t=!1,n=k.cy,r=n.zoom(),i=[e.clientX,e.clientY],a=k.projectIntoViewport(i[0],i[1]),o=k.hoverData.mdownPos,s=k.hoverData.mdownGPos,l=k.selection,u=null;k.hoverData.draggingEles||k.hoverData.dragging||k.hoverData.selecting||(u=k.findNearestElement(a[0],a[1],!0,!1));var c=k.hoverData.last,h=k.hoverData.down,d=[a[0]-l[2],a[1]-l[3]],f=k.dragData.possibleDragElements;if(s){var p=i[0]-s[0],g=i[1]-s[1];k.hoverData.isOverThresholdDrag=w=p*p+g*g>=k.desktopTapThreshold2}var v=D(e);w&&(k.hoverData.tapholdCancelled=!0),t=!0,S(u,["mousemove","vmousemove","tapdrag"],e,{x:a[0],y:a[1]});var y=function(){k.data.bgActivePosistion=void 0,k.hoverData.selecting||n.emit({originalEvent:e,type:"boxstart",position:{x:a[0],y:a[1]}}),l[4]=1,k.hoverData.selecting=!0,k.redrawHint("select",!0),k.redraw()};if(3===k.hoverData.which){if(w){var b={originalEvent:e,type:"cxtdrag",position:{x:a[0],y:a[1]}};h?h.emit(b):n.emit(b),k.hoverData.cxtDragged=!0,(!k.hoverData.cxtOver||u!==k.hoverData.cxtOver)&&(k.hoverData.cxtOver&&k.hoverData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:a[0],y:a[1]}}),k.hoverData.cxtOver=u,u&&u.emit({originalEvent:e,type:"cxtdragover",position:{x:a[0],y:a[1]}}))}}else if(k.hoverData.dragging){if(t=!0,n.panningEnabled()&&n.userPanningEnabled()){if(k.hoverData.justStartedPan){var x=k.hoverData.mdownPos;E={x:(a[0]-x[0])*r,y:(a[1]-x[1])*r},k.hoverData.justStartedPan=!1}else E={x:d[0]*r,y:d[1]*r};n.panBy(E),n.emit("dragpan"),k.hoverData.dragged=!0}a=k.projectIntoViewport(e.clientX,e.clientY)}else if(1==l[4]&&(null==h||h.pannable()))w&&(!k.hoverData.dragging&&n.boxSelectionEnabled()&&(v||!n.panningEnabled()||!n.userPanningEnabled())?y():!k.hoverData.selecting&&n.panningEnabled()&&n.userPanningEnabled()&&B(h,k.hoverData.downs)&&(k.hoverData.dragging=!0,k.hoverData.justStartedPan=!0,l[4]=0,k.data.bgActivePosistion=tr(o),k.redrawHint("select",!0),k.redraw()),h&&h.pannable()&&h.active()&&h.unactivate());else{if(h&&h.pannable()&&h.active()&&h.unactivate(),h&&h.grabbed()||u==c||(c&&S(c,["mouseout","tapdragout"],e,{x:a[0],y:a[1]}),u&&S(u,["mouseover","tapdragover"],e,{x:a[0],y:a[1]}),k.hoverData.last=u),h){if(w){if(n.boxSelectionEnabled()&&v)h&&h.grabbed()&&(V(f),h.emit("freeon"),f.emit("free"),k.dragData.didDrag&&(h.emit("dragfreeon"),f.emit("dragfree"))),y();else if(h&&h.grabbed()&&k.nodeIsDraggable(h)){var w,E,T,C=!k.dragData.didDrag;C&&k.redrawHint("eles",!0),k.dragData.didDrag=!0,k.hoverData.draggingEles||F(f,{inDragLayer:!0});var P={x:0,y:0};if(M(d[0])&&M(d[1])&&(P.x+=d[0],P.y+=d[1],C)){var A=k.hoverData.dragDelta;A&&M(A[0])&&M(A[1])&&(P.x+=A[0],P.y+=A[1])}k.hoverData.draggingEles=!0,f.silentShift(P).emit("position drag"),k.redrawHint("drag",!0),k.redraw()}}else 0===(T=k.hoverData.dragDelta=k.hoverData.dragDelta||[]).length?(T.push(d[0]),T.push(d[1])):(T[0]+=d[0],T[1]+=d[1])}t=!0}if(l[2]=a[0],l[3]=a[1],t)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),k.registerBinding(C,"mouseup",function(r){if((1!==k.hoverData.which||1===r.which||!k.hoverData.capture)&&k.hoverData.capture){k.hoverData.capture=!1;var i=k.cy,a=k.projectIntoViewport(r.clientX,r.clientY),o=k.selection,s=k.findNearestElement(a[0],a[1],!0,!1),l=k.dragData.possibleDragElements,u=k.hoverData.down,c=D(r);if(k.data.bgActivePosistion&&(k.redrawHint("select",!0),k.redraw()),k.hoverData.tapholdCancelled=!0,k.data.bgActivePosistion=void 0,u&&u.unactivate(),3===k.hoverData.which){var h={originalEvent:r,type:"cxttapend",position:{x:a[0],y:a[1]}};if(u?u.emit(h):i.emit(h),!k.hoverData.cxtDragged){var d={originalEvent:r,type:"cxttap",position:{x:a[0],y:a[1]}};u?u.emit(d):i.emit(d)}k.hoverData.cxtDragged=!1,k.hoverData.which=null}else if(1===k.hoverData.which){if(S(s,["mouseup","tapend","vmouseup"],r,{x:a[0],y:a[1]}),k.dragData.didDrag||k.hoverData.dragged||k.hoverData.selecting||k.hoverData.isOverThresholdDrag||(S(u,["click","tap","vclick"],r,{x:a[0],y:a[1]}),t=!1,r.timeStamp-n<=i.multiClickDebounceTime()?(e&&clearTimeout(e),t=!0,n=null,S(u,["dblclick","dbltap","vdblclick"],r,{x:a[0],y:a[1]})):(e=setTimeout(function(){t||S(u,["oneclick","onetap","voneclick"],r,{x:a[0],y:a[1]})},i.multiClickDebounceTime()),n=r.timeStamp)),null!=u||k.dragData.didDrag||k.hoverData.selecting||k.hoverData.dragged||D(r)||(i.$(P).unselect(["tapunselect"]),l.length>0&&k.redrawHint("eles",!0),k.dragData.possibleDragElements=l=i.collection()),s!=u||k.dragData.didDrag||k.hoverData.selecting||null==s||!s._private.selectable||(k.hoverData.dragging||("additive"===i.selectionType()||c?s.selected()?s.unselect(["tapunselect"]):s.select(["tapselect"]):c||(i.$(P).unmerge(s).unselect(["tapunselect"]),s.select(["tapselect"]))),k.redrawHint("eles",!0)),k.hoverData.selecting){var f=i.collection(k.getAllInBox(o[0],o[1],o[2],o[3]));k.redrawHint("select",!0),f.length>0&&k.redrawHint("eles",!0),i.emit({type:"boxend",originalEvent:r,position:{x:a[0],y:a[1]}}),"additive"!==i.selectionType()&&(c||i.$(P).unmerge(f).unselect()),f.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),k.redraw()}if(k.hoverData.dragging&&(k.hoverData.dragging=!1,k.redrawHint("select",!0),k.redrawHint("eles",!0),k.redraw()),!o[4]){k.redrawHint("drag",!0),k.redrawHint("eles",!0);var p=u&&u.grabbed();V(l),p&&(u.emit("freeon"),l.emit("free"),k.dragData.didDrag&&(u.emit("dragfreeon"),l.emit("dragfree")))}}o[4]=0,k.hoverData.down=null,k.hoverData.cxtStarted=!1,k.hoverData.draggingEles=!1,k.hoverData.selecting=!1,k.hoverData.isOverThresholdDrag=!1,k.dragData.didDrag=!1,k.hoverData.dragged=!1,k.hoverData.dragDelta=[],k.hoverData.mdownPos=null,k.hoverData.mdownGPos=null,k.hoverData.which=null}},!1);var K=function(e){if(!k.scrollingPage){var t=k.cy,n=t.zoom(),r=t.pan(),i=k.projectIntoViewport(e.clientX,e.clientY),a=[i[0]*n+r.x,i[1]*n+r.y];if(k.hoverData.draggingEles||k.hoverData.dragging||k.hoverData.cxtStarted||0!==k.selection[4]){e.preventDefault();return}if(t.panningEnabled()&&t.userPanningEnabled()&&t.zoomingEnabled()&&t.userZoomingEnabled()){e.preventDefault(),k.data.wheelZooming=!0,clearTimeout(k.data.wheelTimeout),k.data.wheelTimeout=setTimeout(function(){k.data.wheelZooming=!1,k.redrawHint("eles",!0),k.redraw()},150),o=(null!=e.deltaY?-(e.deltaY/250):null!=e.wheelDeltaY?e.wheelDeltaY/1e3:e.wheelDelta/1e3)*k.wheelSensitivity,1===e.deltaMode&&(o*=33);var o,s=t.zoom()*Math.pow(10,o);"gesturechange"===e.type&&(s=k.gestureStartZoom*e.scale),t.zoom({level:s,renderedPosition:{x:a[0],y:a[1]}}),t.emit("gesturechange"===e.type?"pinchzoom":"scrollzoom")}}};k.registerBinding(k.container,"wheel",K,!0),k.registerBinding(C,"scroll",function(e){k.scrollingPage=!0,clearTimeout(k.scrollingPageTimeout),k.scrollingPageTimeout=setTimeout(function(){k.scrollingPage=!1},250)},!0),k.registerBinding(k.container,"gesturestart",function(e){k.gestureStartZoom=k.cy.zoom(),k.hasTouchStarted||e.preventDefault()},!0),k.registerBinding(k.container,"gesturechange",function(e){k.hasTouchStarted||K(e)},!0),k.registerBinding(k.container,"mouseout",function(e){var t=k.projectIntoViewport(e.clientX,e.clientY);k.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})},!1),k.registerBinding(k.container,"mouseover",function(e){var t=k.projectIntoViewport(e.clientX,e.clientY);k.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})},!1);var Z=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},$=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(k.registerBinding(k.container,"touchstart",v=function(e){if(k.hasTouchStarted=!0,H(e)){j(),k.touchData.capture=!0,k.data.bgActivePosistion=void 0;var t=k.cy,n=k.touchData.now,v=k.touchData.earlier;if(e.touches[0]){var y=k.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);n[0]=y[0],n[1]=y[1]}if(e.touches[1]){var y=k.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);n[2]=y[0],n[3]=y[1]}if(e.touches[2]){var y=k.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);n[4]=y[0],n[5]=y[1]}if(e.touches[1]){k.touchData.singleTouchMoved=!0,V(k.dragData.touchDragEles);var b=k.findContainerClientCoords();h=b[0],d=b[1],f=b[2],p=b[3],r=e.touches[0].clientX-h,i=e.touches[0].clientY-d,a=e.touches[1].clientX-h,o=e.touches[1].clientY-d,g=0<=r&&r<=f&&0<=a&&a<=f&&0<=i&&i<=p&&0<=o&&o<=p;var x=t.pan(),w=t.zoom();if(s=Z(r,i,a,o),l=$(r,i,a,o),c=[((u=[(r+a)/2,(i+o)/2])[0]-x.x)/w,(u[1]-x.y)/w],l<4e4&&!e.touches[2]){var E=k.findNearestElement(n[0],n[1],!0,!0),T=k.findNearestElement(n[2],n[3],!0,!0);E&&E.isNode()?(E.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),k.touchData.start=E):T&&T.isNode()?(T.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),k.touchData.start=T):t.emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),k.touchData.start&&(k.touchData.start._private.grabbed=!1),k.touchData.cxt=!0,k.touchData.cxtDragged=!1,k.data.bgActivePosistion=void 0,k.redraw();return}}if(e.touches[2])t.boxSelectionEnabled()&&e.preventDefault();else if(e.touches[1]);else if(e.touches[0]){var C=k.findNearestElements(n[0],n[1],!0,!0),P=C[0];if(null!=P&&(P.activate(),k.touchData.start=P,k.touchData.starts=C,k.nodeIsGrabbable(P))){var D=k.dragData.touchDragEles=t.collection(),B=null;k.redrawHint("eles",!0),k.redrawHint("drag",!0),P.selected()?F(B=t.$(function(e){return e.selected()&&k.nodeIsGrabbable(e)}),{addToList:D}):F(P,{addToList:D}),N(P);var A=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};P.emit(A("grabon")),B?B.forEach(function(e){e.emit(A("grab"))}):P.emit(A("grab"))}S(P,["touchstart","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==P&&(k.data.bgActivePosistion={x:y[0],y:y[1]},k.redrawHint("select",!0),k.redraw()),k.touchData.singleTouchMoved=!1,k.touchData.singleTouchStartTime=+new Date,clearTimeout(k.touchData.tapholdTimeout),k.touchData.tapholdTimeout=setTimeout(function(){!1!==k.touchData.singleTouchMoved||k.pinching||k.touchData.selecting||S(k.touchData.start,["taphold"],e,{x:n[0],y:n[1]})},k.tapholdDuration)}if(e.touches.length>=1){for(var _=k.touchData.startPosition=[null,null,null,null,null,null],M=0;M<n.length;M++)_[M]=v[M]=n[M];var R=e.touches[0];k.touchData.startGPosition=[R.clientX,R.clientY]}}},!1),k.registerBinding(C,"touchmove",y=function(e){var t=k.touchData.capture;if(t||H(e)){var n=k.selection,u=k.cy,f=k.touchData.now,p=k.touchData.earlier,v=u.zoom();if(e.touches[0]){var y=k.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);f[0]=y[0],f[1]=y[1]}if(e.touches[1]){var y=k.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);f[2]=y[0],f[3]=y[1]}if(e.touches[2]){var y=k.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);f[4]=y[0],f[5]=y[1]}var b=k.touchData.startGPosition;if(t&&e.touches[0]&&b){for(var x=[],w=0;w<f.length;w++)x[w]=f[w]-p[w];var E=e.touches[0].clientX-b[0],T=E*E,C=e.touches[0].clientY-b[1];er=T+C*C>=k.touchTapThreshold2}if(t&&k.touchData.cxt){e.preventDefault();var P=e.touches[0].clientX-h,D=e.touches[0].clientY-d,A=e.touches[1].clientX-h,_=e.touches[1].clientY-d,R=$(P,D,A,_);if(R/l>=2.25||R>=22500){k.touchData.cxt=!1,k.data.bgActivePosistion=void 0,k.redrawHint("select",!0);var I={originalEvent:e,type:"cxttapend",position:{x:f[0],y:f[1]}};k.touchData.start?(k.touchData.start.unactivate().emit(I),k.touchData.start=null):u.emit(I)}}if(t&&k.touchData.cxt){var I={originalEvent:e,type:"cxtdrag",position:{x:f[0],y:f[1]}};k.data.bgActivePosistion=void 0,k.redrawHint("select",!0),k.touchData.start?k.touchData.start.emit(I):u.emit(I),k.touchData.start&&(k.touchData.start._private.grabbed=!1),k.touchData.cxtDragged=!0;var N=k.findNearestElement(f[0],f[1],!0,!0);(!k.touchData.cxtOver||N!==k.touchData.cxtOver)&&(k.touchData.cxtOver&&k.touchData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:f[0],y:f[1]}}),k.touchData.cxtOver=N,N&&N.emit({originalEvent:e,type:"cxtdragover",position:{x:f[0],y:f[1]}}))}else if(t&&e.touches[2]&&u.boxSelectionEnabled())e.preventDefault(),k.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,k.touchData.selecting||u.emit({originalEvent:e,type:"boxstart",position:{x:f[0],y:f[1]}}),k.touchData.selecting=!0,k.touchData.didSelect=!0,n[4]=1,n&&0!==n.length&&void 0!==n[0]?(n[2]=(f[0]+f[2]+f[4])/3,n[3]=(f[1]+f[3]+f[5])/3):(n[0]=(f[0]+f[2]+f[4])/3,n[1]=(f[1]+f[3]+f[5])/3,n[2]=(f[0]+f[2]+f[4])/3+1,n[3]=(f[1]+f[3]+f[5])/3+1),k.redrawHint("select",!0),k.redraw();else if(t&&e.touches[1]&&!k.touchData.didSelect&&u.zoomingEnabled()&&u.panningEnabled()&&u.userZoomingEnabled()&&u.userPanningEnabled()){e.preventDefault(),k.data.bgActivePosistion=void 0,k.redrawHint("select",!0);var L=k.dragData.touchDragEles;if(L){k.redrawHint("drag",!0);for(var O=0;O<L.length;O++){var z=L[O]._private;z.grabbed=!1,z.rscratch.inDragLayer=!1}}var X=k.touchData.start,P=e.touches[0].clientX-h,D=e.touches[0].clientY-d,A=e.touches[1].clientX-h,_=e.touches[1].clientY-d,j=Z(P,D,A,_),Y=j/s;if(g){var q=P-r,W=D-i,U=A-a,G=_-o,K=u.zoom(),Q=K*Y,J=u.pan(),ee=c[0]*K+J.x,et=c[1]*K+J.y,en={x:-Q/K*(ee-J.x-(q+U)/2)+ee,y:-Q/K*(et-J.y-(W+G)/2)+et};if(X&&X.active()){var L=k.dragData.touchDragEles;V(L),k.redrawHint("drag",!0),k.redrawHint("eles",!0),X.unactivate().emit("freeon"),L.emit("free"),k.dragData.didDrag&&(X.emit("dragfreeon"),L.emit("dragfree"))}u.viewport({zoom:Q,pan:en,cancelOnFailedZoom:!0}),u.emit("pinchzoom"),s=j,r=P,i=D,a=A,o=_,k.pinching=!0}if(e.touches[0]){var y=k.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);f[0]=y[0],f[1]=y[1]}if(e.touches[1]){var y=k.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);f[2]=y[0],f[3]=y[1]}if(e.touches[2]){var y=k.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);f[4]=y[0],f[5]=y[1]}}else if(e.touches[0]&&!k.touchData.didSelect){var er,N,ei=k.touchData.start,ea=k.touchData.last;if(k.hoverData.draggingEles||k.swipePanning||(N=k.findNearestElement(f[0],f[1],!0,!0)),t&&null!=ei&&e.preventDefault(),t&&null!=ei&&k.nodeIsDraggable(ei)){if(er){var L=k.dragData.touchDragEles,eo=!k.dragData.didDrag;eo&&F(L,{inDragLayer:!0}),k.dragData.didDrag=!0;var es={x:0,y:0};if(M(x[0])&&M(x[1])&&(es.x+=x[0],es.y+=x[1],eo)){k.redrawHint("eles",!0);var el=k.touchData.dragDelta;el&&M(el[0])&&M(el[1])&&(es.x+=el[0],es.y+=el[1])}k.hoverData.draggingEles=!0,L.silentShift(es).emit("position drag"),k.redrawHint("drag",!0),k.touchData.startPosition[0]==p[0]&&k.touchData.startPosition[1]==p[1]&&k.redrawHint("eles",!0),k.redraw()}else{var el=k.touchData.dragDelta=k.touchData.dragDelta||[];0===el.length?(el.push(x[0]),el.push(x[1])):(el[0]+=x[0],el[1]+=x[1])}}if(S(ei||N,["touchmove","tapdrag","vmousemove"],e,{x:f[0],y:f[1]}),ei&&ei.grabbed()||N==ea||(ea&&ea.emit({originalEvent:e,type:"tapdragout",position:{x:f[0],y:f[1]}}),N&&N.emit({originalEvent:e,type:"tapdragover",position:{x:f[0],y:f[1]}})),k.touchData.last=N,t)for(var O=0;O<f.length;O++)f[O]&&k.touchData.startPosition[O]&&er&&(k.touchData.singleTouchMoved=!0);if(t&&(null==ei||ei.pannable())&&u.panningEnabled()&&u.userPanningEnabled()){B(ei,k.touchData.starts)&&(e.preventDefault(),k.data.bgActivePosistion||(k.data.bgActivePosistion=tr(k.touchData.startPosition)),k.swipePanning?(u.panBy({x:x[0]*v,y:x[1]*v}),u.emit("dragpan")):er&&(k.swipePanning=!0,u.panBy({x:E*v,y:C*v}),u.emit("dragpan"),ei&&(ei.unactivate(),k.redrawHint("select",!0),k.touchData.start=null)));var y=k.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);f[0]=y[0],f[1]=y[1]}}for(var w=0;w<f.length;w++)p[w]=f[w];t&&e.touches.length>0&&!k.hoverData.draggingEles&&!k.swipePanning&&null!=k.data.bgActivePosistion&&(k.data.bgActivePosistion=void 0,k.redrawHint("select",!0),k.redraw())}},!1),k.registerBinding(C,"touchcancel",b=function(e){var t=k.touchData.start;k.touchData.capture=!1,t&&t.unactivate()}),k.registerBinding(C,"touchend",x=function(e){var t,n=k.touchData.start;if(k.touchData.capture){0===e.touches.length&&(k.touchData.capture=!1),e.preventDefault();var r=k.selection;k.swipePanning=!1,k.hoverData.draggingEles=!1;var i=k.cy,a=i.zoom(),o=k.touchData.now,s=k.touchData.earlier;if(e.touches[0]){var l=k.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);o[0]=l[0],o[1]=l[1]}if(e.touches[1]){var l=k.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);o[2]=l[0],o[3]=l[1]}if(e.touches[2]){var l=k.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);o[4]=l[0],o[5]=l[1]}if(n&&n.unactivate(),k.touchData.cxt){if(t={originalEvent:e,type:"cxttapend",position:{x:o[0],y:o[1]}},n?n.emit(t):i.emit(t),!k.touchData.cxtDragged){var u={originalEvent:e,type:"cxttap",position:{x:o[0],y:o[1]}};n?n.emit(u):i.emit(u)}k.touchData.start&&(k.touchData.start._private.grabbed=!1),k.touchData.cxt=!1,k.touchData.start=null,k.redraw();return}if(!e.touches[2]&&i.boxSelectionEnabled()&&k.touchData.selecting){k.touchData.selecting=!1;var c=i.collection(k.getAllInBox(r[0],r[1],r[2],r[3]));r[0]=void 0,r[1]=void 0,r[2]=void 0,r[3]=void 0,r[4]=0,k.redrawHint("select",!0),i.emit({type:"boxend",originalEvent:e,position:{x:o[0],y:o[1]}}),c.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),c.nonempty()&&k.redrawHint("eles",!0),k.redraw()}if(null!=n&&n.unactivate(),e.touches[2])k.data.bgActivePosistion=void 0,k.redrawHint("select",!0);else if(e.touches[1]);else if(e.touches[0]);else if(!e.touches[0]){k.data.bgActivePosistion=void 0,k.redrawHint("select",!0);var h=k.dragData.touchDragEles;if(null!=n){var d=n._private.grabbed;V(h),k.redrawHint("drag",!0),k.redrawHint("eles",!0),d&&(n.emit("freeon"),h.emit("free"),k.dragData.didDrag&&(n.emit("dragfreeon"),h.emit("dragfree"))),S(n,["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]}),n.unactivate(),k.touchData.start=null}else S(k.findNearestElement(o[0],o[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]});var f=k.touchData.startPosition[0]-o[0],p=k.touchData.startPosition[1]-o[1];k.touchData.singleTouchMoved||(n||i.$(":selected").unselect(["tapunselect"]),S(n,["tap","vclick"],e,{x:o[0],y:o[1]}),w=!1,e.timeStamp-T<=i.multiClickDebounceTime()?(E&&clearTimeout(E),w=!0,T=null,S(n,["dbltap","vdblclick"],e,{x:o[0],y:o[1]})):(E=setTimeout(function(){w||S(n,["onetap","voneclick"],e,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),T=e.timeStamp)),null!=n&&!k.dragData.didDrag&&n._private.selectable&&(f*f+p*p)*a*a<k.touchTapThreshold2&&!k.pinching&&("single"===i.selectionType()?(i.$(P).unmerge(n).unselect(["tapunselect"]),n.select(["tapselect"])):n.selected()?n.unselect(["tapunselect"]):n.select(["tapselect"]),k.redrawHint("eles",!0)),k.touchData.singleTouchMoved=!0}for(var g=0;g<o.length;g++)s[g]=o[g];k.dragData.didDrag=!1,0===e.touches.length&&(k.touchData.dragDelta=[],k.touchData.startPosition=[null,null,null,null,null,null],k.touchData.startGPosition=null,k.touchData.didSelect=!1),e.touches.length<2&&(1===e.touches.length&&(k.touchData.startGPosition=[e.touches[0].clientX,e.touches[0].clientY]),k.pinching=!1,k.redrawHint("eles",!0),k.redraw())}},!1),"undefined"==typeof TouchEvent){var Q=[],J=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},ee=function(e){Q.push({event:e,touch:J(e)})},et=function(e){for(var t=0;t<Q.length;t++)if(Q[t].event.pointerId===e.pointerId){Q.splice(t,1);return}},en=function(e){var t=Q.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=J(e)},er=function(e){e.touches=Q.map(function(e){return e.touch})},ei=function(e){return"mouse"===e.pointerType||4===e.pointerType};k.registerBinding(k.container,"pointerdown",function(e){ei(e)||(e.preventDefault(),ee(e),er(e),v(e))}),k.registerBinding(k.container,"pointerup",function(e){ei(e)||(et(e),er(e),x(e))}),k.registerBinding(k.container,"pointercancel",function(e){ei(e)||(et(e),er(e),b(e))}),k.registerBinding(k.container,"pointermove",function(e){ei(e)||(e.preventDefault(),en(e),er(e),y(e))})}};var lX={};lX.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return tW(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return tL(e,t,this.points,a,o,r,i,[0,-1],n)}}},lX.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return tV(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return tX(e,t,r,i,a,o,n)}}},lX.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(void 0!==o[s]&&o[s+"-cx"]===e&&o[s+"-cy"]===n)return o[s];o[s]=Array(t.length/2),o[s+"-cx"]=e,o[s+"-cy"]=n;var l=r/2,u=i/2;a="auto"===a?tQ(r,i):a;for(var c=Array(t.length/2),h=0;h<t.length/2;h++)c[h]={x:e+l*t[2*h],y:n+u*t[2*h+1]};var d,f,p,g,v=c.length;for(d=0,f=c[v-1];d<v;d++)p=c[d%v],g=c[(d+1)%v],o[s][d]=lC(f,p,g,a),f=p,p=g;return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,"drawCorners"))},intersectLine:function(e,t,n,r,i,a,o,s,l){return tU(i,a,this.points,e,t,n,r,o,this.getOrCreateCorners(e,t,n,r,s,l,"corners"))},checkPoint:function(e,t,n,r,i,a,o,s,l){return tO(e,t,this.points,a,o,r,i,this.getOrCreateCorners(a,o,r,i,s,l,"corners"))}}},lX.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:tG(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return tD(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=r/2,u=i/2,c=2*(s=Math.min(l,u,s="auto"===s?t$(r,i):s));return!!(tL(e,t,this.points,a,o,r,i-c,[0,-1],n)||tL(e,t,this.points,a,o,r-c,i,[0,-1],n)||tX(e,t,c,c,a-l+s,o-u+s,n)||tX(e,t,c,c,a+l-s,o-u+s,n)||tX(e,t,c,c,a+l-s,o+u-s,n)||tX(e,t,c,c,a-l+s,o+u-s,n))}}},lX.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:tJ(),points:tG(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a="auto"===i?this.cornerLength:i,o=t/2,s=e/2,l=n-s,u=n+s,c=r-o,h=r+o;return{topLeft:[l,c+a,l+a,c,l+a,c+a],topRight:[u-a,c,u,c+a,u-a,c+a],bottomRight:[u,h-a,u-a,h,u-a,h-a],bottomLeft:[l+a,h,l,h-a,l+a,h-a]}},intersectLine:function(e,t,n,r,i,a,o,s){var l=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s);return tW(i,a,[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]),e,t)},checkPoint:function(e,t,n,r,i,a,o,s){var l="auto"===s?this.cornerLength:s;if(tL(e,t,this.points,a,o,r,i-2*l,[0,-1],n)||tL(e,t,this.points,a,o,r-2*l,i,[0,-1],n))return!0;var u=this.generateCutTrianglePts(r,i,a,o);return tN(e,t,u.topLeft)||tN(e,t,u.topRight)||tN(e,t,u.bottomRight)||tN(e,t,u.bottomLeft)}}},lX.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:tG(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){var l=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),u=function(e){var t=tg({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=tg({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),r=tg({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]};return tW(i,a,[].concat(u(l.topLeft),u(l.topRight),u(l.bottomRight),u(l.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,l=r-i,u=r+i,c=t0(e,t),h=c.heightOffset,d=c.widthOffset,f=c.ctrlPtOffsetPct*e,p={topLeft:[o,l+h,o+f,l,o+d,l],topRight:[s-d,l,s-f,l,s,l+h],bottomRight:[s,u-h,s-f,u,s-d,u],bottomLeft:[o+d,u,o+f,u,o,u-h]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,n,r,i,a,o,s){var l=t0(r,i),u=l.heightOffset,c=l.widthOffset;if(tL(e,t,this.points,a,o,r,i-2*u,[0,-1],n)||tL(e,t,this.points,a,o,r-2*c,i,[0,-1],n))return!0;for(var h=this.generateBarrelBezierPts(r,i,a,o),d=Object.keys(h),f=0;f<d.length;f++){var p=h[d[f]],g=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1],l=Math.min(r,a),u=Math.max(r,a),c=Math.min(o,s),h=Math.max(o,s);if(l<=e&&e<=u&&c<=t&&t<=h){var d=[r-2*i+a,2*(i-r),r],f=t_(d[0],d[1],d[2],e).filter(function(e){return 0<=e&&e<=1});if(f.length>0)return f[0]}return null}(e,t,p);if(null!=g){var v=tp(p[5],p[3],p[1],g);if(p.isTop&&v<=t||p.isBottom&&t<=v)return!0}}return!1}}},lX.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:tG(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var l=e-(n/2+o),u=t-(r/2+o),c=e+(n/2+o),h=tq(i,a,e,t,l,u,c,u,!1);return h.length>0?h:tD(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?t$(r,i):s);if(tL(e,t,this.points,a,o,r,i-l,[0,-1],n)||tL(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!(tN(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||tX(e,t,l,l,a+r/2-s,o+i/2-s,n)||tX(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},lX.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",tG(3,0)),this.generateRoundPolygon("round-triangle",tG(3,0)),this.generatePolygon("rectangle",tG(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",tG(5,0)),this.generateRoundPolygon("round-pentagon",tG(5,0)),this.generatePolygon("hexagon",tG(6,0)),this.generateRoundPolygon("round-hexagon",tG(6,0)),this.generatePolygon("heptagon",tG(7,0)),this.generateRoundPolygon("round-heptagon",tG(7,0)),this.generatePolygon("octagon",tG(8,0)),this.generateRoundPolygon("round-octagon",tG(8,0));var r=Array(20),i=tZ(5,0),a=tZ(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(var s=0;s<5;s++)r[4*s]=i[2*s],r[4*s+1]=i[2*s+1],r[4*s+2]=a[2*s],r[4*s+3]=a[2*s+1];r=tK(r),this.generatePolygon("star",r),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),e.makePolygon=function(e){var n,r="polygon-"+e.join("$");return(n=this[r])?n:t.generatePolygon(r,e)}};var lj={};lj.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},lj.redraw=function(e){e=e||eX(),void 0===this.averageRedrawTime&&(this.averageRedrawTime=0),void 0===this.lastRedrawTime&&(this.lastRedrawTime=0),void 0===this.lastDrawTime&&(this.lastDrawTime=0),this.requestedFrame=!0,this.renderOptions=e},lj.beforeRender=function(e,t){if(!this.destroyed){null==t&&eN("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(e,t){return t.priority-e.priority})}};var lY=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};lj.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){lY(e,!0,r);var i=eg();e.render(e.renderOptions);var a=e.lastDrawTime=eg();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else lY(e,!1,r);e.skipFrame=!1,ey(n)}};ey(n)}};var lq=function(e){this.init(e)},lW=lq.prototype;lW.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],lW.init=function(e){this.options=e,this.cy=e.cy;var t=this.container=e.cy.container(),n=this.cy.window();if(n){var r=n.document,i=r.head,a="__________cytoscape_stylesheet",o="__________cytoscape_container",s=null!=r.getElementById(a);if(0>t.className.indexOf(o)&&(t.className=(t.className||"")+" "+o),!s){var l=r.createElement("style");l.id=a,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}"static"===n.getComputedStyle(t).getPropertyValue("position")&&eO("A Cytoscape container has style position:static and so can not use UI extensions properly")}this.selection=[void 0,void 0,void 0,void 0,0],this.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],this.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},this.dragData={possibleDragElements:[]},this.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},this.redraws=0,this.showFps=e.showFps,this.debug=e.debug,this.webgl=e.webgl,this.hideEdgesOnViewport=e.hideEdgesOnViewport,this.textureOnViewport=e.textureOnViewport,this.wheelSensitivity=e.wheelSensitivity,this.motionBlurEnabled=e.motionBlur,this.forcedPixelRatio=M(e.pixelRatio)?e.pixelRatio:null,this.motionBlur=e.motionBlur,this.motionBlurOpacity=e.motionBlurOpacity,this.motionBlurTransparency=1-this.motionBlurOpacity,this.motionBlurPxRatio=1,this.mbPxRBlurry=1,this.minMbLowQualFrames=4,this.fullQualityMb=!1,this.clearedForMotionBlur=[],this.desktopTapThreshold=e.desktopTapThreshold,this.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,this.touchTapThreshold=e.touchTapThreshold,this.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,this.tapholdDuration=500,this.bindings=[],this.beforeRenderCallbacks=[],this.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},this.registerNodeShapes(),this.registerArrowShapes(),this.registerCalculationListeners()},lW.notify=function(e,t){var n=this.cy;if(!this.destroyed){if("init"===e){this.load();return}if("destroy"===e){this.destroy();return}("add"===e||"remove"===e||"move"===e&&n.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&this.invalidateCachedZSortedEles(),"viewport"===e&&this.redrawHint("select",!0),"gc"===e&&this.redrawHint("gc",!0),("load"===e||"resize"===e||"mount"===e)&&(this.invalidateContainerClientCoordsCache(),this.matchCanvasSize(this.container)),this.redrawHint("eles",!0),this.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},lW.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e<this.bindings.length;e++){var t=this.bindings[e],n=t.target;(n.off||n.removeEventListener).apply(n,t.args)}if(this.bindings=[],this.beforeRenderCallbacks=[],this.onUpdateEleCalcsFns=[],this.removeObserver&&this.removeObserver.disconnect(),this.styleObserver&&this.styleObserver.disconnect(),this.resizeObserver&&this.resizeObserver.disconnect(),this.labelCalcDiv)try{document.body.removeChild(this.labelCalcDiv)}catch(e){}},lW.isHeadless=function(){return!1},[aQ,lz,lF,lV,lX,lj].forEach(function(e){Q(lW,e)});var lU=1e3/60,lH=function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=ef(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),i=e.priority||eI;n.beforeRender(function(i,a){var o=eg(),s=n.averageRedrawTime,l=n.lastRedrawTime,u=[],c=n.cy.extent(),h=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var d=eg(),f=d-o,p=d-a;if(l<lU){var g=lU-(i?s:0);if(p>=e.deqFastCost*g)break}else if(i){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*lU)break;var v=e.deq(t,h,c);if(v.length>0)for(var y=0;y<v.length;y++)u.push(v[y]);else break}u.length>0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&r())},i(t))}}},lG=a(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eM;i(this,e),this.idsByKey=new eK,this.keyForId=new eK,this.cachesByLvl=new eK,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n},[{key:"getIdsFor",value:function(e){null==e&&eN("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new e$,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new eK,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),lK={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},lZ=ej({getKey:null,doesEleInvalidateKey:eM,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:e_,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),l$=function(e,t){this.renderer=e,this.onDequeues=[];var n=lZ(t);Q(this,n),this.lookup=new lG(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},lQ=l$.prototype;lQ.reasons=lK,lQ.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},lQ.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},lQ.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new e5(function(e,t){return t.reqs-e.reqs})},lQ.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},lQ.getElement=function(e,t,n,r,i){var a,o,s,l=this,u=this.renderer,c=u.cy.zoom(),h=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!l.allowEdgeTxrCaching&&e.isEdge()||!l.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(tu(c*n))),r<-4)r=-4;else if(c>=7.99||r>3)return null;var d=Math.pow(2,r),f=t.h*d,p=t.w*d,g=u.eleTextBiggerThanMin(e,d);if(!this.isVisible(e,g))return null;var v=h.get(e,r);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;if(a=f<=25?25:f<=50?50:50*Math.ceil(f/50),f>1024||p>1024)return null;var y=l.getTextureQueue(a),b=y[y.length-2],x=function(){return l.recycleTexture(a,p)||l.addTexture(a,p)};b||(b=y[y.length-1]),b||(b=x()),b.width-b.usedWidth<p&&(b=x());for(var w=function(e){return e&&e.scaledLabelShown===g},E=i&&i===lK.dequeue,T=i&&i===lK.highQuality,k=i&&i===lK.downscale,C=r+1;C<=3;C++){var P=h.get(e,C);if(P){o=P;break}}var S=o&&o.level===r+1?o:null,D=function(){b.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,b.usedWidth,0,p,f)};if(b.context.setTransform(1,0,0,1,0,0),b.context.clearRect(b.usedWidth,0,p,a),w(S))D();else if(w(o)){if(!T)return l.queueElement(e,o.level-1),o;for(var B=o.level;B>r;B--)S=l.getElement(e,t,n,B,lK.downscale);D()}else{if(!E&&!T&&!k)for(var A=r-1;A>=-4;A--){var _=h.get(e,A);if(_){s=_;break}}if(w(s))return l.queueElement(e,r),s;b.context.translate(b.usedWidth,0),b.context.scale(d,d),this.drawElement(b.context,e,t,g,!1),b.context.scale(1/d,1/d),b.context.translate(-b.usedWidth,0)}return v={x:b.usedWidth,texture:b,level:r,scale:d,width:p,height:f,scaledLabelShown:g},b.usedWidth+=Math.ceil(p+8),b.eleCaches.push(v),h.set(e,r,v),l.checkTextureFullness(b),v},lQ.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},lQ.invalidateElement=function(e){var t=this.lookup,n=[];if(t.isInvalid(e)){for(var r=-4;r<=3;r++){var i=t.getForCachedKey(e,r);i&&n.push(i)}if(t.invalidate(e))for(var a=0;a<n.length;a++){var o=n[a],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},lQ.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},lQ.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?eY(t,e):e.fullnessChecks++},lQ.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;eY(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a<i.length;a++){var o=i[a];r.deleteCache(o.key,o.level)}eq(i),this.getRetiredTextureQueue(t).push(e)},lQ.addTexture=function(e,t){var n=this.getTextureQueue(e),r={};return n.push(r),r.eleCaches=[],r.height=e,r.width=Math.max(1024,t),r.usedWidth=0,r.invalidatedWidth=0,r.fullnessChecks=0,r.canvas=this.renderer.makeOffscreenCanvas(r.width,r.height),r.context=r.canvas.getContext("2d"),r},lQ.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),i=0;i<r.length;i++){var a=r[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,eq(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),eY(r,a),n.push(a),a}},lQ.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},lQ.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1;a++)if(t.size()>0){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,u)continue;r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,lK.dequeue)}else break;return r},lQ.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=eA,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},lQ.onDequeue=function(e){this.onDequeues.push(e)},lQ.offDequeue=function(e){eY(this.onDequeues,e)},lQ.setupDequeueing=lH({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++)(0,e.onDequeues[n])(t)},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++)if(tC(a[o].boundingBox(),r))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var lJ=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=eg()-500,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=ef(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),n.beforeRender(function(e,n){n-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new e5(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},l0=lJ.prototype,l1=0;l0.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:l1=++l1%9007199254740991,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(n,n),s.translate(l,u),o},l0.getLayers=function(e,t,n){var r,i,a=this,o=a.renderer.cy.zoom(),s=a.firstGet;if(a.firstGet=!1,null==n){if((n=Math.ceil(tu(o*t)))<-4)n=-4;else if(o>=3.99||n>2)return null}a.validateLayersElesOrdering(n,e);var l=a.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(a.levelIsComplete(n,e))return c;!function(){var t=function(t){if(a.validateLayersElesOrdering(t,e),a.levelIsComplete(t,e))return i=l[t],!0},r=function(e){if(!i)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};r(1),r(-1);for(var o=c.length-1;o>=0;o--){var s=c[o];s.invalid&&eY(c,s)}}();var h=function(){if(!r){r=tm();for(var t=0;t<e.length;t++)tx(r,e[t].boundingBox())}return r};if(a.skipping&&!s)return null;for(var d=null,f=e.length/1,p=!s,g=0;g<e.length;g++){var v=e[g],y=v._private.rscratch,b=y.imgLayerCaches=y.imgLayerCaches||{},x=b[n];if(x){d=x;continue}if((!d||d.eles.length>=f||!tS(d.bb,v.boundingBox()))&&!(d=function(e){var t=(e=e||{}).after;h();var i=Math.ceil(r.w*u),o=Math.ceil(r.h*u);if(i>32767||o>32767||i*o>16e6)return null;var s=a.makeLayer(r,n);if(null!=t){var l=c.indexOf(t)+1;c.splice(l,0,s)}else(void 0===e.insert||e.insert)&&c.unshift(s);return s}({insert:!0,after:d})))return null;i||p?a.queueLayer(d,v):a.drawEleInLayer(d,v,n,t),d.eles.push(v),b[n]=d}return i||(p?null:c)},l0.getEleLevelForLayerLevel=function(e,t){return e},l0.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},l0.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0||a.invalid)return!1;r+=a.eles.length}return r===t.length},l0.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}},l0.updateElementsInLayers=function(e,t){for(var n=N(e[0]),r=0;r<e.length;r++)for(var i=n?null:e[r],a=n?e[r]:e[r].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];u&&(!i||this.getEleLevelForLayerLevel(u.level)===i.level)&&t(u,a,i)}},l0.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},l0.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=eg(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},l0.invalidateLayer=function(e){if(this.lastInvalidationTime=eg(),!e.invalid){var t=e.level,n=e.eles;eY(this.layersByLevel[t],e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var r=0;r<n.length;r++){var i=n[r]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},l0.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,r){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},l0.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},l0.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},l0.dequeue=function(e){for(var t=this.layersQueue,n=[],r=0;r<1&&0!==t.size();){var i=t.peek();if(i.replacement||i.replaces&&i!==i.replaces.replacement||i.invalid){t.pop();continue}var a=i.elesQueue.shift();a&&(this.drawEleInLayer(i,a,i.level,e),r++),0===n.length&&n.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&this.applyLayerReplacement(i),this.requestRedraw())}return n},l0.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],n=e.replaces,r=t.indexOf(n);if(!(r<0)&&!n.invalid){t[r]=e;for(var i=0;i<e.eles.length;i++){var a=e.eles[i]._private,o=a.imgLayerCaches=a.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},l0.requestRedraw=ef(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),l0.setupDequeueing=lH({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:eI,shouldRedraw:e_,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var l2={};function l5(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function l3(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function l4(e,t,n){e.beginPath&&e.beginPath();for(var r=0;r<t.length;r++){var i=t[r];e.lineTo(i.x,i.y)}var a=n[0];e.moveTo(a.x,a.y);for(var r=1;r<n.length;r++){var i=n[r];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function l9(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,2*Math.PI,!1);var a=t[0];e.moveTo(a.x,a.y);for(var o=0;o<t.length;o++){var s=t[o];e.lineTo(s.x,s.y)}e.closePath&&e.closePath()}function l6(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}l2.arrowShapeImpl=function(e){return(b||(b={polygon:l5,"triangle-backcurve":l3,"triangle-tee":l4,"circle-triangle":l9,"triangle-cross":l4,circle:l6}))[e]};var l8={};l8.drawElement=function(e,t,n,r,i,a){t.isNode()?this.drawNode(e,t,n,r,i,a):this.drawEdge(e,t,n,r,i,a)},l8.drawElementOverlay=function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},l8.drawElementUnderlay=function(e,t){t.isNode()?this.drawNodeUnderlay(e,t):this.drawEdgeUnderlay(e,t)},l8.drawCachedElementPortion=function(e,t,n,r,i,a,o,s){var l=n.getBoundingBox(t);if(0!==l.w&&0!==l.h){var u=n.getElement(t,l,r,i,a);if(null!=u){var c,h,d,f,p,g,v=s(this,t);if(0===v)return;var y=o(this,t),b=l.x1,x=l.y1,w=l.w,E=l.h;if(0!==y){var T=n.getRotationPoint(t);d=T.x,f=T.y,e.translate(d,f),e.rotate(y),(p=this.getImgSmoothing(e))||this.setImgSmoothing(e,!0);var k=n.getRotationOffset(t);c=k.x,h=k.y}else c=b,h=x;1!==v&&(g=e.globalAlpha,e.globalAlpha=g*v),e.drawImage(u.texture.canvas,u.x,0,u.width,u.height,c,h,w,E),1!==v&&(e.globalAlpha=g),0===y||(e.rotate(-y),e.translate(-d,-f),p||this.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var l7=function(){return 0},ue=function(e,t){return e.getTextAngle(t,null)},ut=function(e,t){return e.getTextAngle(t,"source")},un=function(e,t){return e.getTextAngle(t,"target")},ur=function(e,t){return t.effectiveOpacity()},ui=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};l8.drawCachedElement=function(e,t,n,r,i,a){var o=this.data,s=o.eleTxrCache,l=o.lblTxrCache,u=o.slbTxrCache,c=o.tlbTxrCache,h=t.boundingBox(),d=!0===a?s.reasons.highQuality:null;if(0!==h.w&&0!==h.h&&t.visible()&&(!r||tC(h,r))){var f=t.isEdge(),p=t.element()._private.rscratch.badLine;this.drawElementUnderlay(e,t),this.drawCachedElementPortion(e,t,s,n,i,d,l7,ur),f&&p||this.drawCachedElementPortion(e,t,l,n,i,d,ue,ui),f&&!p&&(this.drawCachedElementPortion(e,t,u,n,i,d,ut,ui),this.drawCachedElementPortion(e,t,c,n,i,d,un,ui)),this.drawElementOverlay(e,t)}},l8.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},l8.drawCachedElements=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,n,r)}},l8.drawCachedNodes=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,n,r)}},l8.drawLayeredElements=function(e,t,n,r){var i=this.data.lyrTxrCache.getLayers(t,n);if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,n,r)};var ua={};ua.drawEdge=function(e,t,n){var r,i=!(arguments.length>3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=!(arguments.length>5)||void 0===arguments[5]||arguments[5],s=this,l=t._private.rscratch;if(!(o&&!t.visible()||l.badLine||null==l.allpts||isNaN(l.allpts[0]))){n&&(r=n,e.translate(-r.x1,-r.y1));var u=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,b=u*c,x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===h?(s.eleStrokeStyle(e,t,n),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=f,e.lineCap=p,s.eleStrokeStyle(e,t,n),s.drawEdgePath(t,e,l.allpts,d),e.lineCap="butt")},w=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b;s.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var E=t.pstyle("ghost-offset-x").pfValue,T=t.pstyle("ghost-offset-y").pfValue,k=y*t.pstyle("ghost-opacity").value;e.translate(E,T),x(k),w(k),e.translate(-E,-T)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;if(e.lineWidth=f+g,e.lineCap=p,g>0)s.colorStrokeStyle(e,v[0],v[1],v[2],n);else{e.lineCap="butt";return}"straight-triangle"===h?s.drawEdgeTrianglePath(t,e,l.allpts):(s.drawEdgePath(t,e,l.allpts,d),e.lineCap="butt")}();a&&s.drawEdgeUnderlay(e,t),x(),w(),a&&s.drawEdgeOverlay(e,t),s.drawElementText(e,t,null,i),n&&e.translate(r.x1,r.y1)}};var uo=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this.usePaths(),a=n._private.rscratch,o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-color")).value;t.lineWidth=2*o,"self"!==a.edgeType||i?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,s[0],s[1],s[2],r),this.drawEdgePath(n,t,a.allpts,"solid")}}}};ua.drawEdgeOverlay=uo("overlay"),ua.drawEdgeUnderlay=uo("underlay"),ua.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$");i.pathCacheKey&&i.pathCacheKey===h?(p=t=i.pathCache,s=!0):(p=t=new Path2D,i.pathCacheKey=h,i.pathCache=p)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(u),a.lineDashOffset=c;break;case"solid":a.setLineDash([])}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<n.length;d+=4)t.quadraticCurveTo(n[d],n[d+1],n[d+2],n[d+3]);break;case"straight":case"haystack":for(var f=2;f+1<n.length;f+=2)t.lineTo(n[f],n[f+1]);break;case"segments":if(i.isRound){var p,g,v=o(i.roundCorners);try{for(v.s();!(g=v.n()).done;){var y=g.value;lk(t,y)}}catch(e){v.e(e)}finally{v.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var b=2;b+1<n.length;b+=2)t.lineTo(n[b],n[b+1])}t=a,l?t.stroke(p):t.stroke(),t.setLineDash&&t.setLineDash([])},ua.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-l[0],n[i+1]-l[1]),t.lineTo(n[i]+l[0],n[i+1]+l[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},ua.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},ua.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a))&&null!=a){var s=t.pstyle(n+"-arrow-shape").value;if("none"!==s){var l="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",u=t.pstyle(n+"-arrow-fill").value,c=t.pstyle("width").pfValue,h=t.pstyle(n+"-arrow-width"),d="match-line"===h.value?c:h.pfValue;"%"===h.units&&(d*=c);var f=t.pstyle("opacity").value;void 0===o&&(o=f);var p=e.globalCompositeOperation;(1!==o||"hollow"===u)&&(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,l,c,s,d,r,i,a),e.globalCompositeOperation=p);var g=t.pstyle(n+"-arrow-color").value;this.colorFillStyle(e,g[0],g[1],g[2],o),this.colorStrokeStyle(e,g[0],g[1],g[2],o),this.drawArrowShape(t,e,u,c,s,d,r,i,a)}}},ua.drawArrowShape=function(e,t,n,r,i,a,o,s,l){var u,c=this.usePaths()&&"triangle-cross"!==i,h=!1,d=t,f=e.pstyle("arrow-scale").value,p=this.getArrowWidth(r,f),g=this.arrowShapes[i];if(c){var v=this.arrowPathCache=this.arrowPathCache||[],y=ek(i),b=v[y];null!=b?(u=t=b,h=!0):(u=t=new Path2D,v[y]=u)}!h&&(t.beginPath&&t.beginPath(),c?g.draw(t,1,0,{x:0,y:0},1):g.draw(t,p,l,{x:o,y:s},r),t.closePath&&t.closePath()),t=d,c&&(t.translate(o,s),t.rotate(l),t.scale(p,p)),("filled"===n||"both"===n)&&(c?t.fill(u):t.fill()),("hollow"===n||"both"===n)&&(t.lineWidth=a/(c?p:1),t.lineJoin="miter",c?t.stroke(u):t.stroke()),c&&(t.scale(1/p,1/p),t.rotate(-l),t.translate(-o,-s))};var us={};us.safeDrawImage=function(e,t,n,r,i,a,o,s,l,u){if(!(i<=0)&&!(a<=0)&&!(l<=0)&&!(u<=0))try{e.drawImage(t,n,r,i,a,o,s,l,u)}catch(e){eO(e)}},us.drawInscribedImage=function(e,t,n,r,i){var a=n.position(),o=a.x,s=a.y,l=n.cy().style(),u=l.getIndexedStyle.bind(l),c=u(n,"background-fit","value",r),h=u(n,"background-repeat","value",r),d=n.width(),f=n.height(),p=2*n.padding(),g=d+("inner"===u(n,"background-width-relative-to","value",r)?0:p),v=f+("inner"===u(n,"background-height-relative-to","value",r)?0:p),y=n._private.rscratch,b="node"===u(n,"background-clip","value",r),x=u(n,"background-image-opacity","value",r)*i,w=u(n,"background-image-smoothing","value",r),E=n.pstyle("corner-radius").value;"auto"!==E&&(E=n.pstyle("corner-radius").pfValue);var T=t.width||t.cachedW,k=t.height||t.cachedH;(null==T||null==k)&&(document.body.appendChild(t),T=t.cachedW=t.width||t.offsetWidth,k=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var C=T,P=k;if("auto"!==u(n,"background-width","value",r)&&(C="%"===u(n,"background-width","units",r)?u(n,"background-width","pfValue",r)*g:u(n,"background-width","pfValue",r)),"auto"!==u(n,"background-height","value",r)&&(P="%"===u(n,"background-height","units",r)?u(n,"background-height","pfValue",r)*v:u(n,"background-height","pfValue",r)),0!==C&&0!==P){if("contain"===c){var S=Math.min(g/C,v/P);C*=S,P*=S}else if("cover"===c){var S=Math.max(g/C,v/P);C*=S,P*=S}var D=o-g/2,B=u(n,"background-position-x","units",r),A=u(n,"background-position-x","pfValue",r);"%"===B?D+=(g-C)*A:D+=A;var _=u(n,"background-offset-x","units",r),M=u(n,"background-offset-x","pfValue",r);"%"===_?D+=(g-C)*M:D+=M;var R=s-v/2,I=u(n,"background-position-y","units",r),N=u(n,"background-position-y","pfValue",r);"%"===I?R+=(v-P)*N:R+=N;var L=u(n,"background-offset-y","units",r),O=u(n,"background-offset-y","pfValue",r);"%"===L?R+=(v-P)*O:R+=O,y.pathCache&&(D-=o,R-=s,o=0,s=0);var z=e.globalAlpha;e.globalAlpha=x;var F=this.getImgSmoothing(e),V=!1;if("no"===w&&F?(this.setImgSmoothing(e,!1),V=!0):"yes"!==w||F||(this.setImgSmoothing(e,!0),V=!0),"no-repeat"===h)b&&(e.save(),y.pathCache?e.clip(y.pathCache):(this.nodeShapes[this.getNodeShape(n)].draw(e,o,s,g,v,E,y),e.clip())),this.safeDrawImage(e,t,0,0,T,k,D,R,C,P),b&&e.restore();else{var X=e.createPattern(t,h);e.fillStyle=X,this.nodeShapes[this.getNodeShape(n)].draw(e,o,s,g,v,E,y),e.translate(D,R),e.fill(),e.translate(-D,-R)}e.globalAlpha=z,V&&this.setImgSmoothing(e,F)}};var ul={};function uu(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}ul.eleTextBiggerThanMin=function(e,t){return t||(t=Math.pow(2,Math.ceil(tu(e.cy().zoom()*this.getPixelRatio())))),!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},ul.drawElementText=function(e,t,n,r,i){var a,o=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(null==r){if(o&&!this.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=this.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),d=t.pstyle("target-label");if(u||(!c||!c.value)&&(!h||!h.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var f=!n;n&&(a=n,e.translate(-a.x1,-a.y1)),null==i?(this.drawText(e,t,null,f,o),t.isEdge()&&(this.drawText(e,t,"source",f,o),this.drawText(e,t,"target",f,o))):this.drawText(e,t,i,f,o),n&&e.translate(a.x1,a.y1)},ul.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},ul.setupTextStyle=function(e,t){var n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},ul.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+"-":"",a=e.pstyle(i+"text-rotation");if("autorotate"===a.strValue){var o=eU(r,"labelAngle",t);n=e.isEdge()?o:0}else n="none"===a.strValue?0:a.pfValue;return n},ul.drawText=function(e,t,n){var r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s=eU(a,"labelX",n),l=eU(a,"labelY",n),u=this.getLabelText(t,n);if(null!=u&&""!==u&&!isNaN(s)&&!isNaN(l)){this.setupTextStyle(e,t,i);var c,h,d,f=n?n+"-":"",p=eU(a,"labelWidth",n),g=eU(a,"labelHeight",n),v=t.pstyle(f+"text-margin-x").pfValue,y=t.pstyle(f+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),s+=v,l+=y,0!==(d=r?this.getTextAngle(t,n):0)&&(c=s,h=l,e.translate(c,h),e.rotate(d),s=0,l=0),w){case"top":break;case"center":l+=g/2;break;case"bottom":l+=g}var E=t.pstyle("text-background-opacity").value,T=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue,P=0===t.pstyle("text-background-shape").strValue.indexOf("round");if(E>0||k>0&&T>0){var S=s-C;switch(x){case"left":S-=p;break;case"center":S-=p/2}var D=l-g-C,B=p+2*C,A=g+2*C;if(E>0){var _=e.fillStyle,M=t.pstyle("text-background-color").value;e.fillStyle="rgba("+M[0]+","+M[1]+","+M[2]+","+E*o+")",P?uu(e,S,D,B,A,2):e.fillRect(S,D,B,A),e.fillStyle=_}if(k>0&&T>0){var R=e.strokeStyle,I=e.lineWidth,N=t.pstyle("text-border-color").value,L=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+N[0]+","+N[1]+","+N[2]+","+T*o+")",e.lineWidth=k,e.setLineDash)switch(L){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(P?uu(e,S,D,B,A,2,"stroke"):e.strokeRect(S,D,B,A),"double"===L){var O=k/2;P?uu(e,S+O,D+O,B-2*O,A-2*O,2,"stroke"):e.strokeRect(S+O,D+O,B-2*O,A-2*O)}e.setLineDash&&e.setLineDash([]),e.lineWidth=I,e.strokeStyle=R}}var z=2*t.pstyle("text-outline-width").pfValue;if(z>0&&(e.lineWidth=z),"wrap"===t.pstyle("text-wrap").value){var F=eU(a,"labelWrapCachedLines",n),V=eU(a,"labelLineHeight",n),X=p/2,j=this.getLabelJustification(t);switch("auto"===j||("left"===x?"left"===j?s+=-p:"center"===j&&(s+=-X):"center"===x?"left"===j?s+=-X:"right"===j&&(s+=X):"right"===x&&("center"===j?s+=X:"right"===j&&(s+=p))),w){case"top":case"center":case"bottom":l-=(F.length-1)*V}for(var Y=0;Y<F.length;Y++)z>0&&e.strokeText(F[Y],s,l),e.fillText(F[Y],s,l),l+=V}else z>0&&e.strokeText(u,s,l),e.fillText(u,s,l);0!==d&&(e.rotate(-d),e.translate(-c,-h))}}};var uc={};uc.drawNode=function(e,t,n){var r,i,a,o,s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],l=!(arguments.length>4)||void 0===arguments[4]||arguments[4],u=!(arguments.length>5)||void 0===arguments[5]||arguments[5],c=this,h=t._private,d=h.rscratch,f=t.position();if(M(f.x)&&M(f.y)&&(!u||t.visible())){var p=u?t.effectiveOpacity():1,g=c.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(o=n,e.translate(-o.x1,-o.y1));for(var b=t.pstyle("background-image").value,x=Array(b.length),w=Array(b.length),E=0,T=0;T<b.length;T++){var k=b[T];if(x[T]=null!=k&&"none"!==k){var C=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",T);E++,w[T]=c.getCachedImage(k,C,function(){h.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var P=t.pstyle("background-blacken").value,S=t.pstyle("border-width").pfValue,D=t.pstyle("background-opacity").value*p,B=t.pstyle("border-color").value,A=t.pstyle("border-style").value,_=t.pstyle("border-join").value,R=t.pstyle("border-cap").value,I=t.pstyle("border-position").value,N=t.pstyle("border-dash-pattern").pfValue,L=t.pstyle("border-dash-offset").pfValue,O=t.pstyle("border-opacity").value*p,z=t.pstyle("outline-width").pfValue,F=t.pstyle("outline-color").value,V=t.pstyle("outline-style").value,X=t.pstyle("outline-opacity").value*p,j=t.pstyle("outline-offset").value,Y=t.pstyle("corner-radius").value;"auto"!==Y&&(Y=t.pstyle("corner-radius").pfValue);var q=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D;c.eleFillStyle(e,t,n)},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O;c.colorStrokeStyle(e,B[0],B[1],B[2],t)},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;c.colorStrokeStyle(e,F[0],F[1],F[2],t)},H=function(e,t,n,r){var i,a=c.nodePathCache=c.nodePathCache||[],o=eC("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+Y),s=a[o],l=!1;return null!=s?(i=s,l=!0,d.pathCache=i):(i=new Path2D,a[o]=d.pathCache=i),{path:i,cacheHit:l}},G=t.pstyle("shape").strValue,K=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(f.x,f.y);var Z=H(r,i,G,K);a=Z.path,v=Z.cacheHit}var $=function(){if(!v){var n=f;g&&(n={x:0,y:0}),c.nodeShapes[c.getNodeShape(t)].draw(a||e,n.x,n.y,r,i,Y,d)}g?e.fill(a):e.fill()},Q=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=h.backgrounding,a=0,o=0;o<w.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);if(r&&"over"===s||!r&&"inside"===s){a++;continue}x[o]&&w[o].complete&&!w[o].error&&(a++,c.drawInscribedImage(e,w[o],t,o,n))}h.backgrounding=a!==E,i!==h.backgrounding&&t.updateStyle(!1)},J=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;c.hasPie(t)&&(c.drawPie(e,t,a),n&&!g&&c.nodeShapes[c.getNodeShape(t)].draw(e,f.x,f.y,r,i,Y,d))},ee=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,n=P>0?0:255;0!==P&&(c.colorFillStyle(e,n,n,n,(P>0?P:-P)*t),g?e.fill(a):e.fill())},et=function(){if(S>0){if(e.lineWidth=S,e.lineCap=R,e.lineJoin=_,e.setLineDash)switch(A){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(N),e.lineDashOffset=L;break;case"solid":case"double":e.setLineDash([])}if("center"!==I){if(e.save(),e.lineWidth*=2,"inside"===I)g?e.clip(a):e.clip();else{var t=new Path2D;t.rect(-r/2-S,-i/2-S,r+2*S,i+2*S),t.addPath(a),e.clip(t,"evenodd")}g?e.stroke(a):e.stroke(),e.restore()}else g?e.stroke(a):e.stroke();if("double"===A){e.lineWidth=S/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(a):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},en=function(){if(z>0){if(e.lineWidth=z,e.lineCap="butt",e.setLineDash)switch(V){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=f;g&&(n={x:0,y:0});var a=c.getNodeShape(t),o=S;"inside"===I&&(o=0),"outside"===I&&(o*=2);var s=(r+o+(z+j))/r,l=(i+o+(z+j))/i,u=r*s,h=i*l,d=c.nodeShapes[a].points;if(g&&(C=H(u,h,a,d).path),"ellipse"===a)c.drawEllipsePath(C||e,n.x,n.y,u,h);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var p=0,v=0,y=0;"round-diamond"===a?p=(o+j+z)*1.4:"round-heptagon"===a?(p=(o+j+z)*1.075,y=-(o/2+j+z)/35):"round-hexagon"===a?p=(o+j+z)*1.12:"round-pentagon"===a?(p=(o+j+z)*1.13,y=-(o/2+j+z)/15):"round-tag"===a?(p=(o+j+z)*1.12,v=(o/2+z+j)*.07):"round-triangle"===a&&(p=Math.PI/2*(o+j+z),y=-(o+j/2+z)/Math.PI),0===p||(s=(r+p)/r,u=r*s,["round-hexagon","round-tag"].includes(a)||(l=(i+p)/i,h=i*l)),Y="auto"===Y?tQ(u,h):Y;for(var b=u/2,x=h/2,w=Y+(o+z+j)/2,E=Array(d.length/2),T=Array(d.length/2),k=0;k<d.length/2;k++)E[k]={x:n.x+v+b*d[2*k],y:n.y+y+x*d[2*k+1]};var C,P,D,B,A,_=E.length;for(P=0,D=E[_-1];P<_;P++)B=E[P%_],A=E[(P+1)%_],T[P]=lC(D,B,A,w),D=B,B=A;c.drawRoundPolygonPath(C||e,n.x+v,n.y+y,r*s,i*l,d,T)}else["roundrectangle","round-rectangle"].includes(a)?(Y="auto"===Y?t$(u,h):Y,c.drawRoundRectanglePath(C||e,n.x,n.y,u,h,Y+(o+z+j)/2)):["cutrectangle","cut-rectangle"].includes(a)?(Y="auto"===Y?tJ():Y,c.drawCutRectanglePath(C||e,n.x,n.y,u,h,null,Y+(o+z+j)/4)):["bottomroundrectangle","bottom-round-rectangle"].includes(a)?(Y="auto"===Y?t$(u,h):Y,c.drawBottomRoundRectanglePath(C||e,n.x,n.y,u,h,Y+(o+z+j)/2)):"barrel"===a?c.drawBarrelPath(C||e,n.x,n.y,u,h):(d=a.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(a)?tz(tF(d,(o+z+j)/r)):tz(tF(d,-((o+z+j)/r))),c.drawPolygonPath(C||e,n.x,n.y,r,i,d));if(g?e.stroke(C):e.stroke(),"double"===V){e.lineWidth=o/3;var M=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(C):e.stroke(),e.globalCompositeOperation=M}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var er=t.pstyle("ghost-offset-x").pfValue,ei=t.pstyle("ghost-offset-y").pfValue,ea=t.pstyle("ghost-opacity").value,eo=ea*p;e.translate(er,ei),U(),en(),q(ea*D),$(),Q(eo,!0),W(ea*O),et(),J(0!==P||0!==S),Q(eo,!1),ee(eo),e.translate(-er,-ei)}g&&e.translate(-f.x,-f.y),l&&c.drawNodeUnderlay(e,t,f,r,i),g&&e.translate(f.x,f.y),U(),en(),q(),$(),Q(p,!0),W(),et(),J(0!==P||0!==S),Q(p,!1),ee(),g&&e.translate(-f.x,-f.y),c.drawElementText(e,t,null,s),l&&c.drawNodeOverlay(e,t,f,r,i),n&&e.translate(o.x1,o.y1)}};var uh=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n,r,i,a){if(n.visible()){var o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,l=n.pstyle("".concat(e,"-color")).value,u=n.pstyle("".concat(e,"-shape")).value,c=n.pstyle("".concat(e,"-corner-radius")).value;if(s>0){if(r=r||n.position(),null==i||null==a){var h=n.padding();i=n.width()+2*h,a=n.height()+2*h}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,c),t.fill()}}}};uc.drawNodeOverlay=uh("overlay"),uc.drawNodeUnderlay=uh("underlay"),uc.hasPie=function(e){return(e=e[0])._private.hasPie},uc.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=Math.min(t.width(),t.height())/2,u=0;this.usePaths()&&(o=0,s=0),"%"===a.units?l*=a.pfValue:void 0!==a.pfValue&&(l=a.pfValue/2);for(var c=1;c<=i.pieBackgroundN;c++){var h=t.pstyle("pie-"+c+"-background-size").value,d=t.pstyle("pie-"+c+"-background-color").value,f=t.pstyle("pie-"+c+"-background-opacity").value*n,p=h/100;p+u>1&&(p=1-u);var g=1.5*Math.PI+2*Math.PI*u,v=g+2*Math.PI*p;0===h||u>=1||u+p>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,l,g,v),e.closePath(),this.colorFillStyle(e,d[0],d[1],d[2],f),e.fill(),u+=p)}};var ud={};function uf(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw Error(e.getShaderInfoLog(r));return r}function up(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function ug(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function uv(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=n||[,,,,];return o[0]=r*t,o[1]=i*t,o[2]=a*t,o[3]=t,o}function uy(e,t){var n=t||[,,,,];return n[0]=(e>>0&255)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function um(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function ub(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function ux(e,t,n,r){var i=l(um(e,n),3),a=i[0],o=i[1],s=i[2],u=ub(e,o,t*a),c=a*s,h=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,h),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,c,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,c,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=Array(t),f=0;f<t;f++)d[f]=function(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}(e,o,u,c,a,f);return h.dataArray=u,h.stride=c,h.size=a,h.getView=function(e){return d[e]},h.setPoint=function(e,t,n){var r=d[e];r[0]=t,r[1]=n},h.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,h),t?e.bufferSubData(e.ARRAY_BUFFER,0,u,0,t*a):e.bufferSubData(e.ARRAY_BUFFER,0,u)},h}ud.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},ud.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if((t=n[i]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},ud.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r){if(n.isEdge()){var u=n.sourceEndpoint(),c=n.targetEndpoint(),h=n.midpoint(),d=th(u,h),f=th(c,h);a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(d,f))}else{var p=o?{x:0,y:0}:n.position(),g=n.paddedWidth(),v=n.paddedHeight();a=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(g,v))}}else if(n.isEdge()){var y=n.sourceEndpoint(),b=n.targetEndpoint();a=e.createLinearGradient(y.x,y.y,b.x,b.y)}else{var x=o?{x:0,y:0}:n.position(),w=n.paddedWidth(),E=n.paddedHeight(),T=w/2,k=E/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(x.x,x.y-k,x.x,x.y+k);break;case"to-top":a=e.createLinearGradient(x.x,x.y+k,x.x,x.y-k);break;case"to-left":a=e.createLinearGradient(x.x+T,x.y,x.x-T,x.y);break;case"to-right":a=e.createLinearGradient(x.x-T,x.y,x.x+T,x.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(x.x-T,x.y-k,x.x+T,x.y+k);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(x.x-T,x.y+k,x.x+T,x.y-k);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(x.x+T,x.y-k,x.x-T,x.y+k);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(x.x+T,x.y+k,x.x-T,x.y-k)}}if(!a)return null;for(var C=l.length===s.length,P=s.length,S=0;S<P;S++)a.addColorStop(C?l[S]:S/(P-1),"rgba("+s[S][0]+","+s[S][1]+","+s[S][2]+","+i+")");return a},ud.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},ud.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},ud.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},ud.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},ud.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},ud.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},ud.matchCanvasSize=function(e){var t,n=this.data,r=this.findContainerClientCoords(),i=r[2],a=r[3],o=this.getPixelRatio(),s=this.motionBlurPxRatio;(e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_NODE]||e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var l=i*o,u=a*o;if(l!==this.canvasWidth||u!==this.canvasHeight){this.fontCaches=null;var c=n.canvasContainer;c.style.width=i+"px",c.style.height=a+"px";for(var h=0;h<this.CANVAS_LAYERS;h++)(t=n.canvases[h]).width=l,t.height=u,t.style.width=i+"px",t.style.height=a+"px";for(var h=0;h<this.BUFFER_COUNT;h++)(t=n.bufferCanvases[h]).width=l,t.height=u,t.style.width=i+"px",t.style.height=a+"px";this.textureMult=1,o<=1&&(t=n.bufferCanvases[this.TEXTURE_BUFFER],this.textureMult=2,t.width=l*this.textureMult,t.height=u*this.textureMult),this.canvasWidth=l,this.canvasHeight=u,this.pixelRatio=o}},ud.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},ud.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},ud.render=function(e){var t=this;e=e||eX();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,l=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,u=t.data,c=u.canvasNeedsRedraw,h=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),d=void 0!==e.motionBlur?e.motionBlur:t.motionBlur,f=t.motionBlurPxRatio,p=n.hasCompoundNodes(),g=t.hoverData.draggingEles,v=!!t.hoverData.selecting||!!t.touchData.selecting,y=d=d&&!r&&t.motionBlurEnabled&&!v;r||(t.prevPxRatio!==l&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=l),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),d&&(null==t.mbFrames&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(y=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!h&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var b=n.style(),x=n.zoom(),w=void 0!==o?o:x,E=n.pan(),T={x:E.x,y:E.y},k={zoom:x,pan:{x:E.x,y:E.y}},C=t.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!p||(t.motionBlurPxRatio=1),s&&(T=s),w*=l,T.x*=l,T.y*=l;var P=t.getCachedZSortedEles();function S(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function D(e,n){var a,l,c,h;t.clearingMotionBlur||e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(a=T,l=w,c=t.canvasWidth,h=t.canvasHeight):(a={x:E.x*f,y:E.y*f},l=x*f,c=t.canvasWidth*f,h=t.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?S(e,0,0,c,h):!r&&(void 0===n||n)&&e.clearRect(0,0,c,h),i||(e.translate(a.x,a.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(h||(t.textureDrawLastFrame=!1),h){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var B=t.data.bufferContexts[t.TEXTURE_BUFFER];B.setTransform(1,0,0,1,0,0),B.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:B,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult});var k=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};k.mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var A=u.contexts[t.NODE],_=t.textureCache.texture,k=t.textureCache.viewport;A.setTransform(1,0,0,1,0,0),d?S(A,0,0,k.width,k.height):A.clearRect(0,0,k.width,k.height);var M=b.core("outside-texture-bg-color").value,R=b.core("outside-texture-bg-opacity").value;t.colorFillStyle(A,M[0],M[1],M[2],R),A.fillRect(0,0,k.width,k.height);var x=n.zoom();D(A,!1),A.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l),A.drawImage(_,k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var I=n.extent(),N=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),L=t.hideEdgesOnViewport&&N,O=[];if(O[t.NODE]=!c[t.NODE]&&d&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,O[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),O[t.DRAG]=!c[t.DRAG]&&d&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,O[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||i||a||O[t.NODE]){var z=d&&!O[t.NODE]&&1!==f,A=r||(z?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]);D(A,d&&!z?"motionBlur":void 0),L?t.drawCachedNodes(A,P.nondrag,l,I):t.drawLayeredElements(A,P.nondrag,l,I),t.debug&&t.drawDebugPoints(A,P.nondrag),i||d||(c[t.NODE]=!1)}if(!a&&(c[t.DRAG]||i||O[t.DRAG])){var z=d&&!O[t.DRAG]&&1!==f,A=r||(z?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]);D(A,d&&!z?"motionBlur":void 0),L?t.drawCachedNodes(A,P.drag,l,I):t.drawCachedElements(A,P.drag,l,I),t.debug&&t.drawDebugPoints(A,P.drag),i||d||(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,D),d&&1!==f){var F=u.contexts[t.NODE],V=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],X=u.contexts[t.DRAG],j=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],Y=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):S(e,0,0,t.canvasWidth,t.canvasHeight),e.drawImage(n,0,0,t.canvasWidth*f,t.canvasHeight*f,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||O[t.NODE])&&(Y(F,V,O[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||O[t.DRAG])&&(Y(X,j,O[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=k,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),d&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!h,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},100)),r||n.emit("render")},ud.drawSelectionRectangle=function(e,t){var n=this.cy,r=this.data,i=n.style(),a=e.drawOnlyNodeLayer,o=e.drawAllLayers,s=r.canvasNeedsRedraw,l=e.forcedContext;if(this.showFps||!a&&s[this.SELECT_BOX]&&!o){var u=l||r.contexts[this.SELECT_BOX];if(t(u),1==this.selection[4]&&(this.hoverData.selecting||this.touchData.selecting)){var c=this.cy.zoom(),h=i.core("selection-box-border-width").value/c;u.lineWidth=h,u.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+")",u.fillRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]),h>0&&(u.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+")",u.strokeRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]))}if(r.bgActivePosistion&&!this.hoverData.selecting){var c=this.cy.zoom(),d=r.bgActivePosistion;u.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+")",u.beginPath(),u.arc(d.x,d.y,i.core("active-bg-size").pfValue/c,0,2*Math.PI),u.fill()}var f=this.lastRedrawTime;if(this.showFps&&f){var p=Math.round(1e3/(f=Math.round(f))),g="1 frame = "+f+" ms = "+p+" fps";u.setTransform(1,0,0,1,0,0),u.fillStyle="rgba(255, 0, 0, 0.75)",u.strokeStyle="rgba(255, 0, 0, 0.75)",u.font="30px Arial",x||(x=u.measureText(g).actualBoundingBoxAscent),u.fillText(g,0,x),u.strokeRect(0,x+10,250,20),u.fillRect(0,x+10,250*Math.min(p/60,1),20)}o||(s[this.SELECT_BOX]=!1)}};var uw="undefined"!=typeof Float32Array?Float32Array:Array;function uE(){var e=new uw(9);return uw!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function uT(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function uk(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=n[0],f=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=d*r+f*o+u,e[7]=d*i+f*s+c,e[8]=d*a+f*l+h,e}function uC(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=Math.sin(n),f=Math.cos(n);return e[0]=f*r+d*o,e[1]=f*i+d*s,e[2]=f*a+d*l,e[3]=f*o-d*r,e[4]=f*s-d*i,e[5]=f*l-d*a,e[6]=u,e[7]=c,e[8]=h,e}function uP(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var uS={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},uD=ej({texRows:24}),uB=ej({collection:"default",getKey:null,drawElement:null,getBoundingBox:null,getRotation:null,getRotationPoint:null,getRotationOffset:null,isVisible:function(){return!0},getPadding:0}),uA=a(function e(t,n,r,a){i(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(t,n,n),this.scratch=a(t,n,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r,i,a,o,s,l,u,c=this;if(this.locked)throw Error("can't draw, atlas is locked");var h=this.texSize,d=this.texRows,f=this.texHeight,p=this.getScale(t),g=p.scale,v=p.texW,y=p.texH,b=[null,null],x=function(e,r){if(n&&r){var i=r.context,a=e.x,o=f*e.row;i.save(),i.translate(a,o),i.scale(g,g),n(i,t),i.restore()}},w=function(){x(c.freePointer,c.canvas),b[0]={x:c.freePointer.x,y:c.freePointer.row*f,w:v,h:y},b[1]={x:c.freePointer.x+v,y:c.freePointer.row*f,w:0,h:y},c.freePointer.x+=v,c.freePointer.x==h&&(c.freePointer.x=0,c.freePointer.row++)},E=function(){c.freePointer.x=0,c.freePointer.row++};if(this.freePointer.x+v<=h)w();else{if(this.freePointer.row>=d-1)return!1;this.freePointer.x===h?(E(),w()):this.enableWrapping?(r=c.scratch,i=c.canvas,r.clear(),x({x:0,row:0},r),o=v-(a=h-c.freePointer.x),s=c.freePointer.x,l=c.freePointer.row*f,i.context.drawImage(r,0,0,a,f,s,l,a,f),b[0]={x:s,y:l,w:a,h:y},u=(c.freePointer.row+1)*f,i&&i.context.drawImage(r,a,0,o,f,0,u,o,f),b[1]={x:0,y:u,w:o,h:y},c.freePointer.x=o,c.freePointer.row++):(E(),w())}return this.keyToLocation.set(e,b),this.needsBuffer=!0,b}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row<n-1}},{key:"bufferIfNeeded",value:function(e){if(!this.texture){var t;this.texture=(this.debugID,(t=e.createTexture()).buffer=function(n){e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},t.deleteTexture=function(){e.deleteTexture(t)},t)}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}}]),u_=a(function e(t,n,r,a){i(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set},[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){return new uA(this.r,this.texSize,this.texRows,this.createTextureCanvas)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas;this.scratch=r(e,t,Math.floor(t/n),"scratch")}return this.scratch}},{key:"draw",value:function(e,t,n){var r=this.styleKeyToAtlas.get(e);return r||((r=this.atlases[this.atlases.length-1])&&r.canFit(t)||(r&&r.lock(),r=this._createAtlas(),this.atlases.push(r)),r.draw(e,t,n),this.styleKeyToAtlas.set(e,r)),r}},{key:"getAtlas",value:function(e){return this.styleKeyToAtlas.get(e)}},{key:"hasAtlas",value:function(e){return this.styleKeyToAtlas.has(e)}},{key:"markKeyForGC",value:function(e){this.markedKeys.add(e)}},{key:"gc",value:function(){var e=this,t=this.markedKeys;if(0===t.size){console.log("nothing to garbage collect");return}var n,r=[],i=new Map,a=null,s=o(this.atlases);try{for(s.s();!(n=s.n()).done;)if(function(){var s=n.value,c=s.getKeys(),h=function(e,t){return e.intersection?e.intersection(t):new Set(u(e).filter(function(e){return t.has(e)}))}(t,c);if(0===h.size)return r.push(s),c.forEach(function(e){return i.set(e,s)}),1;a||(a=e._createAtlas(),r.push(a));var d,f=o(c);try{for(f.s();!(d=f.n()).done;){var p=d.value;if(!h.has(p)){var g=s.getOffsets(p),v=l(g,2),y=v[0],b=v[1];a.canFit({w:y.w+b.w,h:y.h})||(a.lock(),a=e._createAtlas(),r.push(a)),e._copyTextureToNewAtlas(p,s,a),i.set(p,a)}}}catch(e){f.e(e)}finally{f.f()}s.dispose()}())continue}catch(e){s.e(e)}finally{s.f()}this.atlases=r,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(e,t,n){var r=l(t.getOffsets(e),2),i=r[0],a=r[1];if(0===a.w)n.draw(e,i,function(e){e.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,i.w,0,a.w,a.h);var s=i.w+a.w,u=i.h;n.draw(e,{w:s,h:u},function(e){e.drawImage(o,0,0,s,u,0,0,s,u)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}]),uM=a(function e(t,n){i(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map,this.batchAtlases=[]},[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"addAtlasCollection",value:function(e,t){var n=this.globalOptions,r=n.webglTexSize,i=n.createTextureCanvas,a=t.texRows,o=this._cacheScratchCanvas(i),s=new u_(this.r,r,a,o);this.collections.set(e,s)}},{key:"addRenderType",value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw Error("invalid atlas collection name '".concat(n,"'"));var r=Q({type:e,atlasCollection:this.collections.get(n)},t);this.renderTypes.set(e,r)}},{key:"getRenderTypeOpts",value:function(e){return this.renderTypes.get(e)}},{key:"getAtlasCollection",value:function(e){return this.collections.get(e)}},{key:"_cacheScratchCanvas",value:function(e){var t=-1,n=-1,r=null;return function(i,a,o,s){return s?(r&&a==t&&o==n||(t=a,n=o,r=e(i,a,o)),r):e(i,a,o)}}},{key:"_key",value:function(e,t){return"".concat(e,"-").concat(t)}},{key:"invalidate",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.forceRedraw,i=void 0!==r&&r,a=n.filterEle,s=void 0===a?function(){return!0}:a,l=n.filterType,u=void 0===l?function(){return!0}:l,c=!1,h=!1,d=o(e);try{for(d.s();!(t=d.n()).done;){var f=t.value;if(s(f)){var p,g=o(this.renderTypes.values());try{for(g.s();!(p=g.n()).done;){var v=p.value,y=v.type;if(u(y)){var b=v.getKey(f),x=this.collections.get(v.collection);if(i)x.markKeyForGC(b),h=!0;else{var w=v.getID?v.getID(f):f.id(),E=this._key(y,w),T=this.typeAndIdToKey.get(E);void 0!==T&&T!==b&&(this.typeAndIdToKey.delete(E),x.markKeyForGC(T),c=!0)}}}}catch(e){g.e(e)}finally{g.f()}}}}catch(e){d.e(e)}finally{d.f()}return h&&(this.gc(),c=!1),c}},{key:"gc",value:function(){var e,t=o(this.collections.values());try{for(t.s();!(e=t.n()).done;)e.value.gc()}catch(e){t.e(e)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n){var r=this.renderTypes.get(t),i=r.getKey(e);n||(n=r.getBoundingBox(e));var a=this.collections.get(r.collection),o=!1,s=a.draw(i,n,function(t){r.drawElement(t,e,n,!0,!0),o=!0});if(o){var l=r.getID?r.getID(e):e.id(),u=this._key(t,l);this.typeAndIdToKey.set(u,i)}return s}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(e,t){if(this.batchAtlases.length===this.maxAtlasesPerBatch){var n=this.renderTypes.get(t),r=n.getKey(e),i=this.collections.get(n.collection).getAtlas(r);return!!i&&this.batchAtlases.includes(i)}return!0}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)return;this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(e,t){return t})}},{key:"getAtlasInfo",value:function(e,t){var n=this.renderTypes.get(t),r=n.getBoundingBox(e),i=this.getOrCreateAtlas(e,t,r),a=this.getAtlasIndexForBatch(i);if(void 0!==a){var o=n.getKey(e),s=l(i.getOffsets(o),2);return{index:a,tex1:s[0],tex2:s[1],bb:r}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=this.getRenderTypeOpts(n),o=a.getPadding?a.getPadding(e):0;if(r){var s=r.bb,l=r.tex1,u=r.tex2,c=l.w/(l.w+u.w);i||(c=1-c);var h=this.getAdjustedBB(s,o,i,c);this._applyTransformMatrix(t,h,a,e)}else{var d=a.getBoundingBox(e),f=this.getAdjustedBB(d,o,!0,1);this._applyTransformMatrix(t,f,a,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){uT(e);var i,a,o=n.getRotation?n.getRotation(r):0;if(0!==o){var s=n.getRotationPoint(r);uk(e,e,[s.x,s.y]),uC(e,e,o);var l=n.getRotationOffset(r);i=l.x+t.xOffset,a=l.y}else i=t.x1,a=t.y1;uk(e,e,[i,a]),uP(e,e,[t.w,t.h])}},{key:"getAdjustedBB",value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(i+=l=o-u,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l}}},{key:"getDebugInfo",value:function(){var e,t=[],n=o(this.collections);try{for(n.s();!(e=n.n()).done;){var r=l(e.value,2),i=r[0],a=r[1].getCounts(),s=a.keyCount,u=a.atlasCount;t.push({type:i,keyCount:s,atlasCount:u})}}catch(e){n.e(e)}finally{n.f()}return t}}]),uR=a(function e(t,n,r){i(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=up,this.atlasManager=new uM(t,r),this.program=this.createShaderProgram(uS.SCREEN),this.pickingProgram=this.createShaderProgram(uS.PICKING),this.vao=this.createVAO()},[{key:"addAtlasCollection",value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:"addAtlasRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"invalidate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.type,r=this.atlasManager;return n?r.invalidate(e,{filterType:function(e){return e===n},forceRedraw:!0}):r.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; \n\n in mat3 aTransform;\n\n // what are we rendering?\n in int aVertType;\n\n // for picking\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in float aLineWidth;\n in vec4 aColor;\n\n out vec2 vTexCoord;\n out vec4 vColor;\n flat out int vAtlasId;\n flat out vec4 vIndex;\n flat out int vVertType;\n\n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition;\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x;\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n int vid = gl_VertexID;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4,") {\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\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 vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(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 = pointA;\n vec2 p1 = pointB;\n vec2 p2 = pointC;\n vec2 pos = position;\n if(position.x == 1.0) {\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth;\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(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 vIndex = aIndex;\n vVertType = aVertType;\n }\n "),r=this.atlasManager.getIndexArray(),i=function(e,t,n){var r=uf(e,e.VERTEX_SHADER,t),i=uf(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw Error("Could not initialize shaders");return a}(t,n,"#version 300 es\n precision highp float;\n\n // define texture unit for each node in the batch\n ".concat(r.map(function(e){return"uniform sampler2D uTexture".concat(e,";")}).join("\n "),"\n\n uniform vec4 uBGColor;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n\n out vec4 outColor;\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n ").concat(r.map(function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")}).join("\n else "),"\n } else if(vVertType == ").concat(3,") {\n // blend arrow color with background (using premultiplied alpha)\n outColor.rgb = vColor.rgb + (uBGColor.rgb * (1.0 - vColor.a)); \n outColor.a = 1.0; // make opaque, masks out line under arrow\n } else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "));i.aPosition=t.getAttribLocation(i,"aPosition"),i.aIndex=t.getAttribLocation(i,"aIndex"),i.aVertType=t.getAttribLocation(i,"aVertType"),i.aTransform=t.getAttribLocation(i,"aTransform"),i.aAtlasId=t.getAttribLocation(i,"aAtlasId"),i.aTex=t.getAttribLocation(i,"aTex"),i.aPointAPointB=t.getAttribLocation(i,"aPointAPointB"),i.aPointCPointD=t.getAttribLocation(i,"aPointCPointD"),i.aLineWidth=t.getAttribLocation(i,"aLineWidth"),i.aColor=t.getAttribLocation(i,"aColor"),i.uPanZoomMatrix=t.getUniformLocation(i,"uPanZoomMatrix"),i.uAtlasSize=t.getUniformLocation(i,"uAtlasSize"),i.uBGColor=t.getUniformLocation(i,"uBGColor"),i.uTextures=[];for(var a=0;a<this.atlasManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,"uTexture".concat(a)));return i}},{key:"createVAO",value:function(){var e,t,n,r,i,a,o,s=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=s.length/2;var u=this.maxInstances,c=this.gl,h=this.program,d=c.createVertexArray();return c.bindVertexArray(d),e="vec2",t=h.aPosition,r=(n=l(um(c,e),2))[0],a=ub(c,i=n[1],s),o=c.createBuffer(),c.bindBuffer(c.ARRAY_BUFFER,o),c.bufferData(c.ARRAY_BUFFER,a,c.STATIC_DRAW),i===c.FLOAT?c.vertexAttribPointer(t,r,i,!1,0,0):i===c.INT&&c.vertexAttribIPointer(t,r,i,0,0),c.enableVertexAttribArray(t),c.bindBuffer(c.ARRAY_BUFFER,null),this.transformBuffer=function(e,t,n){for(var r=new Float32Array(9*t),i=Array(t),a=0;a<t;a++){var o=36*a;i[a]=new Float32Array(r.buffer,o,9)}var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,r.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var u=n+l;e.enableVertexAttribArray(u),e.vertexAttribPointer(u,3,e.FLOAT,!1,36,12*l),e.vertexAttribDivisor(u,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),s.getMatrixView=function(e){return i[e]},s.setData=function(e,t){i[t].set(e,0)},s.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferSubData(e.ARRAY_BUFFER,0,r)},s}(c,u,h.aTransform),this.indexBuffer=ux(c,u,"vec4",h.aIndex),this.vertTypeBuffer=ux(c,u,"int",h.aVertType),this.atlasIdBuffer=ux(c,u,"int",h.aAtlasId),this.texBuffer=ux(c,u,"vec4",h.aTex),this.pointAPointBBuffer=ux(c,u,"vec4",h.aPointAPointB),this.pointCPointDBuffer=ux(c,u,"vec4",h.aPointCPointD),this.lineWidthBuffer=ux(c,u,"float",h.aLineWidth),this.colorBuffer=ux(c,u,"vec4",h.aColor),c.bindVertexArray(null),d}},{key:"buffers",get:function(){var e=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(e){return e.endsWith("Buffer")}).map(function(t){return e[t]})),this._buffers}},{key:"startFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:uS.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.rectangleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.atlasManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"getTempMatrix",value:function(){return this.tempMatrix=this.tempMatrix||uE()}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager;if(e.visible()&&r.getRenderTypeOpts(n).isVisible(e)){r.canAddToCurrentBatch(e,n)||this.endBatch(),this.instanceCount+1>=this.maxInstances&&this.endBatch();var i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=0,uy(t,this.indexBuffer.getView(i));var a=r.getAtlasInfo(e,n),o=a.index,s=a.tex1,l=a.tex2;l.w>0&&this.wrappedCount++;for(var u=!0,c=0,h=[s,l];c<h.length;c++){var d=h[c];if(0!=d.w){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=0,uy(t,this.indexBuffer.getView(f)),this.atlasIdBuffer.getView(f)[0]=o;var p=this.texBuffer.getView(f);p[0]=d.x,p[1]=d.y,p[2]=d.w,p[3]=d.h;var g=this.transformBuffer.getMatrixView(f);r.setTransformMatrix(e,g,n,a,u),this.instanceCount++}u=!1}this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"drawSimpleRectangle",value:function(e,t,n){if(e.visible()){var r=this.atlasManager,i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=4,uy(t,this.indexBuffer.getView(i)),uv(e.pstyle("background-color").value,e.pstyle("background-opacity").value,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);r.setTransformMatrix(e,a,n),this.rectangleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,i,a,o=e._private.rscratch;if("source"===n?(r=o.arrowStartX,i=o.arrowStartY,a=o.srcArrowAngle):(r=o.arrowEndX,i=o.arrowEndY,a=o.tgtArrowAngle),!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a))&&null!=a&&"none"!==e.pstyle(n+"-arrow-shape").value){var s=e.pstyle(n+"-arrow-color").value,l=e.pstyle("opacity").value,u=e.pstyle("line-opacity").value,c=e.pstyle("width").pfValue,h=e.pstyle("arrow-scale").value,d=this.r.getArrowWidth(c,h),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);uT(p),uk(p,p,[r,i]),uP(p,p,[d,d]),uC(p,p,a),this.vertTypeBuffer.getView(f)[0]=3,uy(t,this.indexBuffer.getView(f)),uv(s,l*u,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this.getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,i=e.pstyle("line-opacity").value,a=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=1,uy(t,this.indexBuffer.getView(l)),uv(o,s,this.colorBuffer.getView(l)),this.lineWidthBuffer.getView(l)[0]=a;var u=this.pointAPointBBuffer.getView(l);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var c=0;c<n.length-2;c+=2){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=2,uy(t,this.indexBuffer.getView(h)),uv(o,s,this.colorBuffer.getView(h)),this.lineWidthBuffer.getView(h)[0]=a;var d=n[c-2],f=n[c-1],p=n[c],g=n[c+1],v=n[c+2],y=n[c+3],b=n[c+4],x=n[c+5];0==c&&(d=2*p-v+.001,f=2*g-y+.001),c==n.length-4&&(b=2*v-p+.001,x=2*y-g+.001);var w=this.pointAPointBBuffer.getView(h);w[0]=d,w[1]=f,w[2]=p,w[3]=g;var E=this.pointCPointDBuffer.getView(h);E[0]=v,E[1]=y,E[2]=b,E[3]=x,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"getEdgePoints",value:function(e){var t=e._private.rscratch;if(!(t.badLine||null==t.allpts||isNaN(t.allpts[0]))){var n=t.allpts;if(4==n.length)return n;var r=this.getNumSegments(e);return this.getCurveSegmentPoints(n,r)}}},{key:"getNumSegments",value:function(e){return Math.min(15,this.maxInstances)}},{key:"getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var i=r/t;this.setCurvePoint(e,i,n,2*r)}return n}},{key:"setCurvePoint",value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this.setCurvePoint(i,t,n,r)}}},{key:"endBatch",value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(0!==r){var i=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(i),e.bindVertexArray(t);var a,s=o(this.buffers);try{for(s.s();!(a=s.n()).done;)a.value.bufferSubData(r)}catch(e){s.e(e)}finally{s.f()}for(var l=this.atlasManager.getAtlases(),u=0;u<l.length;u++)l[u].bufferIfNeeded(e);for(var c=0;c<l.length;c++)e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,l[c].texture),e.uniform1i(i.uTextures[c],c);e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.atlasManager.getAtlasSize());var h=uv(this.bgColor,1);e.uniform4fv(i.uBGColor,h),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:l.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,rectangleCount:this.rectangleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}]);function uI(e,t){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(t,")")}var uN=a(function e(t){i(this,e),this.r=t},[{key:"getStyleKey",value:function(e,t){var n=this.getStyle(e,t),r=n.shape,i=n.opacity,a=n.color;if(!r)return null;var o=t.width(),s=t.height(),l=uI(a,i);return ek("".concat(r,"-").concat(o,"-").concat(s,"-").concat(l))}},{key:"isVisible",value:function(e,t){return t.pstyle("".concat(e,"-opacity")).value>0}},{key:"getStyle",value:function(e,t){return{opacity:t.pstyle("".concat(e,"-opacity")).value,color:t.pstyle("".concat(e,"-color")).value,shape:t.pstyle("".concat(e,"-shape")).value}}},{key:"getPadding",value:function(e,t){return t.pstyle("".concat(e,"-padding")).pfValue}},{key:"draw",value:function(e,t,n,r){if(this.isVisible(e,n)){var i=this.r,a=r.w,o=r.h,s=a/2,l=o/2,u=this.getStyle(e,n),c=u.shape,h=u.color,d=u.opacity;t.save(),t.fillStyle=uI(h,d),"round-rectangle"===c||"roundrectangle"===c?i.drawRoundRectanglePath(t,s,l,a,o,"auto"):"ellipse"===c&&i.drawEllipsePath(t,s,l,a,o),t.fill(),t.restore()}}}]),uL={};function uO(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=ug(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function uz(e,t,n){var r=e.drawing;(t+=1,n.isNode())?((r.drawTexture(n,t,"node-underlay"),"rectangle"===n.pstyle("shape").value&&"solid"===n.pstyle("background-fill").value&&0===n.pstyle("border-width").pfValue&&"none"===n.pstyle("background-image").strValue)?r.drawSimpleRectangle(n,t,"node-body"):r.drawTexture(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function uF(e,t,n){e.webglDebug&&(H=performance.now());var r=e.drawing,i=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&function(e,t){e.drawSelectionRectangle(t,function(t){return uO(e,t)})}(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var a,s,l,u,c,h,d,f,p,g,v,y,b,x,w,E,T,k,C,P,S,D,B,A,_,M,R,I,N,L,O,z=e.data.contexts[e.WEBGL];n.screen?(z.clearColor(0,0,0,0),z.enable(z.BLEND),z.blendFunc(z.ONE,z.ONE_MINUS_SRC_ALPHA)):z.disable(z.BLEND),z.clear(z.COLOR_BUFFER_BIT|z.DEPTH_BUFFER_BIT),z.viewport(0,0,z.canvas.width,z.canvas.height);var F=(a=e.canvasWidth,s=e.canvasHeight,u=(l=ug(e)).pan,c=l.zoom,uk(h=uE(),h,[u.x,u.y]),uP(h,h,[c,c]),(f=d=uE())[0]=2/a,f[1]=0,f[2]=0,f[3]=0,f[4]=-2/s,f[5]=0,f[6]=-1,f[7]=1,f[8]=1,g=p=uE(),v=d[0],y=d[1],b=d[2],x=d[3],w=d[4],E=d[5],T=d[6],k=d[7],C=d[8],P=h[0],S=h[1],D=h[2],B=h[3],A=h[4],_=h[5],M=h[6],R=h[7],I=h[8],g[0]=P*v+S*x+D*T,g[1]=P*y+S*w+D*k,g[2]=P*b+S*E+D*C,g[3]=B*v+A*x+_*T,g[4]=B*y+A*w+_*k,g[5]=B*b+A*E+_*C,g[6]=M*v+R*x+I*T,g[7]=M*y+R*w+I*k,g[8]=M*b+R*E+I*C,p),V=e.getCachedZSortedEles();if(i=V.length,r.startFrame(F,n),n.screen){for(var X=0;X<V.nondrag.length;X++)uz(e,X,V.nondrag[X]);for(var j=0;j<V.drag.length;j++)uz(e,j,V.drag[j])}else if(n.picking)for(var Y=0;Y<V.length;Y++)uz(e,Y,V[Y]);r.endFrame(),n.screen&&e.webglDebugShowAtlases&&((N=e.data.contexts[e.NODE]).save(),uO(e,N),N.strokeStyle="rgba(0, 0, 0, 0.3)",N.beginPath(),N.moveTo(-1e3,0),N.lineTo(1e3,0),N.stroke(),N.beginPath(),N.moveTo(0,-1e3),N.lineTo(0,1e3),N.stroke(),N.restore(),O=0,(L=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var l=o[s].canvas;if(l){var u=l.width,c=l.height,h=u*s,d=l.height*r;a.save(),a.scale(.125,.125),a.drawImage(l,h,d),a.strokeStyle="black",a.rect(h,d,u,c),a.stroke(),a.restore()}}})(e.drawing,"node",O++),L(e.drawing,"label",O++)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var q=Math.ceil(performance.now()-H),W=r.getDebugInfo(),U=["".concat(i," elements"),"".concat(W.totalInstances," instances"),"".concat(W.batchCount," batches"),"".concat(W.totalAtlases," atlases"),"".concat(W.wrappedCount," wrapped textures"),"".concat(W.rectangleCount," simple rectangles")].join(", ");console.log("WebGL (".concat(n.name,") - frame time ").concat(q,"ms")),console.log("Totals:"),console.log(" ".concat(U)),console.log("Texture Atlases Used:");var H,G,K=o(W.atlasInfo);try{for(K.s();!(G=K.n()).done;){var Z=G.value;console.log(" ".concat(Z.type,": ").concat(Z.keyCount," keys, ").concat(Z.atlasCount," atlases"))}}catch(e){K.e(e)}finally{K.f()}console.log("")}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,r.gc())}uL.initWebgl=function(e,t){var n,r,i,a,s,u=this,c=u.data.contexts[u.WEBGL];e.bgColor=en((n=u.cy.container())&&n.style&&n.style.backgroundColor||"white"),e.webglTexSize=Math.min(e.webglTexSize,c.getParameter(c.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS)),u.webglDebug=e.webglDebug,u.webglDebugShowAtlases=e.webglDebugShowAtlases,u.pickingFrameBuffer=function(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(t,r){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}(c),u.pickingFrameBuffer.needsDraw=!0;var h=function(e){return function(t){return u.getTextAngle(t,e)}},d=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}};u.drawing=new uR(u,c,e);var f=new uN(u);u.drawing.addAtlasCollection("node",uD({texRows:e.webglTexRowsNodes})),u.drawing.addAtlasCollection("label",uD({texRows:e.webglTexRows})),u.drawing.addAtlasRenderType("node-body",uB({collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement})),u.drawing.addAtlasRenderType("label",uB({collection:"label",getKey:t.getLabelKey,getBoundingBox:t.getLabelBox,drawElement:t.drawLabel,getRotation:h(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:d("label")})),u.drawing.addAtlasRenderType("node-overlay",uB({collection:"node",getBoundingBox:t.getElementBox,getKey:function(e){return f.getStyleKey("overlay",e)},drawElement:function(e,t,n){return f.draw("overlay",e,t,n)},isVisible:function(e){return f.isVisible("overlay",e)},getPadding:function(e){return f.getPadding("overlay",e)}})),u.drawing.addAtlasRenderType("node-underlay",uB({collection:"node",getBoundingBox:t.getElementBox,getKey:function(e){return f.getStyleKey("underlay",e)},drawElement:function(e,t,n){return f.draw("underlay",e,t,n)},isVisible:function(e){return f.isVisible("underlay",e)},getPadding:function(e){return f.getPadding("underlay",e)}})),u.drawing.addAtlasRenderType("edge-source-label",uB({collection:"label",getKey:t.getSourceLabelKey,getBoundingBox:t.getSourceLabelBox,drawElement:t.drawSourceLabel,getRotation:h("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:d("source-label")})),u.drawing.addAtlasRenderType("edge-target-label",uB({collection:"label",getKey:t.getTargetLabelKey,getBoundingBox:t.getTargetLabelBox,drawElement:t.drawTargetLabel,getRotation:h("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:d("target-label")}));var p=ef(function(){console.log("garbage collect flag set"),u.data.gc=!0},1e4);u.onUpdateEleCalcs(function(e,t){var n=!1;t&&t.length>0&&(n|=u.drawing.invalidate(t)),n&&p()}),r=u.render,u.render=function(e){e=e||{};var t,n,i=u.cy;u.webgl&&(i.zoom()>7.99?((t=u.data.contexts[u.WEBGL]).clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),r.call(u,e)):((n=function(e){e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,u.canvasWidth,u.canvasHeight),e.restore()})(u.data.contexts[u.NODE]),n(u.data.contexts[u.DRAG]),uF(u,e,uS.SCREEN)))},i=u.matchCanvasSize,u.matchCanvasSize=function(e){i.call(u,e),u.pickingFrameBuffer.setFramebufferAttachmentSizes(u.canvasWidth,u.canvasHeight),u.pickingFrameBuffer.needsDraw=!0},u.findNearestElements=function(e,t,n,r){return function(e,t,n){var r,i,a,s=function(e,t,n,r,i){var a,o,s=ug(e),u=s.pan,c=s.zoom,h=l((b=t*c+u.x,x=n*c+u.y,[b,x=Math.round(e.canvasHeight-x)]),2),d=h[0],f=h[1];a=d-3,o=f-3;var p=e.data.contexts[e.WEBGL];p.bindFramebuffer(p.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(p.viewport(0,0,p.canvas.width,p.canvas.height),uF(e,null,uS.PICKING),e.pickingFrameBuffer.needsDraw=!1);var g=new Uint8Array(144);p.readPixels(a,o,6,6,p.RGBA,p.UNSIGNED_BYTE,g),p.bindFramebuffer(p.FRAMEBUFFER,null);for(var v=new Set,y=0;y<36;y++){var b,x,w,E=(w=g.slice(4*y,4*y+4))[0]+(w[1]<<8)+(w[2]<<16)+(w[3]<<24)-1;E>=0&&v.add(E)}return v}(e,t,n),u=e.getCachedZSortedEles(),c=o(s);try{for(c.s();!(a=c.n()).done;){var h=u[a.value];if(!r&&h.isNode()&&(r=h),!i&&h.isEdge()&&(i=h),r&&i)break}}catch(e){c.e(e)}finally{c.f()}return[r,i].filter(Boolean)}(u,e,t)},a=u.invalidateCachedZSortedEles,u.invalidateCachedZSortedEles=function(){a.call(u),u.pickingFrameBuffer.needsDraw=!0},s=u.notify,u.notify=function(e,t){s.call(u,e,t),"viewport"===e||"bounds"===e?u.pickingFrameBuffer.needsDraw=!0:"background"===e&&u.drawing.invalidate(t,{type:"node-body"})}};var uV={};uV.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],n+s*a[2*l+1]);e.closePath()},uV.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return lk(e,t)}),e.closePath()},uV.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,l="auto"===a?t$(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,l),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.arcTo(t-o,n-s,t,n-s,l),e.lineTo(t,n-s),e.closePath()},uV.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,l="auto"===a?t$(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},uV.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,l=i/2,u="auto"===o?tJ():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+u,n-l),e.lineTo(t+s-u,n-l),e.lineTo(t+s,n-l+u),e.lineTo(t+s,n+l-u),e.lineTo(t+s-u,n+l),e.lineTo(t-s+u,n+l),e.lineTo(t-s,n+l-u),e.lineTo(t-s,n-l+u),e.closePath()},uV.drawBarrelPath=function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,l=t+a,u=n-o,c=n+o,h=t0(r,i),d=h.widthOffset,f=h.heightOffset,p=h.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(s,u+f),e.lineTo(s,c-f),e.quadraticCurveTo(s+p,c,s+d,c),e.lineTo(l-d,c),e.quadraticCurveTo(l-p,c,l,c-f),e.lineTo(l,u+f),e.quadraticCurveTo(l-p,u,l-d,u),e.lineTo(s+d,u),e.quadraticCurveTo(s+p,u,s,u+f),e.closePath()};for(var uX={},uj={},uY=Math.PI/40,uq=0*Math.PI;uq<2*Math.PI;uq+=uY)uX[uq]=Math.sin(uq),uj[uq]=Math.cos(uq);uV.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=uY)a=t-s*uX[u]*0+s*uj[u]*1,o=n+l*uj[u]*0+l*uX[u]*1,0===u?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var uW={};function uU(e){var t=e.indexOf(",");return e.substr(t+1)}function uH(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new n3(function(r,i){try{t.toBlob(function(e){null!=e?r(e):i(Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(e){i(e)}});case"blob":return function(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}(uU(r()),n);case"base64":return uU(r());default:return r()}}uW.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},uW.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=M(e.maxWidth)||M(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;M(e.maxWidth)&&(u=l*e.maxWidth/i),M(e.maxHeight)&&(c=l*e.maxHeight/a),i*=l=Math.min(u,c),a*=l}o||(i*=s,a*=s,l*=s);var h=document.createElement("canvas");h.width=i,h.height=a,h.style.width=i+"px",h.style.height=a+"px";var d=h.getContext("2d");if(i>0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var p=t.pan(),g={x:p.x*l,y:p.y*l};l*=t.zoom(),d.translate(g.x,g.y),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(-g.x,-g.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},uW.png=function(e){return uH(e,this.bufferCanvasImage(e),"image/png")},uW.jpg=function(e){return uH(e,this.bufferCanvasImage(e),"image/jpeg")};var uG={};uG.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}};var uK=uZ.prototype;function uZ(e){var t=this,n=t.cy.window().document;e.webgl&&(uK.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:Array(uK.CANVAS_LAYERS),contexts:Array(uK.CANVAS_LAYERS),canvasNeedsRedraw:Array(uK.CANVAS_LAYERS),bufferCanvases:Array(uK.BUFFER_COUNT),bufferContexts:Array(uK.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position="relative",a.zIndex="0",a.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};E&&E.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l<uK.CANVAS_LAYERS;l++){var u=t.data.canvases[l]=n.createElement("canvas"),c=uK.CANVAS_TYPES[l];t.data.contexts[l]=u.getContext(c),t.data.contexts[l]||eN("Could not create canvas of type "+c),Object.keys(s).forEach(function(e){u.style[e]=s[e]}),u.style.position="absolute",u.setAttribute("data-id","layer"+l),u.style.zIndex=String(uK.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(u),t.data.canvasNeedsRedraw[l]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[uK.NODE].setAttribute("data-id","layer"+uK.NODE+"-node"),t.data.canvases[uK.SELECT_BOX].setAttribute("data-id","layer"+uK.SELECT_BOX+"-selectbox"),t.data.canvases[uK.DRAG].setAttribute("data-id","layer"+uK.DRAG+"-drag"),t.data.canvases[uK.WEBGL]&&t.data.canvases[uK.WEBGL].setAttribute("data-id","layer"+uK.WEBGL+"-webgl");for(var l=0;l<uK.BUFFER_COUNT;l++)t.data.bufferCanvases[l]=n.createElement("canvas"),t.data.bufferContexts[l]=t.data.bufferCanvases[l].getContext("2d"),t.data.bufferCanvases[l].style.position="absolute",t.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),t.data.bufferCanvases[l].style.zIndex=String(-l-1),t.data.bufferCanvases[l].style.visibility="hidden";t.pathsEnabled=!0;var h=tm(),d=function(e){return{x:-e.w/2,y:-e.h/2}},f=function(e){return e[0]._private.nodeKey},p=function(e){return e[0]._private.labelStyleKey},g=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},y=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)},x=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)},w=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)},T=function(e){return e.boundingBox(),e[0]._private.bodyBounds},k=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||h},C=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||h},P=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||h},S=function(e,t){return t},D=function(e){var t;return{x:((t=T(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2}},B=function(e,t,n){var r=e?e+"-":"";return{x:t.x+n.pstyle(r+"text-margin-x").pfValue,y:t.y+n.pstyle(r+"text-margin-y").pfValue}},A=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},_=function(e){return B("",A(e,"labelX","labelY"),e)},M=function(e){return B("source",A(e,"sourceLabelX","sourceLabelY"),e)},R=function(e){return B("target",A(e,"targetLabelX","targetLabelY"),e)},I=function(e){return d(T(e))},N=function(e){return d(C(e))},L=function(e){return d(P(e))},O=function(e){var t=k(e),n=d(k(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w-(t.leftPad||0);break;case"right":n.x=-(t.rightPad||0)}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h-(t.topPad||0);break;case"bottom":n.y=-(t.botPad||0)}}return n},z=t.data.eleTxrCache=new l$(t,{getKey:f,doesEleInvalidateKey:function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},drawElement:y,getBoundingBox:T,getRotationPoint:D,getRotationOffset:I,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),F=t.data.lblTxrCache=new l$(t,{getKey:p,drawElement:b,getBoundingBox:k,getRotationPoint:_,getRotationOffset:O,isVisible:S}),V=t.data.slbTxrCache=new l$(t,{getKey:g,drawElement:x,getBoundingBox:C,getRotationPoint:M,getRotationOffset:N,isVisible:S}),X=t.data.tlbTxrCache=new l$(t,{getKey:v,drawElement:w,getBoundingBox:P,getRotationPoint:R,getRotationOffset:L,isVisible:S}),j=t.data.lyrTxrCache=new lJ(t);t.onUpdateEleCalcs(function(e,t){z.invalidateElements(t),F.invalidateElements(t),V.invalidateElements(t),X.invalidateElements(t),j.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var Y=function(e){for(var t=0;t<e.length;t++)j.enqueueElementRefinement(e[t].ele)};z.onDequeue(Y),F.onDequeue(Y),V.onDequeue(Y),X.onDequeue(Y),e.webgl&&t.initWebgl(e,{getStyleKey:f,getLabelKey:p,getSourceLabelKey:g,getTargetLabelKey:v,drawElement:y,drawLabel:b,drawSourceLabel:x,drawTargetLabel:w,getElementBox:T,getLabelBox:k,getSourceLabelBox:C,getTargetLabelBox:P,getElementRotationPoint:D,getElementRotationOffset:I,getLabelRotationPoint:_,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:R,getLabelRotationOffset:O,getSourceLabelRotationOffset:N,getTargetLabelRotationOffset:L})}uK.CANVAS_LAYERS=3,uK.SELECT_BOX=0,uK.DRAG=1,uK.NODE=2,uK.WEBGL=3,uK.CANVAS_TYPES=["2d","2d","2d","webgl2"],uK.BUFFER_COUNT=3,uK.TEXTURE_BUFFER=0,uK.MOTIONBLUR_BUFFER_NODE=1,uK.MOTIONBLUR_BUFFER_DRAG=2,uK.redrawHint=function(e,t){switch(e){case"eles":this.data.canvasNeedsRedraw[uK.NODE]=t;break;case"drag":this.data.canvasNeedsRedraw[uK.DRAG]=t;break;case"select":this.data.canvasNeedsRedraw[uK.SELECT_BOX]=t;break;case"gc":this.data.gc=!0}};var u$="undefined"!=typeof Path2D;uK.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},uK.usePaths=function(){return u$&&this.pathsEnabled},uK.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},uK.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},uK.makeOffscreenCanvas=function(e,t){var n;return("undefined"==typeof OffscreenCanvas?"undefined":h(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(e,t):((n=this.cy.window().document.createElement("canvas")).width=e,n.height=t),n},[l2,l8,ua,us,ul,uc,ud,uL,uV,uW,uG].forEach(function(e){Q(uK,e)});var uQ=[{name:"null",impl:aK},{name:"base",impl:lq},{name:"canvas",impl:uZ}],uJ={},u0={};function u1(e,t,n){var r=n,i=function(n){eO("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(au.prototype[t])return i(t);au.prototype[t]=n}else if("collection"===e){if(ij.prototype[t])return i(t);ij.prototype[t]=n}else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),_(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(e){return e._private.cy},d={addEventFields:function(e,t){t.layout=e,t.cy=h(e),t.target=e},bubble:function(){return!0},parent:function(e){return h(e)}};Q(o,{createEmitter:function(){return this._private.emitter=new il(d,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),rh.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var f=u2("renderer","base"),p=f.prototype,g=n.prototype,v=function(){f.apply(this,arguments),n.apply(this,arguments)},y=v.prototype;for(var b in p){var x=p[b];if(null!=g[b])return i(b);y[b]=x}for(var w in g)y[w]=g[w];p.clientFunctions.forEach(function(e){y[e]=y[e]||function(){eN("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=v}else if("__proto__"===e||"constructor"===e||"prototype"===e)return eN(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return ei({map:uJ,keys:[e,t],value:r})}function u2(e,t){return ea({map:uJ,keys:[e,t]})}function u5(e,t,n,r,i){return ei({map:u0,keys:[e,t,n,r],value:i})}function u3(e,t,n,r){return ea({map:u0,keys:[e,t,n,r]})}var u4=function(){return 2==arguments.length?u2.apply(null,arguments):3==arguments.length?u1.apply(null,arguments):4==arguments.length?u3.apply(null,arguments):5==arguments.length?u5.apply(null,arguments):void eN("Invalid extension access syntax")};au.prototype.extension=u4,[{type:"layout",extensions:[{name:"breadthfirst",impl:ag},{name:"circle",impl:ay},{name:"concentric",impl:ab},{name:"cose",impl:aw},{name:"grid",impl:aj},{name:"null",impl:aq},{name:"preset",impl:aU},{name:"random",impl:aG}]},{type:"renderer",extensions:uQ}].forEach(function(e){e.extensions.forEach(function(t){u1(e.type,t.name,t.impl)})});var u9=function(){if(!(this instanceof u9))return new u9;this.length=0},u6=u9.prototype;u6.instanceString=function(){return"stylesheet"},u6.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},u6.css=function(e,t){var n=this.length-1;if(D(e))this[n].properties.push({name:e,value:t});else if(_(e))for(var r=Object.keys(e),i=0;i<r.length;i++){var a=r[i],o=e[a];if(null!=o){var s=aa.properties[a]||aa.properties[Y(a)];if(null!=s){var l=s.name;this[n].properties.push({name:l,value:o})}}}return this},u6.style=u6.css,u6.generateStyle=function(e){var t=new aa(e);return this.appendToStyle(t)},u6.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var u8=function(e){return(void 0===e&&(e={}),_(e))?new au(e):D(e)?u4.apply(u4,arguments):void 0};u8.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(u8),e.apply(null,t),this},u8.warnings=function(e){return eL(e)},u8.version="3.31.1",u8.stylesheet=u8.Stylesheet=u9}}]);
|