import{ls as e}from"./app-server-manager-signals-Yn0WSnoY.js";import{t}from"./v4-JB8aTMDB.js";import{at as n,lt as r}from"./vscode-api-DjORcpSo.js";import{n as i,r as a}from"./react-0SBwfqBm.js";var o=r(),s=n({activeOperationId:null,operations:[]});function c(e){return{...e,status:`queued`,targetConversationId:null,steps:p(e.stepIds),errorMessage:null,warningMessage:null,execOutput:null,hasUnseenTerminalState:!1}}function l(){return a(s)}function u(e){let{operations:t}=l();if(e==null)return null;for(let n=t.length-1;n>=0;--n){let r=t[n];if(r.sourceConversationId===e||r.targetConversationId===e)return r}return null}function d(){let n=(0,o.c)(22),[,r]=i(s),a;n[0]===r?a=n[1]:(a=e=>{let n={id:t(),direction:`to-worktree`,status:`queued`,sourceConversationId:e.sourceConversationId,targetConversationId:null,sourceBranch:e.sourceBranch,localBranch:e.localBranch,worktreeBranch:e.worktreeBranch,stepIds:e.stepIds,steps:p(e.stepIds),request:e.request,errorMessage:null,warningMessage:null,execOutput:null,hasUnseenTerminalState:!1,composerViewState:e.composerViewState};return r(e=>({activeOperationId:null,operations:[...e.operations,n]})),n},n[0]=r,n[1]=a);let c=a,l;n[2]===r?l=n[3]:(l=e=>{let n={id:t(),direction:`to-local`,status:`queued`,sourceConversationId:e.sourceConversationId,targetConversationId:null,sourceBranch:e.sourceBranch,localBranch:e.localBranch,worktreeBranch:null,stepIds:e.stepIds,steps:p(e.stepIds),request:e.request,errorMessage:null,warningMessage:null,execOutput:null,hasUnseenTerminalState:!1,composerViewState:e.composerViewState};return r(e=>({activeOperationId:null,operations:[...e.operations,n]})),n},n[2]=r,n[3]=l);let u=l,d;n[4]===r?d=n[5]:(d=e=>{let n={id:t(),direction:`to-host-worktree`,status:`queued`,sourceConversationId:e.sourceConversationId,targetConversationId:null,sourceBranch:e.sourceBranch,localBranch:null,worktreeBranch:null,stepIds:e.stepIds,steps:p(e.stepIds),request:e.request,errorMessage:null,warningMessage:null,execOutput:null,hasUnseenTerminalState:!1,composerViewState:e.composerViewState};return r(e=>({activeOperationId:null,operations:[...e.operations,n]})),n},n[4]=r,n[5]=d);let m=d,h;n[6]===r?h=n[7]:(h=(t,n)=>{r(r=>({...r,operations:r.operations.map(r=>r.id===t?e(r,n):r)}))},n[6]=r,n[7]=h);let g=h,_;n[8]===r?_=n[9]:(_=e=>{r(t=>({activeOperationId:t.activeOperationId===e?null:t.activeOperationId,operations:t.operations.filter(t=>t.id!==e)}))},n[8]=r,n[9]=_);let v=_,y;n[10]===r?y=n[11]:(y=e=>{r(t=>({activeOperationId:e,operations:t.operations.map(t=>t.id===e?{...t,hasUnseenTerminalState:!1}:t)}))},n[10]=r,n[11]=y);let b=y,x;n[12]===r?x=n[13]:(x=()=>{r(f)},n[12]=r,n[13]=x);let S=x,C;return n[14]!==m||n[15]!==u||n[16]!==c||n[17]!==S||n[18]!==b||n[19]!==v||n[20]!==g?(C={addToWorktreeOperation:c,addToLocalOperation:u,addToHostWorktreeOperation:m,updateOperation:g,removeOperation:v,openOperation:b,closeActiveOperation:S},n[14]=m,n[15]=u,n[16]=c,n[17]=S,n[18]=b,n[19]=v,n[20]=g,n[21]=C):C=n[21],C}function f(e){return{...e,activeOperationId:null}}function p(e){return e.map(e=>({id:e,status:`pending`}))}export{l as i,d as n,u as r,c as t};
//# sourceMappingURL=thread-handoff-store-e7vOlXO-.js.map