m&&(O.dx*=m/_,O.dy*=m/_),S.fromGraph(r,C)?O.fixed=!0:(O.x+=O.dx,O.y+=O.dy,O.fixed=!1)}return{converged:x}},am}var pd={},xN;function Kj(){return xN||(xN=1,pd.assignLayoutChanges=function(e,t,n){const{nodeXAttribute:r,nodeYAttribute:a}=n;e.updateEachNodeAttributes((i,s)=>{const u=t[i];return!u||u.fixed||(s[r]=u.x,s[a]=u.y),s},{attributes:["x","y"]})},pd.collectLayoutChanges=function(e){const t={};for(const n in e){const r=e[n];t[n]={x:r.x,y:r.y}}return t}),pd}var im,kN;function Xj(){return kN||(kN=1,im={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),im}var om,TN;function Dee(){if(TN)return om;TN=1;const e=ra(),t=Fu(),n=Yj(),r=Kj(),a=Xj();function i(u,c,d){if(!e(c))throw new Error("graphology-layout-force: the given graph is not a valid graphology instance.");typeof d=="number"?d={maxIterations:d}:d=d||{};const p=d.maxIterations;if(d=t(d,a),typeof p!="number"||p<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");const g={};let m=null,b;for(b=0;bthis.runFrame())},i.prototype.stop=function(){return this.running=!1,this.frameID!==null&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},i.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},i.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0},sm=i,sm}var Fee=Mee();const Pee=ln(Fee);function zee(e={maxIterations:100}){return js(Lee,e)}function Bee(e={}){return U0(Pee,e)}var lm,_N;function Uee(){if(_N)return lm;_N=1;var e=0,t=1,n=2,r=3,a=4,i=5,s=6,u=7,c=8,d=9,p=0,g=1,m=2,b=0,v=1,S=2,k=3,R=4,x=5,A=6,C=7,O=8,_=3,N=10,P=3,I=9,L=10;return lm=function($,U,W){var Y,j,G,z,K,D,V,B,M,X,Q=U.length,le=W.length,re=$.adjustSizes,se=$.barnesHutTheta*$.barnesHutTheta,Te,ae,we,xe,Ie,Ce,Ee,J=[];for(G=0;GNe?(me-=(he-Ne)/2,ve=me+he):(fe-=(Ne-he)/2,ke=fe+Ne),J[0+b]=-1,J[0+v]=(fe+ke)/2,J[0+S]=(me+ve)/2,J[0+k]=Math.max(ke-fe,ve-me),J[0+R]=-1,J[0+x]=-1,J[0+A]=0,J[0+C]=0,J[0+O]=0,Y=1,G=0;G=0){U[G+e]=0)if(Ce=Math.pow(U[G+e]-J[j+C],2)+Math.pow(U[G+t]-J[j+O],2),X=J[j+k],4*X*X/Ce0?(Ee=ae*U[G+s]*J[j+A]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce<0&&(Ee=-ae*U[G+s]*J[j+A]/Math.sqrt(Ce),U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce>0&&(Ee=ae*U[G+s]*J[j+A]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee),j=J[j+R],j<0)break;continue}else{j=J[j+x];continue}else{if(D=J[j+b],D>=0&&D!==G&&(we=U[G+e]-U[D+e],xe=U[G+t]-U[D+t],Ce=we*we+xe*xe,re===!0?Ce>0?(Ee=ae*U[G+s]*U[D+s]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce<0&&(Ee=-ae*U[G+s]*U[D+s]/Math.sqrt(Ce),U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce>0&&(Ee=ae*U[G+s]*U[D+s]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee)),j=J[j+R],j<0)break;continue}else for(ae=$.scalingRatio,z=0;z0?(Ee=ae*U[z+s]*U[K+s]/Ce/Ce,U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee):Ce<0&&(Ee=100*ae*U[z+s]*U[K+s],U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee)):(Ce=Math.sqrt(we*we+xe*xe),Ce>0&&(Ee=ae*U[z+s]*U[K+s]/Ce/Ce,U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee));for(M=$.gravity/$.scalingRatio,ae=$.scalingRatio,G=0;G0&&(Ee=ae*U[G+s]*M):Ce>0&&(Ee=ae*U[G+s]*M/Ce),U[G+n]-=we*Ee,U[G+r]-=xe*Ee;for(ae=1*($.outboundAttractionDistribution?Te:1),V=0;V0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce/U[z+s]):Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce):$.outboundAttractionDistribution?Ce>0&&(Ee=-ae*Ie/U[z+s]):Ce>0&&(Ee=-ae*Ie)):(Ce=Math.sqrt(Math.pow(we,2)+Math.pow(xe,2)),$.linLogMode?$.outboundAttractionDistribution?Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce/U[z+s]):Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce):$.outboundAttractionDistribution?(Ce=1,Ee=-ae*Ie/U[z+s]):(Ce=1,Ee=-ae*Ie)),Ce>0&&(U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee);var ee,ce,Re,Fe,Ve,yt;if(re===!0)for(G=0;GL&&(U[G+n]=U[G+n]*L/ee,U[G+r]=U[G+r]*L/ee),ce=U[G+s]*Math.sqrt((U[G+a]-U[G+n])*(U[G+a]-U[G+n])+(U[G+i]-U[G+r])*(U[G+i]-U[G+r])),Re=Math.sqrt((U[G+a]+U[G+n])*(U[G+a]+U[G+n])+(U[G+i]+U[G+r])*(U[G+i]+U[G+r]))/2,Fe=.1*Math.log(1+Re)/(1+Math.sqrt(ce)),Ve=U[G+e]+U[G+n]*(Fe/$.slowDown),U[G+e]=Ve,yt=U[G+t]+U[G+r]*(Fe/$.slowDown),U[G+t]=yt);else for(G=0;G=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},_a.graphToByteArrays=function(n,r){var a=n.order,i=n.size,s={},u,c=new Float32Array(a*e),d=new Float32Array(i*t);return u=0,n.forEachNode(function(p,g){s[p]=u,c[u]=g.x,c[u+1]=g.y,c[u+2]=0,c[u+3]=0,c[u+4]=0,c[u+5]=0,c[u+6]=1,c[u+7]=1,c[u+8]=g.size||1,c[u+9]=g.fixed?1:0,u+=e}),u=0,n.forEachEdge(function(p,g,m,b,v,S,k){var R=s[m],x=s[b],A=r(p,g,m,b,v,S,k);c[R+6]+=A,c[x+6]+=A,d[u]=R,d[u+1]=x,d[u+2]=A,u+=t}),{nodes:c,edges:d}},_a.assignLayoutChanges=function(n,r,a){var i=0;n.updateEachNodeAttributes(function(s,u){return u.x=r[i],u.y=r[i+1],i+=e,a?a(s,u):u})},_a.readGraphPositions=function(n,r){var a=0;n.forEachNode(function(i,s){r[a]=s.x,r[a+1]=s.y,a+=e})},_a.collectLayoutChanges=function(n,r,a){for(var i=n.nodes(),s={},u=0,c=0,d=r.length;u2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(d)}}var u=i.bind(null,!1);return u.assign=i.bind(null,!0),u.inferSettings=s,cm=u,cm}var Gee=jee();const Hee=ln(Gee);var dm,ON;function $ee(){return ON||(ON=1,dm=function(){var t,n,r={};(function(){var i=0,s=1,u=2,c=3,d=4,p=5,g=6,m=7,b=8,v=9,S=0,k=1,R=2,x=0,A=1,C=2,O=3,_=4,N=5,P=6,I=7,L=8,H=3,$=10,U=3,W=9,Y=10;r.exports=function(G,z,K){var D,V,B,M,X,Q,le,re,se,Te,ae=z.length,we=K.length,xe=G.adjustSizes,Ie=G.barnesHutTheta*G.barnesHutTheta,Ce,Ee,J,fe,ke,me,ve,oe=[];for(B=0;BVe?(he-=(Fe-Ve)/2,Ne=he+Fe):(Pe-=(Ve-Fe)/2,ze=Pe+Ve),oe[0+x]=-1,oe[0+A]=(Pe+ze)/2,oe[0+C]=(he+Ne)/2,oe[0+O]=Math.max(ze-Pe,Ne-he),oe[0+_]=-1,oe[0+N]=-1,oe[0+P]=0,oe[0+I]=0,oe[0+L]=0,D=1,B=0;B=0){z[B+i]=0)if(me=Math.pow(z[B+i]-oe[V+I],2)+Math.pow(z[B+s]-oe[V+L],2),Te=oe[V+O],4*Te*Te/me0?(ve=Ee*z[B+g]*oe[V+P]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve):me<0&&(ve=-Ee*z[B+g]*oe[V+P]/Math.sqrt(me),z[B+u]+=J*ve,z[B+c]+=fe*ve):me>0&&(ve=Ee*z[B+g]*oe[V+P]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve),V=oe[V+_],V<0)break;continue}else{V=oe[V+N];continue}else{if(Q=oe[V+x],Q>=0&&Q!==B&&(J=z[B+i]-z[Q+i],fe=z[B+s]-z[Q+s],me=J*J+fe*fe,xe===!0?me>0?(ve=Ee*z[B+g]*z[Q+g]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve):me<0&&(ve=-Ee*z[B+g]*z[Q+g]/Math.sqrt(me),z[B+u]+=J*ve,z[B+c]+=fe*ve):me>0&&(ve=Ee*z[B+g]*z[Q+g]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve)),V=oe[V+_],V<0)break;continue}else for(Ee=G.scalingRatio,M=0;M0?(ve=Ee*z[M+g]*z[X+g]/me/me,z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve):me<0&&(ve=100*Ee*z[M+g]*z[X+g],z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve)):(me=Math.sqrt(J*J+fe*fe),me>0&&(ve=Ee*z[M+g]*z[X+g]/me/me,z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve));for(se=G.gravity/G.scalingRatio,Ee=G.scalingRatio,B=0;B0&&(ve=Ee*z[B+g]*se):me>0&&(ve=Ee*z[B+g]*se/me),z[B+u]-=J*ve,z[B+c]-=fe*ve;for(Ee=1*(G.outboundAttractionDistribution?Ce:1),le=0;le0&&(ve=-Ee*ke*Math.log(1+me)/me/z[M+g]):me>0&&(ve=-Ee*ke*Math.log(1+me)/me):G.outboundAttractionDistribution?me>0&&(ve=-Ee*ke/z[M+g]):me>0&&(ve=-Ee*ke)):(me=Math.sqrt(Math.pow(J,2)+Math.pow(fe,2)),G.linLogMode?G.outboundAttractionDistribution?me>0&&(ve=-Ee*ke*Math.log(1+me)/me/z[M+g]):me>0&&(ve=-Ee*ke*Math.log(1+me)/me):G.outboundAttractionDistribution?(me=1,ve=-Ee*ke/z[M+g]):(me=1,ve=-Ee*ke)),me>0&&(z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve);var yt,wt,ht,Je,xt,at;if(xe===!0)for(B=0;BY&&(z[B+u]=z[B+u]*Y/yt,z[B+c]=z[B+c]*Y/yt),wt=z[B+g]*Math.sqrt((z[B+d]-z[B+u])*(z[B+d]-z[B+u])+(z[B+p]-z[B+c])*(z[B+p]-z[B+c])),ht=Math.sqrt((z[B+d]+z[B+u])*(z[B+d]+z[B+u])+(z[B+p]+z[B+c])*(z[B+p]+z[B+c]))/2,Je=.1*Math.log(1+ht)/(1+Math.sqrt(wt)),xt=z[B+i]+z[B+u]*(Je/G.slowDown),z[B+i]=xt,at=z[B+s]+z[B+c]*(Je/G.slowDown),z[B+s]=at);else for(B=0;B1&&we.has(ve))&&(z>1&&we.add(ve),Ee=c[Ie+e],fe=c[Ie+t],me=c[Ie+n],oe=Ee-Ce,Pe=fe-J,ze=Math.sqrt(oe*oe+Pe*Pe),he=ze0?(N[Ie]+=oe/ze*(1+ke),P[Ie]+=Pe/ze*(1+ke)):(N[Ie]+=U*i(),P[Ie]+=W*i())));for(v=0,S=0;v1&&Ee.has(he))&&(B>1&&Ee.add(he),me=m[fe+a],oe=m[fe+i],ze=m[fe+s],Ne=me-ke,ee=oe-ve,ce=Math.sqrt(Ne*Ne+ee*ee),Re=ce0?(H[fe]+=Ne/ce*(1+Pe),$[fe]+=ee/ce*(1+Pe)):(H[fe]+=G*d(),$[fe]+=z*d())));for(x=0,A=0;x=0;)g=bk(e,t,n,r,d+1,i+1,s),g>p&&(d===a?g*=UN:gte.test(e.charAt(d-1))?(g*=cte,b=e.slice(a,d-1).match(hte),b&&a>0&&(g*=Math.pow(Sm,b.length))):mte.test(e.charAt(d-1))?(g*=ute,v=e.slice(a,d-1).match(n4),v&&a>0&&(g*=Math.pow(Sm,v.length))):(g*=dte,a>0&&(g*=Math.pow(Sm,d-a))),e.charAt(d)!==t.charAt(i)&&(g*=fte)),(gg&&(g=m*vm)),g>p&&(p=g),d=n.indexOf(c,d+1);return s[u]=p,p}function jN(e){return e.toLowerCase().replace(n4," ")}function bte(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,bk(e,t,jN(e),jN(t),0,0,{})}var Em={exports:{}},wm={};/**
+`);return a}var Wj=.25,wee={arrowHead:null,curvatureAttribute:"curvature",defaultCurvature:Wj},Yj=WebGLRenderingContext,hN=Yj.UNSIGNED_BYTE,di=Yj.FLOAT;function U0(e){var t=sf(sf({},wee),e||{}),n=t,r=n.arrowHead,a=n.curvatureAttribute,i=n.drawLabel,s=(r==null?void 0:r.extremity)==="target"||(r==null?void 0:r.extremity)==="both",u=(r==null?void 0:r.extremity)==="source"||(r==null?void 0:r.extremity)==="both",c=["u_matrix","u_sizeRatio","u_dimensions","u_pixelRatio","u_feather","u_minEdgeThickness"].concat(Jh(r?["u_lengthToThicknessRatio","u_widenessToThicknessRatio"]:[]));return function(d){pee(p,d);function p(){var g;lee(this,p);for(var m=arguments.length,b=new Array(m),S=0;S{const n=this.nodeIdMap[t];if(n!==void 0)return this.nodes[n]});Ta(this,"getEdge",(t,n=!0)=>{const r=n?this.edgeDynamicIdMap[t]:this.edgeIdMap[t];if(r!==void 0)return this.edges[r]});Ta(this,"buildDynamicMap",()=>{this.edgeDynamicIdMap={};for(let t=0;t({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,moveToSelectedNode:!1,isFetching:!1,shouldRender:!1,graphDataFetchAttempted:!1,labelsFetchAttempted:!1,rawGraph:null,sigmaGraph:null,graphLabels:["*"],allDatabaseLabels:["*"],refreshLayout:()=>{const n=t().sigmaGraph;n&&(t().clearSelection(),t().setSigmaGraph(null),setTimeout(()=>{t().setSigmaGraph(n)},10))},setIsFetching:n=>e({isFetching:n}),setShouldRender:n=>e({shouldRender:n}),setSelectedNode:(n,r)=>e({selectedNode:n,moveToSelectedNode:r}),setFocusedNode:n=>e({focusedNode:n}),setSelectedEdge:n=>e({selectedEdge:n}),setFocusedEdge:n=>e({focusedEdge:n}),clearSelection:()=>e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null}),reset:()=>{const n=t().sigmaGraph;n&&Array.from(n.nodes()).forEach(a=>n.dropNode(a)),e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,rawGraph:null,graphLabels:["*"],moveToSelectedNode:!1,shouldRender:!1})},setRawGraph:n=>e({rawGraph:n}),setSigmaGraph:n=>{e({sigmaGraph:n})},setGraphLabels:n=>e({graphLabels:n}),setAllDatabaseLabels:n=>e({allDatabaseLabels:n}),fetchAllDatabaseLabels:async()=>{try{console.log("Fetching all database labels...");const n=await J8();e({allDatabaseLabels:["*",...n]});return}catch(n){throw console.error("Failed to fetch all database labels:",n),e({allDatabaseLabels:["*"]}),n}},setMoveToSelectedNode:n=>e({moveToSelectedNode:n}),setGraphDataFetchAttempted:n=>e({graphDataFetchAttempted:n}),setLabelsFetchAttempted:n=>e({labelsFetchAttempted:n})})),Je=Wk(Aee),_ee=({node:e,move:t})=>{const n=Er(),{gotoNode:r}=Lj();return T.useEffect(()=>(t?(e?(n.getGraph().setNodeAttribute(e,"highlighted",!0),r(e)):(n.setCustomBBox(null),n.getCamera().animate({x:.5,y:.5,ratio:1},{duration:0})),Je.getState().setMoveToSelectedNode(!1)):e&&n.getGraph().setNodeAttribute(e,"highlighted",!0),()=>{e&&n.getGraph().setNodeAttribute(e,"highlighted",!1)}),[e,t,n,r]),null};function Gs(e,t){const n=Er(),r=T.useRef(t);return Mu(r.current,t)||(r.current=t),{positions:T.useCallback(()=>r.current?e(n.getGraph(),r.current):{},[n,r,e]),assign:T.useCallback(()=>{r.current&&e.assign(n.getGraph(),r.current)},[n,r,e])}}function j0(e,t){const n=Er(),[r,a]=T.useState(!1),[i,s]=T.useState(null),u=T.useRef(t);return Mu(u.current,t)||(u.current=t),T.useEffect(()=>{a(!1);let c=null;return u.current&&(c=new e(n.getGraph(),u.current)),s(c),()=>{c!==null&&c.kill()}},[n,u,s,a,e]),{stop:T.useCallback(()=>{i&&(i.stop(),a(!1))},[i,a]),start:T.useCallback(()=>{i&&(i.start(),a(!0))},[i,a]),kill:T.useCallback(()=>{i&&i.kill(),a(!1)},[i,a]),isRunning:r}}var em,mN;function Fu(){if(mN)return em;mN=1;function e(n){return!n||typeof n!="object"||typeof n=="function"||Array.isArray(n)||n instanceof Set||n instanceof Map||n instanceof RegExp||n instanceof Date}function t(n,r){n=n||{};var a={};for(var i in r){var s=n[i],u=r[i];if(!e(u)){a[i]=t(s,u);continue}s===void 0?a[i]=u:a[i]=s}return a}return em=t,em}var tm,bN;function Ree(){if(bN)return tm;bN=1;function e(n){return function(r,a){return r+Math.floor(n()*(a-r+1))}}var t=e(Math.random);return t.createRandom=e,tm=t,tm}var nm,yN;function Cee(){if(yN)return nm;yN=1;var e=Ree().createRandom;function t(r){var a=e(r);return function(i){for(var s=i.length,u=s-1,c=-1;++c0},a.prototype.addChild=function(C,F){this.children[C]=F,++this.countChildren},a.prototype.getChild=function(C){if(!this.children.hasOwnProperty(C)){var F=new a;this.children[C]=F,++this.countChildren}return this.children[C]},a.prototype.applyPositionToChildren=function(){if(this.hasChildren()){var C=this;for(var F in C.children){var I=C.children[F];I.x+=C.x,I.y+=C.y,I.applyPositionToChildren()}}};function i(C,F,I){for(var L in F.children){var H=F.children[L];H.hasChildren()?i(C,H,I):I[H.id]={x:H.x,y:H.y}}}function s(C,F){var I=C.r-F.r,L=F.x-C.x,H=F.y-C.y;return I<0||I*I0&&I*I>L*L+H*H}function c(C,F){for(var I=0;IY?(H=(j+Y-$)/(2*j),W=Math.sqrt(Math.max(0,Y/j-H*H)),I.x=C.x-H*L-W*U,I.y=C.y-H*U+W*L):(H=(j+$-Y)/(2*j),W=Math.sqrt(Math.max(0,$/j-H*H)),I.x=F.x+H*L-W*U,I.y=F.y+H*U+W*L)):(I.x=F.x+I.r,I.y=F.y)}function R(C,F){var I=C.r+F.r-1e-6,L=F.x-C.x,H=F.y-C.y;return I>0&&I*I>L*L+H*H}function x(C,F){var I=C.length;if(I===0)return 0;var L,H,$,U,W,Y,j,G,z,K;if(L=C[0],L.x=0,L.y=0,I<=1)return L.r;if(H=C[1],L.x=-H.r,H.x=L.r,H.y=0,I<=2)return L.r+H.r;$=C[2],k(H,L,$),L=new a(null,null,null,null,L),H=new a(null,null,null,null,H),$=new a(null,null,null,null,$),L.next=$.previous=H,H.next=L.previous=$,$.next=H.previous=L;e:for(Y=3;Y"u"?a:d};typeof a=="function"&&(s=a);var u=function(d){return s(d[r])},c=function(){return s(void 0)};return typeof r=="string"?(i.fromAttributes=u,i.fromGraph=function(d,p){return u(d.getNodeAttributes(p))},i.fromEntry=function(d,p){return u(p)}):typeof r=="function"?(i.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},i.fromGraph=function(d,p){return s(r(p,d.getNodeAttributes(p)))},i.fromEntry=function(d,p){return s(r(d,p))}):(i.fromAttributes=c,i.fromGraph=c,i.fromEntry=c),i}function n(r,a){var i={},s=function(d){return typeof d>"u"?a:d};typeof a=="function"&&(s=a);var u=function(d){return s(d[r])},c=function(){return s(void 0)};return typeof r=="string"?(i.fromAttributes=u,i.fromGraph=function(d,p){return u(d.getEdgeAttributes(p))},i.fromEntry=function(d,p){return u(p)},i.fromPartialEntry=i.fromEntry,i.fromMinimalEntry=i.fromEntry):typeof r=="function"?(i.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},i.fromGraph=function(d,p){var g=d.extremities(p);return s(r(p,d.getEdgeAttributes(p),g[0],g[1],d.getNodeAttributes(g[0]),d.getNodeAttributes(g[1]),d.isUndirected(p)))},i.fromEntry=function(d,p,g,m,b,S,v){return s(r(d,p,g,m,b,S,v))},i.fromPartialEntry=function(d,p,g,m){return s(r(d,p,g,m))},i.fromMinimalEntry=function(d,p){return s(r(d,p))}):(i.fromAttributes=c,i.fromGraph=c,i.fromEntry=c,i.fromMinimalEntry=c),i}return Xl.createNodeValueGetter=t,Xl.createEdgeValueGetter=n,Xl.createEdgeWeightGetter=function(r){return n(r,e)},Xl}var im,wN;function Kj(){if(wN)return im;wN=1;const{createNodeValueGetter:e,createEdgeValueGetter:t}=G0();return im=function(r,a,i){const{nodeXAttribute:s,nodeYAttribute:u}=i,{attraction:c,repulsion:d,gravity:p,inertia:g,maxMove:m}=i.settings;let{shouldSkipNode:b,shouldSkipEdge:S,isNodeFixed:v}=i;v=e(v),b=e(b,!1),S=t(S,!1);const k=r.filterNodes((A,N)=>!b.fromEntry(A,N)),R=k.length;for(let A=0;A{if(O===_||b.fromEntry(O,C)||b.fromEntry(_,F)||S.fromEntry(A,N,O,_,C,F,I))return;const L=a[O],H=a[_],$=H.x-L.x,U=H.y-L.y,W=Math.sqrt($*$+U*U)||1,Y=c*W*$,j=c*W*U;L.dx+=Y,L.dy+=j,H.dx-=Y,H.dy-=j}),p)for(let A=0;Am&&(O.dx*=m/_,O.dy*=m/_),v.fromGraph(r,N)?O.fixed=!0:(O.x+=O.dx,O.y+=O.dy,O.fixed=!1)}return{converged:x}},im}var pd={},xN;function Xj(){return xN||(xN=1,pd.assignLayoutChanges=function(e,t,n){const{nodeXAttribute:r,nodeYAttribute:a}=n;e.updateEachNodeAttributes((i,s)=>{const u=t[i];return!u||u.fixed||(s[r]=u.x,s[a]=u.y),s},{attributes:["x","y"]})},pd.collectLayoutChanges=function(e){const t={};for(const n in e){const r=e[n];t[n]={x:r.x,y:r.y}}return t}),pd}var om,kN;function Zj(){return kN||(kN=1,om={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),om}var sm,TN;function zee(){if(TN)return sm;TN=1;const e=ra(),t=Fu(),n=Kj(),r=Xj(),a=Zj();function i(u,c,d){if(!e(c))throw new Error("graphology-layout-force: the given graph is not a valid graphology instance.");typeof d=="number"?d={maxIterations:d}:d=d||{};const p=d.maxIterations;if(d=t(d,a),typeof p!="number"||p<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");const g={};let m=null,b;for(b=0;bthis.runFrame())},i.prototype.stop=function(){return this.running=!1,this.frameID!==null&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},i.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},i.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0},lm=i,lm}var Gee=jee();const Hee=ln(Gee);function $ee(e={maxIterations:100}){return Gs(Uee,e)}function qee(e={}){return j0(Hee,e)}var um,_N;function Vee(){if(_N)return um;_N=1;var e=0,t=1,n=2,r=3,a=4,i=5,s=6,u=7,c=8,d=9,p=0,g=1,m=2,b=0,S=1,v=2,k=3,R=4,x=5,A=6,N=7,O=8,_=3,C=10,F=3,I=9,L=10;return um=function($,U,W){var Y,j,G,z,K,D,V,B,M,X,Q=U.length,le=W.length,re=$.adjustSizes,se=$.barnesHutTheta*$.barnesHutTheta,Te,ae,we,xe,Ie,Ce,Ee,J=[];for(G=0;GNe?(me-=(he-Ne)/2,ve=me+he):(fe-=(Ne-he)/2,ke=fe+Ne),J[0+b]=-1,J[0+S]=(fe+ke)/2,J[0+v]=(me+ve)/2,J[0+k]=Math.max(ke-fe,ve-me),J[0+R]=-1,J[0+x]=-1,J[0+A]=0,J[0+N]=0,J[0+O]=0,Y=1,G=0;G=0){U[G+e]=0)if(Ce=Math.pow(U[G+e]-J[j+N],2)+Math.pow(U[G+t]-J[j+O],2),X=J[j+k],4*X*X/Ce0?(Ee=ae*U[G+s]*J[j+A]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce<0&&(Ee=-ae*U[G+s]*J[j+A]/Math.sqrt(Ce),U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce>0&&(Ee=ae*U[G+s]*J[j+A]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee),j=J[j+R],j<0)break;continue}else{j=J[j+x];continue}else{if(D=J[j+b],D>=0&&D!==G&&(we=U[G+e]-U[D+e],xe=U[G+t]-U[D+t],Ce=we*we+xe*xe,re===!0?Ce>0?(Ee=ae*U[G+s]*U[D+s]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce<0&&(Ee=-ae*U[G+s]*U[D+s]/Math.sqrt(Ce),U[G+n]+=we*Ee,U[G+r]+=xe*Ee):Ce>0&&(Ee=ae*U[G+s]*U[D+s]/Ce,U[G+n]+=we*Ee,U[G+r]+=xe*Ee)),j=J[j+R],j<0)break;continue}else for(ae=$.scalingRatio,z=0;z0?(Ee=ae*U[z+s]*U[K+s]/Ce/Ce,U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee):Ce<0&&(Ee=100*ae*U[z+s]*U[K+s],U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee)):(Ce=Math.sqrt(we*we+xe*xe),Ce>0&&(Ee=ae*U[z+s]*U[K+s]/Ce/Ce,U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee));for(M=$.gravity/$.scalingRatio,ae=$.scalingRatio,G=0;G0&&(Ee=ae*U[G+s]*M):Ce>0&&(Ee=ae*U[G+s]*M/Ce),U[G+n]-=we*Ee,U[G+r]-=xe*Ee;for(ae=1*($.outboundAttractionDistribution?Te:1),V=0;V0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce/U[z+s]):Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce):$.outboundAttractionDistribution?Ce>0&&(Ee=-ae*Ie/U[z+s]):Ce>0&&(Ee=-ae*Ie)):(Ce=Math.sqrt(Math.pow(we,2)+Math.pow(xe,2)),$.linLogMode?$.outboundAttractionDistribution?Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce/U[z+s]):Ce>0&&(Ee=-ae*Ie*Math.log(1+Ce)/Ce):$.outboundAttractionDistribution?(Ce=1,Ee=-ae*Ie/U[z+s]):(Ce=1,Ee=-ae*Ie)),Ce>0&&(U[z+n]+=we*Ee,U[z+r]+=xe*Ee,U[K+n]-=we*Ee,U[K+r]-=xe*Ee);var ee,ce,Re,Fe,Ve,yt;if(re===!0)for(G=0;GL&&(U[G+n]=U[G+n]*L/ee,U[G+r]=U[G+r]*L/ee),ce=U[G+s]*Math.sqrt((U[G+a]-U[G+n])*(U[G+a]-U[G+n])+(U[G+i]-U[G+r])*(U[G+i]-U[G+r])),Re=Math.sqrt((U[G+a]+U[G+n])*(U[G+a]+U[G+n])+(U[G+i]+U[G+r])*(U[G+i]+U[G+r]))/2,Fe=.1*Math.log(1+Re)/(1+Math.sqrt(ce)),Ve=U[G+e]+U[G+n]*(Fe/$.slowDown),U[G+e]=Ve,yt=U[G+t]+U[G+r]*(Fe/$.slowDown),U[G+t]=yt);else for(G=0;G=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},_a.graphToByteArrays=function(n,r){var a=n.order,i=n.size,s={},u,c=new Float32Array(a*e),d=new Float32Array(i*t);return u=0,n.forEachNode(function(p,g){s[p]=u,c[u]=g.x,c[u+1]=g.y,c[u+2]=0,c[u+3]=0,c[u+4]=0,c[u+5]=0,c[u+6]=1,c[u+7]=1,c[u+8]=g.size||1,c[u+9]=g.fixed?1:0,u+=e}),u=0,n.forEachEdge(function(p,g,m,b,S,v,k){var R=s[m],x=s[b],A=r(p,g,m,b,S,v,k);c[R+6]+=A,c[x+6]+=A,d[u]=R,d[u+1]=x,d[u+2]=A,u+=t}),{nodes:c,edges:d}},_a.assignLayoutChanges=function(n,r,a){var i=0;n.updateEachNodeAttributes(function(s,u){return u.x=r[i],u.y=r[i+1],i+=e,a?a(s,u):u})},_a.readGraphPositions=function(n,r){var a=0;n.forEachNode(function(i,s){r[a]=s.x,r[a+1]=s.y,a+=e})},_a.collectLayoutChanges=function(n,r,a){for(var i=n.nodes(),s={},u=0,c=0,d=r.length;u2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(d)}}var u=i.bind(null,!1);return u.assign=i.bind(null,!0),u.inferSettings=s,dm=u,dm}var Yee=Wee();const Kee=ln(Yee);var fm,ON;function Xee(){return ON||(ON=1,fm=function(){var t,n,r={};(function(){var i=0,s=1,u=2,c=3,d=4,p=5,g=6,m=7,b=8,S=9,v=0,k=1,R=2,x=0,A=1,N=2,O=3,_=4,C=5,F=6,I=7,L=8,H=3,$=10,U=3,W=9,Y=10;r.exports=function(G,z,K){var D,V,B,M,X,Q,le,re,se,Te,ae=z.length,we=K.length,xe=G.adjustSizes,Ie=G.barnesHutTheta*G.barnesHutTheta,Ce,Ee,J,fe,ke,me,ve,oe=[];for(B=0;BVe?(he-=(Fe-Ve)/2,Ne=he+Fe):(Pe-=(Ve-Fe)/2,ze=Pe+Ve),oe[0+x]=-1,oe[0+A]=(Pe+ze)/2,oe[0+N]=(he+Ne)/2,oe[0+O]=Math.max(ze-Pe,Ne-he),oe[0+_]=-1,oe[0+C]=-1,oe[0+F]=0,oe[0+I]=0,oe[0+L]=0,D=1,B=0;B=0){z[B+i]=0)if(me=Math.pow(z[B+i]-oe[V+I],2)+Math.pow(z[B+s]-oe[V+L],2),Te=oe[V+O],4*Te*Te/me0?(ve=Ee*z[B+g]*oe[V+F]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve):me<0&&(ve=-Ee*z[B+g]*oe[V+F]/Math.sqrt(me),z[B+u]+=J*ve,z[B+c]+=fe*ve):me>0&&(ve=Ee*z[B+g]*oe[V+F]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve),V=oe[V+_],V<0)break;continue}else{V=oe[V+C];continue}else{if(Q=oe[V+x],Q>=0&&Q!==B&&(J=z[B+i]-z[Q+i],fe=z[B+s]-z[Q+s],me=J*J+fe*fe,xe===!0?me>0?(ve=Ee*z[B+g]*z[Q+g]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve):me<0&&(ve=-Ee*z[B+g]*z[Q+g]/Math.sqrt(me),z[B+u]+=J*ve,z[B+c]+=fe*ve):me>0&&(ve=Ee*z[B+g]*z[Q+g]/me,z[B+u]+=J*ve,z[B+c]+=fe*ve)),V=oe[V+_],V<0)break;continue}else for(Ee=G.scalingRatio,M=0;M0?(ve=Ee*z[M+g]*z[X+g]/me/me,z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve):me<0&&(ve=100*Ee*z[M+g]*z[X+g],z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve)):(me=Math.sqrt(J*J+fe*fe),me>0&&(ve=Ee*z[M+g]*z[X+g]/me/me,z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve));for(se=G.gravity/G.scalingRatio,Ee=G.scalingRatio,B=0;B0&&(ve=Ee*z[B+g]*se):me>0&&(ve=Ee*z[B+g]*se/me),z[B+u]-=J*ve,z[B+c]-=fe*ve;for(Ee=1*(G.outboundAttractionDistribution?Ce:1),le=0;le0&&(ve=-Ee*ke*Math.log(1+me)/me/z[M+g]):me>0&&(ve=-Ee*ke*Math.log(1+me)/me):G.outboundAttractionDistribution?me>0&&(ve=-Ee*ke/z[M+g]):me>0&&(ve=-Ee*ke)):(me=Math.sqrt(Math.pow(J,2)+Math.pow(fe,2)),G.linLogMode?G.outboundAttractionDistribution?me>0&&(ve=-Ee*ke*Math.log(1+me)/me/z[M+g]):me>0&&(ve=-Ee*ke*Math.log(1+me)/me):G.outboundAttractionDistribution?(me=1,ve=-Ee*ke/z[M+g]):(me=1,ve=-Ee*ke)),me>0&&(z[M+u]+=J*ve,z[M+c]+=fe*ve,z[X+u]-=J*ve,z[X+c]-=fe*ve);var yt,wt,ht,et,xt,it;if(xe===!0)for(B=0;BY&&(z[B+u]=z[B+u]*Y/yt,z[B+c]=z[B+c]*Y/yt),wt=z[B+g]*Math.sqrt((z[B+d]-z[B+u])*(z[B+d]-z[B+u])+(z[B+p]-z[B+c])*(z[B+p]-z[B+c])),ht=Math.sqrt((z[B+d]+z[B+u])*(z[B+d]+z[B+u])+(z[B+p]+z[B+c])*(z[B+p]+z[B+c]))/2,et=.1*Math.log(1+ht)/(1+Math.sqrt(wt)),xt=z[B+i]+z[B+u]*(et/G.slowDown),z[B+i]=xt,it=z[B+s]+z[B+c]*(et/G.slowDown),z[B+s]=it);else for(B=0;B1&&we.has(ve))&&(z>1&&we.add(ve),Ee=c[Ie+e],fe=c[Ie+t],me=c[Ie+n],oe=Ee-Ce,Pe=fe-J,ze=Math.sqrt(oe*oe+Pe*Pe),he=ze0?(C[Ie]+=oe/ze*(1+ke),F[Ie]+=Pe/ze*(1+ke)):(C[Ie]+=U*i(),F[Ie]+=W*i())));for(S=0,v=0;S1&&Ee.has(he))&&(B>1&&Ee.add(he),me=m[fe+a],oe=m[fe+i],ze=m[fe+s],Ne=me-ke,ee=oe-ve,ce=Math.sqrt(Ne*Ne+ee*ee),Re=ce0?(H[fe]+=Ne/ce*(1+Pe),$[fe]+=ee/ce*(1+Pe)):(H[fe]+=G*d(),$[fe]+=z*d())));for(x=0,A=0;x=0;)g=yk(e,t,n,r,d+1,i+1,s),g>p&&(d===a?g*=UN:Ste.test(e.charAt(d-1))?(g*=mte,b=e.slice(a,d-1).match(Ete),b&&a>0&&(g*=Math.pow(Em,b.length))):wte.test(e.charAt(d-1))?(g*=hte,S=e.slice(a,d-1).match(r4),S&&a>0&&(g*=Math.pow(Em,S.length))):(g*=bte,a>0&&(g*=Math.pow(Em,d-a))),e.charAt(d)!==t.charAt(i)&&(g*=yte)),(gg&&(g=m*Sm)),g>p&&(p=g),d=n.indexOf(c,d+1);return s[u]=p,p}function jN(e){return e.toLowerCase().replace(r4," ")}function xte(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,yk(e,t,jN(e),jN(t),0,0,{})}var wm={exports:{}},xm={};/**
* @license React
* use-sync-external-store-shim.production.js
*
@@ -1070,18 +1070,18 @@ void main() {
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var GN;function yte(){if(GN)return wm;GN=1;var e=xf();function t(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function u(g,m){var b=m(),v=r({inst:{value:b,getSnapshot:m}}),S=v[0].inst,k=v[1];return i(function(){S.value=b,S.getSnapshot=m,c(S)&&k({inst:S})},[g,b,m]),a(function(){return c(S)&&k({inst:S}),g(function(){c(S)&&k({inst:S})})},[g]),s(b),b}function c(g){var m=g.getSnapshot;g=g.value;try{var b=m();return!n(g,b)}catch{return!0}}function d(g,m){return m()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:u;return wm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,wm}var HN;function vte(){return HN||(HN=1,Em.exports=yte()),Em.exports}var Ste=vte(),Xl='[cmdk-group=""]',xm='[cmdk-group-items=""]',Ete='[cmdk-group-heading=""]',G0='[cmdk-item=""]',$N=`${G0}:not([aria-disabled="true"])`,yk="cmdk-item-select",to="data-value",wte=(e,t,n)=>bte(e,t,n),r4=T.createContext(void 0),Pu=()=>T.useContext(r4),a4=T.createContext(void 0),H0=()=>T.useContext(a4),i4=T.createContext(void 0),o4=T.forwardRef((e,t)=>{let n=cs(()=>{var B,M;return{search:"",value:(M=(B=e.value)!=null?B:e.defaultValue)!=null?M:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=cs(()=>new Set),a=cs(()=>new Map),i=cs(()=>new Map),s=cs(()=>new Set),u=s4(e),{label:c,children:d,value:p,onValueChange:g,filter:m,shouldFilter:b,loop:v,disablePointerSelection:S=!1,vimBindings:k=!0,...R}=e,x=kn(),A=kn(),C=kn(),O=T.useRef(null),_=Ite();fo(()=>{if(p!==void 0){let B=p.trim();n.current.value=B,N.emit()}},[p]),fo(()=>{_(6,U)},[]);let N=T.useMemo(()=>({subscribe:B=>(s.current.add(B),()=>s.current.delete(B)),snapshot:()=>n.current,setState:(B,M,X)=>{var Q,le,re;if(!Object.is(n.current[B],M)){if(n.current[B]=M,B==="search")$(),L(),_(1,H);else if(B==="value"&&(X||_(5,U),((Q=u.current)==null?void 0:Q.value)!==void 0)){let se=M??"";(re=(le=u.current).onValueChange)==null||re.call(le,se);return}N.emit()}},emit:()=>{s.current.forEach(B=>B())}}),[]),P=T.useMemo(()=>({value:(B,M,X)=>{var Q;M!==((Q=i.current.get(B))==null?void 0:Q.value)&&(i.current.set(B,{value:M,keywords:X}),n.current.filtered.items.set(B,I(M,X)),_(2,()=>{L(),N.emit()}))},item:(B,M)=>(r.current.add(B),M&&(a.current.has(M)?a.current.get(M).add(B):a.current.set(M,new Set([B]))),_(3,()=>{$(),L(),n.current.value||H(),N.emit()}),()=>{i.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let X=W();_(4,()=>{$(),(X==null?void 0:X.getAttribute("id"))===B&&H(),N.emit()})}),group:B=>(a.current.has(B)||a.current.set(B,new Set),()=>{i.current.delete(B),a.current.delete(B)}),filter:()=>u.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:x,inputId:C,labelId:A,listInnerRef:O}),[]);function I(B,M){var X,Q;let le=(Q=(X=u.current)==null?void 0:X.filter)!=null?Q:wte;return B?le(B,n.current.search,M):0}function L(){if(!n.current.search||u.current.shouldFilter===!1)return;let B=n.current.filtered.items,M=[];n.current.filtered.groups.forEach(Q=>{let le=a.current.get(Q),re=0;le.forEach(se=>{let Te=B.get(se);re=Math.max(Te,re)}),M.push([Q,re])});let X=O.current;Y().sort((Q,le)=>{var re,se;let Te=Q.getAttribute("id"),ae=le.getAttribute("id");return((re=B.get(ae))!=null?re:0)-((se=B.get(Te))!=null?se:0)}).forEach(Q=>{let le=Q.closest(xm);le?le.appendChild(Q.parentElement===le?Q:Q.closest(`${xm} > *`)):X.appendChild(Q.parentElement===X?Q:Q.closest(`${xm} > *`))}),M.sort((Q,le)=>le[1]-Q[1]).forEach(Q=>{var le;let re=(le=O.current)==null?void 0:le.querySelector(`${Xl}[${to}="${encodeURIComponent(Q[0])}"]`);re==null||re.parentElement.appendChild(re)})}function H(){let B=Y().find(X=>X.getAttribute("aria-disabled")!=="true"),M=B==null?void 0:B.getAttribute(to);N.setState("value",M||void 0)}function $(){var B,M,X,Q;if(!n.current.search||u.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let le=0;for(let re of r.current){let se=(M=(B=i.current.get(re))==null?void 0:B.value)!=null?M:"",Te=(Q=(X=i.current.get(re))==null?void 0:X.keywords)!=null?Q:[],ae=I(se,Te);n.current.filtered.items.set(re,ae),ae>0&&le++}for(let[re,se]of a.current)for(let Te of se)if(n.current.filtered.items.get(Te)>0){n.current.filtered.groups.add(re);break}n.current.filtered.count=le}function U(){var B,M,X;let Q=W();Q&&(((B=Q.parentElement)==null?void 0:B.firstChild)===Q&&((X=(M=Q.closest(Xl))==null?void 0:M.querySelector(Ete))==null||X.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function W(){var B;return(B=O.current)==null?void 0:B.querySelector(`${G0}[aria-selected="true"]`)}function Y(){var B;return Array.from(((B=O.current)==null?void 0:B.querySelectorAll($N))||[])}function j(B){let M=Y()[B];M&&N.setState("value",M.getAttribute(to))}function G(B){var M;let X=W(),Q=Y(),le=Q.findIndex(se=>se===X),re=Q[le+B];(M=u.current)!=null&&M.loop&&(re=le+B<0?Q[Q.length-1]:le+B===Q.length?Q[0]:Q[le+B]),re&&N.setState("value",re.getAttribute(to))}function z(B){let M=W(),X=M==null?void 0:M.closest(Xl),Q;for(;X&&!Q;)X=B>0?Ote(X,Xl):Dte(X,Xl),Q=X==null?void 0:X.querySelector($N);Q?N.setState("value",Q.getAttribute(to)):G(B)}let K=()=>j(Y().length-1),D=B=>{B.preventDefault(),B.metaKey?K():B.altKey?z(1):G(1)},V=B=>{B.preventDefault(),B.metaKey?j(0):B.altKey?z(-1):G(-1)};return T.createElement(Xe.div,{ref:t,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:B=>{var M;if((M=R.onKeyDown)==null||M.call(R,B),!B.defaultPrevented)switch(B.key){case"n":case"j":{k&&B.ctrlKey&&D(B);break}case"ArrowDown":{D(B);break}case"p":case"k":{k&&B.ctrlKey&&V(B);break}case"ArrowUp":{V(B);break}case"Home":{B.preventDefault(),j(0);break}case"End":{B.preventDefault(),K();break}case"Enter":if(!B.nativeEvent.isComposing&&B.keyCode!==229){B.preventDefault();let X=W();if(X){let Q=new Event(yk);X.dispatchEvent(Q)}}}}},T.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:Mte},c),Qf(e,B=>T.createElement(a4.Provider,{value:N},T.createElement(r4.Provider,{value:P},B))))}),xte=T.forwardRef((e,t)=>{var n,r;let a=kn(),i=T.useRef(null),s=T.useContext(i4),u=Pu(),c=s4(e),d=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:s==null?void 0:s.forceMount;fo(()=>{if(!d)return u.item(a,s==null?void 0:s.id)},[d]);let p=l4(a,i,[e.value,e.children,i],e.keywords),g=H0(),m=po(_=>_.value&&_.value===p.current),b=po(_=>d||u.filter()===!1?!0:_.search?_.filtered.items.get(a)>0:!0);T.useEffect(()=>{let _=i.current;if(!(!_||e.disabled))return _.addEventListener(yk,v),()=>_.removeEventListener(yk,v)},[b,e.onSelect,e.disabled]);function v(){var _,N;S(),(N=(_=c.current).onSelect)==null||N.call(_,p.current)}function S(){g.setState("value",p.current,!0)}if(!b)return null;let{disabled:k,value:R,onSelect:x,forceMount:A,keywords:C,...O}=e;return T.createElement(Xe.div,{ref:gu([i,t]),...O,id:a,"cmdk-item":"",role:"option","aria-disabled":!!k,"aria-selected":!!m,"data-disabled":!!k,"data-selected":!!m,onPointerMove:k||u.getDisablePointerSelection()?void 0:S,onClick:k?void 0:v},e.children)}),kte=T.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...i}=e,s=kn(),u=T.useRef(null),c=T.useRef(null),d=kn(),p=Pu(),g=po(b=>a||p.filter()===!1?!0:b.search?b.filtered.groups.has(s):!0);fo(()=>p.group(s),[]),l4(s,u,[e.value,e.heading,c]);let m=T.useMemo(()=>({id:s,forceMount:a}),[a]);return T.createElement(Xe.div,{ref:gu([u,t]),...i,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&T.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),Qf(e,b=>T.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},T.createElement(i4.Provider,{value:m},b))))}),Tte=T.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=T.useRef(null),i=po(s=>!s.search);return!n&&!i?null:T.createElement(Xe.div,{ref:gu([a,t]),...r,"cmdk-separator":"",role:"separator"})}),Ate=T.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,i=H0(),s=po(p=>p.search),u=po(p=>p.value),c=Pu(),d=T.useMemo(()=>{var p;let g=(p=c.listInnerRef.current)==null?void 0:p.querySelector(`${G0}[${to}="${encodeURIComponent(u)}"]`);return g==null?void 0:g.getAttribute("id")},[]);return T.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),T.createElement(Xe.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":d,id:c.inputId,type:"text",value:a?e.value:s,onChange:p=>{a||i.setState("search",p.target.value),n==null||n(p.target.value)}})}),_te=T.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,i=T.useRef(null),s=T.useRef(null),u=Pu();return T.useEffect(()=>{if(s.current&&i.current){let c=s.current,d=i.current,p,g=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let m=c.offsetHeight;d.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return g.observe(c),()=>{cancelAnimationFrame(p),g.unobserve(c)}}},[]),T.createElement(Xe.div,{ref:gu([i,t]),...a,"cmdk-list":"",role:"listbox","aria-label":r,id:u.listId},Qf(e,c=>T.createElement("div",{ref:gu([s,u.listInnerRef]),"cmdk-list-sizer":""},c)))}),Rte=T.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:i,container:s,...u}=e;return T.createElement(i0,{open:n,onOpenChange:r},T.createElement(o0,{container:s},T.createElement(Mf,{"cmdk-overlay":"",className:a}),T.createElement(Ff,{"aria-label":e.label,"cmdk-dialog":"",className:i},T.createElement(o4,{ref:t,...u}))))}),Cte=T.forwardRef((e,t)=>po(n=>n.filtered.count===0)?T.createElement(Xe.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Nte=T.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...i}=e;return T.createElement(Xe.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Qf(e,s=>T.createElement("div",{"aria-hidden":!0},s)))}),qn=Object.assign(o4,{List:_te,Item:xte,Input:Ate,Group:kte,Separator:Tte,Dialog:Rte,Empty:Cte,Loading:Nte});function Ote(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Dte(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function s4(e){let t=T.useRef(e);return fo(()=>{t.current=e}),t}var fo=typeof window>"u"?T.useEffect:T.useLayoutEffect;function cs(e){let t=T.useRef();return t.current===void 0&&(t.current=e()),t}function gu(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}function po(e){let t=H0(),n=()=>e(t.snapshot());return Ste.useSyncExternalStore(t.subscribe,n,n)}function l4(e,t,n,r=[]){let a=T.useRef(),i=Pu();return fo(()=>{var s;let u=(()=>{var d;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(d=p.current.textContent)==null?void 0:d.trim():a.current}})(),c=r.map(d=>d.trim());i.value(e,u,c),(s=t.current)==null||s.setAttribute(to,u),a.current=u}),a}var Ite=()=>{let[e,t]=T.useState(),n=cs(()=>new Map);return fo(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function Lte(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Qf({asChild:e,children:t},n){return e&&T.isValidElement(t)?T.cloneElement(Lte(t),{ref:t.ref},n(t.props.children)):n(t)}var Mte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const u4=i0,c4=CB,Fte=o0,d4=T.forwardRef(({className:e,...t},n)=>E.jsx(Mf,{ref:n,className:Me("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",e),...t}));d4.displayName=Mf.displayName;const $0=T.forwardRef(({className:e,children:t,...n},r)=>E.jsxs(Fte,{children:[E.jsx(d4,{}),E.jsxs(Ff,{ref:r,className:Me("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",e),...n,children:[t,E.jsxs(u0,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none",children:[E.jsx(Qz,{className:"h-4 w-4"}),E.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$0.displayName=Ff.displayName;const q0=({className:e,...t})=>E.jsx("div",{className:Me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});q0.displayName="DialogHeader";const V0=T.forwardRef(({className:e,...t},n)=>E.jsx(s0,{ref:n,className:Me("text-lg leading-none font-semibold tracking-tight",e),...t}));V0.displayName=s0.displayName;const W0=T.forwardRef(({className:e,...t},n)=>E.jsx(l0,{ref:n,className:Me("text-muted-foreground text-sm",e),...t}));W0.displayName=l0.displayName;const Jf=T.forwardRef(({className:e,...t},n)=>E.jsx(qn,{ref:n,className:Me("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t}));Jf.displayName=qn.displayName;const Y0=T.forwardRef(({className:e,...t},n)=>E.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[E.jsx(G7,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),E.jsx(qn.Input,{ref:n,className:Me("placeholder:text-muted-foreground flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Y0.displayName=qn.Input.displayName;const ep=T.forwardRef(({className:e,...t},n)=>E.jsx(qn.List,{ref:n,className:Me("max-h-[300px] overflow-x-hidden overflow-y-auto",e),...t}));ep.displayName=qn.List.displayName;const K0=T.forwardRef((e,t)=>E.jsx(qn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));K0.displayName=qn.Empty.displayName;const Gs=T.forwardRef(({className:e,...t},n)=>E.jsx(qn.Group,{ref:n,className:Me("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t}));Gs.displayName=qn.Group.displayName;const Pte=T.forwardRef(({className:e,...t},n)=>E.jsx(qn.Separator,{ref:n,className:Me("bg-border -mx-1 h-px",e),...t}));Pte.displayName=qn.Separator.displayName;const Hs=T.forwardRef(({className:e,...t},n)=>E.jsx(qn.Item,{ref:n,className:Me("data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Hs.displayName=qn.Item.displayName;const zte=({layout:e,autoRunFor:t})=>{const n=Er(),{stop:r,start:a,isRunning:i}=e,{t:s}=Vt();return T.useEffect(()=>{if(!n)return;let u=null;return t!==void 0&&t>-1&&n.getGraph().order>0&&(a(),u=t>0?window.setTimeout(()=>{r()},t):null),()=>{r(),u&&clearTimeout(u)}},[t,a,r,n]),E.jsx(Mt,{size:"icon",onClick:()=>i?r():a(),tooltip:s(i?"graphPanel.sideBar.layoutsControl.stopAnimation":"graphPanel.sideBar.layoutsControl.startAnimation"),variant:Ia,children:i?E.jsx(P7,{}):E.jsx(B7,{})})},Bte=()=>{const e=Er(),{t}=Vt(),[n,r]=T.useState("Circular"),[a,i]=T.useState(!1),s=je.use.graphLayoutMaxIterations(),u=Oee(),c=_ee(),d=lte(),p=rte({settings:{margin:1}}),g=zee({maxIterations:s}),m=Jj({iterations:s}),b=ate(),v=Bee(),S=Yee(),k=T.useMemo(()=>({Circular:{layout:u},Circlepack:{layout:c},Random:{layout:d},Noverlaps:{layout:p,worker:b},"Force Directed":{layout:g,worker:v},"Force Atlas":{layout:m,worker:S}}),[c,u,g,m,p,d,v,b,S]),R=T.useCallback(x=>{console.debug(x);const{positions:A}=k[x].layout;YQ(e.getGraph(),A(),{duration:500}),r(x)},[k,e]);return E.jsxs(E.Fragment,{children:[E.jsx("div",{children:k[n]&&"worker"in k[n]&&E.jsx(zte,{layout:k[n].worker})}),E.jsx("div",{children:E.jsxs(Cu,{open:a,onOpenChange:i,children:[E.jsx(Nu,{asChild:!0,children:E.jsx(Mt,{size:"icon",variant:Ia,onClick:()=>i(x=>!x),tooltip:t("graphPanel.sideBar.layoutsControl.layoutGraph"),children:E.jsx(A7,{})})}),E.jsx(Fs,{side:"right",align:"center",className:"p-1",children:E.jsx(Jf,{children:E.jsx(ep,{children:E.jsx(Gs,{children:Object.keys(k).map(x=>E.jsx(Hs,{onSelect:()=>{R(x)},className:"cursor-pointer text-xs",children:t(`graphPanel.sideBar.layoutsControl.layouts.${x}`)},x))})})})})]})})]})},f4=()=>{const e=T.useContext(Gz);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},gd=e=>!!(e.type.startsWith("mouse")&&e.buttons!==0),Ute=({disableHoverEffect:e})=>{const t=Er(),n=Dj(),r=Oj(),a=wJ(),i=je.use.graphLayoutMaxIterations(),{assign:s}=Jj({iterations:i}),{theme:u}=f4(),c=je.use.enableHideUnselectedEdges(),d=ct.use.selectedNode(),p=ct.use.focusedNode(),g=ct.use.selectedEdge(),m=ct.use.focusedEdge(),b=ct.use.sigmaGraph();return T.useEffect(()=>{b&&(a(b),s())},[s,a,b,i]),T.useEffect(()=>{const{setFocusedNode:v,setSelectedNode:S,setFocusedEdge:k,setSelectedEdge:R,clearSelection:x}=ct.getState();n({enterNode:A=>{gd(A.event.original)||v(A.node)},leaveNode:A=>{gd(A.event.original)||v(null)},clickNode:A=>{S(A.node),R(null)},clickEdge:A=>{R(A.edge),S(null)},enterEdge:A=>{gd(A.event.original)||k(A.edge)},leaveEdge:A=>{gd(A.event.original)||k(null)},clickStage:()=>x()})},[n]),T.useEffect(()=>{const v=u==="dark",S=v?G9:void 0,k=v?W9:void 0;r({nodeReducer:(R,x)=>{const A=t.getGraph(),C={...x,highlighted:x.highlighted||!1,labelColor:S};if(!e){C.highlighted=!1;const O=p||d,_=m||g;if(O)(R===O||A.neighbors(O).includes(R))&&(C.highlighted=!0,R===d&&(C.borderColor=V9));else if(_)A.extremities(_).includes(R)&&(C.highlighted=!0,C.size=3);else return C;C.highlighted?v&&(C.labelColor=H9):C.color=$9}return C},edgeReducer:(R,x)=>{const A=t.getGraph(),C={...x,hidden:!1,labelColor:S,color:k};if(!e){const O=p||d;O?c?A.extremities(R).includes(O)||(C.hidden=!0):A.extremities(R).includes(O)&&(C.color=jR):(m||g)&&(R===g?C.color=Y9:R===m?C.color=jR:c&&(C.hidden=!0))}return C}})},[d,p,g,m,r,t,e,u,c]),null},jte=()=>{const{zoomIn:e,zoomOut:t,reset:n}=Ij({duration:200,factor:1.5}),{t:r}=Vt(),a=T.useCallback(()=>e(),[e]),i=T.useCallback(()=>t(),[t]),s=T.useCallback(()=>n(),[n]);return E.jsxs(E.Fragment,{children:[E.jsx(Mt,{variant:Ia,onClick:a,tooltip:r("graphPanel.sideBar.zoomControl.zoomIn"),size:"icon",children:E.jsx(Q7,{})}),E.jsx(Mt,{variant:Ia,onClick:i,tooltip:r("graphPanel.sideBar.zoomControl.zoomOut"),size:"icon",children:E.jsx(eV,{})}),E.jsx(Mt,{variant:Ia,onClick:s,tooltip:r("graphPanel.sideBar.zoomControl.resetZoom"),size:"icon",children:E.jsx(w7,{})})]})},Gte=()=>{const{isFullScreen:e,toggle:t}=xJ(),{t:n}=Vt();return E.jsx(E.Fragment,{children:e?E.jsx(Mt,{variant:Ia,onClick:t,tooltip:n("graphPanel.sideBar.fullScreenControl.windowed"),size:"icon",children:E.jsx(I7,{})}):E.jsx(Mt,{variant:Ia,onClick:t,tooltip:n("graphPanel.sideBar.fullScreenControl.fullScreen"),size:"icon",children:E.jsx(O7,{})})})};var X0="Checkbox",[Hte,GSe]=Sr(X0),[$te,qte]=Hte(X0),p4=T.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:i,required:s,disabled:u,value:c="on",onCheckedChange:d,form:p,...g}=e,[m,b]=T.useState(null),v=gt(t,C=>b(C)),S=T.useRef(!1),k=m?p||!!m.closest("form"):!0,[R=!1,x]=Ma({prop:a,defaultProp:i,onChange:d}),A=T.useRef(R);return T.useEffect(()=>{const C=m==null?void 0:m.form;if(C){const O=()=>x(A.current);return C.addEventListener("reset",O),()=>C.removeEventListener("reset",O)}},[m,x]),E.jsxs($te,{scope:n,state:R,disabled:u,children:[E.jsx(Xe.button,{type:"button",role:"checkbox","aria-checked":yi(R)?"mixed":R,"aria-required":s,"data-state":m4(R),"data-disabled":u?"":void 0,disabled:u,value:c,...g,ref:v,onKeyDown:Ye(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Ye(e.onClick,C=>{x(O=>yi(O)?!0:!O),k&&(S.current=C.isPropagationStopped(),S.current||C.stopPropagation())})}),k&&E.jsx(Vte,{control:m,bubbles:!S.current,name:r,value:c,checked:R,required:s,disabled:u,form:p,style:{transform:"translateX(-100%)"},defaultChecked:yi(i)?!1:i})]})});p4.displayName=X0;var g4="CheckboxIndicator",h4=T.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...a}=e,i=qte(g4,n);return E.jsx(rr,{present:r||yi(i.state)||i.state===!0,children:E.jsx(Xe.span,{"data-state":m4(i.state),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});h4.displayName=g4;var Vte=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:a,...i}=e,s=T.useRef(null),u=HU(n),c=iU(t);T.useEffect(()=>{const p=s.current,g=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(g,"checked").set;if(u!==n&&b){const v=new Event("click",{bubbles:r});p.indeterminate=yi(n),b.call(p,yi(n)?!1:n),p.dispatchEvent(v)}},[u,n,r]);const d=T.useRef(yi(n)?!1:n);return E.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??d.current,...i,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function yi(e){return e==="indeterminate"}function m4(e){return yi(e)?"indeterminate":e?"checked":"unchecked"}var b4=p4,Wte=h4;const ru=T.forwardRef(({className:e,...t},n)=>E.jsx(b4,{ref:n,className:Me("peer border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground h-4 w-4 shrink-0 rounded-sm border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:E.jsx(Wte,{className:Me("flex items-center justify-center text-current"),children:E.jsx(Xk,{className:"h-4 w-4"})})}));ru.displayName=b4.displayName;var Yte="Separator",qN="horizontal",Kte=["horizontal","vertical"],y4=T.forwardRef((e,t)=>{const{decorative:n,orientation:r=qN,...a}=e,i=Xte(r)?r:qN,u=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return E.jsx(Xe.div,{"data-orientation":i,...u,...a,ref:t})});y4.displayName=Yte;function Xte(e){return Kte.includes(e)}var v4=y4;const ds=T.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},a)=>E.jsx(v4,{ref:a,decorative:n,orientation:t,className:Me("bg-border shrink-0",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));ds.displayName=v4.displayName;const fi=({checked:e,onCheckedChange:t,label:n})=>E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(ru,{checked:e,onCheckedChange:t}),E.jsx("label",{htmlFor:"terms",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n})]}),km=({value:e,onEditFinished:t,label:n,min:r,max:a})=>{const[i,s]=T.useState(e),u=T.useCallback(d=>{const p=d.target.value.trim();if(p.length===0){s(null);return}const g=Number.parseInt(p);if(!isNaN(g)&&g!==i){if(r!==void 0&&ga)return;s(g)}},[i,r,a]),c=T.useCallback(()=>{i!==null&&e!==i&&t(i)},[e,i,t]);return E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("label",{htmlFor:"terms",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n}),E.jsx(ki,{type:"number",value:i===null?"":i,onChange:u,className:"h-6 w-full min-w-0 pr-1",min:r,max:a,onBlur:c,onKeyDown:d=>{d.key==="Enter"&&c()}})]})};function Zte(){const[e,t]=T.useState(!1),[n,r]=T.useState(""),a=je.use.refreshLayout(),i=je.use.showPropertyPanel(),s=je.use.showNodeSearchBar(),u=je.use.showNodeLabel(),c=je.use.enableEdgeEvents(),d=je.use.enableNodeDrag(),p=je.use.enableHideUnselectedEdges(),g=je.use.showEdgeLabel(),m=je.use.graphQueryMaxDepth(),b=je.use.graphMinDegree(),v=je.use.graphLayoutMaxIterations(),S=je.use.enableHealthCheck(),k=je.use.apiKey();T.useEffect(()=>{r(k||"")},[k,e]);const R=T.useCallback(()=>je.setState(Y=>({enableNodeDrag:!Y.enableNodeDrag})),[]),x=T.useCallback(()=>je.setState(Y=>({enableEdgeEvents:!Y.enableEdgeEvents})),[]),A=T.useCallback(()=>je.setState(Y=>({enableHideUnselectedEdges:!Y.enableHideUnselectedEdges})),[]),C=T.useCallback(()=>je.setState(Y=>({showEdgeLabel:!Y.showEdgeLabel})),[]),O=T.useCallback(()=>je.setState(Y=>({showPropertyPanel:!Y.showPropertyPanel})),[]),_=T.useCallback(()=>je.setState(Y=>({showNodeSearchBar:!Y.showNodeSearchBar})),[]),N=T.useCallback(()=>je.setState(Y=>({showNodeLabel:!Y.showNodeLabel})),[]),P=T.useCallback(()=>je.setState(Y=>({enableHealthCheck:!Y.enableHealthCheck})),[]),I=T.useCallback(Y=>{Y<1||je.setState({graphQueryMaxDepth:Y})},[]),L=T.useCallback(Y=>{Y<0||je.setState({graphMinDegree:Y})},[]),H=T.useCallback(Y=>{Y<1||je.setState({graphLayoutMaxIterations:Y})},[]),$=T.useCallback(async()=>{je.setState({apiKey:n||null}),await Gn.getState().check(),t(!1)},[n]),U=T.useCallback(Y=>{r(Y.target.value)},[r]),{t:W}=Vt();return E.jsxs(E.Fragment,{children:[E.jsx(Mt,{variant:Ia,tooltip:W("graphPanel.sideBar.settings.refreshLayout"),size:"icon",onClick:a,children:E.jsx(Zz,{})}),E.jsxs(Cu,{open:e,onOpenChange:t,children:[E.jsx(Nu,{asChild:!0,children:E.jsx(Mt,{variant:Ia,tooltip:W("graphPanel.sideBar.settings.settings"),size:"icon",children:E.jsx(V7,{})})}),E.jsx(Fs,{side:"right",align:"start",className:"mb-2 p-2",onCloseAutoFocus:Y=>Y.preventDefault(),children:E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx(fi,{checked:S,onCheckedChange:P,label:W("graphPanel.sideBar.settings.healthCheck")}),E.jsx(ds,{}),E.jsx(fi,{checked:i,onCheckedChange:O,label:W("graphPanel.sideBar.settings.showPropertyPanel")}),E.jsx(fi,{checked:s,onCheckedChange:_,label:W("graphPanel.sideBar.settings.showSearchBar")}),E.jsx(ds,{}),E.jsx(fi,{checked:u,onCheckedChange:N,label:W("graphPanel.sideBar.settings.showNodeLabel")}),E.jsx(fi,{checked:d,onCheckedChange:R,label:W("graphPanel.sideBar.settings.nodeDraggable")}),E.jsx(ds,{}),E.jsx(fi,{checked:g,onCheckedChange:C,label:W("graphPanel.sideBar.settings.showEdgeLabel")}),E.jsx(fi,{checked:p,onCheckedChange:A,label:W("graphPanel.sideBar.settings.hideUnselectedEdges")}),E.jsx(fi,{checked:c,onCheckedChange:x,label:W("graphPanel.sideBar.settings.edgeEvents")}),E.jsx(ds,{}),E.jsx(km,{label:W("graphPanel.sideBar.settings.maxQueryDepth"),min:1,value:m,onEditFinished:I}),E.jsx(km,{label:W("graphPanel.sideBar.settings.minDegree"),min:0,value:b,onEditFinished:L}),E.jsx(km,{label:W("graphPanel.sideBar.settings.maxLayoutIterations"),min:1,max:30,value:v,onEditFinished:H}),E.jsx(ds,{}),E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("label",{className:"text-sm font-medium",children:W("graphPanel.sideBar.settings.apiKey")}),E.jsxs("form",{className:"flex h-6 gap-2",onSubmit:Y=>Y.preventDefault(),children:[E.jsx("div",{className:"w-0 flex-1",children:E.jsx(ki,{type:"password",value:n,onChange:U,placeholder:W("graphPanel.sideBar.settings.enterYourAPIkey"),className:"max-h-full w-full min-w-0",autoComplete:"off"})}),E.jsx(Mt,{onClick:$,variant:"outline",size:"sm",className:"max-h-full shrink-0",children:W("graphPanel.sideBar.settings.save")})]})]})]})})]})]})}const Qte="ENTRIES",S4="KEYS",E4="VALUES",hn="";class Tm{constructor(t,n){const r=t._tree,a=Array.from(r.keys());this.set=t,this._type=n,this._path=a.length>0?[{node:r,keys:a}]:[]}next(){const t=this.dive();return this.backtrack(),t}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:t,keys:n}=os(this._path);if(os(n)===hn)return{done:!1,value:this.result()};const r=t.get(os(n));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const t=os(this._path).keys;t.pop(),!(t.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:t})=>os(t)).filter(t=>t!==hn).join("")}value(){return os(this._path).node.get(hn)}result(){switch(this._type){case E4:return this.value();case S4:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const os=e=>e[e.length-1],Jte=(e,t,n)=>{const r=new Map;if(t===void 0)return r;const a=t.length+1,i=a+n,s=new Uint8Array(i*a).fill(n+1);for(let u=0;u{const c=i*s;e:for(const d of e.keys())if(d===hn){const p=a[c-1];p<=n&&r.set(u,[e.get(d),p])}else{let p=i;for(let g=0;gn)continue e}w4(e.get(d),t,n,r,a,p,s,u+d)}};class mi{constructor(t=new Map,n=""){this._size=void 0,this._tree=t,this._prefix=n}atPrefix(t){if(!t.startsWith(this._prefix))throw new Error("Mismatched prefix");const[n,r]=cf(this._tree,t.slice(this._prefix.length));if(n===void 0){const[a,i]=Z0(r);for(const s of a.keys())if(s!==hn&&s.startsWith(i)){const u=new Map;return u.set(s.slice(i.length),a.get(s)),new mi(u,t)}}return new mi(n,t)}clear(){this._size=void 0,this._tree.clear()}delete(t){return this._size=void 0,ene(this._tree,t)}entries(){return new Tm(this,Qte)}forEach(t){for(const[n,r]of this)t(n,r,this)}fuzzyGet(t,n){return Jte(this._tree,t,n)}get(t){const n=vk(this._tree,t);return n!==void 0?n.get(hn):void 0}has(t){const n=vk(this._tree,t);return n!==void 0&&n.has(hn)}keys(){return new Tm(this,S4)}set(t,n){if(typeof t!="string")throw new Error("key must be a string");return this._size=void 0,Am(this._tree,t).set(hn,n),this}get size(){if(this._size)return this._size;this._size=0;const t=this.entries();for(;!t.next().done;)this._size+=1;return this._size}update(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=Am(this._tree,t);return r.set(hn,n(r.get(hn))),this}fetch(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=Am(this._tree,t);let a=r.get(hn);return a===void 0&&r.set(hn,a=n()),a}values(){return new Tm(this,E4)}[Symbol.iterator](){return this.entries()}static from(t){const n=new mi;for(const[r,a]of t)n.set(r,a);return n}static fromObject(t){return mi.from(Object.entries(t))}}const cf=(e,t,n=[])=>{if(t.length===0||e==null)return[e,n];for(const r of e.keys())if(r!==hn&&t.startsWith(r))return n.push([e,r]),cf(e.get(r),t.slice(r.length),n);return n.push([e,t]),cf(void 0,"",n)},vk=(e,t)=>{if(t.length===0||e==null)return e;for(const n of e.keys())if(n!==hn&&t.startsWith(n))return vk(e.get(n),t.slice(n.length))},Am=(e,t)=>{const n=t.length;e:for(let r=0;e&&r{const[n,r]=cf(e,t);if(n!==void 0){if(n.delete(hn),n.size===0)x4(r);else if(n.size===1){const[a,i]=n.entries().next().value;k4(r,a,i)}}},x4=e=>{if(e.length===0)return;const[t,n]=Z0(e);if(t.delete(n),t.size===0)x4(e.slice(0,-1));else if(t.size===1){const[r,a]=t.entries().next().value;r!==hn&&k4(e.slice(0,-1),r,a)}},k4=(e,t,n)=>{if(e.length===0)return;const[r,a]=Z0(e);r.set(a+t,n),r.delete(a)},Z0=e=>e[e.length-1],Q0="or",T4="and",tne="and_not";class vi{constructor(t){if((t==null?void 0:t.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');const n=t.autoVacuum==null||t.autoVacuum===!0?Cm:t.autoVacuum;this._options={...Rm,...t,autoVacuum:n,searchOptions:{...VN,...t.searchOptions||{}},autoSuggestOptions:{...one,...t.autoSuggestOptions||{}}},this._index=new mi,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Ek,this.addFields(this._options.fields)}add(t){const{extractField:n,tokenize:r,processTerm:a,fields:i,idField:s}=this._options,u=n(t,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);if(this._idToShortId.has(u))throw new Error(`MiniSearch: duplicate ID ${u}`);const c=this.addDocumentId(u);this.saveStoredFields(c,t);for(const d of i){const p=n(t,d);if(p==null)continue;const g=r(p.toString(),d),m=this._fieldIds[d],b=new Set(g).size;this.addFieldLength(c,m,this._documentCount-1,b);for(const v of g){const S=a(v,d);if(Array.isArray(S))for(const k of S)this.addTerm(m,c,k);else S&&this.addTerm(m,c,S)}}}addAll(t){for(const n of t)this.add(n)}addAllAsync(t,n={}){const{chunkSize:r=10}=n,a={chunk:[],promise:Promise.resolve()},{chunk:i,promise:s}=t.reduce(({chunk:u,promise:c},d,p)=>(u.push(d),(p+1)%r===0?{chunk:[],promise:c.then(()=>new Promise(g=>setTimeout(g,0))).then(()=>this.addAll(u))}:{chunk:u,promise:c}),a);return s.then(()=>this.addAll(i))}remove(t){const{tokenize:n,processTerm:r,extractField:a,fields:i,idField:s}=this._options,u=a(t,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);const c=this._idToShortId.get(u);if(c==null)throw new Error(`MiniSearch: cannot remove document with ID ${u}: it is not in the index`);for(const d of i){const p=a(t,d);if(p==null)continue;const g=n(p.toString(),d),m=this._fieldIds[d],b=new Set(g).size;this.removeFieldLength(c,m,this._documentCount,b);for(const v of g){const S=r(v,d);if(Array.isArray(S))for(const k of S)this.removeTerm(m,c,k);else S&&this.removeTerm(m,c,S)}}this._storedFields.delete(c),this._documentIds.delete(c),this._idToShortId.delete(u),this._fieldLength.delete(c),this._documentCount-=1}removeAll(t){if(t)for(const n of t)this.remove(n);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new mi,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(t){const n=this._idToShortId.get(t);if(n==null)throw new Error(`MiniSearch: cannot discard document with ID ${t}: it is not in the index`);this._idToShortId.delete(t),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach((r,a)=>{this.removeFieldLength(n,a,this._documentCount,r)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:t,minDirtCount:n,batchSize:r,batchWait:a}=this._options.autoVacuum;this.conditionalVacuum({batchSize:r,batchWait:a},{minDirtCount:n,minDirtFactor:t})}discardAll(t){const n=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const r of t)this.discard(r)}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()}replace(t){const{idField:n,extractField:r}=this._options,a=r(t,n);this.discard(a),this.add(t)}vacuum(t={}){return this.conditionalVacuum(t)}conditionalVacuum(t,n){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&n,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const r=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=Ek,this.performVacuuming(t,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(n)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(t),this._currentVacuum)}async performVacuuming(t,n){const r=this._dirtCount;if(this.vacuumConditionsMet(n)){const a=t.batchSize||Sk.batchSize,i=t.batchWait||Sk.batchWait;let s=1;for(const[u,c]of this._index){for(const[d,p]of c)for(const[g]of p)this._documentIds.has(g)||(p.size<=1?c.delete(d):p.delete(g));this._index.get(u).size===0&&this._index.delete(u),s%a===0&&await new Promise(d=>setTimeout(d,i)),s+=1}this._dirtCount-=r}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(t){if(t==null)return!0;let{minDirtCount:n,minDirtFactor:r}=t;return n=n||Cm.minDirtCount,r=r||Cm.minDirtFactor,this.dirtCount>=n&&this.dirtFactor>=r}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(t){return this._idToShortId.has(t)}getStoredFields(t){const n=this._idToShortId.get(t);if(n!=null)return this._storedFields.get(n)}search(t,n={}){const{searchOptions:r}=this._options,a={...r,...n},i=this.executeQuery(t,n),s=[];for(const[u,{score:c,terms:d,match:p}]of i){const g=d.length||1,m={id:this._documentIds.get(u),score:c*g,terms:Object.keys(p),queryTerms:d,match:p};Object.assign(m,this._storedFields.get(u)),(a.filter==null||a.filter(m))&&s.push(m)}return t===vi.wildcard&&a.boostDocument==null||s.sort(YN),s}autoSuggest(t,n={}){n={...this._options.autoSuggestOptions,...n};const r=new Map;for(const{score:i,terms:s}of this.search(t,n)){const u=s.join(" "),c=r.get(u);c!=null?(c.score+=i,c.count+=1):r.set(u,{score:i,terms:s,count:1})}const a=[];for(const[i,{score:s,terms:u,count:c}]of r)a.push({suggestion:i,terms:u,score:s/c});return a.sort(YN),a}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(t),n)}static async loadJSONAsync(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(t),n)}static getDefault(t){if(Rm.hasOwnProperty(t))return _m(Rm,t);throw new Error(`MiniSearch: unknown option "${t}"`)}static loadJS(t,n){const{index:r,documentIds:a,fieldLength:i,storedFields:s,serializationVersion:u}=t,c=this.instantiateMiniSearch(t,n);c._documentIds=hd(a),c._fieldLength=hd(i),c._storedFields=hd(s);for(const[d,p]of c._documentIds)c._idToShortId.set(p,d);for(const[d,p]of r){const g=new Map;for(const m of Object.keys(p)){let b=p[m];u===1&&(b=b.ds),g.set(parseInt(m,10),hd(b))}c._index.set(d,g)}return c}static async loadJSAsync(t,n){const{index:r,documentIds:a,fieldLength:i,storedFields:s,serializationVersion:u}=t,c=this.instantiateMiniSearch(t,n);c._documentIds=await md(a),c._fieldLength=await md(i),c._storedFields=await md(s);for(const[p,g]of c._documentIds)c._idToShortId.set(g,p);let d=0;for(const[p,g]of r){const m=new Map;for(const b of Object.keys(g)){let v=g[b];u===1&&(v=v.ds),m.set(parseInt(b,10),await md(v))}++d%1e3===0&&await A4(0),c._index.set(p,m)}return c}static instantiateMiniSearch(t,n){const{documentCount:r,nextId:a,fieldIds:i,averageFieldLength:s,dirtCount:u,serializationVersion:c}=t;if(c!==1&&c!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const d=new vi(n);return d._documentCount=r,d._nextId=a,d._idToShortId=new Map,d._fieldIds=i,d._avgFieldLength=s,d._dirtCount=u||0,d._index=new mi,d}executeQuery(t,n={}){if(t===vi.wildcard)return this.executeWildcardQuery(n);if(typeof t!="string"){const m={...n,...t,queries:void 0},b=t.queries.map(v=>this.executeQuery(v,m));return this.combineResults(b,m.combineWith)}const{tokenize:r,processTerm:a,searchOptions:i}=this._options,s={tokenize:r,processTerm:a,...i,...n},{tokenize:u,processTerm:c}=s,g=u(t).flatMap(m=>c(m)).filter(m=>!!m).map(ine(s)).map(m=>this.executeQuerySpec(m,s));return this.combineResults(g,s.combineWith)}executeQuerySpec(t,n){const r={...this._options.searchOptions,...n},a=(r.fields||this._options.fields).reduce((S,k)=>({...S,[k]:_m(r.boost,k)||1}),{}),{boostDocument:i,weights:s,maxFuzzy:u,bm25:c}=r,{fuzzy:d,prefix:p}={...VN.weights,...s},g=this._index.get(t.term),m=this.termResults(t.term,t.term,1,t.termBoost,g,a,i,c);let b,v;if(t.prefix&&(b=this._index.atPrefix(t.term)),t.fuzzy){const S=t.fuzzy===!0?.2:t.fuzzy,k=S<1?Math.min(u,Math.round(t.term.length*S)):S;k&&(v=this._index.fuzzyGet(t.term,k))}if(b)for(const[S,k]of b){const R=S.length-t.term.length;if(!R)continue;v==null||v.delete(S);const x=p*S.length/(S.length+.3*R);this.termResults(t.term,S,x,t.termBoost,k,a,i,c,m)}if(v)for(const S of v.keys()){const[k,R]=v.get(S);if(!R)continue;const x=d*S.length/(S.length+R);this.termResults(t.term,S,x,t.termBoost,k,a,i,c,m)}return m}executeWildcardQuery(t){const n=new Map,r={...this._options.searchOptions,...t};for(const[a,i]of this._documentIds){const s=r.boostDocument?r.boostDocument(i,"",this._storedFields.get(a)):1;n.set(a,{score:s,terms:[],match:{}})}return n}combineResults(t,n=Q0){if(t.length===0)return new Map;const r=n.toLowerCase(),a=nne[r];if(!a)throw new Error(`Invalid combination operator: ${n}`);return t.reduce(a)||new Map}toJSON(){const t=[];for(const[n,r]of this._index){const a={};for(const[i,s]of r)a[i]=Object.fromEntries(s);t.push([n,a])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:t,serializationVersion:2}}termResults(t,n,r,a,i,s,u,c,d=new Map){if(i==null)return d;for(const p of Object.keys(s)){const g=s[p],m=this._fieldIds[p],b=i.get(m);if(b==null)continue;let v=b.size;const S=this._avgFieldLength[m];for(const k of b.keys()){if(!this._documentIds.has(k)){this.removeTerm(m,k,n),v-=1;continue}const R=u?u(this._documentIds.get(k),n,this._storedFields.get(k)):1;if(!R)continue;const x=b.get(k),A=this._fieldLength.get(k)[m],C=ane(x,v,this._documentCount,A,S,c),O=r*a*g*R*C,_=d.get(k);if(_){_.score+=O,sne(_.terms,t);const N=_m(_.match,n);N?N.push(p):_.match[n]=[p]}else d.set(k,{score:O,terms:[t],match:{[n]:[p]}})}}return d}addTerm(t,n,r){const a=this._index.fetch(r,KN);let i=a.get(t);if(i==null)i=new Map,i.set(n,1),a.set(t,i);else{const s=i.get(n);i.set(n,(s||0)+1)}}removeTerm(t,n,r){if(!this._index.has(r)){this.warnDocumentChanged(n,t,r);return}const a=this._index.fetch(r,KN),i=a.get(t);i==null||i.get(n)==null?this.warnDocumentChanged(n,t,r):i.get(n)<=1?i.size<=1?a.delete(t):i.delete(n):i.set(n,i.get(n)-1),this._index.get(r).size===0&&this._index.delete(r)}warnDocumentChanged(t,n,r){for(const a of Object.keys(this._fieldIds))if(this._fieldIds[a]===n){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(t)} has changed before removal: term "${r}" was not present in field "${a}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(t){const n=this._nextId;return this._idToShortId.set(t,n),this._documentIds.set(n,t),this._documentCount+=1,this._nextId+=1,n}addFields(t){for(let n=0;nObject.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,nne={[Q0]:(e,t)=>{for(const n of t.keys()){const r=e.get(n);if(r==null)e.set(n,t.get(n));else{const{score:a,terms:i,match:s}=t.get(n);r.score=r.score+a,r.match=Object.assign(r.match,s),WN(r.terms,i)}}return e},[T4]:(e,t)=>{const n=new Map;for(const r of t.keys()){const a=e.get(r);if(a==null)continue;const{score:i,terms:s,match:u}=t.get(r);WN(a.terms,s),n.set(r,{score:a.score+i,terms:a.terms,match:Object.assign(a.match,u)})}return n},[tne]:(e,t)=>{for(const n of t.keys())e.delete(n);return e}},rne={k:1.2,b:.7,d:.5},ane=(e,t,n,r,a,i)=>{const{k:s,b:u,d:c}=i;return Math.log(1+(n-t+.5)/(t+.5))*(c+e*(s+1)/(e+s*(1-u+u*r/a)))},ine=e=>(t,n,r)=>{const a=typeof e.fuzzy=="function"?e.fuzzy(t,n,r):e.fuzzy||!1,i=typeof e.prefix=="function"?e.prefix(t,n,r):e.prefix===!0,s=typeof e.boostTerm=="function"?e.boostTerm(t,n,r):1;return{term:t,fuzzy:a,prefix:i,termBoost:s}},Rm={idField:"id",extractField:(e,t)=>e[t],tokenize:e=>e.split(lne),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])=="function"&&console[e](t)},autoVacuum:!0},VN={combineWith:Q0,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:rne},one={combineWith:T4,prefix:(e,t,n)=>t===n.length-1},Sk={batchSize:1e3,batchWait:10},Ek={minDirtFactor:.1,minDirtCount:20},Cm={...Sk,...Ek},sne=(e,t)=>{e.includes(t)||e.push(t)},WN=(e,t)=>{for(const n of t)e.includes(n)||e.push(n)},YN=({score:e},{score:t})=>t-e,KN=()=>new Map,hd=e=>{const t=new Map;for(const n of Object.keys(e))t.set(parseInt(n,10),e[n]);return t},md=async e=>{const t=new Map;let n=0;for(const r of Object.keys(e))t.set(parseInt(r,10),e[r]),++n%1e3===0&&await A4(0);return t},A4=e=>new Promise(t=>setTimeout(t,e)),lne=/[\n\r\p{Z}\p{P}]+/u;function wk(){return wk=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);nye.createElement("div",{className:"node"},ye.createElement("span",{className:"render "+(n?"circle":"disc"),style:{backgroundColor:t||"#000"}}),ye.createElement("span",{className:`label ${n?"text-muted":""} ${e?"":"text-italic"}`},e||r.no_label||"No label")),yne=({id:e,labels:t})=>{const n=Er(),r=T.useMemo(()=>{const a=n.getGraph().getNodeAttributes(e),i=n.getSetting("nodeReducer");return Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},a),i?i(e,a):{})},[n,e]);return ye.createElement(Tk,Object.assign({},r,{labels:t}))},vne=({label:e,color:t,source:n,target:r,hidden:a,directed:i,labels:s={}})=>ye.createElement("div",{className:"edge"},ye.createElement(Tk,Object.assign({},n,{labels:s})),ye.createElement("div",{className:"body"},ye.createElement("div",{className:"render"},ye.createElement("span",{className:a?"dotted":"dash",style:{borderColor:t||"#000"}})," ",i&&ye.createElement("span",{className:"arrow",style:{borderTopColor:t||"#000"}})),ye.createElement("span",{className:`label ${a?"text-muted":""} ${e?"":"fst-italic"}`},e||s.no_label||"No label")),ye.createElement(Tk,Object.assign({},r,{labels:s}))),Sne=({id:e,labels:t})=>{const n=Er(),r=T.useMemo(()=>{const a=n.getGraph().getEdgeAttributes(e),i=n.getSetting("nodeReducer"),s=n.getSetting("edgeReducer"),u=n.getGraph().getNodeAttributes(n.getGraph().source(e)),c=n.getGraph().getNodeAttributes(n.getGraph().target(e));return Object.assign(Object.assign(Object.assign({color:n.getSetting("defaultEdgeColor"),directed:n.getGraph().isDirected(e)},a),s?s(e,a):{}),{source:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},u),i?i(e,u):{}),target:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},c),i?i(e,c):{})})},[n,e]);return ye.createElement(vne,Object.assign({},r,{labels:t}))};function J0(e,t){const[n,r]=T.useState(e);return T.useEffect(()=>{const a=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(a)}},[e,t]),n}function Ene({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,notFound:i,loadingSkeleton:s,label:u,placeholder:c="Select...",value:d,onChange:p,onFocus:g,disabled:m=!1,className:b,noResultsMessage:v}){const[S,k]=T.useState(!1),[R,x]=T.useState(!1),[A,C]=T.useState([]),[O,_]=T.useState(!1),[N,P]=T.useState(null),[I,L]=T.useState(d),[H,$]=T.useState(null),[U,W]=T.useState(""),Y=J0(U,t?0:150),[j,G]=T.useState([]);T.useEffect(()=>{k(!0),L(d)},[d]),T.useEffect(()=>{S||(async()=>{try{_(!0),P(null);const V=d!==null?await e(d):[];G(V),C(V)}catch(V){P(V instanceof Error?V.message:"Failed to fetch options")}finally{_(!1)}})()},[S,e,d]),T.useEffect(()=>{const D=async()=>{try{_(!0),P(null);const V=await e(Y);G(V),C(V)}catch(V){P(V instanceof Error?V.message:"Failed to fetch options")}finally{_(!1)}};S&&t?t&&C(Y?j.filter(V=>n?n(V,Y):!0):j):D()},[e,Y,S,t,n]);const z=T.useCallback(D=>{D!==I&&(L(D),p(D)),x(!1)},[I,L,x,p]),K=T.useCallback(D=>{D!==H&&($(D),g(D))},[H,$,g]);return E.jsx("div",{className:Me(m&&"cursor-not-allowed opacity-50",b),onFocus:()=>{x(!0)},onBlur:()=>x(!1),children:E.jsxs(Jf,{shouldFilter:!1,className:"bg-transparent",children:[E.jsxs("div",{children:[E.jsx(Y0,{placeholder:c,value:U,className:"max-h-8",onValueChange:D=>{W(D),D&&!R&&x(!0)}}),O&&A.length>0&&E.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:E.jsx(Xz,{className:"h-4 w-4 animate-spin"})})]}),E.jsxs(ep,{hidden:!R,children:[N&&E.jsx("div",{className:"text-destructive p-4 text-center",children:N}),O&&A.length===0&&(s||E.jsx(wne,{})),!O&&!N&&A.length===0&&(i||E.jsx(K0,{children:v??`No ${u.toLowerCase()} found.`})),E.jsx(Gs,{children:A.map((D,V)=>E.jsxs(E.Fragment,{children:[E.jsx(Hs,{value:a(D),onSelect:z,onMouseEnter:()=>K(a(D)),className:"truncate",children:r(D)},a(D)+`${V}`),V!==A.length-1&&E.jsx("div",{className:"bg-foreground/10 h-[1px]"},V)]}))})]})]})})}function wne(){return E.jsx(Gs,{children:E.jsx(Hs,{disabled:!0,children:E.jsxs("div",{className:"flex w-full items-center gap-2",children:[E.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),E.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[E.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),E.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}function xne(e){return E.jsxs("div",{children:[e.type==="nodes"&&E.jsx(yne,{id:e.id}),e.type==="edges"&&E.jsx(Sne,{id:e.id}),e.type==="message"&&E.jsx("div",{children:e.message})]})}const Nm="__message_item",bd={graph:null,searchEngine:null},kne=({onChange:e,onFocus:t,value:n})=>{const{t:r}=Vt(),a=ct.use.sigmaGraph(),i=T.useMemo(()=>{if(bd.graph==a)return bd.searchEngine;if(!a||a.nodes().length==0)return;bd.graph=a;const u=new vi({idField:"id",fields:["label"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),c=a.nodes().map(d=>({id:d,label:a.getNodeAttribute(d,"label")}));return u.addAll(c),bd.searchEngine=u,u},[a]),s=T.useCallback(async u=>{if(t&&t(null),!a||!i)return[];if(!u)return a.nodes().slice(0,Zc).map(p=>({id:p,type:"nodes"}));const c=i.search(u).map(d=>({id:d.id,type:"nodes"}));return c.length<=Zc?c:[...c.slice(0,Zc),{type:"message",id:Nm,message:r("graphPanel.search.message",{count:c.length-Zc})}]},[a,i,t,r]);return E.jsx(Ene,{className:"bg-background/60 w-24 rounded-xl border-1 opacity-60 backdrop-blur-lg transition-all hover:w-fit hover:opacity-100",fetcher:s,renderOption:xne,getOptionValue:u=>u.id,value:n&&n.type!=="message"?n.id:null,onChange:u=>{u!==Nm&&e(u?{id:u,type:"nodes"}:null)},onFocus:u=>{u!==Nm&&t&&t(u?{id:u,type:"nodes"}:null)},label:"item",placeholder:r("graphPanel.search.placeholder")})},Tne=({...e})=>E.jsx(kne,{...e});function Ane({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,getDisplayValue:i,notFound:s,loadingSkeleton:u,label:c,placeholder:d="Select...",value:p,onChange:g,disabled:m=!1,className:b,triggerClassName:v,searchInputClassName:S,noResultsMessage:k,triggerTooltip:R,clearable:x=!0}){const[A,C]=T.useState(!1),[O,_]=T.useState(!1),[N,P]=T.useState([]),[I,L]=T.useState(!1),[H,$]=T.useState(null),[U,W]=T.useState(p),[Y,j]=T.useState(null),[G,z]=T.useState(""),K=J0(G,t?0:150),[D,V]=T.useState([]);T.useEffect(()=>{C(!0),W(p)},[p]),T.useEffect(()=>{if(p&&N.length>0){const M=N.find(X=>a(X)===p);M&&j(M)}},[p,N,a]),T.useEffect(()=>{A||(async()=>{try{L(!0),$(null);const X=await e(p);V(X),P(X)}catch(X){$(X instanceof Error?X.message:"Failed to fetch options")}finally{L(!1)}})()},[A,e,p]),T.useEffect(()=>{const M=async()=>{try{L(!0),$(null);const X=await e(K);V(X),P(X)}catch(X){$(X instanceof Error?X.message:"Failed to fetch options")}finally{L(!1)}};A&&t?t&&P(K?D.filter(X=>n?n(X,K):!0):D):M()},[e,K,A,t,n]);const B=T.useCallback(M=>{const X=x&&M===U?"":M;W(X),j(N.find(Q=>a(Q)===X)||null),g(X),_(!1)},[U,g,x,N,a]);return E.jsxs(Cu,{open:O,onOpenChange:_,children:[E.jsx(Nu,{asChild:!0,children:E.jsxs(Mt,{variant:"outline",role:"combobox","aria-expanded":O,className:Me("justify-between",m&&"cursor-not-allowed opacity-50",v),disabled:m,tooltip:R,side:"bottom",children:[Y?i(Y):d,E.jsx(d7,{className:"opacity-50",size:10})]})}),E.jsx(Fs,{className:Me("p-0",b),onCloseAutoFocus:M=>M.preventDefault(),children:E.jsxs(Jf,{shouldFilter:!1,children:[E.jsxs("div",{className:"relative w-full border-b",children:[E.jsx(Y0,{placeholder:`Search ${c.toLowerCase()}...`,value:G,onValueChange:M=>{z(M)},className:S}),I&&N.length>0&&E.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:E.jsx(Xz,{className:"h-4 w-4 animate-spin"})})]}),E.jsxs(ep,{children:[H&&E.jsx("div",{className:"text-destructive p-4 text-center",children:H}),I&&N.length===0&&(u||E.jsx(_ne,{})),!I&&!H&&N.length===0&&(s||E.jsx(K0,{children:k??`No ${c.toLowerCase()} found.`})),E.jsx(Gs,{children:N.map(M=>E.jsxs(Hs,{value:a(M),onSelect:B,className:"truncate",children:[r(M),E.jsx(Xk,{className:Me("ml-auto h-3 w-3",U===a(M)?"opacity-100":"opacity-0")})]},a(M)))})]})]})})]})}function _ne(){return E.jsx(Gs,{children:E.jsx(Hs,{disabled:!0,children:E.jsxs("div",{className:"flex w-full items-center gap-2",children:[E.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),E.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[E.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),E.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const Rne=()=>{const{t:e}=Vt(),t=je.use.queryLabel(),n=ct.use.allDatabaseLabels(),r=T.useCallback(()=>{const i=new vi({idField:"id",fields:["value"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),s=n.map((u,c)=>({id:c,value:u}));return i.addAll(s),{labels:n,searchEngine:i}},[n]),a=T.useCallback(async i=>{const{labels:s,searchEngine:u}=r();let c=s;return i&&(c=u.search(i).map(d=>s[d.id])),c.length<=GR?c:[...c.slice(0,GR),"..."]},[r]);return E.jsx(Ane,{className:"ml-2",triggerClassName:"max-h-8",searchInputClassName:"max-h-8",triggerTooltip:e("graphPanel.graphLabels.selectTooltip"),fetcher:a,renderOption:i=>E.jsx("div",{children:i}),getOptionValue:i=>i,getDisplayValue:i=>E.jsx("div",{children:i}),notFound:E.jsx("div",{className:"py-6 text-center text-sm",children:"No labels found"}),label:e("graphPanel.graphLabels.label"),placeholder:e("graphPanel.graphLabels.placeholder"),value:t!==null?t:"*",onChange:i=>{const s=je.getState().queryLabel;i==="..."&&(i="*"),i===s&&i!=="*"?je.getState().setQueryLabel("*"):je.getState().setQueryLabel(i)},clearable:!1})},zn=({text:e,className:t,tooltipClassName:n,tooltip:r,side:a,onClick:i})=>r?E.jsx(xU,{delayDuration:200,children:E.jsxs(kU,{children:[E.jsx(TU,{asChild:!0,children:E.jsx("label",{className:Me(t,i!==void 0?"cursor-pointer":void 0),onClick:i,children:e})}),E.jsx(k0,{side:a,className:n,children:r})]})}):E.jsx("label",{className:Me(t,i!==void 0?"cursor-pointer":void 0),onClick:i,children:e});var Ld={exports:{}},Cne=Ld.exports,XN;function Nne(){return XN||(XN=1,function(e){(function(t,n,r){function a(c){var d=this,p=u();d.next=function(){var g=2091639*d.s0+d.c*23283064365386963e-26;return d.s0=d.s1,d.s1=d.s2,d.s2=g-(d.c=g|0)},d.c=1,d.s0=p(" "),d.s1=p(" "),d.s2=p(" "),d.s0-=p(c),d.s0<0&&(d.s0+=1),d.s1-=p(c),d.s1<0&&(d.s1+=1),d.s2-=p(c),d.s2<0&&(d.s2+=1),p=null}function i(c,d){return d.c=c.c,d.s0=c.s0,d.s1=c.s1,d.s2=c.s2,d}function s(c,d){var p=new a(c),g=d&&d.state,m=p.next;return m.int32=function(){return p.next()*4294967296|0},m.double=function(){return m()+(m()*2097152|0)*11102230246251565e-32},m.quick=m,g&&(typeof g=="object"&&i(g,p),m.state=function(){return i(p,{})}),m}function u(){var c=4022871197,d=function(p){p=String(p);for(var g=0;g