import{i as e,r as t}from"./src-BOCweS1p.js";import{E as n,g as r,nt as i,sr as a}from"./app-server-manager-signals-Yn0WSnoY.js";import{L as o}from"./vscode-api-DjORcpSo.js";import{a as s,c,l,r as u,s as d,t as f}from"./thread-context-inputs-C9hcxtXy.js";import{t as p}from"./route-scope-CLteRG86.js";import{t as m}from"./use-webview-execution-target-B5MTa9cH.js";var h=o(p,({get:a,scope:o})=>{switch(o.value.routeKind){case`home`:case`new-thread-panel`:{let e=a(i,null),{cwd:t,hostId:n}=m({activeWorkspaceRoot:a(f).data?.roots?.[0]??null,conversationCwd:null,conversationHostId:null,selectedRemoteProject:a(c)});return{cwd:t,hostId:n||e}}case`local-thread`:{let s=a(l)?.[o.value.conversationId],c=o.value.projectContext==null?null:x({defaultHostId:a(i,null),hostId:o.value.projectContext.hostId,projectId:o.value.projectContext.projectId,remoteProjects:a(d)});return{cwd:c?.cwd??t({assignment:s,cwd:a(r,o.value.conversationId)})??a(f).data?.roots?.[0]??null,hostId:c?.hostId??(s==null?null:e(s))??a(n,o.value.conversationId)??a(i,o.value.conversationId)}}case`remote-thread`:return{cwd:null,hostId:a(i,null)};case`other`:throw Error(`Thread context is unavailable for non-thread routes`)}}),g=o(p,({get:e,scope:t})=>{switch(t.value.routeKind){case`home`:case`new-thread-panel`:case`local-thread`:case`remote-thread`:return e(u).data?.codexHome??null;case`other`:throw Error(`Thread context is unavailable for non-thread routes`)}}),_=o(p,({get:e})=>e(h).cwd),v=o(p,({get:e})=>e(h).hostId),y=o(p,({get:e})=>e(s,e(v))),b=o(p,({get:e})=>a(e(y)));function x({defaultHostId:e,hostId:t,projectId:n,remoteProjects:r}){return t==null?{cwd:n,hostId:e}:{cwd:r.find(e=>e.id===n)?.remotePath??null,hostId:t}}export{b as a,v as i,_ as n,y as r,g as t};
//# sourceMappingURL=thread-context-DcUpp6ZL.js.map