import{Pg as X,Qg as p}from"./cli-0.5.4-c3bre0rr.mjs";import"./cli-0.5.4-jbrdvpmn.mjs";import"./cli-0.5.4-gw8qa07r.mjs";import{$K as m,Aj as W,Bj as g,OP as A,PP as a,ZK as P,_K as U,fk as v,ik as C,kk as $}from"./cli-0.5.4-k5fz4zd3.mjs";import"./cli-0.5.4-wbqf44ym.mjs";import"./cli-0.5.4-9ewg9gfs.mjs";import"./cli-0.5.4-we3mspgg.mjs";import"./cli-0.5.4-jzhazry0.mjs";import"./cli-0.5.4-82sw3hrw.mjs";import"./cli-0.5.4-31v143kt.mjs";import"./cli-0.5.4-1cy7wd6s.mjs";import"./cli-0.5.4-5e0pk96f.mjs";import"./cli-0.5.4-z154a7bp.mjs";import"./cli-0.5.4-ng5p0zjs.mjs";import"./cli-0.5.4-5hp7ks3t.mjs";import"./cli-0.5.4-8hdwp78f.mjs";import"./cli-0.5.4-mr9aznxx.mjs";import"./cli-0.5.4-jevfk5q7.mjs";import"./cli-0.5.4-27dzbzdy.mjs";import"./cli-0.5.4-a5bkdqqb.mjs";import"./cli-0.5.4-j2hnw539.mjs";import"./cli-0.5.4-9w59nnw4.mjs";import"./cli-0.5.4-z5d3q8kh.mjs";import"./cli-0.5.4-c0r12dqp.mjs";import"./cli-0.5.4-kqh172jk.mjs";import"./cli-0.5.4-vv4jbgkc.mjs";import{KW as M,MW as V,pX as i,rV as D}from"./cli-0.5.4-s7k1f0wc.mjs";import"./cli-0.5.4-0h0yz2k5.mjs";import"./cli-0.5.4-942dm5q1.mjs";import"./cli-0.5.4-rcmp5h4y.mjs";import"./cli-0.5.4-xdcww3x8.mjs";import"./cli-0.5.4-fq32ny1h.mjs";import"./cli-0.5.4-h1m67ngp.mjs";import"./cli-0.5.4-49erze3e.mjs";import"./cli-0.5.4-jytjks37.mjs";import{PY as L,QY as T,RY as Z}from"./cli-0.5.4-mn22gk7g.mjs";import{SY as h}from"./cli-0.5.4-5t3jj85n.mjs";import"./cli-0.5.4-5shjmmkz.mjs";import"./cli-0.5.4-zb412kkm.mjs";import"./cli-0.5.4-prfn3sxd.mjs";import"./cli-0.5.4-6xmgebmk.mjs";import"./cli-0.5.4-vjgejcrz.mjs";import"./cli-0.5.4-jqt00ywx.mjs";import"./cli-0.5.4-9e7rkd8e.mjs";import{X3 as K,Y3 as d}from"./cli-0.5.4-jp4wtw87.mjs";import"./cli-0.5.4-hambpq58.mjs";import"./cli-0.5.4-syvgmg9g.mjs";import"./cli-0.5.4-w8ttefr5.mjs";import"./cli-0.5.4-j7kkqxv6.mjs";import"./cli-0.5.4-qrwczx7j.mjs";import"./cli-0.5.4-v2z6p9td.mjs";import{K6 as H,L6 as x}from"./cli-0.5.4-cbq01zg3.mjs";import"./cli-0.5.4-37v5fhf1.mjs";import"./cli-0.5.4-7grzwf6q.mjs";import"./cli-0.5.4-9qmek5dq.mjs";import"./cli-0.5.4-9c6r1fjg.mjs";import"./cli-0.5.4-2dw33ms6.mjs";import"./cli-0.5.4-x1fzfxmm.mjs";import"./cli-0.5.4-e822fzaq.mjs";import"./cli-0.5.4-09dvrzcr.mjs";import"./cli-0.5.4-end8wj9r.mjs";import"./cli-0.5.4-4x206j04.mjs";import"./cli-0.5.4-yd3rd9qt.mjs";import"./cli-0.5.4-sgcaw17t.mjs";import{Rla as f,Sla as F,ima as c}from"./cli-0.5.4-jmc3bzbn.mjs";import"./cli-0.5.4-959vxhhb.mjs";import{Vma as _,Zma as u}from"./cli-0.5.4-aacw1src.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};
