import{Ug as X,Vg as n}from"./cli-0.5.12-p7shsask.mjs";import"./cli-0.5.12-n4bfatc5.mjs";import"./cli-0.5.12-ajgk4ksj.mjs";import{Xk as v,_k as C,al as $,en as P,fn as m,lL as U,mL as b,nL as p,sk as W,tk as g}from"./cli-0.5.12-zc0qwdy2.mjs";import"./cli-0.5.12-whfz3xsx.mjs";import"./cli-0.5.12-z100r543.mjs";import"./cli-0.5.12-bzab36pn.mjs";import"./cli-0.5.12-pp1549k7.mjs";import"./cli-0.5.12-9mq24qzr.mjs";import"./cli-0.5.12-7repzgzv.mjs";import"./cli-0.5.12-pdqnfqg3.mjs";import"./cli-0.5.12-c2yq69h9.mjs";import"./cli-0.5.12-kez9r81a.mjs";import"./cli-0.5.12-zbcr8cbk.mjs";import"./cli-0.5.12-2wf629mh.mjs";import"./cli-0.5.12-ghtxkxqx.mjs";import"./cli-0.5.12-xg7a0dy4.mjs";import"./cli-0.5.12-s0h788we.mjs";import"./cli-0.5.12-m22yxpb9.mjs";import"./cli-0.5.12-cw1qs4bg.mjs";import"./cli-0.5.12-yq8ds97a.mjs";import"./cli-0.5.12-qew4mzgp.mjs";import"./cli-0.5.12-gwg1e43k.mjs";import"./cli-0.5.12-36swspqa.mjs";import"./cli-0.5.12-4dn79vqp.mjs";import"./cli-0.5.12-f5pfjvdk.mjs";import{YX as i,_V as D,rX as M,tX as V}from"./cli-0.5.12-fqp5s15p.mjs";import"./cli-0.5.12-rc1p9wk6.mjs";import"./cli-0.5.12-x479axrj.mjs";import"./cli-0.5.12-ysy6e9rz.mjs";import"./cli-0.5.12-cqv7z22w.mjs";import"./cli-0.5.12-7cn41yy7.mjs";import"./cli-0.5.12-34cd39ve.mjs";import"./cli-0.5.12-m2gh4ewc.mjs";import{BZ as L,CZ as T,DZ as Z}from"./cli-0.5.12-c6whkxmz.mjs";import{EZ as h}from"./cli-0.5.12-w3hy6c60.mjs";import"./cli-0.5.12-5d3qcvf5.mjs";import"./cli-0.5.12-f141d2qa.mjs";import"./cli-0.5.12-khvy67r3.mjs";import"./cli-0.5.12-pycnjaeg.mjs";import"./cli-0.5.12-8v5w8znc.mjs";import{A4 as x,z4 as K}from"./cli-0.5.12-ctqkj6ve.mjs";import"./cli-0.5.12-cbevkwg4.mjs";import"./cli-0.5.12-w00qj83e.mjs";import"./cli-0.5.12-nbcjwzzn.mjs";import"./cli-0.5.12-3t06hwwh.mjs";import"./cli-0.5.12-057c2cp2.mjs";import"./cli-0.5.12-ecgx5n54.mjs";import{A6 as d,z6 as H}from"./cli-0.5.12-g4wb8mj2.mjs";import"./cli-0.5.12-vp5smcs1.mjs";import"./cli-0.5.12-y2kq7fe8.mjs";import"./cli-0.5.12-7vxpqr5a.mjs";import"./cli-0.5.12-hvtcdcev.mjs";import"./cli-0.5.12-asbn3d19.mjs";import"./cli-0.5.12-k1crwtdc.mjs";import"./cli-0.5.12-2jxq8gnm.mjs";import"./cli-0.5.12-p5ps8gf0.mjs";import"./cli-0.5.12-hp0508v9.mjs";import"./cli-0.5.12-tfdwzg37.mjs";import"./cli-0.5.12-60w1a0bs.mjs";import{$la as F,_la as f,rma as c}from"./cli-0.5.12-c8f4daey.mjs";import"./cli-0.5.12-0qasc0ef.mjs";import"./cli-0.5.12-f8850v2j.mjs";import"./cli-0.5.12-495d826j.mjs";import"./cli-0.5.12-rt0k97yj.mjs";import"./cli-0.5.12-1vyz0tt9.mjs";import{Yna as _,aoa as u}from"./cli-0.5.12-xzeb7mtb.mjs";function o(G){let k=y.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];A.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]);P.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 U(J,B.toolPermissionContext);if(w.resultType!=="success"){let q=b(w);return L(o,{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 y,A;var a=u(()=>{x();d();c();g();n();i();$();m();p();Z();y=_(D(),1),A=_(h(),1)});a();export{Gk as call};
