import{Pg as X,Qg as p}from"./cli-0.5.3-e78q565q.mjs";import"./cli-0.5.3-wj0ek90c.mjs";import"./cli-0.5.3-b4y7gc8k.mjs";import{MP as A,NP as a,XK as P,YK as U,ZK as m,dk as v,gk as C,ik as $,yj as W,zj as g}from"./cli-0.5.3-jbzr8k4s.mjs";import"./cli-0.5.3-me9jkw92.mjs";import"./cli-0.5.3-bqmztzjc.mjs";import"./cli-0.5.3-ytqxzjff.mjs";import"./cli-0.5.3-h6n812td.mjs";import"./cli-0.5.3-hg8c6qbh.mjs";import"./cli-0.5.3-39jr2yrx.mjs";import"./cli-0.5.3-42e2paz8.mjs";import"./cli-0.5.3-mn45xfck.mjs";import"./cli-0.5.3-m884a3pk.mjs";import"./cli-0.5.3-4f9xxrem.mjs";import"./cli-0.5.3-gr8nsa2k.mjs";import"./cli-0.5.3-yj9nbd9d.mjs";import"./cli-0.5.3-55kd38ff.mjs";import"./cli-0.5.3-e6bjcfwg.mjs";import"./cli-0.5.3-4dbxtwh3.mjs";import"./cli-0.5.3-m0kfmb79.mjs";import"./cli-0.5.3-8zq9vdtg.mjs";import"./cli-0.5.3-vmx7agj7.mjs";import"./cli-0.5.3-h8xs2818.mjs";import"./cli-0.5.3-wcx7cnw5.mjs";import"./cli-0.5.3-9zbakvbf.mjs";import"./cli-0.5.3-hx550gz2.mjs";import{IW as M,KW as V,nX as i,pV as D}from"./cli-0.5.3-842pf3t4.mjs";import"./cli-0.5.3-wxead1ct.mjs";import"./cli-0.5.3-s1hz35ye.mjs";import"./cli-0.5.3-g0svn6bx.mjs";import"./cli-0.5.3-sfdh3pkx.mjs";import"./cli-0.5.3-d8tjnxcj.mjs";import"./cli-0.5.3-6zfw1732.mjs";import"./cli-0.5.3-ptjdgcsy.mjs";import"./cli-0.5.3-tp3jye12.mjs";import{NY as L,OY as T,PY as Z}from"./cli-0.5.3-vqmxwet2.mjs";import{QY as h}from"./cli-0.5.3-rch86nhn.mjs";import"./cli-0.5.3-zg2apr51.mjs";import"./cli-0.5.3-ngnshpb7.mjs";import"./cli-0.5.3-e58xste9.mjs";import"./cli-0.5.3-6163zevg.mjs";import"./cli-0.5.3-jmkkd5ph.mjs";import"./cli-0.5.3-1vt6twff.mjs";import"./cli-0.5.3-7017ez65.mjs";import{V3 as K,W3 as d}from"./cli-0.5.3-ea94acj4.mjs";import"./cli-0.5.3-3k22nqvy.mjs";import"./cli-0.5.3-63q4g3zt.mjs";import"./cli-0.5.3-dyhbm5kp.mjs";import"./cli-0.5.3-vpcrbd8n.mjs";import"./cli-0.5.3-jdw3ajfv.mjs";import"./cli-0.5.3-qg4a557t.mjs";import{I6 as H,J6 as x}from"./cli-0.5.3-t65dek0m.mjs";import"./cli-0.5.3-kavpx97n.mjs";import"./cli-0.5.3-9bdwhdys.mjs";import"./cli-0.5.3-ttc72eq3.mjs";import"./cli-0.5.3-g75gdzrp.mjs";import"./cli-0.5.3-1rg2r7n7.mjs";import"./cli-0.5.3-6j2jk6dt.mjs";import"./cli-0.5.3-66650sba.mjs";import"./cli-0.5.3-9vh3vpap.mjs";import"./cli-0.5.3-n3cxyxpg.mjs";import"./cli-0.5.3-kbvzmaax.mjs";import"./cli-0.5.3-7wdgps7z.mjs";import"./cli-0.5.3-c8bcrqa4.mjs";import{Pla as f,Qla as F,gma as c}from"./cli-0.5.3-qrvd6cmy.mjs";import"./cli-0.5.3-2dk1sk8w.mjs";import{Tma as _,Xma as u}from"./cli-0.5.3-0df3r78b.mjs";function n(G){let k=b.c(10),{message:I,args:J,onDone:B}=G,E,w;if(k[0]!==B)E=()=>{let O=setTimeout(B,0);return()=>clearTimeout(O)},w=[B],k[0]=B,k[1]=E,k[2]=w;else E=k[1],w=k[2];y.useEffect(E,w);let q;if(k[3]!==J)q=T(V,{dimColor:!0,children:[H.pointer," /add-dir ",J]}),k[3]=J,k[4]=q;else q=k[4];let z;if(k[5]!==I)z=L(W,{children:L(V,{children:I})}),k[5]=I,k[6]=z;else z=k[6];let N;if(k[7]!==q||k[8]!==z)N=T(M,{flexDirection:"column",children:[q,z]}),k[7]=q,k[8]=z,k[9]=N;else N=k[9];return N}async function Gk(G,k,I){let J=(I??"").trim(),B=k.getAppState(),E=async(q,z=!1)=>{let O={type:"addDirectories",directories:[q],destination:z?"localSettings":"session"},S=k.getAppState(),j=v(S.toolPermissionContext,O);k.setAppState((R)=>({...R,toolPermissionContext:j}));let Y=f();if(!Y.includes(q))F([...Y,q]);A.refreshConfig();let Q;if(z)try{C(O),Q=`Added ${K.bold(q)} as a working directory and saved to local settings`}catch(R){Q=`Added ${K.bold(q)} as a working directory. Failed to save to local settings: ${R instanceof Error?R.message:"Unknown error"}`}else Q=`Added ${K.bold(q)} as a working directory for this session`;let l=`${Q} ${K.dim("· /permissions to manage")}`;G(l)};if(!J)return L(X,{permissionContext:B.toolPermissionContext,onAddDirectory:E,onCancel:()=>{G("Did not add a working directory.")}});let w=await P(J,B.toolPermissionContext);if(w.resultType!=="success"){let q=U(w);return L(n,{message:q,args:I??"",onDone:()=>G(q)})}return L(X,{directoryPath:w.absolutePath,permissionContext:B.toolPermissionContext,onAddDirectory:E,onCancel:()=>{G(`Did not add ${K.bold(w.absolutePath)} as a working directory.`)}})}var b,y;var o=u(()=>{d();x();c();g();p();i();$();a();m();Z();b=_(D(),1),y=_(h(),1)});o();export{Gk as call};
