mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
340 lines • 469 kB
JavaScript
import{a as v}from"./chunk-AQ6EADP3.mjs";function Ds(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t<e;t++)a[t]=r[t];return a}v(Ds,"_arrayLikeToArray");function ec(r){if(Array.isArray(r))return r}v(ec,"_arrayWithHoles");function rc(r){if(Array.isArray(r))return Ds(r)}v(rc,"_arrayWithoutHoles");function ht(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}v(ht,"_classCallCheck");function tc(r,e){for(var t=0;t<e.length;t++){var a=e[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,Jl(a.key),a)}}v(tc,"_defineProperties");function gt(r,e,t){return e&&tc(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}v(gt,"_createClass");function Tr(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Ks(r))||e){t&&(r=t);var a=0,n=v(function(){},"F");return{s:n,n:v(function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}},"n"),e:v(function(u){throw u},"e"),f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,o=!1;return{s:v(function(){t=t.call(r)},"s"),n:v(function(){var u=t.next();return s=u.done,u},"n"),e:v(function(u){o=!0,i=u},"e"),f:v(function(){try{s||t.return==null||t.return()}finally{if(o)throw i}},"f")}}v(Tr,"_createForOfIteratorHelper");function Ql(r,e,t){return(e=Jl(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}v(Ql,"_defineProperty$1");function ac(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}v(ac,"_iterableToArray");function nc(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var a,n,i,s,o=[],u=!0,l=!1;try{if(i=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(a=i.call(t)).done)&&(o.push(a.value),o.length!==e);u=!0);}catch(f){l=!0,n=f}finally{try{if(!u&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(l)throw n}}return o}}v(nc,"_iterableToArrayLimit");function ic(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}v(ic,"_nonIterableRest");function sc(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}v(sc,"_nonIterableSpread");function Je(r,e){return ec(r)||nc(r,e)||Ks(r,e)||ic()}v(Je,"_slicedToArray");function yn(r){return rc(r)||ac(r)||Ks(r)||sc()}v(yn,"_toConsumableArray");function oc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var a=t.call(r,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}v(oc,"_toPrimitive");function Jl(r){var e=oc(r,"string");return typeof e=="symbol"?e:e+""}v(Jl,"_toPropertyKey");function tr(r){"@babel/helpers - typeof";return tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tr(r)}v(tr,"_typeof");function Ks(r,e){if(r){if(typeof r=="string")return Ds(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ds(r,e):void 0}}v(Ks,"_unsupportedIterableToArray");var er=typeof window>"u"?null:window,Co=er?er.navigator:null;er&&er.document;var uc=tr(""),jl=tr({}),lc=tr(function(){}),vc=typeof HTMLElement>"u"?"undefined":tr(HTMLElement),Ma=v(function(e){return e&&e.instanceString&&Ue(e.instanceString)?e.instanceString():null},"instanceStr"),ge=v(function(e){return e!=null&&tr(e)==uc},"string"),Ue=v(function(e){return e!=null&&tr(e)===lc},"fn"),qe=v(function(e){return!Sr(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},"array"),Le=v(function(e){return e!=null&&tr(e)===jl&&!qe(e)&&e.constructor===Object},"plainObject"),fc=v(function(e){return e!=null&&tr(e)===jl},"object"),ne=v(function(e){return e!=null&&tr(e)===tr(1)&&!isNaN(e)},"number"),cc=v(function(e){return ne(e)&&Math.floor(e)===e},"integer"),mn=v(function(e){if(vc!=="undefined")return e!=null&&e instanceof HTMLElement},"htmlElement"),Sr=v(function(e){return La(e)||ev(e)},"elementOrCollection"),La=v(function(e){return Ma(e)==="collection"&&e._private.single},"element"),ev=v(function(e){return Ma(e)==="collection"&&!e._private.single},"collection"),Xs=v(function(e){return Ma(e)==="core"},"core"),rv=v(function(e){return Ma(e)==="stylesheet"},"stylesheet"),dc=v(function(e){return Ma(e)==="event"},"event"),ut=v(function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},"emptyString"),hc=v(function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},"domElement"),gc=v(function(e){return Le(e)&&ne(e.x1)&&ne(e.x2)&&ne(e.y1)&&ne(e.y2)},"boundingBox"),pc=v(function(e){return fc(e)&&Ue(e.then)},"promise"),yc=v(function(){return Co&&Co.userAgent.match(/msie|trident|edge/i)},"ms"),Zt=v(function(e,t){t||(t=v(function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")},"keyFn"));var a=v(function(){var i=this,s=arguments,o,u=t.apply(i,s),l=a.cache;return(o=l[u])||(o=l[u]=e.apply(i,s)),o},"memoizedFn");return a.cache={},a},"memoize"),Ys=Zt(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Rn=Zt(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),tv=Zt(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),To=v(function(e){return ut(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},"capitalize"),at=v(function(e,t){return e.slice(-1*t.length)===t},"endsWith"),rr="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",mc="rgb[a]?\\(("+rr+"[%]?)\\s*,\\s*("+rr+"[%]?)\\s*,\\s*("+rr+"[%]?)(?:\\s*,\\s*("+rr+"))?\\)",bc="rgb[a]?\\((?:"+rr+"[%]?)\\s*,\\s*(?:"+rr+"[%]?)\\s*,\\s*(?:"+rr+"[%]?)(?:\\s*,\\s*(?:"+rr+"))?\\)",wc="hsl[a]?\\(("+rr+")\\s*,\\s*("+rr+"[%])\\s*,\\s*("+rr+"[%])(?:\\s*,\\s*("+rr+"))?\\)",xc="hsl[a]?\\((?:"+rr+")\\s*,\\s*(?:"+rr+"[%])\\s*,\\s*(?:"+rr+"[%])(?:\\s*,\\s*(?:"+rr+"))?\\)",Ec="\\#[0-9a-fA-F]{3}",Cc="\\#[0-9a-fA-F]{6}",av=v(function(e,t){return e<t?-1:e>t?1:0},"ascending"),Tc=v(function(e,t){return-1*av(e,t)},"descending"),me=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t<e.length;t++){var a=e[t];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var s=n[i];r[s]=a[s]}}return r},Sc=v(function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,a,n,i,s=16;return t?(a=parseInt(e[1]+e[1],s),n=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(a=parseInt(e[1]+e[2],s),n=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[a,n,i]}},"hex2tuple"),kc=v(function(e){var t,a,n,i,s,o,u,l;function f(h,m,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?h+(m-h)*6*p:p<1/2?m:p<2/3?h+(m-h)*(2/3-p)*6:h}v(f,"hue2rgb");var c=new RegExp("^"+wc+"$").exec(e);if(c){if(a=parseInt(c[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(c[2]),n<0||n>100||(n=n/100,i=parseFloat(c[3]),i<0||i>100)||(i=i/100,s=c[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=u=l=Math.round(i*255);else{var d=i<.5?i*(1+n):i+n-i*n,g=2*i-d;o=Math.round(255*f(g,d,a+1/3)),u=Math.round(255*f(g,d,a)),l=Math.round(255*f(g,d,a-1/3))}t=[o,u,l,s]}return t},"hsl2tuple"),Dc=v(function(e){var t,a=new RegExp("^"+mc+"$").exec(e);if(a){t=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;t.push(Math.floor(s))}var o=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(o&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},"rgb2tuple"),Bc=v(function(e){return Pc[e.toLowerCase()]},"colorname2tuple"),nv=v(function(e){return(qe(e)?e:null)||Bc(e)||Sc(e)||Dc(e)||kc(e)},"color2tuple"),Pc={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]},iv=v(function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Le(s))throw Error("Tried to set map with object key");i<a.length-1?(t[s]==null&&(t[s]={}),t=t[s]):t[s]=e.value}},"setMap"),sv=v(function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Le(s))throw Error("Tried to get map with object key");if(t=t[s],t==null)return t}return t},"getMap"),Ua=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ia(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}v(Ia,"getDefaultExportFromCjs");var Qn,So;function Oa(){if(So)return Qn;So=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return v(r,"isObject"),Qn=r,Qn}v(Oa,"requireIsObject");var Jn,ko;function Ac(){if(ko)return Jn;ko=1;var r=typeof Ua=="object"&&Ua&&Ua.Object===Object&&Ua;return Jn=r,Jn}v(Ac,"require_freeGlobal");var jn,Do;function Mn(){if(Do)return jn;Do=1;var r=Ac(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return jn=t,jn}v(Mn,"require_root");var ei,Bo;function Rc(){if(Bo)return ei;Bo=1;var r=Mn(),e=v(function(){return r.Date.now()},"now");return ei=e,ei}v(Rc,"requireNow");var ri,Po;function Mc(){if(Po)return ri;Po=1;var r=/\s/;function e(t){for(var a=t.length;a--&&r.test(t.charAt(a)););return a}return v(e,"trimmedEndIndex"),ri=e,ri}v(Mc,"require_trimmedEndIndex");var ti,Ao;function Lc(){if(Ao)return ti;Ao=1;var r=Mc(),e=/^\s+/;function t(a){return a&&a.slice(0,r(a)+1).replace(e,"")}return v(t,"baseTrim"),ti=t,ti}v(Lc,"require_baseTrim");var ai,Ro;function Zs(){if(Ro)return ai;Ro=1;var r=Mn(),e=r.Symbol;return ai=e,ai}v(Zs,"require_Symbol");var ni,Mo;function Ic(){if(Mo)return ni;Mo=1;var r=Zs(),e=Object.prototype,t=e.hasOwnProperty,a=e.toString,n=r?r.toStringTag:void 0;function i(s){var o=t.call(s,n),u=s[n];try{s[n]=void 0;var l=!0}catch{}var f=a.call(s);return l&&(o?s[n]=u:delete s[n]),f}return v(i,"getRawTag"),ni=i,ni}v(Ic,"require_getRawTag");var ii,Lo;function Oc(){if(Lo)return ii;Lo=1;var r=Object.prototype,e=r.toString;function t(a){return e.call(a)}return v(t,"objectToString"),ii=t,ii}v(Oc,"require_objectToString");var si,Io;function ov(){if(Io)return si;Io=1;var r=Zs(),e=Ic(),t=Oc(),a="[object Null]",n="[object Undefined]",i=r?r.toStringTag:void 0;function s(o){return o==null?o===void 0?n:a:i&&i in Object(o)?e(o):t(o)}return v(s,"baseGetTag"),si=s,si}v(ov,"require_baseGetTag");var oi,Oo;function Nc(){if(Oo)return oi;Oo=1;function r(e){return e!=null&&typeof e=="object"}return v(r,"isObjectLike"),oi=r,oi}v(Nc,"requireIsObjectLike");var ui,No;function Na(){if(No)return ui;No=1;var r=ov(),e=Nc(),t="[object Symbol]";function a(n){return typeof n=="symbol"||e(n)&&r(n)==t}return v(a,"isSymbol"),ui=a,ui}v(Na,"requireIsSymbol");var li,zo;function zc(){if(zo)return li;zo=1;var r=Lc(),e=Oa(),t=Na(),a=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return a;if(e(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=e(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=r(l);var c=i.test(l);return c||s.test(l)?o(l.slice(2),c?2:8):n.test(l)?a:+l}return v(u,"toNumber"),li=u,li}v(zc,"requireToNumber");var vi,Fo;function Fc(){if(Fo)return vi;Fo=1;var r=Oa(),e=Rc(),t=zc(),a="Expected a function",n=Math.max,i=Math.min;function s(o,u,l){var f,c,d,g,h,m,p=0,y=!1,b=!1,w=!0;if(typeof o!="function")throw new TypeError(a);u=t(u)||0,r(l)&&(y=!!l.leading,b="maxWait"in l,d=b?n(t(l.maxWait)||0,u):d,w="trailing"in l?!!l.trailing:w);function x(R){var M=f,I=c;return f=c=void 0,p=R,g=o.apply(I,M),g}v(x,"invokeFunc");function C(R){return p=R,h=setTimeout(S,u),y?x(R):g}v(C,"leadingEdge");function T(R){var M=R-m,I=R-p,O=u-M;return b?i(O,d-I):O}v(T,"remainingWait");function E(R){var M=R-m,I=R-p;return m===void 0||M>=u||M<0||b&&I>=d}v(E,"shouldInvoke");function S(){var R=e();if(E(R))return D(R);h=setTimeout(S,T(R))}v(S,"timerExpired");function D(R){return h=void 0,w&&f?x(R):(f=c=void 0,g)}v(D,"trailingEdge");function B(){h!==void 0&&clearTimeout(h),p=0,f=m=c=h=void 0}v(B,"cancel");function P(){return h===void 0?g:D(e())}v(P,"flush");function A(){var R=e(),M=E(R);if(f=arguments,c=this,m=R,M){if(h===void 0)return C(m);if(b)return clearTimeout(h),h=setTimeout(S,u),x(m)}return h===void 0&&(h=setTimeout(S,u)),g}return v(A,"debounced"),A.cancel=B,A.flush=P,A}return v(s,"debounce"),vi=s,vi}v(Fc,"requireDebounce");var Vc=Fc(),za=Ia(Vc),fi=er?er.performance:null,uv=fi&&fi.now?function(){return fi.now()}:function(){return Date.now()},qc=(function(){if(er){if(er.requestAnimationFrame)return function(r){er.requestAnimationFrame(r)};if(er.mozRequestAnimationFrame)return function(r){er.mozRequestAnimationFrame(r)};if(er.webkitRequestAnimationFrame)return function(r){er.webkitRequestAnimationFrame(r)};if(er.msRequestAnimationFrame)return function(r){er.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(uv())},1e3/60)}})(),bn=v(function(e){return qc(e)},"requestAnimationFrame"),Yr=uv,St=9261,lv=65599,Gt=5381,vv=v(function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:St,a=t,n;n=e.next(),!n.done;)a=a*lv+n.value|0;return a},"hashIterableInts"),Ea=v(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:St;return t*lv+e|0},"hashInt"),Ca=v(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gt;return(t<<5)+t+e|0},"hashIntAlt"),_c=v(function(e,t){return e*2097152+t},"combineHashes"),et=v(function(e){return e[0]*2097152+e[1]},"combineHashesArray"),Ka=v(function(e,t){return[Ea(e[0],t[0]),Ca(e[1],t[1])]},"hashArrays"),Vo=v(function(e,t){var a={value:0,done:!1},n=0,i=e.length,s={next:v(function(){return n<i?a.value=e[n++]:a.done=!0,a},"next")};return vv(s,t)},"hashIntsArray"),Bt=v(function(e,t){var a={value:0,done:!1},n=0,i=e.length,s={next:v(function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a},"next")};return vv(s,t)},"hashString"),fv=v(function(){return Gc(arguments)},"hashStrings"),Gc=v(function(e){for(var t,a=0;a<e.length;a++){var n=e[a];a===0?t=Bt(n):t=Bt(n,t)}return t},"hashStringsArray");function Hc(r,e,t,a,n){var i=n*Math.PI/180,s=Math.cos(i)*(r-t)-Math.sin(i)*(e-a)+t,o=Math.sin(i)*(r-t)+Math.cos(i)*(e-a)+a;return{x:s,y:o}}v(Hc,"rotatePoint");var Wc=v(function(e,t,a,n,i,s){return{x:(e-a)*i+a,y:(t-n)*s+n}},"movePointByBoxAspect");function $c(r,e,t){if(t===0)return r;var a=(e.x1+e.x2)/2,n=(e.y1+e.y2)/2,i=e.w/e.h,s=1/i,o=Hc(r.x,r.y,a,n,t),u=Wc(o.x,o.y,a,n,i,s);return{x:u.x,y:u.y}}v($c,"rotatePosAndSkewByBox");var qo=!0,Uc=console.warn!=null,Kc=console.trace!=null,Qs=Number.MAX_SAFE_INTEGER||9007199254740991,cv=v(function(){return!0},"trueify"),wn=v(function(){return!1},"falsify"),_o=v(function(){return 0},"zeroify"),Js=v(function(){},"noop"),We=v(function(e){throw new Error(e)},"error"),dv=v(function(e){if(e!==void 0)qo=!!e;else return qo},"warnings"),Fe=v(function(e){dv()&&(Uc?console.warn(e):(console.log(e),Kc&&console.trace()))},"warn"),Xc=v(function(e){return me({},e)},"clone"),_r=v(function(e){return e==null?e:qe(e)?e.slice():Le(e)?Xc(e):e},"copy"),Yc=v(function(e){return e.slice()},"copyArray"),hv=v(function(e,t){for(t=e="";e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return t},"uuid"),Zc={},gv=v(function(){return Zc},"staticEmptyObject"),fr=v(function(e){var t=Object.keys(e);return function(a){for(var n={},i=0;i<t.length;i++){var s=t[i],o=a?.[s];n[s]=o===void 0?e[s]:o}return n}},"defaults"),lt=v(function(e,t,a){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)},"removeFromArray"),js=v(function(e){e.splice(0,e.length)},"clearArray"),Qc=v(function(e,t){for(var a=0;a<t.length;a++){var n=t[a];e.push(n)}},"push"),Er=v(function(e,t,a){return a&&(t=tv(a,t)),e[t]},"getPrefixedProperty"),Kr=v(function(e,t,a,n){a&&(t=tv(a,t)),e[t]=n},"setPrefixedProperty"),Jc=(function(){function r(){ht(this,r),this._obj={}}return v(r,"ObjectMap"),gt(r,[{key:"set",value:v(function(t,a){return this._obj[t]=a,this},"set")},{key:"delete",value:v(function(t){return this._obj[t]=void 0,this},"_delete")},{key:"clear",value:v(function(){this._obj={}},"clear")},{key:"has",value:v(function(t){return this._obj[t]!==void 0},"has")},{key:"get",value:v(function(t){return this._obj[t]},"get")}])})(),Xr=typeof Map<"u"?Map:Jc,jc="undefined",ed=(function(){function r(e){if(ht(this,r),this._obj=Object.create(null),this.size=0,e!=null){var t;e.instanceString!=null&&e.instanceString()===this.instanceString()?t=e.toArray():t=e;for(var a=0;a<t.length;a++)this.add(t[a])}}return v(r,"ObjectSet"),gt(r,[{key:"instanceString",value:v(function(){return"set"},"instanceString")},{key:"add",value:v(function(t){var a=this._obj;a[t]!==1&&(a[t]=1,this.size++)},"add")},{key:"delete",value:v(function(t){var a=this._obj;a[t]===1&&(a[t]=0,this.size--)},"_delete")},{key:"clear",value:v(function(){this._obj=Object.create(null)},"clear")},{key:"has",value:v(function(t){return this._obj[t]===1},"has")},{key:"toArray",value:v(function(){var t=this;return Object.keys(this._obj).filter(function(a){return t.has(a)})},"toArray")},{key:"forEach",value:v(function(t,a){return this.toArray().forEach(t,a)},"forEach")}])})(),ea=(typeof Set>"u"?"undefined":tr(Set))!==jc?Set:ed,Ln=v(function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!Xs(e)){We("An element must have a core reference and parameters set");return}var n=t.group;if(n==null&&(t.data&&t.data.source!=null&&t.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){We("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?n==="edges":!!t.pannable,active:!1,classes:new ea,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(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var s=t.renderedPosition,o=e.pan(),u=e.zoom();i.position={x:(s.x-o.x)/u,y:(s.y-o.y)/u}}var l=[];qe(t.classes)?l=t.classes:ge(t.classes)&&(l=t.classes.split(/\s+/));for(var f=0,c=l.length;f<c;f++){var d=l[f];!d||d===""||i.classes.add(d)}this.createEmitter(),(a===void 0||a)&&this.restore();var g=t.style||t.css;g&&(Fe("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(g))},"Element"),Go=v(function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},v(function(a,n,i){var s;Le(a)&&!Sr(a)&&(s=a,a=s.roots||s.root,n=s.visit,i=s.directed),i=arguments.length===2&&!Ue(n)?n:i,n=Ue(n)?n:function(){};for(var o=this._private.cy,u=a=ge(a)?this.filter(a):a,l=[],f=[],c={},d={},g={},h=0,m,p=this.byGroup(),y=p.nodes,b=p.edges,w=0;w<u.length;w++){var x=u[w],C=x.id();x.isNode()&&(l.unshift(x),e.bfs&&(g[C]=!0,f.push(x)),d[C]=0)}for(var T=v(function(){var R=e.bfs?l.shift():l.pop(),M=R.id();if(e.dfs){if(g[M])return 0;g[M]=!0,f.push(R)}var I=d[M],O=c[M],L=O!=null?O.source():null,N=O!=null?O.target():null,_=O==null?void 0:R.same(L)?N[0]:L[0],G;if(G=n(R,O,_,h++,I),G===!0)return m=R,1;if(G===!1)return 1;for(var z=R.connectedEdges().filter(function(ee){return(!i||ee.source().same(R))&&b.has(ee)}),V=0;V<z.length;V++){var K=z[V],j=K.connectedNodes().filter(function(ee){return!ee.same(R)&&y.has(ee)}),Q=j.id();j.length!==0&&!g[Q]&&(j=j[0],l.push(j),e.bfs&&(g[Q]=!0,f.push(j)),c[Q]=K,d[Q]=d[M]+1)}},"_loop"),E;l.length!==0&&(E=T(),!(E!==0&&E===1)););for(var S=o.collection(),D=0;D<f.length;D++){var B=f[D],P=c[B.id()];P!=null&&S.push(P),S.push(B)}return{path:o.collection(S),found:o.collection(m)}},"searchFn")},"defineSearch"),Ta={breadthFirstSearch:Go({bfs:!0}),depthFirstSearch:Go({dfs:!0})};Ta.bfs=Ta.breadthFirstSearch;Ta.dfs=Ta.depthFirstSearch;var sn={exports:{}},rd=sn.exports,Ho;function td(){return Ho||(Ho=1,(function(r,e){(function(){var t,a,n,i,s,o,u,l,f,c,d,g,h,m,p;n=Math.floor,c=Math.min,a=v(function(y,b){return y<b?-1:y>b?1:0},"defaultCmp"),f=v(function(y,b,w,x,C){var T;if(w==null&&(w=0),C==null&&(C=a),w<0)throw new Error("lo must be non-negative");for(x==null&&(x=y.length);w<x;)T=n((w+x)/2),C(b,y[T])<0?x=T:w=T+1;return[].splice.apply(y,[w,w-w].concat(b)),b},"insort"),o=v(function(y,b,w){return w==null&&(w=a),y.push(b),m(y,0,y.length-1,w)},"heappush"),s=v(function(y,b){var w,x;return b==null&&(b=a),w=y.pop(),y.length?(x=y[0],y[0]=w,p(y,0,b)):x=w,x},"heappop"),l=v(function(y,b,w){var x;return w==null&&(w=a),x=y[0],y[0]=b,p(y,0,w),x},"heapreplace"),u=v(function(y,b,w){var x;return w==null&&(w=a),y.length&&w(y[0],b)<0&&(x=[y[0],b],b=x[0],y[0]=x[1],p(y,0,w)),b},"heappushpop"),i=v(function(y,b){var w,x,C,T,E,S;for(b==null&&(b=a),T=(function(){S=[];for(var D=0,B=n(y.length/2);0<=B?D<B:D>B;0<=B?D++:D--)S.push(D);return S}).apply(this).reverse(),E=[],x=0,C=T.length;x<C;x++)w=T[x],E.push(p(y,w,b));return E},"heapify"),h=v(function(y,b,w){var x;if(w==null&&(w=a),x=y.indexOf(b),x!==-1)return m(y,0,x,w),p(y,x,w)},"updateItem"),d=v(function(y,b,w){var x,C,T,E,S;if(w==null&&(w=a),C=y.slice(0,b),!C.length)return C;for(i(C,w),S=y.slice(b),T=0,E=S.length;T<E;T++)x=S[T],u(C,x,w);return C.sort(w).reverse()},"nlargest"),g=v(function(y,b,w){var x,C,T,E,S,D,B,P,A;if(w==null&&(w=a),b*10<=y.length){if(T=y.slice(0,b).sort(w),!T.length)return T;for(C=T[T.length-1],B=y.slice(b),E=0,D=B.length;E<D;E++)x=B[E],w(x,C)<0&&(f(T,x,0,null,w),T.pop(),C=T[T.length-1]);return T}for(i(y,w),A=[],S=0,P=c(b,y.length);0<=P?S<P:S>P;0<=P?++S:--S)A.push(s(y,w));return A},"nsmallest"),m=v(function(y,b,w,x){var C,T,E;for(x==null&&(x=a),C=y[w];w>b;){if(E=w-1>>1,T=y[E],x(C,T)<0){y[w]=T,w=E;continue}break}return y[w]=C},"_siftdown"),p=v(function(y,b,w){var x,C,T,E,S;for(w==null&&(w=a),C=y.length,S=b,T=y[b],x=2*b+1;x<C;)E=x+1,E<C&&!(w(y[x],y[E])<0)&&(x=E),y[b]=y[x],b=x,x=2*b+1;return y[b]=T,m(y,S,b,w)},"_siftup"),t=(function(){y.push=o,y.pop=s,y.replace=l,y.pushpop=u,y.heapify=i,y.updateItem=h,y.nlargest=d,y.nsmallest=g;function y(b){this.cmp=b??a,this.nodes=[]}return v(y,"Heap"),y.prototype.push=function(b){return o(this.nodes,b,this.cmp)},y.prototype.pop=function(){return s(this.nodes,this.cmp)},y.prototype.peek=function(){return this.nodes[0]},y.prototype.contains=function(b){return this.nodes.indexOf(b)!==-1},y.prototype.replace=function(b){return l(this.nodes,b,this.cmp)},y.prototype.pushpop=function(b){return u(this.nodes,b,this.cmp)},y.prototype.heapify=function(){return i(this.nodes,this.cmp)},y.prototype.updateItem=function(b){return h(this.nodes,b,this.cmp)},y.prototype.clear=function(){return this.nodes=[]},y.prototype.empty=function(){return this.nodes.length===0},y.prototype.size=function(){return this.nodes.length},y.prototype.clone=function(){var b;return b=new y,b.nodes=this.nodes.slice(0),b},y.prototype.toArray=function(){return this.nodes.slice(0)},y.prototype.insert=y.prototype.push,y.prototype.top=y.prototype.peek,y.prototype.front=y.prototype.peek,y.prototype.has=y.prototype.contains,y.prototype.copy=y.prototype.clone,y})(),(function(y,b){return r.exports=b()})(this,function(){return t})}).call(rd)})(sn)),sn.exports}v(td,"requireHeap$1");var ci,Wo;function ad(){return Wo||(Wo=1,ci=td()),ci}v(ad,"requireHeap");var nd=ad(),Fa=Ia(nd),id=fr({root:null,weight:v(function(e){return 1},"weight"),directed:!1}),sd={dijkstra:v(function(e){if(!Le(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var a=id(e),n=a.root,i=a.weight,s=a.directed,o=this,u=i,l=ge(n)?this.filter(n)[0]:n[0],f={},c={},d={},g=this.byGroup(),h=g.nodes,m=g.edges;m.unmergeBy(function(I){return I.isLoop()});for(var p=v(function(O){return f[O.id()]},"getDist"),y=v(function(O,L){f[O.id()]=L,b.updateItem(O)},"setDist"),b=new Fa(function(I,O){return p(I)-p(O)}),w=0;w<h.length;w++){var x=h[w];f[x.id()]=x.same(l)?0:1/0,b.push(x)}for(var C=v(function(O,L){for(var N=(s?O.edgesTo(L):O.edgesWith(L)).intersect(m),_=1/0,G,z=0;z<N.length;z++){var V=N[z],K=u(V);(K<_||!G)&&(_=K,G=V)}return{edge:G,dist:_}},"distBetween");b.size()>0;){var T=b.pop(),E=p(T),S=T.id();if(d[S]=E,E!==1/0)for(var D=T.neighborhood().intersect(h),B=0;B<D.length;B++){var P=D[B],A=P.id(),R=C(T,P),M=E+R.dist;M<p(P)&&(y(P,M),c[A]={node:T,edge:R.edge})}}return{distanceTo:v(function(O){var L=ge(O)?h.filter(O)[0]:O[0];return d[L.id()]},"distanceTo"),pathTo:v(function(O){var L=ge(O)?h.filter(O)[0]:O[0],N=[],_=L,G=_.id();if(L.length>0)for(N.unshift(L);c[G];){var z=c[G];N.unshift(z.edge),N.unshift(z.node),_=z.node,G=_.id()}return o.spawn(N)},"pathTo")}},"dijkstra")},od={kruskal:v(function(e){e=e||function(w){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,s=new Array(i),o=a,u=v(function(x){for(var C=0;C<s.length;C++){var T=s[C];if(T.has(x))return C}},"findSetIndex"),l=0;l<i;l++)s[l]=this.spawn(a[l]);for(var f=n.sort(function(w,x){return e(w)-e(x)}),c=0;c<f.length;c++){var d=f[c],g=d.source()[0],h=d.target()[0],m=u(g),p=u(h),y=s[m],b=s[p];m!==p&&(o.merge(d),y.merge(b),s.splice(p,1))}return o},"kruskal")},ud=fr({root:null,goal:null,weight:v(function(e){return 1},"weight"),heuristic:v(function(e){return 0},"heuristic"),directed:!1}),ld={aStar:v(function(e){var t=this.cy(),a=ud(e),n=a.root,i=a.goal,s=a.heuristic,o=a.directed,u=a.weight;n=t.collection(n)[0],i=t.collection(i)[0];var l=n.id(),f=i.id(),c={},d={},g={},h=new Fa(function(G,z){return d[G.id()]-d[z.id()]}),m=new ea,p={},y={},b=v(function(z,V){h.push(z),m.add(V)},"addToOpenSet"),w,x,C=v(function(){w=h.pop(),x=w.id(),m.delete(x)},"popFromOpenSet"),T=v(function(z){return m.has(z)},"isInOpenSet");b(n,l),c[l]=0,d[l]=s(n);for(var E=0;h.size()>0;){if(C(),E++,x===f){for(var S=[],D=i,B=f,P=y[B];S.unshift(D),P!=null&&S.unshift(P),D=p[B],D!=null;)B=D.id(),P=y[B];return{found:!0,distance:c[x],path:this.spawn(S),steps:E}}g[x]=!0;for(var A=w._private.edges,R=0;R<A.length;R++){var M=A[R];if(this.hasElementWithId(M.id())&&!(o&&M.data("source")!==x)){var I=M.source(),O=M.target(),L=I.id()!==x?I:O,N=L.id();if(this.hasElementWithId(N)&&!g[N]){var _=c[x]+u(M);if(!T(N)){c[N]=_,d[N]=_+s(L),b(L,N),p[N]=w,y[N]=M;continue}_<c[N]&&(c[N]=_,d[N]=_+s(L),p[N]=w,y[N]=M)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}},"aStar")},vd=fr({weight:v(function(e){return 1},"weight"),directed:!1}),fd={floydWarshall:v(function(e){for(var t=this.cy(),a=vd(e),n=a.weight,i=a.directed,s=n,o=this.byGroup(),u=o.nodes,l=o.edges,f=u.length,c=f*f,d=v(function(K){return u.indexOf(K)},"indexOf"),g=v(function(K){return u[K]},"atIndex"),h=new Array(c),m=0;m<c;m++){var p=m%f,y=(m-p)/f;y===p?h[m]=0:h[m]=1/0}for(var b=new Array(c),w=new Array(c),x=0;x<l.length;x++){var C=l[x],T=C.source()[0],E=C.target()[0];if(T!==E){var S=d(T),D=d(E),B=S*f+D,P=s(C);if(h[B]>P&&(h[B]=P,b[B]=D,w[B]=C),!i){var A=D*f+S;!i&&h[A]>P&&(h[A]=P,b[A]=S,w[A]=C)}}}for(var R=0;R<f;R++)for(var M=0;M<f;M++)for(var I=M*f+R,O=0;O<f;O++){var L=M*f+O,N=R*f+O;h[I]+h[N]<h[L]&&(h[L]=h[I]+h[N],b[L]=b[I])}var _=v(function(K){return(ge(K)?t.filter(K):K)[0]},"getArgEle"),G=v(function(K){return d(_(K))},"indexOfArgEle"),z={distance:v(function(K,j){var Q=G(K),ee=G(j);return h[Q*f+ee]},"distance"),path:v(function(K,j){var Q=G(K),ee=G(j),te=g(Q);if(Q===ee)return te.collection();if(b[Q*f+ee]==null)return t.collection();var ie=t.collection(),J=Q,q;for(ie.merge(te);Q!==ee;)J=Q,Q=b[Q*f+ee],q=w[J*f+Q],ie.merge(q),ie.merge(g(Q));return ie},"path")};return z},"floydWarshall")},cd=fr({weight:v(function(e){return 1},"weight"),directed:!1,root:null}),dd={bellmanFord:v(function(e){var t=this,a=cd(e),n=a.weight,i=a.directed,s=a.root,o=n,u=this,l=this.cy(),f=this.byGroup(),c=f.edges,d=f.nodes,g=d.length,h=new Xr,m=!1,p=[];s=l.collection(s)[0],c.unmergeBy(function(xe){return xe.isLoop()});for(var y=c.length,b=v(function(be){var pe=h.get(be.id());return pe||(pe={},h.set(be.id(),pe)),pe},"getInfo"),w=v(function(be){return(ge(be)?l.$(be):be)[0]},"getNodeFromTo"),x=v(function(be){return b(w(be)).dist},"distanceTo"),C=v(function(be){for(var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,oe=w(be),he=[],ce=oe;;){if(ce==null)return t.spawn();var Ee=b(ce),we=Ee.edge,ke=Ee.pred;if(he.unshift(ce[0]),ce.same(pe)&&he.length>0)break;we!=null&&he.unshift(we),ce=ke}return u.spawn(he)},"pathTo"),T=0;T<g;T++){var E=d[T],S=b(E);E.same(s)?S.dist=0:S.dist=1/0,S.pred=null,S.edge=null}for(var D=!1,B=v(function(be,pe,oe,he,ce,Ee){var we=he.dist+Ee;we<ce.dist&&!oe.same(he.edge)&&(ce.dist=we,ce.pred=be,ce.edge=oe,D=!0)},"checkForEdgeReplacement"),P=1;P<g;P++){D=!1;for(var A=0;A<y;A++){var R=c[A],M=R.source(),I=R.target(),O=o(R),L=b(M),N=b(I);B(M,I,R,L,N,O),i||B(I,M,R,N,L,O)}if(!D)break}if(D)for(var _=[],G=0;G<y;G++){var z=c[G],V=z.source(),K=z.target(),j=o(z),Q=b(V).dist,ee=b(K).dist;if(Q+j<ee||!i&&ee+j<Q)if(m||(Fe("Graph contains a negative weight cycle for Bellman-Ford"),m=!0),e.findNegativeWeightCycles!==!1){var te=[];Q+j<ee&&te.push(V),!i&&ee+j<Q&&te.push(K);for(var ie=te.length,J=0;J<ie;J++){var q=te[J],W=[q];W.push(b(q).edge);for(var $=b(q).pred;W.indexOf($)===-1;)W.push($),W.push(b($).edge),$=b($).pred;W=W.slice(W.indexOf($));for(var Z=W[0].id(),ae=0,de=2;de<W.length;de+=2)W[de].id()<Z&&(Z=W[de].id(),ae=de);W=W.slice(ae).concat(W.slice(0,ae)),W.push(W[0]);var Pe=W.map(function(xe){return xe.id()}).join(",");_.indexOf(Pe)===-1&&(p.push(u.spawn(W)),_.push(Pe))}}else break}return{distanceTo:x,pathTo:C,hasNegativeWeightCycle:m,negativeWeightCycles:p}},"bellmanFord")},hd=Math.sqrt(2),gd=v(function(e,t,a){a.length===0&&We("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],s=n[2],o=t[i],u=t[s],l=a,f=l.length-1;f>=0;f--){var c=l[f],d=c[1],g=c[2];(t[d]===o&&t[g]===u||t[d]===u&&t[g]===o)&&l.splice(f,1)}for(var h=0;h<l.length;h++){var m=l[h];m[1]===u?(l[h]=m.slice(),l[h][1]=o):m[2]===u&&(l[h]=m.slice(),l[h][2]=o)}for(var p=0;p<t.length;p++)t[p]===u&&(t[p]=o);return l},"collapse"),di=v(function(e,t,a,n){for(;a>n;){var i=Math.floor(Math.random()*t.length);t=gd(i,e,t),a--}return t},"contractUntil"),pd={kargerStein:v(function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(N){return N.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/hd);if(i<2){We("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f<s;f++){var c=n[f];l.push([f,a.indexOf(c.source()),a.indexOf(c.target())])}for(var d=1/0,g=[],h=new Array(i),m=new Array(i),p=new Array(i),y=v(function(_,G){for(var z=0;z<i;z++)G[z]=_[z]},"copyNodesMap"),b=0;b<=o;b++){for(var w=0;w<i;w++)m[w]=w;var x=di(m,l.slice(),i,u),C=x.slice();y(m,p);var T=di(m,x,u,2),E=di(p,C,u,2);T.length<=E.length&&T.length<d?(d=T.length,g=T,y(m,h)):E.length<=T.length&&E.length<d&&(d=E.length,g=E,y(p,h))}for(var S=this.spawn(g.map(function(N){return n[N[0]]})),D=this.spawn(),B=this.spawn(),P=h[0],A=0;A<h.length;A++){var R=h[A],M=a[A];R===P?D.merge(M):B.merge(M)}var I=v(function(_){var G=e.spawn();return _.forEach(function(z){G.merge(z),z.connectedEdges().forEach(function(V){e.contains(V)&&!S.contains(V)&&G.merge(V)})}),G},"constructComponent"),O=[I(D),I(B)],L={cut:S,components:O,partition1:D,partition2:B};return L},"kargerStein")},hi,yd=v(function(e){return{x:e.x,y:e.y}},"copyPosition"),In=v(function(e,t,a){return{x:e.x*t+a.x,y:e.y*t+a.y}},"modelToRenderedPosition"),pv=v(function(e,t,a){return{x:(e.x-a.x)/t,y:(e.y-a.y)/t}},"renderedToModelPosition"),Ht=v(function(e){return{x:e[0],y:e[1]}},"array2point"),md=v(function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=t;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.min(s,n))}return n},"min"),bd=v(function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=t;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.max(s,n))}return n},"max"),wd=v(function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,s=t;s<a;s++){var o=e[s];isFinite(o)&&(n+=o,i++)}return n/i},"mean"),xd=v(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(t,a):(a<e.length&&e.splice(a,e.length-a),t>0&&e.splice(0,t));for(var o=0,u=e.length-1;u>=0;u--){var l=e[u];s?isFinite(l)||(e[u]=-1/0,o++):e.splice(u,1)}i&&e.sort(function(d,g){return d-g});var f=e.length,c=Math.floor(f/2);return f%2!==0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},"median"),Ed=v(function(e){return Math.PI*e/180},"deg2rad"),Xa=v(function(e,t){return Math.atan2(t,e)-Math.PI/2},"getAngleFromDisp"),eo=Math.log2||function(r){return Math.log(r)/Math.log(2)},ro=v(function(e){return e>0?1:e<0?-1:0},"signum"),Pt=v(function(e,t){return Math.sqrt(Ct(e,t))},"dist"),Ct=v(function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},"sqdist"),Cd=v(function(e){for(var t=e.length,a=0,n=0;n<t;n++)a+=e[n];for(var i=0;i<t;i++)e[i]=e[i]/a;return e},"inPlaceSumNormalize"),ir=v(function(e,t,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*a},"qbezierAt"),Ut=v(function(e,t,a,n){return{x:ir(e.x,t.x,a.x,n),y:ir(e.y,t.y,a.y,n)}},"qbezierPtAt"),Td=v(function(e,t,a,n){var i={x:t.x-e.x,y:t.y-e.y},s=Pt(e,t),o={x:i.x/s,y:i.y/s};return a=a??0,n=n??a*s,{x:e.x+o.x*n,y:e.y+o.y*n}},"lineAt"),Sa=v(function(e,t,a){return Math.max(e,Math.min(a,t))},"bound"),mr=v(function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},"makeBoundingBox"),Sd=v(function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},"copyBoundingBox"),kd=v(function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},"clearBoundingBox"),Dd=v(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},"updateBoundingBox"),yv=v(function(e,t,a){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},"expandBoundingBoxByPoint"),on=v(function(e){var t=arguments.length>1&&arguments[1]!==void 0?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},"expandBoundingBox"),un=v(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(t.length===1)a=n=i=s=t[0];else if(t.length===2)a=i=t[0],s=n=t[1];else if(t.length===4){var o=Je(t,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},"expandBoundingBoxSides"),$o=v(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},"assignBoundingBox"),to=v(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)},"boundingBoxesIntersect"),nt=v(function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},"inBoundingBox"),Uo=v(function(e,t){return nt(e,t.x,t.y)},"pointInBoundingBox"),mv=v(function(e,t){return nt(e,t.x1,t.y1)&&nt(e,t.x2,t.y2)},"boundingBoxInBoundingBox"),Bd=(hi=Math.hypot)!==null&&hi!==void 0?hi:function(r,e){return Math.sqrt(r*r+e*e)};function Pd(r,e){if(r.length<3)throw new Error("Need at least 3 vertices");var t=v(function(S,D){return{x:S.x+D.x,y:S.y+D.y}},"add"),a=v(function(S,D){return{x:S.x-D.x,y:S.y-D.y}},"sub"),n=v(function(S,D){return{x:S.x*D,y:S.y*D}},"scale"),i=v(function(S,D){return S.x*D.y-S.y*D.x},"cross"),s=v(function(S){var D=Bd(S.x,S.y);return D===0?{x:0,y:0}:{x:S.x/D,y:S.y/D}},"normalize"),o=v(function(S){for(var D=0,B=0;B<S.length;B++){var P=S[B],A=S[(B+1)%S.length];D+=P.x*A.y-A.x*P.y}return D/2},"signedArea"),u=v(function(S,D,B,P){var A=a(D,S),R=a(P,B),M=i(A,R);if(Math.abs(M)<1e-9)return t(S,n(A,.5));var I=i(a(B,S),R)/M;return t(S,n(A,I))},"intersectLines"),l=r.map(function(E){return{x:E.x,y:E.y}});o(l)<0&&l.reverse();for(var f=l.length,c=[],d=0;d<f;d++){var g=l[d],h=l[(d+1)%f],m=a(h,g),p=s({x:m.y,y:-m.x});c.push(p)}for(var y=c.map(function(E,S){var D=t(l[S],n(E,e)),B=t(l[(S+1)%f],n(E,e));return{p1:D,p2:B}}),b=[],w=0;w<f;w++){var x=y[(w-1+f)%f],C=y[w],T=u(x.p1,x.p2,C.p1,C.p2);b.push(T)}return b}v(Pd,"inflatePolygon");function Ad(r,e,t,a,n,i){var s=Vd(r,e,t,a,n),o=Pd(s,i),u=mr();return o.forEach(function(l){return yv(u,l.x,l.y)}),u}v(Ad,"miterBox");var bv=v(function(e,t,a,n,i,s,o){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?vt(i,s):u,f=i/2,c=s/2;l=Math.min(l,f,c);var d=l!==f,g=l!==c,h;if(d){var m=a-f+l-o,p=n-c-o,y=a+f-l+o,b=p;if(h=it(e,t,a,n,m,p,y,b,!1),h.length>0)return h}if(g){var w=a+f+o,x=n-c+l-o,C=w,T=n+c-l+o;if(h=it(e,t,a,n,w,x,C,T,!1),h.length>0)return h}if(d){var E=a-f+l-o,S=n+c+o,D=a+f-l+o,B=S;if(h=it(e,t,a,n,E,S,D,B,!1),h.length>0)return h}if(g){var P=a-f-o,A=n-c+l-o,R=P,M=n+c-l+o;if(h=it(e,t,a,n,P,A,R,M,!1),h.length>0)return h}var I;{var O=a-f+l,L=n-c+l;if(I=pa(e,t,a,n,O,L,l+o),I.length>0&&I[0]<=O&&I[1]<=L)return[I[0],I[1]]}{var N=a+f-l,_=n-c+l;if(I=pa(e,t,a,n,N,_,l+o),I.length>0&&I[0]>=N&&I[1]<=_)return[I[0],I[1]]}{var G=a+f-l,z=n+c-l;if(I=pa(e,t,a,n,G,z,l+o),I.length>0&&I[0]>=G&&I[1]>=z)return[I[0],I[1]]}{var V=a-f+l,K=n+c-l;if(I=pa(e,t,a,n,V,K,l+o),I.length>0&&I[0]<=V&&I[1]>=K)return[I[0],I[1]]}return[]},"roundRectangleIntersectLine"),Rd=v(function(e,t,a,n,i,s,o){var u=o,l=Math.min(a,i),f=Math.max(a,i),c=Math.min(n,s),d=Math.max(n,s);return l-u<=e&&e<=f+u&&c-u<=t&&t<=d+u},"inLineVicinity"),Md=v(function(e,t,a,n,i,s,o,u,l){var f={x1:Math.min(a,o,i)-l,x2:Math.max(a,o,i)+l,y1:Math.min(n,u,s)-l,y2:Math.max(n,u,s)+l};return!(e<f.x1||e>f.x2||t<f.y1||t>f.y2)},"inBezierVicinity"),Ld=v(function(e,t,a,n){a-=n;var i=t*t-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,u=(-t+s)/o,l=(-t-s)/o;return[u,l]},"solveQuadratic"),Id=v(function(e,t,a,n,i){var s=1e-5;e===0&&(e=s),t/=e,a/=e,n/=e;var o,u,l,f,c,d,g,h;if(u=(3*a-t*t)/9,l=-(27*n)+t*(9*a-2*(t*t)),l/=54,o=u*u*u+l*l,i[1]=0,g=t/3,o>0){c=l+Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),d=l-Math.sqrt(o),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),i[0]=-g+c+d,g+=(c+d)/2,i[4]=i[2]=-g,g=Math.sqrt(3)*(-d+c)/2,i[3]=g,i[5]=-g;return}if(i[5]=i[3]=0,o===0){h=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-g+2*h,i[4]=i[2]=-(h+g);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),h=2*Math.sqrt(u),i[0]=-g+h*Math.cos(f/3),i[2]=-g+h*Math.cos((f+2*Math.PI)/3),i[4]=-g+h*Math.cos((f+4*Math.PI)/3)},"solveCubic"),Od=v(function(e,t,a,n,i,s,o,u){var l=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*u+4*s*s-4*s*u+u*u,f=9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*u-6*s*s+3*s*u,c=3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*u-n*t+2*s*s+2*s*t-u*t,d=1*a*i-a*a+a*e-i*e+n*s-n*n+n*t-s*t,g=[];Id(l,f,c,d,g);for(var h=1e-7,m=[],p=0;p<6;p+=2)Math.abs(g[p+1])<h&&g[p]>=0&&g[p]<=1&&m.push(g[p]);m.push(1),m.push(0);for(var y=-1,b,w,x,C=0;C<m.length;C++)b=Math.pow(1-m[C],2)*a+2*(1-m[C])*m[C]*i+m[C]*m[C]*o,w=Math.pow(1-m[C],2)*n+2*(1-m[C])*m[C]*s+m[C]*m[C]*u,x=Math.pow(b-e,2)+Math.pow(w-t,2),y>=0?x<y&&(y=x):y=x;return y},"sqdistToQuadraticBezier"),Nd=v(function(e,t,a,n,i,s){var o=[e-a,t-n],u=[i-a,s-n],l=u[0]*u[0]+u[1]*u[1],f=o[0]*o[0]+o[1]*o[1],c=o[0]*u[0]+o[1]*u[1],d=c*c/l;return c<0?f:d>l?(e-i)*(e-i)+(t-s)*(t-s):f-d},"sqdistToFiniteLine"),Cr=v(function(e,t,a){for(var n,i,s,o,u,l=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(s=a[(f+1)*2],o=a[(f+1)*2+1]):(s=a[(f+1-a.length/2)*2],o=a[(f+1-a.length/2)*2+1]),!(n==e&&s==e))if(n>=e&&e>=s||n<=e&&e<=s)u=(e-n)/(s-n)*(o-i)+i,u>t&&l++;else continue;return l%2!==0},"pointInsidePolygonPoints"),Zr=v(function(e,t,a,n,i,s,o,u,l){var f=new Array(a.length),c;u[0]!=null?(c=Math.atan(u[1]/u[0]),u[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=u;for(var d=Math.cos(-c),g=Math.sin(-c),h=0;h<f.length/2;h++)f[h*2]=s/2*(a[h*2]*d-a[h*2+1]*g),f[h*2+1]=o/2*(a[h*2+1]*d+a[h*2]*g),f[h*2]+=n,f[h*2+1]+=i;var m;if(l>0){var p=En(f,-l);m=xn(p)}else m=f;return Cr(e,t,m)},"pointInsidePolygon"),zd=v(function(e,t,a,n,i,s,o,u){for(var l=new Array(a.length*2),f=0;f<u.length;f++){var c=u[f];l[f*4+0]=c.startX,l[f*4+1]=c.startY,l[f*4+2]=c.stopX,l[f*4+3]=c.stopY;var d=Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2);if(d<=Math.pow(c.radius,2))return!0}return Cr(e,t,l)},"pointInsideRoundPolygon"),xn=v(function(e){for(var t=new Array(e.length/2),a,n,i,s,o,u,l,f,c=0;c<e.length/4;c++){a=e[c*4],n=e[c*4+1],i=e[c*4+2],s=e[c*4+3],c<e.length/4-1?(o=e[(c+1)*4],u=e[(c+1)*4+1],l=e[(c+1)*4+2],f=e[(c+1)*4+3]):(o=e[0],u=e[1],l=e[2],f=e[3]);var d=it(a,n,i,s,o,u,l,f,!0);t[c*2]=d[0],t[c*2+1]=d[1]}return t},"joinLines"),En=v(function(e,t){for(var a=new Array(e.length*2),n,i,s,o,u=0;u<e.length/2;u++){n=e[u*2],i=e[u*2+1],u<e.length/2-1?(s=e[(u+1)*2],o=e[(u+1)*2+1]):(s=e[0],o=e[1]);var l=o-i,f=-(s-n),c=Math.sqrt(l*l+f*f),d=l/c,g=f/c;a[u*4]=n+d*t,a[u*4+1]=i+g*t,a[u*4+2]=s+d*t,a[u*4+3]=o+g*t}return a},"expandPolygon"),Fd=v(function(e,t,a,n,i,s){var o=a-e,u=n-t;o/=i,u/=s;var l=Math.sqrt(o*o+u*u),f=l-1;if(f<0)return[];var c=f/l;return[(a-e)*c+e,(n-t)*c+t]},"intersectLineEllipse"),Dt=v(function(e,t,a,n,i,s,o){return e-=i,t-=s,e/=a/2+o,t/=n/2+o,e*e+t*t<=1},"checkInEllipse"),pa=v(function(e,t,a,n,i,s,o){var u=[a-e,n-t],l=[e-i,t-s],f=u[0]*u[0]+u[1]*u[1],c=2*(l[0]*u[0]+l[1]*u[1]),d=l[0]*l[0]+l[1]*l[1]-o*o,g=c*c-4*f*d;if(g<0)return[];var h=(-c+Math.sqrt(g))/(2*f),m=(-c-Math.sqrt(g))/(2*f),p=Math.min(h,m),y=Math.max(h,m),b=[];if(p>=0&&p<=1&&b.push(p),y>=0&&y<=1&&b.push(y),b.length===0)return[];var w=b[0]*u[0]+e,x=b[0]*u[1]+t;if(b.length>1){if(b[0]==b[1])return[w,x];var C=b[1]*u[0]+e,T=b[1]*u[1]+t;return[w,x,C,T]}else return[w,x]},"intersectLineCircle"),gi=v(function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},"midOfThree"),it=v(function(e,t,a,n,i,s,o,u,l){var f=e-i,c=a-e,d=o-i,g=t-s,h=n-t,m=u-s,p=d*g-m*f,y=c*g-h*f,b=m*c-d*h;if(b!==0){var w=p/b,x=y/b,C=.001,T=0-C,E=1+C;return T<=w&&w<=E&&T<=x&&x<=E?[e+w*c,t+w*h]:l?[e+w*c,t+w*h]:[]}else return p===0||y===0?gi(e,a,o)===o?[o,u]:gi(e,a,i)===i?[i,s]:gi(i,o,a)===a?[a,n]:[]:[]},"finiteLinesIntersect"),Vd=v(function(e,t,a,n,i){var s=[],o=n/2,u=i/2,l=t,f=a;s.push({x:l+o*e[0],y:f+u*e[1]});for(var c=1;c<e.length/2;c++)s.push({x:l+o*e[c*2],y:f+u*e[c*2+1]});return s},"transformPoints"),ka=v(function(e,t,a,n,i,s,o,u){var l=[],f,c=new Array(a.length),d=!0;s==null&&(d=!1);var g;if(d){for(var h=0;h<c.length/2;h++)c[h*2]=a[h*2]*s+n,c[h*2+1]=a[h*2+1]*o+i;if(u>0){var m=En(c,-u);g=xn(m)}else g=c}else g=a;for(var p,y,b,w,x=0;x<g.length/2;x++)p=g[x*2],y=g[x*2+1],x<g.length/2-1?(b=g[(x+1)*2],w=g[(x+1)*2+1]):(b=g[0],w=g[1]),f=it(e,t,n,i,p,y,b,w),f.length!==0&&l.push(f[0],f[1]);return l},"polygonIntersectLine"),qd=v(function(e,t,a,n,i,s,o,u,l){var f=[],c,d=new Array(a.length*2);l.forEach(function(b,w){w===0?(d[d.length-2]=b.startX,d[d.length-1]=b.startY):(d[w*4-2]=b.startX,d[w*4-1]=b.startY),d[w*4]=b.stopX,d[w*4+1]=b.stopY,c=pa(e,t,n,i,b.cx,b.cy,b.radius),c.length!==0&&f.push(c[0],c[1])});for(var g=0;g<d.length/4;g++)c=it(e,t,n,i,d[g*4],d[g*4+1],d[g*4+2],d[g*4+3],!1),c.length!==0&&f.push(c[0],c[1]);if(f.length>2){for(var h=[f[0],f[1]],m=Math.pow(h[0]-e,2)+Math.pow(h[1]-t,2),p=1;p<f.length/2;p++){var y=Math.pow(f[p*2]-e,2)+Math.pow(f[p*2+1]-t,2);y<=m&&(h[0]=f[p*2],h[1]=f[p*2+1],m=y)}return h}return f},"roundPolygonIntersectLine"),Ya=v(function(e,t,a){var n=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),s=(i-a)/i;return s<0&&(s=1e-5),[t[0]+s*n[0],t[1]+s*n[1]]},"shortenIntersection"),yr=v(function(e,t){var a=Bs(e,t);return a=wv(a),a},"generateUnitNgonPointsFitToSquare"),wv=v(function(e){for(var t,a,n=e.length/2,i=1/0,s=1/0,o=-1/0,u=-1/0,l=0;l<n;l++)t=e[2*l],a=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),s=Math.min(s,a),u=Math.max(u,a);for(var f=2/(o-i),c=2/(u-s),d=0;d<n;d++)t=e[2*d]=e[2*d]*f,a=e[2*d+1]=e[2*d+1]*c,i=Math.min(i,t),o=Math.max(o,t),s=Math.min(s,a),u=Math.max(u,a);if(s<-1)for(var g=0;g<n;g++)a=e[2*g+1]=e[2*g+1]+(-1-s);return e},"fitPolygonToSquare"),Bs=v(function(e,t){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=t;for(var i=new Array(e*2),s,o=0;o<e;o++)s=o*a+n,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},"generateUnitNgonPoints"),vt=v(function(e,t){return Math.min(e/4,t/4,8)},"getRoundRectangleRadius"),xv=v(function(e,t){return Math.min(e/10,t/10,8)},"getRoundPolygonRadius"),ao=v(function(){return 8},"getCutRectangleCornerLength"),_d=v(function(e,t,a){return[e-2*t+a,2*(t-e),e]},"bezierPtsToQuadCoeff"),Ps=v(function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},"getBarrelCurveConstants");function pi(r,e){function t(c){for(var d=[],g=0;g<c.length;g++){var h=c[g],m=c[(g+1)%c.length],p={x:m.x-h.x,y:m.y-h.y},y={x:-p.y,y:p.x},b=Math.sqrt(y.x*y.x+y.y*y.y);d.push({x:y.x/b,y:y.y/b})}return d}v(t,"getAxes");function a(c,d){var g=1/0,h=-1/0,m=Tr(c),p;try{for(m.s();!(p=m.n()).done;){var y=p.value,b=y.x*d.x+y.y*d.y;g=Math.min(g,b),h=Math.max(h,b)}}catch(w){m.e(w)}finally{m.f()}return{min:g,max:h}}v(a,"project");function n(c,d){return!(c.max<d.min||d.max<c.min)}v(n,"overlaps");var i=[].concat(yn(t(r)),yn(t(e))),s=Tr(i),o;try{for(s.s();!(o=s.n()).done;){var u=o.value,l=a(r,u),f=a(e,u);if(!n(l,f))return!1}}catch(c){s.e(c)}finally{s.f()}return!0}v(pi,"satPolygonIntersection");var Gd=fr({dampingFactor:.8,precision:1e-6,iterations:200,weight:v(function(e){return 1},"weight")}),Hd={pageRank:v(function(e){for(var t=Gd(e),a=t.dampingFactor,n=t.precision,i=t.iterations,s=t.weight,o=this._private.cy,u=this.byGroup(),l=u.nodes,f=u.edges,c=l.length,d=c*c,g=f.length,h=new Array(d),m=new Array(c),p=(1-a)/c,y=0;y<c;y++){for(var b=0;b<c;b++){var w=y*c+b;h[w]=0}m[y]=0}for(var x=0;x<g;x++){var C=f[x],T=C.data("source"),E=C.data("target");if(T!==E){var S=l.indexOfId(T),D=l.indexOfId(E),B=s(C),P=D*c+S;h[P]+=B,m[S]+=B}}for(var A=1/c+p,R=0;R<c;R++)if(m[R]===0)for(var M=0;M<c;M++){var I=M*c+R;h[I]=A}else for(var O=0;O<c;O++){var L=O*c+R;h[L]=h[L]/m[R]+p}for(var N=new Array(c),_=new Array(c),G,z=0;z<c;z++)N[z]=1;for(var V=0;V<i;V++){for(var K=0;K<c;K++)_[K]=0;for(var j=0;j<c;j++)for(var Q=0;Q<c;Q++){var ee=j*c+Q;_[j]+=h[ee]*N[Q]}Cd(_),G=N,N=_,_=G;for(var te=0,ie=0;ie<c;ie++){var J=G[ie]-N[ie];te+=J*J}if(te<n)break}var q={rank:v(function($){return $=o.collection($)[0],N[l.indexOf($)]},"rank")};return q},"pageRank")},Ko=fr({root:null,weight:v(function(e){return 1},"weight"),directed:!1,alpha:0}),Kt={degreeCentralityNormalized:v(function(e){e=Ko(e);var t=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},c={},d=0,g=0,h=0;h<n;h++){var m=a[h],p=m.id();e.root=m;var y=this.degreeCentrality(e);d<y.indegree&&(d=y.indegree),g<y.outdegree&&(g=y.outdegree),f[p]=y.indegree,c[p]=y.outdegree}return{indegree:v(function(w){return d==0?0:(ge(w)&&(w=t.filter(w)),f[w.id()]/d)},"indegree"),outdegree:v(function(w){return g===0?0:(ge(w)&&(w=t.filter(w)),c[w.id()]/g)},"outdegree")}}else{for(var i={},s=0,o=0;o<n;o++){var u=a[o];e.root=u;var l=this.degreeCentrality(e);s<l.degree&&(s=l.degree),i[u.id()]=l.degree}return{degree:v(function(w){return s===0?0:(ge(w)&&(w=t.filter(w)),i[w.id()]/s)},"degree")}}},"degreeCentralityNormalized"),degreeCentrality:v(function(e){e=Ko(e);var t=this.cy(),a=this,n=e,i=n.root,s=n.weight,o=n.directed,u=n.alpha;if(i=t.collection(i)[0],o){for(var g=i.connectedEdges(),h=g.filter(function(T){return T.target().same(i)&&a.has(T)}),m=g.filter(function(T){return T.source().same(i)&&a.has(T)}),p=h.length,y=m.length,b=0,w=0,x=0;x<h.length;x++)b+=s(h[x]);for(var C=0;C<m.length;C++)w+=s(m[C]);return{indegree:Math.pow(p,1-u)*Math.pow(b,u),outdegree:Math.pow(y,1-u)*Math.pow(w,u)}}else{for(var l=i.connectedEdges().intersection(a),f=l.length,c=0,d=0;d<l.length;d++)c+=s(l[d]);return{degree:Math.pow(f,1-u)*Math.pow(c,u)}}},"degreeCentrality")};Kt.dc=Kt.degreeCentrality;Kt.dcn=Kt.degreeCentralityNormalised=Kt.degreeCentralityNormalized;var Xo=fr({harmonic:!0,weight:v(function(){return 1},"weight"),directed:!1,root:null}),Xt={closenessCentralityNormalized:v(function(e){for(var t=Xo(e),a=t.harmonic,n=t.weight,i=t.directed,s=this.cy(),o={},u=0,l=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),c=0;c<l.length;c++){for(var d=0,g=l[c],h=0;h<l.length;h++)if(c!==h){var m=f.distance(g,l[h]);a?d+=1/m:d+=m}a||(d=1/d),u<d&&(u=d),o[g.id()]=d}return{closeness:v(function(y){return u==0?0:(ge(y)?y=s.filter(y)[0].id():y=y.id(),o[y]/u)},"closeness")}},"closenessCentralityNormalized"),closenessCentrality:v(function(e){var t=Xo(e),a=t.root,n=t.weight,i=t.directed,s=t.harmonic;a=this.filter(a)[0];for(var o=this.dijkstra({root:a,weight:n,directed:i}),u=0,l=this.nodes(),f=0;f<l.length;f++){var c=l[f];if(!c.same(a)){var d=o.distanceTo(c);s?u+=1/d:u+=d}}return s?u:1/u},"closenessCentrality")};Xt.cc=Xt.closenessCentrality;Xt.ccn=Xt.closenessCentralityNormalised=Xt.closenessCentralityNormalized;var Wd=fr({weight:null,directed:!1}),As={betweennessCentrality:v(function(e){for(var t=Wd(e),a=t.directed,n=t.weight,i=n!=null,s=this.cy(),o=this.nodes(),u={},l={},f=0,c={set:v(function(w,x){l[w]=x,x>f&&(f=x)},"set"),get:v(function(w){return l[w]},"get")},d=0;d<o.length;d++){var g=o[d],h=g.id();a?u[h]=g.outgoers().nodes():u[h]=g.openNeighborhood().nodes(),c.set(h,0)}for(var m=v(function(){for(var w=o[p].id(),x=[],C={},T={},E={},S=new Fa(function(j,Q){return E[j]-E[Q]}),D=0;D<o.length;D++){var B=o[D].id();C[B]=[],T[B]=0,E[B]=1/0}for(T[w]=1,E[w]=0,S.push(w);!S.empty();){var P=S.pop();if(x.push(P),i)for(var A=0;A<u[P].length;A++){var R=u[P][A],M=s.getElementById(P),I=void 0;M.edgesTo(R).length>0?I=M.edgesTo(R)[0]:I=R.edgesTo(M)[0];var O=n(I);R=R.id(),E[R]>E[P]+O&&(E[R]=E[P]+O,S.nodes.indexOf(R)<0?S.push(R):S.updateItem(R),T[R]=0,C[R]=[]),E[R]==E[P]+O&&(T[R]=T[R]+T[P],C[R].push(P))}else for(var L=0;L<u[P].length;L++){var N=u[P][L].id();E[N]==1/0&&(S.push(N),E[N]=E[P]+1),E[N]==E[P]+1&&(T[N]=T[N]+T[P],C[N].push(P))}}for(var _={},G=0;G<o.length;G++)_[o[G].id()]=0;for(;x.length>0;){for(var z=x.pop(),V=0;V<C[z].length;V++){var K=C[z][V];_[K]=_[K]+T[K]/T[z]*(1+_[z])}z!=o[p].id()&&c.set(z,c.get(z)+_[z])}},"_loop"),p=0;p<o.length;p++)m();var y={betweenness:v(function(w){var x=s.collection(w).id();return c.get(x)},"betweenness"),betweennessNormalized:v(function(w){if(f==0)return 0;var x=s.collection(w).id();return c.get(x)/f},"betweennessNormalized")};return y.betweennessNormalised=y.betweennessNormalized,y},"betweennessCentrality")};As.bc=As.betweennessCentrality;var $d=fr({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),Ud=v(function(e){return $d(e)},"setOptions"),Kd=v(function(e,t){for(var a=0,n=0;n<t.length;n++)a+=t[n](e);return a},"getSimilarity"),Xd=v(function(e,t,a){for(var n=0;n<t;n++)e[n*t+n]=a},"addLoops"),Ev=v(function(e,t){for(var a,n=0;n<t;n++){a=0;for(var i=0;i<t;i++)a+=e[i*t+n];for(var s=0;s<t;s++)e[s*t+n]=e[s*t+n]/a}},"normalize"),Yd=v(function(e,t,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var s=0;s<a;s++)n[i*a+s]=0;for(var o=0;o<a;o++)for(var u=0;u<a;u++)n[i*a+u]+=e[i*a+o]*t[o*a+u]}return n},"mmult"),Zd=v(function(e,t,a){for(var n=e.slice(0),i=1;i<a;i++)e=Yd(e,n,t);return e},"expand"),Qd=v(function(e,t,a){for(var n=new Array(t*t),i=0;i<t*t;i++)n[i]=Math.pow(e[i],a);return Ev(n,t),n},"inflate"),Jd=v(function(e,t,a,n){for(var i=0;i<a;i++){var s=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),o=Math.round(t[i]*Math.pow(10,n))/Math.pow(10,n);if(s!==o)return!1}return!0},"hasConverged"),jd=v(function(e,t,a,n){for(var i=[],s=0;s<t;s++){for(var o=[],u=0;u<t;u++)Math.round(e[s*t+u]*1e3)/1e3>0&&o.push(a[u]);o.length!==0&&i.push(n.collection(o))}return i},"assign"),eh=v(function(e,t){for(var a=0;a<e.length;a++)if(!t[a]||e[a].id()!==t[a].id())return!1;return!0},"isDuplicate"),rh=v(function(e){for(var t=0;t<e.length;t++)for(var a=0;a<e.length;a++)t!=a&&eh(e[t],e[a])&&e.splice(a,1);return e},"removeDuplicates"),Yo=v(function(e){for(var t=this.nodes(),a=this.edges(),n=this.cy(),i=Ud(e),s={},o=0;o<t.length;o++)s[t[o].id()]=o;for(var u=t.length,l=u*u,f=new Array(l),c,d=0;d<l;d++)f[d]=0;for(var g=0;g<a.length;g++){var h=a[g],m=s[h.source().id()],p=s[h.target().id()],y=Kd(h,i.attributes);f[m*u+p]+=y,f[p*u+m]+=y}Xd(f,u,i.multFactor),Ev(f,u);for(var b=!0,w=0;b&&w<i.maxIterations;)b=!1,c=Zd(f,u,i.expandFactor),f=Qd(c,u,i.inflateFactor),Jd(f,c,l,4)||(b=!0),w++;var x=jd(f,u,t,n);return x=rh(x),x},"markovClustering"),th={markovClustering:Yo,mcl:Yo},ah=v(function(e){return e},"identity"),Cv=v(function(e,t){return Math.abs(t-e)},"absDiff"),Zo=v(function(e,t,a){return e+Cv(t,a)},"addAbsDiff"),Qo=v(function(e,t,a){return e+Math.pow(a-t,2)},"addSquaredDiff"),nh=v(function(e){return Math.sqrt(e)},"sqrt"),ih=v(function(e,t,a){return Math.max(e,Cv(t,a))},"maxAbsDiff"),la=v(function(e,t,a,n,i){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:ah,o=n,u,l,f=0;f<e;f++)u=t(f),l=a(f),o=i(o,u,l);return s(o)},"getDistance"),Qt={euclidean:v(function(e,t,a){return e>=2?la(e,t,a,0,Qo,nh):la(e,t,a,0,Zo)},"euclidean"),squaredEuclidean:v(function(e,t,a){return la(e,t,a,0,Qo)},"squaredEuclidean"),manhattan:v(function(e,t,a){return la(e,t,a,0,Zo)},"manhattan"),max:v(function(e,t,a){return la(e,t,a,-1/0,ih)},"max")};Qt["squared-euclidean"]=Qt.squaredEuclidean;Qt.squaredeuclidean=Qt.squaredEuclidean;function On(r,e,t,a,n,i){var s;return Ue(r)?s=r:s=Qt[r]||Qt.euclidean,e===0&&Ue(r)?s(n,i):s(e,t,a,n,i)}v(On,"clusteringDistance");var sh=fr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),no=v(function(e){return sh(e)},"setOptions"),Cn=v(function(e,t,a,n,i){var s=i!=="kMedoids",o=s?function(c){return a[c]}:function(c){return n[c](a)},u=v(function(d){return n[d](t)},"getQ"),l=a,f=t;return On(e,n.length,o,u,l,f)},"getDist"),yi=v(function(e,t,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(t),u=null,l=0;l<n;l++)i[l]=e.min(a[l]).value,s[l]=e.max(a[l]).value;for(var f=0;f<t;f++){u=[];for(var c=0;c<n;c++)u[c]=Math.random()*(s[c]-i[c])+i[c];o[f]=u}return o},"randomCentroids"),Tv=v(function(e,t,a,n,i){for(var s=1/0,o=0,u=0;u<t.length;u++){var l=Cn(a,e,t[u],n,i);l<s&&(s=l,o=u)}return o},"classify"),Sv=v(function(e,t,a){for(var n=[],i=null,s=0;s<t.length;s++)i=t[s],a[i.id()]===e&&n.push(i);return n},"buildCluster"),oh=v(function(e,t,a){return Math.abs(t-e)<=a},"haveValuesConverged"),uh=v(function(e,t,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var s=Math.abs(e[n][i]-t[n][i]);if(s>a)return!1}return!0},"haveMatricesConverged"),lh=v(function(e,t,a){for(var n=0;n<a;n++)if(e===t[n])return!0;return!1},"seenBefore"),Jo=v(function(e,t){var a=new Array(t);if(e.length<50)for(var n=0;n<t;n++){for(var i=e[Math.floor(Math.random()*e.length)];lh(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var s=0;s<t;s++)a[s]=e[Math.floor(Math.random()*e.length)];return a},"randomMedoids"),jo=v(function(e,t,a){for(var n=0,i=0;i<t.length;i++)n+=Cn("manhattan",t[i],e,a,"kMedoids");return n},"findCost"),vh=v(function(e){var t=this.cy(),a=this.nodes(),n=null,i=no(e),s=new Array(i.k),o={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=yi(a,i.k,i.attributes)):tr(i.testCentroids)==="object"?u=i.testCentroids:u=yi(a,i.k,i.attributes):u=yi(a,i.k,i.attributes);for(var l=!0,f=0;l&&f<i.maxIterations;){for(var c=0;c<a.length;c++)n=a[c],o[n.id()]=Tv(n,u,i.distance,i.attributes,"kMeans");l=!1;for(var d=0;d<i.k;d++){var g=Sv(d,a,o);if(g.length!==0){for(var h=i.attributes.length,m=u[d],p=new Array(h),y=new Array(h),b=0;b<h;b++){y[b]=0;for(var w=0;w<g.length;w++)n=g[w],y[b]+=i.attributes[b](n);p[b]=y[b]/g.length,oh(p[b],m[b],i.sensitivityThreshold)||(l=!0)}u[d]=p,s[d]=t.collection(g)}}f++}return s},"kMeans"),fh=v(function(e){var t=this.cy(),a=this.nodes(),n=null,i=no(e),s=new Array(i.k),o,u={},l,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(tr(i.testCentroids)==="object"?o=i.testCentroids:o=Jo(a,i.k)):o=Jo(a,i.k);for(var c=!0,d=0;c&&d<i.maxIterations;){for(var g=0;g<a.length;g++)n=a[g],u[n.id()]=Tv(n,o,i.distance,i.attributes,"kMedoids");c=!1;for(var h=0;h<o.length;h++){var m=Sv(h,a,u);if(m.length!==0){f[h]=jo(o[h],m,i.attributes);for(var p=0;p<m.length;p++)l=jo(m[p],m,i.attributes),l<f[h]&&(f[h]=l,o[h]=m[p],c=!0);s[h]=t.collection(m)}}d++}return s},"kMedoids"),ch=v(function(e,t,a,n,i){for(var s,o,u=0;u<t.length;u++)for(var l=0;l<e.length;l++)n[u][l]=Math.pow(a[u][l],i.m);for(var f=0;f<e.length;f++)for(var c=0;c<i.attributes.length;c++){s=0,o=0;for(var d=0;d<t.length;d++)s+=n[d][f]*i.attributes[c](t[d]),o+=n[d][f];e[f][c]=s/o}},"updateCentroids"),dh=v(function(e,t,a,n,i){for(var s=0;s<e.length;s++)t[s]=e[s].slice();for(var o,u,l,f=2/(i.m-1),c=0;c<a.length;c++)for(var d=0;d<n.length;d++){o=0;for(var g=0;g<a.length;g++)u=Cn(i.distance,n[d],a[c],i.attributes,"cmeans"),l=Cn(i.distance,n[d],a[g],i.attributes,"cmeans"),o+=Math.pow(u/l,f);e[d][c]=1/o}},"updateMembership"),hh=v(function(e,t,a,n){for(var i=new Array(a.k),s=0;s<i.length;s++)i[s]=[];for(var o,u,l=0;l<t.length;l++){o=-1/0,u=-1;for(var f=0;f<t[0].length;f++)t[l][f]>o&&(o=t[l][f],u=f);i[u].push(e[l])}for(var c=0;c<i.length;c++)i[c]=n.collection(i[c]);return i},"assign"),eu=v(function(e){var t=this.cy(),a=this.nodes(),n=no(e),i,s,o,u,l;u=new Array(a.length);for(var f=0;f<a.length;f++)u[f]=new Array(n.k);o=new Array(a.length);for(var c=0;c<a.length;c++)o[c]=new Array(n.k);for(var d=0;d<a.length;d++){for(var g=0,h=0;h<n.k;h++)o[d][h]=Math.random(),g+=o[d][h];for(var m=0;m<n.k;m++)o[d][m]=o[d][m]/g}s=new Array(n.k);for(var p=0;p<n.k;p++)s[p]=new Array(n.attributes.length);l=new Array(a.length);for(var y=0;y<a.length;y++)l[y]=new Array(n.k);for(var b=!0,w=0;b&&w<n.maxIterations;)b=!1,ch(s,a,o,l,n),dh(o,u,s,a,n),uh(o,u,n.sensitivityThreshold)||(b=!0),w++;return i=hh(a,o,n,t),{clusters:i,degreeOfMembership:o}},"fuzzyCMeans"),gh={kMeans:vh,kMedoids:fh,fuzzyCMeans:eu,fcm:eu},ph=fr({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),yh={single:"min",complete:"max"},mh=v(function(e){var t=ph(e),a=yh[t.linkage];return a!=null&&(t.linkage=a),t},"setOptions"),ru=v(function(e,t,a,n,i){for(var s=0,o=1/0,u,l=i.attributes,f=v(function(D,B){return On(i.distance,l.length,function(P){return l[P](D)},function(P){return l[P](B)},D,B)},"getDist"),c=0;c<e.length;c++){var d=e[c].key,g=a[d][n[d]];g<o&&(s=d,o=g)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var h=t[s],m=t[n[s]],p;i.mode==="dendrogram"?p={left:h,right:m,key:h.key}:p={value:h.value.concat(m.value),key:h.key},e[h.index]=p,e.splice(m.index,1),t[h.key]=p;for(var y=0;y<e.length;y++){var b=e[y];h.key===b.key?u=1/0:i.linkage==="min"?(u=a[h.key][b.key],a[h.key][b.key]>a[m.key][b.key]&&(u=a[m.key][b.key])):i.linkage==="max"?(u=a[h.key][b.key],a[h.key][b.key]<a[m.key][b.key]&&(u=a[m.key][b.key])):i.linkage==="mean"?u=(a[h.key][b.key]*h.size+a[m.key][b.key]*m.size)/(h.size+m.size):i.mode==="dendrogram"?u=f(b.value,h.value):u=f(b.value[0],h.value[0]),a[h.key][b.key]=a[b.key][h.key]=u}for(var w=0;w<e.length;w++){var x=e[w].key;if(n[x]===h.key||n[x]===m.key){for(var C=x,T=0;T<e.length;T++){var E=e[T].key;a[x][E]<a[x][C]&&(C=E)}n[x]=C}e[w].index=w}return h.key=m.key=h.index=m.index=null,!0},"mergeClosest"),Wt=v(function(e,t,a){e&&(e.value?t.push(e.value):(e.left&&Wt(e.left,t),e.right&&Wt(e.right,t)))},"getAllChildren"),Rs=v(function(e,t){if(!e)return"";if(e.left&&e.right){var a=Rs(e.left,t),n=Rs(e.right,t),i=t.add({group:"nodes",data:{id:a+","+n}});return t.add({group:"edges",data:{source:a,target:i.id()}}),t.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},"buildDendrogram"),Ms=v(function(e,t,a){if(!e)return[];var n=[],i=[],s=[];return t===0?(e.left&&Wt(e.left,n),e.right&&Wt(e.right,i),s=n.concat(i),[a.collection(s)]):t===1?e.value?[a.collection(e.value)]:(e.left&&Wt(e.left,n),e.right&&Wt(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=Ms(e.left,t-1,a)),e.right&&(i=Ms(e.right,t-1,a)),n.concat(i))},"buildClustersFromTree"),tu=v(function(e){for(var t=this.cy(),a=this.nodes(),n=mh(e),i=n.attributes,s=v(function(w,x){return On(n.distance,i.length,function(C){return i[C](w)},function(C){return i[C](x)},w,x)},"getDist"),o=[],u=[],l=[],f=[],c=0;c<a.length;c++){var d={value:n.mode==="dendrogram"?a[c]:[a[c]],key:c,index:c};o[c]=d,f[c]=d,u[c]=[],l[c]=0}for(var g=0;g<o.length;g++)for(var h=0;h<=g;h++){var m=void 0;n.mode==="dendrogram"?m=g===h?1/0:s(o[g].value,o[h].value):m=g===h?1/0:s(o[g].value[0],o[h].value[0]),u[g][h]=m,u[h][g]=m,m<u[g][l[g]]&&(l[g]=h)}for(var p=ru(o,f,u,l,n);p;)p=ru(o,f,u,l,n);var y;return n.mode==="dendrogram"?(y=Ms(o[0],n.dendrogramDepth,t),n.addDendrogram&&Rs(o[0],t)):(y=new Array(o.length),o.forEach(function(b,w){b.key=b.index=null,y[w]=t.collection(b.value)})),y},"hierarchicalClustering"),bh={hierarchicalClustering:tu,hca:tu},wh=fr({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),xh=v(function(e){var t=e.damping,a=e.preference;.5<=t&&t<1||We("Damping must range on [0.5, 1). Got: ".concat(t));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||ne(a)||We("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),wh(e)},"setOptions"),Eh=v(function(e,t,a,n){var i=v(function(o,u){return n[u](o)},"attr");return-On(e,n.length,function(s){return i(t,s)},function(s){return i(a,s)},t,a)},"getSimilarity"),Ch=v(function(e,t){var a=null;return t==="median"?a=xd(e):t==="mean"?a=wd(e):t==="min"?a=md(e):t==="max"?a=bd(e):a=t,a},"getPreference"),Th=v(function(e,t,a){for(var n=[],i=0;i<e;i++)t[i*e+i]+a[i*e+i]>0&&n.push(i);return n},"findExemplars"),au=v(function(e,t,a){for(var n=[],i=0;i<e;i++){for(var s=-1,o=-1/0,u=0;u<a.length;u++){var l=a[u];t[i*e+l]>o&&(s=l,o=t[i*e+l])}s>0&&n.push(s)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},"assignClusters"),Sh=v(function(e,t,a){for(var n=au(e,t,a),i=0;i<a.length;i++){for(var s=[],o=0;o<n.length;o++)n[o]===a[i]&&s.push(o);for(var u=-1,l=-1/0,f=0;f<s.length;f++){for(var c=0,d=0;d<s.length;d++)c+=t[s[d]*e+s[f]];c>l&&(u=f,l=c)}a[i]=s[u]}return n=au(e,t,a),n},"assign"),nu=v(function(e){for(var t=this.cy(),a=this.nodes(),n=xh(e),i={},s=0;s<a.length;s++)i[a[s].id()]=s;var o,u,l,f,c,d;o=a.length,u=o*o,l=new Array(u);for(var g=0;g<u;g++)l[g]=-1/0;for(var h=0;h<o;h++)for(var m=0;m<o;m++)h!==m&&(l[h*o+m]=Eh(n.distance,a[h],a[m],n.attributes));f=Ch(l,n.preference);for(var p=0;p<o;p++)l[p*o+p]=f;c=new Array(u);for(var y=0;y<u;y++)c[y]=0;d=new Array(u);for(var b=0;b<u;b++)d[b]=0;for(var w=new Array(o),x=new Array(o),C=new Array(o),T=0;T<o;T++)w[T]=0,x[T]=0,C[T]=0;for(var E=new Array(o*n.minIterations),S=0;S<E.length;S++)E[S]=0;var D;for(D=0;D<n.maxIterations;D++){for(var B=0;B<o;B++){for(var P=-1/0,A=-1/0,R=-1,M=0,I=0;I<o;I++)w[I]=c[B*o+I],M=d[B*o+I]+l[B*o+I],M>=P?(A=P,P=M,R=I):M>A&&(A=M);for(var O=0;O<o;O++)c[B*o+O]=(1-n.damping)*(l[B*o+O]-P)+n.damping*w[O];c[B*o+R]=(1-n.damping)*(l[B*o+R]-A)+n.damping*w[R]}for(var L=0;L<o;L++){for(var N=0,_=0;_<o;_++)w[_]=d[_*o+L],x[_]=Math.max(0,c[_*o+L]),N+=x[_];N-=x[L],x[L]=c[L*o+L],N+=x[L];for(var G=0;G<o;G++)d[G*o+L]=(1-n.damping)*Math.min(0,N-x[G])+n.damping*w[G];d[L*o+L]=(1-n.damping)*(N-x[L])+n.damping*w[L]}for(var z=0,V=0;V<o;V++){var K=d[V*o+V]+c[V*o+V]>0?1:0;E[D%n.minIterations*o+V]=K,z+=K}if(z>0&&(D>=n.minIterations-1||D==n.maxIterations-1)){for(var j=0,Q=0;Q<o;Q++){C[Q]=0;for(var ee=0;ee<n.minIterations;ee++)C[Q]+=E[ee*o+Q];(C[Q]===0||C[Q]===n.minIterations)&&j++}if(j===o)break}}for(var te=Th(o,c,d),ie=Sh(o,l,te),J={},q=0;q<te.length;q++)J[te[q]]=[];for(var W=0;W<a.length;W++){var $=i[a[W].id()],Z=ie[$];Z!=null&&J[Z].push(a[W])}for(var ae=new Array(te.length),de=0;de<te.length;de++)ae[de]=t.collection(J[te[de]]);return ae},"affinityPropagation"),kh={affinityPropagation:nu,ap:nu},Dh=fr({root:void 0,directed:!1}),Bh={hierholzer:v(function(e){if(!Le(e)){var t=arguments;e={root:t[0],directed:t[1]}}var a=Dh(e),n=a.root,i=a.directed,s=this,o=!1,u,l,f;n&&(f=ge(n)?this.filter(n)[0].id():n[0].id());var c={},d={};i?s.forEach(function(b){var w=b.id();if(b.isNode()){var x=b.indegree(!0),C=b.outdegree(!0),T=x-C,E=C-x;T==1?u?o=!0:u=w:E==1?l?o=!0:l=w:(E>1||T>1)&&(o=!0),c[w]=[],b.outgoers().forEach(function(S){S.isEdge()&&c[w].push(S.id())})}else d[w]=[void 0,b.target().id()]}):s.forEach(function(b){var w=b.id();if(b.isNode()){var x=b.degree(!0);x%2&&(u?l?o=!0:l=w:u=w),c[w]=[],b.connectedEdges().forEach(function(C){return c[w].push(C.id())})}else d[w]=[b.source().id(),b.target().id()]});var g={found:!1,trail:void 0};if(o)return g;if(l&&u)if(i){if(f&&l!=f)return g;f=l}else{if(f&&l!=f&&u!=f)return g;f||(f=l)}else f||(f=s[0].id());var h=v(function(w){for(var x=w,C=[w],T,E,S;c[x].length;)T=c[x].shift(),E=d[T][0],S=d[T][1],x!=S?(c[S]=c[S].filter(function(D){return D!=T}),x=S):!i&&x!=E&&(c[E]=c[E].filter(function(D){return D!=T}),x=E),C.unshift(T),C.unshift(x);return C},"walk"),m=[],p=[];for(p=h(f);p.length!=1;)c[p[0]].length==0?(m.unshift(s.getElementById(p.shift())),m.unshift(s.getElementById(p.shift()))):p=h(p.shift()).concat(p);m.unshift(s.getElementById(p.shift()));for(var y in c)if(c[y].length)return g;return g.found=!0,g.trail=this.spawn(m,!0),g},"hierholzer")},Za=v(function(){var e=this,t={},a=0,n=0,i=[],s=[],o={},u=v(function(d,g){for(var h=s.length-1,m=[],p=e.spawn();s[h].x!=d||s[h].y!=g;)m.push(s.pop().edge),h--;m.push(s.pop().edge),m.forEach(function(y){var b=y.connectedNodes().intersection(e);p.merge(y),b.forEach(function(w){var x=w.id(),C=w.connectedEdges().intersection(e);p.merge(w),t[x].cutVertex?p.merge(C.filter(function(T){return T.isLoop()})):p.merge(C)})}),i.push(p)},"buildComponent"),l=v(function(d,g,h){d===h&&(n+=1),t[g]={id:a,low:a++,cutVertex:!1};var m=e.getElementById(g).connectedEdges().intersection(e);if(m.size()===0)i.push(e.spawn(e.getElementById(g)));else{var p,y,b,w;m.forEach(function(x){p=x.source().id(),y=x.target().id(),b=p===g?y:p,b!==h&&(w=x.id(),o[w]||(o[w]=!0,s.push({x:g,y:b,edge:x})),b in t?t[g].low=Math.min(t[g].low,t[b].id):(l(d,b,g),t[g].low=Math.min(t[g].low,t[b].low),t[g].id<=t[b].low&&(t[g].cutVertex=!0,u(g,b))))})}},"biconnectedSearch");e.forEach(function(c){if(c.isNode()){var d=c.id();d in t||(n=0,l(d,d),t[d].cutVertex=n>1)}});var f=Object.keys(t).filter(function(c){return t[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(f),components:i}},"hopcroftTarjanBiconnected"),Ph={hopcroftTarjanBiconnected:Za,htbc:Za,htb:Za,hopcroftTarjanBiconnectedComponents:Za},Qa=v(function(){var e=this,t={},a=0,n=[],i=[],s=e.spawn(e),o=v(function(l){i.push(l),t[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(m){var p=m.target().id();p!==l&&(p in t||o(p),t[p].explored||(t[l].low=Math.min(t[l].low,t[p].low)))}),t[l].index===t[l].low){for(var c=e.spawn();;){var d=i.pop();if(c.merge(e.getElementById(d)),t[d].low=t[l].index,t[d].explored=!0,d===l)break}var g=c.edgesWith(c),h=c.merge(g);n.push(h),s=s.difference(h)}},"stronglyConnectedSearch");return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||o(l)}}),{cut:s,components:n}},"tarjanStronglyConnected"),Ah={tarjanStronglyConnected:Qa,tsc:Qa,tscc:Qa,tarjanStronglyConnectedComponents:Qa},kv={};[Ta,sd,od,ld,fd,dd,pd,Hd,Kt,Xt,As,th,gh,bh,kh,Bh,Ph,Ah].forEach(function(r){me(kv,r)});var Dv=0,Bv=1,Pv=2,Nr=v(function(e){if(!(this instanceof Nr))return new Nr(e);this.id="Thenable/1.0.7",this.state=Dv,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))},"api");Nr.prototype={fulfill:v(function(e){return iu(this,Bv,"fulfillValue",e)},"fulfill"),reject:v(function(e){return iu(this,Pv,"rejectReason",e)},"reject"),then:v(function(e,t){var a=this,n=new Nr;return a.onFulfilled.push(ou(e,n,"fulfill")),a.onRejected.push(ou(t,n,"reject")),Av(a),n.proxy},"then")};var iu=v(function(e,t,a,n){return e.state===Dv&&(e.state=t,e[a]=n,Av(e)),e},"deliver"),Av=v(function(e){e.state===Bv?su(e,"onFulfilled",e.fulfillValue):e.state===Pv&&su(e,"onRejected",e.rejectReason)},"execute"),su=v(function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=v(function(){for(var o=0;o<n.length;o++)n[o](a)},"func");typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},"execute_handlers"),ou=v(function(e,t,a){return function(n){if(typeof e!="function")t[a].call(t,n);else{var i;try{i=e(n)}catch(s){t.reject(s);return}Rv(t,i)}}},"resolver"),Rv=v(function(e,t){if(e===t||e.proxy===t){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(tr(t)==="object"&&t!==null||typeof t=="function")try{a=t.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(t,function(i){n||(n=!0,i===t?e.reject(new TypeError("circular thenable chain")):Rv(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(t)},"resolve");Nr.all=function(r){return new Nr(function(e,t){for(var a=new Array(r.length),n=0,i=v(function(u,l){a[u]=l,n++,n===r.length&&e(a)},"fulfill"),s=0;s<r.length;s++)(function(o){var u=r[o],l=u!=null&&u.then!=null;if(l)u.then(function(c){i(o,c)},function(c){t(c)});else{var f=u;i(o,f)}})(s)})};Nr.resolve=function(r){return new Nr(function(e,t){e(r)})};Nr.reject=function(r){return new Nr(function(e,t){t(r)})};var ra=typeof Promise<"u"?Promise:Nr,Ls=v(function(e,t,a){var n=Xs(e),i=!n,s=this._private=me({duration:1e3},t,a);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&Ue(s.complete)&&s.completes.push(s.complete),i){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(n){var u=e.pan();s.startPan={x:u.x,y:u.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},"Animation"),At=Ls.prototype;me(At,{instanceString:v(function(){return"animation"},"instanceString"),hook:v(function(){var e=this._private;if(!e.hooked){var t,a=e.target._private.animation;e.queue?t=a.queue:t=a.current,t.push(this),Sr(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},"hook"),play:v(function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},"play"),playing:v(function(){return this._private.playing},"playing"),apply:v(function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},"apply"),applying:v(function(){return this._private.applying},"applying"),pause:v(function(){var e=this._private;return e.playing=!1,e.started=!1,this},"pause"),stop:v(function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},"stop"),rewind:v(function(){return this.progress(0)},"rewind"),fastforward:v(function(){return this.progress(1)},"fastforward"),time:v(function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},"time"),progress:v(function(e){var t=this._private,a=t.playing;return e===void 0?t.progress:(a&&this.pause(),t.progress=e,t.started=!1,a&&this.play(),this)},"progress"),completed:v(function(){return this._private.progress===1},"completed"),reverse:v(function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=v(function(l,f){var c=e[l];c!=null&&(e[l]=e[f],e[f]=c)},"swap");if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],s=i.name,o=e.startStyle[s];e.startStyle[s]=i,e.style[n]=o}return t&&this.play(),this},"reverse"),promise:v(function(e){var t=this._private,a;switch(e){case"frame":a=t.frames;break;default:case"complete":case"completed":a=t.completes}return new ra(function(n,i){a.push(function(){n()})})},"promise")});At.complete=At.completed;At.run=At.play;At.running=At.playing;var Rh={animated:v(function(){return v(function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return!1;var s=n[0];if(s)return s._private.animation.current.length>0},"animatedImpl")},"animated"),clearQueue:v(function(){return v(function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s<n.length;s++){var o=n[s];o._private.animation.queue=[]}return this},"clearQueueImpl")},"clearQueue"),delay:v(function(){return v(function(t,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:t,duration:t,complete:a}):this},"delayImpl")},"delay"),delayAnimation:v(function(){return v(function(t,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:t,duration:t,complete:a}):this},"delayAnimationImpl")},"delayAnimation"),animation:v(function(){return v(function(t,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this,u=!i,l=!u;if(!o.styleEnabled())return this;var f=o.style();t=me({},t,a);var c=Object.keys(t).length===0;if(c)return new Ls(s[0],t);switch(t.duration===void 0&&(t.duration=400),t.duration){case"slow":t.duration=600;break;case"fast":t.duration=200;break}if(l&&(t.style=f.getPropsList(t.style||t.css),t.css=void 0),l&&t.renderedPosition!=null){var d=t.renderedPosition,g=o.pan(),h=o.zoom();t.position=pv(d,h,g)}if(u&&t.panBy!=null){var m=t.panBy,p=o.pan();t.pan={x:p.x+m.x,y:p.y+m.y}}var y=t.center||t.centre;if(u&&y!=null){var b=o.getCenterPan(y.eles,t.zoom);b!=null&&(t.pan=b)}if(u&&t.fit!=null){var w=t.fit,x=o.getFitViewport(w.eles||w.boundingBox,w.padding);x!=null&&(t.pan=x.pan,t.zoom=x.zoom)}if(u&&Le(t.zoom)){var C=o.getZoomedViewport(t.zoom);C!=null?(C.zoomed&&(t.zoom=C.zoom),C.panned&&(t.pan=C.pan)):t.zoom=null}return new Ls(s[0],t)},"animationImpl")},"animation"),animate:v(function(){return v(function(t,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;a&&(t=me({},t,a));for(var u=0;u<s.length;u++){var l=s[u],f=l.animated()&&(t.queue===void 0||t.queue),c=l.animation(t,f?{queue:!0}:void 0);c.play()}return this},"animateImpl")},"animate"),stop:v(function(){return v(function(t,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var u=0;u<s.length;u++){for(var l=s[u],f=l._private,c=f.animation.current,d=0;d<c.length;d++){var g=c[d],h=g._private;a&&(h.duration=0)}t&&(f.animation.queue=[]),a||(f.animation.current=[])}return o.notify("draw"),this},"stopImpl")},"stop")},mi,uu;function Nn(){if(uu)return mi;uu=1;var r=Array.isArray;return mi=r,mi}v(Nn,"requireIsArray");var bi,lu;function Mh(){if(lu)return bi;lu=1;var r=Nn(),e=Na(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function n(i,s){if(r(i))return!1;var o=typeof i;return o=="number"||o=="symbol"||o=="boolean"||i==null||e(i)?!0:a.test(i)||!t.test(i)||s!=null&&i in Object(s)}return v(n,"isKey"),bi=n,bi}v(Mh,"require_isKey");var wi,vu;function Lh(){if(vu)return wi;vu=1;var r=ov(),e=Oa(),t="[object AsyncFunction]",a="[object Function]",n="[object GeneratorFunction]",i="[object Proxy]";function s(o){if(!e(o))return!1;var u=r(o);return u==a||u==n||u==t||u==i}return v(s,"isFunction"),wi=s,wi}v(Lh,"requireIsFunction");var xi,fu;function Ih(){if(fu)return xi;fu=1;var r=Mn(),e=r["__core-js_shared__"];return xi=e,xi}v(Ih,"require_coreJsData");var Ei,cu;function Oh(){if(cu)return Ei;cu=1;var r=Ih(),e=(function(){var a=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function t(a){return!!e&&e in a}return v(t,"isMasked"),Ei=t,Ei}v(Oh,"require_isMasked");var Ci,du;function Nh(){if(du)return Ci;du=1;var r=Function.prototype,e=r.toString;function t(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return v(t,"toSource"),Ci=t,Ci}v(Nh,"require_toSource");var Ti,hu;function zh(){if(hu)return Ti;hu=1;var r=Lh(),e=Oh(),t=Oa(),a=Nh(),n=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,u=s.toString,l=o.hasOwnProperty,f=RegExp("^"+u.call(l).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function c(d){if(!t(d)||e(d))return!1;var g=r(d)?f:i;return g.test(a(d))}return v(c,"baseIsNative"),Ti=c,Ti}v(zh,"require_baseIsNative");var Si,gu;function Fh(){if(gu)return Si;gu=1;function r(e,t){return e?.[t]}return v(r,"getValue"),Si=r,Si}v(Fh,"require_getValue");var ki,pu;function io(){if(pu)return ki;pu=1;var r=zh(),e=Fh();function t(a,n){var i=e(a,n);return r(i)?i:void 0}return v(t,"getNative"),ki=t,ki}v(io,"require_getNative");var Di,yu;function zn(){if(yu)return Di;yu=1;var r=io(),e=r(Object,"create");return Di=e,Di}v(zn,"require_nativeCreate");var Bi,mu;function Vh(){if(mu)return Bi;mu=1;var r=zn();function e(){this.__data__=r?r(null):{},this.size=0}return v(e,"hashClear"),Bi=e,Bi}v(Vh,"require_hashClear");var Pi,bu;function qh(){if(bu)return Pi;bu=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return v(r,"hashDelete"),Pi=r,Pi}v(qh,"require_hashDelete");var Ai,wu;function _h(){if(wu)return Ai;wu=1;var r=zn(),e="__lodash_hash_undefined__",t=Object.prototype,a=t.hasOwnProperty;function n(i){var s=this.__data__;if(r){var o=s[i];return o===e?void 0:o}return a.call(s,i)?s[i]:void 0}return v(n,"hashGet"),Ai=n,Ai}v(_h,"require_hashGet");var Ri,xu;function Gh(){if(xu)return Ri;xu=1;var r=zn(),e=Object.prototype,t=e.hasOwnProperty;function a(n){var i=this.__data__;return r?i[n]!==void 0:t.call(i,n)}return v(a,"hashHas"),Ri=a,Ri}v(Gh,"require_hashHas");var Mi,Eu;function Hh(){if(Eu)return Mi;Eu=1;var r=zn(),e="__lodash_hash_undefined__";function t(a,n){var i=this.__data__;return this.size+=this.has(a)?0:1,i[a]=r&&n===void 0?e:n,this}return v(t,"hashSet"),Mi=t,Mi}v(Hh,"require_hashSet");var Li,Cu;function Wh(){if(Cu)return Li;Cu=1;var r=Vh(),e=qh(),t=_h(),a=Gh(),n=Hh();function i(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o<u;){var l=s[o];this.set(l[0],l[1])}}return v(i,"Hash"),i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,Li=i,Li}v(Wh,"require_Hash");var Ii,Tu;function $h(){if(Tu)return Ii;Tu=1;function r(){this.__data__=[],this.size=0}return v(r,"listCacheClear"),Ii=r,Ii}v($h,"require_listCacheClear");var Oi,Su;function Mv(){if(Su)return Oi;Su=1;function r(e,t){return e===t||e!==e&&t!==t}return v(r,"eq"),Oi=r,Oi}v(Mv,"requireEq");var Ni,ku;function Fn(){if(ku)return Ni;ku=1;var r=Mv();function e(t,a){for(var n=t.length;n--;)if(r(t[n][0],a))return n;return-1}return v(e,"assocIndexOf"),Ni=e,Ni}v(Fn,"require_assocIndexOf");var zi,Du;function Uh(){if(Du)return zi;Du=1;var r=Fn(),e=Array.prototype,t=e.splice;function a(n){var i=this.__data__,s=r(i,n);if(s<0)return!1;var o=i.length-1;return s==o?i.pop():t.call(i,s,1),--this.size,!0}return v(a,"listCacheDelete"),zi=a,zi}v(Uh,"require_listCacheDelete");var Fi,Bu;function Kh(){if(Bu)return Fi;Bu=1;var r=Fn();function e(t){var a=this.__data__,n=r(a,t);return n<0?void 0:a[n][1]}return v(e,"listCacheGet"),Fi=e,Fi}v(Kh,"require_listCacheGet");var Vi,Pu;function Xh(){if(Pu)return Vi;Pu=1;var r=Fn();function e(t){return r(this.__data__,t)>-1}return v(e,"listCacheHas"),Vi=e,Vi}v(Xh,"require_listCacheHas");var qi,Au;function Yh(){if(Au)return qi;Au=1;var r=Fn();function e(t,a){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,a])):n[i][1]=a,this}return v(e,"listCacheSet"),qi=e,qi}v(Yh,"require_listCacheSet");var _i,Ru;function Zh(){if(Ru)return _i;Ru=1;var r=$h(),e=Uh(),t=Kh(),a=Xh(),n=Yh();function i(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o<u;){var l=s[o];this.set(l[0],l[1])}}return v(i,"ListCache"),i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,_i=i,_i}v(Zh,"require_ListCache");var Gi,Mu;function Qh(){if(Mu)return Gi;Mu=1;var r=io(),e=Mn(),t=r(e,"Map");return Gi=t,Gi}v(Qh,"require_Map");var Hi,Lu;function Jh(){if(Lu)return Hi;Lu=1;var r=Wh(),e=Zh(),t=Qh();function a(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return v(a,"mapCacheClear"),Hi=a,Hi}v(Jh,"require_mapCacheClear");var Wi,Iu;function jh(){if(Iu)return Wi;Iu=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return v(r,"isKeyable"),Wi=r,Wi}v(jh,"require_isKeyable");var $i,Ou;function Vn(){if(Ou)return $i;Ou=1;var r=jh();function e(t,a){var n=t.__data__;return r(a)?n[typeof a=="string"?"string":"hash"]:n.map}return v(e,"getMapData"),$i=e,$i}v(Vn,"require_getMapData");var Ui,Nu;function eg(){if(Nu)return Ui;Nu=1;var r=Vn();function e(t){var a=r(this,t).delete(t);return this.size-=a?1:0,a}return v(e,"mapCacheDelete"),Ui=e,Ui}v(eg,"require_mapCacheDelete");var Ki,zu;function rg(){if(zu)return Ki;zu=1;var r=Vn();function e(t){return r(this,t).get(t)}return v(e,"mapCacheGet"),Ki=e,Ki}v(rg,"require_mapCacheGet");var Xi,Fu;function tg(){if(Fu)return Xi;Fu=1;var r=Vn();function e(t){return r(this,t).has(t)}return v(e,"mapCacheHas"),Xi=e,Xi}v(tg,"require_mapCacheHas");var Yi,Vu;function ag(){if(Vu)return Yi;Vu=1;var r=Vn();function e(t,a){var n=r(this,t),i=n.size;return n.set(t,a),this.size+=n.size==i?0:1,this}return v(e,"mapCacheSet"),Yi=e,Yi}v(ag,"require_mapCacheSet");var Zi,qu;function ng(){if(qu)return Zi;qu=1;var r=Jh(),e=eg(),t=rg(),a=tg(),n=ag();function i(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o<u;){var l=s[o];this.set(l[0],l[1])}}return v(i,"MapCache"),i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,Zi=i,Zi}v(ng,"require_MapCache");var Qi,_u;function ig(){if(_u)return Qi;_u=1;var r=ng(),e="Expected a function";function t(a,n){if(typeof a!="function"||n!=null&&typeof n!="function")throw new TypeError(e);var i=v(function(){var s=arguments,o=n?n.apply(this,s):s[0],u=i.cache;if(u.has(o))return u.get(o);var l=a.apply(this,s);return i.cache=u.set(o,l)||u,l},"memoized");return i.cache=new(t.Cache||r),i}return v(t,"memoize"),t.Cache=r,Qi=t,Qi}v(ig,"requireMemoize");var Ji,Gu;function sg(){if(Gu)return Ji;Gu=1;var r=ig(),e=500;function t(a){var n=r(a,function(s){return i.size===e&&i.clear(),s}),i=n.cache;return n}return v(t,"memoizeCapped"),Ji=t,Ji}v(sg,"require_memoizeCapped");var ji,Hu;function Lv(){if(Hu)return ji;Hu=1;var r=sg(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,a=r(function(n){var i=[];return n.charCodeAt(0)===46&&i.push(""),n.replace(e,function(s,o,u,l){i.push(u?l.replace(t,"$1"):o||s)}),i});return ji=a,ji}v(Lv,"require_stringToPath");var es,Wu;function Iv(){if(Wu)return es;Wu=1;function r(e,t){for(var a=-1,n=e==null?0:e.length,i=Array(n);++a<n;)i[a]=t(e[a],a,e);return i}return v(r,"arrayMap"),es=r,es}v(Iv,"require_arrayMap");var rs,$u;function og(){if($u)return rs;$u=1;var r=Zs(),e=Iv(),t=Nn(),a=Na(),n=r?r.prototype:void 0,i=n?n.toString:void 0;function s(o){if(typeof o=="string")return o;if(t(o))return e(o,s)+"";if(a(o))return i?i.call(o):"";var u=o+"";return u=="0"&&1/o==-1/0?"-0":u}return v(s,"baseToString"),rs=s,rs}v(og,"require_baseToString");var ts,Uu;function Ov(){if(Uu)return ts;Uu=1;var r=og();function e(t){return t==null?"":r(t)}return v(e,"toString"),ts=e,ts}v(Ov,"requireToString");var as,Ku;function Nv(){if(Ku)return as;Ku=1;var r=Nn(),e=Mh(),t=Lv(),a=Ov();function n(i,s){return r(i)?i:e(i,s)?[i]:t(a(i))}return v(n,"castPath"),as=n,as}v(Nv,"require_castPath");var ns,Xu;function so(){if(Xu)return ns;Xu=1;var r=Na();function e(t){if(typeof t=="string"||r(t))return t;var a=t+"";return a=="0"&&1/t==-1/0?"-0":a}return v(e,"toKey"),ns=e,ns}v(so,"require_toKey");var is,Yu;function ug(){if(Yu)return is;Yu=1;var r=Nv(),e=so();function t(a,n){n=r(n,a);for(var i=0,s=n.length;a!=null&&i<s;)a=a[e(n[i++])];return i&&i==s?a:void 0}return v(t,"baseGet"),is=t,is}v(ug,"require_baseGet");var ss,Zu;function lg(){if(Zu)return ss;Zu=1;var r=ug();function e(t,a,n){var i=t==null?void 0:r(t,a);return i===void 0?n:i}return v(e,"get"),ss=e,ss}v(lg,"requireGet");var vg=lg(),fg=Ia(vg),os,Qu;function cg(){if(Qu)return os;Qu=1;var r=io(),e=(function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}})();return os=e,os}v(cg,"require_defineProperty");var us,Ju;function dg(){if(Ju)return us;Ju=1;var r=cg();function e(t,a,n){a=="__proto__"&&r?r(t,a,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[a]=n}return v(e,"baseAssignValue"),us=e,us}v(dg,"require_baseAssignValue");var ls,ju;function hg(){if(ju)return ls;ju=1;var r=dg(),e=Mv(),t=Object.prototype,a=t.hasOwnProperty;function n(i,s,o){var u=i[s];(!(a.call(i,s)&&e(u,o))||o===void 0&&!(s in i))&&r(i,s,o)}return v(n,"assignValue"),ls=n,ls}v(hg,"require_assignValue");var vs,el;function gg(){if(el)return vs;el=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(a,n){var i=typeof a;return n=n??r,!!n&&(i=="number"||i!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<n}return v(t,"isIndex"),vs=t,vs}v(gg,"require_isIndex");var fs,rl;function pg(){if(rl)return fs;rl=1;var r=hg(),e=Nv(),t=gg(),a=Oa(),n=so();function i(s,o,u,l){if(!a(s))return s;o=e(o,s);for(var f=-1,c=o.length,d=c-1,g=s;g!=null&&++f<c;){var h=n(o[f]),m=u;if(h==="__proto__"||h==="constructor"||h==="prototype")return s;if(f!=d){var p=g[h];m=l?l(p,h,g):void 0,m===void 0&&(m=a(p)?p:t(o[f+1])?[]:{})}r(g,h,m),g=g[h]}return s}return v(i,"baseSet"),fs=i,fs}v(pg,"require_baseSet");var cs,tl;function yg(){if(tl)return cs;tl=1;var r=pg();function e(t,a,n){return t==null?t:r(t,a,n)}return v(e,"set"),cs=e,cs}v(yg,"requireSet");var mg=yg(),bg=Ia(mg),ds,al;function wg(){if(al)return ds;al=1;function r(e,t){var a=-1,n=e.length;for(t||(t=Array(n));++a<n;)t[a]=e[a];return t}return v(r,"copyArray"),ds=r,ds}v(wg,"require_copyArray");var hs,nl;function xg(){if(nl)return hs;nl=1;var r=Iv(),e=wg(),t=Nn(),a=Na(),n=Lv(),i=so(),s=Ov();function o(u){return t(u)?r(u,i):a(u)?[u]:e(n(s(u)))}return v(o,"toPath"),hs=o,hs}v(xg,"requireToPath");var Eg=xg(),Cg=Ia(Eg),Tg={data:v(function(e){var t={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:v(function(n){},"beforeGet"),beforeSet:v(function(n,i){},"beforeSet"),onSet:v(function(n){},"onSet"),canSet:v(function(n){return!0},"canSet")};return e=me({},t,e),v(function(n,i){var s=e,o=this,u=o.length!==void 0,l=u?o:[o],f=u?o[0]:o;if(ge(n)){var c=n.indexOf(".")!==-1,d=c&&Cg(n);if(s.allowGetting&&i===void 0){var g;return f&&(s.beforeGet(f),d&&f._private[s.field][n]===void 0?g=fg(f._private[s.field],d):g=f._private[s.field][n]),g}else if(s.allowSetting&&i!==void 0){var h=!s.immutableKeys[n];if(h){var m=Ql({},n,i);s.beforeSet(o,m);for(var p=0,y=l.length;p<y;p++){var b=l[p];s.canSet(b)&&(d&&f._private[s.field][n]===void 0?bg(b._private[s.field],d,i):b._private[s.field][n]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&Le(n)){var w=n,x,C,T=Object.keys(w);s.beforeSet(o,w);for(var E=0;E<T.length;E++){x=T[E],C=w[x];var S=!s.immutableKeys[x];if(S)for(var D=0;D<l.length;D++){var B=l[D];s.canSet(B)&&(B._private[s.field][x]=C)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&Ue(n)){var P=n;o.on(s.bindingEvent,P)}else if(s.allowGetting&&n===void 0){var A;return f&&(s.beforeGet(f),A=f._private[s.field]),A}return o},"dataImpl")},"data"),removeData:v(function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=me({},t,e),v(function(n){var i=e,s=this,o=s.length!==void 0,u=o?s:[s];if(ge(n)){for(var l=n.split(/\s+/),f=l.length,c=0;c<f;c++){var d=l[c];if(!ut(d)){var g=!i.immutableKeys[d];if(g)for(var h=0,m=u.length;h<m;h++)u[h]._private[i.field][d]=void 0}}i.triggerEvent&&s[i.triggerFnName](i.event)}else if(n===void 0){for(var p=0,y=u.length;p<y;p++)for(var b=u[p]._private[i.field],w=Object.keys(b),x=0;x<w.length;x++){var C=w[x],T=!i.immutableKeys[C];T&&(b[C]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s},"removeDataImpl")},"removeData")},Sg={eventAliasesOn:v(function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(a,n){var i=this,s=Array.prototype.slice.call(arguments,0);return new ra(function(o,u){var l=v(function(g){i.off.apply(i,c),o(g)},"callback"),f=s.concat([l]),c=f.concat([]);i.on.apply(i,f)})}},"eventAliasesOn")},ze={};[Rh,Tg,Sg].forEach(function(r){me(ze,r)});var kg={animate:ze.animate(),animation:ze.animation(),animated:ze.animated(),clearQueue:ze.clearQueue(),delay:ze.delay(),delayAnimation:ze.delayAnimation(),stop:ze.stop()},ln={classes:v(function(e){var t=this;if(e===void 0){var a=[];return t[0]._private.classes.forEach(function(h){return a.push(h)}),a}else qe(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new ea(e),s=0;s<t.length;s++){for(var o=t[s],u=o._private,l=u.classes,f=!1,c=0;c<e.length;c++){var d=e[c],g=l.has(d);if(!g){f=!0;break}}f||(f=l.size!==e.length),f&&(u.classes=i,n.push(o))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),t},"classes"),addClass:v(function(e){return this.toggleClass(e,!0)},"addClass"),hasClass:v(function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},"hasClass"),toggleClass:v(function(e,t){qe(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=t===void 0,i=[],s=0,o=a.length;s<o;s++)for(var u=a[s],l=u._private.classes,f=!1,c=0;c<e.length;c++){var d=e[c],g=l.has(d),h=!1;t||n&&!g?(l.add(d),h=!0):(!t||n&&g)&&(l.delete(d),h=!0),!f&&h&&(i.push(u),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},"toggleClass"),removeClass:v(function(e){return this.toggleClass(e,!1)},"removeClass"),flashClass:v(function(e,t){var a=this;if(t==null)t=250;else if(t===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},t),a},"flashClass")};ln.className=ln.classNames=ln.classes;var Me={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:rr,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Me.variable="(?:[\\w-.]|(?:\\\\"+Me.metaChar+"))+";Me.className="(?:[\\w-]|(?:\\\\"+Me.metaChar+"))+";Me.value=Me.string+"|"+Me.number;Me.id=Me.variable;(function(){var r,e,t;for(r=Me.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],Me.comparatorOp+="|@"+e;for(r=Me.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],!(e.indexOf("!")>=0)&&e!=="="&&(Me.comparatorOp+="|\\!"+e)})();var Ve=v(function(){return{checks:[]}},"newQuery"),le={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Is=[{selector:":selected",matches:v(function(e){return e.selected()},"matches")},{selector:":unselected",matches:v(function(e){return!e.selected()},"matches")},{selector:":selectable",matches:v(function(e){return e.selectable()},"matches")},{selector:":unselectable",matches:v(function(e){return!e.selectable()},"matches")},{selector:":locked",matches:v(function(e){return e.locked()},"matches")},{selector:":unlocked",matches:v(function(e){return!e.locked()},"matches")},{selector:":visible",matches:v(function(e){return e.visible()},"matches")},{selector:":hidden",matches:v(function(e){return!e.visible()},"matches")},{selector:":transparent",matches:v(function(e){return e.transparent()},"matches")},{selector:":grabbed",matches:v(function(e){return e.grabbed()},"matches")},{selector:":free",matches:v(function(e){return!e.grabbed()},"matches")},{selector:":removed",matches:v(function(e){return e.removed()},"matches")},{selector:":inside",matches:v(function(e){return!e.removed()},"matches")},{selector:":grabbable",matches:v(function(e){return e.grabbable()},"matches")},{selector:":ungrabbable",matches:v(function(e){return!e.grabbable()},"matches")},{selector:":animated",matches:v(function(e){return e.animated()},"matches")},{selector:":unanimated",matches:v(function(e){return!e.animated()},"matches")},{selector:":parent",matches:v(function(e){return e.isParent()},"matches")},{selector:":childless",matches:v(function(e){return e.isChildless()},"matches")},{selector:":child",matches:v(function(e){return e.isChild()},"matches")},{selector:":orphan",matches:v(function(e){return e.isOrphan()},"matches")},{selector:":nonorphan",matches:v(function(e){return e.isChild()},"matches")},{selector:":compound",matches:v(function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()},"matches")},{selector:":loop",matches:v(function(e){return e.isLoop()},"matches")},{selector:":simple",matches:v(function(e){return e.isSimple()},"matches")},{selector:":active",matches:v(function(e){return e.active()},"matches")},{selector:":inactive",matches:v(function(e){return!e.active()},"matches")},{selector:":backgrounding",matches:v(function(e){return e.backgrounding()},"matches")},{selector:":nonbackgrounding",matches:v(function(e){return!e.backgrounding()},"matches")}].sort(function(r,e){return Tc(r.selector,e.selector)}),Dg=(function(){for(var r={},e,t=0;t<Is.length;t++)e=Is[t],r[e.selector]=e.matches;return r})(),Bg=v(function(e,t){return Dg[e](t)},"stateSelectorMatches"),Pg="("+Is.map(function(r){return r.selector}).join("|")+")",Ot=v(function(e){return e.replace(new RegExp("\\\\("+Me.metaChar+")","g"),function(t,a){return a})},"cleanMetaChars"),rt=v(function(e,t,a){e[e.length-1]=a},"replaceLastQuery"),Os=[{name:"group",query:!0,regex:"("+Me.group+")",populate:v(function(e,t,a){var n=Je(a,1),i=n[0];t.checks.push({type:le.GROUP,value:i==="*"?i:i+"s"})},"populate")},{name:"state",query:!0,regex:Pg,populate:v(function(e,t,a){var n=Je(a,1),i=n[0];t.checks.push({type:le.STATE,value:i})},"populate")},{name:"id",query:!0,regex:"\\#("+Me.id+")",populate:v(function(e,t,a){var n=Je(a,1),i=n[0];t.checks.push({type:le.ID,value:Ot(i)})},"populate")},{name:"className",query:!0,regex:"\\.("+Me.className+")",populate:v(function(e,t,a){var n=Je(a,1),i=n[0];t.checks.push({type:le.CLASS,value:Ot(i)})},"populate")},{name:"dataExists",query:!0,regex:"\\[\\s*("+Me.variable+")\\s*\\]",populate:v(function(e,t,a){var n=Je(a,1),i=n[0];t.checks.push({type:le.DATA_EXIST,field:Ot(i)})},"populate")},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Me.variable+")\\s*("+Me.comparatorOp+")\\s*("+Me.value+")\\s*\\]",populate:v(function(e,t,a){var n=Je(a,3),i=n[0],s=n[1],o=n[2],u=new RegExp("^"+Me.string+"$").exec(o)!=null;u?o=o.substring(1,o.length-1):o=parseFloat(o),t.checks.push({type:le.DATA_COMPARE,field:Ot(i),operator:s,value:o})},"populate")},{name:"dataBool",query:!0,regex:"\\[\\s*("+Me.boolOp+")\\s*("+Me.variable+")\\s*\\]",populate:v(function(e,t,a){var n=Je(a,2),i=n[0],s=n[1];t.checks.push({type:le.DATA_BOOL,field:Ot(s),operator:i})},"populate")},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Me.meta+")\\s*("+Me.comparatorOp+")\\s*("+Me.number+")\\s*\\]\\]",populate:v(function(e,t,a){var n=Je(a,3),i=n[0],s=n[1],o=n[2];t.checks.push({type:le.META_COMPARE,field:Ot(i),operator:s,value:parseFloat(o)})},"populate")},{name:"nextQuery",separator:!0,regex:Me.separator,populate:v(function(e,t){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,s=e[e.length-1];a!=null&&(s.subject=a,e.currentSubject=null),s.edgeCount=n,s.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=Ve();return o},"populate")},{name:"directedEdge",separator:!0,regex:Me.directedEdge,populate:v(function(e,t){if(e.currentSubject==null){var a=Ve(),n=t,i=Ve();return a.checks.push({type:le.DIRECTED_EDGE,source:n,target:i}),rt(e,t,a),e.edgeCount++,i}else{var s=Ve(),o=t,u=Ve();return s.checks.push({type:le.NODE_SOURCE,source:o,target:u}),rt(e,t,s),e.edgeCount++,u}},"populate")},{name:"undirectedEdge",separator:!0,regex:Me.undirectedEdge,populate:v(function(e,t){if(e.currentSubject==null){var a=Ve(),n=t,i=Ve();return a.checks.push({type:le.UNDIRECTED_EDGE,nodes:[n,i]}),rt(e,t,a),e.edgeCount++,i}else{var s=Ve(),o=t,u=Ve();return s.checks.push({type:le.NODE_NEIGHBOR,node:o,neighbor:u}),rt(e,t,s),u}},"populate")},{name:"child",separator:!0,regex:Me.child,populate:v(function(e,t){if(e.currentSubject==null){var a=Ve(),n=Ve(),i=e[e.length-1];return a.checks.push({type:le.CHILD,parent:i,child:n}),rt(e,t,a),e.compoundCount++,n}else if(e.currentSubject===t){var s=Ve(),o=e[e.length-1],u=Ve(),l=Ve(),f=Ve(),c=Ve();return s.checks.push({type:le.COMPOUND_SPLIT,left:o,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:le.TRUE}],c.checks.push({type:le.TRUE}),u.checks.push({type:le.PARENT,parent:c,child:f}),rt(e,o,s),e.currentSubject=l,e.compoundCount++,f}else{var d=Ve(),g=Ve(),h=[{type:le.PARENT,parent:d,child:g}];return d.checks=t.checks,t.checks=h,e.compoundCount++,g}},"populate")},{name:"descendant",separator:!0,regex:Me.descendant,populate:v(function(e,t){if(e.currentSubject==null){var a=Ve(),n=Ve(),i=e[e.length-1];return a.checks.push({type:le.DESCENDANT,ancestor:i,descendant:n}),rt(e,t,a),e.compoundCount++,n}else if(e.currentSubject===t){var s=Ve(),o=e[e.length-1],u=Ve(),l=Ve(),f=Ve(),c=Ve();return s.checks.push({type:le.COMPOUND_SPLIT,left:o,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:le.TRUE}],c.checks.push({type:le.TRUE}),u.checks.push({type:le.ANCESTOR,ancestor:c,descendant:f}),rt(e,o,s),e.currentSubject=l,e.compoundCount++,f}else{var d=Ve(),g=Ve(),h=[{type:le.ANCESTOR,ancestor:d,descendant:g}];return d.checks=t.checks,t.checks=h,e.compoundCount++,g}},"populate")},{name:"subject",modifier:!0,regex:Me.subject,populate:v(function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Fe("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===le.DIRECTED_EDGE?n.type=le.NODE_TARGET:i===le.UNDIRECTED_EDGE&&(n.type=le.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)},"populate")}];Os.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var Ag=v(function(e){for(var t,a,n,i=0;i<Os.length;i++){var s=Os[i],o=s.name,u=e.match(s.regexObj);if(u!=null){a=u,t=s,n=o;var l=u[0];e=e.substring(l.length);break}}return{expr:t,match:a,name:n,remaining:e}},"consumeExpr"),Rg=v(function(e){var t=e.match(/^\s+/);if(t){var a=t[0];e=e.substring(a.length)}return e},"consumeWhitespace"),Mg=v(function(e){var t=this,a=t.inputText=e,n=t[0]=Ve();for(t.length=1,a=Rg(a);;){var i=Ag(a);if(i.expr==null)return Fe("The selector `"+e+"`is invalid"),!1;var s=i.match.slice(1),o=i.expr.populate(t,n,s);if(o===!1)return!1;if(o!=null&&(n=o),a=i.remaining,a.match(/^\s*$/))break}var u=t[t.length-1];t.currentSubject!=null&&(u.subject=t.currentSubject),u.edgeCount=t.edgeCount,u.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var f=t[l];if(f.compoundCount>0&&f.edgeCount>0)return Fe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Fe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Fe("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},"parse"),Lg=v(function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=v(function(f){return f??""},"clean"),t=v(function(f){return ge(f)?'"'+f+'"':e(f)},"cleanVal"),a=v(function(f){return" "+f+" "},"space"),n=v(function(f,c){var d=f.type,g=f.value;switch(d){case le.GROUP:{var h=e(g);return h.substring(0,h.length-1)}case le.DATA_COMPARE:{var m=f.field,p=f.operator;return"["+m+a(e(p))+t(g)+"]"}case le.DATA_BOOL:{var y=f.operator,b=f.field;return"["+e(y)+b+"]"}case le.DATA_EXIST:{var w=f.field;return"["+w+"]"}case le.META_COMPARE:{var x=f.operator,C=f.field;return"[["+C+a(e(x))+t(g)+"]]"}case le.STATE:return g;case le.ID:return"#"+g;case le.CLASS:return"."+g;case le.PARENT:case le.CHILD:return i(f.parent,c)+a(">")+i(f.child,c);case le.ANCESTOR:case le.DESCENDANT:return i(f.ancestor,c)+" "+i(f.descendant,c);case le.COMPOUND_SPLIT:{var T=i(f.left,c),E=i(f.subject,c),S=i(f.right,c);return T+(T.length>0?" ":"")+E+S}case le.TRUE:return""}},"checkToString"),i=v(function(f,c){return f.checks.reduce(function(d,g,h){return d+(c===f&&h===0?"$":"")+n(g,c)},"")},"queryToString"),s="",o=0;o<this.length;o++){var u=this[o];s+=i(u,u.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s},"toString"),Ig={parse:Mg,toString:Lg},zv=v(function(e,t,a){var n,i=ge(e),s=ne(e),o=ge(a),u,l,f=!1,c=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),f=!0),(i||o||f)&&(u=!i&&!s?"":""+e,l=""+a),f&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),t){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":d=!0,n=e>a;break;case">=":d=!0,n=e>=a;break;case"<":d=!0,n=e<a;break;case"<=":d=!0,n=e<=a;break;default:n=!1;break}return c&&(e!=null||!d)&&(n=!n),n},"valCmp"),Og=v(function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},"boolCmp"),Ng=v(function(e){return e!==void 0},"existCmp"),oo=v(function(e,t){return e.data(t)},"data"),zg=v(function(e,t){return e[t]()},"meta"),Ye=[],He=v(function(e,t){return e.checks.every(function(a){return Ye[a.type](a,t)})},"matches");Ye[le.GROUP]=function(r,e){var t=r.value;return t==="*"||t===e.group()};Ye[le.STATE]=function(r,e){var t=r.value;return Bg(t,e)};Ye[le.ID]=function(r,e){var t=r.value;return e.id()===t};Ye[le.CLASS]=function(r,e){var t=r.value;return e.hasClass(t)};Ye[le.META_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return zv(zg(e,t),a,n)};Ye[le.DATA_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return zv(oo(e,t),a,n)};Ye[le.DATA_BOOL]=function(r,e){var t=r.field,a=r.operator;return Og(oo(e,t),a)};Ye[le.DATA_EXIST]=function(r,e){var t=r.field;return r.operator,Ng(oo(e,t))};Ye[le.UNDIRECTED_EDGE]=function(r,e){var t=r.nodes[0],a=r.nodes[1],n=e.source(),i=e.target();return He(t,n)&&He(a,i)||He(a,n)&&He(t,i)};Ye[le.NODE_NEIGHBOR]=function(r,e){return He(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&He(r.neighbor,t)})};Ye[le.DIRECTED_EDGE]=function(r,e){return He(r.source,e.source())&&He(r.target,e.target())};Ye[le.NODE_SOURCE]=function(r,e){return He(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&He(r.target,t)})};Ye[le.NODE_TARGET]=function(r,e){return He(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&He(r.source,t)})};Ye[le.CHILD]=function(r,e){return He(r.child,e)&&He(r.parent,e.parent())};Ye[le.PARENT]=function(r,e){return He(r.parent,e)&&e.children().some(function(t){return He(r.child,t)})};Ye[le.DESCENDANT]=function(r,e){return He(r.descendant,e)&&e.ancestors().some(function(t){return He(r.ancestor,t)})};Ye[le.ANCESTOR]=function(r,e){return He(r.ancestor,e)&&e.descendants().some(function(t){return He(r.descendant,t)})};Ye[le.COMPOUND_SPLIT]=function(r,e){return He(r.subject,e)&&He(r.left,e)&&He(r.right,e)};Ye[le.TRUE]=function(){return!0};Ye[le.COLLECTION]=function(r,e){var t=r.value;return t.has(e)};Ye[le.FILTER]=function(r,e){var t=r.value;return t(e)};var Fg=v(function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===le.ID)return e.getElementById(t[0].checks[0].value).collection();var a=v(function(i){for(var s=0;s<t.length;s++){var o=t[s];if(He(o,i))return!0}return!1},"selectorFunction");return t.text()==null&&(a=v(function(){return!0},"selectorFunction")),e.filter(a)},"filter"),Vg=v(function(e){for(var t=this,a=0;a<t.length;a++){var n=t[a];if(He(n,e))return!0}return!1},"matches"),qg={matches:Vg,filter:Fg},ft=v(function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ge(e)&&e.match(/^\s*$/)||(Sr(e)?this.addQuery({checks:[{type:le.COLLECTION,value:e.collection()}]}):Ue(e)?this.addQuery({checks:[{type:le.FILTER,value:e}]}):ge(e)?this.parse(e)||(this.invalid=!0):We("A selector must be created from a string; found "))},"Selector"),ct=ft.prototype;[Ig,qg].forEach(function(r){return me(ct,r)});ct.text=function(){return this.inputText};ct.size=function(){return this.length};ct.eq=function(r){return this[r]};ct.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()};ct.addQuery=function(r){this[this.length++]=r};ct.selector=ct.toString;var st={allAre:v(function(e){var t=new ft(e);return this.every(function(a){return t.matches(a)})},"allAre"),is:v(function(e){var t=new ft(e);return this.some(function(a){return t.matches(a)})},"is"),some:v(function(e,t){for(var a=0;a<this.length;a++){var n=t?e.apply(t,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},"some"),every:v(function(e,t){for(var a=0;a<this.length;a++){var n=t?e.apply(t,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},"every"),same:v(function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,a=e.length;return t!==a?!1:t===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},"same"),anySame:v(function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},"anySame"),allAreNeighbors:v(function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(a){return t.hasElementWithId(a.id())})},"allAreNeighbors"),contains:v(function(e){e=this.cy().collection(e);var t=this;return e.every(function(a){return t.hasElementWithId(a.id())})},"contains")};st.allAreNeighbours=st.allAreNeighbors;st.has=st.contains;st.equal=st.equals=st.same;var Pr=v(function(e,t){return v(function(n,i,s,o){var u=n,l=this,f;if(u==null?f="":Sr(u)&&u.length===1&&(f=u.id()),l.length===1&&f){var c=l[0]._private,d=c.traversalCache=c.traversalCache||{},g=d[t]=d[t]||[],h=Bt(f),m=g[h];return m||(g[h]=e.call(l,n,i,s,o))}else return e.call(l,n,i,s,o)},"traversalCache")},"cache"),Jt={parent:v(function(e){var t=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],s=i._private.parent;s&&t.push(s)}return this.spawn(t,!0).filter(e)},"parent"),parents:v(function(e){for(var t=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];t.push(i)}a=a.parent()}return this.spawn(t,!0).filter(e)},"parents"),commonAncestors:v(function(e){for(var t,a=0;a<this.length;a++){var n=this[a],i=n.parents();t=t||i,t=t.intersect(i)}return t.filter(e)},"commonAncestors"),orphans:v(function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},"orphans"),nonorphans:v(function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},"nonorphans"),children:Pr(function(r){for(var e=[],t=0;t<this.length;t++)for(var a=this[t],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(r)},"children"),siblings:v(function(e){return this.parent().children().not(this).filter(e)},"siblings"),isParent:v(function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},"isParent"),isChildless:v(function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},"isChildless"),isChild:v(function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},"isChild"),isOrphan:v(function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},"isOrphan"),descendants:v(function(e){var t=[];function a(n){for(var i=0;i<n.length;i++){var s=n[i];t.push(s),s.children().nonempty()&&a(s.children())}}return v(a,"add"),a(this.children()),this.spawn(t,!0).filter(e)},"descendants")};function uo(r,e,t,a){for(var n=[],i=new ea,s=r.cy(),o=s.hasCompoundNodes(),u=0;u<r.length;u++){var l=r[u];t?n.push(l):o&&a(n,i,l)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return r}v(uo,"forEachCompound");function Fv(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||r.push(i)}}v(Fv,"addChildren");Jt.forEachDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return uo(this,r,e,Fv)};function Vv(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}v(Vv,"addParent");Jt.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return uo(this,r,e,Vv)};function _g(r,e,t){Vv(r,e,t),Fv(r,e,t)}v(_g,"addParentAndChildren");Jt.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return uo(this,r,e,_g)};Jt.ancestors=Jt.parents;var Da,qv;Da=qv={data:ze.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:ze.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ze.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ze.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ze.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ze.removeData({field:"rscratch",triggerEvent:!1}),id:v(function(){var e=this[0];if(e)return e._private.data.id},"id")};Da.attr=Da.data;Da.removeAttr=Da.removeData;var Gg=qv,qn={};function gs(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var a=0,n=t[0],i=n._private.edges,s=0;s<i.length;s++){var o=i[s];!e&&o.isLoop()||(a+=r(n,o))}return a}else return}}v(gs,"defineDegreeFunction");me(qn,{degree:gs(function(r,e){return e.source().same(e.target())?2:1}),indegree:gs(function(r,e){return e.target().same(r)?1:0}),outdegree:gs(function(r,e){return e.source().same(r)?1:0})});function Nt(r,e){return function(t){for(var a,n=this.nodes(),i=0;i<n.length;i++){var s=n[i],o=s[r](t);o!==void 0&&(a===void 0||e(o,a))&&(a=o)}return a}}v(Nt,"defineDegreeBoundsFunction");me(qn,{minDegree:Nt("degree",function(r,e){return r<e}),maxDegree:Nt("degree",function(r,e){return r>e}),minIndegree:Nt("indegree",function(r,e){return r<e}),maxIndegree:Nt("indegree",function(r,e){return r>e}),minOutdegree:Nt("outdegree",function(r,e){return r<e}),maxOutdegree:Nt("outdegree",function(r,e){return r>e})});me(qn,{totalDegree:v(function(e){for(var t=0,a=this.nodes(),n=0;n<a.length;n++)t+=a[n].degree(e);return t},"totalDegree")});var Or,_v,Gv=v(function(e,t,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var s=i._private.position,o={x:t.x!=null?t.x-s.x:0,y:t.y!=null?t.y-s.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,a),i.dirtyBoundingBoxCache()}}},"beforePositionSet"),il={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:v(function(e){e.updateCompoundBounds()},"beforeGet"),beforeSet:v(function(e,t){Gv(e,t,!1)},"beforeSet"),onSet:v(function(e){e.dirtyCompoundBoundsCache()},"onSet"),canSet:v(function(e){return!e.locked()},"canSet")};Or=_v={position:ze.data(il),silentPosition:ze.data(me({},il,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:v(function(e,t){Gv(e,t,!0)},"beforeSet"),onSet:v(function(e){e.dirtyCompoundBoundsCache()},"onSet")})),positions:v(function(e,t){if(Le(e))t?this.silentPosition(e):this.position(e);else if(Ue(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var s=this[i],o=void 0;(o=a(s,i))&&(t?s.silentPosition(o):s.position(o))}n.endBatch()}return this},"positions"),silentPositions:v(function(e){return this.positions(e,!0)},"silentPositions"),shift:v(function(e,t,a){var n;if(Le(e)?(n={x:ne(e.x)?e.x:0,y:ne(e.y)?e.y:0},a=t):ge(e)&&ne(t)&&(n={x:0,y:0},n[e]=t),n!=null){var i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var u=o.position(),l={x:u.x+n.x,y:u.y+n.y};a?o.silentPosition(l):o.position(l)}}i.endBatch()}return this},"shift"),silentShift:v(function(e,t){return Le(e)?this.shift(e,!0):ge(e)&&ne(t)&&this.shift(e,t,!0),this},"silentShift"),renderedPosition:v(function(e,t){var a=this[0],n=this.cy(),i=n.zoom(),s=n.pan(),o=Le(e)?e:void 0,u=o!==void 0||t!==void 0&&ge(e);if(a&&a.isNode())if(u)for(var l=0;l<this.length;l++){var f=this[l];t!==void 0?f.position(e,(t-s[e])/i):o!==void 0&&f.position(pv(o,i,s))}else{var c=a.position();return o=In(c,i,s),e===void 0?o:o[e]}else if(!u)return;return this},"renderedPosition"),relativePosition:v(function(e,t){var a=this[0],n=this.cy(),i=Le(e)?e:void 0,s=i!==void 0||t!==void 0&&ge(e),o=n.hasCompoundNodes();if(a&&a.isNode())if(s)for(var u=0;u<this.length;u++){var l=this[u],f=o?l.parent():null,c=f&&f.length>0,d=c;c&&(f=f[0]);var g=d?f.position():{x:0,y:0};t!==void 0?l.position(e,t+g[e]):i!==void 0&&l.position({x:i.x+g.x,y:i.y+g.y})}else{var h=a.position(),m=o?a.parent():null,p=m&&m.length>0,y=p;p&&(m=m[0]);var b=y?m.position():{x:0,y:0};return i={x:h.x-b.x,y:h.y-b.y},e===void 0?i:i[e]}else if(!s)return;return this},"relativePosition")};Or.modelPosition=Or.point=Or.position;Or.modelPositions=Or.points=Or.positions;Or.renderedPoint=Or.renderedPosition;Or.relativePoint=Or.relativePosition;var Hg=_v,Yt,pt;Yt=pt={};pt.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:u,w:s-i,h:u-o}};pt.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var a=t._private;a.compoundBoundsClean=!1,a.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};pt.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(s){if(!s.isParent())return;var o=s._private,u=s.children(),l=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},c=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),d=o.position;(c.w===0||c.h===0)&&(c={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},c.x1=d.x-c.w/2,c.x2=d.x+c.w/2,c.y1=d.y-c.h/2,c.y2=d.y+c.h/2);function g(D,B,P){var A=0,R=0,M=B+P;return D>0&&M>0&&(A=B/M*D,R=P/M*D),{biasDiff:A,biasComplementDiff:R}}v(g,"computeBiasValues");function h(D,B,P,A){if(P.units==="%")switch(A){case"width":return D>0?P.pfValue*D:0;case"height":return B>0?P.pfValue*B:0;case"average":return D>0&&B>0?P.pfValue*(D+B)/2:0;case"min":return D>0&&B>0?D>B?P.pfValue*B:P.pfValue*D:0;case"max":return D>0&&B>0?D>B?P.pfValue*D:P.pfValue*B:0;default:return 0}else return P.units==="px"?P.pfValue:0}v(h,"computePaddingValues");var m=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(m=m*100/f.width.val);var p=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(p=p*100/f.width.val);var y=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(y=y*100/f.height.val);var b=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(b=b*100/f.height.val);var w=g(f.width.val-c.w,m,p),x=w.biasDiff,C=w.biasComplementDiff,T=g(f.height.val-c.h,y,b),E=T.biasDiff,S=T.biasComplementDiff;o.autoPadding=h(c.w,c.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(c.w,f.width.val),d.x=(-x+c.x1+c.x2+C)/2,o.autoHeight=Math.max(c.h,f.height.val),d.y=(-E+c.y1+c.y2+S)/2}v(t,"update");for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||r)&&(t(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var Br=v(function(e){return e===1/0||e===-1/0?0:e},"noninf"),Ir=v(function(e,t,a,n,i){n-t===0||i-a===0||t==null||a==null||n==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},"updateBounds"),tt=v(function(e,t){return t==null?e:Ir(e,t.x1,t.y1,t.x2,t.y2)},"updateBoundsFromBox"),va=v(function(e,t,a){return Er(e,t,a)},"prefixedProperty"),Ja=v(function(e,t,a){if(!t.cy().headless()){var n=t._private,i=n.rstyle,s=i.arrowWidth/2,o=t.pstyle(a+"-arrow-shape").value,u,l;if(o!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=n.arrowBounds=n.arrowBounds||{},c=f[a]=f[a]||{};c.x1=u-s,c.y1=l-s,c.x2=u+s,c.y2=l+s,c.w=c.x2-c.x1,c.h=c.y2-c.y1,on(c,1),Ir(e,c.x1,c.y1,c.x2,c.y2)}}},"updateBoundsFromArrow"),ps=v(function(e,t,a){if(!t.cy().headless()){var n;a?n=a+"-":n="";var i=t._private,s=i.rstyle,o=t.pstyle(n+"label").strValue;if(o){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),f=va(s,"labelWidth",a),c=va(s,"labelHeight",a),d=va(s,"labelX",a),g=va(s,"labelY",a),h=t.pstyle(n+"text-margin-x").pfValue,m=t.pstyle(n+"text-margin-y").pfValue,p=t.isEdge(),y=t.pstyle(n+"text-rotation"),b=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue,x=w/2,C=t.pstyle("text-background-padding").pfValue,T=2,E=c,S=f,D=S/2,B=E/2,P,A,R,M;if(p)P=d-D,A=d+D,R=g-B,M=g+B;else{switch(u.value){case"left":P=d-S,A=d;break;case"center":P=d-D,A=d+D;break;case"right":P=d,A=d+S;break}switch(l.value){case"top":R=g-E,M=g;break;case"center":R=g-B,M=g+B;break;case"bottom":R=g,M=g+E;break}}var I=h-Math.max(b,x)-C-T,O=h+Math.max(b,x)+C+T,L=m-Math.max(b,x)-C-T,N=m+Math.max(b,x)+C+T;P+=I,A+=O,R+=L,M+=N;var _=a||"main",G=i.labelBounds,z=G[_]=G[_]||{};z.x1=P,z.y1=R,z.x2=A,z.y2=M,z.w=A-P,z.h=M-R,z.leftPad=I,z.rightPad=O,z.topPad=L,z.botPad=N;var V=p&&y.strValue==="autorotate",K=y.pfValue!=null&&y.pfValue!==0;if(V||K){var j=V?va(i.rstyle,"labelAngle",a):y.pfValue,Q=Math.cos(j),ee=Math.sin(j),te=(P+A)/2,ie=(R+M)/2;if(!p){switch(u.value){case"left":te=A;break;case"right":te=P;break}switch(l.value){case"top":ie=M;break;case"bottom":ie=R;break}}var J=v(function(xe,be){return xe=xe-te,be=be-ie,{x:xe*Q-be*ee+te,y:xe*ee+be*Q+ie}},"rotate"),q=J(P,R),W=J(P,M),$=J(A,R),Z=J(A,M);P=Math.min(q.x,W.x,$.x,Z.x),A=Math.max(q.x,W.x,$.x,Z.x),R=Math.min(q.y,W.y,$.y,Z.y),M=Math.max(q.y,W.y,$.y,Z.y)}var ae=_+"Rot",de=G[ae]=G[ae]||{};de.x1=P,de.y1=R,de.x2=A,de.y2=M,de.w=A-P,de.h=M-R,Ir(e,P,R,A,M),Ir(i.labelBounds.all,P,R,A,M)}return e}},"updateBoundsFromLabel"),sl=v(function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value,i=t.pstyle("outline-offset").value,s=n+i;Hv(e,t,a,s,"outside",s/2)}},"updateBoundsFromOutline"),Hv=v(function(e,t,a,n,i,s){if(!(a===0||n<=0||i==="inside")){var o=t.cy(),u=o.renderer(),l=u.nodeShapes[u.getNodeShape(t)];if(l){var f=t.position(),c=f.x,d=f.y,g=t.width(),h=t.height();if(l.hasMiterBounds){i==="center"&&(n/=2);var m=l.miterBounds(c,d,g,h,n);tt(e,m)}else s!=null&&s>0&&un(e,[s,s,s,s])}}},"updateBoundsFromMiter"),Wg=v(function(e,t){if(!t.cy().headless()){var a=t.pstyle("border-opacity").value,n=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;Hv(e,t,a,n,i)}},"updateBoundsFromMiterBorder"),$g=v(function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=mr(),o=e._private,u=e.isNode(),l=e.isEdge(),f,c,d,g,h,m,p=o.rstyle,y=u&&n?e.pstyle("bounds-expansion").pfValue:[0],b=v(function(Pe){return Pe.pstyle("display").value!=="none"},"isDisplayed"),w=!n||b(e)&&(!l||b(e.source())&&b(e.target()));if(w){var x=0,C=0;n&&t.includeOverlays&&(x=e.pstyle("overlay-opacity").value,x!==0&&(C=e.pstyle("overlay-padding").value));var T=0,E=0;n&&t.includeUnderlays&&(T=e.pstyle("underlay-opacity").value,T!==0&&(E=e.pstyle("underlay-padding").value));var S=Math.max(C,E),D=0,B=0;if(n&&(D=e.pstyle("width").pfValue,B=D/2),u&&t.includeNodes){var P=e.position();h=P.x,m=P.y;var A=e.outerWidth(),R=A/2,M=e.outerHeight(),I=M/2;f=h-R,c=h+R,d=m-I,g=m+I,Ir(s,f,d,c,g),n&&sl(s,e),n&&t.includeOutlines&&!i&&sl(s,e),n&&Wg(s,e)}else if(l&&t.includeEdges)if(n&&!i){var O=e.pstyle("curve-style").strValue;if(f=Math.min(p.srcX,p.midX,p.tgtX),c=Math.max(p.srcX,p.midX,p.tgtX),d=Math.min(p.srcY,p.midY,p.tgtY),g=Math.max(p.srcY,p.midY,p.tgtY),f-=B,c+=B,d-=B,g+=B,Ir(s,f,d,c,g),O==="haystack"){var L=p.haystackPts;if(L&&L.length===2){if(f=L[0].x,d=L[0].y,c=L[1].x,g=L[1].y,f>c){var N=f;f=c,c=N}if(d>g){var _=d;d=g,g=_}Ir(s,f-B,d-B,c+B,g+B)}}else if(O==="bezier"||O==="unbundled-bezier"||at(O,"segments")||at(O,"taxi")){var G;switch(O){case"bezier":case"unbundled-bezier":G=p.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":G=p.linePts;break}if(G!=null)for(var z=0;z<G.length;z++){var V=G[z];f=V.x-B,c=V.x+B,d=V.y-B,g=V.y+B,Ir(s,f,d,c,g)}}}else{var K=e.source(),j=K.position(),Q=e.target(),ee=Q.position();if(f=j.x,c=ee.x,d=j.y,g=ee.y,f>c){var te=f;f=c,c=te}if(d>g){var ie=d;d=g,g=ie}f-=B,c+=B,d-=B,g+=B,Ir(s,f,d,c,g)}if(n&&t.includeEdges&&l&&(Ja(s,e,"mid-source"),Ja(s,e,"mid-target"),Ja(s,e,"source"),Ja(s,e,"target")),n){var J=e.pstyle("ghost").value==="yes";if(J){var q=e.pstyle("ghost-offset-x").pfValue,W=e.pstyle("ghost-offset-y").pfValue;Ir(s,s.x1+q,s.y1+W,s.x2+q,s.y2+W)}}var $=o.bodyBounds=o.bodyBounds||{};$o($,s),un($,y),on($,1),n&&(f=s.x1,c=s.x2,d=s.y1,g=s.y2,Ir(s,f-S,d-S,c+S,g+S));var Z=o.overlayBounds=o.overlayBounds||{};$o(Z,s),un(Z,y),on(Z,1);var ae=o.labelBounds=o.labelBounds||{};ae.all!=null?kd(ae.all):ae.all=mr(),n&&t.includeLabels&&(t.includeMainLabels&&ps(s,e,null),l&&(t.includeSourceLabels&&ps(s,e,"source"),t.includeTargetLabels&&ps(s,e,"target")))}return s.x1=Br(s.x1),s.y1=Br(s.y1),s.x2=Br(s.x2),s.y2=Br(s.y2),s.w=Br(s.x2-s.x1),s.h=Br(s.y2-s.y1),s.w>0&&s.h>0&&w&&(un(s,y),on(s,1)),s},"boundingBoxImpl"),Wv=v(function(e){var t=0,a=v(function(s){return(s?1:0)<<t++},"tf"),n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},"getKey"),$v=v(function(e){var t=v(function(o){return Math.round(o)},"r");if(e.isEdge()){var a=e.source().position(),n=e.target().position();return Vo([t(a.x),t(a.y),t(n.x),t(n.y)])}else{var i=e.position();return Vo([t(i.x),t(i.y)])}},"getBoundingBoxPosKey"),ol=v(function(e,t){var a=e._private,n,i=e.isEdge(),s=t==null?ul:Wv(t),o=s===ul;if(a.bbCache==null?(n=$g(e,Ba),a.bbCache=n,a.bbCachePosKey=$v(e)):n=a.bbCache,!o){var u=e.isNode();n=mr(),(t.includeNodes&&u||t.includeEdges&&!u)&&(t.includeOverlays?tt(n,a.overlayBounds):tt(n,a.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?tt(n,a.labelBounds.all):(t.includeMainLabels&&tt(n,a.labelBounds.mainRot),t.includeSourceLabels&&tt(n,a.labelBounds.sourceRot),t.includeTargetLabels&&tt(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},"cachedBoundingBoxImpl"),Ba={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},ul=Wv(Ba),ll=fr(Ba);pt.boundingBox=function(r){var e,t=r===void 0||r.useCache===void 0||r.useCache===!0,a=Zt(function(f){var c=f._private;return c.bbCache==null||c.styleDirty||c.bbCachePosKey!==$v(f)},function(f){return f.id()});if(t&&this.length===1&&!a(this[0]))r===void 0?r=Ba:r=ll(r),e=ol(this[0],r);else{e=mr(),r=r||Ba;var n=ll(r),i=this,s=i.cy(),o=s.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),o&&this.recalculateRenderedStyle(t),this.updateCompoundBounds(!t);for(var u=0;u<i.length;u++){var l=i[u];a(l)&&l.dirtyBoundingBoxCache(),tt(e,ol(l,n))}}return e.x1=Br(e.x1),e.y1=Br(e.y1),e.x2=Br(e.x2),e.y2=Br(e.y2),e.w=Br(e.x2-e.x1),e.h=Br(e.y2-e.y1),e};pt.dirtyBoundingBoxCache=function(){for(var r=0;r<this.length;r++){var e=this[r]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};pt.boundingBoxAt=function(r){var e=this.nodes(),t=this.cy(),a=t.hasCompoundNodes(),n=t.collection();if(a&&(n=e.filter(function(l){return l.isParent()}),e=e.not(n)),Le(r)){var i=r;r=v(function(){return i},"fn")}var s=v(function(f,c){return f._private.bbAtOldPos=r(f,c)},"storeOldPos"),o=v(function(f){return f._private.bbAtOldPos},"getOldPos");t.startBatch(),e.forEach(s).silentPositions(r),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var u=Sd(this.boundingBox({useCache:!1}));return e.silentPositions(o),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),t.endBatch(),u};Yt.boundingbox=Yt.bb=Yt.boundingBox;Yt.renderedBoundingbox=Yt.renderedBoundingBox;var Ug=pt,ya,Va;ya=Va={};var Uv=v(function(e){e.uppercaseName=To(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=To(e.outerName),ya[e.name]=v(function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var o=a.pstyle(e.name);switch(o.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return o.pfValue}}else return 1},"dimImpl"),ya["outer"+e.uppercaseName]=v(function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){var o=a[e.name](),u=a.pstyle("border-position").value,l;u==="center"?l=a.pstyle("border-width").pfValue:u==="outside"?l=2*a.pstyle("border-width").pfValue:l=0;var f=2*a.padding();return o+l+f}else return 1},"outerDimImpl"),ya["rendered"+e.uppercaseName]=v(function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},"renderedDimImpl"),ya["rendered"+e.uppercaseOuterName]=v(function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}},"renderedOuterDimImpl")},"defineDimFns");Uv({name:"width"});Uv({name:"height"});Va.padding=function(){var r=this[0],e=r._private;return r.isParent()?(r.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:r.pstyle("padding").pfValue):r.pstyle("padding").pfValue};Va.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()};Va.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var Kg=Va,Xg=v(function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},"ifEdge"),Yg=v(function(e,t){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return In(t(e),a.zoom(),a.pan())}},"ifEdgeRenderedPosition"),Zg=v(function(e,t){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),n=a.pan(),i=a.zoom();return t(e).map(function(s){return In(s,i,n)})}},"ifEdgeRenderedPositions"),Qg=v(function(e){return e.renderer().getControlPoints(e)},"controlPoints"),Jg=v(function(e){return e.renderer().getSegmentPoints(e)},"segmentPoints"),jg=v(function(e){return e.renderer().getSourceEndpoint(e)},"sourceEndpoint"),ep=v(function(e){return e.renderer().getTargetEndpoint(e)},"targetEndpoint"),rp=v(function(e){return e.renderer().getEdgeMidpoint(e)},"midpoint"),vl={controlPoints:{get:Qg,mult:!0},segmentPoints:{get:Jg,mult:!0},sourceEndpoint:{get:jg},targetEndpoint:{get:ep},midpoint:{get:rp}},tp=v(function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},"renderedName"),ap=Object.keys(vl).reduce(function(r,e){var t=vl[e],a=tp(e);return r[e]=function(){return Xg(this,t.get)},t.mult?r[a]=function(){return Zg(this,t.get)}:r[a]=function(){return Yg(this,t.get)},r},{}),np=me({},Hg,Ug,Kg,ap);var Kv=v(function(e,t){this.recycle(e,t)},"Event");function fa(){return!1}v(fa,"returnFalse");function ja(){return!0}v(ja,"returnTrue");Kv.prototype={instanceString:v(function(){return"event"},"instanceString"),recycle:v(function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=fa,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ja:fa):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type!=null?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),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},"recycle"),preventDefault:v(function(){this.isDefaultPrevented=ja;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},"preventDefault"),stopPropagation:v(function(){this.isPropagationStopped=ja;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},"stopPropagation"),stopImmediatePropagation:v(function(){this.isImmediatePropagationStopped=ja,this.stopPropagation()},"stopImmediatePropagation"),isDefaultPrevented:fa,isPropagationStopped:fa,isImmediatePropagationStopped:fa};var Xv=/^([^.]+)(\.(?:[^.]+))?$/,ip=".*",Yv={qualifierCompare:v(function(e,t){return e===t},"qualifierCompare"),eventMatches:v(function(){return!0},"eventMatches"),addEventFields:v(function(){},"addEventFields"),callbackContext:v(function(e){return e},"callbackContext"),beforeEmit:v(function(){},"beforeEmit"),afterEmit:v(function(){},"afterEmit"),bubble:v(function(){return!1},"bubble"),parent:v(function(){return null},"parent"),context:null},fl=Object.keys(Yv),sp={};function _n(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sp,e=arguments.length>1?arguments[1]:void 0,t=0;t<fl.length;t++){var a=fl[t];this[a]=r[a]||Yv[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}v(_n,"Emitter");var dt=_n.prototype,Zv=v(function(e,t,a,n,i,s,o){Ue(n)&&(i=n,n=null),o&&(s==null?s=o:s=me({},s,o));for(var u=qe(a)?a:a.split(/\s+/),l=0;l<u.length;l++){var f=u[l];if(!ut(f)){var c=f.match(Xv);if(c){var d=c[1],g=c[2]?c[2]:null,h=t(e,f,d,g,n,i,s);if(h===!1)break}}}},"forEachEvent"),cl=v(function(e,t){return e.addEventFields(e.context,t),new Kv(t.type,t)},"makeEventObj"),op=v(function(e,t,a){if(dc(a)){t(e,a);return}else if(Le(a)){t(e,cl(e,a));return}for(var n=qe(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var s=n[i];if(!ut(s)){var o=s.match(Xv);if(o){var u=o[1],l=o[2]?o[2]:null,f=cl(e,{type:u,namespace:l,target:e.context});t(e,f)}}}},"forEachEventObj");dt.on=dt.addListener=function(r,e,t,a,n){return Zv(this,function(i,s,o,u,l,f,c){Ue(f)&&i.listeners.push({event:s,callback:f,type:o,namespace:u,qualifier:l,conf:c})},r,e,t,a,n),this};dt.one=function(r,e,t,a){return this.on(r,e,t,a,{one:!0})};dt.removeListener=dt.off=function(r,e,t,a){var n=this;this.emitting!==0&&(this.listeners=Yc(this.listeners));for(var i=this.listeners,s=v(function(l){var f=i[l];Zv(n,function(c,d,g,h,m,p){if((f.type===g||r==="*")&&(!h&&f.namespace!==".*"||f.namespace===h)&&(!m||c.qualifierCompare(f.qualifier,m))&&(!p||f.callback===p))return i.splice(l,1),!1},r,e,t,a)},"_loop"),o=i.length-1;o>=0;o--)s(o);return this};dt.removeAllListeners=function(){return this.removeListener("*")};dt.emit=dt.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,qe(e)||(e=[e]),op(this,function(i,s){t!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:t}],n=a.length);for(var o=v(function(){var f=a[u];if(f.type===s.type&&(!f.namespace||f.namespace===s.namespace||f.namespace===ip)&&i.eventMatches(i.context,f,s)){var c=[s];e!=null&&Qc(c,e),i.beforeEmit(i.context,f,s),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(h){return h!==f}));var d=i.callbackContext(i.context,f,s),g=f.callback.apply(d,c);i.afterEmit(i.context,f,s),g===!1&&(s.stopPropagation(),s.preventDefault())}},"_loop2"),u=0;u<n;u++)o();i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,e)},r),this.emitting--,this};var up={qualifierCompare:v(function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},"qualifierCompare"),eventMatches:v(function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&La(a.target)&&n.matches(a.target):!0},"eventMatches"),addEventFields:v(function(e,t){t.cy=e.cy(),t.target=e},"addEventFields"),callbackContext:v(function(e,t,a){return t.qualifier!=null?a.target:e},"callbackContext"),beforeEmit:v(function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},"beforeEmit"),bubble:v(function(){return!0},"bubble"),parent:v(function(e){return e.isChild()?e.parent():e.cy()},"parent")},en=v(function(e){return ge(e)?new ft(e):e},"argSelector"),Qv={createEmitter:v(function(){for(var e=0;e<this.length;e++){var t=this[e],a=t._private;a.emitter||(a.emitter=new _n(up,t))}return this},"createEmitter"),emitter:v(function(){return this._private.emitter},"emitter"),on:v(function(e,t,a){for(var n=en(t),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a)}return this},"on"),removeListener:v(function(e,t,a){for(var n=en(t),i=0;i<this.length;i++){var s=this[i];s.emitter().removeListener(e,n,a)}return this},"removeListener"),removeAllListeners:v(function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},"removeAllListeners"),one:v(function(e,t,a){for(var n=en(t),i=0;i<this.length;i++){var s=this[i];s.emitter().one(e,n,a)}return this},"one"),once:v(function(e,t,a){for(var n=en(t),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a,{once:!0,onceCollection:this})}},"once"),emit:v(function(e,t){for(var a=0;a<this.length;a++){var n=this[a];n.emitter().emit(e,t)}return this},"emit"),emitAndNotify:v(function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this},"emitAndNotify")};ze.eventAliasesOn(Qv);var Jv={nodes:v(function(e){return this.filter(function(t){return t.isNode()}).filter(e)},"nodes"),edges:v(function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},"edges"),byGroup:v(function(){for(var e=this.spawn(),t=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):t.push(n)}return{nodes:e,edges:t}},"byGroup"),filter:v(function(e,t){if(e===void 0)return this;if(ge(e)||Sr(e))return new ft(e).filter(this);if(Ue(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var s=n[i],o=t?e.apply(t,[s,i,n]):e(s,i,n);o&&a.push(s)}return a}return this.spawn()},"filter"),not:v(function(e){if(e){ge(e)&&(e=this.filter(e));for(var t=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||t.push(n)}return t}else return this},"not"),absoluteComplement:v(function(){var e=this.cy();return e.mutableElements().not(this)},"absoluteComplement"),intersect:v(function(e){if(ge(e)){var t=e;return this.filter(t)}for(var a=this.spawn(),n=this,i=e,s=this.length<e.length,o=s?n:i,u=s?i:n,l=0;l<o.length;l++){var f=o[l];u.has(f)&&a.push(f)}return a},"intersect"),xor:v(function(e){var t=this._private.cy;ge(e)&&(e=t.$(e));var a=this.spawn(),n=this,i=e,s=v(function(u,l){for(var f=0;f<u.length;f++){var c=u[f],d=c._private.data.id,g=l.hasElementWithId(d);g||a.push(c)}},"add");return s(n,i),s(i,n),a},"xor"),diff:v(function(e){var t=this._private.cy;ge(e)&&(e=t.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),s=this,o=e,u=v(function(f,c,d){for(var g=0;g<f.length;g++){var h=f[g],m=h._private.data.id,p=c.hasElementWithId(m);p?i.merge(h):d.push(h)}},"add");return u(s,o,a),u(o,s,n),{left:a,right:n,both:i}},"diff"),add:v(function(e){var t=this._private.cy;if(!e)return this;if(ge(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var s=e[i],o=!this.has(s);o&&n.push(s)}return n},"add"),merge:v(function(e){var t=this._private,a=t.cy;if(!e)return this;if(e&&ge(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=t.map,s=0;s<e.length;s++){var o=e[s],u=o._private.data.id,l=!i.has(u);if(l){var f=this.length++;this[f]=o,i.set(u,{ele:o,index:f})}}return this},"merge"),unmergeAt:v(function(e){var t=this[e],a=t.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var s=e===this.length-1;if(this.length>1&&!s){var o=this.length-1,u=this[o],l=u._private.data.id;this[o]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},"unmergeAt"),unmergeOne:v(function(e){e=e[0];var t=this._private,a=e._private.data.id,n=t.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},"unmergeOne"),unmerge:v(function(e){var t=this._private.cy;if(!e)return this;if(e&&ge(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},"unmerge"),unmergeBy:v(function(e){for(var t=this.length-1;t>=0;t--){var a=this[t];e(a)&&this.unmergeAt(t)}return this},"unmergeBy"),map:v(function(e,t){for(var a=[],n=this,i=0;i<n.length;i++){var s=n[i],o=t?e.apply(t,[s,i,n]):e(s,i,n);a.push(o)}return a},"map"),reduce:v(function(e,t){for(var a=t,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},"reduce"),max:v(function(e,t){for(var a=-1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],u=t?e.apply(t,[o,s,i]):e(o,s,i);u>a&&(a=u,n=o)}return{value:a,ele:n}},"max"),min:v(function(e,t){for(var a=1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],u=t?e.apply(t,[o,s,i]):e(o,s,i);u<a&&(a=u,n=o)}return{value:a,ele:n}},"min")},Oe=Jv;Oe.u=Oe["|"]=Oe["+"]=Oe.union=Oe.or=Oe.add;Oe["\\"]=Oe["!"]=Oe["-"]=Oe.difference=Oe.relativeComplement=Oe.subtract=Oe.not;Oe.n=Oe["&"]=Oe["."]=Oe.and=Oe.intersection=Oe.intersect;Oe["^"]=Oe["(+)"]=Oe["(-)"]=Oe.symmetricDifference=Oe.symdiff=Oe.xor;Oe.fnFilter=Oe.filterFn=Oe.stdFilter=Oe.filter;Oe.complement=Oe.abscomp=Oe.absoluteComplement;var lp={isNode:v(function(){return this.group()==="nodes"},"isNode"),isEdge:v(function(){return this.group()==="edges"},"isEdge"),isLoop:v(function(){return this.isEdge()&&this.source()[0]===this.target()[0]},"isLoop"),isSimple:v(function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},"isSimple"),group:v(function(){var e=this[0];if(e)return e._private.group},"group")},jv=v(function(e,t){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var c=f.pstyle("z-compound-depth");return c.value==="auto"?n?f.zDepth():0:c.value==="bottom"?-1:c.value==="top"?Qs:0}v(i,"getDepth");var s=i(e)-i(t);if(s!==0)return s;function o(f){var c=f.pstyle("z-index-compare");return c.value==="auto"&&f.isNode()?1:0}v(o,"getEleDepth");var u=o(e)-o(t);if(u!==0)return u;var l=e.pstyle("z-index").value-t.pstyle("z-index").value;return l!==0?l:e.poolIndex()-t.poolIndex()},"zIndexSort"),Tn={forEach:v(function(e,t){if(Ue(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],s=t?e.apply(t,[i,n,this]):e(i,n,this);if(s===!1)break}return this},"forEach"),toArray:v(function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},"toArray"),slice:v(function(e,t){var a=[],n=this.length;t==null&&(t=n),e==null&&(e=0),e<0&&(e=n+e),t<0&&(t=n+t);for(var i=e;i>=0&&i<t&&i<n;i++)a.push(this[i]);return this.spawn(a)},"slice"),size:v(function(){return this.length},"size"),eq:v(function(e){return this[e]||this.spawn()},"eq"),first:v(function(){return this[0]||this.spawn()},"first"),last:v(function(){return this[this.length-1]||this.spawn()},"last"),empty:v(function(){return this.length===0},"empty"),nonempty:v(function(){return!this.empty()},"nonempty"),sort:v(function(e){if(!Ue(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},"sort"),sortByZIndex:v(function(){return this.sort(jv)},"sortByZIndex"),zDepth:v(function(){var e=this[0];if(e){var t=e._private,a=t.group;if(a==="nodes"){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:Qs-1}else{var i=t.source,s=t.target,o=i.zDepth(),u=s.zDepth();return Math.max(o,u,0)}}},"zDepth")};Tn.each=Tn.forEach;var vp=v(function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":tr(Symbol))!=e&&tr(Symbol.iterator)!=e;t&&(Tn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return Ql({next:v(function(){return i<s?n.value=a[i++]:(n.value=void 0,n.done=!0),n},"next")},Symbol.iterator,function(){return this})})},"defineSymbolIterator");vp();var fp=fr({nodeDimensionsIncludeLabels:!1}),vn={layoutDimensions:v(function(e){e=fp(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();t={w:a.w,h:a.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},"layoutDimensions"),layoutPositions:v(function(e,t,a){var n=this.nodes().filter(function(C){return!C.isParent()}),i=this.cy(),s=t.eles,o=v(function(T){return T.id()},"getMemoizeKey"),u=Zt(a,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=v(function(T,E,S){var D={x:E.x1+E.w/2,y:E.y1+E.h/2},B={x:(S.x-D.x)*T,y:(S.y-D.y)*T};return{x:D.x+B.x,y:D.y+B.y}},"calculateSpacing"),f=t.spacingFactor&&t.spacingFactor!==1,c=v(function(){if(!f)return null;for(var T=mr(),E=0;E<n.length;E++){var S=n[E],D=u(S,E);yv(T,D.x,D.y)}return T},"spacingBb"),d=c(),g=Zt(function(C,T){var E=u(C,T);if(f){var S=Math.abs(t.spacingFactor);E=l(S,d,E)}return t.transform!=null&&(E=t.transform(C,E)),E},o);if(t.animate){for(var h=0;h<n.length;h++){var m=n[h],p=g(m,h),y=t.animateFilter==null||t.animateFilter(m,h);if(y){var b=m.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}else m.position(p)}if(t.fit){var w=i.animation({fit:{boundingBox:s.boundingBoxAt(g),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(w)}else if(t.zoom!==void 0&&t.pan!==void 0){var x=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(x)}e.animations.forEach(function(C){return C.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),ra.all(e.animations.map(function(C){return C.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(g),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&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},"layoutPositions"),layout:v(function(e){var t=this.cy();return t.makeLayout(me({},e,{eles:this}))},"layout")};vn.createLayout=vn.makeLayout=vn.layout;function ef(r,e,t){var a=t._private,n=a.styleCache=a.styleCache||[],i;return(i=n[r])!=null||(i=n[r]=e(t)),i}v(ef,"styleCache");function Gn(r,e){return r=Bt(r),v(function(a){return ef(r,e,a)},"cachedStyleFunction")}v(Gn,"cacheStyleFunction");function Hn(r,e){r=Bt(r);var t=v(function(n){return e.call(n)},"selfFn");return v(function(){var n=this[0];if(n)return ef(r,t,n)},"cachedPrototypeStyleFunction")}v(Hn,"cachePrototypeStyleFunction");var lr={recalculateRenderedStyle:v(function(e){var t=this.cy(),a=t.renderer(),n=t.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},"recalculateRenderedStyle"),dirtyStyleCache:v(function(){var e=this.cy(),t=v(function(i){return i._private.styleCache=null},"dirty");if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(t)}else this.forEach(function(n){t(n),n.connectedEdges().forEach(t)});return this},"dirtyStyleCache"),updateStyle:v(function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var a=t._private.batchStyleEles;return a.merge(this),this}var n=t.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=i;return e?s.emitAndNotify("style"):s.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},"updateStyle"),cleanStyle:v(function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var a=this[t];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},"cleanStyle"),parsedStyle:v(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},"parsedStyle"),numericStyle:v(function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var a=t.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},"numericStyle"),numericStyleUnits:v(function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},"numericStyleUnits"),renderedStyle:v(function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=this[0];if(a)return t.style().getRenderedStyle(a,e)},"renderedStyle"),style:v(function(e,t){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Le(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(ge(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},"style"),removeStyle:v(function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=!1,n=t.style(),i=this;if(e===void 0)for(var s=0;s<i.length;s++){var o=i[s];n.removeAllBypasses(o,a)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];n.removeBypasses(l,e,a)}}return this.emitAndNotify("style"),this},"removeStyle"),show:v(function(){return this.css("display","element"),this},"show"),hide:v(function(){return this.css("display","none"),this},"hide"),effectiveOpacity:v(function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!t)return i;var s=n.data.parent?a.parents():null;if(s)for(var o=0;o<s.length;o++){var u=s[o],l=u.pstyle("opacity").value;i=l*i}return i}},"effectiveOpacity"),transparent:v(function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],a=t.cy().hasCompoundNodes();if(t)return a?t.effectiveOpacity()===0:t.pstyle("opacity").value===0},"transparent"),backgrounding:v(function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding},"backgrounding")};function ys(r,e){var t=r._private,a=t.data.parent?r.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}v(ys,"checkCompound");function lo(r){var e=r.ok,t=r.edgeOkViaNode||r.ok,a=r.parentOk||r.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],s=n.hasCompoundNodes();if(i){var o=i._private;if(!e(i))return!1;if(i.isNode())return!s||ys(i,a);var u=o.source,l=o.target;return t(u)&&(!s||ys(u,t))&&(u===l||t(l)&&(!s||ys(l,t)))}}}v(lo,"defineDerivedStateFunction");var ta=Gn("eleTakesUpSpace",function(r){return r.pstyle("display").value==="element"&&r.width()!==0&&(r.isNode()?r.height()!==0:!0)});lr.takesUpSpace=Hn("takesUpSpace",lo({ok:ta}));var cp=Gn("eleInteractive",function(r){return r.pstyle("events").value==="yes"&&r.pstyle("visibility").value==="visible"&&ta(r)}),dp=Gn("parentInteractive",function(r){return r.pstyle("visibility").value==="visible"&&ta(r)});lr.interactive=Hn("interactive",lo({ok:cp,parentOk:dp,edgeOkViaNode:ta}));lr.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var hp=Gn("eleVisible",function(r){return r.pstyle("visibility").value==="visible"&&r.pstyle("opacity").pfValue!==0&&ta(r)}),gp=ta;lr.visible=Hn("visible",lo({ok:hp,edgeOkViaNode:gp}));lr.hidden=function(){var r=this[0];if(r)return!r.visible()};lr.isBundledBezier=Hn("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});lr.bypass=lr.css=lr.style;lr.renderedCss=lr.renderedStyle;lr.removeBypass=lr.removeCss=lr.removeStyle;lr.pstyle=lr.parsedStyle;var ot={};function dl(r){return function(){var e=arguments,t=[];if(e.length===2){var a=e[0],n=e[1];this.on(r.event,a,n)}else if(e.length===1&&Ue(e[0])){var i=e[0];this.on(r.event,i)}else if(e.length===0||e.length===1&&qe(e[0])){for(var s=e.length===1?e[0]:null,o=0;o<this.length;o++){var u=this[o],l=!r.ableField||u._private[r.ableField],f=u._private[r.field]!=r.value;if(r.overrideAble){var c=r.overrideAble(u);if(c!==void 0&&(l=c,!c))return this}l&&(u._private[r.field]=r.value,f&&t.push(u))}var d=this.spawn(t);d.updateStyle(),d.emit(r.event),s&&d.emit(s)}return this}}v(dl,"defineSwitchFunction");function aa(r){ot[r.field]=function(){var e=this[0];if(e){if(r.overrideField){var t=r.overrideField(e);if(t!==void 0)return t}return e._private[r.field]}},ot[r.on]=dl({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),ot[r.off]=dl({event:r.off,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!1})}v(aa,"defineSwitchSet");aa({field:"locked",overrideField:v(function(e){return e.cy().autolock()?!0:void 0},"overrideField"),on:"lock",off:"unlock"});aa({field:"grabbable",overrideField:v(function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},"overrideField"),on:"grabify",off:"ungrabify"});aa({field:"selected",ableField:"selectable",overrideAble:v(function(e){return e.cy().autounselectify()?!1:void 0},"overrideAble"),on:"select",off:"unselect"});aa({field:"selectable",overrideField:v(function(e){return e.cy().autounselectify()?!1:void 0},"overrideField"),on:"selectify",off:"unselectify"});ot.deselect=ot.unselect;ot.grabbed=function(){var r=this[0];if(r)return r._private.grabbed};aa({field:"active",on:"activate",off:"unactivate"});aa({field:"pannable",on:"panify",off:"unpanify"});ot.inactive=function(){var r=this[0];if(r)return!r._private.active};var hr={},hl=v(function(e){return v(function(a){for(var n=this,i=[],s=0;s<n.length;s++){var o=n[s];if(o.isNode()){for(var u=!1,l=o.connectedEdges(),f=0;f<l.length;f++){var c=l[f],d=c.source(),g=c.target();if(e.noIncomingEdges&&g===o&&d!==o||e.noOutgoingEdges&&d===o&&g!==o){u=!0;break}}u||i.push(o)}}return this.spawn(i,!0).filter(a)},"dagExtremityImpl")},"defineDagExtremity"),gl=v(function(e){return function(t){for(var a=this,n=[],i=0;i<a.length;i++){var s=a[i];if(s.isNode())for(var o=s.connectedEdges(),u=0;u<o.length;u++){var l=o[u],f=l.source(),c=l.target();e.outgoing&&f===s?(n.push(l),n.push(c)):e.incoming&&c===s&&(n.push(l),n.push(f))}}return this.spawn(n,!0).filter(t)}},"defineDagOneHop"),pl=v(function(e){return function(t){for(var a=this,n=[],i={};;){var s=e.outgoing?a.outgoers():a.incomers();if(s.length===0)break;for(var o=!1,u=0;u<s.length;u++){var l=s[u],f=l.id();i[f]||(i[f]=!0,n.push(l),o=!0)}if(!o)break;a=s}return this.spawn(n,!0).filter(t)}},"defineDagAllHops");hr.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null};me(hr,{roots:hl({noIncomingEdges:!0}),leaves:hl({noOutgoingEdges:!0}),outgoers:Pr(gl({outgoing:!0}),"outgoers"),successors:pl({outgoing:!0}),incomers:Pr(gl({incoming:!0}),"incomers"),predecessors:pl({})});me(hr,{neighborhood:Pr(function(r){for(var e=[],t=this.nodes(),a=0;a<t.length;a++)for(var n=t[a],i=n.connectedEdges(),s=0;s<i.length;s++){var o=i[s],u=o.source(),l=o.target(),f=n===u?l:u;f.length>0&&e.push(f[0]),e.push(o[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:v(function(e){return this.neighborhood().add(this).filter(e)},"closedNeighborhood"),openNeighborhood:v(function(e){return this.neighborhood(e)},"openNeighborhood")});hr.neighbourhood=hr.neighborhood;hr.closedNeighbourhood=hr.closedNeighborhood;hr.openNeighbourhood=hr.openNeighborhood;me(hr,{source:Pr(v(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"sourceImpl"),"source"),target:Pr(v(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"targetImpl"),"target"),sources:yl({attr:"source"}),targets:yl({attr:"target"})});function yl(r){return v(function(t){for(var a=[],n=0;n<this.length;n++){var i=this[n],s=i._private[r.attr];s&&a.push(s)}return this.spawn(a,!0).filter(t)},"sourceImpl")}v(yl,"defineSourceFunction");me(hr,{edgesWith:Pr(ml(),"edgesWith"),edgesTo:Pr(ml({thisIsSrc:!0}),"edgesTo")});function ml(r){return v(function(t){var a=[],n=this._private.cy,i=r||{};ge(t)&&(t=n.$(t));for(var s=0;s<t.length;s++)for(var o=t[s]._private.edges,u=0;u<o.length;u++){var l=o[u],f=l._private.data,c=this.hasElementWithId(f.source)&&t.hasElementWithId(f.target),d=t.hasElementWithId(f.source)&&this.hasElementWithId(f.target),g=c||d;g&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!c||i.thisIsTgt&&!d)||a.push(l))}return this.spawn(a,!0)},"edgesWithImpl")}v(ml,"defineEdgesWithFunction");me(hr,{connectedEdges:Pr(function(r){for(var e=[],t=this,a=0;a<t.length;a++){var n=t[a];if(n.isNode())for(var i=n._private.edges,s=0;s<i.length;s++){var o=i[s];e.push(o)}}return this.spawn(e,!0).filter(r)},"connectedEdges"),connectedNodes:Pr(function(r){for(var e=[],t=this,a=0;a<t.length;a++){var n=t[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(r)},"connectedNodes"),parallelEdges:Pr(bl(),"parallelEdges"),codirectedEdges:Pr(bl({codirected:!0}),"codirectedEdges")});function bl(r){var e={codirected:!1};return r=me({},e,r),v(function(a){for(var n=[],i=this.edges(),s=r,o=0;o<i.length;o++)for(var u=i[o],l=u._private,f=l.source,c=f._private.data.id,d=l.data.target,g=f._private.edges,h=0;h<g.length;h++){var m=g[h],p=m._private.data,y=p.target,b=p.source,w=y===d&&b===c,x=c===y&&d===b;(s.codirected&&w||!s.codirected&&(w||x))&&n.push(m)}return this.spawn(n,!0).filter(a)},"parallelEdgesImpl")}v(bl,"defineParallelEdgesFunction");me(hr,{components:v(function(e){var t=this,a=t.cy(),n=a.collection(),i=e==null?t.nodes():e.nodes(),s=[];e!=null&&i.empty()&&(i=e.sources());var o=v(function(f,c){n.merge(f),i.unmerge(f),c.merge(f)},"visitInComponent");if(i.empty())return t.spawn();var u=v(function(){var f=a.collection();s.push(f);var c=i[0];o(c,f),t.bfs({directed:!1,roots:c,visit:v(function(g){return o(g,f)},"visit")}),f.forEach(function(d){d.connectedEdges().forEach(function(g){t.has(g)&&f.has(g.source())&&f.has(g.target())&&f.merge(g)})})},"_loop");do u();while(i.length>0);return s},"components"),component:v(function(){var e=this[0];return e.cy().mutableElements().components(e)[0]},"component")});hr.componentsOf=hr.components;var vr=v(function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){We("A collection must have a reference to the core");return}var i=new Xr,s=!1;if(!t)t=[];else if(t.length>0&&Le(t[0])&&!La(t[0])){s=!0;for(var o=[],u=new ea,l=0,f=t.length;l<f;l++){var c=t[l];c.data==null&&(c.data={});var d=c.data;if(d.id==null)d.id=hv();else if(e.hasElementWithId(d.id)||u.has(d.id))continue;var g=new Ln(e,c,!1);o.push(g),u.add(d.id)}t=o}this.length=0;for(var h=0,m=t.length;h<m;h++){var p=t[h][0];if(p!=null){var y=p._private.data.id;(!a||!i.has(y))&&(a&&i.set(y,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(b){this.lazyMap=b},rebuildMap:v(function(){for(var w=this.lazyMap=new Xr,x=this.eles,C=0;C<x.length;C++){var T=x[C];w.set(T.id(),{index:C,ele:T})}},"rebuildMap")},a&&(this._private.map=i),s&&!n&&this.restore()},"Collection"),Ge=Ln.prototype=vr.prototype=Object.create(Array.prototype);Ge.instanceString=function(){return"collection"};Ge.spawn=function(r,e){return new vr(this.cy(),r,e)};Ge.spawnSelf=function(){return this.spawn(this)};Ge.cy=function(){return this._private.cy};Ge.renderer=function(){return this._private.cy.renderer()};Ge.element=function(){return this[0]};Ge.collection=function(){return ev(this)?this:new vr(this._private.cy,[this])};Ge.unique=function(){return new vr(this._private.cy,this,!0)};Ge.hasElementWithId=function(r){return r=""+r,this._private.map.has(r)};Ge.getElementById=function(r){r=""+r;var e=this._private.cy,t=this._private.map.get(r);return t?t.ele:new vr(e)};Ge.$id=Ge.getElementById;Ge.poolIndex=function(){var r=this._private.cy,e=r._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index};Ge.indexOf=function(r){var e=r[0]._private.data.id;return this._private.map.get(e).index};Ge.indexOfId=function(r){return r=""+r,this._private.map.get(r).index};Ge.json=function(r){var e=this.element(),t=this.cy();if(e==null&&r)return this;if(e!=null){var a=e._private;if(Le(r)){if(t.startBatch(),r.data){e.data(r.data);var n=a.data;if(e.isEdge()){var i=!1,s={},o=r.data.source,u=r.data.target;o!=null&&o!=n.source&&(s.source=""+o,i=!0),u!=null&&u!=n.target&&(s.target=""+u,i=!0),i&&(e=e.move(s))}else{var l="parent"in r.data,f=r.data.parent;l&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}r.position&&e.position(r.position);var c=v(function(m,p,y){var b=r[m];b!=null&&b!==a[m]&&(b?e[p]():e[y]())},"checkSwitch");return c("removed","remove","restore"),c("selected","select","unselect"),c("selectable","selectify","unselectify"),c("locked","lock","unlock"),c("grabbable","grabify","ungrabify"),c("pannable","panify","unpanify"),r.classes!=null&&e.classes(r.classes),t.endBatch(),this}else if(r===void 0){var d={data:_r(a.data),position:_r(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};d.classes="";var g=0;return a.classes.forEach(function(h){return d.classes+=g++===0?h:" "+h}),d}}};Ge.jsons=function(){for(var r=[],e=0;e<this.length;e++){var t=this[e],a=t.json();r.push(a)}return r};Ge.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var a=this[t],n=a.json(),i=new Ln(r,n,!1);e.push(i)}return new vr(r,e)};Ge.copy=Ge.clone;Ge.restore=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=t.cy(),n=a._private,i=[],s=[],o,u=0,l=t.length;u<l;u++){var f=t[u];e&&!f.removed()||(f.isNode()?i.push(f):s.push(f))}o=i.concat(s);var c,d=v(function(){o.splice(c,1),c--},"removeFromElements");for(c=0;c<o.length;c++){var g=o[c],h=g._private,m=h.data;if(g.clearTraversalCache(),!(!e&&!h.removed)){if(m.id===void 0)m.id=hv();else if(ne(m.id))m.id=""+m.id;else if(ut(m.id)||!ge(m.id)){We("Can not create element with invalid string ID `"+m.id+"`"),d();continue}else if(a.hasElementWithId(m.id)){We("Can not create second element with ID `"+m.id+"`"),d();continue}}var p=m.id;if(g.isNode()){var y=h.position;y.x==null&&(y.x=0),y.y==null&&(y.y=0)}if(g.isEdge()){for(var b=g,w=["source","target"],x=w.length,C=!1,T=0;T<x;T++){var E=w[T],S=m[E];ne(S)&&(S=m[E]=""+m[E]),S==null||S===""?(We("Can not create edge `"+p+"` with unspecified "+E),C=!0):a.hasElementWithId(S)||(We("Can not create edge `"+p+"` with nonexistent "+E+" `"+S+"`"),C=!0)}if(C){d();continue}var D=a.getElementById(m.source),B=a.getElementById(m.target);D.same(B)?D._private.edges.push(b):(D._private.edges.push(b),B._private.edges.push(b)),b._private.source=D,b._private.target=B}h.map=new Xr,h.map.set(p,{ele:g,index:0}),h.removed=!1,e&&a.addToPool(g)}for(var P=0;P<i.length;P++){var A=i[P],R=A._private.data;ne(R.parent)&&(R.parent=""+R.parent);var M=R.parent,I=M!=null;if(I||A._private.parent){var O=A._private.parent?a.collection().merge(A._private.parent):a.getElementById(M);if(O.empty())R.parent=void 0;else if(O[0].removed())Fe("Node added with missing parent, reference to parent removed"),R.parent=void 0,A._private.parent=null;else{for(var L=!1,N=O;!N.empty();){if(A.same(N)){L=!0,R.parent=void 0;break}N=N.parent()}L||(O[0]._private.children.push(A),A._private.parent=O[0],n.hasCompoundNodes=!0)}}}if(o.length>0){for(var _=o.length===t.length?t:new vr(a,o),G=0;G<_.length;G++){var z=_[G];z.isNode()||(z.parallelEdges().clearTraversalCache(),z.source().clearTraversalCache(),z.target().clearTraversalCache())}var V;n.hasCompoundNodes?V=a.collection().merge(_).merge(_.connectedNodes()).merge(_.parent()):V=_,V.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?_.emitAndNotify("add"):e&&_.emit("add")}return t};Ge.removed=function(){var r=this[0];return r&&r._private.removed};Ge.inside=function(){var r=this[0];return r&&!r._private.removed};Ge.remove=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=[],n={},i=t._private.cy;function s(M){for(var I=M._private.edges,O=0;O<I.length;O++)u(I[O])}v(s,"addConnectedEdges");function o(M){for(var I=M._private.children,O=0;O<I.length;O++)u(I[O])}v(o,"addChildren");function u(M){var I=n[M.id()];e&&M.removed()||I||(n[M.id()]=!0,M.isNode()?(a.push(M),s(M),o(M)):a.unshift(M))}v(u,"add");for(var l=0,f=t.length;l<f;l++){var c=t[l];u(c)}function d(M,I){var O=M._private.edges;lt(O,I),M.clearTraversalCache()}v(d,"removeEdgeRef");function g(M){M.clearTraversalCache()}v(g,"removeParallelRef");var h=[];h.ids={};function m(M,I){I=I[0],M=M[0];var O=M._private.children,L=M.id();lt(O,I),I._private.parent=null,h.ids[L]||(h.ids[L]=!0,h.push(M))}v(m,"removeChildRef"),t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var p=0;p<a.length;p++){var y=a[p];if(y.isEdge()){var b=y.source()[0],w=y.target()[0];d(b,y),d(w,y);for(var x=y.parallelEdges(),C=0;C<x.length;C++){var T=x[C];g(T),T.isBundledBezier()&&T.dirtyBoundingBoxCache()}}else{var E=y.parent();E.length!==0&&m(E,y)}e&&(y._private.removed=!0)}var S=i._private.elements;i._private.hasCompoundNodes=!1;for(var D=0;D<S.length;D++){var B=S[D];if(B.isParent()){i._private.hasCompoundNodes=!0;break}}var P=new vr(this.cy(),a);P.size()>0&&(r?P.emitAndNotify("remove"):e&&P.emit("remove"));for(var A=0;A<h.length;A++){var R=h[A];(!e||!R.removed())&&R.updateStyle()}return P};Ge.move=function(r){var e=this._private.cy,t=this,a=!1,n=!1,i=v(function(h){return h==null?h:""+h},"toString");if(r.source!==void 0||r.target!==void 0){var s=i(r.source),o=i(r.target),u=s!=null&&e.hasElementWithId(s),l=o!=null&&e.hasElementWithId(o);(u||l)&&(e.batch(function(){t.remove(a,n),t.emitAndNotify("moveout");for(var g=0;g<t.length;g++){var h=t[g],m=h._private.data;h.isEdge()&&(u&&(m.source=s),l&&(m.target=o))}t.restore(a,n)}),t.emitAndNotify("move"))}else if(r.parent!==void 0){var f=i(r.parent),c=f===null||e.hasElementWithId(f);if(c){var d=f===null?void 0:f;e.batch(function(){var g=t.remove(a,n);g.emitAndNotify("moveout");for(var h=0;h<t.length;h++){var m=t[h],p=m._private.data;m.isNode()&&(p.parent=d)}g.restore(a,n)}),t.emitAndNotify("move")}}return this};[kv,kg,ln,st,Jt,Gg,qn,np,Qv,Jv,lp,Tn,vn,lr,ot,hr].forEach(function(r){me(Ge,r)});var pp={add:v(function(e){var t,a=this;if(Sr(e)){var n=e;if(n._private.cy===a)t=n.restore();else{for(var i=[],s=0;s<n.length;s++){var o=n[s];i.push(o.json())}t=new vr(a,i)}}else if(qe(e)){var u=e;t=new vr(a,u)}else if(Le(e)&&(qe(e.nodes)||qe(e.edges))){for(var l=e,f=[],c=["nodes","edges"],d=0,g=c.length;d<g;d++){var h=c[d],m=l[h];if(qe(m))for(var p=0,y=m.length;p<y;p++){var b=me({group:h},m[p]);f.push(b)}}t=new vr(a,f)}else{var w=e;t=new Ln(a,w).collection()}return t},"add"),remove:v(function(e){if(!Sr(e)){if(ge(e)){var t=e;e=this.$(t)}}return e.remove()},"remove")};function yp(r,e,t,a){var n=4,i=.001,s=1e-7,o=10,u=11,l=1/(u-1),f=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var c=0;c<4;++c)if(typeof arguments[c]!="number"||isNaN(arguments[c])||!isFinite(arguments[c]))return!1;r=Math.min(r,1),t=Math.min(t,1),r=Math.max(r,0),t=Math.max(t,0);var d=f?new Float32Array(u):new Array(u);function g(B,P){return 1-3*P+3*B}v(g,"A");function h(B,P){return 3*P-6*B}v(h,"B");function m(B){return 3*B}v(m,"C");function p(B,P,A){return((g(P,A)*B+h(P,A))*B+m(P))*B}v(p,"calcBezier");function y(B,P,A){return 3*g(P,A)*B*B+2*h(P,A)*B+m(P)}v(y,"getSlope");function b(B,P){for(var A=0;A<n;++A){var R=y(P,r,t);if(R===0)return P;var M=p(P,r,t)-B;P-=M/R}return P}v(b,"newtonRaphsonIterate");function w(){for(var B=0;B<u;++B)d[B]=p(B*l,r,t)}v(w,"calcSampleValues");function x(B,P,A){var R,M,I=0;do M=P+(A-P)/2,R=p(M,r,t)-B,R>0?A=M:P=M;while(Math.abs(R)>s&&++I<o);return M}v(x,"binarySubdivide");function C(B){for(var P=0,A=1,R=u-1;A!==R&&d[A]<=B;++A)P+=l;--A;var M=(B-d[A])/(d[A+1]-d[A]),I=P+M*l,O=y(I,r,t);return O>=i?b(B,I):O===0?I:x(B,P,P+l)}v(C,"getTForX");var T=!1;function E(){T=!0,(r!==e||t!==a)&&w()}v(E,"precompute");var S=v(function(P){return T||E(),r===e&&t===a?P:P===0?0:P===1?1:p(C(P),e,a)},"f");S.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var D="generateBezier("+[r,e,t,a]+")";return S.toString=function(){return D},S}v(yp,"generateCubicBezier");var mp=(function(){function r(a){return-a.tension*a.x-a.friction*a.v}v(r,"springAccelerationForState");function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:r(s)}}v(e,"springEvaluateStateWithDerivative");function t(a,n){var i={dx:a.v,dv:r(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),u=e(a,n,o),l=1/6*(i.dx+2*(s.dx+o.dx)+u.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+f*n,a}return v(t,"springIntegrateState"),v(function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,c=16/1e3,d,g,h;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,d=s!==null,d?(l=a(n,i),g=l/s*c):g=c;h=t(h||o,g),u.push(1+h.x),l+=16,Math.abs(h.x)>f&&Math.abs(h.v)>f;);return d?function(m){return u[m*(u.length-1)|0]}:l},"springRK4Factory")})(),_e=v(function(e,t,a,n){var i=yp(e,t,a,n);return function(s,o,u){return s+(o-s)*i(u)}},"cubicBezier"),fn={linear:v(function(e,t,a){return e+(t-e)*a},"linear"),ease:_e(.25,.1,.25,1),"ease-in":_e(.42,0,1,1),"ease-out":_e(0,0,.58,1),"ease-in-out":_e(.42,0,.58,1),"ease-in-sine":_e(.47,0,.745,.715),"ease-out-sine":_e(.39,.575,.565,1),"ease-in-out-sine":_e(.445,.05,.55,.95),"ease-in-quad":_e(.55,.085,.68,.53),"ease-out-quad":_e(.25,.46,.45,.94),"ease-in-out-quad":_e(.455,.03,.515,.955),"ease-in-cubic":_e(.55,.055,.675,.19),"ease-out-cubic":_e(.215,.61,.355,1),"ease-in-out-cubic":_e(.645,.045,.355,1),"ease-in-quart":_e(.895,.03,.685,.22),"ease-out-quart":_e(.165,.84,.44,1),"ease-in-out-quart":_e(.77,0,.175,1),"ease-in-quint":_e(.755,.05,.855,.06),"ease-out-quint":_e(.23,1,.32,1),"ease-in-out-quint":_e(.86,0,.07,1),"ease-in-expo":_e(.95,.05,.795,.035),"ease-out-expo":_e(.19,1,.22,1),"ease-in-out-expo":_e(1,0,0,1),"ease-in-circ":_e(.6,.04,.98,.335),"ease-out-circ":_e(.075,.82,.165,1),"ease-in-out-circ":_e(.785,.135,.15,.86),spring:v(function(e,t,a){if(a===0)return fn.linear;var n=mp(e,t,a);return function(i,s,o){return i+(s-i)*n(o)}},"spring"),"cubic-bezier":_e};function wl(r,e,t,a,n){if(a===1||e===t)return t;var i=n(e,t,a);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}v(wl,"getEasedValue");function xl(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}v(xl,"getValue");function zt(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var s=xl(r,n),o=xl(e,n);if(ne(s)&&ne(o))return wl(i,s,o,t,a);if(qe(s)&&qe(o)){for(var u=[],l=0;l<o.length;l++){var f=s[l],c=o[l];if(f!=null&&c!=null){var d=wl(i,f,c,t,a);u.push(d)}else u.push(c)}return u}}v(zt,"ease");function bp(r,e,t,a){var n=!a,i=r._private,s=e._private,o=s.easing,u=s.startTime,l=a?r:r.cy(),f=l.style();if(!s.easingImpl)if(o==null)s.easingImpl=fn.linear;else{var c;if(ge(o)){var d=f.parse("transition-timing-function",o);c=d.value}else c=o;var g,h;ge(c)?(g=c,h=[]):(g=c[1],h=c.slice(2).map(function(_){return+_})),h.length>0?(g==="spring"&&h.push(s.duration),s.easingImpl=fn[g].apply(null,h)):s.easingImpl=fn[g]}var m=s.easingImpl,p;if(s.duration===0?p=1:p=(t-u)/s.duration,s.applying&&(p=s.progress),p<0?p=0:p>1&&(p=1),s.delay==null){var y=s.startPosition,b=s.position;if(b&&n&&!r.locked()){var w={};ca(y.x,b.x)&&(w.x=zt(y.x,b.x,p,m)),ca(y.y,b.y)&&(w.y=zt(y.y,b.y,p,m)),r.position(w)}var x=s.startPan,C=s.pan,T=i.pan,E=C!=null&&a;E&&(ca(x.x,C.x)&&(T.x=zt(x.x,C.x,p,m)),ca(x.y,C.y)&&(T.y=zt(x.y,C.y,p,m)),r.emit("pan"));var S=s.startZoom,D=s.zoom,B=D!=null&&a;B&&(ca(S,D)&&(i.zoom=Sa(i.minZoom,zt(S,D,p,m),i.maxZoom)),r.emit("zoom")),(E||B)&&r.emit("viewport");var P=s.style;if(P&&P.length>0&&n){for(var A=0;A<P.length;A++){var R=P[A],M=R.name,I=R,O=s.startStyle[M],L=f.properties[O.name],N=zt(O,I,p,m,L);f.overrideBypass(r,M,N)}r.emit("style")}}return s.progress=p,p}v(bp,"step$1");function ca(r,e){return r==null||e==null?!1:ne(r)&&ne(e)?!0:!!(r&&e)}v(ca,"valid");function wp(r,e,t,a){var n=e._private;n.started=!0,n.startTime=t-n.progress*n.duration}v(wp,"startAnimation");function El(r,e){var t=e._private.aniEles,a=[];function n(f,c){var d=f._private,g=d.animation.current,h=d.animation.queue,m=!1;if(g.length===0){var p=h.shift();p&&g.push(p)}for(var y=v(function(T){for(var E=T.length-1;E>=0;E--){var S=T[E];S()}T.splice(0,T.length)},"callbacks"),b=g.length-1;b>=0;b--){var w=g[b],x=w._private;if(x.stopped){g.splice(b,1),x.hooked=!1,x.playing=!1,x.started=!1,y(x.frames);continue}!x.playing&&!x.applying||(x.playing&&x.applying&&(x.applying=!1),x.started||wp(f,w,r),bp(f,w,r,c),x.applying&&(x.applying=!1),y(x.frames),x.step!=null&&x.step(r),w.completed()&&(g.splice(b,1),x.hooked=!1,x.playing=!1,x.started=!1,y(x.completes)),m=!0)}return!c&&g.length===0&&h.length===0&&a.push(f),m}v(n,"stepOne");for(var i=!1,s=0;s<t.length;s++){var o=t[s],u=n(o);i=i||u}var l=n(e,!0);(i||l)&&(t.length>0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}v(El,"stepAll");var xp={animate:ze.animate(),animation:ze.animation(),animated:ze.animated(),clearQueue:ze.clearQueue(),delay:ze.delay(),delayAnimation:ze.delayAnimation(),stop:ze.stop(),addToAnimationPool:v(function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},"addToAnimationPool"),stopAnimationLoop:v(function(){this._private.animationsRunning=!1},"stopAnimationLoop"),startAnimationLoop:v(function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&bn(v(function(i){El(i,e),t()},"animationStep"))}v(t,"headlessStep");var a=e.renderer();a&&a.beforeRender?a.beforeRender(v(function(i,s){El(s,e)},"rendererAnimationStep"),a.beforeRenderPriorities.animations):t()},"startAnimationLoop")},Ep={qualifierCompare:v(function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},"qualifierCompare"),eventMatches:v(function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&La(a.target)&&n.matches(a.target):!0},"eventMatches"),addEventFields:v(function(e,t){t.cy=e,t.target=e},"addEventFields"),callbackContext:v(function(e,t,a){return t.qualifier!=null?a.target:e},"callbackContext")},rn=v(function(e){return ge(e)?new ft(e):e},"argSelector"),rf={createEmitter:v(function(){var e=this._private;return e.emitter||(e.emitter=new _n(Ep,this)),this},"createEmitter"),emitter:v(function(){return this._private.emitter},"emitter"),on:v(function(e,t,a){return this.emitter().on(e,rn(t),a),this},"on"),removeListener:v(function(e,t,a){return this.emitter().removeListener(e,rn(t),a),this},"removeListener"),removeAllListeners:v(function(){return this.emitter().removeAllListeners(),this},"removeAllListeners"),one:v(function(e,t,a){return this.emitter().one(e,rn(t),a),this},"one"),once:v(function(e,t,a){return this.emitter().one(e,rn(t),a),this},"once"),emit:v(function(e,t){return this.emitter().emit(e,t),this},"emit"),emitAndNotify:v(function(e,t){return this.emit(e),this.notify(e,t),this},"emitAndNotify")};ze.eventAliasesOn(rf);var Ns={png:v(function(e){var t=this._private.renderer;return e=e||{},t.png(e)},"png"),jpg:v(function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)},"jpg")};Ns.jpeg=Ns.jpg;var cn={layout:v(function(e){var t=this;if(e==null){We("Layout options must be specified to make a layout");return}if(e.name==null){We("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){We("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ge(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var s=new n(me({},e,{cy:t,eles:i}));return s},"layout")};cn.createLayout=cn.makeLayout=cn.layout;var Cp={notify:v(function(e,t){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();t!=null&&n.merge(t);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},"notify"),notifications:v(function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},"notifications"),noNotifications:v(function(e){this.notifications(!1),e(),this.notifications(!0)},"noNotifications"),batching:v(function(){return this._private.batchCount>0},"batching"),startBatch:v(function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},"startBatch"),endBatch:v(function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?t.notify(a):t.notify(a,n)})}return this},"endBatch"),batch:v(function(e){return this.startBatch(),e(),this.endBatch(),this},"batch"),batchData:v(function(e){var t=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],s=e[i],o=t.getElementById(i);o.data(s)}})},"batchData")},Tp=fr({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]}),zs={renderTo:v(function(e,t,a,n){var i=this._private.renderer;return i.renderTo(e,t,a,n),this},"renderTo"),renderer:v(function(){return this._private.renderer},"renderer"),forceRender:v(function(){return this.notify("draw"),this},"forceRender"),resize:v(function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},"resize"),initRenderer:v(function(e){var t=this,a=t.extension("renderer",e.name);if(a==null){We("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Fe("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=Tp(e);n.cy=t,t._private.renderer=new a(n),this.notify("init")},"initRenderer"),destroyRenderer:v(function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},"destroyRenderer"),onRender:v(function(e){return this.on("render",e)},"onRender"),offRender:v(function(e){return this.off("render",e)},"offRender")};zs.invalidateDimensions=zs.resize;var dn={collection:v(function(e,t){return ge(e)?this.$(e):Sr(e)?e.collection():qe(e)?(t||(t={}),new vr(this,e,t.unique,t.removed)):new vr(this)},"collection"),nodes:v(function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},"nodes"),edges:v(function(e){var t=this.$(function(a){return a.isEdge()});return e?t.filter(e):t},"edges"),$:v(function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},"$"),mutableElements:v(function(){return this._private.elements},"mutableElements")};dn.elements=dn.filter=dn.$;var or={},ba="t",Sp="f";or.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i<r.length;i++){var s=r[i],o=e.getContextMeta(s);if(!o.empty){var u=e.getContextStyle(o),l=e.applyContextStyle(o,u,s);s._private.appliedInitStyle?e.updateTransitions(s,l.diffProps):s._private.appliedInitStyle=!0;var f=e.updateStyleHints(s);f&&n.push(s)}}return n};or.getPropertiesDiff=function(r,e){var t=this,a=t._private.propDiffs=t._private.propDiffs||{},n=r+"-"+e,i=a[n];if(i)return i;for(var s=[],o={},u=0;u<t.length;u++){var l=t[u],f=r[u]===ba,c=e[u]===ba,d=f!==c,g=l.mappedProperties.length>0;if(d||c&&g){var h=void 0;d&&g||d?h=l.properties:g&&(h=l.mappedProperties);for(var m=0;m<h.length;m++){for(var p=h[m],y=p.name,b=!1,w=u+1;w<t.length;w++){var x=t[w],C=e[w]===ba;if(C&&(b=x.properties[p.name]!=null,b))break}!o[y]&&!b&&(o[y]=!0,s.push(y))}}}return a[n]=s,s};or.getContextMeta=function(r){for(var e=this,t="",a,n=r._private.styleCxtKey||"",i=0;i<e.length;i++){var s=e[i],o=s.selector&&s.selector.matches(r);o?t+=ba:t+=Sp}return a=e.getPropertiesDiff(n,t),r._private.styleCxtKey=t,{key:t,diffPropNames:a,empty:a.length===0}};or.getContextStyle=function(r){var e=r.key,t=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<t.length;i++){var s=t[i],o=e[i]===ba;if(o)for(var u=0;u<s.properties.length;u++){var l=s.properties[u];n[l.name]=l}}return a[e]=n,n};or.applyContextStyle=function(r,e,t){for(var a=this,n=r.diffPropNames,i={},s=a.types,o=0;o<n.length;o++){var u=n[o],l=e[u],f=t.pstyle(u);if(!l)if(f)f.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(f!==l){if(l.mapped===s.fn&&f!=null&&f.mapping!=null&&f.mapping.value===l.value){var c=f.mapping,d=c.fnValue=l.value(t);if(d===c.prevFnValue)continue}var g=i[u]={prev:f};a.applyParsedProperty(t,l),g.next=t.pstyle(u),g.next&&g.next.bypass&&(g.next=g.next.bypassed)}}return{diffProps:i}};or.updateStyleHints=function(r){var e=r._private,t=this,a=t.propertyGroupNames,n=t.propertyGroupKeys,i=v(function($,Z,ae){return t.getPropertiesHash($,Z,ae)},"propHash"),s=e.styleKey;if(r.removed())return!1;var o=e.group==="nodes",u=r._private.style;a=Object.keys(u);for(var l=0;l<n.length;l++){var f=n[l];e.styleKeys[f]=[St,Gt]}for(var c=v(function($,Z){return e.styleKeys[Z][0]=Ea($,e.styleKeys[Z][0])},"updateGrKey1"),d=v(function($,Z){return e.styleKeys[Z][1]=Ca($,e.styleKeys[Z][1])},"updateGrKey2"),g=v(function($,Z){c($,Z),d($,Z)},"updateGrKey"),h=v(function($,Z){for(var ae=0;ae<$.length;ae++){var de=$.charCodeAt(ae);c(de,Z),d(de,Z)}},"updateGrKeyWStr"),m=2e9,p=v(function($){return-128<$&&$<128&&Math.floor($)!==$?m-($*1024|0):$},"cleanNum"),y=0;y<a.length;y++){var b=a[y],w=u[b];if(w!=null){var x=this.properties[b],C=x.type,T=x.groupKey,E=void 0;x.hashOverride!=null?E=x.hashOverride(r,w):w.pfValue!=null&&(E=w.pfValue);var S=x.enums==null?w.value:null,D=E!=null,B=S!=null,P=D||B,A=w.units;if(C.number&&P&&!C.multiple){var R=D?E:S;g(p(R),T),!D&&A!=null&&h(A,T)}else h(w.strValue,T)}}for(var M=[St,Gt],I=0;I<n.length;I++){var O=n[I],L=e.styleKeys[O];M[0]=Ea(L[0],M[0]),M[1]=Ca(L[1],M[1])}e.styleKey=_c(M[0],M[1]);var N=e.styleKeys;e.labelDimsKey=et(N.labelDimensions);var _=i(r,["label"],N.labelDimensions);if(e.labelKey=et(_),e.labelStyleKey=et(Ka(N.commonLabel,_)),!o){var G=i(r,["source-label"],N.labelDimensions);e.sourceLabelKey=et(G),e.sourceLabelStyleKey=et(Ka(N.commonLabel,G));var z=i(r,["target-label"],N.labelDimensions);e.targetLabelKey=et(z),e.targetLabelStyleKey=et(Ka(N.commonLabel,z))}if(o){var V=e.styleKeys,K=V.nodeBody,j=V.nodeBorder,Q=V.nodeOutline,ee=V.backgroundImage,te=V.compound,ie=V.pie,J=V.stripe,q=[K,j,Q,ee,te,ie,J].filter(function(W){return W!=null}).reduce(Ka,[St,Gt]);e.nodeKey=et(q),e.hasPie=ie!=null&&ie[0]!==St&&ie[1]!==Gt,e.hasStripe=J!=null&&J[0]!==St&&J[1]!==Gt}return s!==e.styleKey};or.clearStyleHints=function(r){var e=r._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};or.applyParsedProperty=function(r,e){var t=this,a=e,n=r._private.style,i,s=t.types,o=t.properties[a.name].type,u=a.bypass,l=n[a.name],f=l&&l.bypass,c=r._private,d="mapping",g=v(function(K){return K==null?null:K.pfValue!=null?K.pfValue:K.value},"getVal"),h=v(function(){var K=g(l),j=g(a);t.checkTriggers(r,a.name,K,j)},"checkTriggers");if(e.name==="curve-style"&&r.isEdge()&&(e.value!=="bezier"&&r.isLoop()||e.value==="haystack"&&(r.source().isParent()||r.target().isParent()))&&(a=e=this.parse(e.name,"bezier",u)),a.delete)return n[a.name]=void 0,h(),!0;if(a.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,h(),!0):!1:(h(),!0);if(a.deleteBypass)return l?l.bypass?(n[a.name]=l.bypassed,h(),!0):!1:(h(),!0);var m=v(function(){Fe("Do not assign mappings to elements without corresponding data (i.e. ele `"+r.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")},"printMappingErr");switch(a.mapped){case s.mapData:{for(var p=a.field.split("."),y=c.data,b=0;b<p.length&&y;b++){var w=p[b];y=y[w]}if(y==null)return m(),!1;var x;if(ne(y)){var C=a.fieldMax-a.fieldMin;C===0?x=0:x=(y-a.fieldMin)/C}else return Fe("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+y+"` for `"+r.id()+"` is non-numeric)"),!1;if(x<0?x=0:x>1&&(x=1),o.color){var T=a.valueMin[0],E=a.valueMax[0],S=a.valueMin[1],D=a.valueMax[1],B=a.valueMin[2],P=a.valueMax[2],A=a.valueMin[3]==null?1:a.valueMin[3],R=a.valueMax[3]==null?1:a.valueMax[3],M=[Math.round(T+(E-T)*x),Math.round(S+(D-S)*x),Math.round(B+(P-B)*x),Math.round(A+(R-A)*x)];i={bypass:a.bypass,name:a.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else if(o.number){var I=a.valueMin+(a.valueMax-a.valueMin)*x;i=this.parse(a.name,I,a.bypass,d)}else return!1;if(!i)return m(),!1;i.mapping=a,a=i;break}case s.data:{for(var O=a.field.split("."),L=c.data,N=0;N<O.length&&L;N++){var _=O[N];L=L[_]}if(L!=null&&(i=this.parse(a.name,L,a.bypass,d)),!i)return m(),!1;i.mapping=a,a=i;break}case s.fn:{var G=a.value,z=a.fnValue!=null?a.fnValue:G(r);if(a.prevFnValue=z,z==null)return Fe("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+r.id()+"` is null)"),!1;if(i=this.parse(a.name,z,a.bypass,d),!i)return Fe("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+r.id()+"` is invalid)"),!1;i.mapping=_r(a),a=i;break}case void 0:break;default:return!1}return u?(f?a.bypassed=l.bypassed:a.bypassed=l,n[a.name]=a):f?l.bypassed=a:n[a.name]=a,h(),!0};or.cleanElements=function(r,e){for(var t=0;t<r.length;t++){var a=r[t];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),s=0;s<i.length;s++){var o=i[s],u=n[o];u!=null&&(u.bypass?u.bypassed=null:n[o]=null)}}};or.update=function(){var r=this._private.cy,e=r.mutableElements();e.updateStyle()};or.updateTransitions=function(r,e){var t=this,a=r._private,n=r.pstyle("transition-property").value,i=r.pstyle("transition-duration").pfValue,s=r.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var o={},u=!1,l=0;l<n.length;l++){var f=n[l],c=r.pstyle(f),d=e[f];if(d){var g=d.prev,h=g,m=d.next!=null?d.next:c,p=!1,y=void 0,b=1e-6;h&&(ne(h.pfValue)&&ne(m.pfValue)?(p=m.pfValue-h.pfValue,y=h.pfValue+b*p):ne(h.value)&&ne(m.value)?(p=m.value-h.value,y=h.value+b*p):qe(h.value)&&qe(m.value)&&(p=h.value[0]!==m.value[0]||h.value[1]!==m.value[1]||h.value[2]!==m.value[2],y=h.strValue),p&&(o[f]=m.strValue,this.applyBypass(r,f,y),u=!0))}}if(!u)return;a.transitioning=!0,new ra(function(w){s>0?r.delayAnimation(s).play().promise().then(w):w()}).then(function(){return r.animation({style:o,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1)};or.checkTrigger=function(r,e,t,a,n,i){var s=this.properties[e],o=n(s);r.removed()||o!=null&&o(t,a,r)&&i(s)};or.checkZOrderTrigger=function(r,e,t,a){var n=this;this.checkTrigger(r,e,t,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",r)})};or.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})};or.checkConnectedEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};or.checkParallelEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};or.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a),this.checkConnectedEdgesBoundsTrigger(r,e,t,a),this.checkParallelEdgesBoundsTrigger(r,e,t,a)};var qa={};qa.applyBypass=function(r,e,t,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var o=0;o<n.properties.length;o++){var u=n.properties[o],l=u.name,f=this.parse(l,t,!0);f&&i.push(f)}}else if(ge(e)){var c=this.parse(e,t,!0);c&&i.push(c)}else if(Le(e)){var d=e;a=t;for(var g=Object.keys(d),h=0;h<g.length;h++){var m=g[h],p=d[m];if(p===void 0&&(p=d[Rn(m)]),p!==void 0){var y=this.parse(m,p,!0);y&&i.push(y)}}}else return!1;if(i.length===0)return!1;for(var b=!1,w=0;w<r.length;w++){for(var x=r[w],C={},T=void 0,E=0;E<i.length;E++){var S=i[E];if(a){var D=x.pstyle(S.name);T=C[S.name]={prev:D}}b=this.applyParsedProperty(x,_r(S))||b,a&&(T.next=x.pstyle(S.name))}b&&this.updateStyleHints(x),a&&this.updateTransitions(x,C,s)}return b};qa.overrideBypass=function(r,e,t){e=Ys(e);for(var a=0;a<r.length;a++){var n=r[a],i=n._private.style[e],s=this.properties[e].type,o=s.color,u=s.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,t):(i.value=t,i.pfValue!=null&&(i.pfValue=t),o?i.strValue="rgb("+t.join(",")+")":u?i.strValue=t.join(" "):i.strValue=""+t,this.updateStyleHints(n)),this.checkTriggers(n,e,l,t)}};qa.removeAllBypasses=function(r,e){return this.removeBypasses(r,this.propertyNames,e)};qa.removeBypasses=function(r,e,t){for(var a=!0,n=0;n<r.length;n++){for(var i=r[n],s={},o=0;o<e.length;o++){var u=e[o],l=this.properties[u],f=i.pstyle(l.name);if(!(!f||!f.bypass)){var c="",d=this.parse(u,c,!0),g=s[l.name]={prev:f};this.applyParsedProperty(i,d),g.next=i.pstyle(l.name)}}this.updateStyleHints(i),t&&this.updateTransitions(i,s,a)}};var vo={};vo.getEmSizeInPixels=function(){var r=this.containerCss("font-size");return r!=null?parseFloat(r):1};vo.containerCss=function(r){var e=this._private.cy,t=e.container(),a=e.window();if(a&&t&&a.getComputedStyle)return a.getComputedStyle(t).getPropertyValue(r)};var Gr={};Gr.getRenderedStyle=function(r,e){return e?this.getStylePropertyValue(r,e,!0):this.getRawStyle(r,!0)};Gr.getRawStyle=function(r,e){var t=this;if(r=r[0],r){for(var a={},n=0;n<t.properties.length;n++){var i=t.properties[n],s=t.getStylePropertyValue(r,i.name,e);s!=null&&(a[i.name]=s,a[Rn(i.name)]=s)}return a}};Gr.getIndexedStyle=function(r,e,t,a){var n=r.pstyle(e)[t][a];return n??r.cy().style().getDefaultProperty(e)[t][0]};Gr.getStylePropertyValue=function(r,e,t){var a=this;if(r=r[0],r){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,s=r.pstyle(n.name);if(s){var o=s.value,u=s.units,l=s.strValue;if(t&&i.number&&o!=null&&ne(o)){var f=r.cy().zoom(),c=v(function(p){return p*f},"getRenderedValue"),d=v(function(p,y){return c(p)+y},"getValueStringWithUnits"),g=qe(o),h=g?u.every(function(m){return m!=null}):u!=null;return h?g?o.map(function(m,p){return d(m,u[p])}).join(" "):d(o,u):g?o.map(function(m){return ge(m)?m:""+c(m)}).join(" "):""+c(o)}else if(l!=null)return l}return null}};Gr.getAnimationStartStyle=function(r,e){for(var t={},a=0;a<e.length;a++){var n=e[a],i=n.name,s=r.pstyle(i);s!==void 0&&(Le(s)?s=this.parse(i,s.strValue):s=this.parse(i,s)),s&&(t[i]=s)}return t};Gr.getPropsList=function(r){var e=this,t=[],a=r,n=e.properties;if(a)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],u=a[o],l=n[o]||n[Ys(o)],f=this.parse(l.name,u);f&&t.push(f)}return t};Gr.getNonDefaultPropertiesHash=function(r,e,t){var a=t.slice(),n,i,s,o,u,l;for(u=0;u<e.length;u++)if(n=e[u],i=r.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=Ea(o,a[0]),a[1]=Ca(o,a[1]);else for(s=i.strValue,l=0;l<s.length;l++)o=s.charCodeAt(l),a[0]=Ea(o,a[0]),a[1]=Ca(o,a[1]);return a};Gr.getPropertiesHash=Gr.getNonDefaultPropertiesHash;var Wn={};Wn.appendFromJson=function(r){for(var e=this,t=0;t<r.length;t++){var a=r[t],n=a.selector,i=a.style||a.css,s=Object.keys(i);e.selector(n);for(var o=0;o<s.length;o++){var u=s[o],l=i[u];e.css(u,l)}}return e};Wn.fromJson=function(r){var e=this;return e.resetToDefault(),e.appendFromJson(r),e};Wn.json=function(){for(var r=[],e=this.defaultLength;e<this.length;e++){for(var t=this[e],a=t.selector,n=t.properties,i={},s=0;s<n.length;s++){var o=n[s];i[o.name]=o.strValue}r.push({selector:a?a.toString():"core",style:i})}return r};var fo={};fo.appendFromString=function(r){var e=this,t=this,a=""+r,n,i,s;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){a.length>n.length?a=a.substr(n.length):a=""}v(o,"removeSelAndBlockFromRemaining");function u(){i.length>s.length?i=i.substr(s.length):i=""}for(v(u,"removePropAndValFromRem");;){var l=a.match(/^\s*$/);if(l)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Fe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var c=f[1];if(c!=="core"){var d=new ft(c);if(d.invalid){Fe("Skipping parsing of block: Invalid selector found in string stylesheet: "+c),o();continue}}var g=f[2],h=!1;i=g;for(var m=[];;){var p=i.match(/^\s*$/);if(p)break;var y=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){Fe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+g),h=!0;break}s=y[0];var b=y[1],w=y[2],x=e.properties[b];if(!x){Fe("Skipping property: Invalid property name in: "+s),u();continue}var C=t.parse(b,w);if(!C){Fe("Skipping property: Invalid property definition in: "+s),u();continue}m.push({name:b,val:w}),u()}if(h){o();break}t.selector(c);for(var T=0;T<m.length;T++){var E=m[T];t.css(E.name,E.val)}o()}return t};fo.fromString=function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e};var Qe={};(function(){var r=rr,e=bc,t=xc,a=Ec,n=Cc,i=v(function(W){return"^"+W+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},"data"),s=v(function(W){var $=r+"|\\w+|"+e+"|"+t+"|"+a+"|"+n;return"^"+W+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+$+")\\s*\\,\\s*("+$+")\\)$"},"mapData"),o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Qe.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:v(function(W,$){switch(W.length){case 2:return $[0]!=="deg"&&$[0]!=="rad"&&$[1]!=="deg"&&$[1]!=="rad";case 1:return ge(W[0])||$[0]==="deg"||$[0]==="rad";default:return!1}},"validate")},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:v(function(W){var $=W.length;return $===1||$===2||$===4},"validate")}};var u={zeroNonZero:v(function(W,$){return(W==null||$==null)&&W!==$||W==0&&$!=0?!0:W!=0&&$==0},"zeroNonZero"),any:v(function(W,$){return W!=$},"any"),emptyNonEmpty:v(function(W,$){var Z=ut(W),ae=ut($);return Z&&!ae||!Z&&ae},"emptyNonEmpty")},l=Qe.types,f=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],c=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],d=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],g=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],h=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],m=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any},{name:"box-selection",type:l.boxSelection,triggersZOrder:u.any}],p=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:v(function(W,$,Z){return W===$?!1:Z.pstyle("curve-style").value==="bezier"},"triggersBoundsOfParallelEdges")},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],y=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],b=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],w=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],x=v(function(W,$){return $.value==="label"?-W.poolIndex():$.pfValue},"nodeSizeHashOverride"),C=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:x},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:x},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],T=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],E=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],S=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],D=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],B=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:v(function(W,$){return W===$?!1:W==="bezier"||$==="bezier"},"triggersBoundsOfParallelEdges")},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],P=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],A=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],R=[];Qe.pieBackgroundN=16,R.push({name:"pie-size",type:l.sizeMaybePercent}),R.push({name:"pie-hole",type:l.sizeMaybePercent}),R.push({name:"pie-start-angle",type:l.angle});for(var M=1;M<=Qe.pieBackgroundN;M++)R.push({name:"pie-"+M+"-background-color",type:l.color}),R.push({name:"pie-"+M+"-background-size",type:l.percent}),R.push({name:"pie-"+M+"-background-opacity",type:l.zeroOneNumber});var I=[];Qe.stripeBackgroundN=16,I.push({name:"stripe-size",type:l.sizeMaybePercent}),I.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var O=1;O<=Qe.stripeBackgroundN;O++)I.push({name:"stripe-"+O+"-background-color",type:l.color}),I.push({name:"stripe-"+O+"-background-size",type:l.percent}),I.push({name:"stripe-"+O+"-background-opacity",type:l.zeroOneNumber});var L=[],N=Qe.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(q){N.forEach(function(W){var $=W+"-"+q.name,Z=q.type,ae=q.triggersBounds;L.push({name:$,type:Z,triggersBounds:ae})})},{});var _=Qe.properties=[].concat(m,w,p,y,b,P,h,g,f,c,d,C,T,E,S,R,I,D,B,L,A),G=Qe.propertyGroups={behavior:m,transition:w,visibility:p,overlay:y,underlay:b,ghost:P,commonLabel:h,labelDimensions:g,mainLabel:f,sourceLabel:c,targetLabel:d,nodeBody:C,nodeBorder:T,nodeOutline:E,backgroundImage:S,pie:R,stripe:I,compound:D,edgeLine:B,edgeArrow:L,core:A},z=Qe.propertyGroupNames={},V=Qe.propertyGroupKeys=Object.keys(G);V.forEach(function(q){z[q]=G[q].map(function(W){return W.name}),G[q].forEach(function(W){return W.groupKey=q})});var K=Qe.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"}];Qe.propertyNames=_.map(function(q){return q.name});for(var j=0;j<_.length;j++){var Q=_[j];_[Q.name]=Q}for(var ee=0;ee<K.length;ee++){var te=K[ee],ie=_[te.pointsTo],J={name:te.name,alias:!0,pointsTo:ie};_.push(J),_[te.name]=J}})();Qe.getDefaultProperty=function(r){return this.getDefaultProperties()[r]};Qe.getDefaultProperties=function(){var r=this._private;if(r.defaultProperties!=null)return r.defaultProperties;for(var e=me({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=Qe.pieBackgroundN;f++){var c=l.name.replace("{{i}}",f),d=l.value;u[c]=d}return u},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=Qe.stripeBackgroundN;f++){var c=l.name.replace("{{i}}",f),d=l.value;u[c]=d}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return Qe.arrowPrefixes.forEach(function(f){var c=f+"-"+l.name,d=l.value;u[c]=d}),u},{})),t={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,s=e[i],o=this.parse(i,s);t[i]=o}}return r.defaultProperties=t,r.defaultProperties};Qe.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 $n={};$n.parse=function(r,e,t,a){var n=this;if(Ue(e))return n.parseImplWarn(r,e,t,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,s=t?"t":"f",o=""+e,u=fv(r,o,s,i),l=n.propCache=n.propCache||[],f;return(f=l[u])||(f=l[u]=n.parseImplWarn(r,e,t,a)),(t||a==="mapping")&&(f=_r(f),f&&(f.value=_r(f.value))),f};$n.parseImplWarn=function(r,e,t,a){var n=this.parseImpl(r,e,t,a);return!n&&e!=null&&Fe("The style property `".concat(r,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Fe("The style value of `label` is deprecated for `"+n.name+"`"),n};$n.parseImpl=function(r,e,t,a){var n=this;r=Ys(r);var i=n.properties[r],s=e,o=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,r=i.name);var u=ge(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(t&&(e===""||e===null))return{name:r,value:e,bypass:!0,deleteBypass:!0};if(Ue(e))return{name:r,value:e,strValue:"fn",mapped:o.fn,bypass:t};var f,c;if(!(!u||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(t)return!1;var d=o.data;return{name:r,value:f,strValue:""+e,mapped:d,field:f[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(c=new RegExp(o.mapData.regex).exec(e))){if(t||l.multiple)return!1;var g=o.mapData;if(!(l.color||l.number))return!1;var h=this.parse(r,c[4]);if(!h||h.mapped)return!1;var m=this.parse(r,c[5]);if(!m||m.mapped)return!1;if(h.pfValue===m.pfValue||h.strValue===m.strValue)return Fe("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+h.strValue+"`"),this.parse(r,h.strValue);if(l.color){var p=h.value,y=m.value,b=p[0]===y[0]&&p[1]===y[1]&&p[2]===y[2]&&(p[3]===y[3]||(p[3]==null||p[3]===1)&&(y[3]==null||y[3]===1));if(b)return!1}return{name:r,value:c,strValue:""+e,mapped:g,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:h.value,valueMax:m.value,bypass:t}}}if(l.multiple&&a!=="multiple"){var w;if(u?w=e.split(/\s+/):qe(e)?w=e:w=[e],l.evenMultiple&&w.length%2!==0)return null;for(var x=[],C=[],T=[],E="",S=!1,D=0;D<w.length;D++){var B=n.parse(r,w[D],t,"multiple");S=S||ge(B.value),x.push(B.value),T.push(B.pfValue!=null?B.pfValue:B.value),C.push(B.units),E+=(D>0?" ":"")+B.strValue}return l.validate&&!l.validate(x,C)?null:l.singleEnum&&S?x.length===1&&ge(x[0])?{name:r,value:x[0],strValue:x[0],bypass:t}:null:{name:r,value:x,pfValue:T,strValue:E,bypass:t,units:C}}var P=v(function(){for(var J=0;J<l.enums.length;J++){var q=l.enums[J];if(q===e)return{name:r,value:e,strValue:""+e,bypass:t}}return null},"checkEnums");if(l.number){var A,R="px";if(l.units&&(A=l.units),l.implicitUnits&&(R=l.implicitUnits),!l.unitless)if(u){var M="px|em"+(l.allowPercent?"|\\%":"");A&&(M=A);var I=e.match("^("+rr+")("+M+")?$");I&&(e=I[1],A=I[2]||R)}else(!A||l.implicitUnits)&&(A=R);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=s,P();if(l.integer&&!cc(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var O={name:r,value:e,strValue:""+e+(A||""),units:A,bypass:t};return l.unitless||A!=="px"&&A!=="em"?O.pfValue=e:O.pfValue=A==="px"||!A?e:this.getEmSizeInPixels()*e,(A==="ms"||A==="s")&&(O.pfValue=A==="ms"?e:1e3*e),(A==="deg"||A==="rad")&&(O.pfValue=A==="rad"?e:Ed(e)),A==="%"&&(O.pfValue=e/100),O}else if(l.propList){var L=[],N=""+e;if(N!=="none"){for(var _=N.split(/\s*,\s*|\s+/),G=0;G<_.length;G++){var z=_[G].trim();n.properties[z]?L.push(z):Fe("`"+z+"` is not a valid property name")}if(L.length===0)return null}return{name:r,value:L,strValue:L.length===0?"none":L.join(" "),bypass:t}}else if(l.color){var V=nv(e);return V?{name:r,value:V,pfValue:V,strValue:"rgb("+V[0]+","+V[1]+","+V[2]+")",bypass:t}:null}else if(l.regex||l.regexes){if(l.enums){var K=P();if(K)return K}for(var j=l.regexes?l.regexes:[l.regex],Q=0;Q<j.length;Q++){var ee=new RegExp(j[Q]),te=ee.exec(e);if(te)return{name:r,value:l.singleRegexMatchValue?te[1]:te,strValue:""+e,bypass:t}}return null}else return l.string?{name:r,value:""+e,strValue:""+e,bypass:t}:l.enums?P():null};var sr=v(function(e){if(!(this instanceof sr))return new sr(e);if(!Xs(e)){We("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},"Style"),gr=sr.prototype;gr.instanceString=function(){return"style"};gr.clear=function(){for(var r=this._private,e=r.cy,t=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,r.contextStyles={},r.propDiffs={},this.cleanElements(t,!0),t.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};gr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};gr.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)};gr.selector=function(r){var e=r==="core"?null:new ft(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this};gr.css=function(){var r=this,e=arguments;if(e.length===1)for(var t=e[0],a=0;a<r.properties.length;a++){var n=r.properties[a],i=t[n.name];i===void 0&&(i=t[Rn(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};gr.style=gr.css;gr.cssRule=function(r,e){var t=this.parse(r,e);if(t){var a=this.length-1;this[a].properties.push(t),this[a].properties[t.name]=t,t.name.match(/pie-(\d+)-background-size/)&&t.value&&(this._private.hasPie=!0),t.name.match(/stripe-(\d+)-background-size/)&&t.value&&(this._private.hasStripe=!0),t.mapped&&this[a].mappedProperties.push(t);var n=!this[a].selector;n&&(this._private.coreStyle[t.name]=t)}return this};gr.append=function(r){return rv(r)?r.appendToStyle(this):qe(r)?this.appendFromJson(r):ge(r)&&this.appendFromString(r),this};sr.fromJson=function(r,e){var t=new sr(r);return t.fromJson(e),t};sr.fromString=function(r,e){return new sr(r).fromString(e)};[or,qa,vo,Gr,Wn,fo,Qe,$n].forEach(function(r){me(gr,r)});sr.types=gr.types;sr.properties=gr.properties;sr.propertyGroups=gr.propertyGroups;sr.propertyGroupNames=gr.propertyGroupNames;sr.propertyGroupKeys=gr.propertyGroupKeys;var kp={style:v(function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},"style"),setStyle:v(function(e){var t=this._private;return rv(e)?t.style=e.generateStyle(this):qe(e)?t.style=sr.fromJson(this,e):ge(e)?t.style=sr.fromString(this,e):t.style=sr(this),t.style},"setStyle"),updateStyle:v(function(){this.mutableElements().updateStyle()},"updateStyle")},Dp="single",Rt={autolock:v(function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},"autolock"),autoungrabify:v(function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},"autoungrabify"),autounselectify:v(function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},"autounselectify"),selectionType:v(function(e){var t=this._private;if(t.selectionType==null&&(t.selectionType=Dp),e!==void 0)(e==="additive"||e==="single")&&(t.selectionType=e);else return t.selectionType;return this},"selectionType"),panningEnabled:v(function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},"panningEnabled"),userPanningEnabled:v(function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},"userPanningEnabled"),zoomingEnabled:v(function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},"zoomingEnabled"),userZoomingEnabled:v(function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},"userZoomingEnabled"),boxSelectionEnabled:v(function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},"boxSelectionEnabled"),pan:v(function(){var e=arguments,t=this._private.pan,a,n,i,s,o;switch(e.length){case 0:return t;case 1:if(ge(e[0]))return a=e[0],t[a];if(Le(e[0])){if(!this._private.panningEnabled)return this;i=e[0],s=i.x,o=i.y,ne(s)&&(t.x=s),ne(o)&&(t.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&ne(n)&&(t[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},"pan"),panBy:v(function(e,t){var a=arguments,n=this._private.pan,i,s,o,u,l;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Le(e)&&(o=a[0],u=o.x,l=o.y,ne(u)&&(n.x+=u),ne(l)&&(n.y+=l),this.emit("pan viewport"));break;case 2:i=e,s=t,(i==="x"||i==="y")&&ne(s)&&(n[i]+=s),this.emit("pan viewport");break}return this.notify("viewport"),this},"panBy"),gc:v(function(){this.notify("gc")},"gc"),fit:v(function(e,t){var a=this.getFitViewport(e,t);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},"fit"),getFitViewport:v(function(e,t){if(ne(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(ge(e)){var n=e;e=this.$(n)}else if(gc(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else Sr(e)||(e=this.mutableElements());if(!(Sr(e)&&e.empty())){a=a||e.boundingBox();var s=this.width(),o=this.height(),u;if(t=ne(t)?t:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((s-2*t)/a.w,(o-2*t)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(s-u*(a.x1+a.x2))/2,y:(o-u*(a.y1+a.y2))/2};return{zoom:u,pan:l}}}}},"getFitViewport"),zoomRange:v(function(e,t){var a=this._private;if(t==null){var n=e;e=n.min,t=n.max}return ne(e)&&ne(t)&&e<=t?(a.minZoom=e,a.maxZoom=t):ne(e)&&t===void 0&&e<=a.maxZoom?a.minZoom=e:ne(t)&&e===void 0&&t>=a.minZoom&&(a.maxZoom=t),this},"zoomRange"),minZoom:v(function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},"minZoom"),maxZoom:v(function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},"maxZoom"),getZoomedViewport:v(function(e){var t=this._private,a=t.pan,n=t.zoom,i,s,o=!1;if(t.zoomingEnabled||(o=!0),ne(e)?s=e:Le(e)&&(s=e.level,e.position!=null?i=In(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(o=!0)),s=s>t.maxZoom?t.maxZoom:s,s=s<t.minZoom?t.minZoom:s,o||!ne(s)||s===n||i!=null&&(!ne(i.x)||!ne(i.y)))return null;if(i!=null){var u=a,l=n,f=s,c={x:-f/l*(i.x-u.x)+i.x,y:-f/l*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:c}}else return{zoomed:!0,panned:!1,zoom:s,pan:a}},"getZoomedViewport"),zoom:v(function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),a=this._private;return t==null||!t.zoomed?this:(a.zoom=t.zoom,t.panned&&(a.pan.x=t.pan.x,a.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},"zoom"),viewport:v(function(e){var t=this._private,a=!0,n=!0,i=[],s=!1,o=!1;if(!e)return this;if(ne(e.zoom)||(a=!1),Le(e.pan)||(n=!1),!a&&!n)return this;if(a){var u=e.zoom;u<t.minZoom||u>t.maxZoom||!t.zoomingEnabled?s=!0:(t.zoom=u,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ne(l.x)&&(t.pan.x=l.x,o=!1),ne(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},"viewport"),center:v(function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},"center"),getCenterPan:v(function(e,t){if(this._private.panningEnabled){if(ge(e)){var a=e;e=this.mutableElements().filter(a)}else Sr(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();t=t===void 0?this._private.zoom:t;var o={x:(i-t*(n.x1+n.x2))/2,y:(s-t*(n.y1+n.y2))/2};return o}}},"getCenterPan"),reset:v(function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},"reset"),invalidateSize:v(function(){this._private.sizeCache=null},"invalidateSize"),size:v(function(){var e=this._private,t=e.container,a=this;return e.sizeCache=e.sizeCache||(t?(function(){var n=a.window().getComputedStyle(t),i=v(function(o){return parseFloat(n.getPropertyValue(o))},"val");return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},"size"),width:v(function(){return this.size().width},"width"),height:v(function(){return this.size().height},"height"),extent:v(function(){var e=this._private.pan,t=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/t,x2:(a.x2-e.x)/t,y1:(a.y1-e.y)/t,y2:(a.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},"extent"),renderedExtent:v(function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},"renderedExtent"),multiClickDebounceTime:v(function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this},"multiClickDebounceTime")};Rt.centre=Rt.center;Rt.autolockNodes=Rt.autolock;Rt.autoungrabifyNodes=Rt.autoungrabify;var Pa={data:ze.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ze.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ze.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ze.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Pa.attr=Pa.data;Pa.removeAttr=Pa.removeData;var Aa=v(function(e){var t=this;e=me({},e);var a=e.container;a&&!mn(a)&&mn(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=t;var s=er!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=me({name:s?"grid":"null"},o.layout),o.renderer=me({name:s?"canvas":"null"},o.renderer);var u=v(function(h,m,p){return m!==void 0?m:p!==void 0?p:h},"defVal"),l=this._private={container:a,ready:!1,options:o,elements:new vr(this),listeners:[],aniEles:new vr(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,o.zoomingEnabled),userZoomingEnabled:u(!0,o.userZoomingEnabled),panningEnabled:u(!0,o.panningEnabled),userPanningEnabled:u(!0,o.userPanningEnabled),boxSelectionEnabled:u(!0,o.boxSelectionEnabled),autolock:u(!1,o.autolock,o.autolockNodes),autoungrabify:u(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:u(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:ne(o.zoom)?o.zoom:1,pan:{x:Le(o.pan)&&ne(o.pan.x)?o.pan.x:0,y:Le(o.pan)&&ne(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=v(function(h,m){var p=h.some(pc);if(p)return ra.all(h).then(m);m(h)},"loadExtData");l.styleEnabled&&t.setStyle([]);var c=me({},o,o.renderer);t.initRenderer(c);var d=v(function(h,m,p){t.notifications(!1);var y=t.mutableElements();y.length>0&&y.remove(),h!=null&&(Le(h)||qe(h))&&t.add(h),t.one("layoutready",function(w){t.notifications(!0),t.emit(w),t.one("load",m),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",p),t.emit("done")});var b=me({},t._private.options.layout);b.eles=t.elements(),t.layout(b).run()},"setElesAndLayout");f([o.style,o.elements],function(g){var h=g[0],m=g[1];l.styleEnabled&&t.style().append(h),d(m,function(){t.startAnimationLoop(),l.ready=!0,Ue(o.ready)&&t.on("ready",o.ready);for(var p=0;p<i.length;p++){var y=i[p];t.on("ready",y)}n&&(n.readies=[]),t.emit("ready")},o.done)})},"Core"),Sn=Aa.prototype;me(Sn,{instanceString:v(function(){return"core"},"instanceString"),isReady:v(function(){return this._private.ready},"isReady"),destroyed:v(function(){return this._private.destroyed},"destroyed"),ready:v(function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},"ready"),destroy:v(function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},"destroy"),hasElementWithId:v(function(e){return this._private.elements.hasElementWithId(e)},"hasElementWithId"),getElementById:v(function(e){return this._private.elements.getElementById(e)},"getElementById"),hasCompoundNodes:v(function(){return this._private.hasCompoundNodes},"hasCompoundNodes"),headless:v(function(){return this._private.renderer.isHeadless()},"headless"),styleEnabled:v(function(){return this._private.styleEnabled},"styleEnabled"),addToPool:v(function(e){return this._private.elements.merge(e),this},"addToPool"),removeFromPool:v(function(e){return this._private.elements.unmerge(e),this},"removeFromPool"),container:v(function(){return this._private.container||null},"container"),window:v(function(){var e=this._private.container;if(e==null)return er;var t=this._private.container.ownerDocument;return t===void 0||t==null?er:t.defaultView||er},"window"),mount:v(function(e){if(e!=null){var t=this,a=t._private,n=a.options;return!mn(e)&&mn(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),a.container=e,a.styleEnabled=!0,t.invalidateSize(),t.initRenderer(me({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),t.startAnimationLoop(),t.style(n.style),t.emit("mount"),t}},"mount"),unmount:v(function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},"unmount"),options:v(function(){return _r(this._private.options)},"options"),json:v(function(e){var t=this,a=t._private,n=t.mutableElements(),i=v(function(x){return t.getElementById(x.id())},"getFreshRef");if(Le(e)){if(t.startBatch(),e.elements){var s={},o=v(function(x,C){for(var T=[],E=[],S=0;S<x.length;S++){var D=x[S];if(!D.data.id){Fe("cy.json() cannot handle elements without an ID attribute");continue}var B=""+D.data.id,P=t.getElementById(B);s[B]=!0,P.length!==0?E.push({ele:P,json:D}):(C&&(D.group=C),T.push(D))}t.add(T);for(var A=0;A<E.length;A++){var R=E[A],M=R.ele,I=R.json;M.json(I)}},"updateEles");if(qe(e.elements))o(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var f=u[l],c=e.elements[f];qe(c)&&o(c,f)}var d=t.collection();n.filter(function(w){return!s[w.id()]}).forEach(function(w){w.isParent()?d.merge(w):w.remove()}),d.forEach(function(w){return w.children().move({parent:null})}),d.forEach(function(w){return i(w).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var g=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<g.length;h++){var m=g[h];e[m]!=null&&t[m](e[m])}return t.endBatch(),this}else{var p=!!e,y={};p?y.elements=this.elements().map(function(w){return w.json()}):(y.elements={},n.forEach(function(w){var x=w.group();y.elements[x]||(y.elements[x]=[]),y.elements[x].push(w.json())})),this._private.styleEnabled&&(y.style=t.style().json()),y.data=_r(t.data());var b=a.options;return y.zoomingEnabled=a.zoomingEnabled,y.userZoomingEnabled=a.userZoomingEnabled,y.zoom=a.zoom,y.minZoom=a.minZoom,y.maxZoom=a.maxZoom,y.panningEnabled=a.panningEnabled,y.userPanningEnabled=a.userPanningEnabled,y.pan=_r(a.pan),y.boxSelectionEnabled=a.boxSelectionEnabled,y.renderer=_r(b.renderer),y.hideEdgesOnViewport=b.hideEdgesOnViewport,y.textureOnViewport=b.textureOnViewport,y.wheelSensitivity=b.wheelSensitivity,y.motionBlur=b.motionBlur,y.multiClickDebounceTime=b.multiClickDebounceTime,y}},"json")});Sn.$id=Sn.getElementById;[pp,xp,rf,Ns,cn,Cp,zs,dn,kp,Rt,Pa].forEach(function(r){me(Sn,r)});var Bp={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:v(function(e,t){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:v(function(e,t){return t},"transform")},Pp={maximal:!1,acyclic:!1},Ft=v(function(e){return e.scratch("breadthfirst")},"getInfo"),Cl=v(function(e,t){return e.scratch("breadthfirst",t)},"setInfo");function tf(r){this.options=me({},Bp,Pp,r)}v(tf,"BreadthFirstLayout");tf.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,a=t.nodes().filter(function(pe){return pe.isChildless()}),n=t,i=r.directed,s=r.acyclic||r.maximal||r.maximalAdjustments>0,o=!!r.boundingBox,u=mr(o?r.boundingBox:structuredClone(e.extent())),l;if(Sr(r.roots))l=r.roots;else if(qe(r.roots)){for(var f=[],c=0;c<r.roots.length;c++){var d=r.roots[c],g=e.getElementById(d);f.push(g)}l=e.collection(f)}else if(ge(r.roots))l=e.$(r.roots);else if(i)l=a.roots();else{var h=t.components();l=e.collection();for(var m=v(function(){var oe=h[p],he=oe.maxDegree(!1),ce=oe.filter(function(Ee){return Ee.degree(!1)===he});l=l.add(ce)},"_loop"),p=0;p<h.length;p++)m()}var y=[],b={},w=v(function(oe,he){y[he]==null&&(y[he]=[]);var ce=y[he].length;y[he].push(oe),Cl(oe,{index:ce,depth:he})},"addToDepth"),x=v(function(oe,he){var ce=Ft(oe),Ee=ce.depth,we=ce.index;y[Ee][we]=null,oe.isChildless()&&w(oe,he)},"changeDepth");n.bfs({roots:l,directed:r.directed,visit:v(function(oe,he,ce,Ee,we){var ke=oe[0],Be=ke.id();ke.isChildless()&&w(ke,we),b[Be]=!0},"visit")});for(var C=[],T=0;T<a.length;T++){var E=a[T];b[E.id()]||C.push(E)}var S=v(function(oe){for(var he=y[oe],ce=0;ce<he.length;ce++){var Ee=he[ce];if(Ee==null){he.splice(ce,1),ce--;continue}Cl(Ee,{depth:oe,index:ce})}},"assignDepthsAt"),D=v(function(oe,he){for(var ce=Ft(oe),Ee=oe.incomers().filter(function(Y){return Y.isNode()&&t.has(Y)}),we=-1,ke=oe.id(),Be=0;Be<Ee.length;Be++){var Ne=Ee[Be],Ie=Ft(Ne);we=Math.max(we,Ie.depth)}if(ce.depth<=we){if(!r.acyclic&&he[ke])return null;var Re=we+1;return x(oe,Re),he[ke]=Re,!0}return!1},"adjustMaximally");if(i&&s){var B=[],P={},A=v(function(oe){return B.push(oe)},"enqueue"),R=v(function(){return B.shift()},"dequeue");for(a.forEach(function(pe){return B.push(pe)});B.length>0;){var M=R(),I=D(M,P);if(I)M.outgoers().filter(function(pe){return pe.isNode()&&t.has(pe)}).forEach(A);else if(I===null){Fe("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var O=0;if(r.avoidOverlap)for(var L=0;L<a.length;L++){var N=a[L],_=N.layoutDimensions(r),G=_.w,z=_.h;O=Math.max(O,G,z)}var V={},K=v(function(oe){if(V[oe.id()])return V[oe.id()];for(var he=Ft(oe).depth,ce=oe.neighborhood(),Ee=0,we=0,ke=0;ke<ce.length;ke++){var Be=ce[ke];if(!(Be.isEdge()||Be.isParent()||!a.has(Be))){var Ne=Ft(Be);if(Ne!=null){var Ie=Ne.index,Re=Ne.depth;if(!(Ie==null||Re==null)){var Y=y[Re].length;Re<he&&(Ee+=Ie/Y,we++)}}}}return we=Math.max(1,we),Ee=Ee/we,we===0&&(Ee=0),V[oe.id()]=Ee,Ee},"getWeightedPercent"),j=v(function(oe,he){var ce=K(oe),Ee=K(he),we=ce-Ee;return we===0?av(oe.id(),he.id()):we},"sortFn");r.depthSort!==void 0&&(j=r.depthSort);for(var Q=y.length,ee=0;ee<Q;ee++)y[ee].sort(j),S(ee);for(var te=[],ie=0;ie<C.length;ie++)te.push(C[ie]);var J=v(function(){for(var oe=0;oe<Q;oe++)S(oe)},"assignDepths");te.length&&(y.unshift(te),Q=y.length,J());for(var q=0,W=0;W<Q;W++)q=Math.max(y[W].length,q);var $={x:u.x1+u.w/2,y:u.y1+u.h/2},Z=a.reduce(function(pe,oe){return(function(he){return{w:pe.w===-1?he.w:(pe.w+he.w)/2,h:pe.h===-1?he.h:(pe.h+he.h)/2}})(oe.boundingBox({includeLabels:r.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),ae=Math.max(Q===1?0:o?(u.h-r.padding*2-Z.h)/(Q-1):(u.h-r.padding*2-Z.h)/(Q+1),O),de=y.reduce(function(pe,oe){return Math.max(pe,oe.length)},0),Pe=v(function(oe){var he=Ft(oe),ce=he.depth,Ee=he.index;if(r.circle){var we=Math.min(u.w/2/Q,u.h/2/Q);we=Math.max(we,O);var ke=we*ce+we-(Q>0&&y[0].length<=3?we/2:0),Be=2*Math.PI/y[ce].length*Ee;return ce===0&&y[0].length===1&&(ke=1),{x:$.x+ke*Math.cos(Be),y:$.y+ke*Math.sin(Be)}}else{var Ne=y[ce].length,Ie=Math.max(Ne===1?0:o?(u.w-r.padding*2-Z.w)/((r.grid?de:Ne)-1):(u.w-r.padding*2-Z.w)/((r.grid?de:Ne)+1),O),Re={x:$.x+(Ee+1-(Ne+1)/2)*Ie,y:$.y+(ce+1-(Q+1)/2)*ae};return Re}},"getPositionTopBottom"),xe={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(xe).indexOf(r.direction)===-1&&We("Invalid direction '".concat(r.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(xe).join(", ")));var be=v(function(oe){return $c(Pe(oe),u,xe[r.direction])},"getPosition");return t.nodes().layoutPositions(this,r,be),this};var Ap={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:v(function(e,t){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:v(function(e,t){return t},"transform")};function af(r){this.options=me({},Ap,r)}v(af,"CircleLayout");af.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=mr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,c=0,d=0;d<i.length;d++){var g=i[d],h=g.layoutDimensions(e),m=h.w,p=h.h;c=Math.max(c,m,p)}if(ne(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(s.h,s.w)/2-c,i.length>1&&e.avoidOverlap){c*=1.75;var y=Math.cos(l)-Math.cos(0),b=Math.sin(l)-Math.sin(0),w=Math.sqrt(c*c/(y*y+b*b));f=Math.max(w,f)}var x=v(function(T,E){var S=e.startAngle+E*l*(n?1:-1),D=f*Math.cos(S),B=f*Math.sin(S),P={x:o.x+D,y:o.y+B};return P},"getPos");return a.nodes().layoutPositions(this,e,x),this};var Rp={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:v(function(e){return e.degree()},"concentric"),levelWidth:v(function(e){return e.maxDegree()/4},"levelWidth"),animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:v(function(e,t){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:v(function(e,t){return t},"transform")};function nf(r){this.options=me({},Rp,r)}v(nf,"ConcentricLayout");nf.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=r.cy,n=e.eles,i=n.nodes().not(":parent"),s=mr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],l=0,f=0;f<i.length;f++){var c=i[f],d=void 0;d=e.concentric(c),u.push({value:d,node:c}),c._private.scratch.concentric=d}i.updateStyle();for(var g=0;g<i.length;g++){var h=i[g],m=h.layoutDimensions(e);l=Math.max(l,m.w,m.h)}u.sort(function(ae,de){return de.value-ae.value});for(var p=e.levelWidth(i),y=[[]],b=y[0],w=0;w<u.length;w++){var x=u[w];if(b.length>0){var C=Math.abs(b[0].value-x.value);C>=p&&(b=[],y.push(b))}b.push(x)}var T=l+e.minNodeSpacing;if(!e.avoidOverlap){var E=y.length>0&&y[0].length>1,S=Math.min(s.w,s.h)/2-T,D=S/(y.length+E?1:0);T=Math.min(T,D)}for(var B=0,P=0;P<y.length;P++){var A=y[P],R=e.sweep===void 0?2*Math.PI-2*Math.PI/A.length:e.sweep,M=A.dTheta=R/Math.max(1,A.length-1);if(A.length>1&&e.avoidOverlap){var I=Math.cos(M)-Math.cos(0),O=Math.sin(M)-Math.sin(0),L=Math.sqrt(T*T/(I*I+O*O));B=Math.max(L,B)}A.r=B,B+=T}if(e.equidistant){for(var N=0,_=0,G=0;G<y.length;G++){var z=y[G],V=z.r-_;N=Math.max(N,V)}_=0;for(var K=0;K<y.length;K++){var j=y[K];K===0&&(_=j.r),j.r=_,_+=N}}for(var Q={},ee=0;ee<y.length;ee++)for(var te=y[ee],ie=te.dTheta,J=te.r,q=0;q<te.length;q++){var W=te[q],$=e.startAngle+(t?1:-1)*ie*q,Z={x:o.x+J*Math.cos($),y:o.y+J*Math.sin($)};Q[W.node.id()]=Z}return n.nodes().layoutPositions(this,e,function(ae){var de=ae.id();return Q[de]}),this};var ms,Mp={ready:v(function(){},"ready"),stop:v(function(){},"stop"),animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:v(function(e,t){return!0},"animateFilter"),animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:v(function(e){return 2048},"nodeRepulsion"),nodeOverlap:4,idealEdgeLength:v(function(e){return 32},"idealEdgeLength"),edgeElasticity:v(function(e){return 32},"edgeElasticity"),nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Un(r){this.options=me({},Mp,r),this.options.layout=this;var e=this.options.eles.nodes(),t=this.options.eles.edges(),a=t.filter(function(n){var i=n.source().data("id"),s=n.target().data("id"),o=e.some(function(l){return l.data("id")===i}),u=e.some(function(l){return l.data("id")===s});return!o||!u});this.options.eles=this.options.eles.not(a)}v(Un,"CoseLayout");Un.prototype.run=function(){var r=this.options,e=r.cy,t=this;t.stopped=!1,(r.animate===!0||r.animate===!1)&&t.emit({type:"layoutstart",layout:t}),r.debug===!0?ms=!0:ms=!1;var a=Lp(e,t,r);ms&&Op(a),r.randomize&&Np(a);var n=Yr(),i=v(function(){zp(a,e,r),r.fit===!0&&e.fit(r.padding)},"refresh"),s=v(function(d){return!(t.stopped||d>=r.numIter||(Fp(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature<r.minTemp))},"mainLoop"),o=v(function(){if(r.animate===!0||r.animate===!1)i(),t.one("layoutstop",r.stop),t.emit({type:"layoutstop",layout:t});else{var d=r.eles.nodes(),g=of(a,r,d);d.layoutPositions(t,r,g)}},"done"),u=0,l=!0;if(r.animate===!0){var f=v(function(){for(var d=0;l&&d<r.refresh;)l=s(u),u++,d++;if(!l)Sl(a,r),o();else{var g=Yr();g-n>=r.animationThreshold&&i(),bn(f)}},"frame");f()}else{for(;l;)l=s(u),u++;Sl(a,r),o()}return this};Un.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Un.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Lp=v(function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=mr(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},u=a.eles.components(),l={},f=0;f<u.length;f++)for(var c=u[f],d=0;d<c.length;d++){var g=c[d];l[g.id()]=f}for(var f=0;f<o.nodeSize;f++){var h=i[f],m=h.layoutDimensions(a),p={};p.isLocked=h.locked(),p.id=h.data("id"),p.parentId=h.data("parent"),p.cmptId=l[h.id()],p.children=[],p.positionX=h.position("x"),p.positionY=h.position("y"),p.offsetX=0,p.offsetY=0,p.height=m.w,p.width=m.h,p.maxX=p.positionX+p.width/2,p.minX=p.positionX-p.width/2,p.maxY=p.positionY+p.height/2,p.minY=p.positionY-p.height/2,p.padLeft=parseFloat(h.style("padding")),p.padRight=parseFloat(h.style("padding")),p.padTop=parseFloat(h.style("padding")),p.padBottom=parseFloat(h.style("padding")),p.nodeRepulsion=Ue(a.nodeRepulsion)?a.nodeRepulsion(h):a.nodeRepulsion,o.layoutNodes.push(p),o.idToIndex[p.id]=f}for(var y=[],b=0,w=-1,x=[],f=0;f<o.nodeSize;f++){var h=o.layoutNodes[f],C=h.parentId;C!=null?o.layoutNodes[o.idToIndex[C]].children.push(h.id):(y[++w]=h.id,x.push(h.id))}for(o.graphSet.push(x);b<=w;){var T=y[b++],E=o.idToIndex[T],g=o.layoutNodes[E],S=g.children;if(S.length>0){o.graphSet.push(S);for(var f=0;f<S.length;f++)y[++w]=S[f]}}for(var f=0;f<o.graphSet.length;f++)for(var D=o.graphSet[f],d=0;d<D.length;d++){var B=o.idToIndex[D[d]];o.indexToGraph[B]=f}for(var f=0;f<o.edgeSize;f++){var P=n[f],A={};A.id=P.data("id"),A.sourceId=P.data("source"),A.targetId=P.data("target");var R=Ue(a.idealEdgeLength)?a.idealEdgeLength(P):a.idealEdgeLength,M=Ue(a.edgeElasticity)?a.edgeElasticity(P):a.edgeElasticity,I=o.idToIndex[A.sourceId],O=o.idToIndex[A.targetId],L=o.indexToGraph[I],N=o.indexToGraph[O];if(L!=N){for(var _=Ip(A.sourceId,A.targetId,o),G=o.graphSet[_],z=0,p=o.layoutNodes[I];G.indexOf(p.id)===-1;)p=o.layoutNodes[o.idToIndex[p.parentId]],z++;for(p=o.layoutNodes[O];G.indexOf(p.id)===-1;)p=o.layoutNodes[o.idToIndex[p.parentId]],z++;R*=z*a.nestingFactor}A.idealLength=R,A.elasticity=M,o.layoutEdges.push(A)}return o},"createLayoutInfo"),Ip=v(function(e,t,a){var n=sf(e,t,0,a);return 2>n.count?0:n.graph},"findLCA"),sf=v(function(e,t,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:a};for(var s=0,o=0;o<i.length;o++){var u=i[o],l=n.idToIndex[u],f=n.layoutNodes[l].children;if(f.length!==0){var c=n.indexToGraph[n.idToIndex[f[0]]],d=sf(e,t,c,n);if(d.count!==0)if(d.count===1){if(s++,s===2)break}else return d}}return{count:s,graph:a}},"findLCA_aux"),Op,Np=v(function(e,t){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var s=e.layoutNodes[i];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*a,s.positionY=Math.random()*n)}},"randomizePositions"),of=v(function(e,t,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(a.forEach(function(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(s,o){var u=e.layoutNodes[e.idToIndex[s.data("id")]];if(t.boundingBox){var l=i.w===0?.5:(u.positionX-i.x1)/i.w,f=i.h===0?.5:(u.positionY-i.y1)/i.h;return{x:n.x1+l*n.w,y:n.y1+f*n.h}}else return{x:u.positionX,y:u.positionY}}},"getScaleInBoundsFn"),zp=v(function(e,t,a){var n=a.layout,i=a.eles.nodes(),s=of(e,a,i);i.positions(s),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},"refreshPositions"),Fp=v(function(e,t,a){Vp(e,t),Gp(e),Hp(e,t),Wp(e),$p(e)},"step"),Vp=v(function(e,t){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,s=0;s<i;s++)for(var o=e.layoutNodes[e.idToIndex[n[s]]],u=s+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[n[u]]];qp(o,l,e,t)}},"calculateNodeForces"),Tl=v(function(e){return-1+2*e*Math.random()},"randomDistance"),qp=v(function(e,t,a,n){var i=e.cmptId,s=t.cmptId;if(!(i!==s&&!a.isCompound)){var o=t.positionX-e.positionX,u=t.positionY-e.positionY,l=1;o===0&&u===0&&(o=Tl(l),u=Tl(l));var f=_p(e,t,o,u);if(f>0)var c=n.nodeOverlap*f,d=Math.sqrt(o*o+u*u),g=c*o/d,h=c*u/d;else var m=kn(e,o,u),p=kn(t,-1*o,-1*u),y=p.x-m.x,b=p.y-m.y,w=y*y+b*b,d=Math.sqrt(w),c=(e.nodeRepulsion+t.nodeRepulsion)/w,g=c*y/d,h=c*b/d;e.isLocked||(e.offsetX-=g,e.offsetY-=h),t.isLocked||(t.offsetX+=g,t.offsetY+=h)}},"nodeRepulsion"),_p=v(function(e,t,a,n){if(a>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var s=e.maxY-t.minY;else var s=t.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},"nodesOverlap"),kn=v(function(e,t,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,u=a/t,l=s/o,f={};return t===0&&0<a||t===0&&0>a?(f.x=n,f.y=i+s/2,f):0<t&&-1*l<=u&&u<=l?(f.x=n+o/2,f.y=i+o*a/2/t,f):0>t&&-1*l<=u&&u<=l?(f.x=n-o/2,f.y=i-o*a/2/t,f):0<a&&(u<=-1*l||u>=l)?(f.x=n+s*t/2/a,f.y=i+s/2,f):(0>a&&(u<=-1*l||u>=l)&&(f.x=n-s*t/2/a,f.y=i-s/2),f)},"findClippingPoint"),Gp=v(function(e,t){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],s=e.layoutNodes[i],o=e.idToIndex[n.targetId],u=e.layoutNodes[o],l=u.positionX-s.positionX,f=u.positionY-s.positionY;if(!(l===0&&f===0)){var c=kn(s,l,f),d=kn(u,-1*l,-1*f),g=d.x-c.x,h=d.y-c.y,m=Math.sqrt(g*g+h*h),p=Math.pow(n.idealLength-m,2)/n.elasticity;if(m!==0)var y=p*g/m,b=p*h/m;else var y=0,b=0;s.isLocked||(s.offsetX+=y,s.offsetY+=b),u.isLocked||(u.offsetX-=y,u.offsetY-=b)}}},"calculateEdgeForces"),Hp=v(function(e,t){if(t.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],s=i.length;if(n===0)var o=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[l.parentId]],o=f.positionX,u=f.positionY;for(var c=0;c<s;c++){var d=e.layoutNodes[e.idToIndex[i[c]]];if(!d.isLocked){var g=o-d.positionX,h=u-d.positionY,m=Math.sqrt(g*g+h*h);if(m>a){var p=t.gravity*g/m,y=t.gravity*h/m;d.offsetX+=p,d.offsetY+=y}}}}},"calculateGravityForces"),Wp=v(function(e,t){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],u=e.layoutNodes[o],l=u.children;if(0<l.length&&!u.isLocked){for(var f=u.offsetX,c=u.offsetY,d=0;d<l.length;d++){var g=e.layoutNodes[e.idToIndex[l[d]]];g.offsetX+=f,g.offsetY+=c,a[++i]=l[d]}u.offsetX=0,u.offsetY=0}}},"propagateForces"),$p=v(function(e,t){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=Up(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,uf(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},"updatePositions"),Up=v(function(e,t,a){var n=Math.sqrt(e*e+t*t);if(n>a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},"limitForce"),uf=v(function(e,t){var a=e.parentId;if(a!=null){var n=t.layoutNodes[t.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return uf(n,t)}},"updateAncestryBoundaries"),Sl=v(function(e,t){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var s=a[i],o=s.cmptId,u=n[o]=n[o]||[];u.push(s)}for(var l=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var c=0;c<f.length;c++){var d=f[c];f.x1=Math.min(f.x1,d.positionX-d.width/2),f.x2=Math.max(f.x2,d.positionX+d.width/2),f.y1=Math.min(f.y1,d.positionY-d.height/2),f.y2=Math.max(f.y2,d.positionY+d.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,l+=f.w*f.h}}n.sort(function(b,w){return w.w*w.h-b.w*b.h});for(var g=0,h=0,m=0,p=0,y=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var c=0;c<f.length;c++){var d=f[c];d.isLocked||(d.positionX+=g-f.x1,d.positionY+=h-f.y1)}g+=f.w+t.componentSpacing,m+=f.w+t.componentSpacing,p=Math.max(p,f.h),m>y&&(h+=p+t.componentSpacing,g=0,m=0,p=0)}}},"separateComponents"),Kp={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:v(function(e){},"position"),sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:v(function(e,t){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:v(function(e,t){return t},"transform")};function lf(r){this.options=me({},Kp,r)}v(lf,"GridLayout");lf.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=mr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(K){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),u=Math.round(o),l=Math.round(i.w/i.h*o),f=v(function(j){if(j==null)return Math.min(u,l);var Q=Math.min(u,l);Q==u?u=j:l=j},"small"),c=v(function(j){if(j==null)return Math.max(u,l);var Q=Math.max(u,l);Q==u?u=j:l=j},"large"),d=e.rows,g=e.cols!=null?e.cols:e.columns;if(d!=null&&g!=null)u=d,l=g;else if(d!=null&&g==null)u=d,l=Math.ceil(s/u);else if(d==null&&g!=null)l=g,u=Math.ceil(s/l);else if(l*u>s){var h=f(),m=c();(h-1)*m>=s?f(h-1):(m-1)*h>=s&&c(m-1)}else for(;l*u<s;){var p=f(),y=c();(y+1)*p>=s?c(y+1):f(p+1)}var b=i.w/l,w=i.h/u;if(e.condense&&(b=0,w=0),e.avoidOverlap)for(var x=0;x<n.length;x++){var C=n[x],T=C._private.position;(T.x==null||T.y==null)&&(T.x=0,T.y=0);var E=C.layoutDimensions(e),S=e.avoidOverlapPadding,D=E.w+S,B=E.h+S;b=Math.max(b,D),w=Math.max(w,B)}for(var P={},A=v(function(j,Q){return!!P["c-"+j+"-"+Q]},"used"),R=v(function(j,Q){P["c-"+j+"-"+Q]=!0},"use"),M=0,I=0,O=v(function(){I++,I>=l&&(I=0,M++)},"moveToNextCell"),L={},N=0;N<n.length;N++){var _=n[N],G=e.position(_);if(G&&(G.row!==void 0||G.col!==void 0)){var z={row:G.row,col:G.col};if(z.col===void 0)for(z.col=0;A(z.row,z.col);)z.col++;else if(z.row===void 0)for(z.row=0;A(z.row,z.col);)z.row++;L[_.id()]=z,R(z.row,z.col)}}var V=v(function(j,Q){var ee,te;if(j.locked()||j.isParent())return!1;var ie=L[j.id()];if(ie)ee=ie.col*b+b/2+i.x1,te=ie.row*w+w/2+i.y1;else{for(;A(M,I);)O();ee=I*b+b/2+i.x1,te=M*w+w/2+i.y1,R(M,I),O()}return{x:ee,y:te}},"getPos");n.layoutPositions(this,e,V)}return this};var Xp={ready:v(function(){},"ready"),stop:v(function(){},"stop")};function co(r){this.options=me({},Xp,r)}v(co,"NullLayout");co.prototype.run=function(){var r=this.options,e=r.eles,t=this;return r.cy,t.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),t.one("layoutready",r.ready),t.emit("layoutready"),t.one("layoutstop",r.stop),t.emit("layoutstop"),this};co.prototype.stop=function(){return this};var Yp={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:v(function(e,t){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:v(function(e,t){return t},"transform")};function vf(r){this.options=me({},Yp,r)}v(vf,"PresetLayout");vf.prototype.run=function(){var r=this.options,e=r.eles,t=e.nodes(),a=Ue(r.positions);function n(i){if(r.positions==null)return yd(i.position());if(a)return r.positions(i);var s=r.positions[i._private.data.id];return s??null}return v(n,"getPosition"),t.layoutPositions(this,r,function(i,s){var o=n(i);return i.locked()||o==null?!1:o}),this};var Zp={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:v(function(e,t){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:v(function(e,t){return t},"transform")};function ff(r){this.options=me({},Zp,r)}v(ff,"RandomLayout");ff.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,a=mr(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=v(function(s,o){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}},"getPos");return t.nodes().layoutPositions(this,r,n),this};var Qp=[{name:"breadthfirst",impl:tf},{name:"circle",impl:af},{name:"concentric",impl:nf},{name:"cose",impl:Un},{name:"grid",impl:lf},{name:"null",impl:co},{name:"preset",impl:vf},{name:"random",impl:ff}];function cf(r){this.options=r,this.notifications=0}v(cf,"NullRenderer");var kl=v(function(){},"noop"),Dl=v(function(){throw new Error("A headless instance can not render images")},"throwImgErr");cf.prototype={recalculateRenderedStyle:kl,notify:v(function(){this.notifications++},"notify"),init:kl,isHeadless:v(function(){return!0},"isHeadless"),png:Dl,jpg:Dl};var ho={};ho.arrowShapeWidth=.3;ho.registerArrowShapes=function(){var r=this.arrowShapes={},e=this,t=v(function(l,f,c,d,g,h,m){var p=g.x-c/2-m,y=g.x+c/2+m,b=g.y-c/2-m,w=g.y+c/2+m,x=p<=l&&l<=y&&b<=f&&f<=w;return x},"bbCollide"),a=v(function(l,f,c,d,g){var h=l*Math.cos(d)-f*Math.sin(d),m=l*Math.sin(d)+f*Math.cos(d),p=h*c,y=m*c,b=p+g.x,w=y+g.y;return{x:b,y:w}},"transform"),n=v(function(l,f,c,d){for(var g=[],h=0;h<l.length;h+=2){var m=l[h],p=l[h+1];g.push(a(m,p,f,c,d))}return g},"transformPoints"),i=v(function(l){for(var f=[],c=0;c<l.length;c++){var d=l[c];f.push(d.x,d.y)}return f},"pointsToArr"),s=v(function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},"standardGap"),o=v(function(l,f){ge(f)&&(f=r[f]),r[l]=me({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:v(function(d,g,h,m,p,y){var b=i(n(this.points,h+2*y,m,p)),w=Cr(d,g,b);return w},"collide"),roughCollide:t,draw:v(function(d,g,h,m){var p=n(this.points,g,h,m);e.arrowShapeImpl("polygon")(d,p)},"draw"),spacing:v(function(d){return 0},"spacing"),gap:s},f)},"defineArrowShape");o("none",{collide:wn,roughCollide:wn,draw:Js,spacing:_o,gap:_o}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:r.triangle.points,controlPoint:[0,-.15],roughCollide:t,draw:v(function(l,f,c,d,g){var h=n(this.points,f,c,d),m=this.controlPoint,p=a(m[0],m[1],f,c,d);e.arrowShapeImpl(this.name)(l,h,p)},"draw"),gap:v(function(l){return s(l)*.8},"gap")}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:v(function(l,f,c,d,g,h,m){var p=i(n(this.points,c+2*m,d,g)),y=i(n(this.pointsTee,c+2*m,d,g)),b=Cr(l,f,p)||Cr(l,f,y);return b},"collide"),draw:v(function(l,f,c,d,g){var h=n(this.points,f,c,d),m=n(this.pointsTee,f,c,d);e.arrowShapeImpl(this.name)(l,h,m)},"draw")}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:v(function(l,f,c,d,g,h,m){var p=g,y=Math.pow(p.x-l,2)+Math.pow(p.y-f,2)<=Math.pow((c+2*m)*this.radius,2),b=i(n(this.points,c+2*m,d,g));return Cr(l,f,b)||y},"collide"),draw:v(function(l,f,c,d,g){var h=n(this.pointsTr,f,c,d);e.arrowShapeImpl(this.name)(l,h,d.x,d.y,this.radius*f)},"draw"),spacing:v(function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius},"spacing")}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:v(function(l,f){var c=this.baseCrossLinePts.slice(),d=f/l,g=3,h=5;return c[g]=c[g]-d,c[h]=c[h]-d,c},"crossLinePts"),collide:v(function(l,f,c,d,g,h,m){var p=i(n(this.points,c+2*m,d,g)),y=i(n(this.crossLinePts(c,h),c+2*m,d,g)),b=Cr(l,f,p)||Cr(l,f,y);return b},"collide"),draw:v(function(l,f,c,d,g){var h=n(this.points,f,c,d),m=n(this.crossLinePts(f,g),f,c,d);e.arrowShapeImpl(this.name)(l,h,m)},"draw")}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:v(function(l){return s(l)*.525},"gap")}),o("circle",{radius:.15,collide:v(function(l,f,c,d,g,h,m){var p=g,y=Math.pow(p.x-l,2)+Math.pow(p.y-f,2)<=Math.pow((c+2*m)*this.radius,2);return y},"collide"),draw:v(function(l,f,c,d,g){e.arrowShapeImpl(this.name)(l,d.x,d.y,this.radius*f)},"draw"),spacing:v(function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius},"spacing")}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:v(function(l){return 1},"spacing"),gap:v(function(l){return 1},"gap")}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:v(function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value},"gap")}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:v(function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value},"gap")})};var Lt={};Lt.projectIntoViewport=function(r,e){var t=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],s=a[4],o=t.pan(),u=t.zoom(),l=((r-n)/s-o.x)/u,f=((e-i)/s-o.y)/u;return[l,f]};Lt.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var r=this.container,e=r.getBoundingClientRect(),t=this.cy.window().getComputedStyle(r),a=v(function(y){return parseFloat(t.getPropertyValue(y))},"styleValue"),n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},s=r.clientWidth,o=r.clientHeight,u=n.left+n.right,l=n.top+n.bottom,f=i.left+i.right,c=e.width/(s+f),d=s-u,g=o-l,h=e.left+n.left+i.left,m=e.top+n.top+i.top;return this.containerBB=[h,m,d,g,c]};Lt.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Lt.findNearestElement=function(r,e,t,a){return this.findNearestElements(r,e,t,a)[0]};Lt.findNearestElements=function(r,e,t,a){var n=this,i=this,s=i.getCachedZSortedEles(),o=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),f=(a?24:8)/u,c=(a?8:2)/u,d=(a?8:2)/u,g=1/0,h,m;t&&(s=s.interactive);function p(E,S){if(E.isNode()){if(m)return;m=E,o.push(E)}if(E.isEdge()&&(S==null||S<g))if(h){if(h.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value&&h.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value){for(var D=0;D<o.length;D++)if(o[D].isEdge()){o[D]=E,h=E,g=S??g;break}}}else o.push(E),h=E,g=S??g}v(p,"addEle");function y(E){var S=E.outerWidth()+2*c,D=E.outerHeight()+2*c,B=S/2,P=D/2,A=E.position(),R=E.pstyle("corner-radius").value==="auto"?"auto":E.pstyle("corner-radius").pfValue,M=E._private.rscratch;if(A.x-B<=r&&r<=A.x+B&&A.y-P<=e&&e<=A.y+P){var I=i.nodeShapes[n.getNodeShape(E)];if(I.checkPoint(r,e,0,S,D,A.x,A.y,R,M))return p(E,0),!0}}v(y,"checkNode");function b(E){var S=E._private,D=S.rscratch,B=E.pstyle("width").pfValue,P=E.pstyle("arrow-scale").value,A=B/2+f,R=A*A,M=A*2,N=S.source,_=S.target,I;if(D.edgeType==="segments"||D.edgeType==="straight"||D.edgeType==="haystack"){for(var O=D.allpts,L=0;L+3<O.length;L+=2)if(Rd(r,e,O[L],O[L+1],O[L+2],O[L+3],M)&&R>(I=Nd(r,e,O[L],O[L+1],O[L+2],O[L+3])))return p(E,I),!0}else if(D.edgeType==="bezier"||D.edgeType==="multibezier"||D.edgeType==="self"||D.edgeType==="compound"){for(var O=D.allpts,L=0;L+5<D.allpts.length;L+=4)if(Md(r,e,O[L],O[L+1],O[L+2],O[L+3],O[L+4],O[L+5],M)&&R>(I=Od(r,e,O[L],O[L+1],O[L+2],O[L+3],O[L+4],O[L+5])))return p(E,I),!0}for(var N=N||S.source,_=_||S.target,G=n.getArrowWidth(B,P),z=[{name:"source",x:D.arrowStartX,y:D.arrowStartY,angle:D.srcArrowAngle},{name:"target",x:D.arrowEndX,y:D.arrowEndY,angle:D.tgtArrowAngle},{name:"mid-source",x:D.midX,y:D.midY,angle:D.midsrcArrowAngle},{name:"mid-target",x:D.midX,y:D.midY,angle:D.midtgtArrowAngle}],L=0;L<z.length;L++){var V=z[L],K=i.arrowShapes[E.pstyle(V.name+"-arrow-shape").value],j=E.pstyle("width").pfValue;if(K.roughCollide(r,e,G,V.angle,{x:V.x,y:V.y},j,f)&&K.collide(r,e,G,V.angle,{x:V.x,y:V.y},j,f))return p(E),!0}l&&o.length>0&&(y(N),y(_))}v(b,"checkEdge");function w(E,S,D){return Er(E,S,D)}v(w,"preprop");function x(E,S){var D=E._private,B=d,P;S?P=S+"-":P="",E.boundingBox();var A=D.labelBounds[S||"main"],R=E.pstyle(P+"label").value,M=E.pstyle("text-events").strValue==="yes";if(!(!M||!R)){var I=w(D.rscratch,"labelX",S),O=w(D.rscratch,"labelY",S),L=w(D.rscratch,"labelAngle",S),N=E.pstyle(P+"text-margin-x").pfValue,_=E.pstyle(P+"text-margin-y").pfValue,G=A.x1-B-N,z=A.x2+B-N,V=A.y1-B-_,K=A.y2+B-_;if(L){var j=Math.cos(L),Q=Math.sin(L),ee=v(function(Z,ae){return Z=Z-I,ae=ae-O,{x:Z*j-ae*Q+I,y:Z*Q+ae*j+O}},"rotate"),te=ee(G,V),ie=ee(G,K),J=ee(z,V),q=ee(z,K),W=[te.x+N,te.y+_,J.x+N,J.y+_,q.x+N,q.y+_,ie.x+N,ie.y+_];if(Cr(r,e,W))return p(E),!0}else if(nt(A,r,e))return p(E),!0}}v(x,"checkLabel");for(var C=s.length-1;C>=0;C--){var T=s[C];T.isNode()?y(T)||x(T):b(T)||x(T)||x(T,"source")||x(T,"target")}return o};Lt.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),s=2/i,o=[],u=Math.min(r,t),l=Math.max(r,t),f=Math.min(e,a),c=Math.max(e,a);r=u,t=l,e=f,a=c;var d=mr({x1:r,y1:e,x2:t,y2:a}),g=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],h=[[g[0],g[1]],[g[1],g[2]],[g[2],g[3]],[g[3],g[0]]];function m(Z,ae,de){return Er(Z,ae,de)}v(m,"preprop");function p(Z,ae){var de=Z._private,Pe=s,xe="";Z.boundingBox();var be=de.labelBounds.main;if(!be)return null;var pe=m(de.rscratch,"labelX",ae),oe=m(de.rscratch,"labelY",ae),he=m(de.rscratch,"labelAngle",ae),ce=Z.pstyle(xe+"text-margin-x").pfValue,Ee=Z.pstyle(xe+"text-margin-y").pfValue,we=be.x1-Pe-ce,ke=be.x2+Pe-ce,Be=be.y1-Pe-Ee,Ne=be.y2+Pe-Ee;if(he){var Ie=Math.cos(he),Re=Math.sin(he),Y=v(function(F,H){return F=F-pe,H=H-oe,{x:F*Ie-H*Re+pe,y:F*Re+H*Ie+oe}},"rotate");return[Y(we,Be),Y(ke,Be),Y(ke,Ne),Y(we,Ne)]}else return[{x:we,y:Be},{x:ke,y:Be},{x:ke,y:Ne},{x:we,y:Ne}]}v(p,"getRotatedLabelBox");function y(Z,ae,de,Pe){function xe(be,pe,oe){return(oe.y-be.y)*(pe.x-be.x)>(pe.y-be.y)*(oe.x-be.x)}return v(xe,"ccw"),xe(Z,de,Pe)!==xe(ae,de,Pe)&&xe(Z,ae,de)!==xe(Z,ae,Pe)}v(y,"doLinesIntersect");for(var b=0;b<n.length;b++){var w=n[b];if(w.isNode()){var x=w,C=x.pstyle("text-events").strValue==="yes",T=x.pstyle("box-selection").strValue,E=x.pstyle("box-select-labels").strValue==="yes";if(T==="none")continue;var S=(T==="overlap"||E)&&C,D=x.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:S});if(T==="contain"){var B=!1;if(E&&C){var P=p(x);P&&pi(P,g)&&(o.push(x),B=!0)}!B&&mv(d,D)&&o.push(x)}else if(T==="overlap"&&to(d,D)){var A=x.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),R=[{x:A.x1,y:A.y1},{x:A.x2,y:A.y1},{x:A.x2,y:A.y2},{x:A.x1,y:A.y2}];if(pi(R,g))o.push(x);else{var M=p(x);M&&pi(M,g)&&o.push(x)}}}else{var I=w,O=I._private,L=O.rscratch,N=I.pstyle("box-selection").strValue;if(N==="none")continue;if(N==="contain"){if(L.startX!=null&&L.startY!=null&&!nt(d,L.startX,L.startY)||L.endX!=null&&L.endY!=null&&!nt(d,L.endX,L.endY))continue;if(L.edgeType==="bezier"||L.edgeType==="multibezier"||L.edgeType==="self"||L.edgeType==="compound"||L.edgeType==="segments"||L.edgeType==="haystack"){for(var _=O.rstyle.bezierPts||O.rstyle.linePts||O.rstyle.haystackPts,G=!0,z=0;z<_.length;z++)if(!Uo(d,_[z])){G=!1;break}G&&o.push(I)}else L.edgeType==="straight"&&o.push(I)}else if(N==="overlap"){var V=!1;if(L.startX!=null&&L.startY!=null&&L.endX!=null&&L.endY!=null&&(nt(d,L.startX,L.startY)||nt(d,L.endX,L.endY)))o.push(I),V=!0;else if(!V&&L.edgeType==="haystack"){for(var K=O.rstyle.haystackPts,j=0;j<K.length;j++)if(Uo(d,K[j])){o.push(I),V=!0;break}}if(!V){var Q=O.rstyle.bezierPts||O.rstyle.linePts||O.rstyle.haystackPts;if((!Q||Q.length<2)&&L.edgeType==="straight"&&L.startX!=null&&L.startY!=null&&L.endX!=null&&L.endY!=null&&(Q=[{x:L.startX,y:L.startY},{x:L.endX,y:L.endY}]),!Q||Q.length<2)continue;for(var ee=0;ee<Q.length-1;ee++){for(var te=Q[ee],ie=Q[ee+1],J=0;J<h.length;J++){var q=Je(h[J],2),W=q[0],$=q[1];if(y(te,ie,W,$)){o.push(I),V=!0;break}}if(V)break}}}}}return o};var Dn={};Dn.calculateArrowAngles=function(r){var e=r._private.rscratch,t=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",s=e.edgeType==="compound",o=e.edgeType==="self",u,l,f,c,d,g,y,b;if(t?(f=e.haystackPts[0],c=e.haystackPts[1],d=e.haystackPts[2],g=e.haystackPts[3]):(f=e.arrowStartX,c=e.arrowStartY,d=e.arrowEndX,g=e.arrowEndY),y=e.midX,b=e.midY,i)u=f-e.segpts[0],l=c-e.segpts[1];else if(n||s||o||a){var h=e.allpts,m=ir(h[0],h[2],h[4],.1),p=ir(h[1],h[3],h[5],.1);u=f-m,l=c-p}else u=f-y,l=c-b;e.srcArrowAngle=Xa(u,l);var y=e.midX,b=e.midY;if(t&&(y=(f+d)/2,b=(c+g)/2),u=d-f,l=g-c,i){var h=e.allpts;if(h.length/2%2===0){var w=h.length/2,x=w-2;u=h[w]-h[x],l=h[w+1]-h[x+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var w=h.length/2-1,x=w-2;u=h[w]-h[x],l=h[w+1]-h[x+1]}}else if(n||s||o){var h=e.allpts,C=e.ctrlpts,T,E,S,D;if(C.length/2%2===0){var B=h.length/2-1,P=B+2,A=P+2;T=ir(h[B],h[P],h[A],0),E=ir(h[B+1],h[P+1],h[A+1],0),S=ir(h[B],h[P],h[A],1e-4),D=ir(h[B+1],h[P+1],h[A+1],1e-4)}else{var P=h.length/2-1,B=P-2,A=P+2;T=ir(h[B],h[P],h[A],.4999),E=ir(h[B+1],h[P+1],h[A+1],.4999),S=ir(h[B],h[P],h[A],.5),D=ir(h[B+1],h[P+1],h[A+1],.5)}u=S-T,l=D-E}if(e.midtgtArrowAngle=Xa(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var h=e.allpts;if(h.length/2%2!==0){if(!e.isRound){var w=h.length/2-1,R=w+2;u=-(h[R]-h[w]),l=-(h[R+1]-h[w+1])}}}if(e.midsrcArrowAngle=Xa(u,l),i)u=d-e.segpts[e.segpts.length-2],l=g-e.segpts[e.segpts.length-1];else if(n||s||o||a){var h=e.allpts,M=h.length,m=ir(h[M-6],h[M-4],h[M-2],.9),p=ir(h[M-5],h[M-3],h[M-1],.9);u=d-m,l=g-p}else u=d-y,l=g-b;e.tgtArrowAngle=Xa(u,l)};Dn.getArrowWidth=Dn.getArrowHeight=function(r,e){var t=this.arrowWidthCache=this.arrowWidthCache||{},a=t[r+", "+e];return a||(a=Math.max(Math.pow(r*13.37,.9),29)*e,t[r+", "+e]=a,a)};var Fs,Vs,qr={},Dr={},Bl,Pl,kt,hn,Ur,wt,Tt,Fr,Vt,tn,df,hf,qs,_s,Al,Rl=v(function(e,t,a){a.x=t.x-e.x,a.y=t.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},"asVec"),Jp=v(function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},"invertVec"),jp=v(function(e,t,a,n,i){if(e!==Al?Rl(t,e,qr):Jp(Dr,qr),Rl(t,a,Dr),Bl=qr.nx*Dr.ny-qr.ny*Dr.nx,Pl=qr.nx*Dr.nx-qr.ny*-Dr.ny,Ur=Math.asin(Math.max(-1,Math.min(1,Bl))),Math.abs(Ur)<1e-6){Fs=t.x,Vs=t.y,Tt=Vt=0;return}kt=1,hn=!1,Pl<0?Ur<0?Ur=Math.PI+Ur:(Ur=Math.PI-Ur,kt=-1,hn=!0):Ur>0&&(kt=-1,hn=!0),t.radius!==void 0?Vt=t.radius:Vt=n,wt=Ur/2,tn=Math.min(qr.len/2,Dr.len/2),i?(Fr=Math.abs(Math.cos(wt)*Vt/Math.sin(wt)),Fr>tn?(Fr=tn,Tt=Math.abs(Fr*Math.sin(wt)/Math.cos(wt))):Tt=Vt):(Fr=Math.min(tn,Vt),Tt=Math.abs(Fr*Math.sin(wt)/Math.cos(wt))),qs=t.x+Dr.nx*Fr,_s=t.y+Dr.ny*Fr,Fs=qs-Dr.ny*Tt*kt,Vs=_s+Dr.nx*Tt*kt,df=t.x+qr.nx*Fr,hf=t.y+qr.ny*Fr,Al=t},"calcCornerArc");function gf(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}v(gf,"drawPreparedRoundCorner");function go(r,e,t,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(jp(r,e,t,a,n),{cx:Fs,cy:Vs,radius:Tt,startX:df,startY:hf,stopX:qs,stopY:_s,startAngle:qr.ang+Math.PI/2*kt,endAngle:Dr.ang-Math.PI/2*kt,counterClockwise:hn})}v(go,"getRoundCorner");var Ra=.01,ey=Math.sqrt(2*Ra),pr={};pr.findMidptPtsEtc=function(r,e){var t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,s=r.pstyle("source-endpoint"),o=r.pstyle("target-endpoint"),u=s.units!=null&&o.units!=null,l=v(function(C,T,E,S){var D=S-T,B=E-C,P=Math.sqrt(B*B+D*D);return{x:-D/P,y:B/P}},"recalcVectorNormInverse"),f=r.pstyle("edge-distances").value;switch(f){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":{if(u){var c=this.manualEndptToPx(r.source()[0],s),d=Je(c,2),g=d[0],h=d[1],m=this.manualEndptToPx(r.target()[0],o),p=Je(m,2),y=p[0],b=p[1],w={x1:g,y1:h,x2:y,y2:b};n=l(g,h,y,b),i=w}else Fe("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};pr.findHaystackPoints=function(r){for(var e=0;e<r.length;e++){var t=r[e],a=t._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var s=a.source,o=a.target,u=s.position(),l=o.position(),f=s.width(),c=o.width(),d=s.height(),g=o.height(),h=t.pstyle("haystack-radius").value,m=h/2;n.haystackPts=n.allpts=[n.source.x*f*m+u.x,n.source.y*d*m+u.y,n.target.x*c*m+l.x,n.target.y*g*m+l.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(t),this.calculateArrowAngles(t),this.recalculateEdgeLabelProjections(t),this.calculateLabelAngles(t)}};pr.findSegmentsPoints=function(r,e){var t=r._private.rscratch,a=r.pstyle("segment-weights"),n=r.pstyle("segment-distances"),i=r.pstyle("segment-radii"),s=r.pstyle("radius-type"),o=Math.min(a.pfValue.length,n.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=s.pfValue[s.pfValue.length-1];t.edgeType="segments",t.segpts=[],t.radii=[],t.isArcRadius=[];for(var f=0;f<o;f++){var c=a.pfValue[f],d=n.pfValue[f],g=1-c,h=c,m=this.findMidptPtsEtc(r,e),p=m.midptPts,y=m.vectorNormInverse,b={x:p.x1*g+p.x2*h,y:p.y1*g+p.y2*h};t.segpts.push(b.x+y.x*d,b.y+y.y*d),t.radii.push(i.pfValue[f]!==void 0?i.pfValue[f]:u),t.isArcRadius.push((s.pfValue[f]!==void 0?s.pfValue[f]:l)==="arc-radius")}};pr.findLoopPoints=function(r,e,t,a){var n=r._private.rscratch,i=e.dirCounts,s=e.srcPos,o=r.pstyle("control-point-distances"),u=o?o.pfValue[0]:void 0,l=r.pstyle("loop-direction").pfValue,f=r.pstyle("loop-sweep").pfValue,c=r.pstyle("control-point-step-size").pfValue;n.edgeType="self";var d=t,g=c;a&&(d=0,g=u);var h=l-Math.PI/2,m=h-f/2,p=h+f/2,y=l+"_"+f;d=i[y]===void 0?i[y]=0:++i[y],n.ctrlpts=[s.x+Math.cos(m)*1.4*g*(d/3+1),s.y+Math.sin(m)*1.4*g*(d/3+1),s.x+Math.cos(p)*1.4*g*(d/3+1),s.y+Math.sin(p)*1.4*g*(d/3+1)]};pr.findCompoundLoopPoints=function(r,e,t,a){var n=r._private.rscratch;n.edgeType="compound";var i=e.srcPos,s=e.tgtPos,o=e.srcW,u=e.srcH,l=e.tgtW,f=e.tgtH,c=r.pstyle("control-point-step-size").pfValue,d=r.pstyle("control-point-distances"),g=d?d.pfValue[0]:void 0,h=t,m=c;a&&(h=0,m=g);var p=50,y={x:i.x-o/2,y:i.y-u/2},b={x:s.x-l/2,y:s.y-f/2},w={x:Math.min(y.x,b.x),y:Math.min(y.y,b.y)},x=.5,C=Math.max(x,Math.log(o*Ra)),T=Math.max(x,Math.log(l*Ra));n.ctrlpts=[w.x,w.y-(1+Math.pow(p,1.12)/100)*m*(h/3+1)*C,w.x-(1+Math.pow(p,1.12)/100)*m*(h/3+1)*T,w.y]};pr.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"};pr.findBezierPoints=function(r,e,t,a,n){var i=r._private.rscratch,s=r.pstyle("control-point-step-size").pfValue,o=r.pstyle("control-point-distances"),u=r.pstyle("control-point-weights"),l=o&&u?Math.min(o.value.length,u.value.length):1,f=o?o.pfValue[0]:void 0,c=u.value[0],d=a;i.edgeType=d?"multibezier":"bezier",i.ctrlpts=[];for(var g=0;g<l;g++){var h=(.5-e.eles.length/2+t)*s*(n?-1:1),m=void 0,p=ro(h);d&&(f=o?o.pfValue[g]:s,c=u.value[g]),a?m=f:m=f!==void 0?p*f:void 0;var y=m!==void 0?m:h,b=1-c,w=c,x=this.findMidptPtsEtc(r,e),C=x.midptPts,T=x.vectorNormInverse,E={x:C.x1*b+C.x2*w,y:C.y1*b+C.y2*w};i.ctrlpts.push(E.x+T.x*y,E.y+T.y*y)}};pr.findTaxiPoints=function(r,e){var t=r._private.rscratch;t.edgeType="segments";var a="vertical",n="horizontal",i="leftward",s="rightward",o="downward",u="upward",l="auto",f=e.posPts,c=e.srcW,d=e.srcH,g=e.tgtW,h=e.tgtH,m=r.pstyle("edge-distances").value,p=m!=="node-position",y=r.pstyle("taxi-direction").value,b=y,w=r.pstyle("taxi-turn"),x=w.units==="%",C=w.pfValue,T=C<0,E=r.pstyle("taxi-turn-min-distance").pfValue,S=p?(c+g)/2:0,D=p?(d+h)/2:0,B=f.x2-f.x1,P=f.y2-f.y1,A=v(function(H,U){return H>0?Math.max(H-U,0):Math.min(H+U,0)},"subDWH"),R=A(B,S),M=A(P,D),I=!1;b===l?y=Math.abs(R)>Math.abs(M)?n:a:b===u||b===o?(y=a,I=!0):(b===i||b===s)&&(y=n,I=!0);var O=y===a,L=O?M:R,N=O?P:B,_=ro(N),G=!1;!(I&&(x||T))&&(b===o&&N<0||b===u&&N>0||b===i&&N>0||b===s&&N<0)&&(_*=-1,L=_*Math.abs(L),G=!0);var z;if(x){var V=C<0?1+C:C;z=V*L}else{var K=C<0?L:0;z=K+C*_}var j=v(function(H){return Math.abs(H)<E||Math.abs(H)>=Math.abs(L)},"getIsTooClose"),Q=j(z),ee=j(Math.abs(L)-Math.abs(z)),te=Q||ee;if(te&&!G)if(O){var ie=Math.abs(N)<=d/2,J=Math.abs(B)<=g/2;if(ie){var q=(f.x1+f.x2)/2,W=f.y1,$=f.y2;t.segpts=[q,W,q,$]}else if(J){var Z=(f.y1+f.y2)/2,ae=f.x1,de=f.x2;t.segpts=[ae,Z,de,Z]}else t.segpts=[f.x1,f.y2]}else{var Pe=Math.abs(N)<=c/2,xe=Math.abs(P)<=h/2;if(Pe){var be=(f.y1+f.y2)/2,pe=f.x1,oe=f.x2;t.segpts=[pe,be,oe,be]}else if(xe){var he=(f.x1+f.x2)/2,ce=f.y1,Ee=f.y2;t.segpts=[he,ce,he,Ee]}else t.segpts=[f.x2,f.y1]}else if(O){var we=f.y1+z+(p?d/2*_:0),ke=f.x1,Be=f.x2;t.segpts=[ke,we,Be,we]}else{var Ne=f.x1+z+(p?c/2*_:0),Ie=f.y1,Re=f.y2;t.segpts=[Ne,Ie,Ne,Re]}if(t.isRound){var Y=r.pstyle("taxi-radius").value,k=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(Y),t.isArcRadius=new Array(t.segpts.length/2).fill(k)}};pr.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,c=e.srcCornerRadius,d=e.tgtCornerRadius,g=e.srcRs,h=e.tgtRs,m=!ne(t.startX)||!ne(t.startY),p=!ne(t.arrowStartX)||!ne(t.arrowStartY),y=!ne(t.endX)||!ne(t.endY),b=!ne(t.arrowEndX)||!ne(t.arrowEndY),w=3,x=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,C=w*x,T=Pt({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),E=T<C,S=Pt({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),D=S<C,B=!1;if(m||p||E){B=!0;var P={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},A=Math.sqrt(P.x*P.x+P.y*P.y),R={x:P.x/A,y:P.y/A},M=Math.max(i,s),I={x:t.ctrlpts[0]+R.x*2*M,y:t.ctrlpts[1]+R.y*2*M},O=l.intersectLine(a.x,a.y,i,s,I.x,I.y,0,c,g);E?(t.ctrlpts[0]=t.ctrlpts[0]+R.x*(C-T),t.ctrlpts[1]=t.ctrlpts[1]+R.y*(C-T)):(t.ctrlpts[0]=O[0]+R.x*C,t.ctrlpts[1]=O[1]+R.y*C)}if(y||b||D){B=!0;var L={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},N=Math.sqrt(L.x*L.x+L.y*L.y),_={x:L.x/N,y:L.y/N},G=Math.max(i,s),z={x:t.ctrlpts[0]+_.x*2*G,y:t.ctrlpts[1]+_.y*2*G},V=f.intersectLine(n.x,n.y,o,u,z.x,z.y,0,d,h);D?(t.ctrlpts[0]=t.ctrlpts[0]+_.x*(C-S),t.ctrlpts[1]=t.ctrlpts[1]+_.y*(C-S)):(t.ctrlpts[0]=V[0]+_.x*C,t.ctrlpts[1]=V[1]+_.y*C)}B&&this.findEndpoints(r)}};pr.storeAllpts=function(r){var e=r._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var t=0;t+1<e.ctrlpts.length;t+=2)e.allpts.push(e.ctrlpts[t],e.ctrlpts[t+1]),t+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[t]+e.ctrlpts[t+2])/2,(e.ctrlpts[t+1]+e.ctrlpts[t+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=ir(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=ir(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var s=e.radii[i/2-1],o=e.isArcRadius[i/2-1];e.roundCorners.push(go({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:s},{x:e.allpts[i+2],y:e.allpts[i+3]},s,o))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var f=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[f],e.midY=e.segpts[f+1];else{var c={x:e.segpts[f],y:e.segpts[f+1]},d=e.roundCorners[f/2];if(d.radius===0){var g={x:e.segpts[f+2],y:e.segpts[f+3]};e.midX=c.x,e.midY=c.y,e.midVector=[c.y-g.y,g.x-c.x]}else{var h=[c.x-d.cx,c.y-d.cy],m=d.radius/Math.sqrt(Math.pow(h[0],2)+Math.pow(h[1],2));h=h.map(function(p){return p*m}),e.midX=d.cx+h[0],e.midY=d.cy+h[1],e.midVector=h}}}}};pr.checkForInvalidEdgeWarning=function(r){var e=r[0]._private.rscratch;e.nodesOverlap||ne(e.startX)&&ne(e.startY)&&ne(e.endX)&&ne(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Fe("Edge `"+r.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};pr.findEdgeControlPoints=function(r){var e=this;if(!(!r||r.length===0)){for(var t=this,a=t.cy,n=a.hasCompoundNodes(),i=new Xr,s=v(function(D,B){return[].concat(yn(D),[B?1:0]).join("-")},"getKey"),o=[],u=[],l=0;l<r.length;l++){var f=r[l],c=f._private,d=f.pstyle("curve-style").value;if(!(f.removed()||!f.takesUpSpace())){if(d==="haystack"){u.push(f);continue}var g=d==="unbundled-bezier"||at(d,"segments")||d==="straight"||d==="straight-triangle"||at(d,"taxi"),h=d==="unbundled-bezier"||d==="bezier",m=c.source,p=c.target,y=m.poolIndex(),b=p.poolIndex(),w=[y,b].sort(),x=s(w,g),C=i.get(x);C==null&&(C={eles:[]},o.push({pairId:w,edgeIsUnbundled:g}),i.set(x,C)),C.eles.push(f),g&&(C.hasUnbundled=!0),h&&(C.hasBezier=!0)}}for(var T=v(function(){var D=o[E],B=D.pairId,P=D.edgeIsUnbundled,A=s(B,P),R=i.get(A),M;if(!R.hasUnbundled){var I=R.eles[0].parallelEdges().filter(function(k){return k.isBundledBezier()});js(R.eles),I.forEach(function(k){return R.eles.push(k)}),R.eles.sort(function(k,F){return k.poolIndex()-F.poolIndex()})}var O=R.eles[0],L=O.source(),N=O.target();if(L.poolIndex()>N.poolIndex()){var _=L;L=N,N=_}var G=R.srcPos=L.position(),z=R.tgtPos=N.position(),V=R.srcW=L.outerWidth(),K=R.srcH=L.outerHeight(),j=R.tgtW=N.outerWidth(),Q=R.tgtH=N.outerHeight(),ee=R.srcShape=t.nodeShapes[e.getNodeShape(L)],te=R.tgtShape=t.nodeShapes[e.getNodeShape(N)],ie=R.srcCornerRadius=L.pstyle("corner-radius").value==="auto"?"auto":L.pstyle("corner-radius").pfValue,J=R.tgtCornerRadius=N.pstyle("corner-radius").value==="auto"?"auto":N.pstyle("corner-radius").pfValue,q=R.tgtRs=N._private.rscratch,W=R.srcRs=L._private.rscratch;R.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var $=0;$<R.eles.length;$++){var Z=R.eles[$],ae=Z[0]._private.rscratch,de=Z.pstyle("curve-style").value,Pe=de==="unbundled-bezier"||at(de,"segments")||at(de,"taxi"),xe=!L.same(Z.source());if(!R.calculatedIntersection&&L!==N&&(R.hasBezier||R.hasUnbundled)){R.calculatedIntersection=!0;var be=ee.intersectLine(G.x,G.y,V,K,z.x,z.y,0,ie,W),pe=R.srcIntn=be,oe=te.intersectLine(z.x,z.y,j,Q,G.x,G.y,0,J,q),he=R.tgtIntn=oe,ce=R.intersectionPts={x1:be[0],x2:oe[0],y1:be[1],y2:oe[1]},Ee=R.posPts={x1:G.x,x2:z.x,y1:G.y,y2:z.y},we=oe[1]-be[1],ke=oe[0]-be[0],Be=Math.sqrt(ke*ke+we*we);ne(Be)&&Be>=ey||(Be=Math.sqrt(Math.max(ke*ke,Ra)+Math.max(we*we,Ra)));var Ne=R.vector={x:ke,y:we},Ie=R.vectorNorm={x:Ne.x/Be,y:Ne.y/Be},Re={x:-Ie.y,y:Ie.x};R.nodesOverlap=!ne(Be)||te.checkPoint(be[0],be[1],0,j,Q,z.x,z.y,J,q)||ee.checkPoint(oe[0],oe[1],0,V,K,G.x,G.y,ie,W),R.vectorNormInverse=Re,M={nodesOverlap:R.nodesOverlap,dirCounts:R.dirCounts,calculatedIntersection:!0,hasBezier:R.hasBezier,hasUnbundled:R.hasUnbundled,eles:R.eles,srcPos:z,srcRs:q,tgtPos:G,tgtRs:W,srcW:j,srcH:Q,tgtW:V,tgtH:K,srcIntn:he,tgtIntn:pe,srcShape:te,tgtShape:ee,posPts:{x1:Ee.x2,y1:Ee.y2,x2:Ee.x1,y2:Ee.y1},intersectionPts:{x1:ce.x2,y1:ce.y2,x2:ce.x1,y2:ce.y1},vector:{x:-Ne.x,y:-Ne.y},vectorNorm:{x:-Ie.x,y:-Ie.y},vectorNormInverse:{x:-Re.x,y:-Re.y}}}var Y=xe?M:R;ae.nodesOverlap=Y.nodesOverlap,ae.srcIntn=Y.srcIntn,ae.tgtIntn=Y.tgtIntn,ae.isRound=de.startsWith("round"),n&&(L.isParent()||L.isChild()||N.isParent()||N.isChild())&&(L.parents().anySame(N)||N.parents().anySame(L)||L.same(N)&&L.isParent())?e.findCompoundLoopPoints(Z,Y,$,Pe):L===N?e.findLoopPoints(Z,Y,$,Pe):de.endsWith("segments")?e.findSegmentsPoints(Z,Y):de.endsWith("taxi")?e.findTaxiPoints(Z,Y):de==="straight"||!Pe&&R.eles.length%2===1&&$===Math.floor(R.eles.length/2)?e.findStraightEdgePoints(Z):e.findBezierPoints(Z,Y,$,Pe,xe),e.findEndpoints(Z),e.tryToCorrectInvalidPoints(Z,Y),e.checkForInvalidEdgeWarning(Z),e.storeAllpts(Z),e.storeEdgeProjections(Z),e.calculateArrowAngles(Z),e.recalculateEdgeLabelProjections(Z),e.calculateLabelAngles(Z)}},"_loop"),E=0;E<o.length;E++)T();this.findHaystackPoints(u)}};function pf(r){var e=[];if(r!=null){for(var t=0;t<r.length;t+=2){var a=r[t],n=r[t+1];e.push({x:a,y:n})}return e}}v(pf,"getPts");pr.getSegmentPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="segments")return pf(e.segpts)};pr.getControlPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="bezier"||t==="multibezier"||t==="self"||t==="compound")return pf(e.ctrlpts)};pr.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var _a={};_a.manualEndptToPx=function(r,e){var t=this,a=r.position(),n=r.outerWidth(),i=r.outerHeight(),s=r._private.rscratch;if(e.value.length===2){var o=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(o[0]=o[0]*n),e.units[1]==="%"&&(o[1]=o[1]*i),o[0]+=a.x,o[1]+=a.y,o}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(n,i),f=[a.x+Math.cos(u)*l,a.y+Math.sin(u)*l];return t.nodeShapes[this.getNodeShape(r)].intersectLine(a.x,a.y,n,i,f[0],f[1],0,r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,s)}};_a.findEndpoints=function(r){var e,t,a,n,i=this,s,o=r.source()[0],u=r.target()[0],l=o.position(),f=u.position(),c=r.pstyle("target-arrow-shape").value,d=r.pstyle("source-arrow-shape").value,g=r.pstyle("target-distance-from-node").pfValue,h=r.pstyle("source-distance-from-node").pfValue,m=o._private.rscratch,p=u._private.rscratch,y=r.pstyle("curve-style").value,b=r._private.rscratch,w=b.edgeType,x=at(y,"taxi"),C=w==="self"||w==="compound",T=w==="bezier"||w==="multibezier"||C,E=w!=="bezier",S=w==="straight"||w==="segments",D=w==="segments",B=T||E||S,P=C||x,A=r.pstyle("source-endpoint"),R=P?"outside-to-node":A.value,M=o.pstyle("corner-radius").value==="auto"?"auto":o.pstyle("corner-radius").pfValue,I=r.pstyle("target-endpoint"),O=P?"outside-to-node":I.value,L=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;b.srcManEndpt=A,b.tgtManEndpt=I;var N,_,G,z,V=(e=(I==null||(t=I.pfValue)===null||t===void 0?void 0:t.length)===2?I.pfValue:null)!==null&&e!==void 0?e:[0,0],K=(a=(A==null||(n=A.pfValue)===null||n===void 0?void 0:n.length)===2?A.pfValue:null)!==null&&a!==void 0?a:[0,0];if(T){var j=[b.ctrlpts[0],b.ctrlpts[1]],Q=E?[b.ctrlpts[b.ctrlpts.length-2],b.ctrlpts[b.ctrlpts.length-1]]:j;N=Q,_=j}else if(S){var ee=D?b.segpts.slice(0,2):[f.x+V[0],f.y+V[1]],te=D?b.segpts.slice(b.segpts.length-2):[l.x+K[0],l.y+K[1]];N=te,_=ee}if(O==="inside-to-node")s=[f.x,f.y];else if(I.units)s=this.manualEndptToPx(u,I);else if(O==="outside-to-line")s=b.tgtIntn;else if(O==="outside-to-node"||O==="outside-to-node-or-label"?G=N:(O==="outside-to-line"||O==="outside-to-line-or-label")&&(G=[l.x,l.y]),s=i.nodeShapes[this.getNodeShape(u)].intersectLine(f.x,f.y,u.outerWidth(),u.outerHeight(),G[0],G[1],0,L,p),O==="outside-to-node-or-label"||O==="outside-to-line-or-label"){var ie=u._private.rscratch,J=ie.labelWidth,q=ie.labelHeight,W=ie.labelX,$=ie.labelY,Z=J/2,ae=q/2,de=u.pstyle("text-valign").value;de==="top"?$-=ae:de==="bottom"&&($+=ae);var Pe=u.pstyle("text-halign").value;Pe==="left"?W-=Z:Pe==="right"&&(W+=Z);var xe=ka(G[0],G[1],[W-Z,$-ae,W+Z,$-ae,W+Z,$+ae,W-Z,$+ae],f.x,f.y);if(xe.length>0){var be=l,pe=Ct(be,Ht(s)),oe=Ct(be,Ht(xe)),he=pe;if(oe<pe&&(s=xe,he=oe),xe.length>2){var ce=Ct(be,{x:xe[2],y:xe[3]});ce<he&&(s=[xe[2],xe[3]])}}}var Ee=Ya(s,N,i.arrowShapes[c].spacing(r)+g),we=Ya(s,N,i.arrowShapes[c].gap(r)+g);if(b.endX=we[0],b.endY=we[1],b.arrowEndX=Ee[0],b.arrowEndY=Ee[1],R==="inside-to-node")s=[l.x,l.y];else if(A.units)s=this.manualEndptToPx(o,A);else if(R==="outside-to-line")s=b.srcIntn;else if(R==="outside-to-node"||R==="outside-to-node-or-label"?z=_:(R==="outside-to-line"||R==="outside-to-line-or-label")&&(z=[f.x,f.y]),s=i.nodeShapes[this.getNodeShape(o)].intersectLine(l.x,l.y,o.outerWidth(),o.outerHeight(),z[0],z[1],0,M,m),R==="outside-to-node-or-label"||R==="outside-to-line-or-label"){var ke=o._private.rscratch,Be=ke.labelWidth,Ne=ke.labelHeight,Ie=ke.labelX,Re=ke.labelY,Y=Be/2,k=Ne/2,F=o.pstyle("text-valign").value;F==="top"?Re-=k:F==="bottom"&&(Re+=k);var H=o.pstyle("text-halign").value;H==="left"?Ie-=Y:H==="right"&&(Ie+=Y);var U=ka(z[0],z[1],[Ie-Y,Re-k,Ie+Y,Re-k,Ie+Y,Re+k,Ie-Y,Re+k],l.x,l.y);if(U.length>0){var X=f,ve=Ct(X,Ht(s)),re=Ct(X,Ht(U)),se=ve;if(re<ve&&(s=[U[0],U[1]],se=re),U.length>2){var ue=Ct(X,{x:U[2],y:U[3]});ue<se&&(s=[U[2],U[3]])}}}var ye=Ya(s,_,i.arrowShapes[d].spacing(r)+h),Ce=Ya(s,_,i.arrowShapes[d].gap(r)+h);b.startX=Ce[0],b.startY=Ce[1],b.arrowStartX=ye[0],b.arrowStartY=ye[1],B&&(!ne(b.startX)||!ne(b.startY)||!ne(b.endX)||!ne(b.endY)?b.badLine=!0:b.badLine=!1)};_a.getSourceEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};_a.getTargetEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var po={};function ry(r,e,t){for(var a=v(function(l,f,c,d){return ir(l,f,c,d)},"qbezierAt$1"),n=e._private,i=n.rstyle.bezierPts,s=0;s<r.bezierProjPcts.length;s++){var o=r.bezierProjPcts[s];i.push({x:a(t[0],t[2],t[4],o),y:a(t[1],t[3],t[5],o)})}}v(ry,"pushBezierPts");po.storeEdgeProjections=function(r){var e=r._private,t=e.rscratch,a=t.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<t.allpts.length;n+=4)ry(this,r,t.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<t.allpts.length;n+=2)i.push({x:t.allpts[n],y:t.allpts[n+1]});else if(a==="haystack"){var s=t.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth};po.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var Hr={};Hr.recalculateNodeLabelProjection=function(r){var e=r.pstyle("label").strValue;if(!ut(e)){var t,a,n=r._private,i=r.width(),s=r.height(),o=r.padding(),u=r.position(),l=r.pstyle("text-halign").strValue,f=r.pstyle("text-valign").strValue,c=n.rscratch,d=n.rstyle;switch(l){case"left":t=u.x-i/2-o;break;case"right":t=u.x+i/2+o;break;default:t=u.x}switch(f){case"top":a=u.y-s/2-o;break;case"bottom":a=u.y+s/2+o;break;default:a=u.y}c.labelX=t,c.labelY=a,d.labelX=t,d.labelY=a,this.calculateLabelAngles(r),this.applyLabelDimensions(r)}};var yf=v(function(e,t){var a=Math.atan(t/e);return e===0&&a<0&&(a=a*-1),a},"lineAngleFromDelta"),mf=v(function(e,t){var a=t.x-e.x,n=t.y-e.y;return yf(a,n)},"lineAngle"),ty=v(function(e,t,a,n){var i=Sa(0,n-.001,1),s=Sa(0,n+.001,1),o=Ut(e,t,a,i),u=Ut(e,t,a,s);return mf(o,u)},"bezierAngle");Hr.recalculateEdgeLabelProjections=function(r){var e,t=r._private,a=t.rscratch,n=this,i={mid:r.pstyle("label").strValue,source:r.pstyle("source-label").strValue,target:r.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var s=v(function(c,d,g){Kr(t.rscratch,c,d,g),Kr(t.rstyle,c,d,g)},"setRs");s("labelX",null,e.x),s("labelY",null,e.y);var o=yf(a.midDispX,a.midDispY);s("labelAutoAngle",null,o);var u=v(function(){if(u.cache)return u.cache;for(var c=[],d=0;d+5<a.allpts.length;d+=4){var g={x:a.allpts[d],y:a.allpts[d+1]},h={x:a.allpts[d+2],y:a.allpts[d+3]},m={x:a.allpts[d+4],y:a.allpts[d+5]};c.push({p0:g,p1:h,p2:m,startDist:0,length:0,segments:[]})}var p=t.rstyle.bezierPts,y=n.bezierProjPcts.length;function b(E,S,D,B,P){var A=Pt(S,D),R=E.segments[E.segments.length-1],M={p0:S,p1:D,t0:B,t1:P,startDist:R?R.startDist+R.length:0,length:A};E.segments.push(M),E.length+=A}v(b,"addSegment");for(var w=0;w<c.length;w++){var x=c[w],C=c[w-1];C&&(x.startDist=C.startDist+C.length),b(x,x.p0,p[w*y],0,n.bezierProjPcts[0]);for(var T=0;T<y-1;T++)b(x,p[w*y+T],p[w*y+T+1],n.bezierProjPcts[T],n.bezierProjPcts[T+1]);b(x,p[w*y+y-1],x.p2,n.bezierProjPcts[y-1],1)}return u.cache=c},"createControlPointInfo"),l=v(function(c){var d,g=c==="source";if(i[c]){var h=r.pstyle(c+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var m=u(),p,y=0,b=0,w=0;w<m.length;w++){for(var x=m[g?w:m.length-1-w],C=0;C<x.segments.length;C++){var T=x.segments[g?C:x.segments.length-1-C],E=w===m.length-1&&C===x.segments.length-1;if(y=b,b+=T.length,b>=h||E){p={cp:x,segment:T};break}}if(p)break}var S=p.cp,D=p.segment,B=(h-y)/D.length,P=D.t1-D.t0,A=g?D.t0+P*B:D.t1-P*B;A=Sa(0,A,1),e=Ut(S.p0,S.p1,S.p2,A),d=ty(S.p0,S.p1,S.p2,A);break}case"straight":case"segments":case"haystack":{for(var R=0,M,I,O,L,N=a.allpts.length,_=0;_+3<N&&(g?(O={x:a.allpts[_],y:a.allpts[_+1]},L={x:a.allpts[_+2],y:a.allpts[_+3]}):(O={x:a.allpts[N-2-_],y:a.allpts[N-1-_]},L={x:a.allpts[N-4-_],y:a.allpts[N-3-_]}),M=Pt(O,L),I=R,R+=M,!(R>=h));_+=2);var G=h-I,z=G/M;z=Sa(0,z,1),e=Td(O,L,z),d=mf(O,L);break}}s("labelX",c,e.x),s("labelY",c,e.y),s("labelAutoAngle",c,d)}},"calculateEndProjection");l("source"),l("target"),this.applyLabelDimensions(r)}};Hr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};Hr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=Bt(a,r._private.labelDimsKey);if(Er(t.rscratch,"prefixedLabelDimsKey",e)!==n){Kr(t.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(r,a),s=r.pstyle("line-height").pfValue,o=r.pstyle("text-wrap").strValue,u=Er(t.rscratch,"labelWrapCachedLines",e)||[],l=o!=="wrap"?1:Math.max(u.length,1),f=i.height/l,c=f*s,d=i.width,g=i.height+(l-1)*(s-1)*f;Kr(t.rstyle,"labelWidth",e,d),Kr(t.rscratch,"labelWidth",e,d),Kr(t.rstyle,"labelHeight",e,g),Kr(t.rscratch,"labelHeight",e,g),Kr(t.rscratch,"labelLineHeight",e,c)}};Hr.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,s=v(function(K,j){return j?(Kr(t.rscratch,K,e,j),j):Er(t.rscratch,K,e)},"rscratch");if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=r.pstyle("text-wrap").value;if(o==="wrap"){var u=s("labelKey");if(u!=null&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var l="\u200B",f=n.split(`
`),c=r.pstyle("text-max-width").pfValue,d=r.pstyle("text-overflow-wrap").value,g=d==="anywhere",h=[],m=/[\s\u200b]+|$/g,p=0;p<f.length;p++){var y=f[p],b=this.calculateLabelDimensions(r,y),w=b.width;if(g){var x=y.split("").join(l);y=x}if(w>c){var C=y.matchAll(m),T="",E=0,S=Tr(C),D;try{for(S.s();!(D=S.n()).done;){var B=D.value,P=B[0],A=y.substring(E,B.index);E=B.index+P.length;var R=T.length===0?A:T+A+P,M=this.calculateLabelDimensions(r,R),I=M.width;I<=c?T+=A+P:(T&&h.push(T),T=A+P)}}catch(V){S.e(V)}finally{S.f()}T.match(/^[\s\u200b]+$/)||h.push(T)}else h.push(y)}s("labelWrapCachedLines",h),n=s("labelWrapCachedText",h.join(`
`)),s("labelWrapKey",u)}else if(o==="ellipsis"){var O=r.pstyle("text-max-width").pfValue,L="",N="\u2026",_=!1;if(this.calculateLabelDimensions(r,n).width<O)return n;for(var G=0;G<n.length;G++){var z=this.calculateLabelDimensions(r,L+n[G]+N).width;if(z>O)break;L+=n[G],G===n.length-1&&(_=!0)}return _||(L+=N),L}return n};Hr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Hr.calculateLabelDimensions=function(r,e){var t=this,a=t.cy.window(),n=a.document,i=0,s=r.pstyle("font-style").strValue,o=r.pstyle("font-size").pfValue,u=r.pstyle("font-family").strValue,l=r.pstyle("font-weight").strValue,f=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!f){f=this.labelCalcCanvas=n.createElement("canvas"),c=this.labelCalcCanvasContext=f.getContext("2d");var d=f.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}c.font="".concat(s," ").concat(l," ").concat(o,"px ").concat(u);for(var g=0,h=0,m=e.split(`
`),p=0;p<m.length;p++){var y=m[p],b=c.measureText(y),w=Math.ceil(b.width),x=o;g=Math.max(w,g),h+=x}return g+=i,h+=i,{width:g,height:h}};Hr.calculateLabelAngle=function(r,e){var t=r._private,a=t.rscratch,n=r.isEdge(),i=e?e+"-":"",s=r.pstyle(i+"text-rotation"),o=s.strValue;return o==="none"?0:n&&o==="autorotate"?a.labelAutoAngle:o==="autorotate"?0:s.pfValue};Hr.calculateLabelAngles=function(r){var e=this,t=r.isEdge(),a=r._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(r),t&&(n.sourceLabelAngle=e.calculateLabelAngle(r,"source"),n.targetLabelAngle=e.calculateLabelAngle(r,"target"))};var bf={},Ml=28,Ll=!1;bf.getNodeShape=function(r){var e=this,t=r.pstyle("shape").value;if(t==="cutrectangle"&&(r.width()<Ml||r.height()<Ml))return Ll||(Fe("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Ll=!0),"rectangle";if(r.isParent())return t==="rectangle"||t==="roundrectangle"||t==="round-rectangle"||t==="cutrectangle"||t==="cut-rectangle"||t==="barrel"?t:"rectangle";if(t==="polygon"){var a=r.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return t};var Kn={};Kn.registerCalculationListeners=function(){var r=this.cy,e=r.collection(),t=this,a=v(function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var u=0;u<s.length;u++){var l=s[u],f=l._private,c=f.rstyle;c.clean=!1,c.cleanConnected=!1}},"enqueue");t.binder(r).on("bounds.* dirty.*",v(function(s){var o=s.target;a(o)},"onDirtyBounds")).on("style.* background.*",v(function(s){var o=s.target;a(o,!1)},"onDirtyStyle"));var n=v(function(s){if(s){var o=t.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],f=l._private.rstyle;l.isNode()&&!f.cleanConnected&&(a(l.connectedEdges()),f.cleanConnected=!0)}if(o)for(var c=0;c<o.length;c++){var d=o[c];d(s,e)}t.recalculateRenderedStyle(e),e=r.collection()}},"updateEleCalcs");t.flushRenderedStyleQueue=function(){n(!0)},t.beforeRender(n,t.beforeRenderPriorities.eleCalcs)};Kn.onUpdateEleCalcs=function(r){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(r)};Kn.recalculateRenderedStyle=function(r,e){var t=v(function(x){return x._private.rstyle.cleanConnected},"isCleanConnected");if(r.length!==0){var a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<r.length;i++){var s=r[i],o=s._private,u=o.rstyle;s.isEdge()&&(!t(s.source())||!t(s.target()))&&(u.clean=!1),s.isEdge()&&s.isBundledBezier()&&s.parallelEdges().some(function(w){return!w._private.rstyle.clean&&w.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?n.push(s):a.push(s),u.clean=!0)}for(var l=0;l<n.length;l++){var f=n[l],c=f._private,d=c.rstyle,g=f.position();this.recalculateNodeLabelProjection(f),d.nodeX=g.x,d.nodeY=g.y,d.nodeW=f.pstyle("width").pfValue,d.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var h=0;h<a.length;h++){var m=a[h],p=m._private,y=p.rstyle,b=p.rscratch;y.srcX=b.arrowStartX,y.srcY=b.arrowStartY,y.tgtX=b.arrowEndX,y.tgtY=b.arrowEndY,y.midX=b.midX,y.midY=b.midY,y.labelAngle=b.labelAngle,y.sourceLabelAngle=b.sourceLabelAngle,y.targetLabelAngle=b.targetLabelAngle}}}};var Xn={};Xn.updateCachedGrabbedEles=function(){var r=this.cachedZSortedEles;if(r){r.drag=[],r.nondrag=[];for(var e=[],t=0;t<r.length;t++){var a=r[t],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?r.drag.push(a):r.nondrag.push(a)}for(var t=0;t<e.length;t++){var a=e[t];r.drag.push(a)}}};Xn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Xn.getCachedZSortedEles=function(r){if(r||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(jv),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var wf={};[Lt,Dn,pr,_a,po,Hr,bf,Kn,Xn].forEach(function(r){me(wf,r)});var xf={};xf.getCachedImage=function(r,e,t){var a=this,n=a.imageCache=a.imageCache||{},i=n[r];if(i)return i.image.complete||i.image.addEventListener("load",t),i.image;i=n[r]=n[r]||{};var s=i.image=new Image;s.addEventListener("load",t),s.addEventListener("error",function(){s.error=!0});var o="data:",u=r.substring(0,o.length).toLowerCase()===o;return u||(e=e==="null"?null:e,s.crossOrigin=e),s.src=r,s};var Ef=v(function(e,t){var a=e[0];!a||a._private.grabbed===t||(a._private.grabbed=t,e.updateStyle(!1))},"setGrabState"),ay=v(function(e){Ef(e,!0)},"setGrabbed"),ny=v(function(e){Ef(e,!1)},"setFreed"),na={};na.registerBinding=function(r,e,t,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(r)){for(var i=[],s=0;s<r.length;s++){var o=r[s];if(o!==void 0){var u=this.binder(o);i.push(u.on.apply(u,n))}}return i}var u=this.binder(r);return u.on.apply(u,n)};na.binder=function(r){var e=this,t=e.cy.window(),a=r===t||r===t.document||r===t.document.body||hc(r);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:v(function(){return n=!0,!0},"get")});t.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var s=v(function(u,l,f){var c=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(c[2]={capture:f??!1,passive:!1,once:!1}),e.bindings.push({target:r,args:c}),(r.addEventListener||r.on).apply(r,c),this},"on");return{on:s,addEventListener:s,addListener:s,bind:s}};na.nodeIsDraggable=function(r){return r&&r.isNode()&&!r.locked()&&r.grabbable()};na.nodeIsGrabbable=function(r){return this.nodeIsDraggable(r)&&r.interactive()};na.load=function(){var r=this,e=r.cy.window(),t=v(function(k){return k.selected()},"isSelected"),a=v(function(k){var F=k.getRootNode();if(F&&F.nodeType===11&&F.host!==void 0)return F},"getShadowRoot"),n=v(function(k,F,H,U){k==null&&(k=r.cy);for(var X=0;X<F.length;X++){var ve=F[X];k.emit({originalEvent:H,type:ve,position:U})}},"triggerEvents"),i=v(function(k){return k.shiftKey||k.metaKey||k.ctrlKey},"isMultSelKeyDown"),s=v(function(k,F){var H=!0;if(r.cy.hasCompoundNodes()&&k&&k.pannable())for(var U=0;F&&U<F.length;U++){var k=F[U];if(k.isNode()&&k.isParent()&&!k.pannable()){H=!1;break}}else H=!0;return H},"allowPanningPassthrough"),o=v(function(k){k[0]._private.rscratch.inDragLayer=!0},"setInDragLayer"),u=v(function(k){k[0]._private.rscratch.inDragLayer=!1},"setOutDragLayer"),l=v(function(k){k[0]._private.rscratch.isGrabTarget=!0},"setGrabTarget"),f=v(function(k){k[0]._private.rscratch.isGrabTarget=!1},"removeGrabTarget"),c=v(function(k,F){var H=F.addToList,U=H.has(k);!U&&k.grabbable()&&!k.locked()&&(H.merge(k),ay(k))},"addToDragList"),d=v(function(k,F){if(k.cy().hasCompoundNodes()&&!(F.inDragLayer==null&&F.addToList==null)){var H=k.descendants();F.inDragLayer&&(H.forEach(o),H.connectedEdges().forEach(o)),F.addToList&&c(H,F)}},"addDescendantsToDrag"),g=v(function(k,F){F=F||{};var H=k.cy().hasCompoundNodes();F.inDragLayer&&(k.forEach(o),k.neighborhood().stdFilter(function(U){return!H||U.isEdge()}).forEach(o)),F.addToList&&k.forEach(function(U){c(U,F)}),d(k,F),p(k,{inDragLayer:F.inDragLayer}),r.updateCachedGrabbedEles()},"addNodesToDrag"),h=g,m=v(function(k){k&&(r.getCachedZSortedEles().forEach(function(F){ny(F),u(F),f(F)}),r.updateCachedGrabbedEles())},"freeDraggedElements"),p=v(function(k,F){if(!(F.inDragLayer==null&&F.addToList==null)&&k.cy().hasCompoundNodes()){var H=k.ancestors().orphans();if(!H.same(k)){var U=H.descendants().spawnSelf().merge(H).unmerge(k).unmerge(k.descendants()),X=U.connectedEdges();F.inDragLayer&&(X.forEach(o),U.forEach(o)),F.addToList&&U.forEach(function(ve){c(ve,F)})}}},"updateAncestorsInDragLayer"),y=v(function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},"blurActiveDomElement"),b=typeof MutationObserver<"u",w=typeof ResizeObserver<"u";b?(r.removeObserver=new MutationObserver(function(Y){for(var k=0;k<Y.length;k++){var F=Y[k],H=F.removedNodes;if(H)for(var U=0;U<H.length;U++){var X=H[U];if(X===r.container){r.destroy();break}}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(Y){r.destroy()});var x=za(function(){r.cy.resize()},100);b&&(r.styleObserver=new MutationObserver(x),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",x),w&&(r.resizeObserver=new ResizeObserver(x),r.resizeObserver.observe(r.container));var C=v(function(k,F){for(;k!=null;)F(k),k=k.parentNode},"forEachUp"),T=v(function(){r.invalidateContainerClientCoordsCache()},"invalidateCoords");C(r.container,function(Y){r.registerBinding(Y,"transitionend",T),r.registerBinding(Y,"animationend",T),r.registerBinding(Y,"scroll",T)}),r.registerBinding(r.container,"contextmenu",function(Y){Y.preventDefault()});var E=v(function(){return r.selection[4]!==0},"inBoxSelection"),S=v(function(k){for(var F=r.findContainerClientCoords(),H=F[0],U=F[1],X=F[2],ve=F[3],re=k.touches?k.touches:[k],se=!1,ue=0;ue<re.length;ue++){var ye=re[ue];if(H<=ye.clientX&&ye.clientX<=H+X&&U<=ye.clientY&&ye.clientY<=U+ve){se=!0;break}}if(!se)return!1;for(var Ce=r.container,Te=k.target,fe=Te.parentNode,De=!1;fe;){if(fe===Ce){De=!0;break}fe=fe.parentNode}return!!De},"eventInContainer");r.registerBinding(r.container,"mousedown",v(function(k){if(S(k)&&!(r.hoverData.which===1&&k.which!==1)){k.preventDefault(),y(),r.hoverData.capture=!0,r.hoverData.which=k.which;var F=r.cy,H=[k.clientX,k.clientY],U=r.projectIntoViewport(H[0],H[1]),X=r.selection,ve=r.findNearestElements(U[0],U[1],!0,!1),re=ve[0],se=r.dragData.possibleDragElements;r.hoverData.mdownPos=U,r.hoverData.mdownGPos=H;var ue=v(function(Ae){return{originalEvent:k,type:Ae,position:{x:U[0],y:U[1]}}},"makeEvent"),ye=v(function(){r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var Ae=r.hoverData.down;Ae?Ae.emit(ue("taphold")):F.emit(ue("taphold"))}},r.tapholdDuration)},"checkForTaphold");if(k.which==3){r.hoverData.cxtStarted=!0;var Ce={originalEvent:k,type:"cxttapstart",position:{x:U[0],y:U[1]}};re?(re.activate(),re.emit(Ce),r.hoverData.down=re):F.emit(Ce),r.hoverData.downTime=new Date().getTime(),r.hoverData.cxtDragged=!1}else if(k.which==1){re&&re.activate();{if(re!=null&&r.nodeIsGrabbable(re)){var Te=v(function(Ae){Ae.emit(ue("grab"))},"triggerGrab");if(l(re),!re.selected())se=r.dragData.possibleDragElements=F.collection(),h(re,{addToList:se}),re.emit(ue("grabon")).emit(ue("grab"));else{se=r.dragData.possibleDragElements=F.collection();var fe=F.$(function(De){return De.isNode()&&De.selected()&&r.nodeIsGrabbable(De)});g(fe,{addToList:se}),re.emit(ue("grabon")),fe.forEach(Te)}r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=re,r.hoverData.downs=ve,r.hoverData.downTime=new Date().getTime()}n(re,["mousedown","tapstart","vmousedown"],k,{x:U[0],y:U[1]}),re==null?(X[4]=1,r.data.bgActivePosistion={x:U[0],y:U[1]},r.redrawHint("select",!0),r.redraw()):re.pannable()&&(X[4]=1),ye()}X[0]=X[2]=U[0],X[1]=X[3]=U[1]}},"mousedownHandler"),!1);var D=a(r.container);r.registerBinding([e,D],"mousemove",v(function(k){var F=r.hoverData.capture;if(!(!F&&!S(k))){var H=!1,U=r.cy,X=U.zoom(),ve=[k.clientX,k.clientY],re=r.projectIntoViewport(ve[0],ve[1]),se=r.hoverData.mdownPos,ue=r.hoverData.mdownGPos,ye=r.selection,Ce=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(Ce=r.findNearestElement(re[0],re[1],!0,!1));var Te=r.hoverData.last,fe=r.hoverData.down,De=[re[0]-ye[2],re[1]-ye[3]],Ae=r.dragData.possibleDragElements,nr;if(ue){var Ke=ve[0]-ue[0],Ar=Ke*Ke,Xe=ve[1]-ue[1],Ze=Xe*Xe,je=Ar+Ze;r.hoverData.isOverThresholdDrag=nr=je>=r.desktopTapThreshold2}var ur=i(k);nr&&(r.hoverData.tapholdCancelled=!0);var zr=v(function(){var kr=r.hoverData.dragDelta=r.hoverData.dragDelta||[];kr.length===0?(kr.push(De[0]),kr.push(De[1])):(kr[0]+=De[0],kr[1]+=De[1])},"updateDragDelta");H=!0,n(Ce,["mousemove","vmousemove","tapdrag"],k,{x:re[0],y:re[1]});var $e=v(function(kr){return{originalEvent:k,type:kr,position:{x:re[0],y:re[1]}}},"makeEvent"),$r=v(function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||U.emit($e("boxstart")),ye[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()},"goIntoBoxMode");if(r.hoverData.which===3){if(nr){var Rr=$e("cxtdrag");fe?fe.emit(Rr):U.emit(Rr),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||Ce!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit($e("cxtdragout")),r.hoverData.cxtOver=Ce,Ce&&Ce.emit($e("cxtdragover")))}}else if(r.hoverData.dragging){if(H=!0,U.panningEnabled()&&U.userPanningEnabled()){var jr;if(r.hoverData.justStartedPan){var Wa=r.hoverData.mdownPos;jr={x:(re[0]-Wa[0])*X,y:(re[1]-Wa[1])*X},r.hoverData.justStartedPan=!1}else jr={x:De[0]*X,y:De[1]*X};U.panBy(jr),U.emit($e("dragpan")),r.hoverData.dragged=!0}re=r.projectIntoViewport(k.clientX,k.clientY)}else if(ye[4]==1&&(fe==null||fe.pannable())){if(nr){if(!r.hoverData.dragging&&U.boxSelectionEnabled()&&(ur||!U.panningEnabled()||!U.userPanningEnabled()))$r();else if(!r.hoverData.selecting&&U.panningEnabled()&&U.userPanningEnabled()){var bt=s(fe,r.hoverData.downs);bt&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,ye[4]=0,r.data.bgActivePosistion=Ht(se),r.redrawHint("select",!0),r.redraw())}fe&&fe.pannable()&&fe.active()&&fe.unactivate()}}else{if(fe&&fe.pannable()&&fe.active()&&fe.unactivate(),(!fe||!fe.grabbed())&&Ce!=Te&&(Te&&n(Te,["mouseout","tapdragout"],k,{x:re[0],y:re[1]}),Ce&&n(Ce,["mouseover","tapdragover"],k,{x:re[0],y:re[1]}),r.hoverData.last=Ce),fe)if(nr){if(U.boxSelectionEnabled()&&ur)fe&&fe.grabbed()&&(m(Ae),fe.emit($e("freeon")),Ae.emit($e("free")),r.dragData.didDrag&&(fe.emit($e("dragfreeon")),Ae.emit($e("dragfree")))),$r();else if(fe&&fe.grabbed()&&r.nodeIsDraggable(fe)){var wr=!r.dragData.didDrag;wr&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||g(Ae,{inDragLayer:!0});var dr={x:0,y:0};if(ne(De[0])&&ne(De[1])&&(dr.x+=De[0],dr.y+=De[1],wr)){var xr=r.hoverData.dragDelta;xr&&ne(xr[0])&&ne(xr[1])&&(dr.x+=xr[0],dr.y+=xr[1])}r.hoverData.draggingEles=!0,Ae.silentShift(dr).emit($e("position")).emit($e("drag")),r.redrawHint("drag",!0),r.redraw()}}else zr();H=!0}if(ye[2]=re[0],ye[3]=re[1],H)return k.stopPropagation&&k.stopPropagation(),k.preventDefault&&k.preventDefault(),!1}},"mousemoveHandler"),!1);var B,P,A;r.registerBinding(e,"mouseup",v(function(k){if(!(r.hoverData.which===1&&k.which!==1&&r.hoverData.capture)){var F=r.hoverData.capture;if(F){r.hoverData.capture=!1;var H=r.cy,U=r.projectIntoViewport(k.clientX,k.clientY),X=r.selection,ve=r.findNearestElement(U[0],U[1],!0,!1),re=r.dragData.possibleDragElements,se=r.hoverData.down,ue=i(k);r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,se&&se.unactivate();var ye=v(function(Ke){return{originalEvent:k,type:Ke,position:{x:U[0],y:U[1]}}},"makeEvent");if(r.hoverData.which===3){var Ce=ye("cxttapend");if(se?se.emit(Ce):H.emit(Ce),!r.hoverData.cxtDragged){var Te=ye("cxttap");se?se.emit(Te):H.emit(Te)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(n(ve,["mouseup","tapend","vmouseup"],k,{x:U[0],y:U[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(n(se,["click","tap","vclick"],k,{x:U[0],y:U[1]}),P=!1,k.timeStamp-A<=H.multiClickDebounceTime()?(B&&clearTimeout(B),P=!0,A=null,n(se,["dblclick","dbltap","vdblclick"],k,{x:U[0],y:U[1]})):(B=setTimeout(function(){P||n(se,["oneclick","onetap","voneclick"],k,{x:U[0],y:U[1]})},H.multiClickDebounceTime()),A=k.timeStamp)),se==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(k)&&(H.$(t).unselect(["tapunselect"]),re.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=re=H.collection()),ve==se&&!r.dragData.didDrag&&!r.hoverData.selecting&&ve!=null&&ve._private.selectable&&(r.hoverData.dragging||(H.selectionType()==="additive"||ue?ve.selected()?ve.unselect(["tapunselect"]):ve.select(["tapselect"]):ue||(H.$(t).unmerge(ve).unselect(["tapunselect"]),ve.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var fe=H.collection(r.getAllInBox(X[0],X[1],X[2],X[3]));r.redrawHint("select",!0),fe.length>0&&r.redrawHint("eles",!0),H.emit(ye("boxend"));var De=v(function(Ke){return Ke.selectable()&&!Ke.selected()},"eleWouldBeSelected");H.selectionType()==="additive"||ue||H.$(t).unmerge(fe).unselect(),fe.emit(ye("box")).stdFilter(De).select().emit(ye("boxselect")),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!X[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var Ae=se&&se.grabbed();m(re),Ae&&(se.emit(ye("freeon")),re.emit(ye("free")),r.dragData.didDrag&&(se.emit(ye("dragfreeon")),re.emit(ye("dragfree"))))}}X[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}}},"mouseupHandler"),!1);var R=[],M=4,I,O=1e5,L=v(function(k,F){for(var H=0;H<k.length;H++)if(k[H]%F!==0)return!1;return!0},"allAreDivisibleBy"),N=v(function(k){for(var F=Math.abs(k[0]),H=1;H<k.length;H++)if(Math.abs(k[H])!==F)return!1;return!0},"allAreSameMagnitude"),_=v(function(k){var F=!1,H=k.deltaY;if(H==null&&(k.wheelDeltaY!=null?H=k.wheelDeltaY/4:k.wheelDelta!=null&&(H=k.wheelDelta/4)),H!==0){if(I==null)if(R.length>=M){var U=R;if(I=L(U,5),!I){var X=Math.abs(U[0]);I=N(U)&&X>5}if(I)for(var ve=0;ve<U.length;ve++)O=Math.min(Math.abs(U[ve]),O)}else R.push(H),F=!0;else I&&(O=Math.min(Math.abs(H),O));if(!r.scrollingPage){var re=r.cy,se=re.zoom(),ue=re.pan(),ye=r.projectIntoViewport(k.clientX,k.clientY),Ce=[ye[0]*se+ue.x,ye[1]*se+ue.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||E()){k.preventDefault();return}if(re.panningEnabled()&&re.userPanningEnabled()&&re.zoomingEnabled()&&re.userZoomingEnabled()){k.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150);var Te;F&&Math.abs(H)>5&&(H=ro(H)*5),Te=H/-250,I&&(Te/=O,Te*=3),Te=Te*r.wheelSensitivity;var fe=k.deltaMode===1;fe&&(Te*=33);var De=re.zoom()*Math.pow(10,Te);k.type==="gesturechange"&&(De=r.gestureStartZoom*k.scale),re.zoom({level:De,renderedPosition:{x:Ce[0],y:Ce[1]}}),re.emit({type:k.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:k,position:{x:ye[0],y:ye[1]}})}}}},"wheelHandler");r.registerBinding(r.container,"wheel",_,!0),r.registerBinding(e,"scroll",v(function(k){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},"scrollHandler"),!0),r.registerBinding(r.container,"gesturestart",v(function(k){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||k.preventDefault()},"gestureStartHandler"),!0),r.registerBinding(r.container,"gesturechange",function(Y){r.hasTouchStarted||_(Y)},!0),r.registerBinding(r.container,"mouseout",v(function(k){var F=r.projectIntoViewport(k.clientX,k.clientY);r.cy.emit({originalEvent:k,type:"mouseout",position:{x:F[0],y:F[1]}})},"mouseOutHandler"),!1),r.registerBinding(r.container,"mouseover",v(function(k){var F=r.projectIntoViewport(k.clientX,k.clientY);r.cy.emit({originalEvent:k,type:"mouseover",position:{x:F[0],y:F[1]}})},"mouseOverHandler"),!1);var G,z,V,K,j,Q,ee,te,ie,J,q,W,$,Z=v(function(k,F,H,U){return Math.sqrt((H-k)*(H-k)+(U-F)*(U-F))},"distance"),ae=v(function(k,F,H,U){return(H-k)*(H-k)+(U-F)*(U-F)},"distanceSq"),de;r.registerBinding(r.container,"touchstart",de=v(function(k){if(r.hasTouchStarted=!0,!!S(k)){y(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var F=r.cy,H=r.touchData.now,U=r.touchData.earlier;if(k.touches[0]){var X=r.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);H[0]=X[0],H[1]=X[1]}if(k.touches[1]){var X=r.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);H[2]=X[0],H[3]=X[1]}if(k.touches[2]){var X=r.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);H[4]=X[0],H[5]=X[1]}var ve=v(function(ur){return{originalEvent:k,type:ur,position:{x:H[0],y:H[1]}}},"makeEvent");if(k.touches[1]){r.touchData.singleTouchMoved=!0,m(r.dragData.touchDragEles);var re=r.findContainerClientCoords();ie=re[0],J=re[1],q=re[2],W=re[3],G=k.touches[0].clientX-ie,z=k.touches[0].clientY-J,V=k.touches[1].clientX-ie,K=k.touches[1].clientY-J,$=0<=G&&G<=q&&0<=V&&V<=q&&0<=z&&z<=W&&0<=K&&K<=W;var se=F.pan(),ue=F.zoom();j=Z(G,z,V,K),Q=ae(G,z,V,K),ee=[(G+V)/2,(z+K)/2],te=[(ee[0]-se.x)/ue,(ee[1]-se.y)/ue];var ye=200,Ce=ye*ye;if(Q<Ce&&!k.touches[2]){var Te=r.findNearestElement(H[0],H[1],!0,!0),fe=r.findNearestElement(H[2],H[3],!0,!0);Te&&Te.isNode()?(Te.activate().emit(ve("cxttapstart")),r.touchData.start=Te):fe&&fe.isNode()?(fe.activate().emit(ve("cxttapstart")),r.touchData.start=fe):F.emit(ve("cxttapstart")),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!0,r.touchData.cxtDragged=!1,r.data.bgActivePosistion=void 0,r.redraw();return}}if(k.touches[2])F.boxSelectionEnabled()&&k.preventDefault();else if(!k.touches[1]){if(k.touches[0]){var De=r.findNearestElements(H[0],H[1],!0,!0),Ae=De[0];if(Ae!=null&&(Ae.activate(),r.touchData.start=Ae,r.touchData.starts=De,r.nodeIsGrabbable(Ae))){var nr=r.dragData.touchDragEles=F.collection(),Ke=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),Ae.selected()?(Ke=F.$(function(je){return je.selected()&&r.nodeIsGrabbable(je)}),g(Ke,{addToList:nr})):h(Ae,{addToList:nr}),l(Ae),Ae.emit(ve("grabon")),Ke?Ke.forEach(function(je){je.emit(ve("grab"))}):Ae.emit(ve("grab"))}n(Ae,["touchstart","tapstart","vmousedown"],k,{x:H[0],y:H[1]}),Ae==null&&(r.data.bgActivePosistion={x:X[0],y:X[1]},r.redrawHint("select",!0),r.redraw()),r.touchData.singleTouchMoved=!1,r.touchData.singleTouchStartTime=+new Date,clearTimeout(r.touchData.tapholdTimeout),r.touchData.tapholdTimeout=setTimeout(function(){r.touchData.singleTouchMoved===!1&&!r.pinching&&!r.touchData.selecting&&n(r.touchData.start,["taphold"],k,{x:H[0],y:H[1]})},r.tapholdDuration)}}if(k.touches.length>=1){for(var Ar=r.touchData.startPosition=[null,null,null,null,null,null],Xe=0;Xe<H.length;Xe++)Ar[Xe]=U[Xe]=H[Xe];var Ze=k.touches[0];r.touchData.startGPosition=[Ze.clientX,Ze.clientY]}}},"touchstartHandler"),!1);var Pe;r.registerBinding(e,"touchmove",Pe=v(function(k){var F=r.touchData.capture;if(!(!F&&!S(k))){var H=r.selection,U=r.cy,X=r.touchData.now,ve=r.touchData.earlier,re=U.zoom();if(k.touches[0]){var se=r.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);X[0]=se[0],X[1]=se[1]}if(k.touches[1]){var se=r.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);X[2]=se[0],X[3]=se[1]}if(k.touches[2]){var se=r.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);X[4]=se[0],X[5]=se[1]}var ue=v(function(jf){return{originalEvent:k,type:jf,position:{x:X[0],y:X[1]}}},"makeEvent"),ye=r.touchData.startGPosition,Ce;if(F&&k.touches[0]&&ye){for(var Te=[],fe=0;fe<X.length;fe++)Te[fe]=X[fe]-ve[fe];var De=k.touches[0].clientX-ye[0],Ae=De*De,nr=k.touches[0].clientY-ye[1],Ke=nr*nr,Ar=Ae+Ke;Ce=Ar>=r.touchTapThreshold2}if(F&&r.touchData.cxt){k.preventDefault();var Xe=k.touches[0].clientX-ie,Ze=k.touches[0].clientY-J,je=k.touches[1].clientX-ie,ur=k.touches[1].clientY-J,zr=ae(Xe,Ze,je,ur),$e=zr/Q,$r=150,Rr=$r*$r,jr=1.5,Wa=jr*jr;if($e>=Wa||zr>=Rr){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var bt=ue("cxttapend");r.touchData.start?(r.touchData.start.unactivate().emit(bt),r.touchData.start=null):U.emit(bt)}}if(F&&r.touchData.cxt){var bt=ue("cxtdrag");r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(bt):U.emit(bt),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var wr=r.findNearestElement(X[0],X[1],!0,!0);(!r.touchData.cxtOver||wr!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit(ue("cxtdragout")),r.touchData.cxtOver=wr,wr&&wr.emit(ue("cxtdragover")))}else if(F&&k.touches[2]&&U.boxSelectionEnabled())k.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||U.emit(ue("boxstart")),r.touchData.selecting=!0,r.touchData.didSelect=!0,H[4]=1,!H||H.length===0||H[0]===void 0?(H[0]=(X[0]+X[2]+X[4])/3,H[1]=(X[1]+X[3]+X[5])/3,H[2]=(X[0]+X[2]+X[4])/3+1,H[3]=(X[1]+X[3]+X[5])/3+1):(H[2]=(X[0]+X[2]+X[4])/3,H[3]=(X[1]+X[3]+X[5])/3),r.redrawHint("select",!0),r.redraw();else if(F&&k.touches[1]&&!r.touchData.didSelect&&U.zoomingEnabled()&&U.panningEnabled()&&U.userZoomingEnabled()&&U.userPanningEnabled()){k.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var dr=r.dragData.touchDragEles;if(dr){r.redrawHint("drag",!0);for(var xr=0;xr<dr.length;xr++){var sa=dr[xr]._private;sa.grabbed=!1,sa.rscratch.inDragLayer=!1}}var kr=r.touchData.start,Xe=k.touches[0].clientX-ie,Ze=k.touches[0].clientY-J,je=k.touches[1].clientX-ie,ur=k.touches[1].clientY-J,bo=Z(Xe,Ze,je,ur),Wf=bo/j;if($){var $f=Xe-G,Uf=Ze-z,Kf=je-V,Xf=ur-K,Yf=($f+Kf)/2,Zf=(Uf+Xf)/2,oa=U.zoom(),Yn=oa*Wf,$a=U.pan(),wo=te[0]*oa+$a.x,xo=te[1]*oa+$a.y,Qf={x:-Yn/oa*(wo-$a.x-Yf)+wo,y:-Yn/oa*(xo-$a.y-Zf)+xo};if(kr&&kr.active()){var dr=r.dragData.touchDragEles;m(dr),r.redrawHint("drag",!0),r.redrawHint("eles",!0),kr.unactivate().emit(ue("freeon")),dr.emit(ue("free")),r.dragData.didDrag&&(kr.emit(ue("dragfreeon")),dr.emit(ue("dragfree")))}U.viewport({zoom:Yn,pan:Qf,cancelOnFailedZoom:!0}),U.emit(ue("pinchzoom")),j=bo,G=Xe,z=Ze,V=je,K=ur,r.pinching=!0}if(k.touches[0]){var se=r.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);X[0]=se[0],X[1]=se[1]}if(k.touches[1]){var se=r.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);X[2]=se[0],X[3]=se[1]}if(k.touches[2]){var se=r.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);X[4]=se[0],X[5]=se[1]}}else if(k.touches[0]&&!r.touchData.didSelect){var Mr=r.touchData.start,Zn=r.touchData.last,wr;if(!r.hoverData.draggingEles&&!r.swipePanning&&(wr=r.findNearestElement(X[0],X[1],!0,!0)),F&&Mr!=null&&k.preventDefault(),F&&Mr!=null&&r.nodeIsDraggable(Mr))if(Ce){var dr=r.dragData.touchDragEles,Eo=!r.dragData.didDrag;Eo&&g(dr,{inDragLayer:!0}),r.dragData.didDrag=!0;var ua={x:0,y:0};if(ne(Te[0])&&ne(Te[1])&&(ua.x+=Te[0],ua.y+=Te[1],Eo)){r.redrawHint("eles",!0);var Lr=r.touchData.dragDelta;Lr&&ne(Lr[0])&&ne(Lr[1])&&(ua.x+=Lr[0],ua.y+=Lr[1])}r.hoverData.draggingEles=!0,dr.silentShift(ua).emit(ue("position")).emit(ue("drag")),r.redrawHint("drag",!0),r.touchData.startPosition[0]==ve[0]&&r.touchData.startPosition[1]==ve[1]&&r.redrawHint("eles",!0),r.redraw()}else{var Lr=r.touchData.dragDelta=r.touchData.dragDelta||[];Lr.length===0?(Lr.push(Te[0]),Lr.push(Te[1])):(Lr[0]+=Te[0],Lr[1]+=Te[1])}if(n(Mr||wr,["touchmove","tapdrag","vmousemove"],k,{x:X[0],y:X[1]}),(!Mr||!Mr.grabbed())&&wr!=Zn&&(Zn&&Zn.emit(ue("tapdragout")),wr&&wr.emit(ue("tapdragover"))),r.touchData.last=wr,F)for(var xr=0;xr<X.length;xr++)X[xr]&&r.touchData.startPosition[xr]&&Ce&&(r.touchData.singleTouchMoved=!0);if(F&&(Mr==null||Mr.pannable())&&U.panningEnabled()&&U.userPanningEnabled()){var Jf=s(Mr,r.touchData.starts);Jf&&(k.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=Ht(r.touchData.startPosition)),r.swipePanning?(U.panBy({x:Te[0]*re,y:Te[1]*re}),U.emit(ue("dragpan"))):Ce&&(r.swipePanning=!0,U.panBy({x:De*re,y:nr*re}),U.emit(ue("dragpan")),Mr&&(Mr.unactivate(),r.redrawHint("select",!0),r.touchData.start=null)));var se=r.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);X[0]=se[0],X[1]=se[1]}}for(var fe=0;fe<X.length;fe++)ve[fe]=X[fe];F&&k.touches.length>0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},"touchmoveHandler"),!1);var xe;r.registerBinding(e,"touchcancel",xe=v(function(k){var F=r.touchData.start;r.touchData.capture=!1,F&&F.unactivate()},"touchcancelHandler"));var be,pe,oe,he;if(r.registerBinding(e,"touchend",be=v(function(k){var F=r.touchData.start,H=r.touchData.capture;if(H)k.touches.length===0&&(r.touchData.capture=!1),k.preventDefault();else return;var U=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var X=r.cy,ve=X.zoom(),re=r.touchData.now,se=r.touchData.earlier;if(k.touches[0]){var ue=r.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);re[0]=ue[0],re[1]=ue[1]}if(k.touches[1]){var ue=r.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);re[2]=ue[0],re[3]=ue[1]}if(k.touches[2]){var ue=r.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);re[4]=ue[0],re[5]=ue[1]}var ye=v(function(Rr){return{originalEvent:k,type:Rr,position:{x:re[0],y:re[1]}}},"makeEvent");F&&F.unactivate();var Ce;if(r.touchData.cxt){if(Ce=ye("cxttapend"),F?F.emit(Ce):X.emit(Ce),!r.touchData.cxtDragged){var Te=ye("cxttap");F?F.emit(Te):X.emit(Te)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!k.touches[2]&&X.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var fe=X.collection(r.getAllInBox(U[0],U[1],U[2],U[3]));U[0]=void 0,U[1]=void 0,U[2]=void 0,U[3]=void 0,U[4]=0,r.redrawHint("select",!0),X.emit(ye("boxend"));var De=v(function(Rr){return Rr.selectable()&&!Rr.selected()},"eleWouldBeSelected");fe.emit(ye("box")).stdFilter(De).select().emit(ye("boxselect")),fe.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(F?.unactivate(),k.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!k.touches[1]){if(!k.touches[0]){if(!k.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Ae=r.dragData.touchDragEles;if(F!=null){var nr=F._private.grabbed;m(Ae),r.redrawHint("drag",!0),r.redrawHint("eles",!0),nr&&(F.emit(ye("freeon")),Ae.emit(ye("free")),r.dragData.didDrag&&(F.emit(ye("dragfreeon")),Ae.emit(ye("dragfree")))),n(F,["touchend","tapend","vmouseup","tapdragout"],k,{x:re[0],y:re[1]}),F.unactivate(),r.touchData.start=null}else{var Ke=r.findNearestElement(re[0],re[1],!0,!0);n(Ke,["touchend","tapend","vmouseup","tapdragout"],k,{x:re[0],y:re[1]})}var Ar=r.touchData.startPosition[0]-re[0],Xe=Ar*Ar,Ze=r.touchData.startPosition[1]-re[1],je=Ze*Ze,ur=Xe+je,zr=ur*ve*ve;r.touchData.singleTouchMoved||(F||X.$(":selected").unselect(["tapunselect"]),n(F,["tap","vclick"],k,{x:re[0],y:re[1]}),pe=!1,k.timeStamp-he<=X.multiClickDebounceTime()?(oe&&clearTimeout(oe),pe=!0,he=null,n(F,["dbltap","vdblclick"],k,{x:re[0],y:re[1]})):(oe=setTimeout(function(){pe||n(F,["onetap","voneclick"],k,{x:re[0],y:re[1]})},X.multiClickDebounceTime()),he=k.timeStamp)),F!=null&&!r.dragData.didDrag&&F._private.selectable&&zr<r.touchTapThreshold2&&!r.pinching&&(X.selectionType()==="single"?(X.$(t).unmerge(F).unselect(["tapunselect"]),F.select(["tapselect"])):F.selected()?F.unselect(["tapunselect"]):F.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}}}for(var $e=0;$e<re.length;$e++)se[$e]=re[$e];r.dragData.didDrag=!1,k.touches.length===0&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),k.touches.length<2&&(k.touches.length===1&&(r.touchData.startGPosition=[k.touches[0].clientX,k.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())},"touchendHandler"),!1),typeof TouchEvent>"u"){var ce=[],Ee=v(function(k){return{clientX:k.clientX,clientY:k.clientY,force:1,identifier:k.pointerId,pageX:k.pageX,pageY:k.pageY,radiusX:k.width/2,radiusY:k.height/2,screenX:k.screenX,screenY:k.screenY,target:k.target}},"makeTouch"),we=v(function(k){return{event:k,touch:Ee(k)}},"makePointer"),ke=v(function(k){ce.push(we(k))},"addPointer"),Be=v(function(k){for(var F=0;F<ce.length;F++){var H=ce[F];if(H.event.pointerId===k.pointerId){ce.splice(F,1);return}}},"removePointer"),Ne=v(function(k){var F=ce.filter(function(H){return H.event.pointerId===k.pointerId})[0];F.event=k,F.touch=Ee(k)},"updatePointer"),Ie=v(function(k){k.touches=ce.map(function(F){return F.touch})},"addTouchesToEvent"),Re=v(function(k){return k.pointerType==="mouse"||k.pointerType===4},"pointerIsMouse");r.registerBinding(r.container,"pointerdown",function(Y){Re(Y)||(Y.preventDefault(),ke(Y),Ie(Y),de(Y))}),r.registerBinding(r.container,"pointerup",function(Y){Re(Y)||(Be(Y),Ie(Y),be(Y))}),r.registerBinding(r.container,"pointercancel",function(Y){Re(Y)||(Be(Y),Ie(Y),xe(Y))}),r.registerBinding(r.container,"pointermove",function(Y){Re(Y)||(Y.preventDefault(),Ne(Y),Ie(Y),Pe(Y))})}};var Qr={};Qr.generatePolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,draw:v(function(a,n,i,s,o,u){this.renderer.nodeShapeImpl("polygon",a,n,i,s,o,this.points)},"draw"),intersectLine:v(function(a,n,i,s,o,u,l,f){return ka(o,u,this.points,a,n,i/2,s/2,l)},"intersectLine"),checkPoint:v(function(a,n,i,s,o,u,l,f){return Zr(a,n,this.points,u,l,s,o,[0,-1],i)},"checkPoint"),hasMiterBounds:r!=="rectangle",miterBounds:v(function(a,n,i,s,o,u){return Ad(this.points,a,n,i,s,o)},"miterBounds")}};Qr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:v(function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},"draw"),intersectLine:v(function(e,t,a,n,i,s,o,u){return Fd(i,s,e,t,a/2+o,n/2+o)},"intersectLine"),checkPoint:v(function(e,t,a,n,i,s,o,u){return Dt(e,t,n,i,s,o,a)},"checkPoint")}};Qr.generateRoundPolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,getOrCreateCorners:v(function(a,n,i,s,o,u,l){if(u[l]!==void 0&&u[l+"-cx"]===a&&u[l+"-cy"]===n)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=a,u[l+"-cy"]=n;var f=i/2,c=s/2;o=o==="auto"?xv(i,s):o;for(var d=new Array(e.length/2),g=0;g<e.length/2;g++)d[g]={x:a+f*e[g*2],y:n+c*e[g*2+1]};var h,m,p,y,b=d.length;for(m=d[b-1],h=0;h<b;h++)p=d[h%b],y=d[(h+1)%b],u[l][h]=go(m,p,y,o),m=p,p=y;return u[l]},"getOrCreateCorners"),draw:v(function(a,n,i,s,o,u,l){this.renderer.nodeShapeImpl("round-polygon",a,n,i,s,o,this.points,this.getOrCreateCorners(n,i,s,o,u,l,"drawCorners"))},"draw"),intersectLine:v(function(a,n,i,s,o,u,l,f,c){return qd(o,u,this.points,a,n,i,s,l,this.getOrCreateCorners(a,n,i,s,f,c,"corners"))},"intersectLine"),checkPoint:v(function(a,n,i,s,o,u,l,f,c){return zd(a,n,this.points,u,l,s,o,this.getOrCreateCorners(u,l,s,o,f,c,"corners"))},"checkPoint")}};Qr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:yr(4,0),draw:v(function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,s)},"draw"),intersectLine:v(function(e,t,a,n,i,s,o,u){return bv(i,s,e,t,a,n,o,u)},"intersectLine"),checkPoint:v(function(e,t,a,n,i,s,o,u){var l=n/2,f=i/2;u=u==="auto"?vt(n,i):u,u=Math.min(l,f,u);var c=u*2;return!!(Zr(e,t,this.points,s,o,n,i-c,[0,-1],a)||Zr(e,t,this.points,s,o,n-c,i,[0,-1],a)||Dt(e,t,c,c,s-l+u,o-f+u,a)||Dt(e,t,c,c,s+l-u,o-f+u,a)||Dt(e,t,c,c,s+l-u,o+f-u,a)||Dt(e,t,c,c,s-l+u,o+f-u,a))},"checkPoint")}};Qr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:ao(),points:yr(4,0),draw:v(function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,null,s)},"draw"),generateCutTrianglePts:v(function(e,t,a,n,i){var s=i==="auto"?this.cornerLength:i,o=t/2,u=e/2,l=a-u,f=a+u,c=n-o,d=n+o;return{topLeft:[l,c+s,l+s,c,l+s,c+s],topRight:[f-s,c,f,c+s,f-s,c+s],bottomRight:[f,d-s,f-s,d,f-s,d-s],bottomLeft:[l+s,d,l,d-s,l+s,d-s]}},"generateCutTrianglePts"),intersectLine:v(function(e,t,a,n,i,s,o,u){var l=this.generateCutTrianglePts(a+2*o,n+2*o,e,t,u),f=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return ka(i,s,f,e,t)},"intersectLine"),checkPoint:v(function(e,t,a,n,i,s,o,u){var l=u==="auto"?this.cornerLength:u;if(Zr(e,t,this.points,s,o,n,i-2*l,[0,-1],a)||Zr(e,t,this.points,s,o,n-2*l,i,[0,-1],a))return!0;var f=this.generateCutTrianglePts(n,i,s,o);return Cr(e,t,f.topLeft)||Cr(e,t,f.topRight)||Cr(e,t,f.bottomRight)||Cr(e,t,f.bottomLeft)},"checkPoint")}};Qr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:yr(4,0),draw:v(function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},"draw"),intersectLine:v(function(e,t,a,n,i,s,o,u){var l=.15,f=.5,c=.85,d=this.generateBarrelBezierPts(a+2*o,n+2*o,e,t),g=v(function(p){var y=Ut({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},l),b=Ut({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},f),w=Ut({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},c);return[p[0],p[1],y.x,y.y,b.x,b.y,w.x,w.y,p[4],p[5]]},"approximateBarrelCurvePts"),h=[].concat(g(d.topLeft),g(d.topRight),g(d.bottomRight),g(d.bottomLeft));return ka(i,s,h,e,t)},"intersectLine"),generateBarrelBezierPts:v(function(e,t,a,n){var i=t/2,s=e/2,o=a-s,u=a+s,l=n-i,f=n+i,c=Ps(e,t),d=c.heightOffset,g=c.widthOffset,h=c.ctrlPtOffsetPct*e,m={topLeft:[o,l+d,o+h,l,o+g,l],topRight:[u-g,l,u-h,l,u,l+d],bottomRight:[u,f-d,u-h,f,u-g,f],bottomLeft:[o+g,f,o+h,f,o,f-d]};return m.topLeft.isTop=!0,m.topRight.isTop=!0,m.bottomLeft.isBottom=!0,m.bottomRight.isBottom=!0,m},"generateBarrelBezierPts"),checkPoint:v(function(e,t,a,n,i,s,o,u){var l=Ps(n,i),f=l.heightOffset,c=l.widthOffset;if(Zr(e,t,this.points,s,o,n,i-2*f,[0,-1],a)||Zr(e,t,this.points,s,o,n-2*c,i,[0,-1],a))return!0;for(var d=this.generateBarrelBezierPts(n,i,s,o),g=v(function(S,D,B){var P=B[4],A=B[2],R=B[0],M=B[5],I=B[1],O=Math.min(P,R),L=Math.max(P,R),N=Math.min(M,I),_=Math.max(M,I);if(O<=S&&S<=L&&N<=D&&D<=_){var G=_d(P,A,R),z=Ld(G[0],G[1],G[2],S),V=z.filter(function(K){return 0<=K&&K<=1});if(V.length>0)return V[0]}return null},"getCurveT"),h=Object.keys(d),m=0;m<h.length;m++){var p=h[m],y=d[p],b=g(e,t,y);if(b!=null){var w=y[5],x=y[3],C=y[1],T=ir(w,x,C,b);if(y.isTop&&T<=t||y.isBottom&&t<=T)return!0}}return!1},"checkPoint")}};Qr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:yr(4,0),draw:v(function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,s)},"draw"),intersectLine:v(function(e,t,a,n,i,s,o,u){var l=e-(a/2+o),f=t-(n/2+o),c=f,d=e+(a/2+o),g=it(i,s,e,t,l,f,d,c,!1);return g.length>0?g:bv(i,s,e,t,a,n,o,u)},"intersectLine"),checkPoint:v(function(e,t,a,n,i,s,o,u){u=u==="auto"?vt(n,i):u;var l=2*u;if(Zr(e,t,this.points,s,o,n,i-l,[0,-1],a)||Zr(e,t,this.points,s,o,n-l,i,[0,-1],a))return!0;var f=n/2+2*a,c=i/2+2*a,d=[s-f,o-c,s-f,o,s+f,o,s+f,o-c];return!!(Cr(e,t,d)||Dt(e,t,l,l,s+n/2-u,o+i/2-u,a)||Dt(e,t,l,l,s-n/2+u,o+i/2-u,a))},"checkPoint")}};Qr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",yr(3,0)),this.generateRoundPolygon("round-triangle",yr(3,0)),this.generatePolygon("rectangle",yr(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",yr(5,0)),this.generateRoundPolygon("round-pentagon",yr(5,0)),this.generatePolygon("hexagon",yr(6,0)),this.generateRoundPolygon("round-hexagon",yr(6,0)),this.generatePolygon("heptagon",yr(7,0)),this.generateRoundPolygon("round-heptagon",yr(7,0)),this.generatePolygon("octagon",yr(8,0)),this.generateRoundPolygon("round-octagon",yr(8,0));var a=new Array(20);{var n=Bs(5,0),i=Bs(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<i.length/2;o++)i[o*2]*=s,i[o*2+1]*=s;for(var o=0;o<20/4;o++)a[o*4]=n[o*2],a[o*4+1]=n[o*2+1],a[o*4+2]=i[o*2],a[o*4+3]=i[o*2+1]}a=wv(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}r.makePolygon=function(l){var f=l.join("$"),c="polygon-"+f,d;return(d=this[c])?d:e.generatePolygon(c,l)}};var Ga={};Ga.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Ga.redraw=function(r){r=r||gv();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=r};Ga.beforeRender=function(r,e){if(!this.destroyed){e==null&&We("Priority is not optional for beforeRender");var t=this.beforeRenderCallbacks;t.push({fn:r,priority:e}),t.sort(function(a,n){return n.priority-a.priority})}};var Il=v(function(e,t,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(t,a)},"beforeRenderCallbacks");Ga.startRenderLoop=function(){var r=this,e=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var t=v(function(n){if(!r.destroyed){if(!e.batching())if(r.requestedFrame&&!r.skipFrame){Il(r,!0,n);var i=Yr();r.render(r.renderOptions);var s=r.lastDrawTime=Yr();r.averageRedrawTime===void 0&&(r.averageRedrawTime=s-i),r.redrawCount===void 0&&(r.redrawCount=0),r.redrawCount++,r.redrawTotalTime===void 0&&(r.redrawTotalTime=0);var o=s-i;r.redrawTotalTime+=o,r.lastRedrawTime=o,r.averageRedrawTime=r.averageRedrawTime/2+o/2,r.requestedFrame=!1}else Il(r,!1,n);r.skipFrame=!1,bn(t)}},"renderFn");bn(t)}};var iy=v(function(e){this.init(e)},"BaseRenderer"),Cf=iy,ia=Cf.prototype;ia.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];ia.init=function(r){var e=this;e.options=r,e.cy=r.cy;var t=e.container=r.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",u=n.getElementById(s)!=null;if(t.className.indexOf(o)<0&&(t.className=(t.className||"")+" "+o),!u){var l=n.createElement("style");l.id=s,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}var f=a.getComputedStyle(t),c=f.getPropertyValue("position");c==="static"&&Fe("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=r.showFps,e.debug=r.debug,e.webgl=r.webgl,e.hideEdgesOnViewport=r.hideEdgesOnViewport,e.textureOnViewport=r.textureOnViewport,e.wheelSensitivity=r.wheelSensitivity,e.motionBlurEnabled=r.motionBlur,e.forcedPixelRatio=ne(r.pixelRatio)?r.pixelRatio:null,e.motionBlur=r.motionBlur,e.motionBlurOpacity=r.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=r.desktopTapThreshold,e.desktopTapThreshold2=r.desktopTapThreshold*r.desktopTapThreshold,e.touchTapThreshold=r.touchTapThreshold,e.touchTapThreshold2=r.touchTapThreshold*r.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};ia.notify=function(r,e){var t=this,a=t.cy;if(!this.destroyed){if(r==="init"){t.load();return}if(r==="destroy"){t.destroy();return}(r==="add"||r==="remove"||r==="move"&&a.hasCompoundNodes()||r==="load"||r==="zorder"||r==="mount")&&t.invalidateCachedZSortedEles(),r==="viewport"&&t.redrawHint("select",!0),r==="gc"&&t.redrawHint("gc",!0),(r==="load"||r==="resize"||r==="mount")&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container)),t.redrawHint("eles",!0),t.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};ia.destroy=function(){var r=this;r.destroyed=!0,r.cy.stopAnimationLoop();for(var e=0;e<r.bindings.length;e++){var t=r.bindings[e],a=t,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(r.bindings=[],r.beforeRenderCallbacks=[],r.onUpdateEleCalcsFns=[],r.removeObserver&&r.removeObserver.disconnect(),r.styleObserver&&r.styleObserver.disconnect(),r.resizeObserver&&r.resizeObserver.disconnect(),r.labelCalcDiv)try{document.body.removeChild(r.labelCalcDiv)}catch{}};ia.isHeadless=function(){return!1};[ho,wf,xf,na,Qr,Ga].forEach(function(r){me(ia,r)});var bs=1e3/60,Tf={setupDequeueing:v(function(e){return v(function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=za(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),s=v(function(l,f){var c=Yr(),d=n.averageRedrawTime,g=n.lastRedrawTime,h=[],m=n.cy.extent(),p=n.getPixelRatio();for(l||n.flushRenderedStyleQueue();;){var y=Yr(),b=y-c,w=y-f;if(g<bs){var x=bs-(l?d:0);if(w>=e.deqFastCost*x)break}else if(l){if(b>=e.deqCost*g||b>=e.deqAvgCost*d)break}else if(w>=e.deqNoDrawCost*bs)break;var C=e.deq(a,p,m);if(C.length>0)for(var T=0;T<C.length;T++)h.push(C[T]);else break}h.length>0&&(e.onDeqd(a,h),!l&&e.shouldRedraw(a,h,p,m)&&i())},"dequeue"),o=e.priority||Js;n.beforeRender(s,o(a))}},"setupDequeueingImpl")},"setupDequeueing")},sy=(function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:wn;ht(this,r),this.idsByKey=new Xr,this.keyForId=new Xr,this.cachesByLvl=new Xr,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return v(r,"ElementTextureCacheLookup"),gt(r,[{key:"getIdsFor",value:v(function(t){t==null&&We("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new ea,a.set(t,n)),n},"getIdsFor")},{key:"addIdForKey",value:v(function(t,a){t!=null&&this.getIdsFor(t).add(a)},"addIdForKey")},{key:"deleteIdForKey",value:v(function(t,a){t!=null&&this.getIdsFor(t).delete(a)},"deleteIdForKey")},{key:"getNumberOfIdsForKey",value:v(function(t){return t==null?0:this.getIdsFor(t).size},"getNumberOfIdsForKey")},{key:"updateKeyMappingFor",value:v(function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)},"updateKeyMappingFor")},{key:"deleteKeyMappingFor",value:v(function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)},"deleteKeyMappingFor")},{key:"keyHasChangedFor",value:v(function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);return n!==i},"keyHasChangedFor")},{key:"isInvalid",value:v(function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)},"isInvalid")},{key:"getCachesAt",value:v(function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new Xr,a.set(t,i),n.push(t)),i},"getCachesAt")},{key:"getCache",value:v(function(t,a){return this.getCachesAt(a).get(t)},"getCache")},{key:"get",value:v(function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(t),i},"get")},{key:"getForCachedKey",value:v(function(t,a){var n=this.keyForId.get(t.id()),i=this.getCache(n,a);return i},"getForCachedKey")},{key:"hasCache",value:v(function(t,a){return this.getCachesAt(a).has(t)},"hasCache")},{key:"has",value:v(function(t,a){var n=this.getKey(t);return this.hasCache(n,a)},"has")},{key:"setCache",value:v(function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)},"setCache")},{key:"set",value:v(function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)},"set")},{key:"deleteCache",value:v(function(t,a){this.getCachesAt(a).delete(t)},"deleteCache")},{key:"delete",value:v(function(t,a){var n=this.getKey(t);this.deleteCache(n,a)},"_delete")},{key:"invalidateKey",value:v(function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})},"invalidateKey")},{key:"invalidate",value:v(function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0},"invalidate")}])})(),Ol=25,an=50,gn=-4,Gs=3,Sf=7.99,oy=8,uy=1024,ly=1024,vy=1024,fy=.2,cy=.8,dy=10,hy=.15,gy=.1,py=.9,yy=.9,my=100,by=1,$t={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},wy=fr({getKey:null,doesEleInvalidateKey:wn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:cv,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ma=v(function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=wy(t);me(a,n),a.lookup=new sy(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},"ElementTextureCache"),ar=ma.prototype;ar.reasons=$t;ar.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};ar.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};ar.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Fa(function(t,a){return a.reqs-t.reqs});return e};ar.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};ar.getElement=function(r,e,t,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(a==null&&(a=Math.ceil(eo(o*t))),a<gn)a=gn;else if(o>=Sf||a>Gs)return null;var l=Math.pow(2,a),f=e.h*l,c=e.w*l,d=s.eleTextBiggerThanMin(r,l);if(!this.isVisible(r,d))return null;var g=u.get(r,a);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;var h;if(f<=Ol?h=Ol:f<=an?h=an:h=Math.ceil(f/an)*an,f>vy||c>ly)return null;var m=i.getTextureQueue(h),p=m[m.length-2],y=v(function(){return i.recycleTexture(h,c)||i.addTexture(h,c)},"addNewTxr");p||(p=m[m.length-1]),p||(p=y()),p.width-p.usedWidth<c&&(p=y());for(var b=v(function(O){return O&&O.scaledLabelShown===d},"scalableFrom"),w=n&&n===$t.dequeue,x=n&&n===$t.highQuality,C=n&&n===$t.downscale,T,E=a+1;E<=Gs;E++){var S=u.get(r,E);if(S){T=S;break}}var D=T&&T.level===a+1?T:null,B=v(function(){p.context.drawImage(D.texture.canvas,D.x,0,D.width,D.height,p.usedWidth,0,c,f)},"downscale");if(p.context.setTransform(1,0,0,1,0,0),p.context.clearRect(p.usedWidth,0,c,h),b(D))B();else if(b(T))if(x){for(var P=T.level;P>a;P--)D=i.getElement(r,e,t,P,$t.downscale);B()}else return i.queueElement(r,T.level-1),T;else{var A;if(!w&&!x&&!C)for(var R=a-1;R>=gn;R--){var M=u.get(r,R);if(M){A=M;break}}if(b(A))return i.queueElement(r,a),A;p.context.translate(p.usedWidth,0),p.context.scale(l,l),this.drawElement(p.context,r,e,d,!1),p.context.scale(1/l,1/l),p.context.translate(-p.usedWidth,0)}return g={x:p.usedWidth,texture:p,level:a,scale:l,width:c,height:f,scaledLabelShown:d},p.usedWidth+=Math.ceil(c+oy),p.eleCaches.push(g),u.set(r,a,g),i.checkTextureFullness(p),g};ar.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])};ar.invalidateElement=function(r){var e=this,t=e.lookup,a=[],n=t.isInvalid(r);if(n){for(var i=gn;i<=Gs;i++){var s=t.getForCachedKey(r,i);s&&a.push(s)}var o=t.invalidate(r);if(o)for(var u=0;u<a.length;u++){var l=a[u],f=l.texture;f.invalidatedWidth+=l.width,l.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(r)}};ar.checkTextureUtility=function(r){r.invalidatedWidth>=fy*r.width&&this.retireTexture(r)};ar.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>cy&&r.fullnessChecks>=dy?lt(t,r):r.fullnessChecks++};ar.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;lt(a,r),r.retired=!0;for(var i=r.eleCaches,s=0;s<i.length;s++){var o=i[s];n.deleteCache(o.key,o.level)}js(i);var u=e.getRetiredTextureQueue(t);u.push(r)};ar.addTexture=function(r,e){var t=this,a=t.getTextureQueue(r),n={};return a.push(n),n.eleCaches=[],n.height=r,n.width=Math.max(uy,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=t.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};ar.recycleTexture=function(r,e){for(var t=this,a=t.getTextureQueue(r),n=t.getRetiredTextureQueue(r),i=0;i<n.length;i++){var s=n[i];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,js(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),lt(n,s),a.push(s),s}};ar.queueElement=function(r,e){var t=this,a=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(r),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(r),s.reqs++,a.updateItem(s);else{var o={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(o),n[i]=o}};ar.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s<by&&t.size()>0;s++){var o=t.pop(),u=o.key,l=o.eles[0],f=i.hasCache(l,o.level);if(a[u]=null,f)continue;n.push(o);var c=e.getBoundingBox(l);e.getElement(l,c,r,o.level,$t.dequeue)}return n};ar.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(r),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=Qs,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};ar.onDequeue=function(r){this.onDequeues.push(r)};ar.offDequeue=function(r){lt(this.onDequeues,r)};ar.setupDequeueing=Tf.setupDequeueing({deqRedrawThreshold:my,deqCost:hy,deqAvgCost:gy,deqNoDrawCost:py,deqFastCost:yy,deq:v(function(e,t,a){return e.dequeue(t,a)},"deq"),onDeqd:v(function(e,t){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(t)}},"onDeqd"),shouldRedraw:v(function(e,t,a,n){for(var i=0;i<t.length;i++)for(var s=t[i].eles,o=0;o<s.length;o++){var u=s[o].boundingBox();if(to(u,n))return!0}return!1},"shouldRedraw"),priority:v(function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq},"priority")});var xy=1,wa=-4,Bn=2,Ey=3.99,Cy=50,Ty=50,Sy=.15,ky=.1,Dy=.9,By=.9,Py=1,Nl=250,Ay=4e3*4e3,zl=32767,Ry=!0,kf=v(function(e){var t=this,a=t.renderer=e,n=a.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Yr()-2*Nl,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=za(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},Ty),a.beforeRender(function(s,o){o-t.lastInvalidationTime<=Nl?t.skipping=!0:t.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=v(function(o,u){return u.reqs-o.reqs},"qSort");t.layersQueue=new Fa(i),t.setupDequeueing()},"LayeredTextureCache"),cr=kf.prototype,Fl=0,My=Math.pow(2,53)-1;cr.makeLayer=function(r,e){var t=Math.pow(2,e),a=Math.ceil(r.w*t),n=Math.ceil(r.h*t),i=this.renderer.makeOffscreenCanvas(a,n),s={id:Fl=++Fl%My,bb:r,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,u=-s.bb.x1,l=-s.bb.y1;return o.scale(t,t),o.translate(u,l),s};cr.getLayers=function(r,e,t){var a=this,n=a.renderer,i=n.cy,s=i.zoom(),o=a.firstGet;if(a.firstGet=!1,t==null){if(t=Math.ceil(eo(s*e)),t<wa)t=wa;else if(s>=Ey||t>Bn)return null}a.validateLayersElesOrdering(t,r);var u=a.layersByLevel,l=Math.pow(2,t),f=u[t]=u[t]||[],c,d=a.levelIsComplete(t,r),g,h=v(function(){var B=v(function(I){if(a.validateLayersElesOrdering(I,r),a.levelIsComplete(I,r))return g=u[I],!0},"canUseAsTmpLvl"),P=v(function(I){if(!g)for(var O=t+I;wa<=O&&O<=Bn&&!B(O);O+=I);},"checkLvls");P(1),P(-1);for(var A=f.length-1;A>=0;A--){var R=f[A];R.invalid&<(f,R)}},"checkTempLevels");if(!d)h();else return f;var m=v(function(){if(!c){c=mr();for(var B=0;B<r.length;B++)Dd(c,r[B].boundingBox())}return c},"getBb"),p=v(function(B){B=B||{};var P=B.after;m();var A=Math.ceil(c.w*l),R=Math.ceil(c.h*l);if(A>zl||R>zl)return null;var M=A*R;if(M>Ay)return null;var I=a.makeLayer(c,t);if(P!=null){var O=f.indexOf(P)+1;f.splice(O,0,I)}else(B.insert===void 0||B.insert)&&f.unshift(I);return I},"makeLayer");if(a.skipping&&!o)return null;for(var y=null,b=r.length/xy,w=!o,x=0;x<r.length;x++){var C=r[x],T=C._private.rscratch,E=T.imgLayerCaches=T.imgLayerCaches||{},S=E[t];if(S){y=S;continue}if((!y||y.eles.length>=b||!mv(y.bb,C.boundingBox()))&&(y=p({insert:!0,after:y}),!y))return null;g||w?a.queueLayer(y,C):a.drawEleInLayer(y,C,t,e),y.eles.push(C),E[t]=y}return g||(w?null:f)};cr.getEleLevelForLayerLevel=function(r,e){return r};cr.drawEleInLayer=function(r,e,t,a){var n=this,i=this.renderer,s=r.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(t=n.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,t,Ry),i.setImgSmoothing(s,!0))};cr.levelIsComplete=function(r,e){var t=this,a=t.layersByLevel[r];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var s=a[i];if(s.reqs>0||s.invalid)return!1;n+=s.eles.length}return n===e.length};cr.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a<t.length;a++){for(var n=t[a],i=-1,s=0;s<e.length;s++)if(n.eles[0]===e[s]){i=s;break}if(i<0){this.invalidateLayer(n);continue}for(var o=i,s=0;s<n.eles.length;s++)if(n.eles[s]!==e[o+s]){this.invalidateLayer(n);break}}};cr.updateElementsInLayers=function(r,e){for(var t=this,a=La(r[0]),n=0;n<r.length;n++)for(var i=a?null:r[n],s=a?r[n]:r[n].ele,o=s._private.rscratch,u=o.imgLayerCaches=o.imgLayerCaches||{},l=wa;l<=Bn;l++){var f=u[l];f&&(i&&t.getEleLevelForLayerLevel(f.level)!==i.level||e(f,s,i))}};cr.haveLayers=function(){for(var r=this,e=!1,t=wa;t<=Bn;t++){var a=r.layersByLevel[t];if(a&&a.length>0){e=!0;break}}return e};cr.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=Yr(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,v(function(a,n,i){e.invalidateLayer(a)},"invalAssocLayers")))};cr.invalidateLayer=function(r){if(this.lastInvalidationTime=Yr(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];lt(a,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var n=0;n<t.length;n++){var i=t[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};cr.refineElementTextures=function(r){var e=this;e.updateElementsInLayers(r,v(function(a,n,i){var s=a.replacement;if(s||(s=a.replacement=e.makeLayer(a.bb,a.level),s.replaces=a,s.eles=a.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])},"refineEachEle"))};cr.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()};cr.queueLayer=function(r,e){var t=this,a=t.layersQueue,n=r.elesQueue,i=n.hasId=n.hasId||{};if(!r.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}r.reqs?(r.reqs++,a.updateItem(r)):(r.reqs=1,a.push(r))}};cr.dequeue=function(r){for(var e=this,t=e.layersQueue,a=[],n=0;n<Py&&t.size()!==0;){var i=t.peek();if(i.replacement){t.pop();continue}if(i.replaces&&i!==i.replaces.replacement){t.pop();continue}if(i.invalid){t.pop();continue}var s=i.elesQueue.shift();s&&(e.drawEleInLayer(i,s,i.level,r),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(t.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};cr.applyLayerReplacement=function(r){var e=this,t=e.layersByLevel[r.level],a=r.replaces,n=t.indexOf(a);if(!(n<0||a.invalid)){t[n]=r;for(var i=0;i<r.eles.length;i++){var s=r.eles[i]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[r.level]=r)}e.requestRedraw()}};cr.requestRedraw=za(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100);cr.setupDequeueing=Tf.setupDequeueing({deqRedrawThreshold:Cy,deqCost:Sy,deqAvgCost:ky,deqNoDrawCost:Dy,deqFastCost:By,deq:v(function(e,t){return e.dequeue(t)},"deq"),onDeqd:Js,shouldRedraw:cv,priority:v(function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq},"priority")});var Df={},Vl;function Ly(r,e){for(var t=0;t<e.length;t++){var a=e[t];r.lineTo(a.x,a.y)}}v(Ly,"polygon");function Iy(r,e,t){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),r.lineTo(i.x,i.y)}r.quadraticCurveTo(t.x,t.y,a.x,a.y)}v(Iy,"triangleBackcurve");function ql(r,e,t){r.beginPath&&r.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];r.lineTo(i.x,i.y)}var s=t,o=t[0];r.moveTo(o.x,o.y);for(var n=1;n<s.length;n++){var i=s[n];r.lineTo(i.x,i.y)}r.closePath&&r.closePath()}v(ql,"triangleTee");function Oy(r,e,t,a,n){r.beginPath&&r.beginPath(),r.arc(t,a,n,0,Math.PI*2,!1);var i=e,s=i[0];r.moveTo(s.x,s.y);for(var o=0;o<i.length;o++){var u=i[o];r.lineTo(u.x,u.y)}r.closePath&&r.closePath()}v(Oy,"circleTriangle");function Ny(r,e,t,a){r.arc(e,t,a,0,Math.PI*2,!1)}v(Ny,"circle$1");Df.arrowShapeImpl=function(r){return(Vl||(Vl={polygon:Ly,"triangle-backcurve":Iy,"triangle-tee":ql,"circle-triangle":Oy,"triangle-cross":ql,circle:Ny}))[r]};var Wr={};Wr.drawElement=function(r,e,t,a,n,i){var s=this;e.isNode()?s.drawNode(r,e,t,a,n,i):s.drawEdge(r,e,t,a,n,i)};Wr.drawElementOverlay=function(r,e){var t=this;e.isNode()?t.drawNodeOverlay(r,e):t.drawEdgeOverlay(r,e)};Wr.drawElementUnderlay=function(r,e){var t=this;e.isNode()?t.drawNodeUnderlay(r,e):t.drawEdgeUnderlay(r,e)};Wr.drawCachedElementPortion=function(r,e,t,a,n,i,s,o){var u=this,l=t.getBoundingBox(e);if(!(l.w===0||l.h===0)){var f=t.getElement(e,l,a,n,i);if(f!=null){var c=o(u,e);if(c===0)return;var d=s(u,e),g=l.x1,h=l.y1,m=l.w,p=l.h,y,b,w,x,C;if(d!==0){var T=t.getRotationPoint(e);w=T.x,x=T.y,r.translate(w,x),r.rotate(d),C=u.getImgSmoothing(r),C||u.setImgSmoothing(r,!0);var E=t.getRotationOffset(e);y=E.x,b=E.y}else y=g,b=h;var S;c!==1&&(S=r.globalAlpha,r.globalAlpha=S*c),r.drawImage(f.texture.canvas,f.x,0,f.width,f.height,y,b,m,p),c!==1&&(r.globalAlpha=S),d!==0&&(r.rotate(-d),r.translate(-w,-x),C||u.setImgSmoothing(r,!1))}else t.drawElement(r,e)}};var zy=v(function(){return 0},"getZeroRotation"),Fy=v(function(e,t){return e.getTextAngle(t,null)},"getLabelRotation"),Vy=v(function(e,t){return e.getTextAngle(t,"source")},"getSourceLabelRotation"),qy=v(function(e,t){return e.getTextAngle(t,"target")},"getTargetLabelRotation"),_y=v(function(e,t){return t.effectiveOpacity()},"getOpacity"),ws=v(function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()},"getTextOpacity");Wr.drawCachedElement=function(r,e,t,a,n,i){var s=this,o=s.data,u=o.eleTxrCache,l=o.lblTxrCache,f=o.slbTxrCache,c=o.tlbTxrCache,d=e.boundingBox(),g=i===!0?u.reasons.highQuality:null;if(!(d.w===0||d.h===0||!e.visible())&&(!a||to(d,a))){var h=e.isEdge(),m=e.element()._private.rscratch.badLine;s.drawElementUnderlay(r,e),s.drawCachedElementPortion(r,e,u,t,n,g,zy,_y),(!h||!m)&&s.drawCachedElementPortion(r,e,l,t,n,g,Fy,ws),h&&!m&&(s.drawCachedElementPortion(r,e,f,t,n,g,Vy,ws),s.drawCachedElementPortion(r,e,c,t,n,g,qy,ws)),s.drawElementOverlay(r,e)}};Wr.drawElements=function(r,e){for(var t=this,a=0;a<e.length;a++){var n=e[a];t.drawElement(r,n)}};Wr.drawCachedElements=function(r,e,t,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];n.drawCachedElement(r,s,t,a)}};Wr.drawCachedNodes=function(r,e,t,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];s.isNode()&&n.drawCachedElement(r,s,t,a)}};Wr.drawLayeredElements=function(r,e,t,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,t);if(i)for(var s=0;s<i.length;s++){var o=i[s],u=o.bb;u.w===0||u.h===0||r.drawImage(o.canvas,u.x1,u.y1,u.w,u.h)}else n.drawCachedElements(r,e,t,a)};var Jr={};Jr.drawEdge=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var u;t&&(u=t,r.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,c=e.pstyle("curve-style").value,d=e.pstyle("line-style").value,g=e.pstyle("width").pfValue,h=e.pstyle("line-cap").value,m=e.pstyle("line-outline-width").value,p=e.pstyle("line-outline-color").value,y=l*f,b=l*f,w=v(function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;c==="straight-triangle"?(s.eleStrokeStyle(r,e,I),s.drawEdgeTrianglePath(e,r,o.allpts)):(r.lineWidth=g,r.lineCap=h,s.eleStrokeStyle(r,e,I),s.drawEdgePath(e,r,o.allpts,d),r.lineCap="butt")},"drawLine"),x=v(function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;if(r.lineWidth=g+m,r.lineCap=h,m>0)s.colorStrokeStyle(r,p[0],p[1],p[2],I);else{r.lineCap="butt";return}c==="straight-triangle"?s.drawEdgeTrianglePath(e,r,o.allpts):(s.drawEdgePath(e,r,o.allpts,d),r.lineCap="butt")},"drawLineOutline"),C=v(function(){n&&s.drawEdgeOverlay(r,e)},"drawOverlay"),T=v(function(){n&&s.drawEdgeUnderlay(r,e)},"drawUnderlay"),E=v(function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;s.drawArrowheads(r,e,I)},"drawArrows"),S=v(function(){s.drawElementText(r,e,null,a)},"drawText");r.lineJoin="round";var D=e.pstyle("ghost").value==="yes";if(D){var B=e.pstyle("ghost-offset-x").pfValue,P=e.pstyle("ghost-offset-y").pfValue,A=e.pstyle("ghost-opacity").value,R=y*A;r.translate(B,P),w(R),E(R),r.translate(-B,-P)}else x();T(),w(),E(),C(),S(),t&&r.translate(u.x1,u.y1)}};var Bf=v(function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,s=i.usePaths(),o=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=a.pstyle("".concat(e,"-color")).value;t.lineWidth=l,o.edgeType==="self"&&!s?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,f[0],f[1],f[2],n),i.drawEdgePath(a,t,o.allpts,"solid")}}}},"drawEdgeOverlayUnderlay");Jr.drawEdgeOverlay=Bf("overlay");Jr.drawEdgeUnderlay=Bf("underlay");Jr.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,s,o=!1,u=this.usePaths(),l=r.pstyle("line-dash-pattern").pfValue,f=r.pstyle("line-dash-offset").pfValue;if(u){var c=t.join("$"),d=n.pathCacheKey&&n.pathCacheKey===c;d?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=c,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var g=2;g+3<t.length;g+=4)e.quadraticCurveTo(t[g],t[g+1],t[g+2],t[g+3]);break;case"straight":case"haystack":for(var h=2;h+1<t.length;h+=2)e.lineTo(t[h],t[h+1]);break;case"segments":if(n.isRound){var m=Tr(n.roundCorners),p;try{for(m.s();!(p=m.n()).done;){var y=p.value;gf(e,y)}}catch(w){m.e(w)}finally{m.f()}e.lineTo(t[t.length-2],t[t.length-1])}else for(var b=2;b+1<t.length;b+=2)e.lineTo(t[b],t[b+1]);break}e=i,u?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])};Jr.drawEdgeTrianglePath=function(r,e,t){e.fillStyle=e.strokeStyle;for(var a=r.pstyle("width").pfValue,n=0;n+1<t.length;n+=2){var i=[t[n+2]-t[n],t[n+3]-t[n+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/s,-i[0]/s],u=[o[0]*a/2,o[1]*a/2];e.beginPath(),e.moveTo(t[n]-u[0],t[n+1]-u[1]),e.lineTo(t[n]+u[0],t[n+1]+u[1]),e.lineTo(t[n+2],t[n+3]),e.closePath(),e.fill()}};Jr.drawArrowheads=function(r,e,t){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(r,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,t),this.drawArrowhead(r,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,t),this.drawArrowhead(r,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,t),n||this.drawArrowhead(r,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,t)};Jr.drawArrowhead=function(r,e,t,a,n,i,s){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var o=this,u=e.pstyle(t+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(t+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(t+"-arrow-fill").value,c=e.pstyle("width").pfValue,d=e.pstyle(t+"-arrow-width"),g=d.value==="match-line"?c:d.pfValue;d.units==="%"&&(g*=c);var h=e.pstyle("opacity").value;s===void 0&&(s=h);var m=r.globalCompositeOperation;(s!==1||f==="hollow")&&(r.globalCompositeOperation="destination-out",o.colorFillStyle(r,255,255,255,1),o.colorStrokeStyle(r,255,255,255,1),o.drawArrowShape(e,r,l,c,u,g,a,n,i),r.globalCompositeOperation=m);var p=e.pstyle(t+"-arrow-color").value;o.colorFillStyle(r,p[0],p[1],p[2],s),o.colorStrokeStyle(r,p[0],p[1],p[2],s),o.drawArrowShape(e,r,f,c,u,g,a,n,i)}}};Jr.drawArrowShape=function(r,e,t,a,n,i,s,o,u){var l=this,f=this.usePaths()&&n!=="triangle-cross",c=!1,d,g=e,h={x:s,y:o},m=r.pstyle("arrow-scale").value,p=this.getArrowWidth(a,m),y=l.arrowShapes[n];if(f){var b=l.arrowPathCache=l.arrowPathCache||[],w=Bt(n),x=b[w];x!=null?(d=e=x,c=!0):(d=e=new Path2D,b[w]=d)}c||(e.beginPath&&e.beginPath(),f?y.draw(e,1,0,{x:0,y:0},1):y.draw(e,p,u,h,a),e.closePath&&e.closePath()),e=g,f&&(e.translate(s,o),e.rotate(u),e.scale(p,p)),(t==="filled"||t==="both")&&(f?e.fill(d):e.fill()),(t==="hollow"||t==="both")&&(e.lineWidth=i/(f?p:1),e.lineJoin="miter",f?e.stroke(d):e.stroke()),f&&(e.scale(1/p,1/p),e.rotate(-u),e.translate(-s,-o))};var yo={};yo.safeDrawImage=function(r,e,t,a,n,i,s,o,u,l){if(!(n<=0||i<=0||u<=0||l<=0))try{r.drawImage(e,t,a,n,i,s,o,u,l)}catch(f){Fe(f)}};yo.drawInscribedImage=function(r,e,t,a,n){var i=this,s=t.position(),o=s.x,u=s.y,l=t.cy().style(),f=l.getIndexedStyle.bind(l),c=f(t,"background-fit","value",a),d=f(t,"background-repeat","value",a),g=t.width(),h=t.height(),m=t.padding()*2,p=g+(f(t,"background-width-relative-to","value",a)==="inner"?0:m),y=h+(f(t,"background-height-relative-to","value",a)==="inner"?0:m),b=t._private.rscratch,w=f(t,"background-clip","value",a),x=w==="node",C=f(t,"background-image-opacity","value",a)*n,T=f(t,"background-image-smoothing","value",a),E=t.pstyle("corner-radius").value;E!=="auto"&&(E=t.pstyle("corner-radius").pfValue);var S=e.width||e.cachedW,D=e.height||e.cachedH;(S==null||D==null)&&(document.body.appendChild(e),S=e.cachedW=e.width||e.offsetWidth,D=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var B=S,P=D;if(f(t,"background-width","value",a)!=="auto"&&(f(t,"background-width","units",a)==="%"?B=f(t,"background-width","pfValue",a)*p:B=f(t,"background-width","pfValue",a)),f(t,"background-height","value",a)!=="auto"&&(f(t,"background-height","units",a)==="%"?P=f(t,"background-height","pfValue",a)*y:P=f(t,"background-height","pfValue",a)),!(B===0||P===0)){if(c==="contain"){var A=Math.min(p/B,y/P);B*=A,P*=A}else if(c==="cover"){var A=Math.max(p/B,y/P);B*=A,P*=A}var R=o-p/2,M=f(t,"background-position-x","units",a),I=f(t,"background-position-x","pfValue",a);M==="%"?R+=(p-B)*I:R+=I;var O=f(t,"background-offset-x","units",a),L=f(t,"background-offset-x","pfValue",a);O==="%"?R+=(p-B)*L:R+=L;var N=u-y/2,_=f(t,"background-position-y","units",a),G=f(t,"background-position-y","pfValue",a);_==="%"?N+=(y-P)*G:N+=G;var z=f(t,"background-offset-y","units",a),V=f(t,"background-offset-y","pfValue",a);z==="%"?N+=(y-P)*V:N+=V,b.pathCache&&(R-=o,N-=u,o=0,u=0);var K=r.globalAlpha;r.globalAlpha=C;var j=i.getImgSmoothing(r),Q=!1;if(T==="no"&&j?(i.setImgSmoothing(r,!1),Q=!0):T==="yes"&&!j&&(i.setImgSmoothing(r,!0),Q=!0),d==="no-repeat")x&&(r.save(),b.pathCache?r.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,o,u,p,y,E,b),r.clip())),i.safeDrawImage(r,e,0,0,S,D,R,N,B,P),x&&r.restore();else{var ee=r.createPattern(e,d);r.fillStyle=ee,i.nodeShapes[i.getNodeShape(t)].draw(r,o,u,p,y,E,b),r.translate(R,N),r.fill(),r.translate(-R,-N)}r.globalAlpha=K,Q&&i.setImgSmoothing(r,j)}};var It={};It.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(eo(t*a));e=Math.pow(2,n)}var i=r.pstyle("font-size").pfValue*e,s=r.pstyle("min-zoomed-font-size").pfValue;return!(i<s)};It.drawElementText=function(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var u=s.getLabelJustification(e);r.textAlign=u,r.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,f=e.pstyle("label"),c=e.pstyle("source-label"),d=e.pstyle("target-label");if(l||(!f||!f.value)&&(!c||!c.value)&&(!d||!d.value))return;r.textAlign="center",r.textBaseline="bottom"}var g=!t,h;t&&(h=t,r.translate(-h.x1,-h.y1)),n==null?(s.drawText(r,e,null,g,i),e.isEdge()&&(s.drawText(r,e,"source",g,i),s.drawText(r,e,"target",g,i))):s.drawText(r,e,n,g,i),t&&r.translate(h.x1,h.y1)};It.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t<this.fontCaches.length;t++)if(e=this.fontCaches[t],e.context===r)return e;return e={context:r},this.fontCaches.push(e),e};It.setupTextStyle=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*o,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;r.font=a+" "+s+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,l[0],l[1],l[2],o),this.colorStrokeStyle(r,f[0],f[1],f[2],u)};function Gy(r,e,t,a,n){var i=Math.min(a,n),s=i/2,o=e+a/2,u=t+n/2;r.beginPath(),r.arc(o,u,s,0,Math.PI*2),r.closePath()}v(Gy,"circle");function _l(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(i,a/2,n/2);r.beginPath(),r.moveTo(e+s,t),r.lineTo(e+a-s,t),r.quadraticCurveTo(e+a,t,e+a,t+s),r.lineTo(e+a,t+n-s),r.quadraticCurveTo(e+a,t+n,e+a-s,t+n),r.lineTo(e+s,t+n),r.quadraticCurveTo(e,t+n,e,t+n-s),r.lineTo(e,t+s),r.quadraticCurveTo(e,t,e+s,t),r.closePath()}v(_l,"roundRect");It.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",s=r.pstyle(i+"text-rotation");if(s.strValue==="autorotate"){var o=Er(n,"labelAngle",e);t=r.isEdge()?o:0}else s.strValue==="none"?t=0:t=s.pfValue;return t};It.drawText=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var u=Er(s,"labelX",t),l=Er(s,"labelY",t),f,c,d=this.getLabelText(e,t);if(d!=null&&d!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(r,e,n);var g=t?t+"-":"",h=Er(s,"labelWidth",t),m=Er(s,"labelHeight",t),p=e.pstyle(g+"text-margin-x").pfValue,y=e.pstyle(g+"text-margin-y").pfValue,b=e.isEdge(),w=e.pstyle("text-halign").value,x=e.pstyle("text-valign").value;b&&(w="center",x="center"),u+=p,l+=y;var C;switch(a?C=this.getTextAngle(e,t):C=0,C!==0&&(f=u,c=l,r.translate(f,c),r.rotate(C),u=0,l=0),x){case"top":break;case"center":l+=m/2;break;case"bottom":l+=m;break}var T=e.pstyle("text-background-opacity").value,E=e.pstyle("text-border-opacity").value,S=e.pstyle("text-border-width").pfValue,D=e.pstyle("text-background-padding").pfValue,B=e.pstyle("text-background-shape").strValue,P=B==="round-rectangle"||B==="roundrectangle",A=B==="circle",R=2;if(T>0||S>0&&E>0){var M=r.fillStyle,I=r.strokeStyle,O=r.lineWidth,L=e.pstyle("text-background-color").value,N=e.pstyle("text-border-color").value,_=e.pstyle("text-border-style").value,G=T>0,z=S>0&&E>0,V=u-D;switch(w){case"left":V-=h;break;case"center":V-=h/2;break}var K=l-m-D,j=h+2*D,Q=m+2*D;if(G&&(r.fillStyle="rgba(".concat(L[0],",").concat(L[1],",").concat(L[2],",").concat(T*o,")")),z&&(r.strokeStyle="rgba(".concat(N[0],",").concat(N[1],",").concat(N[2],",").concat(E*o,")"),r.lineWidth=S,r.setLineDash))switch(_){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=S/4,r.setLineDash([]);break;case"solid":default:r.setLineDash([]);break}if(P?(r.beginPath(),_l(r,V,K,j,Q,R)):A?(r.beginPath(),Gy(r,V,K,j,Q)):(r.beginPath(),r.rect(V,K,j,Q)),G&&r.fill(),z&&r.stroke(),z&&_==="double"){var ee=S/2;r.beginPath(),P?_l(r,V+ee,K+ee,j-2*ee,Q-2*ee,R):r.rect(V+ee,K+ee,j-2*ee,Q-2*ee),r.stroke()}r.fillStyle=M,r.strokeStyle=I,r.lineWidth=O,r.setLineDash&&r.setLineDash([])}var te=2*e.pstyle("text-outline-width").pfValue;if(te>0&&(r.lineWidth=te),e.pstyle("text-wrap").value==="wrap"){var ie=Er(s,"labelWrapCachedLines",t),J=Er(s,"labelLineHeight",t),q=h/2,W=this.getLabelJustification(e);switch(W==="auto"||(w==="left"?W==="left"?u+=-h:W==="center"&&(u+=-q):w==="center"?W==="left"?u+=-q:W==="right"&&(u+=q):w==="right"&&(W==="center"?u+=q:W==="right"&&(u+=h))),x){case"top":l-=(ie.length-1)*J;break;case"center":case"bottom":l-=(ie.length-1)*J;break}for(var $=0;$<ie.length;$++)te>0&&r.strokeText(ie[$],u,l),r.fillText(ie[$],u,l),l+=J}else te>0&&r.strokeText(d,u,l),r.fillText(d,u,l);C!==0&&(r.rotate(-C),r.translate(-f,-c))}}};var yt={};yt.drawNode=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,u,l=e._private,f=l.rscratch,c=e.position();if(!(!ne(c.x)||!ne(c.y))&&!(i&&!e.visible())){var d=i?e.effectiveOpacity():1,g=s.usePaths(),h,m=!1,p=e.padding();o=e.width()+2*p,u=e.height()+2*p;var y;t&&(y=t,r.translate(-y.x1,-y.y1));for(var b=e.pstyle("background-image"),w=b.value,x=new Array(w.length),C=new Array(w.length),T=0,E=0;E<w.length;E++){var S=w[E],D=x[E]=S!=null&&S!=="none";if(D){var B=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",E);T++,C[E]=s.getCachedImage(S,B,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var P=e.pstyle("background-blacken").value,A=e.pstyle("border-width").pfValue,R=e.pstyle("background-opacity").value*d,M=e.pstyle("border-color").value,I=e.pstyle("border-style").value,O=e.pstyle("border-join").value,L=e.pstyle("border-cap").value,N=e.pstyle("border-position").value,_=e.pstyle("border-dash-pattern").pfValue,G=e.pstyle("border-dash-offset").pfValue,z=e.pstyle("border-opacity").value*d,V=e.pstyle("outline-width").pfValue,K=e.pstyle("outline-color").value,j=e.pstyle("outline-style").value,Q=e.pstyle("outline-opacity").value*d,ee=e.pstyle("outline-offset").value,te=e.pstyle("corner-radius").value;te!=="auto"&&(te=e.pstyle("corner-radius").pfValue);var ie=v(function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:R;s.eleFillStyle(r,e,k)},"setupShapeColor"),J=v(function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;s.colorStrokeStyle(r,M[0],M[1],M[2],k)},"setupBorderColor"),q=v(function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Q;s.colorStrokeStyle(r,K[0],K[1],K[2],k)},"setupOutlineColor"),W=v(function(k,F,H,U){var X=s.nodePathCache=s.nodePathCache||[],ve=fv(H==="polygon"?H+","+U.join(","):H,""+F,""+k,""+te),re=X[ve],se,ue=!1;return re!=null?(se=re,ue=!0,f.pathCache=se):(se=new Path2D,X[ve]=f.pathCache=se),{path:se,cacheHit:ue}},"getPath"),$=e.pstyle("shape").strValue,Z=e.pstyle("shape-polygon-points").pfValue;if(g){r.translate(c.x,c.y);var ae=W(o,u,$,Z);h=ae.path,m=ae.cacheHit}var de=v(function(){if(!m){var k=c;g&&(k={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(h||r,k.x,k.y,o,u,te,f)}g?r.fill(h):r.fill()},"drawShape"),Pe=v(function(){for(var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,H=l.backgrounding,U=0,X=0;X<C.length;X++){var ve=e.cy().style().getIndexedStyle(e,"background-image-containment","value",X);if(F&&ve==="over"||!F&&ve==="inside"){U++;continue}x[X]&&C[X].complete&&!C[X].error&&(U++,s.drawInscribedImage(r,C[X],e,X,k))}l.backgrounding=U!==T,H!==l.backgrounding&&e.updateStyle(!1)},"drawImages"),xe=v(function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasPie(e)&&(s.drawPie(r,e,F),k&&(g||s.nodeShapes[s.getNodeShape(e)].draw(r,c.x,c.y,o,u,te,f)))},"drawPie"),be=v(function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasStripe(e)&&(r.save(),g?r.clip(f.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(r,c.x,c.y,o,u,te,f),r.clip()),s.drawStripe(r,e,F),r.restore(),k&&(g||s.nodeShapes[s.getNodeShape(e)].draw(r,c.x,c.y,o,u,te,f)))},"drawStripe"),pe=v(function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,F=(P>0?P:-P)*k,H=P>0?0:255;P!==0&&(s.colorFillStyle(r,H,H,H,F),g?r.fill(h):r.fill())},"darken"),oe=v(function(){if(A>0){if(r.lineWidth=A,r.lineCap=L,r.lineJoin=O,r.setLineDash)switch(I){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(_),r.lineDashOffset=G;break;case"solid":case"double":r.setLineDash([]);break}if(N!=="center"){if(r.save(),r.lineWidth*=2,N==="inside")g?r.clip(h):r.clip();else{var k=new Path2D;k.rect(-o/2-A,-u/2-A,o+2*A,u+2*A),k.addPath(h),r.clip(k,"evenodd")}g?r.stroke(h):r.stroke(),r.restore()}else g?r.stroke(h):r.stroke();if(I==="double"){r.lineWidth=A/3;var F=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",g?r.stroke(h):r.stroke(),r.globalCompositeOperation=F}r.setLineDash&&r.setLineDash([])}},"drawBorder"),he=v(function(){if(V>0){if(r.lineWidth=V,r.lineCap="butt",r.setLineDash)switch(j){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var k=c;g&&(k={x:0,y:0});var F=s.getNodeShape(e),H=A;N==="inside"&&(H=0),N==="outside"&&(H*=2);var U=(o+H+(V+ee))/o,X=(u+H+(V+ee))/u,ve=o*U,re=u*X,se=s.nodeShapes[F].points,ue;if(g){var ye=W(ve,re,F,se);ue=ye.path}if(F==="ellipse")s.drawEllipsePath(ue||r,k.x,k.y,ve,re);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(F)){var Ce=0,Te=0,fe=0;F==="round-diamond"?Ce=(H+ee+V)*1.4:F==="round-heptagon"?(Ce=(H+ee+V)*1.075,fe=-(H/2+ee+V)/35):F==="round-hexagon"?Ce=(H+ee+V)*1.12:F==="round-pentagon"?(Ce=(H+ee+V)*1.13,fe=-(H/2+ee+V)/15):F==="round-tag"?(Ce=(H+ee+V)*1.12,Te=(H/2+V+ee)*.07):F==="round-triangle"&&(Ce=(H+ee+V)*(Math.PI/2),fe=-(H+ee/2+V)/Math.PI),Ce!==0&&(U=(o+Ce)/o,ve=o*U,["round-hexagon","round-tag"].includes(F)||(X=(u+Ce)/u,re=u*X)),te=te==="auto"?xv(ve,re):te;for(var De=ve/2,Ae=re/2,nr=te+(H+V+ee)/2,Ke=new Array(se.length/2),Ar=new Array(se.length/2),Xe=0;Xe<se.length/2;Xe++)Ke[Xe]={x:k.x+Te+De*se[Xe*2],y:k.y+fe+Ae*se[Xe*2+1]};var Ze,je,ur,zr,$e=Ke.length;for(je=Ke[$e-1],Ze=0;Ze<$e;Ze++)ur=Ke[Ze%$e],zr=Ke[(Ze+1)%$e],Ar[Ze]=go(je,ur,zr,nr),je=ur,ur=zr;s.drawRoundPolygonPath(ue||r,k.x+Te,k.y+fe,o*U,u*X,se,Ar)}else if(["roundrectangle","round-rectangle"].includes(F))te=te==="auto"?vt(ve,re):te,s.drawRoundRectanglePath(ue||r,k.x,k.y,ve,re,te+(H+V+ee)/2);else if(["cutrectangle","cut-rectangle"].includes(F))te=te==="auto"?ao():te,s.drawCutRectanglePath(ue||r,k.x,k.y,ve,re,null,te+(H+V+ee)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(F))te=te==="auto"?vt(ve,re):te,s.drawBottomRoundRectanglePath(ue||r,k.x,k.y,ve,re,te+(H+V+ee)/2);else if(F==="barrel")s.drawBarrelPath(ue||r,k.x,k.y,ve,re);else if(F.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(F)){var $r=(H+V+ee)/o;se=xn(En(se,$r)),s.drawPolygonPath(ue||r,k.x,k.y,o,u,se)}else{var Rr=(H+V+ee)/o;se=xn(En(se,-Rr)),s.drawPolygonPath(ue||r,k.x,k.y,o,u,se)}if(g?r.stroke(ue):r.stroke(),j==="double"){r.lineWidth=H/3;var jr=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",g?r.stroke(ue):r.stroke(),r.globalCompositeOperation=jr}r.setLineDash&&r.setLineDash([])}},"drawOutline"),ce=v(function(){n&&s.drawNodeOverlay(r,e,c,o,u)},"drawOverlay"),Ee=v(function(){n&&s.drawNodeUnderlay(r,e,c,o,u)},"drawUnderlay"),we=v(function(){s.drawElementText(r,e,null,a)},"drawText"),ke=e.pstyle("ghost").value==="yes";if(ke){var Be=e.pstyle("ghost-offset-x").pfValue,Ne=e.pstyle("ghost-offset-y").pfValue,Ie=e.pstyle("ghost-opacity").value,Re=Ie*d;r.translate(Be,Ne),q(),he(),ie(Ie*R),de(),Pe(Re,!0),J(Ie*z),oe(),xe(P!==0||A!==0),be(P!==0||A!==0),Pe(Re,!1),pe(Re),r.translate(-Be,-Ne)}g&&r.translate(-c.x,-c.y),Ee(),g&&r.translate(c.x,c.y),q(),he(),ie(),de(),Pe(d,!0),J(),oe(),xe(P!==0||A!==0),be(P!==0||A!==0),Pe(d,!1),pe(),g&&r.translate(-c.x,-c.y),we(),ce(),t&&r.translate(y.x1,y.y1)}};var Pf=v(function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a,n,i,s){var o=this;if(a.visible()){var u=a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,c=a.pstyle("".concat(e,"-shape")).value,d=a.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(n=n||a.position(),i==null||s==null){var g=a.padding();i=a.width()+2*g,s=a.height()+2*g}o.colorFillStyle(t,f[0],f[1],f[2],l),o.nodeShapes[c].draw(t,n.x,n.y,i+u*2,s+u*2,d),t.fill()}}}},"drawNodeOverlayUnderlay");yt.drawNodeOverlay=Pf("overlay");yt.drawNodeUnderlay=Pf("underlay");yt.hasPie=function(r){return r=r[0],r._private.hasPie};yt.hasStripe=function(r){return r=r[0],r._private.hasStripe};yt.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),o=e.pstyle("pie-start-angle").pfValue,u=a.x,l=a.y,f=e.width(),c=e.height(),d=Math.min(f,c)/2,g,h=0,m=this.usePaths();if(m&&(u=0,l=0),i.units==="%"?d=d*i.pfValue:i.pfValue!==void 0&&(d=i.pfValue/2),s.units==="%"?g=d*s.pfValue:s.pfValue!==void 0&&(g=s.pfValue/2),!(g>=d))for(var p=1;p<=n.pieBackgroundN;p++){var y=e.pstyle("pie-"+p+"-background-size").value,b=e.pstyle("pie-"+p+"-background-color").value,w=e.pstyle("pie-"+p+"-background-opacity").value*t,x=y/100;x+h>1&&(x=1-h);var C=1.5*Math.PI+2*Math.PI*h;C+=o;var T=2*Math.PI*x,E=C+T;y===0||h>=1||h+x>1||(g===0?(r.beginPath(),r.moveTo(u,l),r.arc(u,l,d,C,E),r.closePath()):(r.beginPath(),r.arc(u,l,d,C,E),r.arc(u,l,g,E,C,!0),r.closePath()),this.colorFillStyle(r,b[0],b[1],b[2],w),r.fill(),h+=x)}};yt.drawStripe=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,s=a.y,o=e.width(),u=e.height(),l=0,f=this.usePaths();r.save();var c=e.pstyle("stripe-direction").value,d=e.pstyle("stripe-size");switch(c){case"vertical":break;case"righward":r.rotate(-Math.PI/2);break}var g=o,h=u;d.units==="%"?(g=g*d.pfValue,h=h*d.pfValue):d.pfValue!==void 0&&(g=d.pfValue,h=d.pfValue),f&&(i=0,s=0),s-=g/2,i-=h/2;for(var m=1;m<=n.stripeBackgroundN;m++){var p=e.pstyle("stripe-"+m+"-background-size").value,y=e.pstyle("stripe-"+m+"-background-color").value,b=e.pstyle("stripe-"+m+"-background-opacity").value*t,w=p/100;w+l>1&&(w=1-l),!(p===0||l>=1||l+w>1)&&(r.beginPath(),r.rect(i,s+h*l,g,h*w),r.closePath(),this.colorFillStyle(r,y[0],y[1],y[2],b),r.fill(),l+=w)}r.restore()};var br={},Hy=100;br.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};br.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===r){t=!1;break}return t&&(a={context:r},e.push(a)),a};br.createGradientStyleFor=function(r,e,t,a,n){var i,s=this.usePaths(),o=t.pstyle(e+"-gradient-stop-colors").value,u=t.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(t.isEdge()){var l=t.sourceEndpoint(),f=t.targetEndpoint(),c=t.midpoint(),d=Pt(l,c),g=Pt(f,c);i=r.createRadialGradient(c.x,c.y,0,c.x,c.y,Math.max(d,g))}else{var h=s?{x:0,y:0}:t.position(),m=t.paddedWidth(),p=t.paddedHeight();i=r.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(m,p))}else if(t.isEdge()){var y=t.sourceEndpoint(),b=t.targetEndpoint();i=r.createLinearGradient(y.x,y.y,b.x,b.y)}else{var w=s?{x:0,y:0}:t.position(),x=t.paddedWidth(),C=t.paddedHeight(),T=x/2,E=C/2,S=t.pstyle("background-gradient-direction").value;switch(S){case"to-bottom":i=r.createLinearGradient(w.x,w.y-E,w.x,w.y+E);break;case"to-top":i=r.createLinearGradient(w.x,w.y+E,w.x,w.y-E);break;case"to-left":i=r.createLinearGradient(w.x+T,w.y,w.x-T,w.y);break;case"to-right":i=r.createLinearGradient(w.x-T,w.y,w.x+T,w.y);break;case"to-bottom-right":case"to-right-bottom":i=r.createLinearGradient(w.x-T,w.y-E,w.x+T,w.y+E);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(w.x-T,w.y+E,w.x+T,w.y-E);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(w.x+T,w.y-E,w.x-T,w.y+E);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(w.x+T,w.y+E,w.x-T,w.y-E);break}}if(!i)return null;for(var D=u.length===o.length,B=o.length,P=0;P<B;P++)i.addColorStop(D?u[P]:P/(B-1),"rgba("+o[P][0]+","+o[P][1]+","+o[P][2]+","+n+")");return i};br.gradientFillStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"background",e,t,a);if(!n)return null;r.fillStyle=n};br.colorFillStyle=function(r,e,t,a,n){r.fillStyle="rgba("+e+","+t+","+a+","+n+")"};br.eleFillStyle=function(r,e,t){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(r,e,a,t);else{var n=e.pstyle("background-color").value;this.colorFillStyle(r,n[0],n[1],n[2],t)}};br.gradientStrokeStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"line",e,t,a);if(!n)return null;r.strokeStyle=n};br.colorStrokeStyle=function(r,e,t,a,n){r.strokeStyle="rgba("+e+","+t+","+a+","+n+")"};br.eleStrokeStyle=function(r,e,t){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(r,e,a,t);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(r,n[0],n[1],n[2],t)}};br.matchCanvasSize=function(r){var e=this,t=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],s=e.getPixelRatio(),o=e.motionBlurPxRatio;(r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var u=n*s,l=i*s,f;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var c=t.canvasContainer;c.style.width=n+"px",c.style.height=i+"px";for(var d=0;d<e.CANVAS_LAYERS;d++)f=t.canvases[d],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";for(var d=0;d<e.BUFFER_COUNT;d++)f=t.bufferCanvases[d],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,s<=1&&(f=t.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=u*e.textureMult,f.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=s}};br.renderTo=function(r,e,t,a){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:a})};br.clearCanvas=function(){var r=this,e=r.data;function t(a){a.clearRect(0,0,r.canvasWidth,r.canvasHeight)}v(t,"clear"),t(e.contexts[r.NODE]),t(e.contexts[r.DRAG])};br.render=function(r){var e=this;r=r||gv();var t=e.cy,a=r.forcedContext,n=r.drawAllLayers,i=r.drawOnlyNodeLayer,s=r.forcedZoom,o=r.forcedPan,u=r.forcedPxRatio===void 0?this.getPixelRatio():r.forcedPxRatio,l=e.data,f=l.canvasNeedsRedraw,c=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),d=r.motionBlur!==void 0?r.motionBlur:e.motionBlur,g=e.motionBlurPxRatio,h=t.hasCompoundNodes(),m=e.hoverData.draggingEles,p=!!(e.hoverData.selecting||e.touchData.selecting);d=d&&!a&&e.motionBlurEnabled&&!p;var y=d;a||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),d&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(y=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!c&&(f[e.NODE]=!0,f[e.SELECT_BOX]=!0);var b=t.style(),w=t.zoom(),x=s!==void 0?s:w,C=t.pan(),T={x:C.x,y:C.y},E={zoom:w,pan:{x:C.x,y:C.y}},S=e.prevViewport,D=S===void 0||E.zoom!==S.zoom||E.pan.x!==S.pan.x||E.pan.y!==S.pan.y;!D&&!(m&&!h)&&(e.motionBlurPxRatio=1),o&&(T=o),x*=u,T.x*=u,T.y*=u;var B=e.getCachedZSortedEles();function P(J,q,W,$,Z){var ae=J.globalCompositeOperation;J.globalCompositeOperation="destination-out",e.colorFillStyle(J,255,255,255,e.motionBlurTransparency),J.fillRect(q,W,$,Z),J.globalCompositeOperation=ae}v(P,"mbclear");function A(J,q){var W,$,Z,ae;!e.clearingMotionBlur&&(J===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||J===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(W={x:C.x*g,y:C.y*g},$=w*g,Z=e.canvasWidth*g,ae=e.canvasHeight*g):(W=T,$=x,Z=e.canvasWidth,ae=e.canvasHeight),J.setTransform(1,0,0,1,0,0),q==="motionBlur"?P(J,0,0,Z,ae):!a&&(q===void 0||q)&&J.clearRect(0,0,Z,ae),n||(J.translate(W.x,W.y),J.scale($,$)),o&&J.translate(o.x,o.y),s&&J.scale(s,s)}if(v(A,"setContextTransform"),c||(e.textureDrawLastFrame=!1),c){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=t.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var R=e.data.bufferContexts[e.TEXTURE_BUFFER];R.setTransform(1,0,0,1,0,0),R.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:R,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var E=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight};E.mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}f[e.DRAG]=!1,f[e.NODE]=!1;var M=l.contexts[e.NODE],I=e.textureCache.texture,E=e.textureCache.viewport;M.setTransform(1,0,0,1,0,0),d?P(M,0,0,E.width,E.height):M.clearRect(0,0,E.width,E.height);var O=b.core("outside-texture-bg-color").value,L=b.core("outside-texture-bg-opacity").value;e.colorFillStyle(M,O[0],O[1],O[2],L),M.fillRect(0,0,E.width,E.height);var w=t.zoom();A(M,!1),M.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/u,E.height/E.zoom/u),M.drawImage(I,E.mpan.x,E.mpan.y,E.width/E.zoom/u,E.height/E.zoom/u)}else e.textureOnViewport&&!a&&(e.textureCache=null);var N=t.extent(),_=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),G=e.hideEdgesOnViewport&&_,z=[];if(z[e.NODE]=!f[e.NODE]&&d&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,z[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),z[e.DRAG]=!f[e.DRAG]&&d&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,z[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),f[e.NODE]||n||i||z[e.NODE]){var V=d&&!z[e.NODE]&&g!==1,M=a||(V?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),K=d&&!V?"motionBlur":void 0;A(M,K),G?e.drawCachedNodes(M,B.nondrag,u,N):e.drawLayeredElements(M,B.nondrag,u,N),e.debug&&e.drawDebugPoints(M,B.nondrag),!n&&!d&&(f[e.NODE]=!1)}if(!i&&(f[e.DRAG]||n||z[e.DRAG])){var V=d&&!z[e.DRAG]&&g!==1,M=a||(V?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);A(M,d&&!V?"motionBlur":void 0),G?e.drawCachedNodes(M,B.drag,u,N):e.drawCachedElements(M,B.drag,u,N),e.debug&&e.drawDebugPoints(M,B.drag),!n&&!d&&(f[e.DRAG]=!1)}if(this.drawSelectionRectangle(r,A),d&&g!==1){var j=l.contexts[e.NODE],Q=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],ee=l.contexts[e.DRAG],te=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],ie=v(function(q,W,$){q.setTransform(1,0,0,1,0,0),$||!y?q.clearRect(0,0,e.canvasWidth,e.canvasHeight):P(q,0,0,e.canvasWidth,e.canvasHeight);var Z=g;q.drawImage(W,0,0,e.canvasWidth*Z,e.canvasHeight*Z,0,0,e.canvasWidth,e.canvasHeight)},"drawMotionBlur");(f[e.NODE]||z[e.NODE])&&(ie(j,Q,z[e.NODE]),f[e.NODE]=!1),(f[e.DRAG]||z[e.DRAG])&&(ie(ee,te,z[e.DRAG]),f[e.DRAG]=!1)}e.prevViewport=E,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),d&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!c,e.mbFrames=0,f[e.NODE]=!0,f[e.DRAG]=!0,e.redraw()},Hy)),a||t.emit("render")};var da;br.drawSelectionRectangle=function(r,e){var t=this,a=t.cy,n=t.data,i=a.style(),s=r.drawOnlyNodeLayer,o=r.drawAllLayers,u=n.canvasNeedsRedraw,l=r.forcedContext;if(t.showFps||!s&&u[t.SELECT_BOX]&&!o){var f=l||n.contexts[t.SELECT_BOX];if(e(f),t.selection[4]==1&&(t.hoverData.selecting||t.touchData.selecting)){var c=t.cy.zoom(),d=i.core("selection-box-border-width").value/c;f.lineWidth=d,f.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",f.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),d>0&&(f.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",f.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(n.bgActivePosistion&&!t.hoverData.selecting){var c=t.cy.zoom(),g=n.bgActivePosistion;f.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",f.beginPath(),f.arc(g.x,g.y,i.core("active-bg-size").pfValue/c,0,2*Math.PI),f.fill()}var h=t.lastRedrawTime;if(t.showFps&&h){h=Math.round(h);var m=Math.round(1e3/h),p="1 frame = "+h+" ms = "+m+" fps";if(f.setTransform(1,0,0,1,0,0),f.fillStyle="rgba(255, 0, 0, 0.75)",f.strokeStyle="rgba(255, 0, 0, 0.75)",f.font="30px Arial",!da){var y=f.measureText(p);da=y.actualBoundingBoxAscent}f.fillText(p,0,da);var b=60;f.strokeRect(0,da+10,250,20),f.fillRect(0,da+10,250*Math.min(m/b,1),20)}o||(u[t.SELECT_BOX]=!1)}};function Gl(r,e,t){var a=r.createShader(e);if(r.shaderSource(a,t),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(a));return a}v(Gl,"compileShader");function Wy(r,e,t){var a=Gl(r,r.VERTEX_SHADER,e),n=Gl(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,a),r.attachShader(i,n),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}v(Wy,"createProgram");function $y(r,e,t){t===void 0&&(t=e);var a=r.makeOffscreenCanvas(e,t),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}v($y,"createTextureCanvas");function mo(r){var e=r.pixelRatio,t=r.cy.zoom(),a=r.cy.pan();return{zoom:t*e,pan:{x:a.x*e,y:a.y*e}}}v(mo,"getEffectivePanZoom");function Uy(r){var e=r.pixelRatio,t=r.cy.zoom();return t*e}v(Uy,"getEffectiveZoom");function Ky(r,e,t,a,n){var i=a*t+e.x,s=n*t+e.y;return s=Math.round(r.canvasHeight-s),[i,s]}v(Ky,"modelToRenderedPosition");function Xy(r,e){return e.picking?!0:r.pstyle("background-fill").value!=="solid"||r.pstyle("background-image").strValue!=="none"?!1:r.pstyle("border-width").value===0||r.pstyle("border-opacity").value===0?!0:r.pstyle("border-style").value==="solid"}v(Xy,"isSimpleShape");function Yy(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}v(Yy,"arrayEqual");function xt(r,e,t){var a=r[0]/255,n=r[1]/255,i=r[2]/255,s=e,o=t||new Array(4);return o[0]=a*s,o[1]=n*s,o[2]=i*s,o[3]=s,o}v(xt,"toWebGLColor");function qt(r,e){var t=e||new Array(4);return t[0]=(r>>0&255)/255,t[1]=(r>>8&255)/255,t[2]=(r>>16&255)/255,t[3]=(r>>24&255)/255,t}v(qt,"indexToVec4");function Zy(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}v(Zy,"vec4ToIndex");function Qy(r,e){var t=r.createTexture();return t.buffer=function(a){r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,a),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}v(Qy,"createTexture");function Af(r,e){switch(e){case"float":return[1,r.FLOAT,4];case"vec2":return[2,r.FLOAT,4];case"vec3":return[3,r.FLOAT,4];case"vec4":return[4,r.FLOAT,4];case"int":return[1,r.INT,4];case"ivec2":return[2,r.INT,4]}}v(Af,"getTypeInfo");function Rf(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}v(Rf,"createTypedArray");function Jy(r,e,t,a,n,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*a,n);case r.INT:return new Int32Array(t.buffer,i*a,n)}}v(Jy,"createTypedArrayView");function jy(r,e,t,a){var n=Af(r,e),i=Je(n,2),s=i[0],o=i[1],u=Rf(r,o,a),l=r.createBuffer();return r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,u,r.STATIC_DRAW),o===r.FLOAT?r.vertexAttribPointer(t,s,o,!1,0,0):o===r.INT&&r.vertexAttribIPointer(t,s,o,0,0),r.enableVertexAttribArray(t),r.bindBuffer(r.ARRAY_BUFFER,null),l}v(jy,"createBufferStaticDraw");function Vr(r,e,t,a){var n=Af(r,t),i=Je(n,3),s=i[0],o=i[1],u=i[2],l=Rf(r,o,e*s),f=s*u,c=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,c),r.bufferData(r.ARRAY_BUFFER,e*f,r.DYNAMIC_DRAW),r.enableVertexAttribArray(a),o===r.FLOAT?r.vertexAttribPointer(a,s,o,!1,f,0):o===r.INT&&r.vertexAttribIPointer(a,s,o,f,0),r.vertexAttribDivisor(a,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var d=new Array(e),g=0;g<e;g++)d[g]=Jy(r,o,l,f,s,g);return c.dataArray=l,c.stride=f,c.size=s,c.getView=function(h){return d[h]},c.setPoint=function(h,m,p){var y=d[h];y[0]=m,y[1]=p},c.bufferSubData=function(h){r.bindBuffer(r.ARRAY_BUFFER,c),h?r.bufferSubData(r.ARRAY_BUFFER,0,l,0,h*s):r.bufferSubData(r.ARRAY_BUFFER,0,l)},c}v(Vr,"createBufferDynamicDraw");function em(r,e,t){for(var a=9,n=new Float32Array(e*a),i=new Array(e),s=0;s<e;s++){var o=s*a*4;i[s]=new Float32Array(n.buffer,o,a)}var u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,n.byteLength,r.DYNAMIC_DRAW);for(var l=0;l<3;l++){var f=t+l;r.enableVertexAttribArray(f),r.vertexAttribPointer(f,3,r.FLOAT,!1,36,l*12),r.vertexAttribDivisor(f,1)}return r.bindBuffer(r.ARRAY_BUFFER,null),u.getMatrixView=function(c){return i[c]},u.setData=function(c,d){i[d].set(c,0)},u.bufferSubData=function(){r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferSubData(r.ARRAY_BUFFER,0,n)},u}v(em,"create3x3MatrixBufferDynamicDraw");function rm(r){var e=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,e);var t=r.createTexture();return r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),r.bindFramebuffer(r.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,n){r.bindTexture(r.TEXTURE_2D,t),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,a,n,0,r.RGBA,r.UNSIGNED_BYTE,null)},e}v(rm,"createPickingFrameBuffer");var Hl=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});function xs(){var r=new Hl(9);return Hl!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}v(xs,"create");function Wl(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}v(Wl,"identity");function tm(r,e,t){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],u=e[5],l=e[6],f=e[7],c=e[8],d=t[0],g=t[1],h=t[2],m=t[3],p=t[4],y=t[5],b=t[6],w=t[7],x=t[8];return r[0]=d*a+g*s+h*l,r[1]=d*n+g*o+h*f,r[2]=d*i+g*u+h*c,r[3]=m*a+p*s+y*l,r[4]=m*n+p*o+y*f,r[5]=m*i+p*u+y*c,r[6]=b*a+w*s+x*l,r[7]=b*n+w*o+x*f,r[8]=b*i+w*u+x*c,r}v(tm,"multiply");function pn(r,e,t){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],u=e[5],l=e[6],f=e[7],c=e[8],d=t[0],g=t[1];return r[0]=a,r[1]=n,r[2]=i,r[3]=s,r[4]=o,r[5]=u,r[6]=d*a+g*s+l,r[7]=d*n+g*o+f,r[8]=d*i+g*u+c,r}v(pn,"translate");function $l(r,e,t){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],u=e[5],l=e[6],f=e[7],c=e[8],d=Math.sin(t),g=Math.cos(t);return r[0]=g*a+d*s,r[1]=g*n+d*o,r[2]=g*i+d*u,r[3]=g*s-d*a,r[4]=g*o-d*n,r[5]=g*u-d*i,r[6]=l,r[7]=f,r[8]=c,r}v($l,"rotate");function Hs(r,e,t){var a=t[0],n=t[1];return r[0]=a*e[0],r[1]=a*e[1],r[2]=a*e[2],r[3]=n*e[3],r[4]=n*e[4],r[5]=n*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}v(Hs,"scale");function am(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}v(am,"projection");var nm=(function(){function r(e,t,a,n){ht(this,r),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=t,this.texRows=a,this.texHeight=Math.floor(t/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=n(e,t,t),this.scratch=n(e,t,this.texHeight,"scratch")}return v(r,"Atlas"),gt(r,[{key:"lock",value:v(function(){this.locked=!0},"lock")},{key:"getKeys",value:v(function(){return new Set(this.keyToLocation.keys())},"getKeys")},{key:"getScale",value:v(function(t){var a=t.w,n=t.h,i=this.texHeight,s=this.texSize,o=i/n,u=a*o,l=n*o;return u>s&&(o=s/a,u=a*o,l=n*o),{scale:o,texW:u,texH:l}},"getScale")},{key:"draw",value:v(function(t,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,u=this.texHeight,l=this.getScale(a),f=l.scale,c=l.texW,d=l.texH,g=v(function(w,x){if(n&&x){var C=x.context,T=w.x,E=w.row,S=T,D=u*E;C.save(),C.translate(S,D),C.scale(f,f),n(C,a),C.restore()}},"drawAt"),h=[null,null],m=v(function(){g(i.freePointer,i.canvas),h[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:c,h:d},h[1]={x:i.freePointer.x+c,y:i.freePointer.row*u,w:0,h:d},i.freePointer.x+=c,i.freePointer.x==s&&(i.freePointer.x=0,i.freePointer.row++)},"drawNormal"),p=v(function(){var w=i.scratch,x=i.canvas;w.clear(),g({x:0,row:0},w);var C=s-i.freePointer.x,T=c-C,E=u;{var S=i.freePointer.x,D=i.freePointer.row*u,B=C;x.context.drawImage(w,0,0,B,E,S,D,B,E),h[0]={x:S,y:D,w:B,h:d}}{var P=C,A=(i.freePointer.row+1)*u,R=T;x&&x.context.drawImage(w,P,0,R,E,0,A,R,E),h[1]={x:0,y:A,w:R,h:d}}i.freePointer.x=T,i.freePointer.row++},"drawWrapped"),y=v(function(){i.freePointer.x=0,i.freePointer.row++},"moveToStartOfNextRow");if(this.freePointer.x+c<=s)m();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(y(),m()):this.enableWrapping?p():(y(),m())}return this.keyToLocation.set(t,h),this.needsBuffer=!0,h},"draw")},{key:"getOffsets",value:v(function(t){return this.keyToLocation.get(t)},"getOffsets")},{key:"isEmpty",value:v(function(){return this.freePointer.x===0&&this.freePointer.row===0},"isEmpty")},{key:"canFit",value:v(function(t){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(t),s=i.texW;return this.freePointer.x+s>a?this.freePointer.row<n-1:!0},"canFit")},{key:"bufferIfNeeded",value:v(function(t){this.texture||(this.texture=Qy(t,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))},"bufferIfNeeded")},{key:"dispose",value:v(function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0},"dispose")}])})(),im=(function(){function r(e,t,a,n){ht(this,r),this.r=e,this.texSize=t,this.texRows=a,this.createTextureCanvas=n,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return v(r,"AtlasCollection"),gt(r,[{key:"getKeys",value:v(function(){return new Set(this.styleKeyToAtlas.keys())},"getKeys")},{key:"_createAtlas",value:v(function(){var t=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new nm(t,a,n,i)},"_createAtlas")},{key:"_getScratchCanvas",value:v(function(){if(!this.scratch){var t=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas,s=Math.floor(a/n);this.scratch=i(t,a,s,"scratch")}return this.scratch},"_getScratchCanvas")},{key:"draw",value:v(function(t,a,n){var i=this.styleKeyToAtlas.get(t);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(a))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(t,a,n),this.styleKeyToAtlas.set(t,i)),i},"draw")},{key:"getAtlas",value:v(function(t){return this.styleKeyToAtlas.get(t)},"getAtlas")},{key:"hasAtlas",value:v(function(t){return this.styleKeyToAtlas.has(t)},"hasAtlas")},{key:"markKeyForGC",value:v(function(t){this.markedKeys.add(t)},"markKeyForGC")},{key:"gc",value:v(function(){var t=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var n=[],i=new Map,s=null,o=Tr(this.atlases),u;try{var l=v(function(){var c=u.value,d=c.getKeys(),g=sm(a,d);if(g.size===0)return n.push(c),d.forEach(function(C){return i.set(C,c)}),1;s||(s=t._createAtlas(),n.push(s));var h=Tr(d),m;try{for(h.s();!(m=h.n()).done;){var p=m.value;if(!g.has(p)){var y=c.getOffsets(p),b=Je(y,2),w=b[0],x=b[1];s.canFit({w:w.w+x.w,h:w.h})||(s.lock(),s=t._createAtlas(),n.push(s)),c.canvas&&(t._copyTextureToNewAtlas(p,c,s),i.set(p,s))}}}catch(C){h.e(C)}finally{h.f()}c.dispose()},"_loop");for(o.s();!(u=o.n()).done;)l()}catch(f){o.e(f)}finally{o.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set},"gc")},{key:"_copyTextureToNewAtlas",value:v(function(t,a,n){var i=a.getOffsets(t),s=Je(i,2),o=s[0],u=s[1];if(u.w===0)n.draw(t,o,function(d){d.drawImage(a.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(a.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),l.context.drawImage(a.canvas,u.x,u.y,u.w,u.h,o.w,0,u.w,u.h);var f=o.w+u.w,c=o.h;n.draw(t,{w:f,h:c},function(d){d.drawImage(l,0,0,f,c,0,0,f,c)})}},"_copyTextureToNewAtlas")},{key:"getCounts",value:v(function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}},"getCounts")}])})();function sm(r,e){return r.intersection?r.intersection(e):new Set(yn(r).filter(function(t){return e.has(t)}))}v(sm,"intersection");var om=(function(){function r(e,t){ht(this,r),this.r=e,this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return v(r,"AtlasManager"),gt(r,[{key:"getAtlasSize",value:v(function(){return this.atlasSize},"getAtlasSize")},{key:"addAtlasCollection",value:v(function(t,a){var n=this.globalOptions,i=n.webglTexSize,s=n.createTextureCanvas,o=a.texRows,u=this._cacheScratchCanvas(s),l=new im(this.r,i,o,u);this.collections.set(t,l)},"addAtlasCollection")},{key:"addRenderType",value:v(function(t,a){var n=a.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var i=this.collections.get(n),s=me({type:t,atlasCollection:i},a);this.renderTypes.set(t,s)},"addRenderType")},{key:"getRenderTypeOpts",value:v(function(t){return this.renderTypes.get(t)},"getRenderTypeOpts")},{key:"getAtlasCollection",value:v(function(t){return this.collections.get(t)},"getAtlasCollection")},{key:"_cacheScratchCanvas",value:v(function(t){var a=-1,n=-1,i=null;return function(s,o,u,l){return l?((!i||o!=a||u!=n)&&(a=o,n=u,i=t(s,o,u)),i):t(s,o,u)}},"_cacheScratchCanvas")},{key:"_key",value:v(function(t,a){return"".concat(t,"-").concat(a)},"_key")},{key:"invalidate",value:v(function(t){var a=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,s=i===void 0?!1:i,o=n.filterEle,u=o===void 0?function(){return!0}:o,l=n.filterType,f=l===void 0?function(){return!0}:l,c=!1,d=!1,g=Tr(t),h;try{for(g.s();!(h=g.n()).done;){var m=h.value;if(u(m)){var p=Tr(this.renderTypes.values()),y;try{var b=v(function(){var x=y.value,C=x.type;if(f(C)){var T=a.collections.get(x.collection),E=x.getKey(m),S=Array.isArray(E)?E:[E];if(s)S.forEach(function(A){return T.markKeyForGC(A)}),d=!0;else{var D=x.getID?x.getID(m):m.id(),B=a._key(C,D),P=a.typeAndIdToKey.get(B);P!==void 0&&!Yy(S,P)&&(c=!0,a.typeAndIdToKey.delete(B),P.forEach(function(A){return T.markKeyForGC(A)}))}}},"_loop2");for(p.s();!(y=p.n()).done;)b()}catch(w){p.e(w)}finally{p.f()}}}}catch(w){g.e(w)}finally{g.f()}return d&&(this.gc(),c=!1),c},"invalidate")},{key:"gc",value:v(function(){var t=Tr(this.collections.values()),a;try{for(t.s();!(a=t.n()).done;){var n=a.value;n.gc()}}catch(i){t.e(i)}finally{t.f()}},"gc")},{key:"getOrCreateAtlas",value:v(function(t,a,n,i){var s=this.renderTypes.get(a),o=this.collections.get(s.collection),u=!1,l=o.draw(i,n,function(d){s.drawClipped?(d.save(),d.beginPath(),d.rect(0,0,n.w,n.h),d.clip(),s.drawElement(d,t,n,!0,!0),d.restore()):s.drawElement(d,t,n,!0,!0),u=!0});if(u){var f=s.getID?s.getID(t):t.id(),c=this._key(a,f);this.typeAndIdToKey.has(c)?this.typeAndIdToKey.get(c).push(i):this.typeAndIdToKey.set(c,[i])}return l},"getOrCreateAtlas")},{key:"getAtlasInfo",value:v(function(t,a){var n=this,i=this.renderTypes.get(a),s=i.getKey(t),o=Array.isArray(s)?s:[s];return o.map(function(u){var l=i.getBoundingBox(t,u),f=n.getOrCreateAtlas(t,a,l,u),c=f.getOffsets(u),d=Je(c,2),g=d[0],h=d[1];return{atlas:f,tex:g,tex1:g,tex2:h,bb:l}})},"getAtlasInfo")},{key:"getDebugInfo",value:v(function(){var t=[],a=Tr(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=Je(n.value,2),s=i[0],o=i[1],u=o.getCounts(),l=u.keyCount,f=u.atlasCount;t.push({type:s,keyCount:l,atlasCount:f})}}catch(c){a.e(c)}finally{a.f()}return t},"getDebugInfo")}])})(),um=(function(){function r(e){ht(this,r),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return v(r,"AtlasBatchManager"),gt(r,[{key:"getMaxAtlasesPerBatch",value:v(function(){return this.maxAtlasesPerBatch},"getMaxAtlasesPerBatch")},{key:"getAtlasSize",value:v(function(){return this.atlasSize},"getAtlasSize")},{key:"getIndexArray",value:v(function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,a){return a})},"getIndexArray")},{key:"startBatch",value:v(function(){this.batchAtlases=[]},"startBatch")},{key:"getAtlasCount",value:v(function(){return this.batchAtlases.length},"getAtlasCount")},{key:"getAtlases",value:v(function(){return this.batchAtlases},"getAtlases")},{key:"canAddToCurrentBatch",value:v(function(t){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(t):!0},"canAddToCurrentBatch")},{key:"getAtlasIndexForBatch",value:v(function(t){var a=this.batchAtlases.indexOf(t);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),a=this.batchAtlases.length-1}return a},"getAtlasIndexForBatch")}])})(),lm=`
float circleSD(vec2 p, float r) {
return distance(vec2(0), p) - r; // signed distance
}
`,vm=`
float rectangleSD(vec2 p, vec2 b) {
vec2 d = abs(p)-b;
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
}
`,fm=`
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
cr.x = (p.y > 0.0) ? cr.x : cr.y;
vec2 q = abs(p) - b + cr.x;
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
}
`,cm=`
float ellipseSD(vec2 p, vec2 ab) {
p = abs( p ); // symmetry
// find root with Newton solver
vec2 q = ab*(p-ab);
float w = (q.x<q.y)? 1.570796327 : 0.0;
for( int i=0; i<5; i++ ) {
vec2 cs = vec2(cos(w),sin(w));
vec2 u = ab*vec2( cs.x,cs.y);
vec2 v = ab*vec2(-cs.y,cs.x);
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
}
// compute final point and distance
float d = length(p-ab*vec2(cos(w),sin(w)));
// return signed distance
return (dot(p/ab,p/ab)>1.0) ? d : -d;
}
`,xa={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Pn={IGNORE:1,USE_BB:2},Es=0,Ul=1,Kl=2,Cs=3,_t=4,nn=5,ha=6,ga=7,dm=(function(){function r(e,t,a){ht(this,r),this.r=e,this.gl=t,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=$y,this.atlasManager=new om(e,a),this.batchManager=new um(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(xa.SCREEN),this.pickingProgram=this._createShaderProgram(xa.PICKING),this.vao=this._createVAO()}return v(r,"ElementDrawingWebGL"),gt(r,[{key:"addAtlasCollection",value:v(function(t,a){this.atlasManager.addAtlasCollection(t,a)},"addAtlasCollection")},{key:"addTextureAtlasRenderType",value:v(function(t,a){this.atlasManager.addRenderType(t,a)},"addTextureAtlasRenderType")},{key:"addSimpleShapeRenderType",value:v(function(t,a){this.simpleShapeOptions.set(t,a)},"addSimpleShapeRenderType")},{key:"invalidate",value:v(function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(t,{filterType:v(function(o){return o===n},"filterType"),forceRedraw:!0}):i.invalidate(t)},"invalidate")},{key:"gc",value:v(function(){this.atlasManager.gc()},"gc")},{key:"_createShaderProgram",value:v(function(t){var a=this.gl,n=`#version 300 es
precision highp float;
uniform mat3 uPanZoomMatrix;
uniform int uAtlasSize;
// instanced
in vec2 aPosition; // a vertex from the unit square
in mat3 aTransform; // used to transform verticies, eg into a bounding box
in int aVertType; // the type of thing we are rendering
// the z-index that is output when using picking mode
in vec4 aIndex;
// For textures
in int aAtlasId; // which shader unit/atlas to use
in vec4 aTex; // x/y/w/h of texture in atlas
// for edges
in vec4 aPointAPointB;
in vec4 aPointCPointD;
in vec2 aLineWidth; // also used for node border width
// simple shapes
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
in vec4 aColor; // also used for edges
in vec4 aBorderColor; // aLineWidth is used for border width
// output values passed to the fragment shader
out vec2 vTexCoord;
out vec4 vColor;
out vec2 vPosition;
// flat values are not interpolated
flat out int vAtlasId;
flat out int vVertType;
flat out vec2 vTopRight;
flat out vec2 vBotLeft;
flat out vec4 vCornerRadius;
flat out vec4 vBorderColor;
flat out vec2 vBorderWidth;
flat out vec4 vIndex;
void main(void) {
int vid = gl_VertexID;
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
if(aVertType == `.concat(Es,`) {
float texX = aTex.x; // texture coordinates
float texY = aTex.y;
float texW = aTex.z;
float texH = aTex.w;
if(vid == 1 || vid == 2 || vid == 4) {
texX += texW;
}
if(vid == 2 || vid == 4 || vid == 5) {
texY += texH;
}
float d = float(uAtlasSize);
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
}
else if(aVertType == `).concat(_t," || aVertType == ").concat(ga,`
|| aVertType == `).concat(nn," || aVertType == ").concat(ha,`) { // simple shapes
// the bounding box is needed by the fragment shader
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
// calculations are done in the fragment shader, just pass these along
vColor = aColor;
vCornerRadius = aCornerRadius;
vBorderColor = aBorderColor;
vBorderWidth = aLineWidth;
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
}
else if(aVertType == `).concat(Ul,`) {
vec2 source = aPointAPointB.xy;
vec2 target = aPointAPointB.zw;
// adjust the geometry so that the line is centered on the edge
position.y = position.y - 0.5;
// stretch the unit square into a long skinny rectangle
vec2 xBasis = target - source;
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
vColor = aColor;
}
else if(aVertType == `).concat(Kl,`) {
vec2 pointA = aPointAPointB.xy;
vec2 pointB = aPointAPointB.zw;
vec2 pointC = aPointCPointD.xy;
vec2 pointD = aPointCPointD.zw;
// adjust the geometry so that the line is centered on the edge
position.y = position.y - 0.5;
vec2 p0, p1, p2, pos;
if(position.x == 0.0) { // The left side of the unit square
p0 = pointA;
p1 = pointB;
p2 = pointC;
pos = position;
} else { // The right side of the unit square, use same approach but flip the geometry upside down
p0 = pointD;
p1 = pointC;
p2 = pointB;
pos = vec2(0.0, -position.y);
}
vec2 p01 = p1 - p0;
vec2 p12 = p2 - p1;
vec2 p21 = p1 - p2;
// Find the normal vector.
vec2 tangent = normalize(normalize(p12) + normalize(p01));
vec2 normal = vec2(-tangent.y, tangent.x);
// Find the vector perpendicular to p0 -> p1.
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
// Determine the bend direction.
float sigma = sign(dot(p01 + p21, normal));
float width = aLineWidth[0];
if(sign(pos.y) == -sigma) {
// This is an intersecting vertex. Adjust the position so that there's no overlap.
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
} else {
// This is a non-intersecting vertex. Treat it like a mitre join.
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
}
vColor = aColor;
}
else if(aVertType == `).concat(Cs,` && vid < 3) {
// massage the first triangle into an edge arrow
if(vid == 0)
position = vec2(-0.15, -0.3);
if(vid == 1)
position = vec2( 0.0, 0.0);
if(vid == 2)
position = vec2( 0.15, -0.3);
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
vColor = aColor;
}
else {
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
}
vAtlasId = aAtlasId;
vVertType = aVertType;
vIndex = aIndex;
}
`),i=this.batchManager.getIndexArray(),s=`#version 300 es
precision highp float;
// declare texture unit for each texture atlas in the batch
`.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
`),`
uniform vec4 uBGColor;
uniform float uZoom;
in vec2 vTexCoord;
in vec4 vColor;
in vec2 vPosition; // model coordinates
flat in int vAtlasId;
flat in vec4 vIndex;
flat in int vVertType;
flat in vec2 vTopRight;
flat in vec2 vBotLeft;
flat in vec4 vCornerRadius;
flat in vec4 vBorderColor;
flat in vec2 vBorderWidth;
out vec4 outColor;
`).concat(lm,`
`).concat(vm,`
`).concat(fm,`
`).concat(cm,`
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
return vec4(
top.rgb + (bot.rgb * (1.0 - top.a)),
top.a + (bot.a * (1.0 - top.a))
);
}
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
// scale to the zoom level so that borders don't look blurry when zoomed in
// note 1.5 is an aribitrary value chosen because it looks good
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
}
void main(void) {
if(vVertType == `).concat(Es,`) {
// look up the texel from the texture unit
`).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
else `),`
}
else if(vVertType == `).concat(Cs,`) {
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
outColor = blend(vColor, uBGColor);
outColor.a = 1.0; // make opaque, masks out line under arrow
}
else if(vVertType == `).concat(_t,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
}
else if(vVertType == `).concat(_t," || vVertType == ").concat(ga,`
|| vVertType == `).concat(nn," || vVertType == ").concat(ha,`) { // use SDF
float outerBorder = vBorderWidth[0];
float innerBorder = vBorderWidth[1];
float borderPadding = outerBorder * 2.0;
float w = vTopRight.x - vBotLeft.x - borderPadding;
float h = vTopRight.y - vBotLeft.y - borderPadding;
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
float d; // signed distance
if(vVertType == `).concat(_t,`) {
d = rectangleSD(p, b);
} else if(vVertType == `).concat(ga,` && w == h) {
d = circleSD(p, b.x); // faster than ellipse
} else if(vVertType == `).concat(ga,`) {
d = ellipseSD(p, b);
} else {
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
}
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
if(d > 0.0) {
if(d > outerBorder) {
discard;
} else {
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
}
} else {
if(d > innerBorder) {
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
vec4 innerBorderColor = blend(vBorderColor, vColor);
outColor = distInterp(innerBorderColor, outerColor, d);
}
else {
vec4 outerColor;
if(innerBorder == 0.0 && outerBorder == 0.0) {
outerColor = vec4(0);
} else if(innerBorder == 0.0) {
outerColor = vBorderColor;
} else {
outerColor = blend(vBorderColor, vColor);
}
outColor = distInterp(vColor, outerColor, d - innerBorder);
}
}
}
else {
outColor = vColor;
}
`).concat(t.picking?`if(outColor.a == 0.0) discard;
else outColor = vIndex;`:"",`
}
`),o=Wy(a,n,s);o.aPosition=a.getAttribLocation(o,"aPosition"),o.aIndex=a.getAttribLocation(o,"aIndex"),o.aVertType=a.getAttribLocation(o,"aVertType"),o.aTransform=a.getAttribLocation(o,"aTransform"),o.aAtlasId=a.getAttribLocation(o,"aAtlasId"),o.aTex=a.getAttribLocation(o,"aTex"),o.aPointAPointB=a.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=a.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=a.getAttribLocation(o,"aLineWidth"),o.aColor=a.getAttribLocation(o,"aColor"),o.aCornerRadius=a.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=a.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=a.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=a.getUniformLocation(o,"uAtlasSize"),o.uBGColor=a.getUniformLocation(o,"uBGColor"),o.uZoom=a.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)o.uTextures.push(a.getUniformLocation(o,"uTexture".concat(u)));return o},"_createShaderProgram")},{key:"_createVAO",value:v(function(){var t=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=t.length/2;var a=this.maxInstances,n=this.gl,i=this.program,s=n.createVertexArray();return n.bindVertexArray(s),jy(n,"vec2",i.aPosition,t),this.transformBuffer=em(n,a,i.aTransform),this.indexBuffer=Vr(n,a,"vec4",i.aIndex),this.vertTypeBuffer=Vr(n,a,"int",i.aVertType),this.atlasIdBuffer=Vr(n,a,"int",i.aAtlasId),this.texBuffer=Vr(n,a,"vec4",i.aTex),this.pointAPointBBuffer=Vr(n,a,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Vr(n,a,"vec4",i.aPointCPointD),this.lineWidthBuffer=Vr(n,a,"vec2",i.aLineWidth),this.colorBuffer=Vr(n,a,"vec4",i.aColor),this.cornerRadiusBuffer=Vr(n,a,"vec4",i.aCornerRadius),this.borderColorBuffer=Vr(n,a,"vec4",i.aBorderColor),n.bindVertexArray(null),s},"_createVAO")},{key:"buffers",get:v(function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return at(a,"Buffer")}).map(function(a){return t[a]})),this._buffers},"get")},{key:"startFrame",value:v(function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xa.SCREEN;this.panZoomMatrix=t,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()},"startFrame")},{key:"startBatch",value:v(function(){this.instanceCount=0,this.batchManager.startBatch()},"startBatch")},{key:"endFrame",value:v(function(){this.endBatch()},"endFrame")},{key:"_isVisible",value:v(function(t,a){return t.visible()?a&&a.isVisible?a.isVisible(t):!0:!1},"_isVisible")},{key:"drawTexture",value:v(function(t,a,n){var i=this.atlasManager,s=this.batchManager,o=i.getRenderTypeOpts(n);if(this._isVisible(t,o)&&!(t.isEdge()&&!this._isValidEdge(t))){if(this.renderTarget.picking&&o.getTexPickingMode){var u=o.getTexPickingMode(t);if(u===Pn.IGNORE)return;if(u==Pn.USE_BB){this.drawPickingRectangle(t,a,n);return}}var l=i.getAtlasInfo(t,n),f=Tr(l),c;try{for(f.s();!(c=f.n()).done;){var d=c.value,g=d.atlas,h=d.tex1,m=d.tex2;s.canAddToCurrentBatch(g)||this.endBatch();for(var p=s.getAtlasIndexForBatch(g),y=0,b=[[h,!0],[m,!1]];y<b.length;y++){var w=Je(b[y],2),x=w[0],C=w[1];if(x.w!=0){var T=this.instanceCount;this.vertTypeBuffer.getView(T)[0]=Es;var E=this.indexBuffer.getView(T);qt(a,E);var S=this.atlasIdBuffer.getView(T);S[0]=p;var D=this.texBuffer.getView(T);D[0]=x.x,D[1]=x.y,D[2]=x.w,D[3]=x.h;var B=this.transformBuffer.getMatrixView(T);this.setTransformMatrix(t,B,o,d,C),this.instanceCount++,C||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(P){f.e(P)}finally{f.f()}}},"drawTexture")},{key:"setTransformMatrix",value:v(function(t,a,n,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(n.shapeProps&&n.shapeProps.padding&&(o=t.pstyle(n.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,f=i.tex2,c=l.w/(l.w+f.w);s||(c=1-c);var d=this._getAdjustedBB(u,o,s,c);this._applyTransformMatrix(a,d,n,t)}else{var g=n.getBoundingBox(t),h=this._getAdjustedBB(g,o,!0,1);this._applyTransformMatrix(a,h,n,t)}},"setTransformMatrix")},{key:"_applyTransformMatrix",value:v(function(t,a,n,i){var s,o;Wl(t);var u=n.getRotation?n.getRotation(i):0;if(u!==0){var l=n.getRotationPoint(i),f=l.x,c=l.y;pn(t,t,[f,c]),$l(t,t,u);var d=n.getRotationOffset(i);s=d.x+(a.xOffset||0),o=d.y+(a.yOffset||0)}else s=a.x1,o=a.y1;pn(t,t,[s,o]),Hs(t,t,[a.w,a.h])},"_applyTransformMatrix")},{key:"_getAdjustedBB",value:v(function(t,a,n,i){var s=t.x1,o=t.y1,u=t.w,l=t.h,f=t.yOffset;a&&(s-=a,o-=a,u+=2*a,l+=2*a);var c=0,d=u*i;return n&&i<1?u=d:!n&&i<1&&(c=u-d,s+=c,u=d),{x1:s,y1:o,w:u,h:l,xOffset:c,yOffset:f}},"_getAdjustedBB")},{key:"drawPickingRectangle",value:v(function(t,a,n){var i=this.atlasManager.getRenderTypeOpts(n),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=_t;var o=this.indexBuffer.getView(s);qt(a,o);var u=this.colorBuffer.getView(s);xt([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(t,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()},"drawPickingRectangle")},{key:"drawNode",value:v(function(t,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(t,i)){var s=i.shapeProps,o=this._getVertTypeForShape(t,s.shape);if(o===void 0||i.isSimple&&!i.isSimple(t,this.renderTarget)){this.drawTexture(t,a,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=o,o===nn||o===ha){var l=i.getBoundingBox(t),f=this._getCornerRadius(t,s.radius,l),c=this.cornerRadiusBuffer.getView(u);c[0]=f,c[1]=f,c[2]=f,c[3]=f,o===ha&&(c[0]=0,c[2]=0)}var d=this.indexBuffer.getView(u);qt(a,d);var g=this.renderTarget.picking?1:n==="node-body"?t.effectiveOpacity():1,h=this.renderTarget.picking?1:t.pstyle(s.opacity).value*g,m=t.pstyle(s.color).value,p=this.colorBuffer.getView(u);xt(m,h,p);var y=this.lineWidthBuffer.getView(u);if(y[0]=0,y[1]=0,s.border){var b=t.pstyle("border-width").value;if(b>0){var w=t.pstyle("border-color").value,x=g*t.pstyle("border-opacity").value,C=this.borderColorBuffer.getView(u);xt(w,x,C);var T=t.pstyle("border-position").value;if(T==="inside")y[0]=0,y[1]=-b;else if(T==="outside")y[0]=b,y[1]=0;else{var E=b/2;y[0]=E,y[1]=-E}}}var S=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(t,S,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},"drawNode")},{key:"_getVertTypeForShape",value:v(function(t,a){var n=t.pstyle(a).value;switch(n){case"rectangle":return _t;case"ellipse":return ga;case"roundrectangle":case"round-rectangle":return nn;case"bottom-round-rectangle":return ha;default:return}},"_getVertTypeForShape")},{key:"_getCornerRadius",value:v(function(t,a,n){var i=n.w,s=n.h;if(t.pstyle(a).value==="auto")return vt(i,s);var o=t.pstyle(a).pfValue,u=i/2,l=s/2;return Math.min(o,l,u)},"_getCornerRadius")},{key:"drawEdgeArrow",value:v(function(t,a,n){if(t.visible()){var i=t._private.rscratch,s,o,u;if(n==="source"?(s=i.arrowStartX,o=i.arrowStartY,u=i.srcArrowAngle):(s=i.arrowEndX,o=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(u)||u==null)){var l=t.pstyle(n+"-arrow-shape").value;if(l!=="none"){var f=t.pstyle(n+"-arrow-color").value,c=t.pstyle("opacity").value,d=t.pstyle("line-opacity").value,g=c*d,h=t.pstyle("width").pfValue,m=t.pstyle("arrow-scale").value,p=this.r.getArrowWidth(h,m),y=this.instanceCount,b=this.transformBuffer.getMatrixView(y);Wl(b),pn(b,b,[s,o]),Hs(b,b,[p,p]),$l(b,b,u),this.vertTypeBuffer.getView(y)[0]=Cs;var w=this.indexBuffer.getView(y);qt(a,w);var x=this.colorBuffer.getView(y);xt(f,g,x),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},"drawEdgeArrow")},{key:"drawEdgeLine",value:v(function(t,a){if(t.visible()){var n=this._getEdgePoints(t);if(n){var i=t.pstyle("opacity").value,s=t.pstyle("line-opacity").value,o=t.pstyle("width").pfValue,u=t.pstyle("line-color").value,l=i*s;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=Ul;var c=this.indexBuffer.getView(f);qt(a,c);var d=this.colorBuffer.getView(f);xt(u,l,d);var g=this.lineWidthBuffer.getView(f);g[0]=o;var h=this.pointAPointBBuffer.getView(f);h[0]=n[0],h[1]=n[1],h[2]=n[2],h[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var m=0;m<n.length-2;m+=2){var p=this.instanceCount;this.vertTypeBuffer.getView(p)[0]=Kl;var y=this.indexBuffer.getView(p);qt(a,y);var b=this.colorBuffer.getView(p);xt(u,l,b);var w=this.lineWidthBuffer.getView(p);w[0]=o;var x=n[m-2],C=n[m-1],T=n[m],E=n[m+1],S=n[m+2],D=n[m+3],B=n[m+4],P=n[m+5];m==0&&(x=2*T-S+.001,C=2*E-D+.001),m==n.length-4&&(B=2*S-T+.001,P=2*D-E+.001);var A=this.pointAPointBBuffer.getView(p);A[0]=x,A[1]=C,A[2]=T,A[3]=E;var R=this.pointCPointDBuffer.getView(p);R[0]=S,R[1]=D,R[2]=B,R[3]=P,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},"drawEdgeLine")},{key:"_isValidEdge",value:v(function(t){var a=t._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))},"_isValidEdge")},{key:"_getEdgePoints",value:v(function(t){var a=t._private.rscratch;if(this._isValidEdge(t)){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(n,i)}},"_getEdgePoints")},{key:"_getNumSegments",value:v(function(t){var a=15;return Math.min(Math.max(a,5),this.maxInstances)},"_getNumSegments")},{key:"_getCurveSegmentPoints",value:v(function(t,a){if(t.length==4)return t;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=t[0],n[1]=t[1];else if(i==a)n[i*2]=t[t.length-2],n[i*2+1]=t[t.length-1];else{var s=i/a;this._setCurvePoint(t,s,n,i*2)}return n},"_getCurveSegmentPoints")},{key:"_setCurvePoint",value:v(function(t,a,n,i){if(t.length<=2)n[i]=t[0],n[i+1]=t[1];else{for(var s=Array(t.length-2),o=0;o<s.length;o+=2){var u=(1-a)*t[o]+a*t[o+2],l=(1-a)*t[o+1]+a*t[o+3];s[o]=u,s[o+1]=l}return this._setCurvePoint(s,a,n,i)}},"_setCurvePoint")},{key:"endBatch",value:v(function(){var t=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var s=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(s),t.bindVertexArray(a);var o=Tr(this.buffers),u;try{for(o.s();!(u=o.n()).done;){var l=u.value;l.bufferSubData(i)}}catch(h){o.e(h)}finally{o.f()}for(var f=this.batchManager.getAtlases(),c=0;c<f.length;c++)f[c].bufferIfNeeded(t);for(var d=0;d<f.length;d++)t.activeTexture(t.TEXTURE0+d),t.bindTexture(t.TEXTURE_2D,f[d].texture),t.uniform1i(s.uTextures[d],d);t.uniform1f(s.uZoom,Uy(this.r)),t.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(s.uAtlasSize,this.batchManager.getAtlasSize());var g=xt(this.bgColor,1);t.uniform4fv(s.uBGColor,g),t.drawArraysInstanced(t.TRIANGLES,0,n,i),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:f.length}),this.startBatch()}},"endBatch")},{key:"getDebugInfo",value:v(function(){var t=this.atlasManager.getDebugInfo(),a=t.reduce(function(s,o){return s+o.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(s,o){return s+o.count},0);return{atlasInfo:t,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:i}},"getDebugInfo")}])})(),Mf={};Mf.initWebgl=function(r,e){var t=this,a=t.data.contexts[t.WEBGL];r.bgColor=hm(t),r.webglTexSize=Math.min(r.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),r.webglTexRows=Math.min(r.webglTexRows,54),r.webglTexRowsNodes=Math.min(r.webglTexRowsNodes,54),r.webglBatchSize=Math.min(r.webglBatchSize,16384),r.webglTexPerBatch=Math.min(r.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),t.webglDebug=r.webglDebug,t.webglDebugShowAtlases=r.webglDebugShowAtlases,t.pickingFrameBuffer=rm(a),t.pickingFrameBuffer.needsDraw=!0,t.drawing=new dm(t,a,r);var n=v(function(c){return function(d){return t.getTextAngle(d,c)}},"getLabelRotation"),i=v(function(c){return function(d){var g=d.pstyle(c);return g&&g.value}},"isLabelVisible"),s=v(function(c){return function(d){return d.pstyle("".concat(c,"-opacity")).value>0}},"isLayerVisible"),o=v(function(c){var d=c.pstyle("text-events").strValue==="yes";return d?Pn.USE_BB:Pn.IGNORE},"getTexPickingMode"),u=v(function(c){var d=c.position(),g=d.x,h=d.y,m=c.outerWidth(),p=c.outerHeight();return{w:m,h:p,x1:g-m/2,y1:h-p/2}},"getBBForSimpleShape");t.drawing.addAtlasCollection("node",{texRows:r.webglTexRowsNodes}),t.drawing.addAtlasCollection("label",{texRows:r.webglTexRows}),t.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),t.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:Xy,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),t.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),t.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),t.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:Ts(e.getLabelKey,null),getBoundingBox:Ss(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),t.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:Ts(e.getSourceLabelKey,"source"),getBoundingBox:Ss(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),t.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:Ts(e.getTargetLabelKey,"target"),getBoundingBox:Ss(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=za(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(f,c){var d=!1;c&&c.length>0&&(d|=t.drawing.invalidate(c)),d&&l()}),gm(t)};function hm(r){var e=r.cy.container(),t=e&&e.style&&e.style.backgroundColor||"white";return nv(t)}v(hm,"getBGColor");function Lf(r,e){var t=r._private.rscratch;return Er(t,"labelWrapCachedLines",e)||[]}v(Lf,"getLabelLines");var Ts=v(function(e,t){return function(a){var n=e(a),i=Lf(a,t);return i.length>1?i.map(function(s,o){return"".concat(n,"_").concat(o)}):n}},"getStyleKeysForLabel"),Ss=v(function(e,t){return function(a,n){var i=e(a);if(typeof n=="string"){var s=n.indexOf("_");if(s>0){var o=Number(n.substring(s+1)),u=Lf(a,t),l=i.h/u.length,f=l*o,c=i.y1+f;return{x1:i.x1,w:i.w,y1:c,h:l,yOffset:f}}}return i}},"getBoundingBoxForLabel");function gm(r){{var e=r.render;r.render=function(i){i=i||{};var s=r.cy;r.webgl&&(s.zoom()>Sf?(pm(r),e.call(r,i)):(ym(r),Of(r,i,xa.SCREEN)))}}{var t=r.matchCanvasSize;r.matchCanvasSize=function(i){t.call(r,i),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0}}r.findNearestElements=function(i,s,o,u){return Cm(r,i,s)};{var a=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){a.call(r),r.pickingFrameBuffer.needsDraw=!0}}{var n=r.notify;r.notify=function(i,s){n.call(r,i,s),i==="viewport"||i==="bounds"?r.pickingFrameBuffer.needsDraw=!0:i==="background"&&r.drawing.invalidate(s,{type:"node-body"})}}}v(gm,"overrideCanvasRendererFunctions");function pm(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}v(pm,"clearWebgl");function ym(r){var e=v(function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.canvasWidth,r.canvasHeight),a.restore()},"clear");e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}v(ym,"clearCanvas");function mm(r){var e=r.canvasWidth,t=r.canvasHeight,a=mo(r),n=a.pan,i=a.zoom,s=xs();pn(s,s,[n.x,n.y]),Hs(s,s,[i,i]);var o=xs();am(o,e,t);var u=xs();return tm(u,o,s),u}v(mm,"createPanZoomMatrix");function If(r,e){var t=r.canvasWidth,a=r.canvasHeight,n=mo(r),i=n.pan,s=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,a),e.translate(i.x,i.y),e.scale(s,s)}v(If,"setContextTransform");function bm(r,e){r.drawSelectionRectangle(e,function(t){return If(r,t)})}v(bm,"drawSelectionRectangle");function wm(r){var e=r.data.contexts[r.NODE];e.save(),If(r,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}v(wm,"drawAxes");function xm(r){var e=v(function(n,i,s){for(var o=n.atlasManager.getAtlasCollection(i),u=r.data.contexts[r.NODE],l=o.atlases,f=0;f<l.length;f++){var c=l[f],d=c.canvas;if(d){var g=d.width,h=d.height,m=g*f,p=d.height*s,y=.4;u.save(),u.scale(y,y),u.drawImage(d,m,p),u.strokeStyle="black",u.rect(m,p,g,h),u.stroke(),u.restore()}}},"draw"),t=0;e(r.drawing,"node",t++),e(r.drawing,"label",t++)}v(xm,"drawAtlases");function Em(r,e,t,a,n){var i,s,o,u,l=mo(r),f=l.pan,c=l.zoom;{var d=Ky(r,f,c,e,t),g=Je(d,2),h=g[0],m=g[1],p=6;i=h-p/2,s=m-p/2,o=p,u=p}if(o===0||u===0)return[];var y=r.data.contexts[r.WEBGL];y.bindFramebuffer(y.FRAMEBUFFER,r.pickingFrameBuffer),r.pickingFrameBuffer.needsDraw&&(y.viewport(0,0,y.canvas.width,y.canvas.height),Of(r,null,xa.PICKING),r.pickingFrameBuffer.needsDraw=!1);var b=o*u,w=new Uint8Array(b*4);y.readPixels(i,s,o,u,y.RGBA,y.UNSIGNED_BYTE,w),y.bindFramebuffer(y.FRAMEBUFFER,null);for(var x=new Set,C=0;C<b;C++){var T=w.slice(C*4,C*4+4),E=Zy(T)-1;E>=0&&x.add(E)}return x}v(Em,"getPickingIndexes");function Cm(r,e,t){var a=Em(r,e,t),n=r.getCachedZSortedEles(),i,s,o=Tr(a),u;try{for(o.s();!(u=o.n()).done;){var l=u.value,f=n[l];if(!i&&f.isNode()&&(i=f),!s&&f.isEdge()&&(s=f),i&&s)break}}catch(c){o.e(c)}finally{o.f()}return[i,s].filter(Boolean)}v(Cm,"findNearestElementsWebgl");function ks(r,e,t){var a=r.drawing;e+=1,t.isNode()?(a.drawNode(t,e,"node-underlay"),a.drawNode(t,e,"node-body"),a.drawTexture(t,e,"label"),a.drawNode(t,e,"node-overlay")):(a.drawEdgeLine(t,e),a.drawEdgeArrow(t,e,"source"),a.drawEdgeArrow(t,e,"target"),a.drawTexture(t,e,"label"),a.drawTexture(t,e,"edge-source-label"),a.drawTexture(t,e,"edge-target-label"))}v(ks,"drawEle");function Of(r,e,t){var a;r.webglDebug&&(a=performance.now());var n=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&bm(r,e),r.data.canvasNeedsRedraw[r.NODE]||t.picking){var s=r.data.contexts[r.WEBGL];t.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=mm(r),u=r.getCachedZSortedEles();if(i=u.length,n.startFrame(o,t),t.screen){for(var l=0;l<u.nondrag.length;l++)ks(r,l,u.nondrag[l]);for(var f=0;f<u.drag.length;f++)ks(r,f,u.drag[f])}else if(t.picking)for(var c=0;c<u.length;c++)ks(r,c,u[c]);n.endFrame(),t.screen&&r.webglDebugShowAtlases&&(wm(r),xm(r)),r.data.canvasNeedsRedraw[r.NODE]=!1,r.data.canvasNeedsRedraw[r.DRAG]=!1}if(r.webglDebug){var d=performance.now(),g=!1,h=Math.ceil(d-a),m=n.getDebugInfo(),p=["".concat(i," elements"),"".concat(m.totalInstances," instances"),"".concat(m.batchCount," batches"),"".concat(m.totalAtlases," atlases"),"".concat(m.wrappedCount," wrapped textures"),"".concat(m.simpleCount," simple shapes")].join(", ");if(g)console.log("WebGL (".concat(t.name,") - time ").concat(h,"ms, ").concat(p));else{console.log("WebGL (".concat(t.name,") - frame time ").concat(h,"ms")),console.log("Totals:"),console.log(" ".concat(p)),console.log("Texture Atlases Used:");var y=m.atlasInfo,b=Tr(y),w;try{for(b.s();!(w=b.n()).done;){var x=w.value;console.log(" ".concat(x.type,": ").concat(x.keyCount," keys, ").concat(x.atlasCount," atlases"))}}catch(C){b.e(C)}finally{b.f()}console.log("")}}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,n.gc())}v(Of,"renderWebgl");var mt={};mt.drawPolygonPath=function(r,e,t,a,n,i){var s=a/2,o=n/2;r.beginPath&&r.beginPath(),r.moveTo(e+s*i[0],t+o*i[1]);for(var u=1;u<i.length/2;u++)r.lineTo(e+s*i[u*2],t+o*i[u*2+1]);r.closePath()};mt.drawRoundPolygonPath=function(r,e,t,a,n,i,s){s.forEach(function(o){return gf(r,o)}),r.closePath()};mt.drawRoundRectanglePath=function(r,e,t,a,n,i){var s=a/2,o=n/2,u=i==="auto"?vt(a,n):Math.min(i,o,s);r.beginPath&&r.beginPath(),r.moveTo(e,t-o),r.arcTo(e+s,t-o,e+s,t,u),r.arcTo(e+s,t+o,e,t+o,u),r.arcTo(e-s,t+o,e-s,t,u),r.arcTo(e-s,t-o,e,t-o,u),r.lineTo(e,t-o),r.closePath()};mt.drawBottomRoundRectanglePath=function(r,e,t,a,n,i){var s=a/2,o=n/2,u=i==="auto"?vt(a,n):i;r.beginPath&&r.beginPath(),r.moveTo(e,t-o),r.lineTo(e+s,t-o),r.lineTo(e+s,t),r.arcTo(e+s,t+o,e,t+o,u),r.arcTo(e-s,t+o,e-s,t,u),r.lineTo(e-s,t-o),r.lineTo(e,t-o),r.closePath()};mt.drawCutRectanglePath=function(r,e,t,a,n,i,s){var o=a/2,u=n/2,l=s==="auto"?ao():s;r.beginPath&&r.beginPath(),r.moveTo(e-o+l,t-u),r.lineTo(e+o-l,t-u),r.lineTo(e+o,t-u+l),r.lineTo(e+o,t+u-l),r.lineTo(e+o-l,t+u),r.lineTo(e-o+l,t+u),r.lineTo(e-o,t+u-l),r.lineTo(e-o,t-u+l),r.closePath()};mt.drawBarrelPath=function(r,e,t,a,n){var i=a/2,s=n/2,o=e-i,u=e+i,l=t-s,f=t+s,c=Ps(a,n),d=c.widthOffset,g=c.heightOffset,h=c.ctrlPtOffsetPct*d;r.beginPath&&r.beginPath(),r.moveTo(o,l+g),r.lineTo(o,f-g),r.quadraticCurveTo(o+h,f,o+d,f),r.lineTo(u-d,f),r.quadraticCurveTo(u-h,f,u,f-g),r.lineTo(u,l+g),r.quadraticCurveTo(u-h,l,u-d,l),r.lineTo(o+d,l),r.quadraticCurveTo(o+h,l,o,l+g),r.closePath()};var Xl=Math.sin(0),Yl=Math.cos(0),Ws={},$s={},Nf=Math.PI/40;for(Et=0*Math.PI;Et<2*Math.PI;Et+=Nf)Ws[Et]=Math.sin(Et),$s[Et]=Math.cos(Et);var Et;mt.drawEllipsePath=function(r,e,t,a,n){if(r.beginPath&&r.beginPath(),r.ellipse)r.ellipse(e,t,a/2,n/2,0,0,2*Math.PI);else for(var i,s,o=a/2,u=n/2,l=0*Math.PI;l<2*Math.PI;l+=Nf)i=e-o*Ws[l]*Xl+o*$s[l]*Yl,s=t+u*$s[l]*Xl+u*Ws[l]*Yl,l===0?r.moveTo(i,s):r.lineTo(i,s);r.closePath()};var Ha={};Ha.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]};Ha.bufferCanvasImage=function(r){var e=this.cy,t=e.mutableElements(),a=t.boundingBox(),n=this.findContainerClientCoords(),i=r.full?Math.ceil(a.w):n[2],s=r.full?Math.ceil(a.h):n[3],o=ne(r.maxWidth)||ne(r.maxHeight),u=this.getPixelRatio(),l=1;if(r.scale!==void 0)i*=r.scale,s*=r.scale,l=r.scale;else if(o){var f=1/0,c=1/0;ne(r.maxWidth)&&(f=l*r.maxWidth/i),ne(r.maxHeight)&&(c=l*r.maxHeight/s),l=Math.min(f,c),i*=l,s*=l}o||(i*=u,s*=u,l*=u);var d=document.createElement("canvas");d.width=i,d.height=s,d.style.width=i+"px",d.style.height=s+"px";var g=d.getContext("2d");if(i>0&&s>0){g.clearRect(0,0,i,s),g.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(r.full)g.translate(-a.x1*l,-a.y1*l),g.scale(l,l),this.drawElements(g,h),g.scale(1/l,1/l),g.translate(a.x1*l,a.y1*l);else{var m=e.pan(),p={x:m.x*l,y:m.y*l};l*=e.zoom(),g.translate(p.x,p.y),g.scale(l,l),this.drawElements(g,h),g.scale(1/l,1/l),g.translate(-p.x,-p.y)}r.bg&&(g.globalCompositeOperation="destination-over",g.fillStyle=r.bg,g.rect(0,0,i,s),g.fill())}return d};function Tm(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new Blob([a],{type:e})}v(Tm,"b64ToBlob");function Zl(r){var e=r.indexOf(",");return r.substr(e+1)}v(Zl,"b64UriToB64");function zf(r,e,t){var a=v(function(){return e.toDataURL(t,r.quality)},"getB64Uri");switch(r.output){case"blob-promise":return new ra(function(n,i){try{e.toBlob(function(s){s!=null?n(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},t,r.quality)}catch(s){i(s)}});case"blob":return Tm(Zl(a()),t);case"base64":return Zl(a());case"base64uri":default:return a()}}v(zf,"output");Ha.png=function(r){return zf(r,this.bufferCanvasImage(r),"image/png")};Ha.jpg=function(r){return zf(r,this.bufferCanvasImage(r),"image/jpeg")};var Ff={};Ff.nodeShapeImpl=function(r,e,t,a,n,i,s,o){switch(r){case"ellipse":return this.drawEllipsePath(e,t,a,n,i);case"polygon":return this.drawPolygonPath(e,t,a,n,i,s);case"round-polygon":return this.drawRoundPolygonPath(e,t,a,n,i,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,t,a,n,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,t,a,n,i,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,t,a,n,i,o);case"barrel":return this.drawBarrelPath(e,t,a,n,i)}};var Sm=Vf,Se=Vf.prototype;Se.CANVAS_LAYERS=3;Se.SELECT_BOX=0;Se.DRAG=1;Se.NODE=2;Se.WEBGL=3;Se.CANVAS_TYPES=["2d","2d","2d","webgl2"];Se.BUFFER_COUNT=3;Se.TEXTURE_BUFFER=0;Se.MOTIONBLUR_BUFFER_NODE=1;Se.MOTIONBLUR_BUFFER_DRAG=2;function Vf(r){var e=this,t=e.cy.window(),a=t.document;r.webgl&&(Se.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(Se.CANVAS_LAYERS),contexts:new Array(Se.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Se.CANVAS_LAYERS),bufferCanvases:new Array(Se.BUFFER_COUNT),bufferContexts:new Array(Se.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,s.position="relative",s.zIndex="0",s.overflow="hidden";var o=r.cy.container();o.appendChild(e.data.canvasContainer),o.style[n]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};yc()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<Se.CANVAS_LAYERS;l++){var f=e.data.canvases[l]=a.createElement("canvas"),c=Se.CANVAS_TYPES[l];e.data.contexts[l]=f.getContext(c),e.data.contexts[l]||We("Could not create canvas of type "+c),Object.keys(u).forEach(function(J){f.style[J]=u[J]}),f.style.position="absolute",f.setAttribute("data-id","layer"+l),f.style.zIndex=String(Se.CANVAS_LAYERS-l),e.data.canvasContainer.appendChild(f),e.data.canvasNeedsRedraw[l]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Se.NODE].setAttribute("data-id","layer"+Se.NODE+"-node"),e.data.canvases[Se.SELECT_BOX].setAttribute("data-id","layer"+Se.SELECT_BOX+"-selectbox"),e.data.canvases[Se.DRAG].setAttribute("data-id","layer"+Se.DRAG+"-drag"),e.data.canvases[Se.WEBGL]&&e.data.canvases[Se.WEBGL].setAttribute("data-id","layer"+Se.WEBGL+"-webgl");for(var l=0;l<Se.BUFFER_COUNT;l++)e.data.bufferCanvases[l]=a.createElement("canvas"),e.data.bufferContexts[l]=e.data.bufferCanvases[l].getContext("2d"),e.data.bufferCanvases[l].style.position="absolute",e.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),e.data.bufferCanvases[l].style.zIndex=String(-l-1),e.data.bufferCanvases[l].style.visibility="hidden";e.pathsEnabled=!0;var d=mr(),g=v(function(q){return{x:(q.x1+q.x2)/2,y:(q.y1+q.y2)/2}},"getBoxCenter"),h=v(function(q){return{x:-q.w/2,y:-q.h/2}},"getCenterOffset"),m=v(function(q){var W=q[0]._private,$=W.oldBackgroundTimestamp===W.backgroundTimestamp;return!$},"backgroundTimestampHasChanged"),p=v(function(q){return q[0]._private.nodeKey},"getStyleKey"),y=v(function(q){return q[0]._private.labelStyleKey},"getLabelKey"),b=v(function(q){return q[0]._private.sourceLabelStyleKey},"getSourceLabelKey"),w=v(function(q){return q[0]._private.targetLabelStyleKey},"getTargetLabelKey"),x=v(function(q,W,$,Z,ae){return e.drawElement(q,W,$,!1,!1,ae)},"drawElement"),C=v(function(q,W,$,Z,ae){return e.drawElementText(q,W,$,Z,"main",ae)},"drawLabel"),T=v(function(q,W,$,Z,ae){return e.drawElementText(q,W,$,Z,"source",ae)},"drawSourceLabel"),E=v(function(q,W,$,Z,ae){return e.drawElementText(q,W,$,Z,"target",ae)},"drawTargetLabel"),S=v(function(q){return q.boundingBox(),q[0]._private.bodyBounds},"getElementBox"),D=v(function(q){return q.boundingBox(),q[0]._private.labelBounds.main||d},"getLabelBox"),B=v(function(q){return q.boundingBox(),q[0]._private.labelBounds.source||d},"getSourceLabelBox"),P=v(function(q){return q.boundingBox(),q[0]._private.labelBounds.target||d},"getTargetLabelBox"),A=v(function(q,W){return W},"isLabelVisibleAtScale"),R=v(function(q){return g(S(q))},"getElementRotationPoint"),M=v(function(q,W,$){var Z=q?q+"-":"";return{x:W.x+$.pstyle(Z+"text-margin-x").pfValue,y:W.y+$.pstyle(Z+"text-margin-y").pfValue}},"addTextMargin"),I=v(function(q,W,$){var Z=q[0]._private.rscratch;return{x:Z[W],y:Z[$]}},"getRsPt"),O=v(function(q){return M("",I(q,"labelX","labelY"),q)},"getLabelRotationPoint"),L=v(function(q){return M("source",I(q,"sourceLabelX","sourceLabelY"),q)},"getSourceLabelRotationPoint"),N=v(function(q){return M("target",I(q,"targetLabelX","targetLabelY"),q)},"getTargetLabelRotationPoint"),_=v(function(q){return h(S(q))},"getElementRotationOffset"),G=v(function(q){return h(B(q))},"getSourceLabelRotationOffset"),z=v(function(q){return h(P(q))},"getTargetLabelRotationOffset"),V=v(function(q){var W=D(q),$=h(D(q));if(q.isNode()){switch(q.pstyle("text-halign").value){case"left":$.x=-W.w-(W.leftPad||0);break;case"right":$.x=-(W.rightPad||0);break}switch(q.pstyle("text-valign").value){case"top":$.y=-W.h-(W.topPad||0);break;case"bottom":$.y=-(W.botPad||0);break}}return $},"getLabelRotationOffset"),K=e.data.eleTxrCache=new ma(e,{getKey:p,doesEleInvalidateKey:m,drawElement:x,getBoundingBox:S,getRotationPoint:R,getRotationOffset:_,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),j=e.data.lblTxrCache=new ma(e,{getKey:y,drawElement:C,getBoundingBox:D,getRotationPoint:O,getRotationOffset:V,isVisible:A}),Q=e.data.slbTxrCache=new ma(e,{getKey:b,drawElement:T,getBoundingBox:B,getRotationPoint:L,getRotationOffset:G,isVisible:A}),ee=e.data.tlbTxrCache=new ma(e,{getKey:w,drawElement:E,getBoundingBox:P,getRotationPoint:N,getRotationOffset:z,isVisible:A}),te=e.data.lyrTxrCache=new kf(e);e.onUpdateEleCalcs(v(function(q,W){K.invalidateElements(W),j.invalidateElements(W),Q.invalidateElements(W),ee.invalidateElements(W),te.invalidateElements(W);for(var $=0;$<W.length;$++){var Z=W[$]._private;Z.oldBackgroundTimestamp=Z.backgroundTimestamp}},"invalidateTextureCaches"));var ie=v(function(q){for(var W=0;W<q.length;W++)te.enqueueElementRefinement(q[W].ele)},"refineInLayers");K.onDequeue(ie),j.onDequeue(ie),Q.onDequeue(ie),ee.onDequeue(ie),r.webgl&&e.initWebgl(r,{getStyleKey:p,getLabelKey:y,getSourceLabelKey:b,getTargetLabelKey:w,drawElement:x,drawLabel:C,drawSourceLabel:T,drawTargetLabel:E,getElementBox:S,getLabelBox:D,getSourceLabelBox:B,getTargetLabelBox:P,getElementRotationPoint:R,getElementRotationOffset:_,getLabelRotationPoint:O,getSourceLabelRotationPoint:L,getTargetLabelRotationPoint:N,getLabelRotationOffset:V,getSourceLabelRotationOffset:G,getTargetLabelRotationOffset:z})}v(Vf,"CanvasRenderer");Se.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[Se.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[Se.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[Se.SELECT_BOX]=e;break;case"gc":t.data.gc=!0;break}};var km=typeof Path2D<"u";Se.path2dEnabled=function(r){if(r===void 0)return this.pathsEnabled;this.pathsEnabled=!!r};Se.usePaths=function(){return km&&this.pathsEnabled};Se.setImgSmoothing=function(r,e){r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)};Se.getImgSmoothing=function(r){return r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled};Se.makeOffscreenCanvas=function(r,e){var t;if((typeof OffscreenCanvas>"u"?"undefined":tr(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var a=this.cy.window(),n=a.document;t=n.createElement("canvas"),t.width=r,t.height=e}return t};[Df,Wr,Jr,yo,It,yt,br,Mf,mt,Ha,Ff].forEach(function(r){me(Se,r)});var Dm=[{name:"null",impl:cf},{name:"base",impl:Cf},{name:"canvas",impl:Sm}],Bm=[{type:"layout",extensions:Qp},{type:"renderer",extensions:Dm}],qf={},_f={};function Gf(r,e,t){var a=t,n=v(function(S){Fe("Can not register `"+e+"` for `"+r+"` since `"+S+"` already exists in the prototype and can not be overridden")},"overrideErr");if(r==="core"){if(Aa.prototype[e])return n(e);Aa.prototype[e]=t}else if(r==="collection"){if(vr.prototype[e])return n(e);vr.prototype[e]=t}else if(r==="layout"){for(var i=v(function(S){this.options=S,t.call(this,S),Le(this._private)||(this._private={}),this._private.cy=S.cy,this._private.listeners=[],this.createEmitter()},"Layout"),s=i.prototype=Object.create(t.prototype),o=[],u=0;u<o.length;u++){var l=o[u];s[l]=s[l]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var f=t.prototype.stop;s.stop=function(){var E=this.options;if(E&&E.animate){var S=this.animations;if(S)for(var D=0;D<S.length;D++)S[D].stop()}return f?f.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var c=v(function(S){return S._private.cy},"getCy"),d={addEventFields:v(function(S,D){D.layout=S,D.cy=c(S),D.target=S},"addEventFields"),bubble:v(function(){return!0},"bubble"),parent:v(function(S){return c(S)},"parent")};me(s,{createEmitter:v(function(){return this._private.emitter=new _n(d,this),this},"createEmitter"),emitter:v(function(){return this._private.emitter},"emitter"),on:v(function(S,D){return this.emitter().on(S,D),this},"on"),one:v(function(S,D){return this.emitter().one(S,D),this},"one"),once:v(function(S,D){return this.emitter().one(S,D),this},"once"),removeListener:v(function(S,D){return this.emitter().removeListener(S,D),this},"removeListener"),removeAllListeners:v(function(){return this.emitter().removeAllListeners(),this},"removeAllListeners"),emit:v(function(S,D){return this.emitter().emit(S,D),this},"emit")}),ze.eventAliasesOn(s),a=i}else if(r==="renderer"&&e!=="null"&&e!=="base"){var g=Hf("renderer","base"),h=g.prototype,m=t,p=t.prototype,y=v(function(){g.apply(this,arguments),m.apply(this,arguments)},"Renderer"),b=y.prototype;for(var w in h){var x=h[w],C=p[w]!=null;if(C)return n(w);b[w]=x}for(var T in p)b[T]=p[T];h.clientFunctions.forEach(function(E){b[E]=b[E]||function(){We("Renderer does not implement `renderer."+E+"()` on its prototype")}}),a=y}else if(r==="__proto__"||r==="constructor"||r==="prototype")return We(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return iv({map:qf,keys:[r,e],value:a})}v(Gf,"setExtension");function Hf(r,e){return sv({map:qf,keys:[r,e]})}v(Hf,"getExtension");function Pm(r,e,t,a,n){return iv({map:_f,keys:[r,e,t,a],value:n})}v(Pm,"setModule");function Am(r,e,t,a){return sv({map:_f,keys:[r,e,t,a]})}v(Am,"getModule");var Us=v(function(){if(arguments.length===2)return Hf.apply(null,arguments);if(arguments.length===3)return Gf.apply(null,arguments);if(arguments.length===4)return Am.apply(null,arguments);if(arguments.length===5)return Pm.apply(null,arguments);We("Invalid extension access syntax")},"extension");Aa.prototype.extension=Us;Bm.forEach(function(r){r.extensions.forEach(function(e){Gf(r.type,e.name,e.impl)})});var An=v(function(){if(!(this instanceof An))return new An;this.length=0},"Stylesheet"),Mt=An.prototype;Mt.instanceString=function(){return"stylesheet"};Mt.selector=function(r){var e=this.length++;return this[e]={selector:r,properties:[]},this};Mt.css=function(r,e){var t=this.length-1;if(ge(r))this[t].properties.push({name:r,value:e});else if(Le(r))for(var a=r,n=Object.keys(a),i=0;i<n.length;i++){var s=n[i],o=a[s];if(o!=null){var u=sr.properties[s]||sr.properties[Rn(s)];if(u!=null){var l=u.name,f=o;this[t].properties.push({name:l,value:f})}}}return this};Mt.style=Mt.css;Mt.generateStyle=function(r){var e=new sr(r);return this.appendToStyle(e)};Mt.appendToStyle=function(r){for(var e=0;e<this.length;e++){var t=this[e],a=t.selector,n=t.properties;r.selector(a);for(var i=0;i<n.length;i++){var s=n[i];r.css(s.name,s.value)}}return r};var Rm="3.33.3",jt=v(function(e){if(e===void 0&&(e={}),Le(e))return new Aa(e);if(ge(e))return Us.apply(Us,arguments)},"cytoscape");jt.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(jt),r.apply(null,e),this};jt.warnings=function(r){return dv(r)};jt.version=Rm;jt.stylesheet=jt.Stylesheet=An;export{jt as a};
/*! Bundled license information:
cytoscape/dist/cytoscape.esm.mjs:
(*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*)
(*!
Event object based on jQuery events, MIT license
https://jquery.org/license/
https://tldrlegal.com/license/mit-license
https://github.com/jquery/jquery/blob/master/src/event.js
*)
(*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
(*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
*/