import"../chunks/Bzak7iHL.js";import{o as Ee}from"../chunks/CkyfbJUz.js";import{p as Me,d as o,f as Ke,t as K,a as Le,h as d,g as t,e as s,r as a,s as z,u as R,G as Te}from"../chunks/C9Z4nxhR.js";import{d as qe,a as h,s as v}from"../chunks/DP9qWekZ.js";import{i as ie}from"../chunks/C2oj68pw.js";import{e as H,i as V}from"../chunks/kH-DTQyy.js";import{a as g,f as _}from"../chunks/DPfxVJHQ.js";import{s as Fe}from"../chunks/D00YwZ1M.js";import{s as le,r as Se}from"../chunks/ZesQ8l8p.js";import{s as W}from"../chunks/Co2v30Gm.js";import{b as Ae}from"../chunks/P9ZHwQBL.js";import{b as Ne}from"../chunks/CR6HhlME.js";import{s as De,a as L}from"../chunks/DWr9YED7.js";import{s as Ge,g as de,b as O}from"../chunks/C9fAJV5Y.js";import{w as ce,a as Ie,i as je,m as ze}from"../chunks/BmeMLq0p.js";const Re=()=>{const f=Ge;return{page:{subscribe:f.page.subscribe},navigating:{subscribe:f.navigating.subscribe},updated:f.updated}},He={subscribe(f){return Re().page.subscribe(f)}};var Ve=_(' '),We=_(' '),Oe=_(''),Qe=_('
No matches
'),Be=_('
esc
'),Je=_('
',1);function ct(f,T){Me(T,!0);const Q=()=>L(He,"$page",k),B=()=>L(je,"$isConnected",k),pe=()=>L(ze,"$memoryCount",k),ve=()=>L(Ie,"$avgRetention",k),[k,me]=De();let c=z(!1),u=z(""),y=z(void 0);Ee(()=>{ce.connect();function r(e){if((e.metaKey||e.ctrlKey)&&e.key==="k"){e.preventDefault(),d(c,!t(c)),d(u,""),t(c)&&requestAnimationFrame(()=>{var n;return(n=t(y))==null?void 0:n.focus()});return}if(e.key==="Escape"&&t(c)){d(c,!1);return}if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement)return;if(e.key==="/"){e.preventDefault();const n=document.querySelector('input[type="text"]');n==null||n.focus();return}const i={g:"/graph",m:"/memories",t:"/timeline",f:"/feed",e:"/explore",i:"/intentions",s:"/stats"}[e.key.toLowerCase()];i&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),de(`${O}${i}`))}return window.addEventListener("keydown",r),()=>{ce.disconnect(),window.removeEventListener("keydown",r)}});const $=[{href:"/graph",label:"Graph",icon:"◎",shortcut:"G"},{href:"/memories",label:"Memories",icon:"◈",shortcut:"M"},{href:"/timeline",label:"Timeline",icon:"◷",shortcut:"T"},{href:"/feed",label:"Feed",icon:"◉",shortcut:"F"},{href:"/explore",label:"Explore",icon:"◬",shortcut:"E"},{href:"/intentions",label:"Intentions",icon:"◇",shortcut:"I"},{href:"/stats",label:"Stats",icon:"◫",shortcut:"S"},{href:"/settings",label:"Settings",icon:"⚙",shortcut:","}],ue=$.slice(0,5);function J(r,e){const p=e.startsWith(O)?e.slice(O.length)||"/":e;return r==="/graph"?p==="/"||p==="/graph":p.startsWith(r)}let C=R(()=>t(u)?$.filter(r=>r.label.toLowerCase().includes(t(u).toLowerCase())):$);function U(r){d(c,!1),d(u,""),de(r)}var X=Je(),q=o(Ke(X),6),F=s(q),S=o(s(F),2);H(S,21,()=>$,V,(r,e)=>{const p=R(()=>J(t(e).href,Q().url.pathname));var i=Ve(),n=s(i),x=s(n,!0);a(n);var m=o(n,2),w=s(m,!0);a(m);var E=o(m,2),l=s(E,!0);a(E),a(i),K(()=>{le(i,"href",t(e).href),W(i,1,`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 text-sm ${t(p)?"bg-synapse/15 text-synapse-glow border border-synapse/30 shadow-[0_0_12px_rgba(99,102,241,0.15)] nav-active-border":"text-dim hover:text-text hover:bg-white/[0.03] border border-transparent"}`),v(x,t(e).icon),v(w,t(e).label),v(l,t(e).shortcut)}),g(r,i)}),a(S);var A=o(S,2),fe=s(A);a(A);var Y=o(A,2),N=s(Y),Z=s(N),P=o(Z,2),xe=s(P,!0);a(P),a(N);var ee=o(N,2),D=s(ee),be=s(D);a(D);var te=o(D,2),he=s(te);a(te),a(ee),a(Y),a(F);var G=o(F,2),ae=s(G),ge=s(ae);Fe(ge,()=>T.children),a(ae),a(G);var se=o(G,2),re=s(se),ne=s(re);H(ne,17,()=>ue,V,(r,e)=>{const p=R(()=>J(t(e).href,Q().url.pathname));var i=We(),n=s(i),x=s(n,!0);a(n);var m=o(n,2),w=s(m,!0);a(m),a(i),K(()=>{le(i,"href",t(e).href),W(i,1,`flex flex-col items-center gap-0.5 px-3 py-2 rounded-lg transition-all min-w-[3.5rem] ${t(p)?"text-synapse-glow":"text-muted"}`),v(x,t(e).icon),v(w,t(e).label)}),g(r,i)});var _e=o(ne,2);a(re),a(se),a(q);var ye=o(q,2);{var we=r=>{var e=Be(),p=s(e),i=s(p),n=o(s(i),2);Se(n),Ne(n,l=>d(y,l),()=>t(y)),Te(2),a(i);var x=o(i,2),m=s(x);H(m,17,()=>t(C),V,(l,b)=>{var M=Oe(),I=s(M),ke=s(I,!0);a(I);var j=o(I,2),$e=s(j,!0);a(j);var oe=o(j,2),Ce=s(oe,!0);a(oe),a(M),K(()=>{v(ke,t(b).icon),v($e,t(b).label),v(Ce,t(b).shortcut)}),h("click",M,()=>U(t(b).href)),g(l,M)});var w=o(m,2);{var E=l=>{var b=Qe();g(l,b)};ie(w,l=>{t(C).length===0&&l(E)})}a(x),a(p),a(e),h("keydown",e,l=>{l.key==="Escape"&&d(c,!1)}),h("click",e,l=>{l.target===l.currentTarget&&d(c,!1)}),h("keydown",n,l=>{l.key==="Enter"&&t(C).length>0&&U(t(C)[0].href)}),Ae(n,()=>t(u),l=>d(u,l)),g(r,e)};ie(ye,r=>{t(c)&&r(we)})}K(r=>{W(Z,1,`w-2 h-2 rounded-full ${B()?"bg-recall animate-pulse-glow":"bg-decay"}`),v(xe,B()?"Connected":"Offline"),v(be,`${pe()??""} memories`),v(he,`${r??""}% retention`)},[()=>(ve()*100).toFixed(0)]),h("click",fe,()=>{d(c,!0),d(u,""),requestAnimationFrame(()=>{var r;return(r=t(y))==null?void 0:r.focus()})}),h("click",_e,()=>{d(c,!0),d(u,""),requestAnimationFrame(()=>{var r;return(r=t(y))==null?void 0:r.focus()})}),g(f,X),Le(),me()}qe(["click","keydown"]);export{ct as component};