import{ce as s,U as e,L as a,cf as l}from"./CNYe4-mv.js";const n=s(async(s,n)=>{let i,t;const o=s.params.projectId||null,c=s.params.sessionId||null,r=e(),u=a();if(o||c||r.setCurrentSession(null,null,{cwd:null,projectDisplayName:null,sessionSummary:null,isSessionAlive:!1}),o||c){let s=null,e=null,a=null,n=!1;if(c)try{n=([i,t]=l(()=>$fetch(`/api/sessions/${c}/status`)),i=await i,t(),i).alive}catch(p){}if(o){0!==u.projects.length||u.loading||([i,t]=l(()=>u.loadProjects()),await i,t());const n=u.projects.find(s=>s.name===o);if(n&&(s=n.cwd,e=n.displayName,c)){u.projectSessions[o]||([i,t]=l(()=>u.loadSessions(o)),await i,t());const e=u.projectSessions[o],n=e?.find(s=>s.id===c);n&&(a=n.summary,n.cwd&&(s=n.cwd))}}r.setCurrentSession(o,c,{cwd:s,projectDisplayName:e,sessionSummary:a,isSessionAlive:n})}r.preserveMessages=!1});export{n as default};
