698 lines
262 KiB
JavaScript
Generated
698 lines
262 KiB
JavaScript
Generated
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/utils-vendor-BysuhMZA.js","assets/react-vendor-DEwriMA6.js"])))=>i.map(i=>d[i]);
|
|
var ui=Object.defineProperty;var di=(t,e,n)=>e in t?ui(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $e=(t,e,n)=>di(t,typeof e!="symbol"?e+"":e,n);import{R as W,r as p,c as fi,g as He,d as hi,e as gi}from"./react-vendor-DEwriMA6.js";import{_ as oa,a as aa,f as Zt,N as sa,b as ia,c as la,D as yr,d as Ut,F as pi,E as ca,e as mi,g as Vr,h as vi,n as Ur,v as Be,i as ua,j as da,r as We,k as fa,y as ha,p as yi,l as bi,U as Yn,m as wi,o as xi,S as Ei}from"./graph-vendor-B-X5JegA.js";import{j as g,c as br,P as Et,a as ga,D as Si,C as _i,S as Ci,R as ki,u as Xe,b as ft,d as pa,e as Ti,A as Ri,f as Se,g as Ce,h as Ai,i as ji,O as wr,k as ma,l as xr,m as Ii,T as va,n as ya,o as ba,p as Li,q as Ni,r as wa,s as Pi,t as zi,v as Di,w as Oi,x as Gi,y as ct,z as Fi,B as $i}from"./ui-vendor-CeCm8EER.js";import{t as Mi,c as xa,a as en,b as Hi}from"./utils-vendor-BysuhMZA.js";function fe(...t){return Mi(xa(t))}function tn(t){return t instanceof Error?t.message:`${t}`}function $g(t,e){let n=0,r=null;return function(...a){const o=Date.now(),l=e-(o-n);l<=0?(r&&(clearTimeout(r),r=null),n=o,t.apply(this,a)):r||(r=setTimeout(()=>{n=Date.now(),r=null,t.apply(this,a)},l))}}const Er=t=>{const e=t;e.use={};for(const n of Object.keys(e.getState()))e.use[n]=()=>e(r=>r[n]);return e},Ea="",Mg="/webui/",Le="ghost",Bi="#B2EBF2",Vi="#000",Ui="#E2E2E2",Kn="#EEEEEE",qi="#F57F17",Wi="#969696",Xi="#F57F17",qr="#B2EBF2",It=50,Wr=100,ut=4,Qn=20,Hg=15,Xr="*",Bg={"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"]},Vg={name:"LightRAG",github:"https://github.com/HKUDS/LightRAG"},Yi="modulepreload",Ki=function(t){return"/webui/"+t},Yr={},Qi=function(e,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),i=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=Promise.allSettled(n.map(s=>{if(s=Ki(s),s in Yr)return;Yr[s]=!0;const c=s.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":Yi,c||(f.as="script"),f.crossOrigin="",f.href=s,i&&f.setAttribute("nonce",i),document.head.appendChild(f),c)return new Promise((h,d)=>{f.addEventListener("load",h),f.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${s}`)))})}))}function o(l){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l}return a.then(l=>{for(const i of l||[])i.status==="rejected"&&o(i.reason);return e().catch(o)})};function Sa(t,e){let n;try{n=t()}catch{return}return{getItem:a=>{var o;const l=s=>s===null?null:JSON.parse(s,void 0),i=(o=n.getItem(a))!=null?o:null;return i instanceof Promise?i.then(l):l(i)},setItem:(a,o)=>n.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>n.removeItem(a)}}const Jn=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return Jn(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Jn(r)(n)}}}},Ji=(t,e)=>(n,r,a)=>{let o={storage:Sa(()=>localStorage),partialize:y=>y,version:0,merge:(y,T)=>({...T,...y}),...e},l=!1;const i=new Set,s=new Set;let c=o.storage;if(!c)return t((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...y)},r,a);const u=()=>{const y=o.partialize({...r()});return c.setItem(o.name,{state:y,version:o.version})},f=a.setState;a.setState=(y,T)=>{f(y,T),u()};const h=t((...y)=>{n(...y),u()},r,a);a.getInitialState=()=>h;let d;const b=()=>{var y,T;if(!c)return;l=!1,i.forEach(_=>{var A;return _((A=r())!=null?A:h)});const N=((T=o.onRehydrateStorage)==null?void 0:T.call(o,(y=r())!=null?y:h))||void 0;return Jn(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(R=>[!0,R]):[!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[R,I]=_;if(d=o.merge(I,(A=r())!=null?A:h),n(d,!0),R)return u()}).then(()=>{N==null||N(d,void 0),d=r(),l=!0,s.forEach(_=>_(d))}).catch(_=>{N==null||N(void 0,_)})};return a.persist={setOptions:y=>{o={...o,...y},y.storage&&(c=y.storage)},clearStorage:()=>{c==null||c.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>b(),hasHydrated:()=>l,onHydrate:y=>(i.add(y),()=>{i.delete(y)}),onFinishHydration:y=>(s.add(y),()=>{s.delete(y)})},o.skipHydration||b(),d||h},Zi=Ji,el=en()(Zi(t=>({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,graphLayoutMaxIterations:15,queryLabel:Xr,enableHealthCheck:!0,apiKey:null,currentTab:"documents",showFileName:!1,retrievalHistory:[],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:[]},setTheme:e=>t({theme:e}),setLanguage:e=>{t({language:e}),Qi(async()=>{const{default:n}=await import("./utils-vendor-BysuhMZA.js").then(r=>r.d);return{default:n}},__vite__mapDeps([0,1])).then(({default:n})=>{n.language!==e&&n.changeLanguage(e)})},setGraphLayoutMaxIterations:e=>t({graphLayoutMaxIterations:e}),setQueryLabel:e=>t({queryLabel:e}),setGraphQueryMaxDepth:e=>t({graphQueryMaxDepth:e}),setGraphMaxNodes:e=>t({graphMaxNodes:e}),setMinEdgeSize:e=>t({minEdgeSize:e}),setMaxEdgeSize:e=>t({maxEdgeSize:e}),setEnableHealthCheck:e=>t({enableHealthCheck:e}),setApiKey:e=>t({apiKey:e}),setCurrentTab:e=>t({currentTab:e}),setRetrievalHistory:e=>t({retrievalHistory:e}),updateQuerySettings:e=>t(n=>({querySettings:{...n.querySettings,...e}})),setShowFileName:e=>t({showFileName:e}),setShowLegend:e=>t({showLegend:e})}),{name:"settings-storage",storage:Sa(()=>localStorage),version:11,migrate:(t,e)=>(e<2&&(t.showEdgeLabel=!1),e<3&&(t.queryLabel=Xr),e<4&&(t.showPropertyPanel=!0,t.showNodeSearchBar=!0,t.showNodeLabel=!0,t.enableHealthCheck=!0,t.apiKey=null),e<5&&(t.currentTab="documents"),e<6&&(t.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:[]},t.retrievalHistory=[]),e<7&&(t.graphQueryMaxDepth=3,t.graphLayoutMaxIterations=15),e<8&&(t.graphMinDegree=0,t.language="en"),e<9&&(t.showFileName=!1),e<10&&(delete t.graphMinDegree,t.graphMaxNodes=1e3),e<11&&(t.minEdgeSize=1,t.maxEdgeSize=1),t)})),ne=Er(el);class tl{constructor(){$e(this,"nodes",[]);$e(this,"edges",[]);$e(this,"nodeIdMap",{});$e(this,"edgeIdMap",{});$e(this,"edgeDynamicIdMap",{});$e(this,"getNode",e=>{const n=this.nodeIdMap[e];if(n!==void 0)return this.nodes[n]});$e(this,"getEdge",(e,n=!0)=>{const r=n?this.edgeDynamicIdMap[e]:this.edgeIdMap[e];if(r!==void 0)return this.edges[r]});$e(this,"buildDynamicMap",()=>{this.edgeDynamicIdMap={};for(let e=0;e<this.edges.length;e++){const n=this.edges[e];this.edgeDynamicIdMap[n.dynamicId]=e}})}}const nl=en()((t,e)=>({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:n=>t({graphIsEmpty:n}),setLastSuccessfulQueryLabel:n=>t({lastSuccessfulQueryLabel:n}),setIsFetching:n=>t({isFetching:n}),setSelectedNode:(n,r)=>t({selectedNode:n,moveToSelectedNode:r}),setFocusedNode:n=>t({focusedNode:n}),setSelectedEdge:n=>t({selectedEdge:n}),setFocusedEdge:n=>t({focusedEdge:n}),clearSelection:()=>t({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null}),reset:()=>{t({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,rawGraph:null,sigmaGraph:null,searchEngine:null,moveToSelectedNode:!1,graphIsEmpty:!1})},setRawGraph:n=>t({rawGraph:n}),setSigmaGraph:n=>{t({sigmaGraph:n})},setAllDatabaseLabels:n=>t({allDatabaseLabels:n}),fetchAllDatabaseLabels:async()=>{try{console.log("Fetching all database labels...");const n=await al();t({allDatabaseLabels:["*",...n]});return}catch(n){throw console.error("Failed to fetch all database labels:",n),t({allDatabaseLabels:["*"]}),n}},setMoveToSelectedNode:n=>t({moveToSelectedNode:n}),setSigmaInstance:n=>t({sigmaInstance:n}),setTypeColorMap:n=>t({typeColorMap:n}),setSearchEngine:n=>t({searchEngine:n}),resetSearchEngine:()=>t({searchEngine:null}),setGraphDataFetchAttempted:n=>t({graphDataFetchAttempted:n}),setLabelsFetchAttempted:n=>t({labelsFetchAttempted:n}),nodeToExpand:null,nodeToPrune:null,triggerNodeExpand:n=>t({nodeToExpand:n}),triggerNodePrune:n=>t({nodeToPrune:n}),graphDataVersion:0,incrementGraphDataVersion:()=>t(n=>({graphDataVersion:n.graphDataVersion+1})),updateNodeAndSelect:async(n,r,a,o)=>{const l=e(),{sigmaGraph:i,rawGraph:s}=l;if(!(!i||!s||!i.hasNode(n)))try{const c=i.getNodeAttributes(n);if(console.log("updateNodeAndSelect",n,r,a,o),n===r&&a==="entity_id"){i.addNode(o,{...c,label:o});const u=[];i.forEachEdge(n,(h,d,b,y)=>{const T=b===n?y:b,N=b===n,_=h,A=s.edgeDynamicIdMap[_],R=i.addEdge(N?o:T,N?T:o,d);A!==void 0&&u.push({originalDynamicId:_,newEdgeId:R,edgeIndex:A}),i.dropEdge(h)}),i.dropNode(n);const f=s.nodeIdMap[n];f!==void 0&&(s.nodes[f].id=o,s.nodes[f].labels=[o],s.nodes[f].properties.entity_id=o,delete s.nodeIdMap[n],s.nodeIdMap[o]=f),u.forEach(({originalDynamicId:h,newEdgeId:d,edgeIndex:b})=>{s.edges[b]&&(s.edges[b].source===n&&(s.edges[b].source=o),s.edges[b].target===n&&(s.edges[b].target=o),s.edges[b].dynamicId=d,delete s.edgeDynamicIdMap[h],s.edgeDynamicIdMap[d]=b)}),t({selectedNode:o,moveToSelectedNode:!0})}else{const u=s.nodeIdMap[String(n)];u!==void 0&&(s.nodes[u].properties[a]=o,a==="entity_id"&&(s.nodes[u].labels=[o],i.setNodeAttribute(String(n),"label",o))),t(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(n,r,a,o,l,i)=>{const s=e(),{sigmaGraph:c,rawGraph:u}=s;if(!(!c||!u))try{const f=u.edgeIdMap[String(n)];f!==void 0&&u.edges[f]&&(u.edges[f].properties[l]=i,r!==void 0&&l==="keywords"&&c.setEdgeAttribute(r,"label",i)),t(h=>({graphDataVersion:h.graphDataVersion+1})),t({selectedEdge:r})}catch(f){throw console.error(`Error updating edge ${a}->${o} in graph:`,f),new Error("Failed to update edge in graph")}}})),ee=Er(nl);class rl{constructor(){$e(this,"navigate",null)}setNavigate(e){this.navigate=e}resetAllApplicationState(){console.log("Resetting all application state...");const e=ee.getState(),n=e.sigmaInstance;e.reset(),e.setGraphDataFetchAttempted(!1),e.setLabelsFetchAttempted(!1),e.setSigmaInstance(null),e.setIsFetching(!1),Sr.getState().clear(),ne.getState().setRetrievalHistory([]),sessionStorage.clear(),n&&(n.getGraph().clear(),n.kill(),ee.getState().setSigmaInstance(null))}handleDirectLoginAccess(){const e=!document.referrer;return e&&this.resetAllApplicationState(),e}navigateToLogin(){if(!this.navigate){console.error("Navigation function not set");return}this.resetAllApplicationState(),Zn.getState().logout(),this.navigate("/login")}navigateToHome(){if(!this.navigate){console.error("Navigation function not set");return}this.navigate("/")}}const ol=new rl,Ug="Invalid API Key",qg="API Key required",_e=Hi.create({baseURL:Ea,headers:{"Content-Type":"application/json"}});_e.interceptors.request.use(t=>{const e=ne.getState().apiKey,n=localStorage.getItem("LIGHTRAG-API-TOKEN");return n&&(t.headers.Authorization=`Bearer ${n}`),e&&(t.headers["X-API-Key"]=e),t});_e.interceptors.response.use(t=>t,t=>{var e,n,r,a;if(t.response){if(((e=t.response)==null?void 0:e.status)===401){if((r=(n=t.config)==null?void 0:n.url)!=null&&r.includes("/login"))throw t;return ol.navigateToLogin(),Promise.reject(new Error("Authentication required"))}throw new Error(`${t.response.status} ${t.response.statusText}
|
|
${JSON.stringify(t.response.data)}
|
|
${(a=t.config)==null?void 0:a.url}`)}throw t});const _a=async(t,e,n)=>(await _e.get(`/graphs?label=${encodeURIComponent(t)}&max_depth=${e}&max_nodes=${n}`)).data,al=async()=>(await _e.get("/graph/label/list")).data,sl=async()=>{try{return(await _e.get("/health")).data}catch(t){return{status:"error",message:tn(t)}}},Wg=async()=>(await _e.get("/documents")).data,Xg=async()=>(await _e.post("/documents/scan")).data,Yg=async t=>(await _e.post("/query",t)).data,Kg=async(t,e,n)=>{const r=ne.getState().apiKey,a=localStorage.getItem("LIGHTRAG-API-TOKEN"),o={"Content-Type":"application/json",Accept:"application/x-ndjson"};a&&(o.Authorization=`Bearer ${a}`),r&&(o["X-API-Key"]=r);try{const l=await fetch(`${Ea}/query/stream`,{method:"POST",headers:o,body:JSON.stringify(t)});if(!l.ok){let u="Unknown error";try{u=await l.text()}catch{}throw new Error(`HTTP error ${l.status}: ${l.statusText}
|
|
${u}`)}if(!l.body)throw new Error("Response body is null");const i=l.body.getReader(),s=new TextDecoder;let c="";for(;;){const{done:u,value:f}=await i.read();if(u)break;c+=s.decode(f,{stream:!0});const h=c.split(`
|
|
`);c=h.pop()||"";for(const d of h)if(d.trim())try{const b=JSON.parse(d);b.response?e(b.response):b.error&&n&&n(b.error)}catch(b){console.error("Error parsing stream chunk:",d,b),n&&n(`Error parsing server response: ${d}`)}}if(c.trim())try{const u=JSON.parse(c);u.response?e(u.response):u.error&&n&&n(u.error)}catch(u){console.error("Error parsing final chunk:",c,u),n&&n(`Error parsing final server response: ${c}`)}}catch(l){const i=tn(l);console.error("Stream request failed:",i),n?n(i):console.error("Unhandled stream error:",i)}},Qg=async(t,e)=>{const n=new FormData;return n.append("file",t),(await _e.post("/documents/upload",n,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e!==void 0?a=>{const o=Math.round(a.loaded*100/a.total);e(o)}:void 0})).data},Jg=async()=>(await _e.delete("/documents")).data,Zg=async t=>(await _e.post("/documents/clear_cache",{modes:t})).data,ep=async()=>{try{const t=await _e.get("/auth-status",{timeout:5e3,headers:{Accept:"application/json"}});if((t.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(t.data&&typeof t.data=="object"&&"auth_configured"in t.data&&typeof t.data.auth_configured=="boolean"){if(t.data.auth_configured)return t.data;if(t.data.access_token&&typeof t.data.access_token=="string")return t.data;console.warn("Auth not configured but no valid access token provided")}return console.warn("Received invalid auth status response:",t.data),{auth_configured:!0,auth_mode:"enabled"}}catch(t){return console.error("Failed to get auth status:",tn(t)),{auth_configured:!0,auth_mode:"enabled"}}},tp=async()=>(await _e.get("/documents/pipeline_status")).data,np=async(t,e)=>{const n=new FormData;return n.append("username",t),n.append("password",e),(await _e.post("/login",n,{headers:{"Content-Type":"multipart/form-data"}})).data},il=async(t,e,n=!1)=>(await _e.post("/graph/entity/edit",{entity_name:t,updated_data:e,allow_rename:n})).data,ll=async(t,e,n)=>(await _e.post("/graph/relation/edit",{source_id:t,target_id:e,updated_data:n})).data,cl=async t=>{try{return(await _e.get(`/graph/entity/exists?name=${encodeURIComponent(t)}`)).data.exists}catch(e){return console.error("Error checking entity name:",e),!1}},ul=en()(t=>({health:!0,message:null,messageTitle:null,lastCheckTime:Date.now(),status:null,pipelineBusy:!1,check:async()=>{const e=await sl();return e.status==="healthy"?((e.core_version||e.api_version)&&Zn.getState().setVersion(e.core_version||null,e.api_version||null),("webui_title"in e||"webui_description"in e)&&Zn.getState().setCustomTitle("webui_title"in e?e.webui_title??null:null,"webui_description"in e?e.webui_description??null:null),t({health:!0,message:null,messageTitle:null,lastCheckTime:Date.now(),status:e,pipelineBusy:e.pipeline_busy}),!0):(t({health:!1,message:e.message,messageTitle:"Backend Health Check Error!",lastCheckTime:Date.now(),status:null}),!1)},clear:()=>{t({health:!0,message:null,messageTitle:null})},setErrorMessage:(e,n)=>{t({health:!1,message:e,messageTitle:n})},setPipelineBusy:e=>{t({pipelineBusy:e})}})),Sr=Er(ul),Ca=t=>{try{const e=t.split(".");return e.length!==3?{}:JSON.parse(atob(e[1]))}catch(e){return console.error("Error parsing token payload:",e),{}}},ka=t=>Ca(t).sub||null,dl=t=>Ca(t).role==="guest",fl=()=>{const t=localStorage.getItem("LIGHTRAG-API-TOKEN"),e=localStorage.getItem("LIGHTRAG-CORE-VERSION"),n=localStorage.getItem("LIGHTRAG-API-VERSION"),r=localStorage.getItem("LIGHTRAG-WEBUI-TITLE"),a=localStorage.getItem("LIGHTRAG-WEBUI-DESCRIPTION"),o=t?ka(t):null;return t?{isAuthenticated:!0,isGuestMode:dl(t),coreVersion:e,apiVersion:n,username:o,webuiTitle:r,webuiDescription:a}:{isAuthenticated:!1,isGuestMode:!1,coreVersion:e,apiVersion:n,username:null,webuiTitle:r,webuiDescription:a}},Zn=en(t=>{const e=fl();return{isAuthenticated:e.isAuthenticated,isGuestMode:e.isGuestMode,coreVersion:e.coreVersion,apiVersion:e.apiVersion,username:e.username,webuiTitle:e.webuiTitle,webuiDescription:e.webuiDescription,login:(n,r=!1,a=null,o=null,l=null,i=null)=>{localStorage.setItem("LIGHTRAG-API-TOKEN",n),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"),i?localStorage.setItem("LIGHTRAG-WEBUI-DESCRIPTION",i):localStorage.removeItem("LIGHTRAG-WEBUI-DESCRIPTION");const s=ka(n);t({isAuthenticated:!0,isGuestMode:r,username:s,coreVersion:a,apiVersion:o,webuiTitle:l,webuiDescription:i})},logout:()=>{localStorage.removeItem("LIGHTRAG-API-TOKEN");const n=localStorage.getItem("LIGHTRAG-CORE-VERSION"),r=localStorage.getItem("LIGHTRAG-API-VERSION"),a=localStorage.getItem("LIGHTRAG-WEBUI-TITLE"),o=localStorage.getItem("LIGHTRAG-WEBUI-DESCRIPTION");t({isAuthenticated:!1,isGuestMode:!1,username:null,coreVersion:n,apiVersion:r,webuiTitle:a,webuiDescription:o})},setVersion:(n,r)=>{n&&localStorage.setItem("LIGHTRAG-CORE-VERSION",n),r&&localStorage.setItem("LIGHTRAG-API-VERSION",r),t({coreVersion:n,apiVersion:r})},setCustomTitle:(n,r)=>{n?localStorage.setItem("LIGHTRAG-WEBUI-TITLE",n):localStorage.removeItem("LIGHTRAG-WEBUI-TITLE"),r?localStorage.setItem("LIGHTRAG-WEBUI-DESCRIPTION",r):localStorage.removeItem("LIGHTRAG-WEBUI-DESCRIPTION"),t({webuiTitle:n,webuiDescription:r})}}});var hl=t=>{switch(t){case"success":return ml;case"info":return yl;case"warning":return vl;case"error":return bl;default:return null}},gl=Array(12).fill(0),pl=({visible:t,className:e})=>W.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},W.createElement("div",{className:"sonner-spinner"},gl.map((n,r)=>W.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),ml=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"})),vl=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"})),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:"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"})),bl=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"})),wl=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"})),xl=()=>{let[t,e]=W.useState(document.hidden);return W.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},er=1,El=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,a=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:er++,o=this.toasts.find(i=>i.id===a),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(i=>i.id===a?(this.publish({...i,...t,id:a,title:n}),{...i,...t,id:a,dismissible:l,title:n}):i):this.addToast({title:n,...r,dismissible:l,id:a}),a},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),a=n!==void 0,o,l=r.then(async s=>{if(o=["resolve",s],W.isValidElement(s))a=!1,this.create({id:n,type:"default",message:s});else if(_l(s)&&!s.ok){a=!1;let c=typeof e.error=="function"?await e.error(`HTTP error! status: ${s.status}`):e.error,u=typeof e.description=="function"?await e.description(`HTTP error! status: ${s.status}`):e.description;this.create({id:n,type:"error",message:c,description:u})}else if(e.success!==void 0){a=!1;let c=typeof e.success=="function"?await e.success(s):e.success,u=typeof e.description=="function"?await e.description(s):e.description;this.create({id:n,type:"success",message:c,description:u})}}).catch(async s=>{if(o=["reject",s],e.error!==void 0){a=!1;let c=typeof e.error=="function"?await e.error(s):e.error,u=typeof e.description=="function"?await e.description(s):e.description;this.create({id:n,type:"error",message:c,description:u})}}).finally(()=>{var s;a&&(this.dismiss(n),n=void 0),(s=e.finally)==null||s.call(e)}),i=()=>new Promise((s,c)=>l.then(()=>o[0]==="reject"?c(o[1]):s(o[1])).catch(c));return typeof n!="string"&&typeof n!="number"?{unwrap:i}:Object.assign(n,{unwrap:i})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||er++;return this.create({jsx:t(n),id:n,...e}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ae=new El,Sl=(t,e)=>{let n=(e==null?void 0:e.id)||er++;return Ae.addToast({title:t,...e,id:n}),n},_l=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Cl=Sl,kl=()=>Ae.toasts,Tl=()=>Ae.getActiveToasts(),nt=Object.assign(Cl,{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:kl,getToasts:Tl});function Rl(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}Rl(`: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 Lt(t){return t.label!==void 0}var Al=3,jl="32px",Il="16px",Kr=4e3,Ll=356,Nl=14,Pl=20,zl=200;function Fe(...t){return t.filter(Boolean).join(" ")}function Dl(t){let[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}var Ol=t=>{var e,n,r,a,o,l,i,s,c,u,f;let{invert:h,toast:d,unstyled:b,interacting:y,setHeights:T,visibleToasts:N,heights:_,index:A,toasts:R,expanded:I,removeToast:D,defaultRichColors:m,closeButton:S,style:x,cancelButtonStyle:k,actionButtonStyle:L,className:j="",descriptionClassName:w="",duration:V,position:K,gap:O,loadingIcon:C,expandByDefault:E,classNames:H,icons:ae,closeButtonAriaLabel:$="Close toast",pauseWhenPageIsHidden:v}=t,[z,B]=W.useState(null),[M,J]=W.useState(null),[X,Y]=W.useState(!1),[ie,re]=W.useState(!1),[se,F]=W.useState(!1),[Q,q]=W.useState(!1),[U,P]=W.useState(!1),[oe,ue]=W.useState(0),[te,Z]=W.useState(0),G=W.useRef(d.duration||V||Kr),ge=W.useRef(null),pe=W.useRef(null),ye=A===0,we=A+1<=N,de=d.type,me=d.dismissible!==!1,Ie=d.className||"",ke=d.descriptionClassName||"",Te=W.useMemo(()=>_.findIndex(le=>le.toastId===d.id)||0,[_,d.id]),Pe=W.useMemo(()=>{var le;return(le=d.closeButton)!=null?le:S},[d.closeButton,S]),Ye=W.useMemo(()=>d.duration||V||Kr,[d.duration,V]),Ke=W.useRef(0),Re=W.useRef(0),st=W.useRef(0),ze=W.useRef(null),[si,ii]=K.split("-"),Hr=W.useMemo(()=>_.reduce((le,he,ve)=>ve>=Te?le:le+he.height,0),[_,Te]),Br=xl(),li=d.invert||h,hn=de==="loading";Re.current=W.useMemo(()=>Te*O+Hr,[Te,Hr]),W.useEffect(()=>{G.current=Ye},[Ye]),W.useEffect(()=>{Y(!0)},[]),W.useEffect(()=>{let le=pe.current;if(le){let he=le.getBoundingClientRect().height;return Z(he),T(ve=>[{toastId:d.id,height:he,position:d.position},...ve]),()=>T(ve=>ve.filter(De=>De.toastId!==d.id))}},[T,d.id]),W.useLayoutEffect(()=>{if(!X)return;let le=pe.current,he=le.style.height;le.style.height="auto";let ve=le.getBoundingClientRect().height;le.style.height=he,Z(ve),T(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,T,d.id]);let Qe=W.useCallback(()=>{re(!0),ue(Re.current),T(le=>le.filter(he=>he.toastId!==d.id)),setTimeout(()=>{D(d)},zl)},[d,D,T,Re]);W.useEffect(()=>{if(d.promise&&de==="loading"||d.duration===1/0||d.type==="loading")return;let le;return I||y||v&&Br?(()=>{if(st.current<Ke.current){let he=new Date().getTime()-Ke.current;G.current=G.current-he}st.current=new Date().getTime()})():G.current!==1/0&&(Ke.current=new Date().getTime(),le=setTimeout(()=>{var he;(he=d.onAutoClose)==null||he.call(d,d),Qe()},G.current)),()=>clearTimeout(le)},[I,y,d,de,v,Br,Qe]),W.useEffect(()=>{d.delete&&Qe()},[Qe,d.delete]);function ci(){var le,he,ve;return ae!=null&&ae.loading?W.createElement("div",{className:Fe(H==null?void 0:H.loader,(le=d==null?void 0:d.classNames)==null?void 0:le.loader,"sonner-loader"),"data-visible":de==="loading"},ae.loading):C?W.createElement("div",{className:Fe(H==null?void 0:H.loader,(he=d==null?void 0:d.classNames)==null?void 0:he.loader,"sonner-loader"),"data-visible":de==="loading"},C):W.createElement(pl,{className:Fe(H==null?void 0:H.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(j,Ie,H==null?void 0:H.toast,(e=d==null?void 0:d.classNames)==null?void 0:e.toast,H==null?void 0:H.default,H==null?void 0:H[de],(n=d==null?void 0:d.classNames)==null?void 0:n[de]),"data-sonner-toast":"","data-rich-colors":(r=d.richColors)!=null?r:m,"data-styled":!(d.jsx||d.unstyled||b),"data-mounted":X,"data-promise":!!d.promise,"data-swiped":U,"data-removed":ie,"data-visible":we,"data-y-position":si,"data-x-position":ii,"data-index":A,"data-front":ye,"data-swiping":se,"data-dismissible":me,"data-type":de,"data-invert":li,"data-swipe-out":Q,"data-swipe-direction":M,"data-expanded":!!(I||E&&X),style:{"--index":A,"--toasts-before":A,"--z-index":R.length-A,"--offset":`${ie?oe:Re.current}px`,"--initial-height":E?"auto":`${te}px`,...x,...d.style},onDragEnd:()=>{F(!1),B(null),ze.current=null},onPointerDown:le=>{hn||!me||(ge.current=new Date,ue(Re.current),le.target.setPointerCapture(le.pointerId),le.target.tagName!=="BUTTON"&&(F(!0),ze.current={x:le.clientX,y:le.clientY}))},onPointerUp:()=>{var le,he,ve,De;if(Q||!me)return;ze.current=null;let Oe=Number(((le=pe.current)==null?void 0:le.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),it=new Date().getTime()-((ve=ge.current)==null?void 0:ve.getTime()),Ge=z==="x"?Oe:Je,Ze=Math.abs(Ge)/it;if(Math.abs(Ge)>=Pl||Ze>.11){ue(Re.current),(De=d.onDismiss)==null||De.call(d,d),J(z==="x"?Oe>0?"right":"left":Je>0?"down":"up"),Qe(),q(!0),P(!1);return}F(!1),B(null)},onPointerMove:le=>{var he,ve,De,Oe;if(!ze.current||!me||((he=window.getSelection())==null?void 0:he.toString().length)>0)return;let Je=le.clientY-ze.current.y,it=le.clientX-ze.current.x,Ge=(ve=t.swipeDirections)!=null?ve:Dl(K);!z&&(Math.abs(it)>1||Math.abs(Je)>1)&&B(Math.abs(it)>Math.abs(Je)?"x":"y");let Ze={x:0,y:0};z==="y"?(Ge.includes("top")||Ge.includes("bottom"))&&(Ge.includes("top")&&Je<0||Ge.includes("bottom")&&Je>0)&&(Ze.y=Je):z==="x"&&(Ge.includes("left")||Ge.includes("right"))&&(Ge.includes("left")&&it<0||Ge.includes("right")&&it>0)&&(Ze.x=it),(Math.abs(Ze.x)>0||Math.abs(Ze.y)>0)&&P(!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":$,"data-disabled":hn,"data-close-button":!0,onClick:hn||!me?()=>{}:()=>{var le;Qe(),(le=d.onDismiss)==null||le.call(d,d)},className:Fe(H==null?void 0:H.closeButton,(a=d==null?void 0:d.classNames)==null?void 0:a.closeButton)},(o=ae==null?void 0:ae.close)!=null?o:wl):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(H==null?void 0:H.icon,(l=d==null?void 0:d.classNames)==null?void 0:l.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||ci():null,d.type!=="loading"?d.icon||(ae==null?void 0:ae[de])||hl(de):null):null,W.createElement("div",{"data-content":"",className:Fe(H==null?void 0:H.content,(i=d==null?void 0:d.classNames)==null?void 0:i.content)},W.createElement("div",{"data-title":"",className:Fe(H==null?void 0:H.title,(s=d==null?void 0:d.classNames)==null?void 0:s.title)},typeof d.title=="function"?d.title():d.title),d.description?W.createElement("div",{"data-description":"",className:Fe(w,ke,H==null?void 0:H.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&&Lt(d.cancel)?W.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||k,onClick:le=>{var he,ve;Lt(d.cancel)&&me&&((ve=(he=d.cancel).onClick)==null||ve.call(he,le),Qe())},className:Fe(H==null?void 0:H.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&&Lt(d.action)?W.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||L,onClick:le=>{var he,ve;Lt(d.action)&&((ve=(he=d.action).onClick)==null||ve.call(he,le),!le.defaultPrevented&&Qe())},className:Fe(H==null?void 0:H.actionButton,(f=d==null?void 0:d.classNames)==null?void 0:f.actionButton)},d.action.label):null))};function Qr(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Gl(t,e){let n={};return[t,e].forEach((r,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?Il:jl;function s(c){["top","right","bottom","left"].forEach(u=>{n[`${l}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?s(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${l}-${c}`]=i:n[`${l}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):s(i)}),n}var rp=p.forwardRef(function(t,e){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:i,offset:s,mobileOffset:c,theme:u="light",richColors:f,duration:h,style:d,visibleToasts:b=Al,toastOptions:y,dir:T=Qr(),gap:N=Nl,loadingIcon:_,icons:A,containerAriaLabel:R="Notifications",pauseWhenPageIsHidden:I}=t,[D,m]=W.useState([]),S=W.useMemo(()=>Array.from(new Set([r].concat(D.filter(v=>v.position).map(v=>v.position)))),[D,r]),[x,k]=W.useState([]),[L,j]=W.useState(!1),[w,V]=W.useState(!1),[K,O]=W.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),C=W.useRef(null),E=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=W.useRef(null),ae=W.useRef(!1),$=W.useCallback(v=>{m(z=>{var B;return(B=z.find(M=>M.id===v.id))!=null&&B.delete||Ae.dismiss(v.id),z.filter(({id:M})=>M!==v.id)})},[]);return W.useEffect(()=>Ae.subscribe(v=>{if(v.dismiss){m(z=>z.map(B=>B.id===v.id?{...B,delete:!0}:B));return}setTimeout(()=>{fi.flushSync(()=>{m(z=>{let B=z.findIndex(M=>M.id===v.id);return B!==-1?[...z.slice(0,B),{...z[B],...v},...z.slice(B+1)]:[v,...z]})})})}),[]),W.useEffect(()=>{if(u!=="system"){O(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?O("dark"):O("light")),typeof window>"u")return;let v=window.matchMedia("(prefers-color-scheme: dark)");try{v.addEventListener("change",({matches:z})=>{O(z?"dark":"light")})}catch{v.addListener(({matches:B})=>{try{O(B?"dark":"light")}catch(M){console.error(M)}})}},[u]),W.useEffect(()=>{D.length<=1&&j(!1)},[D]),W.useEffect(()=>{let v=z=>{var B,M;a.every(J=>z[J]||z.code===J)&&(j(!0),(B=C.current)==null||B.focus()),z.code==="Escape"&&(document.activeElement===C.current||(M=C.current)!=null&&M.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[a]),W.useEffect(()=>{if(C.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,ae.current=!1)}},[C.current]),W.createElement("section",{ref:e,"aria-label":`${R} ${E}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},S.map((v,z)=>{var B;let[M,J]=v.split("-");return D.length?W.createElement("ol",{key:v,dir:T==="auto"?Qr():T,tabIndex:-1,ref:C,className:i,"data-sonner-toaster":!0,"data-theme":K,"data-y-position":M,"data-lifted":L&&D.length>1&&!o,"data-x-position":J,style:{"--front-toast-height":`${((B=x[0])==null?void 0:B.height)||0}px`,"--width":`${Ll}px`,"--gap":`${N}px`,...d,...Gl(s,c)},onBlur:X=>{ae.current&&!X.currentTarget.contains(X.relatedTarget)&&(ae.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||ae.current||(ae.current=!0,H.current=X.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{w||j(!1)},onDragEnd:()=>j(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||V(!0)},onPointerUp:()=>V(!1)},D.filter(X=>!X.position&&z===0||X.position===v).map((X,Y)=>{var ie,re;return W.createElement(Ol,{key:X.id,icons:A,index:Y,toast:X,defaultRichColors:f,duration:(ie=y==null?void 0:y.duration)!=null?ie:h,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:n,visibleToasts:b,closeButton:(re=y==null?void 0:y.closeButton)!=null?re:l,interacting:w,position:v,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,removeToast:$,toasts:D.filter(se=>se.position==X.position),heights:x.filter(se=>se.position==X.position),setHeights:k,expandByDefault:o,gap:N,loadingIcon:_,expanded:L,pauseWhenPageIsHidden:I,swipeDirections:t.swipeDirections})})):null}))});const Fl={theme:"system",setTheme:()=>null},Ta=p.createContext(Fl);function op({children:t,...e}){const n=ne.use.theme(),r=ne.use.setTheme();p.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),n==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)"),i=s=>{o.classList.remove("light","dark"),o.classList.add(s.matches?"dark":"light")};return o.classList.add(l.matches?"dark":"light"),l.addEventListener("change",i),()=>l.removeEventListener("change",i)}else o.classList.add(n)},[n]);const a={theme:n,setTheme:r};return g.jsx(Ta.Provider,{...e,value:a,children:t})}const $l=(t,e,n,r)=>{var o,l,i,s;const a=[n,{code:e,...r||{}}];if((l=(o=t==null?void 0:t.services)==null?void 0:o.logger)!=null&&l.forward)return t.services.logger.forward(a,"warn","react-i18next::",!0);ht(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),(s=(i=t==null?void 0:t.services)==null?void 0:i.logger)!=null&&s.warn?t.services.logger.warn(...a):console!=null&&console.warn&&console.warn(...a)},Jr={},tr=(t,e,n,r)=>{ht(n)&&Jr[n]||(ht(n)&&(Jr[n]=new Date),$l(t,e,n,r))},Ra=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},nr=(t,e,n)=>{t.loadNamespaces(e,Ra(t,n))},Zr=(t,e,n,r)=>{if(ht(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return nr(t,n,r);n.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,Ra(t,r))},Ml=(t,e,n={})=>!e.languages||!e.languages.length?(tr(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(r,a)=>{var o;if(((o=n.bindI18n)==null?void 0:o.indexOf("languageChanging"))>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!a(r.isLanguageChangingTo,t))return!1}}),ht=t=>typeof t=="string",Hl=t=>typeof t=="object"&&t!==null,Bl=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Vl={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Ul=t=>Vl[t],ql=t=>t.replace(Bl,Ul);let rr={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ql};const Wl=(t={})=>{rr={...rr,...t}},Xl=()=>rr;let Aa;const Yl=t=>{Aa=t},Kl=()=>Aa,ap={type:"3rdParty",init(t){Wl(t.options.react),Yl(t)}},Ql=p.createContext();class Jl{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Zl=(t,e)=>{const n=p.useRef();return p.useEffect(()=>{n.current=t},[t,e]),n.current},ja=(t,e,n,r)=>t.getFixedT(e,n,r),ec=(t,e,n,r)=>p.useCallback(ja(t,e,n,r),[t,e,n,r]),xe=(t,e={})=>{var R,I,D,m;const{i18n:n}=e,{i18n:r,defaultNS:a}=p.useContext(Ql)||{},o=n||r||Kl();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new Jl),!o){tr(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const S=(k,L)=>ht(L)?L:Hl(L)&&ht(L.defaultValue)?L.defaultValue:Array.isArray(k)?k[k.length-1]:k,x=[S,{},!1];return x.t=S,x.i18n={},x.ready=!1,x}(R=o.options.react)!=null&&R.wait&&tr(o,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const l={...Xl(),...o.options.react,...e},{useSuspense:i,keyPrefix:s}=l;let c=a||((I=o.options)==null?void 0:I.defaultNS);c=ht(c)?[c]:c||["translation"],(m=(D=o.reportNamespaces).addUsedNamespaces)==null||m.call(D,c);const u=(o.isInitialized||o.initializedStoreOnce)&&c.every(S=>Ml(S,o,l)),f=ec(o,e.lng||null,l.nsMode==="fallback"?c:c[0],s),h=()=>f,d=()=>ja(o,e.lng||null,l.nsMode==="fallback"?c:c[0],s),[b,y]=p.useState(h);let T=c.join();e.lng&&(T=`${e.lng}${T}`);const N=Zl(T),_=p.useRef(!0);p.useEffect(()=>{const{bindI18n:S,bindI18nStore:x}=l;_.current=!0,!u&&!i&&(e.lng?Zr(o,e.lng,c,()=>{_.current&&y(d)}):nr(o,c,()=>{_.current&&y(d)})),u&&N&&N!==T&&_.current&&y(d);const k=()=>{_.current&&y(d)};return S&&(o==null||o.on(S,k)),x&&(o==null||o.store.on(x,k)),()=>{_.current=!1,o&&(S==null||S.split(" ").forEach(L=>o.off(L,k))),x&&o&&x.split(" ").forEach(L=>o.store.off(L,k))}},[o,T]),p.useEffect(()=>{_.current&&u&&y(h)},[o,s,u]);const A=[b,o,u];if(A.t=b,A.i18n=o,A.ready=u,u||!u&&!i)return A;throw new Promise(S=>{e.lng?Zr(o,e.lng,c,()=>S()):nr(o,c,()=>S())})},eo=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,to=xa,tc=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return to(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:o}=e,l=Object.keys(a).map(c=>{const u=n==null?void 0:n[c],f=o==null?void 0:o[c];if(u===null)return null;const h=eo(u)||eo(f);return a[c][h]}),i=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),s=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...d}=u;return Object.entries(d).every(b=>{let[y,T]=b;return Array.isArray(T)?T.includes({...o,...i}[y]):{...o,...i}[y]===T})?[...c,f,h]:c},[]);return to(t,l,s,n==null?void 0:n.class,n==null?void 0:n.className)};var[nn,sp]=br("Tooltip",[ga]),rn=ga(),Ia="TooltipProvider",nc=700,or="tooltip.open",[rc,_r]=nn(Ia),La=t=>{const{__scopeTooltip:e,delayDuration:n=nc,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:o}=t,[l,i]=p.useState(!0),s=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),g.jsx(rc,{scope:e,isOpenDelayed:l,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),i(!1)},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i(!0),r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:p.useCallback(u=>{s.current=u},[]),disableHoverableContent:a,children:o})};La.displayName=Ia;var on="Tooltip",[oc,an]=nn(on),Na=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:a=!1,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=t,s=_r(on,t.__scopeTooltip),c=rn(e),[u,f]=p.useState(null),h=ft(),d=p.useRef(0),b=l??s.disableHoverableContent,y=i??s.delayDuration,T=p.useRef(!1),[N=!1,_]=pa({prop:r,defaultProp:a,onChange:m=>{m?(s.onOpen(),document.dispatchEvent(new CustomEvent(or))):s.onClose(),o==null||o(m)}}),A=p.useMemo(()=>N?T.current?"delayed-open":"instant-open":"closed",[N]),R=p.useCallback(()=>{window.clearTimeout(d.current),d.current=0,T.current=!1,_(!0)},[_]),I=p.useCallback(()=>{window.clearTimeout(d.current),d.current=0,_(!1)},[_]),D=p.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>{T.current=!0,_(!0),d.current=0},y)},[y,_]);return p.useEffect(()=>()=>{d.current&&(window.clearTimeout(d.current),d.current=0)},[]),g.jsx(Ti,{...c,children:g.jsx(oc,{scope:e,contentId:h,open:N,stateAttribute:A,trigger:u,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{s.isOpenDelayed?D():R()},[s.isOpenDelayed,D,R]),onTriggerLeave:p.useCallback(()=>{b?I():(window.clearTimeout(d.current),d.current=0)},[I,b]),onOpen:R,onClose:I,disableHoverableContent:b,children:n})})};Na.displayName=on;var ar="TooltipTrigger",Pa=p.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,a=an(ar,n),o=_r(ar,n),l=rn(n),i=p.useRef(null),s=Xe(e,i,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(Ri,{asChild:!0,...l,children:g.jsx(Se.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:s,onPointerMove:Ce(t.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ce(t.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:Ce(t.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ce(t.onFocus,()=>{c.current||a.onOpen()}),onBlur:Ce(t.onBlur,a.onClose),onClick:Ce(t.onClick,a.onClose)})})});Pa.displayName=ar;var ac="TooltipPortal",[ip,sc]=nn(ac,{forceMount:void 0}),wt="TooltipContent",za=p.forwardRef((t,e)=>{const n=sc(wt,t.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...o}=t,l=an(wt,t.__scopeTooltip);return g.jsx(Et,{present:r||l.open,children:l.disableHoverableContent?g.jsx(Da,{side:a,...o,ref:e}):g.jsx(ic,{side:a,...o,ref:e})})}),ic=p.forwardRef((t,e)=>{const n=an(wt,t.__scopeTooltip),r=_r(wt,t.__scopeTooltip),a=p.useRef(null),o=Xe(e,a),[l,i]=p.useState(null),{trigger:s,onClose:c}=n,u=a.current,{onPointerInTransitChange:f}=r,h=p.useCallback(()=>{i(null),f(!1)},[f]),d=p.useCallback((b,y)=>{const T=b.currentTarget,N={x:b.clientX,y:b.clientY},_=dc(N,T.getBoundingClientRect()),A=fc(N,_),R=hc(y.getBoundingClientRect()),I=pc([...A,...R]);i(I),f(!0)},[f]);return p.useEffect(()=>()=>h(),[h]),p.useEffect(()=>{if(s&&u){const b=T=>d(T,u),y=T=>d(T,s);return s.addEventListener("pointerleave",b),u.addEventListener("pointerleave",y),()=>{s.removeEventListener("pointerleave",b),u.removeEventListener("pointerleave",y)}}},[s,u,d,h]),p.useEffect(()=>{if(l){const b=y=>{const T=y.target,N={x:y.clientX,y:y.clientY},_=(s==null?void 0:s.contains(T))||(u==null?void 0:u.contains(T)),A=!gc(N,l);_?h():A&&(h(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[s,u,l,c,h]),g.jsx(Da,{...t,ref:o})}),[lc,cc]=nn(on,{isInside:!1}),Da=p.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=t,s=an(wt,n),c=rn(n),{onClose:u}=s;return p.useEffect(()=>(document.addEventListener(or,u),()=>document.removeEventListener(or,u)),[u]),p.useEffect(()=>{if(s.trigger){const f=h=>{const d=h.target;d!=null&&d.contains(s.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[s.trigger,u]),g.jsx(Si,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:g.jsxs(_i,{"data-state":s.stateAttribute,...c,...i,ref:e,style:{...i.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(Ci,{children:r}),g.jsx(lc,{scope:n,isInside:!0,children:g.jsx(ki,{id:s.contentId,role:"tooltip",children:a||r})})]})})});za.displayName=wt;var Oa="TooltipArrow",uc=p.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,a=rn(n);return cc(Oa,n).isInside?null:g.jsx(Ai,{...a,...r,ref:e})});uc.displayName=Oa;function dc(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),a=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,a,o)){case o:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function fc(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function hc(t){const{top:e,right:n,bottom:r,left:a}=t;return[{x:a,y:e},{x:n,y:e},{x:n,y:r},{x:a,y:r}]}function gc(t,e){const{x:n,y:r}=t;let a=!1;for(let o=0,l=e.length-1;o<e.length;l=o++){const i=e[o].x,s=e[o].y,c=e[l].x,u=e[l].y;s>r!=u>r&&n<(c-i)*(r-s)/(u-s)+i&&(a=!a)}return a}function pc(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),mc(e)}function mc(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const a=t[r];for(;e.length>=2;){const o=e[e.length-1],l=e[e.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))e.pop();else break}e.push(a)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const a=t[r];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var vc=La,yc=Na,bc=Pa,Ga=za;const Fa=vc,$a=yc,Ma=bc,wc=t=>typeof t!="string"?t:g.jsx("div",{className:"relative top-0 pt-1 whitespace-pre-wrap break-words",children:t}),Cr=p.forwardRef(({className:t,side:e="left",align:n="start",children:r,...a},o)=>{const l=p.useRef(null);return p.useEffect(()=>{l.current&&(l.current.scrollTop=0)},[r]),g.jsx(Ga,{ref:o,side:e,align:n,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",t),...a,children:typeof r=="string"?wc(r):r})});Cr.displayName=Ga.displayName;const no=tc("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:t,variant:e,tooltip:n,size:r,side:a="right",asChild:o=!1,...l},i)=>{const s=o?ji:"button";return n?g.jsx(Fa,{children:g.jsxs($a,{children:[g.jsx(Ma,{asChild:!0,children:g.jsx(s,{className:fe(no({variant:e,size:r,className:t}),"cursor-pointer"),ref:i,...l})}),g.jsx(Cr,{side:a,children:n})]})}):g.jsx(s,{className:fe(no({variant:e,size:r,className:t}),"cursor-pointer"),ref:i,...l})});be.displayName="Button";const qt=p.forwardRef(({className:t,type:e,...n},r)=>g.jsx("input",{type:e,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",t),ref:r,...n}));qt.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 xc=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ha=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).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 Ec={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 Sc=p.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:o,iconNode:l,...i},s)=>p.createElement("svg",{ref:s,...Ec,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Ha("lucide",a),...i},[...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 ce=(t,e)=>{const n=p.forwardRef(({className:r,...a},o)=>p.createElement(Sc,{ref:o,iconNode:e,className:Ha(`lucide-${xc(t)}`,r),...a}));return n.displayName=`${t}`,n};/**
|
|
* @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=[["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"}]],lp=ce("Activity",_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 Cc=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],cp=ce("AlignCenter",Cc);/**
|
|
* @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 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],up=ce("AlignLeft",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 Tc=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],dp=ce("AlignRight",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:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],fp=ce("ArrowDown",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:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],hp=ce("ArrowUp",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:"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"}]],Ic=ce("BookOpen",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 Lc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ba=ce("Check",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 Nc=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],gp=ce("ChevronDown",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 Pc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],pp=ce("ChevronUp",Pc);/**
|
|
* @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:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Dc=ce("ChevronsUpDown",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 Oc=[["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"}]],mp=ce("Copy",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 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"}]],vp=ce("Eraser",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 Fc=[["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"}]],yp=ce("FileText",Fc);/**
|
|
* @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=[["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"}]],bp=ce("Files",$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 Mc=[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]],wp=ce("Filter",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 Hc=[["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"}]],Bc=ce("Fullscreen",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 Vc=[["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"}]],Uc=ce("GitBranchPlus",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 qc=[["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"}]],xp=ce("Github",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 Wc=[["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"}]],Xc=ce("Grip",Wc);/**
|
|
* @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 Yc=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Va=ce("LoaderCircle",Yc);/**
|
|
* @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:"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"}]],Ep=ce("Loader",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=[["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"}]],Sp=ce("LogOut",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 Jc=[["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"}]],Zc=ce("Maximize",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 eu=[["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"}]],tu=ce("Minimize",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 nu=[["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"}]],_p=ce("Palette",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 ru=[["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"}]],ou=ce("Pause",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.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"}]],su=ce("Pencil",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 iu=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],lu=ce("Play",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:"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"}]],uu=ce("RefreshCw",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=[["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"}]],fu=ce("RotateCcw",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:"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"}]],gu=ce("RotateCw",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=[["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"}]],mu=ce("Scissors",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=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],yu=ce("Search",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=[["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"}]],Cp=ce("Send",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 wu=[["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"}]],xu=ce("Settings",wu);/**
|
|
* @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:"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"}]],kp=ce("TriangleAlert",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 Su=[["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"}]],Ua=ce("Undo2",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 _u=[["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"}]],Tp=ce("Upload",_u);/**
|
|
* @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:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ku=ce("X",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:"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"}]],Rp=ce("Zap",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=[["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"}]],Au=ce("ZoomIn",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 ju=[["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"}]],Iu=ce("ZoomOut",ju),Lu=ba,Ap=Li,Nu=ma,qa=p.forwardRef(({className:t,...e},n)=>g.jsx(wr,{ref:n,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",t),...e}));qa.displayName=wr.displayName;const Wa=p.forwardRef(({className:t,children:e,...n},r)=>g.jsxs(Nu,{children:[g.jsx(qa,{}),g.jsxs(xr,{ref:r,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",t),...n,children:[e,g.jsxs(Ii,{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(ku,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Wa.displayName=xr.displayName;const Xa=({className:t,...e})=>g.jsx("div",{className:fe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Xa.displayName="DialogHeader";const Ya=({className:t,...e})=>g.jsx("div",{className:fe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Ya.displayName="DialogFooter";const Ka=p.forwardRef(({className:t,...e},n)=>g.jsx(va,{ref:n,className:fe("text-lg leading-none font-semibold tracking-tight",t),...e}));Ka.displayName=va.displayName;const Qa=p.forwardRef(({className:t,...e},n)=>g.jsx(ya,{ref:n,className:fe("text-muted-foreground text-sm",t),...e}));Qa.displayName=ya.displayName;const kr=Pi,Tr=zi,sn=p.forwardRef(({className:t,align:e="center",sideOffset:n=4,collisionPadding:r,sticky:a,avoidCollisions:o=!1,...l},i)=>g.jsx(Ni,{children:g.jsx(wa,{ref:i,align:e,sideOffset:n,collisionPadding:r,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",t),...l})}));sn.displayName=wa.displayName;var Pu=`
|
|
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
|
|
}
|
|
`,zu=Pu,Du=`
|
|
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;
|
|
}
|
|
`,Ou=Du,Ja=WebGLRenderingContext,ro=Ja.UNSIGNED_BYTE,oo=Ja.FLOAT,Gu=["u_sizeRatio","u_pixelRatio","u_matrix"],Fu=function(t){function e(){return ia(this,e),la(this,e,arguments)}return oa(e,t),aa(e,[{key:"getDefinition",value:function(){return{VERTICES:1,VERTEX_SHADER_SOURCE:Ou,FRAGMENT_SHADER_SOURCE:zu,METHOD:WebGLRenderingContext.POINTS,UNIFORMS:Gu,ATTRIBUTES:[{name:"a_position",size:2,type:oo},{name:"a_size",size:1,type:oo},{name:"a_color",size:4,type:ro,normalized:!0},{name:"a_id",size:4,type:ro,normalized:!0}]}}},{key:"processVisibleItem",value:function(r,a,o){var l=this.array;l[a++]=o.x,l[a++]=o.y,l[a++]=o.size,l[a++]=Zt(o.color),l[a++]=r}},{key:"setUniforms",value:function(r,a){var o=r.sizeRatio,l=r.pixelRatio,i=r.matrix,s=a.gl,c=a.uniformLocations,u=c.u_sizeRatio,f=c.u_pixelRatio,h=c.u_matrix;s.uniform1f(f,l),s.uniform1f(u,o),s.uniformMatrix3fv(h,!1,i)}}])}(sa),$u=`
|
|
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;
|
|
}
|
|
`,Mu=$u,Za=WebGLRenderingContext,ao=Za.UNSIGNED_BYTE,Ue=Za.FLOAT,Hu=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],Bu={lengthToThicknessRatio:yr.lengthToThicknessRatio};function es(t){var e=Ut(Ut({},Bu),{});return function(n){function r(){return ia(this,r),la(this,r,arguments)}return oa(r,n),aa(r,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Mu,FRAGMENT_SHADER_SOURCE:pi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Hu,ATTRIBUTES:[{name:"a_positionStart",size:2,type:Ue},{name:"a_positionEnd",size:2,type:Ue},{name:"a_normal",size:2,type:Ue},{name:"a_color",size:4,type:ao,normalized:!0},{name:"a_id",size:4,type:ao,normalized:!0},{name:"a_sourceRadius",size:1,type:Ue},{name:"a_targetRadius",size:1,type:Ue}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:Ue},{name:"a_normalCoef",size:1,type:Ue},{name:"a_sourceRadiusCoef",size:1,type:Ue},{name:"a_targetRadiusCoef",size:1,type:Ue}],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,i,s,c){var u=c.size||1,f=i.x,h=i.y,d=s.x,b=s.y,y=Zt(c.color),T=d-f,N=b-h,_=i.size||1,A=s.size||1,R=T*T+N*N,I=0,D=0;R&&(R=1/Math.sqrt(R),I=-N*R*u,D=T*R*u);var m=this.array;m[l++]=f,m[l++]=h,m[l++]=d,m[l++]=b,m[l++]=I,m[l++]=D,m[l++]=y,m[l++]=o,m[l++]=_,m[l++]=A}},{key:"setUniforms",value:function(o,l){var i=l.gl,s=l.uniformLocations,c=s.u_matrix,u=s.u_zoomRatio,f=s.u_feather,h=s.u_pixelRatio,d=s.u_correctionRatio,b=s.u_sizeRatio,y=s.u_minEdgeThickness,T=s.u_lengthToThicknessRatio;i.uniformMatrix3fv(c,!1,o.matrix),i.uniform1f(u,o.zoomRatio),i.uniform1f(b,o.sizeRatio),i.uniform1f(d,o.correctionRatio),i.uniform1f(h,o.pixelRatio),i.uniform1f(f,o.antiAliasingFeather),i.uniform1f(y,o.minEdgeThickness),i.uniform1f(T,e.lengthToThicknessRatio)}}])}(ca)}es();function Vu(t){return mi([es(),Vr(t),Vr(Ut(Ut({},t),{},{extremity:"source"}))])}Vu();function Uu(t){if(Array.isArray(t))return t}function qu(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,a,o,l,i=[],s=!0,c=!1;try{if(o=(n=n.call(t)).next,e!==0)for(;!(s=(r=o.call(n)).done)&&(i.push(r.value),i.length!==e);s=!0);}catch(u){c=!0,a=u}finally{try{if(!s&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw a}}return i}}function sr(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ts(t,e){if(t){if(typeof t=="string")return sr(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sr(t,e):void 0}}function Wu(){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 Xu(t,e){return Uu(t)||qu(t,e)||ts(t,e)||Wu()}function Yu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ku(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ns(t){var e=Ku(t,"string");return typeof e=="symbol"?e:e+""}function Qu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ns(r.key),r)}}function Ju(t,e,n){return e&&Qu(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Wt(t)}function rs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rs=function(){return!!t})()}function ir(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Zu(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ir(t)}function ed(t,e,n){return e=Wt(e),Zu(t,rs()?Reflect.construct(e,n||[],Wt(t).constructor):e.apply(t,n))}function lr(t,e){return lr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},lr(t,e)}function td(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&lr(t,e)}function vt(t,e,n){return(e=ns(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nd(t){if(Array.isArray(t))return sr(t)}function rd(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function od(){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 gn(t){return nd(t)||rd(t)||ts(t)||od()}function so(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function io(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?so(Object(n),!0).forEach(function(r){vt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):so(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var ad="relative",sd={drawLabel:void 0,drawHover:void 0,borders:[{size:{value:.1},color:{attribute:"borderColor"}},{size:{fill:!0},color:{attribute:"color"}}]},id="#000000";function ld(t){var e=t.borders,n=Ur(e.filter(function(a){var o=a.size;return"fill"in o}).length),r=`
|
|
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(e.flatMap(function(a,o){var l=a.size;return"attribute"in l?["varying float v_borderSize_".concat(o+1,";")]:[]}).join(`
|
|
`),`
|
|
`).concat(e.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(e.flatMap(function(a,o){var l=a.size;if("fill"in l)return[];l=l;var i="attribute"in l?"v_borderSize_".concat(o+1):Ur(l.value),s=(l.mode||ad)==="pixels"?"u_correctionRatio":"v_radius";return[" float borderSize_".concat(o+1," = ").concat(s," * ").concat(i,";")]}).join(`
|
|
`),`
|
|
// Now, let's split the remaining space between "fill" borders:
|
|
float fillBorderSize = (v_radius - (`).concat(e.flatMap(function(a,o){var l=a.size;return"fill"in l?[]:["borderSize_".concat(o+1)]}).join(" + "),") ) / ").concat(n,`;
|
|
`).concat(e.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(e.map(function(a,o){return" float adjustedBorderSize_".concat(o+1," = adjustedBorderSize_").concat(o," - borderSize_").concat(o+1,";")}).join(`
|
|
`),`
|
|
|
|
// Colors:
|
|
vec4 borderColor_0 = transparent;
|
|
`).concat(e.map(function(a,o){var l=a.color,i=[];return"attribute"in l?i.push(" vec4 borderColor_".concat(o+1," = v_borderColor_").concat(o+1,";")):"transparent"in l?i.push(" vec4 borderColor_".concat(o+1," = vec4(0.0, 0.0, 0.0, 0.0);")):i.push(" vec4 borderColor_".concat(o+1," = u_borderColor_").concat(o+1,";")),i.push(" borderColor_".concat(o+1,".a *= bias;")),i.push(" if (borderSize_".concat(o+1," <= 1.0 * u_correctionRatio) { borderColor_").concat(o+1," = borderColor_").concat(o,"; }")),i.join(`
|
|
`)}).join(`
|
|
`),`
|
|
if (dist > adjustedBorderSize_0) {
|
|
gl_FragColor = borderColor_0;
|
|
} else `).concat(e.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 r}function cd(t){var e=t.borders,n=`
|
|
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(e.flatMap(function(r,a){var o=r.size;return"attribute"in o?["attribute float a_borderSize_".concat(a+1,";"),"varying float v_borderSize_".concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
`).concat(e.flatMap(function(r,a){var o=r.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(e.flatMap(function(r,a){var o=r.size;return"attribute"in o?[" v_borderSize_".concat(a+1," = a_borderSize_").concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
`).concat(e.flatMap(function(r,a){var o=r.color;return"attribute"in o?[" v_borderColor_".concat(a+1," = a_borderColor_").concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
#endif
|
|
}
|
|
`);return n}var os=WebGLRenderingContext,lo=os.UNSIGNED_BYTE,Nt=os.FLOAT;function ud(t){var e,n=io(io({},sd),{}),r=n.borders,a=n.drawLabel,o=n.drawHover,l=["u_sizeRatio","u_correctionRatio","u_matrix"].concat(gn(r.flatMap(function(i,s){var c=i.color;return"value"in c?["u_borderColor_".concat(s+1)]:[]})));return e=function(i){td(s,i);function s(){var c;Yu(this,s);for(var u=arguments.length,f=new Array(u),h=0;h<u;h++)f[h]=arguments[h];return c=ed(this,s,[].concat(f)),vt(ir(c),"drawLabel",a),vt(ir(c),"drawHover",o),c}return Ju(s,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:cd(n),FRAGMENT_SHADER_SOURCE:ld(n),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:l,ATTRIBUTES:[{name:"a_position",size:2,type:Nt},{name:"a_id",size:4,type:lo,normalized:!0},{name:"a_size",size:1,type:Nt}].concat(gn(r.flatMap(function(u,f){var h=u.color;return"attribute"in h?[{name:"a_borderColor_".concat(f+1),size:4,type:lo,normalized:!0}]:[]})),gn(r.flatMap(function(u,f){var h=u.size;return"attribute"in h?[{name:"a_borderSize_".concat(f+1),size:1,type:Nt}]:[]}))),CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:Nt}],CONSTANT_DATA:[[s.ANGLE_1],[s.ANGLE_2],[s.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,r.forEach(function(b){var y=b.color;"attribute"in y&&(d[f++]=Zt(h[y.attribute]||y.defaultValue||id))}),r.forEach(function(b){var y=b.size;"attribute"in y&&(d[f++]=h[y.attribute]||y.defaultValue)})}},{key:"setUniforms",value:function(u,f){var h=f.gl,d=f.uniformLocations,b=d.u_sizeRatio,y=d.u_correctionRatio,T=d.u_matrix;h.uniform1f(y,u.correctionRatio),h.uniform1f(b,u.sizeRatio),h.uniformMatrix3fv(T,!1,u.matrix),r.forEach(function(N,_){var A=N.color;if("value"in A){var R=d["u_borderColor_".concat(_+1)],I=vi(A.value),D=Xu(I,4),m=D[0],S=D[1],x=D[2],k=D[3];h.uniform4f(R,m/255,S/255,x/255,k/255)}})}}]),s}(sa),vt(e,"ANGLE_1",0),vt(e,"ANGLE_2",2*Math.PI/3),vt(e,"ANGLE_3",4*Math.PI/3),e}var dd=ud();function fd(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function as(t){var e=fd(t,"string");return typeof e=="symbol"?e:e+""}function ss(t,e,n){return(e=as(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function co(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Xt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?co(Object(n),!0).forEach(function(r){ss(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):co(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,as(r.key),r)}}function pd(t,e,n){return e&&gd(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yt(t){return Yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Yt(t)}function is(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(is=function(){return!!t})()}function ls(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function md(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ls(t)}function vd(t,e,n){return e=Yt(e),md(t,is()?Reflect.construct(e,n||[],Yt(t).constructor):e.apply(t,n))}function cr(t,e){return cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},cr(t,e)}function yd(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cr(t,e)}function ur(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function bd(t){if(Array.isArray(t))return ur(t)}function wd(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xd(t,e){if(t){if(typeof t=="string")return ur(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ur(t,e):void 0}}function Ed(){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 pn(t){return bd(t)||wd(t)||xd(t)||Ed()}function cs(t,e,n,r){var a=Math.pow(1-t,2)*e.x+2*(1-t)*t*n.x+Math.pow(t,2)*r.x,o=Math.pow(1-t,2)*e.y+2*(1-t)*t*n.y+Math.pow(t,2)*r.y;return{x:a,y:o}}function Sd(t,e,n){for(var r=20,a=0,o=t,l=0;l<r;l++){var i=cs((l+1)/r,t,e,n);a+=Math.sqrt(Math.pow(o.x-i.x,2)+Math.pow(o.y-i.y,2)),o=i}return a}function _d(t){var e=t.curvatureAttribute,n=t.defaultCurvature,r=t.keepLabelUpright,a=r===void 0?!0:r;return function(o,l,i,s,c){var u=c.edgeLabelSize,f=l[e]||n,h=c.edgeLabelFont,d=c.edgeLabelWeight,b=c.edgeLabelColor.attribute?l[c.edgeLabelColor.attribute]||c.edgeLabelColor.color||"#000":c.edgeLabelColor.color,y=l.label;if(y){o.fillStyle=b,o.font="".concat(d," ").concat(u,"px ").concat(h);var T=!a||i.x<s.x,N=T?i.x:s.x,_=T?i.y:s.y,A=T?s.x:i.x,R=T?s.y:i.y,I=(N+A)/2,D=(_+R)/2,m=A-N,S=R-_,x=Math.sqrt(Math.pow(m,2)+Math.pow(S,2)),k=T?1:-1,L=I+S*f*k,j=D-m*f*k,w=l.size*.7+5,V={x:j-_,y:-(L-N)},K=Math.sqrt(Math.pow(V.x,2)+Math.pow(V.y,2)),O={x:R-j,y:-(A-L)},C=Math.sqrt(Math.pow(O.x,2)+Math.pow(O.y,2));N+=w*V.x/K,_+=w*V.y/K,A+=w*O.x/C,R+=w*O.y/C,L+=w*S/x,j-=w*m/x;var E={x:L,y:j},H={x:N,y:_},ae={x:A,y:R},$=Sd(H,E,ae);if(!($<i.size+s.size)){var v=o.measureText(y).width,z=$-i.size-s.size;if(v>z){var B="…";for(y=y+B,v=o.measureText(y).width;v>z&&y.length>1;)y=y.slice(0,-2)+B,v=o.measureText(y).width;if(y.length<4)return}for(var M={},J=0,X=y.length;J<X;J++){var Y=y[J];M[Y]||(M[Y]=o.measureText(Y).width*(1+f*.35))}for(var ie=.5-v/$/2,re=0,se=y.length;re<se;re++){var F=y[re],Q=cs(ie,H,E,ae),q=2*(1-ie)*(L-N)+2*ie*(A-L),U=2*(1-ie)*(j-_)+2*ie*(R-j),P=Math.atan2(U,q);o.save(),o.translate(Q.x,Q.y),o.rotate(P),o.fillText(F,0,0),o.restore(),ie+=M[F]/$}}}}}function Cd(t){var e=t.arrowHead,n=(e==null?void 0:e.extremity)==="target"||(e==null?void 0:e.extremity)==="both",r=(e==null?void 0:e.extremity)==="source"||(e==null?void 0:e.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(n?`
|
|
varying float v_targetSize;
|
|
varying vec2 v_targetPoint;`:"",`
|
|
`).concat(r?`
|
|
varying float v_sourceSize;
|
|
varying vec2 v_sourcePoint;`:"",`
|
|
`).concat(e?`
|
|
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(n?`
|
|
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(r?`
|
|
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 kd(t){var e=t.arrowHead,n=(e==null?void 0:e.extremity)==="target"||(e==null?void 0:e.extremity)==="both",r=(e==null?void 0:e.extremity)==="source"||(e==null?void 0:e.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(n?`attribute float a_targetSize;
|
|
`:"",`
|
|
`).concat(r?`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(n?`
|
|
varying float v_targetSize;
|
|
varying vec2 v_targetPoint;`:"",`
|
|
`).concat(r?`
|
|
varying float v_sourceSize;
|
|
varying vec2 v_sourcePoint;`:"",`
|
|
`).concat(e?`
|
|
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(e?"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(n?`
|
|
v_targetSize = a_targetSize * u_pixelRatio / u_sizeRatio;
|
|
v_targetPoint = viewportTarget;
|
|
`:"",`
|
|
`).concat(r?`
|
|
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 us=.25,Td={arrowHead:null,curvatureAttribute:"curvature",defaultCurvature:us},ds=WebGLRenderingContext,uo=ds.UNSIGNED_BYTE,et=ds.FLOAT;function Rr(t){var e=Xt(Xt({},Td),t||{}),n=e,r=n.arrowHead,a=n.curvatureAttribute,o=n.drawLabel,l=(r==null?void 0:r.extremity)==="target"||(r==null?void 0:r.extremity)==="both",i=(r==null?void 0:r.extremity)==="source"||(r==null?void 0:r.extremity)==="both",s=["u_matrix","u_sizeRatio","u_dimensions","u_pixelRatio","u_feather","u_minEdgeThickness"].concat(pn(r?["u_lengthToThicknessRatio","u_widenessToThicknessRatio"]:[]));return function(c){yd(u,c);function u(){var f;hd(this,u);for(var h=arguments.length,d=new Array(h),b=0;b<h;b++)d[b]=arguments[b];return f=vd(this,u,[].concat(d)),ss(ls(f),"drawLabel",o||_d(e)),f}return pd(u,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:kd(e),FRAGMENT_SHADER_SOURCE:Cd(e),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:s,ATTRIBUTES:[{name:"a_source",size:2,type:et},{name:"a_target",size:2,type:et}].concat(pn(l?[{name:"a_targetSize",size:1,type:et}]:[]),pn(i?[{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:uo,normalized:!0},{name:"a_id",size:4,type:uo,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,b,y,T){var N,_=T.size||1,A=b.x,R=b.y,I=y.x,D=y.y,m=Zt(T.color),S=(N=T[a])!==null&&N!==void 0?N:us,x=this.array;x[d++]=A,x[d++]=R,x[d++]=I,x[d++]=D,l&&(x[d++]=y.size),i&&(x[d++]=b.size),x[d++]=_,x[d++]=S,x[d++]=m,x[d++]=h}},{key:"setUniforms",value:function(h,d){var b=d.gl,y=d.uniformLocations,T=y.u_matrix,N=y.u_pixelRatio,_=y.u_feather,A=y.u_sizeRatio,R=y.u_dimensions,I=y.u_minEdgeThickness;if(b.uniformMatrix3fv(T,!1,h.matrix),b.uniform1f(N,h.pixelRatio),b.uniform1f(A,h.sizeRatio),b.uniform1f(_,h.antiAliasingFeather),b.uniform2f(R,h.width*h.pixelRatio,h.height*h.pixelRatio),b.uniform1f(I,h.minEdgeThickness),r){var D=y.u_lengthToThicknessRatio,m=y.u_widenessToThicknessRatio;b.uniform1f(D,r.lengthToThicknessRatio),b.uniform1f(m,r.widenessToThicknessRatio)}}}]),u}(ca)}var Rd=Rr(),Ad=Rr({arrowHead:yr});Rr({arrowHead:Xt(Xt({},yr),{},{extremity:"both"})});const jd=({node:t,move:e})=>{const n=Be(),{gotoNode:r}=ua();return p.useEffect(()=>{const a=n.getGraph();if(e){if(t&&a.hasNode(t))try{a.setNodeAttribute(t,"highlighted",!0),r(t)}catch(o){console.error("Error focusing on node:",o)}else n.setCustomBBox(null),n.getCamera().animate({x:.5,y:.5,ratio:1},{duration:0});ee.getState().setMoveToSelectedNode(!1)}else if(t&&a.hasNode(t))try{a.setNodeAttribute(t,"highlighted",!0)}catch(o){console.error("Error highlighting node:",o)}return()=>{if(t&&a.hasNode(t))try{a.setNodeAttribute(t,"highlighted",!1)}catch(o){console.error("Error cleaning up node highlight:",o)}}},[t,e,n,r]),null};function St(t,e){const n=Be(),r=p.useRef(e);return da(r.current,e)||(r.current=e),{positions:p.useCallback(()=>r.current?t(n.getGraph(),r.current):{},[n,r,t]),assign:p.useCallback(()=>{r.current&&t.assign(n.getGraph(),r.current)},[n,r,t])}}function Ar(t,e){const n=Be(),[r,a]=p.useState(!1),[o,l]=p.useState(null),i=p.useRef(e);return da(i.current,e)||(i.current=e),p.useEffect(()=>{a(!1);let s=null;return i.current&&(s=new t(n.getGraph(),i.current)),l(s),()=>{s!==null&&s.kill()}},[n,i,l,a,t]),{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:r}}var mn,fo;function At(){if(fo)return mn;fo=1;function t(n){return!n||typeof n!="object"||typeof n=="function"||Array.isArray(n)||n instanceof Set||n instanceof Map||n instanceof RegExp||n instanceof Date}function e(n,r){n=n||{};var a={};for(var o in r){var l=n[o],i=r[o];if(!t(i)){a[o]=e(l,i);continue}l===void 0?a[o]=i:a[o]=l}return a}return mn=e,mn}var vn,ho;function Id(){if(ho)return vn;ho=1;function t(n){return function(r,a){return r+Math.floor(n()*(a-r+1))}}var e=t(Math.random);return e.createRandom=t,vn=e,vn}var yn,go;function Ld(){if(go)return yn;go=1;var t=Id().createRandom;function e(r){var a=t(r);return function(o){for(var l=o.length,i=l-1,s=-1;++s<l;){var c=a(s,i),u=o[c];o[c]=o[s],o[s]=u}}}var n=e(Math.random);return n.createShuffleInPlace=e,yn=n,yn}var bn,po;function Nd(){if(po)return bn;po=1;var t=At(),e=We(),n=Ld(),r={attributes:{x:"x",y:"y"},center:0,hierarchyAttributes:[],rng:Math.random,scale:1};function a(m,S,x,k,L){this.wrappedCircle=L||null,this.children={},this.countChildren=0,this.id=m||null,this.next=null,this.previous=null,this.x=S||null,this.y=x||null,L?this.r=1010101:this.r=k||999}a.prototype.hasChildren=function(){return this.countChildren>0},a.prototype.addChild=function(m,S){this.children[m]=S,++this.countChildren},a.prototype.getChild=function(m){if(!this.children.hasOwnProperty(m)){var S=new a;this.children[m]=S,++this.countChildren}return this.children[m]},a.prototype.applyPositionToChildren=function(){if(this.hasChildren()){var m=this;for(var S in m.children){var x=m.children[S];x.x+=m.x,x.y+=m.y,x.applyPositionToChildren()}}};function o(m,S,x){for(var k in S.children){var L=S.children[k];L.hasChildren()?o(m,L,x):x[L.id]={x:L.x,y:L.y}}}function l(m,S){var x=m.r-S.r,k=S.x-m.x,L=S.y-m.y;return x<0||x*x<k*k+L*L}function i(m,S){var x=m.r-S.r+1e-6,k=S.x-m.x,L=S.y-m.y;return x>0&&x*x>k*k+L*L}function s(m,S){for(var x=0;x<S.length;++x)if(!i(m,S[x]))return!1;return!0}function c(m){return new a(null,m.x,m.y,m.r)}function u(m,S){var x=m.x,k=m.y,L=m.r,j=S.x,w=S.y,V=S.r,K=j-x,O=w-k,C=V-L,E=Math.sqrt(K*K+O*O);return new a(null,(x+j+K/E*C)/2,(k+w+O/E*C)/2,(E+L+V)/2)}function f(m,S,x){var k=m.x,L=m.y,j=m.r,w=S.x,V=S.y,K=S.r,O=x.x,C=x.y,E=x.r,H=k-w,ae=k-O,$=L-V,v=L-C,z=K-j,B=E-j,M=k*k+L*L-j*j,J=M-w*w-V*V+K*K,X=M-O*O-C*C+E*E,Y=ae*$-H*v,ie=($*X-v*J)/(Y*2)-k,re=(v*z-$*B)/Y,se=(ae*J-H*X)/(Y*2)-L,F=(H*B-ae*z)/Y,Q=re*re+F*F-1,q=2*(j+ie*re+se*F),U=ie*ie+se*se-j*j,P=-(Q?(q+Math.sqrt(q*q-4*Q*U))/(2*Q):U/q);return new a(null,k+ie+re*P,L+se+F*P,P)}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,S){var x,k;if(s(S,m))return[S];for(x=0;x<m.length;++x)if(l(S,m[x])&&s(u(m[x],S),m))return[m[x],S];for(x=0;x<m.length-1;++x)for(k=x+1;k<m.length;++k)if(l(u(m[x],m[k]),S)&&l(u(m[x],S),m[k])&&l(u(m[k],S),m[x])&&s(f(m[x],m[k],S),m))return[m[x],m[k],S];throw new Error("graphology-layout/circlepack: extendBasis failure !")}function b(m){var S=m.wrappedCircle,x=m.next.wrappedCircle,k=S.r+x.r,L=(S.x*x.r+x.x*S.r)/k,j=(S.y*x.r+x.y*S.r)/k;return L*L+j*j}function y(m,S){var x=0,k=m.slice(),L=m.length,j=[],w,V;for(S(k);x<L;)w=k[x],V&&i(V,w)?++x:(j=d(j,w),V=h(j),x=0);return V}function T(m,S,x){var k=m.x-S.x,L,j,w=m.y-S.y,V,K,O=k*k+w*w;O?(j=S.r+x.r,j*=j,K=m.r+x.r,K*=K,j>K?(L=(O+K-j)/(2*O),V=Math.sqrt(Math.max(0,K/O-L*L)),x.x=m.x-L*k-V*w,x.y=m.y-L*w+V*k):(L=(O+j-K)/(2*O),V=Math.sqrt(Math.max(0,j/O-L*L)),x.x=S.x+L*k-V*w,x.y=S.y+L*w+V*k)):(x.x=S.x+x.r,x.y=S.y)}function N(m,S){var x=m.r+S.r-1e-6,k=S.x-m.x,L=S.y-m.y;return x>0&&x*x>k*k+L*L}function _(m,S){var x=m.length;if(x===0)return 0;var k,L,j,w,V,K,O,C,E,H;if(k=m[0],k.x=0,k.y=0,x<=1)return k.r;if(L=m[1],k.x=-L.r,L.x=k.r,L.y=0,x<=2)return k.r+L.r;j=m[2],T(L,k,j),k=new a(null,null,null,null,k),L=new a(null,null,null,null,L),j=new a(null,null,null,null,j),k.next=j.previous=L,L.next=k.previous=j,j.next=L.previous=k;e:for(K=3;K<x;++K){j=m[K],T(k.wrappedCircle,L.wrappedCircle,j),j=new a(null,null,null,null,j),O=L.next,C=k.previous,E=L.wrappedCircle.r,H=k.wrappedCircle.r;do if(E<=H){if(N(O.wrappedCircle,j.wrappedCircle)){L=O,k.next=L,L.previous=k,--K;continue e}E+=O.wrappedCircle.r,O=O.next}else{if(N(C.wrappedCircle,j.wrappedCircle)){k=C,k.next=L,L.previous=k,--K;continue e}H+=C.wrappedCircle.r,C=C.previous}while(O!==C.next);for(j.previous=k,j.next=L,k.next=L.previous=L=j,w=b(k);(j=j.next)!==L;)(V=b(j))<w&&(k=j,w=V);L=k.next}k=[L.wrappedCircle],j=L;for(var ae=1e4;(j=j.next)!==L&&--ae!==0;)k.push(j.wrappedCircle);for(j=y(k,S),K=0;K<x;++K)k=m[K],k.x-=j.x,k.y-=j.y;return j.r}function A(m,S){var x=0;if(m.hasChildren()){for(var k in m.children){var L=m.children[k];L.hasChildren()&&(L.r=A(L,S))}x=_(Object.values(m.children),S)}return x}function R(m,S){A(m,S);for(var x in m.children){var k=m.children[x];k.applyPositionToChildren()}}function I(m,S,x){if(!e(S))throw new Error("graphology-layout/circlepack: the given graph is not a valid graphology instance.");x=t(x,r);var k={},L={},j=S.nodes(),w=x.center,V=x.hierarchyAttributes,K=n.createShuffleInPlace(x.rng),O=x.scale,C=new a;S.forEachNode(function(z,B){var M=B.size?B.size:1,J=new a(z,null,null,M),X=C;V.forEach(function(Y){var ie=B[Y];X=X.getChild(ie)}),X.addChild(z,J)}),R(C,K),o(S,C,k);var E=j.length,H,ae,$;for($=0;$<E;$++){var v=j[$];H=w+O*k[v].x,ae=w+O*k[v].y,L[v]={x:H,y:ae},m&&(S.setNodeAttribute(v,x.attributes.x,H),S.setNodeAttribute(v,x.attributes.y,ae))}return L}var D=I.bind(null,!1);return D.assign=I.bind(null,!0),bn=D,bn}var Pd=Nd();const zd=He(Pd);function Dd(t={}){return St(zd,t)}var wn,mo;function Od(){if(mo)return wn;mo=1;var t=At(),e=We(),n={dimensions:["x","y"],center:.5,scale:1};function r(o,l,i){if(!e(l))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");i=t(i,n);var s=i.dimensions;if(!Array.isArray(s)||s.length!==2)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=i.center,u=i.scale,f=Math.PI*2,h=(c-.5)*u,d=l.order,b=s[0],y=s[1];function T(A,R){return R[b]=u*Math.cos(A*f/d)+h,R[y]=u*Math.sin(A*f/d)+h,R}var N=0;if(!o){var _={};return l.forEachNode(function(A){_[A]=T(N++,{})}),_}l.updateEachNodeAttributes(function(A,R){return T(N++,R),R},{attributes:s})}var a=r.bind(null,!1);return a.assign=r.bind(null,!0),wn=a,wn}var Gd=Od();const Fd=He(Gd);function $d(t={}){return St(Fd,t)}var kt={},vo;function jr(){if(vo)return kt;vo=1;function t(r){return typeof r!="number"||isNaN(r)?1:r}function e(r,a){var o={},l=function(c){return typeof c>"u"?a:c};typeof a=="function"&&(l=a);var i=function(c){return l(c[r])},s=function(){return l(void 0)};return typeof r=="string"?(o.fromAttributes=i,o.fromGraph=function(c,u){return i(c.getNodeAttributes(u))},o.fromEntry=function(c,u){return i(u)}):typeof r=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},o.fromGraph=function(c,u){return l(r(u,c.getNodeAttributes(u)))},o.fromEntry=function(c,u){return l(r(c,u))}):(o.fromAttributes=s,o.fromGraph=s,o.fromEntry=s),o}function n(r,a){var o={},l=function(c){return typeof c>"u"?a:c};typeof a=="function"&&(l=a);var i=function(c){return l(c[r])},s=function(){return l(void 0)};return typeof r=="string"?(o.fromAttributes=i,o.fromGraph=function(c,u){return i(c.getEdgeAttributes(u))},o.fromEntry=function(c,u){return i(u)},o.fromPartialEntry=o.fromEntry,o.fromMinimalEntry=o.fromEntry):typeof r=="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(r(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,b,y){return l(r(c,u,f,h,d,b,y))},o.fromPartialEntry=function(c,u,f,h){return l(r(c,u,f,h))},o.fromMinimalEntry=function(c,u){return l(r(c,u))}):(o.fromAttributes=s,o.fromGraph=s,o.fromEntry=s,o.fromMinimalEntry=s),o}return kt.createNodeValueGetter=e,kt.createEdgeValueGetter=n,kt.createEdgeWeightGetter=function(r){return n(r,t)},kt}var xn,yo;function fs(){if(yo)return xn;yo=1;const{createNodeValueGetter:t,createEdgeValueGetter:e}=jr();return xn=function(r,a,o){const{nodeXAttribute:l,nodeYAttribute:i}=o,{attraction:s,repulsion:c,gravity:u,inertia:f,maxMove:h}=o.settings;let{shouldSkipNode:d,shouldSkipEdge:b,isNodeFixed:y}=o;y=t(y),d=t(d,!1),b=e(b,!1);const T=r.filterNodes((A,R)=>!d.fromEntry(A,R)),N=T.length;for(let A=0;A<N;A++){const R=T[A],I=r.getNodeAttributes(R),D=a[R];D?a[R]={dx:D.dx*f,dy:D.dy*f,x:I[l]||0,y:I[i]||0}:a[R]={dx:0,dy:0,x:I[l]||0,y:I[i]||0}}if(c)for(let A=0;A<N;A++){const R=T[A],I=a[R];for(let D=A+1;D<N;D++){const m=T[D],S=a[m],x=S.x-I.x,k=S.y-I.y,L=Math.sqrt(x*x+k*k)||1,j=c/L*x,w=c/L*k;I.dx-=j,I.dy-=w,S.dx+=j,S.dy+=w}}if(s&&r.forEachEdge((A,R,I,D,m,S,x)=>{if(I===D||d.fromEntry(I,m)||d.fromEntry(D,S)||b.fromEntry(A,R,I,D,m,S,x))return;const k=a[I],L=a[D],j=L.x-k.x,w=L.y-k.y,V=Math.sqrt(j*j+w*w)||1,K=s*V*j,O=s*V*w;k.dx+=K,k.dy+=O,L.dx-=K,L.dy-=O}),u)for(let A=0;A<N;A++){const R=T[A],I=a[R],{x:D,y:m}=I,S=Math.sqrt(D*D+m*m)||1;a[R].dx-=D*u*S,a[R].dy-=m*u*S}const _=!1;for(let A=0;A<N;A++){const R=T[A],I=a[R],D=Math.sqrt(I.dx*I.dx+I.dy*I.dy);D>h&&(I.dx*=h/D,I.dy*=h/D),y.fromGraph(r,R)?I.fixed=!0:(I.x+=I.dx,I.y+=I.dy,I.fixed=!1)}return{converged:_}},xn}var Pt={},bo;function hs(){return bo||(bo=1,Pt.assignLayoutChanges=function(t,e,n){const{nodeXAttribute:r,nodeYAttribute:a}=n;t.updateEachNodeAttributes((o,l)=>{const i=e[o];return!i||i.fixed||(l[r]=i.x,l[a]=i.y),l},{attributes:["x","y"]})},Pt.collectLayoutChanges=function(t){const e={};for(const n in t){const r=t[n];e[n]={x:r.x,y:r.y}}return e}),Pt}var En,wo;function gs(){return wo||(wo=1,En={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),En}var Sn,xo;function Md(){if(xo)return Sn;xo=1;const t=We(),e=At(),n=fs(),r=hs(),a=gs();function o(i,s,c){if(!t(s))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=e(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=n(s,f,c),!h.converged);d++);if(i){r.assignLayoutChanges(s,f,c);return}return r.collectLayoutChanges(f)}const l=o.bind(null,!1);return l.assign=o.bind(null,!0),Sn=l,Sn}var Hd=Md();const Bd=He(Hd);var _n,Eo;function Vd(){if(Eo)return _n;Eo=1;const t=We(),e=At(),n=fs(),r=hs(),a=gs();function o(l,i){if(!t(l))throw new Error("graphology-layout-force/worker: the given graph is not a valid graphology instance.");i=e(i,a),this.callbacks={},i.onConverged&&(this.callbacks.onConverged=i.onConverged),this.graph=l,this.params=i,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}=n(this.graph,this.nodeStates,this.params);r.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},_n=o,_n}var Ud=Vd();const qd=He(Ud);function Wd(t={maxIterations:100}){return St(Bd,t)}function Xd(t={}){return Ar(qd,t)}var Cn,So;function Yd(){if(So)return Cn;So=1;var t=0,e=1,n=2,r=3,a=4,o=5,l=6,i=7,s=8,c=9,u=0,f=1,h=2,d=0,b=1,y=2,T=3,N=4,_=5,A=6,R=7,I=8,D=3,m=10,S=3,x=9,k=10;return Cn=function(j,w,V){var K,O,C,E,H,ae,$,v,z,B,M=w.length,J=V.length,X=j.adjustSizes,Y=j.barnesHutTheta*j.barnesHutTheta,ie,re,se,F,Q,q,U,P=[];for(C=0;C<M;C+=m)w[C+a]=w[C+n],w[C+o]=w[C+r],w[C+n]=0,w[C+r]=0;if(j.outboundAttractionDistribution){for(ie=0,C=0;C<M;C+=m)ie+=w[C+l];ie/=M/m}if(j.barnesHutOptimize){var oe=1/0,ue=-1/0,te=1/0,Z=-1/0,G,ge,pe;for(C=0;C<M;C+=m)oe=Math.min(oe,w[C+t]),ue=Math.max(ue,w[C+t]),te=Math.min(te,w[C+e]),Z=Math.max(Z,w[C+e]);var ye=ue-oe,we=Z-te;for(ye>we?(te-=(ye-we)/2,Z=te+ye):(oe-=(we-ye)/2,ue=oe+we),P[0+d]=-1,P[0+b]=(oe+ue)/2,P[0+y]=(te+Z)/2,P[0+T]=Math.max(ue-oe,Z-te),P[0+N]=-1,P[0+_]=-1,P[0+A]=0,P[0+R]=0,P[0+I]=0,K=1,C=0;C<M;C+=m)for(O=0,pe=D;;)if(P[O+_]>=0){w[C+t]<P[O+b]?w[C+e]<P[O+y]?G=P[O+_]:G=P[O+_]+x:w[C+e]<P[O+y]?G=P[O+_]+x*2:G=P[O+_]+x*3,P[O+R]=(P[O+R]*P[O+A]+w[C+t]*w[C+l])/(P[O+A]+w[C+l]),P[O+I]=(P[O+I]*P[O+A]+w[C+e]*w[C+l])/(P[O+A]+w[C+l]),P[O+A]+=w[C+l],O=G;continue}else if(P[O+d]<0){P[O+d]=C;break}else{if(P[O+_]=K*x,v=P[O+T]/2,z=P[O+_],P[z+d]=-1,P[z+b]=P[O+b]-v,P[z+y]=P[O+y]-v,P[z+T]=v,P[z+N]=z+x,P[z+_]=-1,P[z+A]=0,P[z+R]=0,P[z+I]=0,z+=x,P[z+d]=-1,P[z+b]=P[O+b]-v,P[z+y]=P[O+y]+v,P[z+T]=v,P[z+N]=z+x,P[z+_]=-1,P[z+A]=0,P[z+R]=0,P[z+I]=0,z+=x,P[z+d]=-1,P[z+b]=P[O+b]+v,P[z+y]=P[O+y]-v,P[z+T]=v,P[z+N]=z+x,P[z+_]=-1,P[z+A]=0,P[z+R]=0,P[z+I]=0,z+=x,P[z+d]=-1,P[z+b]=P[O+b]+v,P[z+y]=P[O+y]+v,P[z+T]=v,P[z+N]=P[O+N],P[z+_]=-1,P[z+A]=0,P[z+R]=0,P[z+I]=0,K+=4,w[P[O+d]+t]<P[O+b]?w[P[O+d]+e]<P[O+y]?G=P[O+_]:G=P[O+_]+x:w[P[O+d]+e]<P[O+y]?G=P[O+_]+x*2:G=P[O+_]+x*3,P[O+A]=w[P[O+d]+l],P[O+R]=w[P[O+d]+t],P[O+I]=w[P[O+d]+e],P[G+d]=P[O+d],P[O+d]=-1,w[C+t]<P[O+b]?w[C+e]<P[O+y]?ge=P[O+_]:ge=P[O+_]+x:w[C+e]<P[O+y]?ge=P[O+_]+x*2:ge=P[O+_]+x*3,G===ge)if(pe--){O=G;continue}else{pe=D;break}P[ge+d]=C;break}}if(j.barnesHutOptimize)for(re=j.scalingRatio,C=0;C<M;C+=m)for(O=0;;)if(P[O+_]>=0)if(q=Math.pow(w[C+t]-P[O+R],2)+Math.pow(w[C+e]-P[O+I],2),B=P[O+T],4*B*B/q<Y){if(se=w[C+t]-P[O+R],F=w[C+e]-P[O+I],X===!0?q>0?(U=re*w[C+l]*P[O+A]/q,w[C+n]+=se*U,w[C+r]+=F*U):q<0&&(U=-re*w[C+l]*P[O+A]/Math.sqrt(q),w[C+n]+=se*U,w[C+r]+=F*U):q>0&&(U=re*w[C+l]*P[O+A]/q,w[C+n]+=se*U,w[C+r]+=F*U),O=P[O+N],O<0)break;continue}else{O=P[O+_];continue}else{if(ae=P[O+d],ae>=0&&ae!==C&&(se=w[C+t]-w[ae+t],F=w[C+e]-w[ae+e],q=se*se+F*F,X===!0?q>0?(U=re*w[C+l]*w[ae+l]/q,w[C+n]+=se*U,w[C+r]+=F*U):q<0&&(U=-re*w[C+l]*w[ae+l]/Math.sqrt(q),w[C+n]+=se*U,w[C+r]+=F*U):q>0&&(U=re*w[C+l]*w[ae+l]/q,w[C+n]+=se*U,w[C+r]+=F*U)),O=P[O+N],O<0)break;continue}else for(re=j.scalingRatio,E=0;E<M;E+=m)for(H=0;H<E;H+=m)se=w[E+t]-w[H+t],F=w[E+e]-w[H+e],X===!0?(q=Math.sqrt(se*se+F*F)-w[E+s]-w[H+s],q>0?(U=re*w[E+l]*w[H+l]/q/q,w[E+n]+=se*U,w[E+r]+=F*U,w[H+n]-=se*U,w[H+r]-=F*U):q<0&&(U=100*re*w[E+l]*w[H+l],w[E+n]+=se*U,w[E+r]+=F*U,w[H+n]-=se*U,w[H+r]-=F*U)):(q=Math.sqrt(se*se+F*F),q>0&&(U=re*w[E+l]*w[H+l]/q/q,w[E+n]+=se*U,w[E+r]+=F*U,w[H+n]-=se*U,w[H+r]-=F*U));for(z=j.gravity/j.scalingRatio,re=j.scalingRatio,C=0;C<M;C+=m)U=0,se=w[C+t],F=w[C+e],q=Math.sqrt(Math.pow(se,2)+Math.pow(F,2)),j.strongGravityMode?q>0&&(U=re*w[C+l]*z):q>0&&(U=re*w[C+l]*z/q),w[C+n]-=se*U,w[C+r]-=F*U;for(re=1*(j.outboundAttractionDistribution?ie:1),$=0;$<J;$+=S)E=V[$+u],H=V[$+f],v=V[$+h],Q=Math.pow(v,j.edgeWeightInfluence),se=w[E+t]-w[H+t],F=w[E+e]-w[H+e],X===!0?(q=Math.sqrt(se*se+F*F)-w[E+s]-w[H+s],j.linLogMode?j.outboundAttractionDistribution?q>0&&(U=-re*Q*Math.log(1+q)/q/w[E+l]):q>0&&(U=-re*Q*Math.log(1+q)/q):j.outboundAttractionDistribution?q>0&&(U=-re*Q/w[E+l]):q>0&&(U=-re*Q)):(q=Math.sqrt(Math.pow(se,2)+Math.pow(F,2)),j.linLogMode?j.outboundAttractionDistribution?q>0&&(U=-re*Q*Math.log(1+q)/q/w[E+l]):q>0&&(U=-re*Q*Math.log(1+q)/q):j.outboundAttractionDistribution?(q=1,U=-re*Q/w[E+l]):(q=1,U=-re*Q)),q>0&&(w[E+n]+=se*U,w[E+r]+=F*U,w[H+n]-=se*U,w[H+r]-=F*U);var de,me,Ie,ke,Te,Pe;if(X===!0)for(C=0;C<M;C+=m)w[C+c]!==1&&(de=Math.sqrt(Math.pow(w[C+n],2)+Math.pow(w[C+r],2)),de>k&&(w[C+n]=w[C+n]*k/de,w[C+r]=w[C+r]*k/de),me=w[C+l]*Math.sqrt((w[C+a]-w[C+n])*(w[C+a]-w[C+n])+(w[C+o]-w[C+r])*(w[C+o]-w[C+r])),Ie=Math.sqrt((w[C+a]+w[C+n])*(w[C+a]+w[C+n])+(w[C+o]+w[C+r])*(w[C+o]+w[C+r]))/2,ke=.1*Math.log(1+Ie)/(1+Math.sqrt(me)),Te=w[C+t]+w[C+n]*(ke/j.slowDown),w[C+t]=Te,Pe=w[C+e]+w[C+r]*(ke/j.slowDown),w[C+e]=Pe);else for(C=0;C<M;C+=m)w[C+c]!==1&&(me=w[C+l]*Math.sqrt((w[C+a]-w[C+n])*(w[C+a]-w[C+n])+(w[C+o]-w[C+r])*(w[C+o]-w[C+r])),Ie=Math.sqrt((w[C+a]+w[C+n])*(w[C+a]+w[C+n])+(w[C+o]+w[C+r])*(w[C+o]+w[C+r]))/2,ke=w[C+i]*Math.log(1+Ie)/(1+Math.sqrt(me)),w[C+i]=Math.min(1,Math.sqrt(ke*(Math.pow(w[C+n],2)+Math.pow(w[C+r],2))/(1+Math.sqrt(me)))),Te=w[C+t]+w[C+n]*(ke/j.slowDown),w[C+t]=Te,Pe=w[C+e]+w[C+r]*(ke/j.slowDown),w[C+e]=Pe);return{}},Cn}var qe={},_o;function ps(){if(_o)return qe;_o=1;var t=10,e=3;return qe.assign=function(n){n=n||{};var r=Array.prototype.slice.call(arguments).slice(1),a,o,l;for(a=0,l=r.length;a<l;a++)if(r[a])for(o in r[a])n[o]=r[a][o];return n},qe.validateSettings=function(n){return"linLogMode"in n&&typeof n.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in n&&typeof n.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in n&&typeof n.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in n&&typeof n.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in n&&!(typeof n.scalingRatio=="number"&&n.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},qe.graphToByteArrays=function(n,r){var a=n.order,o=n.size,l={},i,s=new Float32Array(a*t),c=new Float32Array(o*e);return i=0,n.forEachNode(function(u,f){l[u]=i,s[i]=f.x,s[i+1]=f.y,s[i+2]=0,s[i+3]=0,s[i+4]=0,s[i+5]=0,s[i+6]=1,s[i+7]=1,s[i+8]=f.size||1,s[i+9]=f.fixed?1:0,i+=t}),i=0,n.forEachEdge(function(u,f,h,d,b,y,T){var N=l[h],_=l[d],A=r(u,f,h,d,b,y,T);s[N+6]+=A,s[_+6]+=A,c[i]=N,c[i+1]=_,c[i+2]=A,i+=e}),{nodes:s,edges:c}},qe.assignLayoutChanges=function(n,r,a){var o=0;n.updateEachNodeAttributes(function(l,i){return i.x=r[o],i.y=r[o+1],o+=t,a?a(l,i):i})},qe.readGraphPositions=function(n,r){var a=0;n.forEachNode(function(o,l){r[a]=l.x,r[a+1]=l.y,a+=t})},qe.collectLayoutChanges=function(n,r,a){for(var o=n.nodes(),l={},i=0,s=0,c=r.length;i<c;i+=t){if(a){var u=Object.assign({},n.getNodeAttributes(o[s]));u.x=r[i],u.y=r[i+1],u=a(o[s],u),l[o[s]]={x:u.x,y:u.y}}else l[o[s]]={x:r[i],y:r[i+1]};s++}return l},qe.createWorker=function(r){var a=window.URL||window.webkitURL,o=r.toString(),l=a.createObjectURL(new Blob(["("+o+").call(this);"],{type:"text/javascript"})),i=new Worker(l);return a.revokeObjectURL(l),i},qe}var kn,Co;function ms(){return Co||(Co=1,kn={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),kn}var Tn,ko;function Kd(){if(ko)return Tn;ko=1;var t=We(),e=jr().createEdgeWeightGetter,n=Yd(),r=ps(),a=ms();function o(s,c,u){if(!t(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=e("getEdgeWeight"in u?u.getEdgeWeight:"weight").fromEntry,d=typeof u.outputReducer=="function"?u.outputReducer:null,b=r.assign({},a,u.settings),y=r.validateSettings(b);if(y)throw new Error("graphology-layout-forceatlas2: "+y.message);var T=r.graphToByteArrays(c,h),N;for(N=0;N<f;N++)n(b,T.nodes,T.edges);if(s){r.assignLayoutChanges(c,T.nodes,d);return}return r.collectLayoutChanges(c,T.nodes)}function l(s){var c=typeof s=="number"?s:s.order;return{barnesHutOptimize:c>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(c)}}var i=o.bind(null,!1);return i.assign=o.bind(null,!0),i.inferSettings=l,Tn=i,Tn}var Qd=Kd();const Jd=He(Qd);var Rn,To;function Zd(){return To||(To=1,Rn=function(){var e,n,r={};(function(){var o=0,l=1,i=2,s=3,c=4,u=5,f=6,h=7,d=8,b=9,y=0,T=1,N=2,_=0,A=1,R=2,I=3,D=4,m=5,S=6,x=7,k=8,L=3,j=10,w=3,V=9,K=10;r.exports=function(C,E,H){var ae,$,v,z,B,M,J,X,Y,ie,re=E.length,se=H.length,F=C.adjustSizes,Q=C.barnesHutTheta*C.barnesHutTheta,q,U,P,oe,ue,te,Z,G=[];for(v=0;v<re;v+=j)E[v+c]=E[v+i],E[v+u]=E[v+s],E[v+i]=0,E[v+s]=0;if(C.outboundAttractionDistribution){for(q=0,v=0;v<re;v+=j)q+=E[v+f];q/=re/j}if(C.barnesHutOptimize){var ge=1/0,pe=-1/0,ye=1/0,we=-1/0,de,me,Ie;for(v=0;v<re;v+=j)ge=Math.min(ge,E[v+o]),pe=Math.max(pe,E[v+o]),ye=Math.min(ye,E[v+l]),we=Math.max(we,E[v+l]);var ke=pe-ge,Te=we-ye;for(ke>Te?(ye-=(ke-Te)/2,we=ye+ke):(ge-=(Te-ke)/2,pe=ge+Te),G[0+_]=-1,G[0+A]=(ge+pe)/2,G[0+R]=(ye+we)/2,G[0+I]=Math.max(pe-ge,we-ye),G[0+D]=-1,G[0+m]=-1,G[0+S]=0,G[0+x]=0,G[0+k]=0,ae=1,v=0;v<re;v+=j)for($=0,Ie=L;;)if(G[$+m]>=0){E[v+o]<G[$+A]?E[v+l]<G[$+R]?de=G[$+m]:de=G[$+m]+V:E[v+l]<G[$+R]?de=G[$+m]+V*2:de=G[$+m]+V*3,G[$+x]=(G[$+x]*G[$+S]+E[v+o]*E[v+f])/(G[$+S]+E[v+f]),G[$+k]=(G[$+k]*G[$+S]+E[v+l]*E[v+f])/(G[$+S]+E[v+f]),G[$+S]+=E[v+f],$=de;continue}else if(G[$+_]<0){G[$+_]=v;break}else{if(G[$+m]=ae*V,X=G[$+I]/2,Y=G[$+m],G[Y+_]=-1,G[Y+A]=G[$+A]-X,G[Y+R]=G[$+R]-X,G[Y+I]=X,G[Y+D]=Y+V,G[Y+m]=-1,G[Y+S]=0,G[Y+x]=0,G[Y+k]=0,Y+=V,G[Y+_]=-1,G[Y+A]=G[$+A]-X,G[Y+R]=G[$+R]+X,G[Y+I]=X,G[Y+D]=Y+V,G[Y+m]=-1,G[Y+S]=0,G[Y+x]=0,G[Y+k]=0,Y+=V,G[Y+_]=-1,G[Y+A]=G[$+A]+X,G[Y+R]=G[$+R]-X,G[Y+I]=X,G[Y+D]=Y+V,G[Y+m]=-1,G[Y+S]=0,G[Y+x]=0,G[Y+k]=0,Y+=V,G[Y+_]=-1,G[Y+A]=G[$+A]+X,G[Y+R]=G[$+R]+X,G[Y+I]=X,G[Y+D]=G[$+D],G[Y+m]=-1,G[Y+S]=0,G[Y+x]=0,G[Y+k]=0,ae+=4,E[G[$+_]+o]<G[$+A]?E[G[$+_]+l]<G[$+R]?de=G[$+m]:de=G[$+m]+V:E[G[$+_]+l]<G[$+R]?de=G[$+m]+V*2:de=G[$+m]+V*3,G[$+S]=E[G[$+_]+f],G[$+x]=E[G[$+_]+o],G[$+k]=E[G[$+_]+l],G[de+_]=G[$+_],G[$+_]=-1,E[v+o]<G[$+A]?E[v+l]<G[$+R]?me=G[$+m]:me=G[$+m]+V:E[v+l]<G[$+R]?me=G[$+m]+V*2:me=G[$+m]+V*3,de===me)if(Ie--){$=de;continue}else{Ie=L;break}G[me+_]=v;break}}if(C.barnesHutOptimize)for(U=C.scalingRatio,v=0;v<re;v+=j)for($=0;;)if(G[$+m]>=0)if(te=Math.pow(E[v+o]-G[$+x],2)+Math.pow(E[v+l]-G[$+k],2),ie=G[$+I],4*ie*ie/te<Q){if(P=E[v+o]-G[$+x],oe=E[v+l]-G[$+k],F===!0?te>0?(Z=U*E[v+f]*G[$+S]/te,E[v+i]+=P*Z,E[v+s]+=oe*Z):te<0&&(Z=-U*E[v+f]*G[$+S]/Math.sqrt(te),E[v+i]+=P*Z,E[v+s]+=oe*Z):te>0&&(Z=U*E[v+f]*G[$+S]/te,E[v+i]+=P*Z,E[v+s]+=oe*Z),$=G[$+D],$<0)break;continue}else{$=G[$+m];continue}else{if(M=G[$+_],M>=0&&M!==v&&(P=E[v+o]-E[M+o],oe=E[v+l]-E[M+l],te=P*P+oe*oe,F===!0?te>0?(Z=U*E[v+f]*E[M+f]/te,E[v+i]+=P*Z,E[v+s]+=oe*Z):te<0&&(Z=-U*E[v+f]*E[M+f]/Math.sqrt(te),E[v+i]+=P*Z,E[v+s]+=oe*Z):te>0&&(Z=U*E[v+f]*E[M+f]/te,E[v+i]+=P*Z,E[v+s]+=oe*Z)),$=G[$+D],$<0)break;continue}else for(U=C.scalingRatio,z=0;z<re;z+=j)for(B=0;B<z;B+=j)P=E[z+o]-E[B+o],oe=E[z+l]-E[B+l],F===!0?(te=Math.sqrt(P*P+oe*oe)-E[z+d]-E[B+d],te>0?(Z=U*E[z+f]*E[B+f]/te/te,E[z+i]+=P*Z,E[z+s]+=oe*Z,E[B+i]-=P*Z,E[B+s]-=oe*Z):te<0&&(Z=100*U*E[z+f]*E[B+f],E[z+i]+=P*Z,E[z+s]+=oe*Z,E[B+i]-=P*Z,E[B+s]-=oe*Z)):(te=Math.sqrt(P*P+oe*oe),te>0&&(Z=U*E[z+f]*E[B+f]/te/te,E[z+i]+=P*Z,E[z+s]+=oe*Z,E[B+i]-=P*Z,E[B+s]-=oe*Z));for(Y=C.gravity/C.scalingRatio,U=C.scalingRatio,v=0;v<re;v+=j)Z=0,P=E[v+o],oe=E[v+l],te=Math.sqrt(Math.pow(P,2)+Math.pow(oe,2)),C.strongGravityMode?te>0&&(Z=U*E[v+f]*Y):te>0&&(Z=U*E[v+f]*Y/te),E[v+i]-=P*Z,E[v+s]-=oe*Z;for(U=1*(C.outboundAttractionDistribution?q:1),J=0;J<se;J+=w)z=H[J+y],B=H[J+T],X=H[J+N],ue=Math.pow(X,C.edgeWeightInfluence),P=E[z+o]-E[B+o],oe=E[z+l]-E[B+l],F===!0?(te=Math.sqrt(P*P+oe*oe)-E[z+d]-E[B+d],C.linLogMode?C.outboundAttractionDistribution?te>0&&(Z=-U*ue*Math.log(1+te)/te/E[z+f]):te>0&&(Z=-U*ue*Math.log(1+te)/te):C.outboundAttractionDistribution?te>0&&(Z=-U*ue/E[z+f]):te>0&&(Z=-U*ue)):(te=Math.sqrt(Math.pow(P,2)+Math.pow(oe,2)),C.linLogMode?C.outboundAttractionDistribution?te>0&&(Z=-U*ue*Math.log(1+te)/te/E[z+f]):te>0&&(Z=-U*ue*Math.log(1+te)/te):C.outboundAttractionDistribution?(te=1,Z=-U*ue/E[z+f]):(te=1,Z=-U*ue)),te>0&&(E[z+i]+=P*Z,E[z+s]+=oe*Z,E[B+i]-=P*Z,E[B+s]-=oe*Z);var Pe,Ye,Ke,Re,st,ze;if(F===!0)for(v=0;v<re;v+=j)E[v+b]!==1&&(Pe=Math.sqrt(Math.pow(E[v+i],2)+Math.pow(E[v+s],2)),Pe>K&&(E[v+i]=E[v+i]*K/Pe,E[v+s]=E[v+s]*K/Pe),Ye=E[v+f]*Math.sqrt((E[v+c]-E[v+i])*(E[v+c]-E[v+i])+(E[v+u]-E[v+s])*(E[v+u]-E[v+s])),Ke=Math.sqrt((E[v+c]+E[v+i])*(E[v+c]+E[v+i])+(E[v+u]+E[v+s])*(E[v+u]+E[v+s]))/2,Re=.1*Math.log(1+Ke)/(1+Math.sqrt(Ye)),st=E[v+o]+E[v+i]*(Re/C.slowDown),E[v+o]=st,ze=E[v+l]+E[v+s]*(Re/C.slowDown),E[v+l]=ze);else for(v=0;v<re;v+=j)E[v+b]!==1&&(Ye=E[v+f]*Math.sqrt((E[v+c]-E[v+i])*(E[v+c]-E[v+i])+(E[v+u]-E[v+s])*(E[v+u]-E[v+s])),Ke=Math.sqrt((E[v+c]+E[v+i])*(E[v+c]+E[v+i])+(E[v+u]+E[v+s])*(E[v+u]+E[v+s]))/2,Re=E[v+h]*Math.log(1+Ke)/(1+Math.sqrt(Ye)),E[v+h]=Math.min(1,Math.sqrt(Re*(Math.pow(E[v+i],2)+Math.pow(E[v+s],2))/(1+Math.sqrt(Ye)))),st=E[v+o]+E[v+i]*(Re/C.slowDown),E[v+o]=st,ze=E[v+l]+E[v+s]*(Re/C.slowDown),E[v+l]=ze);return{}}})();var a=r.exports;self.addEventListener("message",function(o){var l=o.data;e=new Float32Array(l.nodes),l.edges&&(n=new Float32Array(l.edges)),a(l.settings,e,n),self.postMessage({nodes:e.buffer},[e.buffer])})}),Rn}var An,Ro;function ef(){if(Ro)return An;Ro=1;var t=Zd(),e=We(),n=jr().createEdgeWeightGetter,r=ps(),a=ms();function o(l,i){if(i=i||{},!e(l))throw new Error("graphology-layout-forceatlas2/worker: the given graph is not a valid graphology instance.");var s=n("getEdgeWeight"in i?i.getEdgeWeight:"weight").fromEntry,c=r.assign({},a,i.settings),u=r.validateSettings(c);if(u)throw new Error("graphology-layout-forceatlas2/worker: "+u.message);this.worker=null,this.graph=l,this.settings=c,this.getEdgeWeight=s,this.matrices=null,this.running=!1,this.killed=!1,this.outputReducer=typeof i.outputReducer=="function"?i.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=r.createWorker(t),this.worker.addEventListener("message",this.handleMessage),this.running&&(this.running=!1,this.start())},o.prototype.handleMessage=function(l){if(this.running){var i=new Float32Array(l.data.nodes);r.assignLayoutChanges(this.graph,i,this.outputReducer),this.outputReducer&&r.readGraphPositions(this.graph,i),this.matrices.nodes=i,this.askForIterations()}},o.prototype.askForIterations=function(l){var i=this.matrices,s={settings:this.settings,nodes:i.nodes.buffer},c=[i.nodes.buffer];return l&&(s.edges=i.edges.buffer,c.push(i.edges.buffer)),this.worker.postMessage(s,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=r.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)},An=o,An}var tf=ef();const nf=He(tf);function vs(t={iterations:100}){return St(Jd,t)}function rf(t={}){return Ar(nf,t)}var jn,Ao;function of(){if(Ao)return jn;Ao=1;var t=0,e=1,n=2,r=3;function a(l,i){return l+"§"+i}function o(){return .01*(.5-Math.random())}return jn=function(i,s){var c=i.margin,u=i.ratio,f=i.expansion,h=i.gridSize,d=i.speed,b,y,T,N,_,A,R=!0,I=s.length,D=I/r|0,m=new Float32Array(D),S=new Float32Array(D),x=1/0,k=1/0,L=-1/0,j=-1/0;for(b=0;b<I;b+=r)T=s[b+t],N=s[b+e],A=s[b+n]*u+c,x=Math.min(x,T-A),L=Math.max(L,T+A),k=Math.min(k,N-A),j=Math.max(j,N+A);var w=L-x,V=j-k,K=(x+L)/2,O=(k+j)/2;x=K-f*w/2,L=K+f*w/2,k=O-f*V/2,j=O+f*V/2;var C=new Array(h*h),E=C.length,H;for(H=0;H<E;H++)C[H]=[];var ae,$,v,z,B,M,J,X,Y,ie;for(b=0;b<I;b+=r)for(T=s[b+t],N=s[b+e],A=s[b+n]*u+c,ae=T-A,$=T+A,v=N-A,z=N+A,B=Math.floor(h*(ae-x)/(L-x)),M=Math.floor(h*($-x)/(L-x)),J=Math.floor(h*(v-k)/(j-k)),X=Math.floor(h*(z-k)/(j-k)),Y=B;Y<=M;Y++)for(ie=J;ie<=X;ie++)C[Y*h+ie].push(b);var re,se=new Set,F,Q,q,U,P,oe,ue,te,Z,G,ge,pe,ye;for(H=0;H<E;H++)for(re=C[H],b=0,_=re.length;b<_;b++)for(F=re[b],q=s[F+t],P=s[F+e],ue=s[F+n],y=b+1;y<_;y++)Q=re[y],Z=a(F,Q),!(E>1&&se.has(Z))&&(E>1&&se.add(Z),U=s[Q+t],oe=s[Q+e],te=s[Q+n],G=U-q,ge=oe-P,pe=Math.sqrt(G*G+ge*ge),ye=pe<ue*u+c+(te*u+c),ye&&(R=!1,Q=Q/r|0,pe>0?(m[Q]+=G/pe*(1+ue),S[Q]+=ge/pe*(1+ue)):(m[Q]+=w*o(),S[Q]+=V*o())));for(b=0,y=0;b<I;b+=r,y++)s[b+t]+=m[y]*.1*d,s[b+e]+=S[y]*.1*d;return{converged:R}},jn}var lt={},jo;function ys(){if(jo)return lt;jo=1;var t=3;return lt.validateSettings=function(e){return"gridSize"in e&&typeof e.gridSize!="number"||e.gridSize<=0?{message:"the `gridSize` setting should be a positive number."}:"margin"in e&&typeof e.margin!="number"||e.margin<0?{message:"the `margin` setting should be 0 or a positive number."}:"expansion"in e&&typeof e.expansion!="number"||e.expansion<=0?{message:"the `expansion` setting should be a positive number."}:"ratio"in e&&typeof e.ratio!="number"||e.ratio<=0?{message:"the `ratio` setting should be a positive number."}:"speed"in e&&typeof e.speed!="number"||e.speed<=0?{message:"the `speed` setting should be a positive number."}:null},lt.graphToByteArray=function(e,n){var r=e.order,a=new Float32Array(r*t),o=0;return e.forEachNode(function(l,i){typeof n=="function"&&(i=n(l,i)),a[o]=i.x,a[o+1]=i.y,a[o+2]=i.size||1,o+=t}),a},lt.assignLayoutChanges=function(e,n,r){var a=0;e.forEachNode(function(o){var l={x:n[a],y:n[a+1]};typeof r=="function"&&(l=r(o,l)),e.mergeNodeAttributes(o,l),a+=t})},lt.collectLayoutChanges=function(e,n,r){var a={},o=0;return e.forEachNode(function(l){var i={x:n[o],y:n[o+1]};typeof r=="function"&&(i=r(l,i)),a[l]=i,o+=t}),a},lt.createWorker=function(n){var r=window.URL||window.webkitURL,a=n.toString(),o=r.createObjectURL(new Blob(["("+a+").call(this);"],{type:"text/javascript"})),l=new Worker(o);return r.revokeObjectURL(o),l},lt}var In,Io;function bs(){return Io||(Io=1,In={gridSize:20,margin:5,expansion:1.1,ratio:1,speed:3}),In}var Ln,Lo;function af(){if(Lo)return Ln;Lo=1;var t=We(),e=of(),n=ys(),r=bs(),a=500;function o(i,s,c){if(!t(s))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({},r,c.settings),h=n.validateSettings(f);if(h)throw new Error("graphology-layout-noverlap: "+h.message);var d=n.graphToByteArray(s,c.inputReducer),b=!1,y;for(y=0;y<u&&!b;y++)b=e(f,d).converged;if(i){n.assignLayoutChanges(s,d,c.outputReducer);return}return n.collectLayoutChanges(s,d,c.outputReducer)}var l=o.bind(null,!1);return l.assign=o.bind(null,!0),Ln=l,Ln}var sf=af();const lf=He(sf);var Nn,No;function cf(){return No||(No=1,Nn=function(){var e,n={};(function(){var a=0,o=1,l=2,i=3;function s(u,f){return u+"§"+f}function c(){return .01*(.5-Math.random())}n.exports=function(f,h){var d=f.margin,b=f.ratio,y=f.expansion,T=f.gridSize,N=f.speed,_,A,R,I,D,m,S=!0,x=h.length,k=x/i|0,L=new Float32Array(k),j=new Float32Array(k),w=1/0,V=1/0,K=-1/0,O=-1/0;for(_=0;_<x;_+=i)R=h[_+a],I=h[_+o],m=h[_+l]*b+d,w=Math.min(w,R-m),K=Math.max(K,R+m),V=Math.min(V,I-m),O=Math.max(O,I+m);var C=K-w,E=O-V,H=(w+K)/2,ae=(V+O)/2;w=H-y*C/2,K=H+y*C/2,V=ae-y*E/2,O=ae+y*E/2;var $=new Array(T*T),v=$.length,z;for(z=0;z<v;z++)$[z]=[];var B,M,J,X,Y,ie,re,se,F,Q;for(_=0;_<x;_+=i)for(R=h[_+a],I=h[_+o],m=h[_+l]*b+d,B=R-m,M=R+m,J=I-m,X=I+m,Y=Math.floor(T*(B-w)/(K-w)),ie=Math.floor(T*(M-w)/(K-w)),re=Math.floor(T*(J-V)/(O-V)),se=Math.floor(T*(X-V)/(O-V)),F=Y;F<=ie;F++)for(Q=re;Q<=se;Q++)$[F*T+Q].push(_);var q,U=new Set,P,oe,ue,te,Z,G,ge,pe,ye,we,de,me,Ie;for(z=0;z<v;z++)for(q=$[z],_=0,D=q.length;_<D;_++)for(P=q[_],ue=h[P+a],Z=h[P+o],ge=h[P+l],A=_+1;A<D;A++)oe=q[A],ye=s(P,oe),!(v>1&&U.has(ye))&&(v>1&&U.add(ye),te=h[oe+a],G=h[oe+o],pe=h[oe+l],we=te-ue,de=G-Z,me=Math.sqrt(we*we+de*de),Ie=me<ge*b+d+(pe*b+d),Ie&&(S=!1,oe=oe/i|0,me>0?(L[oe]+=we/me*(1+ge),j[oe]+=de/me*(1+ge)):(L[oe]+=C*c(),j[oe]+=E*c())));for(_=0,A=0;_<x;_+=i,A++)h[_+a]+=L[A]*.1*N,h[_+o]+=j[A]*.1*N;return{converged:S}}})();var r=n.exports;self.addEventListener("message",function(a){var o=a.data;e=new Float32Array(o.nodes);var l=r(o.settings,e);self.postMessage({result:l,nodes:e.buffer},[e.buffer])})}),Nn}var Pn,Po;function uf(){if(Po)return Pn;Po=1;var t=cf(),e=We(),n=ys(),r=bs();function a(o,l){if(l=l||{},!e(o))throw new Error("graphology-layout-noverlap/worker: the given graph is not a valid graphology instance.");var i=Object.assign({},r,l.settings),s=n.validateSettings(i);if(s)throw new Error("graphology-layout-noverlap/worker: "+s.message);this.worker=null,this.graph=o,this.settings=i,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=n.createWorker(t),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(n.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},i=[o.nodes.buffer];return this.worker.postMessage(l,i),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:n.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)},Pn=a,Pn}var df=uf();const ff=He(df);function hf(t={}){return St(lf,t)}function gf(t={}){return Ar(ff,t)}var zn,zo;function pf(){if(zo)return zn;zo=1;var t=At(),e=We(),n={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function r(o,l,i){if(!e(l))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");i=t(i,n);var s=i.dimensions;if(!Array.isArray(s)||s.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=s.length,u=i.center,f=i.rng,h=i.scale,d=(u-.5)*h;function b(T){for(var N=0;N<c;N++)T[s[N]]=f()*h+d;return T}if(!o){var y={};return l.forEachNode(function(T){y[T]=b({})}),y}l.updateEachNodeAttributes(function(T,N){return b(N),N},{attributes:s})}var a=r.bind(null,!1);return a.assign=r.bind(null,!0),zn=a,zn}var mf=pf();const vf=He(mf);function yf(t={}){return St(vf,t)}var Do=1,bf=.9,wf=.8,xf=.17,Dn=.1,On=.999,Ef=.9999,Sf=.99,_f=/[\\\/_+.#"@\[\(\{&]/,Cf=/[\\\/_+.#"@\[\(\{&]/g,kf=/[\s-]/,ws=/[\s-]/g;function dr(t,e,n,r,a,o,l){if(o===e.length)return a===t.length?Do:Sf;var i=`${a},${o}`;if(l[i]!==void 0)return l[i];for(var s=r.charAt(o),c=n.indexOf(s,a),u=0,f,h,d,b;c>=0;)f=dr(t,e,n,r,c+1,o+1,l),f>u&&(c===a?f*=Do:_f.test(t.charAt(c-1))?(f*=wf,d=t.slice(a,c-1).match(Cf),d&&a>0&&(f*=Math.pow(On,d.length))):kf.test(t.charAt(c-1))?(f*=bf,b=t.slice(a,c-1).match(ws),b&&a>0&&(f*=Math.pow(On,b.length))):(f*=xf,a>0&&(f*=Math.pow(On,c-a))),t.charAt(c)!==e.charAt(o)&&(f*=Ef)),(f<Dn&&n.charAt(c-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(c-1)!==r.charAt(o))&&(h=dr(t,e,n,r,c+1,o+2,l),h*Dn>f&&(f=h*Dn)),f>u&&(u=f),c=n.indexOf(s,c+1);return l[i]=u,u}function Oo(t){return t.toLowerCase().replace(ws," ")}function Tf(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,dr(t,e,Oo(t),Oo(e),0,0,{})}var Gn={exports:{}},Fn={};/**
|
|
* @license React
|
|
* use-sync-external-store-shim.production.js
|
|
*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/var Go;function Rf(){if(Go)return Fn;Go=1;var t=hi();function e(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,o=t.useLayoutEffect,l=t.useDebugValue;function i(f,h){var d=h(),b=r({inst:{value:d,getSnapshot:h}}),y=b[0].inst,T=b[1];return o(function(){y.value=d,y.getSnapshot=h,s(y)&&T({inst:y})},[f,d,h]),a(function(){return s(y)&&T({inst:y}),f(function(){s(y)&&T({inst:y})})},[f]),l(d),d}function s(f){var h=f.getSnapshot;f=f.value;try{var d=h();return!n(f,d)}catch{return!0}}function c(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:i;return Fn.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Fn}var Fo;function Af(){return Fo||(Fo=1,Gn.exports=Rf()),Gn.exports}var jf=Af(),Tt='[cmdk-group=""]',$n='[cmdk-group-items=""]',If='[cmdk-group-heading=""]',Ir='[cmdk-item=""]',$o=`${Ir}:not([aria-disabled="true"])`,fr="cmdk-item-select",dt="data-value",Lf=(t,e,n)=>Tf(t,e,n),xs=p.createContext(void 0),jt=()=>p.useContext(xs),Es=p.createContext(void 0),Lr=()=>p.useContext(Es),Ss=p.createContext(void 0),_s=p.forwardRef((t,e)=>{let n=yt(()=>{var v,z;return{search:"",value:(z=(v=t.value)!=null?v:t.defaultValue)!=null?z:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=yt(()=>new Set),a=yt(()=>new Map),o=yt(()=>new Map),l=yt(()=>new Set),i=Cs(t),{label:s,children:c,value:u,onValueChange:f,filter:h,shouldFilter:d,loop:b,disablePointerSelection:y=!1,vimBindings:T=!0,...N}=t,_=ft(),A=ft(),R=ft(),I=p.useRef(null),D=Bf();gt(()=>{if(u!==void 0){let v=u.trim();n.current.value=v,m.emit()}},[u]),gt(()=>{D(6,w)},[]);let m=p.useMemo(()=>({subscribe:v=>(l.current.add(v),()=>l.current.delete(v)),snapshot:()=>n.current,setState:(v,z,B)=>{var M,J,X;if(!Object.is(n.current[v],z)){if(n.current[v]=z,v==="search")j(),k(),D(1,L);else if(v==="value"&&(B||D(5,w),((M=i.current)==null?void 0:M.value)!==void 0)){let Y=z??"";(X=(J=i.current).onValueChange)==null||X.call(J,Y);return}m.emit()}},emit:()=>{l.current.forEach(v=>v())}}),[]),S=p.useMemo(()=>({value:(v,z,B)=>{var M;z!==((M=o.current.get(v))==null?void 0:M.value)&&(o.current.set(v,{value:z,keywords:B}),n.current.filtered.items.set(v,x(z,B)),D(2,()=>{k(),m.emit()}))},item:(v,z)=>(r.current.add(v),z&&(a.current.has(z)?a.current.get(z).add(v):a.current.set(z,new Set([v]))),D(3,()=>{j(),k(),n.current.value||L(),m.emit()}),()=>{o.current.delete(v),r.current.delete(v),n.current.filtered.items.delete(v);let B=V();D(4,()=>{j(),(B==null?void 0:B.getAttribute("id"))===v&&L(),m.emit()})}),group:v=>(a.current.has(v)||a.current.set(v,new Set),()=>{o.current.delete(v),a.current.delete(v)}),filter:()=>i.current.shouldFilter,label:s||t["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:_,inputId:R,labelId:A,listInnerRef:I}),[]);function x(v,z){var B,M;let J=(M=(B=i.current)==null?void 0:B.filter)!=null?M:Lf;return v?J(v,n.current.search,z):0}function k(){if(!n.current.search||i.current.shouldFilter===!1)return;let v=n.current.filtered.items,z=[];n.current.filtered.groups.forEach(M=>{let J=a.current.get(M),X=0;J.forEach(Y=>{let ie=v.get(Y);X=Math.max(ie,X)}),z.push([M,X])});let B=I.current;K().sort((M,J)=>{var X,Y;let ie=M.getAttribute("id"),re=J.getAttribute("id");return((X=v.get(re))!=null?X:0)-((Y=v.get(ie))!=null?Y:0)}).forEach(M=>{let J=M.closest($n);J?J.appendChild(M.parentElement===J?M:M.closest(`${$n} > *`)):B.appendChild(M.parentElement===B?M:M.closest(`${$n} > *`))}),z.sort((M,J)=>J[1]-M[1]).forEach(M=>{var J;let X=(J=I.current)==null?void 0:J.querySelector(`${Tt}[${dt}="${encodeURIComponent(M[0])}"]`);X==null||X.parentElement.appendChild(X)})}function L(){let v=K().find(B=>B.getAttribute("aria-disabled")!=="true"),z=v==null?void 0:v.getAttribute(dt);m.setState("value",z||void 0)}function j(){var v,z,B,M;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let J=0;for(let X of r.current){let Y=(z=(v=o.current.get(X))==null?void 0:v.value)!=null?z:"",ie=(M=(B=o.current.get(X))==null?void 0:B.keywords)!=null?M:[],re=x(Y,ie);n.current.filtered.items.set(X,re),re>0&&J++}for(let[X,Y]of a.current)for(let ie of Y)if(n.current.filtered.items.get(ie)>0){n.current.filtered.groups.add(X);break}n.current.filtered.count=J}function w(){var v,z,B;let M=V();M&&(((v=M.parentElement)==null?void 0:v.firstChild)===M&&((B=(z=M.closest(Tt))==null?void 0:z.querySelector(If))==null||B.scrollIntoView({block:"nearest"})),M.scrollIntoView({block:"nearest"}))}function V(){var v;return(v=I.current)==null?void 0:v.querySelector(`${Ir}[aria-selected="true"]`)}function K(){var v;return Array.from(((v=I.current)==null?void 0:v.querySelectorAll($o))||[])}function O(v){let z=K()[v];z&&m.setState("value",z.getAttribute(dt))}function C(v){var z;let B=V(),M=K(),J=M.findIndex(Y=>Y===B),X=M[J+v];(z=i.current)!=null&&z.loop&&(X=J+v<0?M[M.length-1]:J+v===M.length?M[0]:M[J+v]),X&&m.setState("value",X.getAttribute(dt))}function E(v){let z=V(),B=z==null?void 0:z.closest(Tt),M;for(;B&&!M;)B=v>0?Mf(B,Tt):Hf(B,Tt),M=B==null?void 0:B.querySelector($o);M?m.setState("value",M.getAttribute(dt)):C(v)}let H=()=>O(K().length-1),ae=v=>{v.preventDefault(),v.metaKey?H():v.altKey?E(1):C(1)},$=v=>{v.preventDefault(),v.metaKey?O(0):v.altKey?E(-1):C(-1)};return p.createElement(Se.div,{ref:e,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:v=>{var z;if((z=N.onKeyDown)==null||z.call(N,v),!v.defaultPrevented)switch(v.key){case"n":case"j":{T&&v.ctrlKey&&ae(v);break}case"ArrowDown":{ae(v);break}case"p":case"k":{T&&v.ctrlKey&&$(v);break}case"ArrowUp":{$(v);break}case"Home":{v.preventDefault(),O(0);break}case"End":{v.preventDefault(),H();break}case"Enter":if(!v.nativeEvent.isComposing&&v.keyCode!==229){v.preventDefault();let B=V();if(B){let M=new Event(fr);B.dispatchEvent(M)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:S.inputId,id:S.labelId,style:Uf},s),ln(t,v=>p.createElement(Es.Provider,{value:m},p.createElement(xs.Provider,{value:S},v))))}),Nf=p.forwardRef((t,e)=>{var n,r;let a=ft(),o=p.useRef(null),l=p.useContext(Ss),i=jt(),s=Cs(t),c=(r=(n=s.current)==null?void 0:n.forceMount)!=null?r:l==null?void 0:l.forceMount;gt(()=>{if(!c)return i.item(a,l==null?void 0:l.id)},[c]);let u=ks(a,o,[t.value,t.children,o],t.keywords),f=Lr(),h=pt(D=>D.value&&D.value===u.current),d=pt(D=>c||i.filter()===!1?!0:D.search?D.filtered.items.get(a)>0:!0);p.useEffect(()=>{let D=o.current;if(!(!D||t.disabled))return D.addEventListener(fr,b),()=>D.removeEventListener(fr,b)},[d,t.onSelect,t.disabled]);function b(){var D,m;y(),(m=(D=s.current).onSelect)==null||m.call(D,u.current)}function y(){f.setState("value",u.current,!0)}if(!d)return null;let{disabled:T,value:N,onSelect:_,forceMount:A,keywords:R,...I}=t;return p.createElement(Se.div,{ref:Rt([o,e]),...I,id:a,"cmdk-item":"",role:"option","aria-disabled":!!T,"aria-selected":!!h,"data-disabled":!!T,"data-selected":!!h,onPointerMove:T||i.getDisablePointerSelection()?void 0:y,onClick:T?void 0:b},t.children)}),Pf=p.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:a,...o}=t,l=ft(),i=p.useRef(null),s=p.useRef(null),c=ft(),u=jt(),f=pt(d=>a||u.filter()===!1?!0:d.search?d.filtered.groups.has(l):!0);gt(()=>u.group(l),[]),ks(l,i,[t.value,t.heading,s]);let h=p.useMemo(()=>({id:l,forceMount:a}),[a]);return p.createElement(Se.div,{ref:Rt([i,e]),...o,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&p.createElement("div",{ref:s,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),ln(t,d=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},p.createElement(Ss.Provider,{value:h},d))))}),zf=p.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,a=p.useRef(null),o=pt(l=>!l.search);return!n&&!o?null:p.createElement(Se.div,{ref:Rt([a,e]),...r,"cmdk-separator":"",role:"separator"})}),Df=p.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,a=t.value!=null,o=Lr(),l=pt(u=>u.search),i=pt(u=>u.value),s=jt(),c=p.useMemo(()=>{var u;let f=(u=s.listInnerRef.current)==null?void 0:u.querySelector(`${Ir}[${dt}="${encodeURIComponent(i)}"]`);return f==null?void 0:f.getAttribute("id")},[]);return p.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),p.createElement(Se.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":s.listId,"aria-labelledby":s.labelId,"aria-activedescendant":c,id:s.inputId,type:"text",value:a?t.value:l,onChange:u=>{a||o.setState("search",u.target.value),n==null||n(u.target.value)}})}),Of=p.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...a}=t,o=p.useRef(null),l=p.useRef(null),i=jt();return p.useEffect(()=>{if(l.current&&o.current){let s=l.current,c=o.current,u,f=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let h=s.offsetHeight;c.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return f.observe(s),()=>{cancelAnimationFrame(u),f.unobserve(s)}}},[]),p.createElement(Se.div,{ref:Rt([o,e]),...a,"cmdk-list":"",role:"listbox","aria-label":r,id:i.listId},ln(t,s=>p.createElement("div",{ref:Rt([l,i.listInnerRef]),"cmdk-list-sizer":""},s)))}),Gf=p.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:o,container:l,...i}=t;return p.createElement(ba,{open:n,onOpenChange:r},p.createElement(ma,{container:l},p.createElement(wr,{"cmdk-overlay":"",className:a}),p.createElement(xr,{"aria-label":t.label,"cmdk-dialog":"",className:o},p.createElement(_s,{ref:e,...i}))))}),Ff=p.forwardRef((t,e)=>pt(n=>n.filtered.count===0)?p.createElement(Se.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),$f=p.forwardRef((t,e)=>{let{progress:n,children:r,label:a="Loading...",...o}=t;return p.createElement(Se.div,{ref:e,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},ln(t,l=>p.createElement("div",{"aria-hidden":!0},l)))}),je=Object.assign(_s,{List:Of,Item:Nf,Input:Df,Group:Pf,Separator:zf,Dialog:Gf,Empty:Ff,Loading:$f});function Mf(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Hf(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function Cs(t){let e=p.useRef(t);return gt(()=>{e.current=t}),e}var gt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function yt(t){let e=p.useRef();return e.current===void 0&&(e.current=t()),e}function Rt(t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}function pt(t){let e=Lr(),n=()=>t(e.snapshot());return jf.useSyncExternalStore(e.subscribe,n,n)}function ks(t,e,n,r=[]){let a=p.useRef(),o=jt();return gt(()=>{var l;let i=(()=>{var c;for(let u of n){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}})(),s=r.map(c=>c.trim());o.value(t,i,s),(l=e.current)==null||l.setAttribute(dt,i),a.current=i}),a}var Bf=()=>{let[t,e]=p.useState(),n=yt(()=>new Map);return gt(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,a)=>{n.current.set(r,a),e({})}};function Vf(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function ln({asChild:t,children:e},n){return t&&p.isValidElement(e)?p.cloneElement(Vf(e),{ref:e.ref},n(e.props.children)):n(e)}var Uf={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const cn=p.forwardRef(({className:t,...e},n)=>g.jsx(je,{ref:n,className:fe("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...e}));cn.displayName=je.displayName;const Nr=p.forwardRef(({className:t,...e},n)=>g.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[g.jsx(yu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),g.jsx(je.Input,{ref:n,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",t),...e})]}));Nr.displayName=je.Input.displayName;const un=p.forwardRef(({className:t,...e},n)=>g.jsx(je.List,{ref:n,className:fe("max-h-[300px] overflow-x-hidden overflow-y-auto",t),...e}));un.displayName=je.List.displayName;const Pr=p.forwardRef((t,e)=>g.jsx(je.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));Pr.displayName=je.Empty.displayName;const _t=p.forwardRef(({className:t,...e},n)=>g.jsx(je.Group,{ref:n,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",t),...e}));_t.displayName=je.Group.displayName;const qf=p.forwardRef(({className:t,...e},n)=>g.jsx(je.Separator,{ref:n,className:fe("bg-border -mx-1 h-px",t),...e}));qf.displayName=je.Separator.displayName;const Ct=p.forwardRef(({className:t,...e},n)=>g.jsx(je.Item,{ref:n,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",t),...e}));Ct.displayName=je.Item.displayName;const Wf=({layout:t,autoRunFor:e,mainLayout:n})=>{const r=Be(),[a,o]=p.useState(!1),l=p.useRef(null),{t:i}=xe(),s=p.useCallback(()=>{if(r)try{const u=r.getGraph();if(!u||u.order===0)return;const f=n.positions();fa(u,f,{duration:300})}catch(u){console.error("Error updating positions:",u),l.current&&(window.clearInterval(l.current),l.current=null,o(!1))}},[r,n]),c=p.useCallback(()=>{if(a){console.log("Stopping layout animation"),l.current&&(window.clearInterval(l.current),l.current=null);try{typeof t.kill=="function"?(t.kill(),console.log("Layout algorithm killed")):typeof t.stop=="function"&&(t.stop(),console.log("Layout algorithm stopped"))}catch(u){console.error("Error stopping layout algorithm:",u)}o(!1)}else console.log("Starting layout animation"),s(),l.current=window.setInterval(()=>{s()},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 t.kill=="function"?t.kill():typeof t.stop=="function"&&t.stop()}catch(u){console.error("Error stopping layout algorithm:",u)}}},3e3)},[a,t,s]);return p.useEffect(()=>{if(!r){console.log("No sigma instance available");return}let u=null;return e!==void 0&&e>-1&&r.getGraph().order>0&&(console.log("Auto-starting layout animation"),s(),l.current=window.setInterval(()=>{s()},200),o(!0),e>0&&(u=window.setTimeout(()=>{console.log("Auto-stopping layout animation after timeout"),l.current&&(window.clearInterval(l.current),l.current=null),o(!1)},e))),()=>{l.current&&(window.clearInterval(l.current),l.current=null),u&&window.clearTimeout(u),o(!1)}},[e,r,s]),g.jsx(be,{size:"icon",onClick:c,tooltip:i(a?"graphPanel.sideBar.layoutsControl.stopAnimation":"graphPanel.sideBar.layoutsControl.startAnimation"),variant:Le,children:a?g.jsx(ou,{}):g.jsx(lu,{})})},Xf=()=>{const t=Be(),{t:e}=xe(),[n,r]=p.useState("Circular"),[a,o]=p.useState(!1),l=ne.use.graphLayoutMaxIterations(),i=$d(),s=Dd(),c=yf(),u=hf({maxIterations:l,settings:{margin:5,expansion:1.1,gridSize:1,ratio:1,speed:3}}),f=Wd({maxIterations:l,settings:{attraction:3e-4,repulsion:.02,gravity:.02,inertia:.4,maxMove:100}}),h=vs({iterations:l}),d=gf(),b=Xd(),y=rf(),T=p.useMemo(()=>({Circular:{layout:i},Circlepack:{layout:s},Random:{layout:c},Noverlaps:{layout:u,worker:d},"Force Directed":{layout:f,worker:b},"Force Atlas":{layout:h,worker:y}}),[s,i,f,h,u,c,b,d,y]),N=p.useCallback(_=>{console.debug("Running layout:",_);const{positions:A}=T[_].layout;try{const R=t.getGraph();if(!R){console.error("No graph available");return}const I=A();console.log("Positions calculated, animating nodes"),fa(R,I,{duration:400}),r(_)}catch(R){console.error("Error running layout:",R)}},[T,t]);return g.jsxs("div",{children:[g.jsx("div",{children:T[n]&&"worker"in T[n]&&g.jsx(Wf,{layout:T[n].worker,mainLayout:T[n].layout})}),g.jsx("div",{children:g.jsxs(kr,{open:a,onOpenChange:o,children:[g.jsx(Tr,{asChild:!0,children:g.jsx(be,{size:"icon",variant:Le,onClick:()=>o(_=>!_),tooltip:e("graphPanel.sideBar.layoutsControl.layoutGraph"),children:g.jsx(Xc,{})})}),g.jsx(sn,{side:"right",align:"start",sideOffset:8,collisionPadding:5,sticky:"always",className:"p-1 min-w-auto",children:g.jsx(cn,{children:g.jsx(un,{children:g.jsx(_t,{children:Object.keys(T).map(_=>g.jsx(Ct,{onSelect:()=>{N(_)},className:"cursor-pointer text-xs",children:e(`graphPanel.sideBar.layoutsControl.layouts.${_}`)},_))})})})})]})})]})},Yf=()=>{const t=p.useContext(Ta);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},zt=t=>!!(t.type.startsWith("mouse")&&t.buttons!==0),Kf=({disableHoverEffect:t})=>{const e=Be(),n=ha(),r=yi(),a=ne.use.graphLayoutMaxIterations(),{assign:o}=vs({iterations:a}),{theme:l}=Yf(),i=ne.use.enableHideUnselectedEdges(),s=ne.use.enableEdgeEvents(),c=ne.use.showEdgeLabel(),u=ne.use.showNodeLabel(),f=ne.use.minEdgeSize(),h=ne.use.maxEdgeSize(),d=ee.use.selectedNode(),b=ee.use.focusedNode(),y=ee.use.selectedEdge(),T=ee.use.focusedEdge(),N=ee.use.sigmaGraph();return p.useEffect(()=>{if(N&&e){try{typeof e.setGraph=="function"?(e.setGraph(N),console.log("Binding graph to sigma instance")):(e.graph=N,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")}},[e,N,o,a]),p.useEffect(()=>{e&&(ee.getState().sigmaInstance||(console.log("Setting sigma instance from GraphControl"),ee.getState().setSigmaInstance(e)))},[e]),p.useEffect(()=>{const{setFocusedNode:_,setSelectedNode:A,setFocusedEdge:R,setSelectedEdge:I,clearSelection:D}=ee.getState(),m={enterNode:S=>{zt(S.event.original)||e.getGraph().hasNode(S.node)&&_(S.node)},leaveNode:S=>{zt(S.event.original)||_(null)},clickNode:S=>{e.getGraph().hasNode(S.node)&&(A(S.node),I(null))},clickStage:()=>D()};s&&(m.clickEdge=S=>{I(S.edge),A(null)},m.enterEdge=S=>{zt(S.event.original)||R(S.edge)},m.leaveEdge=S=>{zt(S.event.original)||R(null)}),n(m)},[n,s]),p.useEffect(()=>{if(e&&N){const _=e.getGraph();let A=Number.MAX_SAFE_INTEGER,R=0;_.forEachEdge(D=>{const m=_.getEdgeAttribute(D,"originalWeight")||1;typeof m=="number"&&(A=Math.min(A,m),R=Math.max(R,m))});const I=R-A;if(I>0){const D=h-f;_.forEachEdge(m=>{const S=_.getEdgeAttribute(m,"originalWeight")||1;if(typeof S=="number"){const x=f+D*Math.pow((S-A)/I,.5);_.setEdgeAttribute(m,"size",x)}})}else _.forEachEdge(D=>{_.setEdgeAttribute(D,"size",f)});e.refresh()}},[e,N,f,h]),p.useEffect(()=>{const _=l==="dark",A=_?Bi:void 0,R=_?Wi:void 0;r({enableEdgeEvents:s,renderEdgeLabels:c,renderLabels:u,nodeReducer:(I,D)=>{const m=e.getGraph(),S={...D,highlighted:D.highlighted||!1,labelColor:A};if(!t){S.highlighted=!1;const x=b||d,k=T||y;if(x&&m.hasNode(x))try{(I===x||m.neighbors(x).includes(I))&&(S.highlighted=!0,I===d&&(S.borderColor=qi))}catch(L){console.error("Error in nodeReducer:",L)}else if(k&&m.hasEdge(k))m.extremities(k).includes(I)&&(S.highlighted=!0,S.size=3);else return S;S.highlighted?_&&(S.labelColor=Vi):S.color=Ui}return S},edgeReducer:(I,D)=>{const m=e.getGraph(),S={...D,hidden:!1,labelColor:A,color:R};if(!t){const x=b||d;if(x&&m.hasNode(x))try{i?m.extremities(I).includes(x)||(S.hidden=!0):m.extremities(I).includes(x)&&(S.color=qr)}catch(k){console.error("Error in edgeReducer:",k)}else{const k=y&&m.hasEdge(y)?y:null,L=T&&m.hasEdge(T)?T:null;(k||L)&&(I===k?S.color=Xi:I===L?S.color=qr:i&&(S.hidden=!0))}}return S}})},[d,b,y,T,r,e,t,l,i,s,c,u]),null},Qf=()=>{const{zoomIn:t,zoomOut:e,reset:n}=ua({duration:200,factor:1.5}),r=Be(),{t:a}=xe(),o=p.useCallback(()=>t(),[t]),l=p.useCallback(()=>e(),[e]),i=p.useCallback(()=>{if(r)try{r.setCustomBBox(null),r.refresh();const u=r.getGraph();if(!(u!=null&&u.order)||u.nodes().length===0){n();return}r.getCamera().animate({x:.5,y:.5,ratio:1.1},{duration:1e3})}catch(u){console.error("Error resetting zoom:",u),n()}},[r,n]),s=p.useCallback(()=>{if(!r)return;const u=r.getCamera(),h=u.angle+Math.PI/8;u.animate({angle:h},{duration:200})},[r]),c=p.useCallback(()=>{if(!r)return;const u=r.getCamera(),h=u.angle-Math.PI/8;u.animate({angle:h},{duration:200})},[r]);return g.jsxs(g.Fragment,{children:[g.jsx(be,{variant:Le,onClick:s,tooltip:a("graphPanel.sideBar.zoomControl.rotateCamera"),size:"icon",children:g.jsx(gu,{})}),g.jsx(be,{variant:Le,onClick:c,tooltip:a("graphPanel.sideBar.zoomControl.rotateCameraCounterClockwise"),size:"icon",children:g.jsx(fu,{})}),g.jsx(be,{variant:Le,onClick:i,tooltip:a("graphPanel.sideBar.zoomControl.resetZoom"),size:"icon",children:g.jsx(Bc,{})}),g.jsx(be,{variant:Le,onClick:o,tooltip:a("graphPanel.sideBar.zoomControl.zoomIn"),size:"icon",children:g.jsx(Au,{})}),g.jsx(be,{variant:Le,onClick:l,tooltip:a("graphPanel.sideBar.zoomControl.zoomOut"),size:"icon",children:g.jsx(Iu,{})})]})},Jf=()=>{const{isFullScreen:t,toggle:e}=bi(),{t:n}=xe();return g.jsx(g.Fragment,{children:t?g.jsx(be,{variant:Le,onClick:e,tooltip:n("graphPanel.sideBar.fullScreenControl.windowed"),size:"icon",children:g.jsx(tu,{})}):g.jsx(be,{variant:Le,onClick:e,tooltip:n("graphPanel.sideBar.fullScreenControl.fullScreen"),size:"icon",children:g.jsx(Zc,{})})})};var zr="Checkbox",[Zf,jp]=br(zr),[eh,th]=Zf(zr),Ts=p.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:o,required:l,disabled:i,value:s="on",onCheckedChange:c,form:u,...f}=t,[h,d]=p.useState(null),b=Xe(e,R=>d(R)),y=p.useRef(!1),T=h?u||!!h.closest("form"):!0,[N=!1,_]=pa({prop:a,defaultProp:o,onChange:c}),A=p.useRef(N);return p.useEffect(()=>{const R=h==null?void 0:h.form;if(R){const I=()=>_(A.current);return R.addEventListener("reset",I),()=>R.removeEventListener("reset",I)}},[h,_]),g.jsxs(eh,{scope:n,state:N,disabled:i,children:[g.jsx(Se.button,{type:"button",role:"checkbox","aria-checked":ot(N)?"mixed":N,"aria-required":l,"data-state":js(N),"data-disabled":i?"":void 0,disabled:i,value:s,...f,ref:b,onKeyDown:Ce(t.onKeyDown,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:Ce(t.onClick,R=>{_(I=>ot(I)?!0:!I),T&&(y.current=R.isPropagationStopped(),y.current||R.stopPropagation())})}),T&&g.jsx(nh,{control:h,bubbles:!y.current,name:r,value:s,checked:N,required:l,disabled:i,form:u,style:{transform:"translateX(-100%)"},defaultChecked:ot(o)?!1:o})]})});Ts.displayName=zr;var Rs="CheckboxIndicator",As=p.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...a}=t,o=th(Rs,n);return g.jsx(Et,{present:r||ot(o.state)||o.state===!0,children:g.jsx(Se.span,{"data-state":js(o.state),"data-disabled":o.disabled?"":void 0,...a,ref:e,style:{pointerEvents:"none",...t.style}})})});As.displayName=Rs;var nh=t=>{const{control:e,checked:n,bubbles:r=!0,defaultChecked:a,...o}=t,l=p.useRef(null),i=Di(n),s=Oi(e);p.useEffect(()=>{const u=l.current,f=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(f,"checked").set;if(i!==n&&d){const b=new Event("click",{bubbles:r});u.indeterminate=ot(n),d.call(u,ot(n)?!1:n),u.dispatchEvent(b)}},[i,n,r]);const c=p.useRef(ot(n)?!1:n);return g.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??c.current,...o,tabIndex:-1,ref:l,style:{...t.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ot(t){return t==="indeterminate"}function js(t){return ot(t)?"indeterminate":t?"checked":"unchecked"}var Is=Ts,rh=As;const Ls=p.forwardRef(({className:t,...e},n)=>g.jsx(Is,{ref:n,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",t),...e,children:g.jsx(rh,{className:fe("flex items-center justify-center text-current"),children:g.jsx(Ba,{className:"h-4 w-4"})})}));Ls.displayName=Is.displayName;var oh="Separator",Mo="horizontal",ah=["horizontal","vertical"],Ns=p.forwardRef((t,e)=>{const{decorative:n,orientation:r=Mo,...a}=t,o=sh(r)?r:Mo,i=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return g.jsx(Se.div,{"data-orientation":o,...i,...a,ref:e})});Ns.displayName=oh;function sh(t){return ah.includes(t)}var Ps=Ns;const bt=p.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},a)=>g.jsx(Ps,{ref:a,decorative:n,orientation:e,className:fe("bg-border shrink-0",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));bt.displayName=Ps.displayName;const tt=({checked:t,onCheckedChange:e,label:n})=>{const r=`checkbox-${n.toLowerCase().replace(/\s+/g,"-")}`;return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Ls,{id:r,checked:t,onCheckedChange:e}),g.jsx("label",{htmlFor:r,className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n})]})},Mn=({value:t,onEditFinished:e,label:n,min:r,max:a,defaultValue:o})=>{const{t:l}=xe(),[i,s]=p.useState(t),c=`input-${n.toLowerCase().replace(/\s+/g,"-")}`,u=p.useCallback(d=>{const b=d.target.value.trim();if(b.length===0){s(null);return}const y=Number.parseInt(b);if(!isNaN(y)&&y!==i){if(r!==void 0&&y<r||a!==void 0&&y>a)return;s(y)}},[i,r,a]),f=p.useCallback(()=>{i!==null&&t!==i&&e(i)},[t,i,e]),h=p.useCallback(()=>{o!==void 0&&t!==o&&(s(o),e(o))},[o,t,e]);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:n}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(qt,{id:c,type:"number",value:i===null?"":i,onChange:u,className:"h-6 w-full min-w-0 pr-1",min:r,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(Ua,{className:"h-3.5 w-3.5"})})]})]})};function ih(){const[t,e]=p.useState(!1),n=ne.use.showPropertyPanel(),r=ne.use.showNodeSearchBar(),a=ne.use.showNodeLabel(),o=ne.use.enableEdgeEvents(),l=ne.use.enableNodeDrag(),i=ne.use.enableHideUnselectedEdges(),s=ne.use.showEdgeLabel(),c=ne.use.minEdgeSize(),u=ne.use.maxEdgeSize(),f=ne.use.graphQueryMaxDepth(),h=ne.use.graphMaxNodes(),d=ne.use.graphLayoutMaxIterations(),b=ne.use.enableHealthCheck(),y=p.useCallback(()=>ne.setState(j=>({enableNodeDrag:!j.enableNodeDrag})),[]),T=p.useCallback(()=>ne.setState(j=>({enableEdgeEvents:!j.enableEdgeEvents})),[]),N=p.useCallback(()=>ne.setState(j=>({enableHideUnselectedEdges:!j.enableHideUnselectedEdges})),[]),_=p.useCallback(()=>ne.setState(j=>({showEdgeLabel:!j.showEdgeLabel})),[]),A=p.useCallback(()=>ne.setState(j=>({showPropertyPanel:!j.showPropertyPanel})),[]),R=p.useCallback(()=>ne.setState(j=>({showNodeSearchBar:!j.showNodeSearchBar})),[]),I=p.useCallback(()=>ne.setState(j=>({showNodeLabel:!j.showNodeLabel})),[]),D=p.useCallback(()=>ne.setState(j=>({enableHealthCheck:!j.enableHealthCheck})),[]),m=p.useCallback(j=>{if(j<1)return;ne.setState({graphQueryMaxDepth:j});const w=ne.getState().queryLabel;ne.getState().setQueryLabel(""),setTimeout(()=>{ne.getState().setQueryLabel(w)},300)},[]),S=p.useCallback(j=>{if(j<1||j>1e3)return;ne.setState({graphMaxNodes:j});const w=ne.getState().queryLabel;ne.getState().setQueryLabel(""),setTimeout(()=>{ne.getState().setQueryLabel(w)},300)},[]),x=p.useCallback(j=>{j<1||ne.setState({graphLayoutMaxIterations:j})},[]),{t:k}=xe(),L=()=>e(!1);return g.jsx(g.Fragment,{children:g.jsxs(kr,{open:t,onOpenChange:e,children:[g.jsx(Tr,{asChild:!0,children:g.jsx(be,{variant:Le,tooltip:k("graphPanel.sideBar.settings.settings"),size:"icon",children:g.jsx(xu,{})})}),g.jsx(sn,{side:"right",align:"end",sideOffset:8,collisionPadding:5,className:"p-2 max-w-[200px]",onCloseAutoFocus:j=>j.preventDefault(),children:g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx(tt,{checked:b,onCheckedChange:D,label:k("graphPanel.sideBar.settings.healthCheck")}),g.jsx(bt,{}),g.jsx(tt,{checked:n,onCheckedChange:A,label:k("graphPanel.sideBar.settings.showPropertyPanel")}),g.jsx(tt,{checked:r,onCheckedChange:R,label:k("graphPanel.sideBar.settings.showSearchBar")}),g.jsx(bt,{}),g.jsx(tt,{checked:a,onCheckedChange:I,label:k("graphPanel.sideBar.settings.showNodeLabel")}),g.jsx(tt,{checked:l,onCheckedChange:y,label:k("graphPanel.sideBar.settings.nodeDraggable")}),g.jsx(bt,{}),g.jsx(tt,{checked:s,onCheckedChange:_,label:k("graphPanel.sideBar.settings.showEdgeLabel")}),g.jsx(tt,{checked:i,onCheckedChange:N,label:k("graphPanel.sideBar.settings.hideUnselectedEdges")}),g.jsx(tt,{checked:o,onCheckedChange:T,label:k("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:k("graphPanel.sideBar.settings.edgeSizeRange")}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(qt,{id:"edge-size-min",type:"number",value:c,onChange:j=>{const w=Number(j.target.value);!isNaN(w)&&w>=1&&w<=u&&ne.setState({minEdgeSize:w})},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(qt,{id:"edge-size-max",type:"number",value:u,onChange:j=>{const w=Number(j.target.value);!isNaN(w)&&w>=c&&w>=1&&w<=10&&ne.setState({maxEdgeSize:w})},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:()=>ne.setState({minEdgeSize:1,maxEdgeSize:5}),type:"button",title:k("graphPanel.sideBar.settings.resetToDefault"),children:g.jsx(Ua,{className:"h-3.5 w-3.5"})})]})]})]}),g.jsx(bt,{}),g.jsx(Mn,{label:k("graphPanel.sideBar.settings.maxQueryDepth"),min:1,value:f,defaultValue:3,onEditFinished:m}),g.jsx(Mn,{label:k("graphPanel.sideBar.settings.maxNodes"),min:1,max:1e3,value:h,defaultValue:1e3,onEditFinished:S}),g.jsx(Mn,{label:k("graphPanel.sideBar.settings.maxLayoutIterations"),min:1,max:30,value:d,defaultValue:15,onEditFinished:x}),g.jsx(bt,{}),g.jsx(be,{onClick:L,variant:"outline",size:"sm",className:"ml-auto px-4",children:k("graphPanel.sideBar.settings.save")})]})})]})})}const lh="ENTRIES",zs="KEYS",Ds="VALUES",Ee="";class Hn{constructor(e,n){const r=e._tree,a=Array.from(r.keys());this.set=e,this._type=n,this._path=a.length>0?[{node:r,keys:a}]:[]}next(){const e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:e,keys:n}=mt(this._path);if(mt(n)===Ee)return{done:!1,value:this.result()};const r=e.get(mt(n));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const e=mt(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>mt(e)).filter(e=>e!==Ee).join("")}value(){return mt(this._path).node.get(Ee)}result(){switch(this._type){case Ds:return this.value();case zs:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const mt=t=>t[t.length-1],ch=(t,e,n)=>{const r=new Map;if(e===void 0)return r;const a=e.length+1,o=a+n,l=new Uint8Array(o*a).fill(n+1);for(let i=0;i<a;++i)l[i]=i;for(let i=1;i<o;++i)l[i*a]=i;return Os(t,e,n,r,l,1,a,""),r},Os=(t,e,n,r,a,o,l,i)=>{const s=o*l;e:for(const c of t.keys())if(c===Ee){const u=a[s-1];u<=n&&r.set(i,[t.get(c),u])}else{let u=o;for(let f=0;f<c.length;++f,++u){const h=c[f],d=l*u,b=d-l;let y=a[d];const T=Math.max(0,u-n-1),N=Math.min(l-1,u+n);for(let _=T;_<N;++_){const A=h!==e[_],R=a[b+_]+ +A,I=a[b+_+1]+1,D=a[d+_]+1,m=a[d+_+1]=Math.min(R,I,D);m<y&&(y=m)}if(y>n)continue e}Os(t.get(c),e,n,r,a,u,l,i+c)}};class rt{constructor(e=new Map,n=""){this._size=void 0,this._tree=e,this._prefix=n}atPrefix(e){if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");const[n,r]=Kt(this._tree,e.slice(this._prefix.length));if(n===void 0){const[a,o]=Dr(r);for(const l of a.keys())if(l!==Ee&&l.startsWith(o)){const i=new Map;return i.set(l.slice(o.length),a.get(l)),new rt(i,e)}}return new rt(n,e)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,uh(this._tree,e)}entries(){return new Hn(this,lh)}forEach(e){for(const[n,r]of this)e(n,r,this)}fuzzyGet(e,n){return ch(this._tree,e,n)}get(e){const n=hr(this._tree,e);return n!==void 0?n.get(Ee):void 0}has(e){const n=hr(this._tree,e);return n!==void 0&&n.has(Ee)}keys(){return new Hn(this,zs)}set(e,n){if(typeof e!="string")throw new Error("key must be a string");return this._size=void 0,Bn(this._tree,e).set(Ee,n),this}get size(){if(this._size)return this._size;this._size=0;const e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,n){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const r=Bn(this._tree,e);return r.set(Ee,n(r.get(Ee))),this}fetch(e,n){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const r=Bn(this._tree,e);let a=r.get(Ee);return a===void 0&&r.set(Ee,a=n()),a}values(){return new Hn(this,Ds)}[Symbol.iterator](){return this.entries()}static from(e){const n=new rt;for(const[r,a]of e)n.set(r,a);return n}static fromObject(e){return rt.from(Object.entries(e))}}const Kt=(t,e,n=[])=>{if(e.length===0||t==null)return[t,n];for(const r of t.keys())if(r!==Ee&&e.startsWith(r))return n.push([t,r]),Kt(t.get(r),e.slice(r.length),n);return n.push([t,e]),Kt(void 0,"",n)},hr=(t,e)=>{if(e.length===0||t==null)return t;for(const n of t.keys())if(n!==Ee&&e.startsWith(n))return hr(t.get(n),e.slice(n.length))},Bn=(t,e)=>{const n=e.length;e:for(let r=0;t&&r<n;){for(const o of t.keys())if(o!==Ee&&e[r]===o[0]){const l=Math.min(n-r,o.length);let i=1;for(;i<l&&e[r+i]===o[i];)++i;const s=t.get(o);if(i===o.length)t=s;else{const c=new Map;c.set(o.slice(i),s),t.set(e.slice(r,r+i),c),t.delete(o),t=c}r+=i;continue e}const a=new Map;return t.set(e.slice(r),a),a}return t},uh=(t,e)=>{const[n,r]=Kt(t,e);if(n!==void 0){if(n.delete(Ee),n.size===0)Gs(r);else if(n.size===1){const[a,o]=n.entries().next().value;Fs(r,a,o)}}},Gs=t=>{if(t.length===0)return;const[e,n]=Dr(t);if(e.delete(n),e.size===0)Gs(t.slice(0,-1));else if(e.size===1){const[r,a]=e.entries().next().value;r!==Ee&&Fs(t.slice(0,-1),r,a)}},Fs=(t,e,n)=>{if(t.length===0)return;const[r,a]=Dr(t);r.set(a+e,n),r.delete(a)},Dr=t=>t[t.length-1],Or="or",$s="and",dh="and_not";class at{constructor(e){if((e==null?void 0:e.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');const n=e.autoVacuum==null||e.autoVacuum===!0?qn:e.autoVacuum;this._options={...Un,...e,autoVacuum:n,searchOptions:{...Ho,...e.searchOptions||{}},autoSuggestOptions:{...mh,...e.autoSuggestOptions||{}}},this._index=new rt,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=pr,this.addFields(this._options.fields)}add(e){const{extractField:n,tokenize:r,processTerm:a,fields:o,idField:l}=this._options,i=n(e,l);if(i==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);if(this._idToShortId.has(i))throw new Error(`MiniSearch: duplicate ID ${i}`);const s=this.addDocumentId(i);this.saveStoredFields(s,e);for(const c of o){const u=n(e,c);if(u==null)continue;const f=r(u.toString(),c),h=this._fieldIds[c],d=new Set(f).size;this.addFieldLength(s,h,this._documentCount-1,d);for(const b of f){const y=a(b,c);if(Array.isArray(y))for(const T of y)this.addTerm(h,s,T);else y&&this.addTerm(h,s,y)}}}addAll(e){for(const n of e)this.add(n)}addAllAsync(e,n={}){const{chunkSize:r=10}=n,a={chunk:[],promise:Promise.resolve()},{chunk:o,promise:l}=e.reduce(({chunk:i,promise:s},c,u)=>(i.push(c),(u+1)%r===0?{chunk:[],promise:s.then(()=>new Promise(f=>setTimeout(f,0))).then(()=>this.addAll(i))}:{chunk:i,promise:s}),a);return l.then(()=>this.addAll(o))}remove(e){const{tokenize:n,processTerm:r,extractField:a,fields:o,idField:l}=this._options,i=a(e,l);if(i==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);const s=this._idToShortId.get(i);if(s==null)throw new Error(`MiniSearch: cannot remove document with ID ${i}: it is not in the index`);for(const c of o){const u=a(e,c);if(u==null)continue;const f=n(u.toString(),c),h=this._fieldIds[c],d=new Set(f).size;this.removeFieldLength(s,h,this._documentCount,d);for(const b of f){const y=r(b,c);if(Array.isArray(y))for(const T of y)this.removeTerm(h,s,T);else y&&this.removeTerm(h,s,y)}}this._storedFields.delete(s),this._documentIds.delete(s),this._idToShortId.delete(i),this._fieldLength.delete(s),this._documentCount-=1}removeAll(e){if(e)for(const n of e)this.remove(n);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new rt,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(e){const n=this._idToShortId.get(e);if(n==null)throw new Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach((r,a)=>{this.removeFieldLength(n,a,this._documentCount,r)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:e,minDirtCount:n,batchSize:r,batchWait:a}=this._options.autoVacuum;this.conditionalVacuum({batchSize:r,batchWait:a},{minDirtCount:n,minDirtFactor:e})}discardAll(e){const n=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const r of e)this.discard(r)}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()}replace(e){const{idField:n,extractField:r}=this._options,a=r(e,n);this.discard(a),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,n){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&n,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const r=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=pr,this.performVacuuming(e,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(n)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,n){const r=this._dirtCount;if(this.vacuumConditionsMet(n)){const a=e.batchSize||gr.batchSize,o=e.batchWait||gr.batchWait;let l=1;for(const[i,s]of this._index){for(const[c,u]of s)for(const[f]of u)this._documentIds.has(f)||(u.size<=1?s.delete(c):u.delete(f));this._index.get(i).size===0&&this._index.delete(i),l%a===0&&await new Promise(c=>setTimeout(c,o)),l+=1}this._dirtCount-=r}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:n,minDirtFactor:r}=e;return n=n||qn.minDirtCount,r=r||qn.minDirtFactor,this.dirtCount>=n&&this.dirtFactor>=r}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){const n=this._idToShortId.get(e);if(n!=null)return this._storedFields.get(n)}search(e,n={}){const{searchOptions:r}=this._options,a={...r,...n},o=this.executeQuery(e,n),l=[];for(const[i,{score:s,terms:c,match:u}]of o){const f=c.length||1,h={id:this._documentIds.get(i),score:s*f,terms:Object.keys(u),queryTerms:c,match:u};Object.assign(h,this._storedFields.get(i)),(a.filter==null||a.filter(h))&&l.push(h)}return e===at.wildcard&&a.boostDocument==null||l.sort(Vo),l}autoSuggest(e,n={}){n={...this._options.autoSuggestOptions,...n};const r=new Map;for(const{score:o,terms:l}of this.search(e,n)){const i=l.join(" "),s=r.get(i);s!=null?(s.score+=o,s.count+=1):r.set(i,{score:o,terms:l,count:1})}const a=[];for(const[o,{score:l,terms:i,count:s}]of r)a.push({suggestion:o,terms:i,score:l/s});return a.sort(Vo),a}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(e,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),n)}static async loadJSONAsync(e,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(e),n)}static getDefault(e){if(Un.hasOwnProperty(e))return Vn(Un,e);throw new Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,n){const{index:r,documentIds:a,fieldLength:o,storedFields:l,serializationVersion:i}=e,s=this.instantiateMiniSearch(e,n);s._documentIds=Dt(a),s._fieldLength=Dt(o),s._storedFields=Dt(l);for(const[c,u]of s._documentIds)s._idToShortId.set(u,c);for(const[c,u]of r){const f=new Map;for(const h of Object.keys(u)){let d=u[h];i===1&&(d=d.ds),f.set(parseInt(h,10),Dt(d))}s._index.set(c,f)}return s}static async loadJSAsync(e,n){const{index:r,documentIds:a,fieldLength:o,storedFields:l,serializationVersion:i}=e,s=this.instantiateMiniSearch(e,n);s._documentIds=await Ot(a),s._fieldLength=await Ot(o),s._storedFields=await Ot(l);for(const[u,f]of s._documentIds)s._idToShortId.set(f,u);let c=0;for(const[u,f]of r){const h=new Map;for(const d of Object.keys(f)){let b=f[d];i===1&&(b=b.ds),h.set(parseInt(d,10),await Ot(b))}++c%1e3===0&&await Ms(0),s._index.set(u,h)}return s}static instantiateMiniSearch(e,n){const{documentCount:r,nextId:a,fieldIds:o,averageFieldLength:l,dirtCount:i,serializationVersion:s}=e;if(s!==1&&s!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const c=new at(n);return c._documentCount=r,c._nextId=a,c._idToShortId=new Map,c._fieldIds=o,c._avgFieldLength=l,c._dirtCount=i||0,c._index=new rt,c}executeQuery(e,n={}){if(e===at.wildcard)return this.executeWildcardQuery(n);if(typeof e!="string"){const h={...n,...e,queries:void 0},d=e.queries.map(b=>this.executeQuery(b,h));return this.combineResults(d,h.combineWith)}const{tokenize:r,processTerm:a,searchOptions:o}=this._options,l={tokenize:r,processTerm:a,...o,...n},{tokenize:i,processTerm:s}=l,f=i(e).flatMap(h=>s(h)).filter(h=>!!h).map(ph(l)).map(h=>this.executeQuerySpec(h,l));return this.combineResults(f,l.combineWith)}executeQuerySpec(e,n){const r={...this._options.searchOptions,...n},a=(r.fields||this._options.fields).reduce((y,T)=>({...y,[T]:Vn(r.boost,T)||1}),{}),{boostDocument:o,weights:l,maxFuzzy:i,bm25:s}=r,{fuzzy:c,prefix:u}={...Ho.weights,...l},f=this._index.get(e.term),h=this.termResults(e.term,e.term,1,e.termBoost,f,a,o,s);let d,b;if(e.prefix&&(d=this._index.atPrefix(e.term)),e.fuzzy){const y=e.fuzzy===!0?.2:e.fuzzy,T=y<1?Math.min(i,Math.round(e.term.length*y)):y;T&&(b=this._index.fuzzyGet(e.term,T))}if(d)for(const[y,T]of d){const N=y.length-e.term.length;if(!N)continue;b==null||b.delete(y);const _=u*y.length/(y.length+.3*N);this.termResults(e.term,y,_,e.termBoost,T,a,o,s,h)}if(b)for(const y of b.keys()){const[T,N]=b.get(y);if(!N)continue;const _=c*y.length/(y.length+N);this.termResults(e.term,y,_,e.termBoost,T,a,o,s,h)}return h}executeWildcardQuery(e){const n=new Map,r={...this._options.searchOptions,...e};for(const[a,o]of this._documentIds){const l=r.boostDocument?r.boostDocument(o,"",this._storedFields.get(a)):1;n.set(a,{score:l,terms:[],match:{}})}return n}combineResults(e,n=Or){if(e.length===0)return new Map;const r=n.toLowerCase(),a=fh[r];if(!a)throw new Error(`Invalid combination operator: ${n}`);return e.reduce(a)||new Map}toJSON(){const e=[];for(const[n,r]of this._index){const a={};for(const[o,l]of r)a[o]=Object.fromEntries(l);e.push([n,a])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:e,serializationVersion:2}}termResults(e,n,r,a,o,l,i,s,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 b=d.size;const y=this._avgFieldLength[h];for(const T of d.keys()){if(!this._documentIds.has(T)){this.removeTerm(h,T,n),b-=1;continue}const N=i?i(this._documentIds.get(T),n,this._storedFields.get(T)):1;if(!N)continue;const _=d.get(T),A=this._fieldLength.get(T)[h],R=gh(_,b,this._documentCount,A,y,s),I=r*a*f*N*R,D=c.get(T);if(D){D.score+=I,vh(D.terms,e);const m=Vn(D.match,n);m?m.push(u):D.match[n]=[u]}else c.set(T,{score:I,terms:[e],match:{[n]:[u]}})}}return c}addTerm(e,n,r){const a=this._index.fetch(r,Uo);let o=a.get(e);if(o==null)o=new Map,o.set(n,1),a.set(e,o);else{const l=o.get(n);o.set(n,(l||0)+1)}}removeTerm(e,n,r){if(!this._index.has(r)){this.warnDocumentChanged(n,e,r);return}const a=this._index.fetch(r,Uo),o=a.get(e);o==null||o.get(n)==null?this.warnDocumentChanged(n,e,r):o.get(n)<=1?o.size<=1?a.delete(e):o.delete(n):o.set(n,o.get(n)-1),this._index.get(r).size===0&&this._index.delete(r)}warnDocumentChanged(e,n,r){for(const a of Object.keys(this._fieldIds))if(this._fieldIds[a]===n){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${r}" was not present in field "${a}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(e){const n=this._nextId;return this._idToShortId.set(e,n),this._documentIds.set(n,e),this._documentCount+=1,this._nextId+=1,n}addFields(e){for(let n=0;n<e.length;n++)this._fieldIds[e[n]]=n}addFieldLength(e,n,r,a){let o=this._fieldLength.get(e);o==null&&this._fieldLength.set(e,o=[]),o[n]=a;const i=(this._avgFieldLength[n]||0)*r+a;this._avgFieldLength[n]=i/(r+1)}removeFieldLength(e,n,r,a){if(r===1){this._avgFieldLength[n]=0;return}const o=this._avgFieldLength[n]*r-a;this._avgFieldLength[n]=o/(r-1)}saveStoredFields(e,n){const{storeFields:r,extractField:a}=this._options;if(r==null||r.length===0)return;let o=this._storedFields.get(e);o==null&&this._storedFields.set(e,o={});for(const l of r){const i=a(n,l);i!==void 0&&(o[l]=i)}}}at.wildcard=Symbol("*");const Vn=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,fh={[Or]:(t,e)=>{for(const n of e.keys()){const r=t.get(n);if(r==null)t.set(n,e.get(n));else{const{score:a,terms:o,match:l}=e.get(n);r.score=r.score+a,r.match=Object.assign(r.match,l),Bo(r.terms,o)}}return t},[$s]:(t,e)=>{const n=new Map;for(const r of e.keys()){const a=t.get(r);if(a==null)continue;const{score:o,terms:l,match:i}=e.get(r);Bo(a.terms,l),n.set(r,{score:a.score+o,terms:a.terms,match:Object.assign(a.match,i)})}return n},[dh]:(t,e)=>{for(const n of e.keys())t.delete(n);return t}},hh={k:1.2,b:.7,d:.5},gh=(t,e,n,r,a,o)=>{const{k:l,b:i,d:s}=o;return Math.log(1+(n-e+.5)/(e+.5))*(s+t*(l+1)/(t+l*(1-i+i*r/a)))},ph=t=>(e,n,r)=>{const a=typeof t.fuzzy=="function"?t.fuzzy(e,n,r):t.fuzzy||!1,o=typeof t.prefix=="function"?t.prefix(e,n,r):t.prefix===!0,l=typeof t.boostTerm=="function"?t.boostTerm(e,n,r):1;return{term:e,fuzzy:a,prefix:o,termBoost:l}},Un={idField:"id",extractField:(t,e)=>t[e],tokenize:t=>t.split(yh),processTerm:t=>t.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(t,e)=>{typeof(console==null?void 0:console[t])=="function"&&console[t](e)},autoVacuum:!0},Ho={combineWith:Or,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:hh},mh={combineWith:$s,prefix:(t,e,n)=>e===n.length-1},gr={batchSize:1e3,batchWait:10},pr={minDirtFactor:.1,minDirtCount:20},qn={...gr,...pr},vh=(t,e)=>{t.includes(e)||t.push(e)},Bo=(t,e)=>{for(const n of e)t.includes(n)||t.push(n)},Vo=({score:t},{score:e})=>e-t,Uo=()=>new Map,Dt=t=>{const e=new Map;for(const n of Object.keys(t))e.set(parseInt(n,10),t[n]);return e},Ot=async t=>{const e=new Map;let n=0;for(const r of Object.keys(t))e.set(parseInt(r,10),t[r]),++n%1e3===0&&await Ms(0);return e},Ms=t=>new Promise(e=>setTimeout(e,t)),yh=/[\n\r\p{Z}\p{P}]+/u,bh={index:new at({fields:[]})};p.createContext(bh);const mr=({label:t,color:e,hidden:n,labels:r={}})=>W.createElement("div",{className:"node"},W.createElement("span",{className:"render "+(n?"circle":"disc"),style:{backgroundColor:e||"#000"}}),W.createElement("span",{className:`label ${n?"text-muted":""} ${t?"":"text-italic"}`},t||r.no_label||"No label")),wh=({id:t,labels:e})=>{const n=Be(),r=p.useMemo(()=>{const a=n.getGraph().getNodeAttributes(t),o=n.getSetting("nodeReducer");return Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},a),o?o(t,a):{})},[n,t]);return W.createElement(mr,Object.assign({},r,{labels:e}))},xh=({label:t,color:e,source:n,target:r,hidden:a,directed:o,labels:l={}})=>W.createElement("div",{className:"edge"},W.createElement(mr,Object.assign({},n,{labels:l})),W.createElement("div",{className:"body"},W.createElement("div",{className:"render"},W.createElement("span",{className:a?"dotted":"dash",style:{borderColor:e||"#000"}})," ",o&&W.createElement("span",{className:"arrow",style:{borderTopColor:e||"#000"}})),W.createElement("span",{className:`label ${a?"text-muted":""} ${t?"":"fst-italic"}`},t||l.no_label||"No label")),W.createElement(mr,Object.assign({},r,{labels:l}))),Eh=({id:t,labels:e})=>{const n=Be(),r=p.useMemo(()=>{const a=n.getGraph().getEdgeAttributes(t),o=n.getSetting("nodeReducer"),l=n.getSetting("edgeReducer"),i=n.getGraph().getNodeAttributes(n.getGraph().source(t)),s=n.getGraph().getNodeAttributes(n.getGraph().target(t));return Object.assign(Object.assign(Object.assign({color:n.getSetting("defaultEdgeColor"),directed:n.getGraph().isDirected(t)},a),l?l(t,a):{}),{source:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},i),o?o(t,i):{}),target:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},s),o?o(t,s):{})})},[n,t]);return W.createElement(xh,Object.assign({},r,{labels:e}))};function Hs(t,e){const[n,r]=p.useState(t);return p.useEffect(()=>{const a=setTimeout(()=>{r(t)},e);return()=>{clearTimeout(a)}},[t,e]),n}function Sh({fetcher:t,preload:e,filterFn:n,renderOption:r,getOptionValue:a,notFound:o,loadingSkeleton:l,label:i,placeholder:s="Select...",value:c,onChange:u,onFocus:f,disabled:h=!1,className:d,noResultsMessage:b}){const[y,T]=p.useState(!1),[N,_]=p.useState(!1),[A,R]=p.useState([]),[I,D]=p.useState(!1),[m,S]=p.useState(null),[x,k]=p.useState(""),L=Hs(x,e?0:150),j=p.useRef(null);p.useEffect(()=>{T(!0)},[]),p.useEffect(()=>{const C=E=>{j.current&&!j.current.contains(E.target)&&N&&_(!1)};return document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[N]);const w=p.useCallback(async C=>{try{D(!0),S(null);const E=await t(C);R(E)}catch(E){S(E instanceof Error?E.message:"Failed to fetch options")}finally{D(!1)}},[t]);p.useEffect(()=>{y&&(e?L&&R(C=>C.filter(E=>n?n(E,L):!0)):w(L))},[y,L,e,n,w]),p.useEffect(()=>{!y||!c||w(c)},[y,c,w]);const V=p.useCallback(C=>{u(C),requestAnimationFrame(()=>{const E=document.activeElement;E==null||E.blur(),_(!1)})},[u]),K=p.useCallback(()=>{_(!0),w(x)},[x,w]),O=p.useCallback(C=>{C.target.closest(".cmd-item")&&C.preventDefault()},[]);return g.jsx("div",{ref:j,className:fe(h&&"cursor-not-allowed opacity-50",d),onMouseDown:O,children:g.jsxs(cn,{shouldFilter:!1,className:"bg-transparent",children:[g.jsxs("div",{children:[g.jsx(Nr,{placeholder:s,value:x,className:"max-h-8",onFocus:K,onValueChange:C=>{k(C),N||_(!0)}}),I&&g.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:g.jsx(Va,{className:"h-4 w-4 animate-spin"})})]}),g.jsxs(un,{hidden:!N,children:[m&&g.jsx("div",{className:"text-destructive p-4 text-center",children:m}),I&&A.length===0&&(l||g.jsx(_h,{})),!I&&!m&&A.length===0&&(o||g.jsx(Pr,{children:b??`No ${i.toLowerCase()} found.`})),g.jsx(_t,{children:A.map((C,E)=>g.jsxs(W.Fragment,{children:[g.jsx(Ct,{value:a(C),onSelect:V,onMouseMove:()=>f(a(C)),className:"truncate cmd-item",children:r(C)},a(C)+`${E}`),E!==A.length-1&&g.jsx("div",{className:"bg-foreground/10 h-[1px]"},`divider-${E}`)]},a(C)+`-fragment-${E}`))})]})]})})}function _h(){return g.jsx(_t,{children:g.jsx(Ct,{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 Wn="__message_item",Ch=({id:t})=>{const e=ee.use.sigmaGraph();return e!=null&&e.hasNode(t)?g.jsx(wh,{id:t}):null};function kh(t){return g.jsxs("div",{children:[t.type==="nodes"&&g.jsx(Ch,{id:t.id}),t.type==="edges"&&g.jsx(Eh,{id:t.id}),t.type==="message"&&g.jsx("div",{children:t.message})]})}const Th=({onChange:t,onFocus:e,value:n})=>{const{t:r}=xe(),a=ee.use.sigmaGraph(),o=ee.use.searchEngine();p.useEffect(()=>{a&&ee.getState().resetSearchEngine()},[a]),p.useEffect(()=>{if(!a||a.nodes().length===0||o)return;const i=new at({idField:"id",fields:["label"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),s=a.nodes().map(c=>({id:c,label:a.getNodeAttribute(c,"label")}));i.addAll(s),ee.getState().setSearchEngine(i)},[a,o]);const l=p.useCallback(async i=>{if(e&&e(null),!a||!o)return[];if(a.nodes().length===0)return[];if(!i)return a.nodes().filter(u=>a.hasNode(u)).slice(0,It).map(u=>({id:u,type:"nodes"}));let s=o.search(i).filter(c=>a.hasNode(c.id)).map(c=>({id:c.id,type:"nodes"}));if(s.length<5){const c=new Set(s.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(i.toLowerCase())&&h.toLowerCase().includes(i.toLowerCase())}).map(f=>({id:f,type:"nodes"}));s=[...s,...u]}return s.length<=It?s:[...s.slice(0,It),{type:"message",id:Wn,message:r("graphPanel.search.message",{count:s.length-It})}]},[a,o,e,r]);return g.jsx(Sh,{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:kh,getOptionValue:i=>i.id,value:n&&n.type!=="message"?n.id:null,onChange:i=>{i!==Wn&&t(i?{id:i,type:"nodes"}:null)},onFocus:i=>{i!==Wn&&e&&e(i?{id:i,type:"nodes"}:null)},label:"item",placeholder:r("graphPanel.search.placeholder")})},Rh=({...t})=>g.jsx(Th,{...t});function Ah({fetcher:t,preload:e,filterFn:n,renderOption:r,getOptionValue:a,getDisplayValue:o,notFound:l,loadingSkeleton:i,label:s,placeholder:c="Select...",value:u,onChange:f,disabled:h=!1,className:d,triggerClassName:b,searchInputClassName:y,noResultsMessage:T,triggerTooltip:N,clearable:_=!0}){const[A,R]=p.useState(!1),[I,D]=p.useState(!1),[m,S]=p.useState([]),[x,k]=p.useState(!1),[L,j]=p.useState(null),[w,V]=p.useState(u),[K,O]=p.useState(null),[C,E]=p.useState(""),H=Hs(C,e?0:150),[ae,$]=p.useState([]),[v,z]=p.useState(null);p.useEffect(()=>{R(!0),V(u)},[u]),p.useEffect(()=>{u&&(!m.length||!K)?z(g.jsx("div",{children:u})):K&&z(null)},[u,m.length,K]),p.useEffect(()=>{if(u&&m.length>0){const M=m.find(J=>a(J)===u);M&&O(M)}},[u,m,a]),p.useEffect(()=>{A||(async()=>{try{k(!0),j(null);const J=await t(u);$(J),S(J)}catch(J){j(J instanceof Error?J.message:"Failed to fetch options")}finally{k(!1)}})()},[A,t,u]),p.useEffect(()=>{const M=async()=>{try{k(!0),j(null);const J=await t(H);$(J),S(J)}catch(J){j(J instanceof Error?J.message:"Failed to fetch options")}finally{k(!1)}};A&&e?e&&S(H?ae.filter(J=>n?n(J,H):!0):ae):M()},[t,H,A,e,n]);const B=p.useCallback(M=>{const J=_&&M===w?"":M;V(J),O(m.find(X=>a(X)===J)||null),f(J),D(!1)},[w,f,_,m,a]);return g.jsxs(kr,{open:I,onOpenChange:D,children:[g.jsx(Tr,{asChild:!0,children:g.jsxs(be,{variant:"outline",role:"combobox","aria-expanded":I,className:fe("justify-between",h&&"cursor-not-allowed opacity-50",b),disabled:h,tooltip:N,side:"bottom",children:[u==="*"?g.jsx("div",{children:"*"}):K?o(K):v||c,g.jsx(Dc,{className:"opacity-50",size:10})]})}),g.jsx(sn,{className:fe("p-0",d),onCloseAutoFocus:M=>M.preventDefault(),align:"start",sideOffset:8,collisionPadding:5,children:g.jsxs(cn,{shouldFilter:!1,children:[g.jsxs("div",{className:"relative w-full border-b",children:[g.jsx(Nr,{placeholder:`Search ${s.toLowerCase()}...`,value:C,onValueChange:M=>{E(M)},className:y}),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(Va,{className:"h-4 w-4 animate-spin"})})]}),g.jsxs(un,{children:[L&&g.jsx("div",{className:"text-destructive p-4 text-center",children:L}),x&&m.length===0&&(i||g.jsx(jh,{})),!x&&!L&&m.length===0&&(l||g.jsx(Pr,{children:T??`No ${s.toLowerCase()} found.`})),g.jsx(_t,{children:m.map(M=>g.jsxs(Ct,{value:a(M),onSelect:B,className:"truncate",children:[r(M),g.jsx(Ba,{className:fe("ml-auto h-3 w-3",w===a(M)?"opacity-100":"opacity-0")})]},a(M)))})]})]})})]})}function jh(){return g.jsx(_t,{children:g.jsx(Ct,{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 Ih=()=>{const{t}=xe(),e=ne.use.queryLabel(),n=ee.use.allDatabaseLabels(),r=ee.use.labelsFetchAttempted(),a=p.useCallback(()=>{const i=new at({idField:"id",fields:["value"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),s=n.map((c,u)=>({id:u,value:c}));return i.addAll(s),{labels:n,searchEngine:i}},[n]),o=p.useCallback(async i=>{const{labels:s,searchEngine:c}=a();let u=s;if(i&&(u=c.search(i).map(f=>s[f.id]),u.length<15)){const f=new Set(u),h=s.filter(d=>f.has(d)?!1:d&&typeof d=="string"&&!d.toLowerCase().startsWith(i.toLowerCase())&&d.toLowerCase().includes(i.toLowerCase()));u=[...u,...h]}return u.length<=Wr?u:[...u.slice(0,Wr),"..."]},[a]);p.useEffect(()=>{r&&(n.length>1?e&&e!=="*"&&!n.includes(e)?(console.log(`Label "${e}" not in available labels, setting to "*"`),ne.getState().setQueryLabel("*")):console.log(`Label "${e}" is valid`):e&&n.length<=1&&e&&e!=="*"&&(console.log("Available labels list is empty, setting label to empty"),ne.getState().setQueryLabel("")),ee.getState().setLabelsFetchAttempted(!1))},[n,e,r]);const l=p.useCallback(()=>{ee.getState().setLabelsFetchAttempted(!1),ee.getState().setGraphDataFetchAttempted(!1),ee.getState().setLastSuccessfulQueryLabel("");const i=ne.getState().queryLabel;i?(ne.getState().setQueryLabel(""),setTimeout(()=>{ne.getState().setQueryLabel(i)},0)):ne.getState().setQueryLabel("*")},[]);return g.jsxs("div",{className:"flex items-center",children:[g.jsx(be,{size:"icon",variant:Le,onClick:l,tooltip:t("graphPanel.graphLabels.refreshTooltip"),className:"mr-2",children:g.jsx(uu,{className:"h-4 w-4"})}),g.jsx(Ah,{className:"min-w-[300px]",triggerClassName:"max-h-8",searchInputClassName:"max-h-8",triggerTooltip:t("graphPanel.graphLabels.selectTooltip"),fetcher:o,renderOption:i=>g.jsx("div",{children:i}),getOptionValue:i=>i,getDisplayValue:i=>g.jsx("div",{children:i}),notFound:g.jsx("div",{className:"py-6 text-center text-sm",children:"No labels found"}),label:t("graphPanel.graphLabels.label"),placeholder:t("graphPanel.graphLabels.placeholder"),value:e!==null?e:"*",onChange:i=>{const s=ne.getState().queryLabel;i==="..."&&(i="*"),i===s&&i!=="*"&&(i="*"),ee.getState().setGraphDataFetchAttempted(!1),ne.getState().setQueryLabel(i)},clearable:!1})]})},Bs=({text:t,className:e,tooltipClassName:n,tooltip:r,side:a,onClick:o})=>r?g.jsx(Fa,{delayDuration:200,children:g.jsxs($a,{children:[g.jsx(Ma,{asChild:!0,children:g.jsx("label",{className:fe(e,o!==void 0?"cursor-pointer":void 0),onClick:o,children:t})}),g.jsx(Cr,{side:a,className:n,children:r})]})}):g.jsx("label",{className:fe(e,o!==void 0?"cursor-pointer":void 0),onClick:o,children:t});var Gt={exports:{}},Lh=Gt.exports,qo;function Nh(){return qo||(qo=1,function(t){(function(e,n,r){function a(s){var c=this,u=i();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(s),c.s0<0&&(c.s0+=1),c.s1-=u(s),c.s1<0&&(c.s1+=1),c.s2-=u(s),c.s2<0&&(c.s2+=1),u=null}function o(s,c){return c.c=s.c,c.s0=s.s0,c.s1=s.s1,c.s2=s.s2,c}function l(s,c){var u=new a(s),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 i(){var s=4022871197,c=function(u){u=String(u);for(var f=0;f<u.length;f++){s+=u.charCodeAt(f);var h=.02519603282416938*s;s=h>>>0,h-=s,h*=s,s=h>>>0,h-=s,s+=h*4294967296}return(s>>>0)*23283064365386963e-26};return c}n&&n.exports?n.exports=l:this.alea=l})(Lh,t)}(Gt)),Gt.exports}var Ft={exports:{}},Ph=Ft.exports,Wo;function zh(){return Wo||(Wo=1,function(t){(function(e,n,r){function a(i){var s=this,c="";s.x=0,s.y=0,s.z=0,s.w=0,s.next=function(){var f=s.x^s.x<<11;return s.x=s.y,s.y=s.z,s.z=s.w,s.w^=s.w>>>19^f^f>>>8},i===(i|0)?s.x=i:c+=i;for(var u=0;u<c.length+64;u++)s.x^=c.charCodeAt(u)|0,s.next()}function o(i,s){return s.x=i.x,s.y=i.y,s.z=i.z,s.w=i.w,s}function l(i,s){var c=new a(i),u=s&&s.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,b=(h+d)/(1<<21);while(b===0);return b},f.int32=c.next,f.quick=f,u&&(typeof u=="object"&&o(u,c),f.state=function(){return o(c,{})}),f}n&&n.exports?n.exports=l:this.xor128=l})(Ph,t)}(Ft)),Ft.exports}var $t={exports:{}},Dh=$t.exports,Xo;function Oh(){return Xo||(Xo=1,function(t){(function(e,n,r){function a(i){var s=this,c="";s.next=function(){var f=s.x^s.x>>>2;return s.x=s.y,s.y=s.z,s.z=s.w,s.w=s.v,(s.d=s.d+362437|0)+(s.v=s.v^s.v<<4^(f^f<<1))|0},s.x=0,s.y=0,s.z=0,s.w=0,s.v=0,i===(i|0)?s.x=i:c+=i;for(var u=0;u<c.length+64;u++)s.x^=c.charCodeAt(u)|0,u==c.length&&(s.d=s.x<<10^s.x>>>4),s.next()}function o(i,s){return s.x=i.x,s.y=i.y,s.z=i.z,s.w=i.w,s.v=i.v,s.d=i.d,s}function l(i,s){var c=new a(i),u=s&&s.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,b=(h+d)/(1<<21);while(b===0);return b},f.int32=c.next,f.quick=f,u&&(typeof u=="object"&&o(u,c),f.state=function(){return o(c,{})}),f}n&&n.exports?n.exports=l:this.xorwow=l})(Dh,t)}($t)),$t.exports}var Mt={exports:{}},Gh=Mt.exports,Yo;function Fh(){return Yo||(Yo=1,function(t){(function(e,n,r){function a(i){var s=this;s.next=function(){var u=s.x,f=s.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,s.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(s,i)}function o(i,s){return s.x=i.x.slice(),s.i=i.i,s}function l(i,s){i==null&&(i=+new Date);var c=new a(i),u=s&&s.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,b=(h+d)/(1<<21);while(b===0);return b},f.int32=c.next,f.quick=f,u&&(u.x&&o(u,c),f.state=function(){return o(c,{})}),f}n&&n.exports?n.exports=l:this.xorshift7=l})(Gh,t)}(Mt)),Mt.exports}var Ht={exports:{}},$h=Ht.exports,Ko;function Mh(){return Ko||(Ko=1,function(t){(function(e,n,r){function a(i){var s=this;s.next=function(){var u=s.w,f=s.X,h=s.i,d,b;return s.w=u=u+1640531527|0,b=f[h+34&127],d=f[h=h+1&127],b^=b<<13,d^=d<<17,b^=b>>>15,d^=d>>>12,b=f[h]=b^d,s.i=h,b+(u^u>>>16)|0};function c(u,f){var h,d,b,y,T,N=[],_=128;for(f===(f|0)?(d=f,f=null):(f=f+"\0",d=0,_=Math.max(_,f.length)),b=0,y=-32;y<_;++y)f&&(d^=f.charCodeAt((y+32)%f.length)),y===0&&(T=d),d^=d<<10,d^=d>>>15,d^=d<<4,d^=d>>>13,y>=0&&(T=T+1640531527|0,h=N[y&127]^=d+T,b=h==0?b+1:0);for(b>=128&&(N[(f&&f.length||0)&127]=-1),b=127,y=4*128;y>0;--y)d=N[b+34&127],h=N[b=b+1&127],d^=d<<13,h^=h<<17,d^=d>>>15,h^=h>>>12,N[b]=d^h;u.w=T,u.X=N,u.i=b}c(s,i)}function o(i,s){return s.i=i.i,s.w=i.w,s.X=i.X.slice(),s}function l(i,s){i==null&&(i=+new Date);var c=new a(i),u=s&&s.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,b=(h+d)/(1<<21);while(b===0);return b},f.int32=c.next,f.quick=f,u&&(u.X&&o(u,c),f.state=function(){return o(c,{})}),f}n&&n.exports?n.exports=l:this.xor4096=l})($h,t)}(Ht)),Ht.exports}var Bt={exports:{}},Hh=Bt.exports,Qo;function Bh(){return Qo||(Qo=1,function(t){(function(e,n,r){function a(i){var s=this,c="";s.next=function(){var f=s.b,h=s.c,d=s.d,b=s.a;return f=f<<25^f>>>7^h,h=h-d|0,d=d<<24^d>>>8^b,b=b-f|0,s.b=f=f<<20^f>>>12^h,s.c=h=h-d|0,s.d=d<<16^h>>>16^b,s.a=b-f|0},s.a=0,s.b=0,s.c=-1640531527,s.d=1367130551,i===Math.floor(i)?(s.a=i/4294967296|0,s.b=i|0):c+=i;for(var u=0;u<c.length+20;u++)s.b^=c.charCodeAt(u)|0,s.next()}function o(i,s){return s.a=i.a,s.b=i.b,s.c=i.c,s.d=i.d,s}function l(i,s){var c=new a(i),u=s&&s.state,f=function(){return(c.next()>>>0)/4294967296};return f.double=function(){do var h=c.next()>>>11,d=(c.next()>>>0)/4294967296,b=(h+d)/(1<<21);while(b===0);return b},f.int32=c.next,f.quick=f,u&&(typeof u=="object"&&o(u,c),f.state=function(){return o(c,{})}),f}n&&n.exports?n.exports=l:this.tychei=l})(Hh,t)}(Bt)),Bt.exports}var Vt={exports:{}};const Vh={},Uh=Object.freeze(Object.defineProperty({__proto__:null,default:Vh},Symbol.toStringTag,{value:"Module"})),qh=gi(Uh);var Wh=Vt.exports,Jo;function Xh(){return Jo||(Jo=1,function(t){(function(e,n,r){var a=256,o=6,l=52,i="random",s=r.pow(a,o),c=r.pow(2,l),u=c*2,f=a-1,h;function d(R,I,D){var m=[];I=I==!0?{entropy:!0}:I||{};var S=N(T(I.entropy?[R,A(n)]:R??_(),3),m),x=new b(m),k=function(){for(var L=x.g(o),j=s,w=0;L<c;)L=(L+w)*a,j*=a,w=x.g(1);for(;L>=u;)L/=2,j/=2,w>>>=1;return(L+w)/j};return k.int32=function(){return x.g(4)|0},k.quick=function(){return x.g(4)/4294967296},k.double=k,N(A(x.S),n),(I.pass||D||function(L,j,w,V){return V&&(V.S&&y(V,x),L.state=function(){return y(x,{})}),w?(r[i]=L,j):L})(k,S,"global"in I?I.global:this==r,I.state)}function b(R){var I,D=R.length,m=this,S=0,x=m.i=m.j=0,k=m.S=[];for(D||(R=[D++]);S<a;)k[S]=S++;for(S=0;S<a;S++)k[S]=k[x=f&x+R[S%D]+(I=k[S])],k[x]=I;(m.g=function(L){for(var j,w=0,V=m.i,K=m.j,O=m.S;L--;)j=O[V=f&V+1],w=w*a+O[f&(O[V]=O[K=f&K+j])+(O[K]=j)];return m.i=V,m.j=K,w})(a)}function y(R,I){return I.i=R.i,I.j=R.j,I.S=R.S.slice(),I}function T(R,I){var D=[],m=typeof R,S;if(I&&m=="object")for(S in R)try{D.push(T(R[S],I-1))}catch{}return D.length?D:m=="string"?R:R+"\0"}function N(R,I){for(var D=R+"",m,S=0;S<D.length;)I[f&S]=f&(m^=I[f&S]*19)+D.charCodeAt(S++);return A(I)}function _(){try{var R;return h&&(R=h.randomBytes)?R=R(a):(R=new Uint8Array(a),(e.crypto||e.msCrypto).getRandomValues(R)),A(R)}catch{var I=e.navigator,D=I&&I.plugins;return[+new Date,e,D,e.screen,A(n)]}}function A(R){return String.fromCharCode.apply(0,R)}if(N(r.random(),n),t.exports){t.exports=d;try{h=qh}catch{}}else r["seed"+i]=d})(typeof self<"u"?self:Wh,[],Math)}(Vt)),Vt.exports}var Xn,Zo;function Yh(){if(Zo)return Xn;Zo=1;var t=Nh(),e=zh(),n=Oh(),r=Fh(),a=Mh(),o=Bh(),l=Xh();return l.alea=t,l.xor128=e,l.xorwow=n,l.xorshift7=r,l.xor4096=a,l.tychei=o,Xn=l,Xn}var Kh=Yh();const vr=He(Kh),Qh={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"},ea={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"},Jh=["#5a2c6d","#0000ff","#cd071e","#00CED1","#9b3a31","#b2e061","#bd7ebe","#6ef7b3","#003366","#DEB887"],ta=t=>{const e="#5D6D7E",n=t?t.toLowerCase():"unknown",r=ee.getState().typeColorMap;if(r.has(n))return r.get(n)||e;const a=Qh[n];if(a){const c=ea[a],u=new Map(r);return u.set(n,c),ee.setState({typeColorMap:u}),c}const o=new Set(Array.from(r.entries()).filter(([,c])=>!Object.values(ea).includes(c)).map(([,c])=>c)),i=Jh.find(c=>!o.has(c))||e,s=new Map(r);return s.set(n,i),ee.setState({typeColorMap:s}),i},Zh=t=>{if(!t)return console.log("Graph validation failed: graph is null"),!1;if(!Array.isArray(t.nodes)||!Array.isArray(t.edges))return console.log("Graph validation failed: nodes or edges is not an array"),!1;if(t.nodes.length===0)return console.log("Graph validation failed: nodes array is empty"),!1;for(const e of t.nodes)if(!e.id||!e.labels||!e.properties)return console.log("Graph validation failed: invalid node structure"),!1;for(const e of t.edges)if(!e.id||!e.source||!e.target)return console.log("Graph validation failed: invalid edge structure"),!1;for(const e of t.edges){const n=t.getNode(e.source),r=t.getNode(e.target);if(n==null||r==null)return console.log("Graph validation failed: edge references non-existent node"),!1}return console.log("Graph validation passed"),!0},eg=async(t,e,n)=>{let r=null;if(!ee.getState().lastSuccessfulQueryLabel){console.log("Last successful queryLabel is empty");try{await ee.getState().fetchAllDatabaseLabels()}catch(i){console.error("Failed to fetch all database labels:",i)}}ee.getState().setLabelsFetchAttempted(!0);const o=t||"*";try{console.log(`Fetching graph label: ${o}, depth: ${e}, nodes: ${n}`),r=await _a(o,e,n)}catch(i){return Sr.getState().setErrorMessage(tn(i),"Query Graphs Error!"),null}let l=null;if(r){const i={},s={};for(let h=0;h<r.nodes.length;h++){const d=r.nodes[h];i[d.id]=h,d.x=Math.random(),d.y=Math.random(),d.degree=0,d.size=10}for(let h=0;h<r.edges.length;h++){const d=r.edges[h];s[d.id]=h;const b=i[d.source],y=i[d.target];if(b!==void 0&&b!==void 0){const T=r.nodes[b],N=r.nodes[y];if(!T){console.error(`Source node ${d.source} is undefined`);continue}if(!N){console.error(`Target node ${d.target} is undefined`);continue}T.degree+=1,N.degree+=1}}let c=Number.MAX_SAFE_INTEGER,u=0;for(const h of r.nodes)c=Math.min(c,h.degree),u=Math.max(u,h.degree);const f=u-c;if(f>0){const h=Qn-ut;for(const d of r.nodes)d.size=Math.round(ut+h*Math.pow((d.degree-c)/f,.5))}l=new tl,l.nodes=r.nodes,l.edges=r.edges,l.nodeIdMap=i,l.edgeIdMap=s,Zh(l)||(l=null,console.warn("Invalid graph data")),console.log("Graph data loaded")}return{rawGraph:l,is_truncated:r.is_truncated}},tg=t=>{var i,s;const e=ne.getState().minEdgeSize,n=ne.getState().maxEdgeSize;if(!t||!t.nodes.length)return console.log("No graph data available, skipping sigma graph creation"),null;const r=new Yn;for(const c of(t==null?void 0:t.nodes)??[]){vr(c.id+Date.now().toString(),{global:!0});const u=Math.random(),f=Math.random();r.addNode(c.id,{label:c.labels.join(", "),color:c.color,x:u,y:f,size:c.size,borderColor:Kn,borderSize:.2})}for(const c of(t==null?void 0:t.edges)??[]){const u=((i=c.properties)==null?void 0:i.weight)!==void 0?Number(c.properties.weight):1;c.dynamicId=r.addEdge(c.source,c.target,{label:((s=c.properties)==null?void 0:s.keywords)||void 0,size:u,originalWeight:u,type:"curvedNoArrow"})}let a=Number.MAX_SAFE_INTEGER,o=0;r.forEachEdge(c=>{const u=r.getEdgeAttribute(c,"originalWeight")||1;a=Math.min(a,u),o=Math.max(o,u)});const l=o-a;if(l>0){const c=n-e;r.forEachEdge(u=>{const f=r.getEdgeAttribute(u,"originalWeight")||1,h=e+c*Math.pow((f-a)/l,.5);r.setEdgeAttribute(u,"size",h)})}else r.forEachEdge(c=>{r.setEdgeAttribute(c,"size",e)});return r},ng=()=>{const{t}=xe(),e=ne.use.queryLabel(),n=ee.use.rawGraph(),r=ee.use.sigmaGraph(),a=ne.use.graphQueryMaxDepth(),o=ne.use.graphMaxNodes(),l=ee.use.isFetching(),i=ee.use.nodeToExpand(),s=ee.use.nodeToPrune(),c=p.useRef(!1),u=p.useRef(!1),f=p.useRef(!1),h=p.useCallback(N=>(n==null?void 0:n.getNode(N))||null,[n]),d=p.useCallback((N,_=!0)=>(n==null?void 0:n.getEdge(N,_))||null,[n]),b=p.useRef(!1);p.useEffect(()=>{if(!e&&(n!==null||r!==null)){const N=ee.getState();N.reset(),N.setGraphDataFetchAttempted(!1),N.setLabelsFetchAttempted(!1),c.current=!1,u.current=!1}},[e,n,r]),p.useEffect(()=>{if(!b.current&&!(!e&&f.current)&&!l&&!ee.getState().graphDataFetchAttempted){b.current=!0,ee.getState().setGraphDataFetchAttempted(!0);const N=ee.getState();N.setIsFetching(!0),N.clearSelection(),N.sigmaGraph&&N.sigmaGraph.forEachNode(D=>{var m;(m=N.sigmaGraph)==null||m.setNodeAttribute(D,"highlighted",!1)}),console.log("Preparing graph data...");const _=e,A=a,R=o;let I;_?I=eg(_,A,R):(console.log("Query label is empty, show empty graph"),I=Promise.resolve({rawGraph:null,is_truncated:!1})),I.then(D=>{const m=ee.getState(),S=D==null?void 0:D.rawGraph;if(S&&S.nodes&&S.nodes.forEach(x=>{var L;const k=(L=x.properties)==null?void 0:L.entity_type;x.color=ta(k)}),D!=null&&D.is_truncated&&nt.info(t("graphPanel.dataIsTruncated","Graph data is truncated to Max Nodes")),m.reset(),!S||!S.nodes||S.nodes.length===0){const x=new Yn;x.addNode("empty-graph-node",{label:t("graphPanel.emptyGraph"),color:"#5D6D7E",x:.5,y:.5,size:15,borderColor:Kn,borderSize:.2}),m.setSigmaGraph(x),m.setRawGraph(null),m.setGraphIsEmpty(!0);const k=Sr.getState().message,L=k&&k.includes("Authentication required");!L&&_&&ne.getState().setQueryLabel(""),L?console.log("Keep queryLabel for post-login reload"):m.setLastSuccessfulQueryLabel(""),console.log(`Graph data is empty, created graph with empty graph node. Auth error: ${L}`)}else{const x=tg(S);S.buildDynamicMap(),m.setSigmaGraph(x),m.setRawGraph(S),m.setGraphIsEmpty(!1),m.setLastSuccessfulQueryLabel(_),m.setMoveToSelectedNode(!0)}c.current=!0,u.current=!0,b.current=!1,m.setIsFetching(!1),(!S||!S.nodes||S.nodes.length===0)&&!_&&(f.current=!0)}).catch(D=>{console.error("Error fetching graph data:",D);const m=ee.getState();m.setIsFetching(!1),c.current=!1,b.current=!1,m.setGraphDataFetchAttempted(!1),m.setLastSuccessfulQueryLabel("")})}},[e,a,o,l,t]),p.useEffect(()=>{i&&((async _=>{var A,R,I,D,m,S;if(!(!_||!r||!n))try{const x=n.getNode(_);if(!x){console.error("Node not found:",_);return}const k=x.labels[0];if(!k){console.error("Node has no label:",_);return}const L=await _a(k,2,1e3);if(!L||!L.nodes||!L.edges){console.error("Failed to fetch extended graph");return}const j=[];for(const F of L.nodes){vr(F.id,{global:!0});const Q=(A=F.properties)==null?void 0:A.entity_type,q=ta(Q);j.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 L.edges)w.push({id:F.id,source:F.source,target:F.target,type:F.type,properties:F.properties,dynamicId:""});const V={};r.forEachNode(F=>{V[F]={x:r.getNodeAttribute(F,"x"),y:r.getNodeAttribute(F,"y")}});const K=new Set(r.nodes()),O=new Set,C=new Set,E=1;let H=0,ae=Number.MAX_SAFE_INTEGER,$=0;r.forEachNode(F=>{const Q=r.degree(F);H=Math.max(H,Q)}),r.forEachEdge(F=>{const Q=r.getEdgeAttribute(F,"originalWeight")||1;ae=Math.min(ae,Q),$=Math.max($,Q)});for(const F of j){if(K.has(F.id))continue;w.some(q=>q.source===_&&q.target===F.id||q.target===_&&q.source===F.id)&&O.add(F.id)}const v=new Map,z=new Map,B=new Set;for(const F of w){const Q=K.has(F.source)||O.has(F.source),q=K.has(F.target)||O.has(F.target);Q&&q?(C.add(F.id),O.has(F.source)?v.set(F.source,(v.get(F.source)||0)+1):K.has(F.source)&&z.set(F.source,(z.get(F.source)||0)+1),O.has(F.target)?v.set(F.target,(v.get(F.target)||0)+1):K.has(F.target)&&z.set(F.target,(z.get(F.target)||0)+1)):(r.hasNode(F.source)?B.add(F.source):O.has(F.source)&&(B.add(F.source),v.set(F.source,(v.get(F.source)||0)+1)),r.hasNode(F.target)?B.add(F.target):O.has(F.target)&&(B.add(F.target),v.set(F.target,(v.get(F.target)||0)+1)))}const M=(F,Q,q,U)=>{const P=U-q||1,oe=Qn-ut;for(const ue of Q)if(F.hasNode(ue)){let te=F.degree(ue);te+=1;const Z=Math.min(te,U+1),G=Math.round(ut+oe*Math.pow((Z-q)/P,.5));F.setNodeAttribute(ue,"size",G)}},J=(F,Q,q)=>{const U=ne.getState().minEdgeSize,P=ne.getState().maxEdgeSize,oe=q-Q||1,ue=P-U;F.forEachEdge(te=>{const Z=F.getEdgeAttribute(te,"originalWeight")||1,G=U+ue*Math.pow((Z-Q)/oe,.5);F.setEdgeAttribute(te,"size",G)})};if(O.size===0){M(r,B,E,H),nt.info(t("graphPanel.propertiesView.node.noNewNodes"));return}for(const[,F]of v.entries())H=Math.max(H,F);for(const[F,Q]of z.entries()){const U=r.degree(F)+Q;H=Math.max(H,U)}const X=H-E||1,Y=Qn-ut,ie=((R=ee.getState().sigmaInstance)==null?void 0:R.getCamera().ratio)||1,re=Math.max(Math.sqrt(x.size)*4,Math.sqrt(O.size)*3)/ie;vr(Date.now().toString(),{global:!0});const se=Math.random()*2*Math.PI;console.log("nodeSize:",x.size,"nodesToAdd:",O.size),console.log("cameraRatio:",Math.round(ie*100)/100,"spreadFactor:",Math.round(re*100)/100);for(const F of O){const Q=j.find(Z=>Z.id===F),q=v.get(F)||0,U=Math.min(q,H+1),P=Math.round(ut+Y*Math.pow((U-E)/X,.5)),oe=2*Math.PI*(Array.from(O).indexOf(F)/O.size),ue=((I=V[F])==null?void 0:I.x)||V[x.id].x+Math.cos(se+oe)*re,te=((D=V[F])==null?void 0:D.y)||V[x.id].y+Math.sin(se+oe)*re;r.addNode(F,{label:Q.labels.join(", "),color:Q.color,x:ue,y:te,size:P,borderColor:Kn,borderSize:.2}),n.getNode(F)||(Q.size=P,Q.x=ue,Q.y=te,Q.degree=q,n.nodes.push(Q),n.nodeIdMap[F]=n.nodes.length-1)}for(const F of C){const Q=w.find(U=>U.id===F);if(r.hasEdge(Q.source,Q.target))continue;const q=((m=Q.properties)==null?void 0:m.weight)!==void 0?Number(Q.properties.weight):1;ae=Math.min(ae,q),$=Math.max($,q),Q.dynamicId=r.addEdge(Q.source,Q.target,{label:((S=Q.properties)==null?void 0:S.keywords)||void 0,size:q,originalWeight:q,type:"curvedNoArrow"}),n.getEdge(Q.id,!1)?console.error("Edge already exists in rawGraph:",Q.id):(n.edges.push(Q),n.edgeIdMap[Q.id]=n.edges.length-1,n.edgeDynamicIdMap[Q.dynamicId]=n.edges.length-1)}if(n.buildDynamicMap(),ee.getState().resetSearchEngine(),M(r,B,E,H),J(r,ae,$),r.hasNode(_)){const F=r.degree(_),Q=Math.min(F,H+1),q=Math.round(ut+Y*Math.pow((Q-E)/X,.5));r.setNodeAttribute(_,"size",q),x.size=q,x.degree=F}}catch(x){console.error("Error expanding node:",x)}})(i),window.setTimeout(()=>{ee.getState().triggerNodeExpand(null)},0))},[i,r,n,t]);const y=p.useCallback((N,_)=>{const A=new Set([N]);return _.forEachNode(R=>{if(R===N)return;const I=_.neighbors(R);I.length===1&&I[0]===N&&A.add(R)}),A},[]);return p.useEffect(()=>{s&&((_=>{if(!(!_||!r||!n))try{const A=ee.getState();if(!r.hasNode(_)){console.error("Node not found:",_);return}const R=y(_,r);if(R.size===r.nodes().length){nt.error(t("graphPanel.propertiesView.node.deleteAllNodesError"));return}A.clearSelection();for(const I of R){r.dropNode(I);const D=n.nodeIdMap[I];if(D!==void 0){const m=n.edges.filter(S=>S.source===I||S.target===I);for(const S of m){const x=n.edgeIdMap[S.id];if(x!==void 0){n.edges.splice(x,1);for(const[k,L]of Object.entries(n.edgeIdMap))L>x&&(n.edgeIdMap[k]=L-1);delete n.edgeIdMap[S.id],delete n.edgeDynamicIdMap[S.dynamicId]}}n.nodes.splice(D,1);for(const[S,x]of Object.entries(n.nodeIdMap))x>D&&(n.nodeIdMap[S]=x-1);delete n.nodeIdMap[I]}}n.buildDynamicMap(),ee.getState().resetSearchEngine(),R.size>1&&nt.info(t("graphPanel.propertiesView.node.nodesRemoved",{count:R.size}))}catch(A){console.error("Error pruning node:",A)}})(s),window.setTimeout(()=>{ee.getState().triggerNodePrune(null)},0))},[s,r,n,y,t]),{lightrageGraph:p.useCallback(()=>{if(r)return r;console.log("Creating new Sigma graph instance");const N=new Yn;return ee.getState().setSigmaGraph(N),N},[r]),getNode:h,getEdge:d}},rg=({name:t})=>{const{t:e}=xe(),n=r=>{const a=`graphPanel.propertiesView.node.propertyNames.${r}`,o=e(a);return o===a?r:o};return g.jsx("span",{className:"text-primary/60 tracking-wide whitespace-nowrap",children:n(t)})},og=({onClick:t})=>g.jsx("div",{children:g.jsx(su,{className:"h-3 w-3 text-gray-500 hover:text-gray-700 cursor-pointer",onClick:t})}),ag=({value:t,onClick:e,tooltip:n})=>g.jsx("div",{className:"flex items-center gap-1 overflow-hidden",children:g.jsx(Bs,{className:"hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis whitespace-nowrap",tooltipClassName:"max-w-80 -translate-x-15",text:t,tooltip:n||(typeof t=="string"?t:JSON.stringify(t,null,2)),side:"left",onClick:e})}),sg=({isOpen:t,onClose:e,onSave:n,propertyName:r,initialValue:a,isSubmitting:o=!1})=>{const{t:l}=xe(),[i,s]=p.useState("");p.useEffect(()=>{t&&s(a)},[t,a]);const c=h=>{const d=`graphPanel.propertiesView.node.propertyNames.${h}`,b=l(d);return b===d?h:b},u=h=>{switch(h){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:{}}}},f=()=>{i.trim()!==""&&(n(i),e())};return g.jsx(Lu,{open:t,onOpenChange:h=>!h&&e(),children:g.jsxs(Wa,{className:"sm:max-w-md",children:[g.jsxs(Xa,{children:[g.jsx(Ka,{children:l("graphPanel.propertiesView.editProperty",{property:c(r)})}),g.jsx(Qa,{children:l("graphPanel.propertiesView.editPropertyDescription")})]}),g.jsx("div",{className:"grid gap-4 py-4",children:(()=>{const h=u(r);return r==="description"?g.jsx("textarea",{value:i,onChange:d=>s(d.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 ${h.className}`,style:h.style,disabled:o}):g.jsx("textarea",{value:i,onChange:d=>s(d.target.value),rows:h.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 ${h.className}`,disabled:o})})()}),g.jsxs(Ya,{children:[g.jsx(be,{type:"button",variant:"outline",onClick:e,disabled:o,children:l("common.cancel")}),g.jsx(be,{type:"button",onClick:f,disabled:o,children:l("common.save")})]})]})})},ig=({name:t,value:e,onClick:n,nodeId:r,edgeId:a,entityId:o,dynamicId:l,entityType:i,sourceId:s,targetId:c,onValueChange:u,isEditable:f=!1,tooltip:h})=>{const{t:d}=xe(),[b,y]=p.useState(!1),[T,N]=p.useState(!1),[_,A]=p.useState(e);p.useEffect(()=>{A(e)},[e]);const R=()=>{f&&!b&&y(!0)},I=()=>{y(!1)},D=async m=>{if(T||m===String(_)){y(!1);return}N(!0);try{if(i==="node"&&o&&r){let S={[t]:m};if(t==="entity_id"){if(await cl(m)){nt.error(d("graphPanel.propertiesView.errors.duplicateName"));return}S={entity_name:m}}await il(o,S,!0);try{await ee.getState().updateNodeAndSelect(r,o,t,m)}catch(x){throw console.error("Error updating node in graph:",x),new Error("Failed to update node in graph")}nt.success(d("graphPanel.propertiesView.success.entityUpdated"))}else if(i==="edge"&&s&&c&&a&&l){const S={[t]:m};await ll(s,c,S);try{await ee.getState().updateEdgeAndSelect(a,l,s,c,t,m)}catch(x){throw console.error(`Error updating edge ${s}->${c} in graph:`,x),new Error("Failed to update edge in graph")}nt.success(d("graphPanel.propertiesView.success.relationUpdated"))}y(!1),A(m),u==null||u(m)}catch(S){console.error("Error updating property:",S),nt.error(d("graphPanel.propertiesView.errors.updateFailed"))}finally{N(!1)}};return g.jsxs("div",{className:"flex items-center gap-1 overflow-hidden",children:[g.jsx(rg,{name:t}),g.jsx(og,{onClick:R}),":",g.jsx(ag,{value:_,onClick:n,tooltip:h||(typeof _=="string"?_:JSON.stringify(_,null,2))}),g.jsx(sg,{isOpen:b,onClose:I,onSave:D,propertyName:t,initialValue:String(_),isSubmitting:T})]})},lg=()=>{const{getNode:t,getEdge:e}=ng(),n=ee.use.selectedNode(),r=ee.use.focusedNode(),a=ee.use.selectedEdge(),o=ee.use.focusedEdge(),l=ee.use.graphDataVersion(),[i,s]=p.useState(null),[c,u]=p.useState(null);return p.useEffect(()=>{let f=null,h=null;r?(f="node",h=t(r)):n?(f="node",h=t(n)):o?(f="edge",h=e(o,!0)):a&&(f="edge",h=e(a,!0)),h?(f=="node"?s(cg(h)):s(ug(h)),u(f)):(s(null),u(null))},[r,n,o,a,l,s,u,t,e]),i?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(dg,{node:i}):g.jsx(fg,{edge:i})}):g.jsx(g.Fragment,{})},cg=t=>{const e=ee.getState(),n=[];if(e.sigmaGraph&&e.rawGraph)try{if(!e.sigmaGraph.hasNode(t.id))return console.warn("Node not found in sigmaGraph:",t.id),{...t,relationships:[]};const r=e.sigmaGraph.edges(t.id);for(const a of r){if(!e.sigmaGraph.hasEdge(a))continue;const o=e.rawGraph.getEdge(a,!0);if(o){const i=t.id===o.source?o.target:o.source;if(!e.sigmaGraph.hasNode(i))continue;const s=e.rawGraph.getNode(i);s&&n.push({type:"Neighbour",id:i,label:s.properties.entity_id?s.properties.entity_id:s.labels.join(", ")})}}}catch(r){console.error("Error refining node properties:",r)}return{...t,relationships:n}},ug=t=>{const e=ee.getState();let n,r;if(e.sigmaGraph&&e.rawGraph)try{if(!e.sigmaGraph.hasEdge(t.dynamicId))return console.warn("Edge not found in sigmaGraph:",t.id,"dynamicId:",t.dynamicId),{...t,sourceNode:void 0,targetNode:void 0};e.sigmaGraph.hasNode(t.source)&&(n=e.rawGraph.getNode(t.source)),e.sigmaGraph.hasNode(t.target)&&(r=e.rawGraph.getNode(t.target))}catch(a){console.error("Error refining edge properties:",a)}return{...t,sourceNode:n,targetNode:r}},Me=({name:t,value:e,onClick:n,tooltip:r,nodeId:a,edgeId:o,dynamicId:l,entityId:i,entityType:s,sourceId:c,targetId:u,isEditable:f=!1})=>{const{t:h}=xe(),d=b=>{const y=`graphPanel.propertiesView.node.propertyNames.${b}`,T=h(y);return T===y?b:T};return f&&(t==="description"||t==="entity_id"||t==="keywords")?g.jsx(ig,{name:t,value:e,onClick:n,nodeId:a,entityId:i,edgeId:o,dynamicId:l,entityType:s,sourceId:c,targetId:u,isEditable:!0,tooltip:r||(typeof e=="string"?e:JSON.stringify(e,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(t)}),":",g.jsx(Bs,{className:"hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis",tooltipClassName:"max-w-80 -translate-x-13",text:e,tooltip:r||(typeof e=="string"?e:JSON.stringify(e,null,2)),side:"left",onClick:n})]})},dg=({node:t})=>{const{t:e}=xe(),n=()=>{ee.getState().triggerNodeExpand(t.id)},r=()=>{ee.getState().triggerNodePrune(t.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:e("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:n,tooltip:e("graphPanel.propertiesView.node.expandNode"),children:g.jsx(Uc,{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:r,tooltip:e("graphPanel.propertiesView.node.pruneNode"),children:g.jsx(mu,{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(Me,{name:e("graphPanel.propertiesView.node.id"),value:String(t.id)}),g.jsx(Me,{name:e("graphPanel.propertiesView.node.labels"),value:t.labels.join(", "),onClick:()=>{ee.getState().setSelectedNode(t.id,!0)}}),g.jsx(Me,{name:e("graphPanel.propertiesView.node.degree"),value:t.degree})]}),g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:e("graphPanel.propertiesView.node.properties")}),g.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(t.properties).sort().map(a=>g.jsx(Me,{name:a,value:t.properties[a],nodeId:String(t.id),entityId:t.properties.entity_id,entityType:"node",isEditable:a==="description"||a==="entity_id"},a))}),t.relationships.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-emerald-700",children:e("graphPanel.propertiesView.node.relationships")}),g.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:t.relationships.map(({type:a,id:o,label:l})=>g.jsx(Me,{name:a,value:l,onClick:()=>{ee.getState().setSelectedNode(o,!0)}},o))})]})]})},fg=({edge:t})=>{const{t:e}=xe();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:e("graphPanel.propertiesView.edge.title")}),g.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[g.jsx(Me,{name:e("graphPanel.propertiesView.edge.id"),value:t.id}),t.type&&g.jsx(Me,{name:e("graphPanel.propertiesView.edge.type"),value:t.type}),g.jsx(Me,{name:e("graphPanel.propertiesView.edge.source"),value:t.sourceNode?t.sourceNode.labels.join(", "):t.source,onClick:()=>{ee.getState().setSelectedNode(t.source,!0)}}),g.jsx(Me,{name:e("graphPanel.propertiesView.edge.target"),value:t.targetNode?t.targetNode.labels.join(", "):t.target,onClick:()=>{ee.getState().setSelectedNode(t.target,!0)}})]}),g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:e("graphPanel.propertiesView.edge.properties")}),g.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(t.properties).sort().map(n=>{var r,a;return g.jsx(Me,{name:n,value:t.properties[n],edgeId:String(t.id),dynamicId:String(t.dynamicId),entityType:"edge",sourceId:((r=t.sourceNode)==null?void 0:r.properties.entity_id)||t.source,targetId:((a=t.targetNode)==null?void 0:a.properties.entity_id)||t.target,isEditable:n==="description"||n==="keywords"},n)})})]})},hg=()=>{const{t}=xe(),e=ne.use.graphQueryMaxDepth(),n=ne.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:[t("graphPanel.sideBar.settings.depth"),": ",e]}),g.jsxs("div",{children:[t("graphPanel.sideBar.settings.max"),": ",n]})]})},Vs=p.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:fe("bg-card text-card-foreground rounded-xl border shadow",t),...e}));Vs.displayName="Card";const gg=p.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:fe("flex flex-col space-y-1.5 p-6",t),...e}));gg.displayName="CardHeader";const pg=p.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:fe("leading-none font-semibold tracking-tight",t),...e}));pg.displayName="CardTitle";const mg=p.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:fe("text-muted-foreground text-sm",t),...e}));mg.displayName="CardDescription";const vg=p.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:fe("p-6 pt-0",t),...e}));vg.displayName="CardContent";const yg=p.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:fe("flex items-center p-6 pt-0",t),...e}));yg.displayName="CardFooter";function bg(t,e){return p.useReducer((n,r)=>e[n][r]??n,t)}var Gr="ScrollArea",[Us,Ip]=br(Gr),[wg,Ne]=Us(Gr),qs=p.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:o=600,...l}=t,[i,s]=p.useState(null),[c,u]=p.useState(null),[f,h]=p.useState(null),[d,b]=p.useState(null),[y,T]=p.useState(null),[N,_]=p.useState(0),[A,R]=p.useState(0),[I,D]=p.useState(!1),[m,S]=p.useState(!1),x=Xe(e,L=>s(L)),k=Gi(a);return g.jsx(wg,{scope:n,type:r,dir:k,scrollHideDelay:o,scrollArea:i,viewport:c,onViewportChange:u,content:f,onContentChange:h,scrollbarX:d,onScrollbarXChange:b,scrollbarXEnabled:I,onScrollbarXEnabledChange:D,scrollbarY:y,onScrollbarYChange:T,scrollbarYEnabled:m,onScrollbarYEnabledChange:S,onCornerWidthChange:_,onCornerHeightChange:R,children:g.jsx(Se.div,{dir:k,...l,ref:x,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});qs.displayName=Gr;var Ws="ScrollAreaViewport",Xs=p.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:a,...o}=t,l=Ne(Ws,n),i=p.useRef(null),s=Xe(e,i,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(Se.div,{"data-radix-scroll-area-viewport":"",...o,ref:s,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:g.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Xs.displayName=Ws;var Ve="ScrollAreaScrollbar",Fr=p.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Ne(Ve,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=a,i=t.orientation==="horizontal";return p.useEffect(()=>(i?o(!0):l(!0),()=>{i?o(!1):l(!1)}),[i,o,l]),a.type==="hover"?g.jsx(xg,{...r,ref:e,forceMount:n}):a.type==="scroll"?g.jsx(Eg,{...r,ref:e,forceMount:n}):a.type==="auto"?g.jsx(Ys,{...r,ref:e,forceMount:n}):a.type==="always"?g.jsx($r,{...r,ref:e}):null});Fr.displayName=Ve;var xg=p.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Ne(Ve,t.__scopeScrollArea),[o,l]=p.useState(!1);return p.useEffect(()=>{const i=a.scrollArea;let s=0;if(i){const c=()=>{window.clearTimeout(s),l(!0)},u=()=>{s=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",c),i.addEventListener("pointerleave",u),()=>{window.clearTimeout(s),i.removeEventListener("pointerenter",c),i.removeEventListener("pointerleave",u)}}},[a.scrollArea,a.scrollHideDelay]),g.jsx(Et,{present:n||o,children:g.jsx(Ys,{"data-state":o?"visible":"hidden",...r,ref:e})})}),Eg=p.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Ne(Ve,t.__scopeScrollArea),o=t.orientation==="horizontal",l=fn(()=>s("SCROLL_END"),100),[i,s]=bg("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(i==="idle"){const c=window.setTimeout(()=>s("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(c)}},[i,a.scrollHideDelay,s]),p.useEffect(()=>{const c=a.viewport,u=o?"scrollLeft":"scrollTop";if(c){let f=c[u];const h=()=>{const d=c[u];f!==d&&(s("SCROLL"),l()),f=d};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[a.viewport,o,s,l]),g.jsx(Et,{present:n||i!=="hidden",children:g.jsx($r,{"data-state":i==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Ce(t.onPointerEnter,()=>s("POINTER_ENTER")),onPointerLeave:Ce(t.onPointerLeave,()=>s("POINTER_LEAVE"))})})}),Ys=p.forwardRef((t,e)=>{const n=Ne(Ve,t.__scopeScrollArea),{forceMount:r,...a}=t,[o,l]=p.useState(!1),i=t.orientation==="horizontal",s=fn(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;l(i?c:u)}},10);return xt(n.viewport,s),xt(n.content,s),g.jsx(Et,{present:r||o,children:g.jsx($r,{"data-state":o?"visible":"hidden",...a,ref:e})})}),$r=p.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,a=Ne(Ve,t.__scopeScrollArea),o=p.useRef(null),l=p.useRef(0),[i,s]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=ei(i.viewport,i.content),u={...r,sizes:i,onSizesChange:s,hasThumb:c>0&&c<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:h=>l.current=h};function f(h,d){return Rg(h,l.current,i,d)}return n==="horizontal"?g.jsx(Sg,{...u,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollLeft,d=na(h,i,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))}}):n==="vertical"?g.jsx(_g,{...u,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollTop,d=na(h,i);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}),Sg=p.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...a}=t,o=Ne(Ve,t.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),c=Xe(e,s,o.onScrollbarXChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),g.jsx(Qs,{"data-orientation":"horizontal",...a,ref:c,sizes:n,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":dn(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+u.deltaX;t.onWheelScroll(h),ni(h,f)&&u.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:s.current.clientWidth,paddingStart:Jt(l.paddingLeft),paddingEnd:Jt(l.paddingRight)}})}})}),_g=p.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...a}=t,o=Ne(Ve,t.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),c=Xe(e,s,o.onScrollbarYChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),g.jsx(Qs,{"data-orientation":"vertical",...a,ref:c,sizes:n,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":dn(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(o.viewport){const h=o.viewport.scrollTop+u.deltaY;t.onWheelScroll(h),ni(h,f)&&u.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:s.current.clientHeight,paddingStart:Jt(l.paddingTop),paddingEnd:Jt(l.paddingBottom)}})}})}),[Cg,Ks]=Us(Ve),Qs=p.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:s,onDragScroll:c,onWheelScroll:u,onResize:f,...h}=t,d=Ne(Ve,n),[b,y]=p.useState(null),T=Xe(e,x=>y(x)),N=p.useRef(null),_=p.useRef(""),A=d.viewport,R=r.content-r.viewport,I=ct(u),D=ct(s),m=fn(f,10);function S(x){if(N.current){const k=x.clientX-N.current.left,L=x.clientY-N.current.top;c({x:k,y:L})}}return p.useEffect(()=>{const x=k=>{const L=k.target;(b==null?void 0:b.contains(L))&&I(k,R)};return document.addEventListener("wheel",x,{passive:!1}),()=>document.removeEventListener("wheel",x,{passive:!1})},[A,b,R,I]),p.useEffect(D,[r,D]),xt(b,m),xt(d.content,m),g.jsx(Cg,{scope:n,scrollbar:b,hasThumb:a,onThumbChange:ct(o),onThumbPointerUp:ct(l),onThumbPositionChange:D,onThumbPointerDown:ct(i),children:g.jsx(Se.div,{...h,ref:T,style:{position:"absolute",...h.style},onPointerDown:Ce(t.onPointerDown,x=>{x.button===0&&(x.target.setPointerCapture(x.pointerId),N.current=b.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",d.viewport&&(d.viewport.style.scrollBehavior="auto"),S(x))}),onPointerMove:Ce(t.onPointerMove,S),onPointerUp:Ce(t.onPointerUp,x=>{const k=x.target;k.hasPointerCapture(x.pointerId)&&k.releasePointerCapture(x.pointerId),document.body.style.webkitUserSelect=_.current,d.viewport&&(d.viewport.style.scrollBehavior=""),N.current=null})})})}),Qt="ScrollAreaThumb",Js=p.forwardRef((t,e)=>{const{forceMount:n,...r}=t,a=Ks(Qt,t.__scopeScrollArea);return g.jsx(Et,{present:n||a.hasThumb,children:g.jsx(kg,{ref:e,...r})})}),kg=p.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...a}=t,o=Ne(Qt,n),l=Ks(Qt,n),{onThumbPositionChange:i}=l,s=Xe(e,f=>l.onThumbChange(f)),c=p.useRef(void 0),u=fn(()=>{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=Ag(f,i);c.current=d,i()}};return i(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,u,i]),g.jsx(Se.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:s,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ce(t.onPointerDownCapture,f=>{const d=f.target.getBoundingClientRect(),b=f.clientX-d.left,y=f.clientY-d.top;l.onThumbPointerDown({x:b,y})}),onPointerUp:Ce(t.onPointerUp,l.onThumbPointerUp)})});Js.displayName=Qt;var Mr="ScrollAreaCorner",Zs=p.forwardRef((t,e)=>{const n=Ne(Mr,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?g.jsx(Tg,{...t,ref:e}):null});Zs.displayName=Mr;var Tg=p.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,a=Ne(Mr,n),[o,l]=p.useState(0),[i,s]=p.useState(0),c=!!(o&&i);return xt(a.scrollbarX,()=>{var f;const u=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(u),s(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(Se.div,{...r,ref:e,style:{width:o,height:i,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Jt(t){return t?parseInt(t,10):0}function ei(t,e){const n=t/e;return isNaN(n)?0:n}function dn(t){const e=ei(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Rg(t,e,n,r="ltr"){const a=dn(n),o=a/2,l=e||o,i=a-l,s=n.scrollbar.paddingStart+l,c=n.scrollbar.size-n.scrollbar.paddingEnd-i,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return ti([s,c],f)(t)}function na(t,e,n="ltr"){const r=dn(e),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-a,l=e.content-e.viewport,i=o-r,s=n==="ltr"?[0,l]:[l*-1,0],c=$i(t,s);return ti([0,l],[0,i])(c)}function ti(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function ni(t,e){return t>0&&t<e}var Ag=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return function a(){const o={left:t.scrollLeft,top:t.scrollTop},l=n.left!==o.left,i=n.top!==o.top;(l||i)&&e(),n=o,r=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(r)};function fn(t,e){const n=ct(t),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function xt(t,e){const n=ct(e);Fi(()=>{let r=0;if(t){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(t),()=>{window.cancelAnimationFrame(r),a.unobserve(t)}}},[t,n])}var ri=qs,jg=Xs,Ig=Zs;const oi=p.forwardRef(({className:t,children:e,...n},r)=>g.jsxs(ri,{ref:r,className:fe("relative overflow-hidden",t),...n,children:[g.jsx(jg,{className:"h-full w-full rounded-[inherit]",children:e}),g.jsx(ai,{}),g.jsx(Ig,{})]}));oi.displayName=ri.displayName;const ai=p.forwardRef(({className:t,orientation:e="vertical",...n},r)=>g.jsx(Fr,{ref:r,orientation:e,className:fe("flex touch-none transition-colors select-none",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:g.jsx(Js,{className:"bg-border relative flex-1 rounded-full"})}));ai.displayName=Fr.displayName;const Lg=({className:t})=>{const{t:e}=xe(),n=ee.use.typeColorMap();return!n||n.size===0?null:g.jsxs(Vs,{className:`p-2 max-w-xs ${t}`,children:[g.jsx("h3",{className:"text-sm font-medium mb-2",children:e("graphPanel.legend")}),g.jsx(oi,{className:"max-h-80",children:g.jsx("div",{className:"flex flex-col gap-1",children:Array.from(n.entries()).map(([r,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:r,children:e(`graphPanel.nodeTypes.${r.toLowerCase()}`,r)})]},r))})})]})},Ng=()=>{const{t}=xe(),e=ne.use.showLegend(),n=ne.use.setShowLegend(),r=p.useCallback(()=>{n(!e)},[e,n]);return g.jsx(be,{variant:Le,onClick:r,tooltip:t("graphPanel.sideBar.legendControl.toggleLegend"),size:"icon",children:g.jsx(Ic,{})})},ra={allowInvalidContainer:!0,defaultNodeType:"default",defaultEdgeType:"curvedNoArrow",renderEdgeLabels:!1,edgeProgramClasses:{arrow:xi,curvedArrow:Ad,curvedNoArrow:Rd},nodeProgramClasses:{default:dd,circel:wi,point:Fu},labelGridCellSize:60,labelRenderedSizeThreshold:12,enableEdgeEvents:!0,labelColor:{color:"#000",attribute:"labelColor"},edgeLabelColor:{color:"#000",attribute:"labelColor"},edgeLabelSize:8,labelSize:12},Pg=()=>{const t=ha(),e=Be(),[n,r]=p.useState(null);return p.useEffect(()=>{t({downNode:a=>{r(a.node),e.getGraph().setNodeAttribute(a.node,"highlighted",!0)},mousemovebody:a=>{if(!n)return;const o=e.viewportToGraph(a);e.getGraph().setNodeAttribute(n,"x",o.x),e.getGraph().setNodeAttribute(n,"y",o.y),a.preventSigmaDefault(),a.original.preventDefault(),a.original.stopPropagation()},mouseup:()=>{n&&(r(null),e.getGraph().removeNodeAttribute(n,"highlighted"))},mousedown:a=>{a.original.buttons!==0&&!e.getCustomBBox()&&e.setCustomBBox(e.getBBox())}})},[t,e,n]),null},Lp=()=>{const[t,e]=p.useState(ra),n=p.useRef(null),r=ee.use.selectedNode(),a=ee.use.focusedNode(),o=ee.use.moveToSelectedNode(),l=ee.use.isFetching(),i=ne.use.showPropertyPanel(),s=ne.use.showNodeSearchBar(),c=ne.use.enableNodeDrag(),u=ne.use.showLegend();p.useEffect(()=>{e(ra),console.log("Initialized sigma settings")},[]),p.useEffect(()=>()=>{const y=ee.getState().sigmaInstance;if(y)try{y.kill(),ee.getState().setSigmaInstance(null),console.log("Cleared sigma instance on Graphviewer unmount")}catch(T){console.error("Error cleaning up sigma instance:",T)}},[]);const f=p.useCallback(y=>{y===null?ee.getState().setFocusedNode(null):y.type==="nodes"&&ee.getState().setFocusedNode(y.id)},[]),h=p.useCallback(y=>{y===null?ee.getState().setSelectedNode(null):y.type==="nodes"&&ee.getState().setSelectedNode(y.id,!0)},[]),d=p.useMemo(()=>a??r,[a,r]),b=p.useMemo(()=>r?{type:"nodes",id:r}:null,[r]);return g.jsxs("div",{className:"relative h-full w-full overflow-hidden",children:[g.jsxs(Ei,{settings:t,className:"!bg-background !size-full overflow-hidden",ref:n,children:[g.jsx(Kf,{}),c&&g.jsx(Pg,{}),g.jsx(jd,{node:d,move:o}),g.jsxs("div",{className:"absolute top-2 left-2 flex items-start gap-2",children:[g.jsx(Ih,{}),s&&g.jsx(Rh,{value:b,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(Xf,{}),g.jsx(Qf,{}),g.jsx(Jf,{}),g.jsx(Ng,{}),g.jsx(ih,{})]}),i&&g.jsx("div",{className:"absolute top-2 right-2",children:g.jsx(lg,{})}),u&&g.jsx("div",{className:"absolute bottom-10 right-2",children:g.jsx(Lg,{className:"bg-background/60 backdrop-blur-lg"})}),g.jsx(hg,{})]}),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{Hs as $,up as A,be as B,Vs as C,Lu as D,vp as E,bp as F,vg as G,lp as H,qt as I,wp as J,hp as K,fp as L,gp as M,pp as N,Ba as O,Bs as P,mp as Q,uu as R,oi as S,kp as T,Tp as U,Ep as V,Yf as W,ku as X,Kg as Y,Yg as Z,$g as _,pg as a,Cp as a0,Qi as a1,no as a2,Ug as a3,qg as a4,kr as a5,Tr as a6,_p as a7,sn as a8,Zn as a9,Mg as aa,Rp as ab,Vg as ac,Fa as ad,$a as ae,Ma as af,Cr as ag,xp as ah,Sp as ai,ol as aj,Ea as ak,Hg as al,op as am,Lp as an,ep as ao,np as ap,rp as aq,ap as ar,mg as b,fe as c,nt as d,yp as e,Qg as f,tn as g,Ap as h,Wa as i,Xa as j,Ka as k,Qa as l,Jg as m,Zg as n,Ls as o,Ya as p,cp as q,dp as r,Bg as s,tp as t,xe as u,Sr as v,ne as w,Wg as x,Xg as y,gg as z};
|