@abi-software/map-utilities 1.1.3-beta.4 → 1.1.3-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -435,18 +435,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
435
435
  Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
436
436
  Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
437
437
  Licensed under The MIT License (http://opensource.org/licenses/MIT)
438
- */var pp=0,vp=1,gp=2,$r=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=pp,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))};$r.prototype={fulfill:function(e){return mp(this,vp,"fulfillValue",e)},reject:function(e){return mp(this,gp,"rejectReason",e)},then:function(e,r){var n=this,a=new $r;return n.onFulfilled.push(wp(e,a,"fulfill")),n.onRejected.push(wp(r,a,"reject")),yp(n),a.proxy}};var mp=function(e,r,n,a){return e.state===pp&&(e.state=r,e[n]=a,yp(e)),e},yp=function(e){e.state===vp?bp(e,"onFulfilled",e.fulfillValue):e.state===gp&&bp(e,"onRejected",e.rejectReason)},bp=function(e,r,n){if(e[r].length!==0){var a=e[r];e[r]=[];var i=function(){for(var l=0;l<a.length;l++)a[l](n)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},wp=function(e,r,n){return function(a){if(typeof e!="function")r[n].call(r,a);else{var i;try{i=e(a)}catch(o){r.reject(o);return}Y5(r,i)}}},Y5=function t(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(ot(r)==="object"&&r!==null||typeof r=="function")try{n=r.then}catch(i){e.reject(i);return}if(typeof n=="function"){var a=!1;try{n.call(r,function(i){a||(a=!0,i===r?e.reject(new TypeError("circular thenable chain")):t(e,i))},function(i){a||(a=!0,e.reject(i))})}catch(i){a||e.reject(i)}return}e.fulfill(r)};$r.all=function(t){return new $r(function(e,r){for(var n=new Array(t.length),a=0,i=function(u,c){n[u]=c,a++,a===t.length&&e(n)},o=0;o<t.length;o++)(function(l){var u=t[l],c=u!=null&&u.then!=null;if(c)u.then(function(f){i(l,f)},function(f){r(f)});else{var d=u;i(l,d)}})(o)})},$r.resolve=function(t){return new $r(function(e,r){e(t)})},$r.reject=function(t){return new $r(function(e,r){r(t)})};var xa=typeof Promise<"u"?Promise:$r,ac=function(e,r,n){var a=zl(e),i=!a,o=this._private=xe({duration:1e3},r,n);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&Ye(o.complete)&&o.completes.push(o.complete),i){var l=e.position();o.startPosition=o.startPosition||{x:l.x,y:l.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(a){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},$n=ac.prototype;xe($n,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,n=e.target._private.animation;e.queue?r=n.queue:r=n.current,r.push(this),Ut(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,n=r.playing;return e===void 0?r.progress:(n&&this.pause(),r.progress=e,r.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(c,d){var f=e[c];f!=null&&(e[c]=e[d],e[d]=f)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var a=0;a<e.style.length;a++){var i=e.style[a],o=i.name,l=e.startStyle[o];e.startStyle[o]=i,e.style[a]=l}return r&&this.play(),this},promise:function(e){var r=this._private,n;switch(e){case"frame":n=r.frames;break;default:case"complete":case"completed":n=r.completes}return new xa(function(a,i){n.push(function(){a()})})}}),$n.complete=$n.completed,$n.run=$n.play,$n.running=$n.playing;var X5={animated:function(){return function(){var r=this,n=r.length!==void 0,a=n?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=a[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,n=r.length!==void 0,a=n?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<a.length;o++){var l=a[o];l._private.animation.queue=[]}return this}},delay:function(){return function(r,n){var a=this._private.cy||this;return a.styleEnabled()?this.animate({delay:r,duration:r,complete:n}):this}},delayAnimation:function(){return function(r,n){var a=this._private.cy||this;return a.styleEnabled()?this.animation({delay:r,duration:r,complete:n}):this}},animation:function(){return function(r,n){var a=this,i=a.length!==void 0,o=i?a:[a],l=this._private.cy||this,u=!i,c=!u;if(!l.styleEnabled())return this;var d=l.style();r=xe({},r,n);var f=Object.keys(r).length===0;if(f)return new ac(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(c&&(r.style=d.getPropsList(r.style||r.css),r.css=void 0),c&&r.renderedPosition!=null){var p=r.renderedPosition,v=l.pan(),h=l.zoom();r.position=Kh(p,h,v)}if(u&&r.panBy!=null){var g=r.panBy,y=l.pan();r.pan={x:y.x+g.x,y:y.y+g.y}}var m=r.center||r.centre;if(u&&m!=null){var b=l.getCenterPan(m.eles,r.zoom);b!=null&&(r.pan=b)}if(u&&r.fit!=null){var w=r.fit,C=l.getFitViewport(w.eles||w.boundingBox,w.padding);C!=null&&(r.pan=C.pan,r.zoom=C.zoom)}if(u&&_e(r.zoom)){var x=l.getZoomedViewport(r.zoom);x!=null?(x.zoomed&&(r.zoom=x.zoom),x.panned&&(r.pan=x.pan)):r.zoom=null}return new ac(o[0],r)}},animate:function(){return function(r,n){var a=this,i=a.length!==void 0,o=i?a:[a],l=this._private.cy||this;if(!l.styleEnabled())return this;n&&(r=xe({},r,n));for(var u=0;u<o.length;u++){var c=o[u],d=c.animated()&&(r.queue===void 0||r.queue),f=c.animation(r,d?{queue:!0}:void 0);f.play()}return this}},stop:function(){return function(r,n){var a=this,i=a.length!==void 0,o=i?a:[a],l=this._private.cy||this;if(!l.styleEnabled())return this;for(var u=0;u<o.length;u++){for(var c=o[u],d=c._private,f=d.animation.current,p=0;p<f.length;p++){var v=f[p],h=v._private;n&&(h.duration=0)}r&&(d.animation.queue=[]),n||(d.animation.current=[])}return l.notify("draw"),this}}},Z5=Array.isArray,Yo=Z5,Q5=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J5=/^\w*$/;function eN(t,e){if(Yo(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||bi(t)?!0:J5.test(t)||!Q5.test(t)||e!=null&&t in Object(e)}var tN=eN,rN="[object AsyncFunction]",nN="[object Function]",aN="[object GeneratorFunction]",iN="[object Proxy]";function oN(t){if(!Fn(t))return!1;var e=Dh(t);return e==nN||e==aN||e==rN||e==iN}var sN=oN,lN=Oo["__core-js_shared__"],ic=lN,Cp=function(){var t=/[^.]+$/.exec(ic&&ic.keys&&ic.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function cN(t){return!!Cp&&Cp in t}var uN=cN,dN=Function.prototype,fN=dN.toString;function hN(t){if(t!=null){try{return fN.call(t)}catch{}try{return t+""}catch{}}return""}var pN=hN,vN=/[\\^$.*+?()[\]{}|]/g,gN=/^\[object .+?Constructor\]$/,mN=Function.prototype,yN=Object.prototype,bN=mN.toString,wN=yN.hasOwnProperty,CN=RegExp("^"+bN.call(wN).replace(vN,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function kN(t){if(!Fn(t)||uN(t))return!1;var e=sN(t)?CN:gN;return e.test(pN(t))}var xN=kN;function EN(t,e){return t==null?void 0:t[e]}var SN=EN;function TN(t,e){var r=SN(t,e);return xN(r)?r:void 0}var oc=TN,BN=oc(Object,"create"),Di=BN;function NN(){this.__data__=Di?Di(null):{},this.size=0}var DN=NN;function PN(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ON=PN,_N="__lodash_hash_undefined__",LN=Object.prototype,FN=LN.hasOwnProperty;function MN(t){var e=this.__data__;if(Di){var r=e[t];return r===_N?void 0:r}return FN.call(e,t)?e[t]:void 0}var IN=MN,AN=Object.prototype,VN=AN.hasOwnProperty;function RN(t){var e=this.__data__;return Di?e[t]!==void 0:VN.call(e,t)}var $N=RN,zN="__lodash_hash_undefined__";function HN(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Di&&e===void 0?zN:e,this}var KN=HN;function Ea(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ea.prototype.clear=DN,Ea.prototype.delete=ON,Ea.prototype.get=IN,Ea.prototype.has=$N,Ea.prototype.set=KN;var kp=Ea;function qN(){this.__data__=[],this.size=0}var UN=qN;function GN(t,e){return t===e||t!==t&&e!==e}var xp=GN;function WN(t,e){for(var r=t.length;r--;)if(xp(t[r][0],e))return r;return-1}var Xo=WN,jN=Array.prototype,YN=jN.splice;function XN(t){var e=this.__data__,r=Xo(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():YN.call(e,r,1),--this.size,!0}var ZN=XN;function QN(t){var e=this.__data__,r=Xo(e,t);return r<0?void 0:e[r][1]}var JN=QN;function e4(t){return Xo(this.__data__,t)>-1}var t4=e4;function r4(t,e){var r=this.__data__,n=Xo(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var n4=r4;function Sa(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Sa.prototype.clear=UN,Sa.prototype.delete=ZN,Sa.prototype.get=JN,Sa.prototype.has=t4,Sa.prototype.set=n4;var a4=Sa,i4=oc(Oo,"Map"),o4=i4;function s4(){this.size=0,this.__data__={hash:new kp,map:new(o4||a4),string:new kp}}var l4=s4;function c4(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var u4=c4;function d4(t,e){var r=t.__data__;return u4(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Zo=d4;function f4(t){var e=Zo(this,t).delete(t);return this.size-=e?1:0,e}var h4=f4;function p4(t){return Zo(this,t).get(t)}var v4=p4;function g4(t){return Zo(this,t).has(t)}var m4=g4;function y4(t,e){var r=Zo(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var b4=y4;function Ta(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ta.prototype.clear=l4,Ta.prototype.delete=h4,Ta.prototype.get=v4,Ta.prototype.has=m4,Ta.prototype.set=b4;var Ep=Ta,w4="Expected a function";function sc(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(w4);var r=function(){var n=arguments,a=e?e.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=t.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(sc.Cache||Ep),r}sc.Cache=Ep;var C4=sc,k4=500;function x4(t){var e=C4(t,function(n){return r.size===k4&&r.clear(),n}),r=e.cache;return e}var E4=x4,S4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,T4=/\\(\\)?/g,B4=E4(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(S4,function(r,n,a,i){e.push(a?i.replace(T4,"$1"):n||r)}),e}),Sp=B4;function N4(t,e){for(var r=-1,n=t==null?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a}var Tp=N4,D4=1/0,Bp=pa?pa.prototype:void 0,Np=Bp?Bp.toString:void 0;function Dp(t){if(typeof t=="string")return t;if(Yo(t))return Tp(t,Dp)+"";if(bi(t))return Np?Np.call(t):"";var e=t+"";return e=="0"&&1/t==-D4?"-0":e}var P4=Dp;function O4(t){return t==null?"":P4(t)}var Pp=O4;function _4(t,e){return Yo(t)?t:tN(t,e)?[t]:Sp(Pp(t))}var Op=_4,L4=1/0;function F4(t){if(typeof t=="string"||bi(t))return t;var e=t+"";return e=="0"&&1/t==-L4?"-0":e}var lc=F4;function M4(t,e){e=Op(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[lc(e[r++])];return r&&r==n?t:void 0}var I4=M4;function A4(t,e,r){var n=t==null?void 0:I4(t,e);return n===void 0?r:n}var V4=A4,R4=function(){try{var t=oc(Object,"defineProperty");return t({},"",{}),t}catch{}}(),_p=R4;function $4(t,e,r){e=="__proto__"&&_p?_p(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var z4=$4,H4=Object.prototype,K4=H4.hasOwnProperty;function q4(t,e,r){var n=t[e];(!(K4.call(t,e)&&xp(n,r))||r===void 0&&!(e in t))&&z4(t,e,r)}var U4=q4,G4=9007199254740991,W4=/^(?:0|[1-9]\d*)$/;function j4(t,e){var r=typeof t;return e=e??G4,!!e&&(r=="number"||r!="symbol"&&W4.test(t))&&t>-1&&t%1==0&&t<e}var Y4=j4;function X4(t,e,r,n){if(!Fn(t))return t;e=Op(e,t);for(var a=-1,i=e.length,o=i-1,l=t;l!=null&&++a<i;){var u=lc(e[a]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(a!=o){var d=l[u];c=n?n(d,u,l):void 0,c===void 0&&(c=Fn(d)?d:Y4(e[a+1])?[]:{})}U4(l,u,c),l=l[u]}return t}var Z4=X4;function Q4(t,e,r){return t==null?t:Z4(t,e,r)}var J4=Q4;function eD(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var tD=eD;function rD(t){return Yo(t)?Tp(t,lc):bi(t)?[t]:tD(Sp(Pp(t)))}var nD=rD,aD={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(a){},beforeSet:function(a,i){},onSet:function(a){},canSet:function(a){return!0}};return e=xe({},r,e),function(a,i){var o=e,l=this,u=l.length!==void 0,c=u?l:[l],d=u?l[0]:l;if(be(a)){var f=a.indexOf(".")!==-1,p=f&&nD(a);if(o.allowGetting&&i===void 0){var v;return d&&(o.beforeGet(d),p&&d._private[o.field][a]===void 0?v=V4(d._private[o.field],p):v=d._private[o.field][a]),v}else if(o.allowSetting&&i!==void 0){var h=!o.immutableKeys[a];if(h){var g=ph({},a,i);o.beforeSet(l,g);for(var y=0,m=c.length;y<m;y++){var b=c[y];o.canSet(b)&&(p&&d._private[o.field][a]===void 0?J4(b._private[o.field],p,i):b._private[o.field][a]=i)}o.updateStyle&&l.updateStyle(),o.onSet(l),o.settingTriggersEvent&&l[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&_e(a)){var w=a,C,x,E=Object.keys(w);o.beforeSet(l,w);for(var k=0;k<E.length;k++){C=E[k],x=w[C];var B=!o.immutableKeys[C];if(B)for(var S=0;S<c.length;S++){var N=c[S];o.canSet(N)&&(N._private[o.field][C]=x)}}o.updateStyle&&l.updateStyle(),o.onSet(l),o.settingTriggersEvent&&l[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&Ye(a)){var D=a;l.on(o.bindingEvent,D)}else if(o.allowGetting&&a===void 0){var P;return d&&(o.beforeGet(d),P=d._private[o.field]),P}return l}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=xe({},r,e),function(a){var i=e,o=this,l=o.length!==void 0,u=l?o:[o];if(be(a)){for(var c=a.split(/\s+/),d=c.length,f=0;f<d;f++){var p=c[f];if(!nn(p)){var v=!i.immutableKeys[p];if(v)for(var h=0,g=u.length;h<g;h++)u[h]._private[i.field][p]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(a===void 0){for(var y=0,m=u.length;y<m;y++)for(var b=u[y]._private[i.field],w=Object.keys(b),C=0;C<w.length;C++){var x=w[C],E=!i.immutableKeys[x];E&&(b[x]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},iD={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(n,a){var i=this,o=Array.prototype.slice.call(arguments,0);return new xa(function(l,u){var c=function(v){i.off.apply(i,f),l(v)},d=o.concat([c]),f=d.concat([]);i.on.apply(i,d)})}}},Ve={};[X5,aD,iD].forEach(function(t){xe(Ve,t)});var oD={animate:Ve.animate(),animation:Ve.animation(),animated:Ve.animated(),clearQueue:Ve.clearQueue(),delay:Ve.delay(),delayAnimation:Ve.delayAnimation(),stop:Ve.stop()},Qo={classes:function(e){var r=this;if(e===void 0){var n=[];return r[0]._private.classes.forEach(function(h){return n.push(h)}),n}else He(e)||(e=(e||"").match(/\S+/g)||[]);for(var a=[],i=new ga(e),o=0;o<r.length;o++){for(var l=r[o],u=l._private,c=u.classes,d=!1,f=0;f<e.length;f++){var p=e[f],v=c.has(p);if(!v){d=!0;break}}d||(d=c.size!==e.length),d&&(u.classes=i,a.push(l))}return a.length>0&&this.spawn(a).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){He(e)||(e=e.match(/\S+/g)||[]);for(var n=this,a=r===void 0,i=[],o=0,l=n.length;o<l;o++)for(var u=n[o],c=u._private.classes,d=!1,f=0;f<e.length;f++){var p=e[f],v=c.has(p),h=!1;r||a&&!v?(c.add(p),h=!0):(!r||a&&v)&&(c.delete(p),h=!0),!d&&h&&(i.push(u),d=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var n=this;if(r==null)r=250;else if(r===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},r),n}};Qo.className=Qo.classNames=Qo.classes;var Le={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:lt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Le.variable="(?:[\\w-.]|(?:\\\\"+Le.metaChar+"))+",Le.className="(?:[\\w-]|(?:\\\\"+Le.metaChar+"))+",Le.value=Le.string+"|"+Le.number,Le.id=Le.variable,function(){var t,e,r;for(t=Le.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Le.comparatorOp+="|@"+e;for(t=Le.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Le.comparatorOp+="|\\!"+e)}();var $e=function(){return{checks:[]}},fe={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},cc=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return yT(t.selector,e.selector)}),sD=function(){for(var t={},e,r=0;r<cc.length;r++)e=cc[r],t[e.selector]=e.matches;return t}(),lD=function(e,r){return sD[e](r)},cD="("+cc.map(function(t){return t.selector}).join("|")+")",Ba=function(e){return e.replace(new RegExp("\\\\("+Le.metaChar+")","g"),function(r,n){return n})},cn=function(e,r,n){e[e.length-1]=n},uc=[{name:"group",query:!0,regex:"("+Le.group+")",populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:cD,populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Le.id+")",populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.ID,value:Ba(i)})}},{name:"className",query:!0,regex:"\\.("+Le.className+")",populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.CLASS,value:Ba(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Le.variable+")\\s*\\]",populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.DATA_EXIST,field:Ba(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Le.variable+")\\s*("+Le.comparatorOp+")\\s*("+Le.value+")\\s*\\]",populate:function(e,r,n){var a=sr(n,3),i=a[0],o=a[1],l=a[2],u=new RegExp("^"+Le.string+"$").exec(l)!=null;u?l=l.substring(1,l.length-1):l=parseFloat(l),r.checks.push({type:fe.DATA_COMPARE,field:Ba(i),operator:o,value:l})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Le.boolOp+")\\s*("+Le.variable+")\\s*\\]",populate:function(e,r,n){var a=sr(n,2),i=a[0],o=a[1];r.checks.push({type:fe.DATA_BOOL,field:Ba(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Le.meta+")\\s*("+Le.comparatorOp+")\\s*("+Le.number+")\\s*\\]\\]",populate:function(e,r,n){var a=sr(n,3),i=a[0],o=a[1],l=a[2];r.checks.push({type:fe.META_COMPARE,field:Ba(i),operator:o,value:parseFloat(l)})}},{name:"nextQuery",separator:!0,regex:Le.separator,populate:function(e,r){var n=e.currentSubject,a=e.edgeCount,i=e.compoundCount,o=e[e.length-1];n!=null&&(o.subject=n,e.currentSubject=null),o.edgeCount=a,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var l=e[e.length++]=$e();return l}},{name:"directedEdge",separator:!0,regex:Le.directedEdge,populate:function(e,r){if(e.currentSubject==null){var n=$e(),a=r,i=$e();return n.checks.push({type:fe.DIRECTED_EDGE,source:a,target:i}),cn(e,r,n),e.edgeCount++,i}else{var o=$e(),l=r,u=$e();return o.checks.push({type:fe.NODE_SOURCE,source:l,target:u}),cn(e,r,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Le.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var n=$e(),a=r,i=$e();return n.checks.push({type:fe.UNDIRECTED_EDGE,nodes:[a,i]}),cn(e,r,n),e.edgeCount++,i}else{var o=$e(),l=r,u=$e();return o.checks.push({type:fe.NODE_NEIGHBOR,node:l,neighbor:u}),cn(e,r,o),u}}},{name:"child",separator:!0,regex:Le.child,populate:function(e,r){if(e.currentSubject==null){var n=$e(),a=$e(),i=e[e.length-1];return n.checks.push({type:fe.CHILD,parent:i,child:a}),cn(e,r,n),e.compoundCount++,a}else if(e.currentSubject===r){var o=$e(),l=e[e.length-1],u=$e(),c=$e(),d=$e(),f=$e();return o.checks.push({type:fe.COMPOUND_SPLIT,left:l,right:u,subject:c}),c.checks=r.checks,r.checks=[{type:fe.TRUE}],f.checks.push({type:fe.TRUE}),u.checks.push({type:fe.PARENT,parent:f,child:d}),cn(e,l,o),e.currentSubject=c,e.compoundCount++,d}else{var p=$e(),v=$e(),h=[{type:fe.PARENT,parent:p,child:v}];return p.checks=r.checks,r.checks=h,e.compoundCount++,v}}},{name:"descendant",separator:!0,regex:Le.descendant,populate:function(e,r){if(e.currentSubject==null){var n=$e(),a=$e(),i=e[e.length-1];return n.checks.push({type:fe.DESCENDANT,ancestor:i,descendant:a}),cn(e,r,n),e.compoundCount++,a}else if(e.currentSubject===r){var o=$e(),l=e[e.length-1],u=$e(),c=$e(),d=$e(),f=$e();return o.checks.push({type:fe.COMPOUND_SPLIT,left:l,right:u,subject:c}),c.checks=r.checks,r.checks=[{type:fe.TRUE}],f.checks.push({type:fe.TRUE}),u.checks.push({type:fe.ANCESTOR,ancestor:f,descendant:d}),cn(e,l,o),e.currentSubject=c,e.compoundCount++,d}else{var p=$e(),v=$e(),h=[{type:fe.ANCESTOR,ancestor:p,descendant:v}];return p.checks=r.checks,r.checks=h,e.compoundCount++,v}}},{name:"subject",modifier:!0,regex:Le.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Ae("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var n=e[e.length-1],a=n.checks[0],i=a==null?null:a.type;i===fe.DIRECTED_EDGE?a.type=fe.NODE_TARGET:i===fe.UNDIRECTED_EDGE&&(a.type=fe.NODE_NEIGHBOR,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];uc.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var uD=function(e){for(var r,n,a,i=0;i<uc.length;i++){var o=uc[i],l=o.name,u=e.match(o.regexObj);if(u!=null){n=u,r=o,a=l;var c=u[0];e=e.substring(c.length);break}}return{expr:r,match:n,name:a,remaining:e}},dD=function(e){var r=e.match(/^\s+/);if(r){var n=r[0];e=e.substring(n.length)}return e},fD=function(e){var r=this,n=r.inputText=e,a=r[0]=$e();for(r.length=1,n=dD(n);;){var i=uD(n);if(i.expr==null)return Ae("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),l=i.expr.populate(r,a,o);if(l===!1)return!1;if(l!=null&&(a=l),n=i.remaining,n.match(/^\s*$/))break}var u=r[r.length-1];r.currentSubject!=null&&(u.subject=r.currentSubject),u.edgeCount=r.edgeCount,u.compoundCount=r.compoundCount;for(var c=0;c<r.length;c++){var d=r[c];if(d.compoundCount>0&&d.edgeCount>0)return Ae("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(d.edgeCount>1)return Ae("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;d.edgeCount===1&&Ae("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},hD=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(d){return d??""},r=function(d){return be(d)?'"'+d+'"':e(d)},n=function(d){return" "+d+" "},a=function(d,f){var p=d.type,v=d.value;switch(p){case fe.GROUP:{var h=e(v);return h.substring(0,h.length-1)}case fe.DATA_COMPARE:{var g=d.field,y=d.operator;return"["+g+n(e(y))+r(v)+"]"}case fe.DATA_BOOL:{var m=d.operator,b=d.field;return"["+e(m)+b+"]"}case fe.DATA_EXIST:{var w=d.field;return"["+w+"]"}case fe.META_COMPARE:{var C=d.operator,x=d.field;return"[["+x+n(e(C))+r(v)+"]]"}case fe.STATE:return v;case fe.ID:return"#"+v;case fe.CLASS:return"."+v;case fe.PARENT:case fe.CHILD:return i(d.parent,f)+n(">")+i(d.child,f);case fe.ANCESTOR:case fe.DESCENDANT:return i(d.ancestor,f)+" "+i(d.descendant,f);case fe.COMPOUND_SPLIT:{var E=i(d.left,f),k=i(d.subject,f),B=i(d.right,f);return E+(E.length>0?" ":"")+k+B}case fe.TRUE:return""}},i=function(d,f){return d.checks.reduce(function(p,v,h){return p+(f===d&&h===0?"$":"")+a(v,f)},"")},o="",l=0;l<this.length;l++){var u=this[l];o+=i(u,u.subject),this.length>1&&l<this.length-1&&(o+=", ")}return this.toStringCache=o,o},pD={parse:fD,toString:hD},Lp=function(e,r,n){var a,i=be(e),o=le(e),l=be(n),u,c,d=!1,f=!1,p=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),f=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),d=!0),(i||l||d)&&(u=!i&&!o?"":""+e,c=""+n),d&&(e=u=u.toLowerCase(),n=c=c.toLowerCase()),r){case"*=":a=u.indexOf(c)>=0;break;case"$=":a=u.indexOf(c,u.length-c.length)>=0;break;case"^=":a=u.indexOf(c)===0;break;case"=":a=e===n;break;case">":p=!0,a=e>n;break;case">=":p=!0,a=e>=n;break;case"<":p=!0,a=e<n;break;case"<=":p=!0,a=e<=n;break;default:a=!1;break}return f&&(e!=null||!p)&&(a=!a),a},vD=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},gD=function(e){return e!==void 0},dc=function(e,r){return e.data(r)},mD=function(e,r){return e[r]()},Ze=[],je=function(e,r){return e.checks.every(function(n){return Ze[n.type](n,r)})};Ze[fe.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()},Ze[fe.STATE]=function(t,e){var r=t.value;return lD(r,e)},Ze[fe.ID]=function(t,e){var r=t.value;return e.id()===r},Ze[fe.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)},Ze[fe.META_COMPARE]=function(t,e){var r=t.field,n=t.operator,a=t.value;return Lp(mD(e,r),n,a)},Ze[fe.DATA_COMPARE]=function(t,e){var r=t.field,n=t.operator,a=t.value;return Lp(dc(e,r),n,a)},Ze[fe.DATA_BOOL]=function(t,e){var r=t.field,n=t.operator;return vD(dc(e,r),n)},Ze[fe.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,gD(dc(e,r))},Ze[fe.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],n=t.nodes[1],a=e.source(),i=e.target();return je(r,a)&&je(n,i)||je(n,a)&&je(r,i)},Ze[fe.NODE_NEIGHBOR]=function(t,e){return je(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&je(t.neighbor,r)})},Ze[fe.DIRECTED_EDGE]=function(t,e){return je(t.source,e.source())&&je(t.target,e.target())},Ze[fe.NODE_SOURCE]=function(t,e){return je(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&je(t.target,r)})},Ze[fe.NODE_TARGET]=function(t,e){return je(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&je(t.source,r)})},Ze[fe.CHILD]=function(t,e){return je(t.child,e)&&je(t.parent,e.parent())},Ze[fe.PARENT]=function(t,e){return je(t.parent,e)&&e.children().some(function(r){return je(t.child,r)})},Ze[fe.DESCENDANT]=function(t,e){return je(t.descendant,e)&&e.ancestors().some(function(r){return je(t.ancestor,r)})},Ze[fe.ANCESTOR]=function(t,e){return je(t.ancestor,e)&&e.descendants().some(function(r){return je(t.descendant,r)})},Ze[fe.COMPOUND_SPLIT]=function(t,e){return je(t.subject,e)&&je(t.left,e)&&je(t.right,e)},Ze[fe.TRUE]=function(){return!0},Ze[fe.COLLECTION]=function(t,e){var r=t.value;return r.has(e)},Ze[fe.FILTER]=function(t,e){var r=t.value;return r(e)};var yD=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===fe.ID)return e.getElementById(r[0].checks[0].value).collection();var n=function(i){for(var o=0;o<r.length;o++){var l=r[o];if(je(l,i))return!0}return!1};return r.text()==null&&(n=function(){return!0}),e.filter(n)},bD=function(e){for(var r=this,n=0;n<r.length;n++){var a=r[n];if(je(a,e))return!0}return!1},wD={matches:bD,filter:yD},un=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||be(e)&&e.match(/^\s*$/)||(Ut(e)?this.addQuery({checks:[{type:fe.COLLECTION,value:e.collection()}]}):Ye(e)?this.addQuery({checks:[{type:fe.FILTER,value:e}]}):be(e)?this.parse(e)||(this.invalid=!0):Xe("A selector must be created from a string; found "))},dn=un.prototype;[pD,wD].forEach(function(t){return xe(dn,t)}),dn.text=function(){return this.inputText},dn.size=function(){return this.length},dn.eq=function(t){return this[t]},dn.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()},dn.addQuery=function(t){this[this.length++]=t},dn.selector=dn.toString;var fn={allAre:function(e){var r=new un(e);return this.every(function(n){return r.matches(n)})},is:function(e){var r=new un(e);return this.some(function(n){return r.matches(n)})},some:function(e,r){for(var n=0;n<this.length;n++){var a=r?e.apply(r,[this[n],n,this]):e(this[n],n,this);if(a)return!0}return!1},every:function(e,r){for(var n=0;n<this.length;n++){var a=r?e.apply(r,[this[n],n,this]):e(this[n],n,this);if(!a)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,n=e.length;return r!==n?!1:r===1?this[0]===e[0]:this.every(function(a){return e.hasElementWithId(a.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(n){return r.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(n){return r.hasElementWithId(n.id())})}};fn.allAreNeighbours=fn.allAreNeighbors,fn.has=fn.contains,fn.equal=fn.equals=fn.same;var Qt=function(e,r){return function(a,i,o,l){var u=a,c=this,d;if(u==null?d="":Ut(u)&&u.length===1&&(d=u.id()),c.length===1&&d){var f=c[0]._private,p=f.traversalCache=f.traversalCache||{},v=p[r]=p[r]||[],h=Mn(d),g=v[h];return g||(v[h]=e.call(c,a,i,o,l))}else return e.call(c,a,i,o,l)}},Na={parent:function(e){var r=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var a=0;a<this.length;a++){var i=this[a],o=i._private.parent;o&&r.push(o)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],n=this.parent();n.nonempty();){for(var a=0;a<n.length;a++){var i=n[a];r.push(i)}n=n.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,n=0;n<this.length;n++){var a=this[n],i=a.parents();r=r||i,r=r.intersect(i)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Qt(function(t){for(var e=[],r=0;r<this.length;r++)for(var n=this[r],a=n._private.children,i=0;i<a.length;i++)e.push(a[i]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function n(a){for(var i=0;i<a.length;i++){var o=a[i];r.push(o),o.children().nonempty()&&n(o.children())}}return n(this.children()),this.spawn(r,!0).filter(e)}};function fc(t,e,r,n){for(var a=[],i=new ga,o=t.cy(),l=o.hasCompoundNodes(),u=0;u<t.length;u++){var c=t[u];r?a.push(c):l&&n(a,i,c)}for(;a.length>0;){var d=a.shift();e(d),i.add(d.id()),l&&n(a,i,d)}return t}function Fp(t,e,r){if(r.isParent())for(var n=r._private.children,a=0;a<n.length;a++){var i=n[a];e.has(i.id())||t.push(i)}}Na.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return fc(this,t,e,Fp)};function Mp(t,e,r){if(r.isChild()){var n=r._private.parent;e.has(n.id())||t.push(n)}}Na.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return fc(this,t,e,Mp)};function CD(t,e,r){Mp(t,e,r),Fp(t,e,r)}Na.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return fc(this,t,e,CD)},Na.ancestors=Na.parents;var Pi,Ip;Pi=Ip={data:Ve.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:Ve.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ve.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ve.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ve.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ve.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Pi.attr=Pi.data,Pi.removeAttr=Pi.removeData;var kD=Ip,Jo={};function hc(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var n=0,a=r[0],i=a._private.edges,o=0;o<i.length;o++){var l=i[o];!e&&l.isLoop()||(n+=t(a,l))}return n}else return}}xe(Jo,{degree:hc(function(t,e){return e.source().same(e.target())?2:1}),indegree:hc(function(t,e){return e.target().same(t)?1:0}),outdegree:hc(function(t,e){return e.source().same(t)?1:0})});function Da(t,e){return function(r){for(var n,a=this.nodes(),i=0;i<a.length;i++){var o=a[i],l=o[t](r);l!==void 0&&(n===void 0||e(l,n))&&(n=l)}return n}}xe(Jo,{minDegree:Da("degree",function(t,e){return t<e}),maxDegree:Da("degree",function(t,e){return t>e}),minIndegree:Da("indegree",function(t,e){return t<e}),maxIndegree:Da("indegree",function(t,e){return t>e}),minOutdegree:Da("outdegree",function(t,e){return t<e}),maxOutdegree:Da("outdegree",function(t,e){return t>e})}),xe(Jo,{totalDegree:function(e){for(var r=0,n=this.nodes(),a=0;a<n.length;a++)r+=n[a].degree(e);return r}});var cr,Ap,Vp=function(e,r,n){for(var a=0;a<e.length;a++){var i=e[a];if(!i.locked()){var o=i._private.position,l={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};i.isParent()&&!(l.x===0&&l.y===0)&&i.children().shift(l,n),i.dirtyBoundingBoxCache()}}},Rp={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){Vp(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};cr=Ap={position:Ve.data(Rp),silentPosition:Ve.data(xe({},Rp,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){Vp(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(_e(e))r?this.silentPosition(e):this.position(e);else if(Ye(e)){var n=e,a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o=this[i],l=void 0;(l=n(o,i))&&(r?o.silentPosition(l):o.position(l))}a.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,n){var a;if(_e(e)?(a={x:le(e.x)?e.x:0,y:le(e.y)?e.y:0},n=r):be(e)&&le(r)&&(a={x:0,y:0},a[e]=r),a!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var l=this[o];if(!(i.hasCompoundNodes()&&l.isChild()&&l.ancestors().anySame(this))){var u=l.position(),c={x:u.x+a.x,y:u.y+a.y};n?l.silentPosition(c):l.position(c)}}i.endBatch()}return this},silentShift:function(e,r){return _e(e)?this.shift(e,!0):be(e)&&le(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var n=this[0],a=this.cy(),i=a.zoom(),o=a.pan(),l=_e(e)?e:void 0,u=l!==void 0||r!==void 0&&be(e);if(n&&n.isNode())if(u)for(var c=0;c<this.length;c++){var d=this[c];r!==void 0?d.position(e,(r-o[e])/i):l!==void 0&&d.position(Kh(l,i,o))}else{var f=n.position();return l=Ao(f,i,o),e===void 0?l:l[e]}else if(!u)return;return this},relativePosition:function(e,r){var n=this[0],a=this.cy(),i=_e(e)?e:void 0,o=i!==void 0||r!==void 0&&be(e),l=a.hasCompoundNodes();if(n&&n.isNode())if(o)for(var u=0;u<this.length;u++){var c=this[u],d=l?c.parent():null,f=d&&d.length>0,p=f;f&&(d=d[0]);var v=p?d.position():{x:0,y:0};r!==void 0?c.position(e,r+v[e]):i!==void 0&&c.position({x:i.x+v.x,y:i.y+v.y})}else{var h=n.position(),g=l?n.parent():null,y=g&&g.length>0,m=y;y&&(g=g[0]);var b=m?g.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(!o)return;return this}},cr.modelPosition=cr.point=cr.position,cr.modelPositions=cr.points=cr.positions,cr.renderedPoint=cr.renderedPosition,cr.relativePoint=cr.relativePosition;var xD=Ap,Pa,hn;Pa=hn={},hn.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),n=r.zoom(),a=r.pan(),i=e.x1*n+a.x,o=e.x2*n+a.x,l=e.y1*n+a.y,u=e.y2*n+a.y;return{x1:i,x2:o,y1:l,y2:u,w:o-i,h:u-l}},hn.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var n=r._private;n.compoundBoundsClean=!1,n.bbCache=null,t||r.emitAndNotify("bounds")}}),this)},hn.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(o){if(!o.isParent())return;var l=o._private,u=o.children(),c=o.pstyle("compound-sizing-wrt-labels").value==="include",d={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},f=u.boundingBox({includeLabels:c,includeOverlays:!1,useCache:!1}),p=l.position;(f.w===0||f.h===0)&&(f={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},f.x1=p.x-f.w/2,f.x2=p.x+f.w/2,f.y1=p.y-f.h/2,f.y2=p.y+f.h/2);function v(S,N,D){var P=0,L=0,O=N+D;return S>0&&O>0&&(P=N/O*S,L=D/O*S),{biasDiff:P,biasComplementDiff:L}}function h(S,N,D,P){if(D.units==="%")switch(P){case"width":return S>0?D.pfValue*S:0;case"height":return N>0?D.pfValue*N:0;case"average":return S>0&&N>0?D.pfValue*(S+N)/2:0;case"min":return S>0&&N>0?S>N?D.pfValue*N:D.pfValue*S:0;case"max":return S>0&&N>0?S>N?D.pfValue*S:D.pfValue*N:0;default:return 0}else return D.units==="px"?D.pfValue:0}var g=d.width.left.value;d.width.left.units==="px"&&d.width.val>0&&(g=g*100/d.width.val);var y=d.width.right.value;d.width.right.units==="px"&&d.width.val>0&&(y=y*100/d.width.val);var m=d.height.top.value;d.height.top.units==="px"&&d.height.val>0&&(m=m*100/d.height.val);var b=d.height.bottom.value;d.height.bottom.units==="px"&&d.height.val>0&&(b=b*100/d.height.val);var w=v(d.width.val-f.w,g,y),C=w.biasDiff,x=w.biasComplementDiff,E=v(d.height.val-f.h,m,b),k=E.biasDiff,B=E.biasComplementDiff;l.autoPadding=h(f.w,f.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),l.autoWidth=Math.max(f.w,d.width.val),p.x=(-C+f.x1+f.x2+x)/2,l.autoHeight=Math.max(f.h,d.height.val),p.y=(-k+f.y1+f.y2+B)/2}for(var n=0;n<this.length;n++){var a=this[n],i=a._private;(!i.compoundBoundsClean||t)&&(r(a),e.batching()||(i.compoundBoundsClean=!0))}return this};var Jt=function(e){return e===1/0||e===-1/0?0:e},ur=function(e,r,n,a,i){a-r===0||i-n===0||r==null||n==null||a==null||i==null||(e.x1=r<e.x1?r:e.x1,e.x2=a>e.x2?a:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},zn=function(e,r){return r==null?e:ur(e,r.x1,r.y1,r.x2,r.y2)},Oi=function(e,r,n){return lr(e,r,n)},es=function(e,r,n){if(!r.cy().headless()){var a=r._private,i=a.rstyle,o=i.arrowWidth/2,l=r.pstyle(n+"-arrow-shape").value,u,c;if(l!=="none"){n==="source"?(u=i.srcX,c=i.srcY):n==="target"?(u=i.tgtX,c=i.tgtY):(u=i.midX,c=i.midY);var d=a.arrowBounds=a.arrowBounds||{},f=d[n]=d[n]||{};f.x1=u-o,f.y1=c-o,f.x2=u+o,f.y2=c+o,f.w=f.x2-f.x1,f.h=f.y2-f.y1,Ro(f,1),ur(e,f.x1,f.y1,f.x2,f.y2)}}},pc=function(e,r,n){if(!r.cy().headless()){var a;n?a=n+"-":a="";var i=r._private,o=i.rstyle,l=r.pstyle(a+"label").strValue;if(l){var u=r.pstyle("text-halign"),c=r.pstyle("text-valign"),d=Oi(o,"labelWidth",n),f=Oi(o,"labelHeight",n),p=Oi(o,"labelX",n),v=Oi(o,"labelY",n),h=r.pstyle(a+"text-margin-x").pfValue,g=r.pstyle(a+"text-margin-y").pfValue,y=r.isEdge(),m=r.pstyle(a+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,w=r.pstyle("text-border-width").pfValue,C=w/2,x=r.pstyle("text-background-padding").pfValue,E=2,k=f,B=d,S=B/2,N=k/2,D,P,L,O;if(y)D=p-S,P=p+S,L=v-N,O=v+N;else{switch(u.value){case"left":D=p-B,P=p;break;case"center":D=p-S,P=p+S;break;case"right":D=p,P=p+B;break}switch(c.value){case"top":L=v-k,O=v;break;case"center":L=v-N,O=v+N;break;case"bottom":L=v,O=v+k;break}}D+=h-Math.max(b,C)-x-E,P+=h+Math.max(b,C)+x+E,L+=g-Math.max(b,C)-x-E,O+=g+Math.max(b,C)+x+E;var I=n||"main",_=i.labelBounds,M=_[I]=_[I]||{};M.x1=D,M.y1=L,M.x2=P,M.y2=O,M.w=P-D,M.h=O-L;var F=y&&m.strValue==="autorotate",V=m.pfValue!=null&&m.pfValue!==0;if(F||V){var H=F?Oi(i.rstyle,"labelAngle",n):m.pfValue,$=Math.cos(H),z=Math.sin(H),j=(D+P)/2,ee=(L+O)/2;if(!y){switch(u.value){case"left":j=P;break;case"right":j=D;break}switch(c.value){case"top":ee=O;break;case"bottom":ee=L;break}}var J=function(he,ne){return he=he-j,ne=ne-ee,{x:he*$-ne*z+j,y:he*z+ne*$+ee}},Z=J(D,L),re=J(D,O),Y=J(P,L),A=J(P,O);D=Math.min(Z.x,re.x,Y.x,A.x),P=Math.max(Z.x,re.x,Y.x,A.x),L=Math.min(Z.y,re.y,Y.y,A.y),O=Math.max(Z.y,re.y,Y.y,A.y)}var K=I+"Rot",W=_[K]=_[K]||{};W.x1=D,W.y1=L,W.x2=P,W.y2=O,W.w=P-D,W.h=O-L,ur(e,D,L,P,O),ur(i.labelBounds.all,D,L,P,O)}return e}},ED=function(e,r){if(!r.cy().headless()){var n=r.pstyle("outline-opacity").value,a=r.pstyle("outline-width").value;if(n>0&&a>0){var i=r.pstyle("outline-offset").value,o=r.pstyle("shape").value,l=a+i,u=(e.w+l*2)/e.w,c=(e.h+l*2)/e.h,d=0,f=0;["diamond","pentagon","round-triangle"].includes(o)?(u=(e.w+l*2.4)/e.w,f=-l/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?u=(e.w+l*2.4)/e.w:o==="star"?(u=(e.w+l*2.8)/e.w,c=(e.h+l*2.6)/e.h,f=-l/3.8):o==="triangle"?(u=(e.w+l*2.8)/e.w,c=(e.h+l*2.4)/e.h,f=-l/1.4):o==="vee"&&(u=(e.w+l*4.4)/e.w,c=(e.h+l*3.8)/e.h,f=-l*.5);var p=e.h*c-e.h,v=e.w*u-e.w;if($o(e,[Math.ceil(p/2),Math.ceil(v/2)]),d!=0||f!==0){var h=UB(e,d,f);Uh(e,h)}}}},SD=function(e,r){var n=e._private.cy,a=n.styleEnabled(),i=n.headless(),o=zt(),l=e._private,u=e.isNode(),c=e.isEdge(),d,f,p,v,h,g,y=l.rstyle,m=u&&a?e.pstyle("bounds-expansion").pfValue:[0],b=function(ue){return ue.pstyle("display").value!=="none"},w=!a||b(e)&&(!c||b(e.source())&&b(e.target()));if(w){var C=0,x=0;a&&r.includeOverlays&&(C=e.pstyle("overlay-opacity").value,C!==0&&(x=e.pstyle("overlay-padding").value));var E=0,k=0;a&&r.includeUnderlays&&(E=e.pstyle("underlay-opacity").value,E!==0&&(k=e.pstyle("underlay-padding").value));var B=Math.max(x,k),S=0,N=0;if(a&&(S=e.pstyle("width").pfValue,N=S/2),u&&r.includeNodes){var D=e.position();h=D.x,g=D.y;var P=e.outerWidth(),L=P/2,O=e.outerHeight(),I=O/2;d=h-L,f=h+L,p=g-I,v=g+I,ur(o,d,p,f,v),a&&r.includeOutlines&&ED(o,e)}else if(c&&r.includeEdges)if(a&&!i){var _=e.pstyle("curve-style").strValue;if(d=Math.min(y.srcX,y.midX,y.tgtX),f=Math.max(y.srcX,y.midX,y.tgtX),p=Math.min(y.srcY,y.midY,y.tgtY),v=Math.max(y.srcY,y.midY,y.tgtY),d-=N,f+=N,p-=N,v+=N,ur(o,d,p,f,v),_==="haystack"){var M=y.haystackPts;if(M&&M.length===2){if(d=M[0].x,p=M[0].y,f=M[1].x,v=M[1].y,d>f){var F=d;d=f,f=F}if(p>v){var V=p;p=v,v=V}ur(o,d-N,p-N,f+N,v+N)}}else if(_==="bezier"||_==="unbundled-bezier"||_.endsWith("segments")||_.endsWith("taxi")){var H;switch(_){case"bezier":case"unbundled-bezier":H=y.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":H=y.linePts;break}if(H!=null)for(var $=0;$<H.length;$++){var z=H[$];d=z.x-N,f=z.x+N,p=z.y-N,v=z.y+N,ur(o,d,p,f,v)}}}else{var j=e.source(),ee=j.position(),J=e.target(),Z=J.position();if(d=ee.x,f=Z.x,p=ee.y,v=Z.y,d>f){var re=d;d=f,f=re}if(p>v){var Y=p;p=v,v=Y}d-=N,f+=N,p-=N,v+=N,ur(o,d,p,f,v)}if(a&&r.includeEdges&&c&&(es(o,e,"mid-source"),es(o,e,"mid-target"),es(o,e,"source"),es(o,e,"target")),a){var A=e.pstyle("ghost").value==="yes";if(A){var K=e.pstyle("ghost-offset-x").pfValue,W=e.pstyle("ghost-offset-y").pfValue;ur(o,o.x1+K,o.y1+W,o.x2+K,o.y2+W)}}var oe=l.bodyBounds=l.bodyBounds||{};Gh(oe,o),$o(oe,m),Ro(oe,1),a&&(d=o.x1,f=o.x2,p=o.y1,v=o.y2,ur(o,d-B,p-B,f+B,v+B));var he=l.overlayBounds=l.overlayBounds||{};Gh(he,o),$o(he,m),Ro(he,1);var ne=l.labelBounds=l.labelBounds||{};ne.all!=null?qB(ne.all):ne.all=zt(),a&&r.includeLabels&&(r.includeMainLabels&&pc(o,e,null),c&&(r.includeSourceLabels&&pc(o,e,"source"),r.includeTargetLabels&&pc(o,e,"target")))}return o.x1=Jt(o.x1),o.y1=Jt(o.y1),o.x2=Jt(o.x2),o.y2=Jt(o.y2),o.w=Jt(o.x2-o.x1),o.h=Jt(o.y2-o.y1),o.w>0&&o.h>0&&w&&($o(o,m),Ro(o,1)),o},$p=function(e){var r=0,n=function(o){return(o?1:0)<<r++},a=0;return a+=n(e.incudeNodes),a+=n(e.includeEdges),a+=n(e.includeLabels),a+=n(e.includeMainLabels),a+=n(e.includeSourceLabels),a+=n(e.includeTargetLabels),a+=n(e.includeOverlays),a+=n(e.includeOutlines),a},zp=function(e){if(e.isEdge()){var r=e.source().position(),n=e.target().position(),a=function(o){return Math.round(o)};return dB([a(r.x),a(r.y),a(n.x),a(n.y)])}else return 0},Hp=function(e,r){var n=e._private,a,i=e.isEdge(),o=r==null?Kp:$p(r),l=o===Kp,u=zp(e),c=n.bbCachePosKey===u,d=r.useCache&&c,f=function(g){return g._private.bbCache==null||g._private.styleDirty},p=!d||f(e)||i&&f(e.source())||f(e.target());if(p?(c||e.recalculateRenderedStyle(d),a=SD(e,_i),n.bbCache=a,n.bbCachePosKey=u):a=n.bbCache,!l){var v=e.isNode();a=zt(),(r.includeNodes&&v||r.includeEdges&&!v)&&(r.includeOverlays?zn(a,n.overlayBounds):zn(a,n.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?zn(a,n.labelBounds.all):(r.includeMainLabels&&zn(a,n.labelBounds.mainRot),r.includeSourceLabels&&zn(a,n.labelBounds.sourceRot),r.includeTargetLabels&&zn(a,n.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},_i={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Kp=$p(_i),qp=wt(_i);hn.boundingBox=function(t){var e;if(this.length===1&&this[0]._private.bbCache!=null&&!this[0]._private.styleDirty&&(t===void 0||t.useCache===void 0||t.useCache===!0))t===void 0?t=_i:t=qp(t),e=Hp(this[0],t);else{e=zt(),t=t||_i;var r=qp(t),n=this,a=n.cy(),i=a.styleEnabled();if(i)for(var o=0;o<n.length;o++){var l=n[o],u=l._private,c=zp(l),d=u.bbCachePosKey===c,f=r.useCache&&d&&!u.styleDirty;l.recalculateRenderedStyle(f)}this.updateCompoundBounds(!t.useCache);for(var p=0;p<n.length;p++){var v=n[p];zn(e,Hp(v,r))}}return e.x1=Jt(e.x1),e.y1=Jt(e.y1),e.x2=Jt(e.x2),e.y2=Jt(e.y2),e.w=Jt(e.x2-e.x1),e.h=Jt(e.y2-e.y1),e},hn.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},hn.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),n=r.hasCompoundNodes(),a=r.collection();if(n&&(a=e.filter(function(c){return c.isParent()}),e=e.not(a)),_e(t)){var i=t;t=function(){return i}}var o=function(d,f){return d._private.bbAtOldPos=t(d,f)},l=function(d){return d._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var u=KB(this.boundingBox({useCache:!1}));return e.silentPositions(l),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),r.endBatch(),u},Pa.boundingbox=Pa.bb=Pa.boundingBox,Pa.renderedBoundingbox=Pa.renderedBoundingBox;var TD=hn,Li,Fi;Li=Fi={};var Up=function(e){e.uppercaseName=xh(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=xh(e.outerName),Li[e.name]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){if(n.isParent())return n.updateCompoundBounds(),a[e.autoName]||0;var l=n.pstyle(e.name);switch(l.strValue){case"label":return n.recalculateRenderedStyle(),a.rstyle[e.labelName]||0;default:return l.pfValue}}else return 1},Li["outer"+e.uppercaseName]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){var l=n[e.name](),u=n.pstyle("border-width").pfValue,c=2*n.padding();return l+u+c}else return 1},Li["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var a=n[e.name]();return a*this.cy().zoom()}},Li["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n){var a=n[e.outerName]();return a*this.cy().zoom()}}};Up({name:"width"}),Up({name:"height"}),Fi.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue},Fi.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()},Fi.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var BD=Fi,ND=function(e,r){if(e.isEdge())return r(e)},DD=function(e,r){if(e.isEdge()){var n=e.cy();return Ao(r(e),n.zoom(),n.pan())}},PD=function(e,r){if(e.isEdge()){var n=e.cy(),a=n.pan(),i=n.zoom();return r(e).map(function(o){return Ao(o,i,a)})}},OD=function(e){return e.renderer().getControlPoints(e)},_D=function(e){return e.renderer().getSegmentPoints(e)},LD=function(e){return e.renderer().getSourceEndpoint(e)},FD=function(e){return e.renderer().getTargetEndpoint(e)},MD=function(e){return e.renderer().getEdgeMidpoint(e)},Gp={controlPoints:{get:OD,mult:!0},segmentPoints:{get:_D,mult:!0},sourceEndpoint:{get:LD},targetEndpoint:{get:FD},midpoint:{get:MD}},ID=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},AD=Object.keys(Gp).reduce(function(t,e){var r=Gp[e],n=ID(e);return t[e]=function(){return ND(this,r.get)},r.mult?t[n]=function(){return PD(this,r.get)}:t[n]=function(){return DD(this,r.get)},t},{}),VD=xe({},xD,TD,BD,AD);/*!
438
+ */var pp=0,vp=1,gp=2,$r=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=pp,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))};$r.prototype={fulfill:function(e){return mp(this,vp,"fulfillValue",e)},reject:function(e){return mp(this,gp,"rejectReason",e)},then:function(e,r){var n=this,a=new $r;return n.onFulfilled.push(wp(e,a,"fulfill")),n.onRejected.push(wp(r,a,"reject")),yp(n),a.proxy}};var mp=function(e,r,n,a){return e.state===pp&&(e.state=r,e[n]=a,yp(e)),e},yp=function(e){e.state===vp?bp(e,"onFulfilled",e.fulfillValue):e.state===gp&&bp(e,"onRejected",e.rejectReason)},bp=function(e,r,n){if(e[r].length!==0){var a=e[r];e[r]=[];var i=function(){for(var l=0;l<a.length;l++)a[l](n)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},wp=function(e,r,n){return function(a){if(typeof e!="function")r[n].call(r,a);else{var i;try{i=e(a)}catch(o){r.reject(o);return}Y5(r,i)}}},Y5=function t(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var n;if(ot(r)==="object"&&r!==null||typeof r=="function")try{n=r.then}catch(i){e.reject(i);return}if(typeof n=="function"){var a=!1;try{n.call(r,function(i){a||(a=!0,i===r?e.reject(new TypeError("circular thenable chain")):t(e,i))},function(i){a||(a=!0,e.reject(i))})}catch(i){a||e.reject(i)}return}e.fulfill(r)};$r.all=function(t){return new $r(function(e,r){for(var n=new Array(t.length),a=0,i=function(u,c){n[u]=c,a++,a===t.length&&e(n)},o=0;o<t.length;o++)(function(l){var u=t[l],c=u!=null&&u.then!=null;if(c)u.then(function(f){i(l,f)},function(f){r(f)});else{var d=u;i(l,d)}})(o)})},$r.resolve=function(t){return new $r(function(e,r){e(t)})},$r.reject=function(t){return new $r(function(e,r){r(t)})};var xa=typeof Promise<"u"?Promise:$r,ac=function(e,r,n){var a=zl(e),i=!a,o=this._private=xe({duration:1e3},r,n);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&Ye(o.complete)&&o.completes.push(o.complete),i){var l=e.position();o.startPosition=o.startPosition||{x:l.x,y:l.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(a){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},$n=ac.prototype;xe($n,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,n=e.target._private.animation;e.queue?r=n.queue:r=n.current,r.push(this),Ut(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,n=r.playing;return e===void 0?r.progress:(n&&this.pause(),r.progress=e,r.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(c,d){var f=e[c];f!=null&&(e[c]=e[d],e[d]=f)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var a=0;a<e.style.length;a++){var i=e.style[a],o=i.name,l=e.startStyle[o];e.startStyle[o]=i,e.style[a]=l}return r&&this.play(),this},promise:function(e){var r=this._private,n;switch(e){case"frame":n=r.frames;break;default:case"complete":case"completed":n=r.completes}return new xa(function(a,i){n.push(function(){a()})})}}),$n.complete=$n.completed,$n.run=$n.play,$n.running=$n.playing;var X5={animated:function(){return function(){var r=this,n=r.length!==void 0,a=n?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=a[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,n=r.length!==void 0,a=n?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<a.length;o++){var l=a[o];l._private.animation.queue=[]}return this}},delay:function(){return function(r,n){var a=this._private.cy||this;return a.styleEnabled()?this.animate({delay:r,duration:r,complete:n}):this}},delayAnimation:function(){return function(r,n){var a=this._private.cy||this;return a.styleEnabled()?this.animation({delay:r,duration:r,complete:n}):this}},animation:function(){return function(r,n){var a=this,i=a.length!==void 0,o=i?a:[a],l=this._private.cy||this,u=!i,c=!u;if(!l.styleEnabled())return this;var d=l.style();r=xe({},r,n);var f=Object.keys(r).length===0;if(f)return new ac(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(c&&(r.style=d.getPropsList(r.style||r.css),r.css=void 0),c&&r.renderedPosition!=null){var p=r.renderedPosition,v=l.pan(),h=l.zoom();r.position=Kh(p,h,v)}if(u&&r.panBy!=null){var g=r.panBy,y=l.pan();r.pan={x:y.x+g.x,y:y.y+g.y}}var m=r.center||r.centre;if(u&&m!=null){var b=l.getCenterPan(m.eles,r.zoom);b!=null&&(r.pan=b)}if(u&&r.fit!=null){var w=r.fit,C=l.getFitViewport(w.eles||w.boundingBox,w.padding);C!=null&&(r.pan=C.pan,r.zoom=C.zoom)}if(u&&_e(r.zoom)){var x=l.getZoomedViewport(r.zoom);x!=null?(x.zoomed&&(r.zoom=x.zoom),x.panned&&(r.pan=x.pan)):r.zoom=null}return new ac(o[0],r)}},animate:function(){return function(r,n){var a=this,i=a.length!==void 0,o=i?a:[a],l=this._private.cy||this;if(!l.styleEnabled())return this;n&&(r=xe({},r,n));for(var u=0;u<o.length;u++){var c=o[u],d=c.animated()&&(r.queue===void 0||r.queue),f=c.animation(r,d?{queue:!0}:void 0);f.play()}return this}},stop:function(){return function(r,n){var a=this,i=a.length!==void 0,o=i?a:[a],l=this._private.cy||this;if(!l.styleEnabled())return this;for(var u=0;u<o.length;u++){for(var c=o[u],d=c._private,f=d.animation.current,p=0;p<f.length;p++){var v=f[p],h=v._private;n&&(h.duration=0)}r&&(d.animation.queue=[]),n||(d.animation.current=[])}return l.notify("draw"),this}}},Z5=Array.isArray,Yo=Z5,Q5=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J5=/^\w*$/;function eN(t,e){if(Yo(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||bi(t)?!0:J5.test(t)||!Q5.test(t)||e!=null&&t in Object(e)}var tN=eN,rN="[object AsyncFunction]",nN="[object Function]",aN="[object GeneratorFunction]",iN="[object Proxy]";function oN(t){if(!Fn(t))return!1;var e=Dh(t);return e==nN||e==aN||e==rN||e==iN}var sN=oN,lN=Oo["__core-js_shared__"],ic=lN,Cp=function(){var t=/[^.]+$/.exec(ic&&ic.keys&&ic.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function cN(t){return!!Cp&&Cp in t}var uN=cN,dN=Function.prototype,fN=dN.toString;function hN(t){if(t!=null){try{return fN.call(t)}catch{}try{return t+""}catch{}}return""}var pN=hN,vN=/[\\^$.*+?()[\]{}|]/g,gN=/^\[object .+?Constructor\]$/,mN=Function.prototype,yN=Object.prototype,bN=mN.toString,wN=yN.hasOwnProperty,CN=RegExp("^"+bN.call(wN).replace(vN,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function kN(t){if(!Fn(t)||uN(t))return!1;var e=sN(t)?CN:gN;return e.test(pN(t))}var xN=kN;function EN(t,e){return t==null?void 0:t[e]}var SN=EN;function TN(t,e){var r=SN(t,e);return xN(r)?r:void 0}var oc=TN,BN=oc(Object,"create"),Di=BN;function NN(){this.__data__=Di?Di(null):{},this.size=0}var DN=NN;function PN(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ON=PN,_N="__lodash_hash_undefined__",LN=Object.prototype,FN=LN.hasOwnProperty;function MN(t){var e=this.__data__;if(Di){var r=e[t];return r===_N?void 0:r}return FN.call(e,t)?e[t]:void 0}var IN=MN,AN=Object.prototype,VN=AN.hasOwnProperty;function RN(t){var e=this.__data__;return Di?e[t]!==void 0:VN.call(e,t)}var $N=RN,zN="__lodash_hash_undefined__";function HN(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Di&&e===void 0?zN:e,this}var KN=HN;function Ea(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ea.prototype.clear=DN,Ea.prototype.delete=ON,Ea.prototype.get=IN,Ea.prototype.has=$N,Ea.prototype.set=KN;var kp=Ea;function qN(){this.__data__=[],this.size=0}var UN=qN;function GN(t,e){return t===e||t!==t&&e!==e}var xp=GN;function WN(t,e){for(var r=t.length;r--;)if(xp(t[r][0],e))return r;return-1}var Xo=WN,jN=Array.prototype,YN=jN.splice;function XN(t){var e=this.__data__,r=Xo(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():YN.call(e,r,1),--this.size,!0}var ZN=XN;function QN(t){var e=this.__data__,r=Xo(e,t);return r<0?void 0:e[r][1]}var JN=QN;function e4(t){return Xo(this.__data__,t)>-1}var t4=e4;function r4(t,e){var r=this.__data__,n=Xo(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var n4=r4;function Sa(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Sa.prototype.clear=UN,Sa.prototype.delete=ZN,Sa.prototype.get=JN,Sa.prototype.has=t4,Sa.prototype.set=n4;var a4=Sa,i4=oc(Oo,"Map"),o4=i4;function s4(){this.size=0,this.__data__={hash:new kp,map:new(o4||a4),string:new kp}}var l4=s4;function c4(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var u4=c4;function d4(t,e){var r=t.__data__;return u4(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Zo=d4;function f4(t){var e=Zo(this,t).delete(t);return this.size-=e?1:0,e}var h4=f4;function p4(t){return Zo(this,t).get(t)}var v4=p4;function g4(t){return Zo(this,t).has(t)}var m4=g4;function y4(t,e){var r=Zo(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var b4=y4;function Ta(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ta.prototype.clear=l4,Ta.prototype.delete=h4,Ta.prototype.get=v4,Ta.prototype.has=m4,Ta.prototype.set=b4;var Ep=Ta,w4="Expected a function";function sc(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(w4);var r=function(){var n=arguments,a=e?e.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=t.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(sc.Cache||Ep),r}sc.Cache=Ep;var C4=sc,k4=500;function x4(t){var e=C4(t,function(n){return r.size===k4&&r.clear(),n}),r=e.cache;return e}var E4=x4,S4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,T4=/\\(\\)?/g,B4=E4(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(S4,function(r,n,a,i){e.push(a?i.replace(T4,"$1"):n||r)}),e}),Sp=B4;function N4(t,e){for(var r=-1,n=t==null?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a}var Tp=N4,D4=1/0,Bp=pa?pa.prototype:void 0,Np=Bp?Bp.toString:void 0;function Dp(t){if(typeof t=="string")return t;if(Yo(t))return Tp(t,Dp)+"";if(bi(t))return Np?Np.call(t):"";var e=t+"";return e=="0"&&1/t==-D4?"-0":e}var P4=Dp;function O4(t){return t==null?"":P4(t)}var Pp=O4;function _4(t,e){return Yo(t)?t:tN(t,e)?[t]:Sp(Pp(t))}var Op=_4,L4=1/0;function F4(t){if(typeof t=="string"||bi(t))return t;var e=t+"";return e=="0"&&1/t==-L4?"-0":e}var lc=F4;function M4(t,e){e=Op(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[lc(e[r++])];return r&&r==n?t:void 0}var I4=M4;function A4(t,e,r){var n=t==null?void 0:I4(t,e);return n===void 0?r:n}var V4=A4,R4=function(){try{var t=oc(Object,"defineProperty");return t({},"",{}),t}catch{}}(),_p=R4;function $4(t,e,r){e=="__proto__"&&_p?_p(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var z4=$4,H4=Object.prototype,K4=H4.hasOwnProperty;function q4(t,e,r){var n=t[e];(!(K4.call(t,e)&&xp(n,r))||r===void 0&&!(e in t))&&z4(t,e,r)}var U4=q4,G4=9007199254740991,W4=/^(?:0|[1-9]\d*)$/;function j4(t,e){var r=typeof t;return e=e??G4,!!e&&(r=="number"||r!="symbol"&&W4.test(t))&&t>-1&&t%1==0&&t<e}var Y4=j4;function X4(t,e,r,n){if(!Fn(t))return t;e=Op(e,t);for(var a=-1,i=e.length,o=i-1,l=t;l!=null&&++a<i;){var u=lc(e[a]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(a!=o){var d=l[u];c=n?n(d,u,l):void 0,c===void 0&&(c=Fn(d)?d:Y4(e[a+1])?[]:{})}U4(l,u,c),l=l[u]}return t}var Z4=X4;function Q4(t,e,r){return t==null?t:Z4(t,e,r)}var J4=Q4;function e3(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var t3=e3;function r3(t){return Yo(t)?Tp(t,lc):bi(t)?[t]:t3(Sp(Pp(t)))}var n3=r3,a3={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(a){},beforeSet:function(a,i){},onSet:function(a){},canSet:function(a){return!0}};return e=xe({},r,e),function(a,i){var o=e,l=this,u=l.length!==void 0,c=u?l:[l],d=u?l[0]:l;if(be(a)){var f=a.indexOf(".")!==-1,p=f&&n3(a);if(o.allowGetting&&i===void 0){var v;return d&&(o.beforeGet(d),p&&d._private[o.field][a]===void 0?v=V4(d._private[o.field],p):v=d._private[o.field][a]),v}else if(o.allowSetting&&i!==void 0){var h=!o.immutableKeys[a];if(h){var g=ph({},a,i);o.beforeSet(l,g);for(var y=0,m=c.length;y<m;y++){var b=c[y];o.canSet(b)&&(p&&d._private[o.field][a]===void 0?J4(b._private[o.field],p,i):b._private[o.field][a]=i)}o.updateStyle&&l.updateStyle(),o.onSet(l),o.settingTriggersEvent&&l[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&_e(a)){var w=a,C,x,E=Object.keys(w);o.beforeSet(l,w);for(var k=0;k<E.length;k++){C=E[k],x=w[C];var B=!o.immutableKeys[C];if(B)for(var S=0;S<c.length;S++){var N=c[S];o.canSet(N)&&(N._private[o.field][C]=x)}}o.updateStyle&&l.updateStyle(),o.onSet(l),o.settingTriggersEvent&&l[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&Ye(a)){var D=a;l.on(o.bindingEvent,D)}else if(o.allowGetting&&a===void 0){var P;return d&&(o.beforeGet(d),P=d._private[o.field]),P}return l}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=xe({},r,e),function(a){var i=e,o=this,l=o.length!==void 0,u=l?o:[o];if(be(a)){for(var c=a.split(/\s+/),d=c.length,f=0;f<d;f++){var p=c[f];if(!nn(p)){var v=!i.immutableKeys[p];if(v)for(var h=0,g=u.length;h<g;h++)u[h]._private[i.field][p]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(a===void 0){for(var y=0,m=u.length;y<m;y++)for(var b=u[y]._private[i.field],w=Object.keys(b),C=0;C<w.length;C++){var x=w[C],E=!i.immutableKeys[x];E&&(b[x]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},i3={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(n,a){var i=this,o=Array.prototype.slice.call(arguments,0);return new xa(function(l,u){var c=function(v){i.off.apply(i,f),l(v)},d=o.concat([c]),f=d.concat([]);i.on.apply(i,d)})}}},Ve={};[X5,a3,i3].forEach(function(t){xe(Ve,t)});var o3={animate:Ve.animate(),animation:Ve.animation(),animated:Ve.animated(),clearQueue:Ve.clearQueue(),delay:Ve.delay(),delayAnimation:Ve.delayAnimation(),stop:Ve.stop()},Qo={classes:function(e){var r=this;if(e===void 0){var n=[];return r[0]._private.classes.forEach(function(h){return n.push(h)}),n}else He(e)||(e=(e||"").match(/\S+/g)||[]);for(var a=[],i=new ga(e),o=0;o<r.length;o++){for(var l=r[o],u=l._private,c=u.classes,d=!1,f=0;f<e.length;f++){var p=e[f],v=c.has(p);if(!v){d=!0;break}}d||(d=c.size!==e.length),d&&(u.classes=i,a.push(l))}return a.length>0&&this.spawn(a).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){He(e)||(e=e.match(/\S+/g)||[]);for(var n=this,a=r===void 0,i=[],o=0,l=n.length;o<l;o++)for(var u=n[o],c=u._private.classes,d=!1,f=0;f<e.length;f++){var p=e[f],v=c.has(p),h=!1;r||a&&!v?(c.add(p),h=!0):(!r||a&&v)&&(c.delete(p),h=!0),!d&&h&&(i.push(u),d=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var n=this;if(r==null)r=250;else if(r===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},r),n}};Qo.className=Qo.classNames=Qo.classes;var Le={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:lt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Le.variable="(?:[\\w-.]|(?:\\\\"+Le.metaChar+"))+",Le.className="(?:[\\w-]|(?:\\\\"+Le.metaChar+"))+",Le.value=Le.string+"|"+Le.number,Le.id=Le.variable,function(){var t,e,r;for(t=Le.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Le.comparatorOp+="|@"+e;for(t=Le.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Le.comparatorOp+="|\\!"+e)}();var $e=function(){return{checks:[]}},fe={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},cc=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return yT(t.selector,e.selector)}),s3=function(){for(var t={},e,r=0;r<cc.length;r++)e=cc[r],t[e.selector]=e.matches;return t}(),l3=function(e,r){return s3[e](r)},c3="("+cc.map(function(t){return t.selector}).join("|")+")",Ba=function(e){return e.replace(new RegExp("\\\\("+Le.metaChar+")","g"),function(r,n){return n})},cn=function(e,r,n){e[e.length-1]=n},uc=[{name:"group",query:!0,regex:"("+Le.group+")",populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:c3,populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Le.id+")",populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.ID,value:Ba(i)})}},{name:"className",query:!0,regex:"\\.("+Le.className+")",populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.CLASS,value:Ba(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Le.variable+")\\s*\\]",populate:function(e,r,n){var a=sr(n,1),i=a[0];r.checks.push({type:fe.DATA_EXIST,field:Ba(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Le.variable+")\\s*("+Le.comparatorOp+")\\s*("+Le.value+")\\s*\\]",populate:function(e,r,n){var a=sr(n,3),i=a[0],o=a[1],l=a[2],u=new RegExp("^"+Le.string+"$").exec(l)!=null;u?l=l.substring(1,l.length-1):l=parseFloat(l),r.checks.push({type:fe.DATA_COMPARE,field:Ba(i),operator:o,value:l})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Le.boolOp+")\\s*("+Le.variable+")\\s*\\]",populate:function(e,r,n){var a=sr(n,2),i=a[0],o=a[1];r.checks.push({type:fe.DATA_BOOL,field:Ba(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Le.meta+")\\s*("+Le.comparatorOp+")\\s*("+Le.number+")\\s*\\]\\]",populate:function(e,r,n){var a=sr(n,3),i=a[0],o=a[1],l=a[2];r.checks.push({type:fe.META_COMPARE,field:Ba(i),operator:o,value:parseFloat(l)})}},{name:"nextQuery",separator:!0,regex:Le.separator,populate:function(e,r){var n=e.currentSubject,a=e.edgeCount,i=e.compoundCount,o=e[e.length-1];n!=null&&(o.subject=n,e.currentSubject=null),o.edgeCount=a,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var l=e[e.length++]=$e();return l}},{name:"directedEdge",separator:!0,regex:Le.directedEdge,populate:function(e,r){if(e.currentSubject==null){var n=$e(),a=r,i=$e();return n.checks.push({type:fe.DIRECTED_EDGE,source:a,target:i}),cn(e,r,n),e.edgeCount++,i}else{var o=$e(),l=r,u=$e();return o.checks.push({type:fe.NODE_SOURCE,source:l,target:u}),cn(e,r,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Le.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var n=$e(),a=r,i=$e();return n.checks.push({type:fe.UNDIRECTED_EDGE,nodes:[a,i]}),cn(e,r,n),e.edgeCount++,i}else{var o=$e(),l=r,u=$e();return o.checks.push({type:fe.NODE_NEIGHBOR,node:l,neighbor:u}),cn(e,r,o),u}}},{name:"child",separator:!0,regex:Le.child,populate:function(e,r){if(e.currentSubject==null){var n=$e(),a=$e(),i=e[e.length-1];return n.checks.push({type:fe.CHILD,parent:i,child:a}),cn(e,r,n),e.compoundCount++,a}else if(e.currentSubject===r){var o=$e(),l=e[e.length-1],u=$e(),c=$e(),d=$e(),f=$e();return o.checks.push({type:fe.COMPOUND_SPLIT,left:l,right:u,subject:c}),c.checks=r.checks,r.checks=[{type:fe.TRUE}],f.checks.push({type:fe.TRUE}),u.checks.push({type:fe.PARENT,parent:f,child:d}),cn(e,l,o),e.currentSubject=c,e.compoundCount++,d}else{var p=$e(),v=$e(),h=[{type:fe.PARENT,parent:p,child:v}];return p.checks=r.checks,r.checks=h,e.compoundCount++,v}}},{name:"descendant",separator:!0,regex:Le.descendant,populate:function(e,r){if(e.currentSubject==null){var n=$e(),a=$e(),i=e[e.length-1];return n.checks.push({type:fe.DESCENDANT,ancestor:i,descendant:a}),cn(e,r,n),e.compoundCount++,a}else if(e.currentSubject===r){var o=$e(),l=e[e.length-1],u=$e(),c=$e(),d=$e(),f=$e();return o.checks.push({type:fe.COMPOUND_SPLIT,left:l,right:u,subject:c}),c.checks=r.checks,r.checks=[{type:fe.TRUE}],f.checks.push({type:fe.TRUE}),u.checks.push({type:fe.ANCESTOR,ancestor:f,descendant:d}),cn(e,l,o),e.currentSubject=c,e.compoundCount++,d}else{var p=$e(),v=$e(),h=[{type:fe.ANCESTOR,ancestor:p,descendant:v}];return p.checks=r.checks,r.checks=h,e.compoundCount++,v}}},{name:"subject",modifier:!0,regex:Le.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Ae("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var n=e[e.length-1],a=n.checks[0],i=a==null?null:a.type;i===fe.DIRECTED_EDGE?a.type=fe.NODE_TARGET:i===fe.UNDIRECTED_EDGE&&(a.type=fe.NODE_NEIGHBOR,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];uc.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var u3=function(e){for(var r,n,a,i=0;i<uc.length;i++){var o=uc[i],l=o.name,u=e.match(o.regexObj);if(u!=null){n=u,r=o,a=l;var c=u[0];e=e.substring(c.length);break}}return{expr:r,match:n,name:a,remaining:e}},d3=function(e){var r=e.match(/^\s+/);if(r){var n=r[0];e=e.substring(n.length)}return e},f3=function(e){var r=this,n=r.inputText=e,a=r[0]=$e();for(r.length=1,n=d3(n);;){var i=u3(n);if(i.expr==null)return Ae("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),l=i.expr.populate(r,a,o);if(l===!1)return!1;if(l!=null&&(a=l),n=i.remaining,n.match(/^\s*$/))break}var u=r[r.length-1];r.currentSubject!=null&&(u.subject=r.currentSubject),u.edgeCount=r.edgeCount,u.compoundCount=r.compoundCount;for(var c=0;c<r.length;c++){var d=r[c];if(d.compoundCount>0&&d.edgeCount>0)return Ae("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(d.edgeCount>1)return Ae("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;d.edgeCount===1&&Ae("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},h3=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(d){return d??""},r=function(d){return be(d)?'"'+d+'"':e(d)},n=function(d){return" "+d+" "},a=function(d,f){var p=d.type,v=d.value;switch(p){case fe.GROUP:{var h=e(v);return h.substring(0,h.length-1)}case fe.DATA_COMPARE:{var g=d.field,y=d.operator;return"["+g+n(e(y))+r(v)+"]"}case fe.DATA_BOOL:{var m=d.operator,b=d.field;return"["+e(m)+b+"]"}case fe.DATA_EXIST:{var w=d.field;return"["+w+"]"}case fe.META_COMPARE:{var C=d.operator,x=d.field;return"[["+x+n(e(C))+r(v)+"]]"}case fe.STATE:return v;case fe.ID:return"#"+v;case fe.CLASS:return"."+v;case fe.PARENT:case fe.CHILD:return i(d.parent,f)+n(">")+i(d.child,f);case fe.ANCESTOR:case fe.DESCENDANT:return i(d.ancestor,f)+" "+i(d.descendant,f);case fe.COMPOUND_SPLIT:{var E=i(d.left,f),k=i(d.subject,f),B=i(d.right,f);return E+(E.length>0?" ":"")+k+B}case fe.TRUE:return""}},i=function(d,f){return d.checks.reduce(function(p,v,h){return p+(f===d&&h===0?"$":"")+a(v,f)},"")},o="",l=0;l<this.length;l++){var u=this[l];o+=i(u,u.subject),this.length>1&&l<this.length-1&&(o+=", ")}return this.toStringCache=o,o},p3={parse:f3,toString:h3},Lp=function(e,r,n){var a,i=be(e),o=le(e),l=be(n),u,c,d=!1,f=!1,p=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),f=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),d=!0),(i||l||d)&&(u=!i&&!o?"":""+e,c=""+n),d&&(e=u=u.toLowerCase(),n=c=c.toLowerCase()),r){case"*=":a=u.indexOf(c)>=0;break;case"$=":a=u.indexOf(c,u.length-c.length)>=0;break;case"^=":a=u.indexOf(c)===0;break;case"=":a=e===n;break;case">":p=!0,a=e>n;break;case">=":p=!0,a=e>=n;break;case"<":p=!0,a=e<n;break;case"<=":p=!0,a=e<=n;break;default:a=!1;break}return f&&(e!=null||!p)&&(a=!a),a},v3=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},g3=function(e){return e!==void 0},dc=function(e,r){return e.data(r)},m3=function(e,r){return e[r]()},Ze=[],je=function(e,r){return e.checks.every(function(n){return Ze[n.type](n,r)})};Ze[fe.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()},Ze[fe.STATE]=function(t,e){var r=t.value;return l3(r,e)},Ze[fe.ID]=function(t,e){var r=t.value;return e.id()===r},Ze[fe.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)},Ze[fe.META_COMPARE]=function(t,e){var r=t.field,n=t.operator,a=t.value;return Lp(m3(e,r),n,a)},Ze[fe.DATA_COMPARE]=function(t,e){var r=t.field,n=t.operator,a=t.value;return Lp(dc(e,r),n,a)},Ze[fe.DATA_BOOL]=function(t,e){var r=t.field,n=t.operator;return v3(dc(e,r),n)},Ze[fe.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,g3(dc(e,r))},Ze[fe.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],n=t.nodes[1],a=e.source(),i=e.target();return je(r,a)&&je(n,i)||je(n,a)&&je(r,i)},Ze[fe.NODE_NEIGHBOR]=function(t,e){return je(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&je(t.neighbor,r)})},Ze[fe.DIRECTED_EDGE]=function(t,e){return je(t.source,e.source())&&je(t.target,e.target())},Ze[fe.NODE_SOURCE]=function(t,e){return je(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&je(t.target,r)})},Ze[fe.NODE_TARGET]=function(t,e){return je(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&je(t.source,r)})},Ze[fe.CHILD]=function(t,e){return je(t.child,e)&&je(t.parent,e.parent())},Ze[fe.PARENT]=function(t,e){return je(t.parent,e)&&e.children().some(function(r){return je(t.child,r)})},Ze[fe.DESCENDANT]=function(t,e){return je(t.descendant,e)&&e.ancestors().some(function(r){return je(t.ancestor,r)})},Ze[fe.ANCESTOR]=function(t,e){return je(t.ancestor,e)&&e.descendants().some(function(r){return je(t.descendant,r)})},Ze[fe.COMPOUND_SPLIT]=function(t,e){return je(t.subject,e)&&je(t.left,e)&&je(t.right,e)},Ze[fe.TRUE]=function(){return!0},Ze[fe.COLLECTION]=function(t,e){var r=t.value;return r.has(e)},Ze[fe.FILTER]=function(t,e){var r=t.value;return r(e)};var y3=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===fe.ID)return e.getElementById(r[0].checks[0].value).collection();var n=function(i){for(var o=0;o<r.length;o++){var l=r[o];if(je(l,i))return!0}return!1};return r.text()==null&&(n=function(){return!0}),e.filter(n)},b3=function(e){for(var r=this,n=0;n<r.length;n++){var a=r[n];if(je(a,e))return!0}return!1},w3={matches:b3,filter:y3},un=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||be(e)&&e.match(/^\s*$/)||(Ut(e)?this.addQuery({checks:[{type:fe.COLLECTION,value:e.collection()}]}):Ye(e)?this.addQuery({checks:[{type:fe.FILTER,value:e}]}):be(e)?this.parse(e)||(this.invalid=!0):Xe("A selector must be created from a string; found "))},dn=un.prototype;[p3,w3].forEach(function(t){return xe(dn,t)}),dn.text=function(){return this.inputText},dn.size=function(){return this.length},dn.eq=function(t){return this[t]},dn.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()},dn.addQuery=function(t){this[this.length++]=t},dn.selector=dn.toString;var fn={allAre:function(e){var r=new un(e);return this.every(function(n){return r.matches(n)})},is:function(e){var r=new un(e);return this.some(function(n){return r.matches(n)})},some:function(e,r){for(var n=0;n<this.length;n++){var a=r?e.apply(r,[this[n],n,this]):e(this[n],n,this);if(a)return!0}return!1},every:function(e,r){for(var n=0;n<this.length;n++){var a=r?e.apply(r,[this[n],n,this]):e(this[n],n,this);if(!a)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,n=e.length;return r!==n?!1:r===1?this[0]===e[0]:this.every(function(a){return e.hasElementWithId(a.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(n){return r.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(n){return r.hasElementWithId(n.id())})}};fn.allAreNeighbours=fn.allAreNeighbors,fn.has=fn.contains,fn.equal=fn.equals=fn.same;var Qt=function(e,r){return function(a,i,o,l){var u=a,c=this,d;if(u==null?d="":Ut(u)&&u.length===1&&(d=u.id()),c.length===1&&d){var f=c[0]._private,p=f.traversalCache=f.traversalCache||{},v=p[r]=p[r]||[],h=Mn(d),g=v[h];return g||(v[h]=e.call(c,a,i,o,l))}else return e.call(c,a,i,o,l)}},Na={parent:function(e){var r=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var a=0;a<this.length;a++){var i=this[a],o=i._private.parent;o&&r.push(o)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],n=this.parent();n.nonempty();){for(var a=0;a<n.length;a++){var i=n[a];r.push(i)}n=n.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,n=0;n<this.length;n++){var a=this[n],i=a.parents();r=r||i,r=r.intersect(i)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Qt(function(t){for(var e=[],r=0;r<this.length;r++)for(var n=this[r],a=n._private.children,i=0;i<a.length;i++)e.push(a[i]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function n(a){for(var i=0;i<a.length;i++){var o=a[i];r.push(o),o.children().nonempty()&&n(o.children())}}return n(this.children()),this.spawn(r,!0).filter(e)}};function fc(t,e,r,n){for(var a=[],i=new ga,o=t.cy(),l=o.hasCompoundNodes(),u=0;u<t.length;u++){var c=t[u];r?a.push(c):l&&n(a,i,c)}for(;a.length>0;){var d=a.shift();e(d),i.add(d.id()),l&&n(a,i,d)}return t}function Fp(t,e,r){if(r.isParent())for(var n=r._private.children,a=0;a<n.length;a++){var i=n[a];e.has(i.id())||t.push(i)}}Na.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return fc(this,t,e,Fp)};function Mp(t,e,r){if(r.isChild()){var n=r._private.parent;e.has(n.id())||t.push(n)}}Na.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return fc(this,t,e,Mp)};function C3(t,e,r){Mp(t,e,r),Fp(t,e,r)}Na.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return fc(this,t,e,C3)},Na.ancestors=Na.parents;var Pi,Ip;Pi=Ip={data:Ve.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:Ve.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ve.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ve.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ve.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ve.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Pi.attr=Pi.data,Pi.removeAttr=Pi.removeData;var k3=Ip,Jo={};function hc(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var n=0,a=r[0],i=a._private.edges,o=0;o<i.length;o++){var l=i[o];!e&&l.isLoop()||(n+=t(a,l))}return n}else return}}xe(Jo,{degree:hc(function(t,e){return e.source().same(e.target())?2:1}),indegree:hc(function(t,e){return e.target().same(t)?1:0}),outdegree:hc(function(t,e){return e.source().same(t)?1:0})});function Da(t,e){return function(r){for(var n,a=this.nodes(),i=0;i<a.length;i++){var o=a[i],l=o[t](r);l!==void 0&&(n===void 0||e(l,n))&&(n=l)}return n}}xe(Jo,{minDegree:Da("degree",function(t,e){return t<e}),maxDegree:Da("degree",function(t,e){return t>e}),minIndegree:Da("indegree",function(t,e){return t<e}),maxIndegree:Da("indegree",function(t,e){return t>e}),minOutdegree:Da("outdegree",function(t,e){return t<e}),maxOutdegree:Da("outdegree",function(t,e){return t>e})}),xe(Jo,{totalDegree:function(e){for(var r=0,n=this.nodes(),a=0;a<n.length;a++)r+=n[a].degree(e);return r}});var cr,Ap,Vp=function(e,r,n){for(var a=0;a<e.length;a++){var i=e[a];if(!i.locked()){var o=i._private.position,l={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};i.isParent()&&!(l.x===0&&l.y===0)&&i.children().shift(l,n),i.dirtyBoundingBoxCache()}}},Rp={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){Vp(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};cr=Ap={position:Ve.data(Rp),silentPosition:Ve.data(xe({},Rp,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){Vp(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(_e(e))r?this.silentPosition(e):this.position(e);else if(Ye(e)){var n=e,a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o=this[i],l=void 0;(l=n(o,i))&&(r?o.silentPosition(l):o.position(l))}a.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,n){var a;if(_e(e)?(a={x:le(e.x)?e.x:0,y:le(e.y)?e.y:0},n=r):be(e)&&le(r)&&(a={x:0,y:0},a[e]=r),a!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var l=this[o];if(!(i.hasCompoundNodes()&&l.isChild()&&l.ancestors().anySame(this))){var u=l.position(),c={x:u.x+a.x,y:u.y+a.y};n?l.silentPosition(c):l.position(c)}}i.endBatch()}return this},silentShift:function(e,r){return _e(e)?this.shift(e,!0):be(e)&&le(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var n=this[0],a=this.cy(),i=a.zoom(),o=a.pan(),l=_e(e)?e:void 0,u=l!==void 0||r!==void 0&&be(e);if(n&&n.isNode())if(u)for(var c=0;c<this.length;c++){var d=this[c];r!==void 0?d.position(e,(r-o[e])/i):l!==void 0&&d.position(Kh(l,i,o))}else{var f=n.position();return l=Ao(f,i,o),e===void 0?l:l[e]}else if(!u)return;return this},relativePosition:function(e,r){var n=this[0],a=this.cy(),i=_e(e)?e:void 0,o=i!==void 0||r!==void 0&&be(e),l=a.hasCompoundNodes();if(n&&n.isNode())if(o)for(var u=0;u<this.length;u++){var c=this[u],d=l?c.parent():null,f=d&&d.length>0,p=f;f&&(d=d[0]);var v=p?d.position():{x:0,y:0};r!==void 0?c.position(e,r+v[e]):i!==void 0&&c.position({x:i.x+v.x,y:i.y+v.y})}else{var h=n.position(),g=l?n.parent():null,y=g&&g.length>0,m=y;y&&(g=g[0]);var b=m?g.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(!o)return;return this}},cr.modelPosition=cr.point=cr.position,cr.modelPositions=cr.points=cr.positions,cr.renderedPoint=cr.renderedPosition,cr.relativePoint=cr.relativePosition;var x3=Ap,Pa,hn;Pa=hn={},hn.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),n=r.zoom(),a=r.pan(),i=e.x1*n+a.x,o=e.x2*n+a.x,l=e.y1*n+a.y,u=e.y2*n+a.y;return{x1:i,x2:o,y1:l,y2:u,w:o-i,h:u-l}},hn.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var n=r._private;n.compoundBoundsClean=!1,n.bbCache=null,t||r.emitAndNotify("bounds")}}),this)},hn.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(o){if(!o.isParent())return;var l=o._private,u=o.children(),c=o.pstyle("compound-sizing-wrt-labels").value==="include",d={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},f=u.boundingBox({includeLabels:c,includeOverlays:!1,useCache:!1}),p=l.position;(f.w===0||f.h===0)&&(f={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},f.x1=p.x-f.w/2,f.x2=p.x+f.w/2,f.y1=p.y-f.h/2,f.y2=p.y+f.h/2);function v(S,N,D){var P=0,L=0,O=N+D;return S>0&&O>0&&(P=N/O*S,L=D/O*S),{biasDiff:P,biasComplementDiff:L}}function h(S,N,D,P){if(D.units==="%")switch(P){case"width":return S>0?D.pfValue*S:0;case"height":return N>0?D.pfValue*N:0;case"average":return S>0&&N>0?D.pfValue*(S+N)/2:0;case"min":return S>0&&N>0?S>N?D.pfValue*N:D.pfValue*S:0;case"max":return S>0&&N>0?S>N?D.pfValue*S:D.pfValue*N:0;default:return 0}else return D.units==="px"?D.pfValue:0}var g=d.width.left.value;d.width.left.units==="px"&&d.width.val>0&&(g=g*100/d.width.val);var y=d.width.right.value;d.width.right.units==="px"&&d.width.val>0&&(y=y*100/d.width.val);var m=d.height.top.value;d.height.top.units==="px"&&d.height.val>0&&(m=m*100/d.height.val);var b=d.height.bottom.value;d.height.bottom.units==="px"&&d.height.val>0&&(b=b*100/d.height.val);var w=v(d.width.val-f.w,g,y),C=w.biasDiff,x=w.biasComplementDiff,E=v(d.height.val-f.h,m,b),k=E.biasDiff,B=E.biasComplementDiff;l.autoPadding=h(f.w,f.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),l.autoWidth=Math.max(f.w,d.width.val),p.x=(-C+f.x1+f.x2+x)/2,l.autoHeight=Math.max(f.h,d.height.val),p.y=(-k+f.y1+f.y2+B)/2}for(var n=0;n<this.length;n++){var a=this[n],i=a._private;(!i.compoundBoundsClean||t)&&(r(a),e.batching()||(i.compoundBoundsClean=!0))}return this};var Jt=function(e){return e===1/0||e===-1/0?0:e},ur=function(e,r,n,a,i){a-r===0||i-n===0||r==null||n==null||a==null||i==null||(e.x1=r<e.x1?r:e.x1,e.x2=a>e.x2?a:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},zn=function(e,r){return r==null?e:ur(e,r.x1,r.y1,r.x2,r.y2)},Oi=function(e,r,n){return lr(e,r,n)},es=function(e,r,n){if(!r.cy().headless()){var a=r._private,i=a.rstyle,o=i.arrowWidth/2,l=r.pstyle(n+"-arrow-shape").value,u,c;if(l!=="none"){n==="source"?(u=i.srcX,c=i.srcY):n==="target"?(u=i.tgtX,c=i.tgtY):(u=i.midX,c=i.midY);var d=a.arrowBounds=a.arrowBounds||{},f=d[n]=d[n]||{};f.x1=u-o,f.y1=c-o,f.x2=u+o,f.y2=c+o,f.w=f.x2-f.x1,f.h=f.y2-f.y1,Ro(f,1),ur(e,f.x1,f.y1,f.x2,f.y2)}}},pc=function(e,r,n){if(!r.cy().headless()){var a;n?a=n+"-":a="";var i=r._private,o=i.rstyle,l=r.pstyle(a+"label").strValue;if(l){var u=r.pstyle("text-halign"),c=r.pstyle("text-valign"),d=Oi(o,"labelWidth",n),f=Oi(o,"labelHeight",n),p=Oi(o,"labelX",n),v=Oi(o,"labelY",n),h=r.pstyle(a+"text-margin-x").pfValue,g=r.pstyle(a+"text-margin-y").pfValue,y=r.isEdge(),m=r.pstyle(a+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,w=r.pstyle("text-border-width").pfValue,C=w/2,x=r.pstyle("text-background-padding").pfValue,E=2,k=f,B=d,S=B/2,N=k/2,D,P,L,O;if(y)D=p-S,P=p+S,L=v-N,O=v+N;else{switch(u.value){case"left":D=p-B,P=p;break;case"center":D=p-S,P=p+S;break;case"right":D=p,P=p+B;break}switch(c.value){case"top":L=v-k,O=v;break;case"center":L=v-N,O=v+N;break;case"bottom":L=v,O=v+k;break}}D+=h-Math.max(b,C)-x-E,P+=h+Math.max(b,C)+x+E,L+=g-Math.max(b,C)-x-E,O+=g+Math.max(b,C)+x+E;var I=n||"main",_=i.labelBounds,M=_[I]=_[I]||{};M.x1=D,M.y1=L,M.x2=P,M.y2=O,M.w=P-D,M.h=O-L;var F=y&&m.strValue==="autorotate",V=m.pfValue!=null&&m.pfValue!==0;if(F||V){var H=F?Oi(i.rstyle,"labelAngle",n):m.pfValue,$=Math.cos(H),z=Math.sin(H),j=(D+P)/2,ee=(L+O)/2;if(!y){switch(u.value){case"left":j=P;break;case"right":j=D;break}switch(c.value){case"top":ee=O;break;case"bottom":ee=L;break}}var J=function(he,ne){return he=he-j,ne=ne-ee,{x:he*$-ne*z+j,y:he*z+ne*$+ee}},Z=J(D,L),re=J(D,O),Y=J(P,L),A=J(P,O);D=Math.min(Z.x,re.x,Y.x,A.x),P=Math.max(Z.x,re.x,Y.x,A.x),L=Math.min(Z.y,re.y,Y.y,A.y),O=Math.max(Z.y,re.y,Y.y,A.y)}var K=I+"Rot",W=_[K]=_[K]||{};W.x1=D,W.y1=L,W.x2=P,W.y2=O,W.w=P-D,W.h=O-L,ur(e,D,L,P,O),ur(i.labelBounds.all,D,L,P,O)}return e}},E3=function(e,r){if(!r.cy().headless()){var n=r.pstyle("outline-opacity").value,a=r.pstyle("outline-width").value;if(n>0&&a>0){var i=r.pstyle("outline-offset").value,o=r.pstyle("shape").value,l=a+i,u=(e.w+l*2)/e.w,c=(e.h+l*2)/e.h,d=0,f=0;["diamond","pentagon","round-triangle"].includes(o)?(u=(e.w+l*2.4)/e.w,f=-l/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?u=(e.w+l*2.4)/e.w:o==="star"?(u=(e.w+l*2.8)/e.w,c=(e.h+l*2.6)/e.h,f=-l/3.8):o==="triangle"?(u=(e.w+l*2.8)/e.w,c=(e.h+l*2.4)/e.h,f=-l/1.4):o==="vee"&&(u=(e.w+l*4.4)/e.w,c=(e.h+l*3.8)/e.h,f=-l*.5);var p=e.h*c-e.h,v=e.w*u-e.w;if($o(e,[Math.ceil(p/2),Math.ceil(v/2)]),d!=0||f!==0){var h=UB(e,d,f);Uh(e,h)}}}},S3=function(e,r){var n=e._private.cy,a=n.styleEnabled(),i=n.headless(),o=zt(),l=e._private,u=e.isNode(),c=e.isEdge(),d,f,p,v,h,g,y=l.rstyle,m=u&&a?e.pstyle("bounds-expansion").pfValue:[0],b=function(ue){return ue.pstyle("display").value!=="none"},w=!a||b(e)&&(!c||b(e.source())&&b(e.target()));if(w){var C=0,x=0;a&&r.includeOverlays&&(C=e.pstyle("overlay-opacity").value,C!==0&&(x=e.pstyle("overlay-padding").value));var E=0,k=0;a&&r.includeUnderlays&&(E=e.pstyle("underlay-opacity").value,E!==0&&(k=e.pstyle("underlay-padding").value));var B=Math.max(x,k),S=0,N=0;if(a&&(S=e.pstyle("width").pfValue,N=S/2),u&&r.includeNodes){var D=e.position();h=D.x,g=D.y;var P=e.outerWidth(),L=P/2,O=e.outerHeight(),I=O/2;d=h-L,f=h+L,p=g-I,v=g+I,ur(o,d,p,f,v),a&&r.includeOutlines&&E3(o,e)}else if(c&&r.includeEdges)if(a&&!i){var _=e.pstyle("curve-style").strValue;if(d=Math.min(y.srcX,y.midX,y.tgtX),f=Math.max(y.srcX,y.midX,y.tgtX),p=Math.min(y.srcY,y.midY,y.tgtY),v=Math.max(y.srcY,y.midY,y.tgtY),d-=N,f+=N,p-=N,v+=N,ur(o,d,p,f,v),_==="haystack"){var M=y.haystackPts;if(M&&M.length===2){if(d=M[0].x,p=M[0].y,f=M[1].x,v=M[1].y,d>f){var F=d;d=f,f=F}if(p>v){var V=p;p=v,v=V}ur(o,d-N,p-N,f+N,v+N)}}else if(_==="bezier"||_==="unbundled-bezier"||_.endsWith("segments")||_.endsWith("taxi")){var H;switch(_){case"bezier":case"unbundled-bezier":H=y.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":H=y.linePts;break}if(H!=null)for(var $=0;$<H.length;$++){var z=H[$];d=z.x-N,f=z.x+N,p=z.y-N,v=z.y+N,ur(o,d,p,f,v)}}}else{var j=e.source(),ee=j.position(),J=e.target(),Z=J.position();if(d=ee.x,f=Z.x,p=ee.y,v=Z.y,d>f){var re=d;d=f,f=re}if(p>v){var Y=p;p=v,v=Y}d-=N,f+=N,p-=N,v+=N,ur(o,d,p,f,v)}if(a&&r.includeEdges&&c&&(es(o,e,"mid-source"),es(o,e,"mid-target"),es(o,e,"source"),es(o,e,"target")),a){var A=e.pstyle("ghost").value==="yes";if(A){var K=e.pstyle("ghost-offset-x").pfValue,W=e.pstyle("ghost-offset-y").pfValue;ur(o,o.x1+K,o.y1+W,o.x2+K,o.y2+W)}}var oe=l.bodyBounds=l.bodyBounds||{};Gh(oe,o),$o(oe,m),Ro(oe,1),a&&(d=o.x1,f=o.x2,p=o.y1,v=o.y2,ur(o,d-B,p-B,f+B,v+B));var he=l.overlayBounds=l.overlayBounds||{};Gh(he,o),$o(he,m),Ro(he,1);var ne=l.labelBounds=l.labelBounds||{};ne.all!=null?qB(ne.all):ne.all=zt(),a&&r.includeLabels&&(r.includeMainLabels&&pc(o,e,null),c&&(r.includeSourceLabels&&pc(o,e,"source"),r.includeTargetLabels&&pc(o,e,"target")))}return o.x1=Jt(o.x1),o.y1=Jt(o.y1),o.x2=Jt(o.x2),o.y2=Jt(o.y2),o.w=Jt(o.x2-o.x1),o.h=Jt(o.y2-o.y1),o.w>0&&o.h>0&&w&&($o(o,m),Ro(o,1)),o},$p=function(e){var r=0,n=function(o){return(o?1:0)<<r++},a=0;return a+=n(e.incudeNodes),a+=n(e.includeEdges),a+=n(e.includeLabels),a+=n(e.includeMainLabels),a+=n(e.includeSourceLabels),a+=n(e.includeTargetLabels),a+=n(e.includeOverlays),a+=n(e.includeOutlines),a},zp=function(e){if(e.isEdge()){var r=e.source().position(),n=e.target().position(),a=function(o){return Math.round(o)};return dB([a(r.x),a(r.y),a(n.x),a(n.y)])}else return 0},Hp=function(e,r){var n=e._private,a,i=e.isEdge(),o=r==null?Kp:$p(r),l=o===Kp,u=zp(e),c=n.bbCachePosKey===u,d=r.useCache&&c,f=function(g){return g._private.bbCache==null||g._private.styleDirty},p=!d||f(e)||i&&f(e.source())||f(e.target());if(p?(c||e.recalculateRenderedStyle(d),a=S3(e,_i),n.bbCache=a,n.bbCachePosKey=u):a=n.bbCache,!l){var v=e.isNode();a=zt(),(r.includeNodes&&v||r.includeEdges&&!v)&&(r.includeOverlays?zn(a,n.overlayBounds):zn(a,n.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?zn(a,n.labelBounds.all):(r.includeMainLabels&&zn(a,n.labelBounds.mainRot),r.includeSourceLabels&&zn(a,n.labelBounds.sourceRot),r.includeTargetLabels&&zn(a,n.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},_i={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Kp=$p(_i),qp=wt(_i);hn.boundingBox=function(t){var e;if(this.length===1&&this[0]._private.bbCache!=null&&!this[0]._private.styleDirty&&(t===void 0||t.useCache===void 0||t.useCache===!0))t===void 0?t=_i:t=qp(t),e=Hp(this[0],t);else{e=zt(),t=t||_i;var r=qp(t),n=this,a=n.cy(),i=a.styleEnabled();if(i)for(var o=0;o<n.length;o++){var l=n[o],u=l._private,c=zp(l),d=u.bbCachePosKey===c,f=r.useCache&&d&&!u.styleDirty;l.recalculateRenderedStyle(f)}this.updateCompoundBounds(!t.useCache);for(var p=0;p<n.length;p++){var v=n[p];zn(e,Hp(v,r))}}return e.x1=Jt(e.x1),e.y1=Jt(e.y1),e.x2=Jt(e.x2),e.y2=Jt(e.y2),e.w=Jt(e.x2-e.x1),e.h=Jt(e.y2-e.y1),e},hn.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},hn.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),n=r.hasCompoundNodes(),a=r.collection();if(n&&(a=e.filter(function(c){return c.isParent()}),e=e.not(a)),_e(t)){var i=t;t=function(){return i}}var o=function(d,f){return d._private.bbAtOldPos=t(d,f)},l=function(d){return d._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var u=KB(this.boundingBox({useCache:!1}));return e.silentPositions(l),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),r.endBatch(),u},Pa.boundingbox=Pa.bb=Pa.boundingBox,Pa.renderedBoundingbox=Pa.renderedBoundingBox;var T3=hn,Li,Fi;Li=Fi={};var Up=function(e){e.uppercaseName=xh(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=xh(e.outerName),Li[e.name]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){if(n.isParent())return n.updateCompoundBounds(),a[e.autoName]||0;var l=n.pstyle(e.name);switch(l.strValue){case"label":return n.recalculateRenderedStyle(),a.rstyle[e.labelName]||0;default:return l.pfValue}}else return 1},Li["outer"+e.uppercaseName]=function(){var n=this[0],a=n._private,i=a.cy,o=i._private.styleEnabled;if(n)if(o){var l=n[e.name](),u=n.pstyle("border-width").pfValue,c=2*n.padding();return l+u+c}else return 1},Li["rendered"+e.uppercaseName]=function(){var n=this[0];if(n){var a=n[e.name]();return a*this.cy().zoom()}},Li["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n){var a=n[e.outerName]();return a*this.cy().zoom()}}};Up({name:"width"}),Up({name:"height"}),Fi.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue},Fi.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()},Fi.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var B3=Fi,N3=function(e,r){if(e.isEdge())return r(e)},D3=function(e,r){if(e.isEdge()){var n=e.cy();return Ao(r(e),n.zoom(),n.pan())}},P3=function(e,r){if(e.isEdge()){var n=e.cy(),a=n.pan(),i=n.zoom();return r(e).map(function(o){return Ao(o,i,a)})}},O3=function(e){return e.renderer().getControlPoints(e)},_3=function(e){return e.renderer().getSegmentPoints(e)},L3=function(e){return e.renderer().getSourceEndpoint(e)},F3=function(e){return e.renderer().getTargetEndpoint(e)},M3=function(e){return e.renderer().getEdgeMidpoint(e)},Gp={controlPoints:{get:O3,mult:!0},segmentPoints:{get:_3,mult:!0},sourceEndpoint:{get:L3},targetEndpoint:{get:F3},midpoint:{get:M3}},I3=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},A3=Object.keys(Gp).reduce(function(t,e){var r=Gp[e],n=I3(e);return t[e]=function(){return N3(this,r.get)},r.mult?t[n]=function(){return P3(this,r.get)}:t[n]=function(){return D3(this,r.get)},t},{}),V3=xe({},x3,T3,B3,A3);/*!
439
439
  Event object based on jQuery events, MIT license
440
440
 
441
441
  https://jquery.org/license/
442
442
  https://tldrlegal.com/license/mit-license
443
443
  https://github.com/jquery/jquery/blob/master/src/event.js
444
- */var Wp=function(e,r){this.recycle(e,r)};function Mi(){return!1}function ts(){return!0}Wp.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Mi,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ts:Mi):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,a=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*a+i.x,y:n.y*a+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=ts;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=ts;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ts,this.stopPropagation()},isDefaultPrevented:Mi,isPropagationStopped:Mi,isImmediatePropagationStopped:Mi};var jp=/^([^.]+)(\.(?:[^.]+))?$/,RD=".*",Yp={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Xp=Object.keys(Yp),$D={};function rs(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$D,e=arguments.length>1?arguments[1]:void 0,r=0;r<Xp.length;r++){var n=Xp[r];this[n]=t[n]||Yp[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var pn=rs.prototype,Zp=function(e,r,n,a,i,o,l){Ye(a)&&(i=a,a=null),l&&(o==null?o=l:o=xe({},o,l));for(var u=He(n)?n:n.split(/\s+/),c=0;c<u.length;c++){var d=u[c];if(!nn(d)){var f=d.match(jp);if(f){var p=f[1],v=f[2]?f[2]:null,h=r(e,d,p,v,a,i,o);if(h===!1)break}}}},Qp=function(e,r){return e.addEventFields(e.context,r),new Wp(r.type,r)},zD=function(e,r,n){if(sT(n)){r(e,n);return}else if(_e(n)){r(e,Qp(e,n));return}for(var a=He(n)?n:n.split(/\s+/),i=0;i<a.length;i++){var o=a[i];if(!nn(o)){var l=o.match(jp);if(l){var u=l[1],c=l[2]?l[2]:null,d=Qp(e,{type:u,namespace:c,target:e.context});r(e,d)}}}};pn.on=pn.addListener=function(t,e,r,n,a){return Zp(this,function(i,o,l,u,c,d,f){Ye(d)&&i.listeners.push({event:o,callback:d,type:l,namespace:u,qualifier:c,conf:f})},t,e,r,n,a),this},pn.one=function(t,e,r,n){return this.on(t,e,r,n,{one:!0})},pn.removeListener=pn.off=function(t,e,r,n){var a=this;this.emitting!==0&&(this.listeners=gB(this.listeners));for(var i=this.listeners,o=function(c){var d=i[c];Zp(a,function(f,p,v,h,g,y){if((d.type===v||t==="*")&&(!h&&d.namespace!==".*"||d.namespace===h)&&(!g||f.qualifierCompare(d.qualifier,g))&&(!y||d.callback===y))return i.splice(c,1),!1},t,e,r,n)},l=i.length-1;l>=0;l--)o(l);return this},pn.removeAllListeners=function(){return this.removeListener("*")},pn.emit=pn.trigger=function(t,e,r){var n=this.listeners,a=n.length;return this.emitting++,He(e)||(e=[e]),zD(this,function(i,o){r!=null&&(n=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],a=n.length);for(var l=function(d){var f=n[d];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===RD)&&i.eventMatches(i.context,f,o)){var p=[o];e!=null&&yB(p,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(g){return g!==f}));var v=i.callbackContext(i.context,f,o),h=f.callback.apply(v,p);i.afterEmit(i.context,f,o),h===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<a;u++)l(u);i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},t),this.emitting--,this};var HD={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,n){var a=r.qualifier;return a!=null?e!==n.target&&vi(n.target)&&a.matches(n.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,n){return r.qualifier!=null?n.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},ns=function(e){return be(e)?new un(e):e},Jp={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],n=r._private;n.emitter||(n.emitter=new rs(HD,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,n){for(var a=ns(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n)}return this},removeListener:function(e,r,n){for(var a=ns(r),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,a,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,n){for(var a=ns(r),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,a,n)}return this},once:function(e,r,n){for(var a=ns(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n,{once:!0,onceCollection:this})}},emit:function(e,r){for(var n=0;n<this.length;n++){var a=this[n];a.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};Ve.eventAliasesOn(Jp);var ev={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),n=0;n<this.length;n++){var a=this[n];a.isNode()?e.push(a):r.push(a)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(be(e)||Ut(e))return new un(e).filter(this);if(Ye(e)){for(var n=this.spawn(),a=this,i=0;i<a.length;i++){var o=a[i],l=r?e.apply(r,[o,i,a]):e(o,i,a);l&&n.push(o)}return n}return this.spawn()},not:function(e){if(e){be(e)&&(e=this.filter(e));for(var r=this.spawn(),n=0;n<this.length;n++){var a=this[n],i=e.has(a);i||r.push(a)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(be(e)){var r=e;return this.filter(r)}for(var n=this.spawn(),a=this,i=e,o=this.length<e.length,l=o?a:i,u=o?i:a,c=0;c<l.length;c++){var d=l[c];u.has(d)&&n.push(d)}return n},xor:function(e){var r=this._private.cy;be(e)&&(e=r.$(e));var n=this.spawn(),a=this,i=e,o=function(u,c){for(var d=0;d<u.length;d++){var f=u[d],p=f._private.data.id,v=c.hasElementWithId(p);v||n.push(f)}};return o(a,i),o(i,a),n},diff:function(e){var r=this._private.cy;be(e)&&(e=r.$(e));var n=this.spawn(),a=this.spawn(),i=this.spawn(),o=this,l=e,u=function(d,f,p){for(var v=0;v<d.length;v++){var h=d[v],g=h._private.data.id,y=f.hasElementWithId(g);y?i.merge(h):p.push(h)}};return u(o,l,n),u(l,o,a),{left:n,right:a,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(be(e)){var n=e;e=r.mutableElements().filter(n)}for(var a=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],l=!this.has(o);l&&a.push(o)}return a},merge:function(e){var r=this._private,n=r.cy;if(!e)return this;if(e&&be(e)){var a=e;e=n.mutableElements().filter(a)}for(var i=r.map,o=0;o<e.length;o++){var l=e[o],u=l._private.data.id,c=!i.has(u);if(c){var d=this.length++;this[d]=l,i.set(u,{ele:l,index:d})}}return this},unmergeAt:function(e){var r=this[e],n=r.id(),a=this._private,i=a.map;this[e]=void 0,i.delete(n);var o=e===this.length-1;if(this.length>1&&!o){var l=this.length-1,u=this[l],c=u._private.data.id;this[l]=void 0,this[e]=u,i.set(c,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,n=e._private.data.id,a=r.map,i=a.get(n);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&be(e)){var n=e;e=r.mutableElements().filter(n)}for(var a=0;a<e.length;a++)this.unmergeOne(e[a]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var n=this[r];e(n)&&this.unmergeAt(r)}return this},map:function(e,r){for(var n=[],a=this,i=0;i<a.length;i++){var o=a[i],l=r?e.apply(r,[o,i,a]):e(o,i,a);n.push(l)}return n},reduce:function(e,r){for(var n=r,a=this,i=0;i<a.length;i++)n=e(n,a[i],i,a);return n},max:function(e,r){for(var n=-1/0,a,i=this,o=0;o<i.length;o++){var l=i[o],u=r?e.apply(r,[l,o,i]):e(l,o,i);u>n&&(n=u,a=l)}return{value:n,ele:a}},min:function(e,r){for(var n=1/0,a,i=this,o=0;o<i.length;o++){var l=i[o],u=r?e.apply(r,[l,o,i]):e(l,o,i);u<n&&(n=u,a=l)}return{value:n,ele:a}}},Fe=ev;Fe.u=Fe["|"]=Fe["+"]=Fe.union=Fe.or=Fe.add,Fe["\\"]=Fe["!"]=Fe["-"]=Fe.difference=Fe.relativeComplement=Fe.subtract=Fe.not,Fe.n=Fe["&"]=Fe["."]=Fe.and=Fe.intersection=Fe.intersect,Fe["^"]=Fe["(+)"]=Fe["(-)"]=Fe.symmetricDifference=Fe.symdiff=Fe.xor,Fe.fnFilter=Fe.filterFn=Fe.stdFilter=Fe.filter,Fe.complement=Fe.abscomp=Fe.absoluteComplement;var KD={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},tv=function(e,r){var n=e.cy(),a=n.hasCompoundNodes();function i(d){var f=d.pstyle("z-compound-depth");return f.value==="auto"?a?d.zDepth():0:f.value==="bottom"?-1:f.value==="top"?Ul:0}var o=i(e)-i(r);if(o!==0)return o;function l(d){var f=d.pstyle("z-index-compare");return f.value==="auto"&&d.isNode()?1:0}var u=l(e)-l(r);if(u!==0)return u;var c=e.pstyle("z-index").value-r.pstyle("z-index").value;return c!==0?c:e.poolIndex()-r.poolIndex()},as={forEach:function(e,r){if(Ye(e))for(var n=this.length,a=0;a<n;a++){var i=this[a],o=r?e.apply(r,[i,a,this]):e(i,a,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var n=[],a=this.length;r==null&&(r=a),e==null&&(e=0),e<0&&(e=a+e),r<0&&(r=a+r);for(var i=e;i>=0&&i<r&&i<a;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Ye(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(tv)},zDepth:function(){var e=this[0];if(e){var r=e._private,n=r.group;if(n==="nodes"){var a=r.data.parent?e.parents().size():0;return e.isParent()?a:Ul-1}else{var i=r.source,o=r.target,l=i.zDepth(),u=o.zDepth();return Math.max(l,u,0)}}}};as.each=as.forEach;var qD=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":ot(Symbol))!=e&&ot(Symbol.iterator)!=e;r&&(as[Symbol.iterator]=function(){var n=this,a={value:void 0,done:!1},i=0,o=this.length;return ph({next:function(){return i<o?a.value=n[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})})};qD();var UD=wt({nodeDimensionsIncludeLabels:!1}),is={layoutDimensions:function(e){e=UD(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();r={w:n.w,h:n.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,n){var a=this.nodes().filter(function(x){return!x.isParent()}),i=this.cy(),o=r.eles,l=function(E){return E.id()},u=gi(n,l);e.emit({type:"layoutstart",layout:e}),e.animations=[];var c=function(E,k,B){var S={x:k.x1+k.w/2,y:k.y1+k.h/2},N={x:(B.x-S.x)*E,y:(B.y-S.y)*E};return{x:S.x+N.x,y:S.y+N.y}},d=r.spacingFactor&&r.spacingFactor!==1,f=function(){if(!d)return null;for(var E=zt(),k=0;k<a.length;k++){var B=a[k],S=u(B,k);GB(E,S.x,S.y)}return E},p=f(),v=gi(function(x,E){var k=u(x,E);if(d){var B=Math.abs(r.spacingFactor);k=c(B,p,k)}return r.transform!=null&&(k=r.transform(x,k)),k},l);if(r.animate){for(var h=0;h<a.length;h++){var g=a[h],y=v(g,h),m=r.animateFilter==null||r.animateFilter(g,h);if(m){var b=g.animation({position:y,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else g.position(y)}if(r.fit){var w=i.animation({fit:{boundingBox:o.boundingBoxAt(v),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(w)}else if(r.zoom!==void 0&&r.pan!==void 0){var C=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(C)}e.animations.forEach(function(x){return x.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),xa.all(e.animations.map(function(x){return x.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else a.positions(v),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(xe({},e,{eles:this}))}};is.createLayout=is.makeLayout=is.layout;function rv(t,e,r){var n=r._private,a=n.styleCache=n.styleCache||[],i;return(i=a[t])!=null||(i=a[t]=e(r)),i}function os(t,e){return t=Mn(t),function(n){return rv(t,e,n)}}function ss(t,e){t=Mn(t);var r=function(a){return e.call(a)};return function(){var a=this[0];if(a)return rv(t,r,a)}}var Ct={recalculateRenderedStyle:function(e){var r=this.cy(),n=r.renderer(),a=r.styleEnabled();return n&&a&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.forEach(r)}else this.forEach(function(a){r(a),a.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var n=r._private.batchStyleEles;return n.merge(this),this}var a=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),a&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(l){return l._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var n=this[r];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],a=n.cy();if(a.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return i??(r?a.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var n=r.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=this[0];if(n)return r.style().getRenderedStyle(n,e)},style:function(e,r){var n=this.cy();if(!n.styleEnabled())return this;var a=!1,i=n.style();if(_e(e)){var o=e;i.applyBypass(this,o,a),this.emitAndNotify("style")}else if(be(e))if(r===void 0){var l=this[0];return l?i.getStylePropertyValue(l,e):void 0}else i.applyBypass(this,e,r,a),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,a=r.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var l=i[o];a.removeAllBypasses(l,n)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var c=i[u];a.removeBypasses(c,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),n=this[0];if(n){var a=n._private,i=n.pstyle("opacity").value;if(!r)return i;var o=a.data.parent?n.parents():null;if(o)for(var l=0;l<o.length;l++){var u=o[l],c=u.pstyle("opacity").value;i=c*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],n=r.cy().hasCompoundNodes();if(r)return n?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function vc(t,e){var r=t._private,n=r.data.parent?t.parents():null;if(n)for(var a=0;a<n.length;a++){var i=n[a];if(!e(i))return!1}return!0}function gc(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,n=t.parentOk||t.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],o=a.hasCompoundNodes();if(i){var l=i._private;if(!e(i))return!1;if(i.isNode())return!o||vc(i,n);var u=l.source,c=l.target;return r(u)&&(!o||vc(u,r))&&(u===c||r(c)&&(!o||vc(c,r)))}}}var Oa=os("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Ct.takesUpSpace=ss("takesUpSpace",gc({ok:Oa}));var GD=os("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Oa(t)}),WD=os("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Oa(t)});Ct.interactive=ss("interactive",gc({ok:GD,parentOk:WD,edgeOkViaNode:Oa})),Ct.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var jD=os("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Oa(t)}),YD=Oa;Ct.visible=ss("visible",gc({ok:jD,edgeOkViaNode:YD})),Ct.hidden=function(){var t=this[0];if(t)return!t.visible()},Ct.isBundledBezier=ss("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1}),Ct.bypass=Ct.css=Ct.style,Ct.renderedCss=Ct.renderedStyle,Ct.removeBypass=Ct.removeCss=Ct.removeStyle,Ct.pstyle=Ct.parsedStyle;var vn={};function nv(t){return function(){var e=arguments,r=[];if(e.length===2){var n=e[0],a=e[1];this.on(t.event,n,a)}else if(e.length===1&&Ye(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&He(e[0])){for(var o=e.length===1?e[0]:null,l=0;l<this.length;l++){var u=this[l],c=!t.ableField||u._private[t.ableField],d=u._private[t.field]!=t.value;if(t.overrideAble){var f=t.overrideAble(u);if(f!==void 0&&(c=f,!f))return this}c&&(u._private[t.field]=t.value,d&&r.push(u))}var p=this.spawn(r);p.updateStyle(),p.emit(t.event),o&&p.emit(o)}return this}}function _a(t){vn[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},vn[t.on]=nv({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),vn[t.off]=nv({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}_a({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"}),_a({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"}),_a({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"}),_a({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"}),vn.deselect=vn.unselect,vn.grabbed=function(){var t=this[0];if(t)return t._private.grabbed},_a({field:"active",on:"activate",off:"unactivate"}),_a({field:"pannable",on:"panify",off:"unpanify"}),vn.inactive=function(){var t=this[0];if(t)return!t._private.active};var Tt={},av=function(e){return function(n){for(var a=this,i=[],o=0;o<a.length;o++){var l=a[o];if(l.isNode()){for(var u=!1,c=l.connectedEdges(),d=0;d<c.length;d++){var f=c[d],p=f.source(),v=f.target();if(e.noIncomingEdges&&v===l&&p!==l||e.noOutgoingEdges&&p===l&&v!==l){u=!0;break}}u||i.push(l)}}return this.spawn(i,!0).filter(n)}},iv=function(e){return function(r){for(var n=this,a=[],i=0;i<n.length;i++){var o=n[i];if(o.isNode())for(var l=o.connectedEdges(),u=0;u<l.length;u++){var c=l[u],d=c.source(),f=c.target();e.outgoing&&d===o?(a.push(c),a.push(f)):e.incoming&&f===o&&(a.push(c),a.push(d))}}return this.spawn(a,!0).filter(r)}},ov=function(e){return function(r){for(var n=this,a=[],i={};;){var o=e.outgoing?n.outgoers():n.incomers();if(o.length===0)break;for(var l=!1,u=0;u<o.length;u++){var c=o[u],d=c.id();i[d]||(i[d]=!0,a.push(c),l=!0)}if(!l)break;n=o}return this.spawn(a,!0).filter(r)}};Tt.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null},xe(Tt,{roots:av({noIncomingEdges:!0}),leaves:av({noOutgoingEdges:!0}),outgoers:Qt(iv({outgoing:!0}),"outgoers"),successors:ov({outgoing:!0}),incomers:Qt(iv({incoming:!0}),"incomers"),predecessors:ov({incoming:!0})}),xe(Tt,{neighborhood:Qt(function(t){for(var e=[],r=this.nodes(),n=0;n<r.length;n++)for(var a=r[n],i=a.connectedEdges(),o=0;o<i.length;o++){var l=i[o],u=l.source(),c=l.target(),d=a===u?c:u;d.length>0&&e.push(d[0]),e.push(l[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Tt.neighbourhood=Tt.neighborhood,Tt.closedNeighbourhood=Tt.closedNeighborhood,Tt.openNeighbourhood=Tt.openNeighborhood,xe(Tt,{source:Qt(function(e){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&e?n.filter(e):n},"source"),target:Qt(function(e){var r=this[0],n;return r&&(n=r._private.target||r.cy().collection()),n&&e?n.filter(e):n},"target"),sources:sv({attr:"source"}),targets:sv({attr:"target"})});function sv(t){return function(r){for(var n=[],a=0;a<this.length;a++){var i=this[a],o=i._private[t.attr];o&&n.push(o)}return this.spawn(n,!0).filter(r)}}xe(Tt,{edgesWith:Qt(lv(),"edgesWith"),edgesTo:Qt(lv({thisIsSrc:!0}),"edgesTo")});function lv(t){return function(r){var n=[],a=this._private.cy,i=t||{};be(r)&&(r=a.$(r));for(var o=0;o<r.length;o++)for(var l=r[o]._private.edges,u=0;u<l.length;u++){var c=l[u],d=c._private.data,f=this.hasElementWithId(d.source)&&r.hasElementWithId(d.target),p=r.hasElementWithId(d.source)&&this.hasElementWithId(d.target),v=f||p;v&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!f||i.thisIsTgt&&!p)||n.push(c))}return this.spawn(n,!0)}}xe(Tt,{connectedEdges:Qt(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var a=r[n];if(a.isNode())for(var i=a._private.edges,o=0;o<i.length;o++){var l=i[o];e.push(l)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Qt(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var a=r[n];a.isEdge()&&(e.push(a.source()[0]),e.push(a.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Qt(cv(),"parallelEdges"),codirectedEdges:Qt(cv({codirected:!0}),"codirectedEdges")});function cv(t){var e={codirected:!1};return t=xe({},e,t),function(n){for(var a=[],i=this.edges(),o=t,l=0;l<i.length;l++)for(var u=i[l],c=u._private,d=c.source,f=d._private.data.id,p=c.data.target,v=d._private.edges,h=0;h<v.length;h++){var g=v[h],y=g._private.data,m=y.target,b=y.source,w=m===p&&b===f,C=f===m&&p===b;(o.codirected&&w||!o.codirected&&(w||C))&&a.push(g)}return this.spawn(a,!0).filter(n)}}xe(Tt,{components:function(e){var r=this,n=r.cy(),a=n.collection(),i=e==null?r.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var l=function(d,f){a.merge(d),i.unmerge(d),f.merge(d)};if(i.empty())return r.spawn();var u=function(){var d=n.collection();o.push(d);var f=i[0];l(f,d),r.bfs({directed:!1,roots:f,visit:function(v){return l(v,d)}}),d.forEach(function(p){p.connectedEdges().forEach(function(v){r.has(v)&&d.has(v.source())&&d.has(v.target())&&d.merge(v)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Tt.componentsOf=Tt.components;var kt=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Xe("A collection must have a reference to the core");return}var i=new wr,o=!1;if(!r)r=[];else if(r.length>0&&_e(r[0])&&!vi(r[0])){o=!0;for(var l=[],u=new ga,c=0,d=r.length;c<d;c++){var f=r[c];f.data==null&&(f.data={});var p=f.data;if(p.id==null)p.id=$h();else if(e.hasElementWithId(p.id)||u.has(p.id))continue;var v=new Io(e,f,!1);l.push(v),u.add(p.id)}r=l}this.length=0;for(var h=0,g=r.length;h<g;h++){var y=r[h][0];if(y!=null){var m=y._private.data.id;(!n||!i.has(m))&&(n&&i.set(m,{index:this.length,ele:y}),this[this.length]=y,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(b){this.lazyMap=b},rebuildMap:function(){for(var w=this.lazyMap=new wr,C=this.eles,x=0;x<C.length;x++){var E=C[x];w.set(E.id(),{index:x,ele:E})}}},n&&(this._private.map=i),o&&!a&&this.restore()},qe=Io.prototype=kt.prototype=Object.create(Array.prototype);qe.instanceString=function(){return"collection"},qe.spawn=function(t,e){return new kt(this.cy(),t,e)},qe.spawnSelf=function(){return this.spawn(this)},qe.cy=function(){return this._private.cy},qe.renderer=function(){return this._private.cy.renderer()},qe.element=function(){return this[0]},qe.collection=function(){return wh(this)?this:new kt(this._private.cy,[this])},qe.unique=function(){return new kt(this._private.cy,this,!0)},qe.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)},qe.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new kt(e)},qe.$id=qe.getElementById,qe.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index},qe.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index},qe.indexOfId=function(t){return t=""+t,this._private.map.get(t).index},qe.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var n=e._private;if(_e(t)){if(r.startBatch(),t.data){e.data(t.data);var a=n.data;if(e.isEdge()){var i=!1,o={},l=t.data.source,u=t.data.target;l!=null&&l!=a.source&&(o.source=""+l,i=!0),u!=null&&u!=a.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var c="parent"in t.data,d=t.data.parent;c&&(d!=null||a.parent!=null)&&d!=a.parent&&(d===void 0&&(d=null),d!=null&&(d=""+d),e=e.move({parent:d}))}}t.position&&e.position(t.position);var f=function(g,y,m){var b=t[g];b!=null&&b!==n[g]&&(b?e[y]():e[m]())};return f("removed","remove","restore"),f("selected","select","unselect"),f("selectable","selectify","unselectify"),f("locked","lock","unlock"),f("grabbable","grabify","ungrabify"),f("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var p={data:br(n.data),position:br(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};p.classes="";var v=0;return n.classes.forEach(function(h){return p.classes+=v++===0?h:" "+h}),p}}},qe.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],n=r.json();t.push(n)}return t},qe.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var n=this[r],a=n.json(),i=new Io(t,a,!1);e.push(i)}return new kt(t,e)},qe.copy=qe.clone,qe.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=r.cy(),a=n._private,i=[],o=[],l,u=0,c=r.length;u<c;u++){var d=r[u];e&&!d.removed()||(d.isNode()?i.push(d):o.push(d))}l=i.concat(o);var f,p=function(){l.splice(f,1),f--};for(f=0;f<l.length;f++){var v=l[f],h=v._private,g=h.data;if(v.clearTraversalCache(),!(!e&&!h.removed)){if(g.id===void 0)g.id=$h();else if(le(g.id))g.id=""+g.id;else if(nn(g.id)||!be(g.id)){Xe("Can not create element with invalid string ID `"+g.id+"`"),p();continue}else if(n.hasElementWithId(g.id)){Xe("Can not create second element with ID `"+g.id+"`"),p();continue}}var y=g.id;if(v.isNode()){var m=h.position;m.x==null&&(m.x=0),m.y==null&&(m.y=0)}if(v.isEdge()){for(var b=v,w=["source","target"],C=w.length,x=!1,E=0;E<C;E++){var k=w[E],B=g[k];le(B)&&(B=g[k]=""+g[k]),B==null||B===""?(Xe("Can not create edge `"+y+"` with unspecified "+k),x=!0):n.hasElementWithId(B)||(Xe("Can not create edge `"+y+"` with nonexistant "+k+" `"+B+"`"),x=!0)}if(x){p();continue}var S=n.getElementById(g.source),N=n.getElementById(g.target);S.same(N)?S._private.edges.push(b):(S._private.edges.push(b),N._private.edges.push(b)),b._private.source=S,b._private.target=N}h.map=new wr,h.map.set(y,{ele:v,index:0}),h.removed=!1,e&&n.addToPool(v)}for(var D=0;D<i.length;D++){var P=i[D],L=P._private.data;le(L.parent)&&(L.parent=""+L.parent);var O=L.parent,I=O!=null;if(I||P._private.parent){var _=P._private.parent?n.collection().merge(P._private.parent):n.getElementById(O);if(_.empty())L.parent=void 0;else if(_[0].removed())Ae("Node added with missing parent, reference to parent removed"),L.parent=void 0,P._private.parent=null;else{for(var M=!1,F=_;!F.empty();){if(P.same(F)){M=!0,L.parent=void 0;break}F=F.parent()}M||(_[0]._private.children.push(P),P._private.parent=_[0],a.hasCompoundNodes=!0)}}}if(l.length>0){for(var V=l.length===r.length?r:new kt(n,l),H=0;H<V.length;H++){var $=V[H];$.isNode()||($.parallelEdges().clearTraversalCache(),$.source().clearTraversalCache(),$.target().clearTraversalCache())}var z;a.hasCompoundNodes?z=n.collection().merge(V).merge(V.connectedNodes()).merge(V.parent()):z=V,z.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?V.emitAndNotify("add"):e&&V.emit("add")}return r},qe.removed=function(){var t=this[0];return t&&t._private.removed},qe.inside=function(){var t=this[0];return t&&!t._private.removed},qe.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=[],a={},i=r._private.cy;function o(O){for(var I=O._private.edges,_=0;_<I.length;_++)u(I[_])}function l(O){for(var I=O._private.children,_=0;_<I.length;_++)u(I[_])}function u(O){var I=a[O.id()];e&&O.removed()||I||(a[O.id()]=!0,O.isNode()?(n.push(O),o(O),l(O)):n.unshift(O))}for(var c=0,d=r.length;c<d;c++){var f=r[c];u(f)}function p(O,I){var _=O._private.edges;on(_,I),O.clearTraversalCache()}function v(O){O.clearTraversalCache()}var h=[];h.ids={};function g(O,I){I=I[0],O=O[0];var _=O._private.children,M=O.id();on(_,I),I._private.parent=null,h.ids[M]||(h.ids[M]=!0,h.push(O))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(n);for(var y=0;y<n.length;y++){var m=n[y];if(m.isEdge()){var b=m.source()[0],w=m.target()[0];p(b,m),p(w,m);for(var C=m.parallelEdges(),x=0;x<C.length;x++){var E=C[x];v(E),E.isBundledBezier()&&E.dirtyBoundingBoxCache()}}else{var k=m.parent();k.length!==0&&g(k,m)}e&&(m._private.removed=!0)}var B=i._private.elements;i._private.hasCompoundNodes=!1;for(var S=0;S<B.length;S++){var N=B[S];if(N.isParent()){i._private.hasCompoundNodes=!0;break}}var D=new kt(this.cy(),n);D.size()>0&&(t?D.emitAndNotify("remove"):e&&D.emit("remove"));for(var P=0;P<h.length;P++){var L=h[P];(!e||!L.removed())&&L.updateStyle()}return D},qe.move=function(t){var e=this._private.cy,r=this,n=!1,a=!1,i=function(h){return h==null?h:""+h};if(t.source!==void 0||t.target!==void 0){var o=i(t.source),l=i(t.target),u=o!=null&&e.hasElementWithId(o),c=l!=null&&e.hasElementWithId(l);(u||c)&&(e.batch(function(){r.remove(n,a),r.emitAndNotify("moveout");for(var v=0;v<r.length;v++){var h=r[v],g=h._private.data;h.isEdge()&&(u&&(g.source=o),c&&(g.target=l))}r.restore(n,a)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var d=i(t.parent),f=d===null||e.hasElementWithId(d);if(f){var p=d===null?void 0:d;e.batch(function(){var v=r.remove(n,a);v.emitAndNotify("moveout");for(var h=0;h<r.length;h++){var g=r[h],y=g._private.data;g.isNode()&&(y.parent=p)}v.restore(n,a)}),r.emitAndNotify("move")}}return this},[hp,oD,Qo,fn,Na,kD,Jo,VD,Jp,ev,KD,as,is,Ct,vn,Tt].forEach(function(t){xe(qe,t)});var XD={add:function(e){var r,n=this;if(Ut(e)){var a=e;if(a._private.cy===n)r=a.restore();else{for(var i=[],o=0;o<a.length;o++){var l=a[o];i.push(l.json())}r=new kt(n,i)}}else if(He(e)){var u=e;r=new kt(n,u)}else if(_e(e)&&(He(e.nodes)||He(e.edges))){for(var c=e,d=[],f=["nodes","edges"],p=0,v=f.length;p<v;p++){var h=f[p],g=c[h];if(He(g))for(var y=0,m=g.length;y<m;y++){var b=xe({group:h},g[y]);d.push(b)}}r=new kt(n,d)}else{var w=e;r=new Io(n,w).collection()}return r},remove:function(e){if(!Ut(e)){if(be(e)){var r=e;e=this.$(r)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function ZD(t,e,r,n){var a=4,i=.001,o=1e-7,l=10,u=11,c=1/(u-1),d=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var f=0;f<4;++f)if(typeof arguments[f]!="number"||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var p=d?new Float32Array(u):new Array(u);function v(N,D){return 1-3*D+3*N}function h(N,D){return 3*D-6*N}function g(N){return 3*N}function y(N,D,P){return((v(D,P)*N+h(D,P))*N+g(D))*N}function m(N,D,P){return 3*v(D,P)*N*N+2*h(D,P)*N+g(D)}function b(N,D){for(var P=0;P<a;++P){var L=m(D,t,r);if(L===0)return D;var O=y(D,t,r)-N;D-=O/L}return D}function w(){for(var N=0;N<u;++N)p[N]=y(N*c,t,r)}function C(N,D,P){var L,O,I=0;do O=D+(P-D)/2,L=y(O,t,r)-N,L>0?P=O:D=O;while(Math.abs(L)>o&&++I<l);return O}function x(N){for(var D=0,P=1,L=u-1;P!==L&&p[P]<=N;++P)D+=c;--P;var O=(N-p[P])/(p[P+1]-p[P]),I=D+O*c,_=m(I,t,r);return _>=i?b(N,I):_===0?I:C(N,D,D+c)}var E=!1;function k(){E=!0,(t!==e||r!==n)&&w()}var B=function(D){return E||k(),t===e&&r===n?D:D===0?0:D===1?1:y(x(D),e,n)};B.getControlPoints=function(){return[{x:t,y:e},{x:r,y:n}]};var S="generateBezier("+[t,e,r,n]+")";return B.toString=function(){return S},B}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var QD=function(){function t(n){return-n.tension*n.x-n.friction*n.v}function e(n,a,i){var o={x:n.x+i.dx*a,v:n.v+i.dv*a,tension:n.tension,friction:n.friction};return{dx:o.v,dv:t(o)}}function r(n,a){var i={dx:n.v,dv:t(n)},o=e(n,a*.5,i),l=e(n,a*.5,o),u=e(n,a,l),c=1/6*(i.dx+2*(o.dx+l.dx)+u.dx),d=1/6*(i.dv+2*(o.dv+l.dv)+u.dv);return n.x=n.x+c*a,n.v=n.v+d*a,n}return function n(a,i,o){var l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,d=1/1e4,f=16/1e3,p,v,h;for(a=parseFloat(a)||500,i=parseFloat(i)||20,o=o||null,l.tension=a,l.friction=i,p=o!==null,p?(c=n(a,i),v=c/o*f):v=f;h=r(h||l,v),u.push(1+h.x),c+=16,Math.abs(h.x)>d&&Math.abs(h.v)>d;);return p?function(g){return u[g*(u.length-1)|0]}:c}}(),Ue=function(e,r,n,a){var i=ZD(e,r,n,a);return function(o,l,u){return o+(l-o)*i(u)}},ls={linear:function(e,r,n){return e+(r-e)*n},ease:Ue(.25,.1,.25,1),"ease-in":Ue(.42,0,1,1),"ease-out":Ue(0,0,.58,1),"ease-in-out":Ue(.42,0,.58,1),"ease-in-sine":Ue(.47,0,.745,.715),"ease-out-sine":Ue(.39,.575,.565,1),"ease-in-out-sine":Ue(.445,.05,.55,.95),"ease-in-quad":Ue(.55,.085,.68,.53),"ease-out-quad":Ue(.25,.46,.45,.94),"ease-in-out-quad":Ue(.455,.03,.515,.955),"ease-in-cubic":Ue(.55,.055,.675,.19),"ease-out-cubic":Ue(.215,.61,.355,1),"ease-in-out-cubic":Ue(.645,.045,.355,1),"ease-in-quart":Ue(.895,.03,.685,.22),"ease-out-quart":Ue(.165,.84,.44,1),"ease-in-out-quart":Ue(.77,0,.175,1),"ease-in-quint":Ue(.755,.05,.855,.06),"ease-out-quint":Ue(.23,1,.32,1),"ease-in-out-quint":Ue(.86,0,.07,1),"ease-in-expo":Ue(.95,.05,.795,.035),"ease-out-expo":Ue(.19,1,.22,1),"ease-in-out-expo":Ue(1,0,0,1),"ease-in-circ":Ue(.6,.04,.98,.335),"ease-out-circ":Ue(.075,.82,.165,1),"ease-in-out-circ":Ue(.785,.135,.15,.86),spring:function(e,r,n){if(n===0)return ls.linear;var a=QD(e,r,n);return function(i,o,l){return i+(o-i)*a(l)}},"cubic-bezier":Ue};function uv(t,e,r,n,a){if(n===1||e===r)return r;var i=a(e,r,n);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function dv(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function La(t,e,r,n,a){var i=a!=null?a.type:null;r<0?r=0:r>1&&(r=1);var o=dv(t,a),l=dv(e,a);if(le(o)&&le(l))return uv(i,o,l,r,n);if(He(o)&&He(l)){for(var u=[],c=0;c<l.length;c++){var d=o[c],f=l[c];if(d!=null&&f!=null){var p=uv(i,d,f,r,n);u.push(p)}else u.push(f)}return u}}function JD(t,e,r,n){var a=!n,i=t._private,o=e._private,l=o.easing,u=o.startTime,c=n?t:t.cy(),d=c.style();if(!o.easingImpl)if(l==null)o.easingImpl=ls.linear;else{var f;if(be(l)){var p=d.parse("transition-timing-function",l);f=p.value}else f=l;var v,h;be(f)?(v=f,h=[]):(v=f[1],h=f.slice(2).map(function(V){return+V})),h.length>0?(v==="spring"&&h.push(o.duration),o.easingImpl=ls[v].apply(null,h)):o.easingImpl=ls[v]}var g=o.easingImpl,y;if(o.duration===0?y=1:y=(r-u)/o.duration,o.applying&&(y=o.progress),y<0?y=0:y>1&&(y=1),o.delay==null){var m=o.startPosition,b=o.position;if(b&&a&&!t.locked()){var w={};Ii(m.x,b.x)&&(w.x=La(m.x,b.x,y,g)),Ii(m.y,b.y)&&(w.y=La(m.y,b.y,y,g)),t.position(w)}var C=o.startPan,x=o.pan,E=i.pan,k=x!=null&&n;k&&(Ii(C.x,x.x)&&(E.x=La(C.x,x.x,y,g)),Ii(C.y,x.y)&&(E.y=La(C.y,x.y,y,g)),t.emit("pan"));var B=o.startZoom,S=o.zoom,N=S!=null&&n;N&&(Ii(B,S)&&(i.zoom=Si(i.minZoom,La(B,S,y,g),i.maxZoom)),t.emit("zoom")),(k||N)&&t.emit("viewport");var D=o.style;if(D&&D.length>0&&a){for(var P=0;P<D.length;P++){var L=D[P],O=L.name,I=L,_=o.startStyle[O],M=d.properties[_.name],F=La(_,I,y,g,M);d.overrideBypass(t,O,F)}t.emit("style")}}return o.progress=y,y}function Ii(t,e){return t==null||e==null?!1:le(t)&&le(e)?!0:!!(t&&e)}function e3(t,e,r,n){var a=e._private;a.started=!0,a.startTime=r-a.progress*a.duration}function fv(t,e){var r=e._private.aniEles,n=[];function a(d,f){var p=d._private,v=p.animation.current,h=p.animation.queue,g=!1;if(v.length===0){var y=h.shift();y&&v.push(y)}for(var m=function(E){for(var k=E.length-1;k>=0;k--){var B=E[k];B()}E.splice(0,E.length)},b=v.length-1;b>=0;b--){var w=v[b],C=w._private;if(C.stopped){v.splice(b,1),C.hooked=!1,C.playing=!1,C.started=!1,m(C.frames);continue}!C.playing&&!C.applying||(C.playing&&C.applying&&(C.applying=!1),C.started||e3(d,w,t),JD(d,w,t,f),C.applying&&(C.applying=!1),m(C.frames),C.step!=null&&C.step(t),w.completed()&&(v.splice(b,1),C.hooked=!1,C.playing=!1,C.started=!1,m(C.completes)),g=!0)}return!f&&v.length===0&&h.length===0&&n.push(d),g}for(var i=!1,o=0;o<r.length;o++){var l=r[o],u=a(l);i=i||u}var c=a(e,!0);(i||c)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(n),e.emit("step")}var t3={animate:Ve.animate(),animation:Ve.animation(),animated:Ve.animated(),clearQueue:Ve.clearQueue(),delay:Ve.delay(),delayAnimation:Ve.delayAnimation(),stop:Ve.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&Lo(function(i){fv(i,e),r()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(i,o){fv(o,e)},n.beforeRenderPriorities.animations):r()}},r3={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,n){var a=r.qualifier;return a!=null?e!==n.target&&vi(n.target)&&a.matches(n.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,n){return r.qualifier!=null?n.target:e}},cs=function(e){return be(e)?new un(e):e},hv={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new rs(r3,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,n){return this.emitter().on(e,cs(r),n),this},removeListener:function(e,r,n){return this.emitter().removeListener(e,cs(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,n){return this.emitter().one(e,cs(r),n),this},once:function(e,r,n){return this.emitter().one(e,cs(r),n),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Ve.eventAliasesOn(hv);var mc={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};mc.jpeg=mc.jpg;var us={layout:function(e){var r=this;if(e==null){Xe("Layout options must be specified to make a layout");return}if(e.name==null){Xe("A `name` must be specified to make a layout");return}var n=e.name,a=r.extension("layout",n);if(a==null){Xe("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;be(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var o=new a(xe({},e,{cy:r,eles:i}));return o}};us.createLayout=us.makeLayout=us.layout;var n3={notify:function(e,r){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var a=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();r!=null&&a.merge(r);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var a=e.batchNotifications[n];a.empty()?r.notify(n):r.notify(n,a)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var n=Object.keys(e),a=0;a<n.length;a++){var i=n[a],o=e[i],l=r.getElementById(i);l.data(o)}})}},a3=wt({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),yc={renderTo:function(e,r,n,a){var i=this._private.renderer;return i.renderTo(e,r,n,a),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var r=this,n=r.extension("renderer",e.name);if(n==null){Xe("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&&Ae("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 a=a3(e);a.cy=r,r._private.renderer=new n(a),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var a=n._private;a.rscratch={},a.rstyle={},a.animation.current=[],a.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};yc.invalidateDimensions=yc.resize;var ds={collection:function(e,r){return be(e)?this.$(e):Ut(e)?e.collection():He(e)?(r||(r={}),new kt(this,e,r.unique,r.removed)):new kt(this)},nodes:function(e){var r=this.$(function(n){return n.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(n){return n.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};ds.elements=ds.filter=ds.$;var Bt={},Ai="t",i3="f";Bt.apply=function(t){for(var e=this,r=e._private,n=r.cy,a=n.collection(),i=0;i<t.length;i++){var o=t[i],l=e.getContextMeta(o);if(!l.empty){var u=e.getContextStyle(l),c=e.applyContextStyle(l,u,o);o._private.appliedInitStyle?e.updateTransitions(o,c.diffProps):o._private.appliedInitStyle=!0;var d=e.updateStyleHints(o);d&&a.push(o)}}return a},Bt.getPropertiesDiff=function(t,e){var r=this,n=r._private.propDiffs=r._private.propDiffs||{},a=t+"-"+e,i=n[a];if(i)return i;for(var o=[],l={},u=0;u<r.length;u++){var c=r[u],d=t[u]===Ai,f=e[u]===Ai,p=d!==f,v=c.mappedProperties.length>0;if(p||f&&v){var h=void 0;p&&v||p?h=c.properties:v&&(h=c.mappedProperties);for(var g=0;g<h.length;g++){for(var y=h[g],m=y.name,b=!1,w=u+1;w<r.length;w++){var C=r[w],x=e[w]===Ai;if(x&&(b=C.properties[y.name]!=null,b))break}!l[m]&&!b&&(l[m]=!0,o.push(m))}}}return n[a]=o,o},Bt.getContextMeta=function(t){for(var e=this,r="",n,a=t._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],l=o.selector&&o.selector.matches(t);l?r+=Ai:r+=i3}return n=e.getPropertiesDiff(a,r),t._private.styleCxtKey=r,{key:r,diffPropNames:n,empty:n.length===0}},Bt.getContextStyle=function(t){var e=t.key,r=this,n=this._private.contextStyles=this._private.contextStyles||{};if(n[e])return n[e];for(var a={_private:{key:e}},i=0;i<r.length;i++){var o=r[i],l=e[i]===Ai;if(l)for(var u=0;u<o.properties.length;u++){var c=o.properties[u];a[c.name]=c}}return n[e]=a,a},Bt.applyContextStyle=function(t,e,r){for(var n=this,a=t.diffPropNames,i={},o=n.types,l=0;l<a.length;l++){var u=a[l],c=e[u],d=r.pstyle(u);if(!c)if(d)d.bypass?c={name:u,deleteBypassed:!0}:c={name:u,delete:!0};else continue;if(d!==c){if(c.mapped===o.fn&&d!=null&&d.mapping!=null&&d.mapping.value===c.value){var f=d.mapping,p=f.fnValue=c.value(r);if(p===f.prevFnValue)continue}var v=i[u]={prev:d};n.applyParsedProperty(r,c),v.next=r.pstyle(u),v.next&&v.next.bypass&&(v.next=v.next.bypassed)}}return{diffProps:i}},Bt.updateStyleHints=function(t){var e=t._private,r=this,n=r.propertyGroupNames,a=r.propertyGroupKeys,i=function(W,oe,he){return r.getPropertiesHash(W,oe,he)},o=e.styleKey;if(t.removed())return!1;var l=e.group==="nodes",u=t._private.style;n=Object.keys(u);for(var c=0;c<a.length;c++){var d=a[c];e.styleKeys[d]=[va,wi]}for(var f=function(W,oe){return e.styleKeys[oe][0]=Ci(W,e.styleKeys[oe][0])},p=function(W,oe){return e.styleKeys[oe][1]=ki(W,e.styleKeys[oe][1])},v=function(W,oe){f(W,oe),p(W,oe)},h=function(W,oe){for(var he=0;he<W.length;he++){var ne=W.charCodeAt(he);f(ne,oe),p(ne,oe)}},g=2e9,y=function(W){return-128<W&&W<128&&Math.floor(W)!==W?g-(W*1024|0):W},m=0;m<n.length;m++){var b=n[m],w=u[b];if(w!=null){var C=this.properties[b],x=C.type,E=C.groupKey,k=void 0;C.hashOverride!=null?k=C.hashOverride(t,w):w.pfValue!=null&&(k=w.pfValue);var B=C.enums==null?w.value:null,S=k!=null,N=B!=null,D=S||N,P=w.units;if(x.number&&D&&!x.multiple){var L=S?k:B;v(y(L),E),!S&&P!=null&&h(P,E)}else h(w.strValue,E)}}for(var O=[va,wi],I=0;I<a.length;I++){var _=a[I],M=e.styleKeys[_];O[0]=Ci(M[0],O[0]),O[1]=ki(M[1],O[1])}e.styleKey=uB(O[0],O[1]);var F=e.styleKeys;e.labelDimsKey=an(F.labelDimensions);var V=i(t,["label"],F.labelDimensions);if(e.labelKey=an(V),e.labelStyleKey=an(Fo(F.commonLabel,V)),!l){var H=i(t,["source-label"],F.labelDimensions);e.sourceLabelKey=an(H),e.sourceLabelStyleKey=an(Fo(F.commonLabel,H));var $=i(t,["target-label"],F.labelDimensions);e.targetLabelKey=an($),e.targetLabelStyleKey=an(Fo(F.commonLabel,$))}if(l){var z=e.styleKeys,j=z.nodeBody,ee=z.nodeBorder,J=z.nodeOutline,Z=z.backgroundImage,re=z.compound,Y=z.pie,A=[j,ee,J,Z,re,Y].filter(function(K){return K!=null}).reduce(Fo,[va,wi]);e.nodeKey=an(A),e.hasPie=Y!=null&&Y[0]!==va&&Y[1]!==wi}return o!==e.styleKey},Bt.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null},Bt.applyParsedProperty=function(t,e){var r=this,n=e,a=t._private.style,i,o=r.types,l=r.properties[n.name].type,u=n.bypass,c=a[n.name],d=c&&c.bypass,f=t._private,p="mapping",v=function(j){return j==null?null:j.pfValue!=null?j.pfValue:j.value},h=function(){var j=v(c),ee=v(n);r.checkTriggers(t,n.name,j,ee)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(n=e=this.parse(e.name,"bezier",u)),n.delete)return a[n.name]=void 0,h(),!0;if(n.deleteBypassed)return c?c.bypass?(c.bypassed=void 0,h(),!0):!1:(h(),!0);if(n.deleteBypass)return c?c.bypass?(a[n.name]=c.bypassed,h(),!0):!1:(h(),!0);var g=function(){Ae("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case o.mapData:{for(var y=n.field.split("."),m=f.data,b=0;b<y.length&&m;b++){var w=y[b];m=m[w]}if(m==null)return g(),!1;var C;if(le(m)){var x=n.fieldMax-n.fieldMin;x===0?C=0:C=(m-n.fieldMin)/x}else return Ae("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+m+"` for `"+t.id()+"` is non-numeric)"),!1;if(C<0?C=0:C>1&&(C=1),l.color){var E=n.valueMin[0],k=n.valueMax[0],B=n.valueMin[1],S=n.valueMax[1],N=n.valueMin[2],D=n.valueMax[2],P=n.valueMin[3]==null?1:n.valueMin[3],L=n.valueMax[3]==null?1:n.valueMax[3],O=[Math.round(E+(k-E)*C),Math.round(B+(S-B)*C),Math.round(N+(D-N)*C),Math.round(P+(L-P)*C)];i={bypass:n.bypass,name:n.name,value:O,strValue:"rgb("+O[0]+", "+O[1]+", "+O[2]+")"}}else if(l.number){var I=n.valueMin+(n.valueMax-n.valueMin)*C;i=this.parse(n.name,I,n.bypass,p)}else return!1;if(!i)return g(),!1;i.mapping=n,n=i;break}case o.data:{for(var _=n.field.split("."),M=f.data,F=0;F<_.length&&M;F++){var V=_[F];M=M[V]}if(M!=null&&(i=this.parse(n.name,M,n.bypass,p)),!i)return g(),!1;i.mapping=n,n=i;break}case o.fn:{var H=n.value,$=n.fnValue!=null?n.fnValue:H(t);if(n.prevFnValue=$,$==null)return Ae("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(n.name,$,n.bypass,p),!i)return Ae("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=br(n),n=i;break}case void 0:break;default:return!1}return u?(d?n.bypassed=c.bypassed:n.bypassed=c,a[n.name]=n):d?c.bypassed=n:a[n.name]=n,h(),!0},Bt.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),!e)n._private.style={};else for(var a=n._private.style,i=Object.keys(a),o=0;o<i.length;o++){var l=i[o],u=a[l];u!=null&&(u.bypass?u.bypassed=null:a[l]=null)}}},Bt.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()},Bt.updateTransitions=function(t,e){var r=this,n=t._private,a=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var l={},u=!1,c=0;c<a.length;c++){var d=a[c],f=t.pstyle(d),p=e[d];if(p){var v=p.prev,h=v,g=p.next!=null?p.next:f,y=!1,m=void 0,b=1e-6;h&&(le(h.pfValue)&&le(g.pfValue)?(y=g.pfValue-h.pfValue,m=h.pfValue+b*y):le(h.value)&&le(g.value)?(y=g.value-h.value,m=h.value+b*y):He(h.value)&&He(g.value)&&(y=h.value[0]!==g.value[0]||h.value[1]!==g.value[1]||h.value[2]!==g.value[2],m=h.strValue),y&&(l[d]=g.strValue,this.applyBypass(t,d,m),u=!0))}}if(!u)return;n.transitioning=!0,new xa(function(w){o>0?t.delayAnimation(o).play().promise().then(w):w()}).then(function(){return t.animation({style:l,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,a),t.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(t,a),t.emitAndNotify("style"),n.transitioning=!1)},Bt.checkTrigger=function(t,e,r,n,a,i){var o=this.properties[e],l=a(o);l!=null&&l(r,n)&&i(o)},Bt.checkZOrderTrigger=function(t,e,r,n){var a=this;this.checkTrigger(t,e,r,n,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",t)})},Bt.checkBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(a){return a.triggersBounds},function(a){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),a.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(r==="bezier"||n==="bezier")&&t.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()}),a.triggersBoundsOfConnectedEdges&&e==="display"&&(r==="none"||n==="none")&&t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},Bt.checkTriggers=function(t,e,r,n){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,n),this.checkBoundsTrigger(t,e,r,n)};var Vi={};Vi.applyBypass=function(t,e,r,n){var a=this,i=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var l=0;l<a.properties.length;l++){var u=a.properties[l],c=u.name,d=this.parse(c,r,!0);d&&i.push(d)}}else if(be(e)){var f=this.parse(e,r,!0);f&&i.push(f)}else if(_e(e)){var p=e;n=r;for(var v=Object.keys(p),h=0;h<v.length;h++){var g=v[h],y=p[g];if(y===void 0&&(y=p[Po(g)]),y!==void 0){var m=this.parse(g,y,!0);m&&i.push(m)}}}else return!1;if(i.length===0)return!1;for(var b=!1,w=0;w<t.length;w++){for(var C=t[w],x={},E=void 0,k=0;k<i.length;k++){var B=i[k];if(n){var S=C.pstyle(B.name);E=x[B.name]={prev:S}}b=this.applyParsedProperty(C,br(B))||b,n&&(E.next=C.pstyle(B.name))}b&&this.updateStyleHints(C),n&&this.updateTransitions(C,x,o)}return b},Vi.overrideBypass=function(t,e,r){e=Hl(e);for(var n=0;n<t.length;n++){var a=t[n],i=a._private.style[e],o=this.properties[e].type,l=o.color,u=o.mutiple,c=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),l?i.strValue="rgb("+r.join(",")+")":u?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(a)),this.checkTriggers(a,e,c,r)}},Vi.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)},Vi.removeBypasses=function(t,e,r){for(var n=!0,a=0;a<t.length;a++){for(var i=t[a],o={},l=0;l<e.length;l++){var u=e[l],c=this.properties[u],d=i.pstyle(c.name);if(!(!d||!d.bypass)){var f="",p=this.parse(u,f,!0),v=o[c.name]={prev:d};this.applyParsedProperty(i,p),v.next=i.pstyle(c.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,o,n)}};var bc={};bc.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1},bc.containerCss=function(t){var e=this._private.cy,r=e.container(),n=e.window();if(n&&r&&n.getComputedStyle)return n.getComputedStyle(r).getPropertyValue(t)};var Cr={};Cr.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)},Cr.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var n={},a=0;a<r.properties.length;a++){var i=r.properties[a],o=r.getStylePropertyValue(t,i.name,e);o!=null&&(n[i.name]=o,n[Po(i.name)]=o)}return n}},Cr.getIndexedStyle=function(t,e,r,n){var a=t.pstyle(e)[r][n];return a??t.cy().style().getDefaultProperty(e)[r][0]},Cr.getStylePropertyValue=function(t,e,r){var n=this;if(t=t[0],t){var a=n.properties[e];a.alias&&(a=a.pointsTo);var i=a.type,o=t.pstyle(a.name);if(o){var l=o.value,u=o.units,c=o.strValue;if(r&&i.number&&l!=null&&le(l)){var d=t.cy().zoom(),f=function(y){return y*d},p=function(y,m){return f(y)+m},v=He(l),h=v?u.every(function(g){return g!=null}):u!=null;return h?v?l.map(function(g,y){return p(g,u[y])}).join(" "):p(l,u):v?l.map(function(g){return be(g)?g:""+f(g)}).join(" "):""+f(l)}else if(c!=null)return c}return null}},Cr.getAnimationStartStyle=function(t,e){for(var r={},n=0;n<e.length;n++){var a=e[n],i=a.name,o=t.pstyle(i);o!==void 0&&(_e(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(r[i]=o)}return r},Cr.getPropsList=function(t){var e=this,r=[],n=t,a=e.properties;if(n)for(var i=Object.keys(n),o=0;o<i.length;o++){var l=i[o],u=n[l],c=a[l]||a[Hl(l)],d=this.parse(c.name,u);d&&r.push(d)}return r},Cr.getNonDefaultPropertiesHash=function(t,e,r){var n=r.slice(),a,i,o,l,u,c;for(u=0;u<e.length;u++)if(a=e[u],i=t.pstyle(a,!1),i!=null)if(i.pfValue!=null)n[0]=Ci(l,n[0]),n[1]=ki(l,n[1]);else for(o=i.strValue,c=0;c<o.length;c++)l=o.charCodeAt(c),n[0]=Ci(l,n[0]),n[1]=ki(l,n[1]);return n},Cr.getPropertiesHash=Cr.getNonDefaultPropertiesHash;var fs={};fs.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var n=t[r],a=n.selector,i=n.style||n.css,o=Object.keys(i);e.selector(a);for(var l=0;l<o.length;l++){var u=o[l],c=i[u];e.css(u,c)}}return e},fs.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e},fs.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],n=r.selector,a=r.properties,i={},o=0;o<a.length;o++){var l=a[o];i[l.name]=l.strValue}t.push({selector:n?n.toString():"core",style:i})}return t};var wc={};wc.appendFromString=function(t){var e=this,r=this,n=""+t,a,i,o;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function l(){n.length>a.length?n=n.substr(a.length):n=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var c=n.match(/^\s*$/);if(c)break;var d=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){Ae("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}a=d[0];var f=d[1];if(f!=="core"){var p=new un(f);if(p.invalid){Ae("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),l();continue}}var v=d[2],h=!1;i=v;for(var g=[];;){var y=i.match(/^\s*$/);if(y)break;var m=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){Ae("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+v),h=!0;break}o=m[0];var b=m[1],w=m[2],C=e.properties[b];if(!C){Ae("Skipping property: Invalid property name in: "+o),u();continue}var x=r.parse(b,w);if(!x){Ae("Skipping property: Invalid property definition in: "+o),u();continue}g.push({name:b,val:w}),u()}if(h){l();break}r.selector(f);for(var E=0;E<g.length;E++){var k=g[E];r.css(k.name,k.val)}l()}return r},wc.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var xt={};(function(){var t=lt,e=hT,r=vT,n=gT,a=mT,i=function(A){return"^"+A+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(A){var K=t+"|\\w+|"+e+"|"+r+"|"+n+"|"+a;return"^"+A+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+K+")\\s*\\,\\s*("+K+")\\)$"},l=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];xt.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:l,singleRegexMatchValue:!0},urls:{regexes:l,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(A,K){switch(A.length){case 2:return K[0]!=="deg"&&K[0]!=="rad"&&K[1]!=="deg"&&K[1]!=="rad";case 1:return be(A[0])||K[0]==="deg"||K[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(A){var K=A.length;return K===1||K===2||K===4}}};var u={zeroNonZero:function(A,K){return(A==null||K==null)&&A!==K||A==0&&K!=0?!0:A!=0&&K==0},any:function(A,K){return A!=K},emptyNonEmpty:function(A,K){var W=nn(A),oe=nn(K);return W&&!oe||!W&&oe}},c=xt.types,d=[{name:"label",type:c.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:c.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:c.bidirectionalSize,triggersBounds:u.any}],f=[{name:"source-label",type:c.text,triggersBounds:u.any},{name:"source-text-rotation",type:c.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:c.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:c.size,triggersBounds:u.any}],p=[{name:"target-label",type:c.text,triggersBounds:u.any},{name:"target-text-rotation",type:c.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:c.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:c.size,triggersBounds:u.any}],v=[{name:"font-family",type:c.fontFamily,triggersBounds:u.any},{name:"font-style",type:c.fontStyle,triggersBounds:u.any},{name:"font-weight",type:c.fontWeight,triggersBounds:u.any},{name:"font-size",type:c.size,triggersBounds:u.any},{name:"text-transform",type:c.textTransform,triggersBounds:u.any},{name:"text-wrap",type:c.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:c.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:c.size,triggersBounds:u.any},{name:"text-outline-width",type:c.size,triggersBounds:u.any},{name:"line-height",type:c.positiveNumber,triggersBounds:u.any}],h=[{name:"text-valign",type:c.valign,triggersBounds:u.any},{name:"text-halign",type:c.halign,triggersBounds:u.any},{name:"color",type:c.color},{name:"text-outline-color",type:c.color},{name:"text-outline-opacity",type:c.zeroOneNumber},{name:"text-background-color",type:c.color},{name:"text-background-opacity",type:c.zeroOneNumber},{name:"text-background-padding",type:c.size,triggersBounds:u.any},{name:"text-border-opacity",type:c.zeroOneNumber},{name:"text-border-color",type:c.color},{name:"text-border-width",type:c.size,triggersBounds:u.any},{name:"text-border-style",type:c.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:c.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:c.justification}],g=[{name:"events",type:c.bool,triggersZOrder:u.any},{name:"text-events",type:c.bool,triggersZOrder:u.any}],y=[{name:"display",type:c.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:c.visibility,triggersZOrder:u.any},{name:"opacity",type:c.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:c.zeroOneNumber},{name:"min-zoomed-font-size",type:c.size},{name:"z-compound-depth",type:c.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:c.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:c.number,triggersZOrder:u.any}],m=[{name:"overlay-padding",type:c.size,triggersBounds:u.any},{name:"overlay-color",type:c.color},{name:"overlay-opacity",type:c.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:c.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:c.cornerRadius}],b=[{name:"underlay-padding",type:c.size,triggersBounds:u.any},{name:"underlay-color",type:c.color},{name:"underlay-opacity",type:c.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:c.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:c.cornerRadius}],w=[{name:"transition-property",type:c.propList},{name:"transition-duration",type:c.time},{name:"transition-delay",type:c.time},{name:"transition-timing-function",type:c.easing}],C=function(A,K){return K.value==="label"?-A.poolIndex():K.pfValue},x=[{name:"height",type:c.nodeSize,triggersBounds:u.any,hashOverride:C},{name:"width",type:c.nodeSize,triggersBounds:u.any,hashOverride:C},{name:"shape",type:c.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:c.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:c.cornerRadius},{name:"background-color",type:c.color},{name:"background-fill",type:c.fill},{name:"background-opacity",type:c.zeroOneNumber},{name:"background-blacken",type:c.nOneOneNumber},{name:"background-gradient-stop-colors",type:c.colors},{name:"background-gradient-stop-positions",type:c.percentages},{name:"background-gradient-direction",type:c.gradientDirection},{name:"padding",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:c.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:c.boundsExpansion,triggersBounds:u.any}],E=[{name:"border-color",type:c.color},{name:"border-opacity",type:c.zeroOneNumber},{name:"border-width",type:c.size,triggersBounds:u.any},{name:"border-style",type:c.borderStyle},{name:"border-cap",type:c.lineCap},{name:"border-join",type:c.lineJoin},{name:"border-dash-pattern",type:c.numbers},{name:"border-dash-offset",type:c.number},{name:"border-position",type:c.linePosition}],k=[{name:"outline-color",type:c.color},{name:"outline-opacity",type:c.zeroOneNumber},{name:"outline-width",type:c.size,triggersBounds:u.any},{name:"outline-style",type:c.borderStyle},{name:"outline-offset",type:c.size,triggersBounds:u.any}],B=[{name:"background-image",type:c.urls},{name:"background-image-crossorigin",type:c.bgCrossOrigin},{name:"background-image-opacity",type:c.zeroOneNumbers},{name:"background-image-containment",type:c.bgContainment},{name:"background-image-smoothing",type:c.bools},{name:"background-position-x",type:c.bgPos},{name:"background-position-y",type:c.bgPos},{name:"background-width-relative-to",type:c.bgRelativeTo},{name:"background-height-relative-to",type:c.bgRelativeTo},{name:"background-repeat",type:c.bgRepeat},{name:"background-fit",type:c.bgFit},{name:"background-clip",type:c.bgClip},{name:"background-width",type:c.bgWH},{name:"background-height",type:c.bgWH},{name:"background-offset-x",type:c.bgPos},{name:"background-offset-y",type:c.bgPos}],S=[{name:"position",type:c.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:c.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:c.size,triggersBounds:u.any},{name:"min-width-bias-left",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:c.size,triggersBounds:u.any},{name:"min-height-bias-top",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:c.sizeMaybePercent,triggersBounds:u.any}],N=[{name:"line-style",type:c.lineStyle},{name:"line-color",type:c.color},{name:"line-fill",type:c.fill},{name:"line-cap",type:c.lineCap},{name:"line-opacity",type:c.zeroOneNumber},{name:"line-dash-pattern",type:c.numbers},{name:"line-dash-offset",type:c.number},{name:"line-outline-width",type:c.size},{name:"line-outline-color",type:c.color},{name:"line-gradient-stop-colors",type:c.colors},{name:"line-gradient-stop-positions",type:c.percentages},{name:"curve-style",type:c.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:c.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:c.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:c.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:c.size,triggersBounds:u.any},{name:"control-point-distances",type:c.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:c.numbers,triggersBounds:u.any},{name:"segment-distances",type:c.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:c.numbers,triggersBounds:u.any},{name:"segment-radii",type:c.numbers,triggersBounds:u.any},{name:"radius-type",type:c.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:c.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:c.size,triggersBounds:u.any},{name:"taxi-direction",type:c.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:c.number,triggersBounds:u.any},{name:"edge-distances",type:c.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:c.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:c.angle,triggersBounds:u.any},{name:"loop-sweep",type:c.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:c.size,triggersBounds:u.any},{name:"target-distance-from-node",type:c.size,triggersBounds:u.any}],D=[{name:"ghost",type:c.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:c.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:c.zeroOneNumber}],P=[{name:"selection-box-color",type:c.color},{name:"selection-box-opacity",type:c.zeroOneNumber},{name:"selection-box-border-color",type:c.color},{name:"selection-box-border-width",type:c.size},{name:"active-bg-color",type:c.color},{name:"active-bg-opacity",type:c.zeroOneNumber},{name:"active-bg-size",type:c.size},{name:"outside-texture-bg-color",type:c.color},{name:"outside-texture-bg-opacity",type:c.zeroOneNumber}],L=[];xt.pieBackgroundN=16,L.push({name:"pie-size",type:c.sizeMaybePercent});for(var O=1;O<=xt.pieBackgroundN;O++)L.push({name:"pie-"+O+"-background-color",type:c.color}),L.push({name:"pie-"+O+"-background-size",type:c.percent}),L.push({name:"pie-"+O+"-background-opacity",type:c.zeroOneNumber});var I=[],_=xt.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:c.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:c.color},{name:"arrow-fill",type:c.arrowFill},{name:"arrow-width",type:c.arrowWidth}].forEach(function(Y){_.forEach(function(A){var K=A+"-"+Y.name,W=Y.type,oe=Y.triggersBounds;I.push({name:K,type:W,triggersBounds:oe})})},{});var M=xt.properties=[].concat(g,w,y,m,b,D,h,v,d,f,p,x,E,k,B,L,S,N,I,P),F=xt.propertyGroups={behavior:g,transition:w,visibility:y,overlay:m,underlay:b,ghost:D,commonLabel:h,labelDimensions:v,mainLabel:d,sourceLabel:f,targetLabel:p,nodeBody:x,nodeBorder:E,nodeOutline:k,backgroundImage:B,pie:L,compound:S,edgeLine:N,edgeArrow:I,core:P},V=xt.propertyGroupNames={},H=xt.propertyGroupKeys=Object.keys(F);H.forEach(function(Y){V[Y]=F[Y].map(function(A){return A.name}),F[Y].forEach(function(A){return A.groupKey=Y})});var $=xt.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"}];xt.propertyNames=M.map(function(Y){return Y.name});for(var z=0;z<M.length;z++){var j=M[z];M[j.name]=j}for(var ee=0;ee<$.length;ee++){var J=$[ee],Z=M[J.pointsTo],re={name:J.name,alias:!0,pointsTo:Z};M.push(re),M[J.name]=re}})(),xt.getDefaultProperty=function(t){return this.getDefaultProperties()[t]},xt.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=xe({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,c){for(var d=1;d<=xt.pieBackgroundN;d++){var f=c.name.replace("{{i}}",d),p=c.value;u[f]=p}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,c){return xt.arrowPrefixes.forEach(function(d){var f=d+"-"+c.name,p=c.value;u[f]=p}),u},{})),r={},n=0;n<this.properties.length;n++){var a=this.properties[n];if(!a.pointsTo){var i=a.name,o=e[i],l=this.parse(i,o);r[i]=l}}return t.defaultProperties=r,t.defaultProperties},xt.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 hs={};hs.parse=function(t,e,r,n){var a=this;if(Ye(e))return a.parseImplWarn(t,e,r,n);var i=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,o=r?"t":"f",l=""+e,u=Mh(t,l,o,i),c=a.propCache=a.propCache||[],d;return(d=c[u])||(d=c[u]=a.parseImplWarn(t,e,r,n)),(r||n==="mapping")&&(d=br(d),d&&(d.value=br(d.value))),d},hs.parseImplWarn=function(t,e,r,n){var a=this.parseImpl(t,e,r,n);return!a&&e!=null&&Ae("The style property `".concat(t,": ").concat(e,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&e==="label"&&Ae("The style value of `label` is deprecated for `"+a.name+"`"),a},hs.parseImpl=function(t,e,r,n){var a=this;t=Hl(t);var i=a.properties[t],o=e,l=a.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var u=be(e);u&&(e=e.trim());var c=i.type;if(!c)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(Ye(e))return{name:t,value:e,strValue:"fn",mapped:l.fn,bypass:r};var d,f;if(!(!u||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(d=new RegExp(l.data.regex).exec(e))){if(r)return!1;var p=l.data;return{name:t,value:d,strValue:""+e,mapped:p,field:d[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(l.mapData.regex).exec(e))){if(r||c.multiple)return!1;var v=l.mapData;if(!(c.color||c.number))return!1;var h=this.parse(t,f[4]);if(!h||h.mapped)return!1;var g=this.parse(t,f[5]);if(!g||g.mapped)return!1;if(h.pfValue===g.pfValue||h.strValue===g.strValue)return Ae("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+h.strValue+"`"),this.parse(t,h.strValue);if(c.color){var y=h.value,m=g.value,b=y[0]===m[0]&&y[1]===m[1]&&y[2]===m[2]&&(y[3]===m[3]||(y[3]==null||y[3]===1)&&(m[3]==null||m[3]===1));if(b)return!1}return{name:t,value:f,strValue:""+e,mapped:v,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:h.value,valueMax:g.value,bypass:r}}}if(c.multiple&&n!=="multiple"){var w;if(u?w=e.split(/\s+/):He(e)?w=e:w=[e],c.evenMultiple&&w.length%2!==0)return null;for(var C=[],x=[],E=[],k="",B=!1,S=0;S<w.length;S++){var N=a.parse(t,w[S],r,"multiple");B=B||be(N.value),C.push(N.value),E.push(N.pfValue!=null?N.pfValue:N.value),x.push(N.units),k+=(S>0?" ":"")+N.strValue}return c.validate&&!c.validate(C,x)?null:c.singleEnum&&B?C.length===1&&be(C[0])?{name:t,value:C[0],strValue:C[0],bypass:r}:null:{name:t,value:C,pfValue:E,strValue:k,bypass:r,units:x}}var D=function(){for(var A=0;A<c.enums.length;A++){var K=c.enums[A];if(K===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(c.number){var P,L="px";if(c.units&&(P=c.units),c.implicitUnits&&(L=c.implicitUnits),!c.unitless)if(u){var O="px|em"+(c.allowPercent?"|\\%":"");P&&(O=P);var I=e.match("^("+lt+")("+O+")?$");I&&(e=I[1],P=I[2]||L)}else(!P||c.implicitUnits)&&(P=L);if(e=parseFloat(e),isNaN(e)&&c.enums===void 0)return null;if(isNaN(e)&&c.enums!==void 0)return e=o,D();if(c.integer&&!oT(e)||c.min!==void 0&&(e<c.min||c.strictMin&&e===c.min)||c.max!==void 0&&(e>c.max||c.strictMax&&e===c.max))return null;var _={name:t,value:e,strValue:""+e+(P||""),units:P,bypass:r};return c.unitless||P!=="px"&&P!=="em"?_.pfValue=e:_.pfValue=P==="px"||!P?e:this.getEmSizeInPixels()*e,(P==="ms"||P==="s")&&(_.pfValue=P==="ms"?e:1e3*e),(P==="deg"||P==="rad")&&(_.pfValue=P==="rad"?e:$B(e)),P==="%"&&(_.pfValue=e/100),_}else if(c.propList){var M=[],F=""+e;if(F!=="none"){for(var V=F.split(/\s*,\s*|\s+/),H=0;H<V.length;H++){var $=V[H].trim();a.properties[$]?M.push($):Ae("`"+$+"` is not a valid property name")}if(M.length===0)return null}return{name:t,value:M,strValue:M.length===0?"none":M.join(" "),bypass:r}}else if(c.color){var z=xT(e);return z?{name:t,value:z,pfValue:z,strValue:"rgb("+z[0]+","+z[1]+","+z[2]+")",bypass:r}:null}else if(c.regex||c.regexes){if(c.enums){var j=D();if(j)return j}for(var ee=c.regexes?c.regexes:[c.regex],J=0;J<ee.length;J++){var Z=new RegExp(ee[J]),re=Z.exec(e);if(re)return{name:t,value:c.singleRegexMatchValue?re[1]:re,strValue:""+e,bypass:r}}return null}else return c.string?{name:t,value:""+e,strValue:""+e,bypass:r}:c.enums?D():null};var Nt=function t(e){if(!(this instanceof t))return new t(e);if(!zl(e)){Xe("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Dt=Nt.prototype;Dt.instanceString=function(){return"style"},Dt.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this},Dt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Dt.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)},Dt.selector=function(t){var e=t==="core"?null:new un(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this},Dt.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],n=0;n<t.properties.length;n++){var a=t.properties[n],i=r[a.name];i===void 0&&(i=r[Po(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this},Dt.style=Dt.css,Dt.cssRule=function(t,e){var r=this.parse(t,e);if(r){var n=this.length-1;this[n].properties.push(r),this[n].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.mapped&&this[n].mappedProperties.push(r);var a=!this[n].selector;a&&(this._private.coreStyle[r.name]=r)}return this},Dt.append=function(t){return Ch(t)?t.appendToStyle(this):He(t)?this.appendFromJson(t):be(t)&&this.appendFromString(t),this},Nt.fromJson=function(t,e){var r=new Nt(t);return r.fromJson(e),r},Nt.fromString=function(t,e){return new Nt(t).fromString(e)},[Bt,Vi,bc,Cr,fs,wc,xt,hs].forEach(function(t){xe(Dt,t)}),Nt.types=Dt.types,Nt.properties=Dt.properties,Nt.propertyGroups=Dt.propertyGroups,Nt.propertyGroupNames=Dt.propertyGroupNames,Nt.propertyGroupKeys=Dt.propertyGroupKeys;var o3={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return Ch(e)?r.style=e.generateStyle(this):He(e)?r.style=Nt.fromJson(this,e):be(e)?r.style=Nt.fromString(this,e):r.style=Nt(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},s3="single",Hn={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=s3),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,n,a,i,o,l;switch(e.length){case 0:return r;case 1:if(be(e[0]))return n=e[0],r[n];if(_e(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,l=i.y,le(o)&&(r.x=o),le(l)&&(r.y=l),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],a=e[1],(n==="x"||n==="y")&&le(a)&&(r[n]=a),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var n=arguments,a=this._private.pan,i,o,l,u,c;if(!this._private.panningEnabled)return this;switch(n.length){case 1:_e(e)&&(l=n[0],u=l.x,c=l.y,le(u)&&(a.x+=u),le(c)&&(a.y+=c),this.emit("pan viewport"));break;case 2:i=e,o=r,(i==="x"||i==="y")&&le(o)&&(a[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},fit:function(e,r){var n=this.getFitViewport(e,r);if(n){var a=this._private;a.zoom=n.zoom,a.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(le(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(be(e)){var a=e;e=this.$(a)}else if(cT(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else Ut(e)||(e=this.mutableElements());if(!(Ut(e)&&e.empty())){n=n||e.boundingBox();var o=this.width(),l=this.height(),u;if(r=le(r)?r:0,!isNaN(o)&&!isNaN(l)&&o>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){u=Math.min((o-2*r)/n.w,(l-2*r)/n.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var c={x:(o-u*(n.x1+n.x2))/2,y:(l-u*(n.y1+n.y2))/2};return{zoom:u,pan:c}}}}},zoomRange:function(e,r){var n=this._private;if(r==null){var a=e;e=a.min,r=a.max}return le(e)&&le(r)&&e<=r?(n.minZoom=e,n.maxZoom=r):le(e)&&r===void 0&&e<=n.maxZoom?n.minZoom=e:le(r)&&e===void 0&&r>=n.minZoom&&(n.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,n=r.pan,a=r.zoom,i,o,l=!1;if(r.zoomingEnabled||(l=!0),le(e)?o=e:_e(e)&&(o=e.level,e.position!=null?i=Ao(e.position,a,n):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(l=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,l||!le(o)||o===a||i!=null&&(!le(i.x)||!le(i.y)))return null;if(i!=null){var u=n,c=a,d=o,f={x:-d/c*(i.x-u.x)+i.x,y:-d/c*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:d,pan:f}}else return{zoomed:!0,panned:!1,zoom:o,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),n=this._private;return r==null||!r.zoomed?this:(n.zoom=r.zoom,r.panned&&(n.pan.x=r.pan.x,n.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,n=!0,a=!0,i=[],o=!1,l=!1;if(!e)return this;if(le(e.zoom)||(n=!1),_e(e.pan)||(a=!1),!n&&!a)return this;if(n){var u=e.zoom;u<r.minZoom||u>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=u,i.push("zoom"))}if(a&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var c=e.pan;le(c.x)&&(r.pan.x=c.x,l=!1),le(c.y)&&(r.pan.y=c.y,l=!1),l||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(be(e)){var n=e;e=this.mutableElements().filter(n)}else Ut(e)||(e=this.mutableElements());if(e.length!==0){var a=e.boundingBox(),i=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var l={x:(i-r*(a.x1+a.x2))/2,y:(o-r*(a.y1+a.y2))/2};return l}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,n=this;return e.sizeCache=e.sizeCache||(r?function(){var a=n.window().getComputedStyle(r),i=function(l){return parseFloat(a.getPropertyValue(l))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,n=this.renderedExtent(),a={x1:(n.x1-e.x)/r,x2:(n.x2-e.x)/r,y1:(n.y1-e.y)/r,y2:(n.y2-e.y)/r};return a.w=a.x2-a.x1,a.h=a.y2-a.y1,a},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Hn.centre=Hn.center,Hn.autolockNodes=Hn.autolock,Hn.autoungrabifyNodes=Hn.autoungrabify;var Ri={data:Ve.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ve.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ve.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ve.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ri.attr=Ri.data,Ri.removeAttr=Ri.removeData;var $i=function(e){var r=this;e=xe({},e);var n=e.container;n&&!Do(n)&&Do(n[0])&&(n=n[0]);var a=n?n._cyreg:null;a=a||{},a&&a.cy&&(a.cy.destroy(),a={});var i=a.readies=a.readies||[];n&&(n._cyreg=a),a.cy=r;var o=st!==void 0&&n!==void 0&&!e.headless,l=e;l.layout=xe({name:o?"grid":"null"},l.layout),l.renderer=xe({name:o?"canvas":"null"},l.renderer);var u=function(h,g,y){return g!==void 0?g:y!==void 0?y:h},c=this._private={container:n,ready:!1,options:l,elements:new kt(this),listeners:[],aniEles:new kt(this),data:l.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,l.zoomingEnabled),userZoomingEnabled:u(!0,l.userZoomingEnabled),panningEnabled:u(!0,l.panningEnabled),userPanningEnabled:u(!0,l.userPanningEnabled),boxSelectionEnabled:u(!0,l.boxSelectionEnabled),autolock:u(!1,l.autolock,l.autolockNodes),autoungrabify:u(!1,l.autoungrabify,l.autoungrabifyNodes),autounselectify:u(!1,l.autounselectify),styleEnabled:l.styleEnabled===void 0?o:l.styleEnabled,zoom:le(l.zoom)?l.zoom:1,pan:{x:_e(l.pan)&&le(l.pan.x)?l.pan.x:0,y:_e(l.pan)&&le(l.pan.y)?l.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,l.multiClickDebounceTime)};this.createEmitter(),this.selectionType(l.selectionType),this.zoomRange({min:l.minZoom,max:l.maxZoom});var d=function(h,g){var y=h.some(uT);if(y)return xa.all(h).then(g);g(h)};c.styleEnabled&&r.setStyle([]);var f=xe({},l,l.renderer);r.initRenderer(f);var p=function(h,g,y){r.notifications(!1);var m=r.mutableElements();m.length>0&&m.remove(),h!=null&&(_e(h)||He(h))&&r.add(h),r.one("layoutready",function(w){r.notifications(!0),r.emit(w),r.one("load",g),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",y),r.emit("done")});var b=xe({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};d([l.style,l.elements],function(v){var h=v[0],g=v[1];c.styleEnabled&&r.style().append(h),p(g,function(){r.startAnimationLoop(),c.ready=!0,Ye(l.ready)&&r.on("ready",l.ready);for(var y=0;y<i.length;y++){var m=i[y];r.on("ready",m)}a&&(a.readies=[]),r.emit("ready")},l.done)})},ps=$i.prototype;xe(ps,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return st;var r=this._private.container.ownerDocument;return r===void 0||r==null?st:r.defaultView||st},mount:function(e){if(e!=null){var r=this,n=r._private,a=n.options;return!Do(e)&&Do(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),n.container=e,n.styleEnabled=!0,r.invalidateSize(),r.initRenderer(xe({},a,a.renderer,{name:a.renderer.name==="null"?"canvas":a.renderer.name})),r.startAnimationLoop(),r.style(a.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return br(this._private.options)},json:function(e){var r=this,n=r._private,a=r.mutableElements(),i=function(C){return r.getElementById(C.id())};if(_e(e)){if(r.startBatch(),e.elements){var o={},l=function(C,x){for(var E=[],k=[],B=0;B<C.length;B++){var S=C[B];if(!S.data.id){Ae("cy.json() cannot handle elements without an ID attribute");continue}var N=""+S.data.id,D=r.getElementById(N);o[N]=!0,D.length!==0?k.push({ele:D,json:S}):(x&&(S.group=x),E.push(S))}r.add(E);for(var P=0;P<k.length;P++){var L=k[P],O=L.ele,I=L.json;O.json(I)}};if(He(e.elements))l(e.elements);else for(var u=["nodes","edges"],c=0;c<u.length;c++){var d=u[c],f=e.elements[d];He(f)&&l(f,d)}var p=r.collection();a.filter(function(w){return!o[w.id()]}).forEach(function(w){w.isParent()?p.merge(w):w.remove()}),p.forEach(function(w){return w.children().move({parent:null})}),p.forEach(function(w){return i(w).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var v=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<v.length;h++){var g=v[h];e[g]!=null&&r[g](e[g])}return r.endBatch(),this}else{var y=!!e,m={};y?m.elements=this.elements().map(function(w){return w.json()}):(m.elements={},a.forEach(function(w){var C=w.group();m.elements[C]||(m.elements[C]=[]),m.elements[C].push(w.json())})),this._private.styleEnabled&&(m.style=r.style().json()),m.data=br(r.data());var b=n.options;return m.zoomingEnabled=n.zoomingEnabled,m.userZoomingEnabled=n.userZoomingEnabled,m.zoom=n.zoom,m.minZoom=n.minZoom,m.maxZoom=n.maxZoom,m.panningEnabled=n.panningEnabled,m.userPanningEnabled=n.userPanningEnabled,m.pan=br(n.pan),m.boxSelectionEnabled=n.boxSelectionEnabled,m.renderer=br(b.renderer),m.hideEdgesOnViewport=b.hideEdgesOnViewport,m.textureOnViewport=b.textureOnViewport,m.wheelSensitivity=b.wheelSensitivity,m.motionBlur=b.motionBlur,m.multiClickDebounceTime=b.multiClickDebounceTime,m}}}),ps.$id=ps.getElementById,[XD,t3,hv,mc,us,n3,yc,ds,o3,Hn,Ri].forEach(function(t){xe(ps,t)});var l3={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},c3={maximal:!1,acyclic:!1},Fa=function(e){return e.scratch("breadthfirst")},pv=function(e,r){return e.scratch("breadthfirst",r)};function vv(t){this.options=xe({},l3,c3,t)}vv.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,a=n.nodes().filter(function(ne){return!ne.isParent()}),i=n,o=e.directed,l=e.acyclic||e.maximal||e.maximalAdjustments>0,u=zt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),c;if(Ut(e.roots))c=e.roots;else if(He(e.roots)){for(var d=[],f=0;f<e.roots.length;f++){var p=e.roots[f],v=r.getElementById(p);d.push(v)}c=r.collection(d)}else if(be(e.roots))c=r.$(e.roots);else if(o)c=a.roots();else{var h=n.components();c=r.collection();for(var g=function(se){var ue=h[se],pe=ue.maxDegree(!1),de=ue.filter(function(me){return me.degree(!1)===pe});c=c.add(de)},y=0;y<h.length;y++)g(y)}var m=[],b={},w=function(se,ue){m[ue]==null&&(m[ue]=[]);var pe=m[ue].length;m[ue].push(se),pv(se,{index:pe,depth:ue})},C=function(se,ue){var pe=Fa(se),de=pe.depth,me=pe.index;m[de][me]=null,w(se,ue)};i.bfs({roots:c,directed:e.directed,visit:function(se,ue,pe,de,me){var Ne=se[0],De=Ne.id();w(Ne,me),b[De]=!0}});for(var x=[],E=0;E<a.length;E++){var k=a[E];b[k.id()]||x.push(k)}var B=function(se){for(var ue=m[se],pe=0;pe<ue.length;pe++){var de=ue[pe];if(de==null){ue.splice(pe,1),pe--;continue}pv(de,{depth:se,index:pe})}},S=function(){for(var se=0;se<m.length;se++)B(se)},N=function(se,ue){for(var pe=Fa(se),de=se.incomers().filter(function(T){return T.isNode()&&n.has(T)}),me=-1,Ne=se.id(),De=0;De<de.length;De++){var Ee=de[De],Pe=Fa(Ee);me=Math.max(me,Pe.depth)}if(pe.depth<=me){if(!e.acyclic&&ue[Ne])return null;var te=me+1;return C(se,te),ue[Ne]=te,!0}return!1};if(o&&l){var D=[],P={},L=function(se){return D.push(se)},O=function(){return D.shift()};for(a.forEach(function(ne){return D.push(ne)});D.length>0;){var I=O(),_=N(I,P);if(_)I.outgoers().filter(function(ne){return ne.isNode()&&n.has(ne)}).forEach(L);else if(_===null){Ae("Detected double maximal shift for node `"+I.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}S();var M=0;if(e.avoidOverlap)for(var F=0;F<a.length;F++){var V=a[F],H=V.layoutDimensions(e),$=H.w,z=H.h;M=Math.max(M,$,z)}var j={},ee=function(se){if(j[se.id()])return j[se.id()];for(var ue=Fa(se).depth,pe=se.neighborhood(),de=0,me=0,Ne=0;Ne<pe.length;Ne++){var De=pe[Ne];if(!(De.isEdge()||De.isParent()||!a.has(De))){var Ee=Fa(De);if(Ee!=null){var Pe=Ee.index,te=Ee.depth;if(!(Pe==null||te==null)){var T=m[te].length;te<ue&&(de+=Pe/T,me++)}}}}return me=Math.max(1,me),de=de/me,me===0&&(de=0),j[se.id()]=de,de},J=function(se,ue){var pe=ee(se),de=ee(ue),me=pe-de;return me===0?Eh(se.id(),ue.id()):me};e.depthSort!==void 0&&(J=e.depthSort);for(var Z=0;Z<m.length;Z++)m[Z].sort(J),B(Z);for(var re=[],Y=0;Y<x.length;Y++)re.push(x[Y]);m.unshift(re),S();for(var A=0,K=0;K<m.length;K++)A=Math.max(m[K].length,A);var W={x:u.x1+u.w/2,y:u.x1+u.h/2},oe=m.reduce(function(ne,se){return Math.max(ne,se.length)},0),he=function(se){var ue=Fa(se),pe=ue.depth,de=ue.index,me=m[pe].length,Ne=Math.max(u.w/((e.grid?oe:me)+1),M),De=Math.max(u.h/(m.length+1),M),Ee=Math.min(u.w/2/m.length,u.h/2/m.length);if(Ee=Math.max(Ee,M),e.circle){var te=Ee*pe+Ee-(m.length>0&&m[0].length<=3?Ee/2:0),T=2*Math.PI/m[pe].length*de;return pe===0&&m[0].length===1&&(te=1),{x:W.x+te*Math.cos(T),y:W.y+te*Math.sin(T)}}else{var Pe={x:W.x+(de+1-(me+1)/2)*Ne,y:(pe+1)*De};return Pe}};return n.nodes().layoutPositions(this,e,he),this};var u3={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function gv(t){this.options=xe({},u3,t)}gv.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,a=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=zt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l={x:o.x1+o.w/2,y:o.y1+o.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,c=u/Math.max(1,i.length-1),d,f=0,p=0;p<i.length;p++){var v=i[p],h=v.layoutDimensions(e),g=h.w,y=h.h;f=Math.max(f,g,y)}if(le(e.radius)?d=e.radius:i.length<=1?d=0:d=Math.min(o.h,o.w)/2-f,i.length>1&&e.avoidOverlap){f*=1.75;var m=Math.cos(c)-Math.cos(0),b=Math.sin(c)-Math.sin(0),w=Math.sqrt(f*f/(m*m+b*b));d=Math.max(w,d)}var C=function(E,k){var B=e.startAngle+k*c*(a?1:-1),S=d*Math.cos(B),N=d*Math.sin(B),D={x:l.x+S,y:l.y+N};return D};return n.nodes().layoutPositions(this,e,C),this};var d3={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function mv(t){this.options=xe({},d3,t)}mv.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,n=t.cy,a=e.eles,i=a.nodes().not(":parent"),o=zt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],c=0,d=0;d<i.length;d++){var f=i[d],p=void 0;p=e.concentric(f),u.push({value:p,node:f}),f._private.scratch.concentric=p}i.updateStyle();for(var v=0;v<i.length;v++){var h=i[v],g=h.layoutDimensions(e);c=Math.max(c,g.w,g.h)}u.sort(function(ne,se){return se.value-ne.value});for(var y=e.levelWidth(i),m=[[]],b=m[0],w=0;w<u.length;w++){var C=u[w];if(b.length>0){var x=Math.abs(b[0].value-C.value);x>=y&&(b=[],m.push(b))}b.push(C)}var E=c+e.minNodeSpacing;if(!e.avoidOverlap){var k=m.length>0&&m[0].length>1,B=Math.min(o.w,o.h)/2-E,S=B/(m.length+k?1:0);E=Math.min(E,S)}for(var N=0,D=0;D<m.length;D++){var P=m[D],L=e.sweep===void 0?2*Math.PI-2*Math.PI/P.length:e.sweep,O=P.dTheta=L/Math.max(1,P.length-1);if(P.length>1&&e.avoidOverlap){var I=Math.cos(O)-Math.cos(0),_=Math.sin(O)-Math.sin(0),M=Math.sqrt(E*E/(I*I+_*_));N=Math.max(M,N)}P.r=N,N+=E}if(e.equidistant){for(var F=0,V=0,H=0;H<m.length;H++){var $=m[H],z=$.r-V;F=Math.max(F,z)}V=0;for(var j=0;j<m.length;j++){var ee=m[j];j===0&&(V=ee.r),ee.r=V,V+=F}}for(var J={},Z=0;Z<m.length;Z++)for(var re=m[Z],Y=re.dTheta,A=re.r,K=0;K<re.length;K++){var W=re[K],oe=e.startAngle+(r?1:-1)*Y*K,he={x:l.x+A*Math.cos(oe),y:l.y+A*Math.sin(oe)};J[W.node.id()]=he}return a.nodes().layoutPositions(this,e,function(ne){var se=ne.id();return J[se]}),this};var Cc,f3={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function vs(t){this.options=xe({},f3,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(a){var i=a.source().data("id"),o=a.target().data("id"),l=e.some(function(c){return c.data("id")===i}),u=e.some(function(c){return c.data("id")===o});return!l||!u});this.options.eles=this.options.eles.not(n)}vs.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?Cc=!0:Cc=!1;var n=h3(e,r,t);Cc&&g3(n),t.randomize&&m3(n);var a=Vr(),i=function(){y3(n,e,t),t.fit===!0&&e.fit(t.padding)},o=function(p){return!(r.stopped||p>=t.numIter||(b3(n,t),n.temperature=n.temperature*t.coolingFactor,n.temperature<t.minTemp))},l=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var p=t.eles.nodes(),v=yv(n,t,p);p.layoutPositions(r,t,v)}},u=0,c=!0;if(t.animate===!0){var d=function f(){for(var p=0;c&&p<t.refresh;)c=o(u),u++,p++;if(!c)wv(n,t),l();else{var v=Vr();v-a>=t.animationThreshold&&i(),Lo(f)}};d()}else{for(;c;)c=o(u),u++;wv(n,t),l()}return this},vs.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},vs.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var h3=function(e,r,n){for(var a=n.eles.edges(),i=n.eles.nodes(),o=zt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),l={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=n.eles.components(),c={},d=0;d<u.length;d++)for(var f=u[d],p=0;p<f.length;p++){var v=f[p];c[v.id()]=d}for(var d=0;d<l.nodeSize;d++){var h=i[d],g=h.layoutDimensions(n),y={};y.isLocked=h.locked(),y.id=h.data("id"),y.parentId=h.data("parent"),y.cmptId=c[h.id()],y.children=[],y.positionX=h.position("x"),y.positionY=h.position("y"),y.offsetX=0,y.offsetY=0,y.height=g.w,y.width=g.h,y.maxX=y.positionX+y.width/2,y.minX=y.positionX-y.width/2,y.maxY=y.positionY+y.height/2,y.minY=y.positionY-y.height/2,y.padLeft=parseFloat(h.style("padding")),y.padRight=parseFloat(h.style("padding")),y.padTop=parseFloat(h.style("padding")),y.padBottom=parseFloat(h.style("padding")),y.nodeRepulsion=Ye(n.nodeRepulsion)?n.nodeRepulsion(h):n.nodeRepulsion,l.layoutNodes.push(y),l.idToIndex[y.id]=d}for(var m=[],b=0,w=-1,C=[],d=0;d<l.nodeSize;d++){var h=l.layoutNodes[d],x=h.parentId;x!=null?l.layoutNodes[l.idToIndex[x]].children.push(h.id):(m[++w]=h.id,C.push(h.id))}for(l.graphSet.push(C);b<=w;){var E=m[b++],k=l.idToIndex[E],v=l.layoutNodes[k],B=v.children;if(B.length>0){l.graphSet.push(B);for(var d=0;d<B.length;d++)m[++w]=B[d]}}for(var d=0;d<l.graphSet.length;d++)for(var S=l.graphSet[d],p=0;p<S.length;p++){var N=l.idToIndex[S[p]];l.indexToGraph[N]=d}for(var d=0;d<l.edgeSize;d++){var D=a[d],P={};P.id=D.data("id"),P.sourceId=D.data("source"),P.targetId=D.data("target");var L=Ye(n.idealEdgeLength)?n.idealEdgeLength(D):n.idealEdgeLength,O=Ye(n.edgeElasticity)?n.edgeElasticity(D):n.edgeElasticity,I=l.idToIndex[P.sourceId],_=l.idToIndex[P.targetId],M=l.indexToGraph[I],F=l.indexToGraph[_];if(M!=F){for(var V=p3(P.sourceId,P.targetId,l),H=l.graphSet[V],$=0,y=l.layoutNodes[I];H.indexOf(y.id)===-1;)y=l.layoutNodes[l.idToIndex[y.parentId]],$++;for(y=l.layoutNodes[_];H.indexOf(y.id)===-1;)y=l.layoutNodes[l.idToIndex[y.parentId]],$++;L*=$*n.nestingFactor}P.idealLength=L,P.elasticity=O,l.layoutEdges.push(P)}return l},p3=function(e,r,n){var a=v3(e,r,0,n);return 2>a.count?0:a.graph},v3=function t(e,r,n,a){var i=a.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:n};for(var o=0,l=0;l<i.length;l++){var u=i[l],c=a.idToIndex[u],d=a.layoutNodes[c].children;if(d.length!==0){var f=a.indexToGraph[a.idToIndex[d[0]]],p=t(e,r,f,a);if(p.count!==0)if(p.count===1){if(o++,o===2)break}else return p}}return{count:o,graph:n}},g3,m3=function(e,r){for(var n=e.clientWidth,a=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*n,o.positionY=Math.random()*a)}},yv=function(e,r,n){var a=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(n.forEach(function(o){var l=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,l.positionX),i.x2=Math.max(i.x2,l.positionX),i.y1=Math.min(i.y1,l.positionY),i.y2=Math.max(i.y2,l.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,l){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var c=(u.positionX-i.x1)/i.w,d=(u.positionY-i.y1)/i.h;return{x:a.x1+c*a.w,y:a.y1+d*a.h}}else return{x:u.positionX,y:u.positionY}}},y3=function(e,r,n){var a=n.layout,i=n.eles.nodes(),o=yv(e,n,i);i.positions(o),e.ready!==!0&&(e.ready=!0,a.one("layoutready",n.ready),a.emit({type:"layoutready",layout:this}))},b3=function(e,r,n){w3(e,r),x3(e),E3(e,r),S3(e),T3(e)},w3=function(e,r){for(var n=0;n<e.graphSet.length;n++)for(var a=e.graphSet[n],i=a.length,o=0;o<i;o++)for(var l=e.layoutNodes[e.idToIndex[a[o]]],u=o+1;u<i;u++){var c=e.layoutNodes[e.idToIndex[a[u]]];C3(l,c,e,r)}},bv=function(e){return-e+2*e*Math.random()},C3=function(e,r,n,a){var i=e.cmptId,o=r.cmptId;if(!(i!==o&&!n.isCompound)){var l=r.positionX-e.positionX,u=r.positionY-e.positionY,c=1;l===0&&u===0&&(l=bv(c),u=bv(c));var d=k3(e,r,l,u);if(d>0)var f=a.nodeOverlap*d,p=Math.sqrt(l*l+u*u),v=f*l/p,h=f*u/p;else var g=gs(e,l,u),y=gs(r,-1*l,-1*u),m=y.x-g.x,b=y.y-g.y,w=m*m+b*b,p=Math.sqrt(w),f=(e.nodeRepulsion+r.nodeRepulsion)/w,v=f*m/p,h=f*b/p;e.isLocked||(e.offsetX-=v,e.offsetY-=h),r.isLocked||(r.offsetX+=v,r.offsetY+=h)}},k3=function(e,r,n,a){if(n>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(a>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},gs=function(e,r,n){var a=e.positionX,i=e.positionY,o=e.height||1,l=e.width||1,u=n/r,c=o/l,d={};return r===0&&0<n||r===0&&0>n?(d.x=a,d.y=i+o/2,d):0<r&&-1*c<=u&&u<=c?(d.x=a+l/2,d.y=i+l*n/2/r,d):0>r&&-1*c<=u&&u<=c?(d.x=a-l/2,d.y=i-l*n/2/r,d):0<n&&(u<=-1*c||u>=c)?(d.x=a+o*r/2/n,d.y=i+o/2,d):(0>n&&(u<=-1*c||u>=c)&&(d.x=a-o*r/2/n,d.y=i-o/2),d)},x3=function(e,r){for(var n=0;n<e.edgeSize;n++){var a=e.layoutEdges[n],i=e.idToIndex[a.sourceId],o=e.layoutNodes[i],l=e.idToIndex[a.targetId],u=e.layoutNodes[l],c=u.positionX-o.positionX,d=u.positionY-o.positionY;if(!(c===0&&d===0)){var f=gs(o,c,d),p=gs(u,-1*c,-1*d),v=p.x-f.x,h=p.y-f.y,g=Math.sqrt(v*v+h*h),y=Math.pow(a.idealLength-g,2)/a.elasticity;if(g!==0)var m=y*v/g,b=y*h/g;else var m=0,b=0;o.isLocked||(o.offsetX+=m,o.offsetY+=b),u.isLocked||(u.offsetX-=m,u.offsetY-=b)}}},E3=function(e,r){if(r.gravity!==0)for(var n=1,a=0;a<e.graphSet.length;a++){var i=e.graphSet[a],o=i.length;if(a===0)var l=e.clientHeight/2,u=e.clientWidth/2;else var c=e.layoutNodes[e.idToIndex[i[0]]],d=e.layoutNodes[e.idToIndex[c.parentId]],l=d.positionX,u=d.positionY;for(var f=0;f<o;f++){var p=e.layoutNodes[e.idToIndex[i[f]]];if(!p.isLocked){var v=l-p.positionX,h=u-p.positionY,g=Math.sqrt(v*v+h*h);if(g>n){var y=r.gravity*v/g,m=r.gravity*h/g;p.offsetX+=y,p.offsetY+=m}}}}},S3=function(e,r){var n=[],a=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;a<=i;){var o=n[a++],l=e.idToIndex[o],u=e.layoutNodes[l],c=u.children;if(0<c.length&&!u.isLocked){for(var d=u.offsetX,f=u.offsetY,p=0;p<c.length;p++){var v=e.layoutNodes[e.idToIndex[c[p]]];v.offsetX+=d,v.offsetY+=f,n[++i]=c[p]}u.offsetX=0,u.offsetY=0}}},T3=function(e,r){for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];if(!(0<a.children.length||a.isLocked)){var i=B3(a.offsetX,a.offsetY,e.temperature);a.positionX+=i.x,a.positionY+=i.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,N3(a,e)}}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},B3=function(e,r,n){var a=Math.sqrt(e*e+r*r);if(a>n)var i={x:n*e/a,y:n*r/a};else var i={x:e,y:r};return i},N3=function t(e,r){var n=e.parentId;if(n!=null){var a=r.layoutNodes[r.idToIndex[n]],i=!1;if((a.maxX==null||e.maxX+a.padRight>a.maxX)&&(a.maxX=e.maxX+a.padRight,i=!0),(a.minX==null||e.minX-a.padLeft<a.minX)&&(a.minX=e.minX-a.padLeft,i=!0),(a.maxY==null||e.maxY+a.padBottom>a.maxY)&&(a.maxY=e.maxY+a.padBottom,i=!0),(a.minY==null||e.minY-a.padTop<a.minY)&&(a.minY=e.minY-a.padTop,i=!0),i)return t(a,r)}},wv=function(e,r){for(var n=e.layoutNodes,a=[],i=0;i<n.length;i++){var o=n[i],l=o.cmptId,u=a[l]=a[l]||[];u.push(o)}for(var c=0,i=0;i<a.length;i++){var d=a[i];if(d){d.x1=1/0,d.x2=-1/0,d.y1=1/0,d.y2=-1/0;for(var f=0;f<d.length;f++){var p=d[f];d.x1=Math.min(d.x1,p.positionX-p.width/2),d.x2=Math.max(d.x2,p.positionX+p.width/2),d.y1=Math.min(d.y1,p.positionY-p.height/2),d.y2=Math.max(d.y2,p.positionY+p.height/2)}d.w=d.x2-d.x1,d.h=d.y2-d.y1,c+=d.w*d.h}}a.sort(function(b,w){return w.w*w.h-b.w*b.h});for(var v=0,h=0,g=0,y=0,m=Math.sqrt(c)*e.clientWidth/e.clientHeight,i=0;i<a.length;i++){var d=a[i];if(d){for(var f=0;f<d.length;f++){var p=d[f];p.isLocked||(p.positionX+=v-d.x1,p.positionY+=h-d.y1)}v+=d.w+r.componentSpacing,g+=d.w+r.componentSpacing,y=Math.max(y,d.h),g>m&&(h+=y+r.componentSpacing,v=0,g=0,y=0)}}},D3={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Cv(t){this.options=xe({},D3,t)}Cv.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,a=n.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));var i=zt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)n.nodes().layoutPositions(this,e,function(j){return{x:i.x1,y:i.y1}});else{var o=a.size(),l=Math.sqrt(o*i.h/i.w),u=Math.round(l),c=Math.round(i.w/i.h*l),d=function(ee){if(ee==null)return Math.min(u,c);var J=Math.min(u,c);J==u?u=ee:c=ee},f=function(ee){if(ee==null)return Math.max(u,c);var J=Math.max(u,c);J==u?u=ee:c=ee},p=e.rows,v=e.cols!=null?e.cols:e.columns;if(p!=null&&v!=null)u=p,c=v;else if(p!=null&&v==null)u=p,c=Math.ceil(o/u);else if(p==null&&v!=null)c=v,u=Math.ceil(o/c);else if(c*u>o){var h=d(),g=f();(h-1)*g>=o?d(h-1):(g-1)*h>=o&&f(g-1)}else for(;c*u<o;){var y=d(),m=f();(m+1)*y>=o?f(m+1):d(y+1)}var b=i.w/c,w=i.h/u;if(e.condense&&(b=0,w=0),e.avoidOverlap)for(var C=0;C<a.length;C++){var x=a[C],E=x._private.position;(E.x==null||E.y==null)&&(E.x=0,E.y=0);var k=x.layoutDimensions(e),B=e.avoidOverlapPadding,S=k.w+B,N=k.h+B;b=Math.max(b,S),w=Math.max(w,N)}for(var D={},P=function(ee,J){return!!D["c-"+ee+"-"+J]},L=function(ee,J){D["c-"+ee+"-"+J]=!0},O=0,I=0,_=function(){I++,I>=c&&(I=0,O++)},M={},F=0;F<a.length;F++){var V=a[F],H=e.position(V);if(H&&(H.row!==void 0||H.col!==void 0)){var $={row:H.row,col:H.col};if($.col===void 0)for($.col=0;P($.row,$.col);)$.col++;else if($.row===void 0)for($.row=0;P($.row,$.col);)$.row++;M[V.id()]=$,L($.row,$.col)}}var z=function(ee,J){var Z,re;if(ee.locked()||ee.isParent())return!1;var Y=M[ee.id()];if(Y)Z=Y.col*b+b/2+i.x1,re=Y.row*w+w/2+i.y1;else{for(;P(O,I);)_();Z=I*b+b/2+i.x1,re=O*w+w/2+i.y1,L(O,I),_()}return{x:Z,y:re}};a.layoutPositions(this,e,z)}return this};var P3={ready:function(){},stop:function(){}};function kc(t){this.options=xe({},P3,t)}kc.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this},kc.prototype.stop=function(){return this};var O3={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function kv(t){this.options=xe({},O3,t)}kv.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),n=Ye(t.positions);function a(i){if(t.positions==null)return MB(i.position());if(n)return t.positions(i);var o=t.positions[i._private.data.id];return o??null}return r.layoutPositions(this,t,function(i,o){var l=a(i);return i.locked()||l==null?!1:l}),this};var _3={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function xv(t){this.options=xe({},_3,t)}xv.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=zt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),a=function(o,l){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}};return r.nodes().layoutPositions(this,t,a),this};var L3=[{name:"breadthfirst",impl:vv},{name:"circle",impl:gv},{name:"concentric",impl:mv},{name:"cose",impl:vs},{name:"grid",impl:Cv},{name:"null",impl:kc},{name:"preset",impl:kv},{name:"random",impl:xv}];function Ev(t){this.options=t,this.notifications=0}var Sv=function(){},Tv=function(){throw new Error("A headless instance can not render images")};Ev.prototype={recalculateRenderedStyle:Sv,notify:function(){this.notifications++},init:Sv,isHeadless:function(){return!0},png:Tv,jpg:Tv};var xc={};xc.arrowShapeWidth=.3,xc.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(c,d,f,p,v,h,g){var y=v.x-f/2-g,m=v.x+f/2+g,b=v.y-f/2-g,w=v.y+f/2+g,C=y<=c&&c<=m&&b<=d&&d<=w;return C},n=function(c,d,f,p,v){var h=c*Math.cos(p)-d*Math.sin(p),g=c*Math.sin(p)+d*Math.cos(p),y=h*f,m=g*f,b=y+v.x,w=m+v.y;return{x:b,y:w}},a=function(c,d,f,p){for(var v=[],h=0;h<c.length;h+=2){var g=c[h],y=c[h+1];v.push(n(g,y,d,f,p))}return v},i=function(c){for(var d=[],f=0;f<c.length;f++){var p=c[f];d.push(p.x,p.y)}return d},o=function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").pfValue*2},l=function(c,d){be(d)&&(d=t[d]),t[c]=xe({name:c,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(p,v,h,g,y,m){var b=i(a(this.points,h+2*m,g,y)),w=Ht(p,v,b);return w},roughCollide:r,draw:function(p,v,h,g){var y=a(this.points,v,h,g);e.arrowShapeImpl("polygon")(p,y)},spacing:function(p){return 0},gap:o},d)};l("none",{collide:Mo,roughCollide:Mo,draw:Gl,spacing:Vh,gap:Vh}),l("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),l("arrow","triangle"),l("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(c,d,f,p,v){var h=a(this.points,d,f,p),g=this.controlPoint,y=n(g[0],g[1],d,f,p);e.arrowShapeImpl(this.name)(c,h,y)},gap:function(c){return o(c)*.8}}),l("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(c,d,f,p,v,h,g){var y=i(a(this.points,f+2*g,p,v)),m=i(a(this.pointsTee,f+2*g,p,v)),b=Ht(c,d,y)||Ht(c,d,m);return b},draw:function(c,d,f,p,v){var h=a(this.points,d,f,p),g=a(this.pointsTee,d,f,p);e.arrowShapeImpl(this.name)(c,h,g)}}),l("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(c,d,f,p,v,h,g){var y=v,m=Math.pow(y.x-c,2)+Math.pow(y.y-d,2)<=Math.pow((f+2*g)*this.radius,2),b=i(a(this.points,f+2*g,p,v));return Ht(c,d,b)||m},draw:function(c,d,f,p,v){var h=a(this.pointsTr,d,f,p);e.arrowShapeImpl(this.name)(c,h,p.x,p.y,this.radius*d)},spacing:function(c){return e.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),l("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(c,d){var f=this.baseCrossLinePts.slice(),p=d/c,v=3,h=5;return f[v]=f[v]-p,f[h]=f[h]-p,f},collide:function(c,d,f,p,v,h,g){var y=i(a(this.points,f+2*g,p,v)),m=i(a(this.crossLinePts(f,h),f+2*g,p,v)),b=Ht(c,d,y)||Ht(c,d,m);return b},draw:function(c,d,f,p,v){var h=a(this.points,d,f,p),g=a(this.crossLinePts(d,v),d,f,p);e.arrowShapeImpl(this.name)(c,h,g)}}),l("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(c){return o(c)*.525}}),l("circle",{radius:.15,collide:function(c,d,f,p,v,h,g){var y=v,m=Math.pow(y.x-c,2)+Math.pow(y.y-d,2)<=Math.pow((f+2*g)*this.radius,2);return m},draw:function(c,d,f,p,v){e.arrowShapeImpl(this.name)(c,p.x,p.y,this.radius*d)},spacing:function(c){return e.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),l("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(c){return 1},gap:function(c){return 1}}),l("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),l("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}}),l("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(c){return .95*c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}})};var Kn={};Kn.projectIntoViewport=function(t,e){var r=this.cy,n=this.findContainerClientCoords(),a=n[0],i=n[1],o=n[4],l=r.pan(),u=r.zoom(),c=((t-a)/o-l.x)/u,d=((e-i)/o-l.y)/u;return[c,d]},Kn.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),n=function(m){return parseFloat(r.getPropertyValue(m))},a={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},i={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=t.clientWidth,l=t.clientHeight,u=a.left+a.right,c=a.top+a.bottom,d=i.left+i.right,f=e.width/(o+d),p=o-u,v=l-c,h=e.left+a.left+i.left,g=e.top+a.top+i.top;return this.containerBB=[h,g,p,v,f]},Kn.invalidateContainerClientCoordsCache=function(){this.containerBB=null},Kn.findNearestElement=function(t,e,r,n){return this.findNearestElements(t,e,r,n)[0]},Kn.findNearestElements=function(t,e,r,n){var a=this,i=this,o=i.getCachedZSortedEles(),l=[],u=i.cy.zoom(),c=i.cy.hasCompoundNodes(),d=(n?24:8)/u,f=(n?8:2)/u,p=(n?8:2)/u,v=1/0,h,g;r&&(o=o.interactive);function y(k,B){if(k.isNode()){if(g)return;g=k,l.push(k)}if(k.isEdge()&&(B==null||B<v))if(h){if(h.pstyle("z-compound-depth").value===k.pstyle("z-compound-depth").value&&h.pstyle("z-compound-depth").value===k.pstyle("z-compound-depth").value){for(var S=0;S<l.length;S++)if(l[S].isEdge()){l[S]=k,h=k,v=B??v;break}}}else l.push(k),h=k,v=B??v}function m(k){var B=k.outerWidth()+2*f,S=k.outerHeight()+2*f,N=B/2,D=S/2,P=k.position(),L=k.pstyle("corner-radius").value==="auto"?"auto":k.pstyle("corner-radius").pfValue,O=k._private.rscratch;if(P.x-N<=t&&t<=P.x+N&&P.y-D<=e&&e<=P.y+D){var I=i.nodeShapes[a.getNodeShape(k)];if(I.checkPoint(t,e,0,B,S,P.x,P.y,L,O))return y(k,0),!0}}function b(k){var B=k._private,S=B.rscratch,N=k.pstyle("width").pfValue,D=k.pstyle("arrow-scale").value,P=N/2+d,L=P*P,O=P*2,F=B.source,V=B.target,I;if(S.edgeType==="segments"||S.edgeType==="straight"||S.edgeType==="haystack"){for(var _=S.allpts,M=0;M+3<_.length;M+=2)if(jB(t,e,_[M],_[M+1],_[M+2],_[M+3],O)&&L>(I=JB(t,e,_[M],_[M+1],_[M+2],_[M+3])))return y(k,I),!0}else if(S.edgeType==="bezier"||S.edgeType==="multibezier"||S.edgeType==="self"||S.edgeType==="compound"){for(var _=S.allpts,M=0;M+5<S.allpts.length;M+=4)if(YB(t,e,_[M],_[M+1],_[M+2],_[M+3],_[M+4],_[M+5],O)&&L>(I=QB(t,e,_[M],_[M+1],_[M+2],_[M+3],_[M+4],_[M+5])))return y(k,I),!0}for(var F=F||B.source,V=V||B.target,H=a.getArrowWidth(N,D),$=[{name:"source",x:S.arrowStartX,y:S.arrowStartY,angle:S.srcArrowAngle},{name:"target",x:S.arrowEndX,y:S.arrowEndY,angle:S.tgtArrowAngle},{name:"mid-source",x:S.midX,y:S.midY,angle:S.midsrcArrowAngle},{name:"mid-target",x:S.midX,y:S.midY,angle:S.midtgtArrowAngle}],M=0;M<$.length;M++){var z=$[M],j=i.arrowShapes[k.pstyle(z.name+"-arrow-shape").value],ee=k.pstyle("width").pfValue;if(j.roughCollide(t,e,H,z.angle,{x:z.x,y:z.y},ee,d)&&j.collide(t,e,H,z.angle,{x:z.x,y:z.y},ee,d))return y(k),!0}c&&l.length>0&&(m(F),m(V))}function w(k,B,S){return lr(k,B,S)}function C(k,B){var S=k._private,N=p,D;B?D=B+"-":D="",k.boundingBox();var P=S.labelBounds[B||"main"],L=k.pstyle(D+"label").value,O=k.pstyle("text-events").strValue==="yes";if(!(!O||!L)){var I=w(S.rscratch,"labelX",B),_=w(S.rscratch,"labelY",B),M=w(S.rscratch,"labelAngle",B),F=k.pstyle(D+"text-margin-x").pfValue,V=k.pstyle(D+"text-margin-y").pfValue,H=P.x1-N-F,$=P.x2+N-F,z=P.y1-N-V,j=P.y2+N-V;if(M){var ee=Math.cos(M),J=Math.sin(M),Z=function(he,ne){return he=he-I,ne=ne-_,{x:he*ee-ne*J+I,y:he*J+ne*ee+_}},re=Z(H,z),Y=Z(H,j),A=Z($,z),K=Z($,j),W=[re.x+F,re.y+V,A.x+F,A.y+V,K.x+F,K.y+V,Y.x+F,Y.y+V];if(Ht(t,e,W))return y(k),!0}else if(ba(P,t,e))return y(k),!0}}for(var x=o.length-1;x>=0;x--){var E=o[x];E.isNode()?m(E)||C(E):b(E)||C(E)||C(E,"source")||C(E,"target")}return l},Kn.getAllInBox=function(t,e,r,n){var a=this.getCachedZSortedEles().interactive,i=[],o=Math.min(t,r),l=Math.max(t,r),u=Math.min(e,n),c=Math.max(e,n);t=o,r=l,e=u,n=c;for(var d=zt({x1:t,y1:e,x2:r,y2:n}),f=0;f<a.length;f++){var p=a[f];if(p.isNode()){var v=p,h=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});Xl(d,h)&&!Wh(h,d)&&i.push(v)}else{var g=p,y=g._private,m=y.rscratch;if(m.startX!=null&&m.startY!=null&&!ba(d,m.startX,m.startY)||m.endX!=null&&m.endY!=null&&!ba(d,m.endX,m.endY))continue;if(m.edgeType==="bezier"||m.edgeType==="multibezier"||m.edgeType==="self"||m.edgeType==="compound"||m.edgeType==="segments"||m.edgeType==="haystack"){for(var b=y.rstyle.bezierPts||y.rstyle.linePts||y.rstyle.haystackPts,w=!0,C=0;C<b.length;C++)if(!WB(d,b[C])){w=!1;break}w&&i.push(g)}else(m.edgeType==="haystack"||m.edgeType==="straight")&&i.push(g)}}return i};var ms={};ms.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",n=e.edgeType==="bezier",a=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",l=e.edgeType==="self",u,c,d,f,p,v,m,b;if(r?(d=e.haystackPts[0],f=e.haystackPts[1],p=e.haystackPts[2],v=e.haystackPts[3]):(d=e.arrowStartX,f=e.arrowStartY,p=e.arrowEndX,v=e.arrowEndY),m=e.midX,b=e.midY,i)u=d-e.segpts[0],c=f-e.segpts[1];else if(a||o||l||n){var h=e.allpts,g=ft(h[0],h[2],h[4],.1),y=ft(h[1],h[3],h[5],.1);u=d-g,c=f-y}else u=d-m,c=f-b;e.srcArrowAngle=Vo(u,c);var m=e.midX,b=e.midY;if(r&&(m=(d+p)/2,b=(f+v)/2),u=p-d,c=v-f,i){var h=e.allpts;if(h.length/2%2===0){var w=h.length/2,C=w-2;u=h[w]-h[C],c=h[w+1]-h[C+1]}else if(e.isRound)u=e.midVector[1],c=-e.midVector[0];else{var w=h.length/2-1,C=w-2;u=h[w]-h[C],c=h[w+1]-h[C+1]}}else if(a||o||l){var h=e.allpts,x=e.ctrlpts,E,k,B,S;if(x.length/2%2===0){var N=h.length/2-1,D=N+2,P=D+2;E=ft(h[N],h[D],h[P],0),k=ft(h[N+1],h[D+1],h[P+1],0),B=ft(h[N],h[D],h[P],1e-4),S=ft(h[N+1],h[D+1],h[P+1],1e-4)}else{var D=h.length/2-1,N=D-2,P=D+2;E=ft(h[N],h[D],h[P],.4999),k=ft(h[N+1],h[D+1],h[P+1],.4999),B=ft(h[N],h[D],h[P],.5),S=ft(h[N+1],h[D+1],h[P+1],.5)}u=B-E,c=S-k}if(e.midtgtArrowAngle=Vo(u,c),e.midDispX=u,e.midDispY=c,u*=-1,c*=-1,i){var h=e.allpts;if(h.length/2%2!==0){if(!e.isRound){var w=h.length/2-1,L=w+2;u=-(h[L]-h[w]),c=-(h[L+1]-h[w+1])}}}if(e.midsrcArrowAngle=Vo(u,c),i)u=p-e.segpts[e.segpts.length-2],c=v-e.segpts[e.segpts.length-1];else if(a||o||l||n){var h=e.allpts,O=h.length,g=ft(h[O-6],h[O-4],h[O-2],.9),y=ft(h[O-5],h[O-3],h[O-1],.9);u=p-g,c=v-y}else u=p-m,c=v-b;e.tgtArrowAngle=Vo(u,c)},ms.getArrowWidth=ms.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},n=r[t+", "+e];return n||(n=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=n,n)};var Ec,Sc,kr={},er={},Bv,Nv,qn,ys,zr,Un,Gn,xr,Ma,bs,Dv,Pv,Tc,Bc,Ov,_v=function(e,r,n){n.x=r.x-e.x,n.y=r.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},F3=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},M3=function(e,r,n,a,i){if(e!==Ov?_v(r,e,kr):F3(er,kr),_v(r,n,er),Bv=kr.nx*er.ny-kr.ny*er.nx,Nv=kr.nx*er.nx-kr.ny*-er.ny,zr=Math.asin(Math.max(-1,Math.min(1,Bv))),Math.abs(zr)<1e-6){Ec=r.x,Sc=r.y,Gn=Ma=0;return}qn=1,ys=!1,Nv<0?zr<0?zr=Math.PI+zr:(zr=Math.PI-zr,qn=-1,ys=!0):zr>0&&(qn=-1,ys=!0),r.radius!==void 0?Ma=r.radius:Ma=a,Un=zr/2,bs=Math.min(kr.len/2,er.len/2),i?(xr=Math.abs(Math.cos(Un)*Ma/Math.sin(Un)),xr>bs?(xr=bs,Gn=Math.abs(xr*Math.sin(Un)/Math.cos(Un))):Gn=Ma):(xr=Math.min(bs,Ma),Gn=Math.abs(xr*Math.sin(Un)/Math.cos(Un))),Tc=r.x+er.nx*xr,Bc=r.y+er.ny*xr,Ec=Tc-er.ny*Gn*qn,Sc=Bc+er.nx*Gn*qn,Dv=r.x+kr.nx*xr,Pv=r.y+kr.ny*xr,Ov=r};function Lv(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Nc(t,e,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===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}:(M3(t,e,r,n,a),{cx:Ec,cy:Sc,radius:Gn,startX:Dv,startY:Pv,stopX:Tc,stopY:Bc,startAngle:kr.ang+Math.PI/2*qn,endAngle:er.ang-Math.PI/2*qn,counterClockwise:ys})}var Pt={};Pt.findMidptPtsEtc=function(t,e){var r=e.posPts,n=e.intersectionPts,a=e.vectorNormInverse,i,o=t.pstyle("source-endpoint"),l=t.pstyle("target-endpoint"),u=o.units!=null&&l.units!=null,c=function(x,E,k,B){var S=B-E,N=k-x,D=Math.sqrt(N*N+S*S);return{x:-S/D,y:N/D}},d=t.pstyle("edge-distances").value;switch(d){case"node-position":i=r;break;case"intersection":i=n;break;case"endpoints":{if(u){var f=this.manualEndptToPx(t.source()[0],o),p=sr(f,2),v=p[0],h=p[1],g=this.manualEndptToPx(t.target()[0],l),y=sr(g,2),m=y[0],b=y[1],w={x1:v,y1:h,x2:m,y2:b};a=c(v,h,m,b),i=w}else Ae("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=n;break}}return{midptPts:i,vectorNormInverse:a}},Pt.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],n=r._private,a=n.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var o=n.source,l=n.target,u=o.position(),c=l.position(),d=o.width(),f=l.width(),p=o.height(),v=l.height(),h=r.pstyle("haystack-radius").value,g=h/2;a.haystackPts=a.allpts=[a.source.x*d*g+u.x,a.source.y*p*g+u.y,a.target.x*f*g+c.x,a.target.y*v*g+c.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}},Pt.findSegmentsPoints=function(t,e){var r=t._private.rscratch,n=t.pstyle("segment-weights"),a=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),l=Math.min(n.pfValue.length,a.pfValue.length),u=i.pfValue[i.pfValue.length-1],c=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var d=0;d<l;d++){var f=n.pfValue[d],p=a.pfValue[d],v=1-f,h=f,g=this.findMidptPtsEtc(t,e),y=g.midptPts,m=g.vectorNormInverse,b={x:y.x1*v+y.x2*h,y:y.y1*v+y.y2*h};r.segpts.push(b.x+m.x*p,b.y+m.y*p),r.radii.push(i.pfValue[d]!==void 0?i.pfValue[d]:u),r.isArcRadius.push((o.pfValue[d]!==void 0?o.pfValue[d]:c)==="arc-radius")}},Pt.findLoopPoints=function(t,e,r,n){var a=t._private.rscratch,i=e.dirCounts,o=e.srcPos,l=t.pstyle("control-point-distances"),u=l?l.pfValue[0]:void 0,c=t.pstyle("loop-direction").pfValue,d=t.pstyle("loop-sweep").pfValue,f=t.pstyle("control-point-step-size").pfValue;a.edgeType="self";var p=r,v=f;n&&(p=0,v=u);var h=c-Math.PI/2,g=h-d/2,y=h+d/2,m=c+"_"+d;p=i[m]===void 0?i[m]=0:++i[m],a.ctrlpts=[o.x+Math.cos(g)*1.4*v*(p/3+1),o.y+Math.sin(g)*1.4*v*(p/3+1),o.x+Math.cos(y)*1.4*v*(p/3+1),o.y+Math.sin(y)*1.4*v*(p/3+1)]},Pt.findCompoundLoopPoints=function(t,e,r,n){var a=t._private.rscratch;a.edgeType="compound";var i=e.srcPos,o=e.tgtPos,l=e.srcW,u=e.srcH,c=e.tgtW,d=e.tgtH,f=t.pstyle("control-point-step-size").pfValue,p=t.pstyle("control-point-distances"),v=p?p.pfValue[0]:void 0,h=r,g=f;n&&(h=0,g=v);var y=50,m={x:i.x-l/2,y:i.y-u/2},b={x:o.x-c/2,y:o.y-d/2},w={x:Math.min(m.x,b.x),y:Math.min(m.y,b.y)},C=.5,x=Math.max(C,Math.log(l*.01)),E=Math.max(C,Math.log(c*.01));a.ctrlpts=[w.x,w.y-(1+Math.pow(y,1.12)/100)*g*(h/3+1)*x,w.x-(1+Math.pow(y,1.12)/100)*g*(h/3+1)*E,w.y]},Pt.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"},Pt.findBezierPoints=function(t,e,r,n,a){var i=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,l=t.pstyle("control-point-distances"),u=t.pstyle("control-point-weights"),c=l&&u?Math.min(l.value.length,u.value.length):1,d=l?l.pfValue[0]:void 0,f=u.value[0],p=n;i.edgeType=p?"multibezier":"bezier",i.ctrlpts=[];for(var v=0;v<c;v++){var h=(.5-e.eles.length/2+r)*o*(a?-1:1),g=void 0,y=qh(h);p&&(d=l?l.pfValue[v]:o,f=u.value[v]),n?g=d:g=d!==void 0?y*d:void 0;var m=g!==void 0?g:h,b=1-f,w=f,C=this.findMidptPtsEtc(t,e),x=C.midptPts,E=C.vectorNormInverse,k={x:x.x1*b+x.x2*w,y:x.y1*b+x.y2*w};i.ctrlpts.push(k.x+E.x*m,k.y+E.y*m)}},Pt.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var n="vertical",a="horizontal",i="leftward",o="rightward",l="downward",u="upward",c="auto",d=e.posPts,f=e.srcW,p=e.srcH,v=e.tgtW,h=e.tgtH,g=t.pstyle("edge-distances").value,y=g!=="node-position",m=t.pstyle("taxi-direction").value,b=m,w=t.pstyle("taxi-turn"),C=w.units==="%",x=w.pfValue,E=x<0,k=t.pstyle("taxi-turn-min-distance").pfValue,B=y?(f+v)/2:0,S=y?(p+h)/2:0,N=d.x2-d.x1,D=d.y2-d.y1,P=function(we,Ce){return we>0?Math.max(we-Ce,0):Math.min(we+Ce,0)},L=P(N,B),O=P(D,S),I=!1;b===c?m=Math.abs(L)>Math.abs(O)?a:n:b===u||b===l?(m=n,I=!0):(b===i||b===o)&&(m=a,I=!0);var _=m===n,M=_?O:L,F=_?D:N,V=qh(F),H=!1;!(I&&(C||E))&&(b===l&&F<0||b===u&&F>0||b===i&&F>0||b===o&&F<0)&&(V*=-1,M=V*Math.abs(M),H=!0);var $;if(C){var z=x<0?1+x:x;$=z*M}else{var j=x<0?M:0;$=j+x*V}var ee=function(we){return Math.abs(we)<k||Math.abs(we)>=Math.abs(M)},J=ee($),Z=ee(Math.abs(M)-Math.abs($)),re=J||Z;if(re&&!H)if(_){var Y=Math.abs(F)<=p/2,A=Math.abs(N)<=v/2;if(Y){var K=(d.x1+d.x2)/2,W=d.y1,oe=d.y2;r.segpts=[K,W,K,oe]}else if(A){var he=(d.y1+d.y2)/2,ne=d.x1,se=d.x2;r.segpts=[ne,he,se,he]}else r.segpts=[d.x1,d.y2]}else{var ue=Math.abs(F)<=f/2,pe=Math.abs(D)<=h/2;if(ue){var de=(d.y1+d.y2)/2,me=d.x1,Ne=d.x2;r.segpts=[me,de,Ne,de]}else if(pe){var De=(d.x1+d.x2)/2,Ee=d.y1,Pe=d.y2;r.segpts=[De,Ee,De,Pe]}else r.segpts=[d.x2,d.y1]}else if(_){var te=d.y1+$+(y?p/2*V:0),T=d.x1,R=d.x2;r.segpts=[T,te,R,te]}else{var Q=d.x1+$+(y?f/2*V:0),G=d.y1,U=d.y2;r.segpts=[Q,G,Q,U]}if(r.isRound){var ie=t.pstyle("taxi-radius").value,X=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ie),r.isArcRadius=new Array(r.segpts.length/2).fill(X)}},Pt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var n=e.srcPos,a=e.tgtPos,i=e.srcW,o=e.srcH,l=e.tgtW,u=e.tgtH,c=e.srcShape,d=e.tgtShape,f=e.srcCornerRadius,p=e.tgtCornerRadius,v=e.srcRs,h=e.tgtRs,g=!le(r.startX)||!le(r.startY),y=!le(r.arrowStartX)||!le(r.arrowStartY),m=!le(r.endX)||!le(r.endY),b=!le(r.arrowEndX)||!le(r.arrowEndY),w=3,C=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,x=w*C,E=In({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),k=E<x,B=In({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),S=B<x,N=!1;if(g||y||k){N=!0;var D={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},P=Math.sqrt(D.x*D.x+D.y*D.y),L={x:D.x/P,y:D.y/P},O=Math.max(i,o),I={x:r.ctrlpts[0]+L.x*2*O,y:r.ctrlpts[1]+L.y*2*O},_=c.intersectLine(n.x,n.y,i,o,I.x,I.y,0,f,v);k?(r.ctrlpts[0]=r.ctrlpts[0]+L.x*(x-E),r.ctrlpts[1]=r.ctrlpts[1]+L.y*(x-E)):(r.ctrlpts[0]=_[0]+L.x*x,r.ctrlpts[1]=_[1]+L.y*x)}if(m||b||S){N=!0;var M={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},F=Math.sqrt(M.x*M.x+M.y*M.y),V={x:M.x/F,y:M.y/F},H=Math.max(i,o),$={x:r.ctrlpts[0]+V.x*2*H,y:r.ctrlpts[1]+V.y*2*H},z=d.intersectLine(a.x,a.y,l,u,$.x,$.y,0,p,h);S?(r.ctrlpts[0]=r.ctrlpts[0]+V.x*(x-B),r.ctrlpts[1]=r.ctrlpts[1]+V.y*(x-B)):(r.ctrlpts[0]=z[0]+V.x*x,r.ctrlpts[1]=z[1]+V.y*x)}N&&this.findEndpoints(t)}},Pt.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var n,a;e.ctrlpts.length/2%2===0?(n=e.allpts.length/2-1,e.midX=e.allpts[n],e.midY=e.allpts[n+1]):(n=e.allpts.length/2-3,a=.5,e.midX=ft(e.allpts[n],e.allpts[n+2],e.allpts[n+4],a),e.midY=ft(e.allpts[n+1],e.allpts[n+3],e.allpts[n+5],a))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],l=e.isArcRadius[i/2-1];e.roundCorners.push(Nc({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,l))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,c=u-2;e.midX=(e.segpts[c]+e.segpts[u])/2,e.midY=(e.segpts[c+1]+e.segpts[u+1])/2}else{var d=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[d],e.midY=e.segpts[d+1];else{var f={x:e.segpts[d],y:e.segpts[d+1]},p=e.roundCorners[d/2],v=[f.x-p.cx,f.y-p.cy],h=p.radius/Math.sqrt(Math.pow(v[0],2)+Math.pow(v[1],2));v=v.map(function(g){return g*h}),e.midX=p.cx+v[0],e.midY=p.cy+v[1],e.midVector=v}}}},Pt.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||le(e.startX)&&le(e.startY)&&le(e.endX)&&le(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Ae("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},Pt.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,n=r.cy,a=n.hasCompoundNodes(),i={map:new wr,get:function(k){var B=this.map.get(k[0]);return B!=null?B.get(k[1]):null},set:function(k,B){var S=this.map.get(k[0]);S==null&&(S=new wr,this.map.set(k[0],S)),S.set(k[1],B)}},o=[],l=[],u=0;u<t.length;u++){var c=t[u],d=c._private,f=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(f==="haystack"){l.push(c);continue}var p=f==="unbundled-bezier"||f.endsWith("segments")||f==="straight"||f==="straight-triangle"||f.endsWith("taxi"),v=f==="unbundled-bezier"||f==="bezier",h=d.source,g=d.target,y=h.poolIndex(),m=g.poolIndex(),b=[y,m].sort(),w=i.get(b);w==null&&(w={eles:[]},i.set(b,w),o.push(b)),w.eles.push(c),p&&(w.hasUnbundled=!0),v&&(w.hasBezier=!0)}}for(var C=function(k){var B=o[k],S=i.get(B),N=void 0;if(!S.hasUnbundled){var D=S.eles[0].parallelEdges().filter(function(Q){return Q.isBundledBezier()});Wl(S.eles),D.forEach(function(Q){return S.eles.push(Q)}),S.eles.sort(function(Q,G){return Q.poolIndex()-G.poolIndex()})}var P=S.eles[0],L=P.source(),O=P.target();if(L.poolIndex()>O.poolIndex()){var I=L;L=O,O=I}var _=S.srcPos=L.position(),M=S.tgtPos=O.position(),F=S.srcW=L.outerWidth(),V=S.srcH=L.outerHeight(),H=S.tgtW=O.outerWidth(),$=S.tgtH=O.outerHeight(),z=S.srcShape=r.nodeShapes[e.getNodeShape(L)],j=S.tgtShape=r.nodeShapes[e.getNodeShape(O)],ee=S.srcCornerRadius=L.pstyle("corner-radius").value==="auto"?"auto":L.pstyle("corner-radius").pfValue,J=S.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,Z=S.tgtRs=O._private.rscratch,re=S.srcRs=L._private.rscratch;S.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var Y=0;Y<S.eles.length;Y++){var A=S.eles[Y],K=A[0]._private.rscratch,W=A.pstyle("curve-style").value,oe=W==="unbundled-bezier"||W.endsWith("segments")||W.endsWith("taxi"),he=!L.same(A.source());if(!S.calculatedIntersection&&L!==O&&(S.hasBezier||S.hasUnbundled)){S.calculatedIntersection=!0;var ne=z.intersectLine(_.x,_.y,F,V,M.x,M.y,0,ee,re),se=S.srcIntn=ne,ue=j.intersectLine(M.x,M.y,H,$,_.x,_.y,0,J,Z),pe=S.tgtIntn=ue,de=S.intersectionPts={x1:ne[0],x2:ue[0],y1:ne[1],y2:ue[1]},me=S.posPts={x1:_.x,x2:M.x,y1:_.y,y2:M.y},Ne=ue[1]-ne[1],De=ue[0]-ne[0],Ee=Math.sqrt(De*De+Ne*Ne),Pe=S.vector={x:De,y:Ne},te=S.vectorNorm={x:Pe.x/Ee,y:Pe.y/Ee},T={x:-te.y,y:te.x};S.nodesOverlap=!le(Ee)||j.checkPoint(ne[0],ne[1],0,H,$,M.x,M.y,J,Z)||z.checkPoint(ue[0],ue[1],0,F,V,_.x,_.y,ee,re),S.vectorNormInverse=T,N={nodesOverlap:S.nodesOverlap,dirCounts:S.dirCounts,calculatedIntersection:!0,hasBezier:S.hasBezier,hasUnbundled:S.hasUnbundled,eles:S.eles,srcPos:M,tgtPos:_,srcW:H,srcH:$,tgtW:F,tgtH:V,srcIntn:pe,tgtIntn:se,srcShape:j,tgtShape:z,posPts:{x1:me.x2,y1:me.y2,x2:me.x1,y2:me.y1},intersectionPts:{x1:de.x2,y1:de.y2,x2:de.x1,y2:de.y1},vector:{x:-Pe.x,y:-Pe.y},vectorNorm:{x:-te.x,y:-te.y},vectorNormInverse:{x:-T.x,y:-T.y}}}var R=he?N:S;K.nodesOverlap=R.nodesOverlap,K.srcIntn=R.srcIntn,K.tgtIntn=R.tgtIntn,K.isRound=W.startsWith("round"),a&&(L.isParent()||L.isChild()||O.isParent()||O.isChild())&&(L.parents().anySame(O)||O.parents().anySame(L)||L.same(O)&&L.isParent())?e.findCompoundLoopPoints(A,R,Y,oe):L===O?e.findLoopPoints(A,R,Y,oe):W.endsWith("segments")?e.findSegmentsPoints(A,R):W.endsWith("taxi")?e.findTaxiPoints(A,R):W==="straight"||!oe&&S.eles.length%2===1&&Y===Math.floor(S.eles.length/2)?e.findStraightEdgePoints(A):e.findBezierPoints(A,R,Y,oe,he),e.findEndpoints(A),e.tryToCorrectInvalidPoints(A,R),e.checkForInvalidEdgeWarning(A),e.storeAllpts(A),e.storeEdgeProjections(A),e.calculateArrowAngles(A),e.recalculateEdgeLabelProjections(A),e.calculateLabelAngles(A)}},x=0;x<o.length;x++)C(x);this.findHaystackPoints(l)}};function Fv(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var n=t[r],a=t[r+1];e.push({x:n,y:a})}return e}}Pt.getSegmentPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="segments")return this.recalculateRenderedStyle(t),Fv(e.segpts)},Pt.getControlPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return this.recalculateRenderedStyle(t),Fv(e.ctrlpts)},Pt.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var zi={};zi.manualEndptToPx=function(t,e){var r=this,n=t.position(),a=t.outerWidth(),i=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var l=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(l[0]=l[0]*a),e.units[1]==="%"&&(l[1]=l[1]*i),l[0]+=n.x,l[1]+=n.y,l}else{var u=e.pfValue[0];u=-Math.PI/2+u;var c=2*Math.max(a,i),d=[n.x+Math.cos(u)*c,n.y+Math.sin(u)*c];return r.nodeShapes[this.getNodeShape(t)].intersectLine(n.x,n.y,a,i,d[0],d[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}},zi.findEndpoints=function(t){var e=this,r,n=t.source()[0],a=t.target()[0],i=n.position(),o=a.position(),l=t.pstyle("target-arrow-shape").value,u=t.pstyle("source-arrow-shape").value,c=t.pstyle("target-distance-from-node").pfValue,d=t.pstyle("source-distance-from-node").pfValue,f=n._private.rscratch,p=a._private.rscratch,v=t.pstyle("curve-style").value,h=t._private.rscratch,g=h.edgeType,y=v==="taxi",m=g==="self"||g==="compound",b=g==="bezier"||g==="multibezier"||m,w=g!=="bezier",C=g==="straight"||g==="segments",x=g==="segments",E=b||w||C,k=m||y,B=t.pstyle("source-endpoint"),S=k?"outside-to-node":B.value,N=n.pstyle("corner-radius").value==="auto"?"auto":n.pstyle("corner-radius").pfValue,D=t.pstyle("target-endpoint"),P=k?"outside-to-node":D.value,L=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue;h.srcManEndpt=B,h.tgtManEndpt=D;var O,I,_,M;if(b){var F=[h.ctrlpts[0],h.ctrlpts[1]],V=w?[h.ctrlpts[h.ctrlpts.length-2],h.ctrlpts[h.ctrlpts.length-1]]:F;O=V,I=F}else if(C){var H=x?h.segpts.slice(0,2):[o.x,o.y],$=x?h.segpts.slice(h.segpts.length-2):[i.x,i.y];O=$,I=H}if(P==="inside-to-node")r=[o.x,o.y];else if(D.units)r=this.manualEndptToPx(a,D);else if(P==="outside-to-line")r=h.tgtIntn;else if(P==="outside-to-node"||P==="outside-to-node-or-label"?_=O:(P==="outside-to-line"||P==="outside-to-line-or-label")&&(_=[i.x,i.y]),r=e.nodeShapes[this.getNodeShape(a)].intersectLine(o.x,o.y,a.outerWidth(),a.outerHeight(),_[0],_[1],0,L,p),P==="outside-to-node-or-label"||P==="outside-to-line-or-label"){var z=a._private.rscratch,j=z.labelWidth,ee=z.labelHeight,J=z.labelX,Z=z.labelY,re=j/2,Y=ee/2,A=a.pstyle("text-valign").value;A==="top"?Z-=Y:A==="bottom"&&(Z+=Y);var K=a.pstyle("text-halign").value;K==="left"?J-=re:K==="right"&&(J+=re);var W=Bi(_[0],_[1],[J-re,Z-Y,J+re,Z-Y,J+re,Z+Y,J-re,Z+Y],o.x,o.y);if(W.length>0){var oe=i,he=An(oe,ma(r)),ne=An(oe,ma(W)),se=he;if(ne<he&&(r=W,se=ne),W.length>2){var ue=An(oe,{x:W[2],y:W[3]});ue<se&&(r=[W[2],W[3]])}}}var pe=Ko(r,O,e.arrowShapes[l].spacing(t)+c),de=Ko(r,O,e.arrowShapes[l].gap(t)+c);if(h.endX=de[0],h.endY=de[1],h.arrowEndX=pe[0],h.arrowEndY=pe[1],S==="inside-to-node")r=[i.x,i.y];else if(B.units)r=this.manualEndptToPx(n,B);else if(S==="outside-to-line")r=h.srcIntn;else if(S==="outside-to-node"||S==="outside-to-node-or-label"?M=I:(S==="outside-to-line"||S==="outside-to-line-or-label")&&(M=[o.x,o.y]),r=e.nodeShapes[this.getNodeShape(n)].intersectLine(i.x,i.y,n.outerWidth(),n.outerHeight(),M[0],M[1],0,N,f),S==="outside-to-node-or-label"||S==="outside-to-line-or-label"){var me=n._private.rscratch,Ne=me.labelWidth,De=me.labelHeight,Ee=me.labelX,Pe=me.labelY,te=Ne/2,T=De/2,R=n.pstyle("text-valign").value;R==="top"?Pe-=T:R==="bottom"&&(Pe+=T);var Q=n.pstyle("text-halign").value;Q==="left"?Ee-=te:Q==="right"&&(Ee+=te);var G=Bi(M[0],M[1],[Ee-te,Pe-T,Ee+te,Pe-T,Ee+te,Pe+T,Ee-te,Pe+T],i.x,i.y);if(G.length>0){var U=o,ie=An(U,ma(r)),X=An(U,ma(G)),ae=ie;if(X<ie&&(r=[G[0],G[1]],ae=X),G.length>2){var we=An(U,{x:G[2],y:G[3]});we<ae&&(r=[G[2],G[3]])}}}var Ce=Ko(r,I,e.arrowShapes[u].spacing(t)+d),ge=Ko(r,I,e.arrowShapes[u].gap(t)+d);h.startX=ge[0],h.startY=ge[1],h.arrowStartX=Ce[0],h.arrowStartY=Ce[1],E&&(!le(h.startX)||!le(h.startY)||!le(h.endX)||!le(h.endY)?h.badLine=!0:h.badLine=!1)},zi.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}},zi.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var Dc={};function I3(t,e,r){for(var n=function(c,d,f,p){return ft(c,d,f,p)},a=e._private,i=a.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var l=t.bezierProjPcts[o];i.push({x:n(r[0],r[2],r[4],l),y:n(r[1],r[3],r[5],l)})}}Dc.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,n=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,n==="multibezier"||n==="bezier"||n==="self"||n==="compound"){e.rstyle.bezierPts=[];for(var a=0;a+5<r.allpts.length;a+=4)I3(this,t,r.allpts.slice(a,a+6))}else if(n==="segments")for(var i=e.rstyle.linePts=[],a=0;a+1<r.allpts.length;a+=2)i.push({x:r.allpts[a],y:r.allpts[a+1]});else if(n==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth},Dc.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Er={};Er.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!nn(e)){var r,n,a=t._private,i=t.width(),o=t.height(),l=t.padding(),u=t.position(),c=t.pstyle("text-halign").strValue,d=t.pstyle("text-valign").strValue,f=a.rscratch,p=a.rstyle;switch(c){case"left":r=u.x-i/2-l;break;case"right":r=u.x+i/2+l;break;default:r=u.x}switch(d){case"top":n=u.y-o/2-l;break;case"bottom":n=u.y+o/2+l;break;default:n=u.y}f.labelX=r,f.labelY=n,p.labelX=r,p.labelY=n,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var Mv=function(e,r){var n=Math.atan(r/e);return e===0&&n<0&&(n=n*-1),n},Iv=function(e,r){var n=r.x-e.x,a=r.y-e.y;return Mv(n,a)},A3=function(e,r,n,a){var i=Si(0,a-.001,1),o=Si(0,a+.001,1),l=ya(e,r,n,i),u=ya(e,r,n,o);return Iv(l,u)};Er.recalculateEdgeLabelProjections=function(t){var e,r=t._private,n=r.rscratch,a=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:n.midX,y:n.midY};var o=function(f,p,v){sn(r.rscratch,f,p,v),sn(r.rstyle,f,p,v)};o("labelX",null,e.x),o("labelY",null,e.y);var l=Mv(n.midDispX,n.midDispY);o("labelAutoAngle",null,l);var u=function d(){if(d.cache)return d.cache;for(var f=[],p=0;p+5<n.allpts.length;p+=4){var v={x:n.allpts[p],y:n.allpts[p+1]},h={x:n.allpts[p+2],y:n.allpts[p+3]},g={x:n.allpts[p+4],y:n.allpts[p+5]};f.push({p0:v,p1:h,p2:g,startDist:0,length:0,segments:[]})}var y=r.rstyle.bezierPts,m=a.bezierProjPcts.length;function b(k,B,S,N,D){var P=In(B,S),L=k.segments[k.segments.length-1],O={p0:B,p1:S,t0:N,t1:D,startDist:L?L.startDist+L.length:0,length:P};k.segments.push(O),k.length+=P}for(var w=0;w<f.length;w++){var C=f[w],x=f[w-1];x&&(C.startDist=x.startDist+x.length),b(C,C.p0,y[w*m],0,a.bezierProjPcts[0]);for(var E=0;E<m-1;E++)b(C,y[w*m+E],y[w*m+E+1],a.bezierProjPcts[E],a.bezierProjPcts[E+1]);b(C,y[w*m+m-1],C.p2,a.bezierProjPcts[m-1],1)}return d.cache=f},c=function(f){var p,v=f==="source";if(i[f]){var h=t.pstyle(f+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var g=u(),y,m=0,b=0,w=0;w<g.length;w++){for(var C=g[v?w:g.length-1-w],x=0;x<C.segments.length;x++){var E=C.segments[v?x:C.segments.length-1-x],k=w===g.length-1&&x===C.segments.length-1;if(m=b,b+=E.length,b>=h||k){y={cp:C,segment:E};break}}if(y)break}var B=y.cp,S=y.segment,N=(h-m)/S.length,D=S.t1-S.t0,P=v?S.t0+D*N:S.t1-D*N;P=Si(0,P,1),e=ya(B.p0,B.p1,B.p2,P),p=A3(B.p0,B.p1,B.p2,P);break}case"straight":case"segments":case"haystack":{for(var L=0,O,I,_,M,F=n.allpts.length,V=0;V+3<F&&(v?(_={x:n.allpts[V],y:n.allpts[V+1]},M={x:n.allpts[V+2],y:n.allpts[V+3]}):(_={x:n.allpts[F-2-V],y:n.allpts[F-1-V]},M={x:n.allpts[F-4-V],y:n.allpts[F-3-V]}),O=In(_,M),I=L,L+=O,!(L>=h));V+=2);var H=h-I,$=H/O;$=Si(0,$,1),e=HB(_,M,$),p=Iv(_,M);break}}o("labelX",f,e.x),o("labelY",f,e.y),o("labelAutoAngle",f,p)}};c("source"),c("target"),this.applyLabelDimensions(t)}},Er.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))},Er.applyPrefixedLabelDimensions=function(t,e){var r=t._private,n=this.getLabelText(t,e),a=this.calculateLabelDimensions(t,n),i=t.pstyle("line-height").pfValue,o=t.pstyle("text-wrap").strValue,l=lr(r.rscratch,"labelWrapCachedLines",e)||[],u=o!=="wrap"?1:Math.max(l.length,1),c=a.height/u,d=c*i,f=a.width,p=a.height+(u-1)*(i-1)*c;sn(r.rstyle,"labelWidth",e,f),sn(r.rscratch,"labelWidth",e,f),sn(r.rstyle,"labelHeight",e,p),sn(r.rscratch,"labelHeight",e,p),sn(r.rscratch,"labelLineHeight",e,d)},Er.getLabelText=function(t,e){var r=t._private,n=e?e+"-":"",a=t.pstyle(n+"label").strValue,i=t.pstyle("text-transform").value,o=function(j,ee){return ee?(sn(r.rscratch,j,e,ee),ee):lr(r.rscratch,j,e)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var l=t.pstyle("text-wrap").value;if(l==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var c="​",d=a.split(`
444
+ */var Wp=function(e,r){this.recycle(e,r)};function Mi(){return!1}function ts(){return!0}Wp.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Mi,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ts:Mi):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,a=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*a+i.x,y:n.y*a+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=ts;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=ts;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ts,this.stopPropagation()},isDefaultPrevented:Mi,isPropagationStopped:Mi,isImmediatePropagationStopped:Mi};var jp=/^([^.]+)(\.(?:[^.]+))?$/,R3=".*",Yp={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Xp=Object.keys(Yp),$3={};function rs(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$3,e=arguments.length>1?arguments[1]:void 0,r=0;r<Xp.length;r++){var n=Xp[r];this[n]=t[n]||Yp[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var pn=rs.prototype,Zp=function(e,r,n,a,i,o,l){Ye(a)&&(i=a,a=null),l&&(o==null?o=l:o=xe({},o,l));for(var u=He(n)?n:n.split(/\s+/),c=0;c<u.length;c++){var d=u[c];if(!nn(d)){var f=d.match(jp);if(f){var p=f[1],v=f[2]?f[2]:null,h=r(e,d,p,v,a,i,o);if(h===!1)break}}}},Qp=function(e,r){return e.addEventFields(e.context,r),new Wp(r.type,r)},z3=function(e,r,n){if(sT(n)){r(e,n);return}else if(_e(n)){r(e,Qp(e,n));return}for(var a=He(n)?n:n.split(/\s+/),i=0;i<a.length;i++){var o=a[i];if(!nn(o)){var l=o.match(jp);if(l){var u=l[1],c=l[2]?l[2]:null,d=Qp(e,{type:u,namespace:c,target:e.context});r(e,d)}}}};pn.on=pn.addListener=function(t,e,r,n,a){return Zp(this,function(i,o,l,u,c,d,f){Ye(d)&&i.listeners.push({event:o,callback:d,type:l,namespace:u,qualifier:c,conf:f})},t,e,r,n,a),this},pn.one=function(t,e,r,n){return this.on(t,e,r,n,{one:!0})},pn.removeListener=pn.off=function(t,e,r,n){var a=this;this.emitting!==0&&(this.listeners=gB(this.listeners));for(var i=this.listeners,o=function(c){var d=i[c];Zp(a,function(f,p,v,h,g,y){if((d.type===v||t==="*")&&(!h&&d.namespace!==".*"||d.namespace===h)&&(!g||f.qualifierCompare(d.qualifier,g))&&(!y||d.callback===y))return i.splice(c,1),!1},t,e,r,n)},l=i.length-1;l>=0;l--)o(l);return this},pn.removeAllListeners=function(){return this.removeListener("*")},pn.emit=pn.trigger=function(t,e,r){var n=this.listeners,a=n.length;return this.emitting++,He(e)||(e=[e]),z3(this,function(i,o){r!=null&&(n=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],a=n.length);for(var l=function(d){var f=n[d];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===R3)&&i.eventMatches(i.context,f,o)){var p=[o];e!=null&&yB(p,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(g){return g!==f}));var v=i.callbackContext(i.context,f,o),h=f.callback.apply(v,p);i.afterEmit(i.context,f,o),h===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<a;u++)l(u);i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},t),this.emitting--,this};var H3={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,n){var a=r.qualifier;return a!=null?e!==n.target&&vi(n.target)&&a.matches(n.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,n){return r.qualifier!=null?n.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},ns=function(e){return be(e)?new un(e):e},Jp={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],n=r._private;n.emitter||(n.emitter=new rs(H3,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,n){for(var a=ns(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n)}return this},removeListener:function(e,r,n){for(var a=ns(r),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,a,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,n){for(var a=ns(r),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,a,n)}return this},once:function(e,r,n){for(var a=ns(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,a,n,{once:!0,onceCollection:this})}},emit:function(e,r){for(var n=0;n<this.length;n++){var a=this[n];a.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};Ve.eventAliasesOn(Jp);var ev={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),n=0;n<this.length;n++){var a=this[n];a.isNode()?e.push(a):r.push(a)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(be(e)||Ut(e))return new un(e).filter(this);if(Ye(e)){for(var n=this.spawn(),a=this,i=0;i<a.length;i++){var o=a[i],l=r?e.apply(r,[o,i,a]):e(o,i,a);l&&n.push(o)}return n}return this.spawn()},not:function(e){if(e){be(e)&&(e=this.filter(e));for(var r=this.spawn(),n=0;n<this.length;n++){var a=this[n],i=e.has(a);i||r.push(a)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(be(e)){var r=e;return this.filter(r)}for(var n=this.spawn(),a=this,i=e,o=this.length<e.length,l=o?a:i,u=o?i:a,c=0;c<l.length;c++){var d=l[c];u.has(d)&&n.push(d)}return n},xor:function(e){var r=this._private.cy;be(e)&&(e=r.$(e));var n=this.spawn(),a=this,i=e,o=function(u,c){for(var d=0;d<u.length;d++){var f=u[d],p=f._private.data.id,v=c.hasElementWithId(p);v||n.push(f)}};return o(a,i),o(i,a),n},diff:function(e){var r=this._private.cy;be(e)&&(e=r.$(e));var n=this.spawn(),a=this.spawn(),i=this.spawn(),o=this,l=e,u=function(d,f,p){for(var v=0;v<d.length;v++){var h=d[v],g=h._private.data.id,y=f.hasElementWithId(g);y?i.merge(h):p.push(h)}};return u(o,l,n),u(l,o,a),{left:n,right:a,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(be(e)){var n=e;e=r.mutableElements().filter(n)}for(var a=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],l=!this.has(o);l&&a.push(o)}return a},merge:function(e){var r=this._private,n=r.cy;if(!e)return this;if(e&&be(e)){var a=e;e=n.mutableElements().filter(a)}for(var i=r.map,o=0;o<e.length;o++){var l=e[o],u=l._private.data.id,c=!i.has(u);if(c){var d=this.length++;this[d]=l,i.set(u,{ele:l,index:d})}}return this},unmergeAt:function(e){var r=this[e],n=r.id(),a=this._private,i=a.map;this[e]=void 0,i.delete(n);var o=e===this.length-1;if(this.length>1&&!o){var l=this.length-1,u=this[l],c=u._private.data.id;this[l]=void 0,this[e]=u,i.set(c,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,n=e._private.data.id,a=r.map,i=a.get(n);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&be(e)){var n=e;e=r.mutableElements().filter(n)}for(var a=0;a<e.length;a++)this.unmergeOne(e[a]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var n=this[r];e(n)&&this.unmergeAt(r)}return this},map:function(e,r){for(var n=[],a=this,i=0;i<a.length;i++){var o=a[i],l=r?e.apply(r,[o,i,a]):e(o,i,a);n.push(l)}return n},reduce:function(e,r){for(var n=r,a=this,i=0;i<a.length;i++)n=e(n,a[i],i,a);return n},max:function(e,r){for(var n=-1/0,a,i=this,o=0;o<i.length;o++){var l=i[o],u=r?e.apply(r,[l,o,i]):e(l,o,i);u>n&&(n=u,a=l)}return{value:n,ele:a}},min:function(e,r){for(var n=1/0,a,i=this,o=0;o<i.length;o++){var l=i[o],u=r?e.apply(r,[l,o,i]):e(l,o,i);u<n&&(n=u,a=l)}return{value:n,ele:a}}},Fe=ev;Fe.u=Fe["|"]=Fe["+"]=Fe.union=Fe.or=Fe.add,Fe["\\"]=Fe["!"]=Fe["-"]=Fe.difference=Fe.relativeComplement=Fe.subtract=Fe.not,Fe.n=Fe["&"]=Fe["."]=Fe.and=Fe.intersection=Fe.intersect,Fe["^"]=Fe["(+)"]=Fe["(-)"]=Fe.symmetricDifference=Fe.symdiff=Fe.xor,Fe.fnFilter=Fe.filterFn=Fe.stdFilter=Fe.filter,Fe.complement=Fe.abscomp=Fe.absoluteComplement;var K3={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},tv=function(e,r){var n=e.cy(),a=n.hasCompoundNodes();function i(d){var f=d.pstyle("z-compound-depth");return f.value==="auto"?a?d.zDepth():0:f.value==="bottom"?-1:f.value==="top"?Ul:0}var o=i(e)-i(r);if(o!==0)return o;function l(d){var f=d.pstyle("z-index-compare");return f.value==="auto"&&d.isNode()?1:0}var u=l(e)-l(r);if(u!==0)return u;var c=e.pstyle("z-index").value-r.pstyle("z-index").value;return c!==0?c:e.poolIndex()-r.poolIndex()},as={forEach:function(e,r){if(Ye(e))for(var n=this.length,a=0;a<n;a++){var i=this[a],o=r?e.apply(r,[i,a,this]):e(i,a,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var n=[],a=this.length;r==null&&(r=a),e==null&&(e=0),e<0&&(e=a+e),r<0&&(r=a+r);for(var i=e;i>=0&&i<r&&i<a;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Ye(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(tv)},zDepth:function(){var e=this[0];if(e){var r=e._private,n=r.group;if(n==="nodes"){var a=r.data.parent?e.parents().size():0;return e.isParent()?a:Ul-1}else{var i=r.source,o=r.target,l=i.zDepth(),u=o.zDepth();return Math.max(l,u,0)}}}};as.each=as.forEach;var q3=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":ot(Symbol))!=e&&ot(Symbol.iterator)!=e;r&&(as[Symbol.iterator]=function(){var n=this,a={value:void 0,done:!1},i=0,o=this.length;return ph({next:function(){return i<o?a.value=n[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})})};q3();var U3=wt({nodeDimensionsIncludeLabels:!1}),is={layoutDimensions:function(e){e=U3(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();r={w:n.w,h:n.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,n){var a=this.nodes().filter(function(x){return!x.isParent()}),i=this.cy(),o=r.eles,l=function(E){return E.id()},u=gi(n,l);e.emit({type:"layoutstart",layout:e}),e.animations=[];var c=function(E,k,B){var S={x:k.x1+k.w/2,y:k.y1+k.h/2},N={x:(B.x-S.x)*E,y:(B.y-S.y)*E};return{x:S.x+N.x,y:S.y+N.y}},d=r.spacingFactor&&r.spacingFactor!==1,f=function(){if(!d)return null;for(var E=zt(),k=0;k<a.length;k++){var B=a[k],S=u(B,k);GB(E,S.x,S.y)}return E},p=f(),v=gi(function(x,E){var k=u(x,E);if(d){var B=Math.abs(r.spacingFactor);k=c(B,p,k)}return r.transform!=null&&(k=r.transform(x,k)),k},l);if(r.animate){for(var h=0;h<a.length;h++){var g=a[h],y=v(g,h),m=r.animateFilter==null||r.animateFilter(g,h);if(m){var b=g.animation({position:y,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else g.position(y)}if(r.fit){var w=i.animation({fit:{boundingBox:o.boundingBoxAt(v),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(w)}else if(r.zoom!==void 0&&r.pan!==void 0){var C=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(C)}e.animations.forEach(function(x){return x.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),xa.all(e.animations.map(function(x){return x.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else a.positions(v),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(xe({},e,{eles:this}))}};is.createLayout=is.makeLayout=is.layout;function rv(t,e,r){var n=r._private,a=n.styleCache=n.styleCache||[],i;return(i=a[t])!=null||(i=a[t]=e(r)),i}function os(t,e){return t=Mn(t),function(n){return rv(t,e,n)}}function ss(t,e){t=Mn(t);var r=function(a){return e.call(a)};return function(){var a=this[0];if(a)return rv(t,r,a)}}var Ct={recalculateRenderedStyle:function(e){var r=this.cy(),n=r.renderer(),a=r.styleEnabled();return n&&a&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.forEach(r)}else this.forEach(function(a){r(a),a.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var n=r._private.batchStyleEles;return n.merge(this),this}var a=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),a&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(l){return l._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var n=this[r];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],a=n.cy();if(a.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return i??(r?a.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var n=r.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=this[0];if(n)return r.style().getRenderedStyle(n,e)},style:function(e,r){var n=this.cy();if(!n.styleEnabled())return this;var a=!1,i=n.style();if(_e(e)){var o=e;i.applyBypass(this,o,a),this.emitAndNotify("style")}else if(be(e))if(r===void 0){var l=this[0];return l?i.getStylePropertyValue(l,e):void 0}else i.applyBypass(this,e,r,a),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,a=r.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var l=i[o];a.removeAllBypasses(l,n)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var c=i[u];a.removeBypasses(c,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),n=this[0];if(n){var a=n._private,i=n.pstyle("opacity").value;if(!r)return i;var o=a.data.parent?n.parents():null;if(o)for(var l=0;l<o.length;l++){var u=o[l],c=u.pstyle("opacity").value;i=c*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],n=r.cy().hasCompoundNodes();if(r)return n?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function vc(t,e){var r=t._private,n=r.data.parent?t.parents():null;if(n)for(var a=0;a<n.length;a++){var i=n[a];if(!e(i))return!1}return!0}function gc(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,n=t.parentOk||t.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],o=a.hasCompoundNodes();if(i){var l=i._private;if(!e(i))return!1;if(i.isNode())return!o||vc(i,n);var u=l.source,c=l.target;return r(u)&&(!o||vc(u,r))&&(u===c||r(c)&&(!o||vc(c,r)))}}}var Oa=os("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Ct.takesUpSpace=ss("takesUpSpace",gc({ok:Oa}));var G3=os("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Oa(t)}),W3=os("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Oa(t)});Ct.interactive=ss("interactive",gc({ok:G3,parentOk:W3,edgeOkViaNode:Oa})),Ct.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var j3=os("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Oa(t)}),Y3=Oa;Ct.visible=ss("visible",gc({ok:j3,edgeOkViaNode:Y3})),Ct.hidden=function(){var t=this[0];if(t)return!t.visible()},Ct.isBundledBezier=ss("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1}),Ct.bypass=Ct.css=Ct.style,Ct.renderedCss=Ct.renderedStyle,Ct.removeBypass=Ct.removeCss=Ct.removeStyle,Ct.pstyle=Ct.parsedStyle;var vn={};function nv(t){return function(){var e=arguments,r=[];if(e.length===2){var n=e[0],a=e[1];this.on(t.event,n,a)}else if(e.length===1&&Ye(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&He(e[0])){for(var o=e.length===1?e[0]:null,l=0;l<this.length;l++){var u=this[l],c=!t.ableField||u._private[t.ableField],d=u._private[t.field]!=t.value;if(t.overrideAble){var f=t.overrideAble(u);if(f!==void 0&&(c=f,!f))return this}c&&(u._private[t.field]=t.value,d&&r.push(u))}var p=this.spawn(r);p.updateStyle(),p.emit(t.event),o&&p.emit(o)}return this}}function _a(t){vn[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},vn[t.on]=nv({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),vn[t.off]=nv({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}_a({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"}),_a({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"}),_a({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"}),_a({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"}),vn.deselect=vn.unselect,vn.grabbed=function(){var t=this[0];if(t)return t._private.grabbed},_a({field:"active",on:"activate",off:"unactivate"}),_a({field:"pannable",on:"panify",off:"unpanify"}),vn.inactive=function(){var t=this[0];if(t)return!t._private.active};var Tt={},av=function(e){return function(n){for(var a=this,i=[],o=0;o<a.length;o++){var l=a[o];if(l.isNode()){for(var u=!1,c=l.connectedEdges(),d=0;d<c.length;d++){var f=c[d],p=f.source(),v=f.target();if(e.noIncomingEdges&&v===l&&p!==l||e.noOutgoingEdges&&p===l&&v!==l){u=!0;break}}u||i.push(l)}}return this.spawn(i,!0).filter(n)}},iv=function(e){return function(r){for(var n=this,a=[],i=0;i<n.length;i++){var o=n[i];if(o.isNode())for(var l=o.connectedEdges(),u=0;u<l.length;u++){var c=l[u],d=c.source(),f=c.target();e.outgoing&&d===o?(a.push(c),a.push(f)):e.incoming&&f===o&&(a.push(c),a.push(d))}}return this.spawn(a,!0).filter(r)}},ov=function(e){return function(r){for(var n=this,a=[],i={};;){var o=e.outgoing?n.outgoers():n.incomers();if(o.length===0)break;for(var l=!1,u=0;u<o.length;u++){var c=o[u],d=c.id();i[d]||(i[d]=!0,a.push(c),l=!0)}if(!l)break;n=o}return this.spawn(a,!0).filter(r)}};Tt.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null},xe(Tt,{roots:av({noIncomingEdges:!0}),leaves:av({noOutgoingEdges:!0}),outgoers:Qt(iv({outgoing:!0}),"outgoers"),successors:ov({outgoing:!0}),incomers:Qt(iv({incoming:!0}),"incomers"),predecessors:ov({incoming:!0})}),xe(Tt,{neighborhood:Qt(function(t){for(var e=[],r=this.nodes(),n=0;n<r.length;n++)for(var a=r[n],i=a.connectedEdges(),o=0;o<i.length;o++){var l=i[o],u=l.source(),c=l.target(),d=a===u?c:u;d.length>0&&e.push(d[0]),e.push(l[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Tt.neighbourhood=Tt.neighborhood,Tt.closedNeighbourhood=Tt.closedNeighborhood,Tt.openNeighbourhood=Tt.openNeighborhood,xe(Tt,{source:Qt(function(e){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&e?n.filter(e):n},"source"),target:Qt(function(e){var r=this[0],n;return r&&(n=r._private.target||r.cy().collection()),n&&e?n.filter(e):n},"target"),sources:sv({attr:"source"}),targets:sv({attr:"target"})});function sv(t){return function(r){for(var n=[],a=0;a<this.length;a++){var i=this[a],o=i._private[t.attr];o&&n.push(o)}return this.spawn(n,!0).filter(r)}}xe(Tt,{edgesWith:Qt(lv(),"edgesWith"),edgesTo:Qt(lv({thisIsSrc:!0}),"edgesTo")});function lv(t){return function(r){var n=[],a=this._private.cy,i=t||{};be(r)&&(r=a.$(r));for(var o=0;o<r.length;o++)for(var l=r[o]._private.edges,u=0;u<l.length;u++){var c=l[u],d=c._private.data,f=this.hasElementWithId(d.source)&&r.hasElementWithId(d.target),p=r.hasElementWithId(d.source)&&this.hasElementWithId(d.target),v=f||p;v&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!f||i.thisIsTgt&&!p)||n.push(c))}return this.spawn(n,!0)}}xe(Tt,{connectedEdges:Qt(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var a=r[n];if(a.isNode())for(var i=a._private.edges,o=0;o<i.length;o++){var l=i[o];e.push(l)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Qt(function(t){for(var e=[],r=this,n=0;n<r.length;n++){var a=r[n];a.isEdge()&&(e.push(a.source()[0]),e.push(a.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Qt(cv(),"parallelEdges"),codirectedEdges:Qt(cv({codirected:!0}),"codirectedEdges")});function cv(t){var e={codirected:!1};return t=xe({},e,t),function(n){for(var a=[],i=this.edges(),o=t,l=0;l<i.length;l++)for(var u=i[l],c=u._private,d=c.source,f=d._private.data.id,p=c.data.target,v=d._private.edges,h=0;h<v.length;h++){var g=v[h],y=g._private.data,m=y.target,b=y.source,w=m===p&&b===f,C=f===m&&p===b;(o.codirected&&w||!o.codirected&&(w||C))&&a.push(g)}return this.spawn(a,!0).filter(n)}}xe(Tt,{components:function(e){var r=this,n=r.cy(),a=n.collection(),i=e==null?r.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var l=function(d,f){a.merge(d),i.unmerge(d),f.merge(d)};if(i.empty())return r.spawn();var u=function(){var d=n.collection();o.push(d);var f=i[0];l(f,d),r.bfs({directed:!1,roots:f,visit:function(v){return l(v,d)}}),d.forEach(function(p){p.connectedEdges().forEach(function(v){r.has(v)&&d.has(v.source())&&d.has(v.target())&&d.merge(v)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Tt.componentsOf=Tt.components;var kt=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Xe("A collection must have a reference to the core");return}var i=new wr,o=!1;if(!r)r=[];else if(r.length>0&&_e(r[0])&&!vi(r[0])){o=!0;for(var l=[],u=new ga,c=0,d=r.length;c<d;c++){var f=r[c];f.data==null&&(f.data={});var p=f.data;if(p.id==null)p.id=$h();else if(e.hasElementWithId(p.id)||u.has(p.id))continue;var v=new Io(e,f,!1);l.push(v),u.add(p.id)}r=l}this.length=0;for(var h=0,g=r.length;h<g;h++){var y=r[h][0];if(y!=null){var m=y._private.data.id;(!n||!i.has(m))&&(n&&i.set(m,{index:this.length,ele:y}),this[this.length]=y,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(b){this.lazyMap=b},rebuildMap:function(){for(var w=this.lazyMap=new wr,C=this.eles,x=0;x<C.length;x++){var E=C[x];w.set(E.id(),{index:x,ele:E})}}},n&&(this._private.map=i),o&&!a&&this.restore()},qe=Io.prototype=kt.prototype=Object.create(Array.prototype);qe.instanceString=function(){return"collection"},qe.spawn=function(t,e){return new kt(this.cy(),t,e)},qe.spawnSelf=function(){return this.spawn(this)},qe.cy=function(){return this._private.cy},qe.renderer=function(){return this._private.cy.renderer()},qe.element=function(){return this[0]},qe.collection=function(){return wh(this)?this:new kt(this._private.cy,[this])},qe.unique=function(){return new kt(this._private.cy,this,!0)},qe.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)},qe.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new kt(e)},qe.$id=qe.getElementById,qe.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index},qe.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index},qe.indexOfId=function(t){return t=""+t,this._private.map.get(t).index},qe.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var n=e._private;if(_e(t)){if(r.startBatch(),t.data){e.data(t.data);var a=n.data;if(e.isEdge()){var i=!1,o={},l=t.data.source,u=t.data.target;l!=null&&l!=a.source&&(o.source=""+l,i=!0),u!=null&&u!=a.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var c="parent"in t.data,d=t.data.parent;c&&(d!=null||a.parent!=null)&&d!=a.parent&&(d===void 0&&(d=null),d!=null&&(d=""+d),e=e.move({parent:d}))}}t.position&&e.position(t.position);var f=function(g,y,m){var b=t[g];b!=null&&b!==n[g]&&(b?e[y]():e[m]())};return f("removed","remove","restore"),f("selected","select","unselect"),f("selectable","selectify","unselectify"),f("locked","lock","unlock"),f("grabbable","grabify","ungrabify"),f("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var p={data:br(n.data),position:br(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};p.classes="";var v=0;return n.classes.forEach(function(h){return p.classes+=v++===0?h:" "+h}),p}}},qe.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],n=r.json();t.push(n)}return t},qe.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var n=this[r],a=n.json(),i=new Io(t,a,!1);e.push(i)}return new kt(t,e)},qe.copy=qe.clone,qe.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=r.cy(),a=n._private,i=[],o=[],l,u=0,c=r.length;u<c;u++){var d=r[u];e&&!d.removed()||(d.isNode()?i.push(d):o.push(d))}l=i.concat(o);var f,p=function(){l.splice(f,1),f--};for(f=0;f<l.length;f++){var v=l[f],h=v._private,g=h.data;if(v.clearTraversalCache(),!(!e&&!h.removed)){if(g.id===void 0)g.id=$h();else if(le(g.id))g.id=""+g.id;else if(nn(g.id)||!be(g.id)){Xe("Can not create element with invalid string ID `"+g.id+"`"),p();continue}else if(n.hasElementWithId(g.id)){Xe("Can not create second element with ID `"+g.id+"`"),p();continue}}var y=g.id;if(v.isNode()){var m=h.position;m.x==null&&(m.x=0),m.y==null&&(m.y=0)}if(v.isEdge()){for(var b=v,w=["source","target"],C=w.length,x=!1,E=0;E<C;E++){var k=w[E],B=g[k];le(B)&&(B=g[k]=""+g[k]),B==null||B===""?(Xe("Can not create edge `"+y+"` with unspecified "+k),x=!0):n.hasElementWithId(B)||(Xe("Can not create edge `"+y+"` with nonexistant "+k+" `"+B+"`"),x=!0)}if(x){p();continue}var S=n.getElementById(g.source),N=n.getElementById(g.target);S.same(N)?S._private.edges.push(b):(S._private.edges.push(b),N._private.edges.push(b)),b._private.source=S,b._private.target=N}h.map=new wr,h.map.set(y,{ele:v,index:0}),h.removed=!1,e&&n.addToPool(v)}for(var D=0;D<i.length;D++){var P=i[D],L=P._private.data;le(L.parent)&&(L.parent=""+L.parent);var O=L.parent,I=O!=null;if(I||P._private.parent){var _=P._private.parent?n.collection().merge(P._private.parent):n.getElementById(O);if(_.empty())L.parent=void 0;else if(_[0].removed())Ae("Node added with missing parent, reference to parent removed"),L.parent=void 0,P._private.parent=null;else{for(var M=!1,F=_;!F.empty();){if(P.same(F)){M=!0,L.parent=void 0;break}F=F.parent()}M||(_[0]._private.children.push(P),P._private.parent=_[0],a.hasCompoundNodes=!0)}}}if(l.length>0){for(var V=l.length===r.length?r:new kt(n,l),H=0;H<V.length;H++){var $=V[H];$.isNode()||($.parallelEdges().clearTraversalCache(),$.source().clearTraversalCache(),$.target().clearTraversalCache())}var z;a.hasCompoundNodes?z=n.collection().merge(V).merge(V.connectedNodes()).merge(V.parent()):z=V,z.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?V.emitAndNotify("add"):e&&V.emit("add")}return r},qe.removed=function(){var t=this[0];return t&&t._private.removed},qe.inside=function(){var t=this[0];return t&&!t._private.removed},qe.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=[],a={},i=r._private.cy;function o(O){for(var I=O._private.edges,_=0;_<I.length;_++)u(I[_])}function l(O){for(var I=O._private.children,_=0;_<I.length;_++)u(I[_])}function u(O){var I=a[O.id()];e&&O.removed()||I||(a[O.id()]=!0,O.isNode()?(n.push(O),o(O),l(O)):n.unshift(O))}for(var c=0,d=r.length;c<d;c++){var f=r[c];u(f)}function p(O,I){var _=O._private.edges;on(_,I),O.clearTraversalCache()}function v(O){O.clearTraversalCache()}var h=[];h.ids={};function g(O,I){I=I[0],O=O[0];var _=O._private.children,M=O.id();on(_,I),I._private.parent=null,h.ids[M]||(h.ids[M]=!0,h.push(O))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(n);for(var y=0;y<n.length;y++){var m=n[y];if(m.isEdge()){var b=m.source()[0],w=m.target()[0];p(b,m),p(w,m);for(var C=m.parallelEdges(),x=0;x<C.length;x++){var E=C[x];v(E),E.isBundledBezier()&&E.dirtyBoundingBoxCache()}}else{var k=m.parent();k.length!==0&&g(k,m)}e&&(m._private.removed=!0)}var B=i._private.elements;i._private.hasCompoundNodes=!1;for(var S=0;S<B.length;S++){var N=B[S];if(N.isParent()){i._private.hasCompoundNodes=!0;break}}var D=new kt(this.cy(),n);D.size()>0&&(t?D.emitAndNotify("remove"):e&&D.emit("remove"));for(var P=0;P<h.length;P++){var L=h[P];(!e||!L.removed())&&L.updateStyle()}return D},qe.move=function(t){var e=this._private.cy,r=this,n=!1,a=!1,i=function(h){return h==null?h:""+h};if(t.source!==void 0||t.target!==void 0){var o=i(t.source),l=i(t.target),u=o!=null&&e.hasElementWithId(o),c=l!=null&&e.hasElementWithId(l);(u||c)&&(e.batch(function(){r.remove(n,a),r.emitAndNotify("moveout");for(var v=0;v<r.length;v++){var h=r[v],g=h._private.data;h.isEdge()&&(u&&(g.source=o),c&&(g.target=l))}r.restore(n,a)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var d=i(t.parent),f=d===null||e.hasElementWithId(d);if(f){var p=d===null?void 0:d;e.batch(function(){var v=r.remove(n,a);v.emitAndNotify("moveout");for(var h=0;h<r.length;h++){var g=r[h],y=g._private.data;g.isNode()&&(y.parent=p)}v.restore(n,a)}),r.emitAndNotify("move")}}return this},[hp,o3,Qo,fn,Na,k3,Jo,V3,Jp,ev,K3,as,is,Ct,vn,Tt].forEach(function(t){xe(qe,t)});var X3={add:function(e){var r,n=this;if(Ut(e)){var a=e;if(a._private.cy===n)r=a.restore();else{for(var i=[],o=0;o<a.length;o++){var l=a[o];i.push(l.json())}r=new kt(n,i)}}else if(He(e)){var u=e;r=new kt(n,u)}else if(_e(e)&&(He(e.nodes)||He(e.edges))){for(var c=e,d=[],f=["nodes","edges"],p=0,v=f.length;p<v;p++){var h=f[p],g=c[h];if(He(g))for(var y=0,m=g.length;y<m;y++){var b=xe({group:h},g[y]);d.push(b)}}r=new kt(n,d)}else{var w=e;r=new Io(n,w).collection()}return r},remove:function(e){if(!Ut(e)){if(be(e)){var r=e;e=this.$(r)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function Z3(t,e,r,n){var a=4,i=.001,o=1e-7,l=10,u=11,c=1/(u-1),d=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var f=0;f<4;++f)if(typeof arguments[f]!="number"||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var p=d?new Float32Array(u):new Array(u);function v(N,D){return 1-3*D+3*N}function h(N,D){return 3*D-6*N}function g(N){return 3*N}function y(N,D,P){return((v(D,P)*N+h(D,P))*N+g(D))*N}function m(N,D,P){return 3*v(D,P)*N*N+2*h(D,P)*N+g(D)}function b(N,D){for(var P=0;P<a;++P){var L=m(D,t,r);if(L===0)return D;var O=y(D,t,r)-N;D-=O/L}return D}function w(){for(var N=0;N<u;++N)p[N]=y(N*c,t,r)}function C(N,D,P){var L,O,I=0;do O=D+(P-D)/2,L=y(O,t,r)-N,L>0?P=O:D=O;while(Math.abs(L)>o&&++I<l);return O}function x(N){for(var D=0,P=1,L=u-1;P!==L&&p[P]<=N;++P)D+=c;--P;var O=(N-p[P])/(p[P+1]-p[P]),I=D+O*c,_=m(I,t,r);return _>=i?b(N,I):_===0?I:C(N,D,D+c)}var E=!1;function k(){E=!0,(t!==e||r!==n)&&w()}var B=function(D){return E||k(),t===e&&r===n?D:D===0?0:D===1?1:y(x(D),e,n)};B.getControlPoints=function(){return[{x:t,y:e},{x:r,y:n}]};var S="generateBezier("+[t,e,r,n]+")";return B.toString=function(){return S},B}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Q3=function(){function t(n){return-n.tension*n.x-n.friction*n.v}function e(n,a,i){var o={x:n.x+i.dx*a,v:n.v+i.dv*a,tension:n.tension,friction:n.friction};return{dx:o.v,dv:t(o)}}function r(n,a){var i={dx:n.v,dv:t(n)},o=e(n,a*.5,i),l=e(n,a*.5,o),u=e(n,a,l),c=1/6*(i.dx+2*(o.dx+l.dx)+u.dx),d=1/6*(i.dv+2*(o.dv+l.dv)+u.dv);return n.x=n.x+c*a,n.v=n.v+d*a,n}return function n(a,i,o){var l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,d=1/1e4,f=16/1e3,p,v,h;for(a=parseFloat(a)||500,i=parseFloat(i)||20,o=o||null,l.tension=a,l.friction=i,p=o!==null,p?(c=n(a,i),v=c/o*f):v=f;h=r(h||l,v),u.push(1+h.x),c+=16,Math.abs(h.x)>d&&Math.abs(h.v)>d;);return p?function(g){return u[g*(u.length-1)|0]}:c}}(),Ue=function(e,r,n,a){var i=Z3(e,r,n,a);return function(o,l,u){return o+(l-o)*i(u)}},ls={linear:function(e,r,n){return e+(r-e)*n},ease:Ue(.25,.1,.25,1),"ease-in":Ue(.42,0,1,1),"ease-out":Ue(0,0,.58,1),"ease-in-out":Ue(.42,0,.58,1),"ease-in-sine":Ue(.47,0,.745,.715),"ease-out-sine":Ue(.39,.575,.565,1),"ease-in-out-sine":Ue(.445,.05,.55,.95),"ease-in-quad":Ue(.55,.085,.68,.53),"ease-out-quad":Ue(.25,.46,.45,.94),"ease-in-out-quad":Ue(.455,.03,.515,.955),"ease-in-cubic":Ue(.55,.055,.675,.19),"ease-out-cubic":Ue(.215,.61,.355,1),"ease-in-out-cubic":Ue(.645,.045,.355,1),"ease-in-quart":Ue(.895,.03,.685,.22),"ease-out-quart":Ue(.165,.84,.44,1),"ease-in-out-quart":Ue(.77,0,.175,1),"ease-in-quint":Ue(.755,.05,.855,.06),"ease-out-quint":Ue(.23,1,.32,1),"ease-in-out-quint":Ue(.86,0,.07,1),"ease-in-expo":Ue(.95,.05,.795,.035),"ease-out-expo":Ue(.19,1,.22,1),"ease-in-out-expo":Ue(1,0,0,1),"ease-in-circ":Ue(.6,.04,.98,.335),"ease-out-circ":Ue(.075,.82,.165,1),"ease-in-out-circ":Ue(.785,.135,.15,.86),spring:function(e,r,n){if(n===0)return ls.linear;var a=Q3(e,r,n);return function(i,o,l){return i+(o-i)*a(l)}},"cubic-bezier":Ue};function uv(t,e,r,n,a){if(n===1||e===r)return r;var i=a(e,r,n);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function dv(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function La(t,e,r,n,a){var i=a!=null?a.type:null;r<0?r=0:r>1&&(r=1);var o=dv(t,a),l=dv(e,a);if(le(o)&&le(l))return uv(i,o,l,r,n);if(He(o)&&He(l)){for(var u=[],c=0;c<l.length;c++){var d=o[c],f=l[c];if(d!=null&&f!=null){var p=uv(i,d,f,r,n);u.push(p)}else u.push(f)}return u}}function J3(t,e,r,n){var a=!n,i=t._private,o=e._private,l=o.easing,u=o.startTime,c=n?t:t.cy(),d=c.style();if(!o.easingImpl)if(l==null)o.easingImpl=ls.linear;else{var f;if(be(l)){var p=d.parse("transition-timing-function",l);f=p.value}else f=l;var v,h;be(f)?(v=f,h=[]):(v=f[1],h=f.slice(2).map(function(V){return+V})),h.length>0?(v==="spring"&&h.push(o.duration),o.easingImpl=ls[v].apply(null,h)):o.easingImpl=ls[v]}var g=o.easingImpl,y;if(o.duration===0?y=1:y=(r-u)/o.duration,o.applying&&(y=o.progress),y<0?y=0:y>1&&(y=1),o.delay==null){var m=o.startPosition,b=o.position;if(b&&a&&!t.locked()){var w={};Ii(m.x,b.x)&&(w.x=La(m.x,b.x,y,g)),Ii(m.y,b.y)&&(w.y=La(m.y,b.y,y,g)),t.position(w)}var C=o.startPan,x=o.pan,E=i.pan,k=x!=null&&n;k&&(Ii(C.x,x.x)&&(E.x=La(C.x,x.x,y,g)),Ii(C.y,x.y)&&(E.y=La(C.y,x.y,y,g)),t.emit("pan"));var B=o.startZoom,S=o.zoom,N=S!=null&&n;N&&(Ii(B,S)&&(i.zoom=Si(i.minZoom,La(B,S,y,g),i.maxZoom)),t.emit("zoom")),(k||N)&&t.emit("viewport");var D=o.style;if(D&&D.length>0&&a){for(var P=0;P<D.length;P++){var L=D[P],O=L.name,I=L,_=o.startStyle[O],M=d.properties[_.name],F=La(_,I,y,g,M);d.overrideBypass(t,O,F)}t.emit("style")}}return o.progress=y,y}function Ii(t,e){return t==null||e==null?!1:le(t)&&le(e)?!0:!!(t&&e)}function eD(t,e,r,n){var a=e._private;a.started=!0,a.startTime=r-a.progress*a.duration}function fv(t,e){var r=e._private.aniEles,n=[];function a(d,f){var p=d._private,v=p.animation.current,h=p.animation.queue,g=!1;if(v.length===0){var y=h.shift();y&&v.push(y)}for(var m=function(E){for(var k=E.length-1;k>=0;k--){var B=E[k];B()}E.splice(0,E.length)},b=v.length-1;b>=0;b--){var w=v[b],C=w._private;if(C.stopped){v.splice(b,1),C.hooked=!1,C.playing=!1,C.started=!1,m(C.frames);continue}!C.playing&&!C.applying||(C.playing&&C.applying&&(C.applying=!1),C.started||eD(d,w,t),J3(d,w,t,f),C.applying&&(C.applying=!1),m(C.frames),C.step!=null&&C.step(t),w.completed()&&(v.splice(b,1),C.hooked=!1,C.playing=!1,C.started=!1,m(C.completes)),g=!0)}return!f&&v.length===0&&h.length===0&&n.push(d),g}for(var i=!1,o=0;o<r.length;o++){var l=r[o],u=a(l);i=i||u}var c=a(e,!0);(i||c)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(n),e.emit("step")}var tD={animate:Ve.animate(),animation:Ve.animation(),animated:Ve.animated(),clearQueue:Ve.clearQueue(),delay:Ve.delay(),delayAnimation:Ve.delayAnimation(),stop:Ve.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&Lo(function(i){fv(i,e),r()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(i,o){fv(o,e)},n.beforeRenderPriorities.animations):r()}},rD={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,n){var a=r.qualifier;return a!=null?e!==n.target&&vi(n.target)&&a.matches(n.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,n){return r.qualifier!=null?n.target:e}},cs=function(e){return be(e)?new un(e):e},hv={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new rs(rD,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,n){return this.emitter().on(e,cs(r),n),this},removeListener:function(e,r,n){return this.emitter().removeListener(e,cs(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,n){return this.emitter().one(e,cs(r),n),this},once:function(e,r,n){return this.emitter().one(e,cs(r),n),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Ve.eventAliasesOn(hv);var mc={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};mc.jpeg=mc.jpg;var us={layout:function(e){var r=this;if(e==null){Xe("Layout options must be specified to make a layout");return}if(e.name==null){Xe("A `name` must be specified to make a layout");return}var n=e.name,a=r.extension("layout",n);if(a==null){Xe("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;be(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var o=new a(xe({},e,{cy:r,eles:i}));return o}};us.createLayout=us.makeLayout=us.layout;var nD={notify:function(e,r){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var a=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();r!=null&&a.merge(r);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var a=e.batchNotifications[n];a.empty()?r.notify(n):r.notify(n,a)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var n=Object.keys(e),a=0;a<n.length;a++){var i=n[a],o=e[i],l=r.getElementById(i);l.data(o)}})}},aD=wt({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),yc={renderTo:function(e,r,n,a){var i=this._private.renderer;return i.renderTo(e,r,n,a),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var r=this,n=r.extension("renderer",e.name);if(n==null){Xe("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&&Ae("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 a=aD(e);a.cy=r,r._private.renderer=new n(a),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var a=n._private;a.rscratch={},a.rstyle={},a.animation.current=[],a.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};yc.invalidateDimensions=yc.resize;var ds={collection:function(e,r){return be(e)?this.$(e):Ut(e)?e.collection():He(e)?(r||(r={}),new kt(this,e,r.unique,r.removed)):new kt(this)},nodes:function(e){var r=this.$(function(n){return n.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(n){return n.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};ds.elements=ds.filter=ds.$;var Bt={},Ai="t",iD="f";Bt.apply=function(t){for(var e=this,r=e._private,n=r.cy,a=n.collection(),i=0;i<t.length;i++){var o=t[i],l=e.getContextMeta(o);if(!l.empty){var u=e.getContextStyle(l),c=e.applyContextStyle(l,u,o);o._private.appliedInitStyle?e.updateTransitions(o,c.diffProps):o._private.appliedInitStyle=!0;var d=e.updateStyleHints(o);d&&a.push(o)}}return a},Bt.getPropertiesDiff=function(t,e){var r=this,n=r._private.propDiffs=r._private.propDiffs||{},a=t+"-"+e,i=n[a];if(i)return i;for(var o=[],l={},u=0;u<r.length;u++){var c=r[u],d=t[u]===Ai,f=e[u]===Ai,p=d!==f,v=c.mappedProperties.length>0;if(p||f&&v){var h=void 0;p&&v||p?h=c.properties:v&&(h=c.mappedProperties);for(var g=0;g<h.length;g++){for(var y=h[g],m=y.name,b=!1,w=u+1;w<r.length;w++){var C=r[w],x=e[w]===Ai;if(x&&(b=C.properties[y.name]!=null,b))break}!l[m]&&!b&&(l[m]=!0,o.push(m))}}}return n[a]=o,o},Bt.getContextMeta=function(t){for(var e=this,r="",n,a=t._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],l=o.selector&&o.selector.matches(t);l?r+=Ai:r+=iD}return n=e.getPropertiesDiff(a,r),t._private.styleCxtKey=r,{key:r,diffPropNames:n,empty:n.length===0}},Bt.getContextStyle=function(t){var e=t.key,r=this,n=this._private.contextStyles=this._private.contextStyles||{};if(n[e])return n[e];for(var a={_private:{key:e}},i=0;i<r.length;i++){var o=r[i],l=e[i]===Ai;if(l)for(var u=0;u<o.properties.length;u++){var c=o.properties[u];a[c.name]=c}}return n[e]=a,a},Bt.applyContextStyle=function(t,e,r){for(var n=this,a=t.diffPropNames,i={},o=n.types,l=0;l<a.length;l++){var u=a[l],c=e[u],d=r.pstyle(u);if(!c)if(d)d.bypass?c={name:u,deleteBypassed:!0}:c={name:u,delete:!0};else continue;if(d!==c){if(c.mapped===o.fn&&d!=null&&d.mapping!=null&&d.mapping.value===c.value){var f=d.mapping,p=f.fnValue=c.value(r);if(p===f.prevFnValue)continue}var v=i[u]={prev:d};n.applyParsedProperty(r,c),v.next=r.pstyle(u),v.next&&v.next.bypass&&(v.next=v.next.bypassed)}}return{diffProps:i}},Bt.updateStyleHints=function(t){var e=t._private,r=this,n=r.propertyGroupNames,a=r.propertyGroupKeys,i=function(W,oe,he){return r.getPropertiesHash(W,oe,he)},o=e.styleKey;if(t.removed())return!1;var l=e.group==="nodes",u=t._private.style;n=Object.keys(u);for(var c=0;c<a.length;c++){var d=a[c];e.styleKeys[d]=[va,wi]}for(var f=function(W,oe){return e.styleKeys[oe][0]=Ci(W,e.styleKeys[oe][0])},p=function(W,oe){return e.styleKeys[oe][1]=ki(W,e.styleKeys[oe][1])},v=function(W,oe){f(W,oe),p(W,oe)},h=function(W,oe){for(var he=0;he<W.length;he++){var ne=W.charCodeAt(he);f(ne,oe),p(ne,oe)}},g=2e9,y=function(W){return-128<W&&W<128&&Math.floor(W)!==W?g-(W*1024|0):W},m=0;m<n.length;m++){var b=n[m],w=u[b];if(w!=null){var C=this.properties[b],x=C.type,E=C.groupKey,k=void 0;C.hashOverride!=null?k=C.hashOverride(t,w):w.pfValue!=null&&(k=w.pfValue);var B=C.enums==null?w.value:null,S=k!=null,N=B!=null,D=S||N,P=w.units;if(x.number&&D&&!x.multiple){var L=S?k:B;v(y(L),E),!S&&P!=null&&h(P,E)}else h(w.strValue,E)}}for(var O=[va,wi],I=0;I<a.length;I++){var _=a[I],M=e.styleKeys[_];O[0]=Ci(M[0],O[0]),O[1]=ki(M[1],O[1])}e.styleKey=uB(O[0],O[1]);var F=e.styleKeys;e.labelDimsKey=an(F.labelDimensions);var V=i(t,["label"],F.labelDimensions);if(e.labelKey=an(V),e.labelStyleKey=an(Fo(F.commonLabel,V)),!l){var H=i(t,["source-label"],F.labelDimensions);e.sourceLabelKey=an(H),e.sourceLabelStyleKey=an(Fo(F.commonLabel,H));var $=i(t,["target-label"],F.labelDimensions);e.targetLabelKey=an($),e.targetLabelStyleKey=an(Fo(F.commonLabel,$))}if(l){var z=e.styleKeys,j=z.nodeBody,ee=z.nodeBorder,J=z.nodeOutline,Z=z.backgroundImage,re=z.compound,Y=z.pie,A=[j,ee,J,Z,re,Y].filter(function(K){return K!=null}).reduce(Fo,[va,wi]);e.nodeKey=an(A),e.hasPie=Y!=null&&Y[0]!==va&&Y[1]!==wi}return o!==e.styleKey},Bt.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null},Bt.applyParsedProperty=function(t,e){var r=this,n=e,a=t._private.style,i,o=r.types,l=r.properties[n.name].type,u=n.bypass,c=a[n.name],d=c&&c.bypass,f=t._private,p="mapping",v=function(j){return j==null?null:j.pfValue!=null?j.pfValue:j.value},h=function(){var j=v(c),ee=v(n);r.checkTriggers(t,n.name,j,ee)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(n=e=this.parse(e.name,"bezier",u)),n.delete)return a[n.name]=void 0,h(),!0;if(n.deleteBypassed)return c?c.bypass?(c.bypassed=void 0,h(),!0):!1:(h(),!0);if(n.deleteBypass)return c?c.bypass?(a[n.name]=c.bypassed,h(),!0):!1:(h(),!0);var g=function(){Ae("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case o.mapData:{for(var y=n.field.split("."),m=f.data,b=0;b<y.length&&m;b++){var w=y[b];m=m[w]}if(m==null)return g(),!1;var C;if(le(m)){var x=n.fieldMax-n.fieldMin;x===0?C=0:C=(m-n.fieldMin)/x}else return Ae("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+m+"` for `"+t.id()+"` is non-numeric)"),!1;if(C<0?C=0:C>1&&(C=1),l.color){var E=n.valueMin[0],k=n.valueMax[0],B=n.valueMin[1],S=n.valueMax[1],N=n.valueMin[2],D=n.valueMax[2],P=n.valueMin[3]==null?1:n.valueMin[3],L=n.valueMax[3]==null?1:n.valueMax[3],O=[Math.round(E+(k-E)*C),Math.round(B+(S-B)*C),Math.round(N+(D-N)*C),Math.round(P+(L-P)*C)];i={bypass:n.bypass,name:n.name,value:O,strValue:"rgb("+O[0]+", "+O[1]+", "+O[2]+")"}}else if(l.number){var I=n.valueMin+(n.valueMax-n.valueMin)*C;i=this.parse(n.name,I,n.bypass,p)}else return!1;if(!i)return g(),!1;i.mapping=n,n=i;break}case o.data:{for(var _=n.field.split("."),M=f.data,F=0;F<_.length&&M;F++){var V=_[F];M=M[V]}if(M!=null&&(i=this.parse(n.name,M,n.bypass,p)),!i)return g(),!1;i.mapping=n,n=i;break}case o.fn:{var H=n.value,$=n.fnValue!=null?n.fnValue:H(t);if(n.prevFnValue=$,$==null)return Ae("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(n.name,$,n.bypass,p),!i)return Ae("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=br(n),n=i;break}case void 0:break;default:return!1}return u?(d?n.bypassed=c.bypassed:n.bypassed=c,a[n.name]=n):d?c.bypassed=n:a[n.name]=n,h(),!0},Bt.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),!e)n._private.style={};else for(var a=n._private.style,i=Object.keys(a),o=0;o<i.length;o++){var l=i[o],u=a[l];u!=null&&(u.bypass?u.bypassed=null:a[l]=null)}}},Bt.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()},Bt.updateTransitions=function(t,e){var r=this,n=t._private,a=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var l={},u=!1,c=0;c<a.length;c++){var d=a[c],f=t.pstyle(d),p=e[d];if(p){var v=p.prev,h=v,g=p.next!=null?p.next:f,y=!1,m=void 0,b=1e-6;h&&(le(h.pfValue)&&le(g.pfValue)?(y=g.pfValue-h.pfValue,m=h.pfValue+b*y):le(h.value)&&le(g.value)?(y=g.value-h.value,m=h.value+b*y):He(h.value)&&He(g.value)&&(y=h.value[0]!==g.value[0]||h.value[1]!==g.value[1]||h.value[2]!==g.value[2],m=h.strValue),y&&(l[d]=g.strValue,this.applyBypass(t,d,m),u=!0))}}if(!u)return;n.transitioning=!0,new xa(function(w){o>0?t.delayAnimation(o).play().promise().then(w):w()}).then(function(){return t.animation({style:l,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,a),t.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(t,a),t.emitAndNotify("style"),n.transitioning=!1)},Bt.checkTrigger=function(t,e,r,n,a,i){var o=this.properties[e],l=a(o);l!=null&&l(r,n)&&i(o)},Bt.checkZOrderTrigger=function(t,e,r,n){var a=this;this.checkTrigger(t,e,r,n,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",t)})},Bt.checkBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(a){return a.triggersBounds},function(a){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),a.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(r==="bezier"||n==="bezier")&&t.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()}),a.triggersBoundsOfConnectedEdges&&e==="display"&&(r==="none"||n==="none")&&t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},Bt.checkTriggers=function(t,e,r,n){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,n),this.checkBoundsTrigger(t,e,r,n)};var Vi={};Vi.applyBypass=function(t,e,r,n){var a=this,i=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var l=0;l<a.properties.length;l++){var u=a.properties[l],c=u.name,d=this.parse(c,r,!0);d&&i.push(d)}}else if(be(e)){var f=this.parse(e,r,!0);f&&i.push(f)}else if(_e(e)){var p=e;n=r;for(var v=Object.keys(p),h=0;h<v.length;h++){var g=v[h],y=p[g];if(y===void 0&&(y=p[Po(g)]),y!==void 0){var m=this.parse(g,y,!0);m&&i.push(m)}}}else return!1;if(i.length===0)return!1;for(var b=!1,w=0;w<t.length;w++){for(var C=t[w],x={},E=void 0,k=0;k<i.length;k++){var B=i[k];if(n){var S=C.pstyle(B.name);E=x[B.name]={prev:S}}b=this.applyParsedProperty(C,br(B))||b,n&&(E.next=C.pstyle(B.name))}b&&this.updateStyleHints(C),n&&this.updateTransitions(C,x,o)}return b},Vi.overrideBypass=function(t,e,r){e=Hl(e);for(var n=0;n<t.length;n++){var a=t[n],i=a._private.style[e],o=this.properties[e].type,l=o.color,u=o.mutiple,c=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),l?i.strValue="rgb("+r.join(",")+")":u?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(a)),this.checkTriggers(a,e,c,r)}},Vi.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)},Vi.removeBypasses=function(t,e,r){for(var n=!0,a=0;a<t.length;a++){for(var i=t[a],o={},l=0;l<e.length;l++){var u=e[l],c=this.properties[u],d=i.pstyle(c.name);if(!(!d||!d.bypass)){var f="",p=this.parse(u,f,!0),v=o[c.name]={prev:d};this.applyParsedProperty(i,p),v.next=i.pstyle(c.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,o,n)}};var bc={};bc.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1},bc.containerCss=function(t){var e=this._private.cy,r=e.container(),n=e.window();if(n&&r&&n.getComputedStyle)return n.getComputedStyle(r).getPropertyValue(t)};var Cr={};Cr.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)},Cr.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var n={},a=0;a<r.properties.length;a++){var i=r.properties[a],o=r.getStylePropertyValue(t,i.name,e);o!=null&&(n[i.name]=o,n[Po(i.name)]=o)}return n}},Cr.getIndexedStyle=function(t,e,r,n){var a=t.pstyle(e)[r][n];return a??t.cy().style().getDefaultProperty(e)[r][0]},Cr.getStylePropertyValue=function(t,e,r){var n=this;if(t=t[0],t){var a=n.properties[e];a.alias&&(a=a.pointsTo);var i=a.type,o=t.pstyle(a.name);if(o){var l=o.value,u=o.units,c=o.strValue;if(r&&i.number&&l!=null&&le(l)){var d=t.cy().zoom(),f=function(y){return y*d},p=function(y,m){return f(y)+m},v=He(l),h=v?u.every(function(g){return g!=null}):u!=null;return h?v?l.map(function(g,y){return p(g,u[y])}).join(" "):p(l,u):v?l.map(function(g){return be(g)?g:""+f(g)}).join(" "):""+f(l)}else if(c!=null)return c}return null}},Cr.getAnimationStartStyle=function(t,e){for(var r={},n=0;n<e.length;n++){var a=e[n],i=a.name,o=t.pstyle(i);o!==void 0&&(_e(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(r[i]=o)}return r},Cr.getPropsList=function(t){var e=this,r=[],n=t,a=e.properties;if(n)for(var i=Object.keys(n),o=0;o<i.length;o++){var l=i[o],u=n[l],c=a[l]||a[Hl(l)],d=this.parse(c.name,u);d&&r.push(d)}return r},Cr.getNonDefaultPropertiesHash=function(t,e,r){var n=r.slice(),a,i,o,l,u,c;for(u=0;u<e.length;u++)if(a=e[u],i=t.pstyle(a,!1),i!=null)if(i.pfValue!=null)n[0]=Ci(l,n[0]),n[1]=ki(l,n[1]);else for(o=i.strValue,c=0;c<o.length;c++)l=o.charCodeAt(c),n[0]=Ci(l,n[0]),n[1]=ki(l,n[1]);return n},Cr.getPropertiesHash=Cr.getNonDefaultPropertiesHash;var fs={};fs.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var n=t[r],a=n.selector,i=n.style||n.css,o=Object.keys(i);e.selector(a);for(var l=0;l<o.length;l++){var u=o[l],c=i[u];e.css(u,c)}}return e},fs.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e},fs.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],n=r.selector,a=r.properties,i={},o=0;o<a.length;o++){var l=a[o];i[l.name]=l.strValue}t.push({selector:n?n.toString():"core",style:i})}return t};var wc={};wc.appendFromString=function(t){var e=this,r=this,n=""+t,a,i,o;n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");function l(){n.length>a.length?n=n.substr(a.length):n=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var c=n.match(/^\s*$/);if(c)break;var d=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){Ae("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}a=d[0];var f=d[1];if(f!=="core"){var p=new un(f);if(p.invalid){Ae("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),l();continue}}var v=d[2],h=!1;i=v;for(var g=[];;){var y=i.match(/^\s*$/);if(y)break;var m=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){Ae("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+v),h=!0;break}o=m[0];var b=m[1],w=m[2],C=e.properties[b];if(!C){Ae("Skipping property: Invalid property name in: "+o),u();continue}var x=r.parse(b,w);if(!x){Ae("Skipping property: Invalid property definition in: "+o),u();continue}g.push({name:b,val:w}),u()}if(h){l();break}r.selector(f);for(var E=0;E<g.length;E++){var k=g[E];r.css(k.name,k.val)}l()}return r},wc.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var xt={};(function(){var t=lt,e=hT,r=vT,n=gT,a=mT,i=function(A){return"^"+A+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(A){var K=t+"|\\w+|"+e+"|"+r+"|"+n+"|"+a;return"^"+A+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+K+")\\s*\\,\\s*("+K+")\\)$"},l=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];xt.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:l,singleRegexMatchValue:!0},urls:{regexes:l,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(A,K){switch(A.length){case 2:return K[0]!=="deg"&&K[0]!=="rad"&&K[1]!=="deg"&&K[1]!=="rad";case 1:return be(A[0])||K[0]==="deg"||K[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(A){var K=A.length;return K===1||K===2||K===4}}};var u={zeroNonZero:function(A,K){return(A==null||K==null)&&A!==K||A==0&&K!=0?!0:A!=0&&K==0},any:function(A,K){return A!=K},emptyNonEmpty:function(A,K){var W=nn(A),oe=nn(K);return W&&!oe||!W&&oe}},c=xt.types,d=[{name:"label",type:c.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:c.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:c.bidirectionalSize,triggersBounds:u.any}],f=[{name:"source-label",type:c.text,triggersBounds:u.any},{name:"source-text-rotation",type:c.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:c.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:c.size,triggersBounds:u.any}],p=[{name:"target-label",type:c.text,triggersBounds:u.any},{name:"target-text-rotation",type:c.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:c.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:c.size,triggersBounds:u.any}],v=[{name:"font-family",type:c.fontFamily,triggersBounds:u.any},{name:"font-style",type:c.fontStyle,triggersBounds:u.any},{name:"font-weight",type:c.fontWeight,triggersBounds:u.any},{name:"font-size",type:c.size,triggersBounds:u.any},{name:"text-transform",type:c.textTransform,triggersBounds:u.any},{name:"text-wrap",type:c.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:c.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:c.size,triggersBounds:u.any},{name:"text-outline-width",type:c.size,triggersBounds:u.any},{name:"line-height",type:c.positiveNumber,triggersBounds:u.any}],h=[{name:"text-valign",type:c.valign,triggersBounds:u.any},{name:"text-halign",type:c.halign,triggersBounds:u.any},{name:"color",type:c.color},{name:"text-outline-color",type:c.color},{name:"text-outline-opacity",type:c.zeroOneNumber},{name:"text-background-color",type:c.color},{name:"text-background-opacity",type:c.zeroOneNumber},{name:"text-background-padding",type:c.size,triggersBounds:u.any},{name:"text-border-opacity",type:c.zeroOneNumber},{name:"text-border-color",type:c.color},{name:"text-border-width",type:c.size,triggersBounds:u.any},{name:"text-border-style",type:c.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:c.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:c.justification}],g=[{name:"events",type:c.bool,triggersZOrder:u.any},{name:"text-events",type:c.bool,triggersZOrder:u.any}],y=[{name:"display",type:c.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:c.visibility,triggersZOrder:u.any},{name:"opacity",type:c.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:c.zeroOneNumber},{name:"min-zoomed-font-size",type:c.size},{name:"z-compound-depth",type:c.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:c.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:c.number,triggersZOrder:u.any}],m=[{name:"overlay-padding",type:c.size,triggersBounds:u.any},{name:"overlay-color",type:c.color},{name:"overlay-opacity",type:c.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:c.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:c.cornerRadius}],b=[{name:"underlay-padding",type:c.size,triggersBounds:u.any},{name:"underlay-color",type:c.color},{name:"underlay-opacity",type:c.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:c.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:c.cornerRadius}],w=[{name:"transition-property",type:c.propList},{name:"transition-duration",type:c.time},{name:"transition-delay",type:c.time},{name:"transition-timing-function",type:c.easing}],C=function(A,K){return K.value==="label"?-A.poolIndex():K.pfValue},x=[{name:"height",type:c.nodeSize,triggersBounds:u.any,hashOverride:C},{name:"width",type:c.nodeSize,triggersBounds:u.any,hashOverride:C},{name:"shape",type:c.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:c.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:c.cornerRadius},{name:"background-color",type:c.color},{name:"background-fill",type:c.fill},{name:"background-opacity",type:c.zeroOneNumber},{name:"background-blacken",type:c.nOneOneNumber},{name:"background-gradient-stop-colors",type:c.colors},{name:"background-gradient-stop-positions",type:c.percentages},{name:"background-gradient-direction",type:c.gradientDirection},{name:"padding",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:c.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:c.boundsExpansion,triggersBounds:u.any}],E=[{name:"border-color",type:c.color},{name:"border-opacity",type:c.zeroOneNumber},{name:"border-width",type:c.size,triggersBounds:u.any},{name:"border-style",type:c.borderStyle},{name:"border-cap",type:c.lineCap},{name:"border-join",type:c.lineJoin},{name:"border-dash-pattern",type:c.numbers},{name:"border-dash-offset",type:c.number},{name:"border-position",type:c.linePosition}],k=[{name:"outline-color",type:c.color},{name:"outline-opacity",type:c.zeroOneNumber},{name:"outline-width",type:c.size,triggersBounds:u.any},{name:"outline-style",type:c.borderStyle},{name:"outline-offset",type:c.size,triggersBounds:u.any}],B=[{name:"background-image",type:c.urls},{name:"background-image-crossorigin",type:c.bgCrossOrigin},{name:"background-image-opacity",type:c.zeroOneNumbers},{name:"background-image-containment",type:c.bgContainment},{name:"background-image-smoothing",type:c.bools},{name:"background-position-x",type:c.bgPos},{name:"background-position-y",type:c.bgPos},{name:"background-width-relative-to",type:c.bgRelativeTo},{name:"background-height-relative-to",type:c.bgRelativeTo},{name:"background-repeat",type:c.bgRepeat},{name:"background-fit",type:c.bgFit},{name:"background-clip",type:c.bgClip},{name:"background-width",type:c.bgWH},{name:"background-height",type:c.bgWH},{name:"background-offset-x",type:c.bgPos},{name:"background-offset-y",type:c.bgPos}],S=[{name:"position",type:c.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:c.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:c.size,triggersBounds:u.any},{name:"min-width-bias-left",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:c.size,triggersBounds:u.any},{name:"min-height-bias-top",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:c.sizeMaybePercent,triggersBounds:u.any}],N=[{name:"line-style",type:c.lineStyle},{name:"line-color",type:c.color},{name:"line-fill",type:c.fill},{name:"line-cap",type:c.lineCap},{name:"line-opacity",type:c.zeroOneNumber},{name:"line-dash-pattern",type:c.numbers},{name:"line-dash-offset",type:c.number},{name:"line-outline-width",type:c.size},{name:"line-outline-color",type:c.color},{name:"line-gradient-stop-colors",type:c.colors},{name:"line-gradient-stop-positions",type:c.percentages},{name:"curve-style",type:c.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:c.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:c.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:c.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:c.size,triggersBounds:u.any},{name:"control-point-distances",type:c.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:c.numbers,triggersBounds:u.any},{name:"segment-distances",type:c.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:c.numbers,triggersBounds:u.any},{name:"segment-radii",type:c.numbers,triggersBounds:u.any},{name:"radius-type",type:c.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:c.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:c.size,triggersBounds:u.any},{name:"taxi-direction",type:c.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:c.number,triggersBounds:u.any},{name:"edge-distances",type:c.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:c.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:c.angle,triggersBounds:u.any},{name:"loop-sweep",type:c.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:c.size,triggersBounds:u.any},{name:"target-distance-from-node",type:c.size,triggersBounds:u.any}],D=[{name:"ghost",type:c.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:c.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:c.zeroOneNumber}],P=[{name:"selection-box-color",type:c.color},{name:"selection-box-opacity",type:c.zeroOneNumber},{name:"selection-box-border-color",type:c.color},{name:"selection-box-border-width",type:c.size},{name:"active-bg-color",type:c.color},{name:"active-bg-opacity",type:c.zeroOneNumber},{name:"active-bg-size",type:c.size},{name:"outside-texture-bg-color",type:c.color},{name:"outside-texture-bg-opacity",type:c.zeroOneNumber}],L=[];xt.pieBackgroundN=16,L.push({name:"pie-size",type:c.sizeMaybePercent});for(var O=1;O<=xt.pieBackgroundN;O++)L.push({name:"pie-"+O+"-background-color",type:c.color}),L.push({name:"pie-"+O+"-background-size",type:c.percent}),L.push({name:"pie-"+O+"-background-opacity",type:c.zeroOneNumber});var I=[],_=xt.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:c.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:c.color},{name:"arrow-fill",type:c.arrowFill},{name:"arrow-width",type:c.arrowWidth}].forEach(function(Y){_.forEach(function(A){var K=A+"-"+Y.name,W=Y.type,oe=Y.triggersBounds;I.push({name:K,type:W,triggersBounds:oe})})},{});var M=xt.properties=[].concat(g,w,y,m,b,D,h,v,d,f,p,x,E,k,B,L,S,N,I,P),F=xt.propertyGroups={behavior:g,transition:w,visibility:y,overlay:m,underlay:b,ghost:D,commonLabel:h,labelDimensions:v,mainLabel:d,sourceLabel:f,targetLabel:p,nodeBody:x,nodeBorder:E,nodeOutline:k,backgroundImage:B,pie:L,compound:S,edgeLine:N,edgeArrow:I,core:P},V=xt.propertyGroupNames={},H=xt.propertyGroupKeys=Object.keys(F);H.forEach(function(Y){V[Y]=F[Y].map(function(A){return A.name}),F[Y].forEach(function(A){return A.groupKey=Y})});var $=xt.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"}];xt.propertyNames=M.map(function(Y){return Y.name});for(var z=0;z<M.length;z++){var j=M[z];M[j.name]=j}for(var ee=0;ee<$.length;ee++){var J=$[ee],Z=M[J.pointsTo],re={name:J.name,alias:!0,pointsTo:Z};M.push(re),M[J.name]=re}})(),xt.getDefaultProperty=function(t){return this.getDefaultProperties()[t]},xt.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=xe({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,c){for(var d=1;d<=xt.pieBackgroundN;d++){var f=c.name.replace("{{i}}",d),p=c.value;u[f]=p}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,c){return xt.arrowPrefixes.forEach(function(d){var f=d+"-"+c.name,p=c.value;u[f]=p}),u},{})),r={},n=0;n<this.properties.length;n++){var a=this.properties[n];if(!a.pointsTo){var i=a.name,o=e[i],l=this.parse(i,o);r[i]=l}}return t.defaultProperties=r,t.defaultProperties},xt.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 hs={};hs.parse=function(t,e,r,n){var a=this;if(Ye(e))return a.parseImplWarn(t,e,r,n);var i=n==="mapping"||n===!0||n===!1||n==null?"dontcare":n,o=r?"t":"f",l=""+e,u=Mh(t,l,o,i),c=a.propCache=a.propCache||[],d;return(d=c[u])||(d=c[u]=a.parseImplWarn(t,e,r,n)),(r||n==="mapping")&&(d=br(d),d&&(d.value=br(d.value))),d},hs.parseImplWarn=function(t,e,r,n){var a=this.parseImpl(t,e,r,n);return!a&&e!=null&&Ae("The style property `".concat(t,": ").concat(e,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&e==="label"&&Ae("The style value of `label` is deprecated for `"+a.name+"`"),a},hs.parseImpl=function(t,e,r,n){var a=this;t=Hl(t);var i=a.properties[t],o=e,l=a.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var u=be(e);u&&(e=e.trim());var c=i.type;if(!c)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(Ye(e))return{name:t,value:e,strValue:"fn",mapped:l.fn,bypass:r};var d,f;if(!(!u||n||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(d=new RegExp(l.data.regex).exec(e))){if(r)return!1;var p=l.data;return{name:t,value:d,strValue:""+e,mapped:p,field:d[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(l.mapData.regex).exec(e))){if(r||c.multiple)return!1;var v=l.mapData;if(!(c.color||c.number))return!1;var h=this.parse(t,f[4]);if(!h||h.mapped)return!1;var g=this.parse(t,f[5]);if(!g||g.mapped)return!1;if(h.pfValue===g.pfValue||h.strValue===g.strValue)return Ae("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+h.strValue+"`"),this.parse(t,h.strValue);if(c.color){var y=h.value,m=g.value,b=y[0]===m[0]&&y[1]===m[1]&&y[2]===m[2]&&(y[3]===m[3]||(y[3]==null||y[3]===1)&&(m[3]==null||m[3]===1));if(b)return!1}return{name:t,value:f,strValue:""+e,mapped:v,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:h.value,valueMax:g.value,bypass:r}}}if(c.multiple&&n!=="multiple"){var w;if(u?w=e.split(/\s+/):He(e)?w=e:w=[e],c.evenMultiple&&w.length%2!==0)return null;for(var C=[],x=[],E=[],k="",B=!1,S=0;S<w.length;S++){var N=a.parse(t,w[S],r,"multiple");B=B||be(N.value),C.push(N.value),E.push(N.pfValue!=null?N.pfValue:N.value),x.push(N.units),k+=(S>0?" ":"")+N.strValue}return c.validate&&!c.validate(C,x)?null:c.singleEnum&&B?C.length===1&&be(C[0])?{name:t,value:C[0],strValue:C[0],bypass:r}:null:{name:t,value:C,pfValue:E,strValue:k,bypass:r,units:x}}var D=function(){for(var A=0;A<c.enums.length;A++){var K=c.enums[A];if(K===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(c.number){var P,L="px";if(c.units&&(P=c.units),c.implicitUnits&&(L=c.implicitUnits),!c.unitless)if(u){var O="px|em"+(c.allowPercent?"|\\%":"");P&&(O=P);var I=e.match("^("+lt+")("+O+")?$");I&&(e=I[1],P=I[2]||L)}else(!P||c.implicitUnits)&&(P=L);if(e=parseFloat(e),isNaN(e)&&c.enums===void 0)return null;if(isNaN(e)&&c.enums!==void 0)return e=o,D();if(c.integer&&!oT(e)||c.min!==void 0&&(e<c.min||c.strictMin&&e===c.min)||c.max!==void 0&&(e>c.max||c.strictMax&&e===c.max))return null;var _={name:t,value:e,strValue:""+e+(P||""),units:P,bypass:r};return c.unitless||P!=="px"&&P!=="em"?_.pfValue=e:_.pfValue=P==="px"||!P?e:this.getEmSizeInPixels()*e,(P==="ms"||P==="s")&&(_.pfValue=P==="ms"?e:1e3*e),(P==="deg"||P==="rad")&&(_.pfValue=P==="rad"?e:$B(e)),P==="%"&&(_.pfValue=e/100),_}else if(c.propList){var M=[],F=""+e;if(F!=="none"){for(var V=F.split(/\s*,\s*|\s+/),H=0;H<V.length;H++){var $=V[H].trim();a.properties[$]?M.push($):Ae("`"+$+"` is not a valid property name")}if(M.length===0)return null}return{name:t,value:M,strValue:M.length===0?"none":M.join(" "),bypass:r}}else if(c.color){var z=xT(e);return z?{name:t,value:z,pfValue:z,strValue:"rgb("+z[0]+","+z[1]+","+z[2]+")",bypass:r}:null}else if(c.regex||c.regexes){if(c.enums){var j=D();if(j)return j}for(var ee=c.regexes?c.regexes:[c.regex],J=0;J<ee.length;J++){var Z=new RegExp(ee[J]),re=Z.exec(e);if(re)return{name:t,value:c.singleRegexMatchValue?re[1]:re,strValue:""+e,bypass:r}}return null}else return c.string?{name:t,value:""+e,strValue:""+e,bypass:r}:c.enums?D():null};var Nt=function t(e){if(!(this instanceof t))return new t(e);if(!zl(e)){Xe("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Dt=Nt.prototype;Dt.instanceString=function(){return"style"},Dt.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this},Dt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Dt.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)},Dt.selector=function(t){var e=t==="core"?null:new un(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this},Dt.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],n=0;n<t.properties.length;n++){var a=t.properties[n],i=r[a.name];i===void 0&&(i=r[Po(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this},Dt.style=Dt.css,Dt.cssRule=function(t,e){var r=this.parse(t,e);if(r){var n=this.length-1;this[n].properties.push(r),this[n].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.mapped&&this[n].mappedProperties.push(r);var a=!this[n].selector;a&&(this._private.coreStyle[r.name]=r)}return this},Dt.append=function(t){return Ch(t)?t.appendToStyle(this):He(t)?this.appendFromJson(t):be(t)&&this.appendFromString(t),this},Nt.fromJson=function(t,e){var r=new Nt(t);return r.fromJson(e),r},Nt.fromString=function(t,e){return new Nt(t).fromString(e)},[Bt,Vi,bc,Cr,fs,wc,xt,hs].forEach(function(t){xe(Dt,t)}),Nt.types=Dt.types,Nt.properties=Dt.properties,Nt.propertyGroups=Dt.propertyGroups,Nt.propertyGroupNames=Dt.propertyGroupNames,Nt.propertyGroupKeys=Dt.propertyGroupKeys;var oD={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return Ch(e)?r.style=e.generateStyle(this):He(e)?r.style=Nt.fromJson(this,e):be(e)?r.style=Nt.fromString(this,e):r.style=Nt(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},sD="single",Hn={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=sD),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,n,a,i,o,l;switch(e.length){case 0:return r;case 1:if(be(e[0]))return n=e[0],r[n];if(_e(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,l=i.y,le(o)&&(r.x=o),le(l)&&(r.y=l),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],a=e[1],(n==="x"||n==="y")&&le(a)&&(r[n]=a),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var n=arguments,a=this._private.pan,i,o,l,u,c;if(!this._private.panningEnabled)return this;switch(n.length){case 1:_e(e)&&(l=n[0],u=l.x,c=l.y,le(u)&&(a.x+=u),le(c)&&(a.y+=c),this.emit("pan viewport"));break;case 2:i=e,o=r,(i==="x"||i==="y")&&le(o)&&(a[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},fit:function(e,r){var n=this.getFitViewport(e,r);if(n){var a=this._private;a.zoom=n.zoom,a.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(le(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(be(e)){var a=e;e=this.$(a)}else if(cT(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else Ut(e)||(e=this.mutableElements());if(!(Ut(e)&&e.empty())){n=n||e.boundingBox();var o=this.width(),l=this.height(),u;if(r=le(r)?r:0,!isNaN(o)&&!isNaN(l)&&o>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){u=Math.min((o-2*r)/n.w,(l-2*r)/n.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var c={x:(o-u*(n.x1+n.x2))/2,y:(l-u*(n.y1+n.y2))/2};return{zoom:u,pan:c}}}}},zoomRange:function(e,r){var n=this._private;if(r==null){var a=e;e=a.min,r=a.max}return le(e)&&le(r)&&e<=r?(n.minZoom=e,n.maxZoom=r):le(e)&&r===void 0&&e<=n.maxZoom?n.minZoom=e:le(r)&&e===void 0&&r>=n.minZoom&&(n.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,n=r.pan,a=r.zoom,i,o,l=!1;if(r.zoomingEnabled||(l=!0),le(e)?o=e:_e(e)&&(o=e.level,e.position!=null?i=Ao(e.position,a,n):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(l=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,l||!le(o)||o===a||i!=null&&(!le(i.x)||!le(i.y)))return null;if(i!=null){var u=n,c=a,d=o,f={x:-d/c*(i.x-u.x)+i.x,y:-d/c*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:d,pan:f}}else return{zoomed:!0,panned:!1,zoom:o,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),n=this._private;return r==null||!r.zoomed?this:(n.zoom=r.zoom,r.panned&&(n.pan.x=r.pan.x,n.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,n=!0,a=!0,i=[],o=!1,l=!1;if(!e)return this;if(le(e.zoom)||(n=!1),_e(e.pan)||(a=!1),!n&&!a)return this;if(n){var u=e.zoom;u<r.minZoom||u>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=u,i.push("zoom"))}if(a&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var c=e.pan;le(c.x)&&(r.pan.x=c.x,l=!1),le(c.y)&&(r.pan.y=c.y,l=!1),l||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(be(e)){var n=e;e=this.mutableElements().filter(n)}else Ut(e)||(e=this.mutableElements());if(e.length!==0){var a=e.boundingBox(),i=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var l={x:(i-r*(a.x1+a.x2))/2,y:(o-r*(a.y1+a.y2))/2};return l}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,n=this;return e.sizeCache=e.sizeCache||(r?function(){var a=n.window().getComputedStyle(r),i=function(l){return parseFloat(a.getPropertyValue(l))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,n=this.renderedExtent(),a={x1:(n.x1-e.x)/r,x2:(n.x2-e.x)/r,y1:(n.y1-e.y)/r,y2:(n.y2-e.y)/r};return a.w=a.x2-a.x1,a.h=a.y2-a.y1,a},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Hn.centre=Hn.center,Hn.autolockNodes=Hn.autolock,Hn.autoungrabifyNodes=Hn.autoungrabify;var Ri={data:Ve.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ve.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ve.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ve.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ri.attr=Ri.data,Ri.removeAttr=Ri.removeData;var $i=function(e){var r=this;e=xe({},e);var n=e.container;n&&!Do(n)&&Do(n[0])&&(n=n[0]);var a=n?n._cyreg:null;a=a||{},a&&a.cy&&(a.cy.destroy(),a={});var i=a.readies=a.readies||[];n&&(n._cyreg=a),a.cy=r;var o=st!==void 0&&n!==void 0&&!e.headless,l=e;l.layout=xe({name:o?"grid":"null"},l.layout),l.renderer=xe({name:o?"canvas":"null"},l.renderer);var u=function(h,g,y){return g!==void 0?g:y!==void 0?y:h},c=this._private={container:n,ready:!1,options:l,elements:new kt(this),listeners:[],aniEles:new kt(this),data:l.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,l.zoomingEnabled),userZoomingEnabled:u(!0,l.userZoomingEnabled),panningEnabled:u(!0,l.panningEnabled),userPanningEnabled:u(!0,l.userPanningEnabled),boxSelectionEnabled:u(!0,l.boxSelectionEnabled),autolock:u(!1,l.autolock,l.autolockNodes),autoungrabify:u(!1,l.autoungrabify,l.autoungrabifyNodes),autounselectify:u(!1,l.autounselectify),styleEnabled:l.styleEnabled===void 0?o:l.styleEnabled,zoom:le(l.zoom)?l.zoom:1,pan:{x:_e(l.pan)&&le(l.pan.x)?l.pan.x:0,y:_e(l.pan)&&le(l.pan.y)?l.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,l.multiClickDebounceTime)};this.createEmitter(),this.selectionType(l.selectionType),this.zoomRange({min:l.minZoom,max:l.maxZoom});var d=function(h,g){var y=h.some(uT);if(y)return xa.all(h).then(g);g(h)};c.styleEnabled&&r.setStyle([]);var f=xe({},l,l.renderer);r.initRenderer(f);var p=function(h,g,y){r.notifications(!1);var m=r.mutableElements();m.length>0&&m.remove(),h!=null&&(_e(h)||He(h))&&r.add(h),r.one("layoutready",function(w){r.notifications(!0),r.emit(w),r.one("load",g),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",y),r.emit("done")});var b=xe({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};d([l.style,l.elements],function(v){var h=v[0],g=v[1];c.styleEnabled&&r.style().append(h),p(g,function(){r.startAnimationLoop(),c.ready=!0,Ye(l.ready)&&r.on("ready",l.ready);for(var y=0;y<i.length;y++){var m=i[y];r.on("ready",m)}a&&(a.readies=[]),r.emit("ready")},l.done)})},ps=$i.prototype;xe(ps,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return st;var r=this._private.container.ownerDocument;return r===void 0||r==null?st:r.defaultView||st},mount:function(e){if(e!=null){var r=this,n=r._private,a=n.options;return!Do(e)&&Do(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),n.container=e,n.styleEnabled=!0,r.invalidateSize(),r.initRenderer(xe({},a,a.renderer,{name:a.renderer.name==="null"?"canvas":a.renderer.name})),r.startAnimationLoop(),r.style(a.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return br(this._private.options)},json:function(e){var r=this,n=r._private,a=r.mutableElements(),i=function(C){return r.getElementById(C.id())};if(_e(e)){if(r.startBatch(),e.elements){var o={},l=function(C,x){for(var E=[],k=[],B=0;B<C.length;B++){var S=C[B];if(!S.data.id){Ae("cy.json() cannot handle elements without an ID attribute");continue}var N=""+S.data.id,D=r.getElementById(N);o[N]=!0,D.length!==0?k.push({ele:D,json:S}):(x&&(S.group=x),E.push(S))}r.add(E);for(var P=0;P<k.length;P++){var L=k[P],O=L.ele,I=L.json;O.json(I)}};if(He(e.elements))l(e.elements);else for(var u=["nodes","edges"],c=0;c<u.length;c++){var d=u[c],f=e.elements[d];He(f)&&l(f,d)}var p=r.collection();a.filter(function(w){return!o[w.id()]}).forEach(function(w){w.isParent()?p.merge(w):w.remove()}),p.forEach(function(w){return w.children().move({parent:null})}),p.forEach(function(w){return i(w).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var v=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<v.length;h++){var g=v[h];e[g]!=null&&r[g](e[g])}return r.endBatch(),this}else{var y=!!e,m={};y?m.elements=this.elements().map(function(w){return w.json()}):(m.elements={},a.forEach(function(w){var C=w.group();m.elements[C]||(m.elements[C]=[]),m.elements[C].push(w.json())})),this._private.styleEnabled&&(m.style=r.style().json()),m.data=br(r.data());var b=n.options;return m.zoomingEnabled=n.zoomingEnabled,m.userZoomingEnabled=n.userZoomingEnabled,m.zoom=n.zoom,m.minZoom=n.minZoom,m.maxZoom=n.maxZoom,m.panningEnabled=n.panningEnabled,m.userPanningEnabled=n.userPanningEnabled,m.pan=br(n.pan),m.boxSelectionEnabled=n.boxSelectionEnabled,m.renderer=br(b.renderer),m.hideEdgesOnViewport=b.hideEdgesOnViewport,m.textureOnViewport=b.textureOnViewport,m.wheelSensitivity=b.wheelSensitivity,m.motionBlur=b.motionBlur,m.multiClickDebounceTime=b.multiClickDebounceTime,m}}}),ps.$id=ps.getElementById,[X3,tD,hv,mc,us,nD,yc,ds,oD,Hn,Ri].forEach(function(t){xe(ps,t)});var lD={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},cD={maximal:!1,acyclic:!1},Fa=function(e){return e.scratch("breadthfirst")},pv=function(e,r){return e.scratch("breadthfirst",r)};function vv(t){this.options=xe({},lD,cD,t)}vv.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,a=n.nodes().filter(function(ne){return!ne.isParent()}),i=n,o=e.directed,l=e.acyclic||e.maximal||e.maximalAdjustments>0,u=zt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),c;if(Ut(e.roots))c=e.roots;else if(He(e.roots)){for(var d=[],f=0;f<e.roots.length;f++){var p=e.roots[f],v=r.getElementById(p);d.push(v)}c=r.collection(d)}else if(be(e.roots))c=r.$(e.roots);else if(o)c=a.roots();else{var h=n.components();c=r.collection();for(var g=function(se){var ue=h[se],pe=ue.maxDegree(!1),de=ue.filter(function(me){return me.degree(!1)===pe});c=c.add(de)},y=0;y<h.length;y++)g(y)}var m=[],b={},w=function(se,ue){m[ue]==null&&(m[ue]=[]);var pe=m[ue].length;m[ue].push(se),pv(se,{index:pe,depth:ue})},C=function(se,ue){var pe=Fa(se),de=pe.depth,me=pe.index;m[de][me]=null,w(se,ue)};i.bfs({roots:c,directed:e.directed,visit:function(se,ue,pe,de,me){var Ne=se[0],De=Ne.id();w(Ne,me),b[De]=!0}});for(var x=[],E=0;E<a.length;E++){var k=a[E];b[k.id()]||x.push(k)}var B=function(se){for(var ue=m[se],pe=0;pe<ue.length;pe++){var de=ue[pe];if(de==null){ue.splice(pe,1),pe--;continue}pv(de,{depth:se,index:pe})}},S=function(){for(var se=0;se<m.length;se++)B(se)},N=function(se,ue){for(var pe=Fa(se),de=se.incomers().filter(function(T){return T.isNode()&&n.has(T)}),me=-1,Ne=se.id(),De=0;De<de.length;De++){var Ee=de[De],Pe=Fa(Ee);me=Math.max(me,Pe.depth)}if(pe.depth<=me){if(!e.acyclic&&ue[Ne])return null;var te=me+1;return C(se,te),ue[Ne]=te,!0}return!1};if(o&&l){var D=[],P={},L=function(se){return D.push(se)},O=function(){return D.shift()};for(a.forEach(function(ne){return D.push(ne)});D.length>0;){var I=O(),_=N(I,P);if(_)I.outgoers().filter(function(ne){return ne.isNode()&&n.has(ne)}).forEach(L);else if(_===null){Ae("Detected double maximal shift for node `"+I.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}S();var M=0;if(e.avoidOverlap)for(var F=0;F<a.length;F++){var V=a[F],H=V.layoutDimensions(e),$=H.w,z=H.h;M=Math.max(M,$,z)}var j={},ee=function(se){if(j[se.id()])return j[se.id()];for(var ue=Fa(se).depth,pe=se.neighborhood(),de=0,me=0,Ne=0;Ne<pe.length;Ne++){var De=pe[Ne];if(!(De.isEdge()||De.isParent()||!a.has(De))){var Ee=Fa(De);if(Ee!=null){var Pe=Ee.index,te=Ee.depth;if(!(Pe==null||te==null)){var T=m[te].length;te<ue&&(de+=Pe/T,me++)}}}}return me=Math.max(1,me),de=de/me,me===0&&(de=0),j[se.id()]=de,de},J=function(se,ue){var pe=ee(se),de=ee(ue),me=pe-de;return me===0?Eh(se.id(),ue.id()):me};e.depthSort!==void 0&&(J=e.depthSort);for(var Z=0;Z<m.length;Z++)m[Z].sort(J),B(Z);for(var re=[],Y=0;Y<x.length;Y++)re.push(x[Y]);m.unshift(re),S();for(var A=0,K=0;K<m.length;K++)A=Math.max(m[K].length,A);var W={x:u.x1+u.w/2,y:u.x1+u.h/2},oe=m.reduce(function(ne,se){return Math.max(ne,se.length)},0),he=function(se){var ue=Fa(se),pe=ue.depth,de=ue.index,me=m[pe].length,Ne=Math.max(u.w/((e.grid?oe:me)+1),M),De=Math.max(u.h/(m.length+1),M),Ee=Math.min(u.w/2/m.length,u.h/2/m.length);if(Ee=Math.max(Ee,M),e.circle){var te=Ee*pe+Ee-(m.length>0&&m[0].length<=3?Ee/2:0),T=2*Math.PI/m[pe].length*de;return pe===0&&m[0].length===1&&(te=1),{x:W.x+te*Math.cos(T),y:W.y+te*Math.sin(T)}}else{var Pe={x:W.x+(de+1-(me+1)/2)*Ne,y:(pe+1)*De};return Pe}};return n.nodes().layoutPositions(this,e,he),this};var uD={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function gv(t){this.options=xe({},uD,t)}gv.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,a=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=zt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l={x:o.x1+o.w/2,y:o.y1+o.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,c=u/Math.max(1,i.length-1),d,f=0,p=0;p<i.length;p++){var v=i[p],h=v.layoutDimensions(e),g=h.w,y=h.h;f=Math.max(f,g,y)}if(le(e.radius)?d=e.radius:i.length<=1?d=0:d=Math.min(o.h,o.w)/2-f,i.length>1&&e.avoidOverlap){f*=1.75;var m=Math.cos(c)-Math.cos(0),b=Math.sin(c)-Math.sin(0),w=Math.sqrt(f*f/(m*m+b*b));d=Math.max(w,d)}var C=function(E,k){var B=e.startAngle+k*c*(a?1:-1),S=d*Math.cos(B),N=d*Math.sin(B),D={x:l.x+S,y:l.y+N};return D};return n.nodes().layoutPositions(this,e,C),this};var dD={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function mv(t){this.options=xe({},dD,t)}mv.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,n=t.cy,a=e.eles,i=a.nodes().not(":parent"),o=zt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],c=0,d=0;d<i.length;d++){var f=i[d],p=void 0;p=e.concentric(f),u.push({value:p,node:f}),f._private.scratch.concentric=p}i.updateStyle();for(var v=0;v<i.length;v++){var h=i[v],g=h.layoutDimensions(e);c=Math.max(c,g.w,g.h)}u.sort(function(ne,se){return se.value-ne.value});for(var y=e.levelWidth(i),m=[[]],b=m[0],w=0;w<u.length;w++){var C=u[w];if(b.length>0){var x=Math.abs(b[0].value-C.value);x>=y&&(b=[],m.push(b))}b.push(C)}var E=c+e.minNodeSpacing;if(!e.avoidOverlap){var k=m.length>0&&m[0].length>1,B=Math.min(o.w,o.h)/2-E,S=B/(m.length+k?1:0);E=Math.min(E,S)}for(var N=0,D=0;D<m.length;D++){var P=m[D],L=e.sweep===void 0?2*Math.PI-2*Math.PI/P.length:e.sweep,O=P.dTheta=L/Math.max(1,P.length-1);if(P.length>1&&e.avoidOverlap){var I=Math.cos(O)-Math.cos(0),_=Math.sin(O)-Math.sin(0),M=Math.sqrt(E*E/(I*I+_*_));N=Math.max(M,N)}P.r=N,N+=E}if(e.equidistant){for(var F=0,V=0,H=0;H<m.length;H++){var $=m[H],z=$.r-V;F=Math.max(F,z)}V=0;for(var j=0;j<m.length;j++){var ee=m[j];j===0&&(V=ee.r),ee.r=V,V+=F}}for(var J={},Z=0;Z<m.length;Z++)for(var re=m[Z],Y=re.dTheta,A=re.r,K=0;K<re.length;K++){var W=re[K],oe=e.startAngle+(r?1:-1)*Y*K,he={x:l.x+A*Math.cos(oe),y:l.y+A*Math.sin(oe)};J[W.node.id()]=he}return a.nodes().layoutPositions(this,e,function(ne){var se=ne.id();return J[se]}),this};var Cc,fD={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function vs(t){this.options=xe({},fD,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(a){var i=a.source().data("id"),o=a.target().data("id"),l=e.some(function(c){return c.data("id")===i}),u=e.some(function(c){return c.data("id")===o});return!l||!u});this.options.eles=this.options.eles.not(n)}vs.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?Cc=!0:Cc=!1;var n=hD(e,r,t);Cc&&gD(n),t.randomize&&mD(n);var a=Vr(),i=function(){yD(n,e,t),t.fit===!0&&e.fit(t.padding)},o=function(p){return!(r.stopped||p>=t.numIter||(bD(n,t),n.temperature=n.temperature*t.coolingFactor,n.temperature<t.minTemp))},l=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var p=t.eles.nodes(),v=yv(n,t,p);p.layoutPositions(r,t,v)}},u=0,c=!0;if(t.animate===!0){var d=function f(){for(var p=0;c&&p<t.refresh;)c=o(u),u++,p++;if(!c)wv(n,t),l();else{var v=Vr();v-a>=t.animationThreshold&&i(),Lo(f)}};d()}else{for(;c;)c=o(u),u++;wv(n,t),l()}return this},vs.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},vs.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var hD=function(e,r,n){for(var a=n.eles.edges(),i=n.eles.nodes(),o=zt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),l={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=n.eles.components(),c={},d=0;d<u.length;d++)for(var f=u[d],p=0;p<f.length;p++){var v=f[p];c[v.id()]=d}for(var d=0;d<l.nodeSize;d++){var h=i[d],g=h.layoutDimensions(n),y={};y.isLocked=h.locked(),y.id=h.data("id"),y.parentId=h.data("parent"),y.cmptId=c[h.id()],y.children=[],y.positionX=h.position("x"),y.positionY=h.position("y"),y.offsetX=0,y.offsetY=0,y.height=g.w,y.width=g.h,y.maxX=y.positionX+y.width/2,y.minX=y.positionX-y.width/2,y.maxY=y.positionY+y.height/2,y.minY=y.positionY-y.height/2,y.padLeft=parseFloat(h.style("padding")),y.padRight=parseFloat(h.style("padding")),y.padTop=parseFloat(h.style("padding")),y.padBottom=parseFloat(h.style("padding")),y.nodeRepulsion=Ye(n.nodeRepulsion)?n.nodeRepulsion(h):n.nodeRepulsion,l.layoutNodes.push(y),l.idToIndex[y.id]=d}for(var m=[],b=0,w=-1,C=[],d=0;d<l.nodeSize;d++){var h=l.layoutNodes[d],x=h.parentId;x!=null?l.layoutNodes[l.idToIndex[x]].children.push(h.id):(m[++w]=h.id,C.push(h.id))}for(l.graphSet.push(C);b<=w;){var E=m[b++],k=l.idToIndex[E],v=l.layoutNodes[k],B=v.children;if(B.length>0){l.graphSet.push(B);for(var d=0;d<B.length;d++)m[++w]=B[d]}}for(var d=0;d<l.graphSet.length;d++)for(var S=l.graphSet[d],p=0;p<S.length;p++){var N=l.idToIndex[S[p]];l.indexToGraph[N]=d}for(var d=0;d<l.edgeSize;d++){var D=a[d],P={};P.id=D.data("id"),P.sourceId=D.data("source"),P.targetId=D.data("target");var L=Ye(n.idealEdgeLength)?n.idealEdgeLength(D):n.idealEdgeLength,O=Ye(n.edgeElasticity)?n.edgeElasticity(D):n.edgeElasticity,I=l.idToIndex[P.sourceId],_=l.idToIndex[P.targetId],M=l.indexToGraph[I],F=l.indexToGraph[_];if(M!=F){for(var V=pD(P.sourceId,P.targetId,l),H=l.graphSet[V],$=0,y=l.layoutNodes[I];H.indexOf(y.id)===-1;)y=l.layoutNodes[l.idToIndex[y.parentId]],$++;for(y=l.layoutNodes[_];H.indexOf(y.id)===-1;)y=l.layoutNodes[l.idToIndex[y.parentId]],$++;L*=$*n.nestingFactor}P.idealLength=L,P.elasticity=O,l.layoutEdges.push(P)}return l},pD=function(e,r,n){var a=vD(e,r,0,n);return 2>a.count?0:a.graph},vD=function t(e,r,n,a){var i=a.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:n};for(var o=0,l=0;l<i.length;l++){var u=i[l],c=a.idToIndex[u],d=a.layoutNodes[c].children;if(d.length!==0){var f=a.indexToGraph[a.idToIndex[d[0]]],p=t(e,r,f,a);if(p.count!==0)if(p.count===1){if(o++,o===2)break}else return p}}return{count:o,graph:n}},gD,mD=function(e,r){for(var n=e.clientWidth,a=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*n,o.positionY=Math.random()*a)}},yv=function(e,r,n){var a=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(n.forEach(function(o){var l=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,l.positionX),i.x2=Math.max(i.x2,l.positionX),i.y1=Math.min(i.y1,l.positionY),i.y2=Math.max(i.y2,l.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,l){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var c=(u.positionX-i.x1)/i.w,d=(u.positionY-i.y1)/i.h;return{x:a.x1+c*a.w,y:a.y1+d*a.h}}else return{x:u.positionX,y:u.positionY}}},yD=function(e,r,n){var a=n.layout,i=n.eles.nodes(),o=yv(e,n,i);i.positions(o),e.ready!==!0&&(e.ready=!0,a.one("layoutready",n.ready),a.emit({type:"layoutready",layout:this}))},bD=function(e,r,n){wD(e,r),xD(e),ED(e,r),SD(e),TD(e)},wD=function(e,r){for(var n=0;n<e.graphSet.length;n++)for(var a=e.graphSet[n],i=a.length,o=0;o<i;o++)for(var l=e.layoutNodes[e.idToIndex[a[o]]],u=o+1;u<i;u++){var c=e.layoutNodes[e.idToIndex[a[u]]];CD(l,c,e,r)}},bv=function(e){return-e+2*e*Math.random()},CD=function(e,r,n,a){var i=e.cmptId,o=r.cmptId;if(!(i!==o&&!n.isCompound)){var l=r.positionX-e.positionX,u=r.positionY-e.positionY,c=1;l===0&&u===0&&(l=bv(c),u=bv(c));var d=kD(e,r,l,u);if(d>0)var f=a.nodeOverlap*d,p=Math.sqrt(l*l+u*u),v=f*l/p,h=f*u/p;else var g=gs(e,l,u),y=gs(r,-1*l,-1*u),m=y.x-g.x,b=y.y-g.y,w=m*m+b*b,p=Math.sqrt(w),f=(e.nodeRepulsion+r.nodeRepulsion)/w,v=f*m/p,h=f*b/p;e.isLocked||(e.offsetX-=v,e.offsetY-=h),r.isLocked||(r.offsetX+=v,r.offsetY+=h)}},kD=function(e,r,n,a){if(n>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(a>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},gs=function(e,r,n){var a=e.positionX,i=e.positionY,o=e.height||1,l=e.width||1,u=n/r,c=o/l,d={};return r===0&&0<n||r===0&&0>n?(d.x=a,d.y=i+o/2,d):0<r&&-1*c<=u&&u<=c?(d.x=a+l/2,d.y=i+l*n/2/r,d):0>r&&-1*c<=u&&u<=c?(d.x=a-l/2,d.y=i-l*n/2/r,d):0<n&&(u<=-1*c||u>=c)?(d.x=a+o*r/2/n,d.y=i+o/2,d):(0>n&&(u<=-1*c||u>=c)&&(d.x=a-o*r/2/n,d.y=i-o/2),d)},xD=function(e,r){for(var n=0;n<e.edgeSize;n++){var a=e.layoutEdges[n],i=e.idToIndex[a.sourceId],o=e.layoutNodes[i],l=e.idToIndex[a.targetId],u=e.layoutNodes[l],c=u.positionX-o.positionX,d=u.positionY-o.positionY;if(!(c===0&&d===0)){var f=gs(o,c,d),p=gs(u,-1*c,-1*d),v=p.x-f.x,h=p.y-f.y,g=Math.sqrt(v*v+h*h),y=Math.pow(a.idealLength-g,2)/a.elasticity;if(g!==0)var m=y*v/g,b=y*h/g;else var m=0,b=0;o.isLocked||(o.offsetX+=m,o.offsetY+=b),u.isLocked||(u.offsetX-=m,u.offsetY-=b)}}},ED=function(e,r){if(r.gravity!==0)for(var n=1,a=0;a<e.graphSet.length;a++){var i=e.graphSet[a],o=i.length;if(a===0)var l=e.clientHeight/2,u=e.clientWidth/2;else var c=e.layoutNodes[e.idToIndex[i[0]]],d=e.layoutNodes[e.idToIndex[c.parentId]],l=d.positionX,u=d.positionY;for(var f=0;f<o;f++){var p=e.layoutNodes[e.idToIndex[i[f]]];if(!p.isLocked){var v=l-p.positionX,h=u-p.positionY,g=Math.sqrt(v*v+h*h);if(g>n){var y=r.gravity*v/g,m=r.gravity*h/g;p.offsetX+=y,p.offsetY+=m}}}}},SD=function(e,r){var n=[],a=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;a<=i;){var o=n[a++],l=e.idToIndex[o],u=e.layoutNodes[l],c=u.children;if(0<c.length&&!u.isLocked){for(var d=u.offsetX,f=u.offsetY,p=0;p<c.length;p++){var v=e.layoutNodes[e.idToIndex[c[p]]];v.offsetX+=d,v.offsetY+=f,n[++i]=c[p]}u.offsetX=0,u.offsetY=0}}},TD=function(e,r){for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];if(!(0<a.children.length||a.isLocked)){var i=BD(a.offsetX,a.offsetY,e.temperature);a.positionX+=i.x,a.positionY+=i.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,ND(a,e)}}for(var n=0;n<e.nodeSize;n++){var a=e.layoutNodes[n];0<a.children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},BD=function(e,r,n){var a=Math.sqrt(e*e+r*r);if(a>n)var i={x:n*e/a,y:n*r/a};else var i={x:e,y:r};return i},ND=function t(e,r){var n=e.parentId;if(n!=null){var a=r.layoutNodes[r.idToIndex[n]],i=!1;if((a.maxX==null||e.maxX+a.padRight>a.maxX)&&(a.maxX=e.maxX+a.padRight,i=!0),(a.minX==null||e.minX-a.padLeft<a.minX)&&(a.minX=e.minX-a.padLeft,i=!0),(a.maxY==null||e.maxY+a.padBottom>a.maxY)&&(a.maxY=e.maxY+a.padBottom,i=!0),(a.minY==null||e.minY-a.padTop<a.minY)&&(a.minY=e.minY-a.padTop,i=!0),i)return t(a,r)}},wv=function(e,r){for(var n=e.layoutNodes,a=[],i=0;i<n.length;i++){var o=n[i],l=o.cmptId,u=a[l]=a[l]||[];u.push(o)}for(var c=0,i=0;i<a.length;i++){var d=a[i];if(d){d.x1=1/0,d.x2=-1/0,d.y1=1/0,d.y2=-1/0;for(var f=0;f<d.length;f++){var p=d[f];d.x1=Math.min(d.x1,p.positionX-p.width/2),d.x2=Math.max(d.x2,p.positionX+p.width/2),d.y1=Math.min(d.y1,p.positionY-p.height/2),d.y2=Math.max(d.y2,p.positionY+p.height/2)}d.w=d.x2-d.x1,d.h=d.y2-d.y1,c+=d.w*d.h}}a.sort(function(b,w){return w.w*w.h-b.w*b.h});for(var v=0,h=0,g=0,y=0,m=Math.sqrt(c)*e.clientWidth/e.clientHeight,i=0;i<a.length;i++){var d=a[i];if(d){for(var f=0;f<d.length;f++){var p=d[f];p.isLocked||(p.positionX+=v-d.x1,p.positionY+=h-d.y1)}v+=d.w+r.componentSpacing,g+=d.w+r.componentSpacing,y=Math.max(y,d.h),g>m&&(h+=y+r.componentSpacing,v=0,g=0,y=0)}}},DD={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Cv(t){this.options=xe({},DD,t)}Cv.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,a=n.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));var i=zt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)n.nodes().layoutPositions(this,e,function(j){return{x:i.x1,y:i.y1}});else{var o=a.size(),l=Math.sqrt(o*i.h/i.w),u=Math.round(l),c=Math.round(i.w/i.h*l),d=function(ee){if(ee==null)return Math.min(u,c);var J=Math.min(u,c);J==u?u=ee:c=ee},f=function(ee){if(ee==null)return Math.max(u,c);var J=Math.max(u,c);J==u?u=ee:c=ee},p=e.rows,v=e.cols!=null?e.cols:e.columns;if(p!=null&&v!=null)u=p,c=v;else if(p!=null&&v==null)u=p,c=Math.ceil(o/u);else if(p==null&&v!=null)c=v,u=Math.ceil(o/c);else if(c*u>o){var h=d(),g=f();(h-1)*g>=o?d(h-1):(g-1)*h>=o&&f(g-1)}else for(;c*u<o;){var y=d(),m=f();(m+1)*y>=o?f(m+1):d(y+1)}var b=i.w/c,w=i.h/u;if(e.condense&&(b=0,w=0),e.avoidOverlap)for(var C=0;C<a.length;C++){var x=a[C],E=x._private.position;(E.x==null||E.y==null)&&(E.x=0,E.y=0);var k=x.layoutDimensions(e),B=e.avoidOverlapPadding,S=k.w+B,N=k.h+B;b=Math.max(b,S),w=Math.max(w,N)}for(var D={},P=function(ee,J){return!!D["c-"+ee+"-"+J]},L=function(ee,J){D["c-"+ee+"-"+J]=!0},O=0,I=0,_=function(){I++,I>=c&&(I=0,O++)},M={},F=0;F<a.length;F++){var V=a[F],H=e.position(V);if(H&&(H.row!==void 0||H.col!==void 0)){var $={row:H.row,col:H.col};if($.col===void 0)for($.col=0;P($.row,$.col);)$.col++;else if($.row===void 0)for($.row=0;P($.row,$.col);)$.row++;M[V.id()]=$,L($.row,$.col)}}var z=function(ee,J){var Z,re;if(ee.locked()||ee.isParent())return!1;var Y=M[ee.id()];if(Y)Z=Y.col*b+b/2+i.x1,re=Y.row*w+w/2+i.y1;else{for(;P(O,I);)_();Z=I*b+b/2+i.x1,re=O*w+w/2+i.y1,L(O,I),_()}return{x:Z,y:re}};a.layoutPositions(this,e,z)}return this};var PD={ready:function(){},stop:function(){}};function kc(t){this.options=xe({},PD,t)}kc.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this},kc.prototype.stop=function(){return this};var OD={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function kv(t){this.options=xe({},OD,t)}kv.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),n=Ye(t.positions);function a(i){if(t.positions==null)return MB(i.position());if(n)return t.positions(i);var o=t.positions[i._private.data.id];return o??null}return r.layoutPositions(this,t,function(i,o){var l=a(i);return i.locked()||l==null?!1:l}),this};var _D={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function xv(t){this.options=xe({},_D,t)}xv.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,n=zt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),a=function(o,l){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}};return r.nodes().layoutPositions(this,t,a),this};var LD=[{name:"breadthfirst",impl:vv},{name:"circle",impl:gv},{name:"concentric",impl:mv},{name:"cose",impl:vs},{name:"grid",impl:Cv},{name:"null",impl:kc},{name:"preset",impl:kv},{name:"random",impl:xv}];function Ev(t){this.options=t,this.notifications=0}var Sv=function(){},Tv=function(){throw new Error("A headless instance can not render images")};Ev.prototype={recalculateRenderedStyle:Sv,notify:function(){this.notifications++},init:Sv,isHeadless:function(){return!0},png:Tv,jpg:Tv};var xc={};xc.arrowShapeWidth=.3,xc.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(c,d,f,p,v,h,g){var y=v.x-f/2-g,m=v.x+f/2+g,b=v.y-f/2-g,w=v.y+f/2+g,C=y<=c&&c<=m&&b<=d&&d<=w;return C},n=function(c,d,f,p,v){var h=c*Math.cos(p)-d*Math.sin(p),g=c*Math.sin(p)+d*Math.cos(p),y=h*f,m=g*f,b=y+v.x,w=m+v.y;return{x:b,y:w}},a=function(c,d,f,p){for(var v=[],h=0;h<c.length;h+=2){var g=c[h],y=c[h+1];v.push(n(g,y,d,f,p))}return v},i=function(c){for(var d=[],f=0;f<c.length;f++){var p=c[f];d.push(p.x,p.y)}return d},o=function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").pfValue*2},l=function(c,d){be(d)&&(d=t[d]),t[c]=xe({name:c,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(p,v,h,g,y,m){var b=i(a(this.points,h+2*m,g,y)),w=Ht(p,v,b);return w},roughCollide:r,draw:function(p,v,h,g){var y=a(this.points,v,h,g);e.arrowShapeImpl("polygon")(p,y)},spacing:function(p){return 0},gap:o},d)};l("none",{collide:Mo,roughCollide:Mo,draw:Gl,spacing:Vh,gap:Vh}),l("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),l("arrow","triangle"),l("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(c,d,f,p,v){var h=a(this.points,d,f,p),g=this.controlPoint,y=n(g[0],g[1],d,f,p);e.arrowShapeImpl(this.name)(c,h,y)},gap:function(c){return o(c)*.8}}),l("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(c,d,f,p,v,h,g){var y=i(a(this.points,f+2*g,p,v)),m=i(a(this.pointsTee,f+2*g,p,v)),b=Ht(c,d,y)||Ht(c,d,m);return b},draw:function(c,d,f,p,v){var h=a(this.points,d,f,p),g=a(this.pointsTee,d,f,p);e.arrowShapeImpl(this.name)(c,h,g)}}),l("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(c,d,f,p,v,h,g){var y=v,m=Math.pow(y.x-c,2)+Math.pow(y.y-d,2)<=Math.pow((f+2*g)*this.radius,2),b=i(a(this.points,f+2*g,p,v));return Ht(c,d,b)||m},draw:function(c,d,f,p,v){var h=a(this.pointsTr,d,f,p);e.arrowShapeImpl(this.name)(c,h,p.x,p.y,this.radius*d)},spacing:function(c){return e.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),l("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(c,d){var f=this.baseCrossLinePts.slice(),p=d/c,v=3,h=5;return f[v]=f[v]-p,f[h]=f[h]-p,f},collide:function(c,d,f,p,v,h,g){var y=i(a(this.points,f+2*g,p,v)),m=i(a(this.crossLinePts(f,h),f+2*g,p,v)),b=Ht(c,d,y)||Ht(c,d,m);return b},draw:function(c,d,f,p,v){var h=a(this.points,d,f,p),g=a(this.crossLinePts(d,v),d,f,p);e.arrowShapeImpl(this.name)(c,h,g)}}),l("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(c){return o(c)*.525}}),l("circle",{radius:.15,collide:function(c,d,f,p,v,h,g){var y=v,m=Math.pow(y.x-c,2)+Math.pow(y.y-d,2)<=Math.pow((f+2*g)*this.radius,2);return m},draw:function(c,d,f,p,v){e.arrowShapeImpl(this.name)(c,p.x,p.y,this.radius*d)},spacing:function(c){return e.getArrowWidth(c.pstyle("width").pfValue,c.pstyle("arrow-scale").value)*this.radius}}),l("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(c){return 1},gap:function(c){return 1}}),l("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),l("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(c){return c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}}),l("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(c){return .95*c.pstyle("width").pfValue*c.pstyle("arrow-scale").value}})};var Kn={};Kn.projectIntoViewport=function(t,e){var r=this.cy,n=this.findContainerClientCoords(),a=n[0],i=n[1],o=n[4],l=r.pan(),u=r.zoom(),c=((t-a)/o-l.x)/u,d=((e-i)/o-l.y)/u;return[c,d]},Kn.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),n=function(m){return parseFloat(r.getPropertyValue(m))},a={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},i={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=t.clientWidth,l=t.clientHeight,u=a.left+a.right,c=a.top+a.bottom,d=i.left+i.right,f=e.width/(o+d),p=o-u,v=l-c,h=e.left+a.left+i.left,g=e.top+a.top+i.top;return this.containerBB=[h,g,p,v,f]},Kn.invalidateContainerClientCoordsCache=function(){this.containerBB=null},Kn.findNearestElement=function(t,e,r,n){return this.findNearestElements(t,e,r,n)[0]},Kn.findNearestElements=function(t,e,r,n){var a=this,i=this,o=i.getCachedZSortedEles(),l=[],u=i.cy.zoom(),c=i.cy.hasCompoundNodes(),d=(n?24:8)/u,f=(n?8:2)/u,p=(n?8:2)/u,v=1/0,h,g;r&&(o=o.interactive);function y(k,B){if(k.isNode()){if(g)return;g=k,l.push(k)}if(k.isEdge()&&(B==null||B<v))if(h){if(h.pstyle("z-compound-depth").value===k.pstyle("z-compound-depth").value&&h.pstyle("z-compound-depth").value===k.pstyle("z-compound-depth").value){for(var S=0;S<l.length;S++)if(l[S].isEdge()){l[S]=k,h=k,v=B??v;break}}}else l.push(k),h=k,v=B??v}function m(k){var B=k.outerWidth()+2*f,S=k.outerHeight()+2*f,N=B/2,D=S/2,P=k.position(),L=k.pstyle("corner-radius").value==="auto"?"auto":k.pstyle("corner-radius").pfValue,O=k._private.rscratch;if(P.x-N<=t&&t<=P.x+N&&P.y-D<=e&&e<=P.y+D){var I=i.nodeShapes[a.getNodeShape(k)];if(I.checkPoint(t,e,0,B,S,P.x,P.y,L,O))return y(k,0),!0}}function b(k){var B=k._private,S=B.rscratch,N=k.pstyle("width").pfValue,D=k.pstyle("arrow-scale").value,P=N/2+d,L=P*P,O=P*2,F=B.source,V=B.target,I;if(S.edgeType==="segments"||S.edgeType==="straight"||S.edgeType==="haystack"){for(var _=S.allpts,M=0;M+3<_.length;M+=2)if(jB(t,e,_[M],_[M+1],_[M+2],_[M+3],O)&&L>(I=JB(t,e,_[M],_[M+1],_[M+2],_[M+3])))return y(k,I),!0}else if(S.edgeType==="bezier"||S.edgeType==="multibezier"||S.edgeType==="self"||S.edgeType==="compound"){for(var _=S.allpts,M=0;M+5<S.allpts.length;M+=4)if(YB(t,e,_[M],_[M+1],_[M+2],_[M+3],_[M+4],_[M+5],O)&&L>(I=QB(t,e,_[M],_[M+1],_[M+2],_[M+3],_[M+4],_[M+5])))return y(k,I),!0}for(var F=F||B.source,V=V||B.target,H=a.getArrowWidth(N,D),$=[{name:"source",x:S.arrowStartX,y:S.arrowStartY,angle:S.srcArrowAngle},{name:"target",x:S.arrowEndX,y:S.arrowEndY,angle:S.tgtArrowAngle},{name:"mid-source",x:S.midX,y:S.midY,angle:S.midsrcArrowAngle},{name:"mid-target",x:S.midX,y:S.midY,angle:S.midtgtArrowAngle}],M=0;M<$.length;M++){var z=$[M],j=i.arrowShapes[k.pstyle(z.name+"-arrow-shape").value],ee=k.pstyle("width").pfValue;if(j.roughCollide(t,e,H,z.angle,{x:z.x,y:z.y},ee,d)&&j.collide(t,e,H,z.angle,{x:z.x,y:z.y},ee,d))return y(k),!0}c&&l.length>0&&(m(F),m(V))}function w(k,B,S){return lr(k,B,S)}function C(k,B){var S=k._private,N=p,D;B?D=B+"-":D="",k.boundingBox();var P=S.labelBounds[B||"main"],L=k.pstyle(D+"label").value,O=k.pstyle("text-events").strValue==="yes";if(!(!O||!L)){var I=w(S.rscratch,"labelX",B),_=w(S.rscratch,"labelY",B),M=w(S.rscratch,"labelAngle",B),F=k.pstyle(D+"text-margin-x").pfValue,V=k.pstyle(D+"text-margin-y").pfValue,H=P.x1-N-F,$=P.x2+N-F,z=P.y1-N-V,j=P.y2+N-V;if(M){var ee=Math.cos(M),J=Math.sin(M),Z=function(he,ne){return he=he-I,ne=ne-_,{x:he*ee-ne*J+I,y:he*J+ne*ee+_}},re=Z(H,z),Y=Z(H,j),A=Z($,z),K=Z($,j),W=[re.x+F,re.y+V,A.x+F,A.y+V,K.x+F,K.y+V,Y.x+F,Y.y+V];if(Ht(t,e,W))return y(k),!0}else if(ba(P,t,e))return y(k),!0}}for(var x=o.length-1;x>=0;x--){var E=o[x];E.isNode()?m(E)||C(E):b(E)||C(E)||C(E,"source")||C(E,"target")}return l},Kn.getAllInBox=function(t,e,r,n){var a=this.getCachedZSortedEles().interactive,i=[],o=Math.min(t,r),l=Math.max(t,r),u=Math.min(e,n),c=Math.max(e,n);t=o,r=l,e=u,n=c;for(var d=zt({x1:t,y1:e,x2:r,y2:n}),f=0;f<a.length;f++){var p=a[f];if(p.isNode()){var v=p,h=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});Xl(d,h)&&!Wh(h,d)&&i.push(v)}else{var g=p,y=g._private,m=y.rscratch;if(m.startX!=null&&m.startY!=null&&!ba(d,m.startX,m.startY)||m.endX!=null&&m.endY!=null&&!ba(d,m.endX,m.endY))continue;if(m.edgeType==="bezier"||m.edgeType==="multibezier"||m.edgeType==="self"||m.edgeType==="compound"||m.edgeType==="segments"||m.edgeType==="haystack"){for(var b=y.rstyle.bezierPts||y.rstyle.linePts||y.rstyle.haystackPts,w=!0,C=0;C<b.length;C++)if(!WB(d,b[C])){w=!1;break}w&&i.push(g)}else(m.edgeType==="haystack"||m.edgeType==="straight")&&i.push(g)}}return i};var ms={};ms.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",n=e.edgeType==="bezier",a=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",l=e.edgeType==="self",u,c,d,f,p,v,m,b;if(r?(d=e.haystackPts[0],f=e.haystackPts[1],p=e.haystackPts[2],v=e.haystackPts[3]):(d=e.arrowStartX,f=e.arrowStartY,p=e.arrowEndX,v=e.arrowEndY),m=e.midX,b=e.midY,i)u=d-e.segpts[0],c=f-e.segpts[1];else if(a||o||l||n){var h=e.allpts,g=ft(h[0],h[2],h[4],.1),y=ft(h[1],h[3],h[5],.1);u=d-g,c=f-y}else u=d-m,c=f-b;e.srcArrowAngle=Vo(u,c);var m=e.midX,b=e.midY;if(r&&(m=(d+p)/2,b=(f+v)/2),u=p-d,c=v-f,i){var h=e.allpts;if(h.length/2%2===0){var w=h.length/2,C=w-2;u=h[w]-h[C],c=h[w+1]-h[C+1]}else if(e.isRound)u=e.midVector[1],c=-e.midVector[0];else{var w=h.length/2-1,C=w-2;u=h[w]-h[C],c=h[w+1]-h[C+1]}}else if(a||o||l){var h=e.allpts,x=e.ctrlpts,E,k,B,S;if(x.length/2%2===0){var N=h.length/2-1,D=N+2,P=D+2;E=ft(h[N],h[D],h[P],0),k=ft(h[N+1],h[D+1],h[P+1],0),B=ft(h[N],h[D],h[P],1e-4),S=ft(h[N+1],h[D+1],h[P+1],1e-4)}else{var D=h.length/2-1,N=D-2,P=D+2;E=ft(h[N],h[D],h[P],.4999),k=ft(h[N+1],h[D+1],h[P+1],.4999),B=ft(h[N],h[D],h[P],.5),S=ft(h[N+1],h[D+1],h[P+1],.5)}u=B-E,c=S-k}if(e.midtgtArrowAngle=Vo(u,c),e.midDispX=u,e.midDispY=c,u*=-1,c*=-1,i){var h=e.allpts;if(h.length/2%2!==0){if(!e.isRound){var w=h.length/2-1,L=w+2;u=-(h[L]-h[w]),c=-(h[L+1]-h[w+1])}}}if(e.midsrcArrowAngle=Vo(u,c),i)u=p-e.segpts[e.segpts.length-2],c=v-e.segpts[e.segpts.length-1];else if(a||o||l||n){var h=e.allpts,O=h.length,g=ft(h[O-6],h[O-4],h[O-2],.9),y=ft(h[O-5],h[O-3],h[O-1],.9);u=p-g,c=v-y}else u=p-m,c=v-b;e.tgtArrowAngle=Vo(u,c)},ms.getArrowWidth=ms.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},n=r[t+", "+e];return n||(n=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=n,n)};var Ec,Sc,kr={},er={},Bv,Nv,qn,ys,zr,Un,Gn,xr,Ma,bs,Dv,Pv,Tc,Bc,Ov,_v=function(e,r,n){n.x=r.x-e.x,n.y=r.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},FD=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},MD=function(e,r,n,a,i){if(e!==Ov?_v(r,e,kr):FD(er,kr),_v(r,n,er),Bv=kr.nx*er.ny-kr.ny*er.nx,Nv=kr.nx*er.nx-kr.ny*-er.ny,zr=Math.asin(Math.max(-1,Math.min(1,Bv))),Math.abs(zr)<1e-6){Ec=r.x,Sc=r.y,Gn=Ma=0;return}qn=1,ys=!1,Nv<0?zr<0?zr=Math.PI+zr:(zr=Math.PI-zr,qn=-1,ys=!0):zr>0&&(qn=-1,ys=!0),r.radius!==void 0?Ma=r.radius:Ma=a,Un=zr/2,bs=Math.min(kr.len/2,er.len/2),i?(xr=Math.abs(Math.cos(Un)*Ma/Math.sin(Un)),xr>bs?(xr=bs,Gn=Math.abs(xr*Math.sin(Un)/Math.cos(Un))):Gn=Ma):(xr=Math.min(bs,Ma),Gn=Math.abs(xr*Math.sin(Un)/Math.cos(Un))),Tc=r.x+er.nx*xr,Bc=r.y+er.ny*xr,Ec=Tc-er.ny*Gn*qn,Sc=Bc+er.nx*Gn*qn,Dv=r.x+kr.nx*xr,Pv=r.y+kr.ny*xr,Ov=r};function Lv(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Nc(t,e,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===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}:(MD(t,e,r,n,a),{cx:Ec,cy:Sc,radius:Gn,startX:Dv,startY:Pv,stopX:Tc,stopY:Bc,startAngle:kr.ang+Math.PI/2*qn,endAngle:er.ang-Math.PI/2*qn,counterClockwise:ys})}var Pt={};Pt.findMidptPtsEtc=function(t,e){var r=e.posPts,n=e.intersectionPts,a=e.vectorNormInverse,i,o=t.pstyle("source-endpoint"),l=t.pstyle("target-endpoint"),u=o.units!=null&&l.units!=null,c=function(x,E,k,B){var S=B-E,N=k-x,D=Math.sqrt(N*N+S*S);return{x:-S/D,y:N/D}},d=t.pstyle("edge-distances").value;switch(d){case"node-position":i=r;break;case"intersection":i=n;break;case"endpoints":{if(u){var f=this.manualEndptToPx(t.source()[0],o),p=sr(f,2),v=p[0],h=p[1],g=this.manualEndptToPx(t.target()[0],l),y=sr(g,2),m=y[0],b=y[1],w={x1:v,y1:h,x2:m,y2:b};a=c(v,h,m,b),i=w}else Ae("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=n;break}}return{midptPts:i,vectorNormInverse:a}},Pt.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],n=r._private,a=n.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var o=n.source,l=n.target,u=o.position(),c=l.position(),d=o.width(),f=l.width(),p=o.height(),v=l.height(),h=r.pstyle("haystack-radius").value,g=h/2;a.haystackPts=a.allpts=[a.source.x*d*g+u.x,a.source.y*p*g+u.y,a.target.x*f*g+c.x,a.target.y*v*g+c.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}},Pt.findSegmentsPoints=function(t,e){var r=t._private.rscratch,n=t.pstyle("segment-weights"),a=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),l=Math.min(n.pfValue.length,a.pfValue.length),u=i.pfValue[i.pfValue.length-1],c=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var d=0;d<l;d++){var f=n.pfValue[d],p=a.pfValue[d],v=1-f,h=f,g=this.findMidptPtsEtc(t,e),y=g.midptPts,m=g.vectorNormInverse,b={x:y.x1*v+y.x2*h,y:y.y1*v+y.y2*h};r.segpts.push(b.x+m.x*p,b.y+m.y*p),r.radii.push(i.pfValue[d]!==void 0?i.pfValue[d]:u),r.isArcRadius.push((o.pfValue[d]!==void 0?o.pfValue[d]:c)==="arc-radius")}},Pt.findLoopPoints=function(t,e,r,n){var a=t._private.rscratch,i=e.dirCounts,o=e.srcPos,l=t.pstyle("control-point-distances"),u=l?l.pfValue[0]:void 0,c=t.pstyle("loop-direction").pfValue,d=t.pstyle("loop-sweep").pfValue,f=t.pstyle("control-point-step-size").pfValue;a.edgeType="self";var p=r,v=f;n&&(p=0,v=u);var h=c-Math.PI/2,g=h-d/2,y=h+d/2,m=c+"_"+d;p=i[m]===void 0?i[m]=0:++i[m],a.ctrlpts=[o.x+Math.cos(g)*1.4*v*(p/3+1),o.y+Math.sin(g)*1.4*v*(p/3+1),o.x+Math.cos(y)*1.4*v*(p/3+1),o.y+Math.sin(y)*1.4*v*(p/3+1)]},Pt.findCompoundLoopPoints=function(t,e,r,n){var a=t._private.rscratch;a.edgeType="compound";var i=e.srcPos,o=e.tgtPos,l=e.srcW,u=e.srcH,c=e.tgtW,d=e.tgtH,f=t.pstyle("control-point-step-size").pfValue,p=t.pstyle("control-point-distances"),v=p?p.pfValue[0]:void 0,h=r,g=f;n&&(h=0,g=v);var y=50,m={x:i.x-l/2,y:i.y-u/2},b={x:o.x-c/2,y:o.y-d/2},w={x:Math.min(m.x,b.x),y:Math.min(m.y,b.y)},C=.5,x=Math.max(C,Math.log(l*.01)),E=Math.max(C,Math.log(c*.01));a.ctrlpts=[w.x,w.y-(1+Math.pow(y,1.12)/100)*g*(h/3+1)*x,w.x-(1+Math.pow(y,1.12)/100)*g*(h/3+1)*E,w.y]},Pt.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"},Pt.findBezierPoints=function(t,e,r,n,a){var i=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,l=t.pstyle("control-point-distances"),u=t.pstyle("control-point-weights"),c=l&&u?Math.min(l.value.length,u.value.length):1,d=l?l.pfValue[0]:void 0,f=u.value[0],p=n;i.edgeType=p?"multibezier":"bezier",i.ctrlpts=[];for(var v=0;v<c;v++){var h=(.5-e.eles.length/2+r)*o*(a?-1:1),g=void 0,y=qh(h);p&&(d=l?l.pfValue[v]:o,f=u.value[v]),n?g=d:g=d!==void 0?y*d:void 0;var m=g!==void 0?g:h,b=1-f,w=f,C=this.findMidptPtsEtc(t,e),x=C.midptPts,E=C.vectorNormInverse,k={x:x.x1*b+x.x2*w,y:x.y1*b+x.y2*w};i.ctrlpts.push(k.x+E.x*m,k.y+E.y*m)}},Pt.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var n="vertical",a="horizontal",i="leftward",o="rightward",l="downward",u="upward",c="auto",d=e.posPts,f=e.srcW,p=e.srcH,v=e.tgtW,h=e.tgtH,g=t.pstyle("edge-distances").value,y=g!=="node-position",m=t.pstyle("taxi-direction").value,b=m,w=t.pstyle("taxi-turn"),C=w.units==="%",x=w.pfValue,E=x<0,k=t.pstyle("taxi-turn-min-distance").pfValue,B=y?(f+v)/2:0,S=y?(p+h)/2:0,N=d.x2-d.x1,D=d.y2-d.y1,P=function(we,Ce){return we>0?Math.max(we-Ce,0):Math.min(we+Ce,0)},L=P(N,B),O=P(D,S),I=!1;b===c?m=Math.abs(L)>Math.abs(O)?a:n:b===u||b===l?(m=n,I=!0):(b===i||b===o)&&(m=a,I=!0);var _=m===n,M=_?O:L,F=_?D:N,V=qh(F),H=!1;!(I&&(C||E))&&(b===l&&F<0||b===u&&F>0||b===i&&F>0||b===o&&F<0)&&(V*=-1,M=V*Math.abs(M),H=!0);var $;if(C){var z=x<0?1+x:x;$=z*M}else{var j=x<0?M:0;$=j+x*V}var ee=function(we){return Math.abs(we)<k||Math.abs(we)>=Math.abs(M)},J=ee($),Z=ee(Math.abs(M)-Math.abs($)),re=J||Z;if(re&&!H)if(_){var Y=Math.abs(F)<=p/2,A=Math.abs(N)<=v/2;if(Y){var K=(d.x1+d.x2)/2,W=d.y1,oe=d.y2;r.segpts=[K,W,K,oe]}else if(A){var he=(d.y1+d.y2)/2,ne=d.x1,se=d.x2;r.segpts=[ne,he,se,he]}else r.segpts=[d.x1,d.y2]}else{var ue=Math.abs(F)<=f/2,pe=Math.abs(D)<=h/2;if(ue){var de=(d.y1+d.y2)/2,me=d.x1,Ne=d.x2;r.segpts=[me,de,Ne,de]}else if(pe){var De=(d.x1+d.x2)/2,Ee=d.y1,Pe=d.y2;r.segpts=[De,Ee,De,Pe]}else r.segpts=[d.x2,d.y1]}else if(_){var te=d.y1+$+(y?p/2*V:0),T=d.x1,R=d.x2;r.segpts=[T,te,R,te]}else{var Q=d.x1+$+(y?f/2*V:0),G=d.y1,U=d.y2;r.segpts=[Q,G,Q,U]}if(r.isRound){var ie=t.pstyle("taxi-radius").value,X=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ie),r.isArcRadius=new Array(r.segpts.length/2).fill(X)}},Pt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var n=e.srcPos,a=e.tgtPos,i=e.srcW,o=e.srcH,l=e.tgtW,u=e.tgtH,c=e.srcShape,d=e.tgtShape,f=e.srcCornerRadius,p=e.tgtCornerRadius,v=e.srcRs,h=e.tgtRs,g=!le(r.startX)||!le(r.startY),y=!le(r.arrowStartX)||!le(r.arrowStartY),m=!le(r.endX)||!le(r.endY),b=!le(r.arrowEndX)||!le(r.arrowEndY),w=3,C=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,x=w*C,E=In({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),k=E<x,B=In({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),S=B<x,N=!1;if(g||y||k){N=!0;var D={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},P=Math.sqrt(D.x*D.x+D.y*D.y),L={x:D.x/P,y:D.y/P},O=Math.max(i,o),I={x:r.ctrlpts[0]+L.x*2*O,y:r.ctrlpts[1]+L.y*2*O},_=c.intersectLine(n.x,n.y,i,o,I.x,I.y,0,f,v);k?(r.ctrlpts[0]=r.ctrlpts[0]+L.x*(x-E),r.ctrlpts[1]=r.ctrlpts[1]+L.y*(x-E)):(r.ctrlpts[0]=_[0]+L.x*x,r.ctrlpts[1]=_[1]+L.y*x)}if(m||b||S){N=!0;var M={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},F=Math.sqrt(M.x*M.x+M.y*M.y),V={x:M.x/F,y:M.y/F},H=Math.max(i,o),$={x:r.ctrlpts[0]+V.x*2*H,y:r.ctrlpts[1]+V.y*2*H},z=d.intersectLine(a.x,a.y,l,u,$.x,$.y,0,p,h);S?(r.ctrlpts[0]=r.ctrlpts[0]+V.x*(x-B),r.ctrlpts[1]=r.ctrlpts[1]+V.y*(x-B)):(r.ctrlpts[0]=z[0]+V.x*x,r.ctrlpts[1]=z[1]+V.y*x)}N&&this.findEndpoints(t)}},Pt.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var n,a;e.ctrlpts.length/2%2===0?(n=e.allpts.length/2-1,e.midX=e.allpts[n],e.midY=e.allpts[n+1]):(n=e.allpts.length/2-3,a=.5,e.midX=ft(e.allpts[n],e.allpts[n+2],e.allpts[n+4],a),e.midY=ft(e.allpts[n+1],e.allpts[n+3],e.allpts[n+5],a))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],l=e.isArcRadius[i/2-1];e.roundCorners.push(Nc({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,l))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,c=u-2;e.midX=(e.segpts[c]+e.segpts[u])/2,e.midY=(e.segpts[c+1]+e.segpts[u+1])/2}else{var d=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[d],e.midY=e.segpts[d+1];else{var f={x:e.segpts[d],y:e.segpts[d+1]},p=e.roundCorners[d/2],v=[f.x-p.cx,f.y-p.cy],h=p.radius/Math.sqrt(Math.pow(v[0],2)+Math.pow(v[1],2));v=v.map(function(g){return g*h}),e.midX=p.cx+v[0],e.midY=p.cy+v[1],e.midVector=v}}}},Pt.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||le(e.startX)&&le(e.startY)&&le(e.endX)&&le(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Ae("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},Pt.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,n=r.cy,a=n.hasCompoundNodes(),i={map:new wr,get:function(k){var B=this.map.get(k[0]);return B!=null?B.get(k[1]):null},set:function(k,B){var S=this.map.get(k[0]);S==null&&(S=new wr,this.map.set(k[0],S)),S.set(k[1],B)}},o=[],l=[],u=0;u<t.length;u++){var c=t[u],d=c._private,f=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(f==="haystack"){l.push(c);continue}var p=f==="unbundled-bezier"||f.endsWith("segments")||f==="straight"||f==="straight-triangle"||f.endsWith("taxi"),v=f==="unbundled-bezier"||f==="bezier",h=d.source,g=d.target,y=h.poolIndex(),m=g.poolIndex(),b=[y,m].sort(),w=i.get(b);w==null&&(w={eles:[]},i.set(b,w),o.push(b)),w.eles.push(c),p&&(w.hasUnbundled=!0),v&&(w.hasBezier=!0)}}for(var C=function(k){var B=o[k],S=i.get(B),N=void 0;if(!S.hasUnbundled){var D=S.eles[0].parallelEdges().filter(function(Q){return Q.isBundledBezier()});Wl(S.eles),D.forEach(function(Q){return S.eles.push(Q)}),S.eles.sort(function(Q,G){return Q.poolIndex()-G.poolIndex()})}var P=S.eles[0],L=P.source(),O=P.target();if(L.poolIndex()>O.poolIndex()){var I=L;L=O,O=I}var _=S.srcPos=L.position(),M=S.tgtPos=O.position(),F=S.srcW=L.outerWidth(),V=S.srcH=L.outerHeight(),H=S.tgtW=O.outerWidth(),$=S.tgtH=O.outerHeight(),z=S.srcShape=r.nodeShapes[e.getNodeShape(L)],j=S.tgtShape=r.nodeShapes[e.getNodeShape(O)],ee=S.srcCornerRadius=L.pstyle("corner-radius").value==="auto"?"auto":L.pstyle("corner-radius").pfValue,J=S.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,Z=S.tgtRs=O._private.rscratch,re=S.srcRs=L._private.rscratch;S.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var Y=0;Y<S.eles.length;Y++){var A=S.eles[Y],K=A[0]._private.rscratch,W=A.pstyle("curve-style").value,oe=W==="unbundled-bezier"||W.endsWith("segments")||W.endsWith("taxi"),he=!L.same(A.source());if(!S.calculatedIntersection&&L!==O&&(S.hasBezier||S.hasUnbundled)){S.calculatedIntersection=!0;var ne=z.intersectLine(_.x,_.y,F,V,M.x,M.y,0,ee,re),se=S.srcIntn=ne,ue=j.intersectLine(M.x,M.y,H,$,_.x,_.y,0,J,Z),pe=S.tgtIntn=ue,de=S.intersectionPts={x1:ne[0],x2:ue[0],y1:ne[1],y2:ue[1]},me=S.posPts={x1:_.x,x2:M.x,y1:_.y,y2:M.y},Ne=ue[1]-ne[1],De=ue[0]-ne[0],Ee=Math.sqrt(De*De+Ne*Ne),Pe=S.vector={x:De,y:Ne},te=S.vectorNorm={x:Pe.x/Ee,y:Pe.y/Ee},T={x:-te.y,y:te.x};S.nodesOverlap=!le(Ee)||j.checkPoint(ne[0],ne[1],0,H,$,M.x,M.y,J,Z)||z.checkPoint(ue[0],ue[1],0,F,V,_.x,_.y,ee,re),S.vectorNormInverse=T,N={nodesOverlap:S.nodesOverlap,dirCounts:S.dirCounts,calculatedIntersection:!0,hasBezier:S.hasBezier,hasUnbundled:S.hasUnbundled,eles:S.eles,srcPos:M,tgtPos:_,srcW:H,srcH:$,tgtW:F,tgtH:V,srcIntn:pe,tgtIntn:se,srcShape:j,tgtShape:z,posPts:{x1:me.x2,y1:me.y2,x2:me.x1,y2:me.y1},intersectionPts:{x1:de.x2,y1:de.y2,x2:de.x1,y2:de.y1},vector:{x:-Pe.x,y:-Pe.y},vectorNorm:{x:-te.x,y:-te.y},vectorNormInverse:{x:-T.x,y:-T.y}}}var R=he?N:S;K.nodesOverlap=R.nodesOverlap,K.srcIntn=R.srcIntn,K.tgtIntn=R.tgtIntn,K.isRound=W.startsWith("round"),a&&(L.isParent()||L.isChild()||O.isParent()||O.isChild())&&(L.parents().anySame(O)||O.parents().anySame(L)||L.same(O)&&L.isParent())?e.findCompoundLoopPoints(A,R,Y,oe):L===O?e.findLoopPoints(A,R,Y,oe):W.endsWith("segments")?e.findSegmentsPoints(A,R):W.endsWith("taxi")?e.findTaxiPoints(A,R):W==="straight"||!oe&&S.eles.length%2===1&&Y===Math.floor(S.eles.length/2)?e.findStraightEdgePoints(A):e.findBezierPoints(A,R,Y,oe,he),e.findEndpoints(A),e.tryToCorrectInvalidPoints(A,R),e.checkForInvalidEdgeWarning(A),e.storeAllpts(A),e.storeEdgeProjections(A),e.calculateArrowAngles(A),e.recalculateEdgeLabelProjections(A),e.calculateLabelAngles(A)}},x=0;x<o.length;x++)C(x);this.findHaystackPoints(l)}};function Fv(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var n=t[r],a=t[r+1];e.push({x:n,y:a})}return e}}Pt.getSegmentPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="segments")return this.recalculateRenderedStyle(t),Fv(e.segpts)},Pt.getControlPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return this.recalculateRenderedStyle(t),Fv(e.ctrlpts)},Pt.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var zi={};zi.manualEndptToPx=function(t,e){var r=this,n=t.position(),a=t.outerWidth(),i=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var l=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(l[0]=l[0]*a),e.units[1]==="%"&&(l[1]=l[1]*i),l[0]+=n.x,l[1]+=n.y,l}else{var u=e.pfValue[0];u=-Math.PI/2+u;var c=2*Math.max(a,i),d=[n.x+Math.cos(u)*c,n.y+Math.sin(u)*c];return r.nodeShapes[this.getNodeShape(t)].intersectLine(n.x,n.y,a,i,d[0],d[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}},zi.findEndpoints=function(t){var e=this,r,n=t.source()[0],a=t.target()[0],i=n.position(),o=a.position(),l=t.pstyle("target-arrow-shape").value,u=t.pstyle("source-arrow-shape").value,c=t.pstyle("target-distance-from-node").pfValue,d=t.pstyle("source-distance-from-node").pfValue,f=n._private.rscratch,p=a._private.rscratch,v=t.pstyle("curve-style").value,h=t._private.rscratch,g=h.edgeType,y=v==="taxi",m=g==="self"||g==="compound",b=g==="bezier"||g==="multibezier"||m,w=g!=="bezier",C=g==="straight"||g==="segments",x=g==="segments",E=b||w||C,k=m||y,B=t.pstyle("source-endpoint"),S=k?"outside-to-node":B.value,N=n.pstyle("corner-radius").value==="auto"?"auto":n.pstyle("corner-radius").pfValue,D=t.pstyle("target-endpoint"),P=k?"outside-to-node":D.value,L=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue;h.srcManEndpt=B,h.tgtManEndpt=D;var O,I,_,M;if(b){var F=[h.ctrlpts[0],h.ctrlpts[1]],V=w?[h.ctrlpts[h.ctrlpts.length-2],h.ctrlpts[h.ctrlpts.length-1]]:F;O=V,I=F}else if(C){var H=x?h.segpts.slice(0,2):[o.x,o.y],$=x?h.segpts.slice(h.segpts.length-2):[i.x,i.y];O=$,I=H}if(P==="inside-to-node")r=[o.x,o.y];else if(D.units)r=this.manualEndptToPx(a,D);else if(P==="outside-to-line")r=h.tgtIntn;else if(P==="outside-to-node"||P==="outside-to-node-or-label"?_=O:(P==="outside-to-line"||P==="outside-to-line-or-label")&&(_=[i.x,i.y]),r=e.nodeShapes[this.getNodeShape(a)].intersectLine(o.x,o.y,a.outerWidth(),a.outerHeight(),_[0],_[1],0,L,p),P==="outside-to-node-or-label"||P==="outside-to-line-or-label"){var z=a._private.rscratch,j=z.labelWidth,ee=z.labelHeight,J=z.labelX,Z=z.labelY,re=j/2,Y=ee/2,A=a.pstyle("text-valign").value;A==="top"?Z-=Y:A==="bottom"&&(Z+=Y);var K=a.pstyle("text-halign").value;K==="left"?J-=re:K==="right"&&(J+=re);var W=Bi(_[0],_[1],[J-re,Z-Y,J+re,Z-Y,J+re,Z+Y,J-re,Z+Y],o.x,o.y);if(W.length>0){var oe=i,he=An(oe,ma(r)),ne=An(oe,ma(W)),se=he;if(ne<he&&(r=W,se=ne),W.length>2){var ue=An(oe,{x:W[2],y:W[3]});ue<se&&(r=[W[2],W[3]])}}}var pe=Ko(r,O,e.arrowShapes[l].spacing(t)+c),de=Ko(r,O,e.arrowShapes[l].gap(t)+c);if(h.endX=de[0],h.endY=de[1],h.arrowEndX=pe[0],h.arrowEndY=pe[1],S==="inside-to-node")r=[i.x,i.y];else if(B.units)r=this.manualEndptToPx(n,B);else if(S==="outside-to-line")r=h.srcIntn;else if(S==="outside-to-node"||S==="outside-to-node-or-label"?M=I:(S==="outside-to-line"||S==="outside-to-line-or-label")&&(M=[o.x,o.y]),r=e.nodeShapes[this.getNodeShape(n)].intersectLine(i.x,i.y,n.outerWidth(),n.outerHeight(),M[0],M[1],0,N,f),S==="outside-to-node-or-label"||S==="outside-to-line-or-label"){var me=n._private.rscratch,Ne=me.labelWidth,De=me.labelHeight,Ee=me.labelX,Pe=me.labelY,te=Ne/2,T=De/2,R=n.pstyle("text-valign").value;R==="top"?Pe-=T:R==="bottom"&&(Pe+=T);var Q=n.pstyle("text-halign").value;Q==="left"?Ee-=te:Q==="right"&&(Ee+=te);var G=Bi(M[0],M[1],[Ee-te,Pe-T,Ee+te,Pe-T,Ee+te,Pe+T,Ee-te,Pe+T],i.x,i.y);if(G.length>0){var U=o,ie=An(U,ma(r)),X=An(U,ma(G)),ae=ie;if(X<ie&&(r=[G[0],G[1]],ae=X),G.length>2){var we=An(U,{x:G[2],y:G[3]});we<ae&&(r=[G[2],G[3]])}}}var Ce=Ko(r,I,e.arrowShapes[u].spacing(t)+d),ge=Ko(r,I,e.arrowShapes[u].gap(t)+d);h.startX=ge[0],h.startY=ge[1],h.arrowStartX=Ce[0],h.arrowStartY=Ce[1],E&&(!le(h.startX)||!le(h.startY)||!le(h.endX)||!le(h.endY)?h.badLine=!0:h.badLine=!1)},zi.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}},zi.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var Dc={};function ID(t,e,r){for(var n=function(c,d,f,p){return ft(c,d,f,p)},a=e._private,i=a.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var l=t.bezierProjPcts[o];i.push({x:n(r[0],r[2],r[4],l),y:n(r[1],r[3],r[5],l)})}}Dc.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,n=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,n==="multibezier"||n==="bezier"||n==="self"||n==="compound"){e.rstyle.bezierPts=[];for(var a=0;a+5<r.allpts.length;a+=4)ID(this,t,r.allpts.slice(a,a+6))}else if(n==="segments")for(var i=e.rstyle.linePts=[],a=0;a+1<r.allpts.length;a+=2)i.push({x:r.allpts[a],y:r.allpts[a+1]});else if(n==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth},Dc.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Er={};Er.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!nn(e)){var r,n,a=t._private,i=t.width(),o=t.height(),l=t.padding(),u=t.position(),c=t.pstyle("text-halign").strValue,d=t.pstyle("text-valign").strValue,f=a.rscratch,p=a.rstyle;switch(c){case"left":r=u.x-i/2-l;break;case"right":r=u.x+i/2+l;break;default:r=u.x}switch(d){case"top":n=u.y-o/2-l;break;case"bottom":n=u.y+o/2+l;break;default:n=u.y}f.labelX=r,f.labelY=n,p.labelX=r,p.labelY=n,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var Mv=function(e,r){var n=Math.atan(r/e);return e===0&&n<0&&(n=n*-1),n},Iv=function(e,r){var n=r.x-e.x,a=r.y-e.y;return Mv(n,a)},AD=function(e,r,n,a){var i=Si(0,a-.001,1),o=Si(0,a+.001,1),l=ya(e,r,n,i),u=ya(e,r,n,o);return Iv(l,u)};Er.recalculateEdgeLabelProjections=function(t){var e,r=t._private,n=r.rscratch,a=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:n.midX,y:n.midY};var o=function(f,p,v){sn(r.rscratch,f,p,v),sn(r.rstyle,f,p,v)};o("labelX",null,e.x),o("labelY",null,e.y);var l=Mv(n.midDispX,n.midDispY);o("labelAutoAngle",null,l);var u=function d(){if(d.cache)return d.cache;for(var f=[],p=0;p+5<n.allpts.length;p+=4){var v={x:n.allpts[p],y:n.allpts[p+1]},h={x:n.allpts[p+2],y:n.allpts[p+3]},g={x:n.allpts[p+4],y:n.allpts[p+5]};f.push({p0:v,p1:h,p2:g,startDist:0,length:0,segments:[]})}var y=r.rstyle.bezierPts,m=a.bezierProjPcts.length;function b(k,B,S,N,D){var P=In(B,S),L=k.segments[k.segments.length-1],O={p0:B,p1:S,t0:N,t1:D,startDist:L?L.startDist+L.length:0,length:P};k.segments.push(O),k.length+=P}for(var w=0;w<f.length;w++){var C=f[w],x=f[w-1];x&&(C.startDist=x.startDist+x.length),b(C,C.p0,y[w*m],0,a.bezierProjPcts[0]);for(var E=0;E<m-1;E++)b(C,y[w*m+E],y[w*m+E+1],a.bezierProjPcts[E],a.bezierProjPcts[E+1]);b(C,y[w*m+m-1],C.p2,a.bezierProjPcts[m-1],1)}return d.cache=f},c=function(f){var p,v=f==="source";if(i[f]){var h=t.pstyle(f+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var g=u(),y,m=0,b=0,w=0;w<g.length;w++){for(var C=g[v?w:g.length-1-w],x=0;x<C.segments.length;x++){var E=C.segments[v?x:C.segments.length-1-x],k=w===g.length-1&&x===C.segments.length-1;if(m=b,b+=E.length,b>=h||k){y={cp:C,segment:E};break}}if(y)break}var B=y.cp,S=y.segment,N=(h-m)/S.length,D=S.t1-S.t0,P=v?S.t0+D*N:S.t1-D*N;P=Si(0,P,1),e=ya(B.p0,B.p1,B.p2,P),p=AD(B.p0,B.p1,B.p2,P);break}case"straight":case"segments":case"haystack":{for(var L=0,O,I,_,M,F=n.allpts.length,V=0;V+3<F&&(v?(_={x:n.allpts[V],y:n.allpts[V+1]},M={x:n.allpts[V+2],y:n.allpts[V+3]}):(_={x:n.allpts[F-2-V],y:n.allpts[F-1-V]},M={x:n.allpts[F-4-V],y:n.allpts[F-3-V]}),O=In(_,M),I=L,L+=O,!(L>=h));V+=2);var H=h-I,$=H/O;$=Si(0,$,1),e=HB(_,M,$),p=Iv(_,M);break}}o("labelX",f,e.x),o("labelY",f,e.y),o("labelAutoAngle",f,p)}};c("source"),c("target"),this.applyLabelDimensions(t)}},Er.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))},Er.applyPrefixedLabelDimensions=function(t,e){var r=t._private,n=this.getLabelText(t,e),a=this.calculateLabelDimensions(t,n),i=t.pstyle("line-height").pfValue,o=t.pstyle("text-wrap").strValue,l=lr(r.rscratch,"labelWrapCachedLines",e)||[],u=o!=="wrap"?1:Math.max(l.length,1),c=a.height/u,d=c*i,f=a.width,p=a.height+(u-1)*(i-1)*c;sn(r.rstyle,"labelWidth",e,f),sn(r.rscratch,"labelWidth",e,f),sn(r.rstyle,"labelHeight",e,p),sn(r.rscratch,"labelHeight",e,p),sn(r.rscratch,"labelLineHeight",e,d)},Er.getLabelText=function(t,e){var r=t._private,n=e?e+"-":"",a=t.pstyle(n+"label").strValue,i=t.pstyle("text-transform").value,o=function(j,ee){return ee?(sn(r.rscratch,j,e,ee),ee):lr(r.rscratch,j,e)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var l=t.pstyle("text-wrap").value;if(l==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var c="​",d=a.split(`
445
445
  `),f=t.pstyle("text-max-width").pfValue,p=t.pstyle("text-overflow-wrap").value,v=p==="anywhere",h=[],g=/[\s\u200b]+|$/g,y=0;y<d.length;y++){var m=d[y],b=this.calculateLabelDimensions(t,m),w=b.width;if(v){var C=m.split("").join(c);m=C}if(w>f){var x=m.matchAll(g),E="",k=0,B=mh(x),S;try{for(B.s();!(S=B.n()).done;){var N=S.value,D=N[0],P=m.substring(k,N.index);k=N.index+D.length;var L=E.length===0?P:E+P+D,O=this.calculateLabelDimensions(t,L),I=O.width;I<=f?E+=P+D:(E&&h.push(E),E=P+D)}}catch(z){B.e(z)}finally{B.f()}E.match(/^[\s\u200b]+$/)||h.push(E)}else h.push(m)}o("labelWrapCachedLines",h),a=o("labelWrapCachedText",h.join(`
446
446
  `)),o("labelWrapKey",u)}else if(l==="ellipsis"){var _=t.pstyle("text-max-width").pfValue,M="",F="…",V=!1;if(this.calculateLabelDimensions(t,a).width<_)return a;for(var H=0;H<a.length;H++){var $=this.calculateLabelDimensions(t,M+a[H]+F).width;if($>_)break;M+=a[H],H===a.length-1&&(V=!0)}return V||(M+=F),M}return a},Er.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e},Er.calculateLabelDimensions=function(t,e){var r=this,n=r.cy.window(),a=n.document,i=Mn(e,t._private.labelDimsKey),o=r.labelDimCache||(r.labelDimCache=[]),l=o[i];if(l!=null)return l;var u=0,c=t.pstyle("font-style").strValue,d=t.pstyle("font-size").pfValue,f=t.pstyle("font-family").strValue,p=t.pstyle("font-weight").strValue,v=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=a.createElement("canvas"),h=this.labelCalcCanvasContext=v.getContext("2d");var g=v.style;g.position="absolute",g.left="-9999px",g.top="-9999px",g.zIndex="-1",g.visibility="hidden",g.pointerEvents="none"}h.font="".concat(c," ").concat(p," ").concat(d,"px ").concat(f);for(var y=0,m=0,b=e.split(`
447
- `),w=0;w<b.length;w++){var C=b[w],x=h.measureText(C),E=Math.ceil(x.width),k=d;y=Math.max(E,y),m+=k}return y+=u,m+=u,o[i]={width:y,height:m}},Er.calculateLabelAngle=function(t,e){var r=t._private,n=r.rscratch,a=t.isEdge(),i=e?e+"-":"",o=t.pstyle(i+"text-rotation"),l=o.strValue;return l==="none"?0:a&&l==="autorotate"?n.labelAutoAngle:l==="autorotate"?0:o.pfValue},Er.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),n=t._private,a=n.rscratch;a.labelAngle=e.calculateLabelAngle(t),r&&(a.sourceLabelAngle=e.calculateLabelAngle(t,"source"),a.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var Av={},Vv=28,Rv=!1;Av.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<Vv||t.height()<Vv))return Rv||(Ae("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Rv=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var n=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(n).name}return r};var ws={};ws.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,n=function(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),l)for(var u=0;u<o.length;u++){var c=o[u],d=c._private,f=d.rstyle;f.clean=!1,f.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var l=o.target;n(l)}).on("style.* background.*",function(o){var l=o.target;n(l,!1)});var a=function(o){if(o){var l=r.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var c=e[u],d=c._private.rstyle;c.isNode()&&!d.cleanConnected&&(n(c.connectedEdges()),d.cleanConnected=!0)}if(l)for(var f=0;f<l.length;f++){var p=l[f];p(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){a(!0)},r.beforeRender(a,r.beforeRenderPriorities.eleCalcs)},ws.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)},ws.recalculateRenderedStyle=function(t,e){var r=function(C){return C._private.rstyle.cleanConnected},n=[],a=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var o=t[i],l=o._private,u=l.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(l.group==="nodes"?a.push(o):n.push(o),u.clean=!0)}for(var c=0;c<a.length;c++){var d=a[c],f=d._private,p=f.rstyle,v=d.position();this.recalculateNodeLabelProjection(d),p.nodeX=v.x,p.nodeY=v.y,p.nodeW=d.pstyle("width").pfValue,p.nodeH=d.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var h=0;h<n.length;h++){var g=n[h],y=g._private,m=y.rstyle,b=y.rscratch;m.srcX=b.arrowStartX,m.srcY=b.arrowStartY,m.tgtX=b.arrowEndX,m.tgtY=b.arrowEndY,m.midX=b.midX,m.midY=b.midY,m.labelAngle=b.labelAngle,m.sourceLabelAngle=b.sourceLabelAngle,m.targetLabelAngle=b.targetLabelAngle}}};var Cs={};Cs.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var n=t[r],a=n._private.rscratch;n.grabbed()&&!n.isParent()?e.push(n):a.inDragLayer?t.drag.push(n):t.nondrag.push(n)}for(var r=0;r<e.length;r++){var n=e[r];t.drag.push(n)}}},Cs.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},Cs.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(tv),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var $v={};[Kn,ms,Pt,zi,Dc,Er,Av,ws,Cs].forEach(function(t){xe($v,t)});var zv={};zv.getCachedImage=function(t,e,r){var n=this,a=n.imageCache=n.imageCache||{},i=a[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=a[t]=a[t]||{};var o=i.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var l="data:",u=t.substring(0,l.length).toLowerCase()===l;return u||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var Ia={};Ia.registerBinding=function(t,e,r,n){var a=Array.prototype.slice.apply(arguments,[1]),i=this.binder(t);return i.on.apply(i,a)},Ia.binder=function(t){var e=this,r=e.cy.window(),n=t===r||t===r.document||t===r.document.body||lT(t);if(e.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});r.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=a}var o=function(u,c,d){var f=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(f[2]={capture:d??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:f}),(t.addEventListener||t.on).apply(t,f),this};return{on:o,addEventListener:o,addListener:o,bind:o}},Ia.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()},Ia.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()},Ia.load=function(){var t=this,e=t.cy.window(),r=function(T){return T.selected()},n=function(T,R,Q,G){T==null&&(T=t.cy);for(var U=0;U<R.length;U++){var ie=R[U];T.emit({originalEvent:Q,type:ie,position:G})}},a=function(T){return T.shiftKey||T.metaKey||T.ctrlKey},i=function(T,R){var Q=!0;if(t.cy.hasCompoundNodes()&&T&&T.pannable())for(var G=0;R&&G<R.length;G++){var T=R[G];if(T.isNode()&&T.isParent()&&!T.pannable()){Q=!1;break}}else Q=!0;return Q},o=function(T){T[0]._private.grabbed=!0},l=function(T){T[0]._private.grabbed=!1},u=function(T){T[0]._private.rscratch.inDragLayer=!0},c=function(T){T[0]._private.rscratch.inDragLayer=!1},d=function(T){T[0]._private.rscratch.isGrabTarget=!0},f=function(T){T[0]._private.rscratch.isGrabTarget=!1},p=function(T,R){var Q=R.addToList,G=Q.has(T);!G&&T.grabbable()&&!T.locked()&&(Q.merge(T),o(T))},v=function(T,R){if(T.cy().hasCompoundNodes()&&!(R.inDragLayer==null&&R.addToList==null)){var Q=T.descendants();R.inDragLayer&&(Q.forEach(u),Q.connectedEdges().forEach(u)),R.addToList&&p(Q,R)}},h=function(T,R){R=R||{};var Q=T.cy().hasCompoundNodes();R.inDragLayer&&(T.forEach(u),T.neighborhood().stdFilter(function(G){return!Q||G.isEdge()}).forEach(u)),R.addToList&&T.forEach(function(G){p(G,R)}),v(T,R),m(T,{inDragLayer:R.inDragLayer}),t.updateCachedGrabbedEles()},g=h,y=function(T){T&&(t.getCachedZSortedEles().forEach(function(R){l(R),c(R),f(R)}),t.updateCachedGrabbedEles())},m=function(T,R){if(!(R.inDragLayer==null&&R.addToList==null)&&T.cy().hasCompoundNodes()){var Q=T.ancestors().orphans();if(!Q.same(T)){var G=Q.descendants().spawnSelf().merge(Q).unmerge(T).unmerge(T.descendants()),U=G.connectedEdges();R.inDragLayer&&(U.forEach(u),G.forEach(u)),R.addToList&&G.forEach(function(ie){p(ie,R)})}}},b=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},w=typeof MutationObserver<"u",C=typeof ResizeObserver<"u";w?(t.removeObserver=new MutationObserver(function(te){for(var T=0;T<te.length;T++){var R=te[T],Q=R.removedNodes;if(Q)for(var G=0;G<Q.length;G++){var U=Q[G];if(U===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(te){t.destroy()});var x=_o(function(){t.cy.resize()},100);w&&(t.styleObserver=new MutationObserver(x),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",x),C&&(t.resizeObserver=new ResizeObserver(x),t.resizeObserver.observe(t.container));var E=function(T,R){for(;T!=null;)R(T),T=T.parentNode},k=function(){t.invalidateContainerClientCoordsCache()};E(t.container,function(te){t.registerBinding(te,"transitionend",k),t.registerBinding(te,"animationend",k),t.registerBinding(te,"scroll",k)}),t.registerBinding(t.container,"contextmenu",function(te){te.preventDefault()});var B=function(){return t.selection[4]!==0},S=function(T){for(var R=t.findContainerClientCoords(),Q=R[0],G=R[1],U=R[2],ie=R[3],X=T.touches?T.touches:[T],ae=!1,we=0;we<X.length;we++){var Ce=X[we];if(Q<=Ce.clientX&&Ce.clientX<=Q+U&&G<=Ce.clientY&&Ce.clientY<=G+ie){ae=!0;break}}if(!ae)return!1;for(var ge=t.container,Se=T.target,ve=Se.parentNode,ye=!1;ve;){if(ve===ge){ye=!0;break}ve=ve.parentNode}return!!ye};t.registerBinding(t.container,"mousedown",function(T){if(S(T)&&!(t.hoverData.which===1&&T.which!==1)){T.preventDefault(),b(),t.hoverData.capture=!0,t.hoverData.which=T.which;var R=t.cy,Q=[T.clientX,T.clientY],G=t.projectIntoViewport(Q[0],Q[1]),U=t.selection,ie=t.findNearestElements(G[0],G[1],!0,!1),X=ie[0],ae=t.dragData.possibleDragElements;t.hoverData.mdownPos=G,t.hoverData.mdownGPos=Q;var we=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var Ge=t.hoverData.down;Ge?Ge.emit({originalEvent:T,type:"taphold",position:{x:G[0],y:G[1]}}):R.emit({originalEvent:T,type:"taphold",position:{x:G[0],y:G[1]}})}},t.tapholdDuration)};if(T.which==3){t.hoverData.cxtStarted=!0;var Ce={originalEvent:T,type:"cxttapstart",position:{x:G[0],y:G[1]}};X?(X.activate(),X.emit(Ce),t.hoverData.down=X):R.emit(Ce),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(T.which==1){X&&X.activate();{if(X!=null&&t.nodeIsGrabbable(X)){var ge=function(Ge){return{originalEvent:T,type:Ge,position:{x:G[0],y:G[1]}}},Se=function(Ge){Ge.emit(ge("grab"))};if(d(X),!X.selected())ae=t.dragData.possibleDragElements=R.collection(),g(X,{addToList:ae}),X.emit(ge("grabon")).emit(ge("grab"));else{ae=t.dragData.possibleDragElements=R.collection();var ve=R.$(function(ye){return ye.isNode()&&ye.selected()&&t.nodeIsGrabbable(ye)});h(ve,{addToList:ae}),X.emit(ge("grabon")),ve.forEach(Se)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=X,t.hoverData.downs=ie,t.hoverData.downTime=new Date().getTime()}n(X,["mousedown","tapstart","vmousedown"],T,{x:G[0],y:G[1]}),X==null?(U[4]=1,t.data.bgActivePosistion={x:G[0],y:G[1]},t.redrawHint("select",!0),t.redraw()):X.pannable()&&(U[4]=1),we()}U[0]=U[2]=G[0],U[1]=U[3]=G[1]}},!1),t.registerBinding(e,"mousemove",function(T){var R=t.hoverData.capture;if(!(!R&&!S(T))){var Q=!1,G=t.cy,U=G.zoom(),ie=[T.clientX,T.clientY],X=t.projectIntoViewport(ie[0],ie[1]),ae=t.hoverData.mdownPos,we=t.hoverData.mdownGPos,Ce=t.selection,ge=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(ge=t.findNearestElement(X[0],X[1],!0,!1));var Se=t.hoverData.last,ve=t.hoverData.down,ye=[X[0]-Ce[2],X[1]-Ce[3]],Ge=t.dragData.possibleDragElements,Re;if(we){var rt=ie[0]-we[0],nt=rt*rt,Qe=ie[1]-we[1],Ot=Qe*Qe,ut=nt+Ot;t.hoverData.isOverThresholdDrag=Re=ut>=t.desktopTapThreshold2}var ht=a(T);Re&&(t.hoverData.tapholdCancelled=!0);var Wt=function(){var q=t.hoverData.dragDelta=t.hoverData.dragDelta||[];q.length===0?(q.push(ye[0]),q.push(ye[1])):(q[0]+=ye[0],q[1]+=ye[1])};Q=!0,n(ge,["mousemove","vmousemove","tapdrag"],T,{x:X[0],y:X[1]});var _t=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||G.emit({originalEvent:T,type:"boxstart",position:{x:X[0],y:X[1]}}),Ce[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Re){var Lt={originalEvent:T,type:"cxtdrag",position:{x:X[0],y:X[1]}};ve?ve.emit(Lt):G.emit(Lt),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||ge!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:X[0],y:X[1]}}),t.hoverData.cxtOver=ge,ge&&ge.emit({originalEvent:T,type:"cxtdragover",position:{x:X[0],y:X[1]}}))}}else if(t.hoverData.dragging){if(Q=!0,G.panningEnabled()&&G.userPanningEnabled()){var tr;if(t.hoverData.justStartedPan){var dr=t.hoverData.mdownPos;tr={x:(X[0]-dr[0])*U,y:(X[1]-dr[1])*U},t.hoverData.justStartedPan=!1}else tr={x:ye[0]*U,y:ye[1]*U};G.panBy(tr),G.emit("dragpan"),t.hoverData.dragged=!0}X=t.projectIntoViewport(T.clientX,T.clientY)}else if(Ce[4]==1&&(ve==null||ve.pannable())){if(Re){if(!t.hoverData.dragging&&G.boxSelectionEnabled()&&(ht||!G.panningEnabled()||!G.userPanningEnabled()))_t();else if(!t.hoverData.selecting&&G.panningEnabled()&&G.userPanningEnabled()){var Kt=i(ve,t.hoverData.downs);Kt&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Ce[4]=0,t.data.bgActivePosistion=ma(ae),t.redrawHint("select",!0),t.redraw())}ve&&ve.pannable()&&ve.active()&&ve.unactivate()}}else{if(ve&&ve.pannable()&&ve.active()&&ve.unactivate(),(!ve||!ve.grabbed())&&ge!=Se&&(Se&&n(Se,["mouseout","tapdragout"],T,{x:X[0],y:X[1]}),ge&&n(ge,["mouseover","tapdragover"],T,{x:X[0],y:X[1]}),t.hoverData.last=ge),ve)if(Re){if(G.boxSelectionEnabled()&&ht)ve&&ve.grabbed()&&(y(Ge),ve.emit("freeon"),Ge.emit("free"),t.dragData.didDrag&&(ve.emit("dragfreeon"),Ge.emit("dragfree"))),_t();else if(ve&&ve.grabbed()&&t.nodeIsDraggable(ve)){var Je=!t.dragData.didDrag;Je&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||h(Ge,{inDragLayer:!0});var at={x:0,y:0};if(le(ye[0])&&le(ye[1])&&(at.x+=ye[0],at.y+=ye[1],Je)){var pt=t.hoverData.dragDelta;pt&&le(pt[0])&&le(pt[1])&&(at.x+=pt[0],at.y+=pt[1])}t.hoverData.draggingEles=!0,Ge.silentShift(at).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else Wt();Q=!0}if(Ce[2]=X[0],Ce[3]=X[1],Q)return T.stopPropagation&&T.stopPropagation(),T.preventDefault&&T.preventDefault(),!1}},!1);var N,D,P;t.registerBinding(e,"mouseup",function(T){if(!(t.hoverData.which===1&&T.which!==1&&t.hoverData.capture)){var R=t.hoverData.capture;if(R){t.hoverData.capture=!1;var Q=t.cy,G=t.projectIntoViewport(T.clientX,T.clientY),U=t.selection,ie=t.findNearestElement(G[0],G[1],!0,!1),X=t.dragData.possibleDragElements,ae=t.hoverData.down,we=a(T);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ae&&ae.unactivate(),t.hoverData.which===3){var Ce={originalEvent:T,type:"cxttapend",position:{x:G[0],y:G[1]}};if(ae?ae.emit(Ce):Q.emit(Ce),!t.hoverData.cxtDragged){var ge={originalEvent:T,type:"cxttap",position:{x:G[0],y:G[1]}};ae?ae.emit(ge):Q.emit(ge)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(n(ie,["mouseup","tapend","vmouseup"],T,{x:G[0],y:G[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(n(ae,["click","tap","vclick"],T,{x:G[0],y:G[1]}),D=!1,T.timeStamp-P<=Q.multiClickDebounceTime()?(N&&clearTimeout(N),D=!0,P=null,n(ae,["dblclick","dbltap","vdblclick"],T,{x:G[0],y:G[1]})):(N=setTimeout(function(){D||n(ae,["oneclick","onetap","voneclick"],T,{x:G[0],y:G[1]})},Q.multiClickDebounceTime()),P=T.timeStamp)),ae==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!a(T)&&(Q.$(r).unselect(["tapunselect"]),X.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=X=Q.collection()),ie==ae&&!t.dragData.didDrag&&!t.hoverData.selecting&&ie!=null&&ie._private.selectable&&(t.hoverData.dragging||(Q.selectionType()==="additive"||we?ie.selected()?ie.unselect(["tapunselect"]):ie.select(["tapselect"]):we||(Q.$(r).unmerge(ie).unselect(["tapunselect"]),ie.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Se=Q.collection(t.getAllInBox(U[0],U[1],U[2],U[3]));t.redrawHint("select",!0),Se.length>0&&t.redrawHint("eles",!0),Q.emit({type:"boxend",originalEvent:T,position:{x:G[0],y:G[1]}});var ve=function(Re){return Re.selectable()&&!Re.selected()};Q.selectionType()==="additive"||we||Q.$(r).unmerge(Se).unselect(),Se.emit("box").stdFilter(ve).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!U[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var ye=ae&&ae.grabbed();y(X),ye&&(ae.emit("freeon"),X.emit("free"),t.dragData.didDrag&&(ae.emit("dragfreeon"),X.emit("dragfree")))}}U[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var L=function(T){if(!t.scrollingPage){var R=t.cy,Q=R.zoom(),G=R.pan(),U=t.projectIntoViewport(T.clientX,T.clientY),ie=[U[0]*Q+G.x,U[1]*Q+G.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||B()){T.preventDefault();return}if(R.panningEnabled()&&R.userPanningEnabled()&&R.zoomingEnabled()&&R.userZoomingEnabled()){T.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var X;T.deltaY!=null?X=T.deltaY/-250:T.wheelDeltaY!=null?X=T.wheelDeltaY/1e3:X=T.wheelDelta/1e3,X=X*t.wheelSensitivity;var ae=T.deltaMode===1;ae&&(X*=33);var we=R.zoom()*Math.pow(10,X);T.type==="gesturechange"&&(we=t.gestureStartZoom*T.scale),R.zoom({level:we,renderedPosition:{x:ie[0],y:ie[1]}}),R.emit(T.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",L,!0),t.registerBinding(e,"scroll",function(T){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(T){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||T.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(te){t.hasTouchStarted||L(te)},!0),t.registerBinding(t.container,"mouseout",function(T){var R=t.projectIntoViewport(T.clientX,T.clientY);t.cy.emit({originalEvent:T,type:"mouseout",position:{x:R[0],y:R[1]}})},!1),t.registerBinding(t.container,"mouseover",function(T){var R=t.projectIntoViewport(T.clientX,T.clientY);t.cy.emit({originalEvent:T,type:"mouseover",position:{x:R[0],y:R[1]}})},!1);var O,I,_,M,F,V,H,$,z,j,ee,J,Z,re=function(T,R,Q,G){return Math.sqrt((Q-T)*(Q-T)+(G-R)*(G-R))},Y=function(T,R,Q,G){return(Q-T)*(Q-T)+(G-R)*(G-R)},A;t.registerBinding(t.container,"touchstart",A=function(T){if(t.hasTouchStarted=!0,!!S(T)){b(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var R=t.cy,Q=t.touchData.now,G=t.touchData.earlier;if(T.touches[0]){var U=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);Q[0]=U[0],Q[1]=U[1]}if(T.touches[1]){var U=t.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);Q[2]=U[0],Q[3]=U[1]}if(T.touches[2]){var U=t.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);Q[4]=U[0],Q[5]=U[1]}if(T.touches[1]){t.touchData.singleTouchMoved=!0,y(t.dragData.touchDragEles);var ie=t.findContainerClientCoords();z=ie[0],j=ie[1],ee=ie[2],J=ie[3],O=T.touches[0].clientX-z,I=T.touches[0].clientY-j,_=T.touches[1].clientX-z,M=T.touches[1].clientY-j,Z=0<=O&&O<=ee&&0<=_&&_<=ee&&0<=I&&I<=J&&0<=M&&M<=J;var X=R.pan(),ae=R.zoom();F=re(O,I,_,M),V=Y(O,I,_,M),H=[(O+_)/2,(I+M)/2],$=[(H[0]-X.x)/ae,(H[1]-X.y)/ae];var we=200,Ce=we*we;if(V<Ce&&!T.touches[2]){var ge=t.findNearestElement(Q[0],Q[1],!0,!0),Se=t.findNearestElement(Q[2],Q[3],!0,!0);ge&&ge.isNode()?(ge.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:Q[0],y:Q[1]}}),t.touchData.start=ge):Se&&Se.isNode()?(Se.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:Q[0],y:Q[1]}}),t.touchData.start=Se):R.emit({originalEvent:T,type:"cxttapstart",position:{x:Q[0],y:Q[1]}}),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(T.touches[2])R.boxSelectionEnabled()&&T.preventDefault();else if(!T.touches[1]){if(T.touches[0]){var ve=t.findNearestElements(Q[0],Q[1],!0,!0),ye=ve[0];if(ye!=null&&(ye.activate(),t.touchData.start=ye,t.touchData.starts=ve,t.nodeIsGrabbable(ye))){var Ge=t.dragData.touchDragEles=R.collection(),Re=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),ye.selected()?(Re=R.$(function(ut){return ut.selected()&&t.nodeIsGrabbable(ut)}),h(Re,{addToList:Ge})):g(ye,{addToList:Ge}),d(ye);var rt=function(ht){return{originalEvent:T,type:ht,position:{x:Q[0],y:Q[1]}}};ye.emit(rt("grabon")),Re?Re.forEach(function(ut){ut.emit(rt("grab"))}):ye.emit(rt("grab"))}n(ye,["touchstart","tapstart","vmousedown"],T,{x:Q[0],y:Q[1]}),ye==null&&(t.data.bgActivePosistion={x:U[0],y:U[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&n(t.touchData.start,["taphold"],T,{x:Q[0],y:Q[1]})},t.tapholdDuration)}}if(T.touches.length>=1){for(var nt=t.touchData.startPosition=[null,null,null,null,null,null],Qe=0;Qe<Q.length;Qe++)nt[Qe]=G[Qe]=Q[Qe];var Ot=T.touches[0];t.touchData.startGPosition=[Ot.clientX,Ot.clientY]}}},!1);var K;t.registerBinding(e,"touchmove",K=function(T){var R=t.touchData.capture;if(!(!R&&!S(T))){var Q=t.selection,G=t.cy,U=t.touchData.now,ie=t.touchData.earlier,X=G.zoom();if(T.touches[0]){var ae=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);U[0]=ae[0],U[1]=ae[1]}if(T.touches[1]){var ae=t.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);U[2]=ae[0],U[3]=ae[1]}if(T.touches[2]){var ae=t.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);U[4]=ae[0],U[5]=ae[1]}var we=t.touchData.startGPosition,Ce;if(R&&T.touches[0]&&we){for(var ge=[],Se=0;Se<U.length;Se++)ge[Se]=U[Se]-ie[Se];var ve=T.touches[0].clientX-we[0],ye=ve*ve,Ge=T.touches[0].clientY-we[1],Re=Ge*Ge,rt=ye+Re;Ce=rt>=t.touchTapThreshold2}if(R&&t.touchData.cxt){T.preventDefault();var nt=T.touches[0].clientX-z,Qe=T.touches[0].clientY-j,Ot=T.touches[1].clientX-z,ut=T.touches[1].clientY-j,ht=Y(nt,Qe,Ot,ut),Wt=ht/V,_t=150,Lt=_t*_t,tr=1.5,dr=tr*tr;if(Wt>=dr||ht>=Lt){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Kt={originalEvent:T,type:"cxttapend",position:{x:U[0],y:U[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(Kt),t.touchData.start=null):G.emit(Kt)}}if(R&&t.touchData.cxt){var Kt={originalEvent:T,type:"cxtdrag",position:{x:U[0],y:U[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Kt):G.emit(Kt),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Je=t.findNearestElement(U[0],U[1],!0,!0);(!t.touchData.cxtOver||Je!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:U[0],y:U[1]}}),t.touchData.cxtOver=Je,Je&&Je.emit({originalEvent:T,type:"cxtdragover",position:{x:U[0],y:U[1]}}))}else if(R&&T.touches[2]&&G.boxSelectionEnabled())T.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||G.emit({originalEvent:T,type:"boxstart",position:{x:U[0],y:U[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,Q[4]=1,!Q||Q.length===0||Q[0]===void 0?(Q[0]=(U[0]+U[2]+U[4])/3,Q[1]=(U[1]+U[3]+U[5])/3,Q[2]=(U[0]+U[2]+U[4])/3+1,Q[3]=(U[1]+U[3]+U[5])/3+1):(Q[2]=(U[0]+U[2]+U[4])/3,Q[3]=(U[1]+U[3]+U[5])/3),t.redrawHint("select",!0),t.redraw();else if(R&&T.touches[1]&&!t.touchData.didSelect&&G.zoomingEnabled()&&G.panningEnabled()&&G.userZoomingEnabled()&&G.userPanningEnabled()){T.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var at=t.dragData.touchDragEles;if(at){t.redrawHint("drag",!0);for(var pt=0;pt<at.length;pt++){var mn=at[pt]._private;mn.grabbed=!1,mn.rscratch.inDragLayer=!1}}var q=t.touchData.start,nt=T.touches[0].clientX-z,Qe=T.touches[0].clientY-j,Ot=T.touches[1].clientX-z,ut=T.touches[1].clientY-j,ce=re(nt,Qe,Ot,ut),Oe=ce/F;if(Z){var ze=nt-O,Tr=Qe-I,yn=Ot-_,za=ut-M,qr=(ze+yn)/2,rr=(Tr+za)/2,bn=G.zoom(),Vc=bn*Oe,Ss=G.pan(),hg=$[0]*bn+Ss.x,pg=$[1]*bn+Ss.y,YP={x:-Vc/bn*(hg-Ss.x-qr)+hg,y:-Vc/bn*(pg-Ss.y-rr)+pg};if(q&&q.active()){var at=t.dragData.touchDragEles;y(at),t.redrawHint("drag",!0),t.redrawHint("eles",!0),q.unactivate().emit("freeon"),at.emit("free"),t.dragData.didDrag&&(q.emit("dragfreeon"),at.emit("dragfree"))}G.viewport({zoom:Vc,pan:YP,cancelOnFailedZoom:!0}),G.emit("pinchzoom"),F=ce,O=nt,I=Qe,_=Ot,M=ut,t.pinching=!0}if(T.touches[0]){var ae=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);U[0]=ae[0],U[1]=ae[1]}if(T.touches[1]){var ae=t.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);U[2]=ae[0],U[3]=ae[1]}if(T.touches[2]){var ae=t.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);U[4]=ae[0],U[5]=ae[1]}}else if(T.touches[0]&&!t.touchData.didSelect){var fr=t.touchData.start,Rc=t.touchData.last,Je;if(!t.hoverData.draggingEles&&!t.swipePanning&&(Je=t.findNearestElement(U[0],U[1],!0,!0)),R&&fr!=null&&T.preventDefault(),R&&fr!=null&&t.nodeIsDraggable(fr))if(Ce){var at=t.dragData.touchDragEles,vg=!t.dragData.didDrag;vg&&h(at,{inDragLayer:!0}),t.dragData.didDrag=!0;var Gi={x:0,y:0};if(le(ge[0])&&le(ge[1])&&(Gi.x+=ge[0],Gi.y+=ge[1],vg)){t.redrawHint("eles",!0);var hr=t.touchData.dragDelta;hr&&le(hr[0])&&le(hr[1])&&(Gi.x+=hr[0],Gi.y+=hr[1])}t.hoverData.draggingEles=!0,at.silentShift(Gi).emit("position drag"),t.redrawHint("drag",!0),t.touchData.startPosition[0]==ie[0]&&t.touchData.startPosition[1]==ie[1]&&t.redrawHint("eles",!0),t.redraw()}else{var hr=t.touchData.dragDelta=t.touchData.dragDelta||[];hr.length===0?(hr.push(ge[0]),hr.push(ge[1])):(hr[0]+=ge[0],hr[1]+=ge[1])}if(n(fr||Je,["touchmove","tapdrag","vmousemove"],T,{x:U[0],y:U[1]}),(!fr||!fr.grabbed())&&Je!=Rc&&(Rc&&Rc.emit({originalEvent:T,type:"tapdragout",position:{x:U[0],y:U[1]}}),Je&&Je.emit({originalEvent:T,type:"tapdragover",position:{x:U[0],y:U[1]}})),t.touchData.last=Je,R)for(var pt=0;pt<U.length;pt++)U[pt]&&t.touchData.startPosition[pt]&&Ce&&(t.touchData.singleTouchMoved=!0);if(R&&(fr==null||fr.pannable())&&G.panningEnabled()&&G.userPanningEnabled()){var XP=i(fr,t.touchData.starts);XP&&(T.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=ma(t.touchData.startPosition)),t.swipePanning?(G.panBy({x:ge[0]*X,y:ge[1]*X}),G.emit("dragpan")):Ce&&(t.swipePanning=!0,G.panBy({x:ve*X,y:Ge*X}),G.emit("dragpan"),fr&&(fr.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ae=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);U[0]=ae[0],U[1]=ae[1]}}for(var Se=0;Se<U.length;Se++)ie[Se]=U[Se];R&&T.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var W;t.registerBinding(e,"touchcancel",W=function(T){var R=t.touchData.start;t.touchData.capture=!1,R&&R.unactivate()});var oe,he,ne,se;if(t.registerBinding(e,"touchend",oe=function(T){var R=t.touchData.start,Q=t.touchData.capture;if(Q)T.touches.length===0&&(t.touchData.capture=!1),T.preventDefault();else return;var G=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var U=t.cy,ie=U.zoom(),X=t.touchData.now,ae=t.touchData.earlier;if(T.touches[0]){var we=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);X[0]=we[0],X[1]=we[1]}if(T.touches[1]){var we=t.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);X[2]=we[0],X[3]=we[1]}if(T.touches[2]){var we=t.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);X[4]=we[0],X[5]=we[1]}R&&R.unactivate();var Ce;if(t.touchData.cxt){if(Ce={originalEvent:T,type:"cxttapend",position:{x:X[0],y:X[1]}},R?R.emit(Ce):U.emit(Ce),!t.touchData.cxtDragged){var ge={originalEvent:T,type:"cxttap",position:{x:X[0],y:X[1]}};R?R.emit(ge):U.emit(ge)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!T.touches[2]&&U.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Se=U.collection(t.getAllInBox(G[0],G[1],G[2],G[3]));G[0]=void 0,G[1]=void 0,G[2]=void 0,G[3]=void 0,G[4]=0,t.redrawHint("select",!0),U.emit({type:"boxend",originalEvent:T,position:{x:X[0],y:X[1]}});var ve=function(Lt){return Lt.selectable()&&!Lt.selected()};Se.emit("box").stdFilter(ve).select().emit("boxselect"),Se.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(R!=null&&R.unactivate(),T.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!T.touches[1]){if(!T.touches[0]){if(!T.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ye=t.dragData.touchDragEles;if(R!=null){var Ge=R._private.grabbed;y(ye),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ge&&(R.emit("freeon"),ye.emit("free"),t.dragData.didDrag&&(R.emit("dragfreeon"),ye.emit("dragfree"))),n(R,["touchend","tapend","vmouseup","tapdragout"],T,{x:X[0],y:X[1]}),R.unactivate(),t.touchData.start=null}else{var Re=t.findNearestElement(X[0],X[1],!0,!0);n(Re,["touchend","tapend","vmouseup","tapdragout"],T,{x:X[0],y:X[1]})}var rt=t.touchData.startPosition[0]-X[0],nt=rt*rt,Qe=t.touchData.startPosition[1]-X[1],Ot=Qe*Qe,ut=nt+Ot,ht=ut*ie*ie;t.touchData.singleTouchMoved||(R||U.$(":selected").unselect(["tapunselect"]),n(R,["tap","vclick"],T,{x:X[0],y:X[1]}),he=!1,T.timeStamp-se<=U.multiClickDebounceTime()?(ne&&clearTimeout(ne),he=!0,se=null,n(R,["dbltap","vdblclick"],T,{x:X[0],y:X[1]})):(ne=setTimeout(function(){he||n(R,["onetap","voneclick"],T,{x:X[0],y:X[1]})},U.multiClickDebounceTime()),se=T.timeStamp)),R!=null&&!t.dragData.didDrag&&R._private.selectable&&ht<t.touchTapThreshold2&&!t.pinching&&(U.selectionType()==="single"?(U.$(r).unmerge(R).unselect(["tapunselect"]),R.select(["tapselect"])):R.selected()?R.unselect(["tapunselect"]):R.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Wt=0;Wt<X.length;Wt++)ae[Wt]=X[Wt];t.dragData.didDrag=!1,T.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),T.touches.length<2&&(T.touches.length===1&&(t.touchData.startGPosition=[T.touches[0].clientX,T.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var ue=[],pe=function(T){return{clientX:T.clientX,clientY:T.clientY,force:1,identifier:T.pointerId,pageX:T.pageX,pageY:T.pageY,radiusX:T.width/2,radiusY:T.height/2,screenX:T.screenX,screenY:T.screenY,target:T.target}},de=function(T){return{event:T,touch:pe(T)}},me=function(T){ue.push(de(T))},Ne=function(T){for(var R=0;R<ue.length;R++){var Q=ue[R];if(Q.event.pointerId===T.pointerId){ue.splice(R,1);return}}},De=function(T){var R=ue.filter(function(Q){return Q.event.pointerId===T.pointerId})[0];R.event=T,R.touch=pe(T)},Ee=function(T){T.touches=ue.map(function(R){return R.touch})},Pe=function(T){return T.pointerType==="mouse"||T.pointerType===4};t.registerBinding(t.container,"pointerdown",function(te){Pe(te)||(te.preventDefault(),me(te),Ee(te),A(te))}),t.registerBinding(t.container,"pointerup",function(te){Pe(te)||(Ne(te),Ee(te),oe(te))}),t.registerBinding(t.container,"pointercancel",function(te){Pe(te)||(Ne(te),Ee(te),W(te))}),t.registerBinding(t.container,"pointermove",function(te){Pe(te)||(te.preventDefault(),De(te),Ee(te),K(te))})}};var Hr={};Hr.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(n,a,i,o,l,u){this.renderer.nodeShapeImpl("polygon",n,a,i,o,l,this.points)},intersectLine:function(n,a,i,o,l,u,c,d){return Bi(l,u,this.points,n,a,i/2,o/2,c)},checkPoint:function(n,a,i,o,l,u,c,d){return Rr(n,a,this.points,u,c,o,l,[0,-1],i)}}},Hr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i)},intersectLine:function(e,r,n,a,i,o,l,u){return t5(i,o,e,r,n/2+l,a/2+l)},checkPoint:function(e,r,n,a,i,o,l,u){return Vn(e,r,a,i,o,l,n)}}},Hr.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(n,a,i,o,l,u,c){if(u[c]!==void 0&&u[c+"-cx"]===n&&u[c+"-cy"]===a)return u[c];u[c]=new Array(e.length/2),u[c+"-cx"]=n,u[c+"-cy"]=a;var d=i/2,f=o/2;l=l==="auto"?Xh(i,o):l;for(var p=new Array(e.length/2),v=0;v<e.length/2;v++)p[v]={x:n+d*e[v*2],y:a+f*e[v*2+1]};var h,g,y,m,b=p.length;for(g=p[b-1],h=0;h<b;h++)y=p[h%b],m=p[(h+1)%b],u[c][h]=Nc(g,y,m,l),g=y,y=m;return u[c]},draw:function(n,a,i,o,l,u,c){this.renderer.nodeShapeImpl("round-polygon",n,a,i,o,l,this.points,this.getOrCreateCorners(a,i,o,l,u,c,"drawCorners"))},intersectLine:function(n,a,i,o,l,u,c,d,f){return r5(l,u,this.points,n,a,i,o,c,this.getOrCreateCorners(n,a,i,o,d,f,"corners"))},checkPoint:function(n,a,i,o,l,u,c,d,f){return e5(n,a,this.points,u,c,o,l,this.getOrCreateCorners(u,c,o,l,d,f,"corners"))}}},Hr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Mt(4,0),draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i,this.points,o)},intersectLine:function(e,r,n,a,i,o,l,u){return jh(i,o,e,r,n,a,l,u)},checkPoint:function(e,r,n,a,i,o,l,u){var c=a/2,d=i/2;u=u==="auto"?Rn(a,i):u,u=Math.min(c,d,u);var f=u*2;return!!(Rr(e,r,this.points,o,l,a,i-f,[0,-1],n)||Rr(e,r,this.points,o,l,a-f,i,[0,-1],n)||Vn(e,r,f,f,o-c+u,l-d+u,n)||Vn(e,r,f,f,o+c-u,l-d+u,n)||Vn(e,r,f,f,o+c-u,l+d-u,n)||Vn(e,r,f,f,o-c+u,l+d-u,n))}}},Hr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Jl(),points:Mt(4,0),draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i,null,o)},generateCutTrianglePts:function(e,r,n,a,i){var o=i==="auto"?this.cornerLength:i,l=r/2,u=e/2,c=n-u,d=n+u,f=a-l,p=a+l;return{topLeft:[c,f+o,c+o,f,c+o,f+o],topRight:[d-o,f,d,f+o,d-o,f+o],bottomRight:[d,p-o,d-o,p,d-o,p-o],bottomLeft:[c+o,p,c,p-o,c+o,p-o]}},intersectLine:function(e,r,n,a,i,o,l,u){var c=this.generateCutTrianglePts(n+2*l,a+2*l,e,r,u),d=[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]);return Bi(i,o,d,e,r)},checkPoint:function(e,r,n,a,i,o,l,u){var c=u==="auto"?this.cornerLength:u;if(Rr(e,r,this.points,o,l,a,i-2*c,[0,-1],n)||Rr(e,r,this.points,o,l,a-2*c,i,[0,-1],n))return!0;var d=this.generateCutTrianglePts(a,i,o,l);return Ht(e,r,d.topLeft)||Ht(e,r,d.topRight)||Ht(e,r,d.bottomRight)||Ht(e,r,d.bottomLeft)}}},Hr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Mt(4,0),draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i)},intersectLine:function(e,r,n,a,i,o,l,u){var c=.15,d=.5,f=.85,p=this.generateBarrelBezierPts(n+2*l,a+2*l,e,r),v=function(y){var m=ya({x:y[0],y:y[1]},{x:y[2],y:y[3]},{x:y[4],y:y[5]},c),b=ya({x:y[0],y:y[1]},{x:y[2],y:y[3]},{x:y[4],y:y[5]},d),w=ya({x:y[0],y:y[1]},{x:y[2],y:y[3]},{x:y[4],y:y[5]},f);return[y[0],y[1],m.x,m.y,b.x,b.y,w.x,w.y,y[4],y[5]]},h=[].concat(v(p.topLeft),v(p.topRight),v(p.bottomRight),v(p.bottomLeft));return Bi(i,o,h,e,r)},generateBarrelBezierPts:function(e,r,n,a){var i=r/2,o=e/2,l=n-o,u=n+o,c=a-i,d=a+i,f=ec(e,r),p=f.heightOffset,v=f.widthOffset,h=f.ctrlPtOffsetPct*e,g={topLeft:[l,c+p,l+h,c,l+v,c],topRight:[u-v,c,u-h,c,u,c+p],bottomRight:[u,d-p,u-h,d,u-v,d],bottomLeft:[l+v,d,l+h,d,l,d-p]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,r,n,a,i,o,l,u){var c=ec(a,i),d=c.heightOffset,f=c.widthOffset;if(Rr(e,r,this.points,o,l,a,i-2*d,[0,-1],n)||Rr(e,r,this.points,o,l,a-2*f,i,[0,-1],n))return!0;for(var p=this.generateBarrelBezierPts(a,i,o,l),v=function(B,S,N){var D=N[4],P=N[2],L=N[0],O=N[5],I=N[1],_=Math.min(D,L),M=Math.max(D,L),F=Math.min(O,I),V=Math.max(O,I);if(_<=B&&B<=M&&F<=S&&S<=V){var H=n5(D,P,L),$=XB(H[0],H[1],H[2],B),z=$.filter(function(j){return 0<=j&&j<=1});if(z.length>0)return z[0]}return null},h=Object.keys(p),g=0;g<h.length;g++){var y=h[g],m=p[y],b=v(e,r,m);if(b!=null){var w=m[5],C=m[3],x=m[1],E=ft(w,C,x,b);if(m.isTop&&E<=r||m.isBottom&&r<=E)return!0}}return!1}}},Hr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Mt(4,0),draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i,this.points,o)},intersectLine:function(e,r,n,a,i,o,l,u){var c=e-(n/2+l),d=r-(a/2+l),f=d,p=e+(n/2+l),v=ln(i,o,e,r,c,d,p,f,!1);return v.length>0?v:jh(i,o,e,r,n,a,l,u)},checkPoint:function(e,r,n,a,i,o,l,u){u=u==="auto"?Rn(a,i):u;var c=2*u;if(Rr(e,r,this.points,o,l,a,i-c,[0,-1],n)||Rr(e,r,this.points,o,l,a-c,i,[0,-1],n))return!0;var d=a/2+2*n,f=i/2+2*n,p=[o-d,l-f,o-d,l,o+d,l,o+d,l-f];return!!(Ht(e,r,p)||Vn(e,r,c,c,o+a/2-u,l+i/2-u,n)||Vn(e,r,c,c,o-a/2+u,l+i/2-u,n))}}},Hr.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Mt(3,0)),this.generateRoundPolygon("round-triangle",Mt(3,0)),this.generatePolygon("rectangle",Mt(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",Mt(5,0)),this.generateRoundPolygon("round-pentagon",Mt(5,0)),this.generatePolygon("hexagon",Mt(6,0)),this.generateRoundPolygon("round-hexagon",Mt(6,0)),this.generatePolygon("heptagon",Mt(7,0)),this.generateRoundPolygon("round-heptagon",Mt(7,0)),this.generatePolygon("octagon",Mt(8,0)),this.generateRoundPolygon("round-octagon",Mt(8,0));var n=new Array(20);{var a=Ql(5,0),i=Ql(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var l=0;l<i.length/2;l++)i[l*2]*=o,i[l*2+1]*=o;for(var l=0;l<20/4;l++)n[l*4]=a[l*2],n[l*4+1]=a[l*2+1],n[l*4+2]=i[l*2],n[l*4+3]=i[l*2+1]}n=Yh(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}t.makePolygon=function(c){var d=c.join("$"),f="polygon-"+d,p;return(p=this[f])?p:e.generatePolygon(f,c)}};var Hi={};Hi.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},Hi.redraw=function(t){t=t||zh();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t},Hi.beforeRender=function(t,e){if(!this.destroyed){e==null&&Xe("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(n,a){return a.priority-n.priority})}};var Hv=function(e,r,n){for(var a=e.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(r,n)};Hi.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function n(a){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){Hv(t,!0,a);var i=Vr();t.render(t.renderOptions);var o=t.lastDrawTime=Vr();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var l=o-i;t.redrawTotalTime+=l,t.lastRedrawTime=l,t.averageRedrawTime=t.averageRedrawTime/2+l/2,t.requestedFrame=!1}else Hv(t,!1,a);t.skipFrame=!1,Lo(n)}};Lo(r)}};var V3=function(e){this.init(e)},Kv=V3,Aa=Kv.prototype;Aa.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Aa.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),n=e.cy.window();if(n){var a=n.document,i=a.head,o="__________cytoscape_stylesheet",l="__________cytoscape_container",u=a.getElementById(o)!=null;if(r.className.indexOf(l)<0&&(r.className=(r.className||"")+" "+l),!u){var c=a.createElement("style");c.id=o,c.textContent="."+l+" { position: relative; }",i.insertBefore(c,i.children[0])}var d=n.getComputedStyle(r),f=d.getPropertyValue("position");f==="static"&&Ae("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=le(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()},Aa.notify=function(t,e){var r=this,n=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&n.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},Aa.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],n=r,a=n.target;(a.off||a.removeEventListener).apply(a,n.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}},Aa.isHeadless=function(){return!1},[xc,$v,zv,Ia,Hr,Hi].forEach(function(t){xe(Aa,t)});var Pc=1e3/60,qv={setupDequeueing:function(e){return function(){var n=this,a=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var i=_o(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},e.deqRedrawThreshold),o=function(c,d){var f=Vr(),p=a.averageRedrawTime,v=a.lastRedrawTime,h=[],g=a.cy.extent(),y=a.getPixelRatio();for(c||a.flushRenderedStyleQueue();;){var m=Vr(),b=m-f,w=m-d;if(v<Pc){var C=Pc-(c?p:0);if(w>=e.deqFastCost*C)break}else if(c){if(b>=e.deqCost*v||b>=e.deqAvgCost*p)break}else if(w>=e.deqNoDrawCost*Pc)break;var x=e.deq(n,y,g);if(x.length>0)for(var E=0;E<x.length;E++)h.push(x[E]);else break}h.length>0&&(e.onDeqd(n,h),!c&&e.shouldRedraw(n,h,y,g)&&i())},l=e.priority||Gl;a.beforeRender(o,l(n))}}}},R3=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Mo;Rl(this,t),this.idsByKey=new wr,this.keyForId=new wr,this.cachesByLvl=new wr,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return $l(t,[{key:"getIdsFor",value:function(r){r==null&&Xe("Can not get id list for null key");var n=this.idsByKey,a=this.idsByKey.get(r);return a||(a=new ga,n.set(r,a)),a}},{key:"addIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).add(n)}},{key:"deleteIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).delete(n)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var n=r.id(),a=this.keyForId.get(n),i=this.getKey(r);this.deleteIdForKey(a,n),this.addIdForKey(i,n),this.keyForId.set(n,i)}},{key:"deleteKeyMappingFor",value:function(r){var n=r.id(),a=this.keyForId.get(n);this.deleteIdForKey(a,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(r){var n=r.id(),a=this.keyForId.get(n),i=this.getKey(r);return a!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var n=this.cachesByLvl,a=this.lvls,i=n.get(r);return i||(i=new wr,n.set(r,i),a.push(r)),i}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var a=this.getKey(r),i=this.getCache(a,n);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,n){var a=this.keyForId.get(r.id()),i=this.getCache(a,n);return i}},{key:"hasCache",value:function(r,n){return this.getCachesAt(n).has(r)}},{key:"has",value:function(r,n){var a=this.getKey(r);return this.hasCache(a,n)}},{key:"setCache",value:function(r,n,a){a.key=r,this.getCachesAt(n).set(r,a)}},{key:"set",value:function(r,n,a){var i=this.getKey(r);this.setCache(i,n,a),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,n){this.getCachesAt(n).delete(r)}},{key:"delete",value:function(r,n){var a=this.getKey(r);this.deleteCache(a,n)}},{key:"invalidateKey",value:function(r){var n=this;this.lvls.forEach(function(a){return n.deleteCache(r,a)})}},{key:"invalidate",value:function(r){var n=r.id(),a=this.keyForId.get(n);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(a),i||this.getNumberOfIdsForKey(a)===0}}]),t}(),Uv=25,ks=50,xs=-4,Oc=3,$3=7.99,z3=8,H3=1024,K3=1024,q3=1024,U3=.2,G3=.8,W3=10,j3=.15,Y3=.1,X3=.9,Z3=.9,Q3=100,J3=1,Va={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},eP=wt({getKey:null,doesEleInvalidateKey:Mo,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ah,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Ki=function(e,r){var n=this;n.renderer=e,n.onDequeues=[];var a=eP(r);xe(n,a),n.lookup=new R3(a.getKey,a.doesEleInvalidateKey),n.setupDequeueing()},ct=Ki.prototype;ct.reasons=Va,ct.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]},ct.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=r[t]=r[t]||[];return n},ct.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Ei(function(r,n){return n.reqs-r.reqs});return e},ct.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e},ct.getElement=function(t,e,r,n,a){var i=this,o=this.renderer,l=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(n==null&&(n=Math.ceil(Yl(l*r))),n<xs)n=xs;else if(l>=$3||n>Oc)return null;var c=Math.pow(2,n),d=e.h*c,f=e.w*c,p=o.eleTextBiggerThanMin(t,c);if(!this.isVisible(t,p))return null;var v=u.get(t,n);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var h;if(d<=Uv?h=Uv:d<=ks?h=ks:h=Math.ceil(d/ks)*ks,d>q3||f>K3)return null;var g=i.getTextureQueue(h),y=g[g.length-2],m=function(){return i.recycleTexture(h,f)||i.addTexture(h,f)};y||(y=g[g.length-1]),y||(y=m()),y.width-y.usedWidth<f&&(y=m());for(var b=function(_){return _&&_.scaledLabelShown===p},w=a&&a===Va.dequeue,C=a&&a===Va.highQuality,x=a&&a===Va.downscale,E,k=n+1;k<=Oc;k++){var B=u.get(t,k);if(B){E=B;break}}var S=E&&E.level===n+1?E:null,N=function(){y.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,y.usedWidth,0,f,d)};if(y.context.setTransform(1,0,0,1,0,0),y.context.clearRect(y.usedWidth,0,f,h),b(S))N();else if(b(E))if(C){for(var D=E.level;D>n;D--)S=i.getElement(t,e,r,D,Va.downscale);N()}else return i.queueElement(t,E.level-1),E;else{var P;if(!w&&!C&&!x)for(var L=n-1;L>=xs;L--){var O=u.get(t,L);if(O){P=O;break}}if(b(P))return i.queueElement(t,n),P;y.context.translate(y.usedWidth,0),y.context.scale(c,c),this.drawElement(y.context,t,e,p,!1),y.context.scale(1/c,1/c),y.context.translate(-y.usedWidth,0)}return v={x:y.usedWidth,texture:y,level:n,scale:c,width:f,height:d,scaledLabelShown:p},y.usedWidth+=Math.ceil(f+z3),y.eleCaches.push(v),u.set(t,n,v),i.checkTextureFullness(y),v},ct.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])},ct.invalidateElement=function(t){var e=this,r=e.lookup,n=[],a=r.isInvalid(t);if(a){for(var i=xs;i<=Oc;i++){var o=r.getForCachedKey(t,i);o&&n.push(o)}var l=r.invalidate(t);if(l)for(var u=0;u<n.length;u++){var c=n[u],d=c.texture;d.invalidatedWidth+=c.width,c.invalidated=!0,e.checkTextureUtility(d)}e.removeFromQueue(t)}},ct.checkTextureUtility=function(t){t.invalidatedWidth>=U3*t.width&&this.retireTexture(t)},ct.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>G3&&t.fullnessChecks>=W3?on(r,t):t.fullnessChecks++},ct.retireTexture=function(t){var e=this,r=t.height,n=e.getTextureQueue(r),a=this.lookup;on(n,t),t.retired=!0;for(var i=t.eleCaches,o=0;o<i.length;o++){var l=i[o];a.deleteCache(l.key,l.level)}Wl(i);var u=e.getRetiredTextureQueue(r);u.push(t)},ct.addTexture=function(t,e){var r=this,n=r.getTextureQueue(t),a={};return n.push(a),a.eleCaches=[],a.height=t,a.width=Math.max(H3,e),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=r.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a},ct.recycleTexture=function(t,e){for(var r=this,n=r.getTextureQueue(t),a=r.getRetiredTextureQueue(t),i=0;i<a.length;i++){var o=a[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Wl(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),on(a,o),n.push(o),o}},ct.queueElement=function(t,e){var r=this,n=r.getElementQueue(),a=r.getElementKeyToQueue(),i=this.getKey(t),o=a[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,n.updateItem(o);else{var l={eles:t.spawn().merge(t),level:e,reqs:1,key:i};n.push(l),a[i]=l}},ct.dequeue=function(t){for(var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),a=[],i=e.lookup,o=0;o<J3&&r.size()>0;o++){var l=r.pop(),u=l.key,c=l.eles[0],d=i.hasCache(c,l.level);if(n[u]=null,d)continue;a.push(l);var f=e.getBoundingBox(c);e.getElement(c,f,t,l.level,Va.dequeue)}return a},ct.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),a=this.getKey(t),i=n[a];i!=null&&(i.eles.length===1?(i.reqs=Ul,r.updateItem(i),r.pop(),n[a]=null):i.eles.unmerge(t))},ct.onDequeue=function(t){this.onDequeues.push(t)},ct.offDequeue=function(t){on(this.onDequeues,t)},ct.setupDequeueing=qv.setupDequeueing({deqRedrawThreshold:Q3,deqCost:j3,deqAvgCost:Y3,deqNoDrawCost:X3,deqFastCost:Z3,deq:function(e,r,n){return e.dequeue(r,n)},onDeqd:function(e,r){for(var n=0;n<e.onDequeues.length;n++){var a=e.onDequeues[n];a(r)}},shouldRedraw:function(e,r,n,a){for(var i=0;i<r.length;i++)for(var o=r[i].eles,l=0;l<o.length;l++){var u=o[l].boundingBox();if(Xl(u,a))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var tP=1,qi=-4,Es=2,rP=3.99,nP=50,aP=50,iP=.15,oP=.1,sP=.9,lP=.9,cP=1,Gv=250,uP=4e3*4e3,dP=!0,Wv=function(e){var r=this,n=r.renderer=e,a=n.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Vr()-2*Gv,r.skipping=!1,r.eleTxrDeqs=a.collection(),r.scheduleElementRefinement=_o(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},aP),n.beforeRender(function(o,l){l-r.lastInvalidationTime<=Gv?r.skipping=!0:r.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var i=function(l,u){return u.reqs-l.reqs};r.layersQueue=new Ei(i),r.setupDequeueing()},Et=Wv.prototype,jv=0,fP=Math.pow(2,53)-1;Et.makeLayer=function(t,e){var r=Math.pow(2,e),n=Math.ceil(t.w*r),a=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(n,a),o={id:jv=++jv%fP,bb:t,level:e,width:n,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},l=o.context,u=-o.bb.x1,c=-o.bb.y1;return l.scale(r,r),l.translate(u,c),o},Et.getLayers=function(t,e,r){var n=this,a=n.renderer,i=a.cy,o=i.zoom(),l=n.firstGet;if(n.firstGet=!1,r==null){if(r=Math.ceil(Yl(o*e)),r<qi)r=qi;else if(o>=rP||r>Es)return null}n.validateLayersElesOrdering(r,t);var u=n.layersByLevel,c=Math.pow(2,r),d=u[r]=u[r]||[],f,p=n.levelIsComplete(r,t),v,h=function(){var N=function(I){if(n.validateLayersElesOrdering(I,t),n.levelIsComplete(I,t))return v=u[I],!0},D=function(I){if(!v)for(var _=r+I;qi<=_&&_<=Es&&!N(_);_+=I);};D(1),D(-1);for(var P=d.length-1;P>=0;P--){var L=d[P];L.invalid&&on(d,L)}};if(!p)h();else return d;var g=function(){if(!f){f=zt();for(var N=0;N<t.length;N++)Uh(f,t[N].boundingBox())}return f},y=function(N){N=N||{};var D=N.after;g();var P=f.w*c*(f.h*c);if(P>uP)return null;var L=n.makeLayer(f,r);if(D!=null){var O=d.indexOf(D)+1;d.splice(O,0,L)}else(N.insert===void 0||N.insert)&&d.unshift(L);return L};if(n.skipping&&!l)return null;for(var m=null,b=t.length/tP,w=!l,C=0;C<t.length;C++){var x=t[C],E=x._private.rscratch,k=E.imgLayerCaches=E.imgLayerCaches||{},B=k[r];if(B){m=B;continue}if((!m||m.eles.length>=b||!Wh(m.bb,x.boundingBox()))&&(m=y({insert:!0,after:m}),!m))return null;v||w?n.queueLayer(m,x):n.drawEleInLayer(m,x,r,e),m.eles.push(x),k[r]=m}return v||(w?null:d)},Et.getEleLevelForLayerLevel=function(t,e){return t},Et.drawEleInLayer=function(t,e,r,n){var a=this,i=this.renderer,o=t.context,l=e.boundingBox();l.w===0||l.h===0||!e.visible()||(r=a.getEleLevelForLayerLevel(r,n),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,r,dP),i.setImgSmoothing(o,!0))},Et.levelIsComplete=function(t,e){var r=this,n=r.layersByLevel[t];if(!n||n.length===0)return!1;for(var a=0,i=0;i<n.length;i++){var o=n[i];if(o.reqs>0||o.invalid)return!1;a+=o.eles.length}return a===e.length},Et.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var n=0;n<r.length;n++){for(var a=r[n],i=-1,o=0;o<e.length;o++)if(a.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(a);continue}for(var l=i,o=0;o<a.eles.length;o++)if(a.eles[o]!==e[l+o]){this.invalidateLayer(a);break}}},Et.updateElementsInLayers=function(t,e){for(var r=this,n=vi(t[0]),a=0;a<t.length;a++)for(var i=n?null:t[a],o=n?t[a]:t[a].ele,l=o._private.rscratch,u=l.imgLayerCaches=l.imgLayerCaches||{},c=qi;c<=Es;c++){var d=u[c];d&&(i&&r.getEleLevelForLayerLevel(d.level)!==i.level||e(d,o,i))}},Et.haveLayers=function(){for(var t=this,e=!1,r=qi;r<=Es;r++){var n=t.layersByLevel[r];if(n&&n.length>0){e=!0;break}}return e},Et.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Vr(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(n,a,i){e.invalidateLayer(n)}))},Et.invalidateLayer=function(t){if(this.lastInvalidationTime=Vr(),!t.invalid){var e=t.level,r=t.eles,n=this.layersByLevel[e];on(n,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var a=0;a<r.length;a++){var i=r[a]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}},Et.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(n,a,i){var o=n.replacement;if(o||(o=n.replacement=e.makeLayer(n.bb,n.level),o.replaces=n,o.eles=n.eles),!o.reqs)for(var l=0;l<o.eles.length;l++)e.queueLayer(o,o.eles[l])})},Et.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()},Et.queueLayer=function(t,e){var r=this,n=r.layersQueue,a=t.elesQueue,i=a.hasId=a.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;a.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,n.updateItem(t)):(t.reqs=1,n.push(t))}},Et.dequeue=function(t){for(var e=this,r=e.layersQueue,n=[],a=0;a<cP&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,t),a++),n.length===0&&n.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return n},Et.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],n=t.replaces,a=r.indexOf(n);if(!(a<0||n.invalid)){r[a]=t;for(var i=0;i<t.eles.length;i++){var o=t.eles[i]._private,l=o.imgLayerCaches=o.imgLayerCaches||{};l&&(l[t.level]=t)}e.requestRedraw()}},Et.requestRedraw=_o(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100),Et.setupDequeueing=qv.setupDequeueing({deqRedrawThreshold:nP,deqCost:iP,deqAvgCost:oP,deqNoDrawCost:sP,deqFastCost:lP,deq:function(e,r){return e.dequeue(r)},onDeqd:Gl,shouldRedraw:Ah,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Yv={},Xv;function hP(t,e){for(var r=0;r<e.length;r++){var n=e[r];t.lineTo(n.x,n.y)}}function pP(t,e,r){for(var n,a=0;a<e.length;a++){var i=e[a];a===0&&(n=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,n.x,n.y)}function Zv(t,e,r){t.beginPath&&t.beginPath();for(var n=e,a=0;a<n.length;a++){var i=n[a];t.lineTo(i.x,i.y)}var o=r,l=r[0];t.moveTo(l.x,l.y);for(var a=1;a<o.length;a++){var i=o[a];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function vP(t,e,r,n,a){t.beginPath&&t.beginPath(),t.arc(r,n,a,0,Math.PI*2,!1);var i=e,o=i[0];t.moveTo(o.x,o.y);for(var l=0;l<i.length;l++){var u=i[l];t.lineTo(u.x,u.y)}t.closePath&&t.closePath()}function gP(t,e,r,n){t.arc(e,r,n,0,Math.PI*2,!1)}Yv.arrowShapeImpl=function(t){return(Xv||(Xv={polygon:hP,"triangle-backcurve":pP,"triangle-tee":Zv,"circle-triangle":vP,"triangle-cross":Zv,circle:gP}))[t]};var Sr={};Sr.drawElement=function(t,e,r,n,a,i){var o=this;e.isNode()?o.drawNode(t,e,r,n,a,i):o.drawEdge(t,e,r,n,a,i)},Sr.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)},Sr.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)},Sr.drawCachedElementPortion=function(t,e,r,n,a,i,o,l){var u=this,c=r.getBoundingBox(e);if(!(c.w===0||c.h===0)){var d=r.getElement(e,c,n,a,i);if(d!=null){var f=l(u,e);if(f===0)return;var p=o(u,e),v=c.x1,h=c.y1,g=c.w,y=c.h,m,b,w,C,x;if(p!==0){var E=r.getRotationPoint(e);w=E.x,C=E.y,t.translate(w,C),t.rotate(p),x=u.getImgSmoothing(t),x||u.setImgSmoothing(t,!0);var k=r.getRotationOffset(e);m=k.x,b=k.y}else m=v,b=h;var B;f!==1&&(B=t.globalAlpha,t.globalAlpha=B*f),t.drawImage(d.texture.canvas,d.x,0,d.width,d.height,m,b,g,y),f!==1&&(t.globalAlpha=B),p!==0&&(t.rotate(-p),t.translate(-w,-C),x||u.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var mP=function(){return 0},yP=function(e,r){return e.getTextAngle(r,null)},bP=function(e,r){return e.getTextAngle(r,"source")},wP=function(e,r){return e.getTextAngle(r,"target")},CP=function(e,r){return r.effectiveOpacity()},_c=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};Sr.drawCachedElement=function(t,e,r,n,a,i){var o=this,l=o.data,u=l.eleTxrCache,c=l.lblTxrCache,d=l.slbTxrCache,f=l.tlbTxrCache,p=e.boundingBox(),v=i===!0?u.reasons.highQuality:null;if(!(p.w===0||p.h===0||!e.visible())&&(!n||Xl(p,n))){var h=e.isEdge(),g=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,u,r,a,v,mP,CP),(!h||!g)&&o.drawCachedElementPortion(t,e,c,r,a,v,yP,_c),h&&!g&&(o.drawCachedElementPortion(t,e,d,r,a,v,bP,_c),o.drawCachedElementPortion(t,e,f,r,a,v,wP,_c)),o.drawElementOverlay(t,e)}},Sr.drawElements=function(t,e){for(var r=this,n=0;n<e.length;n++){var a=e[n];r.drawElement(t,a)}},Sr.drawCachedElements=function(t,e,r,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];a.drawCachedElement(t,o,r,n)}},Sr.drawCachedNodes=function(t,e,r,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&a.drawCachedElement(t,o,r,n)}},Sr.drawLayeredElements=function(t,e,r,n){var a=this,i=a.data.lyrTxrCache.getLayers(e,r);if(i)for(var o=0;o<i.length;o++){var l=i[o],u=l.bb;u.w===0||u.h===0||t.drawImage(l.canvas,u.x1,u.y1,u.w,u.h)}else a.drawCachedElements(t,e,r,n)};var Kr={};Kr.drawEdge=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,l=e._private.rscratch;if(!(i&&!e.visible())&&!(l.badLine||l.allpts==null||isNaN(l.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var c=i?e.pstyle("opacity").value:1,d=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,p=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,h=e.pstyle("line-cap").value,g=e.pstyle("line-outline-width").value,y=e.pstyle("line-outline-color").value,m=c*d,b=c*d,w=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;f==="straight-triangle"?(o.eleStrokeStyle(t,e,I),o.drawEdgeTrianglePath(e,t,l.allpts)):(t.lineWidth=v,t.lineCap=h,o.eleStrokeStyle(t,e,I),o.drawEdgePath(e,t,l.allpts,p),t.lineCap="butt")},C=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;if(t.lineWidth=v+g,t.lineCap=h,g>0)o.colorStrokeStyle(t,y[0],y[1],y[2],I);else{t.lineCap="butt";return}f==="straight-triangle"?o.drawEdgeTrianglePath(e,t,l.allpts):(o.drawEdgePath(e,t,l.allpts,p),t.lineCap="butt")},x=function(){a&&o.drawEdgeOverlay(t,e)},E=function(){a&&o.drawEdgeUnderlay(t,e)},k=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;o.drawArrowheads(t,e,I)},B=function(){o.drawElementText(t,e,null,n)};t.lineJoin="round";var S=e.pstyle("ghost").value==="yes";if(S){var N=e.pstyle("ghost-offset-x").pfValue,D=e.pstyle("ghost-offset-y").pfValue,P=e.pstyle("ghost-opacity").value,L=m*P;t.translate(N,D),w(L),k(L),t.translate(-N,-D)}else C();E(),w(),k(),x(),B(),r&&t.translate(u.x1,u.y1)}};var Qv=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n){if(n.visible()){var a=n.pstyle("".concat(e,"-opacity")).value;if(a!==0){var i=this,o=i.usePaths(),l=n._private.rscratch,u=n.pstyle("".concat(e,"-padding")).pfValue,c=2*u,d=n.pstyle("".concat(e,"-color")).value;r.lineWidth=c,l.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,d[0],d[1],d[2],a),i.drawEdgePath(n,r,l.allpts,"solid")}}}};Kr.drawEdgeOverlay=Qv("overlay"),Kr.drawEdgeUnderlay=Qv("underlay"),Kr.drawEdgePath=function(t,e,r,n){var a=t._private.rscratch,i=e,o,l=!1,u=this.usePaths(),c=t.pstyle("line-dash-pattern").pfValue,d=t.pstyle("line-dash-offset").pfValue;if(u){var f=r.join("$"),p=a.pathCacheKey&&a.pathCacheKey===f;p?(o=e=a.pathCache,l=!0):(o=e=new Path2D,a.pathCacheKey=f,a.pathCache=o)}if(i.setLineDash)switch(n){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(c),i.lineDashOffset=d;break;case"solid":i.setLineDash([]);break}if(!l&&!a.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var v=2;v+3<r.length;v+=4)e.quadraticCurveTo(r[v],r[v+1],r[v+2],r[v+3]);break;case"straight":case"haystack":for(var h=2;h+1<r.length;h+=2)e.lineTo(r[h],r[h+1]);break;case"segments":if(a.isRound){var g=mh(a.roundCorners),y;try{for(g.s();!(y=g.n()).done;){var m=y.value;Lv(e,m)}}catch(w){g.e(w)}finally{g.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var b=2;b+1<r.length;b+=2)e.lineTo(r[b],r[b+1]);break}e=i,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])},Kr.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var n=t.pstyle("width").pfValue,a=0;a+1<r.length;a+=2){var i=[r[a+2]-r[a],r[a+3]-r[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),l=[i[1]/o,-i[0]/o],u=[l[0]*n/2,l[1]*n/2];e.beginPath(),e.moveTo(r[a]-u[0],r[a+1]-u[1]),e.lineTo(r[a]+u[0],r[a+1]+u[1]),e.lineTo(r[a+2],r[a+3]),e.closePath(),e.fill()}},Kr.drawArrowheads=function(t,e,r){var n=e._private.rscratch,a=n.edgeType==="haystack";a||this.drawArrowhead(t,e,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,r),a||this.drawArrowhead(t,e,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,r)},Kr.drawArrowhead=function(t,e,r,n,a,i,o){if(!(isNaN(n)||n==null||isNaN(a)||a==null||isNaN(i)||i==null)){var l=this,u=e.pstyle(r+"-arrow-shape").value;if(u!=="none"){var c=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",d=e.pstyle(r+"-arrow-fill").value,f=e.pstyle("width").pfValue,p=e.pstyle(r+"-arrow-width"),v=p.value==="match-line"?f:p.pfValue;p.units==="%"&&(v*=f);var h=e.pstyle("opacity").value;o===void 0&&(o=h);var g=t.globalCompositeOperation;(o!==1||d==="hollow")&&(t.globalCompositeOperation="destination-out",l.colorFillStyle(t,255,255,255,1),l.colorStrokeStyle(t,255,255,255,1),l.drawArrowShape(e,t,c,f,u,v,n,a,i),t.globalCompositeOperation=g);var y=e.pstyle(r+"-arrow-color").value;l.colorFillStyle(t,y[0],y[1],y[2],o),l.colorStrokeStyle(t,y[0],y[1],y[2],o),l.drawArrowShape(e,t,d,f,u,v,n,a,i)}}},Kr.drawArrowShape=function(t,e,r,n,a,i,o,l,u){var c=this,d=this.usePaths()&&a!=="triangle-cross",f=!1,p,v=e,h={x:o,y:l},g=t.pstyle("arrow-scale").value,y=this.getArrowWidth(n,g),m=c.arrowShapes[a];if(d){var b=c.arrowPathCache=c.arrowPathCache||[],w=Mn(a),C=b[w];C!=null?(p=e=C,f=!0):(p=e=new Path2D,b[w]=p)}f||(e.beginPath&&e.beginPath(),d?m.draw(e,1,0,{x:0,y:0},1):m.draw(e,y,u,h,n),e.closePath&&e.closePath()),e=v,d&&(e.translate(o,l),e.rotate(u),e.scale(y,y)),(r==="filled"||r==="both")&&(d?e.fill(p):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(d?y:1),e.lineJoin="miter",d?e.stroke(p):e.stroke()),d&&(e.scale(1/y,1/y),e.rotate(-u),e.translate(-o,-l))};var Lc={};Lc.safeDrawImage=function(t,e,r,n,a,i,o,l,u,c){if(!(a<=0||i<=0||u<=0||c<=0))try{t.drawImage(e,r,n,a,i,o,l,u,c)}catch(d){Ae(d)}},Lc.drawInscribedImage=function(t,e,r,n,a){var i=this,o=r.position(),l=o.x,u=o.y,c=r.cy().style(),d=c.getIndexedStyle.bind(c),f=d(r,"background-fit","value",n),p=d(r,"background-repeat","value",n),v=r.width(),h=r.height(),g=r.padding()*2,y=v+(d(r,"background-width-relative-to","value",n)==="inner"?0:g),m=h+(d(r,"background-height-relative-to","value",n)==="inner"?0:g),b=r._private.rscratch,w=d(r,"background-clip","value",n),C=w==="node",x=d(r,"background-image-opacity","value",n)*a,E=d(r,"background-image-smoothing","value",n),k=r.pstyle("corner-radius").value;k!=="auto"&&(k=r.pstyle("corner-radius").pfValue);var B=e.width||e.cachedW,S=e.height||e.cachedH;(B==null||S==null)&&(document.body.appendChild(e),B=e.cachedW=e.width||e.offsetWidth,S=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var N=B,D=S;if(d(r,"background-width","value",n)!=="auto"&&(d(r,"background-width","units",n)==="%"?N=d(r,"background-width","pfValue",n)*y:N=d(r,"background-width","pfValue",n)),d(r,"background-height","value",n)!=="auto"&&(d(r,"background-height","units",n)==="%"?D=d(r,"background-height","pfValue",n)*m:D=d(r,"background-height","pfValue",n)),!(N===0||D===0)){if(f==="contain"){var P=Math.min(y/N,m/D);N*=P,D*=P}else if(f==="cover"){var P=Math.max(y/N,m/D);N*=P,D*=P}var L=l-y/2,O=d(r,"background-position-x","units",n),I=d(r,"background-position-x","pfValue",n);O==="%"?L+=(y-N)*I:L+=I;var _=d(r,"background-offset-x","units",n),M=d(r,"background-offset-x","pfValue",n);_==="%"?L+=(y-N)*M:L+=M;var F=u-m/2,V=d(r,"background-position-y","units",n),H=d(r,"background-position-y","pfValue",n);V==="%"?F+=(m-D)*H:F+=H;var $=d(r,"background-offset-y","units",n),z=d(r,"background-offset-y","pfValue",n);$==="%"?F+=(m-D)*z:F+=z,b.pathCache&&(L-=l,F-=u,l=0,u=0);var j=t.globalAlpha;t.globalAlpha=x;var ee=i.getImgSmoothing(t),J=!1;if(E==="no"&&ee?(i.setImgSmoothing(t,!1),J=!0):E==="yes"&&!ee&&(i.setImgSmoothing(t,!0),J=!0),p==="no-repeat")C&&(t.save(),b.pathCache?t.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,l,u,y,m,k,b),t.clip())),i.safeDrawImage(t,e,0,0,B,S,L,F,N,D),C&&t.restore();else{var Z=t.createPattern(e,p);t.fillStyle=Z,i.nodeShapes[i.getNodeShape(r)].draw(t,l,u,y,m,k,b),t.translate(L,F),t.fill(),t.translate(-L,-F)}t.globalAlpha=j,J&&i.setImgSmoothing(t,ee)}};var Wn={};Wn.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),n=this.getPixelRatio(),a=Math.ceil(Yl(r*n));e=Math.pow(2,a)}var i=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(i<o)},Wn.drawElementText=function(t,e,r,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(n==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var l=e.pstyle("label");if(!l||!l.value)return;var u=o.getLabelJustification(e);t.textAlign=u,t.textBaseline="bottom"}else{var c=e.element()._private.rscratch.badLine,d=e.pstyle("label"),f=e.pstyle("source-label"),p=e.pstyle("target-label");if(c||(!d||!d.value)&&(!f||!f.value)&&(!p||!p.value))return;t.textAlign="center",t.textBaseline="bottom"}var v=!r,h;r&&(h=r,t.translate(-h.x1,-h.y1)),a==null?(o.drawText(t,e,null,v,i),e.isEdge()&&(o.drawText(t,e,"source",v,i),o.drawText(t,e,"target",v,i))):o.drawText(t,e,a,v,i),r&&t.translate(h.x1,h.y1)},Wn.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e},Wn.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,l=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*l,c=e.pstyle("color").value,d=e.pstyle("text-outline-color").value;t.font=n+" "+o+" "+a+" "+i,t.lineJoin="round",this.colorFillStyle(t,c[0],c[1],c[2],l),this.colorStrokeStyle(t,d[0],d[1],d[2],u)};function Fc(t,e,r,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+n-i,r),t.quadraticCurveTo(e+n,r,e+n,r+i),t.lineTo(e+n,r+a-i),t.quadraticCurveTo(e+n,r+a,e+n-i,r+a),t.lineTo(e+i,r+a),t.quadraticCurveTo(e,r+a,e,r+a-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),o?t.stroke():t.fill()}Wn.getTextAngle=function(t,e){var r,n=t._private,a=n.rscratch,i=e?e+"-":"",o=t.pstyle(i+"text-rotation"),l=lr(a,"labelAngle",e);return o.strValue==="autorotate"?r=t.isEdge()?l:0:o.strValue==="none"?r=0:r=o.pfValue,r},Wn.drawText=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,l=a?e.effectiveOpacity():1;if(!(a&&(l===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=lr(o,"labelX",r),c=lr(o,"labelY",r),d,f,p=this.getLabelText(e,r);if(p!=null&&p!==""&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(t,e,a);var v=r?r+"-":"",h=lr(o,"labelWidth",r),g=lr(o,"labelHeight",r),y=e.pstyle(v+"text-margin-x").pfValue,m=e.pstyle(v+"text-margin-y").pfValue,b=e.isEdge(),w=e.pstyle("text-halign").value,C=e.pstyle("text-valign").value;b&&(w="center",C="center"),u+=y,c+=m;var x;switch(n?x=this.getTextAngle(e,r):x=0,x!==0&&(d=u,f=c,t.translate(d,f),t.rotate(x),u=0,c=0),C){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g;break}var E=e.pstyle("text-background-opacity").value,k=e.pstyle("text-border-opacity").value,B=e.pstyle("text-border-width").pfValue,S=e.pstyle("text-background-padding").pfValue,N=e.pstyle("text-background-shape").strValue,D=N.indexOf("round")===0,P=2;if(E>0||B>0&&k>0){var L=u-S;switch(w){case"left":L-=h;break;case"center":L-=h/2;break}var O=c-g-S,I=h+2*S,_=g+2*S;if(E>0){var M=t.fillStyle,F=e.pstyle("text-background-color").value;t.fillStyle="rgba("+F[0]+","+F[1]+","+F[2]+","+E*l+")",D?Fc(t,L,O,I,_,P):t.fillRect(L,O,I,_),t.fillStyle=M}if(B>0&&k>0){var V=t.strokeStyle,H=t.lineWidth,$=e.pstyle("text-border-color").value,z=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+$[0]+","+$[1]+","+$[2]+","+k*l+")",t.lineWidth=B,t.setLineDash)switch(z){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=B/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(D?Fc(t,L,O,I,_,P,"stroke"):t.strokeRect(L,O,I,_),z==="double"){var j=B/2;D?Fc(t,L+j,O+j,I-j*2,_-j*2,P,"stroke"):t.strokeRect(L+j,O+j,I-j*2,_-j*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=H,t.strokeStyle=V}}var ee=2*e.pstyle("text-outline-width").pfValue;if(ee>0&&(t.lineWidth=ee),e.pstyle("text-wrap").value==="wrap"){var J=lr(o,"labelWrapCachedLines",r),Z=lr(o,"labelLineHeight",r),re=h/2,Y=this.getLabelJustification(e);switch(Y==="auto"||(w==="left"?Y==="left"?u+=-h:Y==="center"&&(u+=-re):w==="center"?Y==="left"?u+=-re:Y==="right"&&(u+=re):w==="right"&&(Y==="center"?u+=re:Y==="right"&&(u+=h))),C){case"top":c-=(J.length-1)*Z;break;case"center":case"bottom":c-=(J.length-1)*Z;break}for(var A=0;A<J.length;A++)ee>0&&t.strokeText(J[A],u,c),t.fillText(J[A],u,c),c+=Z}else ee>0&&t.strokeText(p,u,c),t.fillText(p,u,c);x!==0&&(t.rotate(-x),t.translate(-d,-f))}}};var Ra={};Ra.drawNode=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,l,u,c=e._private,d=c.rscratch,f=e.position();if(!(!le(f.x)||!le(f.y))&&!(i&&!e.visible())){var p=i?e.effectiveOpacity():1,v=o.usePaths(),h,g=!1,y=e.padding();l=e.width()+2*y,u=e.height()+2*y;var m;r&&(m=r,t.translate(-m.x1,-m.y1));for(var b=e.pstyle("background-image"),w=b.value,C=new Array(w.length),x=new Array(w.length),E=0,k=0;k<w.length;k++){var B=w[k],S=C[k]=B!=null&&B!=="none";if(S){var N=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",k);E++,x[k]=o.getCachedImage(B,N,function(){c.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var D=e.pstyle("background-blacken").value,P=e.pstyle("border-width").pfValue,L=e.pstyle("background-opacity").value*p,O=e.pstyle("border-color").value,I=e.pstyle("border-style").value,_=e.pstyle("border-join").value,M=e.pstyle("border-cap").value,F=e.pstyle("border-position").value,V=e.pstyle("border-dash-pattern").pfValue,H=e.pstyle("border-dash-offset").pfValue,$=e.pstyle("border-opacity").value*p,z=e.pstyle("outline-width").pfValue,j=e.pstyle("outline-color").value,ee=e.pstyle("outline-style").value,J=e.pstyle("outline-opacity").value*p,Z=e.pstyle("outline-offset").value,re=e.pstyle("corner-radius").value;re!=="auto"&&(re=e.pstyle("corner-radius").pfValue);var Y=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L;o.eleFillStyle(t,e,ie)},A=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$;o.colorStrokeStyle(t,O[0],O[1],O[2],ie)},K=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:J;o.colorStrokeStyle(t,j[0],j[1],j[2],ie)},W=function(ie,X,ae,we){var Ce=o.nodePathCache=o.nodePathCache||[],ge=Mh(ae==="polygon"?ae+","+we.join(","):ae,""+X,""+ie,""+re),Se=Ce[ge],ve,ye=!1;return Se!=null?(ve=Se,ye=!0,d.pathCache=ve):(ve=new Path2D,Ce[ge]=d.pathCache=ve),{path:ve,cacheHit:ye}},oe=e.pstyle("shape").strValue,he=e.pstyle("shape-polygon-points").pfValue;if(v){t.translate(f.x,f.y);var ne=W(l,u,oe,he);h=ne.path,g=ne.cacheHit}var se=function(){if(!g){var ie=f;v&&(ie={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(h||t,ie.x,ie.y,l,u,re,d)}v?t.fill(h):t.fill()},ue=function(){for(var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ae=c.backgrounding,we=0,Ce=0;Ce<x.length;Ce++){var ge=e.cy().style().getIndexedStyle(e,"background-image-containment","value",Ce);if(X&&ge==="over"||!X&&ge==="inside"){we++;continue}C[Ce]&&x[Ce].complete&&!x[Ce].error&&(we++,o.drawInscribedImage(t,x[Ce],e,Ce,ie))}c.backgrounding=we!==E,ae!==c.backgrounding&&e.updateStyle(!1)},pe=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;o.hasPie(e)&&(o.drawPie(t,e,X),ie&&(v||o.nodeShapes[o.getNodeShape(e)].draw(t,f.x,f.y,l,u,re,d)))},de=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,X=(D>0?D:-D)*ie,ae=D>0?0:255;D!==0&&(o.colorFillStyle(t,ae,ae,ae,X),v?t.fill(h):t.fill())},me=function(){if(P>0){if(t.lineWidth=P,t.lineCap=M,t.lineJoin=_,t.setLineDash)switch(I){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(V),t.lineDashOffset=H;break;case"solid":case"double":t.setLineDash([]);break}if(F!=="center"){if(t.save(),t.lineWidth*=2,F==="inside")v?t.clip(h):t.clip();else{var ie=new Path2D;ie.rect(-l/2-P,-u/2-P,l+2*P,u+2*P),ie.addPath(h),t.clip(ie,"evenodd")}v?t.stroke(h):t.stroke(),t.restore()}else v?t.stroke(h):t.stroke();if(I==="double"){t.lineWidth=P/3;var X=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(h):t.stroke(),t.globalCompositeOperation=X}t.setLineDash&&t.setLineDash([])}},Ne=function(){if(z>0){if(t.lineWidth=z,t.lineCap="butt",t.setLineDash)switch(ee){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var ie=f;v&&(ie={x:0,y:0});var X=o.getNodeShape(e),ae=P;F==="inside"&&(ae=0),F==="outside"&&(ae*=2);var we=(l+ae+(z+Z))/l,Ce=(u+ae+(z+Z))/u,ge=l*we,Se=u*Ce,ve=o.nodeShapes[X].points,ye;if(v){var Ge=W(ge,Se,X,ve);ye=Ge.path}if(X==="ellipse")o.drawEllipsePath(ye||t,ie.x,ie.y,ge,Se);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(X)){var Re=0,rt=0,nt=0;X==="round-diamond"?Re=(ae+Z+z)*1.4:X==="round-heptagon"?(Re=(ae+Z+z)*1.075,nt=-(ae/2+Z+z)/35):X==="round-hexagon"?Re=(ae+Z+z)*1.12:X==="round-pentagon"?(Re=(ae+Z+z)*1.13,nt=-(ae/2+Z+z)/15):X==="round-tag"?(Re=(ae+Z+z)*1.12,rt=(ae/2+z+Z)*.07):X==="round-triangle"&&(Re=(ae+Z+z)*(Math.PI/2),nt=-(ae+Z/2+z)/Math.PI),Re!==0&&(we=(l+Re)/l,ge=l*we,["round-hexagon","round-tag"].includes(X)||(Ce=(u+Re)/u,Se=u*Ce)),re=re==="auto"?Xh(ge,Se):re;for(var Qe=ge/2,Ot=Se/2,ut=re+(ae+z+Z)/2,ht=new Array(ve.length/2),Wt=new Array(ve.length/2),_t=0;_t<ve.length/2;_t++)ht[_t]={x:ie.x+rt+Qe*ve[_t*2],y:ie.y+nt+Ot*ve[_t*2+1]};var Lt,tr,dr,Kt,Je=ht.length;for(tr=ht[Je-1],Lt=0;Lt<Je;Lt++)dr=ht[Lt%Je],Kt=ht[(Lt+1)%Je],Wt[Lt]=Nc(tr,dr,Kt,ut),tr=dr,dr=Kt;o.drawRoundPolygonPath(ye||t,ie.x+rt,ie.y+nt,l*we,u*Ce,ve,Wt)}else if(["roundrectangle","round-rectangle"].includes(X))re=re==="auto"?Rn(ge,Se):re,o.drawRoundRectanglePath(ye||t,ie.x,ie.y,ge,Se,re+(ae+z+Z)/2);else if(["cutrectangle","cut-rectangle"].includes(X))re=re==="auto"?Jl():re,o.drawCutRectanglePath(ye||t,ie.x,ie.y,ge,Se,null,re+(ae+z+Z)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(X))re=re==="auto"?Rn(ge,Se):re,o.drawBottomRoundRectanglePath(ye||t,ie.x,ie.y,ge,Se,re+(ae+z+Z)/2);else if(X==="barrel")o.drawBarrelPath(ye||t,ie.x,ie.y,ge,Se);else if(X.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(X)){var at=(ae+z+Z)/l;ve=zo(Ho(ve,at)),o.drawPolygonPath(ye||t,ie.x,ie.y,l,u,ve)}else{var pt=(ae+z+Z)/l;ve=zo(Ho(ve,-pt)),o.drawPolygonPath(ye||t,ie.x,ie.y,l,u,ve)}if(v?t.stroke(ye):t.stroke(),ee==="double"){t.lineWidth=ae/3;var mn=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(ye):t.stroke(),t.globalCompositeOperation=mn}t.setLineDash&&t.setLineDash([])}},De=function(){a&&o.drawNodeOverlay(t,e,f,l,u)},Ee=function(){a&&o.drawNodeUnderlay(t,e,f,l,u)},Pe=function(){o.drawElementText(t,e,null,n)},te=e.pstyle("ghost").value==="yes";if(te){var T=e.pstyle("ghost-offset-x").pfValue,R=e.pstyle("ghost-offset-y").pfValue,Q=e.pstyle("ghost-opacity").value,G=Q*p;t.translate(T,R),K(),Ne(),Y(Q*L),se(),ue(G,!0),A(Q*$),me(),pe(D!==0||P!==0),ue(G,!1),de(G),t.translate(-T,-R)}v&&t.translate(-f.x,-f.y),Ee(),v&&t.translate(f.x,f.y),K(),Ne(),Y(),se(),ue(p,!0),A(),me(),pe(D!==0||P!==0),ue(p,!1),de(),v&&t.translate(-f.x,-f.y),Pe(),De(),r&&t.translate(m.x1,m.y1)}};var Jv=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n,a,i,o){var l=this;if(n.visible()){var u=n.pstyle("".concat(e,"-padding")).pfValue,c=n.pstyle("".concat(e,"-opacity")).value,d=n.pstyle("".concat(e,"-color")).value,f=n.pstyle("".concat(e,"-shape")).value,p=n.pstyle("".concat(e,"-corner-radius")).value;if(c>0){if(a=a||n.position(),i==null||o==null){var v=n.padding();i=n.width()+2*v,o=n.height()+2*v}l.colorFillStyle(r,d[0],d[1],d[2],c),l.nodeShapes[f].draw(r,a.x,a.y,i+u*2,o+u*2,p),r.fill()}}}};Ra.drawNodeOverlay=Jv("overlay"),Ra.drawNodeUnderlay=Jv("underlay"),Ra.hasPie=function(t){return t=t[0],t._private.hasPie},Ra.drawPie=function(t,e,r,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=e.pstyle("pie-size"),o=n.x,l=n.y,u=e.width(),c=e.height(),d=Math.min(u,c)/2,f=0,p=this.usePaths();p&&(o=0,l=0),i.units==="%"?d=d*i.pfValue:i.pfValue!==void 0&&(d=i.pfValue/2);for(var v=1;v<=a.pieBackgroundN;v++){var h=e.pstyle("pie-"+v+"-background-size").value,g=e.pstyle("pie-"+v+"-background-color").value,y=e.pstyle("pie-"+v+"-background-opacity").value*r,m=h/100;m+f>1&&(m=1-f);var b=1.5*Math.PI+2*Math.PI*f,w=2*Math.PI*m,C=b+w;h===0||f>=1||f+m>1||(t.beginPath(),t.moveTo(o,l),t.arc(o,l,d,b,C),t.closePath(),this.colorFillStyle(t,g[0],g[1],g[2],y),t.fill(),f+=m)}};var Gt={},kP=100;Gt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r},Gt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,n,a=0;a<e.length;a++)if(n=e[a],n.context===t){r=!1;break}return r&&(n={context:t},e.push(n)),n},Gt.createGradientStyleFor=function(t,e,r,n,a){var i,o=this.usePaths(),l=r.pstyle(e+"-gradient-stop-colors").value,u=r.pstyle(e+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(r.isEdge()){var c=r.sourceEndpoint(),d=r.targetEndpoint(),f=r.midpoint(),p=In(c,f),v=In(d,f);i=t.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(p,v))}else{var h=o?{x:0,y:0}:r.position(),g=r.paddedWidth(),y=r.paddedHeight();i=t.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(g,y))}else if(r.isEdge()){var m=r.sourceEndpoint(),b=r.targetEndpoint();i=t.createLinearGradient(m.x,m.y,b.x,b.y)}else{var w=o?{x:0,y:0}:r.position(),C=r.paddedWidth(),x=r.paddedHeight(),E=C/2,k=x/2,B=r.pstyle("background-gradient-direction").value;switch(B){case"to-bottom":i=t.createLinearGradient(w.x,w.y-k,w.x,w.y+k);break;case"to-top":i=t.createLinearGradient(w.x,w.y+k,w.x,w.y-k);break;case"to-left":i=t.createLinearGradient(w.x+E,w.y,w.x-E,w.y);break;case"to-right":i=t.createLinearGradient(w.x-E,w.y,w.x+E,w.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(w.x-E,w.y-k,w.x+E,w.y+k);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(w.x-E,w.y+k,w.x+E,w.y-k);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(w.x+E,w.y-k,w.x-E,w.y+k);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(w.x+E,w.y+k,w.x-E,w.y-k);break}}if(!i)return null;for(var S=u.length===l.length,N=l.length,D=0;D<N;D++)i.addColorStop(S?u[D]:D/(N-1),"rgba("+l[D][0]+","+l[D][1]+","+l[D][2]+","+a+")");return i},Gt.gradientFillStyle=function(t,e,r,n){var a=this.createGradientStyleFor(t,"background",e,r,n);if(!a)return null;t.fillStyle=a},Gt.colorFillStyle=function(t,e,r,n,a){t.fillStyle="rgba("+e+","+r+","+n+","+a+")"},Gt.eleFillStyle=function(t,e,r){var n=e.pstyle("background-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientFillStyle(t,e,n,r);else{var a=e.pstyle("background-color").value;this.colorFillStyle(t,a[0],a[1],a[2],r)}},Gt.gradientStrokeStyle=function(t,e,r,n){var a=this.createGradientStyleFor(t,"line",e,r,n);if(!a)return null;t.strokeStyle=a},Gt.colorStrokeStyle=function(t,e,r,n,a){t.strokeStyle="rgba("+e+","+r+","+n+","+a+")"},Gt.eleStrokeStyle=function(t,e,r){var n=e.pstyle("line-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientStrokeStyle(t,e,n,r);else{var a=e.pstyle("line-color").value;this.colorStrokeStyle(t,a[0],a[1],a[2],r)}},Gt.matchCanvasSize=function(t){var e=this,r=e.data,n=e.findContainerClientCoords(),a=n[2],i=n[3],o=e.getPixelRatio(),l=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=l);var u=a*o,c=i*o,d;if(!(u===e.canvasWidth&&c===e.canvasHeight)){e.fontCaches=null;var f=r.canvasContainer;f.style.width=a+"px",f.style.height=i+"px";for(var p=0;p<e.CANVAS_LAYERS;p++)d=r.canvases[p],d.width=u,d.height=c,d.style.width=a+"px",d.style.height=i+"px";for(var p=0;p<e.BUFFER_COUNT;p++)d=r.bufferCanvases[p],d.width=u,d.height=c,d.style.width=a+"px",d.style.height=i+"px";e.textureMult=1,o<=1&&(d=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,d.width=u*e.textureMult,d.height=c*e.textureMult),e.canvasWidth=u,e.canvasHeight=c}},Gt.renderTo=function(t,e,r,n){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})},Gt.render=function(t){t=t||zh();var e=t.forcedContext,r=t.drawAllLayers,n=t.drawOnlyNodeLayer,a=t.forcedZoom,i=t.forcedPan,o=this,l=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,u=o.cy,c=o.data,d=c.canvasNeedsRedraw,f=o.textureOnViewport&&!e&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),p=t.motionBlur!==void 0?t.motionBlur:o.motionBlur,v=o.motionBlurPxRatio,h=u.hasCompoundNodes(),g=o.hoverData.draggingEles,y=!!(o.hoverData.selecting||o.touchData.selecting);p=p&&!e&&o.motionBlurEnabled&&!y;var m=p;e||(o.prevPxRatio!==l&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=l),!e&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),p&&(o.mbFrames==null&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(m=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!f&&(d[o.NODE]=!0,d[o.SELECT_BOX]=!0);var b=u.style(),w=u.zoom(),C=a!==void 0?a:w,x=u.pan(),E={x:x.x,y:x.y},k={zoom:w,pan:{x:x.x,y:x.y}},B=o.prevViewport,S=B===void 0||k.zoom!==B.zoom||k.pan.x!==B.pan.x||k.pan.y!==B.pan.y;!S&&!(g&&!h)&&(o.motionBlurPxRatio=1),i&&(E=i),C*=l,E.x*=l,E.y*=l;var N=o.getCachedZSortedEles();function D(ne,se,ue,pe,de){var me=ne.globalCompositeOperation;ne.globalCompositeOperation="destination-out",o.colorFillStyle(ne,255,255,255,o.motionBlurTransparency),ne.fillRect(se,ue,pe,de),ne.globalCompositeOperation=me}function P(ne,se){var ue,pe,de,me;!o.clearingMotionBlur&&(ne===c.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]||ne===c.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG])?(ue={x:x.x*v,y:x.y*v},pe=w*v,de=o.canvasWidth*v,me=o.canvasHeight*v):(ue=E,pe=C,de=o.canvasWidth,me=o.canvasHeight),ne.setTransform(1,0,0,1,0,0),se==="motionBlur"?D(ne,0,0,de,me):!e&&(se===void 0||se)&&ne.clearRect(0,0,de,me),r||(ne.translate(ue.x,ue.y),ne.scale(pe,pe)),i&&ne.translate(i.x,i.y),a&&ne.scale(a,a)}if(f||(o.textureDrawLastFrame=!1),f){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=u.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var L=o.data.bufferContexts[o.TEXTURE_BUFFER];L.setTransform(1,0,0,1,0,0),L.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:L,drawOnlyNodeLayer:!0,forcedPxRatio:l*o.textureMult});var k=o.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:o.canvasWidth,height:o.canvasHeight};k.mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}d[o.DRAG]=!1,d[o.NODE]=!1;var O=c.contexts[o.NODE],I=o.textureCache.texture,k=o.textureCache.viewport;O.setTransform(1,0,0,1,0,0),p?D(O,0,0,k.width,k.height):O.clearRect(0,0,k.width,k.height);var _=b.core("outside-texture-bg-color").value,M=b.core("outside-texture-bg-opacity").value;o.colorFillStyle(O,_[0],_[1],_[2],M),O.fillRect(0,0,k.width,k.height);var w=u.zoom();P(O,!1),O.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l),O.drawImage(I,k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l)}else o.textureOnViewport&&!e&&(o.textureCache=null);var F=u.extent(),V=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),H=o.hideEdgesOnViewport&&V,$=[];if($[o.NODE]=!d[o.NODE]&&p&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,$[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),$[o.DRAG]=!d[o.DRAG]&&p&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,$[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),d[o.NODE]||r||n||$[o.NODE]){var z=p&&!$[o.NODE]&&v!==1,O=e||(z?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:c.contexts[o.NODE]),j=p&&!z?"motionBlur":void 0;P(O,j),H?o.drawCachedNodes(O,N.nondrag,l,F):o.drawLayeredElements(O,N.nondrag,l,F),o.debug&&o.drawDebugPoints(O,N.nondrag),!r&&!p&&(d[o.NODE]=!1)}if(!n&&(d[o.DRAG]||r||$[o.DRAG])){var z=p&&!$[o.DRAG]&&v!==1,O=e||(z?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:c.contexts[o.DRAG]);P(O,p&&!z?"motionBlur":void 0),H?o.drawCachedNodes(O,N.drag,l,F):o.drawCachedElements(O,N.drag,l,F),o.debug&&o.drawDebugPoints(O,N.drag),!r&&!p&&(d[o.DRAG]=!1)}if(o.showFps||!n&&d[o.SELECT_BOX]&&!r){var O=e||c.contexts[o.SELECT_BOX];if(P(O),o.selection[4]==1&&(o.hoverData.selecting||o.touchData.selecting)){var w=o.cy.zoom(),ee=b.core("selection-box-border-width").value/w;O.lineWidth=ee,O.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",O.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),ee>0&&(O.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",O.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(c.bgActivePosistion&&!o.hoverData.selecting){var w=o.cy.zoom(),J=c.bgActivePosistion;O.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",O.beginPath(),O.arc(J.x,J.y,b.core("active-bg-size").pfValue/w,0,2*Math.PI),O.fill()}var Z=o.lastRedrawTime;if(o.showFps&&Z){Z=Math.round(Z);var re=Math.round(1e3/Z);O.setTransform(1,0,0,1,0,0),O.fillStyle="rgba(255, 0, 0, 0.75)",O.strokeStyle="rgba(255, 0, 0, 0.75)",O.lineWidth=1,O.fillText("1 frame = "+Z+" ms = "+re+" fps",0,20);var Y=60;O.strokeRect(0,30,250,20),O.fillRect(0,30,250*Math.min(re/Y,1),20)}r||(d[o.SELECT_BOX]=!1)}if(p&&v!==1){var A=c.contexts[o.NODE],K=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],W=c.contexts[o.DRAG],oe=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],he=function(se,ue,pe){se.setTransform(1,0,0,1,0,0),pe||!m?se.clearRect(0,0,o.canvasWidth,o.canvasHeight):D(se,0,0,o.canvasWidth,o.canvasHeight);var de=v;se.drawImage(ue,0,0,o.canvasWidth*de,o.canvasHeight*de,0,0,o.canvasWidth,o.canvasHeight)};(d[o.NODE]||$[o.NODE])&&(he(A,K,$[o.NODE]),d[o.NODE]=!1),(d[o.DRAG]||$[o.DRAG])&&(he(W,oe,$[o.DRAG]),d[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),p&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!f,o.mbFrames=0,d[o.NODE]=!0,d[o.DRAG]=!0,o.redraw()},kP)),e||u.emit("render")};var gn={};gn.drawPolygonPath=function(t,e,r,n,a,i){var o=n/2,l=a/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*i[0],r+l*i[1]);for(var u=1;u<i.length/2;u++)t.lineTo(e+o*i[u*2],r+l*i[u*2+1]);t.closePath()},gn.drawRoundPolygonPath=function(t,e,r,n,a,i,o){o.forEach(function(l){return Lv(t,l)}),t.closePath()},gn.drawRoundRectanglePath=function(t,e,r,n,a,i){var o=n/2,l=a/2,u=i==="auto"?Rn(n,a):Math.min(i,l,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-l),t.arcTo(e+o,r-l,e+o,r,u),t.arcTo(e+o,r+l,e,r+l,u),t.arcTo(e-o,r+l,e-o,r,u),t.arcTo(e-o,r-l,e,r-l,u),t.lineTo(e,r-l),t.closePath()},gn.drawBottomRoundRectanglePath=function(t,e,r,n,a,i){var o=n/2,l=a/2,u=i==="auto"?Rn(n,a):i;t.beginPath&&t.beginPath(),t.moveTo(e,r-l),t.lineTo(e+o,r-l),t.lineTo(e+o,r),t.arcTo(e+o,r+l,e,r+l,u),t.arcTo(e-o,r+l,e-o,r,u),t.lineTo(e-o,r-l),t.lineTo(e,r-l),t.closePath()},gn.drawCutRectanglePath=function(t,e,r,n,a,i,o){var l=n/2,u=a/2,c=o==="auto"?Jl():o;t.beginPath&&t.beginPath(),t.moveTo(e-l+c,r-u),t.lineTo(e+l-c,r-u),t.lineTo(e+l,r-u+c),t.lineTo(e+l,r+u-c),t.lineTo(e+l-c,r+u),t.lineTo(e-l+c,r+u),t.lineTo(e-l,r+u-c),t.lineTo(e-l,r-u+c),t.closePath()},gn.drawBarrelPath=function(t,e,r,n,a){var i=n/2,o=a/2,l=e-i,u=e+i,c=r-o,d=r+o,f=ec(n,a),p=f.widthOffset,v=f.heightOffset,h=f.ctrlPtOffsetPct*p;t.beginPath&&t.beginPath(),t.moveTo(l,c+v),t.lineTo(l,d-v),t.quadraticCurveTo(l+h,d,l+p,d),t.lineTo(u-p,d),t.quadraticCurveTo(u-h,d,u,d-v),t.lineTo(u,c+v),t.quadraticCurveTo(u-h,c,u-p,c),t.lineTo(l+p,c),t.quadraticCurveTo(l+h,c,l,c+v),t.closePath()};for(var eg=Math.sin(0),tg=Math.cos(0),Mc={},Ic={},rg=Math.PI/40,$a=0*Math.PI;$a<2*Math.PI;$a+=rg)Mc[$a]=Math.sin($a),Ic[$a]=Math.cos($a);gn.drawEllipsePath=function(t,e,r,n,a){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,n/2,a/2,0,0,2*Math.PI);else for(var i,o,l=n/2,u=a/2,c=0*Math.PI;c<2*Math.PI;c+=rg)i=e-l*Mc[c]*eg+l*Ic[c]*tg,o=r+u*Ic[c]*eg+u*Mc[c]*tg,c===0?t.moveTo(i,o):t.lineTo(i,o);t.closePath()};var Ui={};Ui.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]},Ui.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),n=r.boundingBox(),a=this.findContainerClientCoords(),i=t.full?Math.ceil(n.w):a[2],o=t.full?Math.ceil(n.h):a[3],l=le(t.maxWidth)||le(t.maxHeight),u=this.getPixelRatio(),c=1;if(t.scale!==void 0)i*=t.scale,o*=t.scale,c=t.scale;else if(l){var d=1/0,f=1/0;le(t.maxWidth)&&(d=c*t.maxWidth/i),le(t.maxHeight)&&(f=c*t.maxHeight/o),c=Math.min(d,f),i*=c,o*=c}l||(i*=u,o*=u,c*=u);var p=document.createElement("canvas");p.width=i,p.height=o,p.style.width=i+"px",p.style.height=o+"px";var v=p.getContext("2d");if(i>0&&o>0){v.clearRect(0,0,i,o),v.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(t.full)v.translate(-n.x1*c,-n.y1*c),v.scale(c,c),this.drawElements(v,h),v.scale(1/c,1/c),v.translate(n.x1*c,n.y1*c);else{var g=e.pan(),y={x:g.x*c,y:g.y*c};c*=e.zoom(),v.translate(y.x,y.y),v.scale(c,c),this.drawElements(v,h),v.scale(1/c,1/c),v.translate(-y.x,-y.y)}t.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=t.bg,v.rect(0,0,i,o),v.fill())}return p};function xP(t,e){for(var r=atob(t),n=new ArrayBuffer(r.length),a=new Uint8Array(n),i=0;i<r.length;i++)a[i]=r.charCodeAt(i);return new Blob([n],{type:e})}function ng(t){var e=t.indexOf(",");return t.substr(e+1)}function ag(t,e,r){var n=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new xa(function(a,i){try{e.toBlob(function(o){o!=null?a(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){i(o)}});case"blob":return xP(ng(n()),r);case"base64":return ng(n());case"base64uri":default:return n()}}Ui.png=function(t){return ag(t,this.bufferCanvasImage(t),"image/png")},Ui.jpg=function(t){return ag(t,this.bufferCanvasImage(t),"image/jpeg")};var ig={};ig.nodeShapeImpl=function(t,e,r,n,a,i,o,l){switch(t){case"ellipse":return this.drawEllipsePath(e,r,n,a,i);case"polygon":return this.drawPolygonPath(e,r,n,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,n,a,i,o,l);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,n,a,i,l);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,n,a,i,o,l);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,n,a,i,l);case"barrel":return this.drawBarrelPath(e,r,n,a,i)}};var EP=og,Me=og.prototype;Me.CANVAS_LAYERS=3,Me.SELECT_BOX=0,Me.DRAG=1,Me.NODE=2,Me.BUFFER_COUNT=3,Me.TEXTURE_BUFFER=0,Me.MOTIONBLUR_BUFFER_NODE=1,Me.MOTIONBLUR_BUFFER_DRAG=2;function og(t){var e=this,r=e.cy.window(),n=r.document;e.data={canvases:new Array(Me.CANVAS_LAYERS),contexts:new Array(Me.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Me.CANVAS_LAYERS),bufferCanvases:new Array(Me.BUFFER_COUNT),bufferContexts:new Array(Me.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=n.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[a]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var l=t.cy.container();l.appendChild(e.data.canvasContainer),l.style[a]=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"};dT()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var c=0;c<Me.CANVAS_LAYERS;c++){var d=e.data.canvases[c]=n.createElement("canvas");e.data.contexts[c]=d.getContext("2d"),Object.keys(u).forEach(function(Y){d.style[Y]=u[Y]}),d.style.position="absolute",d.setAttribute("data-id","layer"+c),d.style.zIndex=String(Me.CANVAS_LAYERS-c),e.data.canvasContainer.appendChild(d),e.data.canvasNeedsRedraw[c]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Me.NODE].setAttribute("data-id","layer"+Me.NODE+"-node"),e.data.canvases[Me.SELECT_BOX].setAttribute("data-id","layer"+Me.SELECT_BOX+"-selectbox"),e.data.canvases[Me.DRAG].setAttribute("data-id","layer"+Me.DRAG+"-drag");for(var c=0;c<Me.BUFFER_COUNT;c++)e.data.bufferCanvases[c]=n.createElement("canvas"),e.data.bufferContexts[c]=e.data.bufferCanvases[c].getContext("2d"),e.data.bufferCanvases[c].style.position="absolute",e.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),e.data.bufferCanvases[c].style.zIndex=String(-c-1),e.data.bufferCanvases[c].style.visibility="hidden";e.pathsEnabled=!0;var f=zt(),p=function(A){return{x:(A.x1+A.x2)/2,y:(A.y1+A.y2)/2}},v=function(A){return{x:-A.w/2,y:-A.h/2}},h=function(A){var K=A[0]._private,W=K.oldBackgroundTimestamp===K.backgroundTimestamp;return!W},g=function(A){return A[0]._private.nodeKey},y=function(A){return A[0]._private.labelStyleKey},m=function(A){return A[0]._private.sourceLabelStyleKey},b=function(A){return A[0]._private.targetLabelStyleKey},w=function(A,K,W,oe,he){return e.drawElement(A,K,W,!1,!1,he)},C=function(A,K,W,oe,he){return e.drawElementText(A,K,W,oe,"main",he)},x=function(A,K,W,oe,he){return e.drawElementText(A,K,W,oe,"source",he)},E=function(A,K,W,oe,he){return e.drawElementText(A,K,W,oe,"target",he)},k=function(A){return A.boundingBox(),A[0]._private.bodyBounds},B=function(A){return A.boundingBox(),A[0]._private.labelBounds.main||f},S=function(A){return A.boundingBox(),A[0]._private.labelBounds.source||f},N=function(A){return A.boundingBox(),A[0]._private.labelBounds.target||f},D=function(A,K){return K},P=function(A){return p(k(A))},L=function(A,K,W){var oe=A?A+"-":"";return{x:K.x+W.pstyle(oe+"text-margin-x").pfValue,y:K.y+W.pstyle(oe+"text-margin-y").pfValue}},O=function(A,K,W){var oe=A[0]._private.rscratch;return{x:oe[K],y:oe[W]}},I=function(A){return L("",O(A,"labelX","labelY"),A)},_=function(A){return L("source",O(A,"sourceLabelX","sourceLabelY"),A)},M=function(A){return L("target",O(A,"targetLabelX","targetLabelY"),A)},F=function(A){return v(k(A))},V=function(A){return v(S(A))},H=function(A){return v(N(A))},$=function(A){var K=B(A),W=v(B(A));if(A.isNode()){switch(A.pstyle("text-halign").value){case"left":W.x=-K.w;break;case"right":W.x=0;break}switch(A.pstyle("text-valign").value){case"top":W.y=-K.h;break;case"bottom":W.y=0;break}}return W},z=e.data.eleTxrCache=new Ki(e,{getKey:g,doesEleInvalidateKey:h,drawElement:w,getBoundingBox:k,getRotationPoint:P,getRotationOffset:F,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),j=e.data.lblTxrCache=new Ki(e,{getKey:y,drawElement:C,getBoundingBox:B,getRotationPoint:I,getRotationOffset:$,isVisible:D}),ee=e.data.slbTxrCache=new Ki(e,{getKey:m,drawElement:x,getBoundingBox:S,getRotationPoint:_,getRotationOffset:V,isVisible:D}),J=e.data.tlbTxrCache=new Ki(e,{getKey:b,drawElement:E,getBoundingBox:N,getRotationPoint:M,getRotationOffset:H,isVisible:D}),Z=e.data.lyrTxrCache=new Wv(e);e.onUpdateEleCalcs(function(A,K){z.invalidateElements(K),j.invalidateElements(K),ee.invalidateElements(K),J.invalidateElements(K),Z.invalidateElements(K);for(var W=0;W<K.length;W++){var oe=K[W]._private;oe.oldBackgroundTimestamp=oe.backgroundTimestamp}});var re=function(A){for(var K=0;K<A.length;K++)Z.enqueueElementRefinement(A[K].ele)};z.onDequeue(re),j.onDequeue(re),ee.onDequeue(re),J.onDequeue(re)}Me.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Me.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Me.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Me.SELECT_BOX]=e;break}};var SP=typeof Path2D<"u";Me.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t},Me.usePaths=function(){return SP&&this.pathsEnabled},Me.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)},Me.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled},Me.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":ot(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var n=this.cy.window(),a=n.document;r=a.createElement("canvas"),r.width=t,r.height=e}return r},[Yv,Sr,Kr,Lc,Wn,Ra,Gt,gn,Ui,ig].forEach(function(t){xe(Me,t)});var TP=[{name:"null",impl:Ev},{name:"base",impl:Kv},{name:"canvas",impl:EP}],BP=[{type:"layout",extensions:L3},{type:"renderer",extensions:TP}],sg={},lg={};function cg(t,e,r){var n=r,a=function(B){Ae("Can not register `"+e+"` for `"+t+"` since `"+B+"` already exists in the prototype and can not be overridden")};if(t==="core"){if($i.prototype[e])return a(e);$i.prototype[e]=r}else if(t==="collection"){if(kt.prototype[e])return a(e);kt.prototype[e]=r}else if(t==="layout"){for(var i=function(B){this.options=B,r.call(this,B),_e(this._private)||(this._private={}),this._private.cy=B.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),l=[],u=0;u<l.length;u++){var c=l[u];o[c]=o[c]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var d=r.prototype.stop;o.stop=function(){var k=this.options;if(k&&k.animate){var B=this.animations;if(B)for(var S=0;S<B.length;S++)B[S].stop()}return d?d.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var f=function(B){return B._private.cy},p={addEventFields:function(B,S){S.layout=B,S.cy=f(B),S.target=B},bubble:function(){return!0},parent:function(B){return f(B)}};xe(o,{createEmitter:function(){return this._private.emitter=new rs(p,this),this},emitter:function(){return this._private.emitter},on:function(B,S){return this.emitter().on(B,S),this},one:function(B,S){return this.emitter().one(B,S),this},once:function(B,S){return this.emitter().one(B,S),this},removeListener:function(B,S){return this.emitter().removeListener(B,S),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(B,S){return this.emitter().emit(B,S),this}}),Ve.eventAliasesOn(o),n=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var v=ug("renderer","base"),h=v.prototype,g=r,y=r.prototype,m=function(){v.apply(this,arguments),g.apply(this,arguments)},b=m.prototype;for(var w in h){var C=h[w],x=y[w]!=null;if(x)return a(w);b[w]=C}for(var E in y)b[E]=y[E];h.clientFunctions.forEach(function(k){b[k]=b[k]||function(){Xe("Renderer does not implement `renderer."+k+"()` on its prototype")}}),n=m}else if(t==="__proto__"||t==="constructor"||t==="prototype")return Xe(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return Sh({map:sg,keys:[t,e],value:n})}function ug(t,e){return Th({map:sg,keys:[t,e]})}function NP(t,e,r,n,a){return Sh({map:lg,keys:[t,e,r,n],value:a})}function DP(t,e,r,n){return Th({map:lg,keys:[t,e,r,n]})}var Ac=function(){if(arguments.length===2)return ug.apply(null,arguments);if(arguments.length===3)return cg.apply(null,arguments);if(arguments.length===4)return DP.apply(null,arguments);if(arguments.length===5)return NP.apply(null,arguments);Xe("Invalid extension access syntax")};$i.prototype.extension=Ac,BP.forEach(function(t){t.extensions.forEach(function(e){cg(t.type,e.name,e.impl)})});var dg=function t(){if(!(this instanceof t))return new t;this.length=0},jn=dg.prototype;jn.instanceString=function(){return"stylesheet"},jn.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this},jn.css=function(t,e){var r=this.length-1;if(be(t))this[r].properties.push({name:t,value:e});else if(_e(t))for(var n=t,a=Object.keys(n),i=0;i<a.length;i++){var o=a[i],l=n[o];if(l!=null){var u=Nt.properties[o]||Nt.properties[Po(o)];if(u!=null){var c=u.name,d=l;this[r].properties.push({name:c,value:d})}}}return this},jn.style=jn.css,jn.generateStyle=function(t){var e=new Nt(t);return this.appendToStyle(e)},jn.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],n=r.selector,a=r.properties;t.selector(n);for(var i=0;i<a.length;i++){var o=a[i];t.css(o.name,o.value)}}return t};var PP="3.30.2",Yn=function(e){if(e===void 0&&(e={}),_e(e))return new $i(e);if(be(e))return Ac.apply(Ac,arguments)};Yn.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Yn),t.apply(null,e),this},Yn.warnings=function(t){return Rh(t)},Yn.version=PP,Yn.stylesheet=Yn.Stylesheet=dg;let OP=class{constructor(e,r){Br(this,"cyg",null);Br(this,"nodes",[]);Br(this,"edges",[]);Br(this,"axons",[]);Br(this,"dendrites",[]);Br(this,"labelCache",new Map);Br(this,"graphCanvas",null);this.labelCache=e,this.graphCanvas=r}async addConnectivity(e){if(this.axons=e.axons.map(r=>JSON.stringify(r)),this.dendrites=e.dendrites.map(r=>JSON.stringify(r)),e.connectivity.length)for(const r of e.connectivity){const n=await this.graphNode(r[0]),a=await this.graphNode(r[1]);this.nodes.push(n),this.nodes.push(a),this.edges.push({id:`${n.id}_${a.id}`,source:n.id,target:a.id})}else this.nodes.push({id:"MISSING",label:"NO PATHS"})}showConnectivity(e){this.cyg=new LP(this,e)}clearConnectivity(){var e;(e=this.cyg)!=null&&e.cy&&(this.cyg.cy.remove(),this.cyg.cy=null)}reset(){var e;(e=this.cyg)!=null&&e.cy&&this.cyg.cy.reset()}enableZoom(e){var r;(r=this.cyg)!=null&&r.cy&&this.cyg.cy.userZoomingEnabled(e)}get elements(){return[...this.nodes.map(e=>({data:e})),...this.edges.map(e=>({data:e}))]}get roots(){return this.dendrites}async graphNode(e){const r=JSON.stringify(e),n=[e[0],...e[1]],a=[];for(const o of n){const l=this.labelCache.has(o)?this.labelCache.get(o):"";a.push(l)}n.push(...a);const i={id:r,label:n.join(`
448
- `)};return this.axons.includes(r)?this.dendrites.includes(r)?i["both-a-d"]=!0:i.axon=!0:this.dendrites.includes(r)&&(i.dendrite=!0),i}};const _P=[{selector:"node",style:{label:"data(label)","background-color":"#80F0F0","text-valign":"center","text-wrap":"wrap","text-max-width":"80px","font-size":"6px"}},{selector:"node[axon]",style:{"background-color":"green"}},{selector:"node[dendrite]",style:{"background-color":"red"}},{selector:"node[both-a-d]",style:{"background-color":"gray"}},{selector:"edge",style:{width:2,"line-color":"#9dbaea","target-arrow-color":"#9dbaea","target-arrow-shape":"triangle","curve-style":"bezier"}}];class LP{constructor(e,r){Br(this,"cy");Br(this,"tooltip");var n;this.cy=Yn({container:r,elements:e.elements,layout:{name:"breadthfirst",circle:!1,roots:e.roots},directed:!0,style:_P,minZoom:.5,maxZoom:10,wheelSensitivity:.4}).on("mouseover","node",this.overNode.bind(this)).on("mouseout","node",this.exitNode.bind(this)).on("position","node",this.moveNode.bind(this)),this.tooltip=document.createElement("div"),this.tooltip.className="cy-graph-tooltip",this.tooltip.hidden=!0,(n=r==null?void 0:r.lastChild)==null||n.appendChild(this.tooltip)}remove(){this.cy&&this.cy.destroy()}checkRightBoundary(e){var r;e+this.tooltip.offsetWidth>=((r=this.tooltip.parentElement)==null?void 0:r.offsetWidth)&&(this.tooltip.style.left=`${e-this.tooltip.offsetWidth}px`)}overNode(e){const r=e.target;this.tooltip.innerText=r.data().label,this.tooltip.style.left=`${e.renderedPosition.x}px`,this.tooltip.style.top=`${e.renderedPosition.y}px`,this.tooltip.hidden=!1,this.checkRightBoundary(e.renderedPosition.x)}moveNode(e){const r=e.target;this.tooltip.style.left=`${r.renderedPosition().x}px`,this.tooltip.style.top=`${r.renderedPosition().y}px`,this.checkRightBoundary(r.renderedPosition().x)}exitNode(e){this.tooltip.hidden=!0}}const FP=1.3,MP=24*60*60*1e3,IP="Reset position",fg="Lock zoom (to scroll)",AP="Unlock zoom",VP="#8300bf",RP={name:"ConnectivityGraph",props:{entry:{type:String,default:""},mapServer:{type:String,default:""}},data:function(){return{loading:!0,connectivityGraph:null,selectedSource:"",pathList:[],schemaVersion:"",knowledgeByPath:new Map,labelledTerms:new Set,labelCache:new Map,resetLabel:IP,zoomLockLabel:fg,iconColor:VP,zoomEnabled:!1}},mounted(){this.refreshCache(),this.loadCacheData(),this.run().then(t=>{this.showGraph(this.entry)})},methods:{loadCacheData:function(){const t=sessionStorage.getItem("connectivity-graph-source"),e=sessionStorage.getItem("connectivity-graph-labels"),r=sessionStorage.getItem("connectivity-graph-pathlist"),n=sessionStorage.getItem("connectivity-graph-schema-version");if(t&&(this.selectedSource=t),r&&(this.pathList=JSON.parse(r)),e){const a=JSON.parse(e);this.labelCache=new Map(Object.entries(a))}n&&(this.schemaVersion=n)},removeAllCacheData:function(){["connectivity-graph-expiry","connectivity-graph-source","connectivity-graph-labels","connectivity-graph-pathlist","connectivity-graph-schema-version"].forEach(e=>{sessionStorage.removeItem(e)})},refreshCache:function(){const t=sessionStorage.getItem("connectivity-graph-expiry");new Date().getTime()>t&&this.removeAllCacheData()},updateCacheExpiry:function(){const e=new Date().getTime()+MP;sessionStorage.setItem("connectivity-graph-expiry",e)},run:async function(){if(this.schemaVersion||(this.schemaVersion=await this.getSchemaVersion(),sessionStorage.setItem("connectivity-graph-schema-version",this.schemaVersion),this.updateCacheExpiry()),this.schemaVersion<FP){console.warn("No Server!");return}this.showSpinner(),this.selectedSource||(this.selectedSource=await this.setSourceList(),sessionStorage.setItem("connectivity-graph-source",this.selectedSource),this.updateCacheExpiry()),await this.setPathList(this.selectedSource),this.hideSpinner()},showGraph:async function(t){const e=this.$refs.graphCanvas;this.showSpinner(),this.connectivityGraph=new OP(this.labelCache,e),await this.connectivityGraph.addConnectivity(this.knowledgeByPath.get(t)),this.hideSpinner(),this.connectivityGraph.showConnectivity(e)},query:async function(t,e){const r=`${this.mapServer}knowledge/query/`,n={sql:t,params:e};try{const a=await fetch(r,{method:"POST",headers:{Accept:"application/json; charset=utf-8","Cache-Control":"no-store","Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`Cannot access ${r}`);return await a.json()}catch{return{values:[]}}},setSourceList:async function(){const t=await this.getJsonData(`${this.mapServer}knowledge/sources`),e=t?t.sources||[]:[];let r="";for(const n of e)n&&r===""&&(r=n);return r},loadPathData:async function(t){const e=await this.query(`select entity, knowledge from knowledge
447
+ `),w=0;w<b.length;w++){var C=b[w],x=h.measureText(C),E=Math.ceil(x.width),k=d;y=Math.max(E,y),m+=k}return y+=u,m+=u,o[i]={width:y,height:m}},Er.calculateLabelAngle=function(t,e){var r=t._private,n=r.rscratch,a=t.isEdge(),i=e?e+"-":"",o=t.pstyle(i+"text-rotation"),l=o.strValue;return l==="none"?0:a&&l==="autorotate"?n.labelAutoAngle:l==="autorotate"?0:o.pfValue},Er.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),n=t._private,a=n.rscratch;a.labelAngle=e.calculateLabelAngle(t),r&&(a.sourceLabelAngle=e.calculateLabelAngle(t,"source"),a.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var Av={},Vv=28,Rv=!1;Av.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<Vv||t.height()<Vv))return Rv||(Ae("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Rv=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var n=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(n).name}return r};var ws={};ws.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,n=function(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),l)for(var u=0;u<o.length;u++){var c=o[u],d=c._private,f=d.rstyle;f.clean=!1,f.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var l=o.target;n(l)}).on("style.* background.*",function(o){var l=o.target;n(l,!1)});var a=function(o){if(o){var l=r.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var c=e[u],d=c._private.rstyle;c.isNode()&&!d.cleanConnected&&(n(c.connectedEdges()),d.cleanConnected=!0)}if(l)for(var f=0;f<l.length;f++){var p=l[f];p(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){a(!0)},r.beforeRender(a,r.beforeRenderPriorities.eleCalcs)},ws.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)},ws.recalculateRenderedStyle=function(t,e){var r=function(C){return C._private.rstyle.cleanConnected},n=[],a=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var o=t[i],l=o._private,u=l.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(l.group==="nodes"?a.push(o):n.push(o),u.clean=!0)}for(var c=0;c<a.length;c++){var d=a[c],f=d._private,p=f.rstyle,v=d.position();this.recalculateNodeLabelProjection(d),p.nodeX=v.x,p.nodeY=v.y,p.nodeW=d.pstyle("width").pfValue,p.nodeH=d.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var h=0;h<n.length;h++){var g=n[h],y=g._private,m=y.rstyle,b=y.rscratch;m.srcX=b.arrowStartX,m.srcY=b.arrowStartY,m.tgtX=b.arrowEndX,m.tgtY=b.arrowEndY,m.midX=b.midX,m.midY=b.midY,m.labelAngle=b.labelAngle,m.sourceLabelAngle=b.sourceLabelAngle,m.targetLabelAngle=b.targetLabelAngle}}};var Cs={};Cs.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var n=t[r],a=n._private.rscratch;n.grabbed()&&!n.isParent()?e.push(n):a.inDragLayer?t.drag.push(n):t.nondrag.push(n)}for(var r=0;r<e.length;r++){var n=e[r];t.drag.push(n)}}},Cs.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},Cs.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(tv),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var $v={};[Kn,ms,Pt,zi,Dc,Er,Av,ws,Cs].forEach(function(t){xe($v,t)});var zv={};zv.getCachedImage=function(t,e,r){var n=this,a=n.imageCache=n.imageCache||{},i=a[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=a[t]=a[t]||{};var o=i.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var l="data:",u=t.substring(0,l.length).toLowerCase()===l;return u||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var Ia={};Ia.registerBinding=function(t,e,r,n){var a=Array.prototype.slice.apply(arguments,[1]),i=this.binder(t);return i.on.apply(i,a)},Ia.binder=function(t){var e=this,r=e.cy.window(),n=t===r||t===r.document||t===r.document.body||lT(t);if(e.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});r.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=a}var o=function(u,c,d){var f=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(f[2]={capture:d??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:f}),(t.addEventListener||t.on).apply(t,f),this};return{on:o,addEventListener:o,addListener:o,bind:o}},Ia.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()},Ia.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()},Ia.load=function(){var t=this,e=t.cy.window(),r=function(T){return T.selected()},n=function(T,R,Q,G){T==null&&(T=t.cy);for(var U=0;U<R.length;U++){var ie=R[U];T.emit({originalEvent:Q,type:ie,position:G})}},a=function(T){return T.shiftKey||T.metaKey||T.ctrlKey},i=function(T,R){var Q=!0;if(t.cy.hasCompoundNodes()&&T&&T.pannable())for(var G=0;R&&G<R.length;G++){var T=R[G];if(T.isNode()&&T.isParent()&&!T.pannable()){Q=!1;break}}else Q=!0;return Q},o=function(T){T[0]._private.grabbed=!0},l=function(T){T[0]._private.grabbed=!1},u=function(T){T[0]._private.rscratch.inDragLayer=!0},c=function(T){T[0]._private.rscratch.inDragLayer=!1},d=function(T){T[0]._private.rscratch.isGrabTarget=!0},f=function(T){T[0]._private.rscratch.isGrabTarget=!1},p=function(T,R){var Q=R.addToList,G=Q.has(T);!G&&T.grabbable()&&!T.locked()&&(Q.merge(T),o(T))},v=function(T,R){if(T.cy().hasCompoundNodes()&&!(R.inDragLayer==null&&R.addToList==null)){var Q=T.descendants();R.inDragLayer&&(Q.forEach(u),Q.connectedEdges().forEach(u)),R.addToList&&p(Q,R)}},h=function(T,R){R=R||{};var Q=T.cy().hasCompoundNodes();R.inDragLayer&&(T.forEach(u),T.neighborhood().stdFilter(function(G){return!Q||G.isEdge()}).forEach(u)),R.addToList&&T.forEach(function(G){p(G,R)}),v(T,R),m(T,{inDragLayer:R.inDragLayer}),t.updateCachedGrabbedEles()},g=h,y=function(T){T&&(t.getCachedZSortedEles().forEach(function(R){l(R),c(R),f(R)}),t.updateCachedGrabbedEles())},m=function(T,R){if(!(R.inDragLayer==null&&R.addToList==null)&&T.cy().hasCompoundNodes()){var Q=T.ancestors().orphans();if(!Q.same(T)){var G=Q.descendants().spawnSelf().merge(Q).unmerge(T).unmerge(T.descendants()),U=G.connectedEdges();R.inDragLayer&&(U.forEach(u),G.forEach(u)),R.addToList&&G.forEach(function(ie){p(ie,R)})}}},b=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},w=typeof MutationObserver<"u",C=typeof ResizeObserver<"u";w?(t.removeObserver=new MutationObserver(function(te){for(var T=0;T<te.length;T++){var R=te[T],Q=R.removedNodes;if(Q)for(var G=0;G<Q.length;G++){var U=Q[G];if(U===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(te){t.destroy()});var x=_o(function(){t.cy.resize()},100);w&&(t.styleObserver=new MutationObserver(x),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",x),C&&(t.resizeObserver=new ResizeObserver(x),t.resizeObserver.observe(t.container));var E=function(T,R){for(;T!=null;)R(T),T=T.parentNode},k=function(){t.invalidateContainerClientCoordsCache()};E(t.container,function(te){t.registerBinding(te,"transitionend",k),t.registerBinding(te,"animationend",k),t.registerBinding(te,"scroll",k)}),t.registerBinding(t.container,"contextmenu",function(te){te.preventDefault()});var B=function(){return t.selection[4]!==0},S=function(T){for(var R=t.findContainerClientCoords(),Q=R[0],G=R[1],U=R[2],ie=R[3],X=T.touches?T.touches:[T],ae=!1,we=0;we<X.length;we++){var Ce=X[we];if(Q<=Ce.clientX&&Ce.clientX<=Q+U&&G<=Ce.clientY&&Ce.clientY<=G+ie){ae=!0;break}}if(!ae)return!1;for(var ge=t.container,Se=T.target,ve=Se.parentNode,ye=!1;ve;){if(ve===ge){ye=!0;break}ve=ve.parentNode}return!!ye};t.registerBinding(t.container,"mousedown",function(T){if(S(T)&&!(t.hoverData.which===1&&T.which!==1)){T.preventDefault(),b(),t.hoverData.capture=!0,t.hoverData.which=T.which;var R=t.cy,Q=[T.clientX,T.clientY],G=t.projectIntoViewport(Q[0],Q[1]),U=t.selection,ie=t.findNearestElements(G[0],G[1],!0,!1),X=ie[0],ae=t.dragData.possibleDragElements;t.hoverData.mdownPos=G,t.hoverData.mdownGPos=Q;var we=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var Ge=t.hoverData.down;Ge?Ge.emit({originalEvent:T,type:"taphold",position:{x:G[0],y:G[1]}}):R.emit({originalEvent:T,type:"taphold",position:{x:G[0],y:G[1]}})}},t.tapholdDuration)};if(T.which==3){t.hoverData.cxtStarted=!0;var Ce={originalEvent:T,type:"cxttapstart",position:{x:G[0],y:G[1]}};X?(X.activate(),X.emit(Ce),t.hoverData.down=X):R.emit(Ce),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(T.which==1){X&&X.activate();{if(X!=null&&t.nodeIsGrabbable(X)){var ge=function(Ge){return{originalEvent:T,type:Ge,position:{x:G[0],y:G[1]}}},Se=function(Ge){Ge.emit(ge("grab"))};if(d(X),!X.selected())ae=t.dragData.possibleDragElements=R.collection(),g(X,{addToList:ae}),X.emit(ge("grabon")).emit(ge("grab"));else{ae=t.dragData.possibleDragElements=R.collection();var ve=R.$(function(ye){return ye.isNode()&&ye.selected()&&t.nodeIsGrabbable(ye)});h(ve,{addToList:ae}),X.emit(ge("grabon")),ve.forEach(Se)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=X,t.hoverData.downs=ie,t.hoverData.downTime=new Date().getTime()}n(X,["mousedown","tapstart","vmousedown"],T,{x:G[0],y:G[1]}),X==null?(U[4]=1,t.data.bgActivePosistion={x:G[0],y:G[1]},t.redrawHint("select",!0),t.redraw()):X.pannable()&&(U[4]=1),we()}U[0]=U[2]=G[0],U[1]=U[3]=G[1]}},!1),t.registerBinding(e,"mousemove",function(T){var R=t.hoverData.capture;if(!(!R&&!S(T))){var Q=!1,G=t.cy,U=G.zoom(),ie=[T.clientX,T.clientY],X=t.projectIntoViewport(ie[0],ie[1]),ae=t.hoverData.mdownPos,we=t.hoverData.mdownGPos,Ce=t.selection,ge=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(ge=t.findNearestElement(X[0],X[1],!0,!1));var Se=t.hoverData.last,ve=t.hoverData.down,ye=[X[0]-Ce[2],X[1]-Ce[3]],Ge=t.dragData.possibleDragElements,Re;if(we){var rt=ie[0]-we[0],nt=rt*rt,Qe=ie[1]-we[1],Ot=Qe*Qe,ut=nt+Ot;t.hoverData.isOverThresholdDrag=Re=ut>=t.desktopTapThreshold2}var ht=a(T);Re&&(t.hoverData.tapholdCancelled=!0);var Wt=function(){var q=t.hoverData.dragDelta=t.hoverData.dragDelta||[];q.length===0?(q.push(ye[0]),q.push(ye[1])):(q[0]+=ye[0],q[1]+=ye[1])};Q=!0,n(ge,["mousemove","vmousemove","tapdrag"],T,{x:X[0],y:X[1]});var _t=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||G.emit({originalEvent:T,type:"boxstart",position:{x:X[0],y:X[1]}}),Ce[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Re){var Lt={originalEvent:T,type:"cxtdrag",position:{x:X[0],y:X[1]}};ve?ve.emit(Lt):G.emit(Lt),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||ge!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:X[0],y:X[1]}}),t.hoverData.cxtOver=ge,ge&&ge.emit({originalEvent:T,type:"cxtdragover",position:{x:X[0],y:X[1]}}))}}else if(t.hoverData.dragging){if(Q=!0,G.panningEnabled()&&G.userPanningEnabled()){var tr;if(t.hoverData.justStartedPan){var dr=t.hoverData.mdownPos;tr={x:(X[0]-dr[0])*U,y:(X[1]-dr[1])*U},t.hoverData.justStartedPan=!1}else tr={x:ye[0]*U,y:ye[1]*U};G.panBy(tr),G.emit("dragpan"),t.hoverData.dragged=!0}X=t.projectIntoViewport(T.clientX,T.clientY)}else if(Ce[4]==1&&(ve==null||ve.pannable())){if(Re){if(!t.hoverData.dragging&&G.boxSelectionEnabled()&&(ht||!G.panningEnabled()||!G.userPanningEnabled()))_t();else if(!t.hoverData.selecting&&G.panningEnabled()&&G.userPanningEnabled()){var Kt=i(ve,t.hoverData.downs);Kt&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Ce[4]=0,t.data.bgActivePosistion=ma(ae),t.redrawHint("select",!0),t.redraw())}ve&&ve.pannable()&&ve.active()&&ve.unactivate()}}else{if(ve&&ve.pannable()&&ve.active()&&ve.unactivate(),(!ve||!ve.grabbed())&&ge!=Se&&(Se&&n(Se,["mouseout","tapdragout"],T,{x:X[0],y:X[1]}),ge&&n(ge,["mouseover","tapdragover"],T,{x:X[0],y:X[1]}),t.hoverData.last=ge),ve)if(Re){if(G.boxSelectionEnabled()&&ht)ve&&ve.grabbed()&&(y(Ge),ve.emit("freeon"),Ge.emit("free"),t.dragData.didDrag&&(ve.emit("dragfreeon"),Ge.emit("dragfree"))),_t();else if(ve&&ve.grabbed()&&t.nodeIsDraggable(ve)){var Je=!t.dragData.didDrag;Je&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||h(Ge,{inDragLayer:!0});var at={x:0,y:0};if(le(ye[0])&&le(ye[1])&&(at.x+=ye[0],at.y+=ye[1],Je)){var pt=t.hoverData.dragDelta;pt&&le(pt[0])&&le(pt[1])&&(at.x+=pt[0],at.y+=pt[1])}t.hoverData.draggingEles=!0,Ge.silentShift(at).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else Wt();Q=!0}if(Ce[2]=X[0],Ce[3]=X[1],Q)return T.stopPropagation&&T.stopPropagation(),T.preventDefault&&T.preventDefault(),!1}},!1);var N,D,P;t.registerBinding(e,"mouseup",function(T){if(!(t.hoverData.which===1&&T.which!==1&&t.hoverData.capture)){var R=t.hoverData.capture;if(R){t.hoverData.capture=!1;var Q=t.cy,G=t.projectIntoViewport(T.clientX,T.clientY),U=t.selection,ie=t.findNearestElement(G[0],G[1],!0,!1),X=t.dragData.possibleDragElements,ae=t.hoverData.down,we=a(T);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ae&&ae.unactivate(),t.hoverData.which===3){var Ce={originalEvent:T,type:"cxttapend",position:{x:G[0],y:G[1]}};if(ae?ae.emit(Ce):Q.emit(Ce),!t.hoverData.cxtDragged){var ge={originalEvent:T,type:"cxttap",position:{x:G[0],y:G[1]}};ae?ae.emit(ge):Q.emit(ge)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(n(ie,["mouseup","tapend","vmouseup"],T,{x:G[0],y:G[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(n(ae,["click","tap","vclick"],T,{x:G[0],y:G[1]}),D=!1,T.timeStamp-P<=Q.multiClickDebounceTime()?(N&&clearTimeout(N),D=!0,P=null,n(ae,["dblclick","dbltap","vdblclick"],T,{x:G[0],y:G[1]})):(N=setTimeout(function(){D||n(ae,["oneclick","onetap","voneclick"],T,{x:G[0],y:G[1]})},Q.multiClickDebounceTime()),P=T.timeStamp)),ae==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!a(T)&&(Q.$(r).unselect(["tapunselect"]),X.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=X=Q.collection()),ie==ae&&!t.dragData.didDrag&&!t.hoverData.selecting&&ie!=null&&ie._private.selectable&&(t.hoverData.dragging||(Q.selectionType()==="additive"||we?ie.selected()?ie.unselect(["tapunselect"]):ie.select(["tapselect"]):we||(Q.$(r).unmerge(ie).unselect(["tapunselect"]),ie.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Se=Q.collection(t.getAllInBox(U[0],U[1],U[2],U[3]));t.redrawHint("select",!0),Se.length>0&&t.redrawHint("eles",!0),Q.emit({type:"boxend",originalEvent:T,position:{x:G[0],y:G[1]}});var ve=function(Re){return Re.selectable()&&!Re.selected()};Q.selectionType()==="additive"||we||Q.$(r).unmerge(Se).unselect(),Se.emit("box").stdFilter(ve).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!U[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var ye=ae&&ae.grabbed();y(X),ye&&(ae.emit("freeon"),X.emit("free"),t.dragData.didDrag&&(ae.emit("dragfreeon"),X.emit("dragfree")))}}U[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var L=function(T){if(!t.scrollingPage){var R=t.cy,Q=R.zoom(),G=R.pan(),U=t.projectIntoViewport(T.clientX,T.clientY),ie=[U[0]*Q+G.x,U[1]*Q+G.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||B()){T.preventDefault();return}if(R.panningEnabled()&&R.userPanningEnabled()&&R.zoomingEnabled()&&R.userZoomingEnabled()){T.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var X;T.deltaY!=null?X=T.deltaY/-250:T.wheelDeltaY!=null?X=T.wheelDeltaY/1e3:X=T.wheelDelta/1e3,X=X*t.wheelSensitivity;var ae=T.deltaMode===1;ae&&(X*=33);var we=R.zoom()*Math.pow(10,X);T.type==="gesturechange"&&(we=t.gestureStartZoom*T.scale),R.zoom({level:we,renderedPosition:{x:ie[0],y:ie[1]}}),R.emit(T.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",L,!0),t.registerBinding(e,"scroll",function(T){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(T){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||T.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(te){t.hasTouchStarted||L(te)},!0),t.registerBinding(t.container,"mouseout",function(T){var R=t.projectIntoViewport(T.clientX,T.clientY);t.cy.emit({originalEvent:T,type:"mouseout",position:{x:R[0],y:R[1]}})},!1),t.registerBinding(t.container,"mouseover",function(T){var R=t.projectIntoViewport(T.clientX,T.clientY);t.cy.emit({originalEvent:T,type:"mouseover",position:{x:R[0],y:R[1]}})},!1);var O,I,_,M,F,V,H,$,z,j,ee,J,Z,re=function(T,R,Q,G){return Math.sqrt((Q-T)*(Q-T)+(G-R)*(G-R))},Y=function(T,R,Q,G){return(Q-T)*(Q-T)+(G-R)*(G-R)},A;t.registerBinding(t.container,"touchstart",A=function(T){if(t.hasTouchStarted=!0,!!S(T)){b(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var R=t.cy,Q=t.touchData.now,G=t.touchData.earlier;if(T.touches[0]){var U=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);Q[0]=U[0],Q[1]=U[1]}if(T.touches[1]){var U=t.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);Q[2]=U[0],Q[3]=U[1]}if(T.touches[2]){var U=t.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);Q[4]=U[0],Q[5]=U[1]}if(T.touches[1]){t.touchData.singleTouchMoved=!0,y(t.dragData.touchDragEles);var ie=t.findContainerClientCoords();z=ie[0],j=ie[1],ee=ie[2],J=ie[3],O=T.touches[0].clientX-z,I=T.touches[0].clientY-j,_=T.touches[1].clientX-z,M=T.touches[1].clientY-j,Z=0<=O&&O<=ee&&0<=_&&_<=ee&&0<=I&&I<=J&&0<=M&&M<=J;var X=R.pan(),ae=R.zoom();F=re(O,I,_,M),V=Y(O,I,_,M),H=[(O+_)/2,(I+M)/2],$=[(H[0]-X.x)/ae,(H[1]-X.y)/ae];var we=200,Ce=we*we;if(V<Ce&&!T.touches[2]){var ge=t.findNearestElement(Q[0],Q[1],!0,!0),Se=t.findNearestElement(Q[2],Q[3],!0,!0);ge&&ge.isNode()?(ge.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:Q[0],y:Q[1]}}),t.touchData.start=ge):Se&&Se.isNode()?(Se.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:Q[0],y:Q[1]}}),t.touchData.start=Se):R.emit({originalEvent:T,type:"cxttapstart",position:{x:Q[0],y:Q[1]}}),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(T.touches[2])R.boxSelectionEnabled()&&T.preventDefault();else if(!T.touches[1]){if(T.touches[0]){var ve=t.findNearestElements(Q[0],Q[1],!0,!0),ye=ve[0];if(ye!=null&&(ye.activate(),t.touchData.start=ye,t.touchData.starts=ve,t.nodeIsGrabbable(ye))){var Ge=t.dragData.touchDragEles=R.collection(),Re=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),ye.selected()?(Re=R.$(function(ut){return ut.selected()&&t.nodeIsGrabbable(ut)}),h(Re,{addToList:Ge})):g(ye,{addToList:Ge}),d(ye);var rt=function(ht){return{originalEvent:T,type:ht,position:{x:Q[0],y:Q[1]}}};ye.emit(rt("grabon")),Re?Re.forEach(function(ut){ut.emit(rt("grab"))}):ye.emit(rt("grab"))}n(ye,["touchstart","tapstart","vmousedown"],T,{x:Q[0],y:Q[1]}),ye==null&&(t.data.bgActivePosistion={x:U[0],y:U[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&n(t.touchData.start,["taphold"],T,{x:Q[0],y:Q[1]})},t.tapholdDuration)}}if(T.touches.length>=1){for(var nt=t.touchData.startPosition=[null,null,null,null,null,null],Qe=0;Qe<Q.length;Qe++)nt[Qe]=G[Qe]=Q[Qe];var Ot=T.touches[0];t.touchData.startGPosition=[Ot.clientX,Ot.clientY]}}},!1);var K;t.registerBinding(e,"touchmove",K=function(T){var R=t.touchData.capture;if(!(!R&&!S(T))){var Q=t.selection,G=t.cy,U=t.touchData.now,ie=t.touchData.earlier,X=G.zoom();if(T.touches[0]){var ae=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);U[0]=ae[0],U[1]=ae[1]}if(T.touches[1]){var ae=t.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);U[2]=ae[0],U[3]=ae[1]}if(T.touches[2]){var ae=t.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);U[4]=ae[0],U[5]=ae[1]}var we=t.touchData.startGPosition,Ce;if(R&&T.touches[0]&&we){for(var ge=[],Se=0;Se<U.length;Se++)ge[Se]=U[Se]-ie[Se];var ve=T.touches[0].clientX-we[0],ye=ve*ve,Ge=T.touches[0].clientY-we[1],Re=Ge*Ge,rt=ye+Re;Ce=rt>=t.touchTapThreshold2}if(R&&t.touchData.cxt){T.preventDefault();var nt=T.touches[0].clientX-z,Qe=T.touches[0].clientY-j,Ot=T.touches[1].clientX-z,ut=T.touches[1].clientY-j,ht=Y(nt,Qe,Ot,ut),Wt=ht/V,_t=150,Lt=_t*_t,tr=1.5,dr=tr*tr;if(Wt>=dr||ht>=Lt){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Kt={originalEvent:T,type:"cxttapend",position:{x:U[0],y:U[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(Kt),t.touchData.start=null):G.emit(Kt)}}if(R&&t.touchData.cxt){var Kt={originalEvent:T,type:"cxtdrag",position:{x:U[0],y:U[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Kt):G.emit(Kt),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Je=t.findNearestElement(U[0],U[1],!0,!0);(!t.touchData.cxtOver||Je!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:U[0],y:U[1]}}),t.touchData.cxtOver=Je,Je&&Je.emit({originalEvent:T,type:"cxtdragover",position:{x:U[0],y:U[1]}}))}else if(R&&T.touches[2]&&G.boxSelectionEnabled())T.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||G.emit({originalEvent:T,type:"boxstart",position:{x:U[0],y:U[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,Q[4]=1,!Q||Q.length===0||Q[0]===void 0?(Q[0]=(U[0]+U[2]+U[4])/3,Q[1]=(U[1]+U[3]+U[5])/3,Q[2]=(U[0]+U[2]+U[4])/3+1,Q[3]=(U[1]+U[3]+U[5])/3+1):(Q[2]=(U[0]+U[2]+U[4])/3,Q[3]=(U[1]+U[3]+U[5])/3),t.redrawHint("select",!0),t.redraw();else if(R&&T.touches[1]&&!t.touchData.didSelect&&G.zoomingEnabled()&&G.panningEnabled()&&G.userZoomingEnabled()&&G.userPanningEnabled()){T.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var at=t.dragData.touchDragEles;if(at){t.redrawHint("drag",!0);for(var pt=0;pt<at.length;pt++){var mn=at[pt]._private;mn.grabbed=!1,mn.rscratch.inDragLayer=!1}}var q=t.touchData.start,nt=T.touches[0].clientX-z,Qe=T.touches[0].clientY-j,Ot=T.touches[1].clientX-z,ut=T.touches[1].clientY-j,ce=re(nt,Qe,Ot,ut),Oe=ce/F;if(Z){var ze=nt-O,Tr=Qe-I,yn=Ot-_,za=ut-M,qr=(ze+yn)/2,rr=(Tr+za)/2,bn=G.zoom(),Vc=bn*Oe,Ss=G.pan(),hg=$[0]*bn+Ss.x,pg=$[1]*bn+Ss.y,YP={x:-Vc/bn*(hg-Ss.x-qr)+hg,y:-Vc/bn*(pg-Ss.y-rr)+pg};if(q&&q.active()){var at=t.dragData.touchDragEles;y(at),t.redrawHint("drag",!0),t.redrawHint("eles",!0),q.unactivate().emit("freeon"),at.emit("free"),t.dragData.didDrag&&(q.emit("dragfreeon"),at.emit("dragfree"))}G.viewport({zoom:Vc,pan:YP,cancelOnFailedZoom:!0}),G.emit("pinchzoom"),F=ce,O=nt,I=Qe,_=Ot,M=ut,t.pinching=!0}if(T.touches[0]){var ae=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);U[0]=ae[0],U[1]=ae[1]}if(T.touches[1]){var ae=t.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);U[2]=ae[0],U[3]=ae[1]}if(T.touches[2]){var ae=t.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);U[4]=ae[0],U[5]=ae[1]}}else if(T.touches[0]&&!t.touchData.didSelect){var fr=t.touchData.start,Rc=t.touchData.last,Je;if(!t.hoverData.draggingEles&&!t.swipePanning&&(Je=t.findNearestElement(U[0],U[1],!0,!0)),R&&fr!=null&&T.preventDefault(),R&&fr!=null&&t.nodeIsDraggable(fr))if(Ce){var at=t.dragData.touchDragEles,vg=!t.dragData.didDrag;vg&&h(at,{inDragLayer:!0}),t.dragData.didDrag=!0;var Gi={x:0,y:0};if(le(ge[0])&&le(ge[1])&&(Gi.x+=ge[0],Gi.y+=ge[1],vg)){t.redrawHint("eles",!0);var hr=t.touchData.dragDelta;hr&&le(hr[0])&&le(hr[1])&&(Gi.x+=hr[0],Gi.y+=hr[1])}t.hoverData.draggingEles=!0,at.silentShift(Gi).emit("position drag"),t.redrawHint("drag",!0),t.touchData.startPosition[0]==ie[0]&&t.touchData.startPosition[1]==ie[1]&&t.redrawHint("eles",!0),t.redraw()}else{var hr=t.touchData.dragDelta=t.touchData.dragDelta||[];hr.length===0?(hr.push(ge[0]),hr.push(ge[1])):(hr[0]+=ge[0],hr[1]+=ge[1])}if(n(fr||Je,["touchmove","tapdrag","vmousemove"],T,{x:U[0],y:U[1]}),(!fr||!fr.grabbed())&&Je!=Rc&&(Rc&&Rc.emit({originalEvent:T,type:"tapdragout",position:{x:U[0],y:U[1]}}),Je&&Je.emit({originalEvent:T,type:"tapdragover",position:{x:U[0],y:U[1]}})),t.touchData.last=Je,R)for(var pt=0;pt<U.length;pt++)U[pt]&&t.touchData.startPosition[pt]&&Ce&&(t.touchData.singleTouchMoved=!0);if(R&&(fr==null||fr.pannable())&&G.panningEnabled()&&G.userPanningEnabled()){var XP=i(fr,t.touchData.starts);XP&&(T.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=ma(t.touchData.startPosition)),t.swipePanning?(G.panBy({x:ge[0]*X,y:ge[1]*X}),G.emit("dragpan")):Ce&&(t.swipePanning=!0,G.panBy({x:ve*X,y:Ge*X}),G.emit("dragpan"),fr&&(fr.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ae=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);U[0]=ae[0],U[1]=ae[1]}}for(var Se=0;Se<U.length;Se++)ie[Se]=U[Se];R&&T.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var W;t.registerBinding(e,"touchcancel",W=function(T){var R=t.touchData.start;t.touchData.capture=!1,R&&R.unactivate()});var oe,he,ne,se;if(t.registerBinding(e,"touchend",oe=function(T){var R=t.touchData.start,Q=t.touchData.capture;if(Q)T.touches.length===0&&(t.touchData.capture=!1),T.preventDefault();else return;var G=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var U=t.cy,ie=U.zoom(),X=t.touchData.now,ae=t.touchData.earlier;if(T.touches[0]){var we=t.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);X[0]=we[0],X[1]=we[1]}if(T.touches[1]){var we=t.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);X[2]=we[0],X[3]=we[1]}if(T.touches[2]){var we=t.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);X[4]=we[0],X[5]=we[1]}R&&R.unactivate();var Ce;if(t.touchData.cxt){if(Ce={originalEvent:T,type:"cxttapend",position:{x:X[0],y:X[1]}},R?R.emit(Ce):U.emit(Ce),!t.touchData.cxtDragged){var ge={originalEvent:T,type:"cxttap",position:{x:X[0],y:X[1]}};R?R.emit(ge):U.emit(ge)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!T.touches[2]&&U.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Se=U.collection(t.getAllInBox(G[0],G[1],G[2],G[3]));G[0]=void 0,G[1]=void 0,G[2]=void 0,G[3]=void 0,G[4]=0,t.redrawHint("select",!0),U.emit({type:"boxend",originalEvent:T,position:{x:X[0],y:X[1]}});var ve=function(Lt){return Lt.selectable()&&!Lt.selected()};Se.emit("box").stdFilter(ve).select().emit("boxselect"),Se.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(R!=null&&R.unactivate(),T.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!T.touches[1]){if(!T.touches[0]){if(!T.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ye=t.dragData.touchDragEles;if(R!=null){var Ge=R._private.grabbed;y(ye),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ge&&(R.emit("freeon"),ye.emit("free"),t.dragData.didDrag&&(R.emit("dragfreeon"),ye.emit("dragfree"))),n(R,["touchend","tapend","vmouseup","tapdragout"],T,{x:X[0],y:X[1]}),R.unactivate(),t.touchData.start=null}else{var Re=t.findNearestElement(X[0],X[1],!0,!0);n(Re,["touchend","tapend","vmouseup","tapdragout"],T,{x:X[0],y:X[1]})}var rt=t.touchData.startPosition[0]-X[0],nt=rt*rt,Qe=t.touchData.startPosition[1]-X[1],Ot=Qe*Qe,ut=nt+Ot,ht=ut*ie*ie;t.touchData.singleTouchMoved||(R||U.$(":selected").unselect(["tapunselect"]),n(R,["tap","vclick"],T,{x:X[0],y:X[1]}),he=!1,T.timeStamp-se<=U.multiClickDebounceTime()?(ne&&clearTimeout(ne),he=!0,se=null,n(R,["dbltap","vdblclick"],T,{x:X[0],y:X[1]})):(ne=setTimeout(function(){he||n(R,["onetap","voneclick"],T,{x:X[0],y:X[1]})},U.multiClickDebounceTime()),se=T.timeStamp)),R!=null&&!t.dragData.didDrag&&R._private.selectable&&ht<t.touchTapThreshold2&&!t.pinching&&(U.selectionType()==="single"?(U.$(r).unmerge(R).unselect(["tapunselect"]),R.select(["tapselect"])):R.selected()?R.unselect(["tapunselect"]):R.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Wt=0;Wt<X.length;Wt++)ae[Wt]=X[Wt];t.dragData.didDrag=!1,T.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),T.touches.length<2&&(T.touches.length===1&&(t.touchData.startGPosition=[T.touches[0].clientX,T.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var ue=[],pe=function(T){return{clientX:T.clientX,clientY:T.clientY,force:1,identifier:T.pointerId,pageX:T.pageX,pageY:T.pageY,radiusX:T.width/2,radiusY:T.height/2,screenX:T.screenX,screenY:T.screenY,target:T.target}},de=function(T){return{event:T,touch:pe(T)}},me=function(T){ue.push(de(T))},Ne=function(T){for(var R=0;R<ue.length;R++){var Q=ue[R];if(Q.event.pointerId===T.pointerId){ue.splice(R,1);return}}},De=function(T){var R=ue.filter(function(Q){return Q.event.pointerId===T.pointerId})[0];R.event=T,R.touch=pe(T)},Ee=function(T){T.touches=ue.map(function(R){return R.touch})},Pe=function(T){return T.pointerType==="mouse"||T.pointerType===4};t.registerBinding(t.container,"pointerdown",function(te){Pe(te)||(te.preventDefault(),me(te),Ee(te),A(te))}),t.registerBinding(t.container,"pointerup",function(te){Pe(te)||(Ne(te),Ee(te),oe(te))}),t.registerBinding(t.container,"pointercancel",function(te){Pe(te)||(Ne(te),Ee(te),W(te))}),t.registerBinding(t.container,"pointermove",function(te){Pe(te)||(te.preventDefault(),De(te),Ee(te),K(te))})}};var Hr={};Hr.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(n,a,i,o,l,u){this.renderer.nodeShapeImpl("polygon",n,a,i,o,l,this.points)},intersectLine:function(n,a,i,o,l,u,c,d){return Bi(l,u,this.points,n,a,i/2,o/2,c)},checkPoint:function(n,a,i,o,l,u,c,d){return Rr(n,a,this.points,u,c,o,l,[0,-1],i)}}},Hr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i)},intersectLine:function(e,r,n,a,i,o,l,u){return t5(i,o,e,r,n/2+l,a/2+l)},checkPoint:function(e,r,n,a,i,o,l,u){return Vn(e,r,a,i,o,l,n)}}},Hr.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(n,a,i,o,l,u,c){if(u[c]!==void 0&&u[c+"-cx"]===n&&u[c+"-cy"]===a)return u[c];u[c]=new Array(e.length/2),u[c+"-cx"]=n,u[c+"-cy"]=a;var d=i/2,f=o/2;l=l==="auto"?Xh(i,o):l;for(var p=new Array(e.length/2),v=0;v<e.length/2;v++)p[v]={x:n+d*e[v*2],y:a+f*e[v*2+1]};var h,g,y,m,b=p.length;for(g=p[b-1],h=0;h<b;h++)y=p[h%b],m=p[(h+1)%b],u[c][h]=Nc(g,y,m,l),g=y,y=m;return u[c]},draw:function(n,a,i,o,l,u,c){this.renderer.nodeShapeImpl("round-polygon",n,a,i,o,l,this.points,this.getOrCreateCorners(a,i,o,l,u,c,"drawCorners"))},intersectLine:function(n,a,i,o,l,u,c,d,f){return r5(l,u,this.points,n,a,i,o,c,this.getOrCreateCorners(n,a,i,o,d,f,"corners"))},checkPoint:function(n,a,i,o,l,u,c,d,f){return e5(n,a,this.points,u,c,o,l,this.getOrCreateCorners(u,c,o,l,d,f,"corners"))}}},Hr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Mt(4,0),draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i,this.points,o)},intersectLine:function(e,r,n,a,i,o,l,u){return jh(i,o,e,r,n,a,l,u)},checkPoint:function(e,r,n,a,i,o,l,u){var c=a/2,d=i/2;u=u==="auto"?Rn(a,i):u,u=Math.min(c,d,u);var f=u*2;return!!(Rr(e,r,this.points,o,l,a,i-f,[0,-1],n)||Rr(e,r,this.points,o,l,a-f,i,[0,-1],n)||Vn(e,r,f,f,o-c+u,l-d+u,n)||Vn(e,r,f,f,o+c-u,l-d+u,n)||Vn(e,r,f,f,o+c-u,l+d-u,n)||Vn(e,r,f,f,o-c+u,l+d-u,n))}}},Hr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Jl(),points:Mt(4,0),draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i,null,o)},generateCutTrianglePts:function(e,r,n,a,i){var o=i==="auto"?this.cornerLength:i,l=r/2,u=e/2,c=n-u,d=n+u,f=a-l,p=a+l;return{topLeft:[c,f+o,c+o,f,c+o,f+o],topRight:[d-o,f,d,f+o,d-o,f+o],bottomRight:[d,p-o,d-o,p,d-o,p-o],bottomLeft:[c+o,p,c,p-o,c+o,p-o]}},intersectLine:function(e,r,n,a,i,o,l,u){var c=this.generateCutTrianglePts(n+2*l,a+2*l,e,r,u),d=[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]);return Bi(i,o,d,e,r)},checkPoint:function(e,r,n,a,i,o,l,u){var c=u==="auto"?this.cornerLength:u;if(Rr(e,r,this.points,o,l,a,i-2*c,[0,-1],n)||Rr(e,r,this.points,o,l,a-2*c,i,[0,-1],n))return!0;var d=this.generateCutTrianglePts(a,i,o,l);return Ht(e,r,d.topLeft)||Ht(e,r,d.topRight)||Ht(e,r,d.bottomRight)||Ht(e,r,d.bottomLeft)}}},Hr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Mt(4,0),draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i)},intersectLine:function(e,r,n,a,i,o,l,u){var c=.15,d=.5,f=.85,p=this.generateBarrelBezierPts(n+2*l,a+2*l,e,r),v=function(y){var m=ya({x:y[0],y:y[1]},{x:y[2],y:y[3]},{x:y[4],y:y[5]},c),b=ya({x:y[0],y:y[1]},{x:y[2],y:y[3]},{x:y[4],y:y[5]},d),w=ya({x:y[0],y:y[1]},{x:y[2],y:y[3]},{x:y[4],y:y[5]},f);return[y[0],y[1],m.x,m.y,b.x,b.y,w.x,w.y,y[4],y[5]]},h=[].concat(v(p.topLeft),v(p.topRight),v(p.bottomRight),v(p.bottomLeft));return Bi(i,o,h,e,r)},generateBarrelBezierPts:function(e,r,n,a){var i=r/2,o=e/2,l=n-o,u=n+o,c=a-i,d=a+i,f=ec(e,r),p=f.heightOffset,v=f.widthOffset,h=f.ctrlPtOffsetPct*e,g={topLeft:[l,c+p,l+h,c,l+v,c],topRight:[u-v,c,u-h,c,u,c+p],bottomRight:[u,d-p,u-h,d,u-v,d],bottomLeft:[l+v,d,l+h,d,l,d-p]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,r,n,a,i,o,l,u){var c=ec(a,i),d=c.heightOffset,f=c.widthOffset;if(Rr(e,r,this.points,o,l,a,i-2*d,[0,-1],n)||Rr(e,r,this.points,o,l,a-2*f,i,[0,-1],n))return!0;for(var p=this.generateBarrelBezierPts(a,i,o,l),v=function(B,S,N){var D=N[4],P=N[2],L=N[0],O=N[5],I=N[1],_=Math.min(D,L),M=Math.max(D,L),F=Math.min(O,I),V=Math.max(O,I);if(_<=B&&B<=M&&F<=S&&S<=V){var H=n5(D,P,L),$=XB(H[0],H[1],H[2],B),z=$.filter(function(j){return 0<=j&&j<=1});if(z.length>0)return z[0]}return null},h=Object.keys(p),g=0;g<h.length;g++){var y=h[g],m=p[y],b=v(e,r,m);if(b!=null){var w=m[5],C=m[3],x=m[1],E=ft(w,C,x,b);if(m.isTop&&E<=r||m.isBottom&&r<=E)return!0}}return!1}}},Hr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Mt(4,0),draw:function(e,r,n,a,i,o){this.renderer.nodeShapeImpl(this.name,e,r,n,a,i,this.points,o)},intersectLine:function(e,r,n,a,i,o,l,u){var c=e-(n/2+l),d=r-(a/2+l),f=d,p=e+(n/2+l),v=ln(i,o,e,r,c,d,p,f,!1);return v.length>0?v:jh(i,o,e,r,n,a,l,u)},checkPoint:function(e,r,n,a,i,o,l,u){u=u==="auto"?Rn(a,i):u;var c=2*u;if(Rr(e,r,this.points,o,l,a,i-c,[0,-1],n)||Rr(e,r,this.points,o,l,a-c,i,[0,-1],n))return!0;var d=a/2+2*n,f=i/2+2*n,p=[o-d,l-f,o-d,l,o+d,l,o+d,l-f];return!!(Ht(e,r,p)||Vn(e,r,c,c,o+a/2-u,l+i/2-u,n)||Vn(e,r,c,c,o-a/2+u,l+i/2-u,n))}}},Hr.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Mt(3,0)),this.generateRoundPolygon("round-triangle",Mt(3,0)),this.generatePolygon("rectangle",Mt(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",Mt(5,0)),this.generateRoundPolygon("round-pentagon",Mt(5,0)),this.generatePolygon("hexagon",Mt(6,0)),this.generateRoundPolygon("round-hexagon",Mt(6,0)),this.generatePolygon("heptagon",Mt(7,0)),this.generateRoundPolygon("round-heptagon",Mt(7,0)),this.generatePolygon("octagon",Mt(8,0)),this.generateRoundPolygon("round-octagon",Mt(8,0));var n=new Array(20);{var a=Ql(5,0),i=Ql(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var l=0;l<i.length/2;l++)i[l*2]*=o,i[l*2+1]*=o;for(var l=0;l<20/4;l++)n[l*4]=a[l*2],n[l*4+1]=a[l*2+1],n[l*4+2]=i[l*2],n[l*4+3]=i[l*2+1]}n=Yh(n),this.generatePolygon("star",n),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}t.makePolygon=function(c){var d=c.join("$"),f="polygon-"+d,p;return(p=this[f])?p:e.generatePolygon(f,c)}};var Hi={};Hi.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},Hi.redraw=function(t){t=t||zh();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t},Hi.beforeRender=function(t,e){if(!this.destroyed){e==null&&Xe("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(n,a){return a.priority-n.priority})}};var Hv=function(e,r,n){for(var a=e.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(r,n)};Hi.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function n(a){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){Hv(t,!0,a);var i=Vr();t.render(t.renderOptions);var o=t.lastDrawTime=Vr();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var l=o-i;t.redrawTotalTime+=l,t.lastRedrawTime=l,t.averageRedrawTime=t.averageRedrawTime/2+l/2,t.requestedFrame=!1}else Hv(t,!1,a);t.skipFrame=!1,Lo(n)}};Lo(r)}};var VD=function(e){this.init(e)},Kv=VD,Aa=Kv.prototype;Aa.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Aa.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),n=e.cy.window();if(n){var a=n.document,i=a.head,o="__________cytoscape_stylesheet",l="__________cytoscape_container",u=a.getElementById(o)!=null;if(r.className.indexOf(l)<0&&(r.className=(r.className||"")+" "+l),!u){var c=a.createElement("style");c.id=o,c.textContent="."+l+" { position: relative; }",i.insertBefore(c,i.children[0])}var d=n.getComputedStyle(r),f=d.getPropertyValue("position");f==="static"&&Ae("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=le(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()},Aa.notify=function(t,e){var r=this,n=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&n.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},Aa.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],n=r,a=n.target;(a.off||a.removeEventListener).apply(a,n.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}},Aa.isHeadless=function(){return!1},[xc,$v,zv,Ia,Hr,Hi].forEach(function(t){xe(Aa,t)});var Pc=1e3/60,qv={setupDequeueing:function(e){return function(){var n=this,a=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var i=_o(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},e.deqRedrawThreshold),o=function(c,d){var f=Vr(),p=a.averageRedrawTime,v=a.lastRedrawTime,h=[],g=a.cy.extent(),y=a.getPixelRatio();for(c||a.flushRenderedStyleQueue();;){var m=Vr(),b=m-f,w=m-d;if(v<Pc){var C=Pc-(c?p:0);if(w>=e.deqFastCost*C)break}else if(c){if(b>=e.deqCost*v||b>=e.deqAvgCost*p)break}else if(w>=e.deqNoDrawCost*Pc)break;var x=e.deq(n,y,g);if(x.length>0)for(var E=0;E<x.length;E++)h.push(x[E]);else break}h.length>0&&(e.onDeqd(n,h),!c&&e.shouldRedraw(n,h,y,g)&&i())},l=e.priority||Gl;a.beforeRender(o,l(n))}}}},RD=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Mo;Rl(this,t),this.idsByKey=new wr,this.keyForId=new wr,this.cachesByLvl=new wr,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return $l(t,[{key:"getIdsFor",value:function(r){r==null&&Xe("Can not get id list for null key");var n=this.idsByKey,a=this.idsByKey.get(r);return a||(a=new ga,n.set(r,a)),a}},{key:"addIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).add(n)}},{key:"deleteIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).delete(n)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var n=r.id(),a=this.keyForId.get(n),i=this.getKey(r);this.deleteIdForKey(a,n),this.addIdForKey(i,n),this.keyForId.set(n,i)}},{key:"deleteKeyMappingFor",value:function(r){var n=r.id(),a=this.keyForId.get(n);this.deleteIdForKey(a,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(r){var n=r.id(),a=this.keyForId.get(n),i=this.getKey(r);return a!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var n=this.cachesByLvl,a=this.lvls,i=n.get(r);return i||(i=new wr,n.set(r,i),a.push(r)),i}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var a=this.getKey(r),i=this.getCache(a,n);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,n){var a=this.keyForId.get(r.id()),i=this.getCache(a,n);return i}},{key:"hasCache",value:function(r,n){return this.getCachesAt(n).has(r)}},{key:"has",value:function(r,n){var a=this.getKey(r);return this.hasCache(a,n)}},{key:"setCache",value:function(r,n,a){a.key=r,this.getCachesAt(n).set(r,a)}},{key:"set",value:function(r,n,a){var i=this.getKey(r);this.setCache(i,n,a),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,n){this.getCachesAt(n).delete(r)}},{key:"delete",value:function(r,n){var a=this.getKey(r);this.deleteCache(a,n)}},{key:"invalidateKey",value:function(r){var n=this;this.lvls.forEach(function(a){return n.deleteCache(r,a)})}},{key:"invalidate",value:function(r){var n=r.id(),a=this.keyForId.get(n);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(a),i||this.getNumberOfIdsForKey(a)===0}}]),t}(),Uv=25,ks=50,xs=-4,Oc=3,$D=7.99,zD=8,HD=1024,KD=1024,qD=1024,UD=.2,GD=.8,WD=10,jD=.15,YD=.1,XD=.9,ZD=.9,QD=100,JD=1,Va={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},eP=wt({getKey:null,doesEleInvalidateKey:Mo,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ah,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Ki=function(e,r){var n=this;n.renderer=e,n.onDequeues=[];var a=eP(r);xe(n,a),n.lookup=new RD(a.getKey,a.doesEleInvalidateKey),n.setupDequeueing()},ct=Ki.prototype;ct.reasons=Va,ct.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]},ct.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=r[t]=r[t]||[];return n},ct.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Ei(function(r,n){return n.reqs-r.reqs});return e},ct.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e},ct.getElement=function(t,e,r,n,a){var i=this,o=this.renderer,l=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(n==null&&(n=Math.ceil(Yl(l*r))),n<xs)n=xs;else if(l>=$D||n>Oc)return null;var c=Math.pow(2,n),d=e.h*c,f=e.w*c,p=o.eleTextBiggerThanMin(t,c);if(!this.isVisible(t,p))return null;var v=u.get(t,n);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var h;if(d<=Uv?h=Uv:d<=ks?h=ks:h=Math.ceil(d/ks)*ks,d>qD||f>KD)return null;var g=i.getTextureQueue(h),y=g[g.length-2],m=function(){return i.recycleTexture(h,f)||i.addTexture(h,f)};y||(y=g[g.length-1]),y||(y=m()),y.width-y.usedWidth<f&&(y=m());for(var b=function(_){return _&&_.scaledLabelShown===p},w=a&&a===Va.dequeue,C=a&&a===Va.highQuality,x=a&&a===Va.downscale,E,k=n+1;k<=Oc;k++){var B=u.get(t,k);if(B){E=B;break}}var S=E&&E.level===n+1?E:null,N=function(){y.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,y.usedWidth,0,f,d)};if(y.context.setTransform(1,0,0,1,0,0),y.context.clearRect(y.usedWidth,0,f,h),b(S))N();else if(b(E))if(C){for(var D=E.level;D>n;D--)S=i.getElement(t,e,r,D,Va.downscale);N()}else return i.queueElement(t,E.level-1),E;else{var P;if(!w&&!C&&!x)for(var L=n-1;L>=xs;L--){var O=u.get(t,L);if(O){P=O;break}}if(b(P))return i.queueElement(t,n),P;y.context.translate(y.usedWidth,0),y.context.scale(c,c),this.drawElement(y.context,t,e,p,!1),y.context.scale(1/c,1/c),y.context.translate(-y.usedWidth,0)}return v={x:y.usedWidth,texture:y,level:n,scale:c,width:f,height:d,scaledLabelShown:p},y.usedWidth+=Math.ceil(f+zD),y.eleCaches.push(v),u.set(t,n,v),i.checkTextureFullness(y),v},ct.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])},ct.invalidateElement=function(t){var e=this,r=e.lookup,n=[],a=r.isInvalid(t);if(a){for(var i=xs;i<=Oc;i++){var o=r.getForCachedKey(t,i);o&&n.push(o)}var l=r.invalidate(t);if(l)for(var u=0;u<n.length;u++){var c=n[u],d=c.texture;d.invalidatedWidth+=c.width,c.invalidated=!0,e.checkTextureUtility(d)}e.removeFromQueue(t)}},ct.checkTextureUtility=function(t){t.invalidatedWidth>=UD*t.width&&this.retireTexture(t)},ct.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>GD&&t.fullnessChecks>=WD?on(r,t):t.fullnessChecks++},ct.retireTexture=function(t){var e=this,r=t.height,n=e.getTextureQueue(r),a=this.lookup;on(n,t),t.retired=!0;for(var i=t.eleCaches,o=0;o<i.length;o++){var l=i[o];a.deleteCache(l.key,l.level)}Wl(i);var u=e.getRetiredTextureQueue(r);u.push(t)},ct.addTexture=function(t,e){var r=this,n=r.getTextureQueue(t),a={};return n.push(a),a.eleCaches=[],a.height=t,a.width=Math.max(HD,e),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=r.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a},ct.recycleTexture=function(t,e){for(var r=this,n=r.getTextureQueue(t),a=r.getRetiredTextureQueue(t),i=0;i<a.length;i++){var o=a[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Wl(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),on(a,o),n.push(o),o}},ct.queueElement=function(t,e){var r=this,n=r.getElementQueue(),a=r.getElementKeyToQueue(),i=this.getKey(t),o=a[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,n.updateItem(o);else{var l={eles:t.spawn().merge(t),level:e,reqs:1,key:i};n.push(l),a[i]=l}},ct.dequeue=function(t){for(var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),a=[],i=e.lookup,o=0;o<JD&&r.size()>0;o++){var l=r.pop(),u=l.key,c=l.eles[0],d=i.hasCache(c,l.level);if(n[u]=null,d)continue;a.push(l);var f=e.getBoundingBox(c);e.getElement(c,f,t,l.level,Va.dequeue)}return a},ct.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),a=this.getKey(t),i=n[a];i!=null&&(i.eles.length===1?(i.reqs=Ul,r.updateItem(i),r.pop(),n[a]=null):i.eles.unmerge(t))},ct.onDequeue=function(t){this.onDequeues.push(t)},ct.offDequeue=function(t){on(this.onDequeues,t)},ct.setupDequeueing=qv.setupDequeueing({deqRedrawThreshold:QD,deqCost:jD,deqAvgCost:YD,deqNoDrawCost:XD,deqFastCost:ZD,deq:function(e,r,n){return e.dequeue(r,n)},onDeqd:function(e,r){for(var n=0;n<e.onDequeues.length;n++){var a=e.onDequeues[n];a(r)}},shouldRedraw:function(e,r,n,a){for(var i=0;i<r.length;i++)for(var o=r[i].eles,l=0;l<o.length;l++){var u=o[l].boundingBox();if(Xl(u,a))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var tP=1,qi=-4,Es=2,rP=3.99,nP=50,aP=50,iP=.15,oP=.1,sP=.9,lP=.9,cP=1,Gv=250,uP=4e3*4e3,dP=!0,Wv=function(e){var r=this,n=r.renderer=e,a=n.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Vr()-2*Gv,r.skipping=!1,r.eleTxrDeqs=a.collection(),r.scheduleElementRefinement=_o(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},aP),n.beforeRender(function(o,l){l-r.lastInvalidationTime<=Gv?r.skipping=!0:r.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var i=function(l,u){return u.reqs-l.reqs};r.layersQueue=new Ei(i),r.setupDequeueing()},Et=Wv.prototype,jv=0,fP=Math.pow(2,53)-1;Et.makeLayer=function(t,e){var r=Math.pow(2,e),n=Math.ceil(t.w*r),a=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(n,a),o={id:jv=++jv%fP,bb:t,level:e,width:n,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},l=o.context,u=-o.bb.x1,c=-o.bb.y1;return l.scale(r,r),l.translate(u,c),o},Et.getLayers=function(t,e,r){var n=this,a=n.renderer,i=a.cy,o=i.zoom(),l=n.firstGet;if(n.firstGet=!1,r==null){if(r=Math.ceil(Yl(o*e)),r<qi)r=qi;else if(o>=rP||r>Es)return null}n.validateLayersElesOrdering(r,t);var u=n.layersByLevel,c=Math.pow(2,r),d=u[r]=u[r]||[],f,p=n.levelIsComplete(r,t),v,h=function(){var N=function(I){if(n.validateLayersElesOrdering(I,t),n.levelIsComplete(I,t))return v=u[I],!0},D=function(I){if(!v)for(var _=r+I;qi<=_&&_<=Es&&!N(_);_+=I);};D(1),D(-1);for(var P=d.length-1;P>=0;P--){var L=d[P];L.invalid&&on(d,L)}};if(!p)h();else return d;var g=function(){if(!f){f=zt();for(var N=0;N<t.length;N++)Uh(f,t[N].boundingBox())}return f},y=function(N){N=N||{};var D=N.after;g();var P=f.w*c*(f.h*c);if(P>uP)return null;var L=n.makeLayer(f,r);if(D!=null){var O=d.indexOf(D)+1;d.splice(O,0,L)}else(N.insert===void 0||N.insert)&&d.unshift(L);return L};if(n.skipping&&!l)return null;for(var m=null,b=t.length/tP,w=!l,C=0;C<t.length;C++){var x=t[C],E=x._private.rscratch,k=E.imgLayerCaches=E.imgLayerCaches||{},B=k[r];if(B){m=B;continue}if((!m||m.eles.length>=b||!Wh(m.bb,x.boundingBox()))&&(m=y({insert:!0,after:m}),!m))return null;v||w?n.queueLayer(m,x):n.drawEleInLayer(m,x,r,e),m.eles.push(x),k[r]=m}return v||(w?null:d)},Et.getEleLevelForLayerLevel=function(t,e){return t},Et.drawEleInLayer=function(t,e,r,n){var a=this,i=this.renderer,o=t.context,l=e.boundingBox();l.w===0||l.h===0||!e.visible()||(r=a.getEleLevelForLayerLevel(r,n),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,r,dP),i.setImgSmoothing(o,!0))},Et.levelIsComplete=function(t,e){var r=this,n=r.layersByLevel[t];if(!n||n.length===0)return!1;for(var a=0,i=0;i<n.length;i++){var o=n[i];if(o.reqs>0||o.invalid)return!1;a+=o.eles.length}return a===e.length},Et.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var n=0;n<r.length;n++){for(var a=r[n],i=-1,o=0;o<e.length;o++)if(a.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(a);continue}for(var l=i,o=0;o<a.eles.length;o++)if(a.eles[o]!==e[l+o]){this.invalidateLayer(a);break}}},Et.updateElementsInLayers=function(t,e){for(var r=this,n=vi(t[0]),a=0;a<t.length;a++)for(var i=n?null:t[a],o=n?t[a]:t[a].ele,l=o._private.rscratch,u=l.imgLayerCaches=l.imgLayerCaches||{},c=qi;c<=Es;c++){var d=u[c];d&&(i&&r.getEleLevelForLayerLevel(d.level)!==i.level||e(d,o,i))}},Et.haveLayers=function(){for(var t=this,e=!1,r=qi;r<=Es;r++){var n=t.layersByLevel[r];if(n&&n.length>0){e=!0;break}}return e},Et.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Vr(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(n,a,i){e.invalidateLayer(n)}))},Et.invalidateLayer=function(t){if(this.lastInvalidationTime=Vr(),!t.invalid){var e=t.level,r=t.eles,n=this.layersByLevel[e];on(n,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var a=0;a<r.length;a++){var i=r[a]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}},Et.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(n,a,i){var o=n.replacement;if(o||(o=n.replacement=e.makeLayer(n.bb,n.level),o.replaces=n,o.eles=n.eles),!o.reqs)for(var l=0;l<o.eles.length;l++)e.queueLayer(o,o.eles[l])})},Et.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()},Et.queueLayer=function(t,e){var r=this,n=r.layersQueue,a=t.elesQueue,i=a.hasId=a.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;a.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,n.updateItem(t)):(t.reqs=1,n.push(t))}},Et.dequeue=function(t){for(var e=this,r=e.layersQueue,n=[],a=0;a<cP&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,t),a++),n.length===0&&n.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return n},Et.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],n=t.replaces,a=r.indexOf(n);if(!(a<0||n.invalid)){r[a]=t;for(var i=0;i<t.eles.length;i++){var o=t.eles[i]._private,l=o.imgLayerCaches=o.imgLayerCaches||{};l&&(l[t.level]=t)}e.requestRedraw()}},Et.requestRedraw=_o(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100),Et.setupDequeueing=qv.setupDequeueing({deqRedrawThreshold:nP,deqCost:iP,deqAvgCost:oP,deqNoDrawCost:sP,deqFastCost:lP,deq:function(e,r){return e.dequeue(r)},onDeqd:Gl,shouldRedraw:Ah,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Yv={},Xv;function hP(t,e){for(var r=0;r<e.length;r++){var n=e[r];t.lineTo(n.x,n.y)}}function pP(t,e,r){for(var n,a=0;a<e.length;a++){var i=e[a];a===0&&(n=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,n.x,n.y)}function Zv(t,e,r){t.beginPath&&t.beginPath();for(var n=e,a=0;a<n.length;a++){var i=n[a];t.lineTo(i.x,i.y)}var o=r,l=r[0];t.moveTo(l.x,l.y);for(var a=1;a<o.length;a++){var i=o[a];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function vP(t,e,r,n,a){t.beginPath&&t.beginPath(),t.arc(r,n,a,0,Math.PI*2,!1);var i=e,o=i[0];t.moveTo(o.x,o.y);for(var l=0;l<i.length;l++){var u=i[l];t.lineTo(u.x,u.y)}t.closePath&&t.closePath()}function gP(t,e,r,n){t.arc(e,r,n,0,Math.PI*2,!1)}Yv.arrowShapeImpl=function(t){return(Xv||(Xv={polygon:hP,"triangle-backcurve":pP,"triangle-tee":Zv,"circle-triangle":vP,"triangle-cross":Zv,circle:gP}))[t]};var Sr={};Sr.drawElement=function(t,e,r,n,a,i){var o=this;e.isNode()?o.drawNode(t,e,r,n,a,i):o.drawEdge(t,e,r,n,a,i)},Sr.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)},Sr.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)},Sr.drawCachedElementPortion=function(t,e,r,n,a,i,o,l){var u=this,c=r.getBoundingBox(e);if(!(c.w===0||c.h===0)){var d=r.getElement(e,c,n,a,i);if(d!=null){var f=l(u,e);if(f===0)return;var p=o(u,e),v=c.x1,h=c.y1,g=c.w,y=c.h,m,b,w,C,x;if(p!==0){var E=r.getRotationPoint(e);w=E.x,C=E.y,t.translate(w,C),t.rotate(p),x=u.getImgSmoothing(t),x||u.setImgSmoothing(t,!0);var k=r.getRotationOffset(e);m=k.x,b=k.y}else m=v,b=h;var B;f!==1&&(B=t.globalAlpha,t.globalAlpha=B*f),t.drawImage(d.texture.canvas,d.x,0,d.width,d.height,m,b,g,y),f!==1&&(t.globalAlpha=B),p!==0&&(t.rotate(-p),t.translate(-w,-C),x||u.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var mP=function(){return 0},yP=function(e,r){return e.getTextAngle(r,null)},bP=function(e,r){return e.getTextAngle(r,"source")},wP=function(e,r){return e.getTextAngle(r,"target")},CP=function(e,r){return r.effectiveOpacity()},_c=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};Sr.drawCachedElement=function(t,e,r,n,a,i){var o=this,l=o.data,u=l.eleTxrCache,c=l.lblTxrCache,d=l.slbTxrCache,f=l.tlbTxrCache,p=e.boundingBox(),v=i===!0?u.reasons.highQuality:null;if(!(p.w===0||p.h===0||!e.visible())&&(!n||Xl(p,n))){var h=e.isEdge(),g=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,u,r,a,v,mP,CP),(!h||!g)&&o.drawCachedElementPortion(t,e,c,r,a,v,yP,_c),h&&!g&&(o.drawCachedElementPortion(t,e,d,r,a,v,bP,_c),o.drawCachedElementPortion(t,e,f,r,a,v,wP,_c)),o.drawElementOverlay(t,e)}},Sr.drawElements=function(t,e){for(var r=this,n=0;n<e.length;n++){var a=e[n];r.drawElement(t,a)}},Sr.drawCachedElements=function(t,e,r,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];a.drawCachedElement(t,o,r,n)}},Sr.drawCachedNodes=function(t,e,r,n){for(var a=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&a.drawCachedElement(t,o,r,n)}},Sr.drawLayeredElements=function(t,e,r,n){var a=this,i=a.data.lyrTxrCache.getLayers(e,r);if(i)for(var o=0;o<i.length;o++){var l=i[o],u=l.bb;u.w===0||u.h===0||t.drawImage(l.canvas,u.x1,u.y1,u.w,u.h)}else a.drawCachedElements(t,e,r,n)};var Kr={};Kr.drawEdge=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,l=e._private.rscratch;if(!(i&&!e.visible())&&!(l.badLine||l.allpts==null||isNaN(l.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var c=i?e.pstyle("opacity").value:1,d=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,p=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,h=e.pstyle("line-cap").value,g=e.pstyle("line-outline-width").value,y=e.pstyle("line-outline-color").value,m=c*d,b=c*d,w=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;f==="straight-triangle"?(o.eleStrokeStyle(t,e,I),o.drawEdgeTrianglePath(e,t,l.allpts)):(t.lineWidth=v,t.lineCap=h,o.eleStrokeStyle(t,e,I),o.drawEdgePath(e,t,l.allpts,p),t.lineCap="butt")},C=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;if(t.lineWidth=v+g,t.lineCap=h,g>0)o.colorStrokeStyle(t,y[0],y[1],y[2],I);else{t.lineCap="butt";return}f==="straight-triangle"?o.drawEdgeTrianglePath(e,t,l.allpts):(o.drawEdgePath(e,t,l.allpts,p),t.lineCap="butt")},x=function(){a&&o.drawEdgeOverlay(t,e)},E=function(){a&&o.drawEdgeUnderlay(t,e)},k=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;o.drawArrowheads(t,e,I)},B=function(){o.drawElementText(t,e,null,n)};t.lineJoin="round";var S=e.pstyle("ghost").value==="yes";if(S){var N=e.pstyle("ghost-offset-x").pfValue,D=e.pstyle("ghost-offset-y").pfValue,P=e.pstyle("ghost-opacity").value,L=m*P;t.translate(N,D),w(L),k(L),t.translate(-N,-D)}else C();E(),w(),k(),x(),B(),r&&t.translate(u.x1,u.y1)}};var Qv=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n){if(n.visible()){var a=n.pstyle("".concat(e,"-opacity")).value;if(a!==0){var i=this,o=i.usePaths(),l=n._private.rscratch,u=n.pstyle("".concat(e,"-padding")).pfValue,c=2*u,d=n.pstyle("".concat(e,"-color")).value;r.lineWidth=c,l.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,d[0],d[1],d[2],a),i.drawEdgePath(n,r,l.allpts,"solid")}}}};Kr.drawEdgeOverlay=Qv("overlay"),Kr.drawEdgeUnderlay=Qv("underlay"),Kr.drawEdgePath=function(t,e,r,n){var a=t._private.rscratch,i=e,o,l=!1,u=this.usePaths(),c=t.pstyle("line-dash-pattern").pfValue,d=t.pstyle("line-dash-offset").pfValue;if(u){var f=r.join("$"),p=a.pathCacheKey&&a.pathCacheKey===f;p?(o=e=a.pathCache,l=!0):(o=e=new Path2D,a.pathCacheKey=f,a.pathCache=o)}if(i.setLineDash)switch(n){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(c),i.lineDashOffset=d;break;case"solid":i.setLineDash([]);break}if(!l&&!a.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var v=2;v+3<r.length;v+=4)e.quadraticCurveTo(r[v],r[v+1],r[v+2],r[v+3]);break;case"straight":case"haystack":for(var h=2;h+1<r.length;h+=2)e.lineTo(r[h],r[h+1]);break;case"segments":if(a.isRound){var g=mh(a.roundCorners),y;try{for(g.s();!(y=g.n()).done;){var m=y.value;Lv(e,m)}}catch(w){g.e(w)}finally{g.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var b=2;b+1<r.length;b+=2)e.lineTo(r[b],r[b+1]);break}e=i,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])},Kr.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var n=t.pstyle("width").pfValue,a=0;a+1<r.length;a+=2){var i=[r[a+2]-r[a],r[a+3]-r[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),l=[i[1]/o,-i[0]/o],u=[l[0]*n/2,l[1]*n/2];e.beginPath(),e.moveTo(r[a]-u[0],r[a+1]-u[1]),e.lineTo(r[a]+u[0],r[a+1]+u[1]),e.lineTo(r[a+2],r[a+3]),e.closePath(),e.fill()}},Kr.drawArrowheads=function(t,e,r){var n=e._private.rscratch,a=n.edgeType==="haystack";a||this.drawArrowhead(t,e,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,r),a||this.drawArrowhead(t,e,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,r)},Kr.drawArrowhead=function(t,e,r,n,a,i,o){if(!(isNaN(n)||n==null||isNaN(a)||a==null||isNaN(i)||i==null)){var l=this,u=e.pstyle(r+"-arrow-shape").value;if(u!=="none"){var c=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",d=e.pstyle(r+"-arrow-fill").value,f=e.pstyle("width").pfValue,p=e.pstyle(r+"-arrow-width"),v=p.value==="match-line"?f:p.pfValue;p.units==="%"&&(v*=f);var h=e.pstyle("opacity").value;o===void 0&&(o=h);var g=t.globalCompositeOperation;(o!==1||d==="hollow")&&(t.globalCompositeOperation="destination-out",l.colorFillStyle(t,255,255,255,1),l.colorStrokeStyle(t,255,255,255,1),l.drawArrowShape(e,t,c,f,u,v,n,a,i),t.globalCompositeOperation=g);var y=e.pstyle(r+"-arrow-color").value;l.colorFillStyle(t,y[0],y[1],y[2],o),l.colorStrokeStyle(t,y[0],y[1],y[2],o),l.drawArrowShape(e,t,d,f,u,v,n,a,i)}}},Kr.drawArrowShape=function(t,e,r,n,a,i,o,l,u){var c=this,d=this.usePaths()&&a!=="triangle-cross",f=!1,p,v=e,h={x:o,y:l},g=t.pstyle("arrow-scale").value,y=this.getArrowWidth(n,g),m=c.arrowShapes[a];if(d){var b=c.arrowPathCache=c.arrowPathCache||[],w=Mn(a),C=b[w];C!=null?(p=e=C,f=!0):(p=e=new Path2D,b[w]=p)}f||(e.beginPath&&e.beginPath(),d?m.draw(e,1,0,{x:0,y:0},1):m.draw(e,y,u,h,n),e.closePath&&e.closePath()),e=v,d&&(e.translate(o,l),e.rotate(u),e.scale(y,y)),(r==="filled"||r==="both")&&(d?e.fill(p):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(d?y:1),e.lineJoin="miter",d?e.stroke(p):e.stroke()),d&&(e.scale(1/y,1/y),e.rotate(-u),e.translate(-o,-l))};var Lc={};Lc.safeDrawImage=function(t,e,r,n,a,i,o,l,u,c){if(!(a<=0||i<=0||u<=0||c<=0))try{t.drawImage(e,r,n,a,i,o,l,u,c)}catch(d){Ae(d)}},Lc.drawInscribedImage=function(t,e,r,n,a){var i=this,o=r.position(),l=o.x,u=o.y,c=r.cy().style(),d=c.getIndexedStyle.bind(c),f=d(r,"background-fit","value",n),p=d(r,"background-repeat","value",n),v=r.width(),h=r.height(),g=r.padding()*2,y=v+(d(r,"background-width-relative-to","value",n)==="inner"?0:g),m=h+(d(r,"background-height-relative-to","value",n)==="inner"?0:g),b=r._private.rscratch,w=d(r,"background-clip","value",n),C=w==="node",x=d(r,"background-image-opacity","value",n)*a,E=d(r,"background-image-smoothing","value",n),k=r.pstyle("corner-radius").value;k!=="auto"&&(k=r.pstyle("corner-radius").pfValue);var B=e.width||e.cachedW,S=e.height||e.cachedH;(B==null||S==null)&&(document.body.appendChild(e),B=e.cachedW=e.width||e.offsetWidth,S=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var N=B,D=S;if(d(r,"background-width","value",n)!=="auto"&&(d(r,"background-width","units",n)==="%"?N=d(r,"background-width","pfValue",n)*y:N=d(r,"background-width","pfValue",n)),d(r,"background-height","value",n)!=="auto"&&(d(r,"background-height","units",n)==="%"?D=d(r,"background-height","pfValue",n)*m:D=d(r,"background-height","pfValue",n)),!(N===0||D===0)){if(f==="contain"){var P=Math.min(y/N,m/D);N*=P,D*=P}else if(f==="cover"){var P=Math.max(y/N,m/D);N*=P,D*=P}var L=l-y/2,O=d(r,"background-position-x","units",n),I=d(r,"background-position-x","pfValue",n);O==="%"?L+=(y-N)*I:L+=I;var _=d(r,"background-offset-x","units",n),M=d(r,"background-offset-x","pfValue",n);_==="%"?L+=(y-N)*M:L+=M;var F=u-m/2,V=d(r,"background-position-y","units",n),H=d(r,"background-position-y","pfValue",n);V==="%"?F+=(m-D)*H:F+=H;var $=d(r,"background-offset-y","units",n),z=d(r,"background-offset-y","pfValue",n);$==="%"?F+=(m-D)*z:F+=z,b.pathCache&&(L-=l,F-=u,l=0,u=0);var j=t.globalAlpha;t.globalAlpha=x;var ee=i.getImgSmoothing(t),J=!1;if(E==="no"&&ee?(i.setImgSmoothing(t,!1),J=!0):E==="yes"&&!ee&&(i.setImgSmoothing(t,!0),J=!0),p==="no-repeat")C&&(t.save(),b.pathCache?t.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,l,u,y,m,k,b),t.clip())),i.safeDrawImage(t,e,0,0,B,S,L,F,N,D),C&&t.restore();else{var Z=t.createPattern(e,p);t.fillStyle=Z,i.nodeShapes[i.getNodeShape(r)].draw(t,l,u,y,m,k,b),t.translate(L,F),t.fill(),t.translate(-L,-F)}t.globalAlpha=j,J&&i.setImgSmoothing(t,ee)}};var Wn={};Wn.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),n=this.getPixelRatio(),a=Math.ceil(Yl(r*n));e=Math.pow(2,a)}var i=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(i<o)},Wn.drawElementText=function(t,e,r,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(n==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var l=e.pstyle("label");if(!l||!l.value)return;var u=o.getLabelJustification(e);t.textAlign=u,t.textBaseline="bottom"}else{var c=e.element()._private.rscratch.badLine,d=e.pstyle("label"),f=e.pstyle("source-label"),p=e.pstyle("target-label");if(c||(!d||!d.value)&&(!f||!f.value)&&(!p||!p.value))return;t.textAlign="center",t.textBaseline="bottom"}var v=!r,h;r&&(h=r,t.translate(-h.x1,-h.y1)),a==null?(o.drawText(t,e,null,v,i),e.isEdge()&&(o.drawText(t,e,"source",v,i),o.drawText(t,e,"target",v,i))):o.drawText(t,e,a,v,i),r&&t.translate(h.x1,h.y1)},Wn.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e},Wn.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,l=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*l,c=e.pstyle("color").value,d=e.pstyle("text-outline-color").value;t.font=n+" "+o+" "+a+" "+i,t.lineJoin="round",this.colorFillStyle(t,c[0],c[1],c[2],l),this.colorStrokeStyle(t,d[0],d[1],d[2],u)};function Fc(t,e,r,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+n-i,r),t.quadraticCurveTo(e+n,r,e+n,r+i),t.lineTo(e+n,r+a-i),t.quadraticCurveTo(e+n,r+a,e+n-i,r+a),t.lineTo(e+i,r+a),t.quadraticCurveTo(e,r+a,e,r+a-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),o?t.stroke():t.fill()}Wn.getTextAngle=function(t,e){var r,n=t._private,a=n.rscratch,i=e?e+"-":"",o=t.pstyle(i+"text-rotation"),l=lr(a,"labelAngle",e);return o.strValue==="autorotate"?r=t.isEdge()?l:0:o.strValue==="none"?r=0:r=o.pfValue,r},Wn.drawText=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,l=a?e.effectiveOpacity():1;if(!(a&&(l===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=lr(o,"labelX",r),c=lr(o,"labelY",r),d,f,p=this.getLabelText(e,r);if(p!=null&&p!==""&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(t,e,a);var v=r?r+"-":"",h=lr(o,"labelWidth",r),g=lr(o,"labelHeight",r),y=e.pstyle(v+"text-margin-x").pfValue,m=e.pstyle(v+"text-margin-y").pfValue,b=e.isEdge(),w=e.pstyle("text-halign").value,C=e.pstyle("text-valign").value;b&&(w="center",C="center"),u+=y,c+=m;var x;switch(n?x=this.getTextAngle(e,r):x=0,x!==0&&(d=u,f=c,t.translate(d,f),t.rotate(x),u=0,c=0),C){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g;break}var E=e.pstyle("text-background-opacity").value,k=e.pstyle("text-border-opacity").value,B=e.pstyle("text-border-width").pfValue,S=e.pstyle("text-background-padding").pfValue,N=e.pstyle("text-background-shape").strValue,D=N.indexOf("round")===0,P=2;if(E>0||B>0&&k>0){var L=u-S;switch(w){case"left":L-=h;break;case"center":L-=h/2;break}var O=c-g-S,I=h+2*S,_=g+2*S;if(E>0){var M=t.fillStyle,F=e.pstyle("text-background-color").value;t.fillStyle="rgba("+F[0]+","+F[1]+","+F[2]+","+E*l+")",D?Fc(t,L,O,I,_,P):t.fillRect(L,O,I,_),t.fillStyle=M}if(B>0&&k>0){var V=t.strokeStyle,H=t.lineWidth,$=e.pstyle("text-border-color").value,z=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+$[0]+","+$[1]+","+$[2]+","+k*l+")",t.lineWidth=B,t.setLineDash)switch(z){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=B/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(D?Fc(t,L,O,I,_,P,"stroke"):t.strokeRect(L,O,I,_),z==="double"){var j=B/2;D?Fc(t,L+j,O+j,I-j*2,_-j*2,P,"stroke"):t.strokeRect(L+j,O+j,I-j*2,_-j*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=H,t.strokeStyle=V}}var ee=2*e.pstyle("text-outline-width").pfValue;if(ee>0&&(t.lineWidth=ee),e.pstyle("text-wrap").value==="wrap"){var J=lr(o,"labelWrapCachedLines",r),Z=lr(o,"labelLineHeight",r),re=h/2,Y=this.getLabelJustification(e);switch(Y==="auto"||(w==="left"?Y==="left"?u+=-h:Y==="center"&&(u+=-re):w==="center"?Y==="left"?u+=-re:Y==="right"&&(u+=re):w==="right"&&(Y==="center"?u+=re:Y==="right"&&(u+=h))),C){case"top":c-=(J.length-1)*Z;break;case"center":case"bottom":c-=(J.length-1)*Z;break}for(var A=0;A<J.length;A++)ee>0&&t.strokeText(J[A],u,c),t.fillText(J[A],u,c),c+=Z}else ee>0&&t.strokeText(p,u,c),t.fillText(p,u,c);x!==0&&(t.rotate(-x),t.translate(-d,-f))}}};var Ra={};Ra.drawNode=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,l,u,c=e._private,d=c.rscratch,f=e.position();if(!(!le(f.x)||!le(f.y))&&!(i&&!e.visible())){var p=i?e.effectiveOpacity():1,v=o.usePaths(),h,g=!1,y=e.padding();l=e.width()+2*y,u=e.height()+2*y;var m;r&&(m=r,t.translate(-m.x1,-m.y1));for(var b=e.pstyle("background-image"),w=b.value,C=new Array(w.length),x=new Array(w.length),E=0,k=0;k<w.length;k++){var B=w[k],S=C[k]=B!=null&&B!=="none";if(S){var N=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",k);E++,x[k]=o.getCachedImage(B,N,function(){c.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var D=e.pstyle("background-blacken").value,P=e.pstyle("border-width").pfValue,L=e.pstyle("background-opacity").value*p,O=e.pstyle("border-color").value,I=e.pstyle("border-style").value,_=e.pstyle("border-join").value,M=e.pstyle("border-cap").value,F=e.pstyle("border-position").value,V=e.pstyle("border-dash-pattern").pfValue,H=e.pstyle("border-dash-offset").pfValue,$=e.pstyle("border-opacity").value*p,z=e.pstyle("outline-width").pfValue,j=e.pstyle("outline-color").value,ee=e.pstyle("outline-style").value,J=e.pstyle("outline-opacity").value*p,Z=e.pstyle("outline-offset").value,re=e.pstyle("corner-radius").value;re!=="auto"&&(re=e.pstyle("corner-radius").pfValue);var Y=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L;o.eleFillStyle(t,e,ie)},A=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$;o.colorStrokeStyle(t,O[0],O[1],O[2],ie)},K=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:J;o.colorStrokeStyle(t,j[0],j[1],j[2],ie)},W=function(ie,X,ae,we){var Ce=o.nodePathCache=o.nodePathCache||[],ge=Mh(ae==="polygon"?ae+","+we.join(","):ae,""+X,""+ie,""+re),Se=Ce[ge],ve,ye=!1;return Se!=null?(ve=Se,ye=!0,d.pathCache=ve):(ve=new Path2D,Ce[ge]=d.pathCache=ve),{path:ve,cacheHit:ye}},oe=e.pstyle("shape").strValue,he=e.pstyle("shape-polygon-points").pfValue;if(v){t.translate(f.x,f.y);var ne=W(l,u,oe,he);h=ne.path,g=ne.cacheHit}var se=function(){if(!g){var ie=f;v&&(ie={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(h||t,ie.x,ie.y,l,u,re,d)}v?t.fill(h):t.fill()},ue=function(){for(var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ae=c.backgrounding,we=0,Ce=0;Ce<x.length;Ce++){var ge=e.cy().style().getIndexedStyle(e,"background-image-containment","value",Ce);if(X&&ge==="over"||!X&&ge==="inside"){we++;continue}C[Ce]&&x[Ce].complete&&!x[Ce].error&&(we++,o.drawInscribedImage(t,x[Ce],e,Ce,ie))}c.backgrounding=we!==E,ae!==c.backgrounding&&e.updateStyle(!1)},pe=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;o.hasPie(e)&&(o.drawPie(t,e,X),ie&&(v||o.nodeShapes[o.getNodeShape(e)].draw(t,f.x,f.y,l,u,re,d)))},de=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,X=(D>0?D:-D)*ie,ae=D>0?0:255;D!==0&&(o.colorFillStyle(t,ae,ae,ae,X),v?t.fill(h):t.fill())},me=function(){if(P>0){if(t.lineWidth=P,t.lineCap=M,t.lineJoin=_,t.setLineDash)switch(I){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(V),t.lineDashOffset=H;break;case"solid":case"double":t.setLineDash([]);break}if(F!=="center"){if(t.save(),t.lineWidth*=2,F==="inside")v?t.clip(h):t.clip();else{var ie=new Path2D;ie.rect(-l/2-P,-u/2-P,l+2*P,u+2*P),ie.addPath(h),t.clip(ie,"evenodd")}v?t.stroke(h):t.stroke(),t.restore()}else v?t.stroke(h):t.stroke();if(I==="double"){t.lineWidth=P/3;var X=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(h):t.stroke(),t.globalCompositeOperation=X}t.setLineDash&&t.setLineDash([])}},Ne=function(){if(z>0){if(t.lineWidth=z,t.lineCap="butt",t.setLineDash)switch(ee){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var ie=f;v&&(ie={x:0,y:0});var X=o.getNodeShape(e),ae=P;F==="inside"&&(ae=0),F==="outside"&&(ae*=2);var we=(l+ae+(z+Z))/l,Ce=(u+ae+(z+Z))/u,ge=l*we,Se=u*Ce,ve=o.nodeShapes[X].points,ye;if(v){var Ge=W(ge,Se,X,ve);ye=Ge.path}if(X==="ellipse")o.drawEllipsePath(ye||t,ie.x,ie.y,ge,Se);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(X)){var Re=0,rt=0,nt=0;X==="round-diamond"?Re=(ae+Z+z)*1.4:X==="round-heptagon"?(Re=(ae+Z+z)*1.075,nt=-(ae/2+Z+z)/35):X==="round-hexagon"?Re=(ae+Z+z)*1.12:X==="round-pentagon"?(Re=(ae+Z+z)*1.13,nt=-(ae/2+Z+z)/15):X==="round-tag"?(Re=(ae+Z+z)*1.12,rt=(ae/2+z+Z)*.07):X==="round-triangle"&&(Re=(ae+Z+z)*(Math.PI/2),nt=-(ae+Z/2+z)/Math.PI),Re!==0&&(we=(l+Re)/l,ge=l*we,["round-hexagon","round-tag"].includes(X)||(Ce=(u+Re)/u,Se=u*Ce)),re=re==="auto"?Xh(ge,Se):re;for(var Qe=ge/2,Ot=Se/2,ut=re+(ae+z+Z)/2,ht=new Array(ve.length/2),Wt=new Array(ve.length/2),_t=0;_t<ve.length/2;_t++)ht[_t]={x:ie.x+rt+Qe*ve[_t*2],y:ie.y+nt+Ot*ve[_t*2+1]};var Lt,tr,dr,Kt,Je=ht.length;for(tr=ht[Je-1],Lt=0;Lt<Je;Lt++)dr=ht[Lt%Je],Kt=ht[(Lt+1)%Je],Wt[Lt]=Nc(tr,dr,Kt,ut),tr=dr,dr=Kt;o.drawRoundPolygonPath(ye||t,ie.x+rt,ie.y+nt,l*we,u*Ce,ve,Wt)}else if(["roundrectangle","round-rectangle"].includes(X))re=re==="auto"?Rn(ge,Se):re,o.drawRoundRectanglePath(ye||t,ie.x,ie.y,ge,Se,re+(ae+z+Z)/2);else if(["cutrectangle","cut-rectangle"].includes(X))re=re==="auto"?Jl():re,o.drawCutRectanglePath(ye||t,ie.x,ie.y,ge,Se,null,re+(ae+z+Z)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(X))re=re==="auto"?Rn(ge,Se):re,o.drawBottomRoundRectanglePath(ye||t,ie.x,ie.y,ge,Se,re+(ae+z+Z)/2);else if(X==="barrel")o.drawBarrelPath(ye||t,ie.x,ie.y,ge,Se);else if(X.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(X)){var at=(ae+z+Z)/l;ve=zo(Ho(ve,at)),o.drawPolygonPath(ye||t,ie.x,ie.y,l,u,ve)}else{var pt=(ae+z+Z)/l;ve=zo(Ho(ve,-pt)),o.drawPolygonPath(ye||t,ie.x,ie.y,l,u,ve)}if(v?t.stroke(ye):t.stroke(),ee==="double"){t.lineWidth=ae/3;var mn=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(ye):t.stroke(),t.globalCompositeOperation=mn}t.setLineDash&&t.setLineDash([])}},De=function(){a&&o.drawNodeOverlay(t,e,f,l,u)},Ee=function(){a&&o.drawNodeUnderlay(t,e,f,l,u)},Pe=function(){o.drawElementText(t,e,null,n)},te=e.pstyle("ghost").value==="yes";if(te){var T=e.pstyle("ghost-offset-x").pfValue,R=e.pstyle("ghost-offset-y").pfValue,Q=e.pstyle("ghost-opacity").value,G=Q*p;t.translate(T,R),K(),Ne(),Y(Q*L),se(),ue(G,!0),A(Q*$),me(),pe(D!==0||P!==0),ue(G,!1),de(G),t.translate(-T,-R)}v&&t.translate(-f.x,-f.y),Ee(),v&&t.translate(f.x,f.y),K(),Ne(),Y(),se(),ue(p,!0),A(),me(),pe(D!==0||P!==0),ue(p,!1),de(),v&&t.translate(-f.x,-f.y),Pe(),De(),r&&t.translate(m.x1,m.y1)}};var Jv=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n,a,i,o){var l=this;if(n.visible()){var u=n.pstyle("".concat(e,"-padding")).pfValue,c=n.pstyle("".concat(e,"-opacity")).value,d=n.pstyle("".concat(e,"-color")).value,f=n.pstyle("".concat(e,"-shape")).value,p=n.pstyle("".concat(e,"-corner-radius")).value;if(c>0){if(a=a||n.position(),i==null||o==null){var v=n.padding();i=n.width()+2*v,o=n.height()+2*v}l.colorFillStyle(r,d[0],d[1],d[2],c),l.nodeShapes[f].draw(r,a.x,a.y,i+u*2,o+u*2,p),r.fill()}}}};Ra.drawNodeOverlay=Jv("overlay"),Ra.drawNodeUnderlay=Jv("underlay"),Ra.hasPie=function(t){return t=t[0],t._private.hasPie},Ra.drawPie=function(t,e,r,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=e.pstyle("pie-size"),o=n.x,l=n.y,u=e.width(),c=e.height(),d=Math.min(u,c)/2,f=0,p=this.usePaths();p&&(o=0,l=0),i.units==="%"?d=d*i.pfValue:i.pfValue!==void 0&&(d=i.pfValue/2);for(var v=1;v<=a.pieBackgroundN;v++){var h=e.pstyle("pie-"+v+"-background-size").value,g=e.pstyle("pie-"+v+"-background-color").value,y=e.pstyle("pie-"+v+"-background-opacity").value*r,m=h/100;m+f>1&&(m=1-f);var b=1.5*Math.PI+2*Math.PI*f,w=2*Math.PI*m,C=b+w;h===0||f>=1||f+m>1||(t.beginPath(),t.moveTo(o,l),t.arc(o,l,d,b,C),t.closePath(),this.colorFillStyle(t,g[0],g[1],g[2],y),t.fill(),f+=m)}};var Gt={},kP=100;Gt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r},Gt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,n,a=0;a<e.length;a++)if(n=e[a],n.context===t){r=!1;break}return r&&(n={context:t},e.push(n)),n},Gt.createGradientStyleFor=function(t,e,r,n,a){var i,o=this.usePaths(),l=r.pstyle(e+"-gradient-stop-colors").value,u=r.pstyle(e+"-gradient-stop-positions").pfValue;if(n==="radial-gradient")if(r.isEdge()){var c=r.sourceEndpoint(),d=r.targetEndpoint(),f=r.midpoint(),p=In(c,f),v=In(d,f);i=t.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(p,v))}else{var h=o?{x:0,y:0}:r.position(),g=r.paddedWidth(),y=r.paddedHeight();i=t.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(g,y))}else if(r.isEdge()){var m=r.sourceEndpoint(),b=r.targetEndpoint();i=t.createLinearGradient(m.x,m.y,b.x,b.y)}else{var w=o?{x:0,y:0}:r.position(),C=r.paddedWidth(),x=r.paddedHeight(),E=C/2,k=x/2,B=r.pstyle("background-gradient-direction").value;switch(B){case"to-bottom":i=t.createLinearGradient(w.x,w.y-k,w.x,w.y+k);break;case"to-top":i=t.createLinearGradient(w.x,w.y+k,w.x,w.y-k);break;case"to-left":i=t.createLinearGradient(w.x+E,w.y,w.x-E,w.y);break;case"to-right":i=t.createLinearGradient(w.x-E,w.y,w.x+E,w.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(w.x-E,w.y-k,w.x+E,w.y+k);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(w.x-E,w.y+k,w.x+E,w.y-k);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(w.x+E,w.y-k,w.x-E,w.y+k);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(w.x+E,w.y+k,w.x-E,w.y-k);break}}if(!i)return null;for(var S=u.length===l.length,N=l.length,D=0;D<N;D++)i.addColorStop(S?u[D]:D/(N-1),"rgba("+l[D][0]+","+l[D][1]+","+l[D][2]+","+a+")");return i},Gt.gradientFillStyle=function(t,e,r,n){var a=this.createGradientStyleFor(t,"background",e,r,n);if(!a)return null;t.fillStyle=a},Gt.colorFillStyle=function(t,e,r,n,a){t.fillStyle="rgba("+e+","+r+","+n+","+a+")"},Gt.eleFillStyle=function(t,e,r){var n=e.pstyle("background-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientFillStyle(t,e,n,r);else{var a=e.pstyle("background-color").value;this.colorFillStyle(t,a[0],a[1],a[2],r)}},Gt.gradientStrokeStyle=function(t,e,r,n){var a=this.createGradientStyleFor(t,"line",e,r,n);if(!a)return null;t.strokeStyle=a},Gt.colorStrokeStyle=function(t,e,r,n,a){t.strokeStyle="rgba("+e+","+r+","+n+","+a+")"},Gt.eleStrokeStyle=function(t,e,r){var n=e.pstyle("line-fill").value;if(n==="linear-gradient"||n==="radial-gradient")this.gradientStrokeStyle(t,e,n,r);else{var a=e.pstyle("line-color").value;this.colorStrokeStyle(t,a[0],a[1],a[2],r)}},Gt.matchCanvasSize=function(t){var e=this,r=e.data,n=e.findContainerClientCoords(),a=n[2],i=n[3],o=e.getPixelRatio(),l=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=l);var u=a*o,c=i*o,d;if(!(u===e.canvasWidth&&c===e.canvasHeight)){e.fontCaches=null;var f=r.canvasContainer;f.style.width=a+"px",f.style.height=i+"px";for(var p=0;p<e.CANVAS_LAYERS;p++)d=r.canvases[p],d.width=u,d.height=c,d.style.width=a+"px",d.style.height=i+"px";for(var p=0;p<e.BUFFER_COUNT;p++)d=r.bufferCanvases[p],d.width=u,d.height=c,d.style.width=a+"px",d.style.height=i+"px";e.textureMult=1,o<=1&&(d=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,d.width=u*e.textureMult,d.height=c*e.textureMult),e.canvasWidth=u,e.canvasHeight=c}},Gt.renderTo=function(t,e,r,n){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})},Gt.render=function(t){t=t||zh();var e=t.forcedContext,r=t.drawAllLayers,n=t.drawOnlyNodeLayer,a=t.forcedZoom,i=t.forcedPan,o=this,l=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,u=o.cy,c=o.data,d=c.canvasNeedsRedraw,f=o.textureOnViewport&&!e&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),p=t.motionBlur!==void 0?t.motionBlur:o.motionBlur,v=o.motionBlurPxRatio,h=u.hasCompoundNodes(),g=o.hoverData.draggingEles,y=!!(o.hoverData.selecting||o.touchData.selecting);p=p&&!e&&o.motionBlurEnabled&&!y;var m=p;e||(o.prevPxRatio!==l&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=l),!e&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),p&&(o.mbFrames==null&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(m=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!f&&(d[o.NODE]=!0,d[o.SELECT_BOX]=!0);var b=u.style(),w=u.zoom(),C=a!==void 0?a:w,x=u.pan(),E={x:x.x,y:x.y},k={zoom:w,pan:{x:x.x,y:x.y}},B=o.prevViewport,S=B===void 0||k.zoom!==B.zoom||k.pan.x!==B.pan.x||k.pan.y!==B.pan.y;!S&&!(g&&!h)&&(o.motionBlurPxRatio=1),i&&(E=i),C*=l,E.x*=l,E.y*=l;var N=o.getCachedZSortedEles();function D(ne,se,ue,pe,de){var me=ne.globalCompositeOperation;ne.globalCompositeOperation="destination-out",o.colorFillStyle(ne,255,255,255,o.motionBlurTransparency),ne.fillRect(se,ue,pe,de),ne.globalCompositeOperation=me}function P(ne,se){var ue,pe,de,me;!o.clearingMotionBlur&&(ne===c.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]||ne===c.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG])?(ue={x:x.x*v,y:x.y*v},pe=w*v,de=o.canvasWidth*v,me=o.canvasHeight*v):(ue=E,pe=C,de=o.canvasWidth,me=o.canvasHeight),ne.setTransform(1,0,0,1,0,0),se==="motionBlur"?D(ne,0,0,de,me):!e&&(se===void 0||se)&&ne.clearRect(0,0,de,me),r||(ne.translate(ue.x,ue.y),ne.scale(pe,pe)),i&&ne.translate(i.x,i.y),a&&ne.scale(a,a)}if(f||(o.textureDrawLastFrame=!1),f){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=u.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var L=o.data.bufferContexts[o.TEXTURE_BUFFER];L.setTransform(1,0,0,1,0,0),L.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:L,drawOnlyNodeLayer:!0,forcedPxRatio:l*o.textureMult});var k=o.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:o.canvasWidth,height:o.canvasHeight};k.mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}d[o.DRAG]=!1,d[o.NODE]=!1;var O=c.contexts[o.NODE],I=o.textureCache.texture,k=o.textureCache.viewport;O.setTransform(1,0,0,1,0,0),p?D(O,0,0,k.width,k.height):O.clearRect(0,0,k.width,k.height);var _=b.core("outside-texture-bg-color").value,M=b.core("outside-texture-bg-opacity").value;o.colorFillStyle(O,_[0],_[1],_[2],M),O.fillRect(0,0,k.width,k.height);var w=u.zoom();P(O,!1),O.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l),O.drawImage(I,k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l)}else o.textureOnViewport&&!e&&(o.textureCache=null);var F=u.extent(),V=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),H=o.hideEdgesOnViewport&&V,$=[];if($[o.NODE]=!d[o.NODE]&&p&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,$[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),$[o.DRAG]=!d[o.DRAG]&&p&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,$[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),d[o.NODE]||r||n||$[o.NODE]){var z=p&&!$[o.NODE]&&v!==1,O=e||(z?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:c.contexts[o.NODE]),j=p&&!z?"motionBlur":void 0;P(O,j),H?o.drawCachedNodes(O,N.nondrag,l,F):o.drawLayeredElements(O,N.nondrag,l,F),o.debug&&o.drawDebugPoints(O,N.nondrag),!r&&!p&&(d[o.NODE]=!1)}if(!n&&(d[o.DRAG]||r||$[o.DRAG])){var z=p&&!$[o.DRAG]&&v!==1,O=e||(z?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:c.contexts[o.DRAG]);P(O,p&&!z?"motionBlur":void 0),H?o.drawCachedNodes(O,N.drag,l,F):o.drawCachedElements(O,N.drag,l,F),o.debug&&o.drawDebugPoints(O,N.drag),!r&&!p&&(d[o.DRAG]=!1)}if(o.showFps||!n&&d[o.SELECT_BOX]&&!r){var O=e||c.contexts[o.SELECT_BOX];if(P(O),o.selection[4]==1&&(o.hoverData.selecting||o.touchData.selecting)){var w=o.cy.zoom(),ee=b.core("selection-box-border-width").value/w;O.lineWidth=ee,O.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",O.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),ee>0&&(O.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",O.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(c.bgActivePosistion&&!o.hoverData.selecting){var w=o.cy.zoom(),J=c.bgActivePosistion;O.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",O.beginPath(),O.arc(J.x,J.y,b.core("active-bg-size").pfValue/w,0,2*Math.PI),O.fill()}var Z=o.lastRedrawTime;if(o.showFps&&Z){Z=Math.round(Z);var re=Math.round(1e3/Z);O.setTransform(1,0,0,1,0,0),O.fillStyle="rgba(255, 0, 0, 0.75)",O.strokeStyle="rgba(255, 0, 0, 0.75)",O.lineWidth=1,O.fillText("1 frame = "+Z+" ms = "+re+" fps",0,20);var Y=60;O.strokeRect(0,30,250,20),O.fillRect(0,30,250*Math.min(re/Y,1),20)}r||(d[o.SELECT_BOX]=!1)}if(p&&v!==1){var A=c.contexts[o.NODE],K=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],W=c.contexts[o.DRAG],oe=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],he=function(se,ue,pe){se.setTransform(1,0,0,1,0,0),pe||!m?se.clearRect(0,0,o.canvasWidth,o.canvasHeight):D(se,0,0,o.canvasWidth,o.canvasHeight);var de=v;se.drawImage(ue,0,0,o.canvasWidth*de,o.canvasHeight*de,0,0,o.canvasWidth,o.canvasHeight)};(d[o.NODE]||$[o.NODE])&&(he(A,K,$[o.NODE]),d[o.NODE]=!1),(d[o.DRAG]||$[o.DRAG])&&(he(W,oe,$[o.DRAG]),d[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),p&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!f,o.mbFrames=0,d[o.NODE]=!0,d[o.DRAG]=!0,o.redraw()},kP)),e||u.emit("render")};var gn={};gn.drawPolygonPath=function(t,e,r,n,a,i){var o=n/2,l=a/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*i[0],r+l*i[1]);for(var u=1;u<i.length/2;u++)t.lineTo(e+o*i[u*2],r+l*i[u*2+1]);t.closePath()},gn.drawRoundPolygonPath=function(t,e,r,n,a,i,o){o.forEach(function(l){return Lv(t,l)}),t.closePath()},gn.drawRoundRectanglePath=function(t,e,r,n,a,i){var o=n/2,l=a/2,u=i==="auto"?Rn(n,a):Math.min(i,l,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-l),t.arcTo(e+o,r-l,e+o,r,u),t.arcTo(e+o,r+l,e,r+l,u),t.arcTo(e-o,r+l,e-o,r,u),t.arcTo(e-o,r-l,e,r-l,u),t.lineTo(e,r-l),t.closePath()},gn.drawBottomRoundRectanglePath=function(t,e,r,n,a,i){var o=n/2,l=a/2,u=i==="auto"?Rn(n,a):i;t.beginPath&&t.beginPath(),t.moveTo(e,r-l),t.lineTo(e+o,r-l),t.lineTo(e+o,r),t.arcTo(e+o,r+l,e,r+l,u),t.arcTo(e-o,r+l,e-o,r,u),t.lineTo(e-o,r-l),t.lineTo(e,r-l),t.closePath()},gn.drawCutRectanglePath=function(t,e,r,n,a,i,o){var l=n/2,u=a/2,c=o==="auto"?Jl():o;t.beginPath&&t.beginPath(),t.moveTo(e-l+c,r-u),t.lineTo(e+l-c,r-u),t.lineTo(e+l,r-u+c),t.lineTo(e+l,r+u-c),t.lineTo(e+l-c,r+u),t.lineTo(e-l+c,r+u),t.lineTo(e-l,r+u-c),t.lineTo(e-l,r-u+c),t.closePath()},gn.drawBarrelPath=function(t,e,r,n,a){var i=n/2,o=a/2,l=e-i,u=e+i,c=r-o,d=r+o,f=ec(n,a),p=f.widthOffset,v=f.heightOffset,h=f.ctrlPtOffsetPct*p;t.beginPath&&t.beginPath(),t.moveTo(l,c+v),t.lineTo(l,d-v),t.quadraticCurveTo(l+h,d,l+p,d),t.lineTo(u-p,d),t.quadraticCurveTo(u-h,d,u,d-v),t.lineTo(u,c+v),t.quadraticCurveTo(u-h,c,u-p,c),t.lineTo(l+p,c),t.quadraticCurveTo(l+h,c,l,c+v),t.closePath()};for(var eg=Math.sin(0),tg=Math.cos(0),Mc={},Ic={},rg=Math.PI/40,$a=0*Math.PI;$a<2*Math.PI;$a+=rg)Mc[$a]=Math.sin($a),Ic[$a]=Math.cos($a);gn.drawEllipsePath=function(t,e,r,n,a){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,n/2,a/2,0,0,2*Math.PI);else for(var i,o,l=n/2,u=a/2,c=0*Math.PI;c<2*Math.PI;c+=rg)i=e-l*Mc[c]*eg+l*Ic[c]*tg,o=r+u*Ic[c]*eg+u*Mc[c]*tg,c===0?t.moveTo(i,o):t.lineTo(i,o);t.closePath()};var Ui={};Ui.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]},Ui.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),n=r.boundingBox(),a=this.findContainerClientCoords(),i=t.full?Math.ceil(n.w):a[2],o=t.full?Math.ceil(n.h):a[3],l=le(t.maxWidth)||le(t.maxHeight),u=this.getPixelRatio(),c=1;if(t.scale!==void 0)i*=t.scale,o*=t.scale,c=t.scale;else if(l){var d=1/0,f=1/0;le(t.maxWidth)&&(d=c*t.maxWidth/i),le(t.maxHeight)&&(f=c*t.maxHeight/o),c=Math.min(d,f),i*=c,o*=c}l||(i*=u,o*=u,c*=u);var p=document.createElement("canvas");p.width=i,p.height=o,p.style.width=i+"px",p.style.height=o+"px";var v=p.getContext("2d");if(i>0&&o>0){v.clearRect(0,0,i,o),v.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(t.full)v.translate(-n.x1*c,-n.y1*c),v.scale(c,c),this.drawElements(v,h),v.scale(1/c,1/c),v.translate(n.x1*c,n.y1*c);else{var g=e.pan(),y={x:g.x*c,y:g.y*c};c*=e.zoom(),v.translate(y.x,y.y),v.scale(c,c),this.drawElements(v,h),v.scale(1/c,1/c),v.translate(-y.x,-y.y)}t.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=t.bg,v.rect(0,0,i,o),v.fill())}return p};function xP(t,e){for(var r=atob(t),n=new ArrayBuffer(r.length),a=new Uint8Array(n),i=0;i<r.length;i++)a[i]=r.charCodeAt(i);return new Blob([n],{type:e})}function ng(t){var e=t.indexOf(",");return t.substr(e+1)}function ag(t,e,r){var n=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new xa(function(a,i){try{e.toBlob(function(o){o!=null?a(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){i(o)}});case"blob":return xP(ng(n()),r);case"base64":return ng(n());case"base64uri":default:return n()}}Ui.png=function(t){return ag(t,this.bufferCanvasImage(t),"image/png")},Ui.jpg=function(t){return ag(t,this.bufferCanvasImage(t),"image/jpeg")};var ig={};ig.nodeShapeImpl=function(t,e,r,n,a,i,o,l){switch(t){case"ellipse":return this.drawEllipsePath(e,r,n,a,i);case"polygon":return this.drawPolygonPath(e,r,n,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,n,a,i,o,l);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,n,a,i,l);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,n,a,i,o,l);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,n,a,i,l);case"barrel":return this.drawBarrelPath(e,r,n,a,i)}};var EP=og,Me=og.prototype;Me.CANVAS_LAYERS=3,Me.SELECT_BOX=0,Me.DRAG=1,Me.NODE=2,Me.BUFFER_COUNT=3,Me.TEXTURE_BUFFER=0,Me.MOTIONBLUR_BUFFER_NODE=1,Me.MOTIONBLUR_BUFFER_DRAG=2;function og(t){var e=this,r=e.cy.window(),n=r.document;e.data={canvases:new Array(Me.CANVAS_LAYERS),contexts:new Array(Me.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Me.CANVAS_LAYERS),bufferCanvases:new Array(Me.BUFFER_COUNT),bufferContexts:new Array(Me.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=n.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[a]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var l=t.cy.container();l.appendChild(e.data.canvasContainer),l.style[a]=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"};dT()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var c=0;c<Me.CANVAS_LAYERS;c++){var d=e.data.canvases[c]=n.createElement("canvas");e.data.contexts[c]=d.getContext("2d"),Object.keys(u).forEach(function(Y){d.style[Y]=u[Y]}),d.style.position="absolute",d.setAttribute("data-id","layer"+c),d.style.zIndex=String(Me.CANVAS_LAYERS-c),e.data.canvasContainer.appendChild(d),e.data.canvasNeedsRedraw[c]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Me.NODE].setAttribute("data-id","layer"+Me.NODE+"-node"),e.data.canvases[Me.SELECT_BOX].setAttribute("data-id","layer"+Me.SELECT_BOX+"-selectbox"),e.data.canvases[Me.DRAG].setAttribute("data-id","layer"+Me.DRAG+"-drag");for(var c=0;c<Me.BUFFER_COUNT;c++)e.data.bufferCanvases[c]=n.createElement("canvas"),e.data.bufferContexts[c]=e.data.bufferCanvases[c].getContext("2d"),e.data.bufferCanvases[c].style.position="absolute",e.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),e.data.bufferCanvases[c].style.zIndex=String(-c-1),e.data.bufferCanvases[c].style.visibility="hidden";e.pathsEnabled=!0;var f=zt(),p=function(A){return{x:(A.x1+A.x2)/2,y:(A.y1+A.y2)/2}},v=function(A){return{x:-A.w/2,y:-A.h/2}},h=function(A){var K=A[0]._private,W=K.oldBackgroundTimestamp===K.backgroundTimestamp;return!W},g=function(A){return A[0]._private.nodeKey},y=function(A){return A[0]._private.labelStyleKey},m=function(A){return A[0]._private.sourceLabelStyleKey},b=function(A){return A[0]._private.targetLabelStyleKey},w=function(A,K,W,oe,he){return e.drawElement(A,K,W,!1,!1,he)},C=function(A,K,W,oe,he){return e.drawElementText(A,K,W,oe,"main",he)},x=function(A,K,W,oe,he){return e.drawElementText(A,K,W,oe,"source",he)},E=function(A,K,W,oe,he){return e.drawElementText(A,K,W,oe,"target",he)},k=function(A){return A.boundingBox(),A[0]._private.bodyBounds},B=function(A){return A.boundingBox(),A[0]._private.labelBounds.main||f},S=function(A){return A.boundingBox(),A[0]._private.labelBounds.source||f},N=function(A){return A.boundingBox(),A[0]._private.labelBounds.target||f},D=function(A,K){return K},P=function(A){return p(k(A))},L=function(A,K,W){var oe=A?A+"-":"";return{x:K.x+W.pstyle(oe+"text-margin-x").pfValue,y:K.y+W.pstyle(oe+"text-margin-y").pfValue}},O=function(A,K,W){var oe=A[0]._private.rscratch;return{x:oe[K],y:oe[W]}},I=function(A){return L("",O(A,"labelX","labelY"),A)},_=function(A){return L("source",O(A,"sourceLabelX","sourceLabelY"),A)},M=function(A){return L("target",O(A,"targetLabelX","targetLabelY"),A)},F=function(A){return v(k(A))},V=function(A){return v(S(A))},H=function(A){return v(N(A))},$=function(A){var K=B(A),W=v(B(A));if(A.isNode()){switch(A.pstyle("text-halign").value){case"left":W.x=-K.w;break;case"right":W.x=0;break}switch(A.pstyle("text-valign").value){case"top":W.y=-K.h;break;case"bottom":W.y=0;break}}return W},z=e.data.eleTxrCache=new Ki(e,{getKey:g,doesEleInvalidateKey:h,drawElement:w,getBoundingBox:k,getRotationPoint:P,getRotationOffset:F,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),j=e.data.lblTxrCache=new Ki(e,{getKey:y,drawElement:C,getBoundingBox:B,getRotationPoint:I,getRotationOffset:$,isVisible:D}),ee=e.data.slbTxrCache=new Ki(e,{getKey:m,drawElement:x,getBoundingBox:S,getRotationPoint:_,getRotationOffset:V,isVisible:D}),J=e.data.tlbTxrCache=new Ki(e,{getKey:b,drawElement:E,getBoundingBox:N,getRotationPoint:M,getRotationOffset:H,isVisible:D}),Z=e.data.lyrTxrCache=new Wv(e);e.onUpdateEleCalcs(function(A,K){z.invalidateElements(K),j.invalidateElements(K),ee.invalidateElements(K),J.invalidateElements(K),Z.invalidateElements(K);for(var W=0;W<K.length;W++){var oe=K[W]._private;oe.oldBackgroundTimestamp=oe.backgroundTimestamp}});var re=function(A){for(var K=0;K<A.length;K++)Z.enqueueElementRefinement(A[K].ele)};z.onDequeue(re),j.onDequeue(re),ee.onDequeue(re),J.onDequeue(re)}Me.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Me.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Me.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Me.SELECT_BOX]=e;break}};var SP=typeof Path2D<"u";Me.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t},Me.usePaths=function(){return SP&&this.pathsEnabled},Me.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)},Me.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled},Me.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":ot(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var n=this.cy.window(),a=n.document;r=a.createElement("canvas"),r.width=t,r.height=e}return r},[Yv,Sr,Kr,Lc,Wn,Ra,Gt,gn,Ui,ig].forEach(function(t){xe(Me,t)});var TP=[{name:"null",impl:Ev},{name:"base",impl:Kv},{name:"canvas",impl:EP}],BP=[{type:"layout",extensions:LD},{type:"renderer",extensions:TP}],sg={},lg={};function cg(t,e,r){var n=r,a=function(B){Ae("Can not register `"+e+"` for `"+t+"` since `"+B+"` already exists in the prototype and can not be overridden")};if(t==="core"){if($i.prototype[e])return a(e);$i.prototype[e]=r}else if(t==="collection"){if(kt.prototype[e])return a(e);kt.prototype[e]=r}else if(t==="layout"){for(var i=function(B){this.options=B,r.call(this,B),_e(this._private)||(this._private={}),this._private.cy=B.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),l=[],u=0;u<l.length;u++){var c=l[u];o[c]=o[c]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var d=r.prototype.stop;o.stop=function(){var k=this.options;if(k&&k.animate){var B=this.animations;if(B)for(var S=0;S<B.length;S++)B[S].stop()}return d?d.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var f=function(B){return B._private.cy},p={addEventFields:function(B,S){S.layout=B,S.cy=f(B),S.target=B},bubble:function(){return!0},parent:function(B){return f(B)}};xe(o,{createEmitter:function(){return this._private.emitter=new rs(p,this),this},emitter:function(){return this._private.emitter},on:function(B,S){return this.emitter().on(B,S),this},one:function(B,S){return this.emitter().one(B,S),this},once:function(B,S){return this.emitter().one(B,S),this},removeListener:function(B,S){return this.emitter().removeListener(B,S),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(B,S){return this.emitter().emit(B,S),this}}),Ve.eventAliasesOn(o),n=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var v=ug("renderer","base"),h=v.prototype,g=r,y=r.prototype,m=function(){v.apply(this,arguments),g.apply(this,arguments)},b=m.prototype;for(var w in h){var C=h[w],x=y[w]!=null;if(x)return a(w);b[w]=C}for(var E in y)b[E]=y[E];h.clientFunctions.forEach(function(k){b[k]=b[k]||function(){Xe("Renderer does not implement `renderer."+k+"()` on its prototype")}}),n=m}else if(t==="__proto__"||t==="constructor"||t==="prototype")return Xe(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return Sh({map:sg,keys:[t,e],value:n})}function ug(t,e){return Th({map:sg,keys:[t,e]})}function NP(t,e,r,n,a){return Sh({map:lg,keys:[t,e,r,n],value:a})}function DP(t,e,r,n){return Th({map:lg,keys:[t,e,r,n]})}var Ac=function(){if(arguments.length===2)return ug.apply(null,arguments);if(arguments.length===3)return cg.apply(null,arguments);if(arguments.length===4)return DP.apply(null,arguments);if(arguments.length===5)return NP.apply(null,arguments);Xe("Invalid extension access syntax")};$i.prototype.extension=Ac,BP.forEach(function(t){t.extensions.forEach(function(e){cg(t.type,e.name,e.impl)})});var dg=function t(){if(!(this instanceof t))return new t;this.length=0},jn=dg.prototype;jn.instanceString=function(){return"stylesheet"},jn.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this},jn.css=function(t,e){var r=this.length-1;if(be(t))this[r].properties.push({name:t,value:e});else if(_e(t))for(var n=t,a=Object.keys(n),i=0;i<a.length;i++){var o=a[i],l=n[o];if(l!=null){var u=Nt.properties[o]||Nt.properties[Po(o)];if(u!=null){var c=u.name,d=l;this[r].properties.push({name:c,value:d})}}}return this},jn.style=jn.css,jn.generateStyle=function(t){var e=new Nt(t);return this.appendToStyle(e)},jn.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],n=r.selector,a=r.properties;t.selector(n);for(var i=0;i<a.length;i++){var o=a[i];t.css(o.name,o.value)}}return t};var PP="3.30.2",Yn=function(e){if(e===void 0&&(e={}),_e(e))return new $i(e);if(be(e))return Ac.apply(Ac,arguments)};Yn.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Yn),t.apply(null,e),this},Yn.warnings=function(t){return Rh(t)},Yn.version=PP,Yn.stylesheet=Yn.Stylesheet=dg;let OP=class extends EventTarget{constructor(r,n){super();Br(this,"cyg",null);Br(this,"nodes",[]);Br(this,"edges",[]);Br(this,"axons",[]);Br(this,"dendrites",[]);Br(this,"labelCache",new Map);Br(this,"graphCanvas",null);this.labelCache=r,this.graphCanvas=n}async addConnectivity(r){if(this.axons=r.axons.map(n=>JSON.stringify(n)),this.dendrites=r.dendrites.map(n=>JSON.stringify(n)),r.connectivity.length)for(const n of r.connectivity){const a=await this.graphNode(n[0]),i=await this.graphNode(n[1]);this.nodes.push(a),this.nodes.push(i),this.edges.push({id:`${a.id}_${i.id}`,source:a.id,target:i.id})}else this.nodes.push({id:"MISSING",label:"NO PATHS"})}showConnectivity(r){this.cyg=new LP(this,r),this.cyg.on("tap-node",n=>{const a=new CustomEvent("tap-node",{detail:n.detail});this.dispatchEvent(a)})}clearConnectivity(){var r;(r=this.cyg)!=null&&r.cy&&(this.cyg.cy.remove(),this.cyg.cy=null)}reset(){var r;(r=this.cyg)!=null&&r.cy&&this.cyg.cy.reset()}enableZoom(r){var n;(n=this.cyg)!=null&&n.cy&&this.cyg.cy.userZoomingEnabled(r)}get elements(){return[...this.nodes.map(r=>({data:r})),...this.edges.map(r=>({data:r}))]}get roots(){return this.dendrites}async graphNode(r){const n=JSON.stringify(r),a=[r[0],...r[1]],i=[];for(const l of a){const u=this.labelCache.has(l)?this.labelCache.get(l):"";i.push(u)}a.push(...i);const o={id:n,label:a.join(`
448
+ `)};return this.axons.includes(n)?this.dendrites.includes(n)?o["both-a-d"]=!0:o.axon=!0:this.dendrites.includes(n)&&(o.dendrite=!0),o}on(r,n){this.addEventListener(r,n)}};const _P=[{selector:"node",style:{label:"data(label)","background-color":"#80F0F0","text-valign":"center","text-wrap":"wrap","text-max-width":"80px","font-size":"6px"}},{selector:"node[axon]",style:{"background-color":"green"}},{selector:"node[dendrite]",style:{"background-color":"red"}},{selector:"node[both-a-d]",style:{"background-color":"gray"}},{selector:"edge",style:{width:2,"line-color":"#9dbaea","target-arrow-color":"#9dbaea","target-arrow-shape":"triangle","curve-style":"bezier"}}];class LP extends EventTarget{constructor(r,n){var a;super();Br(this,"cy");Br(this,"tooltip");this.cy=Yn({container:n,elements:r.elements,layout:{name:"breadthfirst",circle:!1,roots:r.roots},directed:!0,style:_P,minZoom:.5,maxZoom:10,wheelSensitivity:.4}).on("mouseover","node",this.overNode.bind(this)).on("mouseout","node",this.exitNode.bind(this)).on("position","node",this.moveNode.bind(this)).on("tap","node",this.tapNode.bind(this)),this.tooltip=document.createElement("div"),this.tooltip.className="cy-graph-tooltip",this.tooltip.hidden=!0,(a=n==null?void 0:n.lastChild)==null||a.appendChild(this.tooltip)}remove(){this.cy&&this.cy.destroy()}checkRightBoundary(r){var n;r+this.tooltip.offsetWidth>=((n=this.tooltip.parentElement)==null?void 0:n.offsetWidth)&&(this.tooltip.style.left=`${r-this.tooltip.offsetWidth}px`)}overNode(r){const n=r.target;this.tooltip.innerText=n.data().label,this.tooltip.style.left=`${r.renderedPosition.x}px`,this.tooltip.style.top=`${r.renderedPosition.y}px`,this.tooltip.hidden=!1,this.checkRightBoundary(r.renderedPosition.x)}moveNode(r){const n=r.target;this.tooltip.style.left=`${n.renderedPosition().x}px`,this.tooltip.style.top=`${n.renderedPosition().y}px`,this.checkRightBoundary(n.renderedPosition().x)}exitNode(r){this.tooltip.hidden=!0}tapNode(r){const a=r.target.data(),i=new CustomEvent("tap-node",{detail:a});this.dispatchEvent(i)}on(r,n){this.addEventListener(r,n)}}const FP=1.3,MP=24*60*60*1e3,IP="Reset position",fg="Lock zoom (to scroll)",AP="Unlock zoom",VP="#8300bf",RP={name:"ConnectivityGraph",props:{entry:{type:String,default:""},mapServer:{type:String,default:""}},data:function(){return{loading:!0,connectivityGraph:null,selectedSource:"",pathList:[],schemaVersion:"",knowledgeByPath:new Map,labelledTerms:new Set,labelCache:new Map,resetLabel:IP,zoomLockLabel:fg,iconColor:VP,zoomEnabled:!1}},mounted(){this.refreshCache(),this.loadCacheData(),this.run().then(t=>{this.showGraph(this.entry)})},methods:{loadCacheData:function(){const t=sessionStorage.getItem("connectivity-graph-source"),e=sessionStorage.getItem("connectivity-graph-labels"),r=sessionStorage.getItem("connectivity-graph-pathlist"),n=sessionStorage.getItem("connectivity-graph-schema-version");if(t&&(this.selectedSource=t),r&&(this.pathList=JSON.parse(r)),e){const a=JSON.parse(e);this.labelCache=new Map(Object.entries(a))}n&&(this.schemaVersion=n)},removeAllCacheData:function(){["connectivity-graph-expiry","connectivity-graph-source","connectivity-graph-labels","connectivity-graph-pathlist","connectivity-graph-schema-version"].forEach(e=>{sessionStorage.removeItem(e)})},refreshCache:function(){const t=sessionStorage.getItem("connectivity-graph-expiry");new Date().getTime()>t&&this.removeAllCacheData()},updateCacheExpiry:function(){const e=new Date().getTime()+MP;sessionStorage.setItem("connectivity-graph-expiry",e)},run:async function(){if(this.schemaVersion||(this.schemaVersion=await this.getSchemaVersion(),sessionStorage.setItem("connectivity-graph-schema-version",this.schemaVersion),this.updateCacheExpiry()),this.schemaVersion<FP){console.warn("No Server!");return}this.showSpinner(),this.selectedSource||(this.selectedSource=await this.setSourceList(),sessionStorage.setItem("connectivity-graph-source",this.selectedSource),this.updateCacheExpiry()),await this.setPathList(this.selectedSource),this.hideSpinner()},showGraph:async function(t){const e=this.$refs.graphCanvas;this.showSpinner(),this.connectivityGraph=new OP(this.labelCache,e),await this.connectivityGraph.addConnectivity(this.knowledgeByPath.get(t)),this.hideSpinner(),this.connectivityGraph.showConnectivity(e),this.connectivityGraph.on("tap-node",r=>{const{label:n}=r.detail,a=n.split(`
449
+ `);this.$emit("tap-node",a)})},query:async function(t,e){const r=`${this.mapServer}knowledge/query/`,n={sql:t,params:e};try{const a=await fetch(r,{method:"POST",headers:{Accept:"application/json; charset=utf-8","Cache-Control":"no-store","Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`Cannot access ${r}`);return await a.json()}catch{return{values:[]}}},setSourceList:async function(){const t=await this.getJsonData(`${this.mapServer}knowledge/sources`),e=t?t.sources||[]:[];let r="";for(const n of e)n&&r===""&&(r=n);return r},loadPathData:async function(t){const e=await this.query(`select entity, knowledge from knowledge
449
450
  where entity like 'ilxtr:%' and source=?
450
451
  order by entity`,[t]);return e?e.values:[]},setPathList:async function(t){this.pathList.length||(this.pathList=await this.loadPathData(t),sessionStorage.setItem("connectivity-graph-pathlist",JSON.stringify(this.pathList)),this.updateCacheExpiry()),this.knowledgeByPath.clear(),this.labelledTerms=new Set;for(const[e,r]of this.pathList){const n=JSON.parse(r);"connectivity"in n&&(this.knowledgeByPath.set(e,n),this.cacheLabels(n))}return this.labelCache.size||await this.getCachedTermLabels(),""},getSchemaVersion:async function(){const t=await this.getJsonData(`${this.mapServer}knowledge/schema-version`);return t&&+t.version||0},getJsonData:async function(t){try{const e=await fetch(t,{method:"GET",headers:{Accept:"application/json; charset=utf-8","Cache-Control":"no-store","Content-Type":"application/json"}});return e.ok||console.error(`Cannot access ${t}`),await e.json()}catch{return null}},getCachedTermLabels:async function(){if(this.labelledTerms.size){const t=await this.query(`
451
452
  select entity, label from labels
452
- where entity in (?${", ?".repeat(this.labelledTerms.size-1)})`,[...this.labelledTerms.values()]);for(const r of t.values)this.labelCache.set(r[0],r[1]);const e=Object.fromEntries(this.labelCache);sessionStorage.setItem("connectivity-graph-labels",JSON.stringify(e)),this.updateCacheExpiry()}},cacheNodeLabels:function(t){for(const e of[t[0],...t[1]])this.labelledTerms.add(e)},cacheLabels:async function(t){for(const e of t.connectivity)this.cacheNodeLabels(e[0]),this.cacheNodeLabels(e[1])},showSpinner:function(){this.loading=!0},hideSpinner:function(){this.loading=!1},reset:function(){this.connectivityGraph.reset()},toggleZoom:function(){this.zoomEnabled=!this.zoomEnabled,this.zoomLockLabel=this.zoomEnabled?AP:fg,this.connectivityGraph.enableZoom(!this.zoomEnabled)}}},$P={class:"connectivity-graph"},zP={ref:"graphCanvas",class:"graph-canvas"},HP={class:"control-panel"},KP=s.createStaticVNode('<div class="node-key" data-v-ec98b14b><div class="key-head" data-v-ec98b14b>Node type:</div><div data-v-ec98b14b><div data-v-ec98b14b><span data-v-ec98b14b>Node:</span><span class="key-box" style="background:#80F0F0;" data-v-ec98b14b></span></div><div data-v-ec98b14b><span data-v-ec98b14b>Axon:</span><span class="key-box" style="background:green;" data-v-ec98b14b></span></div><div data-v-ec98b14b><span data-v-ec98b14b>Dendrite:</span><span class="key-box" style="background:red;" data-v-ec98b14b></span></div><div data-v-ec98b14b><span data-v-ec98b14b>Both:</span><span class="key-box" style="background:gray;" data-v-ec98b14b></span></div></div></div>',1),qP={class:"tools"},UP={class:"visually-hidden"},GP={class:"visually-hidden"};function WP(t,e,r,n,a,i){const o=M1,l=yt,u=Ar,c=si,d=rb,f=ob,p=Fl;return s.withDirectives((s.openBlock(),s.createElementBlock("div",$P,[s.createElementVNode("div",zP,null,512),s.createElementVNode("div",HP,[KP,s.createElementVNode("div",qP,[s.createVNode(c,{content:t.resetLabel,placement:"bottom",effect:"control-tooltip"},{default:s.withCtx(()=>[s.createVNode(u,{class:s.normalizeClass(["control-button",t.theme]),size:"small",onClick:i.reset},{default:s.withCtx(()=>[s.createVNode(l,{color:"white"},{default:s.withCtx(()=>[s.createVNode(o)]),_:1}),s.createElementVNode("span",UP,s.toDisplayString(t.resetLabel),1)]),_:1},8,["class","onClick"])]),_:1},8,["content"]),s.createVNode(c,{content:t.zoomLockLabel,placement:"bottom",effect:"control-tooltip"},{default:s.withCtx(()=>[s.createVNode(u,{class:s.normalizeClass(["control-button",t.theme]),size:"small",onClick:i.toggleZoom},{default:s.withCtx(()=>[s.createVNode(l,{color:"white"},{default:s.withCtx(()=>[t.zoomEnabled?(s.openBlock(),s.createBlock(d,{key:0})):(s.openBlock(),s.createBlock(f,{key:1}))]),_:1}),s.createElementVNode("span",GP,s.toDisplayString(t.zoomLockLabel),1)]),_:1},8,["class","onClick"])]),_:1},8,["content"])])])])),[[p,t.loading]])}const jP=yr(RP,[["render",WP],["__scopeId","data-v-ec98b14b"]]);Ke.ConnectivityGraph=jP,Ke.CopyToClipboard=ZS,Ke.DrawToolbar=NE,Ke.HelpModeDialog=FE,Ke.Tooltip=FS,Ke.TreeControls=US,Object.defineProperty(Ke,Symbol.toStringTag,{value:"Module"})});
453
+ where entity in (?${", ?".repeat(this.labelledTerms.size-1)})`,[...this.labelledTerms.values()]);for(const r of t.values)this.labelCache.set(r[0],r[1]);const e=Object.fromEntries(this.labelCache);sessionStorage.setItem("connectivity-graph-labels",JSON.stringify(e)),this.updateCacheExpiry()}},cacheNodeLabels:function(t){for(const e of[t[0],...t[1]])this.labelledTerms.add(e)},cacheLabels:async function(t){for(const e of t.connectivity)this.cacheNodeLabels(e[0]),this.cacheNodeLabels(e[1])},showSpinner:function(){this.loading=!0},hideSpinner:function(){this.loading=!1},reset:function(){this.connectivityGraph.reset()},toggleZoom:function(){this.zoomEnabled=!this.zoomEnabled,this.zoomLockLabel=this.zoomEnabled?AP:fg,this.connectivityGraph.enableZoom(!this.zoomEnabled)}}},$P={class:"connectivity-graph"},zP={ref:"graphCanvas",class:"graph-canvas"},HP={class:"control-panel"},KP=s.createStaticVNode('<div class="node-key" data-v-d620c023><div class="key-head" data-v-d620c023>Node type:</div><div data-v-d620c023><div data-v-d620c023><span data-v-d620c023>Node:</span><span class="key-box" style="background:#80F0F0;" data-v-d620c023></span></div><div data-v-d620c023><span data-v-d620c023>Axon:</span><span class="key-box" style="background:green;" data-v-d620c023></span></div><div data-v-d620c023><span data-v-d620c023>Dendrite:</span><span class="key-box" style="background:red;" data-v-d620c023></span></div><div data-v-d620c023><span data-v-d620c023>Both:</span><span class="key-box" style="background:gray;" data-v-d620c023></span></div></div></div>',1),qP={class:"tools"},UP={class:"visually-hidden"},GP={class:"visually-hidden"};function WP(t,e,r,n,a,i){const o=M1,l=yt,u=Ar,c=si,d=rb,f=ob,p=Fl;return s.withDirectives((s.openBlock(),s.createElementBlock("div",$P,[s.createElementVNode("div",zP,null,512),s.createElementVNode("div",HP,[KP,s.createElementVNode("div",qP,[s.createVNode(c,{content:t.resetLabel,placement:"bottom",effect:"control-tooltip"},{default:s.withCtx(()=>[s.createVNode(u,{class:s.normalizeClass(["control-button",t.theme]),size:"small",onClick:i.reset},{default:s.withCtx(()=>[s.createVNode(l,{color:"white"},{default:s.withCtx(()=>[s.createVNode(o)]),_:1}),s.createElementVNode("span",UP,s.toDisplayString(t.resetLabel),1)]),_:1},8,["class","onClick"])]),_:1},8,["content"]),s.createVNode(c,{content:t.zoomLockLabel,placement:"bottom",effect:"control-tooltip"},{default:s.withCtx(()=>[s.createVNode(u,{class:s.normalizeClass(["control-button",t.theme]),size:"small",onClick:i.toggleZoom},{default:s.withCtx(()=>[s.createVNode(l,{color:"white"},{default:s.withCtx(()=>[t.zoomEnabled?(s.openBlock(),s.createBlock(d,{key:0})):(s.openBlock(),s.createBlock(f,{key:1}))]),_:1}),s.createElementVNode("span",GP,s.toDisplayString(t.zoomLockLabel),1)]),_:1},8,["class","onClick"])]),_:1},8,["content"])])])])),[[p,t.loading]])}const jP=yr(RP,[["render",WP],["__scopeId","data-v-d620c023"]]);Ke.ConnectivityGraph=jP,Ke.CopyToClipboard=ZS,Ke.DrawToolbar=NE,Ke.HelpModeDialog=FE,Ke.Tooltip=FS,Ke.TreeControls=US,Object.defineProperty(Ke,Symbol.toStringTag,{value:"Module"})});