import{n as e}from"./rolldown-runtime-Czos8NxU.js";import{Tl as t,el as n,nl as r,ol as i,rl as a}from"./app-initial~app-main~worktree-init-v2-page~appgen-settings-page~page~appgen-publication-ter~fzo5ij6p-BKVLyD1q.js";import{Ad as o,eg as s,kd as c,tg as l}from"./app-initial~app-main~new-thread-panel-page-BZHGOlMi.js";function u(e){return{...e,status:`queued`,targetConversationId:null,steps:h(e.stepIds),errorMessage:null,warningMessage:null,execOutput:null,hasUnseenTerminalState:!1}}function d(){return a(_)}function f(e){let{operations:t}=d();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 p(){let e=(0,g.c)(22),[,t]=r(_),n;e[0]===t?n=e[1]:(n=e=>{let n={id:l(),direction:`to-worktree`,status:`queued`,sourceConversationId:e.sourceConversationId,targetConversationId:null,sourceBranch:e.sourceBranch,localBranch:e.localBranch,worktreeBranch:e.worktreeBranch,stepIds:e.stepIds,steps:h(e.stepIds),request:e.request,errorMessage:null,warningMessage:null,execOutput:null,hasUnseenTerminalState:!1,composerViewState:e.composerViewState};return t(e=>({activeOperationId:null,operations:[...e.operations,n]})),n},e[0]=t,e[1]=n);let i=n,a;e[2]===t?a=e[3]:(a=e=>{let n={id:l(),direction:`to-local`,status:`queued`,sourceConversationId:e.sourceConversationId,targetConversationId:null,sourceBranch:e.sourceBranch,localBranch:e.localBranch,worktreeBranch:null,stepIds:e.stepIds,steps:h(e.stepIds),request:e.request,errorMessage:null,warningMessage:null,execOutput:null,hasUnseenTerminalState:!1,composerViewState:e.composerViewState};return t(e=>({activeOperationId:null,operations:[...e.operations,n]})),n},e[2]=t,e[3]=a);let s=a,c;e[4]===t?c=e[5]:(c=e=>{let n={id:l(),direction:`to-host-worktree`,status:`queued`,sourceConversationId:e.sourceConversationId,targetConversationId:null,sourceBranch:e.sourceBranch,localBranch:null,worktreeBranch:null,stepIds:e.stepIds,steps:h(e.stepIds),request:e.request,errorMessage:null,warningMessage:null,execOutput:null,hasUnseenTerminalState:!1,composerViewState:e.composerViewState};return t(e=>({activeOperationId:null,operations:[...e.operations,n]})),n},e[4]=t,e[5]=c);let u=c,d;e[6]===t?d=e[7]:(d=(e,n)=>{t(t=>({...t,operations:t.operations.map(t=>t.id===e?o(t,n):t)}))},e[6]=t,e[7]=d);let f=d,p;e[8]===t?p=e[9]:(p=e=>{t(t=>({activeOperationId:t.activeOperationId===e?null:t.activeOperationId,operations:t.operations.filter(t=>t.id!==e)}))},e[8]=t,e[9]=p);let v=p,y;e[10]===t?y=e[11]:(y=e=>{t(t=>({activeOperationId:e,operations:t.operations.map(t=>t.id===e?{...t,hasUnseenTerminalState:!1}:t)}))},e[10]=t,e[11]=y);let b=y,x;e[12]===t?x=e[13]:(x=()=>{t(m)},e[12]=t,e[13]=x);let S=x,C;return e[14]!==u||e[15]!==s||e[16]!==i||e[17]!==S||e[18]!==b||e[19]!==v||e[20]!==f?(C={addToWorktreeOperation:i,addToLocalOperation:s,addToHostWorktreeOperation:u,updateOperation:f,removeOperation:v,openOperation:b,closeActiveOperation:S},e[14]=u,e[15]=s,e[16]=i,e[17]=S,e[18]=b,e[19]=v,e[20]=f,e[21]=C):C=e[21],C}function m(e){return{...e,activeOperationId:null}}function h(e){return e.map(e=>({id:e,status:`pending`}))}var g,_,v=e((()=>{g=t(),c(),n(),s(),_=i({activeOperationId:null,operations:[]})}));export{d as a,f as i,u as n,p as r,v as t};
//# sourceMappingURL=app-initial~app-main~remote-conversation-page~hotkey-window-thread-page~thread-app-shell-ch~oc6ebzsr-uZJVL94r.js.map