1import{r,u as E,a as L,b as M,j as s,S as D,F as P,M as R,B as A,c as B,J as O}from"./index-BX7vJsaK.js";const I=["erratum","errata","correction","retraction"];function z(n){const o=(n.pub_type??"").toLowerCase(),c=(n.title??"").toLowerCase();return I.some(h=>o.includes(h)||c.startsWith(h))}const C=[{label:"Home",path:"/",keywords:"Division of Digital Psychiatry BIDMC Beth Israel Harvard mental health technology research Boston"},{label:"mindLAMP",path:"/mindlamp",keywords:"mindLAMP digital phenotyping passive sensing smartphone app open source platform data collection wearable cognitive assessments surveys mental health monitoring"},{label:"Digital Clinic",path:"/clinic",keywords:"digital clinic telehealth mental health care app prescription digital therapeutics clinical services patients BIDMC"},{label:"DOORS",path:"/doors",keywords:"DOORS digital outreach obtaining resources skills digital literacy mental health education training clinicians patients digital health tools skills curriculum program AI artificial intelligence apps guidance support coaching"},{label:"Digital Navigator",path:"/digital-navigator",keywords:"digital navigator health training curriculum manual DOORS digital literacy app selection data integration peer advocate community volunteer role smartphone"},{label:"BEACON",path:"/beacon",keywords:"BEACON digital clinic psychosis schizophrenia schizoaffective first episode serious mental illness SMI adapted digital intervention smartphone mindLAMP BIDMC"},{label:"Studies",path:"/studies",keywords:"clinical research studies recruiting participants psychosis depression anxiety college mental health wearables smartphone digital biomarkers BIDMC international"},{label:"Publications",path:"/publications",keywords:"research papers journal articles publications digital psychiatry mental health technology peer reviewed JMIR schizophrenia bipolar mHealth"},{label:"AI",path:"/ai",keywords:"artificial intelligence machine learning large language models LLM mental health psychiatry clinical decision support AI tools responsible use"},{label:"SODP",path:"/sodp",keywords:"Society of Digital Psychiatry professional organization membership digital mental health network community clinicians researchers"},{label:"Job Listings",path:"/jobs",keywords:"jobs careers hiring open positions postdoc postdoctoral research fellow employment opportunities work with us"},...O.map(n=>({label:n.cardTitle,path:`/jobs/${n.slug}`,keywords:`job posting open position hiring apply careers ${n.cardTitle} ${n.cardSubtitle}`}))];function T(){const[n,o]=r.useState(!1),[c,h]=r.useState(""),[p,f]=r.useState(0),j=r.useRef(null),x=r.useRef(null),y=E(),{studies:k}=L(),{publications:N}=M();r.useEffect(()=>(window.__cmdkOpen=()=>o(!0),()=>{delete window.__cmdkOpen}),[]),r.useEffect(()=>{const e=a=>{(a.metaKey||a.ctrlKey)&&a.key==="k"&&(a.preventDefault(),o(i=>!i)),a.key==="Escape"&&o(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),r.useEffect(()=>{n&&(h(""),f(0),setTimeout(()=>{var e;return(e=j.current)==null?void 0:e.focus()},10))},[n]);const v=r.useMemo(()=>{const e=c.toLowerCase().trim();if(!e){const t=C.map(l=>({kind:"page",label:l.label,path:l.path})),b=k.filter(l=>l.isRecruiting).slice(0,3).map(l=>({kind:"study",label:l.title,subtitle:[l.status,l.duration].filter(Boolean).join(" · "),url:"/studies"})),g=[{group:"Pages",items:t}];return b.length&&g.push({group:"Studies",items:b}),g}const a=C.filter(t=>t.label.toLowerCase().includes(e)||t.keywords.toLowerCase().includes(e)).slice(0,3).map(t=>({kind:"page",label:t.label,path:t.path})),i=k.filter(t=>t.title.toLowerCase().includes(e)||t.desc.toLowerCase().includes(e)).slice(0,3).map(t=>({kind:"study",label:t.title,subtitle:[t.status,t.duration].filter(Boolean).join(" · "),url:"/studies"})),u=N.filter(t=>!z(t)).filter(t=>t.title.toLowerCase().includes(e)||t.authors.toLowerCase().includes(e)).slice(0,3).map(t=>{var g;const b=((g=t.authors.split(",")[0])==null?void 0:g.trim())||t.authors;return{kind:"pub",label:t.title,subtitle:[b,t.journal,t.year].filter(
1Boolean).join(" · "),url:t.url||(t.doi?`https://doi.org/${t.doi}`:"")}}),d=[];return a.length&&d.push({group:"Pages",items:a}),i.length&&d.push({group:"Studies",items:i}),u.length&&d.push({group:"Publications",items:u}),d},[c,k,N]),m=r.useMemo(()=>v.flatMap(e=>e.items),[v]),w=r.useCallback(e=>{o(!1),e.kind==="page"?y(e.path):e.kind==="study"?y(e.url):e.kind==="pub"&&e.url&&window.open(e.url,"_blank","noopener,noreferrer")},[y]);if(r.useEffect(()=>{if(!n||!x.current)return;const e=x.current.querySelector(`[data-idx="${p}"]`);e&&e.scrollIntoView({block:"nearest"})},[p,n]),r.useEffect(()=>{if(!n)return;const e=a=>{a.key==="ArrowDown"&&(a.preventDefault(),f(i=>Math.min(i+1,m.length-1))),a.key==="ArrowUp"&&(a.preventDefault(),f(i=>Math.max(i-1,0))),a.key==="Enter"&&m[p]&&w(m[p])};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n,m,p,w]),!n)return null;let S=0;return s.jsxs("div",{className:"fixed inset-0 z-[60] flex items-start justify-center pt-24 px-4",onClick:()=>o(!1),children:[s.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm"}),s.jsxs("div",{className:"relative w-full max-w-xl bg-surface rounded-2xl shadow-2xl border border-outline-variant/30 overflow-hidden",onClick:e=>e.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-outline-variant/30",children:[s.jsx(D,{size:18,className:"text-on-surface-variant shrink-0"}),s.jsx("input",{ref:j,value:c,onChange:e=>{h(e.target.value),f(0)},placeholder:"Search pages, studies, publicationsâ¦",className:"flex-1 bg-transparent text-on-surface placeholder:text-on-surface-variant/60 outline-none text-sm font-body"}),s.jsx("kbd",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface-container text-on-surface-variant font-mono",children:"ESC"})]}),s.jsxs("div",{ref:x,className:"max-h-80 overflow-y-auto",children:[m.length===0&&c&&s.jsxs("p",{className:"text-center text-on-surface-variant text-sm py-8",children:["No results for â",c,"â"]}),v.map(({group:e,items:a})=>s.jsxs("div",{children:[s.jsx("div",{className:"px-4 pt-3 pb-1",children:s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-on-surface-variant/60",children:e})}),a.map(i=>{const u=S++,d="subtitle"in i?i.subtitle:null;return s.jsxs("button",{"data-idx":u,onClick:()=>w(i),onMouseEnter:()=>f(u),className:B("w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors",p===u?"bg-primary/10 text-primary":"hover:bg-surface-container-low"),children:[i.kind==="page"&&s.jsx(P,{size:14,className:"shrink-0 text-on-surface-variant"}),i.kind==="study"&&s.jsx(R,{size:14,className:"shrink-0 text-on-surface-variant"}),i.kind==="pub"&&s.jsx(A,{size:14,className:"shrink-0 text-on-surface-variant"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"text-sm truncate block",children:i.label}),d&&s.jsx("span",{className:"text-xs text-on-surface-variant/70 truncate block",children:d})]})]},u)})]},e))]}),s.jsxs("div",{className:"px-4 py-2 border-t border-outline-variant/20 flex items-center gap-4 text-[10px] text-on-surface-variant/50",children:[s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1 py-0.5 rounded bg-surface-container font-mono",children:"ââ"})," navigate"]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1 py-0.5 rounded bg-surface-container font-mono",children:"âµ"})," open"]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1 py-0.5 rounded bg-surface-container font-mono",children:"esc"})," close"]})]})]})]})}export{T as CommandPalette};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.