702 lines
268 KiB
JavaScript
Generated
702 lines
268 KiB
JavaScript
Generated
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/utils-vendor-elCzPYZl.js","assets/react-vendor-CgPb4pW_.js"])))=>i.map(i=>d[i]);
|
|
var gi=Object.defineProperty;var pi=(e,t,r)=>t in e?gi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Me=(e,t,r)=>pi(e,typeof t!="symbol"?t+"":t,r);import{R as W,r as p,c as mi,g as He,d as vi}from"./react-vendor-CgPb4pW_.js";import{_ as aa,a as sa,f as rr,N as ia,b as la,c as ca,D as wn,d as Wt,F as yi,E as ua,e as bi,g as qn,h as wi,n as Wn,v as Be,i as da,j as fa,r as Xe,k as ha,y as ga,p as xi,l as _i,U as Yr,m as Si,o as Ei,S as ki}from"./graph-vendor-BC3frDkq.js";import{j as g,c as xn,P as _t,a as pa,D as Ci,C as Ti,b as Ri,R as Ai,u as Ve,d as ft,e as ma,f as ji,A as Ii,g as xe,h as ke,i as Ni,S as Li,O as _n,k as va,l as Sn,m as Pi,T as ya,n as ba,o as wa,p as zi,q as Di,r as xa,s as Oi,t as Gi,v as Rt,w as Fi,x as Mi,y as $i,z as ut,B as Hi,E as Bi}from"./ui-vendor-DaJTMqwy.js";import{t as Vi,c as _a,a as nr,b as Ui}from"./utils-vendor-elCzPYZl.js";function fe(...e){return Vi(_a(e))}function or(e){return e instanceof Error?e.message:`${e}`}function Xg(e,t){let r=0,n=null;return function(...a){const o=Date.now(),l=t-(o-r);l<=0?(n&&(clearTimeout(n),n=null),r=o,e.apply(this,a)):n||(n=setTimeout(()=>{r=Date.now(),n=null,e.apply(this,a)},l))}}const En=e=>{const t=e;t.use={};for(const r of Object.keys(t.getState()))t.use[r]=()=>t(n=>n[r]);return t},Kr="",Yg="/webui/",Ne="ghost",qi="#B2EBF2",Wi="#000",Xi="#E2E2E2",Qr="#EEEEEE",Yi="#F57F17",Ki="#969696",Qi="#F57F17",Xn="#B2EBF2",Lt=50,Yn=100,dt=4,Jr=20,Kg=15,Kn="*",Qg={"text/plain":[".txt",".md",".html",".htm",".tex",".json",".xml",".yaml",".yml",".rtf",".odt",".epub",".csv",".log",".conf",".ini",".properties",".sql",".bat",".sh",".c",".cpp",".py",".java",".js",".ts",".swift",".go",".rb",".php",".css",".scss",".less"],"application/pdf":[".pdf"],"application/msword":[".doc"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":[".pptx"]},Jg={name:"LightRAG",github:"https://github.com/HKUDS/LightRAG"},Ji="modulepreload",Zi=function(e){return"/webui/"+e},Qn={},el=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){let l=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),i=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));a=l(r.map(c=>{if(c=Zi(c),c in Qn)return;Qn[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":Ji,u||(h.as="script"),h.crossOrigin="",h.href=c,i&&h.setAttribute("nonce",i),document.head.appendChild(h),u)return new Promise((d,y)=>{h.addEventListener("load",d),h.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(l){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=l,window.dispatchEvent(s),!s.defaultPrevented)throw l}return a.then(l=>{for(const s of l||[])s.status==="rejected"&&o(s.reason);return t().catch(o)})};function Sa(e,t){let r;try{r=e()}catch{return}return{getItem:a=>{var o;const l=i=>i===null?null:JSON.parse(i,void 0),s=(o=r.getItem(a))!=null?o:null;return s instanceof Promise?s.then(l):l(s)},setItem:(a,o)=>r.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>r.removeItem(a)}}const Zr=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return Zr(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Zr(n)(r)}}}},tl=(e,t)=>(r,n,a)=>{let o={storage:Sa(()=>localStorage),partialize:b=>b,version:0,merge:(b,C)=>({...C,...b}),...t},l=!1;const s=new Set,i=new Set;let c=o.storage;if(!c)return e((...b)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...b)},n,a);const u=()=>{const b=o.partialize({...n()});return c.setItem(o.name,{state:b,version:o.version})},f=a.setState;a.setState=(b,C)=>{f(b,C),u()};const h=e((...b)=>{r(...b),u()},n,a);a.getInitialState=()=>h;let d;const y=()=>{var b,C;if(!c)return;l=!1,s.forEach(_=>{var A;return _((A=n())!=null?A:h)});const j=((C=o.onRehydrateStorage)==null?void 0:C.call(o,(b=n())!=null?b:h))||void 0;return Zr(c.getItem.bind(c))(o.name).then(_=>{if(_)if(typeof _.version=="number"&&_.version!==o.version){if(o.migrate){const A=o.migrate(_.state,_.version);return A instanceof Promise?A.then(I=>[!0,I]):[!0,A]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,_.state];return[!1,void 0]}).then(_=>{var A;const[I,N]=_;if(d=o.merge(N,(A=n())!=null?A:h),r(d,!0),I)return u()}).then(()=>{j==null||j(d,void 0),d=n(),l=!0,i.forEach(_=>_(d))}).catch(_=>{j==null||j(void 0,_)})};return a.persist={setOptions:b=>{o={...o,...b},b.storage&&(c=b.storage)},clearStorage:()=>{c==null||c.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>y(),hasHydrated:()=>l,onHydrate:b=>(s.add(b),()=>{s.delete(b)}),onFinishHydration:b=>(i.add(b),()=>{i.delete(b)})},o.skipHydration||y(),d||h},rl=tl,nl=nr()(rl(e=>({theme:"system",language:"en",showPropertyPanel:!0,showNodeSearchBar:!0,showLegend:!1,showNodeLabel:!0,enableNodeDrag:!0,showEdgeLabel:!1,enableHideUnselectedEdges:!0,enableEdgeEvents:!1,minEdgeSize:1,maxEdgeSize:1,graphQueryMaxDepth:3,graphMaxNodes:1e3,backendMaxGraphNodes:null,graphLayoutMaxIterations:15,queryLabel:Kn,enableHealthCheck:!0,apiKey:null,currentTab:"documents",showFileName:!1,retrievalHistory:[],querySettings:{mode:"global",response_type:"Multiple Paragraphs",top_k:10,chunk_top_k:5,max_entity_tokens:1e4,max_relation_tokens:1e4,max_total_tokens:32e3,only_need_context:!1,only_need_prompt:!1,stream:!0,history_turns:3,hl_keywords:[],ll_keywords:[],user_prompt:"",enable_rerank:!0},setTheme:t=>e({theme:t}),setLanguage:t=>{e({language:t}),el(async()=>{const{default:r}=await import("./utils-vendor-elCzPYZl.js").then(n=>n.d);return{default:r}},__vite__mapDeps([0,1])).then(({default:r})=>{r.language!==t&&r.changeLanguage(t)})},setGraphLayoutMaxIterations:t=>e({graphLayoutMaxIterations:t}),setQueryLabel:t=>e({queryLabel:t}),setGraphQueryMaxDepth:t=>e({graphQueryMaxDepth:t}),setGraphMaxNodes:(t,r=!1)=>{const n=Z.getState();if(n.graphMaxNodes!==t)if(r){const a=n.queryLabel;e({graphMaxNodes:t,queryLabel:""}),setTimeout(()=>{e({queryLabel:a})},300)}else e({graphMaxNodes:t})},setBackendMaxGraphNodes:t=>e({backendMaxGraphNodes:t}),setMinEdgeSize:t=>e({minEdgeSize:t}),setMaxEdgeSize:t=>e({maxEdgeSize:t}),setEnableHealthCheck:t=>e({enableHealthCheck:t}),setApiKey:t=>e({apiKey:t}),setCurrentTab:t=>e({currentTab:t}),setRetrievalHistory:t=>e({retrievalHistory:t}),updateQuerySettings:t=>e(r=>({querySettings:{...r.querySettings,...t}})),setShowFileName:t=>e({showFileName:t}),setShowLegend:t=>e({showLegend:t})}),{name:"settings-storage",storage:Sa(()=>localStorage),version:15,migrate:(e,t)=>(t<2&&(e.showEdgeLabel=!1),t<3&&(e.queryLabel=Kn),t<4&&(e.showPropertyPanel=!0,e.showNodeSearchBar=!0,e.showNodeLabel=!0,e.enableHealthCheck=!0,e.apiKey=null),t<5&&(e.currentTab="documents"),t<6&&(e.querySettings={mode:"global",response_type:"Multiple Paragraphs",top_k:10,max_token_for_text_unit:4e3,max_token_for_global_context:4e3,max_token_for_local_context:4e3,only_need_context:!1,only_need_prompt:!1,stream:!0,history_turns:3,hl_keywords:[],ll_keywords:[]},e.retrievalHistory=[]),t<7&&(e.graphQueryMaxDepth=3,e.graphLayoutMaxIterations=15),t<8&&(e.graphMinDegree=0,e.language="en"),t<9&&(e.showFileName=!1),t<10&&(delete e.graphMinDegree,e.graphMaxNodes=1e3),t<11&&(e.minEdgeSize=1,e.maxEdgeSize=1),t<12&&(e.retrievalHistory=[]),t<13&&e.querySettings&&(e.querySettings.user_prompt=""),t<14&&(e.backendMaxGraphNodes=null),t<15&&(e.querySettings={mode:"global",response_type:"Multiple Paragraphs",top_k:10,chunk_top_k:5,max_entity_tokens:1e4,max_relation_tokens:1e4,max_total_tokens:32e3,only_need_context:!1,only_need_prompt:!1,stream:!0,history_turns:3,hl_keywords:[],ll_keywords:[],user_prompt:"",enable_rerank:!0}),e)})),Z=En(nl);class ol{constructor(){Me(this,"nodes",[]);Me(this,"edges",[]);Me(this,"nodeIdMap",{});Me(this,"edgeIdMap",{});Me(this,"edgeDynamicIdMap",{});Me(this,"getNode",t=>{const r=this.nodeIdMap[t];if(r!==void 0)return this.nodes[r]});Me(this,"getEdge",(t,r=!0)=>{const n=r?this.edgeDynamicIdMap[t]:this.edgeIdMap[t];if(n!==void 0)return this.edges[n]});Me(this,"buildDynamicMap",()=>{this.edgeDynamicIdMap={};for(let t=0;t<this.edges.length;t++){const r=this.edges[t];this.edgeDynamicIdMap[r.dynamicId]=t}})}}const al=nr()((e,t)=>({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,moveToSelectedNode:!1,isFetching:!1,graphIsEmpty:!1,lastSuccessfulQueryLabel:"",graphDataFetchAttempted:!1,labelsFetchAttempted:!1,rawGraph:null,sigmaGraph:null,sigmaInstance:null,allDatabaseLabels:["*"],typeColorMap:new Map,searchEngine:null,setGraphIsEmpty:r=>e({graphIsEmpty:r}),setLastSuccessfulQueryLabel:r=>e({lastSuccessfulQueryLabel:r}),setIsFetching:r=>e({isFetching:r}),setSelectedNode:(r,n)=>e({selectedNode:r,moveToSelectedNode:n}),setFocusedNode:r=>e({focusedNode:r}),setSelectedEdge:r=>e({selectedEdge:r}),setFocusedEdge:r=>e({focusedEdge:r}),clearSelection:()=>e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null}),reset:()=>{e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,rawGraph:null,sigmaGraph:null,searchEngine:null,moveToSelectedNode:!1,graphIsEmpty:!1})},setRawGraph:r=>e({rawGraph:r}),setSigmaGraph:r=>{e({sigmaGraph:r})},setAllDatabaseLabels:r=>e({allDatabaseLabels:r}),fetchAllDatabaseLabels:async()=>{try{console.log("Fetching all database labels...");const r=await il();e({allDatabaseLabels:["*",...r]});return}catch(r){throw console.error("Failed to fetch all database labels:",r),e({allDatabaseLabels:["*"]}),r}},setMoveToSelectedNode:r=>e({moveToSelectedNode:r}),setSigmaInstance:r=>e({sigmaInstance:r}),setTypeColorMap:r=>e({typeColorMap:r}),setSearchEngine:r=>e({searchEngine:r}),resetSearchEngine:()=>e({searchEngine:null}),setGraphDataFetchAttempted:r=>e({graphDataFetchAttempted:r}),setLabelsFetchAttempted:r=>e({labelsFetchAttempted:r}),nodeToExpand:null,nodeToPrune:null,triggerNodeExpand:r=>e({nodeToExpand:r}),triggerNodePrune:r=>e({nodeToPrune:r}),graphDataVersion:0,incrementGraphDataVersion:()=>e(r=>({graphDataVersion:r.graphDataVersion+1})),updateNodeAndSelect:async(r,n,a,o)=>{const l=t(),{sigmaGraph:s,rawGraph:i}=l;if(!(!s||!i||!s.hasNode(r)))try{const c=s.getNodeAttributes(r);if(console.log("updateNodeAndSelect",r,n,a,o),r===n&&a==="entity_id"){s.addNode(o,{...c,label:o});const u=[];s.forEachEdge(r,(h,d,y,b)=>{const C=y===r?b:y,j=y===r,_=h,A=i.edgeDynamicIdMap[_],I=s.addEdge(j?o:C,j?C:o,d);A!==void 0&&u.push({originalDynamicId:_,newEdgeId:I,edgeIndex:A}),s.dropEdge(h)}),s.dropNode(r);const f=i.nodeIdMap[r];f!==void 0&&(i.nodes[f].id=o,i.nodes[f].labels=[o],i.nodes[f].properties.entity_id=o,delete i.nodeIdMap[r],i.nodeIdMap[o]=f),u.forEach(({originalDynamicId:h,newEdgeId:d,edgeIndex:y})=>{i.edges[y]&&(i.edges[y].source===r&&(i.edges[y].source=o),i.edges[y].target===r&&(i.edges[y].target=o),i.edges[y].dynamicId=d,delete i.edgeDynamicIdMap[h],i.edgeDynamicIdMap[d]=y)}),e({selectedNode:o,moveToSelectedNode:!0})}else{const u=i.nodeIdMap[String(r)];u!==void 0&&(i.nodes[u].properties[a]=o,a==="entity_id"&&(i.nodes[u].labels=[o],s.setNodeAttribute(String(r),"label",o))),e(f=>({graphDataVersion:f.graphDataVersion+1}))}}catch(c){throw console.error("Error updating node in graph:",c),new Error("Failed to update node in graph")}},updateEdgeAndSelect:async(r,n,a,o,l,s)=>{const i=t(),{sigmaGraph:c,rawGraph:u}=i;if(!(!c||!u))try{const f=u.edgeIdMap[String(r)];f!==void 0&&u.edges[f]&&(u.edges[f].properties[l]=s,n!==void 0&&l==="keywords"&&c.setEdgeAttribute(n,"label",s)),e(h=>({graphDataVersion:h.graphDataVersion+1})),e({selectedEdge:n})}catch(f){throw console.error(`Error updating edge ${a}->${o} in graph:`,f),new Error("Failed to update edge in graph")}}})),te=En(al);class sl{constructor(){Me(this,"navigate",null)}setNavigate(t){this.navigate=t}resetAllApplicationState(t=!1){console.log("Resetting all application state...");const r=te.getState(),n=r.sigmaInstance;r.reset(),r.setGraphDataFetchAttempted(!1),r.setLabelsFetchAttempted(!1),r.setSigmaInstance(null),r.setIsFetching(!1),kn.getState().clear(),t||Z.getState().setRetrievalHistory([]),sessionStorage.clear(),n&&(n.getGraph().clear(),n.kill(),te.getState().setSigmaInstance(null))}navigateToLogin(){if(!this.navigate){console.error("Navigation function not set");return}const t=Xt.getState().username;t&&localStorage.setItem("LIGHTRAG-PREVIOUS-USER",t),this.resetAllApplicationState(!0),Xt.getState().logout(),this.navigate("/login")}navigateToHome(){if(!this.navigate){console.error("Navigation function not set");return}this.navigate("/")}}const Ea=new sl,Zg="Invalid API Key",ep="API Key required",_e=Ui.create({baseURL:Kr,headers:{"Content-Type":"application/json"}});_e.interceptors.request.use(e=>{const t=Z.getState().apiKey,r=localStorage.getItem("LIGHTRAG-API-TOKEN");return r&&(e.headers.Authorization=`Bearer ${r}`),t&&(e.headers["X-API-Key"]=t),e});_e.interceptors.response.use(e=>e,e=>{var t,r,n,a;if(e.response){if(((t=e.response)==null?void 0:t.status)===401){if((n=(r=e.config)==null?void 0:r.url)!=null&&n.includes("/login"))throw e;return Ea.navigateToLogin(),Promise.reject(new Error("Authentication required"))}throw new Error(`${e.response.status} ${e.response.statusText}
|
|
${JSON.stringify(e.response.data)}
|
|
${(a=e.config)==null?void 0:a.url}`)}throw e});const ka=async(e,t,r)=>(await _e.get(`/graphs?label=${encodeURIComponent(e)}&max_depth=${t}&max_nodes=${r}`)).data,il=async()=>(await _e.get("/graph/label/list")).data,ll=async()=>{try{return(await _e.get("/health")).data}catch(e){return{status:"error",message:or(e)}}},tp=async()=>(await _e.get("/documents")).data,rp=async()=>(await _e.post("/documents/scan")).data,np=async e=>(await _e.post("/query",e)).data,op=async(e,t,r)=>{const n=Z.getState().apiKey,a=localStorage.getItem("LIGHTRAG-API-TOKEN"),o={"Content-Type":"application/json",Accept:"application/x-ndjson"};a&&(o.Authorization=`Bearer ${a}`),n&&(o["X-API-Key"]=n);try{const l=await fetch(`${Kr}/query/stream`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!l.ok){if(l.status===401)throw Ea.navigateToLogin(),new Error("Authentication required");let u="Unknown error";try{u=await l.text()}catch{}const f=`${Kr}/query/stream`;throw new Error(`${l.status} ${l.statusText}
|
|
${JSON.stringify({error:u})}
|
|
${f}`)}if(!l.body)throw new Error("Response body is null");const s=l.body.getReader(),i=new TextDecoder;let c="";for(;;){const{done:u,value:f}=await s.read();if(u)break;c+=i.decode(f,{stream:!0});const h=c.split(`
|
|
`);c=h.pop()||"";for(const d of h)if(d.trim())try{const y=JSON.parse(d);y.response?t(y.response):y.error&&r&&r(y.error)}catch(y){console.error("Error parsing stream chunk:",d,y),r&&r(`Error parsing server response: ${d}`)}}if(c.trim())try{const u=JSON.parse(c);u.response?t(u.response):u.error&&r&&r(u.error)}catch(u){console.error("Error parsing final chunk:",c,u),r&&r(`Error parsing final server response: ${c}`)}}catch(l){const s=or(l);if(s==="Authentication required"){console.error("Authentication required for stream request"),r&&r("Authentication required");return}const i=s.match(/^(\d{3})\s/);if(i){const c=parseInt(i[1],10);let u=s;switch(c){case 403:u="You do not have permission to access this resource (403 Forbidden)",console.error("Permission denied for stream request:",s);break;case 404:u="The requested resource does not exist (404 Not Found)",console.error("Resource not found for stream request:",s);break;case 429:u="Too many requests, please try again later (429 Too Many Requests)",console.error("Rate limited for stream request:",s);break;case 500:case 502:case 503:case 504:u=`Server error, please try again later (${c})`,console.error("Server error for stream request:",s);break;default:console.error("Stream request failed with status code:",c,s)}r&&r(u);return}if(s.includes("NetworkError")||s.includes("Failed to fetch")||s.includes("Network request failed")){console.error("Network error for stream request:",s),r&&r("Network connection error, please check your internet connection");return}if(s.includes("Error parsing")||s.includes("SyntaxError")){console.error("JSON parsing error in stream:",s),r&&r("Error processing response data");return}console.error("Unhandled stream error:",s),r?r(s):console.error("No error handler provided for stream error:",s)}},ap=async(e,t)=>{const r=new FormData;return r.append("file",e),(await _e.post("/documents/upload",r,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:t!==void 0?a=>{const o=Math.round(a.loaded*100/a.total);t(o)}:void 0})).data},sp=async()=>(await _e.delete("/documents")).data,ip=async e=>(await _e.post("/documents/clear_cache",{modes:e})).data,lp=async(e,t=!1)=>(await _e.delete("/documents/delete_document",{data:{doc_ids:e,delete_file:t}})).data,cp=async()=>{try{const e=await _e.get("/auth-status",{timeout:5e3,headers:{Accept:"application/json"}});if((e.headers["content-type"]||"").includes("text/html"))return console.warn("Received HTML response instead of JSON for auth-status endpoint"),{auth_configured:!0,auth_mode:"enabled"};if(e.data&&typeof e.data=="object"&&"auth_configured"in e.data&&typeof e.data.auth_configured=="boolean"){if(e.data.auth_configured)return e.data;if(e.data.access_token&&typeof e.data.access_token=="string")return e.data;console.warn("Auth not configured but no valid access token provided")}return console.warn("Received invalid auth status response:",e.data),{auth_configured:!0,auth_mode:"enabled"}}catch(e){return console.error("Failed to get auth status:",or(e)),{auth_configured:!0,auth_mode:"enabled"}}},up=async()=>(await _e.get("/documents/pipeline_status")).data,dp=async(e,t)=>{const r=new FormData;return r.append("username",e),r.append("password",t),(await _e.post("/login",r,{headers:{"Content-Type":"multipart/form-data"}})).data},cl=async(e,t,r=!1)=>(await _e.post("/graph/entity/edit",{entity_name:e,updated_data:t,allow_rename:r})).data,ul=async(e,t,r)=>(await _e.post("/graph/relation/edit",{source_id:e,target_id:t,updated_data:r})).data,dl=async e=>{try{return(await _e.get(`/graph/entity/exists?name=${encodeURIComponent(e)}`)).data.exists}catch(t){return console.error("Error checking entity name:",t),!1}},fl=nr()(e=>({health:!0,message:null,messageTitle:null,lastCheckTime:Date.now(),status:null,pipelineBusy:!1,check:async()=>{var r;const t=await ll();if(t.status==="healthy"){if((t.core_version||t.api_version)&&Xt.getState().setVersion(t.core_version||null,t.api_version||null),("webui_title"in t||"webui_description"in t)&&Xt.getState().setCustomTitle("webui_title"in t?t.webui_title??null:null,"webui_description"in t?t.webui_description??null:null),(r=t.configuration)!=null&&r.max_graph_nodes){const n=parseInt(t.configuration.max_graph_nodes,10);!isNaN(n)&&n>0&&Z.getState().backendMaxGraphNodes!==n&&(Z.getState().setBackendMaxGraphNodes(n),Z.getState().graphMaxNodes>n&&Z.getState().setGraphMaxNodes(n,!0))}return e({health:!0,message:null,messageTitle:null,lastCheckTime:Date.now(),status:t,pipelineBusy:t.pipeline_busy}),!0}return e({health:!1,message:t.message,messageTitle:"Backend Health Check Error!",lastCheckTime:Date.now(),status:null}),!1},clear:()=>{e({health:!0,message:null,messageTitle:null})},setErrorMessage:(t,r)=>{e({health:!1,message:t,messageTitle:r})},setPipelineBusy:t=>{e({pipelineBusy:t})}})),kn=En(fl),Ca=e=>{try{const t=e.split(".");return t.length!==3?{}:JSON.parse(atob(t[1]))}catch(t){return console.error("Error parsing token payload:",t),{}}},Ta=e=>Ca(e).sub||null,hl=e=>Ca(e).role==="guest",gl=()=>{const e=localStorage.getItem("LIGHTRAG-API-TOKEN"),t=localStorage.getItem("LIGHTRAG-CORE-VERSION"),r=localStorage.getItem("LIGHTRAG-API-VERSION"),n=localStorage.getItem("LIGHTRAG-WEBUI-TITLE"),a=localStorage.getItem("LIGHTRAG-WEBUI-DESCRIPTION"),o=e?Ta(e):null;return e?{isAuthenticated:!0,isGuestMode:hl(e),coreVersion:t,apiVersion:r,username:o,webuiTitle:n,webuiDescription:a}:{isAuthenticated:!1,isGuestMode:!1,coreVersion:t,apiVersion:r,username:null,webuiTitle:n,webuiDescription:a}},Xt=nr(e=>{const t=gl();return{isAuthenticated:t.isAuthenticated,isGuestMode:t.isGuestMode,coreVersion:t.coreVersion,apiVersion:t.apiVersion,username:t.username,webuiTitle:t.webuiTitle,webuiDescription:t.webuiDescription,login:(r,n=!1,a=null,o=null,l=null,s=null)=>{localStorage.setItem("LIGHTRAG-API-TOKEN",r),a&&localStorage.setItem("LIGHTRAG-CORE-VERSION",a),o&&localStorage.setItem("LIGHTRAG-API-VERSION",o),l?localStorage.setItem("LIGHTRAG-WEBUI-TITLE",l):localStorage.removeItem("LIGHTRAG-WEBUI-TITLE"),s?localStorage.setItem("LIGHTRAG-WEBUI-DESCRIPTION",s):localStorage.removeItem("LIGHTRAG-WEBUI-DESCRIPTION");const i=Ta(r);e({isAuthenticated:!0,isGuestMode:n,username:i,coreVersion:a,apiVersion:o,webuiTitle:l,webuiDescription:s})},logout:()=>{localStorage.removeItem("LIGHTRAG-API-TOKEN");const r=localStorage.getItem("LIGHTRAG-CORE-VERSION"),n=localStorage.getItem("LIGHTRAG-API-VERSION"),a=localStorage.getItem("LIGHTRAG-WEBUI-TITLE"),o=localStorage.getItem("LIGHTRAG-WEBUI-DESCRIPTION");e({isAuthenticated:!1,isGuestMode:!1,username:null,coreVersion:r,apiVersion:n,webuiTitle:a,webuiDescription:o})},setVersion:(r,n)=>{r&&localStorage.setItem("LIGHTRAG-CORE-VERSION",r),n&&localStorage.setItem("LIGHTRAG-API-VERSION",n),e({coreVersion:r,apiVersion:n})},setCustomTitle:(r,n)=>{r?localStorage.setItem("LIGHTRAG-WEBUI-TITLE",r):localStorage.removeItem("LIGHTRAG-WEBUI-TITLE"),n?localStorage.setItem("LIGHTRAG-WEBUI-DESCRIPTION",n):localStorage.removeItem("LIGHTRAG-WEBUI-DESCRIPTION"),e({webuiTitle:r,webuiDescription:n})}}});var pl=e=>{switch(e){case"success":return yl;case"info":return wl;case"warning":return bl;case"error":return xl;default:return null}},ml=Array(12).fill(0),vl=({visible:e,className:t})=>W.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},W.createElement("div",{className:"sonner-spinner"},ml.map((r,n)=>W.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),yl=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),bl=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),wl=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),xl=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),_l=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},W.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),W.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Sl=()=>{let[e,t]=W.useState(document.hidden);return W.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},en=1,El=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:en++,o=this.toasts.find(s=>s.id===a),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(s=>s.id===a?(this.publish({...s,...e,id:a,title:r}),{...s,...e,id:a,dismissible:l,title:r}):s):this.addToast({title:r,...n,dismissible:l,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),a=r!==void 0,o,l=n.then(async i=>{if(o=["resolve",i],W.isValidElement(i))a=!1,this.create({id:r,type:"default",message:i});else if(Cl(i)&&!i.ok){a=!1;let c=typeof t.error=="function"?await t.error(`HTTP error! status: ${i.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${i.status}`):t.description;this.create({id:r,type:"error",message:c,description:u})}else if(t.success!==void 0){a=!1;let c=typeof t.success=="function"?await t.success(i):t.success,u=typeof t.description=="function"?await t.description(i):t.description;this.create({id:r,type:"success",message:c,description:u})}}).catch(async i=>{if(o=["reject",i],t.error!==void 0){a=!1;let c=typeof t.error=="function"?await t.error(i):t.error,u=typeof t.description=="function"?await t.description(i):t.description;this.create({id:r,type:"error",message:c,description:u})}}).finally(()=>{var i;a&&(this.dismiss(r),r=void 0),(i=t.finally)==null||i.call(t)}),s=()=>new Promise((i,c)=>l.then(()=>o[0]==="reject"?c(o[1]):i(o[1])).catch(c));return typeof r!="string"&&typeof r!="number"?{unwrap:s}:Object.assign(r,{unwrap:s})},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||en++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ae=new El,kl=(e,t)=>{let r=(t==null?void 0:t.id)||en++;return Ae.addToast({title:e,...t,id:r}),r},Cl=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Tl=kl,Rl=()=>Ae.toasts,Al=()=>Ae.getActiveToasts(),rt=Object.assign(Tl,{success:Ae.success,info:Ae.info,warning:Ae.warning,error:Ae.error,custom:Ae.custom,message:Ae.message,promise:Ae.promise,dismiss:Ae.dismiss,loading:Ae.loading},{getHistory:Rl,getToasts:Al});function jl(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}jl(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
`);function Pt(e){return e.label!==void 0}var Il=3,Nl="32px",Ll="16px",Jn=4e3,Pl=356,zl=14,Dl=20,Ol=200;function Fe(...e){return e.filter(Boolean).join(" ")}function Gl(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var Fl=e=>{var t,r,n,a,o,l,s,i,c,u,f;let{invert:h,toast:d,unstyled:y,interacting:b,setHeights:C,visibleToasts:j,heights:_,index:A,toasts:I,expanded:N,removeToast:z,defaultRichColors:m,closeButton:E,style:x,cancelButtonStyle:T,actionButtonStyle:R,className:O="",descriptionClassName:w="",duration:H,position:K,gap:D,loadingIcon:k,expandByDefault:S,classNames:B,icons:ae,closeButtonAriaLabel:M="Close toast",pauseWhenPageIsHidden:v}=e,[P,V]=W.useState(null),[$,Q]=W.useState(null),[X,Y]=W.useState(!1),[se,ne]=W.useState(!1),[ie,F]=W.useState(!1),[J,q]=W.useState(!1),[U,L]=W.useState(!1),[oe,ue]=W.useState(0),[re,ee]=W.useState(0),G=W.useRef(d.duration||H||Jn),ge=W.useRef(null),pe=W.useRef(null),ye=A===0,we=A+1<=j,de=d.type,me=d.dismissible!==!1,Ie=d.className||"",Ce=d.descriptionClassName||"",Te=W.useMemo(()=>_.findIndex(ce=>ce.toastId===d.id)||0,[_,d.id]),Pe=W.useMemo(()=>{var ce;return(ce=d.closeButton)!=null?ce:E},[d.closeButton,E]),Ye=W.useMemo(()=>d.duration||H||Jn,[d.duration,H]),Ke=W.useRef(0),Re=W.useRef(0),it=W.useRef(0),ze=W.useRef(null),[ui,di]=K.split("-"),Vn=W.useMemo(()=>_.reduce((ce,he,ve)=>ve>=Te?ce:ce+he.height,0),[_,Te]),Un=Sl(),fi=d.invert||h,pr=de==="loading";Re.current=W.useMemo(()=>Te*D+Vn,[Te,Vn]),W.useEffect(()=>{G.current=Ye},[Ye]),W.useEffect(()=>{Y(!0)},[]),W.useEffect(()=>{let ce=pe.current;if(ce){let he=ce.getBoundingClientRect().height;return ee(he),C(ve=>[{toastId:d.id,height:he,position:d.position},...ve]),()=>C(ve=>ve.filter(De=>De.toastId!==d.id))}},[C,d.id]),W.useLayoutEffect(()=>{if(!X)return;let ce=pe.current,he=ce.style.height;ce.style.height="auto";let ve=ce.getBoundingClientRect().height;ce.style.height=he,ee(ve),C(De=>De.find(Oe=>Oe.toastId===d.id)?De.map(Oe=>Oe.toastId===d.id?{...Oe,height:ve}:Oe):[{toastId:d.id,height:ve,position:d.position},...De])},[X,d.title,d.description,C,d.id]);let Qe=W.useCallback(()=>{ne(!0),ue(Re.current),C(ce=>ce.filter(he=>he.toastId!==d.id)),setTimeout(()=>{z(d)},Ol)},[d,z,C,Re]);W.useEffect(()=>{if(d.promise&&de==="loading"||d.duration===1/0||d.type==="loading")return;let ce;return N||b||v&&Un?(()=>{if(it.current<Ke.current){let he=new Date().getTime()-Ke.current;G.current=G.current-he}it.current=new Date().getTime()})():G.current!==1/0&&(Ke.current=new Date().getTime(),ce=setTimeout(()=>{var he;(he=d.onAutoClose)==null||he.call(d,d),Qe()},G.current)),()=>clearTimeout(ce)},[N,b,d,de,v,Un,Qe]),W.useEffect(()=>{d.delete&&Qe()},[Qe,d.delete]);function hi(){var ce,he,ve;return ae!=null&&ae.loading?W.createElement("div",{className:Fe(B==null?void 0:B.loader,(ce=d==null?void 0:d.classNames)==null?void 0:ce.loader,"sonner-loader"),"data-visible":de==="loading"},ae.loading):k?W.createElement("div",{className:Fe(B==null?void 0:B.loader,(he=d==null?void 0:d.classNames)==null?void 0:he.loader,"sonner-loader"),"data-visible":de==="loading"},k):W.createElement(vl,{className:Fe(B==null?void 0:B.loader,(ve=d==null?void 0:d.classNames)==null?void 0:ve.loader),visible:de==="loading"})}return W.createElement("li",{tabIndex:0,ref:pe,className:Fe(O,Ie,B==null?void 0:B.toast,(t=d==null?void 0:d.classNames)==null?void 0:t.toast,B==null?void 0:B.default,B==null?void 0:B[de],(r=d==null?void 0:d.classNames)==null?void 0:r[de]),"data-sonner-toast":"","data-rich-colors":(n=d.richColors)!=null?n:m,"data-styled":!(d.jsx||d.unstyled||y),"data-mounted":X,"data-promise":!!d.promise,"data-swiped":U,"data-removed":se,"data-visible":we,"data-y-position":ui,"data-x-position":di,"data-index":A,"data-front":ye,"data-swiping":ie,"data-dismissible":me,"data-type":de,"data-invert":fi,"data-swipe-out":J,"data-swipe-direction":$,"data-expanded":!!(N||S&&X),style:{"--index":A,"--toasts-before":A,"--z-index":I.length-A,"--offset":`${se?oe:Re.current}px`,"--initial-height":S?"auto":`${re}px`,...x,...d.style},onDragEnd:()=>{F(!1),V(null),ze.current=null},onPointerDown:ce=>{pr||!me||(ge.current=new Date,ue(Re.current),ce.target.setPointerCapture(ce.pointerId),ce.target.tagName!=="BUTTON"&&(F(!0),ze.current={x:ce.clientX,y:ce.clientY}))},onPointerUp:()=>{var ce,he,ve,De;if(J||!me)return;ze.current=null;let Oe=Number(((ce=pe.current)==null?void 0:ce.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Je=Number(((he=pe.current)==null?void 0:he.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),lt=new Date().getTime()-((ve=ge.current)==null?void 0:ve.getTime()),Ge=P==="x"?Oe:Je,Ze=Math.abs(Ge)/lt;if(Math.abs(Ge)>=Dl||Ze>.11){ue(Re.current),(De=d.onDismiss)==null||De.call(d,d),Q(P==="x"?Oe>0?"right":"left":Je>0?"down":"up"),Qe(),q(!0),L(!1);return}F(!1),V(null)},onPointerMove:ce=>{var he,ve,De,Oe;if(!ze.current||!me||((he=window.getSelection())==null?void 0:he.toString().length)>0)return;let Je=ce.clientY-ze.current.y,lt=ce.clientX-ze.current.x,Ge=(ve=e.swipeDirections)!=null?ve:Gl(K);!P&&(Math.abs(lt)>1||Math.abs(Je)>1)&&V(Math.abs(lt)>Math.abs(Je)?"x":"y");let Ze={x:0,y:0};P==="y"?(Ge.includes("top")||Ge.includes("bottom"))&&(Ge.includes("top")&&Je<0||Ge.includes("bottom")&&Je>0)&&(Ze.y=Je):P==="x"&&(Ge.includes("left")||Ge.includes("right"))&&(Ge.includes("left")&<<0||Ge.includes("right")&<>0)&&(Ze.x=lt),(Math.abs(Ze.x)>0||Math.abs(Ze.y)>0)&&L(!0),(De=pe.current)==null||De.style.setProperty("--swipe-amount-x",`${Ze.x}px`),(Oe=pe.current)==null||Oe.style.setProperty("--swipe-amount-y",`${Ze.y}px`)}},Pe&&!d.jsx?W.createElement("button",{"aria-label":M,"data-disabled":pr,"data-close-button":!0,onClick:pr||!me?()=>{}:()=>{var ce;Qe(),(ce=d.onDismiss)==null||ce.call(d,d)},className:Fe(B==null?void 0:B.closeButton,(a=d==null?void 0:d.classNames)==null?void 0:a.closeButton)},(o=ae==null?void 0:ae.close)!=null?o:_l):null,d.jsx||p.isValidElement(d.title)?d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title:W.createElement(W.Fragment,null,de||d.icon||d.promise?W.createElement("div",{"data-icon":"",className:Fe(B==null?void 0:B.icon,(l=d==null?void 0:d.classNames)==null?void 0:l.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||hi():null,d.type!=="loading"?d.icon||(ae==null?void 0:ae[de])||pl(de):null):null,W.createElement("div",{"data-content":"",className:Fe(B==null?void 0:B.content,(s=d==null?void 0:d.classNames)==null?void 0:s.content)},W.createElement("div",{"data-title":"",className:Fe(B==null?void 0:B.title,(i=d==null?void 0:d.classNames)==null?void 0:i.title)},typeof d.title=="function"?d.title():d.title),d.description?W.createElement("div",{"data-description":"",className:Fe(w,Ce,B==null?void 0:B.description,(c=d==null?void 0:d.classNames)==null?void 0:c.description)},typeof d.description=="function"?d.description():d.description):null),p.isValidElement(d.cancel)?d.cancel:d.cancel&&Pt(d.cancel)?W.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||T,onClick:ce=>{var he,ve;Pt(d.cancel)&&me&&((ve=(he=d.cancel).onClick)==null||ve.call(he,ce),Qe())},className:Fe(B==null?void 0:B.cancelButton,(u=d==null?void 0:d.classNames)==null?void 0:u.cancelButton)},d.cancel.label):null,p.isValidElement(d.action)?d.action:d.action&&Pt(d.action)?W.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||R,onClick:ce=>{var he,ve;Pt(d.action)&&((ve=(he=d.action).onClick)==null||ve.call(he,ce),!ce.defaultPrevented&&Qe())},className:Fe(B==null?void 0:B.actionButton,(f=d==null?void 0:d.classNames)==null?void 0:f.actionButton)},d.action.label):null))};function Zn(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Ml(e,t){let r={};return[e,t].forEach((n,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",s=o?Ll:Nl;function i(c){["top","right","bottom","left"].forEach(u=>{r[`${l}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof n=="number"||typeof n=="string"?i(n):typeof n=="object"?["top","right","bottom","left"].forEach(c=>{n[c]===void 0?r[`${l}-${c}`]=s:r[`${l}-${c}`]=typeof n[c]=="number"?`${n[c]}px`:n[c]}):i(s)}),r}var fp=p.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:s,offset:i,mobileOffset:c,theme:u="light",richColors:f,duration:h,style:d,visibleToasts:y=Il,toastOptions:b,dir:C=Zn(),gap:j=zl,loadingIcon:_,icons:A,containerAriaLabel:I="Notifications",pauseWhenPageIsHidden:N}=e,[z,m]=W.useState([]),E=W.useMemo(()=>Array.from(new Set([n].concat(z.filter(v=>v.position).map(v=>v.position)))),[z,n]),[x,T]=W.useState([]),[R,O]=W.useState(!1),[w,H]=W.useState(!1),[K,D]=W.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),k=W.useRef(null),S=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),B=W.useRef(null),ae=W.useRef(!1),M=W.useCallback(v=>{m(P=>{var V;return(V=P.find($=>$.id===v.id))!=null&&V.delete||Ae.dismiss(v.id),P.filter(({id:$})=>$!==v.id)})},[]);return W.useEffect(()=>Ae.subscribe(v=>{if(v.dismiss){m(P=>P.map(V=>V.id===v.id?{...V,delete:!0}:V));return}setTimeout(()=>{mi.flushSync(()=>{m(P=>{let V=P.findIndex($=>$.id===v.id);return V!==-1?[...P.slice(0,V),{...P[V],...v},...P.slice(V+1)]:[v,...P]})})})}),[]),W.useEffect(()=>{if(u!=="system"){D(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?D("dark"):D("light")),typeof window>"u")return;let v=window.matchMedia("(prefers-color-scheme: dark)");try{v.addEventListener("change",({matches:P})=>{D(P?"dark":"light")})}catch{v.addListener(({matches:V})=>{try{D(V?"dark":"light")}catch($){console.error($)}})}},[u]),W.useEffect(()=>{z.length<=1&&O(!1)},[z]),W.useEffect(()=>{let v=P=>{var V,$;a.every(Q=>P[Q]||P.code===Q)&&(O(!0),(V=k.current)==null||V.focus()),P.code==="Escape"&&(document.activeElement===k.current||($=k.current)!=null&&$.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[a]),W.useEffect(()=>{if(k.current)return()=>{B.current&&(B.current.focus({preventScroll:!0}),B.current=null,ae.current=!1)}},[k.current]),W.createElement("section",{ref:t,"aria-label":`${I} ${S}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},E.map((v,P)=>{var V;let[$,Q]=v.split("-");return z.length?W.createElement("ol",{key:v,dir:C==="auto"?Zn():C,tabIndex:-1,ref:k,className:s,"data-sonner-toaster":!0,"data-theme":K,"data-y-position":$,"data-lifted":R&&z.length>1&&!o,"data-x-position":Q,style:{"--front-toast-height":`${((V=x[0])==null?void 0:V.height)||0}px`,"--width":`${Pl}px`,"--gap":`${j}px`,...d,...Ml(i,c)},onBlur:X=>{ae.current&&!X.currentTarget.contains(X.relatedTarget)&&(ae.current=!1,B.current&&(B.current.focus({preventScroll:!0}),B.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||ae.current||(ae.current=!0,B.current=X.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{w||O(!1)},onDragEnd:()=>O(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},z.filter(X=>!X.position&&P===0||X.position===v).map((X,Y)=>{var se,ne;return W.createElement(Fl,{key:X.id,icons:A,index:Y,toast:X,defaultRichColors:f,duration:(se=b==null?void 0:b.duration)!=null?se:h,className:b==null?void 0:b.className,descriptionClassName:b==null?void 0:b.descriptionClassName,invert:r,visibleToasts:y,closeButton:(ne=b==null?void 0:b.closeButton)!=null?ne:l,interacting:w,position:v,style:b==null?void 0:b.style,unstyled:b==null?void 0:b.unstyled,classNames:b==null?void 0:b.classNames,cancelButtonStyle:b==null?void 0:b.cancelButtonStyle,actionButtonStyle:b==null?void 0:b.actionButtonStyle,removeToast:M,toasts:z.filter(ie=>ie.position==X.position),heights:x.filter(ie=>ie.position==X.position),setHeights:T,expandByDefault:o,gap:j,loadingIcon:_,expanded:R,pauseWhenPageIsHidden:N,swipeDirections:e.swipeDirections})})):null}))});const $l={theme:"system",setTheme:()=>null},Ra=p.createContext($l);function hp({children:e,...t}){const r=Z.use.theme(),n=Z.use.setTheme();p.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),r==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)"),s=i=>{o.classList.remove("light","dark"),o.classList.add(i.matches?"dark":"light")};return o.classList.add(l.matches?"dark":"light"),l.addEventListener("change",s),()=>l.removeEventListener("change",s)}else o.classList.add(r)},[r]);const a={theme:r,setTheme:n};return g.jsx(Ra.Provider,{...t,value:a,children:e})}const Hl=(e,t,r,n)=>{var o,l,s,i;const a=[r,{code:t,...n||{}}];if((l=(o=e==null?void 0:e.services)==null?void 0:o.logger)!=null&&l.forward)return e.services.logger.forward(a,"warn","react-i18next::",!0);ht(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),(i=(s=e==null?void 0:e.services)==null?void 0:s.logger)!=null&&i.warn?e.services.logger.warn(...a):console!=null&&console.warn&&console.warn(...a)},eo={},tn=(e,t,r,n)=>{ht(r)&&eo[r]||(ht(r)&&(eo[r]=new Date),Hl(e,t,r,n))},Aa=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},rn=(e,t,r)=>{e.loadNamespaces(t,Aa(e,r))},to=(e,t,r,n)=>{if(ht(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return rn(e,r,n);r.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,Aa(e,n))},Bl=(e,t,r={})=>!t.languages||!t.languages.length?(tn(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:r.lng,precheck:(n,a)=>{var o;if(((o=r.bindI18n)==null?void 0:o.indexOf("languageChanging"))>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!a(n.isLanguageChangingTo,e))return!1}}),ht=e=>typeof e=="string",Vl=e=>typeof e=="object"&&e!==null,Ul=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,ql={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Wl=e=>ql[e],Xl=e=>e.replace(Ul,Wl);let nn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Xl};const Yl=(e={})=>{nn={...nn,...e}},Kl=()=>nn;let ja;const Ql=e=>{ja=e},Jl=()=>ja,gp={type:"3rdParty",init(e){Yl(e.options.react),Ql(e)}},Zl=p.createContext();class ec{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const tc=(e,t)=>{const r=p.useRef();return p.useEffect(()=>{r.current=e},[e,t]),r.current},Ia=(e,t,r,n)=>e.getFixedT(t,r,n),rc=(e,t,r,n)=>p.useCallback(Ia(e,t,r,n),[e,t,r,n]),Se=(e,t={})=>{var I,N,z,m;const{i18n:r}=t,{i18n:n,defaultNS:a}=p.useContext(Zl)||{},o=r||n||Jl();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new ec),!o){tn(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const E=(T,R)=>ht(R)?R:Vl(R)&&ht(R.defaultValue)?R.defaultValue:Array.isArray(T)?T[T.length-1]:T,x=[E,{},!1];return x.t=E,x.i18n={},x.ready=!1,x}(I=o.options.react)!=null&&I.wait&&tn(o,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const l={...Kl(),...o.options.react,...t},{useSuspense:s,keyPrefix:i}=l;let c=a||((N=o.options)==null?void 0:N.defaultNS);c=ht(c)?[c]:c||["translation"],(m=(z=o.reportNamespaces).addUsedNamespaces)==null||m.call(z,c);const u=(o.isInitialized||o.initializedStoreOnce)&&c.every(E=>Bl(E,o,l)),f=rc(o,t.lng||null,l.nsMode==="fallback"?c:c[0],i),h=()=>f,d=()=>Ia(o,t.lng||null,l.nsMode==="fallback"?c:c[0],i),[y,b]=p.useState(h);let C=c.join();t.lng&&(C=`${t.lng}${C}`);const j=tc(C),_=p.useRef(!0);p.useEffect(()=>{const{bindI18n:E,bindI18nStore:x}=l;_.current=!0,!u&&!s&&(t.lng?to(o,t.lng,c,()=>{_.current&&b(d)}):rn(o,c,()=>{_.current&&b(d)})),u&&j&&j!==C&&_.current&&b(d);const T=()=>{_.current&&b(d)};return E&&(o==null||o.on(E,T)),x&&(o==null||o.store.on(x,T)),()=>{_.current=!1,o&&(E==null||E.split(" ").forEach(R=>o.off(R,T))),x&&o&&x.split(" ").forEach(R=>o.store.off(R,T))}},[o,C]),p.useEffect(()=>{_.current&&u&&b(h)},[o,i,u]);const A=[y,o,u];if(A.t=y,A.i18n=o,A.ready=u,u||!u&&!s)return A;throw new Promise(E=>{t.lng?to(o,t.lng,c,()=>E()):rn(o,c,()=>E())})},ro=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,no=_a,nc=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return no(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:o}=t,l=Object.keys(a).map(c=>{const u=r==null?void 0:r[c],f=o==null?void 0:o[c];if(u===null)return null;const h=ro(u)||ro(f);return a[c][h]}),s=r&&Object.entries(r).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),i=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((c,u)=>{let{class:f,className:h,...d}=u;return Object.entries(d).every(y=>{let[b,C]=y;return Array.isArray(C)?C.includes({...o,...s}[b]):{...o,...s}[b]===C})?[...c,f,h]:c},[]);return no(e,l,i,r==null?void 0:r.class,r==null?void 0:r.className)};var[ar,pp]=xn("Tooltip",[pa]),sr=pa(),Na="TooltipProvider",oc=700,on="tooltip.open",[ac,Cn]=ar(Na),La=e=>{const{__scopeTooltip:t,delayDuration:r=oc,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:o}=e,l=p.useRef(!0),s=p.useRef(!1),i=p.useRef(0);return p.useEffect(()=>{const c=i.current;return()=>window.clearTimeout(c)},[]),g.jsx(ac,{scope:t,isOpenDelayedRef:l,delayDuration:r,onOpen:p.useCallback(()=>{window.clearTimeout(i.current),l.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>l.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:p.useCallback(c=>{s.current=c},[]),disableHoverableContent:a,children:o})};La.displayName=Na;var At="Tooltip",[sc,ir]=ar(At),Pa=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:s}=e,i=Cn(At,e.__scopeTooltip),c=sr(t),[u,f]=p.useState(null),h=ft(),d=p.useRef(0),y=l??i.disableHoverableContent,b=s??i.delayDuration,C=p.useRef(!1),[j,_]=ma({prop:n,defaultProp:a??!1,onChange:m=>{m?(i.onOpen(),document.dispatchEvent(new CustomEvent(on))):i.onClose(),o==null||o(m)},caller:At}),A=p.useMemo(()=>j?C.current?"delayed-open":"instant-open":"closed",[j]),I=p.useCallback(()=>{window.clearTimeout(d.current),d.current=0,C.current=!1,_(!0)},[_]),N=p.useCallback(()=>{window.clearTimeout(d.current),d.current=0,_(!1)},[_]),z=p.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>{C.current=!0,_(!0),d.current=0},b)},[b,_]);return p.useEffect(()=>()=>{d.current&&(window.clearTimeout(d.current),d.current=0)},[]),g.jsx(ji,{...c,children:g.jsx(sc,{scope:t,contentId:h,open:j,stateAttribute:A,trigger:u,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{i.isOpenDelayedRef.current?z():I()},[i.isOpenDelayedRef,z,I]),onTriggerLeave:p.useCallback(()=>{y?N():(window.clearTimeout(d.current),d.current=0)},[N,y]),onOpen:I,onClose:N,disableHoverableContent:y,children:r})})};Pa.displayName=At;var an="TooltipTrigger",za=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=ir(an,r),o=Cn(an,r),l=sr(r),s=p.useRef(null),i=Ve(t,s,a.onTriggerChange),c=p.useRef(!1),u=p.useRef(!1),f=p.useCallback(()=>c.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),g.jsx(Ii,{asChild:!0,...l,children:g.jsx(xe.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:i,onPointerMove:ke(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:ke(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:ke(e.onPointerDown,()=>{a.open&&a.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ke(e.onFocus,()=>{c.current||a.onOpen()}),onBlur:ke(e.onBlur,a.onClose),onClick:ke(e.onClick,a.onClose)})})});za.displayName=an;var ic="TooltipPortal",[mp,lc]=ar(ic,{forceMount:void 0}),wt="TooltipContent",Da=p.forwardRef((e,t)=>{const r=lc(wt,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...o}=e,l=ir(wt,e.__scopeTooltip);return g.jsx(_t,{present:n||l.open,children:l.disableHoverableContent?g.jsx(Oa,{side:a,...o,ref:t}):g.jsx(cc,{side:a,...o,ref:t})})}),cc=p.forwardRef((e,t)=>{const r=ir(wt,e.__scopeTooltip),n=Cn(wt,e.__scopeTooltip),a=p.useRef(null),o=Ve(t,a),[l,s]=p.useState(null),{trigger:i,onClose:c}=r,u=a.current,{onPointerInTransitChange:f}=n,h=p.useCallback(()=>{s(null),f(!1)},[f]),d=p.useCallback((y,b)=>{const C=y.currentTarget,j={x:y.clientX,y:y.clientY},_=gc(j,C.getBoundingClientRect()),A=pc(j,_),I=mc(b.getBoundingClientRect()),N=yc([...A,...I]);s(N),f(!0)},[f]);return p.useEffect(()=>()=>h(),[h]),p.useEffect(()=>{if(i&&u){const y=C=>d(C,u),b=C=>d(C,i);return i.addEventListener("pointerleave",y),u.addEventListener("pointerleave",b),()=>{i.removeEventListener("pointerleave",y),u.removeEventListener("pointerleave",b)}}},[i,u,d,h]),p.useEffect(()=>{if(l){const y=b=>{const C=b.target,j={x:b.clientX,y:b.clientY},_=(i==null?void 0:i.contains(C))||(u==null?void 0:u.contains(C)),A=!vc(j,l);_?h():A&&(h(),c())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[i,u,l,c,h]),g.jsx(Oa,{...e,ref:o})}),[uc,dc]=ar(At,{isInside:!1}),fc=Ri("TooltipContent"),Oa=p.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...s}=e,i=ir(wt,r),c=sr(r),{onClose:u}=i;return p.useEffect(()=>(document.addEventListener(on,u),()=>document.removeEventListener(on,u)),[u]),p.useEffect(()=>{if(i.trigger){const f=h=>{const d=h.target;d!=null&&d.contains(i.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[i.trigger,u]),g.jsx(Ci,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:g.jsxs(Ti,{"data-state":i.stateAttribute,...c,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(fc,{children:n}),g.jsx(uc,{scope:r,isInside:!0,children:g.jsx(Ai,{id:i.contentId,role:"tooltip",children:a||n})})]})})});Da.displayName=wt;var Ga="TooltipArrow",hc=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=sr(r);return dc(Ga,r).isInside?null:g.jsx(Ni,{...a,...n,ref:t})});hc.displayName=Ga;function gc(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,a,o)){case o:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function pc(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function mc(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function vc(e,t){const{x:r,y:n}=e;let a=!1;for(let o=0,l=t.length-1;o<t.length;l=o++){const s=t[o],i=t[l],c=s.x,u=s.y,f=i.x,h=i.y;u>n!=h>n&&r<(f-c)*(n-u)/(h-u)+c&&(a=!a)}return a}function yc(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),bc(t)}function bc(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];for(;t.length>=2;){const o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const o=r[r.length-1],l=r[r.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var wc=La,xc=Pa,_c=za,Fa=Da;const Ma=wc,$a=xc,Ha=_c,Sc=e=>typeof e!="string"?e:g.jsx("div",{className:"relative top-0 pt-1 whitespace-pre-wrap break-words",children:e}),Tn=p.forwardRef(({className:e,side:t="left",align:r="start",children:n,...a},o)=>{const l=p.useRef(null);return p.useEffect(()=>{l.current&&(l.current.scrollTop=0)},[n]),g.jsx(Fa,{ref:o,side:t,align:r,className:fe("bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-[60vh] overflow-y-auto whitespace-pre-wrap break-words rounded-md border px-3 py-2 text-sm shadow-md z-60",e),...a,children:typeof n=="string"?Sc(n):n})});Tn.displayName=Fa.displayName;const oo=nc("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"size-8"}},defaultVariants:{variant:"default",size:"default"}}),be=p.forwardRef(({className:e,variant:t,tooltip:r,size:n,side:a="right",asChild:o=!1,...l},s)=>{const i=o?Li:"button";return r?g.jsx(Ma,{children:g.jsxs($a,{children:[g.jsx(Ha,{asChild:!0,children:g.jsx(i,{className:fe(oo({variant:t,size:n,className:e}),"cursor-pointer"),ref:s,...l})}),g.jsx(Tn,{side:a,children:r})]})}):g.jsx(i,{className:fe(oo({variant:t,size:n,className:e}),"cursor-pointer"),ref:s,...l})});be.displayName="Button";const Yt=p.forwardRef(({className:e,type:t,...r},n)=>g.jsx("input",{type:t,className:fe("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 rounded-md border bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm [&::-webkit-inner-spin-button]:opacity-50 [&::-webkit-outer-spin-button]:opacity-50",e),ref:n,...r}));Yt.displayName="Input";/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Ec=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ba=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/var kc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Cc=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:l,...s},i)=>p.createElement("svg",{ref:i,...kc,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Ba("lucide",a),...s},[...l.map(([c,u])=>p.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const le=(e,t)=>{const r=p.forwardRef(({className:n,...a},o)=>p.createElement(Cc,{ref:o,iconNode:t,className:Ba(`lucide-${Ec(e)}`,n),...a}));return r.displayName=`${e}`,r};/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Tc=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],vp=le("Activity",Tc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Rc=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],yp=le("AlignCenter",Rc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Ac=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],bp=le("AlignLeft",Ac);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const jc=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],wp=le("AlignRight",jc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Ic=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],xp=le("ArrowDown",Ic);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Nc=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],_p=le("ArrowUp",Nc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Lc=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Pc=le("BookOpen",Lc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const zc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Va=le("Check",zc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Dc=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Sp=le("ChevronDown",Dc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Oc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ep=le("ChevronUp",Oc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Gc=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Fc=le("ChevronsUpDown",Gc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Mc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],kp=le("CircleAlert",Mc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const $c=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Cp=le("Copy",$c);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Hc=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],Tp=le("Eraser",Hc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Bc=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Rp=le("FileText",Bc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Vc=[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]],Ap=le("Files",Vc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Uc=[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]],jp=le("Filter",Uc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const qc=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]],Wc=le("Fullscreen",qc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Xc=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],Yc=le("GitBranchPlus",Xc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Kc=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Ip=le("Github",Kc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Qc=[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]],Jc=le("Grip",Qc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Zc=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ua=le("LoaderCircle",Zc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const eu=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],Np=le("Loader",eu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const tu=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],Lp=le("LogOut",tu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const ru=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],nu=le("Maximize",ru);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const ou=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],au=le("Minimize",ou);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const su=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],Pp=le("Palette",su);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const iu=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],lu=le("Pause",iu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const cu=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],uu=le("Pencil",cu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const du=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],fu=le("Play",du);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const hu=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],gu=le("RefreshCw",hu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const pu=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],mu=le("RotateCcw",pu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const vu=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],yu=le("RotateCw",vu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const bu=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],wu=le("Scissors",bu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const xu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],_u=le("Search",xu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Su=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],zp=le("Send",Su);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Eu=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ku=le("Settings",Eu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Cu=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],Dp=le("Trash",Cu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Tu=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Op=le("TriangleAlert",Tu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Ru=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],qa=le("Undo2",Ru);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Au=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],Gp=le("Upload",Au);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const ju=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Iu=le("X",ju);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Nu=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Fp=le("Zap",Nu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Lu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Pu=le("ZoomIn",Lu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const zu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Du=le("ZoomOut",zu),Ou=wa,Mp=zi,Gu=va,Wa=p.forwardRef(({className:e,...t},r)=>g.jsx(_n,{ref:r,className:fe("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/30",e),...t}));Wa.displayName=_n.displayName;const Xa=p.forwardRef(({className:e,children:t,...r},n)=>g.jsxs(Gu,{children:[g.jsx(Wa,{}),g.jsxs(Sn,{ref:n,className:fe("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),...r,children:[t,g.jsxs(Pi,{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:[g.jsx(Iu,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Xa.displayName=Sn.displayName;const Ya=({className:e,...t})=>g.jsx("div",{className:fe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ya.displayName="DialogHeader";const Ka=({className:e,...t})=>g.jsx("div",{className:fe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ka.displayName="DialogFooter";const Qa=p.forwardRef(({className:e,...t},r)=>g.jsx(ya,{ref:r,className:fe("text-lg leading-none font-semibold tracking-tight",e),...t}));Qa.displayName=ya.displayName;const Ja=p.forwardRef(({className:e,...t},r)=>g.jsx(ba,{ref:r,className:fe("text-muted-foreground text-sm",e),...t}));Ja.displayName=ba.displayName;const Rn=Oi,An=Gi,lr=p.forwardRef(({className:e,align:t="center",sideOffset:r=4,collisionPadding:n,sticky:a,avoidCollisions:o=!1,...l},s)=>g.jsx(Di,{children:g.jsx(xa,{ref:s,align:t,sideOffset:r,collisionPadding:n,sticky:a,avoidCollisions:o,className:fe("bg-popover text-popover-foreground 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 rounded-md border p-4 shadow-md outline-none",e),...l})}));lr.displayName=xa.displayName;var Fu=`
|
|
precision mediump float;
|
|
|
|
varying vec4 v_color;
|
|
varying float v_border;
|
|
|
|
const float radius = 0.5;
|
|
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
void main(void) {
|
|
vec2 m = gl_PointCoord - vec2(0.5, 0.5);
|
|
float dist = radius - length(m);
|
|
|
|
// No antialiasing for picking mode:
|
|
#ifdef PICKING_MODE
|
|
if (dist > v_border)
|
|
gl_FragColor = v_color;
|
|
else
|
|
gl_FragColor = transparent;
|
|
|
|
#else
|
|
float t = 0.0;
|
|
if (dist > v_border)
|
|
t = 1.0;
|
|
else if (dist > 0.0)
|
|
t = dist / v_border;
|
|
|
|
gl_FragColor = mix(transparent, v_color, t);
|
|
#endif
|
|
}
|
|
`,Mu=Fu,$u=`
|
|
attribute vec4 a_id;
|
|
attribute vec4 a_color;
|
|
attribute vec2 a_position;
|
|
attribute float a_size;
|
|
|
|
uniform float u_sizeRatio;
|
|
uniform float u_pixelRatio;
|
|
uniform mat3 u_matrix;
|
|
|
|
varying vec4 v_color;
|
|
varying float v_border;
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
|
|
void main() {
|
|
gl_Position = vec4(
|
|
(u_matrix * vec3(a_position, 1)).xy,
|
|
0,
|
|
1
|
|
);
|
|
|
|
// Multiply the point size twice:
|
|
// - x SCALING_RATIO to correct the canvas scaling
|
|
// - x 2 to correct the formulae
|
|
gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0;
|
|
|
|
v_border = (0.5 / a_size) * u_sizeRatio;
|
|
|
|
#ifdef PICKING_MODE
|
|
// For picking mode, we use the ID as the color:
|
|
v_color = a_id;
|
|
#else
|
|
// For normal mode, we use the color:
|
|
v_color = a_color;
|
|
#endif
|
|
|
|
v_color.a *= bias;
|
|
}
|
|
`,Hu=$u,Za=WebGLRenderingContext,ao=Za.UNSIGNED_BYTE,so=Za.FLOAT,Bu=["u_sizeRatio","u_pixelRatio","u_matrix"],Vu=function(e){function t(){return la(this,t),ca(this,t,arguments)}return aa(t,e),sa(t,[{key:"getDefinition",value:function(){return{VERTICES:1,VERTEX_SHADER_SOURCE:Hu,FRAGMENT_SHADER_SOURCE:Mu,METHOD:WebGLRenderingContext.POINTS,UNIFORMS:Bu,ATTRIBUTES:[{name:"a_position",size:2,type:so},{name:"a_size",size:1,type:so},{name:"a_color",size:4,type:ao,normalized:!0},{name:"a_id",size:4,type:ao,normalized:!0}]}}},{key:"processVisibleItem",value:function(n,a,o){var l=this.array;l[a++]=o.x,l[a++]=o.y,l[a++]=o.size,l[a++]=rr(o.color),l[a++]=n}},{key:"setUniforms",value:function(n,a){var o=n.sizeRatio,l=n.pixelRatio,s=n.matrix,i=a.gl,c=a.uniformLocations,u=c.u_sizeRatio,f=c.u_pixelRatio,h=c.u_matrix;i.uniform1f(f,l),i.uniform1f(u,o),i.uniformMatrix3fv(h,!1,s)}}])}(ia),Uu=`
|
|
attribute vec4 a_id;
|
|
attribute vec4 a_color;
|
|
attribute vec2 a_normal;
|
|
attribute float a_normalCoef;
|
|
attribute vec2 a_positionStart;
|
|
attribute vec2 a_positionEnd;
|
|
attribute float a_positionCoef;
|
|
attribute float a_sourceRadius;
|
|
attribute float a_targetRadius;
|
|
attribute float a_sourceRadiusCoef;
|
|
attribute float a_targetRadiusCoef;
|
|
|
|
uniform mat3 u_matrix;
|
|
uniform float u_zoomRatio;
|
|
uniform float u_sizeRatio;
|
|
uniform float u_pixelRatio;
|
|
uniform float u_correctionRatio;
|
|
uniform float u_minEdgeThickness;
|
|
uniform float u_lengthToThicknessRatio;
|
|
uniform float u_feather;
|
|
|
|
varying vec4 v_color;
|
|
varying vec2 v_normal;
|
|
varying float v_thickness;
|
|
varying float v_feather;
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
|
|
void main() {
|
|
float minThickness = u_minEdgeThickness;
|
|
|
|
vec2 normal = a_normal * a_normalCoef;
|
|
vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;
|
|
|
|
float normalLength = length(normal);
|
|
vec2 unitNormal = normal / normalLength;
|
|
|
|
// These first computations are taken from edge.vert.glsl. Please read it to
|
|
// get better comments on what's happening:
|
|
float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);
|
|
float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;
|
|
|
|
// Here, we move the point to leave space for the arrow heads:
|
|
// Source arrow head
|
|
float sourceRadius = a_sourceRadius * a_sourceRadiusCoef;
|
|
float sourceDirection = sign(sourceRadius);
|
|
float webGLSourceRadius = sourceDirection * sourceRadius * 2.0 * u_correctionRatio / u_sizeRatio;
|
|
float webGLSourceArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
|
|
vec2 sourceCompensationVector =
|
|
vec2(-sourceDirection * unitNormal.y, sourceDirection * unitNormal.x)
|
|
* (webGLSourceRadius + webGLSourceArrowHeadLength);
|
|
|
|
// Target arrow head
|
|
float targetRadius = a_targetRadius * a_targetRadiusCoef;
|
|
float targetDirection = sign(targetRadius);
|
|
float webGLTargetRadius = targetDirection * targetRadius * 2.0 * u_correctionRatio / u_sizeRatio;
|
|
float webGLTargetArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
|
|
vec2 targetCompensationVector =
|
|
vec2(-targetDirection * unitNormal.y, targetDirection * unitNormal.x)
|
|
* (webGLTargetRadius + webGLTargetArrowHeadLength);
|
|
|
|
// Here is the proper position of the vertex
|
|
gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + sourceCompensationVector + targetCompensationVector, 1)).xy, 0, 1);
|
|
|
|
v_thickness = webGLThickness / u_zoomRatio;
|
|
|
|
v_normal = unitNormal;
|
|
|
|
v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;
|
|
|
|
#ifdef PICKING_MODE
|
|
// For picking mode, we use the ID as the color:
|
|
v_color = a_id;
|
|
#else
|
|
// For normal mode, we use the color:
|
|
v_color = a_color;
|
|
#endif
|
|
|
|
v_color.a *= bias;
|
|
}
|
|
`,qu=Uu,es=WebGLRenderingContext,io=es.UNSIGNED_BYTE,qe=es.FLOAT,Wu=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],Xu={lengthToThicknessRatio:wn.lengthToThicknessRatio};function ts(e){var t=Wt(Wt({},Xu),{});return function(r){function n(){return la(this,n),ca(this,n,arguments)}return aa(n,r),sa(n,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:qu,FRAGMENT_SHADER_SOURCE:yi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Wu,ATTRIBUTES:[{name:"a_positionStart",size:2,type:qe},{name:"a_positionEnd",size:2,type:qe},{name:"a_normal",size:2,type:qe},{name:"a_color",size:4,type:io,normalized:!0},{name:"a_id",size:4,type:io,normalized:!0},{name:"a_sourceRadius",size:1,type:qe},{name:"a_targetRadius",size:1,type:qe}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:qe},{name:"a_normalCoef",size:1,type:qe},{name:"a_sourceRadiusCoef",size:1,type:qe},{name:"a_targetRadiusCoef",size:1,type:qe}],CONSTANT_DATA:[[0,1,-1,0],[0,-1,1,0],[1,1,0,1],[1,1,0,1],[0,-1,1,0],[1,-1,0,-1]]}}},{key:"processVisibleItem",value:function(o,l,s,i,c){var u=c.size||1,f=s.x,h=s.y,d=i.x,y=i.y,b=rr(c.color),C=d-f,j=y-h,_=s.size||1,A=i.size||1,I=C*C+j*j,N=0,z=0;I&&(I=1/Math.sqrt(I),N=-j*I*u,z=C*I*u);var m=this.array;m[l++]=f,m[l++]=h,m[l++]=d,m[l++]=y,m[l++]=N,m[l++]=z,m[l++]=b,m[l++]=o,m[l++]=_,m[l++]=A}},{key:"setUniforms",value:function(o,l){var s=l.gl,i=l.uniformLocations,c=i.u_matrix,u=i.u_zoomRatio,f=i.u_feather,h=i.u_pixelRatio,d=i.u_correctionRatio,y=i.u_sizeRatio,b=i.u_minEdgeThickness,C=i.u_lengthToThicknessRatio;s.uniformMatrix3fv(c,!1,o.matrix),s.uniform1f(u,o.zoomRatio),s.uniform1f(y,o.sizeRatio),s.uniform1f(d,o.correctionRatio),s.uniform1f(h,o.pixelRatio),s.uniform1f(f,o.antiAliasingFeather),s.uniform1f(b,o.minEdgeThickness),s.uniform1f(C,t.lengthToThicknessRatio)}}])}(ua)}ts();function Yu(e){return bi([ts(),qn(e),qn(Wt(Wt({},e),{},{extremity:"source"}))])}Yu();function Ku(e){if(Array.isArray(e))return e}function Qu(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,o,l,s=[],i=!0,c=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(i=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);i=!0);}catch(u){c=!0,a=u}finally{try{if(!i&&r.return!=null&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw a}}return s}}function sn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function rs(e,t){if(e){if(typeof e=="string")return sn(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?sn(e,t):void 0}}function Ju(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zu(e,t){return Ku(e)||Qu(e,t)||rs(e,t)||Ju()}function ed(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function td(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ns(e){var t=td(e,"string");return typeof t=="symbol"?t:t+""}function rd(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ns(n.key),n)}}function nd(e,t,r){return t&&rd(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kt(e){return Kt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kt(e)}function os(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(os=function(){return!!e})()}function ln(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function od(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ln(e)}function ad(e,t,r){return t=Kt(t),od(e,os()?Reflect.construct(t,r||[],Kt(e).constructor):t.apply(e,r))}function cn(e,t){return cn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},cn(e,t)}function sd(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cn(e,t)}function mt(e,t,r){return(t=ns(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function id(e){if(Array.isArray(e))return sn(e)}function ld(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cd(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mr(e){return id(e)||ld(e)||rs(e)||cd()}function lo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function co(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lo(Object(r),!0).forEach(function(n){mt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ud="relative",dd={drawLabel:void 0,drawHover:void 0,borders:[{size:{value:.1},color:{attribute:"borderColor"}},{size:{fill:!0},color:{attribute:"color"}}]},fd="#000000";function hd(e){var t=e.borders,r=Wn(t.filter(function(a){var o=a.size;return"fill"in o}).length),n=`
|
|
precision highp float;
|
|
|
|
varying vec2 v_diffVector;
|
|
varying float v_radius;
|
|
|
|
#ifdef PICKING_MODE
|
|
varying vec4 v_color;
|
|
#else
|
|
// For normal mode, we use the border colors defined in the program:
|
|
`.concat(t.flatMap(function(a,o){var l=a.size;return"attribute"in l?["varying float v_borderSize_".concat(o+1,";")]:[]}).join(`
|
|
`),`
|
|
`).concat(t.flatMap(function(a,o){var l=a.color;return"attribute"in l?["varying vec4 v_borderColor_".concat(o+1,";")]:"value"in l?["uniform vec4 u_borderColor_".concat(o+1,";")]:[]}).join(`
|
|
`),`
|
|
#endif
|
|
|
|
uniform float u_correctionRatio;
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
void main(void) {
|
|
float dist = length(v_diffVector);
|
|
float aaBorder = 2.0 * u_correctionRatio;
|
|
float v_borderSize_0 = v_radius;
|
|
vec4 v_borderColor_0 = transparent;
|
|
|
|
// No antialiasing for picking mode:
|
|
#ifdef PICKING_MODE
|
|
if (dist > v_radius)
|
|
gl_FragColor = transparent;
|
|
else {
|
|
gl_FragColor = v_color;
|
|
gl_FragColor.a *= bias;
|
|
}
|
|
#else
|
|
// Sizes:
|
|
`).concat(t.flatMap(function(a,o){var l=a.size;if("fill"in l)return[];l=l;var s="attribute"in l?"v_borderSize_".concat(o+1):Wn(l.value),i=(l.mode||ud)==="pixels"?"u_correctionRatio":"v_radius";return[" float borderSize_".concat(o+1," = ").concat(i," * ").concat(s,";")]}).join(`
|
|
`),`
|
|
// Now, let's split the remaining space between "fill" borders:
|
|
float fillBorderSize = (v_radius - (`).concat(t.flatMap(function(a,o){var l=a.size;return"fill"in l?[]:["borderSize_".concat(o+1)]}).join(" + "),") ) / ").concat(r,`;
|
|
`).concat(t.flatMap(function(a,o){var l=a.size;return"fill"in l?[" float borderSize_".concat(o+1," = fillBorderSize;")]:[]}).join(`
|
|
`),`
|
|
|
|
// Finally, normalize all border sizes, to start from the full size and to end with the smallest:
|
|
float adjustedBorderSize_0 = v_radius;
|
|
`).concat(t.map(function(a,o){return" float adjustedBorderSize_".concat(o+1," = adjustedBorderSize_").concat(o," - borderSize_").concat(o+1,";")}).join(`
|
|
`),`
|
|
|
|
// Colors:
|
|
vec4 borderColor_0 = transparent;
|
|
`).concat(t.map(function(a,o){var l=a.color,s=[];return"attribute"in l?s.push(" vec4 borderColor_".concat(o+1," = v_borderColor_").concat(o+1,";")):"transparent"in l?s.push(" vec4 borderColor_".concat(o+1," = vec4(0.0, 0.0, 0.0, 0.0);")):s.push(" vec4 borderColor_".concat(o+1," = u_borderColor_").concat(o+1,";")),s.push(" borderColor_".concat(o+1,".a *= bias;")),s.push(" if (borderSize_".concat(o+1," <= 1.0 * u_correctionRatio) { borderColor_").concat(o+1," = borderColor_").concat(o,"; }")),s.join(`
|
|
`)}).join(`
|
|
`),`
|
|
if (dist > adjustedBorderSize_0) {
|
|
gl_FragColor = borderColor_0;
|
|
} else `).concat(t.map(function(a,o){return"if (dist > adjustedBorderSize_".concat(o,` - aaBorder) {
|
|
gl_FragColor = mix(borderColor_`).concat(o+1,", borderColor_").concat(o,", (dist - adjustedBorderSize_").concat(o,` + aaBorder) / aaBorder);
|
|
} else if (dist > adjustedBorderSize_`).concat(o+1,`) {
|
|
gl_FragColor = borderColor_`).concat(o+1,`;
|
|
} else `)}).join(""),` { /* Nothing to add here */ }
|
|
#endif
|
|
}
|
|
`);return n}function gd(e){var t=e.borders,r=`
|
|
attribute vec2 a_position;
|
|
attribute float a_size;
|
|
attribute float a_angle;
|
|
|
|
uniform mat3 u_matrix;
|
|
uniform float u_sizeRatio;
|
|
uniform float u_correctionRatio;
|
|
|
|
varying vec2 v_diffVector;
|
|
varying float v_radius;
|
|
|
|
#ifdef PICKING_MODE
|
|
attribute vec4 a_id;
|
|
varying vec4 v_color;
|
|
#else
|
|
`.concat(t.flatMap(function(n,a){var o=n.size;return"attribute"in o?["attribute float a_borderSize_".concat(a+1,";"),"varying float v_borderSize_".concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
`).concat(t.flatMap(function(n,a){var o=n.color;return"attribute"in o?["attribute vec4 a_borderColor_".concat(a+1,";"),"varying vec4 v_borderColor_".concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
#endif
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
void main() {
|
|
float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;
|
|
vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));
|
|
vec2 position = a_position + diffVector;
|
|
gl_Position = vec4(
|
|
(u_matrix * vec3(position, 1)).xy,
|
|
0,
|
|
1
|
|
);
|
|
|
|
v_radius = size / 2.0;
|
|
v_diffVector = diffVector;
|
|
|
|
#ifdef PICKING_MODE
|
|
v_color = a_id;
|
|
#else
|
|
`).concat(t.flatMap(function(n,a){var o=n.size;return"attribute"in o?[" v_borderSize_".concat(a+1," = a_borderSize_").concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
`).concat(t.flatMap(function(n,a){var o=n.color;return"attribute"in o?[" v_borderColor_".concat(a+1," = a_borderColor_").concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
#endif
|
|
}
|
|
`);return r}var as=WebGLRenderingContext,uo=as.UNSIGNED_BYTE,zt=as.FLOAT;function pd(e){var t,r=co(co({},dd),{}),n=r.borders,a=r.drawLabel,o=r.drawHover,l=["u_sizeRatio","u_correctionRatio","u_matrix"].concat(mr(n.flatMap(function(s,i){var c=s.color;return"value"in c?["u_borderColor_".concat(i+1)]:[]})));return t=function(s){sd(i,s);function i(){var c;ed(this,i);for(var u=arguments.length,f=new Array(u),h=0;h<u;h++)f[h]=arguments[h];return c=ad(this,i,[].concat(f)),mt(ln(c),"drawLabel",a),mt(ln(c),"drawHover",o),c}return nd(i,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:gd(r),FRAGMENT_SHADER_SOURCE:hd(r),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:l,ATTRIBUTES:[{name:"a_position",size:2,type:zt},{name:"a_id",size:4,type:uo,normalized:!0},{name:"a_size",size:1,type:zt}].concat(mr(n.flatMap(function(u,f){var h=u.color;return"attribute"in h?[{name:"a_borderColor_".concat(f+1),size:4,type:uo,normalized:!0}]:[]})),mr(n.flatMap(function(u,f){var h=u.size;return"attribute"in h?[{name:"a_borderSize_".concat(f+1),size:1,type:zt}]:[]}))),CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:zt}],CONSTANT_DATA:[[i.ANGLE_1],[i.ANGLE_2],[i.ANGLE_3]]}}},{key:"processVisibleItem",value:function(u,f,h){var d=this.array;d[f++]=h.x,d[f++]=h.y,d[f++]=u,d[f++]=h.size,n.forEach(function(y){var b=y.color;"attribute"in b&&(d[f++]=rr(h[b.attribute]||b.defaultValue||fd))}),n.forEach(function(y){var b=y.size;"attribute"in b&&(d[f++]=h[b.attribute]||b.defaultValue)})}},{key:"setUniforms",value:function(u,f){var h=f.gl,d=f.uniformLocations,y=d.u_sizeRatio,b=d.u_correctionRatio,C=d.u_matrix;h.uniform1f(b,u.correctionRatio),h.uniform1f(y,u.sizeRatio),h.uniformMatrix3fv(C,!1,u.matrix),n.forEach(function(j,_){var A=j.color;if("value"in A){var I=d["u_borderColor_".concat(_+1)],N=wi(A.value),z=Zu(N,4),m=z[0],E=z[1],x=z[2],T=z[3];h.uniform4f(I,m/255,E/255,x/255,T/255)}})}}]),i}(ia),mt(t,"ANGLE_1",0),mt(t,"ANGLE_2",2*Math.PI/3),mt(t,"ANGLE_3",4*Math.PI/3),t}var md=pd();function vd(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ss(e){var t=vd(e,"string");return typeof t=="symbol"?t:t+""}function is(e,t,r){return(t=ss(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Qt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fo(Object(r),!0).forEach(function(n){is(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bd(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ss(n.key),n)}}function wd(e,t,r){return t&&bd(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jt(e){return Jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jt(e)}function ls(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ls=function(){return!!e})()}function cs(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xd(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cs(e)}function _d(e,t,r){return t=Jt(t),xd(e,ls()?Reflect.construct(t,r||[],Jt(e).constructor):t.apply(e,r))}function un(e,t){return un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},un(e,t)}function Sd(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&un(e,t)}function dn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ed(e){if(Array.isArray(e))return dn(e)}function kd(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Cd(e,t){if(e){if(typeof e=="string")return dn(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?dn(e,t):void 0}}function Td(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vr(e){return Ed(e)||kd(e)||Cd(e)||Td()}function us(e,t,r,n){var a=Math.pow(1-e,2)*t.x+2*(1-e)*e*r.x+Math.pow(e,2)*n.x,o=Math.pow(1-e,2)*t.y+2*(1-e)*e*r.y+Math.pow(e,2)*n.y;return{x:a,y:o}}function Rd(e,t,r){for(var n=20,a=0,o=e,l=0;l<n;l++){var s=us((l+1)/n,e,t,r);a+=Math.sqrt(Math.pow(o.x-s.x,2)+Math.pow(o.y-s.y,2)),o=s}return a}function Ad(e){var t=e.curvatureAttribute,r=e.defaultCurvature,n=e.keepLabelUpright,a=n===void 0?!0:n;return function(o,l,s,i,c){var u=c.edgeLabelSize,f=l[t]||r,h=c.edgeLabelFont,d=c.edgeLabelWeight,y=c.edgeLabelColor.attribute?l[c.edgeLabelColor.attribute]||c.edgeLabelColor.color||"#000":c.edgeLabelColor.color,b=l.label;if(b){o.fillStyle=y,o.font="".concat(d," ").concat(u,"px ").concat(h);var C=!a||s.x<i.x,j=C?s.x:i.x,_=C?s.y:i.y,A=C?i.x:s.x,I=C?i.y:s.y,N=(j+A)/2,z=(_+I)/2,m=A-j,E=I-_,x=Math.sqrt(Math.pow(m,2)+Math.pow(E,2)),T=C?1:-1,R=N+E*f*T,O=z-m*f*T,w=l.size*.7+5,H={x:O-_,y:-(R-j)},K=Math.sqrt(Math.pow(H.x,2)+Math.pow(H.y,2)),D={x:I-O,y:-(A-R)},k=Math.sqrt(Math.pow(D.x,2)+Math.pow(D.y,2));j+=w*H.x/K,_+=w*H.y/K,A+=w*D.x/k,I+=w*D.y/k,R+=w*E/x,O-=w*m/x;var S={x:R,y:O},B={x:j,y:_},ae={x:A,y:I},M=Rd(B,S,ae);if(!(M<s.size+i.size)){var v=o.measureText(b).width,P=M-s.size-i.size;if(v>P){var V="…";for(b=b+V,v=o.measureText(b).width;v>P&&b.length>1;)b=b.slice(0,-2)+V,v=o.measureText(b).width;if(b.length<4)return}for(var $={},Q=0,X=b.length;Q<X;Q++){var Y=b[Q];$[Y]||($[Y]=o.measureText(Y).width*(1+f*.35))}for(var se=.5-v/M/2,ne=0,ie=b.length;ne<ie;ne++){var F=b[ne],J=us(se,B,S,ae),q=2*(1-se)*(R-j)+2*se*(A-R),U=2*(1-se)*(O-_)+2*se*(I-O),L=Math.atan2(U,q);o.save(),o.translate(J.x,J.y),o.rotate(L),o.fillText(F,0,0),o.restore(),se+=$[F]/M}}}}}function jd(e){var t=e.arrowHead,r=(t==null?void 0:t.extremity)==="target"||(t==null?void 0:t.extremity)==="both",n=(t==null?void 0:t.extremity)==="source"||(t==null?void 0:t.extremity)==="both",a=`
|
|
precision highp float;
|
|
|
|
varying vec4 v_color;
|
|
varying float v_thickness;
|
|
varying float v_feather;
|
|
varying vec2 v_cpA;
|
|
varying vec2 v_cpB;
|
|
varying vec2 v_cpC;
|
|
`.concat(r?`
|
|
varying float v_targetSize;
|
|
varying vec2 v_targetPoint;`:"",`
|
|
`).concat(n?`
|
|
varying float v_sourceSize;
|
|
varying vec2 v_sourcePoint;`:"",`
|
|
`).concat(t?`
|
|
uniform float u_lengthToThicknessRatio;
|
|
uniform float u_widenessToThicknessRatio;`:"",`
|
|
|
|
float det(vec2 a, vec2 b) {
|
|
return a.x * b.y - b.x * a.y;
|
|
}
|
|
|
|
vec2 getDistanceVector(vec2 b0, vec2 b1, vec2 b2) {
|
|
float a = det(b0, b2), b = 2.0 * det(b1, b0), d = 2.0 * det(b2, b1);
|
|
float f = b * d - a * a;
|
|
vec2 d21 = b2 - b1, d10 = b1 - b0, d20 = b2 - b0;
|
|
vec2 gf = 2.0 * (b * d21 + d * d10 + a * d20);
|
|
gf = vec2(gf.y, -gf.x);
|
|
vec2 pp = -f * gf / dot(gf, gf);
|
|
vec2 d0p = b0 - pp;
|
|
float ap = det(d0p, d20), bp = 2.0 * det(d10, d0p);
|
|
float t = clamp((ap + bp) / (2.0 * a + b + d), 0.0, 1.0);
|
|
return mix(mix(b0, b1, t), mix(b1, b2, t), t);
|
|
}
|
|
|
|
float distToQuadraticBezierCurve(vec2 p, vec2 b0, vec2 b1, vec2 b2) {
|
|
return length(getDistanceVector(b0 - p, b1 - p, b2 - p));
|
|
}
|
|
|
|
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
void main(void) {
|
|
float dist = distToQuadraticBezierCurve(gl_FragCoord.xy, v_cpA, v_cpB, v_cpC);
|
|
float thickness = v_thickness;
|
|
`).concat(r?`
|
|
float distToTarget = length(gl_FragCoord.xy - v_targetPoint);
|
|
float targetArrowLength = v_targetSize + thickness * u_lengthToThicknessRatio;
|
|
if (distToTarget < targetArrowLength) {
|
|
thickness = (distToTarget - v_targetSize) / (targetArrowLength - v_targetSize) * u_widenessToThicknessRatio * thickness;
|
|
}`:"",`
|
|
`).concat(n?`
|
|
float distToSource = length(gl_FragCoord.xy - v_sourcePoint);
|
|
float sourceArrowLength = v_sourceSize + thickness * u_lengthToThicknessRatio;
|
|
if (distToSource < sourceArrowLength) {
|
|
thickness = (distToSource - v_sourceSize) / (sourceArrowLength - v_sourceSize) * u_widenessToThicknessRatio * thickness;
|
|
}`:"",`
|
|
|
|
float halfThickness = thickness / 2.0;
|
|
if (dist < halfThickness) {
|
|
#ifdef PICKING_MODE
|
|
gl_FragColor = v_color;
|
|
#else
|
|
float t = smoothstep(
|
|
halfThickness - v_feather,
|
|
halfThickness,
|
|
dist
|
|
);
|
|
|
|
gl_FragColor = mix(v_color, transparent, t);
|
|
#endif
|
|
} else {
|
|
gl_FragColor = transparent;
|
|
}
|
|
}
|
|
`);return a}function Id(e){var t=e.arrowHead,r=(t==null?void 0:t.extremity)==="target"||(t==null?void 0:t.extremity)==="both",n=(t==null?void 0:t.extremity)==="source"||(t==null?void 0:t.extremity)==="both",a=`
|
|
attribute vec4 a_id;
|
|
attribute vec4 a_color;
|
|
attribute float a_direction;
|
|
attribute float a_thickness;
|
|
attribute vec2 a_source;
|
|
attribute vec2 a_target;
|
|
attribute float a_current;
|
|
attribute float a_curvature;
|
|
`.concat(r?`attribute float a_targetSize;
|
|
`:"",`
|
|
`).concat(n?`attribute float a_sourceSize;
|
|
`:"",`
|
|
|
|
uniform mat3 u_matrix;
|
|
uniform float u_sizeRatio;
|
|
uniform float u_pixelRatio;
|
|
uniform vec2 u_dimensions;
|
|
uniform float u_minEdgeThickness;
|
|
uniform float u_feather;
|
|
|
|
varying vec4 v_color;
|
|
varying float v_thickness;
|
|
varying float v_feather;
|
|
varying vec2 v_cpA;
|
|
varying vec2 v_cpB;
|
|
varying vec2 v_cpC;
|
|
`).concat(r?`
|
|
varying float v_targetSize;
|
|
varying vec2 v_targetPoint;`:"",`
|
|
`).concat(n?`
|
|
varying float v_sourceSize;
|
|
varying vec2 v_sourcePoint;`:"",`
|
|
`).concat(t?`
|
|
uniform float u_widenessToThicknessRatio;`:"",`
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
const float epsilon = 0.7;
|
|
|
|
vec2 clipspaceToViewport(vec2 pos, vec2 dimensions) {
|
|
return vec2(
|
|
(pos.x + 1.0) * dimensions.x / 2.0,
|
|
(pos.y + 1.0) * dimensions.y / 2.0
|
|
);
|
|
}
|
|
|
|
vec2 viewportToClipspace(vec2 pos, vec2 dimensions) {
|
|
return vec2(
|
|
pos.x / dimensions.x * 2.0 - 1.0,
|
|
pos.y / dimensions.y * 2.0 - 1.0
|
|
);
|
|
}
|
|
|
|
void main() {
|
|
float minThickness = u_minEdgeThickness;
|
|
|
|
// Selecting the correct position
|
|
// Branchless "position = a_source if a_current == 1.0 else a_target"
|
|
vec2 position = a_source * max(0.0, a_current) + a_target * max(0.0, 1.0 - a_current);
|
|
position = (u_matrix * vec3(position, 1)).xy;
|
|
|
|
vec2 source = (u_matrix * vec3(a_source, 1)).xy;
|
|
vec2 target = (u_matrix * vec3(a_target, 1)).xy;
|
|
|
|
vec2 viewportPosition = clipspaceToViewport(position, u_dimensions);
|
|
vec2 viewportSource = clipspaceToViewport(source, u_dimensions);
|
|
vec2 viewportTarget = clipspaceToViewport(target, u_dimensions);
|
|
|
|
vec2 delta = viewportTarget.xy - viewportSource.xy;
|
|
float len = length(delta);
|
|
vec2 normal = vec2(-delta.y, delta.x) * a_direction;
|
|
vec2 unitNormal = normal / len;
|
|
float boundingBoxThickness = len * a_curvature;
|
|
|
|
float curveThickness = max(minThickness, a_thickness / u_sizeRatio);
|
|
v_thickness = curveThickness * u_pixelRatio;
|
|
v_feather = u_feather;
|
|
|
|
v_cpA = viewportSource;
|
|
v_cpB = 0.5 * (viewportSource + viewportTarget) + unitNormal * a_direction * boundingBoxThickness;
|
|
v_cpC = viewportTarget;
|
|
|
|
vec2 viewportOffsetPosition = (
|
|
viewportPosition +
|
|
unitNormal * (boundingBoxThickness / 2.0 + sign(boundingBoxThickness) * (`).concat(t?"curveThickness * u_widenessToThicknessRatio":"curveThickness",` + epsilon)) *
|
|
max(0.0, a_direction) // NOTE: cutting the bounding box in half to avoid overdraw
|
|
);
|
|
|
|
position = viewportToClipspace(viewportOffsetPosition, u_dimensions);
|
|
gl_Position = vec4(position, 0, 1);
|
|
|
|
`).concat(r?`
|
|
v_targetSize = a_targetSize * u_pixelRatio / u_sizeRatio;
|
|
v_targetPoint = viewportTarget;
|
|
`:"",`
|
|
`).concat(n?`
|
|
v_sourceSize = a_sourceSize * u_pixelRatio / u_sizeRatio;
|
|
v_sourcePoint = viewportSource;
|
|
`:"",`
|
|
|
|
#ifdef PICKING_MODE
|
|
// For picking mode, we use the ID as the color:
|
|
v_color = a_id;
|
|
#else
|
|
// For normal mode, we use the color:
|
|
v_color = a_color;
|
|
#endif
|
|
|
|
v_color.a *= bias;
|
|
}
|
|
`);return a}var ds=.25,Nd={arrowHead:null,curvatureAttribute:"curvature",defaultCurvature:ds},fs=WebGLRenderingContext,ho=fs.UNSIGNED_BYTE,et=fs.FLOAT;function jn(e){var t=Qt(Qt({},Nd),e||{}),r=t,n=r.arrowHead,a=r.curvatureAttribute,o=r.drawLabel,l=(n==null?void 0:n.extremity)==="target"||(n==null?void 0:n.extremity)==="both",s=(n==null?void 0:n.extremity)==="source"||(n==null?void 0:n.extremity)==="both",i=["u_matrix","u_sizeRatio","u_dimensions","u_pixelRatio","u_feather","u_minEdgeThickness"].concat(vr(n?["u_lengthToThicknessRatio","u_widenessToThicknessRatio"]:[]));return function(c){Sd(u,c);function u(){var f;yd(this,u);for(var h=arguments.length,d=new Array(h),y=0;y<h;y++)d[y]=arguments[y];return f=_d(this,u,[].concat(d)),is(cs(f),"drawLabel",o||Ad(t)),f}return wd(u,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Id(t),FRAGMENT_SHADER_SOURCE:jd(t),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:i,ATTRIBUTES:[{name:"a_source",size:2,type:et},{name:"a_target",size:2,type:et}].concat(vr(l?[{name:"a_targetSize",size:1,type:et}]:[]),vr(s?[{name:"a_sourceSize",size:1,type:et}]:[]),[{name:"a_thickness",size:1,type:et},{name:"a_curvature",size:1,type:et},{name:"a_color",size:4,type:ho,normalized:!0},{name:"a_id",size:4,type:ho,normalized:!0}]),CONSTANT_ATTRIBUTES:[{name:"a_current",size:1,type:et},{name:"a_direction",size:1,type:et}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[0,-1],[1,1],[1,-1]]}}},{key:"processVisibleItem",value:function(h,d,y,b,C){var j,_=C.size||1,A=y.x,I=y.y,N=b.x,z=b.y,m=rr(C.color),E=(j=C[a])!==null&&j!==void 0?j:ds,x=this.array;x[d++]=A,x[d++]=I,x[d++]=N,x[d++]=z,l&&(x[d++]=b.size),s&&(x[d++]=y.size),x[d++]=_,x[d++]=E,x[d++]=m,x[d++]=h}},{key:"setUniforms",value:function(h,d){var y=d.gl,b=d.uniformLocations,C=b.u_matrix,j=b.u_pixelRatio,_=b.u_feather,A=b.u_sizeRatio,I=b.u_dimensions,N=b.u_minEdgeThickness;if(y.uniformMatrix3fv(C,!1,h.matrix),y.uniform1f(j,h.pixelRatio),y.uniform1f(A,h.sizeRatio),y.uniform1f(_,h.antiAliasingFeather),y.uniform2f(I,h.width*h.pixelRatio,h.height*h.pixelRatio),y.uniform1f(N,h.minEdgeThickness),n){var z=b.u_lengthToThicknessRatio,m=b.u_widenessToThicknessRatio;y.uniform1f(z,n.lengthToThicknessRatio),y.uniform1f(m,n.widenessToThicknessRatio)}}}]),u}(ua)}var Ld=jn(),Pd=jn({arrowHead:wn});jn({arrowHead:Qt(Qt({},wn),{},{extremity:"both"})});const zd=({node:e,move:t})=>{const r=Be(),{gotoNode:n}=da();return p.useEffect(()=>{const a=r.getGraph();if(t){if(e&&a.hasNode(e))try{a.setNodeAttribute(e,"highlighted",!0),n(e)}catch(o){console.error("Error focusing on node:",o)}else r.setCustomBBox(null),r.getCamera().animate({x:.5,y:.5,ratio:1},{duration:0});te.getState().setMoveToSelectedNode(!1)}else if(e&&a.hasNode(e))try{a.setNodeAttribute(e,"highlighted",!0)}catch(o){console.error("Error highlighting node:",o)}return()=>{if(e&&a.hasNode(e))try{a.setNodeAttribute(e,"highlighted",!1)}catch(o){console.error("Error cleaning up node highlight:",o)}}},[e,t,r,n]),null};function St(e,t){const r=Be(),n=p.useRef(t);return fa(n.current,t)||(n.current=t),{positions:p.useCallback(()=>n.current?e(r.getGraph(),n.current):{},[r,n,e]),assign:p.useCallback(()=>{n.current&&e.assign(r.getGraph(),n.current)},[r,n,e])}}function In(e,t){const r=Be(),[n,a]=p.useState(!1),[o,l]=p.useState(null),s=p.useRef(t);return fa(s.current,t)||(s.current=t),p.useEffect(()=>{a(!1);let i=null;return s.current&&(i=new e(r.getGraph(),s.current)),l(i),()=>{i!==null&&i.kill()}},[r,s,l,a,e]),{stop:p.useCallback(()=>{o&&(o.stop(),a(!1))},[o,a]),start:p.useCallback(()=>{o&&(o.start(),a(!0))},[o,a]),kill:p.useCallback(()=>{o&&o.kill(),a(!1)},[o,a]),isRunning:n}}var yr,go;function It(){if(go)return yr;go=1;function e(r){return!r||typeof r!="object"||typeof r=="function"||Array.isArray(r)||r instanceof Set||r instanceof Map||r instanceof RegExp||r instanceof Date}function t(r,n){r=r||{};var a={};for(var o in n){var l=r[o],s=n[o];if(!e(s)){a[o]=t(l,s);continue}l===void 0?a[o]=s:a[o]=l}return a}return yr=t,yr}var br,po;function Dd(){if(po)return br;po=1;function e(r){return function(n,a){return n+Math.floor(r()*(a-n+1))}}var t=e(Math.random);return t.createRandom=e,br=t,br}var wr,mo;function Od(){if(mo)return wr;mo=1;var e=Dd().createRandom;function t(n){var a=e(n);return function(o){for(var l=o.length,s=l-1,i=-1;++i<l;){var c=a(i,s),u=o[c];o[c]=o[i],o[i]=u}}}var r=t(Math.random);return r.createShuffleInPlace=t,wr=r,wr}var xr,vo;function Gd(){if(vo)return xr;vo=1;var e=It(),t=Xe(),r=Od(),n={attributes:{x:"x",y:"y"},center:0,hierarchyAttributes:[],rng:Math.random,scale:1};function a(m,E,x,T,R){this.wrappedCircle=R||null,this.children={},this.countChildren=0,this.id=m||null,this.next=null,this.previous=null,this.x=E||null,this.y=x||null,R?this.r=1010101:this.r=T||999}a.prototype.hasChildren=function(){return this.countChildren>0},a.prototype.addChild=function(m,E){this.children[m]=E,++this.countChildren},a.prototype.getChild=function(m){if(!this.children.hasOwnProperty(m)){var E=new a;this.children[m]=E,++this.countChildren}return this.children[m]},a.prototype.applyPositionToChildren=function(){if(this.hasChildren()){var m=this;for(var E in m.children){var x=m.children[E];x.x+=m.x,x.y+=m.y,x.applyPositionToChildren()}}};function o(m,E,x){for(var T in E.children){var R=E.children[T];R.hasChildren()?o(m,R,x):x[R.id]={x:R.x,y:R.y}}}function l(m,E){var x=m.r-E.r,T=E.x-m.x,R=E.y-m.y;return x<0||x*x<T*T+R*R}function s(m,E){var x=m.r-E.r+1e-6,T=E.x-m.x,R=E.y-m.y;return x>0&&x*x>T*T+R*R}function i(m,E){for(var x=0;x<E.length;++x)if(!s(m,E[x]))return!1;return!0}function c(m){return new a(null,m.x,m.y,m.r)}function u(m,E){var x=m.x,T=m.y,R=m.r,O=E.x,w=E.y,H=E.r,K=O-x,D=w-T,k=H-R,S=Math.sqrt(K*K+D*D);return new a(null,(x+O+K/S*k)/2,(T+w+D/S*k)/2,(S+R+H)/2)}function f(m,E,x){var T=m.x,R=m.y,O=m.r,w=E.x,H=E.y,K=E.r,D=x.x,k=x.y,S=x.r,B=T-w,ae=T-D,M=R-H,v=R-k,P=K-O,V=S-O,$=T*T+R*R-O*O,Q=$-w*w-H*H+K*K,X=$-D*D-k*k+S*S,Y=ae*M-B*v,se=(M*X-v*Q)/(Y*2)-T,ne=(v*P-M*V)/Y,ie=(ae*Q-B*X)/(Y*2)-R,F=(B*V-ae*P)/Y,J=ne*ne+F*F-1,q=2*(O+se*ne+ie*F),U=se*se+ie*ie-O*O,L=-(J?(q+Math.sqrt(q*q-4*J*U))/(2*J):U/q);return new a(null,T+se+ne*L,R+ie+F*L,L)}function h(m){switch(m.length){case 1:return c(m[0]);case 2:return u(m[0],m[1]);case 3:return f(m[0],m[1],m[2]);default:throw new Error("graphology-layout/circlepack: Invalid basis length "+m.length)}}function d(m,E){var x,T;if(i(E,m))return[E];for(x=0;x<m.length;++x)if(l(E,m[x])&&i(u(m[x],E),m))return[m[x],E];for(x=0;x<m.length-1;++x)for(T=x+1;T<m.length;++T)if(l(u(m[x],m[T]),E)&&l(u(m[x],E),m[T])&&l(u(m[T],E),m[x])&&i(f(m[x],m[T],E),m))return[m[x],m[T],E];throw new Error("graphology-layout/circlepack: extendBasis failure !")}function y(m){var E=m.wrappedCircle,x=m.next.wrappedCircle,T=E.r+x.r,R=(E.x*x.r+x.x*E.r)/T,O=(E.y*x.r+x.y*E.r)/T;return R*R+O*O}function b(m,E){var x=0,T=m.slice(),R=m.length,O=[],w,H;for(E(T);x<R;)w=T[x],H&&s(H,w)?++x:(O=d(O,w),H=h(O),x=0);return H}function C(m,E,x){var T=m.x-E.x,R,O,w=m.y-E.y,H,K,D=T*T+w*w;D?(O=E.r+x.r,O*=O,K=m.r+x.r,K*=K,O>K?(R=(D+K-O)/(2*D),H=Math.sqrt(Math.max(0,K/D-R*R)),x.x=m.x-R*T-H*w,x.y=m.y-R*w+H*T):(R=(D+O-K)/(2*D),H=Math.sqrt(Math.max(0,O/D-R*R)),x.x=E.x+R*T-H*w,x.y=E.y+R*w+H*T)):(x.x=E.x+x.r,x.y=E.y)}function j(m,E){var x=m.r+E.r-1e-6,T=E.x-m.x,R=E.y-m.y;return x>0&&x*x>T*T+R*R}function _(m,E){var x=m.length;if(x===0)return 0;var T,R,O,w,H,K,D,k,S,B;if(T=m[0],T.x=0,T.y=0,x<=1)return T.r;if(R=m[1],T.x=-R.r,R.x=T.r,R.y=0,x<=2)return T.r+R.r;O=m[2],C(R,T,O),T=new a(null,null,null,null,T),R=new a(null,null,null,null,R),O=new a(null,null,null,null,O),T.next=O.previous=R,R.next=T.previous=O,O.next=R.previous=T;e:for(K=3;K<x;++K){O=m[K],C(T.wrappedCircle,R.wrappedCircle,O),O=new a(null,null,null,null,O),D=R.next,k=T.previous,S=R.wrappedCircle.r,B=T.wrappedCircle.r;do if(S<=B){if(j(D.wrappedCircle,O.wrappedCircle)){R=D,T.next=R,R.previous=T,--K;continue e}S+=D.wrappedCircle.r,D=D.next}else{if(j(k.wrappedCircle,O.wrappedCircle)){T=k,T.next=R,R.previous=T,--K;continue e}B+=k.wrappedCircle.r,k=k.previous}while(D!==k.next);for(O.previous=T,O.next=R,T.next=R.previous=R=O,w=y(T);(O=O.next)!==R;)(H=y(O))<w&&(T=O,w=H);R=T.next}T=[R.wrappedCircle],O=R;for(var ae=1e4;(O=O.next)!==R&&--ae!==0;)T.push(O.wrappedCircle);for(O=b(T,E),K=0;K<x;++K)T=m[K],T.x-=O.x,T.y-=O.y;return O.r}function A(m,E){var x=0;if(m.hasChildren()){for(var T in m.children){var R=m.children[T];R.hasChildren()&&(R.r=A(R,E))}x=_(Object.values(m.children),E)}return x}function I(m,E){A(m,E);for(var x in m.children){var T=m.children[x];T.applyPositionToChildren()}}function N(m,E,x){if(!t(E))throw new Error("graphology-layout/circlepack: the given graph is not a valid graphology instance.");x=e(x,n);var T={},R={},O=E.nodes(),w=x.center,H=x.hierarchyAttributes,K=r.createShuffleInPlace(x.rng),D=x.scale,k=new a;E.forEachNode(function(P,V){var $=V.size?V.size:1,Q=new a(P,null,null,$),X=k;H.forEach(function(Y){var se=V[Y];X=X.getChild(se)}),X.addChild(P,Q)}),I(k,K),o(E,k,T);var S=O.length,B,ae,M;for(M=0;M<S;M++){var v=O[M];B=w+D*T[v].x,ae=w+D*T[v].y,R[v]={x:B,y:ae},m&&(E.setNodeAttribute(v,x.attributes.x,B),E.setNodeAttribute(v,x.attributes.y,ae))}return R}var z=N.bind(null,!1);return z.assign=N.bind(null,!0),xr=z,xr}var Fd=Gd();const Md=He(Fd);function $d(e={}){return St(Md,e)}var _r,yo;function Hd(){if(yo)return _r;yo=1;var e=It(),t=Xe(),r={dimensions:["x","y"],center:.5,scale:1};function n(o,l,s){if(!t(l))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");s=e(s,r);var i=s.dimensions;if(!Array.isArray(i)||i.length!==2)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=s.center,u=s.scale,f=Math.PI*2,h=(c-.5)*u,d=l.order,y=i[0],b=i[1];function C(A,I){return I[y]=u*Math.cos(A*f/d)+h,I[b]=u*Math.sin(A*f/d)+h,I}var j=0;if(!o){var _={};return l.forEachNode(function(A){_[A]=C(j++,{})}),_}l.updateEachNodeAttributes(function(A,I){return C(j++,I),I},{attributes:i})}var a=n.bind(null,!1);return a.assign=n.bind(null,!0),_r=a,_r}var Bd=Hd();const Vd=He(Bd);function Ud(e={}){return St(Vd,e)}var Ct={},bo;function Nn(){if(bo)return Ct;bo=1;function e(n){return typeof n!="number"||isNaN(n)?1:n}function t(n,a){var o={},l=function(c){return typeof c>"u"?a:c};typeof a=="function"&&(l=a);var s=function(c){return l(c[n])},i=function(){return l(void 0)};return typeof n=="string"?(o.fromAttributes=s,o.fromGraph=function(c,u){return s(c.getNodeAttributes(u))},o.fromEntry=function(c,u){return s(u)}):typeof n=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},o.fromGraph=function(c,u){return l(n(u,c.getNodeAttributes(u)))},o.fromEntry=function(c,u){return l(n(c,u))}):(o.fromAttributes=i,o.fromGraph=i,o.fromEntry=i),o}function r(n,a){var o={},l=function(c){return typeof c>"u"?a:c};typeof a=="function"&&(l=a);var s=function(c){return l(c[n])},i=function(){return l(void 0)};return typeof n=="string"?(o.fromAttributes=s,o.fromGraph=function(c,u){return s(c.getEdgeAttributes(u))},o.fromEntry=function(c,u){return s(u)},o.fromPartialEntry=o.fromEntry,o.fromMinimalEntry=o.fromEntry):typeof n=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},o.fromGraph=function(c,u){var f=c.extremities(u);return l(n(u,c.getEdgeAttributes(u),f[0],f[1],c.getNodeAttributes(f[0]),c.getNodeAttributes(f[1]),c.isUndirected(u)))},o.fromEntry=function(c,u,f,h,d,y,b){return l(n(c,u,f,h,d,y,b))},o.fromPartialEntry=function(c,u,f,h){return l(n(c,u,f,h))},o.fromMinimalEntry=function(c,u){return l(n(c,u))}):(o.fromAttributes=i,o.fromGraph=i,o.fromEntry=i,o.fromMinimalEntry=i),o}return Ct.createNodeValueGetter=t,Ct.createEdgeValueGetter=r,Ct.createEdgeWeightGetter=function(n){return r(n,e)},Ct}var Sr,wo;function hs(){if(wo)return Sr;wo=1;const{createNodeValueGetter:e,createEdgeValueGetter:t}=Nn();return Sr=function(n,a,o){const{nodeXAttribute:l,nodeYAttribute:s}=o,{attraction:i,repulsion:c,gravity:u,inertia:f,maxMove:h}=o.settings;let{shouldSkipNode:d,shouldSkipEdge:y,isNodeFixed:b}=o;b=e(b),d=e(d,!1),y=t(y,!1);const C=n.filterNodes((A,I)=>!d.fromEntry(A,I)),j=C.length;for(let A=0;A<j;A++){const I=C[A],N=n.getNodeAttributes(I),z=a[I];z?a[I]={dx:z.dx*f,dy:z.dy*f,x:N[l]||0,y:N[s]||0}:a[I]={dx:0,dy:0,x:N[l]||0,y:N[s]||0}}if(c)for(let A=0;A<j;A++){const I=C[A],N=a[I];for(let z=A+1;z<j;z++){const m=C[z],E=a[m],x=E.x-N.x,T=E.y-N.y,R=Math.sqrt(x*x+T*T)||1,O=c/R*x,w=c/R*T;N.dx-=O,N.dy-=w,E.dx+=O,E.dy+=w}}if(i&&n.forEachEdge((A,I,N,z,m,E,x)=>{if(N===z||d.fromEntry(N,m)||d.fromEntry(z,E)||y.fromEntry(A,I,N,z,m,E,x))return;const T=a[N],R=a[z],O=R.x-T.x,w=R.y-T.y,H=Math.sqrt(O*O+w*w)||1,K=i*H*O,D=i*H*w;T.dx+=K,T.dy+=D,R.dx-=K,R.dy-=D}),u)for(let A=0;A<j;A++){const I=C[A],N=a[I],{x:z,y:m}=N,E=Math.sqrt(z*z+m*m)||1;a[I].dx-=z*u*E,a[I].dy-=m*u*E}const _=!1;for(let A=0;A<j;A++){const I=C[A],N=a[I],z=Math.sqrt(N.dx*N.dx+N.dy*N.dy);z>h&&(N.dx*=h/z,N.dy*=h/z),b.fromGraph(n,I)?N.fixed=!0:(N.x+=N.dx,N.y+=N.dy,N.fixed=!1)}return{converged:_}},Sr}var Dt={},xo;function gs(){return xo||(xo=1,Dt.assignLayoutChanges=function(e,t,r){const{nodeXAttribute:n,nodeYAttribute:a}=r;e.updateEachNodeAttributes((o,l)=>{const s=t[o];return!s||s.fixed||(l[n]=s.x,l[a]=s.y),l},{attributes:["x","y"]})},Dt.collectLayoutChanges=function(e){const t={};for(const r in e){const n=e[r];t[r]={x:n.x,y:n.y}}return t}),Dt}var Er,_o;function ps(){return _o||(_o=1,Er={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),Er}var kr,So;function qd(){if(So)return kr;So=1;const e=Xe(),t=It(),r=hs(),n=gs(),a=ps();function o(s,i,c){if(!e(i))throw new Error("graphology-layout-force: the given graph is not a valid graphology instance.");typeof c=="number"?c={maxIterations:c}:c=c||{};const u=c.maxIterations;if(c=t(c,a),typeof u!="number"||u<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");const f={};let h=null,d;for(d=0;d<u&&(h=r(i,f,c),!h.converged);d++);if(s){n.assignLayoutChanges(i,f,c);return}return n.collectLayoutChanges(f)}const l=o.bind(null,!1);return l.assign=o.bind(null,!0),kr=l,kr}var Wd=qd();const Xd=He(Wd);var Cr,Eo;function Yd(){if(Eo)return Cr;Eo=1;const e=Xe(),t=It(),r=hs(),n=gs(),a=ps();function o(l,s){if(!e(l))throw new Error("graphology-layout-force/worker: the given graph is not a valid graphology instance.");s=t(s,a),this.callbacks={},s.onConverged&&(this.callbacks.onConverged=s.onConverged),this.graph=l,this.params=s,this.nodeStates={},this.frameID=null,this.running=!1,this.killed=!1}return o.prototype.isRunning=function(){return this.running},o.prototype.runFrame=function(){let{converged:l}=r(this.graph,this.nodeStates,this.params);n.assignLayoutChanges(this.graph,this.nodeStates,this.params),l=!1,l?(this.callbacks.onConverged&&this.callbacks.onConverged(),this.stop()):this.frameID=window.requestAnimationFrame(()=>this.runFrame())},o.prototype.stop=function(){return this.running=!1,this.frameID!==null&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},o.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},o.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0},Cr=o,Cr}var Kd=Yd();const Qd=He(Kd);function Jd(e={maxIterations:100}){return St(Xd,e)}function Zd(e={}){return In(Qd,e)}var Tr,ko;function ef(){if(ko)return Tr;ko=1;var e=0,t=1,r=2,n=3,a=4,o=5,l=6,s=7,i=8,c=9,u=0,f=1,h=2,d=0,y=1,b=2,C=3,j=4,_=5,A=6,I=7,N=8,z=3,m=10,E=3,x=9,T=10;return Tr=function(O,w,H){var K,D,k,S,B,ae,M,v,P,V,$=w.length,Q=H.length,X=O.adjustSizes,Y=O.barnesHutTheta*O.barnesHutTheta,se,ne,ie,F,J,q,U,L=[];for(k=0;k<$;k+=m)w[k+a]=w[k+r],w[k+o]=w[k+n],w[k+r]=0,w[k+n]=0;if(O.outboundAttractionDistribution){for(se=0,k=0;k<$;k+=m)se+=w[k+l];se/=$/m}if(O.barnesHutOptimize){var oe=1/0,ue=-1/0,re=1/0,ee=-1/0,G,ge,pe;for(k=0;k<$;k+=m)oe=Math.min(oe,w[k+e]),ue=Math.max(ue,w[k+e]),re=Math.min(re,w[k+t]),ee=Math.max(ee,w[k+t]);var ye=ue-oe,we=ee-re;for(ye>we?(re-=(ye-we)/2,ee=re+ye):(oe-=(we-ye)/2,ue=oe+we),L[0+d]=-1,L[0+y]=(oe+ue)/2,L[0+b]=(re+ee)/2,L[0+C]=Math.max(ue-oe,ee-re),L[0+j]=-1,L[0+_]=-1,L[0+A]=0,L[0+I]=0,L[0+N]=0,K=1,k=0;k<$;k+=m)for(D=0,pe=z;;)if(L[D+_]>=0){w[k+e]<L[D+y]?w[k+t]<L[D+b]?G=L[D+_]:G=L[D+_]+x:w[k+t]<L[D+b]?G=L[D+_]+x*2:G=L[D+_]+x*3,L[D+I]=(L[D+I]*L[D+A]+w[k+e]*w[k+l])/(L[D+A]+w[k+l]),L[D+N]=(L[D+N]*L[D+A]+w[k+t]*w[k+l])/(L[D+A]+w[k+l]),L[D+A]+=w[k+l],D=G;continue}else if(L[D+d]<0){L[D+d]=k;break}else{if(L[D+_]=K*x,v=L[D+C]/2,P=L[D+_],L[P+d]=-1,L[P+y]=L[D+y]-v,L[P+b]=L[D+b]-v,L[P+C]=v,L[P+j]=P+x,L[P+_]=-1,L[P+A]=0,L[P+I]=0,L[P+N]=0,P+=x,L[P+d]=-1,L[P+y]=L[D+y]-v,L[P+b]=L[D+b]+v,L[P+C]=v,L[P+j]=P+x,L[P+_]=-1,L[P+A]=0,L[P+I]=0,L[P+N]=0,P+=x,L[P+d]=-1,L[P+y]=L[D+y]+v,L[P+b]=L[D+b]-v,L[P+C]=v,L[P+j]=P+x,L[P+_]=-1,L[P+A]=0,L[P+I]=0,L[P+N]=0,P+=x,L[P+d]=-1,L[P+y]=L[D+y]+v,L[P+b]=L[D+b]+v,L[P+C]=v,L[P+j]=L[D+j],L[P+_]=-1,L[P+A]=0,L[P+I]=0,L[P+N]=0,K+=4,w[L[D+d]+e]<L[D+y]?w[L[D+d]+t]<L[D+b]?G=L[D+_]:G=L[D+_]+x:w[L[D+d]+t]<L[D+b]?G=L[D+_]+x*2:G=L[D+_]+x*3,L[D+A]=w[L[D+d]+l],L[D+I]=w[L[D+d]+e],L[D+N]=w[L[D+d]+t],L[G+d]=L[D+d],L[D+d]=-1,w[k+e]<L[D+y]?w[k+t]<L[D+b]?ge=L[D+_]:ge=L[D+_]+x:w[k+t]<L[D+b]?ge=L[D+_]+x*2:ge=L[D+_]+x*3,G===ge)if(pe--){D=G;continue}else{pe=z;break}L[ge+d]=k;break}}if(O.barnesHutOptimize)for(ne=O.scalingRatio,k=0;k<$;k+=m)for(D=0;;)if(L[D+_]>=0)if(q=Math.pow(w[k+e]-L[D+I],2)+Math.pow(w[k+t]-L[D+N],2),V=L[D+C],4*V*V/q<Y){if(ie=w[k+e]-L[D+I],F=w[k+t]-L[D+N],X===!0?q>0?(U=ne*w[k+l]*L[D+A]/q,w[k+r]+=ie*U,w[k+n]+=F*U):q<0&&(U=-ne*w[k+l]*L[D+A]/Math.sqrt(q),w[k+r]+=ie*U,w[k+n]+=F*U):q>0&&(U=ne*w[k+l]*L[D+A]/q,w[k+r]+=ie*U,w[k+n]+=F*U),D=L[D+j],D<0)break;continue}else{D=L[D+_];continue}else{if(ae=L[D+d],ae>=0&&ae!==k&&(ie=w[k+e]-w[ae+e],F=w[k+t]-w[ae+t],q=ie*ie+F*F,X===!0?q>0?(U=ne*w[k+l]*w[ae+l]/q,w[k+r]+=ie*U,w[k+n]+=F*U):q<0&&(U=-ne*w[k+l]*w[ae+l]/Math.sqrt(q),w[k+r]+=ie*U,w[k+n]+=F*U):q>0&&(U=ne*w[k+l]*w[ae+l]/q,w[k+r]+=ie*U,w[k+n]+=F*U)),D=L[D+j],D<0)break;continue}else for(ne=O.scalingRatio,S=0;S<$;S+=m)for(B=0;B<S;B+=m)ie=w[S+e]-w[B+e],F=w[S+t]-w[B+t],X===!0?(q=Math.sqrt(ie*ie+F*F)-w[S+i]-w[B+i],q>0?(U=ne*w[S+l]*w[B+l]/q/q,w[S+r]+=ie*U,w[S+n]+=F*U,w[B+r]-=ie*U,w[B+n]-=F*U):q<0&&(U=100*ne*w[S+l]*w[B+l],w[S+r]+=ie*U,w[S+n]+=F*U,w[B+r]-=ie*U,w[B+n]-=F*U)):(q=Math.sqrt(ie*ie+F*F),q>0&&(U=ne*w[S+l]*w[B+l]/q/q,w[S+r]+=ie*U,w[S+n]+=F*U,w[B+r]-=ie*U,w[B+n]-=F*U));for(P=O.gravity/O.scalingRatio,ne=O.scalingRatio,k=0;k<$;k+=m)U=0,ie=w[k+e],F=w[k+t],q=Math.sqrt(Math.pow(ie,2)+Math.pow(F,2)),O.strongGravityMode?q>0&&(U=ne*w[k+l]*P):q>0&&(U=ne*w[k+l]*P/q),w[k+r]-=ie*U,w[k+n]-=F*U;for(ne=1*(O.outboundAttractionDistribution?se:1),M=0;M<Q;M+=E)S=H[M+u],B=H[M+f],v=H[M+h],J=Math.pow(v,O.edgeWeightInfluence),ie=w[S+e]-w[B+e],F=w[S+t]-w[B+t],X===!0?(q=Math.sqrt(ie*ie+F*F)-w[S+i]-w[B+i],O.linLogMode?O.outboundAttractionDistribution?q>0&&(U=-ne*J*Math.log(1+q)/q/w[S+l]):q>0&&(U=-ne*J*Math.log(1+q)/q):O.outboundAttractionDistribution?q>0&&(U=-ne*J/w[S+l]):q>0&&(U=-ne*J)):(q=Math.sqrt(Math.pow(ie,2)+Math.pow(F,2)),O.linLogMode?O.outboundAttractionDistribution?q>0&&(U=-ne*J*Math.log(1+q)/q/w[S+l]):q>0&&(U=-ne*J*Math.log(1+q)/q):O.outboundAttractionDistribution?(q=1,U=-ne*J/w[S+l]):(q=1,U=-ne*J)),q>0&&(w[S+r]+=ie*U,w[S+n]+=F*U,w[B+r]-=ie*U,w[B+n]-=F*U);var de,me,Ie,Ce,Te,Pe;if(X===!0)for(k=0;k<$;k+=m)w[k+c]!==1&&(de=Math.sqrt(Math.pow(w[k+r],2)+Math.pow(w[k+n],2)),de>T&&(w[k+r]=w[k+r]*T/de,w[k+n]=w[k+n]*T/de),me=w[k+l]*Math.sqrt((w[k+a]-w[k+r])*(w[k+a]-w[k+r])+(w[k+o]-w[k+n])*(w[k+o]-w[k+n])),Ie=Math.sqrt((w[k+a]+w[k+r])*(w[k+a]+w[k+r])+(w[k+o]+w[k+n])*(w[k+o]+w[k+n]))/2,Ce=.1*Math.log(1+Ie)/(1+Math.sqrt(me)),Te=w[k+e]+w[k+r]*(Ce/O.slowDown),w[k+e]=Te,Pe=w[k+t]+w[k+n]*(Ce/O.slowDown),w[k+t]=Pe);else for(k=0;k<$;k+=m)w[k+c]!==1&&(me=w[k+l]*Math.sqrt((w[k+a]-w[k+r])*(w[k+a]-w[k+r])+(w[k+o]-w[k+n])*(w[k+o]-w[k+n])),Ie=Math.sqrt((w[k+a]+w[k+r])*(w[k+a]+w[k+r])+(w[k+o]+w[k+n])*(w[k+o]+w[k+n]))/2,Ce=w[k+s]*Math.log(1+Ie)/(1+Math.sqrt(me)),w[k+s]=Math.min(1,Math.sqrt(Ce*(Math.pow(w[k+r],2)+Math.pow(w[k+n],2))/(1+Math.sqrt(me)))),Te=w[k+e]+w[k+r]*(Ce/O.slowDown),w[k+e]=Te,Pe=w[k+t]+w[k+n]*(Ce/O.slowDown),w[k+t]=Pe);return{}},Tr}var We={},Co;function ms(){if(Co)return We;Co=1;var e=10,t=3;return We.assign=function(r){r=r||{};var n=Array.prototype.slice.call(arguments).slice(1),a,o,l;for(a=0,l=n.length;a<l;a++)if(n[a])for(o in n[a])r[o]=n[a][o];return r},We.validateSettings=function(r){return"linLogMode"in r&&typeof r.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in r&&typeof r.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in r&&typeof r.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in r&&typeof r.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in r&&!(typeof r.scalingRatio=="number"&&r.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in r&&typeof r.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in r&&!(typeof r.gravity=="number"&&r.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in r&&!(typeof r.slowDown=="number"||r.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in r&&typeof r.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in r&&!(typeof r.barnesHutTheta=="number"&&r.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},We.graphToByteArrays=function(r,n){var a=r.order,o=r.size,l={},s,i=new Float32Array(a*e),c=new Float32Array(o*t);return s=0,r.forEachNode(function(u,f){l[u]=s,i[s]=f.x,i[s+1]=f.y,i[s+2]=0,i[s+3]=0,i[s+4]=0,i[s+5]=0,i[s+6]=1,i[s+7]=1,i[s+8]=f.size||1,i[s+9]=f.fixed?1:0,s+=e}),s=0,r.forEachEdge(function(u,f,h,d,y,b,C){var j=l[h],_=l[d],A=n(u,f,h,d,y,b,C);i[j+6]+=A,i[_+6]+=A,c[s]=j,c[s+1]=_,c[s+2]=A,s+=t}),{nodes:i,edges:c}},We.assignLayoutChanges=function(r,n,a){var o=0;r.updateEachNodeAttributes(function(l,s){return s.x=n[o],s.y=n[o+1],o+=e,a?a(l,s):s})},We.readGraphPositions=function(r,n){var a=0;r.forEachNode(function(o,l){n[a]=l.x,n[a+1]=l.y,a+=e})},We.collectLayoutChanges=function(r,n,a){for(var o=r.nodes(),l={},s=0,i=0,c=n.length;s<c;s+=e){if(a){var u=Object.assign({},r.getNodeAttributes(o[i]));u.x=n[s],u.y=n[s+1],u=a(o[i],u),l[o[i]]={x:u.x,y:u.y}}else l[o[i]]={x:n[s],y:n[s+1]};i++}return l},We.createWorker=function(n){var a=window.URL||window.webkitURL,o=n.toString(),l=a.createObjectURL(new Blob(["("+o+").call(this);"],{type:"text/javascript"})),s=new Worker(l);return a.revokeObjectURL(l),s},We}var Rr,To;function vs(){return To||(To=1,Rr={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),Rr}var Ar,Ro;function tf(){if(Ro)return Ar;Ro=1;var e=Xe(),t=Nn().createEdgeWeightGetter,r=ef(),n=ms(),a=vs();function o(i,c,u){if(!e(c))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof u=="number"&&(u={iterations:u});var f=u.iterations;if(typeof f!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(f<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var h=t("getEdgeWeight"in u?u.getEdgeWeight:"weight").fromEntry,d=typeof u.outputReducer=="function"?u.outputReducer:null,y=n.assign({},a,u.settings),b=n.validateSettings(y);if(b)throw new Error("graphology-layout-forceatlas2: "+b.message);var C=n.graphToByteArrays(c,h),j;for(j=0;j<f;j++)r(y,C.nodes,C.edges);if(i){n.assignLayoutChanges(c,C.nodes,d);return}return n.collectLayoutChanges(c,C.nodes)}function l(i){var c=typeof i=="number"?i:i.order;return{barnesHutOptimize:c>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(c)}}var s=o.bind(null,!1);return s.assign=o.bind(null,!0),s.inferSettings=l,Ar=s,Ar}var rf=tf();const nf=He(rf);var jr,Ao;function of(){return Ao||(Ao=1,jr=function(){var t,r,n={};(function(){var o=0,l=1,s=2,i=3,c=4,u=5,f=6,h=7,d=8,y=9,b=0,C=1,j=2,_=0,A=1,I=2,N=3,z=4,m=5,E=6,x=7,T=8,R=3,O=10,w=3,H=9,K=10;n.exports=function(k,S,B){var ae,M,v,P,V,$,Q,X,Y,se,ne=S.length,ie=B.length,F=k.adjustSizes,J=k.barnesHutTheta*k.barnesHutTheta,q,U,L,oe,ue,re,ee,G=[];for(v=0;v<ne;v+=O)S[v+c]=S[v+s],S[v+u]=S[v+i],S[v+s]=0,S[v+i]=0;if(k.outboundAttractionDistribution){for(q=0,v=0;v<ne;v+=O)q+=S[v+f];q/=ne/O}if(k.barnesHutOptimize){var ge=1/0,pe=-1/0,ye=1/0,we=-1/0,de,me,Ie;for(v=0;v<ne;v+=O)ge=Math.min(ge,S[v+o]),pe=Math.max(pe,S[v+o]),ye=Math.min(ye,S[v+l]),we=Math.max(we,S[v+l]);var Ce=pe-ge,Te=we-ye;for(Ce>Te?(ye-=(Ce-Te)/2,we=ye+Ce):(ge-=(Te-Ce)/2,pe=ge+Te),G[0+_]=-1,G[0+A]=(ge+pe)/2,G[0+I]=(ye+we)/2,G[0+N]=Math.max(pe-ge,we-ye),G[0+z]=-1,G[0+m]=-1,G[0+E]=0,G[0+x]=0,G[0+T]=0,ae=1,v=0;v<ne;v+=O)for(M=0,Ie=R;;)if(G[M+m]>=0){S[v+o]<G[M+A]?S[v+l]<G[M+I]?de=G[M+m]:de=G[M+m]+H:S[v+l]<G[M+I]?de=G[M+m]+H*2:de=G[M+m]+H*3,G[M+x]=(G[M+x]*G[M+E]+S[v+o]*S[v+f])/(G[M+E]+S[v+f]),G[M+T]=(G[M+T]*G[M+E]+S[v+l]*S[v+f])/(G[M+E]+S[v+f]),G[M+E]+=S[v+f],M=de;continue}else if(G[M+_]<0){G[M+_]=v;break}else{if(G[M+m]=ae*H,X=G[M+N]/2,Y=G[M+m],G[Y+_]=-1,G[Y+A]=G[M+A]-X,G[Y+I]=G[M+I]-X,G[Y+N]=X,G[Y+z]=Y+H,G[Y+m]=-1,G[Y+E]=0,G[Y+x]=0,G[Y+T]=0,Y+=H,G[Y+_]=-1,G[Y+A]=G[M+A]-X,G[Y+I]=G[M+I]+X,G[Y+N]=X,G[Y+z]=Y+H,G[Y+m]=-1,G[Y+E]=0,G[Y+x]=0,G[Y+T]=0,Y+=H,G[Y+_]=-1,G[Y+A]=G[M+A]+X,G[Y+I]=G[M+I]-X,G[Y+N]=X,G[Y+z]=Y+H,G[Y+m]=-1,G[Y+E]=0,G[Y+x]=0,G[Y+T]=0,Y+=H,G[Y+_]=-1,G[Y+A]=G[M+A]+X,G[Y+I]=G[M+I]+X,G[Y+N]=X,G[Y+z]=G[M+z],G[Y+m]=-1,G[Y+E]=0,G[Y+x]=0,G[Y+T]=0,ae+=4,S[G[M+_]+o]<G[M+A]?S[G[M+_]+l]<G[M+I]?de=G[M+m]:de=G[M+m]+H:S[G[M+_]+l]<G[M+I]?de=G[M+m]+H*2:de=G[M+m]+H*3,G[M+E]=S[G[M+_]+f],G[M+x]=S[G[M+_]+o],G[M+T]=S[G[M+_]+l],G[de+_]=G[M+_],G[M+_]=-1,S[v+o]<G[M+A]?S[v+l]<G[M+I]?me=G[M+m]:me=G[M+m]+H:S[v+l]<G[M+I]?me=G[M+m]+H*2:me=G[M+m]+H*3,de===me)if(Ie--){M=de;continue}else{Ie=R;break}G[me+_]=v;break}}if(k.barnesHutOptimize)for(U=k.scalingRatio,v=0;v<ne;v+=O)for(M=0;;)if(G[M+m]>=0)if(re=Math.pow(S[v+o]-G[M+x],2)+Math.pow(S[v+l]-G[M+T],2),se=G[M+N],4*se*se/re<J){if(L=S[v+o]-G[M+x],oe=S[v+l]-G[M+T],F===!0?re>0?(ee=U*S[v+f]*G[M+E]/re,S[v+s]+=L*ee,S[v+i]+=oe*ee):re<0&&(ee=-U*S[v+f]*G[M+E]/Math.sqrt(re),S[v+s]+=L*ee,S[v+i]+=oe*ee):re>0&&(ee=U*S[v+f]*G[M+E]/re,S[v+s]+=L*ee,S[v+i]+=oe*ee),M=G[M+z],M<0)break;continue}else{M=G[M+m];continue}else{if($=G[M+_],$>=0&&$!==v&&(L=S[v+o]-S[$+o],oe=S[v+l]-S[$+l],re=L*L+oe*oe,F===!0?re>0?(ee=U*S[v+f]*S[$+f]/re,S[v+s]+=L*ee,S[v+i]+=oe*ee):re<0&&(ee=-U*S[v+f]*S[$+f]/Math.sqrt(re),S[v+s]+=L*ee,S[v+i]+=oe*ee):re>0&&(ee=U*S[v+f]*S[$+f]/re,S[v+s]+=L*ee,S[v+i]+=oe*ee)),M=G[M+z],M<0)break;continue}else for(U=k.scalingRatio,P=0;P<ne;P+=O)for(V=0;V<P;V+=O)L=S[P+o]-S[V+o],oe=S[P+l]-S[V+l],F===!0?(re=Math.sqrt(L*L+oe*oe)-S[P+d]-S[V+d],re>0?(ee=U*S[P+f]*S[V+f]/re/re,S[P+s]+=L*ee,S[P+i]+=oe*ee,S[V+s]-=L*ee,S[V+i]-=oe*ee):re<0&&(ee=100*U*S[P+f]*S[V+f],S[P+s]+=L*ee,S[P+i]+=oe*ee,S[V+s]-=L*ee,S[V+i]-=oe*ee)):(re=Math.sqrt(L*L+oe*oe),re>0&&(ee=U*S[P+f]*S[V+f]/re/re,S[P+s]+=L*ee,S[P+i]+=oe*ee,S[V+s]-=L*ee,S[V+i]-=oe*ee));for(Y=k.gravity/k.scalingRatio,U=k.scalingRatio,v=0;v<ne;v+=O)ee=0,L=S[v+o],oe=S[v+l],re=Math.sqrt(Math.pow(L,2)+Math.pow(oe,2)),k.strongGravityMode?re>0&&(ee=U*S[v+f]*Y):re>0&&(ee=U*S[v+f]*Y/re),S[v+s]-=L*ee,S[v+i]-=oe*ee;for(U=1*(k.outboundAttractionDistribution?q:1),Q=0;Q<ie;Q+=w)P=B[Q+b],V=B[Q+C],X=B[Q+j],ue=Math.pow(X,k.edgeWeightInfluence),L=S[P+o]-S[V+o],oe=S[P+l]-S[V+l],F===!0?(re=Math.sqrt(L*L+oe*oe)-S[P+d]-S[V+d],k.linLogMode?k.outboundAttractionDistribution?re>0&&(ee=-U*ue*Math.log(1+re)/re/S[P+f]):re>0&&(ee=-U*ue*Math.log(1+re)/re):k.outboundAttractionDistribution?re>0&&(ee=-U*ue/S[P+f]):re>0&&(ee=-U*ue)):(re=Math.sqrt(Math.pow(L,2)+Math.pow(oe,2)),k.linLogMode?k.outboundAttractionDistribution?re>0&&(ee=-U*ue*Math.log(1+re)/re/S[P+f]):re>0&&(ee=-U*ue*Math.log(1+re)/re):k.outboundAttractionDistribution?(re=1,ee=-U*ue/S[P+f]):(re=1,ee=-U*ue)),re>0&&(S[P+s]+=L*ee,S[P+i]+=oe*ee,S[V+s]-=L*ee,S[V+i]-=oe*ee);var Pe,Ye,Ke,Re,it,ze;if(F===!0)for(v=0;v<ne;v+=O)S[v+y]!==1&&(Pe=Math.sqrt(Math.pow(S[v+s],2)+Math.pow(S[v+i],2)),Pe>K&&(S[v+s]=S[v+s]*K/Pe,S[v+i]=S[v+i]*K/Pe),Ye=S[v+f]*Math.sqrt((S[v+c]-S[v+s])*(S[v+c]-S[v+s])+(S[v+u]-S[v+i])*(S[v+u]-S[v+i])),Ke=Math.sqrt((S[v+c]+S[v+s])*(S[v+c]+S[v+s])+(S[v+u]+S[v+i])*(S[v+u]+S[v+i]))/2,Re=.1*Math.log(1+Ke)/(1+Math.sqrt(Ye)),it=S[v+o]+S[v+s]*(Re/k.slowDown),S[v+o]=it,ze=S[v+l]+S[v+i]*(Re/k.slowDown),S[v+l]=ze);else for(v=0;v<ne;v+=O)S[v+y]!==1&&(Ye=S[v+f]*Math.sqrt((S[v+c]-S[v+s])*(S[v+c]-S[v+s])+(S[v+u]-S[v+i])*(S[v+u]-S[v+i])),Ke=Math.sqrt((S[v+c]+S[v+s])*(S[v+c]+S[v+s])+(S[v+u]+S[v+i])*(S[v+u]+S[v+i]))/2,Re=S[v+h]*Math.log(1+Ke)/(1+Math.sqrt(Ye)),S[v+h]=Math.min(1,Math.sqrt(Re*(Math.pow(S[v+s],2)+Math.pow(S[v+i],2))/(1+Math.sqrt(Ye)))),it=S[v+o]+S[v+s]*(Re/k.slowDown),S[v+o]=it,ze=S[v+l]+S[v+i]*(Re/k.slowDown),S[v+l]=ze);return{}}})();var a=n.exports;self.addEventListener("message",function(o){var l=o.data;t=new Float32Array(l.nodes),l.edges&&(r=new Float32Array(l.edges)),a(l.settings,t,r),self.postMessage({nodes:t.buffer},[t.buffer])})}),jr}var Ir,jo;function af(){if(jo)return Ir;jo=1;var e=of(),t=Xe(),r=Nn().createEdgeWeightGetter,n=ms(),a=vs();function o(l,s){if(s=s||{},!t(l))throw new Error("graphology-layout-forceatlas2/worker: the given graph is not a valid graphology instance.");var i=r("getEdgeWeight"in s?s.getEdgeWeight:"weight").fromEntry,c=n.assign({},a,s.settings),u=n.validateSettings(c);if(u)throw new Error("graphology-layout-forceatlas2/worker: "+u.message);this.worker=null,this.graph=l,this.settings=c,this.getEdgeWeight=i,this.matrices=null,this.running=!1,this.killed=!1,this.outputReducer=typeof s.outputReducer=="function"?s.outputReducer:null,this.handleMessage=this.handleMessage.bind(this);var f=void 0,h=this;this.handleGraphUpdate=function(){h.worker&&h.worker.terminate(),f&&clearTimeout(f),f=setTimeout(function(){f=void 0,h.spawnWorker()},0)},l.on("nodeAdded",this.handleGraphUpdate),l.on("edgeAdded",this.handleGraphUpdate),l.on("nodeDropped",this.handleGraphUpdate),l.on("edgeDropped",this.handleGraphUpdate),this.spawnWorker()}return o.prototype.isRunning=function(){return this.running},o.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=n.createWorker(e),this.worker.addEventListener("message",this.handleMessage),this.running&&(this.running=!1,this.start())},o.prototype.handleMessage=function(l){if(this.running){var s=new Float32Array(l.data.nodes);n.assignLayoutChanges(this.graph,s,this.outputReducer),this.outputReducer&&n.readGraphPositions(this.graph,s),this.matrices.nodes=s,this.askForIterations()}},o.prototype.askForIterations=function(l){var s=this.matrices,i={settings:this.settings,nodes:s.nodes.buffer},c=[s.nodes.buffer];return l&&(i.edges=s.edges.buffer,c.push(s.edges.buffer)),this.worker.postMessage(i,c),this},o.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-forceatlas2/worker.start: layout was killed.");return this.running?this:(this.matrices=n.graphToByteArrays(this.graph,this.getEdgeWeight),this.running=!0,this.askForIterations(!0),this)},o.prototype.stop=function(){return this.running=!1,this},o.prototype.kill=function(){if(this.killed)return this;this.running=!1,this.killed=!0,this.matrices=null,this.worker.terminate(),this.graph.removeListener("nodeAdded",this.handleGraphUpdate),this.graph.removeListener("edgeAdded",this.handleGraphUpdate),this.graph.removeListener("nodeDropped",this.handleGraphUpdate),this.graph.removeListener("edgeDropped",this.handleGraphUpdate)},Ir=o,Ir}var sf=af();const lf=He(sf);function ys(e={iterations:100}){return St(nf,e)}function cf(e={}){return In(lf,e)}var Nr,Io;function uf(){if(Io)return Nr;Io=1;var e=0,t=1,r=2,n=3;function a(l,s){return l+"§"+s}function o(){return .01*(.5-Math.random())}return Nr=function(s,i){var c=s.margin,u=s.ratio,f=s.expansion,h=s.gridSize,d=s.speed,y,b,C,j,_,A,I=!0,N=i.length,z=N/n|0,m=new Float32Array(z),E=new Float32Array(z),x=1/0,T=1/0,R=-1/0,O=-1/0;for(y=0;y<N;y+=n)C=i[y+e],j=i[y+t],A=i[y+r]*u+c,x=Math.min(x,C-A),R=Math.max(R,C+A),T=Math.min(T,j-A),O=Math.max(O,j+A);var w=R-x,H=O-T,K=(x+R)/2,D=(T+O)/2;x=K-f*w/2,R=K+f*w/2,T=D-f*H/2,O=D+f*H/2;var k=new Array(h*h),S=k.length,B;for(B=0;B<S;B++)k[B]=[];var ae,M,v,P,V,$,Q,X,Y,se;for(y=0;y<N;y+=n)for(C=i[y+e],j=i[y+t],A=i[y+r]*u+c,ae=C-A,M=C+A,v=j-A,P=j+A,V=Math.floor(h*(ae-x)/(R-x)),$=Math.floor(h*(M-x)/(R-x)),Q=Math.floor(h*(v-T)/(O-T)),X=Math.floor(h*(P-T)/(O-T)),Y=V;Y<=$;Y++)for(se=Q;se<=X;se++)k[Y*h+se].push(y);var ne,ie=new Set,F,J,q,U,L,oe,ue,re,ee,G,ge,pe,ye;for(B=0;B<S;B++)for(ne=k[B],y=0,_=ne.length;y<_;y++)for(F=ne[y],q=i[F+e],L=i[F+t],ue=i[F+r],b=y+1;b<_;b++)J=ne[b],ee=a(F,J),!(S>1&&ie.has(ee))&&(S>1&&ie.add(ee),U=i[J+e],oe=i[J+t],re=i[J+r],G=U-q,ge=oe-L,pe=Math.sqrt(G*G+ge*ge),ye=pe<ue*u+c+(re*u+c),ye&&(I=!1,J=J/n|0,pe>0?(m[J]+=G/pe*(1+ue),E[J]+=ge/pe*(1+ue)):(m[J]+=w*o(),E[J]+=H*o())));for(y=0,b=0;y<N;y+=n,b++)i[y+e]+=m[b]*.1*d,i[y+t]+=E[b]*.1*d;return{converged:I}},Nr}var ct={},No;function bs(){if(No)return ct;No=1;var e=3;return ct.validateSettings=function(t){return"gridSize"in t&&typeof t.gridSize!="number"||t.gridSize<=0?{message:"the `gridSize` setting should be a positive number."}:"margin"in t&&typeof t.margin!="number"||t.margin<0?{message:"the `margin` setting should be 0 or a positive number."}:"expansion"in t&&typeof t.expansion!="number"||t.expansion<=0?{message:"the `expansion` setting should be a positive number."}:"ratio"in t&&typeof t.ratio!="number"||t.ratio<=0?{message:"the `ratio` setting should be a positive number."}:"speed"in t&&typeof t.speed!="number"||t.speed<=0?{message:"the `speed` setting should be a positive number."}:null},ct.graphToByteArray=function(t,r){var n=t.order,a=new Float32Array(n*e),o=0;return t.forEachNode(function(l,s){typeof r=="function"&&(s=r(l,s)),a[o]=s.x,a[o+1]=s.y,a[o+2]=s.size||1,o+=e}),a},ct.assignLayoutChanges=function(t,r,n){var a=0;t.forEachNode(function(o){var l={x:r[a],y:r[a+1]};typeof n=="function"&&(l=n(o,l)),t.mergeNodeAttributes(o,l),a+=e})},ct.collectLayoutChanges=function(t,r,n){var a={},o=0;return t.forEachNode(function(l){var s={x:r[o],y:r[o+1]};typeof n=="function"&&(s=n(l,s)),a[l]=s,o+=e}),a},ct.createWorker=function(r){var n=window.URL||window.webkitURL,a=r.toString(),o=n.createObjectURL(new Blob(["("+a+").call(this);"],{type:"text/javascript"})),l=new Worker(o);return n.revokeObjectURL(o),l},ct}var Lr,Lo;function ws(){return Lo||(Lo=1,Lr={gridSize:20,margin:5,expansion:1.1,ratio:1,speed:3}),Lr}var Pr,Po;function df(){if(Po)return Pr;Po=1;var e=Xe(),t=uf(),r=bs(),n=ws(),a=500;function o(s,i,c){if(!e(i))throw new Error("graphology-layout-noverlap: the given graph is not a valid graphology instance.");typeof c=="number"?c={maxIterations:c}:c=c||{};var u=c.maxIterations||a;if(typeof u!="number"||u<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");var f=Object.assign({},n,c.settings),h=r.validateSettings(f);if(h)throw new Error("graphology-layout-noverlap: "+h.message);var d=r.graphToByteArray(i,c.inputReducer),y=!1,b;for(b=0;b<u&&!y;b++)y=t(f,d).converged;if(s){r.assignLayoutChanges(i,d,c.outputReducer);return}return r.collectLayoutChanges(i,d,c.outputReducer)}var l=o.bind(null,!1);return l.assign=o.bind(null,!0),Pr=l,Pr}var ff=df();const hf=He(ff);var zr,zo;function gf(){return zo||(zo=1,zr=function(){var t,r={};(function(){var a=0,o=1,l=2,s=3;function i(u,f){return u+"§"+f}function c(){return .01*(.5-Math.random())}r.exports=function(f,h){var d=f.margin,y=f.ratio,b=f.expansion,C=f.gridSize,j=f.speed,_,A,I,N,z,m,E=!0,x=h.length,T=x/s|0,R=new Float32Array(T),O=new Float32Array(T),w=1/0,H=1/0,K=-1/0,D=-1/0;for(_=0;_<x;_+=s)I=h[_+a],N=h[_+o],m=h[_+l]*y+d,w=Math.min(w,I-m),K=Math.max(K,I+m),H=Math.min(H,N-m),D=Math.max(D,N+m);var k=K-w,S=D-H,B=(w+K)/2,ae=(H+D)/2;w=B-b*k/2,K=B+b*k/2,H=ae-b*S/2,D=ae+b*S/2;var M=new Array(C*C),v=M.length,P;for(P=0;P<v;P++)M[P]=[];var V,$,Q,X,Y,se,ne,ie,F,J;for(_=0;_<x;_+=s)for(I=h[_+a],N=h[_+o],m=h[_+l]*y+d,V=I-m,$=I+m,Q=N-m,X=N+m,Y=Math.floor(C*(V-w)/(K-w)),se=Math.floor(C*($-w)/(K-w)),ne=Math.floor(C*(Q-H)/(D-H)),ie=Math.floor(C*(X-H)/(D-H)),F=Y;F<=se;F++)for(J=ne;J<=ie;J++)M[F*C+J].push(_);var q,U=new Set,L,oe,ue,re,ee,G,ge,pe,ye,we,de,me,Ie;for(P=0;P<v;P++)for(q=M[P],_=0,z=q.length;_<z;_++)for(L=q[_],ue=h[L+a],ee=h[L+o],ge=h[L+l],A=_+1;A<z;A++)oe=q[A],ye=i(L,oe),!(v>1&&U.has(ye))&&(v>1&&U.add(ye),re=h[oe+a],G=h[oe+o],pe=h[oe+l],we=re-ue,de=G-ee,me=Math.sqrt(we*we+de*de),Ie=me<ge*y+d+(pe*y+d),Ie&&(E=!1,oe=oe/s|0,me>0?(R[oe]+=we/me*(1+ge),O[oe]+=de/me*(1+ge)):(R[oe]+=k*c(),O[oe]+=S*c())));for(_=0,A=0;_<x;_+=s,A++)h[_+a]+=R[A]*.1*j,h[_+o]+=O[A]*.1*j;return{converged:E}}})();var n=r.exports;self.addEventListener("message",function(a){var o=a.data;t=new Float32Array(o.nodes);var l=n(o.settings,t);self.postMessage({result:l,nodes:t.buffer},[t.buffer])})}),zr}var Dr,Do;function pf(){if(Do)return Dr;Do=1;var e=gf(),t=Xe(),r=bs(),n=ws();function a(o,l){if(l=l||{},!t(o))throw new Error("graphology-layout-noverlap/worker: the given graph is not a valid graphology instance.");var s=Object.assign({},n,l.settings),i=r.validateSettings(s);if(i)throw new Error("graphology-layout-noverlap/worker: "+i.message);this.worker=null,this.graph=o,this.settings=s,this.matrices=null,this.running=!1,this.killed=!1,this.inputReducer=l.inputReducer,this.outputReducer=l.outputReducer,this.callbacks={onConverged:typeof l.onConverged=="function"?l.onConverged:null},this.handleMessage=this.handleMessage.bind(this);var c=!1,u=this;this.handleAddition=function(){c||(c=!0,u.spawnWorker(),setTimeout(function(){c=!1},0))},o.on("nodeAdded",this.handleAddition),o.on("edgeAdded",this.handleAddition),this.spawnWorker()}return a.prototype.isRunning=function(){return this.running},a.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=r.createWorker(e),this.worker.addEventListener("message",this.handleMessage),this.running&&(this.running=!1,this.start())},a.prototype.handleMessage=function(o){if(this.running){var l=new Float32Array(o.data.nodes);if(r.assignLayoutChanges(this.graph,l,this.outputReducer),this.matrices.nodes=l,o.data.result.converged){this.callbacks.onConverged&&this.callbacks.onConverged(),this.stop();return}this.askForIterations()}},a.prototype.askForIterations=function(){var o=this.matrices,l={settings:this.settings,nodes:o.nodes.buffer},s=[o.nodes.buffer];return this.worker.postMessage(l,s),this},a.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-noverlap/worker.start: layout was killed.");return this.running?this:(this.matrices={nodes:r.graphToByteArray(this.graph,this.inputReducer)},this.running=!0,this.askForIterations(),this)},a.prototype.stop=function(){return this.running=!1,this},a.prototype.kill=function(){if(this.killed)return this;this.running=!1,this.killed=!0,this.matrices=null,this.worker.terminate(),this.graph.removeListener("nodeAdded",this.handleAddition),this.graph.removeListener("edgeAdded",this.handleAddition)},Dr=a,Dr}var mf=pf();const vf=He(mf);function yf(e={}){return St(hf,e)}function bf(e={}){return In(vf,e)}var Or,Oo;function wf(){if(Oo)return Or;Oo=1;var e=It(),t=Xe(),r={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function n(o,l,s){if(!t(l))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");s=e(s,r);var i=s.dimensions;if(!Array.isArray(i)||i.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=i.length,u=s.center,f=s.rng,h=s.scale,d=(u-.5)*h;function y(C){for(var j=0;j<c;j++)C[i[j]]=f()*h+d;return C}if(!o){var b={};return l.forEachNode(function(C){b[C]=y({})}),b}l.updateEachNodeAttributes(function(C,j){return y(j),j},{attributes:i})}var a=n.bind(null,!1);return a.assign=n.bind(null,!0),Or=a,Or}var xf=wf();const _f=He(xf);function Sf(e={}){return St(_f,e)}var Go=1,Ef=.9,kf=.8,Cf=.17,Gr=.1,Fr=.999,Tf=.9999,Rf=.99,Af=/[\\\/_+.#"@\[\(\{&]/,jf=/[\\\/_+.#"@\[\(\{&]/g,If=/[\s-]/,xs=/[\s-]/g;function fn(e,t,r,n,a,o,l){if(o===t.length)return a===e.length?Go:Rf;var s=`${a},${o}`;if(l[s]!==void 0)return l[s];for(var i=n.charAt(o),c=r.indexOf(i,a),u=0,f,h,d,y;c>=0;)f=fn(e,t,r,n,c+1,o+1,l),f>u&&(c===a?f*=Go:Af.test(e.charAt(c-1))?(f*=kf,d=e.slice(a,c-1).match(jf),d&&a>0&&(f*=Math.pow(Fr,d.length))):If.test(e.charAt(c-1))?(f*=Ef,y=e.slice(a,c-1).match(xs),y&&a>0&&(f*=Math.pow(Fr,y.length))):(f*=Cf,a>0&&(f*=Math.pow(Fr,c-a))),e.charAt(c)!==t.charAt(o)&&(f*=Tf)),(f<Gr&&r.charAt(c-1)===n.charAt(o+1)||n.charAt(o+1)===n.charAt(o)&&r.charAt(c-1)!==n.charAt(o))&&(h=fn(e,t,r,n,c+1,o+2,l),h*Gr>f&&(f=h*Gr)),f>u&&(u=f),c=r.indexOf(i,c+1);return l[s]=u,u}function Fo(e){return e.toLowerCase().replace(xs," ")}function Nf(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,fn(e,t,Fo(e),Fo(t),0,0,{})}var Tt='[cmdk-group=""]',Mr='[cmdk-group-items=""]',Lf='[cmdk-group-heading=""]',_s='[cmdk-item=""]',Mo=`${_s}:not([aria-disabled="true"])`,hn="cmdk-item-select",vt="data-value",Pf=(e,t,r)=>Nf(e,t,r),Ss=p.createContext(void 0),Nt=()=>p.useContext(Ss),Es=p.createContext(void 0),Ln=()=>p.useContext(Es),ks=p.createContext(void 0),Cs=p.forwardRef((e,t)=>{let r=yt(()=>{var v,P;return{search:"",value:(P=(v=e.value)!=null?v:e.defaultValue)!=null?P:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=yt(()=>new Set),a=yt(()=>new Map),o=yt(()=>new Map),l=yt(()=>new Set),s=Ts(e),{label:i,children:c,value:u,onValueChange:f,filter:h,shouldFilter:d,loop:y,disablePointerSelection:b=!1,vimBindings:C=!0,...j}=e,_=ft(),A=ft(),I=ft(),N=p.useRef(null),z=Uf();gt(()=>{if(u!==void 0){let v=u.trim();r.current.value=v,m.emit()}},[u]),gt(()=>{z(6,w)},[]);let m=p.useMemo(()=>({subscribe:v=>(l.current.add(v),()=>l.current.delete(v)),snapshot:()=>r.current,setState:(v,P,V)=>{var $,Q,X,Y;if(!Object.is(r.current[v],P)){if(r.current[v]=P,v==="search")O(),T(),z(1,R);else if(v==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(I);se?se.focus():($=document.getElementById(_))==null||$.focus()}if(z(7,()=>{var se;r.current.selectedItemId=(se=H())==null?void 0:se.id,m.emit()}),V||z(5,w),((Q=s.current)==null?void 0:Q.value)!==void 0){let se=P??"";(Y=(X=s.current).onValueChange)==null||Y.call(X,se);return}}m.emit()}},emit:()=>{l.current.forEach(v=>v())}}),[]),E=p.useMemo(()=>({value:(v,P,V)=>{var $;P!==(($=o.current.get(v))==null?void 0:$.value)&&(o.current.set(v,{value:P,keywords:V}),r.current.filtered.items.set(v,x(P,V)),z(2,()=>{T(),m.emit()}))},item:(v,P)=>(n.current.add(v),P&&(a.current.has(P)?a.current.get(P).add(v):a.current.set(P,new Set([v]))),z(3,()=>{O(),T(),r.current.value||R(),m.emit()}),()=>{o.current.delete(v),n.current.delete(v),r.current.filtered.items.delete(v);let V=H();z(4,()=>{O(),(V==null?void 0:V.getAttribute("id"))===v&&R(),m.emit()})}),group:v=>(a.current.has(v)||a.current.set(v,new Set),()=>{o.current.delete(v),a.current.delete(v)}),filter:()=>s.current.shouldFilter,label:i||e["aria-label"],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:_,inputId:I,labelId:A,listInnerRef:N}),[]);function x(v,P){var V,$;let Q=($=(V=s.current)==null?void 0:V.filter)!=null?$:Pf;return v?Q(v,r.current.search,P):0}function T(){if(!r.current.search||s.current.shouldFilter===!1)return;let v=r.current.filtered.items,P=[];r.current.filtered.groups.forEach($=>{let Q=a.current.get($),X=0;Q.forEach(Y=>{let se=v.get(Y);X=Math.max(se,X)}),P.push([$,X])});let V=N.current;K().sort(($,Q)=>{var X,Y;let se=$.getAttribute("id"),ne=Q.getAttribute("id");return((X=v.get(ne))!=null?X:0)-((Y=v.get(se))!=null?Y:0)}).forEach($=>{let Q=$.closest(Mr);Q?Q.appendChild($.parentElement===Q?$:$.closest(`${Mr} > *`)):V.appendChild($.parentElement===V?$:$.closest(`${Mr} > *`))}),P.sort(($,Q)=>Q[1]-$[1]).forEach($=>{var Q;let X=(Q=N.current)==null?void 0:Q.querySelector(`${Tt}[${vt}="${encodeURIComponent($[0])}"]`);X==null||X.parentElement.appendChild(X)})}function R(){let v=K().find(V=>V.getAttribute("aria-disabled")!=="true"),P=v==null?void 0:v.getAttribute(vt);m.setState("value",P||void 0)}function O(){var v,P,V,$;if(!r.current.search||s.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let Q=0;for(let X of n.current){let Y=(P=(v=o.current.get(X))==null?void 0:v.value)!=null?P:"",se=($=(V=o.current.get(X))==null?void 0:V.keywords)!=null?$:[],ne=x(Y,se);r.current.filtered.items.set(X,ne),ne>0&&Q++}for(let[X,Y]of a.current)for(let se of Y)if(r.current.filtered.items.get(se)>0){r.current.filtered.groups.add(X);break}r.current.filtered.count=Q}function w(){var v,P,V;let $=H();$&&(((v=$.parentElement)==null?void 0:v.firstChild)===$&&((V=(P=$.closest(Tt))==null?void 0:P.querySelector(Lf))==null||V.scrollIntoView({block:"nearest"})),$.scrollIntoView({block:"nearest"}))}function H(){var v;return(v=N.current)==null?void 0:v.querySelector(`${_s}[aria-selected="true"]`)}function K(){var v;return Array.from(((v=N.current)==null?void 0:v.querySelectorAll(Mo))||[])}function D(v){let P=K()[v];P&&m.setState("value",P.getAttribute(vt))}function k(v){var P;let V=H(),$=K(),Q=$.findIndex(Y=>Y===V),X=$[Q+v];(P=s.current)!=null&&P.loop&&(X=Q+v<0?$[$.length-1]:Q+v===$.length?$[0]:$[Q+v]),X&&m.setState("value",X.getAttribute(vt))}function S(v){let P=H(),V=P==null?void 0:P.closest(Tt),$;for(;V&&!$;)V=v>0?Bf(V,Tt):Vf(V,Tt),$=V==null?void 0:V.querySelector(Mo);$?m.setState("value",$.getAttribute(vt)):k(v)}let B=()=>D(K().length-1),ae=v=>{v.preventDefault(),v.metaKey?B():v.altKey?S(1):k(1)},M=v=>{v.preventDefault(),v.metaKey?D(0):v.altKey?S(-1):k(-1)};return p.createElement(xe.div,{ref:t,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:v=>{var P;(P=j.onKeyDown)==null||P.call(j,v);let V=v.nativeEvent.isComposing||v.keyCode===229;if(!(v.defaultPrevented||V))switch(v.key){case"n":case"j":{C&&v.ctrlKey&&ae(v);break}case"ArrowDown":{ae(v);break}case"p":case"k":{C&&v.ctrlKey&&M(v);break}case"ArrowUp":{M(v);break}case"Home":{v.preventDefault(),D(0);break}case"End":{v.preventDefault(),B();break}case"Enter":{v.preventDefault();let $=H();if($){let Q=new Event(hn);$.dispatchEvent(Q)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:Wf},i),cr(e,v=>p.createElement(Es.Provider,{value:m},p.createElement(Ss.Provider,{value:E},v))))}),zf=p.forwardRef((e,t)=>{var r,n;let a=ft(),o=p.useRef(null),l=p.useContext(ks),s=Nt(),i=Ts(e),c=(n=(r=i.current)==null?void 0:r.forceMount)!=null?n:l==null?void 0:l.forceMount;gt(()=>{if(!c)return s.item(a,l==null?void 0:l.id)},[c]);let u=Rs(a,o,[e.value,e.children,o],e.keywords),f=Ln(),h=st(z=>z.value&&z.value===u.current),d=st(z=>c||s.filter()===!1?!0:z.search?z.filtered.items.get(a)>0:!0);p.useEffect(()=>{let z=o.current;if(!(!z||e.disabled))return z.addEventListener(hn,y),()=>z.removeEventListener(hn,y)},[d,e.onSelect,e.disabled]);function y(){var z,m;b(),(m=(z=i.current).onSelect)==null||m.call(z,u.current)}function b(){f.setState("value",u.current,!0)}if(!d)return null;let{disabled:C,value:j,onSelect:_,forceMount:A,keywords:I,...N}=e;return p.createElement(xe.div,{ref:Rt(o,t),...N,id:a,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!h,"data-disabled":!!C,"data-selected":!!h,onPointerMove:C||s.getDisablePointerSelection()?void 0:b,onClick:C?void 0:y},e.children)}),Df=p.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...o}=e,l=ft(),s=p.useRef(null),i=p.useRef(null),c=ft(),u=Nt(),f=st(d=>a||u.filter()===!1?!0:d.search?d.filtered.groups.has(l):!0);gt(()=>u.group(l),[]),Rs(l,s,[e.value,e.heading,i]);let h=p.useMemo(()=>({id:l,forceMount:a}),[a]);return p.createElement(xe.div,{ref:Rt(s,t),...o,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&p.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),cr(e,d=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},p.createElement(ks.Provider,{value:h},d))))}),Of=p.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=p.useRef(null),o=st(l=>!l.search);return!r&&!o?null:p.createElement(xe.div,{ref:Rt(a,t),...n,"cmdk-separator":"",role:"separator"})}),Gf=p.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,o=Ln(),l=st(c=>c.search),s=st(c=>c.selectedItemId),i=Nt();return p.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),p.createElement(xe.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,"aria-activedescendant":s,id:i.inputId,type:"text",value:a?e.value:l,onChange:c=>{a||o.setState("search",c.target.value),r==null||r(c.target.value)}})}),Ff=p.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,o=p.useRef(null),l=p.useRef(null),s=st(c=>c.selectedItemId),i=Nt();return p.useEffect(()=>{if(l.current&&o.current){let c=l.current,u=o.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let d=c.offsetHeight;u.style.setProperty("--cmdk-list-height",d.toFixed(1)+"px")})});return h.observe(c),()=>{cancelAnimationFrame(f),h.unobserve(c)}}},[]),p.createElement(xe.div,{ref:Rt(o,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":s,"aria-label":n,id:i.listId},cr(e,c=>p.createElement("div",{ref:Rt(l,i.listInnerRef),"cmdk-list-sizer":""},c)))}),Mf=p.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:o,container:l,...s}=e;return p.createElement(wa,{open:r,onOpenChange:n},p.createElement(va,{container:l},p.createElement(_n,{"cmdk-overlay":"",className:a}),p.createElement(Sn,{"aria-label":e.label,"cmdk-dialog":"",className:o},p.createElement(Cs,{ref:t,...s}))))}),$f=p.forwardRef((e,t)=>st(r=>r.filtered.count===0)?p.createElement(xe.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Hf=p.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...o}=e;return p.createElement(xe.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},cr(e,l=>p.createElement("div",{"aria-hidden":!0},l)))}),je=Object.assign(Cs,{List:Ff,Item:zf,Input:Gf,Group:Df,Separator:Of,Dialog:Mf,Empty:$f,Loading:Hf});function Bf(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Vf(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Ts(e){let t=p.useRef(e);return gt(()=>{t.current=e}),t}var gt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function yt(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function st(e){let t=Ln(),r=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,r,r)}function Rs(e,t,r,n=[]){let a=p.useRef(),o=Nt();return gt(()=>{var l;let s=(()=>{var c;for(let u of r){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():a.current}})(),i=n.map(c=>c.trim());o.value(e,s,i),(l=t.current)==null||l.setAttribute(vt,s),a.current=s}),a}var Uf=()=>{let[e,t]=p.useState(),r=yt(()=>new Map);return gt(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function qf(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function cr({asChild:e,children:t},r){return e&&p.isValidElement(t)?p.cloneElement(qf(t),{ref:t.ref},r(t.props.children)):r(t)}var Wf={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const ur=p.forwardRef(({className:e,...t},r)=>g.jsx(je,{ref:r,className:fe("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t}));ur.displayName=je.displayName;const Pn=p.forwardRef(({className:e,...t},r)=>g.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[g.jsx(_u,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),g.jsx(je.Input,{ref:r,className:fe("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})]}));Pn.displayName=je.Input.displayName;const dr=p.forwardRef(({className:e,...t},r)=>g.jsx(je.List,{ref:r,className:fe("max-h-[300px] overflow-x-hidden overflow-y-auto",e),...t}));dr.displayName=je.List.displayName;const zn=p.forwardRef((e,t)=>g.jsx(je.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));zn.displayName=je.Empty.displayName;const Et=p.forwardRef(({className:e,...t},r)=>g.jsx(je.Group,{ref:r,className:fe("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}));Et.displayName=je.Group.displayName;const Xf=p.forwardRef(({className:e,...t},r)=>g.jsx(je.Separator,{ref:r,className:fe("bg-border -mx-1 h-px",e),...t}));Xf.displayName=je.Separator.displayName;const kt=p.forwardRef(({className:e,...t},r)=>g.jsx(je.Item,{ref:r,className:fe("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}));kt.displayName=je.Item.displayName;const Yf=({layout:e,autoRunFor:t,mainLayout:r})=>{const n=Be(),[a,o]=p.useState(!1),l=p.useRef(null),{t:s}=Se(),i=p.useCallback(()=>{if(n)try{const u=n.getGraph();if(!u||u.order===0)return;const f=r.positions();ha(u,f,{duration:300})}catch(u){console.error("Error updating positions:",u),l.current&&(window.clearInterval(l.current),l.current=null,o(!1))}},[n,r]),c=p.useCallback(()=>{if(a){console.log("Stopping layout animation"),l.current&&(window.clearInterval(l.current),l.current=null);try{typeof e.kill=="function"?(e.kill(),console.log("Layout algorithm killed")):typeof e.stop=="function"&&(e.stop(),console.log("Layout algorithm stopped"))}catch(u){console.error("Error stopping layout algorithm:",u)}o(!1)}else console.log("Starting layout animation"),i(),l.current=window.setInterval(()=>{i()},200),o(!0),setTimeout(()=>{if(l.current){console.log("Auto-stopping layout animation after 3 seconds"),window.clearInterval(l.current),l.current=null,o(!1);try{typeof e.kill=="function"?e.kill():typeof e.stop=="function"&&e.stop()}catch(u){console.error("Error stopping layout algorithm:",u)}}},3e3)},[a,e,i]);return p.useEffect(()=>{if(!n){console.log("No sigma instance available");return}let u=null;return t!==void 0&&t>-1&&n.getGraph().order>0&&(console.log("Auto-starting layout animation"),i(),l.current=window.setInterval(()=>{i()},200),o(!0),t>0&&(u=window.setTimeout(()=>{console.log("Auto-stopping layout animation after timeout"),l.current&&(window.clearInterval(l.current),l.current=null),o(!1)},t))),()=>{l.current&&(window.clearInterval(l.current),l.current=null),u&&window.clearTimeout(u),o(!1)}},[t,n,i]),g.jsx(be,{size:"icon",onClick:c,tooltip:s(a?"graphPanel.sideBar.layoutsControl.stopAnimation":"graphPanel.sideBar.layoutsControl.startAnimation"),variant:Ne,children:a?g.jsx(lu,{}):g.jsx(fu,{})})},Kf=()=>{const e=Be(),{t}=Se(),[r,n]=p.useState("Circular"),[a,o]=p.useState(!1),l=Z.use.graphLayoutMaxIterations(),s=Ud(),i=$d(),c=Sf(),u=yf({maxIterations:l,settings:{margin:5,expansion:1.1,gridSize:1,ratio:1,speed:3}}),f=Jd({maxIterations:l,settings:{attraction:3e-4,repulsion:.02,gravity:.02,inertia:.4,maxMove:100}}),h=ys({iterations:l}),d=bf(),y=Zd(),b=cf(),C=p.useMemo(()=>({Circular:{layout:s},Circlepack:{layout:i},Random:{layout:c},Noverlaps:{layout:u,worker:d},"Force Directed":{layout:f,worker:y},"Force Atlas":{layout:h,worker:b}}),[i,s,f,h,u,c,y,d,b]),j=p.useCallback(_=>{console.debug("Running layout:",_);const{positions:A}=C[_].layout;try{const I=e.getGraph();if(!I){console.error("No graph available");return}const N=A();console.log("Positions calculated, animating nodes"),ha(I,N,{duration:400}),n(_)}catch(I){console.error("Error running layout:",I)}},[C,e]);return g.jsxs("div",{children:[g.jsx("div",{children:C[r]&&"worker"in C[r]&&g.jsx(Yf,{layout:C[r].worker,mainLayout:C[r].layout})}),g.jsx("div",{children:g.jsxs(Rn,{open:a,onOpenChange:o,children:[g.jsx(An,{asChild:!0,children:g.jsx(be,{size:"icon",variant:Ne,onClick:()=>o(_=>!_),tooltip:t("graphPanel.sideBar.layoutsControl.layoutGraph"),children:g.jsx(Jc,{})})}),g.jsx(lr,{side:"right",align:"start",sideOffset:8,collisionPadding:5,sticky:"always",className:"p-1 min-w-auto",children:g.jsx(ur,{children:g.jsx(dr,{children:g.jsx(Et,{children:Object.keys(C).map(_=>g.jsx(kt,{onSelect:()=>{j(_)},className:"cursor-pointer text-xs",children:t(`graphPanel.sideBar.layoutsControl.layouts.${_}`)},_))})})})})]})})]})},Qf=()=>{const e=p.useContext(Ra);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},Ot=e=>!!(e.type.startsWith("mouse")&&e.buttons!==0),Jf=({disableHoverEffect:e})=>{const t=Be(),r=ga(),n=xi(),a=Z.use.graphLayoutMaxIterations(),{assign:o}=ys({iterations:a}),{theme:l}=Qf(),s=Z.use.enableHideUnselectedEdges(),i=Z.use.enableEdgeEvents(),c=Z.use.showEdgeLabel(),u=Z.use.showNodeLabel(),f=Z.use.minEdgeSize(),h=Z.use.maxEdgeSize(),d=te.use.selectedNode(),y=te.use.focusedNode(),b=te.use.selectedEdge(),C=te.use.focusedEdge(),j=te.use.sigmaGraph();return p.useEffect(()=>{if(j&&t){try{typeof t.setGraph=="function"?(t.setGraph(j),console.log("Binding graph to sigma instance")):(t.graph=j,console.warn("Simgma missing setGraph function, set graph property directly"))}catch(_){console.error("Error setting graph on sigma instance:",_)}o(),console.log("Initial layout applied to graph")}},[t,j,o,a]),p.useEffect(()=>{t&&(te.getState().sigmaInstance||(console.log("Setting sigma instance from GraphControl"),te.getState().setSigmaInstance(t)))},[t]),p.useEffect(()=>{const{setFocusedNode:_,setSelectedNode:A,setFocusedEdge:I,setSelectedEdge:N,clearSelection:z}=te.getState(),m={enterNode:E=>{Ot(E.event.original)||t.getGraph().hasNode(E.node)&&_(E.node)},leaveNode:E=>{Ot(E.event.original)||_(null)},clickNode:E=>{t.getGraph().hasNode(E.node)&&(A(E.node),N(null))},clickStage:()=>z()};i&&(m.clickEdge=E=>{N(E.edge),A(null)},m.enterEdge=E=>{Ot(E.event.original)||I(E.edge)},m.leaveEdge=E=>{Ot(E.event.original)||I(null)}),r(m)},[r,i]),p.useEffect(()=>{if(t&&j){const _=t.getGraph();let A=Number.MAX_SAFE_INTEGER,I=0;_.forEachEdge(z=>{const m=_.getEdgeAttribute(z,"originalWeight")||1;typeof m=="number"&&(A=Math.min(A,m),I=Math.max(I,m))});const N=I-A;if(N>0){const z=h-f;_.forEachEdge(m=>{const E=_.getEdgeAttribute(m,"originalWeight")||1;if(typeof E=="number"){const x=f+z*Math.pow((E-A)/N,.5);_.setEdgeAttribute(m,"size",x)}})}else _.forEachEdge(z=>{_.setEdgeAttribute(z,"size",f)});t.refresh()}},[t,j,f,h]),p.useEffect(()=>{const _=l==="dark",A=_?qi:void 0,I=_?Ki:void 0;n({enableEdgeEvents:i,renderEdgeLabels:c,renderLabels:u,nodeReducer:(N,z)=>{const m=t.getGraph(),E={...z,highlighted:z.highlighted||!1,labelColor:A};if(!e){E.highlighted=!1;const x=y||d,T=C||b;if(x&&m.hasNode(x))try{(N===x||m.neighbors(x).includes(N))&&(E.highlighted=!0,N===d&&(E.borderColor=Yi))}catch(R){console.error("Error in nodeReducer:",R)}else if(T&&m.hasEdge(T))m.extremities(T).includes(N)&&(E.highlighted=!0,E.size=3);else return E;E.highlighted?_&&(E.labelColor=Wi):E.color=Xi}return E},edgeReducer:(N,z)=>{const m=t.getGraph(),E={...z,hidden:!1,labelColor:A,color:I};if(!e){const x=y||d;if(x&&m.hasNode(x))try{s?m.extremities(N).includes(x)||(E.hidden=!0):m.extremities(N).includes(x)&&(E.color=Xn)}catch(T){console.error("Error in edgeReducer:",T)}else{const T=b&&m.hasEdge(b)?b:null,R=C&&m.hasEdge(C)?C:null;(T||R)&&(N===T?E.color=Qi:N===R?E.color=Xn:s&&(E.hidden=!0))}}return E}})},[d,y,b,C,n,t,e,l,s,i,c,u]),null},Zf=()=>{const{zoomIn:e,zoomOut:t,reset:r}=da({duration:200,factor:1.5}),n=Be(),{t:a}=Se(),o=p.useCallback(()=>e(),[e]),l=p.useCallback(()=>t(),[t]),s=p.useCallback(()=>{if(n)try{n.setCustomBBox(null),n.refresh();const u=n.getGraph();if(!(u!=null&&u.order)||u.nodes().length===0){r();return}n.getCamera().animate({x:.5,y:.5,ratio:1.1},{duration:1e3})}catch(u){console.error("Error resetting zoom:",u),r()}},[n,r]),i=p.useCallback(()=>{if(!n)return;const u=n.getCamera(),h=u.angle+Math.PI/8;u.animate({angle:h},{duration:200})},[n]),c=p.useCallback(()=>{if(!n)return;const u=n.getCamera(),h=u.angle-Math.PI/8;u.animate({angle:h},{duration:200})},[n]);return g.jsxs(g.Fragment,{children:[g.jsx(be,{variant:Ne,onClick:i,tooltip:a("graphPanel.sideBar.zoomControl.rotateCamera"),size:"icon",children:g.jsx(yu,{})}),g.jsx(be,{variant:Ne,onClick:c,tooltip:a("graphPanel.sideBar.zoomControl.rotateCameraCounterClockwise"),size:"icon",children:g.jsx(mu,{})}),g.jsx(be,{variant:Ne,onClick:s,tooltip:a("graphPanel.sideBar.zoomControl.resetZoom"),size:"icon",children:g.jsx(Wc,{})}),g.jsx(be,{variant:Ne,onClick:o,tooltip:a("graphPanel.sideBar.zoomControl.zoomIn"),size:"icon",children:g.jsx(Pu,{})}),g.jsx(be,{variant:Ne,onClick:l,tooltip:a("graphPanel.sideBar.zoomControl.zoomOut"),size:"icon",children:g.jsx(Du,{})})]})},eh=()=>{const{isFullScreen:e,toggle:t}=_i(),{t:r}=Se();return g.jsx(g.Fragment,{children:e?g.jsx(be,{variant:Ne,onClick:t,tooltip:r("graphPanel.sideBar.fullScreenControl.windowed"),size:"icon",children:g.jsx(au,{})}):g.jsx(be,{variant:Ne,onClick:t,tooltip:r("graphPanel.sideBar.fullScreenControl.fullScreen"),size:"icon",children:g.jsx(nu,{})})})};var fr="Checkbox",[th,$p]=xn(fr),[rh,Dn]=th(fr);function nh(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:o,form:l,name:s,onCheckedChange:i,required:c,value:u="on",internal_do_not_use_render:f}=e,[h,d]=ma({prop:r,defaultProp:a??!1,onChange:i,caller:fr}),[y,b]=p.useState(null),[C,j]=p.useState(null),_=p.useRef(!1),A=y?!!l||!!y.closest("form"):!0,I={checked:h,disabled:o,setChecked:d,control:y,setControl:b,name:s,form:l,value:u,hasConsumerStoppedPropagationRef:_,required:c,defaultChecked:ot(a)?!1:a,isFormControl:A,bubbleInput:C,setBubbleInput:j};return g.jsx(rh,{scope:t,...I,children:oh(f)?f(I):n})}var As="CheckboxTrigger",js=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:o,value:l,disabled:s,checked:i,required:c,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:h,isFormControl:d,bubbleInput:y}=Dn(As,e),b=Ve(a,u),C=p.useRef(i);return p.useEffect(()=>{const j=o==null?void 0:o.form;if(j){const _=()=>f(C.current);return j.addEventListener("reset",_),()=>j.removeEventListener("reset",_)}},[o,f]),g.jsx(xe.button,{type:"button",role:"checkbox","aria-checked":ot(i)?"mixed":i,"aria-required":c,"data-state":zs(i),"data-disabled":s?"":void 0,disabled:s,value:l,...n,ref:b,onKeyDown:ke(t,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:ke(r,j=>{f(_=>ot(_)?!0:!_),y&&d&&(h.current=j.isPropagationStopped(),h.current||j.stopPropagation())})})});js.displayName=As;var On=p.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:o,required:l,disabled:s,value:i,onCheckedChange:c,form:u,...f}=e;return g.jsx(nh,{__scopeCheckbox:r,checked:a,defaultChecked:o,disabled:s,required:l,onCheckedChange:c,name:n,form:u,value:i,internal_do_not_use_render:({isFormControl:h})=>g.jsxs(g.Fragment,{children:[g.jsx(js,{...f,ref:t,__scopeCheckbox:r}),h&&g.jsx(Ps,{__scopeCheckbox:r})]})})});On.displayName=fr;var Is="CheckboxIndicator",Ns=p.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,o=Dn(Is,r);return g.jsx(_t,{present:n||ot(o.checked)||o.checked===!0,children:g.jsx(xe.span,{"data-state":zs(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});Ns.displayName=Is;var Ls="CheckboxBubbleInput",Ps=p.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:l,required:s,disabled:i,name:c,value:u,form:f,bubbleInput:h,setBubbleInput:d}=Dn(Ls,e),y=Ve(r,d),b=Fi(o),C=Mi(n);p.useEffect(()=>{const _=h;if(!_)return;const A=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(A,"checked").set,z=!a.current;if(b!==o&&N){const m=new Event("click",{bubbles:z});_.indeterminate=ot(o),N.call(_,ot(o)?!1:o),_.dispatchEvent(m)}},[h,b,o,a]);const j=p.useRef(ot(o)?!1:o);return g.jsx(xe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??j.current,required:s,disabled:i,name:c,value:u,form:f,...t,tabIndex:-1,ref:y,style:{...t.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ps.displayName=Ls;function oh(e){return typeof e=="function"}function ot(e){return e==="indeterminate"}function zs(e){return ot(e)?"indeterminate":e?"checked":"unchecked"}const Ds=p.forwardRef(({className:e,...t},r)=>g.jsx(On,{ref:r,className:fe("peer border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-muted data-[state=checked]:text-muted-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:g.jsx(Ns,{className:fe("flex items-center justify-center text-current"),children:g.jsx(Va,{className:"h-4 w-4"})})}));Ds.displayName=On.displayName;var ah="Separator",$o="horizontal",sh=["horizontal","vertical"],Os=p.forwardRef((e,t)=>{const{decorative:r,orientation:n=$o,...a}=e,o=ih(n)?n:$o,s=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return g.jsx(xe.div,{"data-orientation":o,...s,...a,ref:t})});Os.displayName=ah;function ih(e){return sh.includes(e)}var Gs=Os;const bt=p.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},a)=>g.jsx(Gs,{ref:a,decorative:r,orientation:t,className:fe("bg-border shrink-0",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));bt.displayName=Gs.displayName;const tt=({checked:e,onCheckedChange:t,label:r})=>{const n=`checkbox-${r.toLowerCase().replace(/\s+/g,"-")}`;return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Ds,{id:n,checked:e,onCheckedChange:t}),g.jsx("label",{htmlFor:n,className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:r})]})},$r=({value:e,onEditFinished:t,label:r,min:n,max:a,defaultValue:o})=>{const{t:l}=Se(),[s,i]=p.useState(e),c=`input-${r.toLowerCase().replace(/\s+/g,"-")}`;p.useEffect(()=>{i(e)},[e]);const u=p.useCallback(d=>{const y=d.target.value.trim();if(y.length===0){i(null);return}const b=Number.parseInt(y);if(!isNaN(b)&&b!==s){if(n!==void 0&&b<n||a!==void 0&&b>a)return;i(b)}},[s,n,a]),f=p.useCallback(()=>{s!==null&&e!==s&&t(s)},[e,s,t]),h=p.useCallback(()=>{o!==void 0&&e!==o&&(i(o),t(o))},[o,e,t]);return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{htmlFor:c,className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:r}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Yt,{id:c,type:"number",value:s===null?"":s,onChange:u,className:"h-6 w-full min-w-0 pr-1",min:n,max:a,onBlur:f,onKeyDown:d=>{d.key==="Enter"&&f()}}),o!==void 0&&g.jsx(be,{variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0 hover:bg-muted text-muted-foreground hover:text-foreground",onClick:h,type:"button",title:l("graphPanel.sideBar.settings.resetToDefault"),children:g.jsx(qa,{className:"h-3.5 w-3.5"})})]})]})};function lh(){const[e,t]=p.useState(!1),r=Z.use.showPropertyPanel(),n=Z.use.showNodeSearchBar(),a=Z.use.showNodeLabel(),o=Z.use.enableEdgeEvents(),l=Z.use.enableNodeDrag(),s=Z.use.enableHideUnselectedEdges(),i=Z.use.showEdgeLabel(),c=Z.use.minEdgeSize(),u=Z.use.maxEdgeSize(),f=Z.use.graphQueryMaxDepth(),h=Z.use.graphMaxNodes(),d=Z.use.backendMaxGraphNodes(),y=Z.use.graphLayoutMaxIterations(),b=Z.use.enableHealthCheck(),C=p.useCallback(()=>Z.setState(w=>({enableNodeDrag:!w.enableNodeDrag})),[]),j=p.useCallback(()=>Z.setState(w=>({enableEdgeEvents:!w.enableEdgeEvents})),[]),_=p.useCallback(()=>Z.setState(w=>({enableHideUnselectedEdges:!w.enableHideUnselectedEdges})),[]),A=p.useCallback(()=>Z.setState(w=>({showEdgeLabel:!w.showEdgeLabel})),[]),I=p.useCallback(()=>Z.setState(w=>({showPropertyPanel:!w.showPropertyPanel})),[]),N=p.useCallback(()=>Z.setState(w=>({showNodeSearchBar:!w.showNodeSearchBar})),[]),z=p.useCallback(()=>Z.setState(w=>({showNodeLabel:!w.showNodeLabel})),[]),m=p.useCallback(()=>Z.setState(w=>({enableHealthCheck:!w.enableHealthCheck})),[]),E=p.useCallback(w=>{if(w<1)return;Z.setState({graphQueryMaxDepth:w});const H=Z.getState().queryLabel;Z.getState().setQueryLabel(""),setTimeout(()=>{Z.getState().setQueryLabel(H)},300)},[]),x=p.useCallback(w=>{const H=d||1e3;w<1||w>H||Z.getState().setGraphMaxNodes(w,!0)},[d]),T=p.useCallback(w=>{w<1||Z.setState({graphLayoutMaxIterations:w})},[]),{t:R}=Se(),O=()=>t(!1);return g.jsx(g.Fragment,{children:g.jsxs(Rn,{open:e,onOpenChange:t,children:[g.jsx(An,{asChild:!0,children:g.jsx(be,{variant:Ne,tooltip:R("graphPanel.sideBar.settings.settings"),size:"icon",children:g.jsx(ku,{})})}),g.jsx(lr,{side:"right",align:"end",sideOffset:8,collisionPadding:5,className:"p-2 max-w-[200px]",onCloseAutoFocus:w=>w.preventDefault(),children:g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx(tt,{checked:b,onCheckedChange:m,label:R("graphPanel.sideBar.settings.healthCheck")}),g.jsx(bt,{}),g.jsx(tt,{checked:r,onCheckedChange:I,label:R("graphPanel.sideBar.settings.showPropertyPanel")}),g.jsx(tt,{checked:n,onCheckedChange:N,label:R("graphPanel.sideBar.settings.showSearchBar")}),g.jsx(bt,{}),g.jsx(tt,{checked:a,onCheckedChange:z,label:R("graphPanel.sideBar.settings.showNodeLabel")}),g.jsx(tt,{checked:l,onCheckedChange:C,label:R("graphPanel.sideBar.settings.nodeDraggable")}),g.jsx(bt,{}),g.jsx(tt,{checked:i,onCheckedChange:A,label:R("graphPanel.sideBar.settings.showEdgeLabel")}),g.jsx(tt,{checked:s,onCheckedChange:_,label:R("graphPanel.sideBar.settings.hideUnselectedEdges")}),g.jsx(tt,{checked:o,onCheckedChange:j,label:R("graphPanel.sideBar.settings.edgeEvents")}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{htmlFor:"edge-size-min",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:R("graphPanel.sideBar.settings.edgeSizeRange")}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Yt,{id:"edge-size-min",type:"number",value:c,onChange:w=>{const H=Number(w.target.value);!isNaN(H)&&H>=1&&H<=u&&Z.setState({minEdgeSize:H})},className:"h-6 w-16 min-w-0 pr-1",min:1,max:Math.min(u,10)}),g.jsx("span",{children:"-"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Yt,{id:"edge-size-max",type:"number",value:u,onChange:w=>{const H=Number(w.target.value);!isNaN(H)&&H>=c&&H>=1&&H<=10&&Z.setState({maxEdgeSize:H})},className:"h-6 w-16 min-w-0 pr-1",min:c,max:10}),g.jsx(be,{variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0 hover:bg-muted text-muted-foreground hover:text-foreground",onClick:()=>Z.setState({minEdgeSize:1,maxEdgeSize:5}),type:"button",title:R("graphPanel.sideBar.settings.resetToDefault"),children:g.jsx(qa,{className:"h-3.5 w-3.5"})})]})]})]}),g.jsx(bt,{}),g.jsx($r,{label:R("graphPanel.sideBar.settings.maxQueryDepth"),min:1,value:f,defaultValue:3,onEditFinished:E}),g.jsx($r,{label:`${R("graphPanel.sideBar.settings.maxNodes")} (≤ ${d||1e3})`,min:1,max:d||1e3,value:h,defaultValue:d||1e3,onEditFinished:x}),g.jsx($r,{label:R("graphPanel.sideBar.settings.maxLayoutIterations"),min:1,max:30,value:y,defaultValue:15,onEditFinished:T}),g.jsx(bt,{}),g.jsx(be,{onClick:O,variant:"outline",size:"sm",className:"ml-auto px-4",children:R("graphPanel.sideBar.settings.save")})]})})]})})}const ch="ENTRIES",Fs="KEYS",Ms="VALUES",Ee="";class Hr{constructor(t,r){const n=t._tree,a=Array.from(n.keys());this.set=t,this._type=r,this._path=a.length>0?[{node:n,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:r}=pt(this._path);if(pt(r)===Ee)return{done:!1,value:this.result()};const n=t.get(pt(r));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const t=pt(this._path).keys;t.pop(),!(t.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:t})=>pt(t)).filter(t=>t!==Ee).join("")}value(){return pt(this._path).node.get(Ee)}result(){switch(this._type){case Ms:return this.value();case Fs:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const pt=e=>e[e.length-1],uh=(e,t,r)=>{const n=new Map;if(t===void 0)return n;const a=t.length+1,o=a+r,l=new Uint8Array(o*a).fill(r+1);for(let s=0;s<a;++s)l[s]=s;for(let s=1;s<o;++s)l[s*a]=s;return $s(e,t,r,n,l,1,a,""),n},$s=(e,t,r,n,a,o,l,s)=>{const i=o*l;e:for(const c of e.keys())if(c===Ee){const u=a[i-1];u<=r&&n.set(s,[e.get(c),u])}else{let u=o;for(let f=0;f<c.length;++f,++u){const h=c[f],d=l*u,y=d-l;let b=a[d];const C=Math.max(0,u-r-1),j=Math.min(l-1,u+r);for(let _=C;_<j;++_){const A=h!==t[_],I=a[y+_]+ +A,N=a[y+_+1]+1,z=a[d+_]+1,m=a[d+_+1]=Math.min(I,N,z);m<b&&(b=m)}if(b>r)continue e}$s(e.get(c),t,r,n,a,u,l,s+c)}};class nt{constructor(t=new Map,r=""){this._size=void 0,this._tree=t,this._prefix=r}atPrefix(t){if(!t.startsWith(this._prefix))throw new Error("Mismatched prefix");const[r,n]=Zt(this._tree,t.slice(this._prefix.length));if(r===void 0){const[a,o]=Gn(n);for(const l of a.keys())if(l!==Ee&&l.startsWith(o)){const s=new Map;return s.set(l.slice(o.length),a.get(l)),new nt(s,t)}}return new nt(r,t)}clear(){this._size=void 0,this._tree.clear()}delete(t){return this._size=void 0,dh(this._tree,t)}entries(){return new Hr(this,ch)}forEach(t){for(const[r,n]of this)t(r,n,this)}fuzzyGet(t,r){return uh(this._tree,t,r)}get(t){const r=gn(this._tree,t);return r!==void 0?r.get(Ee):void 0}has(t){const r=gn(this._tree,t);return r!==void 0&&r.has(Ee)}keys(){return new Hr(this,Fs)}set(t,r){if(typeof t!="string")throw new Error("key must be a string");return this._size=void 0,Br(this._tree,t).set(Ee,r),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,r){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const n=Br(this._tree,t);return n.set(Ee,r(n.get(Ee))),this}fetch(t,r){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const n=Br(this._tree,t);let a=n.get(Ee);return a===void 0&&n.set(Ee,a=r()),a}values(){return new Hr(this,Ms)}[Symbol.iterator](){return this.entries()}static from(t){const r=new nt;for(const[n,a]of t)r.set(n,a);return r}static fromObject(t){return nt.from(Object.entries(t))}}const Zt=(e,t,r=[])=>{if(t.length===0||e==null)return[e,r];for(const n of e.keys())if(n!==Ee&&t.startsWith(n))return r.push([e,n]),Zt(e.get(n),t.slice(n.length),r);return r.push([e,t]),Zt(void 0,"",r)},gn=(e,t)=>{if(t.length===0||e==null)return e;for(const r of e.keys())if(r!==Ee&&t.startsWith(r))return gn(e.get(r),t.slice(r.length))},Br=(e,t)=>{const r=t.length;e:for(let n=0;e&&n<r;){for(const o of e.keys())if(o!==Ee&&t[n]===o[0]){const l=Math.min(r-n,o.length);let s=1;for(;s<l&&t[n+s]===o[s];)++s;const i=e.get(o);if(s===o.length)e=i;else{const c=new Map;c.set(o.slice(s),i),e.set(t.slice(n,n+s),c),e.delete(o),e=c}n+=s;continue e}const a=new Map;return e.set(t.slice(n),a),a}return e},dh=(e,t)=>{const[r,n]=Zt(e,t);if(r!==void 0){if(r.delete(Ee),r.size===0)Hs(n);else if(r.size===1){const[a,o]=r.entries().next().value;Bs(n,a,o)}}},Hs=e=>{if(e.length===0)return;const[t,r]=Gn(e);if(t.delete(r),t.size===0)Hs(e.slice(0,-1));else if(t.size===1){const[n,a]=t.entries().next().value;n!==Ee&&Bs(e.slice(0,-1),n,a)}},Bs=(e,t,r)=>{if(e.length===0)return;const[n,a]=Gn(e);n.set(a+t,r),n.delete(a)},Gn=e=>e[e.length-1],Fn="or",Vs="and",fh="and_not";class at{constructor(t){if((t==null?void 0:t.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');const r=t.autoVacuum==null||t.autoVacuum===!0?qr:t.autoVacuum;this._options={...Ur,...t,autoVacuum:r,searchOptions:{...Ho,...t.searchOptions||{}},autoSuggestOptions:{...vh,...t.autoSuggestOptions||{}}},this._index=new nt,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=mn,this.addFields(this._options.fields)}add(t){const{extractField:r,tokenize:n,processTerm:a,fields:o,idField:l}=this._options,s=r(t,l);if(s==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);if(this._idToShortId.has(s))throw new Error(`MiniSearch: duplicate ID ${s}`);const i=this.addDocumentId(s);this.saveStoredFields(i,t);for(const c of o){const u=r(t,c);if(u==null)continue;const f=n(u.toString(),c),h=this._fieldIds[c],d=new Set(f).size;this.addFieldLength(i,h,this._documentCount-1,d);for(const y of f){const b=a(y,c);if(Array.isArray(b))for(const C of b)this.addTerm(h,i,C);else b&&this.addTerm(h,i,b)}}}addAll(t){for(const r of t)this.add(r)}addAllAsync(t,r={}){const{chunkSize:n=10}=r,a={chunk:[],promise:Promise.resolve()},{chunk:o,promise:l}=t.reduce(({chunk:s,promise:i},c,u)=>(s.push(c),(u+1)%n===0?{chunk:[],promise:i.then(()=>new Promise(f=>setTimeout(f,0))).then(()=>this.addAll(s))}:{chunk:s,promise:i}),a);return l.then(()=>this.addAll(o))}remove(t){const{tokenize:r,processTerm:n,extractField:a,fields:o,idField:l}=this._options,s=a(t,l);if(s==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);const i=this._idToShortId.get(s);if(i==null)throw new Error(`MiniSearch: cannot remove document with ID ${s}: it is not in the index`);for(const c of o){const u=a(t,c);if(u==null)continue;const f=r(u.toString(),c),h=this._fieldIds[c],d=new Set(f).size;this.removeFieldLength(i,h,this._documentCount,d);for(const y of f){const b=n(y,c);if(Array.isArray(b))for(const C of b)this.removeTerm(h,i,C);else b&&this.removeTerm(h,i,b)}}this._storedFields.delete(i),this._documentIds.delete(i),this._idToShortId.delete(s),this._fieldLength.delete(i),this._documentCount-=1}removeAll(t){if(t)for(const r of t)this.remove(r);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new nt,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 r=this._idToShortId.get(t);if(r==null)throw new Error(`MiniSearch: cannot discard document with ID ${t}: it is not in the index`);this._idToShortId.delete(t),this._documentIds.delete(r),this._storedFields.delete(r),(this._fieldLength.get(r)||[]).forEach((n,a)=>{this.removeFieldLength(r,a,this._documentCount,n)}),this._fieldLength.delete(r),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:t,minDirtCount:r,batchSize:n,batchWait:a}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:a},{minDirtCount:r,minDirtFactor:t})}discardAll(t){const r=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const n of t)this.discard(n)}finally{this._options.autoVacuum=r}this.maybeAutoVacuum()}replace(t){const{idField:r,extractField:n}=this._options,a=n(t,r);this.discard(a),this.add(t)}vacuum(t={}){return this.conditionalVacuum(t)}conditionalVacuum(t,r){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const n=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=mn,this.performVacuuming(t,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(t),this._currentVacuum)}async performVacuuming(t,r){const n=this._dirtCount;if(this.vacuumConditionsMet(r)){const a=t.batchSize||pn.batchSize,o=t.batchWait||pn.batchWait;let l=1;for(const[s,i]of this._index){for(const[c,u]of i)for(const[f]of u)this._documentIds.has(f)||(u.size<=1?i.delete(c):u.delete(f));this._index.get(s).size===0&&this._index.delete(s),l%a===0&&await new Promise(c=>setTimeout(c,o)),l+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(t){if(t==null)return!0;let{minDirtCount:r,minDirtFactor:n}=t;return r=r||qr.minDirtCount,n=n||qr.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n}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 r=this._idToShortId.get(t);if(r!=null)return this._storedFields.get(r)}search(t,r={}){const{searchOptions:n}=this._options,a={...n,...r},o=this.executeQuery(t,r),l=[];for(const[s,{score:i,terms:c,match:u}]of o){const f=c.length||1,h={id:this._documentIds.get(s),score:i*f,terms:Object.keys(u),queryTerms:c,match:u};Object.assign(h,this._storedFields.get(s)),(a.filter==null||a.filter(h))&&l.push(h)}return t===at.wildcard&&a.boostDocument==null||l.sort(Vo),l}autoSuggest(t,r={}){r={...this._options.autoSuggestOptions,...r};const n=new Map;for(const{score:o,terms:l}of this.search(t,r)){const s=l.join(" "),i=n.get(s);i!=null?(i.score+=o,i.count+=1):n.set(s,{score:o,terms:l,count:1})}const a=[];for(const[o,{score:l,terms:s,count:i}]of n)a.push({suggestion:o,terms:s,score:l/i});return a.sort(Vo),a}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(t,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(t),r)}static async loadJSONAsync(t,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(t),r)}static getDefault(t){if(Ur.hasOwnProperty(t))return Vr(Ur,t);throw new Error(`MiniSearch: unknown option "${t}"`)}static loadJS(t,r){const{index:n,documentIds:a,fieldLength:o,storedFields:l,serializationVersion:s}=t,i=this.instantiateMiniSearch(t,r);i._documentIds=Gt(a),i._fieldLength=Gt(o),i._storedFields=Gt(l);for(const[c,u]of i._documentIds)i._idToShortId.set(u,c);for(const[c,u]of n){const f=new Map;for(const h of Object.keys(u)){let d=u[h];s===1&&(d=d.ds),f.set(parseInt(h,10),Gt(d))}i._index.set(c,f)}return i}static async loadJSAsync(t,r){const{index:n,documentIds:a,fieldLength:o,storedFields:l,serializationVersion:s}=t,i=this.instantiateMiniSearch(t,r);i._documentIds=await Ft(a),i._fieldLength=await Ft(o),i._storedFields=await Ft(l);for(const[u,f]of i._documentIds)i._idToShortId.set(f,u);let c=0;for(const[u,f]of n){const h=new Map;for(const d of Object.keys(f)){let y=f[d];s===1&&(y=y.ds),h.set(parseInt(d,10),await Ft(y))}++c%1e3===0&&await Us(0),i._index.set(u,h)}return i}static instantiateMiniSearch(t,r){const{documentCount:n,nextId:a,fieldIds:o,averageFieldLength:l,dirtCount:s,serializationVersion:i}=t;if(i!==1&&i!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const c=new at(r);return c._documentCount=n,c._nextId=a,c._idToShortId=new Map,c._fieldIds=o,c._avgFieldLength=l,c._dirtCount=s||0,c._index=new nt,c}executeQuery(t,r={}){if(t===at.wildcard)return this.executeWildcardQuery(r);if(typeof t!="string"){const h={...r,...t,queries:void 0},d=t.queries.map(y=>this.executeQuery(y,h));return this.combineResults(d,h.combineWith)}const{tokenize:n,processTerm:a,searchOptions:o}=this._options,l={tokenize:n,processTerm:a,...o,...r},{tokenize:s,processTerm:i}=l,f=s(t).flatMap(h=>i(h)).filter(h=>!!h).map(mh(l)).map(h=>this.executeQuerySpec(h,l));return this.combineResults(f,l.combineWith)}executeQuerySpec(t,r){const n={...this._options.searchOptions,...r},a=(n.fields||this._options.fields).reduce((b,C)=>({...b,[C]:Vr(n.boost,C)||1}),{}),{boostDocument:o,weights:l,maxFuzzy:s,bm25:i}=n,{fuzzy:c,prefix:u}={...Ho.weights,...l},f=this._index.get(t.term),h=this.termResults(t.term,t.term,1,t.termBoost,f,a,o,i);let d,y;if(t.prefix&&(d=this._index.atPrefix(t.term)),t.fuzzy){const b=t.fuzzy===!0?.2:t.fuzzy,C=b<1?Math.min(s,Math.round(t.term.length*b)):b;C&&(y=this._index.fuzzyGet(t.term,C))}if(d)for(const[b,C]of d){const j=b.length-t.term.length;if(!j)continue;y==null||y.delete(b);const _=u*b.length/(b.length+.3*j);this.termResults(t.term,b,_,t.termBoost,C,a,o,i,h)}if(y)for(const b of y.keys()){const[C,j]=y.get(b);if(!j)continue;const _=c*b.length/(b.length+j);this.termResults(t.term,b,_,t.termBoost,C,a,o,i,h)}return h}executeWildcardQuery(t){const r=new Map,n={...this._options.searchOptions,...t};for(const[a,o]of this._documentIds){const l=n.boostDocument?n.boostDocument(o,"",this._storedFields.get(a)):1;r.set(a,{score:l,terms:[],match:{}})}return r}combineResults(t,r=Fn){if(t.length===0)return new Map;const n=r.toLowerCase(),a=hh[n];if(!a)throw new Error(`Invalid combination operator: ${r}`);return t.reduce(a)||new Map}toJSON(){const t=[];for(const[r,n]of this._index){const a={};for(const[o,l]of n)a[o]=Object.fromEntries(l);t.push([r,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,r,n,a,o,l,s,i,c=new Map){if(o==null)return c;for(const u of Object.keys(l)){const f=l[u],h=this._fieldIds[u],d=o.get(h);if(d==null)continue;let y=d.size;const b=this._avgFieldLength[h];for(const C of d.keys()){if(!this._documentIds.has(C)){this.removeTerm(h,C,r),y-=1;continue}const j=s?s(this._documentIds.get(C),r,this._storedFields.get(C)):1;if(!j)continue;const _=d.get(C),A=this._fieldLength.get(C)[h],I=ph(_,y,this._documentCount,A,b,i),N=n*a*f*j*I,z=c.get(C);if(z){z.score+=N,yh(z.terms,t);const m=Vr(z.match,r);m?m.push(u):z.match[r]=[u]}else c.set(C,{score:N,terms:[t],match:{[r]:[u]}})}}return c}addTerm(t,r,n){const a=this._index.fetch(n,Uo);let o=a.get(t);if(o==null)o=new Map,o.set(r,1),a.set(t,o);else{const l=o.get(r);o.set(r,(l||0)+1)}}removeTerm(t,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,t,n);return}const a=this._index.fetch(n,Uo),o=a.get(t);o==null||o.get(r)==null?this.warnDocumentChanged(r,t,n):o.get(r)<=1?o.size<=1?a.delete(t):o.delete(r):o.set(r,o.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(t,r,n){for(const a of Object.keys(this._fieldIds))if(this._fieldIds[a]===r){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(t)} has changed before removal: term "${n}" was not present in field "${a}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(t){const r=this._nextId;return this._idToShortId.set(t,r),this._documentIds.set(r,t),this._documentCount+=1,this._nextId+=1,r}addFields(t){for(let r=0;r<t.length;r++)this._fieldIds[t[r]]=r}addFieldLength(t,r,n,a){let o=this._fieldLength.get(t);o==null&&this._fieldLength.set(t,o=[]),o[r]=a;const s=(this._avgFieldLength[r]||0)*n+a;this._avgFieldLength[r]=s/(n+1)}removeFieldLength(t,r,n,a){if(n===1){this._avgFieldLength[r]=0;return}const o=this._avgFieldLength[r]*n-a;this._avgFieldLength[r]=o/(n-1)}saveStoredFields(t,r){const{storeFields:n,extractField:a}=this._options;if(n==null||n.length===0)return;let o=this._storedFields.get(t);o==null&&this._storedFields.set(t,o={});for(const l of n){const s=a(r,l);s!==void 0&&(o[l]=s)}}}at.wildcard=Symbol("*");const Vr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,hh={[Fn]:(e,t)=>{for(const r of t.keys()){const n=e.get(r);if(n==null)e.set(r,t.get(r));else{const{score:a,terms:o,match:l}=t.get(r);n.score=n.score+a,n.match=Object.assign(n.match,l),Bo(n.terms,o)}}return e},[Vs]:(e,t)=>{const r=new Map;for(const n of t.keys()){const a=e.get(n);if(a==null)continue;const{score:o,terms:l,match:s}=t.get(n);Bo(a.terms,l),r.set(n,{score:a.score+o,terms:a.terms,match:Object.assign(a.match,s)})}return r},[fh]:(e,t)=>{for(const r of t.keys())e.delete(r);return e}},gh={k:1.2,b:.7,d:.5},ph=(e,t,r,n,a,o)=>{const{k:l,b:s,d:i}=o;return Math.log(1+(r-t+.5)/(t+.5))*(i+e*(l+1)/(e+l*(1-s+s*n/a)))},mh=e=>(t,r,n)=>{const a=typeof e.fuzzy=="function"?e.fuzzy(t,r,n):e.fuzzy||!1,o=typeof e.prefix=="function"?e.prefix(t,r,n):e.prefix===!0,l=typeof e.boostTerm=="function"?e.boostTerm(t,r,n):1;return{term:t,fuzzy:a,prefix:o,termBoost:l}},Ur={idField:"id",extractField:(e,t)=>e[t],tokenize:e=>e.split(bh),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},Ho={combineWith:Fn,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:gh},vh={combineWith:Vs,prefix:(e,t,r)=>t===r.length-1},pn={batchSize:1e3,batchWait:10},mn={minDirtFactor:.1,minDirtCount:20},qr={...pn,...mn},yh=(e,t)=>{e.includes(t)||e.push(t)},Bo=(e,t)=>{for(const r of t)e.includes(r)||e.push(r)},Vo=({score:e},{score:t})=>t-e,Uo=()=>new Map,Gt=e=>{const t=new Map;for(const r of Object.keys(e))t.set(parseInt(r,10),e[r]);return t},Ft=async e=>{const t=new Map;let r=0;for(const n of Object.keys(e))t.set(parseInt(n,10),e[n]),++r%1e3===0&&await Us(0);return t},Us=e=>new Promise(t=>setTimeout(t,e)),bh=/[\n\r\p{Z}\p{P}]+/u;function qo(){return qo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qo.apply(null,arguments)}function jt(e){"@babel/helpers - typeof";return jt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jt(e)}function wh(e,t){if(jt(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(jt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xh(e){var t=wh(e,"string");return jt(t)=="symbol"?t:t+""}function Hp(e,t,r){return(t=xh(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _h(e){if(Array.isArray(e))return vn(e)}function Sh(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Eh(e,t){if(e){if(typeof e=="string")return vn(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vn(e,t):void 0}}function kh(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bp(e){return _h(e)||Sh(e)||Eh(e)||kh()}function Ch(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Vp(e,t){if(e==null)return{};var r,n,a=Ch(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}const Th={index:new at({fields:[]})};p.createContext(Th);const yn=({label:e,color:t,hidden:r,labels:n={}})=>W.createElement("div",{className:"node"},W.createElement("span",{className:"render "+(r?"circle":"disc"),style:{backgroundColor:t||"#000"}}),W.createElement("span",{className:`label ${r?"text-muted":""} ${e?"":"text-italic"}`},e||n.no_label||"No label")),Rh=({id:e,labels:t})=>{const r=Be(),n=p.useMemo(()=>{const a=r.getGraph().getNodeAttributes(e),o=r.getSetting("nodeReducer");return Object.assign(Object.assign({color:r.getSetting("defaultNodeColor")},a),o?o(e,a):{})},[r,e]);return W.createElement(yn,Object.assign({},n,{labels:t}))},Ah=({label:e,color:t,source:r,target:n,hidden:a,directed:o,labels:l={}})=>W.createElement("div",{className:"edge"},W.createElement(yn,Object.assign({},r,{labels:l})),W.createElement("div",{className:"body"},W.createElement("div",{className:"render"},W.createElement("span",{className:a?"dotted":"dash",style:{borderColor:t||"#000"}})," ",o&&W.createElement("span",{className:"arrow",style:{borderTopColor:t||"#000"}})),W.createElement("span",{className:`label ${a?"text-muted":""} ${e?"":"fst-italic"}`},e||l.no_label||"No label")),W.createElement(yn,Object.assign({},n,{labels:l}))),jh=({id:e,labels:t})=>{const r=Be(),n=p.useMemo(()=>{const a=r.getGraph().getEdgeAttributes(e),o=r.getSetting("nodeReducer"),l=r.getSetting("edgeReducer"),s=r.getGraph().getNodeAttributes(r.getGraph().source(e)),i=r.getGraph().getNodeAttributes(r.getGraph().target(e));return Object.assign(Object.assign(Object.assign({color:r.getSetting("defaultEdgeColor"),directed:r.getGraph().isDirected(e)},a),l?l(e,a):{}),{source:Object.assign(Object.assign({color:r.getSetting("defaultNodeColor")},s),o?o(e,s):{}),target:Object.assign(Object.assign({color:r.getSetting("defaultNodeColor")},i),o?o(e,i):{})})},[r,e]);return W.createElement(Ah,Object.assign({},n,{labels:t}))};function qs(e,t){const[r,n]=p.useState(e);return p.useEffect(()=>{const a=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(a)}},[e,t]),r}function Ih({fetcher:e,preload:t,filterFn:r,renderOption:n,getOptionValue:a,notFound:o,loadingSkeleton:l,label:s,placeholder:i="Select...",value:c,onChange:u,onFocus:f,disabled:h=!1,className:d,noResultsMessage:y}){const[b,C]=p.useState(!1),[j,_]=p.useState(!1),[A,I]=p.useState([]),[N,z]=p.useState(!1),[m,E]=p.useState(null),[x,T]=p.useState(""),R=qs(x,t?0:150),O=p.useRef(null);p.useEffect(()=>{C(!0)},[]),p.useEffect(()=>{const k=S=>{O.current&&!O.current.contains(S.target)&&j&&_(!1)};return document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}},[j]);const w=p.useCallback(async k=>{try{z(!0),E(null);const S=await e(k);I(S)}catch(S){E(S instanceof Error?S.message:"Failed to fetch options")}finally{z(!1)}},[e]);p.useEffect(()=>{b&&(t?R&&I(k=>k.filter(S=>r?r(S,R):!0)):w(R))},[b,R,t,r,w]),p.useEffect(()=>{!b||!c||w(c)},[b,c,w]);const H=p.useCallback(k=>{u(k),requestAnimationFrame(()=>{const S=document.activeElement;S==null||S.blur(),_(!1)})},[u]),K=p.useCallback(()=>{_(!0),w(x)},[x,w]),D=p.useCallback(k=>{k.target.closest(".cmd-item")&&k.preventDefault()},[]);return g.jsx("div",{ref:O,className:fe(h&&"cursor-not-allowed opacity-50",d),onMouseDown:D,children:g.jsxs(ur,{shouldFilter:!1,className:"bg-transparent",children:[g.jsxs("div",{children:[g.jsx(Pn,{placeholder:i,value:x,className:"max-h-8",onFocus:K,onValueChange:k=>{T(k),j||_(!0)}}),N&&g.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:g.jsx(Ua,{className:"h-4 w-4 animate-spin"})})]}),g.jsxs(dr,{hidden:!j,children:[m&&g.jsx("div",{className:"text-destructive p-4 text-center",children:m}),N&&A.length===0&&(l||g.jsx(Nh,{})),!N&&!m&&A.length===0&&(o||g.jsx(zn,{children:y??`No ${s.toLowerCase()} found.`})),g.jsx(Et,{children:A.map((k,S)=>g.jsxs(W.Fragment,{children:[g.jsx(kt,{value:a(k),onSelect:H,onMouseMove:()=>f(a(k)),className:"truncate cmd-item",children:n(k)},a(k)+`${S}`),S!==A.length-1&&g.jsx("div",{className:"bg-foreground/10 h-[1px]"},`divider-${S}`)]},a(k)+`-fragment-${S}`))})]})]})})}function Nh(){return g.jsx(Et,{children:g.jsx(kt,{disabled:!0,children:g.jsxs("div",{className:"flex w-full items-center gap-2",children:[g.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),g.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[g.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),g.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const Wr="__message_item",Lh=({id:e})=>{const t=te.use.sigmaGraph();return t!=null&&t.hasNode(e)?g.jsx(Rh,{id:e}):null};function Ph(e){return g.jsxs("div",{children:[e.type==="nodes"&&g.jsx(Lh,{id:e.id}),e.type==="edges"&&g.jsx(jh,{id:e.id}),e.type==="message"&&g.jsx("div",{children:e.message})]})}const zh=({onChange:e,onFocus:t,value:r})=>{const{t:n}=Se(),a=te.use.sigmaGraph(),o=te.use.searchEngine();p.useEffect(()=>{a&&te.getState().resetSearchEngine()},[a]),p.useEffect(()=>{if(!a||a.nodes().length===0||o)return;const s=new at({idField:"id",fields:["label"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),i=a.nodes().map(c=>({id:c,label:a.getNodeAttribute(c,"label")}));s.addAll(i),te.getState().setSearchEngine(s)},[a,o]);const l=p.useCallback(async s=>{if(t&&t(null),!a||!o)return[];if(a.nodes().length===0)return[];if(!s)return a.nodes().filter(u=>a.hasNode(u)).slice(0,Lt).map(u=>({id:u,type:"nodes"}));let i=o.search(s).filter(c=>a.hasNode(c.id)).map(c=>({id:c.id,type:"nodes"}));if(i.length<5){const c=new Set(i.map(f=>f.id)),u=a.nodes().filter(f=>{if(c.has(f))return!1;const h=a.getNodeAttribute(f,"label");return h&&typeof h=="string"&&!h.toLowerCase().startsWith(s.toLowerCase())&&h.toLowerCase().includes(s.toLowerCase())}).map(f=>({id:f,type:"nodes"}));i=[...i,...u]}return i.length<=Lt?i:[...i.slice(0,Lt),{type:"message",id:Wr,message:n("graphPanel.search.message",{count:i.length-Lt})}]},[a,o,t,n]);return g.jsx(Ih,{className:"bg-background/60 w-24 rounded-xl border-1 opacity-60 backdrop-blur-lg transition-all hover:w-fit hover:opacity-100",fetcher:l,renderOption:Ph,getOptionValue:s=>s.id,value:r&&r.type!=="message"?r.id:null,onChange:s=>{s!==Wr&&e(s?{id:s,type:"nodes"}:null)},onFocus:s=>{s!==Wr&&t&&t(s?{id:s,type:"nodes"}:null)},label:"item",placeholder:n("graphPanel.search.placeholder")})},Dh=({...e})=>g.jsx(zh,{...e});function Oh({fetcher:e,preload:t,filterFn:r,renderOption:n,getOptionValue:a,getDisplayValue:o,notFound:l,loadingSkeleton:s,label:i,placeholder:c="Select...",value:u,onChange:f,disabled:h=!1,className:d,triggerClassName:y,searchInputClassName:b,noResultsMessage:C,triggerTooltip:j,clearable:_=!0}){const[A,I]=p.useState(!1),[N,z]=p.useState(!1),[m,E]=p.useState([]),[x,T]=p.useState(!1),[R,O]=p.useState(null),[w,H]=p.useState(u),[K,D]=p.useState(null),[k,S]=p.useState(""),B=qs(k,t?0:150),[ae,M]=p.useState([]),[v,P]=p.useState(null);p.useEffect(()=>{I(!0),H(u)},[u]),p.useEffect(()=>{u&&(!m.length||!K)?P(g.jsx("div",{children:u})):K&&P(null)},[u,m.length,K]),p.useEffect(()=>{if(u&&m.length>0){const $=m.find(Q=>a(Q)===u);$&&D($)}},[u,m,a]),p.useEffect(()=>{A||(async()=>{try{T(!0),O(null);const Q=await e(u);M(Q),E(Q)}catch(Q){O(Q instanceof Error?Q.message:"Failed to fetch options")}finally{T(!1)}})()},[A,e,u]),p.useEffect(()=>{const $=async()=>{try{T(!0),O(null);const Q=await e(B);M(Q),E(Q)}catch(Q){O(Q instanceof Error?Q.message:"Failed to fetch options")}finally{T(!1)}};A&&t?t&&E(B?ae.filter(Q=>r?r(Q,B):!0):ae):$()},[e,B,A,t,r]);const V=p.useCallback($=>{const Q=_&&$===w?"":$;H(Q),D(m.find(X=>a(X)===Q)||null),f(Q),z(!1)},[w,f,_,m,a]);return g.jsxs(Rn,{open:N,onOpenChange:z,children:[g.jsx(An,{asChild:!0,children:g.jsxs(be,{variant:"outline",role:"combobox","aria-expanded":N,className:fe("justify-between",h&&"cursor-not-allowed opacity-50",y),disabled:h,tooltip:j,side:"bottom",children:[u==="*"?g.jsx("div",{children:"*"}):K?o(K):v||c,g.jsx(Fc,{className:"opacity-50",size:10})]})}),g.jsx(lr,{className:fe("p-0",d),onCloseAutoFocus:$=>$.preventDefault(),align:"start",sideOffset:8,collisionPadding:5,children:g.jsxs(ur,{shouldFilter:!1,children:[g.jsxs("div",{className:"relative w-full border-b",children:[g.jsx(Pn,{placeholder:`Search ${i.toLowerCase()}...`,value:k,onValueChange:$=>{S($)},className:b}),x&&m.length>0&&g.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:g.jsx(Ua,{className:"h-4 w-4 animate-spin"})})]}),g.jsxs(dr,{children:[R&&g.jsx("div",{className:"text-destructive p-4 text-center",children:R}),x&&m.length===0&&(s||g.jsx(Gh,{})),!x&&!R&&m.length===0&&(l||g.jsx(zn,{children:C??`No ${i.toLowerCase()} found.`})),g.jsx(Et,{children:m.map($=>g.jsxs(kt,{value:a($),onSelect:V,className:"truncate",children:[n($),g.jsx(Va,{className:fe("ml-auto h-3 w-3",w===a($)?"opacity-100":"opacity-0")})]},a($)))})]})]})})]})}function Gh(){return g.jsx(Et,{children:g.jsx(kt,{disabled:!0,children:g.jsxs("div",{className:"flex w-full items-center gap-2",children:[g.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),g.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[g.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),g.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const Fh=()=>{const{t:e}=Se(),t=Z.use.queryLabel(),r=te.use.allDatabaseLabels(),n=te.use.labelsFetchAttempted(),a=p.useCallback(()=>{const s=new at({idField:"id",fields:["value"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),i=r.map((c,u)=>({id:u,value:c}));return s.addAll(i),{labels:r,searchEngine:s}},[r]),o=p.useCallback(async s=>{const{labels:i,searchEngine:c}=a();let u=i;if(s&&(u=c.search(s).map(f=>i[f.id]),u.length<15)){const f=new Set(u),h=i.filter(d=>f.has(d)?!1:d&&typeof d=="string"&&!d.toLowerCase().startsWith(s.toLowerCase())&&d.toLowerCase().includes(s.toLowerCase()));u=[...u,...h]}return u.length<=Yn?u:[...u.slice(0,Yn),"..."]},[a]);p.useEffect(()=>{n&&(r.length>1?t&&t!=="*"&&!r.includes(t)?(console.log(`Label "${t}" not in available labels, setting to "*"`),Z.getState().setQueryLabel("*")):console.log(`Label "${t}" is valid`):t&&r.length<=1&&t&&t!=="*"&&(console.log("Available labels list is empty, setting label to empty"),Z.getState().setQueryLabel("")),te.getState().setLabelsFetchAttempted(!1))},[r,t,n]);const l=p.useCallback(()=>{te.getState().setLabelsFetchAttempted(!1),te.getState().setGraphDataFetchAttempted(!1),te.getState().setLastSuccessfulQueryLabel("");const s=Z.getState().queryLabel;s?(Z.getState().setQueryLabel(""),setTimeout(()=>{Z.getState().setQueryLabel(s)},0)):Z.getState().setQueryLabel("*")},[]);return g.jsxs("div",{className:"flex items-center",children:[g.jsx(be,{size:"icon",variant:Ne,onClick:l,tooltip:e("graphPanel.graphLabels.refreshTooltip"),className:"mr-2",children:g.jsx(gu,{className:"h-4 w-4"})}),g.jsx(Oh,{className:"min-w-[300px]",triggerClassName:"max-h-8",searchInputClassName:"max-h-8",triggerTooltip:e("graphPanel.graphLabels.selectTooltip"),fetcher:o,renderOption:s=>g.jsx("div",{children:s}),getOptionValue:s=>s,getDisplayValue:s=>g.jsx("div",{children:s}),notFound:g.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:s=>{const i=Z.getState().queryLabel;s==="..."&&(s="*"),s===i&&s!=="*"&&(s="*"),te.getState().setGraphDataFetchAttempted(!1),Z.getState().setQueryLabel(s)},clearable:!1})]})},Ws=({text:e,className:t,tooltipClassName:r,tooltip:n,side:a,onClick:o})=>n?g.jsx(Ma,{delayDuration:200,children:g.jsxs($a,{children:[g.jsx(Ha,{asChild:!0,children:g.jsx("label",{className:fe(t,o!==void 0?"cursor-pointer":void 0),onClick:o,children:e})}),g.jsx(Tn,{side:a,className:r,children:n})]})}):g.jsx("label",{className:fe(t,o!==void 0?"cursor-pointer":void 0),onClick:o,children:e});var Mt={exports:{}},Mh=Mt.exports,Wo;function $h(){return Wo||(Wo=1,function(e){(function(t,r,n){function a(i){var c=this,u=s();c.next=function(){var f=2091639*c.s0+c.c*23283064365386963e-26;return c.s0=c.s1,c.s1=c.s2,c.s2=f-(c.c=f|0)},c.c=1,c.s0=u(" "),c.s1=u(" "),c.s2=u(" "),c.s0-=u(i),c.s0<0&&(c.s0+=1),c.s1-=u(i),c.s1<0&&(c.s1+=1),c.s2-=u(i),c.s2<0&&(c.s2+=1),u=null}function o(i,c){return c.c=i.c,c.s0=i.s0,c.s1=i.s1,c.s2=i.s2,c}function l(i,c){var u=new a(i),f=c&&c.state,h=u.next;return h.int32=function(){return u.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,f&&(typeof f=="object"&&o(f,u),h.state=function(){return o(u,{})}),h}function s(){var i=4022871197,c=function(u){u=String(u);for(var f=0;f<u.length;f++){i+=u.charCodeAt(f);var h=.02519603282416938*i;i=h>>>0,h-=i,h*=i,i=h>>>0,h-=i,i+=h*4294967296}return(i>>>0)*23283064365386963e-26};return c}r&&r.exports?r.exports=l:this.alea=l})(Mh,e)}(Mt)),Mt.exports}var $t={exports:{}},Hh=$t.exports,Xo;function Bh(){return Xo||(Xo=1,function(e){(function(t,r,n){function a(s){var i=this,c="";i.x=0,i.y=0,i.z=0,i.w=0,i.next=function(){var f=i.x^i.x<<11;return i.x=i.y,i.y=i.z,i.z=i.w,i.w^=i.w>>>19^f^f>>>8},s===(s|0)?i.x=s:c+=s;for(var u=0;u<c.length+64;u++)i.x^=c.charCodeAt(u)|0,i.next()}function o(s,i){return i.x=s.x,i.y=s.y,i.z=s.z,i.w=s.w,i}function l(s,i){var c=new a(s),u=i&&i.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,y=(h+d)/(1<<21);while(y===0);return y},f.int32=c.next,f.quick=f,u&&(typeof u=="object"&&o(u,c),f.state=function(){return o(c,{})}),f}r&&r.exports?r.exports=l:this.xor128=l})(Hh,e)}($t)),$t.exports}var Ht={exports:{}},Vh=Ht.exports,Yo;function Uh(){return Yo||(Yo=1,function(e){(function(t,r,n){function a(s){var i=this,c="";i.next=function(){var f=i.x^i.x>>>2;return i.x=i.y,i.y=i.z,i.z=i.w,i.w=i.v,(i.d=i.d+362437|0)+(i.v=i.v^i.v<<4^(f^f<<1))|0},i.x=0,i.y=0,i.z=0,i.w=0,i.v=0,s===(s|0)?i.x=s:c+=s;for(var u=0;u<c.length+64;u++)i.x^=c.charCodeAt(u)|0,u==c.length&&(i.d=i.x<<10^i.x>>>4),i.next()}function o(s,i){return i.x=s.x,i.y=s.y,i.z=s.z,i.w=s.w,i.v=s.v,i.d=s.d,i}function l(s,i){var c=new a(s),u=i&&i.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,y=(h+d)/(1<<21);while(y===0);return y},f.int32=c.next,f.quick=f,u&&(typeof u=="object"&&o(u,c),f.state=function(){return o(c,{})}),f}r&&r.exports?r.exports=l:this.xorwow=l})(Vh,e)}(Ht)),Ht.exports}var Bt={exports:{}},qh=Bt.exports,Ko;function Wh(){return Ko||(Ko=1,function(e){(function(t,r,n){function a(s){var i=this;i.next=function(){var u=i.x,f=i.i,h,d;return h=u[f],h^=h>>>7,d=h^h<<24,h=u[f+1&7],d^=h^h>>>10,h=u[f+3&7],d^=h^h>>>3,h=u[f+4&7],d^=h^h<<7,h=u[f+7&7],h=h^h<<13,d^=h^h<<9,u[f]=d,i.i=f+1&7,d};function c(u,f){var h,d=[];if(f===(f|0))d[0]=f;else for(f=""+f,h=0;h<f.length;++h)d[h&7]=d[h&7]<<15^f.charCodeAt(h)+d[h+1&7]<<13;for(;d.length<8;)d.push(0);for(h=0;h<8&&d[h]===0;++h);for(h==8?d[7]=-1:d[h],u.x=d,u.i=0,h=256;h>0;--h)u.next()}c(i,s)}function o(s,i){return i.x=s.x.slice(),i.i=s.i,i}function l(s,i){s==null&&(s=+new Date);var c=new a(s),u=i&&i.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,y=(h+d)/(1<<21);while(y===0);return y},f.int32=c.next,f.quick=f,u&&(u.x&&o(u,c),f.state=function(){return o(c,{})}),f}r&&r.exports?r.exports=l:this.xorshift7=l})(qh,e)}(Bt)),Bt.exports}var Vt={exports:{}},Xh=Vt.exports,Qo;function Yh(){return Qo||(Qo=1,function(e){(function(t,r,n){function a(s){var i=this;i.next=function(){var u=i.w,f=i.X,h=i.i,d,y;return i.w=u=u+1640531527|0,y=f[h+34&127],d=f[h=h+1&127],y^=y<<13,d^=d<<17,y^=y>>>15,d^=d>>>12,y=f[h]=y^d,i.i=h,y+(u^u>>>16)|0};function c(u,f){var h,d,y,b,C,j=[],_=128;for(f===(f|0)?(d=f,f=null):(f=f+"\0",d=0,_=Math.max(_,f.length)),y=0,b=-32;b<_;++b)f&&(d^=f.charCodeAt((b+32)%f.length)),b===0&&(C=d),d^=d<<10,d^=d>>>15,d^=d<<4,d^=d>>>13,b>=0&&(C=C+1640531527|0,h=j[b&127]^=d+C,y=h==0?y+1:0);for(y>=128&&(j[(f&&f.length||0)&127]=-1),y=127,b=4*128;b>0;--b)d=j[y+34&127],h=j[y=y+1&127],d^=d<<13,h^=h<<17,d^=d>>>15,h^=h>>>12,j[y]=d^h;u.w=C,u.X=j,u.i=y}c(i,s)}function o(s,i){return i.i=s.i,i.w=s.w,i.X=s.X.slice(),i}function l(s,i){s==null&&(s=+new Date);var c=new a(s),u=i&&i.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,y=(h+d)/(1<<21);while(y===0);return y},f.int32=c.next,f.quick=f,u&&(u.X&&o(u,c),f.state=function(){return o(c,{})}),f}r&&r.exports?r.exports=l:this.xor4096=l})(Xh,e)}(Vt)),Vt.exports}var Ut={exports:{}},Kh=Ut.exports,Jo;function Qh(){return Jo||(Jo=1,function(e){(function(t,r,n){function a(s){var i=this,c="";i.next=function(){var f=i.b,h=i.c,d=i.d,y=i.a;return f=f<<25^f>>>7^h,h=h-d|0,d=d<<24^d>>>8^y,y=y-f|0,i.b=f=f<<20^f>>>12^h,i.c=h=h-d|0,i.d=d<<16^h>>>16^y,i.a=y-f|0},i.a=0,i.b=0,i.c=-1640531527,i.d=1367130551,s===Math.floor(s)?(i.a=s/4294967296|0,i.b=s|0):c+=s;for(var u=0;u<c.length+20;u++)i.b^=c.charCodeAt(u)|0,i.next()}function o(s,i){return i.a=s.a,i.b=s.b,i.c=s.c,i.d=s.d,i}function l(s,i){var c=new a(s),u=i&&i.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,y=(h+d)/(1<<21);while(y===0);return y},f.int32=c.next,f.quick=f,u&&(typeof u=="object"&&o(u,c),f.state=function(){return o(c,{})}),f}r&&r.exports?r.exports=l:this.tychei=l})(Kh,e)}(Ut)),Ut.exports}var qt={exports:{}};const Jh={},Zh=Object.freeze(Object.defineProperty({__proto__:null,default:Jh},Symbol.toStringTag,{value:"Module"})),eg=vi(Zh);var tg=qt.exports,Zo;function rg(){return Zo||(Zo=1,function(e){(function(t,r,n){var a=256,o=6,l=52,s="random",i=n.pow(a,o),c=n.pow(2,l),u=c*2,f=a-1,h;function d(I,N,z){var m=[];N=N==!0?{entropy:!0}:N||{};var E=j(C(N.entropy?[I,A(r)]:I??_(),3),m),x=new y(m),T=function(){for(var R=x.g(o),O=i,w=0;R<c;)R=(R+w)*a,O*=a,w=x.g(1);for(;R>=u;)R/=2,O/=2,w>>>=1;return(R+w)/O};return T.int32=function(){return x.g(4)|0},T.quick=function(){return x.g(4)/4294967296},T.double=T,j(A(x.S),r),(N.pass||z||function(R,O,w,H){return H&&(H.S&&b(H,x),R.state=function(){return b(x,{})}),w?(n[s]=R,O):R})(T,E,"global"in N?N.global:this==n,N.state)}function y(I){var N,z=I.length,m=this,E=0,x=m.i=m.j=0,T=m.S=[];for(z||(I=[z++]);E<a;)T[E]=E++;for(E=0;E<a;E++)T[E]=T[x=f&x+I[E%z]+(N=T[E])],T[x]=N;(m.g=function(R){for(var O,w=0,H=m.i,K=m.j,D=m.S;R--;)O=D[H=f&H+1],w=w*a+D[f&(D[H]=D[K=f&K+O])+(D[K]=O)];return m.i=H,m.j=K,w})(a)}function b(I,N){return N.i=I.i,N.j=I.j,N.S=I.S.slice(),N}function C(I,N){var z=[],m=typeof I,E;if(N&&m=="object")for(E in I)try{z.push(C(I[E],N-1))}catch{}return z.length?z:m=="string"?I:I+"\0"}function j(I,N){for(var z=I+"",m,E=0;E<z.length;)N[f&E]=f&(m^=N[f&E]*19)+z.charCodeAt(E++);return A(N)}function _(){try{var I;return h&&(I=h.randomBytes)?I=I(a):(I=new Uint8Array(a),(t.crypto||t.msCrypto).getRandomValues(I)),A(I)}catch{var N=t.navigator,z=N&&N.plugins;return[+new Date,t,z,t.screen,A(r)]}}function A(I){return String.fromCharCode.apply(0,I)}if(j(n.random(),r),e.exports){e.exports=d;try{h=eg}catch{}}else n["seed"+s]=d})(typeof self<"u"?self:tg,[],Math)}(qt)),qt.exports}var Xr,ea;function ng(){if(ea)return Xr;ea=1;var e=$h(),t=Bh(),r=Uh(),n=Wh(),a=Yh(),o=Qh(),l=rg();return l.alea=e,l.xor128=t,l.xorwow=r,l.xorshift7=n,l.xor4096=a,l.tychei=o,Xr=l,Xr}var og=ng();const bn=He(og),ag={unknown:"unknown",未知:"unknown",other:"unknown",category:"category",类别:"category",type:"category",分类:"category",organization:"organization",组织:"organization",org:"organization",company:"organization",公司:"organization",机构:"organization",event:"event",事件:"event",activity:"event",活动:"event",person:"person",人物:"person",people:"person",human:"person",人:"person",animal:"animal",动物:"animal",creature:"animal",生物:"animal",geo:"geo",地理:"geo",geography:"geo",地域:"geo",location:"location",地点:"location",place:"location",address:"location",位置:"location",地址:"location",technology:"technology",技术:"technology",tech:"technology",科技:"technology",equipment:"equipment",设备:"equipment",device:"equipment",装备:"equipment",weapon:"weapon",武器:"weapon",arms:"weapon",军火:"weapon",object:"object",物品:"object",stuff:"object",物体:"object",group:"group",群组:"group",community:"group",社区:"group"},ta={unknown:"#f4d371",category:"#e3493b",organization:"#0f705d",event:"#00bfa0",person:"#4169E1",animal:"#84a3e1",geo:"#ff99cc",location:"#cf6d17",technology:"#b300b3",equipment:"#2F4F4F",weapon:"#4421af",object:"#00cc00",group:"#0f558a"},sg=["#5a2c6d","#0000ff","#cd071e","#00CED1","#9b3a31","#b2e061","#bd7ebe","#6ef7b3","#003366","#DEB887"],ra=e=>{const t="#5D6D7E",r=e?e.toLowerCase():"unknown",n=te.getState().typeColorMap;if(n.has(r))return n.get(r)||t;const a=ag[r];if(a){const c=ta[a],u=new Map(n);return u.set(r,c),te.setState({typeColorMap:u}),c}const o=new Set(Array.from(n.entries()).filter(([,c])=>!Object.values(ta).includes(c)).map(([,c])=>c)),s=sg.find(c=>!o.has(c))||t,i=new Map(n);return i.set(r,s),te.setState({typeColorMap:i}),s},ig=e=>{if(!e)return console.log("Graph validation failed: graph is null"),!1;if(!Array.isArray(e.nodes)||!Array.isArray(e.edges))return console.log("Graph validation failed: nodes or edges is not an array"),!1;if(e.nodes.length===0)return console.log("Graph validation failed: nodes array is empty"),!1;for(const t of e.nodes)if(!t.id||!t.labels||!t.properties)return console.log("Graph validation failed: invalid node structure"),!1;for(const t of e.edges)if(!t.id||!t.source||!t.target)return console.log("Graph validation failed: invalid edge structure"),!1;for(const t of e.edges){const r=e.getNode(t.source),n=e.getNode(t.target);if(r==null||n==null)return console.log("Graph validation failed: edge references non-existent node"),!1}return console.log("Graph validation passed"),!0},lg=async(e,t,r)=>{let n=null;if(!te.getState().lastSuccessfulQueryLabel){console.log("Last successful queryLabel is empty");try{await te.getState().fetchAllDatabaseLabels()}catch(s){console.error("Failed to fetch all database labels:",s)}}te.getState().setLabelsFetchAttempted(!0);const o=e||"*";try{console.log(`Fetching graph label: ${o}, depth: ${t}, nodes: ${r}`),n=await ka(o,t,r)}catch(s){return kn.getState().setErrorMessage(or(s),"Query Graphs Error!"),null}let l=null;if(n){const s={},i={};for(let h=0;h<n.nodes.length;h++){const d=n.nodes[h];s[d.id]=h,d.x=Math.random(),d.y=Math.random(),d.degree=0,d.size=10}for(let h=0;h<n.edges.length;h++){const d=n.edges[h];i[d.id]=h;const y=s[d.source],b=s[d.target];if(y!==void 0&&y!==void 0){const C=n.nodes[y],j=n.nodes[b];if(!C){console.error(`Source node ${d.source} is undefined`);continue}if(!j){console.error(`Target node ${d.target} is undefined`);continue}C.degree+=1,j.degree+=1}}let c=Number.MAX_SAFE_INTEGER,u=0;for(const h of n.nodes)c=Math.min(c,h.degree),u=Math.max(u,h.degree);const f=u-c;if(f>0){const h=Jr-dt;for(const d of n.nodes)d.size=Math.round(dt+h*Math.pow((d.degree-c)/f,.5))}l=new ol,l.nodes=n.nodes,l.edges=n.edges,l.nodeIdMap=s,l.edgeIdMap=i,ig(l)||(l=null,console.warn("Invalid graph data")),console.log("Graph data loaded")}return{rawGraph:l,is_truncated:n.is_truncated}},cg=e=>{var s,i;const t=Z.getState().minEdgeSize,r=Z.getState().maxEdgeSize;if(!e||!e.nodes.length)return console.log("No graph data available, skipping sigma graph creation"),null;const n=new Yr;for(const c of(e==null?void 0:e.nodes)??[]){bn(c.id+Date.now().toString(),{global:!0});const u=Math.random(),f=Math.random();n.addNode(c.id,{label:c.labels.join(", "),color:c.color,x:u,y:f,size:c.size,borderColor:Qr,borderSize:.2})}for(const c of(e==null?void 0:e.edges)??[]){const u=((s=c.properties)==null?void 0:s.weight)!==void 0?Number(c.properties.weight):1;c.dynamicId=n.addEdge(c.source,c.target,{label:((i=c.properties)==null?void 0:i.keywords)||void 0,size:u,originalWeight:u,type:"curvedNoArrow"})}let a=Number.MAX_SAFE_INTEGER,o=0;n.forEachEdge(c=>{const u=n.getEdgeAttribute(c,"originalWeight")||1;a=Math.min(a,u),o=Math.max(o,u)});const l=o-a;if(l>0){const c=r-t;n.forEachEdge(u=>{const f=n.getEdgeAttribute(u,"originalWeight")||1,h=t+c*Math.pow((f-a)/l,.5);n.setEdgeAttribute(u,"size",h)})}else n.forEachEdge(c=>{n.setEdgeAttribute(c,"size",t)});return n},ug=()=>{const{t:e}=Se(),t=Z.use.queryLabel(),r=te.use.rawGraph(),n=te.use.sigmaGraph(),a=Z.use.graphQueryMaxDepth(),o=Z.use.graphMaxNodes(),l=te.use.isFetching(),s=te.use.nodeToExpand(),i=te.use.nodeToPrune(),c=p.useRef(!1),u=p.useRef(!1),f=p.useRef(!1),h=p.useCallback(j=>(r==null?void 0:r.getNode(j))||null,[r]),d=p.useCallback((j,_=!0)=>(r==null?void 0:r.getEdge(j,_))||null,[r]),y=p.useRef(!1);p.useEffect(()=>{if(!t&&(r!==null||n!==null)){const j=te.getState();j.reset(),j.setGraphDataFetchAttempted(!1),j.setLabelsFetchAttempted(!1),c.current=!1,u.current=!1}},[t,r,n]),p.useEffect(()=>{if(!y.current&&!(!t&&f.current)&&!l&&!te.getState().graphDataFetchAttempted){y.current=!0,te.getState().setGraphDataFetchAttempted(!0);const j=te.getState();j.setIsFetching(!0),j.clearSelection(),j.sigmaGraph&&j.sigmaGraph.forEachNode(z=>{var m;(m=j.sigmaGraph)==null||m.setNodeAttribute(z,"highlighted",!1)}),console.log("Preparing graph data...");const _=t,A=a,I=o;let N;_?N=lg(_,A,I):(console.log("Query label is empty, show empty graph"),N=Promise.resolve({rawGraph:null,is_truncated:!1})),N.then(z=>{const m=te.getState(),E=z==null?void 0:z.rawGraph;if(E&&E.nodes&&E.nodes.forEach(x=>{var R;const T=(R=x.properties)==null?void 0:R.entity_type;x.color=ra(T)}),z!=null&&z.is_truncated&&rt.info(e("graphPanel.dataIsTruncated","Graph data is truncated to Max Nodes")),m.reset(),!E||!E.nodes||E.nodes.length===0){const x=new Yr;x.addNode("empty-graph-node",{label:e("graphPanel.emptyGraph"),color:"#5D6D7E",x:.5,y:.5,size:15,borderColor:Qr,borderSize:.2}),m.setSigmaGraph(x),m.setRawGraph(null),m.setGraphIsEmpty(!0);const T=kn.getState().message,R=T&&T.includes("Authentication required");!R&&_&&Z.getState().setQueryLabel(""),R?console.log("Keep queryLabel for post-login reload"):m.setLastSuccessfulQueryLabel(""),console.log(`Graph data is empty, created graph with empty graph node. Auth error: ${R}`)}else{const x=cg(E);E.buildDynamicMap(),m.setSigmaGraph(x),m.setRawGraph(E),m.setGraphIsEmpty(!1),m.setLastSuccessfulQueryLabel(_),m.setMoveToSelectedNode(!0)}c.current=!0,u.current=!0,y.current=!1,m.setIsFetching(!1),(!E||!E.nodes||E.nodes.length===0)&&!_&&(f.current=!0)}).catch(z=>{console.error("Error fetching graph data:",z);const m=te.getState();m.setIsFetching(!1),c.current=!1,y.current=!1,m.setGraphDataFetchAttempted(!1),m.setLastSuccessfulQueryLabel("")})}},[t,a,o,l,e]),p.useEffect(()=>{s&&((async _=>{var A,I,N,z,m,E;if(!(!_||!n||!r))try{const x=r.getNode(_);if(!x){console.error("Node not found:",_);return}const T=x.labels[0];if(!T){console.error("Node has no label:",_);return}const R=await ka(T,2,1e3);if(!R||!R.nodes||!R.edges){console.error("Failed to fetch extended graph");return}const O=[];for(const F of R.nodes){bn(F.id,{global:!0});const J=(A=F.properties)==null?void 0:A.entity_type,q=ra(J);O.push({id:F.id,labels:F.labels,properties:F.properties,size:10,x:Math.random(),y:Math.random(),color:q,degree:0})}const w=[];for(const F of R.edges)w.push({id:F.id,source:F.source,target:F.target,type:F.type,properties:F.properties,dynamicId:""});const H={};n.forEachNode(F=>{H[F]={x:n.getNodeAttribute(F,"x"),y:n.getNodeAttribute(F,"y")}});const K=new Set(n.nodes()),D=new Set,k=new Set,S=1;let B=0,ae=Number.MAX_SAFE_INTEGER,M=0;n.forEachNode(F=>{const J=n.degree(F);B=Math.max(B,J)}),n.forEachEdge(F=>{const J=n.getEdgeAttribute(F,"originalWeight")||1;ae=Math.min(ae,J),M=Math.max(M,J)});for(const F of O){if(K.has(F.id))continue;w.some(q=>q.source===_&&q.target===F.id||q.target===_&&q.source===F.id)&&D.add(F.id)}const v=new Map,P=new Map,V=new Set;for(const F of w){const J=K.has(F.source)||D.has(F.source),q=K.has(F.target)||D.has(F.target);J&&q?(k.add(F.id),D.has(F.source)?v.set(F.source,(v.get(F.source)||0)+1):K.has(F.source)&&P.set(F.source,(P.get(F.source)||0)+1),D.has(F.target)?v.set(F.target,(v.get(F.target)||0)+1):K.has(F.target)&&P.set(F.target,(P.get(F.target)||0)+1)):(n.hasNode(F.source)?V.add(F.source):D.has(F.source)&&(V.add(F.source),v.set(F.source,(v.get(F.source)||0)+1)),n.hasNode(F.target)?V.add(F.target):D.has(F.target)&&(V.add(F.target),v.set(F.target,(v.get(F.target)||0)+1)))}const $=(F,J,q,U)=>{const L=U-q||1,oe=Jr-dt;for(const ue of J)if(F.hasNode(ue)){let re=F.degree(ue);re+=1;const ee=Math.min(re,U+1),G=Math.round(dt+oe*Math.pow((ee-q)/L,.5));F.setNodeAttribute(ue,"size",G)}},Q=(F,J,q)=>{const U=Z.getState().minEdgeSize,L=Z.getState().maxEdgeSize,oe=q-J||1,ue=L-U;F.forEachEdge(re=>{const ee=F.getEdgeAttribute(re,"originalWeight")||1,G=U+ue*Math.pow((ee-J)/oe,.5);F.setEdgeAttribute(re,"size",G)})};if(D.size===0){$(n,V,S,B),rt.info(e("graphPanel.propertiesView.node.noNewNodes"));return}for(const[,F]of v.entries())B=Math.max(B,F);for(const[F,J]of P.entries()){const U=n.degree(F)+J;B=Math.max(B,U)}const X=B-S||1,Y=Jr-dt,se=((I=te.getState().sigmaInstance)==null?void 0:I.getCamera().ratio)||1,ne=Math.max(Math.sqrt(x.size)*4,Math.sqrt(D.size)*3)/se;bn(Date.now().toString(),{global:!0});const ie=Math.random()*2*Math.PI;console.log("nodeSize:",x.size,"nodesToAdd:",D.size),console.log("cameraRatio:",Math.round(se*100)/100,"spreadFactor:",Math.round(ne*100)/100);for(const F of D){const J=O.find(ee=>ee.id===F),q=v.get(F)||0,U=Math.min(q,B+1),L=Math.round(dt+Y*Math.pow((U-S)/X,.5)),oe=2*Math.PI*(Array.from(D).indexOf(F)/D.size),ue=((N=H[F])==null?void 0:N.x)||H[x.id].x+Math.cos(ie+oe)*ne,re=((z=H[F])==null?void 0:z.y)||H[x.id].y+Math.sin(ie+oe)*ne;n.addNode(F,{label:J.labels.join(", "),color:J.color,x:ue,y:re,size:L,borderColor:Qr,borderSize:.2}),r.getNode(F)||(J.size=L,J.x=ue,J.y=re,J.degree=q,r.nodes.push(J),r.nodeIdMap[F]=r.nodes.length-1)}for(const F of k){const J=w.find(U=>U.id===F);if(n.hasEdge(J.source,J.target))continue;const q=((m=J.properties)==null?void 0:m.weight)!==void 0?Number(J.properties.weight):1;ae=Math.min(ae,q),M=Math.max(M,q),J.dynamicId=n.addEdge(J.source,J.target,{label:((E=J.properties)==null?void 0:E.keywords)||void 0,size:q,originalWeight:q,type:"curvedNoArrow"}),r.getEdge(J.id,!1)?console.error("Edge already exists in rawGraph:",J.id):(r.edges.push(J),r.edgeIdMap[J.id]=r.edges.length-1,r.edgeDynamicIdMap[J.dynamicId]=r.edges.length-1)}if(r.buildDynamicMap(),te.getState().resetSearchEngine(),$(n,V,S,B),Q(n,ae,M),n.hasNode(_)){const F=n.degree(_),J=Math.min(F,B+1),q=Math.round(dt+Y*Math.pow((J-S)/X,.5));n.setNodeAttribute(_,"size",q),x.size=q,x.degree=F}}catch(x){console.error("Error expanding node:",x)}})(s),window.setTimeout(()=>{te.getState().triggerNodeExpand(null)},0))},[s,n,r,e]);const b=p.useCallback((j,_)=>{const A=new Set([j]);return _.forEachNode(I=>{if(I===j)return;const N=_.neighbors(I);N.length===1&&N[0]===j&&A.add(I)}),A},[]);return p.useEffect(()=>{i&&((_=>{if(!(!_||!n||!r))try{const A=te.getState();if(!n.hasNode(_)){console.error("Node not found:",_);return}const I=b(_,n);if(I.size===n.nodes().length){rt.error(e("graphPanel.propertiesView.node.deleteAllNodesError"));return}A.clearSelection();for(const N of I){n.dropNode(N);const z=r.nodeIdMap[N];if(z!==void 0){const m=r.edges.filter(E=>E.source===N||E.target===N);for(const E of m){const x=r.edgeIdMap[E.id];if(x!==void 0){r.edges.splice(x,1);for(const[T,R]of Object.entries(r.edgeIdMap))R>x&&(r.edgeIdMap[T]=R-1);delete r.edgeIdMap[E.id],delete r.edgeDynamicIdMap[E.dynamicId]}}r.nodes.splice(z,1);for(const[E,x]of Object.entries(r.nodeIdMap))x>z&&(r.nodeIdMap[E]=x-1);delete r.nodeIdMap[N]}}r.buildDynamicMap(),te.getState().resetSearchEngine(),I.size>1&&rt.info(e("graphPanel.propertiesView.node.nodesRemoved",{count:I.size}))}catch(A){console.error("Error pruning node:",A)}})(i),window.setTimeout(()=>{te.getState().triggerNodePrune(null)},0))},[i,n,r,b,e]),{lightrageGraph:p.useCallback(()=>{if(n)return n;console.log("Creating new Sigma graph instance");const j=new Yr;return te.getState().setSigmaGraph(j),j},[n]),getNode:h,getEdge:d}},dg=({name:e})=>{const{t}=Se(),r=n=>{const a=`graphPanel.propertiesView.node.propertyNames.${n}`,o=t(a);return o===a?n:o};return g.jsx("span",{className:"text-primary/60 tracking-wide whitespace-nowrap",children:r(e)})},fg=({onClick:e})=>g.jsx("div",{children:g.jsx(uu,{className:"h-3 w-3 text-gray-500 hover:text-gray-700 cursor-pointer",onClick:e})}),hg=({value:e,onClick:t,tooltip:r})=>g.jsx("div",{className:"flex items-center gap-1 overflow-hidden",children:g.jsx(Ws,{className:"hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis whitespace-nowrap",tooltipClassName:"max-w-80 -translate-x-15",text:e,tooltip:r||(typeof e=="string"?e:JSON.stringify(e,null,2)),side:"left",onClick:t})}),gg=({isOpen:e,onClose:t,onSave:r,propertyName:n,initialValue:a,isSubmitting:o=!1})=>{const{t:l}=Se(),[s,i]=p.useState(""),[c,u]=p.useState(null);p.useEffect(()=>{e&&i(a)},[e,a]);const f=y=>{const b=`graphPanel.propertiesView.node.propertyNames.${y}`,C=l(b);return C===b?y:C},h=y=>{switch(y){case"description":return{className:"max-h-[50vh] min-h-[10em] resize-y",style:{height:"70vh",minHeight:"20em",resize:"vertical"}};case"entity_id":return{rows:2,className:"",style:{}};case"keywords":return{rows:4,className:"",style:{}};default:return{rows:5,className:"",style:{}}}},d=async()=>{if(s.trim()!==""){u(null);try{await r(s),t()}catch(y){console.error("Save error:",y),u(typeof y=="object"&&y!==null&&y.message||l("common.saveFailed"))}}};return g.jsx(Ou,{open:e,onOpenChange:y=>!y&&t(),children:g.jsxs(Xa,{className:"sm:max-w-md",children:[g.jsxs(Ya,{children:[g.jsx(Qa,{children:l("graphPanel.propertiesView.editProperty",{property:f(n)})}),g.jsx(Ja,{children:l("graphPanel.propertiesView.editPropertyDescription")})]}),c&&g.jsx("div",{className:"bg-destructive/15 text-destructive px-4 py-2 rounded-md text-sm mt-2",children:c}),g.jsx("div",{className:"grid gap-4 py-4",children:(()=>{const y=h(n);return n==="description"?g.jsx("textarea",{value:s,onChange:b=>i(b.target.value),className:`border-input focus-visible:ring-ring flex w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm transition-colors focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 ${y.className}`,style:y.style,disabled:o}):g.jsx("textarea",{value:s,onChange:b=>i(b.target.value),rows:y.rows,className:`border-input focus-visible:ring-ring flex w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm transition-colors focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 ${y.className}`,disabled:o})})()}),g.jsxs(Ka,{children:[g.jsx(be,{type:"button",variant:"outline",onClick:t,disabled:o,children:l("common.cancel")}),g.jsx(be,{type:"button",onClick:d,disabled:o,children:o?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"mr-2",children:g.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[g.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),g.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),l("common.saving")]}):l("common.save")})]})]})})},pg=({name:e,value:t,onClick:r,nodeId:n,edgeId:a,entityId:o,dynamicId:l,entityType:s,sourceId:i,targetId:c,onValueChange:u,isEditable:f=!1,tooltip:h})=>{const{t:d}=Se(),[y,b]=p.useState(!1),[C,j]=p.useState(!1),[_,A]=p.useState(t);p.useEffect(()=>{A(t)},[t]);const I=()=>{f&&!y&&b(!0)},N=()=>{b(!1)},z=async m=>{if(C||m===String(_)){b(!1);return}j(!0);try{if(s==="node"&&o&&n){let E={[e]:m};if(e==="entity_id"){if(await dl(m)){rt.error(d("graphPanel.propertiesView.errors.duplicateName"));return}E={entity_name:m}}await cl(o,E,!0);try{await te.getState().updateNodeAndSelect(n,o,e,m)}catch(x){throw console.error("Error updating node in graph:",x),new Error("Failed to update node in graph")}rt.success(d("graphPanel.propertiesView.success.entityUpdated"))}else if(s==="edge"&&i&&c&&a&&l){const E={[e]:m};await ul(i,c,E);try{await te.getState().updateEdgeAndSelect(a,l,i,c,e,m)}catch(x){throw console.error(`Error updating edge ${i}->${c} in graph:`,x),new Error("Failed to update edge in graph")}rt.success(d("graphPanel.propertiesView.success.relationUpdated"))}b(!1),A(m),u==null||u(m)}catch(E){console.error("Error updating property:",E),rt.error(d("graphPanel.propertiesView.errors.updateFailed"))}finally{j(!1)}};return g.jsxs("div",{className:"flex items-center gap-1 overflow-hidden",children:[g.jsx(dg,{name:e}),g.jsx(fg,{onClick:I}),":",g.jsx(hg,{value:_,onClick:r,tooltip:h||(typeof _=="string"?_:JSON.stringify(_,null,2))}),g.jsx(gg,{isOpen:y,onClose:N,onSave:z,propertyName:e,initialValue:String(_),isSubmitting:C})]})},mg=()=>{const{getNode:e,getEdge:t}=ug(),r=te.use.selectedNode(),n=te.use.focusedNode(),a=te.use.selectedEdge(),o=te.use.focusedEdge(),l=te.use.graphDataVersion(),[s,i]=p.useState(null),[c,u]=p.useState(null);return p.useEffect(()=>{let f=null,h=null;n?(f="node",h=e(n)):r?(f="node",h=e(r)):o?(f="edge",h=t(o,!0)):a&&(f="edge",h=t(a,!0)),h?(f=="node"?i(vg(h)):i(yg(h)),u(f)):(i(null),u(null))},[n,r,o,a,l,i,u,e,t]),s?g.jsx("div",{className:"bg-background/80 max-w-xs rounded-lg border-2 p-2 text-xs backdrop-blur-lg",children:c=="node"?g.jsx(bg,{node:s}):g.jsx(wg,{edge:s})}):g.jsx(g.Fragment,{})},vg=e=>{const t=te.getState(),r=[];if(t.sigmaGraph&&t.rawGraph)try{if(!t.sigmaGraph.hasNode(e.id))return console.warn("Node not found in sigmaGraph:",e.id),{...e,relationships:[]};const n=t.sigmaGraph.edges(e.id);for(const a of n){if(!t.sigmaGraph.hasEdge(a))continue;const o=t.rawGraph.getEdge(a,!0);if(o){const s=e.id===o.source?o.target:o.source;if(!t.sigmaGraph.hasNode(s))continue;const i=t.rawGraph.getNode(s);i&&r.push({type:"Neighbour",id:s,label:i.properties.entity_id?i.properties.entity_id:i.labels.join(", ")})}}}catch(n){console.error("Error refining node properties:",n)}return{...e,relationships:r}},yg=e=>{const t=te.getState();let r,n;if(t.sigmaGraph&&t.rawGraph)try{if(!t.sigmaGraph.hasEdge(e.dynamicId))return console.warn("Edge not found in sigmaGraph:",e.id,"dynamicId:",e.dynamicId),{...e,sourceNode:void 0,targetNode:void 0};t.sigmaGraph.hasNode(e.source)&&(r=t.rawGraph.getNode(e.source)),t.sigmaGraph.hasNode(e.target)&&(n=t.rawGraph.getNode(e.target))}catch(a){console.error("Error refining edge properties:",a)}return{...e,sourceNode:r,targetNode:n}},$e=({name:e,value:t,onClick:r,tooltip:n,nodeId:a,edgeId:o,dynamicId:l,entityId:s,entityType:i,sourceId:c,targetId:u,isEditable:f=!1})=>{const{t:h}=Se(),d=y=>{const b=`graphPanel.propertiesView.node.propertyNames.${y}`,C=h(b);return C===b?y:C};return f&&(e==="description"||e==="entity_id"||e==="keywords")?g.jsx(pg,{name:e,value:t,onClick:r,nodeId:a,entityId:s,edgeId:o,dynamicId:l,entityType:i,sourceId:c,targetId:u,isEditable:!0,tooltip:n||(typeof t=="string"?t:JSON.stringify(t,null,2))}):g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-primary/60 tracking-wide whitespace-nowrap",children:d(e)}),":",g.jsx(Ws,{className:"hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis",tooltipClassName:"max-w-80 -translate-x-13",text:t,tooltip:n||(typeof t=="string"?t:JSON.stringify(t,null,2)),side:"left",onClick:r})]})},bg=({node:e})=>{const{t}=Se(),r=()=>{te.getState().triggerNodeExpand(e.id)},n=()=>{te.getState().triggerNodePrune(e.id)};return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-blue-700",children:t("graphPanel.propertiesView.node.title")}),g.jsxs("div",{className:"flex gap-3",children:[g.jsx(be,{size:"icon",variant:"ghost",className:"h-7 w-7 border border-gray-400 hover:bg-gray-200 dark:border-gray-600 dark:hover:bg-gray-700",onClick:r,tooltip:t("graphPanel.propertiesView.node.expandNode"),children:g.jsx(Yc,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"})}),g.jsx(be,{size:"icon",variant:"ghost",className:"h-7 w-7 border border-gray-400 hover:bg-gray-200 dark:border-gray-600 dark:hover:bg-gray-700",onClick:n,tooltip:t("graphPanel.propertiesView.node.pruneNode"),children:g.jsx(wu,{className:"h-4 w-4 text-gray-900 dark:text-gray-300"})})]})]}),g.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[g.jsx($e,{name:t("graphPanel.propertiesView.node.id"),value:String(e.id)}),g.jsx($e,{name:t("graphPanel.propertiesView.node.labels"),value:e.labels.join(", "),onClick:()=>{te.getState().setSelectedNode(e.id,!0)}}),g.jsx($e,{name:t("graphPanel.propertiesView.node.degree"),value:e.degree})]}),g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:t("graphPanel.propertiesView.node.properties")}),g.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(e.properties).sort().map(a=>a==="created_at"?null:g.jsx($e,{name:a,value:e.properties[a],nodeId:String(e.id),entityId:e.properties.entity_id,entityType:"node",isEditable:a==="description"||a==="entity_id"},a))}),e.relationships.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-emerald-700",children:t("graphPanel.propertiesView.node.relationships")}),g.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:e.relationships.map(({type:a,id:o,label:l})=>g.jsx($e,{name:a,value:l,onClick:()=>{te.getState().setSelectedNode(o,!0)}},o))})]})]})},wg=({edge:e})=>{const{t}=Se();return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-violet-700",children:t("graphPanel.propertiesView.edge.title")}),g.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[g.jsx($e,{name:t("graphPanel.propertiesView.edge.id"),value:e.id}),e.type&&g.jsx($e,{name:t("graphPanel.propertiesView.edge.type"),value:e.type}),g.jsx($e,{name:t("graphPanel.propertiesView.edge.source"),value:e.sourceNode?e.sourceNode.labels.join(", "):e.source,onClick:()=>{te.getState().setSelectedNode(e.source,!0)}}),g.jsx($e,{name:t("graphPanel.propertiesView.edge.target"),value:e.targetNode?e.targetNode.labels.join(", "):e.target,onClick:()=>{te.getState().setSelectedNode(e.target,!0)}})]}),g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:t("graphPanel.propertiesView.edge.properties")}),g.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(e.properties).sort().map(r=>{var n,a;return r==="created_at"?null:g.jsx($e,{name:r,value:e.properties[r],edgeId:String(e.id),dynamicId:String(e.dynamicId),entityType:"edge",sourceId:((n=e.sourceNode)==null?void 0:n.properties.entity_id)||e.source,targetId:((a=e.targetNode)==null?void 0:a.properties.entity_id)||e.target,isEditable:r==="description"||r==="keywords"},r)})})]})},xg=()=>{const{t:e}=Se(),t=Z.use.graphQueryMaxDepth(),r=Z.use.graphMaxNodes();return g.jsxs("div",{className:"absolute bottom-4 left-[calc(1rem+2.5rem)] flex items-center gap-2 text-xs text-gray-400",children:[g.jsxs("div",{children:[e("graphPanel.sideBar.settings.depth"),": ",t]}),g.jsxs("div",{children:[e("graphPanel.sideBar.settings.max"),": ",r]})]})},Xs=p.forwardRef(({className:e,...t},r)=>g.jsx("div",{ref:r,className:fe("bg-card text-card-foreground rounded-xl border shadow",e),...t}));Xs.displayName="Card";const _g=p.forwardRef(({className:e,...t},r)=>g.jsx("div",{ref:r,className:fe("flex flex-col space-y-1.5 p-6",e),...t}));_g.displayName="CardHeader";const Sg=p.forwardRef(({className:e,...t},r)=>g.jsx("div",{ref:r,className:fe("leading-none font-semibold tracking-tight",e),...t}));Sg.displayName="CardTitle";const Eg=p.forwardRef(({className:e,...t},r)=>g.jsx("div",{ref:r,className:fe("text-muted-foreground text-sm",e),...t}));Eg.displayName="CardDescription";const kg=p.forwardRef(({className:e,...t},r)=>g.jsx("div",{ref:r,className:fe("p-6 pt-0",e),...t}));kg.displayName="CardContent";const Cg=p.forwardRef(({className:e,...t},r)=>g.jsx("div",{ref:r,className:fe("flex items-center p-6 pt-0",e),...t}));Cg.displayName="CardFooter";function Tg(e,t){return p.useReducer((r,n)=>t[r][n]??r,e)}var Mn="ScrollArea",[Ys,Up]=xn(Mn),[Rg,Le]=Ys(Mn),Ks=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:o=600,...l}=e,[s,i]=p.useState(null),[c,u]=p.useState(null),[f,h]=p.useState(null),[d,y]=p.useState(null),[b,C]=p.useState(null),[j,_]=p.useState(0),[A,I]=p.useState(0),[N,z]=p.useState(!1),[m,E]=p.useState(!1),x=Ve(t,R=>i(R)),T=$i(a);return g.jsx(Rg,{scope:r,type:n,dir:T,scrollHideDelay:o,scrollArea:s,viewport:c,onViewportChange:u,content:f,onContentChange:h,scrollbarX:d,onScrollbarXChange:y,scrollbarXEnabled:N,onScrollbarXEnabledChange:z,scrollbarY:b,onScrollbarYChange:C,scrollbarYEnabled:m,onScrollbarYEnabledChange:E,onCornerWidthChange:_,onCornerHeightChange:I,children:g.jsx(xe.div,{dir:T,...l,ref:x,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":A+"px",...e.style}})})});Ks.displayName=Mn;var Qs="ScrollAreaViewport",Js=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...o}=e,l=Le(Qs,r),s=p.useRef(null),i=Ve(t,s,l.onViewportChange);return g.jsxs(g.Fragment,{children:[g.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),g.jsx(xe.div,{"data-radix-scroll-area-viewport":"",...o,ref:i,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:g.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Js.displayName=Qs;var Ue="ScrollAreaScrollbar",$n=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Le(Ue,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=a,s=e.orientation==="horizontal";return p.useEffect(()=>(s?o(!0):l(!0),()=>{s?o(!1):l(!1)}),[s,o,l]),a.type==="hover"?g.jsx(Ag,{...n,ref:t,forceMount:r}):a.type==="scroll"?g.jsx(jg,{...n,ref:t,forceMount:r}):a.type==="auto"?g.jsx(Zs,{...n,ref:t,forceMount:r}):a.type==="always"?g.jsx(Hn,{...n,ref:t}):null});$n.displayName=Ue;var Ag=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Le(Ue,e.__scopeScrollArea),[o,l]=p.useState(!1);return p.useEffect(()=>{const s=a.scrollArea;let i=0;if(s){const c=()=>{window.clearTimeout(i),l(!0)},u=()=>{i=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return s.addEventListener("pointerenter",c),s.addEventListener("pointerleave",u),()=>{window.clearTimeout(i),s.removeEventListener("pointerenter",c),s.removeEventListener("pointerleave",u)}}},[a.scrollArea,a.scrollHideDelay]),g.jsx(_t,{present:r||o,children:g.jsx(Zs,{"data-state":o?"visible":"hidden",...n,ref:t})})}),jg=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Le(Ue,e.__scopeScrollArea),o=e.orientation==="horizontal",l=gr(()=>i("SCROLL_END"),100),[s,i]=Tg("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(s==="idle"){const c=window.setTimeout(()=>i("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(c)}},[s,a.scrollHideDelay,i]),p.useEffect(()=>{const c=a.viewport,u=o?"scrollLeft":"scrollTop";if(c){let f=c[u];const h=()=>{const d=c[u];f!==d&&(i("SCROLL"),l()),f=d};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[a.viewport,o,i,l]),g.jsx(_t,{present:r||s!=="hidden",children:g.jsx(Hn,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ke(e.onPointerEnter,()=>i("POINTER_ENTER")),onPointerLeave:ke(e.onPointerLeave,()=>i("POINTER_LEAVE"))})})}),Zs=p.forwardRef((e,t)=>{const r=Le(Ue,e.__scopeScrollArea),{forceMount:n,...a}=e,[o,l]=p.useState(!1),s=e.orientation==="horizontal",i=gr(()=>{if(r.viewport){const c=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;l(s?c:u)}},10);return xt(r.viewport,i),xt(r.content,i),g.jsx(_t,{present:n||o,children:g.jsx(Hn,{"data-state":o?"visible":"hidden",...a,ref:t})})}),Hn=p.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,a=Le(Ue,e.__scopeScrollArea),o=p.useRef(null),l=p.useRef(0),[s,i]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=oi(s.viewport,s.content),u={...n,sizes:s,onSizesChange:i,hasThumb:c>0&&c<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:h=>l.current=h};function f(h,d){return Dg(h,l.current,s,d)}return r==="horizontal"?g.jsx(Ig,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollLeft,d=na(h,s,a.dir);o.current.style.transform=`translate3d(${d}px, 0, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollLeft=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollLeft=f(h,a.dir))}}):r==="vertical"?g.jsx(Ng,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollTop,d=na(h,s);o.current.style.transform=`translate3d(0, ${d}px, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollTop=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollTop=f(h))}}):null}),Ig=p.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,o=Le(Ue,e.__scopeScrollArea),[l,s]=p.useState(),i=p.useRef(null),c=Ve(t,i,o.onScrollbarXChange);return p.useEffect(()=>{i.current&&s(getComputedStyle(i.current))},[i]),g.jsx(ti,{"data-orientation":"horizontal",...a,ref:c,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":hr(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+u.deltaX;e.onWheelScroll(h),si(h,f)&&u.preventDefault()}},onResize:()=>{i.current&&o.viewport&&l&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:tr(l.paddingLeft),paddingEnd:tr(l.paddingRight)}})}})}),Ng=p.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,o=Le(Ue,e.__scopeScrollArea),[l,s]=p.useState(),i=p.useRef(null),c=Ve(t,i,o.onScrollbarYChange);return p.useEffect(()=>{i.current&&s(getComputedStyle(i.current))},[i]),g.jsx(ti,{"data-orientation":"vertical",...a,ref:c,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":hr(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(o.viewport){const h=o.viewport.scrollTop+u.deltaY;e.onWheelScroll(h),si(h,f)&&u.preventDefault()}},onResize:()=>{i.current&&o.viewport&&l&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:tr(l.paddingTop),paddingEnd:tr(l.paddingBottom)}})}})}),[Lg,ei]=Ys(Ue),ti=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:s,onThumbPositionChange:i,onDragScroll:c,onWheelScroll:u,onResize:f,...h}=e,d=Le(Ue,r),[y,b]=p.useState(null),C=Ve(t,x=>b(x)),j=p.useRef(null),_=p.useRef(""),A=d.viewport,I=n.content-n.viewport,N=ut(u),z=ut(i),m=gr(f,10);function E(x){if(j.current){const T=x.clientX-j.current.left,R=x.clientY-j.current.top;c({x:T,y:R})}}return p.useEffect(()=>{const x=T=>{const R=T.target;(y==null?void 0:y.contains(R))&&N(T,I)};return document.addEventListener("wheel",x,{passive:!1}),()=>document.removeEventListener("wheel",x,{passive:!1})},[A,y,I,N]),p.useEffect(z,[n,z]),xt(y,m),xt(d.content,m),g.jsx(Lg,{scope:r,scrollbar:y,hasThumb:a,onThumbChange:ut(o),onThumbPointerUp:ut(l),onThumbPositionChange:z,onThumbPointerDown:ut(s),children:g.jsx(xe.div,{...h,ref:C,style:{position:"absolute",...h.style},onPointerDown:ke(e.onPointerDown,x=>{x.button===0&&(x.target.setPointerCapture(x.pointerId),j.current=y.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",d.viewport&&(d.viewport.style.scrollBehavior="auto"),E(x))}),onPointerMove:ke(e.onPointerMove,E),onPointerUp:ke(e.onPointerUp,x=>{const T=x.target;T.hasPointerCapture(x.pointerId)&&T.releasePointerCapture(x.pointerId),document.body.style.webkitUserSelect=_.current,d.viewport&&(d.viewport.style.scrollBehavior=""),j.current=null})})})}),er="ScrollAreaThumb",ri=p.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=ei(er,e.__scopeScrollArea);return g.jsx(_t,{present:r||a.hasThumb,children:g.jsx(Pg,{ref:t,...n})})}),Pg=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,o=Le(er,r),l=ei(er,r),{onThumbPositionChange:s}=l,i=Ve(t,f=>l.onThumbChange(f)),c=p.useRef(void 0),u=gr(()=>{c.current&&(c.current(),c.current=void 0)},100);return p.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(u(),!c.current){const d=Og(f,s);c.current=d,s()}};return s(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,u,s]),g.jsx(xe.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ke(e.onPointerDownCapture,f=>{const d=f.target.getBoundingClientRect(),y=f.clientX-d.left,b=f.clientY-d.top;l.onThumbPointerDown({x:y,y:b})}),onPointerUp:ke(e.onPointerUp,l.onThumbPointerUp)})});ri.displayName=er;var Bn="ScrollAreaCorner",ni=p.forwardRef((e,t)=>{const r=Le(Bn,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?g.jsx(zg,{...e,ref:t}):null});ni.displayName=Bn;var zg=p.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=Le(Bn,r),[o,l]=p.useState(0),[s,i]=p.useState(0),c=!!(o&&s);return xt(a.scrollbarX,()=>{var f;const u=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(u),i(u)}),xt(a.scrollbarY,()=>{var f;const u=((f=a.scrollbarY)==null?void 0:f.offsetWidth)||0;a.onCornerWidthChange(u),l(u)}),c?g.jsx(xe.div,{...n,ref:t,style:{width:o,height:s,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function tr(e){return e?parseInt(e,10):0}function oi(e,t){const r=e/t;return isNaN(r)?0:r}function hr(e){const t=oi(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Dg(e,t,r,n="ltr"){const a=hr(r),o=a/2,l=t||o,s=a-l,i=r.scrollbar.paddingStart+l,c=r.scrollbar.size-r.scrollbar.paddingEnd-s,u=r.content-r.viewport,f=n==="ltr"?[0,u]:[u*-1,0];return ai([i,c],f)(e)}function na(e,t,r="ltr"){const n=hr(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,l=t.content-t.viewport,s=o-n,i=r==="ltr"?[0,l]:[l*-1,0],c=Bi(e,i);return ai([0,l],[0,s])(c)}function ai(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function si(e,t){return e>0&&e<t}var Og=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},l=r.left!==o.left,s=r.top!==o.top;(l||s)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function gr(e,t){const r=ut(e),n=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(n.current),[]),p.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function xt(e,t){const r=ut(t);Hi(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var ii=Ks,Gg=Js,Fg=ni;const li=p.forwardRef(({className:e,children:t,...r},n)=>g.jsxs(ii,{ref:n,className:fe("relative overflow-hidden",e),...r,children:[g.jsx(Gg,{className:"h-full w-full rounded-[inherit]",children:t}),g.jsx(ci,{}),g.jsx(Fg,{})]}));li.displayName=ii.displayName;const ci=p.forwardRef(({className:e,orientation:t="vertical",...r},n)=>g.jsx($n,{ref:n,orientation:t,className:fe("flex touch-none transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:g.jsx(ri,{className:"bg-border relative flex-1 rounded-full"})}));ci.displayName=$n.displayName;const Mg=({className:e})=>{const{t}=Se(),r=te.use.typeColorMap();return!r||r.size===0?null:g.jsxs(Xs,{className:`p-2 max-w-xs ${e}`,children:[g.jsx("h3",{className:"text-sm font-medium mb-2",children:t("graphPanel.legend")}),g.jsx(li,{className:"max-h-80",children:g.jsx("div",{className:"flex flex-col gap-1",children:Array.from(r.entries()).map(([n,a])=>g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:a}}),g.jsx("span",{className:"text-xs truncate",title:n,children:t(`graphPanel.nodeTypes.${n.toLowerCase()}`,n)})]},n))})})]})},$g=()=>{const{t:e}=Se(),t=Z.use.showLegend(),r=Z.use.setShowLegend(),n=p.useCallback(()=>{r(!t)},[t,r]);return g.jsx(be,{variant:Ne,onClick:n,tooltip:e("graphPanel.sideBar.legendControl.toggleLegend"),size:"icon",children:g.jsx(Pc,{})})},oa={allowInvalidContainer:!0,defaultNodeType:"default",defaultEdgeType:"curvedNoArrow",renderEdgeLabels:!1,edgeProgramClasses:{arrow:Ei,curvedArrow:Pd,curvedNoArrow:Ld},nodeProgramClasses:{default:md,circel:Si,point:Vu},labelGridCellSize:60,labelRenderedSizeThreshold:12,enableEdgeEvents:!0,labelColor:{color:"#000",attribute:"labelColor"},edgeLabelColor:{color:"#000",attribute:"labelColor"},edgeLabelSize:8,labelSize:12},Hg=()=>{const e=ga(),t=Be(),[r,n]=p.useState(null);return p.useEffect(()=>{e({downNode:a=>{n(a.node),t.getGraph().setNodeAttribute(a.node,"highlighted",!0)},mousemovebody:a=>{if(!r)return;const o=t.viewportToGraph(a);t.getGraph().setNodeAttribute(r,"x",o.x),t.getGraph().setNodeAttribute(r,"y",o.y),a.preventSigmaDefault(),a.original.preventDefault(),a.original.stopPropagation()},mouseup:()=>{r&&(n(null),t.getGraph().removeNodeAttribute(r,"highlighted"))},mousedown:a=>{a.original.buttons!==0&&!t.getCustomBBox()&&t.setCustomBBox(t.getBBox())}})},[e,t,r]),null},qp=()=>{const[e,t]=p.useState(oa),r=p.useRef(null),n=te.use.selectedNode(),a=te.use.focusedNode(),o=te.use.moveToSelectedNode(),l=te.use.isFetching(),s=Z.use.showPropertyPanel(),i=Z.use.showNodeSearchBar(),c=Z.use.enableNodeDrag(),u=Z.use.showLegend();p.useEffect(()=>{t(oa),console.log("Initialized sigma settings")},[]),p.useEffect(()=>()=>{const b=te.getState().sigmaInstance;if(b)try{b.kill(),te.getState().setSigmaInstance(null),console.log("Cleared sigma instance on Graphviewer unmount")}catch(C){console.error("Error cleaning up sigma instance:",C)}},[]);const f=p.useCallback(b=>{b===null?te.getState().setFocusedNode(null):b.type==="nodes"&&te.getState().setFocusedNode(b.id)},[]),h=p.useCallback(b=>{b===null?te.getState().setSelectedNode(null):b.type==="nodes"&&te.getState().setSelectedNode(b.id,!0)},[]),d=p.useMemo(()=>a??n,[a,n]),y=p.useMemo(()=>n?{type:"nodes",id:n}:null,[n]);return g.jsxs("div",{className:"relative h-full w-full overflow-hidden",children:[g.jsxs(ki,{settings:e,className:"!bg-background !size-full overflow-hidden",ref:r,children:[g.jsx(Jf,{}),c&&g.jsx(Hg,{}),g.jsx(zd,{node:d,move:o}),g.jsxs("div",{className:"absolute top-2 left-2 flex items-start gap-2",children:[g.jsx(Fh,{}),i&&g.jsx(Dh,{value:y,onFocus:f,onChange:h})]}),g.jsxs("div",{className:"bg-background/60 absolute bottom-2 left-2 flex flex-col rounded-xl border-2 backdrop-blur-lg",children:[g.jsx(Kf,{}),g.jsx(Zf,{}),g.jsx(eh,{}),g.jsx($g,{}),g.jsx(lh,{})]}),s&&g.jsx("div",{className:"absolute top-2 right-2",children:g.jsx(mg,{})}),u&&g.jsx("div",{className:"absolute bottom-10 right-2",children:g.jsx(Mg,{className:"bg-background/60 backdrop-blur-lg"})}),g.jsx(xg,{})]}),l&&g.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"mb-2 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),g.jsx("p",{children:"Loading Graph Data..."})]})})]})};export{Qf as $,bp as A,be as B,Xs as C,Ou as D,Tp as E,Ap as F,tp as G,rp as H,Yt as I,_g as J,kg as K,vp as L,jp as M,_p as N,xp as O,Sp as P,Ep as Q,gu as R,li as S,Op as T,Gp as U,Va as V,Ma as W,Iu as X,$a as Y,Ha as Z,Tn as _,Sg as a,Cp as a0,Np as a1,el as a2,op as a3,np as a4,Xg as a5,qs as a6,zp as a7,qo as a8,Hp as a9,Vp as aa,Bp as ab,oo as ac,Zg as ad,ep as ae,Rn as af,An as ag,Pp as ah,lr as ai,Xt as aj,Yg as ak,Fp as al,Jg as am,Ip as an,Lp as ao,Ea as ap,Kr as aq,Kg as ar,hp as as,qp as at,cp as au,dp as av,fp as aw,gp as ax,Eg as b,fe as c,rt as d,Rp as e,ap as f,or as g,Mp as h,Xa as i,Ya as j,Qa as k,Ja as l,sp as m,ip as n,Ds as o,Ka as p,lp as q,Dp as r,Qg as s,kp as t,Se as u,yp as v,wp as w,up as x,kn as y,Z as z};
|