c.y2)},IK=function(e,t,n,i){n-=i;var a=t*t-4*e*n;if(a<0)return[];var o=Math.sqrt(a),s=2*e,u=(-t+o)/s,l=(-t-o)/s;return[u,l]},NK=function(e,t,n,i,a){var o=1e-5;e===0&&(e=o),t/=e,n/=e,i/=e;var s,u,l,c,f,d,h,p;if(u=(3*n-t*t)/9,l=-(27*i)+t*(9*n-2*(t*t)),l/=54,s=u*u*u+l*l,a[1]=0,h=t/3,s>0){f=l+Math.sqrt(s),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),d=l-Math.sqrt(s),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),a[0]=-h+f+d,h+=(f+d)/2,a[4]=a[2]=-h,h=Math.sqrt(3)*(-d+f)/2,a[3]=h,a[5]=-h;return}if(a[5]=a[3]=0,s===0){p=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),a[0]=-h+2*p,a[4]=a[2]=-(p+h);return}u=-u,c=u*u*u,c=Math.acos(l/Math.sqrt(c)),p=2*Math.sqrt(u),a[0]=-h+p*Math.cos(c/3),a[2]=-h+p*Math.cos((c+2*Math.PI)/3),a[4]=-h+p*Math.cos((c+4*Math.PI)/3)},LK=function(e,t,n,i,a,o,s,u){var l=1*n*n-4*n*a+2*n*s+4*a*a-4*a*s+s*s+i*i-4*i*o+2*i*u+4*o*o-4*o*u+u*u,c=9*n*a-3*n*n-3*n*s-6*a*a+3*a*s+9*i*o-3*i*i-3*i*u-6*o*o+3*o*u,f=3*n*n-6*n*a+n*s-n*e+2*a*a+2*a*e-s*e+3*i*i-6*i*o+i*u-i*t+2*o*o+2*o*t-u*t,d=1*n*a-n*n+n*e-a*e+i*o-i*i+i*t-o*t,h=[];NK(l,c,f,d,h);for(var p=1e-7,g=[],y=0;y<6;y+=2)Math.abs(h[y+1])=0&&h[y]<=1&&g.push(h[y]);g.push(1),g.push(0);for(var b=-1,_,m,x,E=0;E=0?xl?(e-a)*(e-a)+(t-o)*(t-o):c-d},Cc=function(e,t,n){for(var i,a,o,s,u,l=0,c=0;c=e&&e>=o||i<=e&&e<=o)u=(e-i)/(o-i)*(s-a)+a,u>t&&l++;else continue;return l%2!==0},pv=function(e,t,n,i,a,o,s,u,l){var c=new Array(n.length),f;u[0]!=null?(f=Math.atan(u[1]/u[0]),u[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=u;for(var d=Math.cos(-f),h=Math.sin(-f),p=0;p0){var y=Ix(c,-l);g=kx(y)}else g=c;return Cc(e,t,g)},BK=function(e,t,n,i,a,o,s,u){for(var l=new Array(n.length*2),c=0;c=0&&y<=1&&_.push(y),b>=0&&b<=1&&_.push(b),_.length===0)return[];var m=_[0]*u[0]+e,x=_[0]*u[1]+t;if(_.length>1){if(_[0]==_[1])return[m,x];var E=_[1]*u[0]+e,O=_[1]*u[1]+t;return[m,x,E,O]}else return[m,x]},kS=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},gp=function(e,t,n,i,a,o,s,u,l){var c=e-a,f=n-e,d=s-a,h=t-o,p=i-t,g=u-o,y=d*h-g*c,b=f*h-p*c,_=g*f-d*p;if(_!==0){var m=y/_,x=b/_,E=.001,O=0-E,S=1+E;return O<=m&&m<=S&&O<=x&&x<=S?[e+m*f,t+m*p]:l?[e+m*f,t+m*p]:[]}else return y===0||b===0?kS(e,n,s)===s?[s,u]:kS(e,n,a)===a?[a,o]:kS(a,s,n)===n?[n,i]:[]:[]},UK=function(e,t,n,i,a){var o=[],s=i/2,u=a/2,l=t,c=n;o.push({x:l+s*e[0],y:c+u*e[1]});for(var f=1;f0){var g=Ix(f,-u);h=kx(g)}else h=f}else h=n;for(var y,b,_,m,x=0;x2){for(var p=[c[0],c[1]],g=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),y=1;yc&&(c=x)},get:function(m){return l[m]}},d=0;d0?z=j.edgesTo(B)[0]:z=B.edgesTo(j)[0];var H=i(z);B=B.id(),S[B]>S[k]+H&&(S[B]=S[k]+H,T.nodes.indexOf(B)<0?T.push(B):T.updateItem(B),O[B]=0,E[B]=[]),S[B]==S[k]+H&&(O[B]=O[B]+O[k],E[B].push(k))}else for(var q=0;q0;){for(var X=x.pop(),Z=0;Z0&&s.push(n[u]);s.length!==0&&a.push(i.collection(s))}return a},tZ=function(e,t){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:iZ,s=i,u,l,c=0;c=2?q0(e,t,n,0,LI,aZ):q0(e,t,n,0,NI)},squaredEuclidean:function(e,t,n){return q0(e,t,n,0,LI)},manhattan:function(e,t,n){return q0(e,t,n,0,NI)},max:function(e,t,n){return q0(e,t,n,-1/0,oZ)}};Bm["squared-euclidean"]=Bm.squaredEuclidean;Bm.squaredeuclidean=Bm.squaredEuclidean;function M2(r,e,t,n,i,a){var o;return Ya(r)?o=r:o=Bm[r]||Bm.euclidean,e===0&&Ya(r)?o(i,a):o(e,t,n,i,a)}var sZ=du({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),tD=function(e){return sZ(e)},Nx=function(e,t,n,i,a){var o=a!=="kMedoids",s=o?function(f){return n[f]}:function(f){return i[f](n)},u=function(d){return i[d](t)},l=n,c=t;return M2(e,i.length,s,u,l,c)},NS=function(e,t,n){for(var i=n.length,a=new Array(i),o=new Array(i),s=new Array(t),u=null,l=0;ln)return!1}return!0},cZ=function(e,t,n){for(var i=0;is&&(s=t[l][c],u=c);a[u].push(e[l])}for(var f=0;f=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var p=t[o],g=t[i[o]],y;a.mode==="dendrogram"?y={left:p,right:g,key:p.key}:y={value:p.value.concat(g.value),key:p.key},e[p.index]=y,e.splice(g.index,1),t[p.key]=y;for(var b=0;bn[g.key][_.key]&&(u=n[g.key][_.key])):a.linkage==="max"?(u=n[p.key][_.key],n[p.key][_.key]0&&i.push(a);return i},qI=function(e,t,n){for(var i=[],a=0;as&&(o=l,s=t[a*e+l])}o>0&&i.push(o)}for(var c=0;cl&&(u=c,l=f)}n[a]=o[u]}return i=qI(e,t,n),i},GI=function(e){for(var t=this.cy(),n=this.nodes(),i=xZ(e),a={},o=0;o=k?(L=k,k=j,B=z):j>L&&(L=j);for(var H=0;H0?1:0;S[P%i.minIterations*s+Z]=ue,X+=ue}if(X>0&&(P>=i.minIterations-1||P==i.maxIterations-1)){for(var re=0,ne=0;ne1||O>1)&&(s=!0),f[m]=[],_.outgoers().forEach(function(T){T.isEdge()&&f[m].push(T.id())})}else d[m]=[void 0,_.target().id()]}):o.forEach(function(_){var m=_.id();if(_.isNode()){var x=_.degree(!0);x%2&&(u?l?s=!0:l=m:u=m),f[m]=[],_.connectedEdges().forEach(function(E){return f[m].push(E.id())})}else d[m]=[_.source().id(),_.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(l&&u)if(a){if(c&&l!=c)return h;c=l}else{if(c&&l!=c&&u!=c)return h;c||(c=l)}else c||(c=o[0].id());var p=function(m){for(var x=m,E=[m],O,S,T;f[x].length;)O=f[x].shift(),S=d[O][0],T=d[O][1],x!=T?(f[T]=f[T].filter(function(P){return P!=O}),x=T):!a&&x!=S&&(f[S]=f[S].filter(function(P){return P!=O}),x=S),E.unshift(O),E.unshift(x);return E},g=[],y=[];for(y=p(c);y.length!=1;)f[y[0]].length==0?(g.unshift(o.getElementById(y.shift())),g.unshift(o.getElementById(y.shift()))):y=p(y.shift()).concat(y);g.unshift(o.getElementById(y.shift()));for(var b in f)if(f[b].length)return h;return h.found=!0,h.trail=this.spawn(g,!0),h}},vw=function(){var e=this,t={},n=0,i=0,a=[],o=[],s={},u=function(d,h){for(var p=o.length-1,g=[],y=e.spawn();o[p].x!=d||o[p].y!=h;)g.push(o.pop().edge),p--;g.push(o.pop().edge),g.forEach(function(b){var _=b.connectedNodes().intersection(e);y.merge(b),_.forEach(function(m){var x=m.id(),E=m.connectedEdges().intersection(e);y.merge(m),t[x].cutVertex?y.merge(E.filter(function(O){return O.isLoop()})):y.merge(E)})}),a.push(y)},l=function(d,h,p){d===p&&(i+=1),t[h]={id:n,low:n++,cutVertex:!1};var g=e.getElementById(h).connectedEdges().intersection(e);if(g.size()===0)a.push(e.spawn(e.getElementById(h)));else{var y,b,_,m;g.forEach(function(x){y=x.source().id(),b=x.target().id(),_=y===h?b:y,_!==p&&(m=x.id(),s[m]||(s[m]=!0,o.push({x:h,y:_,edge:x})),_ in t?t[h].low=Math.min(t[h].low,t[_].id):(l(d,_,h),t[h].low=Math.min(t[h].low,t[_].low),t[h].id<=t[_].low&&(t[h].cutVertex=!0,u(h,_))))})}};e.forEach(function(f){if(f.isNode()){var d=f.id();d in t||(i=0,l(d,d),t[d].cutVertex=i>1)}});var c=Object.keys(t).filter(function(f){return t[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(c),components:a}},PZ={hopcroftTarjanBiconnected:vw,htbc:vw,htb:vw,hopcroftTarjanBiconnectedComponents:vw},pw=function(){var e=this,t={},n=0,i=[],a=[],o=e.spawn(e),s=function(l){a.push(l),t[l]={index:n,low:n++,explored:!1};var c=e.getElementById(l).connectedEdges().intersection(e);if(c.forEach(function(g){var y=g.target().id();y!==l&&(y in t||s(y),t[y].explored||(t[l].low=Math.min(t[l].low,t[y].low)))}),t[l].index===t[l].low){for(var f=e.spawn();;){var d=a.pop();if(f.merge(e.getElementById(d)),t[d].low=t[l].index,t[d].explored=!0,d===l)break}var h=f.edgesWith(f),p=f.merge(h);i.push(p),o=o.difference(p)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||s(l)}}),{cut:o,components:i}},MZ={tarjanStronglyConnected:pw,tsc:pw,tscc:pw,tarjanStronglyConnectedComponents:pw},xF={};[m1,sK,uK,cK,dK,vK,yK,VK,xm,Em,vM,nZ,gZ,_Z,CZ,RZ,PZ,MZ].forEach(function(r){kr(xF,r)});/*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
-*/var EF=0,SF=1,OF=2,Pd=function(e){if(!(this instanceof Pd))return new Pd(e);this.id="Thenable/1.0.7",this.state=EF,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))};Pd.prototype={fulfill:function(e){return GI(this,SF,"fulfillValue",e)},reject:function(e){return GI(this,OF,"rejectReason",e)},then:function(e,t){var n=this,i=new Pd;return n.onFulfilled.push(HI(e,i,"fulfill")),n.onRejected.push(HI(t,i,"reject")),TF(n),i.proxy}};var GI=function(e,t,n,i){return e.state===EF&&(e.state=t,e[n]=i,TF(e)),e},TF=function(e){e.state===SF?VI(e,"onFulfilled",e.fulfillValue):e.state===OF&&VI(e,"onRejected",e.rejectReason)},VI=function(e,t,n){if(e[t].length!==0){var i=e[t];e[t]=[];var a=function(){for(var s=0;s0}},clearQueue:function(){return function(){var t=this,n=t.length!==void 0,i=n?t:[t],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var o=0;o-1}return nO=e,nO}var iO,vN;function KZ(){if(vN)return iO;vN=1;var r=I2();function e(t,n){var i=this.__data__,a=r(i,t);return a<0?(++this.size,i.push([t,n])):i[a][1]=n,this}return iO=e,iO}var aO,pN;function ZZ(){if(pN)return aO;pN=1;var r=WZ(),e=YZ(),t=XZ(),n=$Z(),i=KZ();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s-1&&n%1==0&&n0&&this.spawn(i).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){ra(e)||(e=e.match(/\S+/g)||[]);for(var n=this,i=t===void 0,a=[],o=0,s=n.length;o0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Zw.className=Zw.classNames=Zw.classes;var ni={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:ls,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};ni.variable="(?:[\\w-.]|(?:\\\\"+ni.metaChar+"))+";ni.className="(?:[\\w-]|(?:\\\\"+ni.metaChar+"))+";ni.value=ni.string+"|"+ni.number;ni.id=ni.variable;(function(){var r,e,t;for(r=ni.comparatorOp.split("|"),t=0;t=0)&&e!=="="&&(ni.comparatorOp+="|\\!"+e)})();var Vi=function(){return{checks:[]}},nr={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},yM=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(r,e){return O$(r.selector,e.selector)}),AQ=(function(){for(var r={},e,t=0;t0&&c.edgeCount>0)return Ai("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return Ai("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;c.edgeCount===1&&Ai("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},IQ=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(c){return c??""},t=function(c){return Ar(c)?'"'+c+'"':e(c)},n=function(c){return" "+c+" "},i=function(c,f){var d=c.type,h=c.value;switch(d){case nr.GROUP:{var p=e(h);return p.substring(0,p.length-1)}case nr.DATA_COMPARE:{var g=c.field,y=c.operator;return"["+g+n(e(y))+t(h)+"]"}case nr.DATA_BOOL:{var b=c.operator,_=c.field;return"["+e(b)+_+"]"}case nr.DATA_EXIST:{var m=c.field;return"["+m+"]"}case nr.META_COMPARE:{var x=c.operator,E=c.field;return"[["+E+n(e(x))+t(h)+"]]"}case nr.STATE:return h;case nr.ID:return"#"+h;case nr.CLASS:return"."+h;case nr.PARENT:case nr.CHILD:return a(c.parent,f)+n(">")+a(c.child,f);case nr.ANCESTOR:case nr.DESCENDANT:return a(c.ancestor,f)+" "+a(c.descendant,f);case nr.COMPOUND_SPLIT:{var O=a(c.left,f),S=a(c.subject,f),T=a(c.right,f);return O+(O.length>0?" ":"")+S+T}case nr.TRUE:return""}},a=function(c,f){return c.checks.reduce(function(d,h,p){return d+(f===c&&p===0?"$":"")+i(h,f)},"")},o="",s=0;s1&&s=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),c=!0),(a||s||c)&&(u=!a&&!o?"":""+e,l=""+n),c&&(e=u=u.toLowerCase(),n=l=l.toLowerCase()),t){case"*=":i=u.indexOf(l)>=0;break;case"$=":i=u.indexOf(l,u.length-l.length)>=0;break;case"^=":i=u.indexOf(l)===0;break;case"=":i=e===n;break;case">":d=!0,i=e>n;break;case">=":d=!0,i=e>=n;break;case"<":d=!0,i=e0;){var c=i.shift();e(c),a.add(c.id()),s&&n(i,a,c)}return r}function IF(r,e,t){if(t.isParent())for(var n=t._private.children,i=0;i1&&arguments[1]!==void 0?arguments[1]:!0;return iD(this,r,e,IF)};function NF(r,e,t){if(t.isChild()){var n=t._private.parent;e.has(n.id())||r.push(n)}}Fm.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return iD(this,r,e,NF)};function qQ(r,e,t){NF(r,e,t),IF(r,e,t)}Fm.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return iD(this,r,e,qQ)};Fm.ancestors=Fm.parents;var w1,LF;w1=LF={data:Ci.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:Ci.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ci.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ci.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ci.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ci.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};w1.attr=w1.data;w1.removeAttr=w1.removeData;var GQ=LF,L2={};function kO(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var n=0,i=t[0],a=i._private.edges,o=0;oe}),minIndegree:Ky("indegree",function(r,e){return re}),minOutdegree:Ky("outdegree",function(r,e){return re})});kr(L2,{totalDegree:function(e){for(var t=0,n=this.nodes(),i=0;i0,d=f;f&&(c=c[0]);var h=d?c.position():{x:0,y:0};t!==void 0?l.position(e,t+h[e]):a!==void 0&&l.position({x:a.x+h.x,y:a.y+h.y})}else{var p=n.position(),g=s?n.parent():null,y=g&&g.length>0,b=y;y&&(g=g[0]);var _=b?g.position():{x:0,y:0};return a={x:p.x-_.x,y:p.y-_.y},e===void 0?a:a[e]}else if(!o)return;return this}};Cd.modelPosition=Cd.point=Cd.position;Cd.modelPositions=Cd.points=Cd.positions;Cd.renderedPoint=Cd.renderedPosition;Cd.relativePoint=Cd.relativePosition;var VQ=jF,Sm,Gp;Sm=Gp={};Gp.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),n=t.zoom(),i=t.pan(),a=e.x1*n+i.x,o=e.x2*n+i.x,s=e.y1*n+i.y,u=e.y2*n+i.y;return{x1:a,x2:o,y1:s,y2:u,w:o-a,h:u-s}};Gp.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};Gp.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",c={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:l,includeOverlays:!1,useCache:!1}),d=s.position;(f.w===0||f.h===0)&&(f={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},f.x1=d.x-f.w/2,f.x2=d.x+f.w/2,f.y1=d.y-f.h/2,f.y2=d.y+f.h/2);function h(P,I,k){var L=0,B=0,j=I+k;return P>0&&j>0&&(L=I/j*P,B=k/j*P),{biasDiff:L,biasComplementDiff:B}}function p(P,I,k,L){if(k.units==="%")switch(L){case"width":return P>0?k.pfValue*P:0;case"height":return I>0?k.pfValue*I:0;case"average":return P>0&&I>0?k.pfValue*(P+I)/2:0;case"min":return P>0&&I>0?P>I?k.pfValue*I:k.pfValue*P:0;case"max":return P>0&&I>0?P>I?k.pfValue*P:k.pfValue*I:0;default:return 0}else return k.units==="px"?k.pfValue:0}var g=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(g=g*100/c.width.val);var y=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(y=y*100/c.width.val);var b=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(b=b*100/c.height.val);var _=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(_=_*100/c.height.val);var m=h(c.width.val-f.w,g,y),x=m.biasDiff,E=m.biasComplementDiff,O=h(c.height.val-f.h,b,_),S=O.biasDiff,T=O.biasComplementDiff;s.autoPadding=p(f.w,f.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(f.w,c.width.val),d.x=(-x+f.x1+f.x2+E)/2,s.autoHeight=Math.max(f.h,c.height.val),d.y=(-S+f.y1+f.y2+T)/2}for(var n=0;ne.x2?i:e.x2,e.y1=ne.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},cp=function(e,t){return t==null?e:xd(e,t.x1,t.y1,t.x2,t.y2)},G0=function(e,t,n){return Tc(e,t,n)},gw=function(e,t,n){if(!t.cy().headless()){var i=t._private,a=i.rstyle,o=a.arrowWidth/2,s=t.pstyle(n+"-arrow-shape").value,u,l;if(s!=="none"){n==="source"?(u=a.srcX,l=a.srcY):n==="target"?(u=a.tgtX,l=a.tgtY):(u=a.midX,l=a.midY);var c=i.arrowBounds=i.arrowBounds||{},f=c[n]=c[n]||{};f.x1=u-o,f.y1=l-o,f.x2=u+o,f.y2=l+o,f.w=f.x2-f.x1,f.h=f.y2-f.y1,$w(f,1),xd(e,f.x1,f.y1,f.x2,f.y2)}}},IO=function(e,t,n){if(!t.cy().headless()){var i;n?i=n+"-":i="";var a=t._private,o=a.rstyle,s=t.pstyle(i+"label").strValue;if(s){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),c=G0(o,"labelWidth",n),f=G0(o,"labelHeight",n),d=G0(o,"labelX",n),h=G0(o,"labelY",n),p=t.pstyle(i+"text-margin-x").pfValue,g=t.pstyle(i+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle(i+"text-rotation"),_=t.pstyle("text-outline-width").pfValue,m=t.pstyle("text-border-width").pfValue,x=m/2,E=t.pstyle("text-background-padding").pfValue,O=2,S=f,T=c,P=T/2,I=S/2,k,L,B,j;if(y)k=d-P,L=d+P,B=h-I,j=h+I;else{switch(u.value){case"left":k=d-T,L=d;break;case"center":k=d-P,L=d+P;break;case"right":k=d,L=d+T;break}switch(l.value){case"top":B=h-S,j=h;break;case"center":B=h-I,j=h+I;break;case"bottom":B=h,j=h+S;break}}var z=p-Math.max(_,x)-E-O,H=p+Math.max(_,x)+E+O,q=g-Math.max(_,x)-E-O,W=g+Math.max(_,x)+E+O;k+=z,L+=H,B+=q,j+=W;var $=n||"main",J=a.labelBounds,X=J[$]=J[$]||{};X.x1=k,X.y1=B,X.x2=L,X.y2=j,X.w=L-k,X.h=j-B,X.leftPad=z,X.rightPad=H,X.topPad=q,X.botPad=W;var Z=y&&b.strValue==="autorotate",ue=b.pfValue!=null&&b.pfValue!==0;if(Z||ue){var re=Z?G0(a.rstyle,"labelAngle",n):b.pfValue,ne=Math.cos(re),le=Math.sin(re),ce=(k+L)/2,pe=(B+j)/2;if(!y){switch(u.value){case"left":ce=L;break;case"right":ce=k;break}switch(l.value){case"top":pe=j;break;case"bottom":pe=B;break}}var fe=function(Ce,Y){return Ce=Ce-ce,Y=Y-pe,{x:Ce*ne-Y*le+ce,y:Ce*le+Y*ne+pe}},se=fe(k,B),de=fe(k,j),ge=fe(L,B),Oe=fe(L,j);k=Math.min(se.x,de.x,ge.x,Oe.x),L=Math.max(se.x,de.x,ge.x,Oe.x),B=Math.min(se.y,de.y,ge.y,Oe.y),j=Math.max(se.y,de.y,ge.y,Oe.y)}var ke=$+"Rot",De=J[ke]=J[ke]||{};De.x1=k,De.y1=B,De.x2=L,De.y2=j,De.w=L-k,De.h=j-B,xd(e,k,B,L,j),xd(a.labelBounds.all,k,B,L,j)}return e}},VN=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,i=t.pstyle("outline-width").value,a=t.pstyle("outline-offset").value,o=i+a;FF(e,t,n,o,"outside",o/2)}},FF=function(e,t,n,i,a,o){if(!(n===0||i<=0||a==="inside")){var s=t.cy(),u=t.pstyle("shape").value,l=s.renderer().nodeShapes[u],c=t.position(),f=c.x,d=c.y,h=t.width(),p=t.height();if(l.hasMiterBounds){a==="center"&&(i/=2);var g=l.miterBounds(f,d,h,p,i);cp(e,g)}else o!=null&&o>0&&Kw(e,[o,o,o,o])}},HQ=function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,i=t.pstyle("border-width").pfValue,a=t.pstyle("border-position").value;FF(e,t,n,i,a)}},WQ=function(e,t){var n=e._private.cy,i=n.styleEnabled(),a=n.headless(),o=ql(),s=e._private,u=e.isNode(),l=e.isEdge(),c,f,d,h,p,g,y=s.rstyle,b=u&&i?e.pstyle("bounds-expansion").pfValue:[0],_=function(Ne){return Ne.pstyle("display").value!=="none"},m=!i||_(e)&&(!l||_(e.source())&&_(e.target()));if(m){var x=0,E=0;i&&t.includeOverlays&&(x=e.pstyle("overlay-opacity").value,x!==0&&(E=e.pstyle("overlay-padding").value));var O=0,S=0;i&&t.includeUnderlays&&(O=e.pstyle("underlay-opacity").value,O!==0&&(S=e.pstyle("underlay-padding").value));var T=Math.max(E,S),P=0,I=0;if(i&&(P=e.pstyle("width").pfValue,I=P/2),u&&t.includeNodes){var k=e.position();p=k.x,g=k.y;var L=e.outerWidth(),B=L/2,j=e.outerHeight(),z=j/2;c=p-B,f=p+B,d=g-z,h=g+z,xd(o,c,d,f,h),i&&VN(o,e),i&&t.includeOutlines&&!a&&VN(o,e),i&&HQ(o,e)}else if(l&&t.includeEdges)if(i&&!a){var H=e.pstyle("curve-style").strValue;if(c=Math.min(y.srcX,y.midX,y.tgtX),f=Math.max(y.srcX,y.midX,y.tgtX),d=Math.min(y.srcY,y.midY,y.tgtY),h=Math.max(y.srcY,y.midY,y.tgtY),c-=I,f+=I,d-=I,h+=I,xd(o,c,d,f,h),H==="haystack"){var q=y.haystackPts;if(q&&q.length===2){if(c=q[0].x,d=q[0].y,f=q[1].x,h=q[1].y,c>f){var W=c;c=f,f=W}if(d>h){var $=d;d=h,h=$}xd(o,c-I,d-I,f+I,h+I)}}else if(H==="bezier"||H==="unbundled-bezier"||vp(H,"segments")||vp(H,"taxi")){var J;switch(H){case"bezier":case"unbundled-bezier":J=y.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":J=y.linePts;break}if(J!=null)for(var X=0;Xf){var ce=c;c=f,f=ce}if(d>h){var pe=d;d=h,h=pe}c-=I,f+=I,d-=I,h+=I,xd(o,c,d,f,h)}if(i&&t.includeEdges&&l&&(gw(o,e,"mid-source"),gw(o,e,"mid-target"),gw(o,e,"source"),gw(o,e,"target")),i){var fe=e.pstyle("ghost").value==="yes";if(fe){var se=e.pstyle("ghost-offset-x").pfValue,de=e.pstyle("ghost-offset-y").pfValue;xd(o,o.x1+se,o.y1+de,o.x2+se,o.y2+de)}}var ge=s.bodyBounds=s.bodyBounds||{};RI(ge,o),Kw(ge,b),$w(ge,1),i&&(c=o.x1,f=o.x2,d=o.y1,h=o.y2,xd(o,c-T,d-T,f+T,h+T));var Oe=s.overlayBounds=s.overlayBounds||{};RI(Oe,o),Kw(Oe,b),$w(Oe,1);var ke=s.labelBounds=s.labelBounds||{};ke.all!=null?CK(ke.all):ke.all=ql(),i&&t.includeLabels&&(t.includeMainLabels&&IO(o,e,null),l&&(t.includeSourceLabels&&IO(o,e,"source"),t.includeTargetLabels&&IO(o,e,"target")))}return o.x1=If(o.x1),o.y1=If(o.y1),o.x2=If(o.x2),o.y2=If(o.y2),o.w=If(o.x2-o.x1),o.h=If(o.y2-o.y1),o.w>0&&o.h>0&&m&&(Kw(o,b),$w(o,1)),o},UF=function(e){var t=0,n=function(o){return(o?1:0)<0}},clearQueue:function(){return function(){var t=this,n=t.length!==void 0,i=n?t:[t],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var o=0;o-1}return nO=e,nO}var iO,pN;function KZ(){if(pN)return iO;pN=1;var r=I2();function e(t,n){var i=this.__data__,a=r(i,t);return a<0?(++this.size,i.push([t,n])):i[a][1]=n,this}return iO=e,iO}var aO,gN;function ZZ(){if(gN)return aO;gN=1;var r=WZ(),e=YZ(),t=XZ(),n=$Z(),i=KZ();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s-1&&n%1==0&&n0&&this.spawn(i).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){ra(e)||(e=e.match(/\S+/g)||[]);for(var n=this,i=t===void 0,a=[],o=0,s=n.length;o0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Zw.className=Zw.classNames=Zw.classes;var ni={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:ls,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};ni.variable="(?:[\\w-.]|(?:\\\\"+ni.metaChar+"))+";ni.className="(?:[\\w-]|(?:\\\\"+ni.metaChar+"))+";ni.value=ni.string+"|"+ni.number;ni.id=ni.variable;(function(){var r,e,t;for(r=ni.comparatorOp.split("|"),t=0;t=0)&&e!=="="&&(ni.comparatorOp+="|\\!"+e)})();var Vi=function(){return{checks:[]}},nr={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},mM=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(r,e){return O$(r.selector,e.selector)}),AQ=(function(){for(var r={},e,t=0;t0&&c.edgeCount>0)return Ai("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return Ai("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;c.edgeCount===1&&Ai("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},IQ=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(c){return c??""},t=function(c){return Ar(c)?'"'+c+'"':e(c)},n=function(c){return" "+c+" "},i=function(c,f){var d=c.type,h=c.value;switch(d){case nr.GROUP:{var p=e(h);return p.substring(0,p.length-1)}case nr.DATA_COMPARE:{var g=c.field,y=c.operator;return"["+g+n(e(y))+t(h)+"]"}case nr.DATA_BOOL:{var b=c.operator,_=c.field;return"["+e(b)+_+"]"}case nr.DATA_EXIST:{var m=c.field;return"["+m+"]"}case nr.META_COMPARE:{var x=c.operator,E=c.field;return"[["+E+n(e(x))+t(h)+"]]"}case nr.STATE:return h;case nr.ID:return"#"+h;case nr.CLASS:return"."+h;case nr.PARENT:case nr.CHILD:return a(c.parent,f)+n(">")+a(c.child,f);case nr.ANCESTOR:case nr.DESCENDANT:return a(c.ancestor,f)+" "+a(c.descendant,f);case nr.COMPOUND_SPLIT:{var O=a(c.left,f),S=a(c.subject,f),T=a(c.right,f);return O+(O.length>0?" ":"")+S+T}case nr.TRUE:return""}},a=function(c,f){return c.checks.reduce(function(d,h,p){return d+(f===c&&p===0?"$":"")+i(h,f)},"")},o="",s=0;s1&&s=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),c=!0),(a||s||c)&&(u=!a&&!o?"":""+e,l=""+n),c&&(e=u=u.toLowerCase(),n=l=l.toLowerCase()),t){case"*=":i=u.indexOf(l)>=0;break;case"$=":i=u.indexOf(l,u.length-l.length)>=0;break;case"^=":i=u.indexOf(l)===0;break;case"=":i=e===n;break;case">":d=!0,i=e>n;break;case">=":d=!0,i=e>=n;break;case"<":d=!0,i=e0;){var c=i.shift();e(c),a.add(c.id()),s&&n(i,a,c)}return r}function IF(r,e,t){if(t.isParent())for(var n=t._private.children,i=0;i1&&arguments[1]!==void 0?arguments[1]:!0;return aD(this,r,e,IF)};function NF(r,e,t){if(t.isChild()){var n=t._private.parent;e.has(n.id())||r.push(n)}}Fm.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return aD(this,r,e,NF)};function qQ(r,e,t){NF(r,e,t),IF(r,e,t)}Fm.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return aD(this,r,e,qQ)};Fm.ancestors=Fm.parents;var w1,LF;w1=LF={data:Ci.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:Ci.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ci.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ci.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ci.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ci.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};w1.attr=w1.data;w1.removeAttr=w1.removeData;var GQ=LF,L2={};function kO(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var n=0,i=t[0],a=i._private.edges,o=0;o