makecoder 4.0.57 → 4.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cc.mjs +2 -2
  2. package/dist/coder.js +39 -39
  3. package/dist/darwin-arm64/cc.js +2 -2
  4. package/dist/darwin-x64/cc.js +2 -2
  5. package/dist/gemini/{chunk-P6AAZN7C.js → chunk-266SNVZB.js} +1 -1
  6. package/dist/gemini/{chunk-C7WYZFGG.js → chunk-2AH4XFVC.js} +2 -2
  7. package/dist/gemini/{chunk-YHLOYN7E.js → chunk-2BCRFXVD.js} +1 -1
  8. package/dist/gemini/{chunk-GMCQZQGQ.js → chunk-2I73JSEP.js} +3 -3
  9. package/dist/gemini/{chunk-VVPG7N67.js → chunk-3AZIBTSH.js} +1 -1
  10. package/dist/gemini/{chunk-UC3K4MCZ.js → chunk-7U34TXLX.js} +1 -1
  11. package/dist/gemini/{chunk-LA23QQDZ.js → chunk-C7ISM6PN.js} +1 -1
  12. package/dist/gemini/{chunk-QQRA4YFW.js → chunk-FJ6IIWF5.js} +1 -1
  13. package/dist/gemini/{chunk-QCMDS3PD.js → chunk-JKCNEXJF.js} +3 -3
  14. package/dist/gemini/{chunk-JNCEWGIV.js → chunk-JX43KPLT.js} +1 -1
  15. package/dist/gemini/{chunk-RKJKHDZC.js → chunk-P6YMHMJL.js} +1 -1
  16. package/dist/gemini/{chunk-HCTUJMZR.js → chunk-PZSSXHHP.js} +1 -1
  17. package/dist/gemini/{chunk-YG6QM4WI.js → chunk-QTFKUXKM.js} +1 -1
  18. package/dist/gemini/{chunk-MUVQ2FAZ.js → chunk-QYJUTNIU.js} +1 -1
  19. package/dist/gemini/{chunk-ZJ2D6ILW.js → chunk-STX7FBUU.js} +1 -1
  20. package/dist/gemini/{chunk-NJ4BSMX7.js → chunk-YJXXYFOM.js} +2 -2
  21. package/dist/gemini/{cleanup-S2LRI2Y4.js → cleanup-HVASUFMM.js} +1 -1
  22. package/dist/gemini/{cleanup-ZZNAJRKJ.js → cleanup-MJ7HQT46.js} +1 -1
  23. package/dist/gemini/{core-C22BYMS6.js → core-EOYLD74V.js} +1 -1
  24. package/dist/gemini/{devtoolsService-EGQAB3JU.js → devtoolsService-B7SSRNHW.js} +2 -2
  25. package/dist/gemini/{devtoolsService-YXEESS76.js → devtoolsService-FLOV3S5Z.js} +2 -2
  26. package/dist/gemini/{dist-X3AUJEIX.js → dist-NVGK4PVU.js} +1 -1
  27. package/dist/gemini/{gemini-X6HMGNFO.js → gemini-2Z2AJTYC.js} +5 -5
  28. package/dist/gemini/{gemini-ENBHDO7W.js → gemini-DRGPGRHF.js} +5 -5
  29. package/dist/gemini/gemini.js +2 -2
  30. package/dist/gemini/{interactiveCli-SZJWTGR5.js → interactiveCli-4K2UKYKF.js} +3 -3
  31. package/dist/gemini/{interactiveCli-CI6V7WL5.js → interactiveCli-TAIO5CBT.js} +9 -9
  32. package/dist/gemini/{liteRtServerManager-J7BSXFBK.js → liteRtServerManager-TUTNSHFW.js} +1 -1
  33. package/dist/gemini/{liteRtServerManager-BDF74U3A.js → liteRtServerManager-XJXZSOE7.js} +1 -1
  34. package/dist/gemini/{oauth2-provider-P65NTFUD.js → oauth2-provider-NEH5B4N6.js} +1 -1
  35. package/dist/gemini/{oauth2-provider-3MTIBHLN.js → oauth2-provider-QU5NILIP.js} +1 -1
  36. package/dist/gemini/{start-DYZJFE46.js → start-SOY6W5ZY.js} +1 -1
  37. package/dist/gemini/{start-KAI6HBJ2.js → start-TUGBMFO3.js} +1 -1
  38. package/dist/linux-x64/cc.js +2 -2
  39. package/dist/win32-x64/cc.js +2 -2
  40. package/package.json +5 -5
  41. package/packages/mcp-channel/wecom/package-lock.json +1313 -0
  42. package/scripts/postinstall.js +12 -12
  43. /package/{claude → packages}/mcp-channel/wecom/.mcp.json +0 -0
  44. /package/{claude → packages}/mcp-channel/wecom/package.json +0 -0
  45. /package/{claude → packages}/mcp-channel/wecom/server.js +0 -0
@@ -1,5 +1,5 @@
1
1
  const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
- import{$ as rd,$a as tC,$b as AC,Aa as Er,Ab as fC,Ba as c,Bb as ol,Ca as WS,Cb as gC,Da as VS,Db as hC,Ea as $S,Eb as yC,Fa as We,Fb as fd,G as ja,Ga as id,Gb as TC,H as xS,Ha as P,Hb as rl,I as od,Ia as qS,Ib as xC,J as lf,Ja as de,Jb as tn,K as pc,Ka as Ct,Kb as gd,L as za,La as gc,Lb as SC,M as Qs,Ma as KS,Mb as Ro,N as SS,Na as jS,Nb as yc,O as CS,Oa as ze,Ob as CC,P as bS,Pa as zS,Pb as bC,Q as ES,Qa as sd,Qb as EC,R as RS,Ra as en,Rb as rs,S as cf,Sa as ad,Sb as nl,T as IS,Ta as Ue,Tb as il,U as vS,Ua as YS,Ub as be,V as AS,Va as pf,Vb as on,W as wS,Wa as XS,Wb as rn,X as ar,Xa as QS,Xb as RC,Y as uf,Ya as JS,Yb as IC,Z as Ya,Za as ZS,Zb as ns,_ as _S,_a as eC,_b as vC,aa as DS,ab as oC,ac as wC,ba as $n,bb as rC,bc as ta,ca as fc,cb as tl,cc as hd,da as MS,db as Js,dc as _C,e as fS,ea as Xa,eb as nC,ec as DC,fa as Qa,fb as ff,fc as nn,ga as Ja,gb as iC,gc as gf,h as gS,ha as nd,hb as Zs,hc as yd,i as hS,ia as PS,ib as ea,ic as Td,j as Ka,ja as OS,jb as hc,jc as MC,k as ot,ka as df,kb as sC,kc as At,la as LS,lb as aC,lc as Lo,ma as mf,mb as ld,mc as PC,na as NS,nb as ht,nc as xd,oa as BS,ob as lC,oc as OC,p as yS,pa as qn,pb as cC,pc as LC,qa as kS,qb as cd,ra as u,rb as Se,rc as Sd,sa as l,sb as uC,sc as NC,ta as HS,tb as dC,ua as FS,ub as mC,va as US,vb as ud,wa as Oo,wb as dd,xa as Za,xb as md,y as TS,ya as GS,yb as pd,za as el,zb as pC}from"./chunk-GMCQZQGQ.js";import{c as Pt}from"./chunk-TU3BMADG.js";import{b as td}from"./chunk-ZJ2D6ILW.js";import{$ as fo,A as tS,B as oS,C as rS,D as Ys,E as nS,L as iS,M as sS,P as Wn,Q as os,U as Ci,V as aS,W as Xs,X as Yt,Y as ed,Z as Nt,_ as Zr,aa as sf,b as zs,ba as kr,c as $x,ca as lS,d as Un,e as dc,f as Si,fa as cS,g as qx,ga as uS,h as rf,ha as af,i as Kx,j as jx,ja as dS,ma as mS,o as zx,p as Yx,q as Gn,r as Xx,ra as Vn,s as Qx,sa as pS,v as Jx,w as nf,x as mc,y as Zx,z as eS}from"./chunk-YHLOYN7E.js";import{a as Ux,b as Wx,c as Vx,e as sr}from"./chunk-YG6QM4WI.js";import{a as z,b as js,c as Gx}from"./chunk-JNCEWGIV.js";import{a as ts,b as Ks,h as Fn,j as Fx}from"./chunk-QQRA4YFW.js";import{$c as LT,$f as JT,$n as Lx,Ac as Vu,Ag as ix,An as _x,Ao as Bx,Bc as _T,Bd as Zi,Bh as mx,Bo as kx,Cc as $u,Cm as Cx,Cn as Dx,Co as Hx,Dc as DT,Dd as FT,De as Yp,Eb as Gu,Ef as Xp,Ek as es,Fd as UT,Ge as jT,Gk as hx,Gn as Mx,Hb as IT,Hd as GT,Jc as qu,Jd as WT,Je as zT,Kg as sx,Kk as Xu,Li as Zp,M as hT,Mc as MT,N as yT,Nd as VT,Nm as bx,O as Ga,Og as Qp,Oh as bn,P as cc,Pb as Kp,Pn as Px,Qb as jp,Qg as Jp,Ri as ef,Se as Ws,U as qp,Vb as vT,Wa as xT,Xa as ST,Xc as PT,Y as TT,Ya as CT,Ye as YT,Yh as $s,Zc as zp,Zn as Ox,_c as OT,_g as zu,_i as fx,ac as AT,ag as ZT,ai as oo,bd as NT,cd as BT,cm as Tx,dd as kT,dg as Vs,dm as xx,eg as Va,fg as $a,fm as Sx,hg as ex,ig as tx,jh as ax,jn as Ju,kg as ox,lc as br,le as $T,lh as lx,lk as gx,ma as Fu,mh as cx,na as Uu,ne as qT,nh as ux,nn as Zu,oc as wT,of as uc,on as Ex,pf as XT,ph as Cn,pn as Rx,qc as Qi,qf as Ku,qn as Ix,rc as Ji,rd as HT,rn as vx,sk as Yu,sn as qs,tb as bT,tf as ju,ub as ET,uf as QT,ul as yx,vg as rx,vn as Ax,we as KT,wi as px,wj as qa,wn as of,x as gT,xb as RT,xo as Nx,yc as Wu,yh as dx,ym as tf,yn as wx,zc as Wa,zg as nx}from"./chunk-NJ4BSMX7.js";import{$a as Wp,$d as mT,Ab as Zy,Bc as Bu,Kd as $p,La as Yy,Le as Qu,M as Fy,Na as Xy,Pa as Qy,S as Uy,Sa as Ua,Sc as ku,Sd as nT,T as Gy,Tc as Hu,Td as iT,U as Up,Uc as tT,Ud as sT,V as Wy,Vc as oT,W as Vy,Wc as rT,Wd as aT,X as Du,Xd as lT,Yd as cT,Zd as uT,_a as Gp,_d as dT,aa as $y,ab as Vp,ac as eT,ae as pT,b as ue,bb as nc,cb as ic,da as qy,db as sc,eb as Xi,fa as Ky,fb as ac,ga as jy,gb as Pu,hb as Ou,ia as zy,ib as Jy,j as Hy,jb as Lu,kb as lc,ne as fT,t as $o,tb as Mt,te as xe,va as Mu,vb as Nu,xa as Br}from"./chunk-VJDLXRZ3.js";import"./chunk-TWIC4BKL.js";import"./chunk-JAFVB6DI.js";import"./chunk-A5A5SUZN.js";import{a as Rt,c as It,d as Z_,e as C}from"./chunk-YUXORC52.js";var Qb=It((ZH,Xb)=>{"use strict";var ND="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Xb.exports=ND});var tE=It((eF,eE)=>{"use strict";var BD=Qb();function Jb(){}function Zb(){}Zb.resetWarningCache=Jb;eE.exports=function(){function e(r,n,s,i,a,d){if(d!==BD){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}e.isRequired=e;function t(){return e}var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Zb,resetWarningCache:Jb};return o.PropTypes=o,o}});var rE=It((rF,oE)=>{oE.exports=tE()();var tF,oF});var lE=It((nF,Gd)=>{"use strict";var iE=td(),kD=eS(),nE=/\s/g;function Of(...e){let t=kD.apply(this,e),o=(r,n)=>HD(r?r.toString():"",t,n);return o.multiline=(r,n)=>FD(r?r.toString():"",t,n),o}var sE=(e,t,o)=>t.interpolation.toLowerCase()==="hsv"?e.hsv(o,t.hsvSpin.toLowerCase()):e.rgb(o);function HD(e,t,o){let r=aE(o),n=Math.max(e.replace(nE,"").length,t.stops.length),s=sE(t,r,n),i="";for(let a of e)i+=a.match(nE)?a:iE.hex(s.shift().toHex())(a);return i}function FD(e,t,o){let r=aE(o),n=e.split(`
2
+ import{$ as rd,$a as tC,$b as AC,Aa as Er,Ab as fC,Ba as c,Bb as ol,Ca as WS,Cb as gC,Da as VS,Db as hC,Ea as $S,Eb as yC,Fa as We,Fb as fd,G as ja,Ga as id,Gb as TC,H as xS,Ha as P,Hb as rl,I as od,Ia as qS,Ib as xC,J as lf,Ja as de,Jb as tn,K as pc,Ka as Ct,Kb as gd,L as za,La as gc,Lb as SC,M as Qs,Ma as KS,Mb as Ro,N as SS,Na as jS,Nb as yc,O as CS,Oa as ze,Ob as CC,P as bS,Pa as zS,Pb as bC,Q as ES,Qa as sd,Qb as EC,R as RS,Ra as en,Rb as rs,S as cf,Sa as ad,Sb as nl,T as IS,Ta as Ue,Tb as il,U as vS,Ua as YS,Ub as be,V as AS,Va as pf,Vb as on,W as wS,Wa as XS,Wb as rn,X as ar,Xa as QS,Xb as RC,Y as uf,Ya as JS,Yb as IC,Z as Ya,Za as ZS,Zb as ns,_ as _S,_a as eC,_b as vC,aa as DS,ab as oC,ac as wC,ba as $n,bb as rC,bc as ta,ca as fc,cb as tl,cc as hd,da as MS,db as Js,dc as _C,e as fS,ea as Xa,eb as nC,ec as DC,fa as Qa,fb as ff,fc as nn,ga as Ja,gb as iC,gc as gf,h as gS,ha as nd,hb as Zs,hc as yd,i as hS,ia as PS,ib as ea,ic as Td,j as Ka,ja as OS,jb as hc,jc as MC,k as ot,ka as df,kb as sC,kc as At,la as LS,lb as aC,lc as Lo,ma as mf,mb as ld,mc as PC,na as NS,nb as ht,nc as xd,oa as BS,ob as lC,oc as OC,p as yS,pa as qn,pb as cC,pc as LC,qa as kS,qb as cd,ra as u,rb as Se,rc as Sd,sa as l,sb as uC,sc as NC,ta as HS,tb as dC,ua as FS,ub as mC,va as US,vb as ud,wa as Oo,wb as dd,xa as Za,xb as md,y as TS,ya as GS,yb as pd,za as el,zb as pC}from"./chunk-2I73JSEP.js";import{c as Pt}from"./chunk-TU3BMADG.js";import{b as td}from"./chunk-C7ISM6PN.js";import{$ as fo,A as tS,B as oS,C as rS,D as Ys,E as nS,L as iS,M as sS,P as Wn,Q as os,U as Ci,V as aS,W as Xs,X as Yt,Y as ed,Z as Nt,_ as Zr,aa as sf,b as zs,ba as kr,c as $x,ca as lS,d as Un,e as dc,f as Si,fa as cS,g as qx,ga as uS,h as rf,ha as af,i as Kx,j as jx,ja as dS,ma as mS,o as zx,p as Yx,q as Gn,r as Xx,ra as Vn,s as Qx,sa as pS,v as Jx,w as nf,x as mc,y as Zx,z as eS}from"./chunk-2BCRFXVD.js";import{a as Ux,b as Wx,c as Vx,e as sr}from"./chunk-QTFKUXKM.js";import{a as z,b as js,c as Gx}from"./chunk-JX43KPLT.js";import{a as ts,b as Ks,h as Fn,j as Fx}from"./chunk-FJ6IIWF5.js";import{$c as LT,$f as JT,$n as Lx,Ac as Vu,Ag as ix,An as _x,Ao as Bx,Bc as _T,Bd as Zi,Bh as mx,Bo as kx,Cc as $u,Cm as Cx,Cn as Dx,Co as Hx,Dc as DT,Dd as FT,De as Yp,Eb as Gu,Ef as Xp,Ek as es,Fd as UT,Ge as jT,Gk as hx,Gn as Mx,Hb as IT,Hd as GT,Jc as qu,Jd as WT,Je as zT,Kg as sx,Kk as Xu,Li as Zp,M as hT,Mc as MT,N as yT,Nd as VT,Nm as bx,O as Ga,Og as Qp,Oh as bn,P as cc,Pb as Kp,Pn as Px,Qb as jp,Qg as Jp,Ri as ef,Se as Ws,U as qp,Vb as vT,Wa as xT,Xa as ST,Xc as PT,Y as TT,Ya as CT,Ye as YT,Yh as $s,Zc as zp,Zn as Ox,_c as OT,_g as zu,_i as fx,ac as AT,ag as ZT,ai as oo,bd as NT,cd as BT,cm as Tx,dd as kT,dg as Vs,dm as xx,eg as Va,fg as $a,fm as Sx,hg as ex,ig as tx,jh as ax,jn as Ju,kg as ox,lc as br,le as $T,lh as lx,lk as gx,ma as Fu,mh as cx,na as Uu,ne as qT,nh as ux,nn as Zu,oc as wT,of as uc,on as Ex,pf as XT,ph as Cn,pn as Rx,qc as Qi,qf as Ku,qn as Ix,rc as Ji,rd as HT,rn as vx,sk as Yu,sn as qs,tb as bT,tf as ju,ub as ET,uf as QT,ul as yx,vg as rx,vn as Ax,we as KT,wi as px,wj as qa,wn as of,x as gT,xb as RT,xo as Nx,yc as Wu,yh as dx,ym as tf,yn as wx,zc as Wa,zg as nx}from"./chunk-YJXXYFOM.js";import{$a as Wp,$d as mT,Ab as Zy,Bc as Bu,Kd as $p,La as Yy,Le as Qu,M as Fy,Na as Xy,Pa as Qy,S as Uy,Sa as Ua,Sc as ku,Sd as nT,T as Gy,Tc as Hu,Td as iT,U as Up,Uc as tT,Ud as sT,V as Wy,Vc as oT,W as Vy,Wc as rT,Wd as aT,X as Du,Xd as lT,Yd as cT,Zd as uT,_a as Gp,_d as dT,aa as $y,ab as Vp,ac as eT,ae as pT,b as ue,bb as nc,cb as ic,da as qy,db as sc,eb as Xi,fa as Ky,fb as ac,ga as jy,gb as Pu,hb as Ou,ia as zy,ib as Jy,j as Hy,jb as Lu,kb as lc,ne as fT,t as $o,tb as Mt,te as xe,va as Mu,vb as Nu,xa as Br}from"./chunk-VJDLXRZ3.js";import"./chunk-TWIC4BKL.js";import"./chunk-JAFVB6DI.js";import"./chunk-A5A5SUZN.js";import{a as Rt,c as It,d as Z_,e as C}from"./chunk-YUXORC52.js";var Qb=It((ZH,Xb)=>{"use strict";var ND="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Xb.exports=ND});var tE=It((eF,eE)=>{"use strict";var BD=Qb();function Jb(){}function Zb(){}Zb.resetWarningCache=Jb;eE.exports=function(){function e(r,n,s,i,a,d){if(d!==BD){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}e.isRequired=e;function t(){return e}var o={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Zb,resetWarningCache:Jb};return o.PropTypes=o,o}});var rE=It((rF,oE)=>{oE.exports=tE()();var tF,oF});var lE=It((nF,Gd)=>{"use strict";var iE=td(),kD=eS(),nE=/\s/g;function Of(...e){let t=kD.apply(this,e),o=(r,n)=>HD(r?r.toString():"",t,n);return o.multiline=(r,n)=>FD(r?r.toString():"",t,n),o}var sE=(e,t,o)=>t.interpolation.toLowerCase()==="hsv"?e.hsv(o,t.hsvSpin.toLowerCase()):e.rgb(o);function HD(e,t,o){let r=aE(o),n=Math.max(e.replace(nE,"").length,t.stops.length),s=sE(t,r,n),i="";for(let a of e)i+=a.match(nE)?a:iE.hex(s.shift().toHex())(a);return i}function FD(e,t,o){let r=aE(o),n=e.split(`
3
3
  `),s=Math.max.apply(null,n.map(d=>d.length).concat([t.stops.length])),i=sE(t,r,s),a=[];for(let d of n){let m=i.slice(0),f="";for(let h of d)f+=iE.hex(m.shift().toHex())(h);a.push(f)}return a.join(`
4
4
  `)}function aE(e){let t={interpolation:"rgb",hsvSpin:"short",...e};if(e!==void 0&&typeof e!="object")throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof e}\``);if(typeof t.interpolation!="string")throw new TypeError(`Expected \`options.interpolation\` to be a \`string\`, got \`${typeof t.interpolation}\``);if(t.interpolation.toLowerCase()==="hsv"&&typeof t.hsvSpin!="string")throw new TypeError(`Expected \`options.hsvSpin\` to be a \`string\`, got \`${typeof t.hsvSpin}\``);return t}var Ic={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"],options:{}},cristal:{colors:["#bdfff3","#4ac29a"],options:{}},teen:{colors:["#77a1d3","#79cbca","#e684ae"],options:{}},mind:{colors:["#473b7b","#3584a7","#30d2be"],options:{}},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"],options:{}},fruit:{colors:["#ff4e50","#f9d423"],options:{}},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"],options:{}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"],options:{}},summer:{colors:["#fdbb2d","#22c1c3"],options:{}},rainbow:{colors:["#ff0000","#ff0100"],options:{interpolation:"hsv",hsvSpin:"long"}},pastel:{colors:["#74ebd5","#74ecd5"],options:{interpolation:"hsv",hsvSpin:"long"}}};Gd.exports=Of;for(let e in Ic)Gd.exports[e]=t=>new Of(Ic[e].colors)(t,Ic[e].options),Gd.exports[e].multiline=t=>new Of(Ic[e].colors).multiline(t,Ic[e].options)});var Dg=It(Ia=>{Ia.parse=Ia.decode=yL;Ia.stringify=Ia.encode=RA;Ia.safe=kl;Ia.unsafe=Qm;var _g=typeof process<"u"&&process.platform==="win32"?`\r
5
5
  `:`
@@ -57,7 +57,7 @@ def fibonacci(n):
57
57
  @@ -1,2 +1,2 @@
58
58
  - print("Hello, " + name)
59
59
  + print(f"Hello, {name}!")
60
- `,availableTerminalHeight:i===!1?W:void 0,terminalWidth:b,theme:L})]}),Ux&&(0,xt.jsx)(u,{marginTop:1,children:(0,xt.jsx)(nR,{activeTheme:L})})]})]}):(0,xt.jsx)(rR,{onSelect:E,onHighlight:A,isFocused:T==="scope",initialScope:d}),(0,xt.jsx)(u,{marginTop:1,children:(0,xt.jsxs)(l,{color:c.text.secondary,wrap:"truncate",children:["(Use Enter to ",T==="theme"?"select":"apply scope",", Tab to"," ",T==="theme"?"configure scope":"select theme",", Esc to close)"]})})]})}var Qt=C(z(),1);var Ai=C(z(),1);var zf=C(td(),1);var Ii=C(z(),1);function jf(e,t,o,r){t<e?e=t:t>=e+r&&(e=t-r+1);let n=Math.max(0,o-r),s=Math.min(e,n);return Math.max(0,s)}function _M(e,t){return function(r,n){if(e.length===0)return r;let s=e.findIndex(a=>a.key===r.activeItemKey),i=s!==-1?s:0;switch(n.type){case"MOVE_UP":{let a=i>0?i-1:e.length-1;return{activeItemKey:e[a].key,windowStart:jf(r.windowStart,a,e.length,t)}}case"MOVE_DOWN":{let a=i<e.length-1?i+1:0;return{activeItemKey:e[a].key,windowStart:jf(r.windowStart,a,e.length,t)}}default:return r}}}function lR({items:e,maxItemsToShow:t}){let o=(0,Ii.useMemo)(()=>_M(e,t),[e,t]),[r,n]=(0,Ii.useReducer)(o,{activeItemKey:e[0]?.key??null,windowStart:0}),s=(0,Ii.useMemo)(()=>{if(e.length===0)return 0;let m=e.findIndex(f=>f.key===r.activeItemKey);return m!==-1?m:0},[e,r.activeItemKey]),i=(0,Ii.useMemo)(()=>jf(r.windowStart,s,e.length,t),[r.windowStart,s,e.length,t]),a=(0,Ii.useCallback)(()=>n({type:"MOVE_UP"}),[]),d=(0,Ii.useCallback)(()=>n({type:"MOVE_DOWN"}),[]);return{activeItemKey:r.activeItemKey,activeIndex:s,windowStart:i,moveUp:a,moveDown:d}}var vi=C(z(),1);var cR={editingKey:null,buffer:"",cursorPos:0};function DM(e,t){switch(t.type){case"START_EDIT":return{editingKey:t.key,buffer:t.initialValue,cursorPos:Yt(t.initialValue)};case"COMMIT_EDIT":return cR;case"MOVE_LEFT":return{...e,cursorPos:Math.max(0,e.cursorPos-1)};case"MOVE_RIGHT":return{...e,cursorPos:Math.min(Yt(e.buffer),e.cursorPos+1)};case"HOME":return{...e,cursorPos:0};case"END":return{...e,cursorPos:Yt(e.buffer)};case"DELETE_LEFT":{if(e.cursorPos===0)return e;let o=Nt(e.buffer,0,e.cursorPos-1),r=Nt(e.buffer,e.cursorPos);return{...e,buffer:o+r,cursorPos:e.cursorPos-1}}case"DELETE_RIGHT":{if(e.cursorPos===Yt(e.buffer))return e;let o=Nt(e.buffer,0,e.cursorPos),r=Nt(e.buffer,e.cursorPos+1);return{...e,buffer:o+r}}case"INSERT_CHAR":{let o=t.char,r=!1;if(t.isNumberType?r=/[0-9\-+.]/.test(o):(r=o.length===1&&o.charCodeAt(0)>=32,o=Zr(o)),!r||o.length===0)return e;let n=Nt(e.buffer,0,e.cursorPos),s=Nt(e.buffer,e.cursorPos);return{...e,buffer:n+o+s,cursorPos:e.cursorPos+1}}default:return e}}function uR({onCommit:e}){let[t,o]=(0,vi.useReducer)(DM,cR),[r,n]=(0,vi.useState)(!0);(0,vi.useEffect)(()=>{if(!t.editingKey){n(!0);return}n(!0);let a=setInterval(()=>{n(d=>!d)},500);return()=>clearInterval(a)},[t.editingKey,t.buffer,t.cursorPos]);let s=(0,vi.useCallback)((a,d)=>{o({type:"START_EDIT",key:a,initialValue:d})},[]),i=(0,vi.useCallback)(()=>{t.editingKey&&e(t.editingKey,t.buffer),o({type:"COMMIT_EDIT"})},[t.editingKey,t.buffer,e]);return{editState:t,editDispatch:o,startEditing:s,commitEdit:i,cursorVisible:r}}var Ye=C(P(),1);function am({title:e,borderColor:t,searchEnabled:o=!0,searchPlaceholder:r="Search to filter",searchBuffer:n,items:s,showScopeSelector:i=!0,scopeItems:a,selectedScope:d,onScopeChange:m,maxItemsToShow:f,maxLabelWidth:h,onItemToggle:p,onEditCommit:y,onItemClear:g,onClose:x,onKeyPress:S,keyMatchers:I,availableHeight:A,footer:E}){let T=ze(),v=I??T,R=(0,Ai.useMemo)(()=>(a??Sl()).map(j=>({...j,key:j.value})),[a]),b=i&&R.length>1,{effectiveMaxItemsToShow:_,finalShowScopeSelector:w}=(0,Ai.useMemo)(()=>{let j=b,$=f;if(!A)return{effectiveMaxItemsToShow:$,finalShowScopeSelector:j};let X=4,Q=1,Ce=o?5:1,_e=2,Be=1,ce=5,Fe=1,pt=E?.height??0,St=3,xn=A-X,qr=Q+Ce+_e+Be+Fe+pt,tr=qr+ce,Do=xn-tr,Kr=Math.max(1,Math.floor(Do/St)),_t=xn-qr,or=Math.max(1,Math.floor(_t/St)),Mn=j,mi=j?Kr:or;return j&&A<25&&or>Kr+1&&(Mn=!1,mi=or),{effectiveMaxItemsToShow:Math.min(mi,s.length),finalShowScopeSelector:Mn}},[A,f,s.length,o,b,E]),{activeIndex:M,windowStart:D,moveUp:N,moveDown:O}=lR({items:s,maxItemsToShow:_}),{editState:W,editDispatch:L,startEditing:k,commitEdit:F,cursorVisible:B}=uR({onCommit:(j,$)=>{let X=s.find(Q=>Q.key===j);X&&y(j,$,X)}}),{editingKey:K,buffer:q,cursorPos:Z}=W,[Y,oe]=(0,Ai.useState)("settings"),le=!w&&Y==="scope"?"settings":Y,G=s.slice(D,D+_),ee=s.length>_,te=s.length>_,se=s[M],ne=(0,Ai.useCallback)(j=>{m?.(j)},[m]);return de(j=>{if(!(!K&&S?.(j,se))){if(K){let X=s.find(Q=>Q.key===K)?.type??"string";if(v["cursor.left"](j)){L({type:"MOVE_LEFT"});return}if(v["cursor.right"](j)){L({type:"MOVE_RIGHT"});return}if(v["cursor.home"](j)){L({type:"HOME"});return}if(v["cursor.end"](j)){L({type:"END"});return}if(v["edit.deleteLeft"](j)){L({type:"DELETE_LEFT"});return}if(v["edit.deleteRight"](j)){L({type:"DELETE_RIGHT"});return}if(v["basic.cancel"](j)){F();return}if(v["basic.confirm"](j)){F();return}if(v["nav.dialog.up"](j)&&!j.insertable){F(),N();return}if(v["nav.dialog.down"](j)&&!j.insertable){F(),O();return}j.sequence&&L({type:"INSERT_CHAR",char:j.sequence,isNumberType:X==="number"});return}if(le==="settings"){if(v["nav.dialog.up"](j))return N(),!0;if(v["nav.dialog.down"](j))return O(),!0;if(v["basic.confirm"](j)&&se){if(se.type==="boolean"||se.type==="enum")p(se.key,se);else{let $=se.rawValue,X=se.editValue??($!==void 0?String($):"");k(se.key,X)}return!0}if(v["app.clearScreen"](j)&&se)return g(se.key,se),!0;if(se?.type==="number"&&/^[0-9]$/.test(j.sequence))return k(se.key,j.sequence),!0}if(j.name==="tab"&&w){oe($=>$==="settings"?"scope":"settings");return}if(v["basic.cancel"](j)){x();return}}},{isActive:!0,priority:le==="settings"}),(0,Ye.jsx)(u,{borderStyle:"round",borderColor:t??c.border.default,flexDirection:"row",padding:1,width:"100%",maxHeight:A,children:(0,Ye.jsxs)(u,{flexDirection:"column",flexGrow:1,children:[(0,Ye.jsx)(u,{marginX:1,children:(0,Ye.jsxs)(l,{bold:le==="settings"&&!K,wrap:"truncate",children:[le==="settings"?"> ":" ",e," "]})}),o&&n&&(0,Ye.jsx)(u,{borderStyle:"round",borderColor:K?c.border.default:le==="settings"?c.ui.focus:c.border.default,paddingX:1,height:3,marginTop:1,children:(0,Ye.jsx)(ea,{focus:le==="settings"&&!K,buffer:n,placeholder:r})}),(0,Ye.jsx)(u,{height:1}),G.length===0?(0,Ye.jsx)(u,{marginX:1,height:1,flexDirection:"column",children:(0,Ye.jsx)(l,{color:c.text.secondary,children:"No matches found."})}):(0,Ye.jsxs)(Ye.Fragment,{children:[ee&&(0,Ye.jsx)(u,{marginX:1,children:(0,Ye.jsx)(l,{color:c.text.secondary,children:"\u25B2"})}),G.map((j,$)=>{let X=$+D,Q=le==="settings"&&M===X,Ce;if(K===j.key)if(B&&Z<Yt(q)){let _e=Nt(q,0,Z),Be=Nt(q,Z,Z+1),ce=Nt(q,Z+1);Ce=_e+zf.default.inverse(Be)+ce}else Z>=Yt(q)?Ce=q+(B?zf.default.inverse(" "):" "):Ce=q;else Ce=j.displayValue;return(0,Ye.jsxs)(Ai.default.Fragment,{children:[(0,Ye.jsxs)(u,{marginX:1,flexDirection:"row",alignItems:"flex-start",backgroundColor:Q?c.background.focus:void 0,children:[(0,Ye.jsx)(u,{minWidth:2,flexShrink:0,children:(0,Ye.jsx)(l,{color:Q?c.ui.focus:c.text.secondary,children:Q?"\u25CF":""})}),(0,Ye.jsxs)(u,{flexDirection:"row",flexGrow:1,minWidth:0,alignItems:"flex-start",children:[(0,Ye.jsxs)(u,{flexDirection:"column",width:h,minWidth:0,children:[(0,Ye.jsxs)(l,{color:Q?c.ui.focus:c.text.primary,children:[j.label,j.scopeMessage&&(0,Ye.jsxs)(l,{color:c.text.secondary,children:[" ",j.scopeMessage]})]}),(0,Ye.jsx)(l,{color:c.text.secondary,wrap:"truncate",children:j.description??""})]}),(0,Ye.jsx)(u,{minWidth:3}),(0,Ye.jsx)(u,{flexShrink:0,children:(0,Ye.jsx)(l,{color:Q?c.ui.focus:j.isGreyedOut?c.text.secondary:c.text.primary,terminalCursorFocus:K===j.key&&B,terminalCursorPosition:ed(q,Z),children:Ce})})]})]}),(0,Ye.jsx)(u,{height:1})]},j.key)}),te&&(0,Ye.jsx)(u,{marginX:1,children:(0,Ye.jsx)(l,{color:c.text.secondary,children:"\u25BC"})})]}),(0,Ye.jsx)(u,{height:1}),w&&(0,Ye.jsxs)(u,{marginX:1,flexDirection:"column",children:[(0,Ye.jsxs)(l,{bold:le==="scope",wrap:"truncate",children:[le==="scope"?"> ":" ","Apply To"]}),(0,Ye.jsx)(Ue,{items:R,initialIndex:R.findIndex(j=>j.value===d),onSelect:ne,onHighlight:ne,isFocused:le==="scope",showNumbers:le==="scope",priority:le==="scope"})]}),(0,Ye.jsx)(u,{height:1}),(0,Ye.jsx)(u,{marginX:1,children:(0,Ye.jsxs)(l,{color:c.text.secondary,children:["(Use Enter to select, ",be("app.clearScreen")," to reset",w?", Tab to change focus":"",", Esc to close)"]})}),E&&(0,Ye.jsx)(u,{marginX:1,children:E.content})]})})}var Yf=C(P(),1);var MM=8,PM=new gc("up"),OM=new gc("ctrl+p"),LM=new gc("down"),NM=new gc("ctrl+n");function BM(e){let t=new Map,o=[["User",e.user.settings],["Workspace",e.workspace.settings],["System",e.system.settings]];for(let r of xS()){let n=new Map;for(let[s,i]of o){let a=Qs(r,i)?pc(r,i):void 0;n.set(s,JSON.stringify(a))}t.set(r,n)}return t}function dR({onSelect:e,onRestartRequest:t,availableTerminalHeight:o}){let{settings:r,setSetting:n}=id(),[s,i]=(0,Qt.useState)("User"),a=(0,Qt.useMemo)(()=>Sl().filter(k=>{let F=r.forScope(k.value);return F.readOnly!==!0&&(k.value!=="Workspace"||F.path!==void 0)}),[r]),d=a.find(k=>k.value===s)?.value??a[0]?.value,m=d??"User";d&&s!==d&&i(d);let[f]=(0,Qt.useState)(()=>BM(r)),[h,p]=(0,Qt.useState)(""),[y,g]=(0,Qt.useState)(()=>za()),{fzfInstance:x,searchMap:S}=(0,Qt.useMemo)(()=>{let k=za(),F=new Map,B=[];return k.forEach(q=>{let Z=ja(q);Z?.label&&(B.push(Z.label),F.set(Z.label.toLowerCase(),q))}),{fzfInstance:new qs(B,{fuzzy:"v2",casing:"case-insensitive"}),searchMap:F}},[]);(0,Qt.useEffect)(()=>{let k=!0;if(!h.trim()||!x){g(za());return}return(async()=>{let B=await x.find(h);if(!k)return;let K=new Set;B.forEach(q=>{let Z=S.get(q.item.toLowerCase());Z&&K.add(Z)}),g(Array.from(K))})(),()=>{k=!1}},[h,x,S]);let A=(0,Qt.useMemo)(()=>{let k=new Set,F=[["User",r.user.settings],["Workspace",r.workspace.settings],["System",r.system.settings]];for(let[B,K]of f)for(let[q,Z]of F){let Y=Qs(B,Z)?pc(B,Z):void 0,oe=K.get(q);if(JSON.stringify(Y)!==oe){k.add(B);break}}return k},[r,f]).size>0,E=(0,Qt.useMemo)(()=>{let k=za(),F=0;for(let B of k){let K=ja(B);if(!K)continue;let q=Dc(B,m,r),Y=(K.label||B)+(q?` ${q}`:""),oe=kr(Y),le=K.description?kr(K.description):0;F=Math.max(F,oe,le)}return F},[m,r]),T=uC({initialText:"",onChange:p}),v=h?y:za(),R=(0,Qt.useMemo)(()=>{let k=r.forScope(m).settings,F=r.merged;return v.map(B=>{let K=ja(B),q=K?.type??"string",Z=SS(B,k,F),Y=Dc(B,m,r),oe=!Qs(B,k),le=pc(B,k),G=bS(q,le);return{key:B,label:K?.label||B,description:K?.description,type:q,displayValue:Z,isGreyedOut:oe,scopeMessage:Y,rawValue:le,editValue:G}})},[v,m,r]),b=(0,Qt.useCallback)(k=>{i(k)},[]),_=(0,Qt.useCallback)((k,F)=>{if(!d)return;let B=ja(k);if(!mS.has(B?.type))return;let K=r.forScope(d).settings,q=pc(k,K),Z;if(B?.type==="boolean"){if(typeof q!="boolean")return;Z=!q}else if(B?.type==="enum"&&B.options){let Y=B.options;if(Y.length===0)return;let oe=Y?.findIndex(le=>le.value===q);oe!==-1&&oe<Y.length-1?Z=Y[oe+1].value:Z=Y[0].value}else return;ue.log(`[DEBUG SettingsDialog] Saving ${k} immediately with value:`,Z),n(d,k,Z)},[r,d,n]),w=(0,Qt.useCallback)((k,F,B)=>{if(!d)return;let q=ja(k)?.type??"string",Z=CS(q,F);Z!==null&&n(d,k,Z)},[d,n]),M=(0,Qt.useCallback)((k,F)=>{d&&n(d,k,void 0)},[d,n]),D=(0,Qt.useCallback)(()=>{e(void 0,m)},[e,m]),N=ze(),O=(0,Qt.useMemo)(()=>({...N,"nav.dialog.up":k=>PM.matches(k)||OM.matches(k),"nav.dialog.down":k=>LM.matches(k)||NM.matches(k)}),[N]),W=(0,Qt.useCallback)((k,F)=>A&&k.sequence==="r"?(t&&t(),!0):!1,[A,t]),L=!A;return(0,Yf.jsx)(am,{title:"Settings",borderColor:A?c.status.warning:void 0,searchEnabled:L,searchBuffer:T,items:R,showScopeSelector:a.length>1,scopeItems:a,selectedScope:m,onScopeChange:b,maxItemsToShow:MM,availableHeight:o,maxLabelWidth:E,onItemToggle:_,onEditCommit:w,onItemClear:M,onClose:D,onKeyPress:W,keyMatchers:O,footer:A?{content:(0,Yf.jsx)(l,{color:c.status.warning,children:"Changes that require a restart have been modified. Press r to exit and apply changes now."}),height:1}:void 0})}var lm=C(z(),1);var ga=C(P(),1);function mR({onTimeout:e}){let[t,o]=(0,lm.useState)(!1);return de(r=>{(r.name==="escape"||r.ctrl&&r.name==="c")&&e()},{isActive:!0}),(0,lm.useEffect)(()=>{let r=setTimeout(()=>{o(!0),e()},18e4);return()=>clearTimeout(r)},[e]),(0,ga.jsx)(u,{borderStyle:"round",borderColor:c.border.default,flexDirection:"column",padding:1,width:"100%",children:t?(0,ga.jsx)(l,{color:c.status.error,children:"Authentication timed out. Please try again."}):(0,ga.jsx)(u,{children:(0,ga.jsxs)(l,{children:[(0,ga.jsx)(Ro,{type:"dots"})," Waiting for authentication... (Press Esc or Ctrl+C to cancel)"]})})})}var cm=C(z(),1);var In=C(z(),1);function Xf(e,t){let o=t.merged.security.auth.enforcedType;return o&&o!==e?`Authentication is enforced to be ${o}, but you are currently using ${e}.`:t.merged.security.auth.useExternal||e==="gemini-api-key"?null:Sd(e)}var fR=(e,t,o=null,r=null)=>{let[n,s]=(0,In.useState)(o?"updating":"unauthenticated"),[i,a]=(0,In.useState)(o),[d,m]=(0,In.useState)(r),[f,h]=(0,In.useState)(void 0),p=(0,In.useCallback)(g=>{a(g),g&&s("updating")},[a,s]),y=(0,In.useCallback)(async()=>{let g=process.env.GEMINI_API_KEY;if(g!==void 0)return h(g),g;let x=await lx()??"";return h(x),x},[]);return(0,In.useEffect)(()=>{n==="awaiting_api_key_input"&&y()},[n,y]),(0,In.useEffect)(()=>{(async()=>{if(n!=="unauthenticated")return;let g=e.merged.security.auth.selectedType;if(!g){process.env.GEMINI_API_KEY?p('Existing API key detected (GEMINI_API_KEY). Select "Gemini API Key" option to use it.'):p("No authentication method selected.");return}if(g==="gemini-api-key"&&!await y()){s("awaiting_api_key_input");return}let x=Xf(g,e);if(x){p(x);return}let S=process.env.GEMINI_DEFAULT_AUTH_TYPE;if(S&&!Object.values(Cn).includes(S)){p(`Invalid value for GEMINI_DEFAULT_AUTH_TYPE: "${S}". Valid values are: ${Object.values(Cn).join(", ")}.`);return}try{await t.refreshAuth(g),ue.log(`Authenticated via "${g}".`),a(null),s("authenticated")}catch(I){let A=Qy(I);A?m({message:A.message,appealUrl:A.appealUrl,appealLinkText:A.appealLinkText}):I instanceof zu?p(Br(I)):p(`Failed to sign in. Message: ${Br(I)}`)}})()},[e,t,n,s,a,p,y]),{authState:n,setAuthState:s,authError:i,onAuthError:p,apiKeyDefaultValue:f,reloadApiKey:y,accountSuspensionInfo:d,setAccountSuspensionInfo:m}};var no=C(P(),1);function gR({config:e,settings:t,setAuthState:o,authError:r,onAuthError:n,setAuthContext:s}){let[i,a]=(0,cm.useState)(!1),d=[{label:"Sign in with Google",value:"oauth-personal",key:"oauth-personal"},...process.env.CLOUD_SHELL==="true"?[{label:"Use Cloud Shell user credentials",value:"compute-default-credentials",key:"compute-default-credentials"}]:process.env.GEMINI_CLI_USE_COMPUTE_ADC==="true"?[{label:"Use metadata server application default credentials",value:"compute-default-credentials",key:"compute-default-credentials"}]:[],{label:"Use Gemini API Key",value:"gemini-api-key",key:"gemini-api-key"},{label:"Vertex AI",value:"vertex-ai",key:"vertex-ai"}];t.merged.security.auth.enforcedType&&(d=d.filter(g=>g.value===t.merged.security.auth.enforcedType));let m=null,f=process.env.GEMINI_DEFAULT_AUTH_TYPE;f&&Object.values(Cn).includes(f)&&(m=f);let h=d.findIndex(g=>t.merged.security.auth.selectedType?g.value===t.merged.security.auth.selectedType:m?g.value===m:process.env.GEMINI_API_KEY?g.value==="gemini-api-key":g.value==="oauth-personal");t.merged.security.auth.enforcedType&&(h=0);let p=(0,cm.useCallback)(async(g,x)=>{if(!i){if(g){let S=g==="oauth-personal"||g==="vertex-ai"&&process.env.CLOUD_SHELL==="true";if(s(S?{requiresRestart:!0}:{}),await qu(),t.setValue(x,"security.auth.selectedType",g),g==="oauth-personal"&&e.isBrowserLaunchSuppressed()){a(!0),setTimeout(sr,100);return}if(g==="gemini-api-key"){o("awaiting_api_key_input");return}}o("unauthenticated")}},[t,e,o,i,s]),y=g=>{let x=Xf(g,t);x?n(x):p(g,"User")};return de(g=>g.name==="escape"?r?!0:t.merged.security.auth.selectedType===void 0?(n("You must select an auth method to proceed. Press Ctrl+C twice to exit."),!0):(p(void 0,"User"),!0):!1,{isActive:!0}),i?(0,no.jsx)(u,{borderStyle:"round",borderColor:c.ui.focus,flexDirection:"row",padding:1,width:"100%",alignItems:"flex-start",children:(0,no.jsx)(l,{color:c.text.primary,children:"Logging in with Google... Restarting Gemini CLI to continue."})}):(0,no.jsxs)(u,{borderStyle:"round",borderColor:c.ui.focus,flexDirection:"row",padding:1,width:"100%",alignItems:"flex-start",children:[(0,no.jsx)(l,{color:c.text.accent,children:"? "}),(0,no.jsxs)(u,{flexDirection:"column",flexGrow:1,children:[(0,no.jsx)(l,{bold:!0,color:c.text.primary,children:"Get started"}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.text.primary,children:"How would you like to authenticate for this project?"})}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(Ue,{items:d,initialIndex:h,onSelect:y,onHighlight:()=>{n(null)}})}),r&&(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.status.error,children:r})}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.text.secondary,children:"(Use Enter to select)"})}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.text.primary,children:"Terms of Services and Privacy Notice for Gemini CLI"})}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.text.link,children:"https://geminicli.com/docs/resources/tos-privacy/"})})]})]})}var ha=C(z(),1);var yo=C(P(),1);function hR({accountSuspensionInfo:e,onExit:t,onChangeAuth:o}){let[r,n]=(0,ha.useState)(null),s=e.appealUrl,i=e.appealLinkText??"Open the Google Form",a=(0,ha.useMemo)(()=>{let f=[];return s&&f.push({label:i,value:"open_form",key:"open_form"}),f.push({label:"Change authentication",value:"change_auth",key:"change_auth"},{label:"Exit",value:"exit",key:"exit"}),f},[s,i]);de(f=>f.name==="escape"?(d(),!0):!1,{isActive:!0});let d=(0,ha.useCallback)(async()=>{await Fn(),t()},[t]),m=(0,ha.useCallback)(async f=>{if(f==="open_form"&&s){if(!$a()){n(`Please open this URL in a browser: ${s}`);return}try{await Va(s)}catch{n(`Failed to open browser. Please visit: ${s}`)}}else f==="change_auth"?o():await d()},[d,o,s]);return(0,yo.jsxs)(u,{flexDirection:"column",padding:1,children:[(0,yo.jsx)(l,{bold:!0,color:c.status.error,children:"Error: Account Suspended"}),(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(l,{children:e.message})}),s&&(0,yo.jsxs)(yo.Fragment,{children:[(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(l,{children:"Appeal URL:"})}),(0,yo.jsx)(u,{children:(0,yo.jsxs)(l,{color:c.text.link,children:["[",s,"]"]})})]}),r&&(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(l,{color:c.status.error,children:r})}),(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(Ue,{items:a,onSelect:f=>void m(f)})}),(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(l,{dimColor:!0,children:"Escape to exit"})})]})}var um=C(z(),1);var fr=C(P(),1);function yR({onSubmit:e,onCancel:t,error:o,defaultValue:r=""}){let n=ze(),{terminalWidth:s}=Se(),i=s-8,a=(0,um.useRef)(null);(0,um.useEffect)(()=>()=>{a.current?.cancel()},[]);let d=r,m=Zs({initialText:d||"",initialCursorOffset:d?.length||0,viewport:{width:i,height:4},inputFilter:p=>p.replace(/[^a-zA-Z0-9_.-]/g,"").replace(/[\r\n]/g,""),singleLine:!0}),f=p=>{e(p)},h=()=>{a.current?.cancel();let p=!1,y=new Promise((g,x)=>{ux().then(()=>!p&&g(),S=>!p&&x(S))});return a.current={cancel:()=>{p=!0}},y.then(()=>{m.setText("")}).catch(g=>{ue.debug("Failed to clear API key:",g)})};return de(p=>n["edit.clear"](p)?(h(),!0):!1,{isActive:!0}),(0,fr.jsxs)(u,{borderStyle:"round",borderColor:c.ui.focus,flexDirection:"column",padding:1,width:"100%",children:[(0,fr.jsx)(l,{bold:!0,color:c.text.primary,children:"Enter Gemini API Key"}),(0,fr.jsxs)(u,{marginTop:1,flexDirection:"column",children:[(0,fr.jsx)(l,{color:c.text.primary,children:"Please enter your Gemini API key. It will be securely stored in your system keychain."}),(0,fr.jsxs)(l,{color:c.text.secondary,children:["You can get an API key from"," ",(0,fr.jsx)(l,{color:c.text.link,children:"https://aistudio.google.com/app/apikey"})]})]}),(0,fr.jsx)(u,{marginTop:1,flexDirection:"row",children:(0,fr.jsx)(u,{borderStyle:"round",borderColor:c.border.default,paddingX:1,flexGrow:1,children:(0,fr.jsx)(ea,{buffer:m,onSubmit:f,onCancel:t,placeholder:"Paste your API key here"})})}),o&&(0,fr.jsx)(u,{marginTop:1,children:(0,fr.jsx)(l,{color:c.status.error,children:o})}),(0,fr.jsx)(u,{marginTop:1,children:(0,fr.jsx)(l,{color:c.text.secondary,children:"(Press Enter to submit, Esc to cancel, Ctrl+C to clear stored key)"})})]})}var Jf=C(z(),1);var Qf=class{availableEditors;constructor(){let t=Object.keys(uc).sort();this.availableEditors=[{name:"None",type:"not_set",disabled:!1},...t.map(o=>{let r=Ku(o),n=ju(o),s=n?"":" (Not available in sandbox)";return s=r?s:" (Not installed)",{name:uc[o]+s,type:o,disabled:!r||!n}})]}getAvailableEditorDisplays(){return this.availableEditors}},TR=new Qf;var wo=C(P(),1);function xR({onSelect:e,settings:t,onExit:o}){let[r,n]=(0,Jf.useState)("User"),[s,i]=(0,Jf.useState)("editor");de(S=>S.name==="tab"?(i(I=>I==="editor"?"scope":"editor"),!0):S.name==="escape"?(o(),!0):!1,{isActive:!0});let a=TR.getAvailableEditorDisplays(),d=t.forScope(r).settings.general?.preferredEditor,m=d?a.findIndex(S=>S.type===d):0;m===-1&&(xe.emitFeedback("error",`Editor is not supported: ${d}`),m=0);let f=[{label:"User Settings",value:"User",key:"User"},{label:"Workspace Settings",value:"Workspace",key:"Workspace"}],h=S=>{if(S==="not_set"){e(void 0,r);return}e(S,r)},p=S=>{n(S),i("editor")},y="",g=r==="User"?"Workspace":"User";t.forScope(g).settings.general?.preferredEditor!==void 0&&(y=t.forScope(r).settings.general?.preferredEditor!==void 0?`(Also modified in ${g})`:`(Modified in ${g})`);let x="None";return t.merged.general.preferredEditor&&QT(t.merged.general.preferredEditor)&&(x=uc[t.merged.general.preferredEditor]),(0,wo.jsxs)(u,{borderStyle:"round",borderColor:c.border.default,flexDirection:"row",padding:1,width:"100%",children:[(0,wo.jsxs)(u,{flexDirection:"column",width:"45%",paddingRight:2,children:[(0,wo.jsxs)(l,{bold:s==="editor",children:[s==="editor"?"> ":" ","Select Editor"," ",(0,wo.jsx)(l,{color:c.text.secondary,children:y})]}),(0,wo.jsx)(Ue,{items:a.map(S=>({label:S.name,value:S.type,disabled:S.disabled,key:S.type})),initialIndex:m,onSelect:h,isFocused:s==="editor"},r),(0,wo.jsxs)(u,{marginTop:1,flexDirection:"column",children:[(0,wo.jsxs)(l,{bold:s==="scope",children:[s==="scope"?"> ":" ","Apply To"]}),(0,wo.jsx)(Ue,{items:f,initialIndex:0,onSelect:p,isFocused:s==="scope"})]}),(0,wo.jsx)(u,{marginTop:1,children:(0,wo.jsx)(l,{color:c.text.secondary,children:"(Use Enter to select, Tab to change focus, Esc to close)"})})]}),(0,wo.jsxs)(u,{flexDirection:"column",width:"55%",paddingLeft:2,children:[(0,wo.jsx)(l,{bold:!0,color:c.text.primary,children:"Editor Preference"}),(0,wo.jsxs)(u,{flexDirection:"column",gap:1,marginTop:1,children:[(0,wo.jsx)(l,{color:c.text.secondary,children:"These editors are currently supported. Please note that some editors cannot be used in sandbox mode."}),(0,wo.jsxs)(l,{color:c.text.secondary,children:["Your preferred editor is:"," ",(0,wo.jsx)(l,{color:x==="None"?c.status.error:c.text.link,bold:!0,children:x}),"."]})]})]})]})}var Jt=C(P(),1);var SR=({onExit:e})=>(de(t=>t.name==="escape"?(e(),!0):!1,{isActive:!0}),(0,Jt.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,Jt.jsx)(l,{bold:!0,color:c.text.accent,children:"Gemini API Key Notice"}),(0,Jt.jsx)(Oo,{}),(0,Jt.jsxs)(l,{color:c.text.primary,children:["By using the Gemini API",(0,Jt.jsx)(l,{color:c.text.link,children:"[1]"}),", Google AI Studio",(0,Jt.jsx)(l,{color:c.status.error,children:"[2]"}),', and the other Google developer services that reference these terms (collectively, the "APIs" or "Services"), you are agreeing to Google APIs Terms of Service (the "API Terms")',(0,Jt.jsx)(l,{color:c.status.success,children:"[3]"}),', and the Gemini API Additional Terms of Service (the "Additional Terms")',(0,Jt.jsx)(l,{color:c.text.accent,children:"[4]"}),"."]}),(0,Jt.jsx)(Oo,{}),(0,Jt.jsxs)(l,{color:c.text.primary,children:[(0,Jt.jsx)(l,{color:c.text.link,children:"[1]"})," ","https://ai.google.dev/docs/gemini_api_overview"]}),(0,Jt.jsxs)(l,{color:c.text.primary,children:[(0,Jt.jsx)(l,{color:c.status.error,children:"[2]"})," https://aistudio.google.com/"]}),(0,Jt.jsxs)(l,{color:c.text.primary,children:[(0,Jt.jsx)(l,{color:c.status.success,children:"[3]"})," ","https://developers.google.com/terms"]}),(0,Jt.jsxs)(l,{color:c.text.primary,children:[(0,Jt.jsx)(l,{color:c.text.accent,children:"[4]"})," ","https://ai.google.dev/gemini-api/terms"]}),(0,Jt.jsx)(Oo,{}),(0,Jt.jsx)(l,{color:c.text.secondary,children:"Press Esc to exit."})]}));var gr=C(P(),1);var CR=({onExit:e})=>(de(t=>t.name==="escape"?(e(),!0):!1,{isActive:!0}),(0,gr.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,gr.jsx)(l,{bold:!0,color:c.text.accent,children:"Vertex AI Notice"}),(0,gr.jsx)(Oo,{}),(0,gr.jsxs)(l,{color:c.text.primary,children:["Service Specific Terms",(0,gr.jsx)(l,{color:c.text.link,children:"[1]"})," are incorporated into the agreement under which Google has agreed to provide Google Cloud Platform",(0,gr.jsx)(l,{color:c.status.success,children:"[2]"})," to Customer (the \u201CAgreement\u201D). If the Agreement authorizes the resale or supply of Google Cloud Platform under a Google Cloud partner or reseller program, then except for in the section entitled \u201CPartner-Specific Terms\u201D, all references to Customer in the Service Specific Terms mean Partner or Reseller (as applicable), and all references to Customer Data in the Service Specific Terms mean Partner Data. Capitalized terms used but not defined in the Service Specific Terms have the meaning given to them in the Agreement."]}),(0,gr.jsx)(Oo,{}),(0,gr.jsxs)(l,{color:c.text.primary,children:[(0,gr.jsx)(l,{color:c.text.link,children:"[1]"})," ","https://cloud.google.com/terms/service-terms"]}),(0,gr.jsxs)(l,{color:c.text.primary,children:[(0,gr.jsx)(l,{color:c.status.success,children:"[2]"})," ","https://cloud.google.com/terms/services"]}),(0,gr.jsx)(Oo,{}),(0,gr.jsx)(l,{color:c.text.secondary,children:"Press Esc to exit."})]}));var Cl=C(z(),1);var ER=e=>{let[t,o]=(0,Cl.useState)({isLoading:!0});(0,Cl.useEffect)(()=>{(async()=>{o({isLoading:!0});try{let s=bR(e),i=s.userTier;if(i===void 0)throw new Error("Could not determine user tier.");if(i!==MT.FREE){o({isLoading:!1,isFreeTier:!1});return}let a=await kM(s);o({isLoading:!1,isFreeTier:!0,dataCollectionOptIn:a})}catch(s){o({isLoading:!1,error:s instanceof Error?s.message:String(s)})}})()},[e]);let r=(0,Cl.useCallback)(async n=>{try{let s=bR(e),i=await HM(s,n);o({isLoading:!1,isFreeTier:!0,dataCollectionOptIn:i})}catch(s){o({isLoading:!1,error:s instanceof Error?s.message:String(s)})}},[e]);return{privacyState:t,updateDataCollectionOptIn:r}};function bR(e){let t=ax(e);if(t===void 0)throw new Error("Oauth not being used");if(t.projectId===void 0)throw new Error("CodeAssist server is missing a project ID");return t}async function kM(e){try{let t=await e.getCodeAssistGlobalUserSetting();return t.freeTierDataCollectionOptin===void 0&&ue.warn("Warning: Code Assist API did not return freeTierDataCollectionOptin. Defaulting to true."),t.freeTierDataCollectionOptin??!0}catch(t){if(t&&typeof t=="object"&&"response"in t&&t.response?.status===404)return!0;throw t}}async function HM(e,t){let o=await e.setCodeAssistGlobalUserSetting({cloudaicompanionProject:e.projectId,freeTierDataCollectionOptin:t});return o.freeTierDataCollectionOptin===void 0&&ue.warn(`Warning: Code Assist API did not return freeTierDataCollectionOptin. Defaulting to ${t}.`),o.freeTierDataCollectionOptin??t}var yt=C(P(),1);var RR=({config:e,onExit:t})=>{let{privacyState:o,updateDataCollectionOptIn:r}=ER(e);if(de(s=>(o.error||o.isFreeTier===!1)&&s.name==="escape"?(t(),!0):!1,{isActive:!0}),o.isLoading)return(0,yt.jsx)(l,{color:c.text.secondary,children:"Loading..."});if(o.error)return(0,yt.jsxs)(u,{flexDirection:"column",marginY:1,children:[(0,yt.jsxs)(l,{color:c.status.error,children:["Error loading Opt-in settings: ",o.error]}),(0,yt.jsx)(l,{color:c.text.secondary,children:"Press Esc to exit."})]});if(o.isFreeTier===!1)return(0,yt.jsxs)(u,{flexDirection:"column",marginY:1,children:[(0,yt.jsx)(l,{bold:!0,color:c.text.accent,children:"Gemini Code Assist Privacy Notice"}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{children:"https://developers.google.com/gemini-code-assist/resources/privacy-notices"}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{color:c.text.secondary,children:"Press Esc to exit."})]});let n=[{label:"Yes",value:!0,key:"true"},{label:"No",value:!1,key:"false"}];return(0,yt.jsxs)(u,{flexDirection:"column",marginY:1,children:[(0,yt.jsx)(l,{bold:!0,color:c.text.accent,children:"Gemini Code Assist for Individuals Privacy Notice"}),(0,yt.jsx)(Oo,{}),(0,yt.jsxs)(l,{color:c.text.primary,children:["This notice and our Privacy Policy",(0,yt.jsx)(l,{color:c.text.link,children:"[1]"})," describe how Gemini Code Assist handles your data. Please read them carefully."]}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{color:c.text.primary,children:"When you use Gemini Code Assist for individuals with Gemini CLI, Google collects your prompts, related code, generated output, code edits, related feature usage information, and your feedback to provide, improve, and develop Google products and services and machine learning technologies."}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{color:c.text.primary,children:"To help with quality and improve our products (such as generative machine-learning models), human reviewers may read, annotate, and process the data collected above. We take steps to protect your privacy as part of this process. This includes disconnecting the data from your Google Account before reviewers see or annotate it, and storing those disconnected copies for up to 18 months. Please don't submit confidential information or any data you wouldn't want a reviewer to see or Google to use to improve our products, services and machine-learning technologies."}),(0,yt.jsx)(Oo,{}),(0,yt.jsxs)(u,{flexDirection:"column",children:[(0,yt.jsx)(l,{color:c.text.primary,children:"Allow Google to use this data to develop and improve our products?"}),(0,yt.jsx)(Ue,{items:n,initialIndex:o.dataCollectionOptIn?0:1,onSelect:s=>{r(s),o.error||t()}})]}),(0,yt.jsx)(Oo,{}),(0,yt.jsxs)(l,{children:[(0,yt.jsx)(l,{color:c.text.link,children:"[1]"})," ","https://policies.google.com/privacy"]}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{color:c.text.secondary,children:"Press Enter to choose an option and exit."})]})};var bl=C(P(),1);var FM=({config:e,onExit:t})=>{switch(e.getContentGeneratorConfig()?.authType){case"gemini-api-key":return(0,bl.jsx)(SR,{onExit:t});case"vertex-ai":return(0,bl.jsx)(CR,{onExit:t});case"oauth-personal":default:return(0,bl.jsx)(RR,{config:e,onExit:t})}},IR=({onExit:e,config:t})=>(0,bl.jsx)(u,{borderStyle:"round",padding:1,flexDirection:"column",children:(0,bl.jsx)(FM,{config:t,onExit:e})});var wi=C(P(),1);function vR({failedModel:e,fallbackModel:t,message:o,isTerminalQuotaError:r,isModelNotFoundError:n,authType:s,tierName:i,onChoice:a}){let d;if(e===t)d=[{label:"Keep trying",value:"retry_once",key:"retry_once"},{label:"Stop",value:"retry_later",key:"retry_later"}];else if(n||r){let h=xd(i);d=[{label:`Switch to ${t}`,value:"retry_always",key:"retry_always"},...s==="oauth-personal"&&!h?[{label:"Upgrade for higher limits",value:"upgrade",key:"upgrade"}]:[],{label:"Stop",value:"retry_later",key:"retry_later"}]}else d=[{label:"Keep trying",value:"retry_once",key:"retry_once"},{label:`Switch to ${t}`,value:"retry_always",key:"retry_always"},{label:"Stop",value:"retry_later",key:"retry_later"}];let m=h=>{a(h)};return(0,wi.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,wi.jsx)(u,{marginBottom:1,children:(h=>{let p=h.split(/(\s+)/);return(0,wi.jsx)(l,{children:p.map((y,g)=>y.startsWith("/")?(0,wi.jsx)(l,{bold:!0,color:c.text.accent,children:y},g):(0,wi.jsx)(l,{children:y},g))})})(o)}),(0,wi.jsx)(u,{marginTop:1,marginBottom:1,children:(0,wi.jsx)(Ue,{items:d,onSelect:m})})]})}var ya=C(z(),1);var Ht=C(P(),1);function AR({validationLink:e,learnMoreUrl:t,onChoice:o}){let r=ze(),[n,s]=(0,ya.useState)("choosing"),[i,a]=(0,ya.useState)(""),d=[{label:"Verify your account",value:"verify",key:"verify"},{label:"Change authentication",value:"change_auth",key:"change_auth"}];de(f=>r["basic.cancel"](f)||r["basic.quit"](f)?(o("cancel"),!0):n==="waiting"&&r["basic.confirm"](f)?(s("complete"),!0):!1,{isActive:n!=="complete"}),(0,ya.useEffect)(()=>{if(n==="complete"){let f=setTimeout(()=>{o("verify")},500);return()=>clearTimeout(f)}},[n,o]);let m=(0,ya.useCallback)(async f=>{if(f==="verify")if(e){if(!$a()){a(`Please open this URL in a browser: ${e}`),s("waiting");return}try{await Va(e),s("waiting")}catch(h){a(h instanceof Error?h.message:"Failed to open browser"),s("error")}}else o("verify");else o(f)},[e,o]);return n==="error"?(0,Ht.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,Ht.jsx)(l,{color:c.status.error,children:i||"Failed to open verification link. Please try again or change authentication."}),(0,Ht.jsx)(u,{marginTop:1,children:(0,Ht.jsx)(Ue,{items:d,onSelect:f=>void m(f)})})]}):n==="waiting"?(0,Ht.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,Ht.jsxs)(u,{children:[(0,Ht.jsx)(Ro,{}),(0,Ht.jsxs)(l,{children:[" ","Waiting for verification... (Press Esc or Ctrl+C to cancel)"]})]}),i&&(0,Ht.jsx)(u,{marginTop:1,children:(0,Ht.jsx)(l,{children:i})}),(0,Ht.jsx)(u,{marginTop:1,children:(0,Ht.jsx)(l,{dimColor:!0,children:"Press Enter when verification is complete."})})]}):n==="complete"?(0,Ht.jsx)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:(0,Ht.jsx)(l,{color:c.status.success,children:"Verification complete"})}):(0,Ht.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,Ht.jsx)(u,{marginBottom:1,children:(0,Ht.jsx)(l,{children:"Further action is required to use this service."})}),(0,Ht.jsx)(u,{marginTop:1,marginBottom:1,children:(0,Ht.jsx)(Ue,{items:d,onSelect:f=>void m(f)})}),t&&(0,Ht.jsx)(u,{marginTop:1,children:(0,Ht.jsxs)(l,{dimColor:!0,children:["Learn more: ",(0,Ht.jsx)(l,{color:c.text.accent,children:t})]})})]})}var To=C(P(),1);function wR({failedModel:e,fallbackModel:t,resetTime:o,creditBalance:r,onChoice:n}){let s=[{label:"Use AI Credits - Continue this request (Overage)",value:"use_credits",key:"use_credits"},{label:"Manage - View balance and purchase more credits",value:"manage",key:"manage"}];return t&&s.push({label:`Switch to ${t}`,value:"use_fallback",key:"use_fallback"}),s.push({label:"Stop - Abort request",value:"stop",key:"stop"}),(0,To.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,To.jsxs)(u,{marginBottom:1,flexDirection:"column",children:[(0,To.jsxs)(l,{color:c.status.warning,children:["Usage limit reached for ",e,"."]}),o&&(0,To.jsxs)(l,{children:["Access resets at ",o,"."]}),(0,To.jsxs)(l,{children:[(0,To.jsx)(l,{bold:!0,color:c.text.accent,children:"/stats"})," ","model for usage details"]}),(0,To.jsxs)(l,{children:[(0,To.jsx)(l,{bold:!0,color:c.text.accent,children:"/model"})," ","to switch models."]}),(0,To.jsxs)(l,{children:[(0,To.jsx)(l,{bold:!0,color:c.text.accent,children:"/auth"})," ","to switch to API key."]})]}),(0,To.jsx)(u,{marginBottom:1,children:(0,To.jsxs)(l,{children:["You have"," ",(0,To.jsx)(l,{bold:!0,color:c.status.success,children:r})," ","AI Credits available."]})}),(0,To.jsx)(u,{marginBottom:1,children:(0,To.jsx)(l,{children:"How would you like to proceed?"})}),(0,To.jsx)(u,{marginTop:1,marginBottom:1,children:(0,To.jsx)(Ue,{items:s,onSelect:n})})]})}var io=C(P(),1);function _R({failedModel:e,fallbackModel:t,resetTime:o,onGetCredits:r,onChoice:n}){let s=[{label:"Get AI Credits - Open browser to purchase credits",value:"get_credits",key:"get_credits"}];t&&s.push({label:`Switch to ${t}`,value:"use_fallback",key:"use_fallback"}),s.push({label:"Stop - Abort request",value:"stop",key:"stop"});let i=a=>{a==="get_credits"&&r?.(),n(a)};return(0,io.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,io.jsxs)(u,{marginBottom:1,flexDirection:"column",children:[(0,io.jsxs)(l,{color:c.status.warning,children:["Usage limit reached for ",e,"."]}),o&&(0,io.jsxs)(l,{children:["Access resets at ",o,"."]}),(0,io.jsxs)(l,{children:[(0,io.jsx)(l,{bold:!0,color:c.text.accent,children:"/stats"})," ","model for usage details"]}),(0,io.jsxs)(l,{children:[(0,io.jsx)(l,{bold:!0,color:c.text.accent,children:"/model"})," ","to switch models."]}),(0,io.jsxs)(l,{children:[(0,io.jsx)(l,{bold:!0,color:c.text.accent,children:"/auth"})," ","to switch to API key."]})]}),(0,io.jsx)(u,{marginBottom:1,children:(0,io.jsx)(l,{children:"To continue using this model now, purchase more AI Credits."})}),(0,io.jsx)(u,{marginBottom:1,children:(0,io.jsx)(l,{dimColor:!0,children:"Newly purchased AI credits may take a few minutes to update."})}),(0,io.jsx)(u,{marginBottom:1,children:(0,io.jsx)(l,{children:"How would you like to proceed?"})}),(0,io.jsx)(u,{marginTop:1,marginBottom:1,children:(0,io.jsx)(Ue,{items:s,onSelect:i})})]})}var zt=C(z(),1);var He={get type(){return ot.getActiveTheme().colors.type},get Foreground(){return ot.getActiveTheme().colors.Foreground},get Background(){return ot.getColors().Background},get LightBlue(){return ot.getActiveTheme().colors.LightBlue},get AccentBlue(){return ot.getActiveTheme().colors.AccentBlue},get AccentPurple(){return ot.getActiveTheme().colors.AccentPurple},get AccentCyan(){return ot.getActiveTheme().colors.AccentCyan},get AccentGreen(){return ot.getActiveTheme().colors.AccentGreen},get AccentYellow(){return ot.getActiveTheme().colors.AccentYellow},get AccentRed(){return ot.getActiveTheme().colors.AccentRed},get DiffAdded(){return ot.getActiveTheme().colors.DiffAdded},get DiffRemoved(){return ot.getActiveTheme().colors.DiffRemoved},get Comment(){return ot.getActiveTheme().colors.Comment},get Gray(){return ot.getActiveTheme().colors.Gray},get DarkGray(){return ot.getColors().DarkGray},get InputBackground(){return ot.getColors().InputBackground},get MessageBackground(){return ot.getColors().MessageBackground},get GradientColors(){return ot.getActiveTheme().colors.GradientColors}};import FR from"node:path";var Gt=C(P(),1);var Cs=({name:e,shortcut:t})=>(0,Gt.jsxs)(Gt.Fragment,{children:[e,": ",(0,Gt.jsx)(l,{bold:!0,children:t})]}),DR=()=>(0,Gt.jsxs)(u,{flexDirection:"column",children:[(0,Gt.jsxs)(l,{color:He.Gray,children:[(0,Gt.jsx)(Cs,{name:"Navigate",shortcut:"\u2191/\u2193"})," ",(0,Gt.jsx)(Cs,{name:"Resume",shortcut:"Enter"})," ",(0,Gt.jsx)(Cs,{name:"Search",shortcut:"/"})," ",(0,Gt.jsx)(Cs,{name:"Delete",shortcut:"x"})," ",(0,Gt.jsx)(Cs,{name:"Quit",shortcut:"q"})]}),(0,Gt.jsxs)(l,{color:He.Gray,children:[(0,Gt.jsx)(Cs,{name:"Sort",shortcut:"s"})," ",(0,Gt.jsx)(Cs,{name:"Reverse",shortcut:"r"})," ",(0,Gt.jsx)(Cs,{name:"First/Last",shortcut:"g/G"})]})]}),MR=({state:e})=>(0,Gt.jsxs)(u,{marginTop:1,children:[(0,Gt.jsx)(l,{color:He.Gray,children:"Search: "}),(0,Gt.jsx)(l,{color:He.AccentPurple,children:e.searchQuery}),(0,Gt.jsx)(l,{color:He.Gray,children:" (Esc to cancel)"})]}),PR=({state:e})=>(0,Gt.jsx)(u,{marginTop:1,children:(0,Gt.jsxs)(l,{color:He.Gray,dimColor:!0,children:["No sessions found matching '",e.searchQuery,"'."]})});var dm=C(P(),1);var OR=({state:e})=>(0,dm.jsxs)(u,{flexDirection:"row",justifyContent:"space-between",children:[(0,dm.jsxs)(l,{color:He.AccentPurple,children:["Chat Sessions (",e.totalSessions," total",e.searchQuery?", filtered":"",")"]}),(0,dm.jsxs)(l,{color:He.Gray,children:["sorted by ",e.sortOrder," ",e.sortReverse?"asc":"desc"]})]});var Zf=C(P(),1);var LR=()=>(0,Zf.jsx)(u,{flexDirection:"column",paddingX:1,children:(0,Zf.jsx)(l,{color:He.Gray,children:"Loading sessions\u2026"})});var Pc=C(P(),1);var NR=({state:e})=>(0,Pc.jsxs)(u,{flexDirection:"column",paddingX:1,children:[(0,Pc.jsxs)(l,{color:He.AccentRed,children:["Error: ",e.error]}),(0,Pc.jsx)(l,{color:He.Gray,children:"Press q to exit"})]});var Oc=C(P(),1);var BR=()=>(0,Oc.jsxs)(u,{flexDirection:"column",paddingX:1,children:[(0,Oc.jsx)(l,{color:He.Gray,children:"No auto-saved conversations found."}),(0,Oc.jsx)(l,{color:He.Gray,children:"Press q to exit"})]});var kR=(e,t,o)=>{let r=[...e].sort((n,s)=>{switch(t){case"date":return new Date(s.lastUpdated).getTime()-new Date(n.lastUpdated).getTime();case"messages":return s.messageCount-n.messageCount;case"name":return n.displayName.localeCompare(s.displayName);default:return 0}});return o?r.reverse():r},UM=(e,t)=>{if(!t.trim())return[];let o=t.toLowerCase(),r=[];for(let n of e){let s=cS(n.content),i=s.toLowerCase(),a=0;for(;;){let d=i.indexOf(o,a);if(d===-1)break;let m=Math.max(0,d-10),f=Math.min(s.length,d+t.length+10),h=s.slice(m,f),p=d-m,y=p+t.length,g=h.slice(0,p),x=h.slice(p,y),S=h.slice(y);m>0&&(g="\u2026"+g),f<s.length&&(S=S+"\u2026"),r.push({before:g,match:x,after:S,role:n.role}),a=d+1}}return r},HR=(e,t)=>{if(!t.trim())return e.map(r=>({...r,matchSnippets:void 0,matchCount:void 0}));let o=t.toLowerCase();return e.filter(r=>{let n=r.displayName.toLowerCase().includes(o)||r.id.toLowerCase().includes(o)||r.firstUserMessage.toLowerCase().includes(o),s=r.fullContent?.toLowerCase().includes(o);return n||s?(r.messages&&(r.matchSnippets=UM(r.messages,t),r.matchCount=r.matchSnippets.length),!0):!1})};var we=C(P(),1);var bs=20,GM=30,WM=({state:e})=>(0,we.jsxs)(u,{flexDirection:"row",marginTop:1,children:[(0,we.jsx)(l,{children:e.scrollOffset>0?(0,we.jsx)(l,{children:"\u25B2 "}):" "}),(0,we.jsx)(u,{width:5,flexShrink:0,children:(0,we.jsx)(l,{color:He.Gray,bold:!0,children:"Index"})}),(0,we.jsx)(l,{color:He.Gray,children:" \u2502 "}),(0,we.jsx)(u,{width:4,flexShrink:0,children:(0,we.jsx)(l,{color:He.Gray,bold:!0,children:"Msgs"})}),(0,we.jsx)(l,{color:He.Gray,children:" \u2502 "}),(0,we.jsx)(u,{width:4,flexShrink:0,children:(0,we.jsx)(l,{color:He.Gray,bold:!0,children:"Age"})}),(0,we.jsx)(l,{color:He.Gray,children:" \u2502 "}),(0,we.jsx)(u,{flexShrink:0,children:(0,we.jsx)(l,{color:He.Gray,bold:!0,children:e.searchQuery?"Match":"Name"})})]}),VM=({session:e,textColor:t})=>{if(!e.matchSnippets||e.matchSnippets.length===0)return null;let o=e.matchSnippets[0],r=o.role==="user"?"You: ":"Gemini:",n=t(o.role==="user"?He.AccentGreen:He.AccentBlue);return(0,we.jsxs)(we.Fragment,{children:[(0,we.jsxs)(l,{color:n,bold:!0,children:[r," "]}),o.before,(0,we.jsx)(l,{color:t(He.AccentRed),bold:!0,children:o.match}),o.after]})},$M=({session:e,state:t,terminalWidth:o,formatRelativeTime:r})=>{let n=t.startIndex+t.visibleSessions.indexOf(e),s=n===t.activeIndex,i=e.isCurrentSession,a=(g=He.Foreground)=>i?He.Gray:s?c.ui.focus:g,d=s?"\u276F ":" ",m="",f=null;e.isCurrentSession&&(m=" (current)"),t.searchQuery&&e.matchSnippets&&e.matchSnippets.length>0&&(f=(0,we.jsx)(VM,{session:e,textColor:a}),e.matchCount&&e.matchCount>1&&(m+=` (+${e.matchCount-1} more)`));let h=m?m.length+1:0,p=Math.max(20,o-GM-h),y=f||(e.displayName.length===0?(0,we.jsx)(l,{color:a(He.Gray),dimColor:!0,children:"(No messages)"}):e.displayName.length>p?e.displayName.slice(0,p-1)+"\u2026":e.displayName);return(0,we.jsxs)(u,{flexDirection:"row",backgroundColor:s?c.background.focus:void 0,children:[(0,we.jsx)(l,{color:a(),dimColor:i,children:d}),(0,we.jsx)(u,{width:5,children:(0,we.jsxs)(l,{color:a(),dimColor:i,children:["#",n+1]})}),(0,we.jsxs)(l,{color:a(He.Gray),dimColor:i,children:[" ","\u2502"," "]}),(0,we.jsx)(u,{width:4,children:(0,we.jsx)(l,{color:a(),dimColor:i,children:e.messageCount})}),(0,we.jsxs)(l,{color:a(He.Gray),dimColor:i,children:[" ","\u2502"," "]}),(0,we.jsx)(u,{width:4,children:(0,we.jsx)(l,{color:a(),dimColor:i,children:r(e.lastUpdated,"short")})}),(0,we.jsxs)(l,{color:a(He.Gray),dimColor:i,children:[" ","\u2502"," "]}),(0,we.jsx)(u,{flexGrow:1,children:(0,we.jsxs)(l,{color:a(He.Comment),dimColor:i,children:[y,m&&(0,we.jsx)(l,{color:a(He.Gray),dimColor:!0,bold:!1,children:m})]})})]})},qM=({state:e,formatRelativeTime:t})=>(0,we.jsxs)(u,{flexDirection:"column",children:[(0,we.jsxs)(u,{flexDirection:"column",children:[!e.isSearchMode&&(0,we.jsx)(DR,{}),(0,we.jsx)(WM,{state:e})]}),e.visibleSessions.map(o=>(0,we.jsx)($M,{session:o,state:e,terminalWidth:e.terminalWidth,formatRelativeTime:t},o.id)),(0,we.jsx)(l,{color:He.Gray,children:e.endIndex<e.totalSessions?(0,we.jsx)(we.Fragment,{children:"\u25BC"}):(0,we.jsx)(l,{dimColor:!0,children:"\u25BC"})})]}),KM=(e=[],t=!0,o=null)=>{let{columns:r}=ti(),[n,s]=(0,zt.useState)(e),[i,a]=(0,zt.useState)(t),[d,m]=(0,zt.useState)(o),[f,h]=(0,zt.useState)(0),[p,y]=(0,zt.useState)(0),[g,x]=(0,zt.useState)("date"),[S,I]=(0,zt.useState)(!1),[A,E]=(0,zt.useState)(""),[T,v]=(0,zt.useState)(!1),[R,b]=(0,zt.useState)(!1),_=(0,zt.useRef)(!1),w=(0,zt.useMemo)(()=>{let L=HR(n,A);return kR(L,g,S)},[n,A,g,S]);(0,zt.useEffect)(()=>{A||(b(!1),_.current=!1)},[A]);let M=w.length,D=p,N=Math.min(p+bs,M),O=w.slice(D,N);return{sessions:n,setSessions:s,loading:i,setLoading:a,error:d,setError:m,activeIndex:f,setActiveIndex:h,scrollOffset:p,setScrollOffset:y,searchQuery:A,setSearchQuery:E,isSearchMode:T,setIsSearchMode:v,hasLoadedFullContent:R,setHasLoadedFullContent:b,sortOrder:g,setSortOrder:x,sortReverse:S,setSortReverse:I,terminalWidth:r,filteredAndSortedSessions:w,totalSessions:M,startIndex:D,endIndex:N,visibleSessions:O}},jM=(e,t)=>{let{setSessions:o,setLoading:r,setError:n,isSearchMode:s,hasLoadedFullContent:i,setHasLoadedFullContent:a}=t;(0,zt.useEffect)(()=>{(async()=>{try{let m=FR.join(e.storage.getProjectTempDir(),"chats"),f=await af(m,e.getSessionId());o(f),r(!1)}catch(m){n(m instanceof Error?m.message:"Failed to load sessions"),r(!1)}})()},[e,o,r,n]),(0,zt.useEffect)(()=>{(async()=>{if(s&&!i)try{let m=FR.join(e.storage.getProjectTempDir(),"chats"),f=await af(m,e.getSessionId(),{includeFullContent:!0});o(f),a(!0)}catch(m){n(m instanceof Error?m.message:"Failed to load full session content")}})()},[s,i,e,o,a,n])},zM=e=>{let{totalSessions:t,activeIndex:o,scrollOffset:r,setActiveIndex:n,setScrollOffset:s}=e;return(0,zt.useCallback)(i=>{let a=Math.max(0,Math.min(t-1,o+i));n(a),a<r?s(a):a>=r+bs&&s(a-bs+1)},[t,o,r,n,s])},YM=e=>{let{sortOrder:t,setSortOrder:o}=e;return(0,zt.useCallback)(()=>{let r=["date","messages","name"],s=(r.indexOf(t)+1)%r.length;o(r[s])},[t,o])},XM=(e,t,o,r,n,s)=>{de(i=>{if(e.isSearchMode){if(i.name==="escape")return e.setIsSearchMode(!1),e.setSearchQuery(""),e.setActiveIndex(0),e.setScrollOffset(0),!0;if(i.name==="backspace")return e.setSearchQuery(a=>a.slice(0,-1)),e.setActiveIndex(0),e.setScrollOffset(0),!0;if(i.name==="enter"){let a=e.filteredAndSortedSessions[e.activeIndex];return a&&!a.isCurrentSession&&r(a),!0}else if(i.sequence&&i.sequence.length===1&&!i.alt&&!i.ctrl&&!i.cmd)return e.setSearchQuery(a=>a+i.sequence),e.setActiveIndex(0),e.setScrollOffset(0),!0}else{if(i.sequence==="g")return e.setActiveIndex(0),e.setScrollOffset(0),!0;if(i.sequence==="G")return e.setActiveIndex(e.totalSessions-1),e.setScrollOffset(Math.max(0,e.totalSessions-bs)),!0;if(i.sequence==="s")return o(),!0;if(i.sequence==="r")return e.setSortReverse(!e.sortReverse),!0;if(i.sequence==="/")return e.setIsSearchMode(!0),!0;if(i.sequence==="q"||i.sequence==="Q"||i.name==="escape")return s(),!0;if(i.sequence==="x"||i.sequence==="X"){let a=e.filteredAndSortedSessions[e.activeIndex];return a&&!a.isCurrentSession&&n(a).then(()=>{e.setSessions(e.sessions.filter(d=>d.id!==a.id)),e.activeIndex>=e.filteredAndSortedSessions.length-1&&e.setActiveIndex(Math.max(0,e.filteredAndSortedSessions.length-2))}).catch(d=>{e.setError(`Failed to delete session: ${d instanceof Error?d.message:"Unknown error"}`)}),!0}else{if(i.sequence==="u")return t(-Math.round(bs/2)),!0;if(i.sequence==="d")return t(Math.round(bs/2)),!0}}if(i.name==="enter"&&e.filteredAndSortedSessions[e.activeIndex]){let a=e.filteredAndSortedSessions[e.activeIndex];return a.isCurrentSession||r(a),!0}else{if(i.name==="up")return t(-1),!0;if(i.name==="down")return t(1),!0;if(i.name==="pageup")return t(-bs),!0;if(i.name==="pagedown")return t(bs),!0}return!1},{isActive:!0})};function QM({state:e}){return e.loading?(0,we.jsx)(LR,{}):e.error?(0,we.jsx)(NR,{state:e}):e.sessions.length===0?(0,we.jsx)(BR,{}):(0,we.jsxs)(u,{flexDirection:"column",paddingX:1,children:[(0,we.jsx)(OR,{state:e}),e.isSearchMode&&(0,we.jsx)(MR,{state:e}),e.totalSessions===0?(0,we.jsx)(PR,{state:e}):(0,we.jsx)(qM,{state:e,formatRelativeTime:uS})]})}function UR({config:e,onResumeSession:t,onDeleteSession:o,onExit:r}){let n=KM();jM(e,n);let s=zM(n),i=YM(n);return XM(n,s,i,t,o,r),(0,we.jsx)(QM,{state:n})}var hr=C(z(),1);var WR=C(z(),1);var Lc=C(P(),1);var GR=({value:e,width:t,warningThreshold:o=80})=>{let r=Math.min(Math.max(e,0),100),n=Math.ceil(r/100*t),s=t-n,i=c.status.success;return r>=100?i=c.status.error:r>=o&&(i=c.status.warning),(0,Lc.jsxs)(u,{flexDirection:"row",children:[(0,Lc.jsx)(l,{color:i,children:"\u25AC".repeat(n)}),(0,Lc.jsx)(l,{color:c.border.default,children:"\u25AC".repeat(s)})]})};var No=C(P(),1);var JM=({row:e,availableWidth:t})=>{let{terminalWidth:o}=Se(),r=12,n=4,s=26,i=e.usedPercentage,a=e.name,d=`${i.toFixed(0)}%`.padEnd(n),m=e.resetTime?fc(e.resetTime,"column").slice(0,s).padEnd(s):"".padEnd(s),f=r,h=n+1,p=s+1,y=f+h+p,g=t??o,x=t!=null?0:4,I=Math.max(0,g-x-y-3),A=c.text.primary;return i>=100?A=c.status.error:i>=80&&(A=c.status.warning),(0,No.jsxs)(u,{flexDirection:"row",width:"100%",children:[(0,No.jsx)(u,{width:r,children:(0,No.jsx)(l,{color:c.text.primary,wrap:"truncate-end",children:a})}),(0,No.jsx)(u,{flexGrow:1,children:(0,No.jsx)(GR,{value:i,width:I})}),(0,No.jsx)(u,{width:4,marginLeft:1,children:(0,No.jsx)(l,{color:A,children:d})}),(0,No.jsx)(u,{width:s,marginLeft:1,children:(0,No.jsx)(l,{color:c.text.secondary,children:m.trim()?`Resets: ${m}`:""})})]})},VR=({buckets:e,availableWidth:t,modelsToShow:o=["all"],title:r="Model usage"})=>{let n=ht(),s=(0,WR.useMemo)(()=>{if(!e)return[];let i=e.filter(d=>d.modelId&&d.remainingFraction!=null);if(o.includes("current")){let d=n.getActiveModel?.()??n.getModel?.();i=i.filter(m=>m.modelId===d)}else o.includes("all")||(i=i.filter(d=>d.modelId&&o.includes(d.modelId)));let a=new Map;return i.forEach(d=>{let m=d.modelId,f=d.remainingFraction;if(!m||f==null)return;let h=n?.modelConfigService?.getModelDefinition(m)?.tier,p=h??m,y=a.get(p);if(!y||f<y.remainingFraction){let x=h?{pro:"Pro",flash:"Flash","flash-lite":"Flash Lite"}[h]??h:Mt(m,n);a.set(p,{modelId:m,remainingFraction:f,resetTime:d.resetTime,name:x})}}),Array.from(a.entries()).map(([d,m])=>{let f=1-m.remainingFraction,h=f*100;return{modelId:d,name:m.name,usedFraction:f,usedPercentage:h,resetTime:m.resetTime}})},[e,n,o]);return s.length===0?null:(0,No.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,No.jsx)(u,{borderStyle:"single",borderTop:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderColor:c.border.default}),(0,No.jsxs)(u,{flexDirection:"column",children:[(0,No.jsx)(u,{marginBottom:1,children:(0,No.jsx)(l,{bold:!0,color:c.text.primary,children:r})}),s.map(i=>(0,No.jsx)(JM,{row:i,availableWidth:t},i.modelId))]})]})};var El=C(P(),1);function Nc({items:e,initialIndex:t=0,onSelect:o,onHighlight:r,isFocused:n=!0,showNumbers:s=!1,showScrollArrows:i=!1,maxItemsToShow:a=10}){return(0,El.jsx)(ad,{items:e,initialIndex:t,onSelect:o,onHighlight:r,isFocused:n,showNumbers:s,showScrollArrows:i,maxItemsToShow:a,renderItem:(d,{titleColor:m})=>(0,El.jsxs)(u,{flexDirection:"column",children:[(0,El.jsx)(l,{color:m,children:d.title}),d.description&&(0,El.jsx)(l,{color:c.text.secondary,children:d.description})]},d.key)})}var Yo=C(P(),1);function $R({onClose:e}){let t=(0,hr.useContext)(ld),o=We(),{terminalWidth:r}=Se(),[n,s]=(0,hr.useState)(()=>!(t?.getProModelNoAccessSync()??!1)),[i,a]=(0,hr.useState)(()=>t?.getProModelNoAccessSync()?"manual":"main"),[d,m]=(0,hr.useState)(!1);(0,hr.useEffect)(()=>{async function R(){if(!t)return;let b=await t.getProModelNoAccess();s(!b),b&&a("manual")}R()},[t]);let f=t?.getModel()||lc,h=t?.getHasAccessToPreviewModel(),p=t?.getGemini31LaunchedSync?.()??!1,y=t?.getGemini31FlashLiteLaunchedSync?.()??!1,g=o.merged.security.auth.selectedType,x=p&&g==="gemini-api-key",S=(0,hr.useMemo)(()=>{if(t?.getExperimentalDynamicModelConfiguration?.()===!0&&t.getModelConfigService){let b=t.getModelConfigService().getModelDefinition(f);return b&&b.tier!=="auto"&&b.isVisible===!0?f:""}return[sc,Xi,ac,Gp,Wp,Vp,ic,nc].includes(f)?f:""},[f,t]);de(R=>R.name==="escape"?(i==="manual"&&n?a("main"):e(),!0):R.name==="tab"?(m(b=>!b),!0):!1,{isActive:!0});let I=(0,hr.useMemo)(()=>{if(t?.getExperimentalDynamicModelConfiguration?.()===!0&&t.getModelConfigService){let _=t.getModelConfigService().getAvailableModelOptions({useGemini3_1:p,useGemini3_1FlashLite:y,useCustomTools:x,hasAccessToPreview:h,hasAccessToProModel:n}).filter(w=>w.tier==="auto").map(w=>({value:w.modelId,title:w.name,description:w.description,key:w.modelId}));return _.push({value:"Manual",title:S?`Manual (${Mt(S,t??void 0)})`:"Manual",description:"Manually select a model",key:"Manual"}),_}let R=[{value:lc,title:Mt(lc),description:"Let Gemini CLI decide the best model for the task: gemini-2.5-pro, gemini-2.5-flash",key:lc},{value:"Manual",title:S?`Manual (${Mt(S)})`:"Manual",description:"Manually select a model",key:"Manual"}];return h&&R.unshift({value:Lu,title:Mt(Lu),description:p?"Let Gemini CLI decide the best model for the task: gemini-3.1-pro, gemini-3-flash":"Let Gemini CLI decide the best model for the task: gemini-3-pro, gemini-3-flash",key:Lu}),R},[t,h,S,p,y,x,n]),A=(0,hr.useMemo)(()=>{if(t?.getExperimentalDynamicModelConfiguration?.()===!0&&t.getModelConfigService)return t.getModelConfigService().getAvailableModelOptions({useGemini3_1:p,useGemini3_1FlashLite:y,useCustomTools:x,hasAccessToPreview:h,hasAccessToProModel:n}).filter(w=>w.tier!=="auto").map(w=>({value:w.modelId,title:w.name,key:w.modelId}));let R=t?.getExperimentalGemma()??!1,b=[{value:sc,title:Mt(sc),key:sc},{value:Xi,title:Mt(Xi),key:Xi},{value:ac,title:Mt(ac),key:ac}];if(R&&b.push({value:Pu,title:Mt(Pu),key:Pu},{value:Ou,title:Mt(Ou),key:Ou}),h){let _=p?Wp:Gp,M=[{value:x?Vp:_,title:Mt(_),key:_},{value:nc,title:Mt(nc),key:nc}];y&&M.push({value:ic,title:Mt(ic),key:ic}),b.unshift(...M)}return n?b:b.filter(_=>!Nu(_.value))},[h,p,y,x,n,t]),E=i==="main"?I:A,T=(0,hr.useMemo)(()=>{let R=E.findIndex(b=>b.value===f);if(R!==-1)return R;if(i==="main"){let b=E.findIndex(_=>_.value==="Manual");return b!==-1?b:0}return 0},[f,E,i]),v=(0,hr.useCallback)(R=>{if(R==="Manual"){a("manual");return}if(t){t.setModel(R,!d);let b=new AT(R);zT(t,b)}e()},[t,e,d]);return(0,Yo.jsxs)(u,{borderStyle:"round",borderColor:c.border.default,flexDirection:"column",padding:1,width:"100%",children:[(0,Yo.jsx)(l,{bold:!0,children:"Select Model"}),(0,Yo.jsx)(u,{marginTop:1,children:(0,Yo.jsx)(Nc,{items:E,onSelect:v,initialIndex:T,showNumbers:!0})}),(0,Yo.jsx)(u,{marginTop:1,flexDirection:"column",children:(0,Yo.jsxs)(u,{children:[(0,Yo.jsxs)(l,{bold:!0,color:c.text.primary,children:["Remember model for future sessions:"," "]}),(0,Yo.jsx)(l,{color:c.status.success,children:d?"true":"false"}),(0,Yo.jsx)(l,{color:c.text.secondary,children:" (Press Tab to toggle)"})]})}),(0,Yo.jsx)(u,{flexDirection:"column",children:(0,Yo.jsx)(l,{color:c.text.secondary,children:"> To use a specific Gemini model on startup, use the --model flag."})}),(0,Yo.jsx)(VR,{buckets:t?.getLastRetrievedQuota()?.buckets,availableWidth:r-2}),(0,Yo.jsx)(u,{marginTop:1,flexDirection:"column",children:(0,Yo.jsx)(l,{color:c.text.secondary,children:"(Press Esc to close)"})})]})}var yr=C(z(),1);var Zt=C(P(),1);var ZM=[{value:"ggml-tiny.en.bin",label:"Tiny (EN)",description:"Fastest, lower accuracy (~75MB)"},{value:"ggml-base.en.bin",label:"Base (EN)",description:"Balanced speed and accuracy (~142MB)"},{value:"ggml-large-v3-turbo-q5_0.bin",label:"Large v3 Turbo (Q5_0)",description:"High accuracy, quantized (~547MB)"},{value:"ggml-large-v3-turbo-q8_0.bin",label:"Large v3 Turbo (Q8_0)",description:"Maximum accuracy, high memory (~834MB)"}];function qR({onClose:e}){let{settings:t,setSetting:o}=id(),[r,n]=(0,yr.useState)("backend"),[s,i]=(0,yr.useState)(null),[a,d]=(0,yr.useState)(null),m=(0,yr.useMemo)(()=>Hx("whisper-stream"),[]),f=(0,yr.useMemo)(()=>new kx,[]),h=t.merged.experimental.voice?.backend??"gemini-live",p=t.merged.experimental.voice?.whisperModel??"ggml-base.en.bin",[y,g]=(0,yr.useState)(h),x=(0,yr.useCallback)(v=>v.name==="escape"?(r==="whisper-models"?n("backend"):e(),!0):!1,[r,e]);de(x,{isActive:!0});let S=(0,yr.useCallback)(v=>{v==="whisper"?n("whisper-models"):(o("User","experimental.voice.backend","gemini-live"),e())},[o,e]),I=(0,yr.useCallback)(v=>{g(v)},[]),A=(0,yr.useCallback)(async v=>{if(f.isModelInstalled(v))o("User","experimental.voice.backend","whisper"),o("User","experimental.voice.whisperModel",v),e();else{d(null);let R=b=>i(b);f.on("progress",R);try{await f.downloadModel(v),o("User","experimental.voice.backend","whisper"),o("User","experimental.voice.whisperModel",v),e()}catch(b){d(`Failed to download: ${b instanceof Error?b.message:String(b)}`)}finally{f.off("progress",R),i(null)}}},[f,o,e]),E=(0,yr.useMemo)(()=>[{value:"gemini-live",title:"Gemini Live API (Cloud)",description:"Real-time cloud transcription via Gemini Live API.",key:"gemini-live"},{value:"whisper",title:"Whisper (Local)",description:m?"Local transcription using whisper.cpp.":"Local transcription (Requires: brew install whisper-cpp)",key:"whisper"}],[m]),T=(0,yr.useMemo)(()=>ZM.map(v=>({value:v.value,title:`${v.label}${f.isModelInstalled(v.value)?" (Installed)":" (Download)"}`,description:v.description,key:v.value})),[f]);return(0,Zt.jsxs)(u,{borderStyle:"round",borderColor:c.border.default,flexDirection:"column",padding:1,width:"100%",children:[(0,Zt.jsx)(l,{bold:!0,children:r==="backend"?"Select Voice Transcription Backend":"Select Whisper Model"}),a&&(0,Zt.jsx)(u,{marginTop:1,children:(0,Zt.jsx)(l,{color:c.status.error,children:a})}),s?(0,Zt.jsx)(u,{marginTop:1,flexDirection:"column",children:(0,Zt.jsxs)(u,{children:[(0,Zt.jsxs)(l,{children:["Downloading ",s.modelName,"... "]}),(0,Zt.jsx)(Ro,{}),(0,Zt.jsxs)(l,{children:[" ",Math.round(s.percentage*100),"%"]})]})}):(0,Zt.jsx)(u,{marginTop:1,flexDirection:"column",children:r==="backend"?(0,Zt.jsxs)(Zt.Fragment,{children:[(0,Zt.jsx)(Nc,{items:E,onSelect:S,onHighlight:I,initialIndex:h==="whisper"?1:0,showNumbers:!0}),y==="gemini-live"&&(0,Zt.jsx)(u,{marginTop:1,children:(0,Zt.jsx)(hl,{text:"When using the Gemini Live backend, voice recordings are sent to Google Cloud for transcription. Enterprise users should verify this aligns with their data privacy and compliance requirements."})})]}):(0,Zt.jsx)(Nc,{items:T,onSelect:A,initialIndex:T.findIndex(v=>v.value===p),showNumbers:!0})}),(0,Zt.jsx)(u,{marginTop:1,flexDirection:"column",children:(0,Zt.jsx)(l,{color:c.text.secondary,children:r==="whisper-models"?"(Press Esc to go back)":"(Press Esc to close)"})})]})}import eP from"node:process";var mm=C(P(),1);var KR=()=>{let e=ze(),{handleRestart:t}=Ir();return de(r=>e["app.restart"](r)?(t(),!0):!1,{isActive:!0}),(0,mm.jsx)(u,{borderStyle:"round",borderColor:c.status.warning,paddingX:1,children:(0,mm.jsxs)(l,{color:c.status.warning,children:["Admin settings have changed. Please restart the session to apply new settings."," Press 'r' to restart, or 'Ctrl+C' twice to exit."]})})};var pm=C(P(),1);var jR=({reason:e})=>{de(o=>o.name==="r"||o.name==="R"?(sr(),!0):!1,{isActive:!0});let t="Workspace trust has changed.";return e==="NONE"?ue.warn('IdeTrustChangeDialog rendered with unexpected reason "NONE"'):e==="CONNECTION_CHANGE"?t="Workspace trust has changed due to a change in the IDE connection.":e==="TRUST_CHANGE"&&(t="Workspace trust has changed due to a change in the IDE trust."),(0,pm.jsx)(u,{borderStyle:"round",borderColor:c.status.warning,paddingX:1,children:(0,pm.jsxs)(l,{color:c.status.warning,children:[t," Press 'r' to restart Gemini to apply the changes."]})})};var Tr=C(z(),1);var tg=C(P(),1);var Bc=[{key:"enabled",label:"Enabled",description:"Enable or disable this agent",type:"boolean",path:["enabled"],defaultValue:!0},{key:"model",label:"Model",description:"Model to use (e.g., 'gemini-2.0-flash' or 'inherit')",type:"string",path:["modelConfig","model"],defaultValue:"inherit"},{key:"temperature",label:"Temperature",description:"Sampling temperature (0.0 to 2.0)",type:"number",path:["modelConfig","generateContentConfig","temperature"],defaultValue:void 0},{key:"topP",label:"Top P",description:"Nucleus sampling parameter (0.0 to 1.0)",type:"number",path:["modelConfig","generateContentConfig","topP"],defaultValue:void 0},{key:"topK",label:"Top K",description:"Top-K sampling parameter",type:"number",path:["modelConfig","generateContentConfig","topK"],defaultValue:void 0},{key:"maxOutputTokens",label:"Max Output Tokens",description:"Maximum number of tokens to generate",type:"number",path:["modelConfig","generateContentConfig","maxOutputTokens"],defaultValue:void 0},{key:"maxTimeMinutes",label:"Max Time (minutes)",description:"Maximum execution time in minutes",type:"number",path:["runConfig","maxTimeMinutes"],defaultValue:void 0},{key:"maxTurns",label:"Max Turns",description:"Maximum number of conversational turns",type:"number",path:["runConfig","maxTurns"],defaultValue:void 0}];function eg(e,t,o){if(!od(e))return e;let r={...e},n=r;for(let i=0;i<t.length-1;i++){let a=t[i];n[a]===void 0||n[a]===null?n[a]={}:od(n[a])&&(n[a]={...n[a]});let d=n[a];if(od(d))n=d;else return r}let s=t[t.length-1];return o===void 0?delete n[s]:n[s]=o,r}function zR(e,t){return t.kind!=="local"?e.defaultValue:e.key==="enabled"?!t.experimental:e.key==="model"?t.modelConfig?.model??"inherit":e.key==="temperature"?t.modelConfig?.generateContentConfig?.temperature:e.key==="topP"?t.modelConfig?.generateContentConfig?.topP:e.key==="topK"?t.modelConfig?.generateContentConfig?.topK:e.key==="maxOutputTokens"?t.modelConfig?.generateContentConfig?.maxOutputTokens:e.key==="maxTimeMinutes"?t.runConfig?.maxTimeMinutes:e.key==="maxTurns"?t.runConfig?.maxTurns:e.defaultValue}function YR({agentName:e,displayName:t,definition:o,settings:r,onClose:n,onSave:s,availableTerminalHeight:i}){let[a,d]=(0,Tr.useState)("User"),[m,f]=(0,Tr.useState)(()=>{let R=r.forScope(a).settings.agents?.overrides?.[e];return R?structuredClone(R):{}}),[h,p]=(0,Tr.useState)(new Set);(0,Tr.useEffect)(()=>{let R=r.forScope(a).settings.agents?.overrides?.[e];f(R?structuredClone(R):{}),p(new Set)},[a,r,e]);let y=(0,Tr.useCallback)((v,R,b)=>{if(["__proto__","constructor","prototype"].includes(e))return;let _=["agents","overrides",e,...R].join(".");r.setValue(a,_,b),s?.()},[r,a,e,s]),g=(0,Tr.useMemo)(()=>{let v=0;for(let R of Bc){let b=kr(R.label),_=kr(R.description);v=Math.max(v,b,_)}return v},[]),x=(0,Tr.useMemo)(()=>Bc.map(v=>{let R=lf(m,v.path),b=zR(v,o),_=R!==void 0?R:b,w;v.type==="boolean"?w=_?"true":"false":_!=null?w=String(_):w="(default)",(h.has(v.key)||R!==void 0)&&R!==void 0&&(w+="*");let D=R!==void 0?R:_;return{key:v.key,label:v.label,description:v.description,type:v.type,displayValue:w,isGreyedOut:R===void 0,scopeMessage:void 0,rawValue:D}}),[m,o,h]),S=8,I=(0,Tr.useCallback)(v=>{d(v)},[]),A=(0,Tr.useCallback)((v,R)=>{let b=Bc.find(O=>O.key===v);if(!b||b.type!=="boolean")return;let _=lf(m,b.path),w=zR(b,o),D=!(_!==void 0?_:w),N=eg(m,b.path,D);f(N),p(O=>new Set(O).add(v)),y(b.key,b.path,D)},[m,o,y]),E=(0,Tr.useCallback)((v,R,b)=>{let _=Bc.find(D=>D.key===v);if(!_)return;let w;if(_.type==="number")if(R.trim()==="")w=void 0;else{let D=Number(R.trim());if(Number.isNaN(D))return;w=D}else w=R.trim()===""?void 0:R;let M=eg(m,_.path,w);f(M),p(D=>new Set(D).add(v)),y(_.key,_.path,w)},[m,y]),T=(0,Tr.useCallback)((v,R)=>{let b=Bc.find(w=>w.key===v);if(!b)return;let _=eg(m,b.path,void 0);f(_),p(w=>{let M=new Set(w);return M.delete(v),M}),y(b.key,b.path,void 0)},[m,y]);return(0,tg.jsx)(am,{title:`Configure: ${t}`,searchEnabled:!1,items:x,showScopeSelector:!0,selectedScope:a,onScopeChange:I,maxItemsToShow:S,availableHeight:i,maxLabelWidth:g,onItemToggle:A,onEditCommit:E,onItemClear:T,onClose:n,footer:h.size>0?{content:(0,tg.jsx)(l,{color:c.text.secondary,children:"Changes saved automatically."}),height:1}:void 0})}var fm=C(z(),1);var _i=C(P(),1);var XR=({config:e,request:t,onClose:o})=>{let r=ze(),n=(0,fm.useRef)(!1),s=(0,fm.useCallback)(async a=>{if(!n.current){n.current=!0;try{a==="accept"&&(await new Cx().acceptIntegrity(t.scope,t.identifier,t.newHash),await e.loadWorkspacePolicies(t.policyDir)),o()}finally{n.current=!1}}},[e,t,o]);de(a=>r["basic.cancel"](a)?(o(),!0):!1,{isActive:!0});let i=[{label:"Accept and Load",value:"accept",key:"accept"},{label:"Ignore (Use Default Policies)",value:"ignore",key:"ignore"}];return(0,_i.jsx)(u,{flexDirection:"column",width:"100%",children:(0,_i.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.status.warning,padding:1,marginLeft:1,marginRight:1,children:[(0,_i.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,_i.jsxs)(l,{bold:!0,color:c.text.primary,children:["New or changed ",t.scope," policies detected"]}),(0,_i.jsxs)(l,{color:c.text.primary,children:["Location: ",t.identifier]}),(0,_i.jsx)(l,{color:c.text.primary,children:"Do you want to accept and load these policies?"})]}),(0,_i.jsx)(Ue,{items:i,onSelect:s,isFocused:!0})]})})};var kc=C(P(),1);var QR=({onDismiss:e,config:t,message:o})=>{de(n=>n.name==="escape"?(e(),!0):n.name==="r"||n.name==="R"?(setTimeout(async()=>{if(process.send){let s=t.getRemoteAdminSettings();s&&process.send({type:"admin-settings-update",settings:s})}await sr()},100),!0):!1,{isActive:!0});let r=o??"You've successfully signed in with Google. Gemini CLI needs to be restarted.";return(0,kc.jsxs)(u,{borderStyle:"round",borderColor:c.status.warning,paddingX:1,flexDirection:"column",children:[(0,kc.jsx)(l,{color:c.status.warning,children:r}),(0,kc.jsx)(l,{color:c.status.warning,children:"Press R to restart, or Esc to choose a different authentication method."})]})};var Ge=C(P(),1);var gm=({addItem:e,terminalWidth:t})=>{let o=ht(),r=We(),n=Se(),s=fd(),i=Ir(),{constrainHeight:a,terminalHeight:d,staticExtraHeight:m,terminalWidth:f}=n;if(n.adminSettingsChanged)return(0,Ge.jsx)(KR,{});if(n.showIdeRestartPrompt)return(0,Ge.jsx)(jR,{reason:n.ideTrustRestartReason});if(n.newAgents)return(0,Ge.jsx)(Ob,{agents:n.newAgents,onSelect:i.handleNewAgentsSelect});if(s.proQuotaRequest)return(0,Ge.jsx)(vR,{failedModel:s.proQuotaRequest.failedModel,fallbackModel:s.proQuotaRequest.fallbackModel,message:s.proQuotaRequest.message,isTerminalQuotaError:s.proQuotaRequest.isTerminalQuotaError,isModelNotFoundError:!!s.proQuotaRequest.isModelNotFoundError,authType:s.proQuotaRequest.authType,tierName:o?.getUserTierName(),onChoice:i.handleProQuotaChoice});if(s.validationRequest)return(0,Ge.jsx)(AR,{validationLink:s.validationRequest.validationLink,validationDescription:s.validationRequest.validationDescription,learnMoreUrl:s.validationRequest.learnMoreUrl,onChoice:i.handleValidationChoice});if(s.overageMenuRequest)return(0,Ge.jsx)(wR,{failedModel:s.overageMenuRequest.failedModel,fallbackModel:s.overageMenuRequest.fallbackModel,resetTime:s.overageMenuRequest.resetTime,creditBalance:s.overageMenuRequest.creditBalance,onChoice:i.handleOverageMenuChoice});if(s.emptyWalletRequest)return(0,Ge.jsx)(_R,{failedModel:s.emptyWalletRequest.failedModel,fallbackModel:s.emptyWalletRequest.fallbackModel,resetTime:s.emptyWalletRequest.resetTime,onGetCredits:s.emptyWalletRequest.onGetCredits,onChoice:i.handleEmptyWalletChoice});if(n.shouldShowIdePrompt)return(0,Ge.jsx)(vb,{ide:n.currentIDE,onComplete:i.handleIdePromptComplete});if(n.isFolderTrustDialogOpen)return(0,Ge.jsx)(Ab,{onSelect:i.handleFolderTrustSelect,isRestarting:n.isRestarting,discoveryResults:n.folderDiscoveryResults});if(n.isPolicyUpdateDialogOpen)return(0,Ge.jsx)(XR,{config:o,request:n.policyUpdateConfirmationRequest,onClose:()=>i.setIsPolicyUpdateDialogOpen(!1)});if(n.loopDetectionConfirmationRequest)return(0,Ge.jsx)(oR,{onComplete:n.loopDetectionConfirmationRequest.onComplete});if(n.permissionConfirmationRequest){let p=n.permissionConfirmationRequest.files.map(y=>`- ${y}`).join(`
60
+ `,availableTerminalHeight:i===!1?W:void 0,terminalWidth:b,theme:L})]}),Ux&&(0,xt.jsx)(u,{marginTop:1,children:(0,xt.jsx)(nR,{activeTheme:L})})]})]}):(0,xt.jsx)(rR,{onSelect:E,onHighlight:A,isFocused:T==="scope",initialScope:d}),(0,xt.jsx)(u,{marginTop:1,children:(0,xt.jsxs)(l,{color:c.text.secondary,wrap:"truncate",children:["(Use Enter to ",T==="theme"?"select":"apply scope",", Tab to"," ",T==="theme"?"configure scope":"select theme",", Esc to close)"]})})]})}var Qt=C(z(),1);var Ai=C(z(),1);var zf=C(td(),1);var Ii=C(z(),1);function jf(e,t,o,r){t<e?e=t:t>=e+r&&(e=t-r+1);let n=Math.max(0,o-r),s=Math.min(e,n);return Math.max(0,s)}function _M(e,t){return function(r,n){if(e.length===0)return r;let s=e.findIndex(a=>a.key===r.activeItemKey),i=s!==-1?s:0;switch(n.type){case"MOVE_UP":{let a=i>0?i-1:e.length-1;return{activeItemKey:e[a].key,windowStart:jf(r.windowStart,a,e.length,t)}}case"MOVE_DOWN":{let a=i<e.length-1?i+1:0;return{activeItemKey:e[a].key,windowStart:jf(r.windowStart,a,e.length,t)}}default:return r}}}function lR({items:e,maxItemsToShow:t}){let o=(0,Ii.useMemo)(()=>_M(e,t),[e,t]),[r,n]=(0,Ii.useReducer)(o,{activeItemKey:e[0]?.key??null,windowStart:0}),s=(0,Ii.useMemo)(()=>{if(e.length===0)return 0;let m=e.findIndex(f=>f.key===r.activeItemKey);return m!==-1?m:0},[e,r.activeItemKey]),i=(0,Ii.useMemo)(()=>jf(r.windowStart,s,e.length,t),[r.windowStart,s,e.length,t]),a=(0,Ii.useCallback)(()=>n({type:"MOVE_UP"}),[]),d=(0,Ii.useCallback)(()=>n({type:"MOVE_DOWN"}),[]);return{activeItemKey:r.activeItemKey,activeIndex:s,windowStart:i,moveUp:a,moveDown:d}}var vi=C(z(),1);var cR={editingKey:null,buffer:"",cursorPos:0};function DM(e,t){switch(t.type){case"START_EDIT":return{editingKey:t.key,buffer:t.initialValue,cursorPos:Yt(t.initialValue)};case"COMMIT_EDIT":return cR;case"MOVE_LEFT":return{...e,cursorPos:Math.max(0,e.cursorPos-1)};case"MOVE_RIGHT":return{...e,cursorPos:Math.min(Yt(e.buffer),e.cursorPos+1)};case"HOME":return{...e,cursorPos:0};case"END":return{...e,cursorPos:Yt(e.buffer)};case"DELETE_LEFT":{if(e.cursorPos===0)return e;let o=Nt(e.buffer,0,e.cursorPos-1),r=Nt(e.buffer,e.cursorPos);return{...e,buffer:o+r,cursorPos:e.cursorPos-1}}case"DELETE_RIGHT":{if(e.cursorPos===Yt(e.buffer))return e;let o=Nt(e.buffer,0,e.cursorPos),r=Nt(e.buffer,e.cursorPos+1);return{...e,buffer:o+r}}case"INSERT_CHAR":{let o=t.char,r=!1;if(t.isNumberType?r=/[0-9\-+.]/.test(o):(r=o.length===1&&o.charCodeAt(0)>=32,o=Zr(o)),!r||o.length===0)return e;let n=Nt(e.buffer,0,e.cursorPos),s=Nt(e.buffer,e.cursorPos);return{...e,buffer:n+o+s,cursorPos:e.cursorPos+1}}default:return e}}function uR({onCommit:e}){let[t,o]=(0,vi.useReducer)(DM,cR),[r,n]=(0,vi.useState)(!0);(0,vi.useEffect)(()=>{if(!t.editingKey){n(!0);return}n(!0);let a=setInterval(()=>{n(d=>!d)},500);return()=>clearInterval(a)},[t.editingKey,t.buffer,t.cursorPos]);let s=(0,vi.useCallback)((a,d)=>{o({type:"START_EDIT",key:a,initialValue:d})},[]),i=(0,vi.useCallback)(()=>{t.editingKey&&e(t.editingKey,t.buffer),o({type:"COMMIT_EDIT"})},[t.editingKey,t.buffer,e]);return{editState:t,editDispatch:o,startEditing:s,commitEdit:i,cursorVisible:r}}var Ye=C(P(),1);function am({title:e,borderColor:t,searchEnabled:o=!0,searchPlaceholder:r="Search to filter",searchBuffer:n,items:s,showScopeSelector:i=!0,scopeItems:a,selectedScope:d,onScopeChange:m,maxItemsToShow:f,maxLabelWidth:h,onItemToggle:p,onEditCommit:y,onItemClear:g,onClose:x,onKeyPress:S,keyMatchers:I,availableHeight:A,footer:E}){let T=ze(),v=I??T,R=(0,Ai.useMemo)(()=>(a??Sl()).map(j=>({...j,key:j.value})),[a]),b=i&&R.length>1,{effectiveMaxItemsToShow:_,finalShowScopeSelector:w}=(0,Ai.useMemo)(()=>{let j=b,$=f;if(!A)return{effectiveMaxItemsToShow:$,finalShowScopeSelector:j};let X=4,Q=1,Ce=o?5:1,_e=2,Be=1,ce=5,Fe=1,pt=E?.height??0,St=3,xn=A-X,qr=Q+Ce+_e+Be+Fe+pt,tr=qr+ce,Do=xn-tr,Kr=Math.max(1,Math.floor(Do/St)),_t=xn-qr,or=Math.max(1,Math.floor(_t/St)),Mn=j,mi=j?Kr:or;return j&&A<25&&or>Kr+1&&(Mn=!1,mi=or),{effectiveMaxItemsToShow:Math.min(mi,s.length),finalShowScopeSelector:Mn}},[A,f,s.length,o,b,E]),{activeIndex:M,windowStart:D,moveUp:N,moveDown:O}=lR({items:s,maxItemsToShow:_}),{editState:W,editDispatch:L,startEditing:k,commitEdit:F,cursorVisible:B}=uR({onCommit:(j,$)=>{let X=s.find(Q=>Q.key===j);X&&y(j,$,X)}}),{editingKey:K,buffer:q,cursorPos:Z}=W,[Y,oe]=(0,Ai.useState)("settings"),le=!w&&Y==="scope"?"settings":Y,G=s.slice(D,D+_),ee=s.length>_,te=s.length>_,se=s[M],ne=(0,Ai.useCallback)(j=>{m?.(j)},[m]);return de(j=>{if(!(!K&&S?.(j,se))){if(K){let X=s.find(Q=>Q.key===K)?.type??"string";if(v["cursor.left"](j)){L({type:"MOVE_LEFT"});return}if(v["cursor.right"](j)){L({type:"MOVE_RIGHT"});return}if(v["cursor.home"](j)){L({type:"HOME"});return}if(v["cursor.end"](j)){L({type:"END"});return}if(v["edit.deleteLeft"](j)){L({type:"DELETE_LEFT"});return}if(v["edit.deleteRight"](j)){L({type:"DELETE_RIGHT"});return}if(v["basic.cancel"](j)){F();return}if(v["basic.confirm"](j)){F();return}if(v["nav.dialog.up"](j)&&!j.insertable){F(),N();return}if(v["nav.dialog.down"](j)&&!j.insertable){F(),O();return}j.sequence&&L({type:"INSERT_CHAR",char:j.sequence,isNumberType:X==="number"});return}if(le==="settings"){if(v["nav.dialog.up"](j))return N(),!0;if(v["nav.dialog.down"](j))return O(),!0;if(v["basic.confirm"](j)&&se){if(se.type==="boolean"||se.type==="enum")p(se.key,se);else{let $=se.rawValue,X=se.editValue??($!==void 0?String($):"");k(se.key,X)}return!0}if(v["app.clearScreen"](j)&&se)return g(se.key,se),!0;if(se?.type==="number"&&/^[0-9]$/.test(j.sequence))return k(se.key,j.sequence),!0}if(j.name==="tab"&&w){oe($=>$==="settings"?"scope":"settings");return}if(v["basic.cancel"](j)){x();return}}},{isActive:!0,priority:le==="settings"}),(0,Ye.jsx)(u,{borderStyle:"round",borderColor:t??c.border.default,flexDirection:"row",padding:1,width:"100%",maxHeight:A,children:(0,Ye.jsxs)(u,{flexDirection:"column",flexGrow:1,children:[(0,Ye.jsx)(u,{marginX:1,children:(0,Ye.jsxs)(l,{bold:le==="settings"&&!K,wrap:"truncate",children:[le==="settings"?"> ":" ",e," "]})}),o&&n&&(0,Ye.jsx)(u,{borderStyle:"round",borderColor:K?c.border.default:le==="settings"?c.ui.focus:c.border.default,paddingX:1,height:3,marginTop:1,children:(0,Ye.jsx)(ea,{focus:le==="settings"&&!K,buffer:n,placeholder:r})}),(0,Ye.jsx)(u,{height:1}),G.length===0?(0,Ye.jsx)(u,{marginX:1,height:1,flexDirection:"column",children:(0,Ye.jsx)(l,{color:c.text.secondary,children:"No matches found."})}):(0,Ye.jsxs)(Ye.Fragment,{children:[ee&&(0,Ye.jsx)(u,{marginX:1,children:(0,Ye.jsx)(l,{color:c.text.secondary,children:"\u25B2"})}),G.map((j,$)=>{let X=$+D,Q=le==="settings"&&M===X,Ce;if(K===j.key)if(B&&Z<Yt(q)){let _e=Nt(q,0,Z),Be=Nt(q,Z,Z+1),ce=Nt(q,Z+1);Ce=_e+zf.default.inverse(Be)+ce}else Z>=Yt(q)?Ce=q+(B?zf.default.inverse(" "):" "):Ce=q;else Ce=j.displayValue;return(0,Ye.jsxs)(Ai.default.Fragment,{children:[(0,Ye.jsxs)(u,{marginX:1,flexDirection:"row",alignItems:"flex-start",backgroundColor:Q?c.background.focus:void 0,children:[(0,Ye.jsx)(u,{minWidth:2,flexShrink:0,children:(0,Ye.jsx)(l,{color:Q?c.ui.focus:c.text.secondary,children:Q?"\u25CF":""})}),(0,Ye.jsxs)(u,{flexDirection:"row",flexGrow:1,minWidth:0,alignItems:"flex-start",children:[(0,Ye.jsxs)(u,{flexDirection:"column",width:h,minWidth:0,children:[(0,Ye.jsxs)(l,{color:Q?c.ui.focus:c.text.primary,children:[j.label,j.scopeMessage&&(0,Ye.jsxs)(l,{color:c.text.secondary,children:[" ",j.scopeMessage]})]}),(0,Ye.jsx)(l,{color:c.text.secondary,wrap:"truncate",children:j.description??""})]}),(0,Ye.jsx)(u,{minWidth:3}),(0,Ye.jsx)(u,{flexShrink:0,children:(0,Ye.jsx)(l,{color:Q?c.ui.focus:j.isGreyedOut?c.text.secondary:c.text.primary,terminalCursorFocus:K===j.key&&B,terminalCursorPosition:ed(q,Z),children:Ce})})]})]}),(0,Ye.jsx)(u,{height:1})]},j.key)}),te&&(0,Ye.jsx)(u,{marginX:1,children:(0,Ye.jsx)(l,{color:c.text.secondary,children:"\u25BC"})})]}),(0,Ye.jsx)(u,{height:1}),w&&(0,Ye.jsxs)(u,{marginX:1,flexDirection:"column",children:[(0,Ye.jsxs)(l,{bold:le==="scope",wrap:"truncate",children:[le==="scope"?"> ":" ","Apply To"]}),(0,Ye.jsx)(Ue,{items:R,initialIndex:R.findIndex(j=>j.value===d),onSelect:ne,onHighlight:ne,isFocused:le==="scope",showNumbers:le==="scope",priority:le==="scope"})]}),(0,Ye.jsx)(u,{height:1}),(0,Ye.jsx)(u,{marginX:1,children:(0,Ye.jsxs)(l,{color:c.text.secondary,children:["(Use Enter to select, ",be("app.clearScreen")," to reset",w?", Tab to change focus":"",", Esc to close)"]})}),E&&(0,Ye.jsx)(u,{marginX:1,children:E.content})]})})}var Yf=C(P(),1);var MM=8,PM=new gc("up"),OM=new gc("ctrl+p"),LM=new gc("down"),NM=new gc("ctrl+n");function BM(e){let t=new Map,o=[["User",e.user.settings],["Workspace",e.workspace.settings],["System",e.system.settings]];for(let r of xS()){let n=new Map;for(let[s,i]of o){let a=Qs(r,i)?pc(r,i):void 0;n.set(s,JSON.stringify(a))}t.set(r,n)}return t}function dR({onSelect:e,onRestartRequest:t,availableTerminalHeight:o}){let{settings:r,setSetting:n}=id(),[s,i]=(0,Qt.useState)("User"),a=(0,Qt.useMemo)(()=>Sl().filter(k=>{let F=r.forScope(k.value);return F.readOnly!==!0&&(k.value!=="Workspace"||F.path!==void 0)}),[r]),d=a.find(k=>k.value===s)?.value??a[0]?.value,m=d??"User";d&&s!==d&&i(d);let[f]=(0,Qt.useState)(()=>BM(r)),[h,p]=(0,Qt.useState)(""),[y,g]=(0,Qt.useState)(()=>za()),{fzfInstance:x,searchMap:S}=(0,Qt.useMemo)(()=>{let k=za(),F=new Map,B=[];return k.forEach(q=>{let Z=ja(q);Z?.label&&(B.push(Z.label),F.set(Z.label.toLowerCase(),q))}),{fzfInstance:new qs(B,{fuzzy:"v2",casing:"case-insensitive"}),searchMap:F}},[]);(0,Qt.useEffect)(()=>{let k=!0;if(!h.trim()||!x){g(za());return}return(async()=>{let B=await x.find(h);if(!k)return;let K=new Set;B.forEach(q=>{let Z=S.get(q.item.toLowerCase());Z&&K.add(Z)}),g(Array.from(K))})(),()=>{k=!1}},[h,x,S]);let A=(0,Qt.useMemo)(()=>{let k=new Set,F=[["User",r.user.settings],["Workspace",r.workspace.settings],["System",r.system.settings]];for(let[B,K]of f)for(let[q,Z]of F){let Y=Qs(B,Z)?pc(B,Z):void 0,oe=K.get(q);if(JSON.stringify(Y)!==oe){k.add(B);break}}return k},[r,f]).size>0,E=(0,Qt.useMemo)(()=>{let k=za(),F=0;for(let B of k){let K=ja(B);if(!K)continue;let q=Dc(B,m,r),Y=(K.label||B)+(q?` ${q}`:""),oe=kr(Y),le=K.description?kr(K.description):0;F=Math.max(F,oe,le)}return F},[m,r]),T=uC({initialText:"",onChange:p}),v=h?y:za(),R=(0,Qt.useMemo)(()=>{let k=r.forScope(m).settings,F=r.merged;return v.map(B=>{let K=ja(B),q=K?.type??"string",Z=SS(B,k,F),Y=Dc(B,m,r),oe=!Qs(B,k),le=pc(B,k),G=bS(q,le);return{key:B,label:K?.label||B,description:K?.description,type:q,displayValue:Z,isGreyedOut:oe,scopeMessage:Y,rawValue:le,editValue:G}})},[v,m,r]),b=(0,Qt.useCallback)(k=>{i(k)},[]),_=(0,Qt.useCallback)((k,F)=>{if(!d)return;let B=ja(k);if(!mS.has(B?.type))return;let K=r.forScope(d).settings,q=pc(k,K),Z;if(B?.type==="boolean"){if(typeof q!="boolean")return;Z=!q}else if(B?.type==="enum"&&B.options){let Y=B.options;if(Y.length===0)return;let oe=Y?.findIndex(le=>le.value===q);oe!==-1&&oe<Y.length-1?Z=Y[oe+1].value:Z=Y[0].value}else return;ue.log(`[DEBUG SettingsDialog] Saving ${k} immediately with value:`,Z),n(d,k,Z)},[r,d,n]),w=(0,Qt.useCallback)((k,F,B)=>{if(!d)return;let q=ja(k)?.type??"string",Z=CS(q,F);Z!==null&&n(d,k,Z)},[d,n]),M=(0,Qt.useCallback)((k,F)=>{d&&n(d,k,void 0)},[d,n]),D=(0,Qt.useCallback)(()=>{e(void 0,m)},[e,m]),N=ze(),O=(0,Qt.useMemo)(()=>({...N,"nav.dialog.up":k=>PM.matches(k)||OM.matches(k),"nav.dialog.down":k=>LM.matches(k)||NM.matches(k)}),[N]),W=(0,Qt.useCallback)((k,F)=>A&&k.sequence==="r"?(t&&t(),!0):!1,[A,t]),L=!A;return(0,Yf.jsx)(am,{title:"Settings",borderColor:A?c.status.warning:void 0,searchEnabled:L,searchBuffer:T,items:R,showScopeSelector:a.length>1,scopeItems:a,selectedScope:m,onScopeChange:b,maxItemsToShow:MM,availableHeight:o,maxLabelWidth:E,onItemToggle:_,onEditCommit:w,onItemClear:M,onClose:D,onKeyPress:W,keyMatchers:O,footer:A?{content:(0,Yf.jsx)(l,{color:c.status.warning,children:"Changes that require a restart have been modified. Press r to exit and apply changes now."}),height:1}:void 0})}var lm=C(z(),1);var ga=C(P(),1);function mR({onTimeout:e}){let[t,o]=(0,lm.useState)(!1);return de(r=>{(r.name==="escape"||r.ctrl&&r.name==="c")&&e()},{isActive:!0}),(0,lm.useEffect)(()=>{let r=setTimeout(()=>{o(!0),e()},18e4);return()=>clearTimeout(r)},[e]),(0,ga.jsx)(u,{borderStyle:"round",borderColor:c.border.default,flexDirection:"column",padding:1,width:"100%",children:t?(0,ga.jsx)(l,{color:c.status.error,children:"Authentication timed out. Please try again."}):(0,ga.jsx)(u,{children:(0,ga.jsxs)(l,{children:[(0,ga.jsx)(Ro,{type:"dots"})," Waiting for authentication... (Press Esc or Ctrl+C to cancel)"]})})})}var cm=C(z(),1);var In=C(z(),1);function Xf(e,t){let o=t.merged.security.auth.enforcedType;return o&&o!==e?`Authentication is enforced to be ${o}, but you are currently using ${e}.`:t.merged.security.auth.useExternal||e==="gemini-api-key"?null:Sd(e)}var fR=(e,t,o=null,r=null)=>{let[n,s]=(0,In.useState)(o?"updating":"unauthenticated"),[i,a]=(0,In.useState)(o),[d,m]=(0,In.useState)(r),[f,h]=(0,In.useState)(void 0),p=(0,In.useCallback)(g=>{a(g),g&&s("updating")},[a,s]),y=(0,In.useCallback)(async()=>{let g=process.env.GEMINI_API_KEY;if(g!==void 0)return h(g),g;let x=await lx()??"";return h(x),x},[]);return(0,In.useEffect)(()=>{n==="awaiting_api_key_input"&&y()},[n,y]),(0,In.useEffect)(()=>{(async()=>{if(n!=="unauthenticated")return;let g=(process.env.USE_VERTEX?"vertex-ai":void 0)||e.merged.security.auth.selectedType;if(!g){process.env.GEMINI_API_KEY?p('Existing API key detected (GEMINI_API_KEY). Select "Gemini API Key" option to use it.'):p("No authentication method selected.");return}if(g==="gemini-api-key"&&!await y()){s("awaiting_api_key_input");return}let x=Xf(g,e);if(x){p(x);return}let S=process.env.GEMINI_DEFAULT_AUTH_TYPE;if(S&&!Object.values(Cn).includes(S)){p(`Invalid value for GEMINI_DEFAULT_AUTH_TYPE: "${S}". Valid values are: ${Object.values(Cn).join(", ")}.`);return}try{await t.refreshAuth(g),ue.log(`Authenticated via "${g}".`),a(null),s("authenticated")}catch(I){let A=Qy(I);A?m({message:A.message,appealUrl:A.appealUrl,appealLinkText:A.appealLinkText}):I instanceof zu?p(Br(I)):p(`Failed to sign in. Message: ${Br(I)}`)}})()},[e,t,n,s,a,p,y]),{authState:n,setAuthState:s,authError:i,onAuthError:p,apiKeyDefaultValue:f,reloadApiKey:y,accountSuspensionInfo:d,setAccountSuspensionInfo:m}};var no=C(P(),1);function gR({config:e,settings:t,setAuthState:o,authError:r,onAuthError:n,setAuthContext:s}){let[i,a]=(0,cm.useState)(!1),d=[{label:"Sign in with Google",value:"oauth-personal",key:"oauth-personal"},...process.env.CLOUD_SHELL==="true"?[{label:"Use Cloud Shell user credentials",value:"compute-default-credentials",key:"compute-default-credentials"}]:process.env.GEMINI_CLI_USE_COMPUTE_ADC==="true"?[{label:"Use metadata server application default credentials",value:"compute-default-credentials",key:"compute-default-credentials"}]:[],{label:"Use Gemini API Key",value:"gemini-api-key",key:"gemini-api-key"},{label:"Vertex AI",value:"vertex-ai",key:"vertex-ai"}];t.merged.security.auth.enforcedType&&(d=d.filter(g=>g.value===t.merged.security.auth.enforcedType));let m=null,f=process.env.GEMINI_DEFAULT_AUTH_TYPE;f&&Object.values(Cn).includes(f)&&(m=f);let h=d.findIndex(g=>t.merged.security.auth.selectedType?g.value===t.merged.security.auth.selectedType:m?g.value===m:process.env.GEMINI_API_KEY?g.value==="gemini-api-key":g.value==="oauth-personal");t.merged.security.auth.enforcedType&&(h=0);let p=(0,cm.useCallback)(async(g,x)=>{if(!i){if(g){let S=g==="oauth-personal"||g==="vertex-ai"&&process.env.CLOUD_SHELL==="true";if(s(S?{requiresRestart:!0}:{}),await qu(),t.setValue(x,"security.auth.selectedType",g),g==="oauth-personal"&&e.isBrowserLaunchSuppressed()){a(!0),setTimeout(sr,100);return}if(g==="gemini-api-key"){o("awaiting_api_key_input");return}}o("unauthenticated")}},[t,e,o,i,s]),y=g=>{let x=Xf(g,t);x?n(x):p(g,"User")};return de(g=>g.name==="escape"?r?!0:t.merged.security.auth.selectedType===void 0?(n("You must select an auth method to proceed. Press Ctrl+C twice to exit."),!0):(p(void 0,"User"),!0):!1,{isActive:!0}),i?(0,no.jsx)(u,{borderStyle:"round",borderColor:c.ui.focus,flexDirection:"row",padding:1,width:"100%",alignItems:"flex-start",children:(0,no.jsx)(l,{color:c.text.primary,children:"Logging in with Google... Restarting Gemini CLI to continue."})}):(0,no.jsxs)(u,{borderStyle:"round",borderColor:c.ui.focus,flexDirection:"row",padding:1,width:"100%",alignItems:"flex-start",children:[(0,no.jsx)(l,{color:c.text.accent,children:"? "}),(0,no.jsxs)(u,{flexDirection:"column",flexGrow:1,children:[(0,no.jsx)(l,{bold:!0,color:c.text.primary,children:"Get started"}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.text.primary,children:"How would you like to authenticate for this project?"})}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(Ue,{items:d,initialIndex:h,onSelect:y,onHighlight:()=>{n(null)}})}),r&&(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.status.error,children:r})}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.text.secondary,children:"(Use Enter to select)"})}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.text.primary,children:"Terms of Services and Privacy Notice for Gemini CLI"})}),(0,no.jsx)(u,{marginTop:1,children:(0,no.jsx)(l,{color:c.text.link,children:"https://geminicli.com/docs/resources/tos-privacy/"})})]})]})}var ha=C(z(),1);var yo=C(P(),1);function hR({accountSuspensionInfo:e,onExit:t,onChangeAuth:o}){let[r,n]=(0,ha.useState)(null),s=e.appealUrl,i=e.appealLinkText??"Open the Google Form",a=(0,ha.useMemo)(()=>{let f=[];return s&&f.push({label:i,value:"open_form",key:"open_form"}),f.push({label:"Change authentication",value:"change_auth",key:"change_auth"},{label:"Exit",value:"exit",key:"exit"}),f},[s,i]);de(f=>f.name==="escape"?(d(),!0):!1,{isActive:!0});let d=(0,ha.useCallback)(async()=>{await Fn(),t()},[t]),m=(0,ha.useCallback)(async f=>{if(f==="open_form"&&s){if(!$a()){n(`Please open this URL in a browser: ${s}`);return}try{await Va(s)}catch{n(`Failed to open browser. Please visit: ${s}`)}}else f==="change_auth"?o():await d()},[d,o,s]);return(0,yo.jsxs)(u,{flexDirection:"column",padding:1,children:[(0,yo.jsx)(l,{bold:!0,color:c.status.error,children:"Error: Account Suspended"}),(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(l,{children:e.message})}),s&&(0,yo.jsxs)(yo.Fragment,{children:[(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(l,{children:"Appeal URL:"})}),(0,yo.jsx)(u,{children:(0,yo.jsxs)(l,{color:c.text.link,children:["[",s,"]"]})})]}),r&&(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(l,{color:c.status.error,children:r})}),(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(Ue,{items:a,onSelect:f=>void m(f)})}),(0,yo.jsx)(u,{marginTop:1,children:(0,yo.jsx)(l,{dimColor:!0,children:"Escape to exit"})})]})}var um=C(z(),1);var fr=C(P(),1);function yR({onSubmit:e,onCancel:t,error:o,defaultValue:r=""}){let n=ze(),{terminalWidth:s}=Se(),i=s-8,a=(0,um.useRef)(null);(0,um.useEffect)(()=>()=>{a.current?.cancel()},[]);let d=r,m=Zs({initialText:d||"",initialCursorOffset:d?.length||0,viewport:{width:i,height:4},inputFilter:p=>p.replace(/[^a-zA-Z0-9_.-]/g,"").replace(/[\r\n]/g,""),singleLine:!0}),f=p=>{e(p)},h=()=>{a.current?.cancel();let p=!1,y=new Promise((g,x)=>{ux().then(()=>!p&&g(),S=>!p&&x(S))});return a.current={cancel:()=>{p=!0}},y.then(()=>{m.setText("")}).catch(g=>{ue.debug("Failed to clear API key:",g)})};return de(p=>n["edit.clear"](p)?(h(),!0):!1,{isActive:!0}),(0,fr.jsxs)(u,{borderStyle:"round",borderColor:c.ui.focus,flexDirection:"column",padding:1,width:"100%",children:[(0,fr.jsx)(l,{bold:!0,color:c.text.primary,children:"Enter Gemini API Key"}),(0,fr.jsxs)(u,{marginTop:1,flexDirection:"column",children:[(0,fr.jsx)(l,{color:c.text.primary,children:"Please enter your Gemini API key. It will be securely stored in your system keychain."}),(0,fr.jsxs)(l,{color:c.text.secondary,children:["You can get an API key from"," ",(0,fr.jsx)(l,{color:c.text.link,children:"https://aistudio.google.com/app/apikey"})]})]}),(0,fr.jsx)(u,{marginTop:1,flexDirection:"row",children:(0,fr.jsx)(u,{borderStyle:"round",borderColor:c.border.default,paddingX:1,flexGrow:1,children:(0,fr.jsx)(ea,{buffer:m,onSubmit:f,onCancel:t,placeholder:"Paste your API key here"})})}),o&&(0,fr.jsx)(u,{marginTop:1,children:(0,fr.jsx)(l,{color:c.status.error,children:o})}),(0,fr.jsx)(u,{marginTop:1,children:(0,fr.jsx)(l,{color:c.text.secondary,children:"(Press Enter to submit, Esc to cancel, Ctrl+C to clear stored key)"})})]})}var Jf=C(z(),1);var Qf=class{availableEditors;constructor(){let t=Object.keys(uc).sort();this.availableEditors=[{name:"None",type:"not_set",disabled:!1},...t.map(o=>{let r=Ku(o),n=ju(o),s=n?"":" (Not available in sandbox)";return s=r?s:" (Not installed)",{name:uc[o]+s,type:o,disabled:!r||!n}})]}getAvailableEditorDisplays(){return this.availableEditors}},TR=new Qf;var wo=C(P(),1);function xR({onSelect:e,settings:t,onExit:o}){let[r,n]=(0,Jf.useState)("User"),[s,i]=(0,Jf.useState)("editor");de(S=>S.name==="tab"?(i(I=>I==="editor"?"scope":"editor"),!0):S.name==="escape"?(o(),!0):!1,{isActive:!0});let a=TR.getAvailableEditorDisplays(),d=t.forScope(r).settings.general?.preferredEditor,m=d?a.findIndex(S=>S.type===d):0;m===-1&&(xe.emitFeedback("error",`Editor is not supported: ${d}`),m=0);let f=[{label:"User Settings",value:"User",key:"User"},{label:"Workspace Settings",value:"Workspace",key:"Workspace"}],h=S=>{if(S==="not_set"){e(void 0,r);return}e(S,r)},p=S=>{n(S),i("editor")},y="",g=r==="User"?"Workspace":"User";t.forScope(g).settings.general?.preferredEditor!==void 0&&(y=t.forScope(r).settings.general?.preferredEditor!==void 0?`(Also modified in ${g})`:`(Modified in ${g})`);let x="None";return t.merged.general.preferredEditor&&QT(t.merged.general.preferredEditor)&&(x=uc[t.merged.general.preferredEditor]),(0,wo.jsxs)(u,{borderStyle:"round",borderColor:c.border.default,flexDirection:"row",padding:1,width:"100%",children:[(0,wo.jsxs)(u,{flexDirection:"column",width:"45%",paddingRight:2,children:[(0,wo.jsxs)(l,{bold:s==="editor",children:[s==="editor"?"> ":" ","Select Editor"," ",(0,wo.jsx)(l,{color:c.text.secondary,children:y})]}),(0,wo.jsx)(Ue,{items:a.map(S=>({label:S.name,value:S.type,disabled:S.disabled,key:S.type})),initialIndex:m,onSelect:h,isFocused:s==="editor"},r),(0,wo.jsxs)(u,{marginTop:1,flexDirection:"column",children:[(0,wo.jsxs)(l,{bold:s==="scope",children:[s==="scope"?"> ":" ","Apply To"]}),(0,wo.jsx)(Ue,{items:f,initialIndex:0,onSelect:p,isFocused:s==="scope"})]}),(0,wo.jsx)(u,{marginTop:1,children:(0,wo.jsx)(l,{color:c.text.secondary,children:"(Use Enter to select, Tab to change focus, Esc to close)"})})]}),(0,wo.jsxs)(u,{flexDirection:"column",width:"55%",paddingLeft:2,children:[(0,wo.jsx)(l,{bold:!0,color:c.text.primary,children:"Editor Preference"}),(0,wo.jsxs)(u,{flexDirection:"column",gap:1,marginTop:1,children:[(0,wo.jsx)(l,{color:c.text.secondary,children:"These editors are currently supported. Please note that some editors cannot be used in sandbox mode."}),(0,wo.jsxs)(l,{color:c.text.secondary,children:["Your preferred editor is:"," ",(0,wo.jsx)(l,{color:x==="None"?c.status.error:c.text.link,bold:!0,children:x}),"."]})]})]})]})}var Jt=C(P(),1);var SR=({onExit:e})=>(de(t=>t.name==="escape"?(e(),!0):!1,{isActive:!0}),(0,Jt.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,Jt.jsx)(l,{bold:!0,color:c.text.accent,children:"Gemini API Key Notice"}),(0,Jt.jsx)(Oo,{}),(0,Jt.jsxs)(l,{color:c.text.primary,children:["By using the Gemini API",(0,Jt.jsx)(l,{color:c.text.link,children:"[1]"}),", Google AI Studio",(0,Jt.jsx)(l,{color:c.status.error,children:"[2]"}),', and the other Google developer services that reference these terms (collectively, the "APIs" or "Services"), you are agreeing to Google APIs Terms of Service (the "API Terms")',(0,Jt.jsx)(l,{color:c.status.success,children:"[3]"}),', and the Gemini API Additional Terms of Service (the "Additional Terms")',(0,Jt.jsx)(l,{color:c.text.accent,children:"[4]"}),"."]}),(0,Jt.jsx)(Oo,{}),(0,Jt.jsxs)(l,{color:c.text.primary,children:[(0,Jt.jsx)(l,{color:c.text.link,children:"[1]"})," ","https://ai.google.dev/docs/gemini_api_overview"]}),(0,Jt.jsxs)(l,{color:c.text.primary,children:[(0,Jt.jsx)(l,{color:c.status.error,children:"[2]"})," https://aistudio.google.com/"]}),(0,Jt.jsxs)(l,{color:c.text.primary,children:[(0,Jt.jsx)(l,{color:c.status.success,children:"[3]"})," ","https://developers.google.com/terms"]}),(0,Jt.jsxs)(l,{color:c.text.primary,children:[(0,Jt.jsx)(l,{color:c.text.accent,children:"[4]"})," ","https://ai.google.dev/gemini-api/terms"]}),(0,Jt.jsx)(Oo,{}),(0,Jt.jsx)(l,{color:c.text.secondary,children:"Press Esc to exit."})]}));var gr=C(P(),1);var CR=({onExit:e})=>(de(t=>t.name==="escape"?(e(),!0):!1,{isActive:!0}),(0,gr.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,gr.jsx)(l,{bold:!0,color:c.text.accent,children:"Vertex AI Notice"}),(0,gr.jsx)(Oo,{}),(0,gr.jsxs)(l,{color:c.text.primary,children:["Service Specific Terms",(0,gr.jsx)(l,{color:c.text.link,children:"[1]"})," are incorporated into the agreement under which Google has agreed to provide Google Cloud Platform",(0,gr.jsx)(l,{color:c.status.success,children:"[2]"})," to Customer (the \u201CAgreement\u201D). If the Agreement authorizes the resale or supply of Google Cloud Platform under a Google Cloud partner or reseller program, then except for in the section entitled \u201CPartner-Specific Terms\u201D, all references to Customer in the Service Specific Terms mean Partner or Reseller (as applicable), and all references to Customer Data in the Service Specific Terms mean Partner Data. Capitalized terms used but not defined in the Service Specific Terms have the meaning given to them in the Agreement."]}),(0,gr.jsx)(Oo,{}),(0,gr.jsxs)(l,{color:c.text.primary,children:[(0,gr.jsx)(l,{color:c.text.link,children:"[1]"})," ","https://cloud.google.com/terms/service-terms"]}),(0,gr.jsxs)(l,{color:c.text.primary,children:[(0,gr.jsx)(l,{color:c.status.success,children:"[2]"})," ","https://cloud.google.com/terms/services"]}),(0,gr.jsx)(Oo,{}),(0,gr.jsx)(l,{color:c.text.secondary,children:"Press Esc to exit."})]}));var Cl=C(z(),1);var ER=e=>{let[t,o]=(0,Cl.useState)({isLoading:!0});(0,Cl.useEffect)(()=>{(async()=>{o({isLoading:!0});try{let s=bR(e),i=s.userTier;if(i===void 0)throw new Error("Could not determine user tier.");if(i!==MT.FREE){o({isLoading:!1,isFreeTier:!1});return}let a=await kM(s);o({isLoading:!1,isFreeTier:!0,dataCollectionOptIn:a})}catch(s){o({isLoading:!1,error:s instanceof Error?s.message:String(s)})}})()},[e]);let r=(0,Cl.useCallback)(async n=>{try{let s=bR(e),i=await HM(s,n);o({isLoading:!1,isFreeTier:!0,dataCollectionOptIn:i})}catch(s){o({isLoading:!1,error:s instanceof Error?s.message:String(s)})}},[e]);return{privacyState:t,updateDataCollectionOptIn:r}};function bR(e){let t=ax(e);if(t===void 0)throw new Error("Oauth not being used");if(t.projectId===void 0)throw new Error("CodeAssist server is missing a project ID");return t}async function kM(e){try{let t=await e.getCodeAssistGlobalUserSetting();return t.freeTierDataCollectionOptin===void 0&&ue.warn("Warning: Code Assist API did not return freeTierDataCollectionOptin. Defaulting to true."),t.freeTierDataCollectionOptin??!0}catch(t){if(t&&typeof t=="object"&&"response"in t&&t.response?.status===404)return!0;throw t}}async function HM(e,t){let o=await e.setCodeAssistGlobalUserSetting({cloudaicompanionProject:e.projectId,freeTierDataCollectionOptin:t});return o.freeTierDataCollectionOptin===void 0&&ue.warn(`Warning: Code Assist API did not return freeTierDataCollectionOptin. Defaulting to ${t}.`),o.freeTierDataCollectionOptin??t}var yt=C(P(),1);var RR=({config:e,onExit:t})=>{let{privacyState:o,updateDataCollectionOptIn:r}=ER(e);if(de(s=>(o.error||o.isFreeTier===!1)&&s.name==="escape"?(t(),!0):!1,{isActive:!0}),o.isLoading)return(0,yt.jsx)(l,{color:c.text.secondary,children:"Loading..."});if(o.error)return(0,yt.jsxs)(u,{flexDirection:"column",marginY:1,children:[(0,yt.jsxs)(l,{color:c.status.error,children:["Error loading Opt-in settings: ",o.error]}),(0,yt.jsx)(l,{color:c.text.secondary,children:"Press Esc to exit."})]});if(o.isFreeTier===!1)return(0,yt.jsxs)(u,{flexDirection:"column",marginY:1,children:[(0,yt.jsx)(l,{bold:!0,color:c.text.accent,children:"Gemini Code Assist Privacy Notice"}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{children:"https://developers.google.com/gemini-code-assist/resources/privacy-notices"}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{color:c.text.secondary,children:"Press Esc to exit."})]});let n=[{label:"Yes",value:!0,key:"true"},{label:"No",value:!1,key:"false"}];return(0,yt.jsxs)(u,{flexDirection:"column",marginY:1,children:[(0,yt.jsx)(l,{bold:!0,color:c.text.accent,children:"Gemini Code Assist for Individuals Privacy Notice"}),(0,yt.jsx)(Oo,{}),(0,yt.jsxs)(l,{color:c.text.primary,children:["This notice and our Privacy Policy",(0,yt.jsx)(l,{color:c.text.link,children:"[1]"})," describe how Gemini Code Assist handles your data. Please read them carefully."]}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{color:c.text.primary,children:"When you use Gemini Code Assist for individuals with Gemini CLI, Google collects your prompts, related code, generated output, code edits, related feature usage information, and your feedback to provide, improve, and develop Google products and services and machine learning technologies."}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{color:c.text.primary,children:"To help with quality and improve our products (such as generative machine-learning models), human reviewers may read, annotate, and process the data collected above. We take steps to protect your privacy as part of this process. This includes disconnecting the data from your Google Account before reviewers see or annotate it, and storing those disconnected copies for up to 18 months. Please don't submit confidential information or any data you wouldn't want a reviewer to see or Google to use to improve our products, services and machine-learning technologies."}),(0,yt.jsx)(Oo,{}),(0,yt.jsxs)(u,{flexDirection:"column",children:[(0,yt.jsx)(l,{color:c.text.primary,children:"Allow Google to use this data to develop and improve our products?"}),(0,yt.jsx)(Ue,{items:n,initialIndex:o.dataCollectionOptIn?0:1,onSelect:s=>{r(s),o.error||t()}})]}),(0,yt.jsx)(Oo,{}),(0,yt.jsxs)(l,{children:[(0,yt.jsx)(l,{color:c.text.link,children:"[1]"})," ","https://policies.google.com/privacy"]}),(0,yt.jsx)(Oo,{}),(0,yt.jsx)(l,{color:c.text.secondary,children:"Press Enter to choose an option and exit."})]})};var bl=C(P(),1);var FM=({config:e,onExit:t})=>{switch(e.getContentGeneratorConfig()?.authType){case"gemini-api-key":return(0,bl.jsx)(SR,{onExit:t});case"vertex-ai":return(0,bl.jsx)(CR,{onExit:t});case"oauth-personal":default:return(0,bl.jsx)(RR,{config:e,onExit:t})}},IR=({onExit:e,config:t})=>(0,bl.jsx)(u,{borderStyle:"round",padding:1,flexDirection:"column",children:(0,bl.jsx)(FM,{config:t,onExit:e})});var wi=C(P(),1);function vR({failedModel:e,fallbackModel:t,message:o,isTerminalQuotaError:r,isModelNotFoundError:n,authType:s,tierName:i,onChoice:a}){let d;if(e===t)d=[{label:"Keep trying",value:"retry_once",key:"retry_once"},{label:"Stop",value:"retry_later",key:"retry_later"}];else if(n||r){let h=xd(i);d=[{label:`Switch to ${t}`,value:"retry_always",key:"retry_always"},...s==="oauth-personal"&&!h?[{label:"Upgrade for higher limits",value:"upgrade",key:"upgrade"}]:[],{label:"Stop",value:"retry_later",key:"retry_later"}]}else d=[{label:"Keep trying",value:"retry_once",key:"retry_once"},{label:`Switch to ${t}`,value:"retry_always",key:"retry_always"},{label:"Stop",value:"retry_later",key:"retry_later"}];let m=h=>{a(h)};return(0,wi.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,wi.jsx)(u,{marginBottom:1,children:(h=>{let p=h.split(/(\s+)/);return(0,wi.jsx)(l,{children:p.map((y,g)=>y.startsWith("/")?(0,wi.jsx)(l,{bold:!0,color:c.text.accent,children:y},g):(0,wi.jsx)(l,{children:y},g))})})(o)}),(0,wi.jsx)(u,{marginTop:1,marginBottom:1,children:(0,wi.jsx)(Ue,{items:d,onSelect:m})})]})}var ya=C(z(),1);var Ht=C(P(),1);function AR({validationLink:e,learnMoreUrl:t,onChoice:o}){let r=ze(),[n,s]=(0,ya.useState)("choosing"),[i,a]=(0,ya.useState)(""),d=[{label:"Verify your account",value:"verify",key:"verify"},{label:"Change authentication",value:"change_auth",key:"change_auth"}];de(f=>r["basic.cancel"](f)||r["basic.quit"](f)?(o("cancel"),!0):n==="waiting"&&r["basic.confirm"](f)?(s("complete"),!0):!1,{isActive:n!=="complete"}),(0,ya.useEffect)(()=>{if(n==="complete"){let f=setTimeout(()=>{o("verify")},500);return()=>clearTimeout(f)}},[n,o]);let m=(0,ya.useCallback)(async f=>{if(f==="verify")if(e){if(!$a()){a(`Please open this URL in a browser: ${e}`),s("waiting");return}try{await Va(e),s("waiting")}catch(h){a(h instanceof Error?h.message:"Failed to open browser"),s("error")}}else o("verify");else o(f)},[e,o]);return n==="error"?(0,Ht.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,Ht.jsx)(l,{color:c.status.error,children:i||"Failed to open verification link. Please try again or change authentication."}),(0,Ht.jsx)(u,{marginTop:1,children:(0,Ht.jsx)(Ue,{items:d,onSelect:f=>void m(f)})})]}):n==="waiting"?(0,Ht.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,Ht.jsxs)(u,{children:[(0,Ht.jsx)(Ro,{}),(0,Ht.jsxs)(l,{children:[" ","Waiting for verification... (Press Esc or Ctrl+C to cancel)"]})]}),i&&(0,Ht.jsx)(u,{marginTop:1,children:(0,Ht.jsx)(l,{children:i})}),(0,Ht.jsx)(u,{marginTop:1,children:(0,Ht.jsx)(l,{dimColor:!0,children:"Press Enter when verification is complete."})})]}):n==="complete"?(0,Ht.jsx)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:(0,Ht.jsx)(l,{color:c.status.success,children:"Verification complete"})}):(0,Ht.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,Ht.jsx)(u,{marginBottom:1,children:(0,Ht.jsx)(l,{children:"Further action is required to use this service."})}),(0,Ht.jsx)(u,{marginTop:1,marginBottom:1,children:(0,Ht.jsx)(Ue,{items:d,onSelect:f=>void m(f)})}),t&&(0,Ht.jsx)(u,{marginTop:1,children:(0,Ht.jsxs)(l,{dimColor:!0,children:["Learn more: ",(0,Ht.jsx)(l,{color:c.text.accent,children:t})]})})]})}var To=C(P(),1);function wR({failedModel:e,fallbackModel:t,resetTime:o,creditBalance:r,onChoice:n}){let s=[{label:"Use AI Credits - Continue this request (Overage)",value:"use_credits",key:"use_credits"},{label:"Manage - View balance and purchase more credits",value:"manage",key:"manage"}];return t&&s.push({label:`Switch to ${t}`,value:"use_fallback",key:"use_fallback"}),s.push({label:"Stop - Abort request",value:"stop",key:"stop"}),(0,To.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,To.jsxs)(u,{marginBottom:1,flexDirection:"column",children:[(0,To.jsxs)(l,{color:c.status.warning,children:["Usage limit reached for ",e,"."]}),o&&(0,To.jsxs)(l,{children:["Access resets at ",o,"."]}),(0,To.jsxs)(l,{children:[(0,To.jsx)(l,{bold:!0,color:c.text.accent,children:"/stats"})," ","model for usage details"]}),(0,To.jsxs)(l,{children:[(0,To.jsx)(l,{bold:!0,color:c.text.accent,children:"/model"})," ","to switch models."]}),(0,To.jsxs)(l,{children:[(0,To.jsx)(l,{bold:!0,color:c.text.accent,children:"/auth"})," ","to switch to API key."]})]}),(0,To.jsx)(u,{marginBottom:1,children:(0,To.jsxs)(l,{children:["You have"," ",(0,To.jsx)(l,{bold:!0,color:c.status.success,children:r})," ","AI Credits available."]})}),(0,To.jsx)(u,{marginBottom:1,children:(0,To.jsx)(l,{children:"How would you like to proceed?"})}),(0,To.jsx)(u,{marginTop:1,marginBottom:1,children:(0,To.jsx)(Ue,{items:s,onSelect:n})})]})}var io=C(P(),1);function _R({failedModel:e,fallbackModel:t,resetTime:o,onGetCredits:r,onChoice:n}){let s=[{label:"Get AI Credits - Open browser to purchase credits",value:"get_credits",key:"get_credits"}];t&&s.push({label:`Switch to ${t}`,value:"use_fallback",key:"use_fallback"}),s.push({label:"Stop - Abort request",value:"stop",key:"stop"});let i=a=>{a==="get_credits"&&r?.(),n(a)};return(0,io.jsxs)(u,{borderStyle:"round",flexDirection:"column",padding:1,children:[(0,io.jsxs)(u,{marginBottom:1,flexDirection:"column",children:[(0,io.jsxs)(l,{color:c.status.warning,children:["Usage limit reached for ",e,"."]}),o&&(0,io.jsxs)(l,{children:["Access resets at ",o,"."]}),(0,io.jsxs)(l,{children:[(0,io.jsx)(l,{bold:!0,color:c.text.accent,children:"/stats"})," ","model for usage details"]}),(0,io.jsxs)(l,{children:[(0,io.jsx)(l,{bold:!0,color:c.text.accent,children:"/model"})," ","to switch models."]}),(0,io.jsxs)(l,{children:[(0,io.jsx)(l,{bold:!0,color:c.text.accent,children:"/auth"})," ","to switch to API key."]})]}),(0,io.jsx)(u,{marginBottom:1,children:(0,io.jsx)(l,{children:"To continue using this model now, purchase more AI Credits."})}),(0,io.jsx)(u,{marginBottom:1,children:(0,io.jsx)(l,{dimColor:!0,children:"Newly purchased AI credits may take a few minutes to update."})}),(0,io.jsx)(u,{marginBottom:1,children:(0,io.jsx)(l,{children:"How would you like to proceed?"})}),(0,io.jsx)(u,{marginTop:1,marginBottom:1,children:(0,io.jsx)(Ue,{items:s,onSelect:i})})]})}var zt=C(z(),1);var He={get type(){return ot.getActiveTheme().colors.type},get Foreground(){return ot.getActiveTheme().colors.Foreground},get Background(){return ot.getColors().Background},get LightBlue(){return ot.getActiveTheme().colors.LightBlue},get AccentBlue(){return ot.getActiveTheme().colors.AccentBlue},get AccentPurple(){return ot.getActiveTheme().colors.AccentPurple},get AccentCyan(){return ot.getActiveTheme().colors.AccentCyan},get AccentGreen(){return ot.getActiveTheme().colors.AccentGreen},get AccentYellow(){return ot.getActiveTheme().colors.AccentYellow},get AccentRed(){return ot.getActiveTheme().colors.AccentRed},get DiffAdded(){return ot.getActiveTheme().colors.DiffAdded},get DiffRemoved(){return ot.getActiveTheme().colors.DiffRemoved},get Comment(){return ot.getActiveTheme().colors.Comment},get Gray(){return ot.getActiveTheme().colors.Gray},get DarkGray(){return ot.getColors().DarkGray},get InputBackground(){return ot.getColors().InputBackground},get MessageBackground(){return ot.getColors().MessageBackground},get GradientColors(){return ot.getActiveTheme().colors.GradientColors}};import FR from"node:path";var Gt=C(P(),1);var Cs=({name:e,shortcut:t})=>(0,Gt.jsxs)(Gt.Fragment,{children:[e,": ",(0,Gt.jsx)(l,{bold:!0,children:t})]}),DR=()=>(0,Gt.jsxs)(u,{flexDirection:"column",children:[(0,Gt.jsxs)(l,{color:He.Gray,children:[(0,Gt.jsx)(Cs,{name:"Navigate",shortcut:"\u2191/\u2193"})," ",(0,Gt.jsx)(Cs,{name:"Resume",shortcut:"Enter"})," ",(0,Gt.jsx)(Cs,{name:"Search",shortcut:"/"})," ",(0,Gt.jsx)(Cs,{name:"Delete",shortcut:"x"})," ",(0,Gt.jsx)(Cs,{name:"Quit",shortcut:"q"})]}),(0,Gt.jsxs)(l,{color:He.Gray,children:[(0,Gt.jsx)(Cs,{name:"Sort",shortcut:"s"})," ",(0,Gt.jsx)(Cs,{name:"Reverse",shortcut:"r"})," ",(0,Gt.jsx)(Cs,{name:"First/Last",shortcut:"g/G"})]})]}),MR=({state:e})=>(0,Gt.jsxs)(u,{marginTop:1,children:[(0,Gt.jsx)(l,{color:He.Gray,children:"Search: "}),(0,Gt.jsx)(l,{color:He.AccentPurple,children:e.searchQuery}),(0,Gt.jsx)(l,{color:He.Gray,children:" (Esc to cancel)"})]}),PR=({state:e})=>(0,Gt.jsx)(u,{marginTop:1,children:(0,Gt.jsxs)(l,{color:He.Gray,dimColor:!0,children:["No sessions found matching '",e.searchQuery,"'."]})});var dm=C(P(),1);var OR=({state:e})=>(0,dm.jsxs)(u,{flexDirection:"row",justifyContent:"space-between",children:[(0,dm.jsxs)(l,{color:He.AccentPurple,children:["Chat Sessions (",e.totalSessions," total",e.searchQuery?", filtered":"",")"]}),(0,dm.jsxs)(l,{color:He.Gray,children:["sorted by ",e.sortOrder," ",e.sortReverse?"asc":"desc"]})]});var Zf=C(P(),1);var LR=()=>(0,Zf.jsx)(u,{flexDirection:"column",paddingX:1,children:(0,Zf.jsx)(l,{color:He.Gray,children:"Loading sessions\u2026"})});var Pc=C(P(),1);var NR=({state:e})=>(0,Pc.jsxs)(u,{flexDirection:"column",paddingX:1,children:[(0,Pc.jsxs)(l,{color:He.AccentRed,children:["Error: ",e.error]}),(0,Pc.jsx)(l,{color:He.Gray,children:"Press q to exit"})]});var Oc=C(P(),1);var BR=()=>(0,Oc.jsxs)(u,{flexDirection:"column",paddingX:1,children:[(0,Oc.jsx)(l,{color:He.Gray,children:"No auto-saved conversations found."}),(0,Oc.jsx)(l,{color:He.Gray,children:"Press q to exit"})]});var kR=(e,t,o)=>{let r=[...e].sort((n,s)=>{switch(t){case"date":return new Date(s.lastUpdated).getTime()-new Date(n.lastUpdated).getTime();case"messages":return s.messageCount-n.messageCount;case"name":return n.displayName.localeCompare(s.displayName);default:return 0}});return o?r.reverse():r},UM=(e,t)=>{if(!t.trim())return[];let o=t.toLowerCase(),r=[];for(let n of e){let s=cS(n.content),i=s.toLowerCase(),a=0;for(;;){let d=i.indexOf(o,a);if(d===-1)break;let m=Math.max(0,d-10),f=Math.min(s.length,d+t.length+10),h=s.slice(m,f),p=d-m,y=p+t.length,g=h.slice(0,p),x=h.slice(p,y),S=h.slice(y);m>0&&(g="\u2026"+g),f<s.length&&(S=S+"\u2026"),r.push({before:g,match:x,after:S,role:n.role}),a=d+1}}return r},HR=(e,t)=>{if(!t.trim())return e.map(r=>({...r,matchSnippets:void 0,matchCount:void 0}));let o=t.toLowerCase();return e.filter(r=>{let n=r.displayName.toLowerCase().includes(o)||r.id.toLowerCase().includes(o)||r.firstUserMessage.toLowerCase().includes(o),s=r.fullContent?.toLowerCase().includes(o);return n||s?(r.messages&&(r.matchSnippets=UM(r.messages,t),r.matchCount=r.matchSnippets.length),!0):!1})};var we=C(P(),1);var bs=20,GM=30,WM=({state:e})=>(0,we.jsxs)(u,{flexDirection:"row",marginTop:1,children:[(0,we.jsx)(l,{children:e.scrollOffset>0?(0,we.jsx)(l,{children:"\u25B2 "}):" "}),(0,we.jsx)(u,{width:5,flexShrink:0,children:(0,we.jsx)(l,{color:He.Gray,bold:!0,children:"Index"})}),(0,we.jsx)(l,{color:He.Gray,children:" \u2502 "}),(0,we.jsx)(u,{width:4,flexShrink:0,children:(0,we.jsx)(l,{color:He.Gray,bold:!0,children:"Msgs"})}),(0,we.jsx)(l,{color:He.Gray,children:" \u2502 "}),(0,we.jsx)(u,{width:4,flexShrink:0,children:(0,we.jsx)(l,{color:He.Gray,bold:!0,children:"Age"})}),(0,we.jsx)(l,{color:He.Gray,children:" \u2502 "}),(0,we.jsx)(u,{flexShrink:0,children:(0,we.jsx)(l,{color:He.Gray,bold:!0,children:e.searchQuery?"Match":"Name"})})]}),VM=({session:e,textColor:t})=>{if(!e.matchSnippets||e.matchSnippets.length===0)return null;let o=e.matchSnippets[0],r=o.role==="user"?"You: ":"Gemini:",n=t(o.role==="user"?He.AccentGreen:He.AccentBlue);return(0,we.jsxs)(we.Fragment,{children:[(0,we.jsxs)(l,{color:n,bold:!0,children:[r," "]}),o.before,(0,we.jsx)(l,{color:t(He.AccentRed),bold:!0,children:o.match}),o.after]})},$M=({session:e,state:t,terminalWidth:o,formatRelativeTime:r})=>{let n=t.startIndex+t.visibleSessions.indexOf(e),s=n===t.activeIndex,i=e.isCurrentSession,a=(g=He.Foreground)=>i?He.Gray:s?c.ui.focus:g,d=s?"\u276F ":" ",m="",f=null;e.isCurrentSession&&(m=" (current)"),t.searchQuery&&e.matchSnippets&&e.matchSnippets.length>0&&(f=(0,we.jsx)(VM,{session:e,textColor:a}),e.matchCount&&e.matchCount>1&&(m+=` (+${e.matchCount-1} more)`));let h=m?m.length+1:0,p=Math.max(20,o-GM-h),y=f||(e.displayName.length===0?(0,we.jsx)(l,{color:a(He.Gray),dimColor:!0,children:"(No messages)"}):e.displayName.length>p?e.displayName.slice(0,p-1)+"\u2026":e.displayName);return(0,we.jsxs)(u,{flexDirection:"row",backgroundColor:s?c.background.focus:void 0,children:[(0,we.jsx)(l,{color:a(),dimColor:i,children:d}),(0,we.jsx)(u,{width:5,children:(0,we.jsxs)(l,{color:a(),dimColor:i,children:["#",n+1]})}),(0,we.jsxs)(l,{color:a(He.Gray),dimColor:i,children:[" ","\u2502"," "]}),(0,we.jsx)(u,{width:4,children:(0,we.jsx)(l,{color:a(),dimColor:i,children:e.messageCount})}),(0,we.jsxs)(l,{color:a(He.Gray),dimColor:i,children:[" ","\u2502"," "]}),(0,we.jsx)(u,{width:4,children:(0,we.jsx)(l,{color:a(),dimColor:i,children:r(e.lastUpdated,"short")})}),(0,we.jsxs)(l,{color:a(He.Gray),dimColor:i,children:[" ","\u2502"," "]}),(0,we.jsx)(u,{flexGrow:1,children:(0,we.jsxs)(l,{color:a(He.Comment),dimColor:i,children:[y,m&&(0,we.jsx)(l,{color:a(He.Gray),dimColor:!0,bold:!1,children:m})]})})]})},qM=({state:e,formatRelativeTime:t})=>(0,we.jsxs)(u,{flexDirection:"column",children:[(0,we.jsxs)(u,{flexDirection:"column",children:[!e.isSearchMode&&(0,we.jsx)(DR,{}),(0,we.jsx)(WM,{state:e})]}),e.visibleSessions.map(o=>(0,we.jsx)($M,{session:o,state:e,terminalWidth:e.terminalWidth,formatRelativeTime:t},o.id)),(0,we.jsx)(l,{color:He.Gray,children:e.endIndex<e.totalSessions?(0,we.jsx)(we.Fragment,{children:"\u25BC"}):(0,we.jsx)(l,{dimColor:!0,children:"\u25BC"})})]}),KM=(e=[],t=!0,o=null)=>{let{columns:r}=ti(),[n,s]=(0,zt.useState)(e),[i,a]=(0,zt.useState)(t),[d,m]=(0,zt.useState)(o),[f,h]=(0,zt.useState)(0),[p,y]=(0,zt.useState)(0),[g,x]=(0,zt.useState)("date"),[S,I]=(0,zt.useState)(!1),[A,E]=(0,zt.useState)(""),[T,v]=(0,zt.useState)(!1),[R,b]=(0,zt.useState)(!1),_=(0,zt.useRef)(!1),w=(0,zt.useMemo)(()=>{let L=HR(n,A);return kR(L,g,S)},[n,A,g,S]);(0,zt.useEffect)(()=>{A||(b(!1),_.current=!1)},[A]);let M=w.length,D=p,N=Math.min(p+bs,M),O=w.slice(D,N);return{sessions:n,setSessions:s,loading:i,setLoading:a,error:d,setError:m,activeIndex:f,setActiveIndex:h,scrollOffset:p,setScrollOffset:y,searchQuery:A,setSearchQuery:E,isSearchMode:T,setIsSearchMode:v,hasLoadedFullContent:R,setHasLoadedFullContent:b,sortOrder:g,setSortOrder:x,sortReverse:S,setSortReverse:I,terminalWidth:r,filteredAndSortedSessions:w,totalSessions:M,startIndex:D,endIndex:N,visibleSessions:O}},jM=(e,t)=>{let{setSessions:o,setLoading:r,setError:n,isSearchMode:s,hasLoadedFullContent:i,setHasLoadedFullContent:a}=t;(0,zt.useEffect)(()=>{(async()=>{try{let m=FR.join(e.storage.getProjectTempDir(),"chats"),f=await af(m,e.getSessionId());o(f),r(!1)}catch(m){n(m instanceof Error?m.message:"Failed to load sessions"),r(!1)}})()},[e,o,r,n]),(0,zt.useEffect)(()=>{(async()=>{if(s&&!i)try{let m=FR.join(e.storage.getProjectTempDir(),"chats"),f=await af(m,e.getSessionId(),{includeFullContent:!0});o(f),a(!0)}catch(m){n(m instanceof Error?m.message:"Failed to load full session content")}})()},[s,i,e,o,a,n])},zM=e=>{let{totalSessions:t,activeIndex:o,scrollOffset:r,setActiveIndex:n,setScrollOffset:s}=e;return(0,zt.useCallback)(i=>{let a=Math.max(0,Math.min(t-1,o+i));n(a),a<r?s(a):a>=r+bs&&s(a-bs+1)},[t,o,r,n,s])},YM=e=>{let{sortOrder:t,setSortOrder:o}=e;return(0,zt.useCallback)(()=>{let r=["date","messages","name"],s=(r.indexOf(t)+1)%r.length;o(r[s])},[t,o])},XM=(e,t,o,r,n,s)=>{de(i=>{if(e.isSearchMode){if(i.name==="escape")return e.setIsSearchMode(!1),e.setSearchQuery(""),e.setActiveIndex(0),e.setScrollOffset(0),!0;if(i.name==="backspace")return e.setSearchQuery(a=>a.slice(0,-1)),e.setActiveIndex(0),e.setScrollOffset(0),!0;if(i.name==="enter"){let a=e.filteredAndSortedSessions[e.activeIndex];return a&&!a.isCurrentSession&&r(a),!0}else if(i.sequence&&i.sequence.length===1&&!i.alt&&!i.ctrl&&!i.cmd)return e.setSearchQuery(a=>a+i.sequence),e.setActiveIndex(0),e.setScrollOffset(0),!0}else{if(i.sequence==="g")return e.setActiveIndex(0),e.setScrollOffset(0),!0;if(i.sequence==="G")return e.setActiveIndex(e.totalSessions-1),e.setScrollOffset(Math.max(0,e.totalSessions-bs)),!0;if(i.sequence==="s")return o(),!0;if(i.sequence==="r")return e.setSortReverse(!e.sortReverse),!0;if(i.sequence==="/")return e.setIsSearchMode(!0),!0;if(i.sequence==="q"||i.sequence==="Q"||i.name==="escape")return s(),!0;if(i.sequence==="x"||i.sequence==="X"){let a=e.filteredAndSortedSessions[e.activeIndex];return a&&!a.isCurrentSession&&n(a).then(()=>{e.setSessions(e.sessions.filter(d=>d.id!==a.id)),e.activeIndex>=e.filteredAndSortedSessions.length-1&&e.setActiveIndex(Math.max(0,e.filteredAndSortedSessions.length-2))}).catch(d=>{e.setError(`Failed to delete session: ${d instanceof Error?d.message:"Unknown error"}`)}),!0}else{if(i.sequence==="u")return t(-Math.round(bs/2)),!0;if(i.sequence==="d")return t(Math.round(bs/2)),!0}}if(i.name==="enter"&&e.filteredAndSortedSessions[e.activeIndex]){let a=e.filteredAndSortedSessions[e.activeIndex];return a.isCurrentSession||r(a),!0}else{if(i.name==="up")return t(-1),!0;if(i.name==="down")return t(1),!0;if(i.name==="pageup")return t(-bs),!0;if(i.name==="pagedown")return t(bs),!0}return!1},{isActive:!0})};function QM({state:e}){return e.loading?(0,we.jsx)(LR,{}):e.error?(0,we.jsx)(NR,{state:e}):e.sessions.length===0?(0,we.jsx)(BR,{}):(0,we.jsxs)(u,{flexDirection:"column",paddingX:1,children:[(0,we.jsx)(OR,{state:e}),e.isSearchMode&&(0,we.jsx)(MR,{state:e}),e.totalSessions===0?(0,we.jsx)(PR,{state:e}):(0,we.jsx)(qM,{state:e,formatRelativeTime:uS})]})}function UR({config:e,onResumeSession:t,onDeleteSession:o,onExit:r}){let n=KM();jM(e,n);let s=zM(n),i=YM(n);return XM(n,s,i,t,o,r),(0,we.jsx)(QM,{state:n})}var hr=C(z(),1);var WR=C(z(),1);var Lc=C(P(),1);var GR=({value:e,width:t,warningThreshold:o=80})=>{let r=Math.min(Math.max(e,0),100),n=Math.ceil(r/100*t),s=t-n,i=c.status.success;return r>=100?i=c.status.error:r>=o&&(i=c.status.warning),(0,Lc.jsxs)(u,{flexDirection:"row",children:[(0,Lc.jsx)(l,{color:i,children:"\u25AC".repeat(n)}),(0,Lc.jsx)(l,{color:c.border.default,children:"\u25AC".repeat(s)})]})};var No=C(P(),1);var JM=({row:e,availableWidth:t})=>{let{terminalWidth:o}=Se(),r=12,n=4,s=26,i=e.usedPercentage,a=e.name,d=`${i.toFixed(0)}%`.padEnd(n),m=e.resetTime?fc(e.resetTime,"column").slice(0,s).padEnd(s):"".padEnd(s),f=r,h=n+1,p=s+1,y=f+h+p,g=t??o,x=t!=null?0:4,I=Math.max(0,g-x-y-3),A=c.text.primary;return i>=100?A=c.status.error:i>=80&&(A=c.status.warning),(0,No.jsxs)(u,{flexDirection:"row",width:"100%",children:[(0,No.jsx)(u,{width:r,children:(0,No.jsx)(l,{color:c.text.primary,wrap:"truncate-end",children:a})}),(0,No.jsx)(u,{flexGrow:1,children:(0,No.jsx)(GR,{value:i,width:I})}),(0,No.jsx)(u,{width:4,marginLeft:1,children:(0,No.jsx)(l,{color:A,children:d})}),(0,No.jsx)(u,{width:s,marginLeft:1,children:(0,No.jsx)(l,{color:c.text.secondary,children:m.trim()?`Resets: ${m}`:""})})]})},VR=({buckets:e,availableWidth:t,modelsToShow:o=["all"],title:r="Model usage"})=>{let n=ht(),s=(0,WR.useMemo)(()=>{if(!e)return[];let i=e.filter(d=>d.modelId&&d.remainingFraction!=null);if(o.includes("current")){let d=n.getActiveModel?.()??n.getModel?.();i=i.filter(m=>m.modelId===d)}else o.includes("all")||(i=i.filter(d=>d.modelId&&o.includes(d.modelId)));let a=new Map;return i.forEach(d=>{let m=d.modelId,f=d.remainingFraction;if(!m||f==null)return;let h=n?.modelConfigService?.getModelDefinition(m)?.tier,p=h??m,y=a.get(p);if(!y||f<y.remainingFraction){let x=h?{pro:"Pro",flash:"Flash","flash-lite":"Flash Lite"}[h]??h:Mt(m,n);a.set(p,{modelId:m,remainingFraction:f,resetTime:d.resetTime,name:x})}}),Array.from(a.entries()).map(([d,m])=>{let f=1-m.remainingFraction,h=f*100;return{modelId:d,name:m.name,usedFraction:f,usedPercentage:h,resetTime:m.resetTime}})},[e,n,o]);return s.length===0?null:(0,No.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,No.jsx)(u,{borderStyle:"single",borderTop:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderColor:c.border.default}),(0,No.jsxs)(u,{flexDirection:"column",children:[(0,No.jsx)(u,{marginBottom:1,children:(0,No.jsx)(l,{bold:!0,color:c.text.primary,children:r})}),s.map(i=>(0,No.jsx)(JM,{row:i,availableWidth:t},i.modelId))]})]})};var El=C(P(),1);function Nc({items:e,initialIndex:t=0,onSelect:o,onHighlight:r,isFocused:n=!0,showNumbers:s=!1,showScrollArrows:i=!1,maxItemsToShow:a=10}){return(0,El.jsx)(ad,{items:e,initialIndex:t,onSelect:o,onHighlight:r,isFocused:n,showNumbers:s,showScrollArrows:i,maxItemsToShow:a,renderItem:(d,{titleColor:m})=>(0,El.jsxs)(u,{flexDirection:"column",children:[(0,El.jsx)(l,{color:m,children:d.title}),d.description&&(0,El.jsx)(l,{color:c.text.secondary,children:d.description})]},d.key)})}var Yo=C(P(),1);function $R({onClose:e}){let t=(0,hr.useContext)(ld),o=We(),{terminalWidth:r}=Se(),[n,s]=(0,hr.useState)(()=>!(t?.getProModelNoAccessSync()??!1)),[i,a]=(0,hr.useState)(()=>t?.getProModelNoAccessSync()?"manual":"main"),[d,m]=(0,hr.useState)(!1);(0,hr.useEffect)(()=>{async function R(){if(!t)return;let b=await t.getProModelNoAccess();s(!b),b&&a("manual")}R()},[t]);let f=t?.getModel()||lc,h=t?.getHasAccessToPreviewModel(),p=t?.getGemini31LaunchedSync?.()??!1,y=t?.getGemini31FlashLiteLaunchedSync?.()??!1,g=o.merged.security.auth.selectedType,x=p&&g==="gemini-api-key",S=(0,hr.useMemo)(()=>{if(t?.getExperimentalDynamicModelConfiguration?.()===!0&&t.getModelConfigService){let b=t.getModelConfigService().getModelDefinition(f);return b&&b.tier!=="auto"&&b.isVisible===!0?f:""}return[sc,Xi,ac,Gp,Wp,Vp,ic,nc].includes(f)?f:""},[f,t]);de(R=>R.name==="escape"?(i==="manual"&&n?a("main"):e(),!0):R.name==="tab"?(m(b=>!b),!0):!1,{isActive:!0});let I=(0,hr.useMemo)(()=>{if(t?.getExperimentalDynamicModelConfiguration?.()===!0&&t.getModelConfigService){let _=t.getModelConfigService().getAvailableModelOptions({useGemini3_1:p,useGemini3_1FlashLite:y,useCustomTools:x,hasAccessToPreview:h,hasAccessToProModel:n}).filter(w=>w.tier==="auto").map(w=>({value:w.modelId,title:w.name,description:w.description,key:w.modelId}));return _.push({value:"Manual",title:S?`Manual (${Mt(S,t??void 0)})`:"Manual",description:"Manually select a model",key:"Manual"}),_}let R=[{value:lc,title:Mt(lc),description:"Let Gemini CLI decide the best model for the task: gemini-2.5-pro, gemini-2.5-flash",key:lc},{value:"Manual",title:S?`Manual (${Mt(S)})`:"Manual",description:"Manually select a model",key:"Manual"}];return h&&R.unshift({value:Lu,title:Mt(Lu),description:p?"Let Gemini CLI decide the best model for the task: gemini-3.1-pro, gemini-3-flash":"Let Gemini CLI decide the best model for the task: gemini-3-pro, gemini-3-flash",key:Lu}),R},[t,h,S,p,y,x,n]),A=(0,hr.useMemo)(()=>{if(t?.getExperimentalDynamicModelConfiguration?.()===!0&&t.getModelConfigService)return t.getModelConfigService().getAvailableModelOptions({useGemini3_1:p,useGemini3_1FlashLite:y,useCustomTools:x,hasAccessToPreview:h,hasAccessToProModel:n}).filter(w=>w.tier!=="auto").map(w=>({value:w.modelId,title:w.name,key:w.modelId}));let R=t?.getExperimentalGemma()??!1,b=[{value:sc,title:Mt(sc),key:sc},{value:Xi,title:Mt(Xi),key:Xi},{value:ac,title:Mt(ac),key:ac}];if(R&&b.push({value:Pu,title:Mt(Pu),key:Pu},{value:Ou,title:Mt(Ou),key:Ou}),h){let _=p?Wp:Gp,M=[{value:x?Vp:_,title:Mt(_),key:_},{value:nc,title:Mt(nc),key:nc}];y&&M.push({value:ic,title:Mt(ic),key:ic}),b.unshift(...M)}return n?b:b.filter(_=>!Nu(_.value))},[h,p,y,x,n,t]),E=i==="main"?I:A,T=(0,hr.useMemo)(()=>{let R=E.findIndex(b=>b.value===f);if(R!==-1)return R;if(i==="main"){let b=E.findIndex(_=>_.value==="Manual");return b!==-1?b:0}return 0},[f,E,i]),v=(0,hr.useCallback)(R=>{if(R==="Manual"){a("manual");return}if(t){t.setModel(R,!d);let b=new AT(R);zT(t,b)}e()},[t,e,d]);return(0,Yo.jsxs)(u,{borderStyle:"round",borderColor:c.border.default,flexDirection:"column",padding:1,width:"100%",children:[(0,Yo.jsx)(l,{bold:!0,children:"Select Model"}),(0,Yo.jsx)(u,{marginTop:1,children:(0,Yo.jsx)(Nc,{items:E,onSelect:v,initialIndex:T,showNumbers:!0})}),(0,Yo.jsx)(u,{marginTop:1,flexDirection:"column",children:(0,Yo.jsxs)(u,{children:[(0,Yo.jsxs)(l,{bold:!0,color:c.text.primary,children:["Remember model for future sessions:"," "]}),(0,Yo.jsx)(l,{color:c.status.success,children:d?"true":"false"}),(0,Yo.jsx)(l,{color:c.text.secondary,children:" (Press Tab to toggle)"})]})}),(0,Yo.jsx)(u,{flexDirection:"column",children:(0,Yo.jsx)(l,{color:c.text.secondary,children:"> To use a specific Gemini model on startup, use the --model flag."})}),(0,Yo.jsx)(VR,{buckets:t?.getLastRetrievedQuota()?.buckets,availableWidth:r-2}),(0,Yo.jsx)(u,{marginTop:1,flexDirection:"column",children:(0,Yo.jsx)(l,{color:c.text.secondary,children:"(Press Esc to close)"})})]})}var yr=C(z(),1);var Zt=C(P(),1);var ZM=[{value:"ggml-tiny.en.bin",label:"Tiny (EN)",description:"Fastest, lower accuracy (~75MB)"},{value:"ggml-base.en.bin",label:"Base (EN)",description:"Balanced speed and accuracy (~142MB)"},{value:"ggml-large-v3-turbo-q5_0.bin",label:"Large v3 Turbo (Q5_0)",description:"High accuracy, quantized (~547MB)"},{value:"ggml-large-v3-turbo-q8_0.bin",label:"Large v3 Turbo (Q8_0)",description:"Maximum accuracy, high memory (~834MB)"}];function qR({onClose:e}){let{settings:t,setSetting:o}=id(),[r,n]=(0,yr.useState)("backend"),[s,i]=(0,yr.useState)(null),[a,d]=(0,yr.useState)(null),m=(0,yr.useMemo)(()=>Hx("whisper-stream"),[]),f=(0,yr.useMemo)(()=>new kx,[]),h=t.merged.experimental.voice?.backend??"gemini-live",p=t.merged.experimental.voice?.whisperModel??"ggml-base.en.bin",[y,g]=(0,yr.useState)(h),x=(0,yr.useCallback)(v=>v.name==="escape"?(r==="whisper-models"?n("backend"):e(),!0):!1,[r,e]);de(x,{isActive:!0});let S=(0,yr.useCallback)(v=>{v==="whisper"?n("whisper-models"):(o("User","experimental.voice.backend","gemini-live"),e())},[o,e]),I=(0,yr.useCallback)(v=>{g(v)},[]),A=(0,yr.useCallback)(async v=>{if(f.isModelInstalled(v))o("User","experimental.voice.backend","whisper"),o("User","experimental.voice.whisperModel",v),e();else{d(null);let R=b=>i(b);f.on("progress",R);try{await f.downloadModel(v),o("User","experimental.voice.backend","whisper"),o("User","experimental.voice.whisperModel",v),e()}catch(b){d(`Failed to download: ${b instanceof Error?b.message:String(b)}`)}finally{f.off("progress",R),i(null)}}},[f,o,e]),E=(0,yr.useMemo)(()=>[{value:"gemini-live",title:"Gemini Live API (Cloud)",description:"Real-time cloud transcription via Gemini Live API.",key:"gemini-live"},{value:"whisper",title:"Whisper (Local)",description:m?"Local transcription using whisper.cpp.":"Local transcription (Requires: brew install whisper-cpp)",key:"whisper"}],[m]),T=(0,yr.useMemo)(()=>ZM.map(v=>({value:v.value,title:`${v.label}${f.isModelInstalled(v.value)?" (Installed)":" (Download)"}`,description:v.description,key:v.value})),[f]);return(0,Zt.jsxs)(u,{borderStyle:"round",borderColor:c.border.default,flexDirection:"column",padding:1,width:"100%",children:[(0,Zt.jsx)(l,{bold:!0,children:r==="backend"?"Select Voice Transcription Backend":"Select Whisper Model"}),a&&(0,Zt.jsx)(u,{marginTop:1,children:(0,Zt.jsx)(l,{color:c.status.error,children:a})}),s?(0,Zt.jsx)(u,{marginTop:1,flexDirection:"column",children:(0,Zt.jsxs)(u,{children:[(0,Zt.jsxs)(l,{children:["Downloading ",s.modelName,"... "]}),(0,Zt.jsx)(Ro,{}),(0,Zt.jsxs)(l,{children:[" ",Math.round(s.percentage*100),"%"]})]})}):(0,Zt.jsx)(u,{marginTop:1,flexDirection:"column",children:r==="backend"?(0,Zt.jsxs)(Zt.Fragment,{children:[(0,Zt.jsx)(Nc,{items:E,onSelect:S,onHighlight:I,initialIndex:h==="whisper"?1:0,showNumbers:!0}),y==="gemini-live"&&(0,Zt.jsx)(u,{marginTop:1,children:(0,Zt.jsx)(hl,{text:"When using the Gemini Live backend, voice recordings are sent to Google Cloud for transcription. Enterprise users should verify this aligns with their data privacy and compliance requirements."})})]}):(0,Zt.jsx)(Nc,{items:T,onSelect:A,initialIndex:T.findIndex(v=>v.value===p),showNumbers:!0})}),(0,Zt.jsx)(u,{marginTop:1,flexDirection:"column",children:(0,Zt.jsx)(l,{color:c.text.secondary,children:r==="whisper-models"?"(Press Esc to go back)":"(Press Esc to close)"})})]})}import eP from"node:process";var mm=C(P(),1);var KR=()=>{let e=ze(),{handleRestart:t}=Ir();return de(r=>e["app.restart"](r)?(t(),!0):!1,{isActive:!0}),(0,mm.jsx)(u,{borderStyle:"round",borderColor:c.status.warning,paddingX:1,children:(0,mm.jsxs)(l,{color:c.status.warning,children:["Admin settings have changed. Please restart the session to apply new settings."," Press 'r' to restart, or 'Ctrl+C' twice to exit."]})})};var pm=C(P(),1);var jR=({reason:e})=>{de(o=>o.name==="r"||o.name==="R"?(sr(),!0):!1,{isActive:!0});let t="Workspace trust has changed.";return e==="NONE"?ue.warn('IdeTrustChangeDialog rendered with unexpected reason "NONE"'):e==="CONNECTION_CHANGE"?t="Workspace trust has changed due to a change in the IDE connection.":e==="TRUST_CHANGE"&&(t="Workspace trust has changed due to a change in the IDE trust."),(0,pm.jsx)(u,{borderStyle:"round",borderColor:c.status.warning,paddingX:1,children:(0,pm.jsxs)(l,{color:c.status.warning,children:[t," Press 'r' to restart Gemini to apply the changes."]})})};var Tr=C(z(),1);var tg=C(P(),1);var Bc=[{key:"enabled",label:"Enabled",description:"Enable or disable this agent",type:"boolean",path:["enabled"],defaultValue:!0},{key:"model",label:"Model",description:"Model to use (e.g., 'gemini-2.0-flash' or 'inherit')",type:"string",path:["modelConfig","model"],defaultValue:"inherit"},{key:"temperature",label:"Temperature",description:"Sampling temperature (0.0 to 2.0)",type:"number",path:["modelConfig","generateContentConfig","temperature"],defaultValue:void 0},{key:"topP",label:"Top P",description:"Nucleus sampling parameter (0.0 to 1.0)",type:"number",path:["modelConfig","generateContentConfig","topP"],defaultValue:void 0},{key:"topK",label:"Top K",description:"Top-K sampling parameter",type:"number",path:["modelConfig","generateContentConfig","topK"],defaultValue:void 0},{key:"maxOutputTokens",label:"Max Output Tokens",description:"Maximum number of tokens to generate",type:"number",path:["modelConfig","generateContentConfig","maxOutputTokens"],defaultValue:void 0},{key:"maxTimeMinutes",label:"Max Time (minutes)",description:"Maximum execution time in minutes",type:"number",path:["runConfig","maxTimeMinutes"],defaultValue:void 0},{key:"maxTurns",label:"Max Turns",description:"Maximum number of conversational turns",type:"number",path:["runConfig","maxTurns"],defaultValue:void 0}];function eg(e,t,o){if(!od(e))return e;let r={...e},n=r;for(let i=0;i<t.length-1;i++){let a=t[i];n[a]===void 0||n[a]===null?n[a]={}:od(n[a])&&(n[a]={...n[a]});let d=n[a];if(od(d))n=d;else return r}let s=t[t.length-1];return o===void 0?delete n[s]:n[s]=o,r}function zR(e,t){return t.kind!=="local"?e.defaultValue:e.key==="enabled"?!t.experimental:e.key==="model"?t.modelConfig?.model??"inherit":e.key==="temperature"?t.modelConfig?.generateContentConfig?.temperature:e.key==="topP"?t.modelConfig?.generateContentConfig?.topP:e.key==="topK"?t.modelConfig?.generateContentConfig?.topK:e.key==="maxOutputTokens"?t.modelConfig?.generateContentConfig?.maxOutputTokens:e.key==="maxTimeMinutes"?t.runConfig?.maxTimeMinutes:e.key==="maxTurns"?t.runConfig?.maxTurns:e.defaultValue}function YR({agentName:e,displayName:t,definition:o,settings:r,onClose:n,onSave:s,availableTerminalHeight:i}){let[a,d]=(0,Tr.useState)("User"),[m,f]=(0,Tr.useState)(()=>{let R=r.forScope(a).settings.agents?.overrides?.[e];return R?structuredClone(R):{}}),[h,p]=(0,Tr.useState)(new Set);(0,Tr.useEffect)(()=>{let R=r.forScope(a).settings.agents?.overrides?.[e];f(R?structuredClone(R):{}),p(new Set)},[a,r,e]);let y=(0,Tr.useCallback)((v,R,b)=>{if(["__proto__","constructor","prototype"].includes(e))return;let _=["agents","overrides",e,...R].join(".");r.setValue(a,_,b),s?.()},[r,a,e,s]),g=(0,Tr.useMemo)(()=>{let v=0;for(let R of Bc){let b=kr(R.label),_=kr(R.description);v=Math.max(v,b,_)}return v},[]),x=(0,Tr.useMemo)(()=>Bc.map(v=>{let R=lf(m,v.path),b=zR(v,o),_=R!==void 0?R:b,w;v.type==="boolean"?w=_?"true":"false":_!=null?w=String(_):w="(default)",(h.has(v.key)||R!==void 0)&&R!==void 0&&(w+="*");let D=R!==void 0?R:_;return{key:v.key,label:v.label,description:v.description,type:v.type,displayValue:w,isGreyedOut:R===void 0,scopeMessage:void 0,rawValue:D}}),[m,o,h]),S=8,I=(0,Tr.useCallback)(v=>{d(v)},[]),A=(0,Tr.useCallback)((v,R)=>{let b=Bc.find(O=>O.key===v);if(!b||b.type!=="boolean")return;let _=lf(m,b.path),w=zR(b,o),D=!(_!==void 0?_:w),N=eg(m,b.path,D);f(N),p(O=>new Set(O).add(v)),y(b.key,b.path,D)},[m,o,y]),E=(0,Tr.useCallback)((v,R,b)=>{let _=Bc.find(D=>D.key===v);if(!_)return;let w;if(_.type==="number")if(R.trim()==="")w=void 0;else{let D=Number(R.trim());if(Number.isNaN(D))return;w=D}else w=R.trim()===""?void 0:R;let M=eg(m,_.path,w);f(M),p(D=>new Set(D).add(v)),y(_.key,_.path,w)},[m,y]),T=(0,Tr.useCallback)((v,R)=>{let b=Bc.find(w=>w.key===v);if(!b)return;let _=eg(m,b.path,void 0);f(_),p(w=>{let M=new Set(w);return M.delete(v),M}),y(b.key,b.path,void 0)},[m,y]);return(0,tg.jsx)(am,{title:`Configure: ${t}`,searchEnabled:!1,items:x,showScopeSelector:!0,selectedScope:a,onScopeChange:I,maxItemsToShow:S,availableHeight:i,maxLabelWidth:g,onItemToggle:A,onEditCommit:E,onItemClear:T,onClose:n,footer:h.size>0?{content:(0,tg.jsx)(l,{color:c.text.secondary,children:"Changes saved automatically."}),height:1}:void 0})}var fm=C(z(),1);var _i=C(P(),1);var XR=({config:e,request:t,onClose:o})=>{let r=ze(),n=(0,fm.useRef)(!1),s=(0,fm.useCallback)(async a=>{if(!n.current){n.current=!0;try{a==="accept"&&(await new Cx().acceptIntegrity(t.scope,t.identifier,t.newHash),await e.loadWorkspacePolicies(t.policyDir)),o()}finally{n.current=!1}}},[e,t,o]);de(a=>r["basic.cancel"](a)?(o(),!0):!1,{isActive:!0});let i=[{label:"Accept and Load",value:"accept",key:"accept"},{label:"Ignore (Use Default Policies)",value:"ignore",key:"ignore"}];return(0,_i.jsx)(u,{flexDirection:"column",width:"100%",children:(0,_i.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.status.warning,padding:1,marginLeft:1,marginRight:1,children:[(0,_i.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,_i.jsxs)(l,{bold:!0,color:c.text.primary,children:["New or changed ",t.scope," policies detected"]}),(0,_i.jsxs)(l,{color:c.text.primary,children:["Location: ",t.identifier]}),(0,_i.jsx)(l,{color:c.text.primary,children:"Do you want to accept and load these policies?"})]}),(0,_i.jsx)(Ue,{items:i,onSelect:s,isFocused:!0})]})})};var kc=C(P(),1);var QR=({onDismiss:e,config:t,message:o})=>{de(n=>n.name==="escape"?(e(),!0):n.name==="r"||n.name==="R"?(setTimeout(async()=>{if(process.send){let s=t.getRemoteAdminSettings();s&&process.send({type:"admin-settings-update",settings:s})}await sr()},100),!0):!1,{isActive:!0});let r=o??"You've successfully signed in with Google. Gemini CLI needs to be restarted.";return(0,kc.jsxs)(u,{borderStyle:"round",borderColor:c.status.warning,paddingX:1,flexDirection:"column",children:[(0,kc.jsx)(l,{color:c.status.warning,children:r}),(0,kc.jsx)(l,{color:c.status.warning,children:"Press R to restart, or Esc to choose a different authentication method."})]})};var Ge=C(P(),1);var gm=({addItem:e,terminalWidth:t})=>{let o=ht(),r=We(),n=Se(),s=fd(),i=Ir(),{constrainHeight:a,terminalHeight:d,staticExtraHeight:m,terminalWidth:f}=n;if(n.adminSettingsChanged)return(0,Ge.jsx)(KR,{});if(n.showIdeRestartPrompt)return(0,Ge.jsx)(jR,{reason:n.ideTrustRestartReason});if(n.newAgents)return(0,Ge.jsx)(Ob,{agents:n.newAgents,onSelect:i.handleNewAgentsSelect});if(s.proQuotaRequest)return(0,Ge.jsx)(vR,{failedModel:s.proQuotaRequest.failedModel,fallbackModel:s.proQuotaRequest.fallbackModel,message:s.proQuotaRequest.message,isTerminalQuotaError:s.proQuotaRequest.isTerminalQuotaError,isModelNotFoundError:!!s.proQuotaRequest.isModelNotFoundError,authType:s.proQuotaRequest.authType,tierName:o?.getUserTierName(),onChoice:i.handleProQuotaChoice});if(s.validationRequest)return(0,Ge.jsx)(AR,{validationLink:s.validationRequest.validationLink,validationDescription:s.validationRequest.validationDescription,learnMoreUrl:s.validationRequest.learnMoreUrl,onChoice:i.handleValidationChoice});if(s.overageMenuRequest)return(0,Ge.jsx)(wR,{failedModel:s.overageMenuRequest.failedModel,fallbackModel:s.overageMenuRequest.fallbackModel,resetTime:s.overageMenuRequest.resetTime,creditBalance:s.overageMenuRequest.creditBalance,onChoice:i.handleOverageMenuChoice});if(s.emptyWalletRequest)return(0,Ge.jsx)(_R,{failedModel:s.emptyWalletRequest.failedModel,fallbackModel:s.emptyWalletRequest.fallbackModel,resetTime:s.emptyWalletRequest.resetTime,onGetCredits:s.emptyWalletRequest.onGetCredits,onChoice:i.handleEmptyWalletChoice});if(n.shouldShowIdePrompt)return(0,Ge.jsx)(vb,{ide:n.currentIDE,onComplete:i.handleIdePromptComplete});if(n.isFolderTrustDialogOpen)return(0,Ge.jsx)(Ab,{onSelect:i.handleFolderTrustSelect,isRestarting:n.isRestarting,discoveryResults:n.folderDiscoveryResults});if(n.isPolicyUpdateDialogOpen)return(0,Ge.jsx)(XR,{config:o,request:n.policyUpdateConfirmationRequest,onClose:()=>i.setIsPolicyUpdateDialogOpen(!1)});if(n.loopDetectionConfirmationRequest)return(0,Ge.jsx)(oR,{onComplete:n.loopDetectionConfirmationRequest.onComplete});if(n.permissionConfirmationRequest){let p=n.permissionConfirmationRequest.files.map(y=>`- ${y}`).join(`
61
61
  `);return(0,Ge.jsx)(_c,{prompt:`The following files are outside your workspace:
62
62
 
63
63
  ${p}
@@ -116,7 +116,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
116
116
  `),await sr())}Vo("authenticated")},[i,r,Vo,Nr,Hs]),Ih=(0,V.useCallback)(async U=>{try{if(Nr(null),!U.trim()){Nr("API key cannot be empty or whitespace only.");return}await cx(U),await mh(),await r.refreshAuth("gemini-api-key"),Vo("authenticated")}catch(fe){Nr(`Failed to save API key: ${fe instanceof Error?fe.message:String(fe)}`)}},[Vo,Nr,mh,r]),vh=(0,V.useCallback)(()=>{Vo("updating")},[Vo]);(0,V.useEffect)(()=>{Bn==="authenticated"&&(H(r.getUserTier()),et(r.getUserPaidTier()))},[r,Bn]),(0,V.useEffect)(()=>{if(i.merged.security.auth.enforcedType&&i.merged.security.auth.selectedType&&i.merged.security.auth.enforcedType!==i.merged.security.auth.selectedType)Nr(`Authentication is enforced to be ${i.merged.security.auth.enforcedType}, but you are currently using ${i.merged.security.auth.selectedType}.`);else if(i.merged.security.auth.selectedType&&!i.merged.security.auth.useExternal){if(i.merged.security.auth.selectedType==="gemini-api-key")return;let U=Sd(i.merged.security.auth.selectedType);U&&Nr(U)}},[i.merged.security.auth.selectedType,i.merged.security.auth.enforcedType,i.merged.security.auth.useExternal,Nr]);let{isModelDialogOpen:Tp,openModelDialog:Ah,closeModelDialog:wh}=Ov(),{isVoiceModelDialogOpen:xp,openVoiceModelDialog:du,closeVoiceModelDialog:_h}=Lv(),{toggleVimEnabled:S_}=rl(),Sp=(0,V.useRef)(()=>{}),[Ha,Fs]=(0,V.useState)(!1),{cleanUiDetailsVisible:mu,setCleanUiDetailsVisible:Dh,toggleCleanUiDetailsVisible:Mh,revealCleanUiDetailsTemporarily:pu}=f_(),C_=(0,V.useMemo)(()=>({openAuthDialog:()=>Vo("updating"),openThemeDialog:lh,openEditorDialog:Kl,openPrivacyNotice:()=>N(!0),openSettingsDialog:sh,openSessionBrowser:uu,openModelDialog:Ah,openVoiceModelDialog:du,openAgentConfigDialog:Ee,openPermissionsDialog:hi,quit:U=>{su(),M(U),setTimeout(async()=>{await Fn(),th.exit(0)},100)},setDebugMessage:_,toggleCorgiMode:()=>T(U=>!U),toggleVoiceMode:()=>St(U=>!U),toggleDebugProfiler:Ke,dispatchExtensionStateUpdate:Ns,addConfirmUpdateExtensionRequest:nr,toggleBackgroundTasks:()=>{te.current(),se.current||(B(!0),ne.current.size>1?Sp.current(!0):Sp.current(!1))},toggleShortcutsHelp:()=>Fs(U=>!U),setText:oh}),[Vo,lh,su,Kl,sh,uu,Ah,du,Ee,M,_,N,T,Ns,hi,nr,Ke,Fs,oh]),{handleSlashCommand:Ti,slashCommands:fu,pendingHistoryItems:gu,commandContext:Ph,confirmationRequest:Us}=kv(r,i,x.addItem,x.clearItems,x.loadHistory,qt,S_,k,C_,Vi,tt,jr,Y),[Xl,Oh]=(0,V.useState)(null),[hu,Lh]=(0,V.useState)(null);(0,V.useEffect)(()=>{let U=fe=>{Oh({prompt:fe.prompt,onConfirm:me=>{Oh(null),fe.onConfirm(me)}})};return xe.on("consent-request",U),()=>{xe.off("consent-request",U)}},[]);let b_=(0,V.useCallback)(async()=>{x.addItem({type:"info",text:"Refreshing hierarchical memory (GEMINI.md or other context files)..."},Date.now());try{let U,fe;if(r.isJitContextEnabled())await r.getMemoryContextManager()?.refresh(),r.updateSystemInstructionIfInitialized(),U=tf(r.getUserMemory()),fe=r.getGeminiMdFileCount();else{let me=await Qu(r);U=tf(me.memoryContent),fe=me.fileCount}x.addItem({type:"info",text:`Memory reloaded successfully. ${U.length>0?`Loaded ${U.length} characters from ${fe} file(s)`:"No memory content found"}`},Date.now()),r.getDebugMode()&&ue.log(`[DEBUG] Refreshed memory content in config: ${U.substring(0,200)}...`)}catch(U){let fe=Br(U);x.addItem({type:"error",text:`Error refreshing memory: ${fe}`},Date.now()),ue.warn("Error refreshing memory:",U)}},[r,x]),Cp=(0,V.useRef)(()=>{}),Nh=(0,V.useCallback)((U,fe=!1)=>{U?ee(!0):(ee(!1),Cp.current(!1,fe))},[]);(0,V.useEffect)(()=>{if(G){let U=x.history.findLast(me=>me.type==="user"),fe=Co.at(-1);(!U||typeof U.text=="string"&&U.text===fe)&&(Cp.current(!0),ee(!1))}},[G,Co,x.history]);let yu=(0,V.useRef)([]),[E_,Bh]=(0,V.useState)(0),bp=(0,V.useCallback)(()=>{if(yu.current.length===0)return null;let U=yu.current.join(`
117
117
  `);return yu.current=[],Bh(0),U},[]);(0,V.useEffect)(()=>{let U=(fe,me)=>{me!=="user_steering"&&me!=="background_completion"||(yu.current.push(fe),Bh(ve=>ve+1))};return r.injectionService.onInjection(U),()=>{r.injectionService.offInjection(U)}},[r]);let kh=(0,V.useMemo)(()=>r?.getAgentSessionInteractiveEnabled()?new Px({config:r,getPreferredEditor:Ba}):void 0,[r,Ba]),R_=kh?Jv({agent:kh,addItem:x.addItem,onCancelSubmit:Nh,isShellFocused:F,logger:So}):Xv(r.getGeminiClient(),x.history,x.addItem,r,i,_,Ti,ce,Ba,Nr,b_,xn,qr,Nh,B,je,gt,F,bp),{streamingState:po,submitQuery:Fa,initError:Ep,pendingHistoryItems:Tu,thought:Ql,cancelOngoingRequest:Hh,pendingToolCalls:I_,handleApprovalModeChange:Fh,activePtyId:ji,loopDetectionConfirmationRequest:xu,lastOutputTime:Rp,backgroundTaskCount:Ip,isBackgroundTaskVisible:kn,toggleBackgroundTasks:Su,backgroundCurrentExecution:Uh,backgroundTasks:Hn,dismissBackgroundTask:Gh,retryStatus:v_}=R_,Eo=(0,V.useMemo)(()=>[...gu,...Tu],[gu,Tu]);te.current=Su,se.current=kn,ne.current=Hn;let{activeBackgroundTaskPid:Wh,setIsBackgroundTaskListOpen:Gs,isBackgroundTaskListOpen:Vh,setActiveBackgroundTaskPid:$h,backgroundTaskHeight:vp}=e_({backgroundTasks:Hn,backgroundTaskCount:Ip,isBackgroundTaskVisible:kn,activePtyId:ji,embeddedShellFocused:F,setEmbeddedShellFocused:B,terminalHeight:gt});Sp.current=Gs;let Jl=(0,V.useRef)(0);(0,V.useEffect)(()=>{Jl.current=Rp},[Rp]);let{shouldShowFocusHint:A_,inactivityStatus:qh}=rA({activePtyId:ji,lastOutputTime:Rp,streamingState:po,pendingToolCalls:I_,embeddedShellFocused:F,isInteractiveShellEnabled:r.isInteractiveShellEnabled()}),Kh=qh==="action_required",jh=qh==="silent_working",w_=(0,V.useCallback)(U=>{Fh(U),mu||pu(eh)},[Fh,mu,pu]),{isMcpReady:Zl}=$w(r),Cu=(0,V.useMemo)(()=>Eo.some(U=>U.type==="compression"&&U.compression.isPending),[Eo]),{messageQueue:bu,addMessage:Eu,clearQueue:zh,getQueuedMessagesText:Yh,popAllMessages:Xh}=Vw({isConfigInitialized:tt,streamingState:po,submitQuery:Fa,isMcpReady:Zl,isCompressing:Cu});Cp.current=(0,V.useCallback)((U=!0,fe=!1)=>{if(!fe&&Fd(Eo))return;if(!U){fe&&yi.setText("");return}let ve=Co.at(-1)||"",ct=Yh();ct&&(ve=ve?`${ve}
118
118
 
119
- ${ct}`:ct,zh()),ve&&yi.setText(ve)},[yi,Co,Yh,zh,Eo]);let Qh=(0,V.useCallback)(U=>{let fe=U.trim();fe&&(r.injectionService.addInjection(fe,"user_steering"),x.addItem({type:"hint",text:fe}))},[r,x]),ec=(0,V.useCallback)(async U=>{a(),uo(null),Ie||(co(!0),S||qt());let fe=ar(U.trim()),me=po==="idle",ve=po==="responding"||_f(Eo);if(fe&&ve){let{commandToExecute:Yi}=Ya(U,fu??[]);if(Yi?.isSafeConcurrent){Ti(U),Po(U);return}}if(r.isModelSteeringEnabled()&&ve&&!fe){Qh(U),Po(U);return}let ct=tt&&Zl;if(fe&&tt||!Cu&&me&&ct){if(!fe){let Yi=await vS(U,r);if(Yi.length>0){Lh({files:Yi,onComplete:Q_=>{Lh(null),Q_.allowed&&Yi.forEach(J_=>r.getWorkspaceContext().addReadOnlyPath(J_)),Fa(U)}}),Po(U);return}}Fa(U)}else me&&!Cu&&!ct&&bu.length===0&&xe.emitFeedback("info",tt?"Waiting for MCP servers to initialize... Slash commands are still available and prompts will be queued.":"Initializing... Prompts will be queued."),Eu(U);Po(U)},[Eu,Po,Fa,Ti,fu,Zl,po,Cu,bu.length,Eo,r,Ie,co,S,qt,a,Qh,tt,uo]),Jh=(0,V.useCallback)(()=>{a(),uo(null),x.clearItems(),Ki(),qt()},[x,Ki,qt,a,uo]),{handleInput:Zh}=eA(yi,ec),Ap=!Ep&&!L&&!hp&&(po==="idle"||po==="responding"||po==="waiting_for_confirmation")&&!zl,tc=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{tc.current?.disconnect()},[]);let[Ru,__]=(0,V.useState)(0),[ey,D_]=(0,V.useState)(0);(0,V.useLayoutEffect)(()=>{!oe&&Ru>0&&D_(Ru)},[oe,Ru]);let wp=oe&&ey>0?ey:Ru,ty=(0,V.useCallback)(U=>{if(tc.current&&(tc.current.disconnect(),tc.current=null),U){let fe=new qn(me=>{let ve=me[0];if(ve){let ct=Math.round(ve.contentRect.height);__(Yi=>ct!==Yi?ct:Yi)}});fe.observe(U),tc.current=fe}},[]),_p=Math.max(0,gt-wp-vp-1);r.setShellExecutionConfig({terminalWidth:Math.floor(je*NN),terminalHeight:Math.max(Math.floor(_p-BN),1),pager:i.merged.tools.shell.pager,showColor:i.merged.tools.shell.showColor,sanitizationConfig:r.sanitizationConfig,sandboxManager:r.sandboxManager});let{isFocused:Iu,hasReceivedFocusEvent:M_}=VS(),oy=(0,V.useMemo)(()=>{let U=i.merged.context.fileName;return U?Array.isArray(U)?U:[U]:fT()},[i.merged.context.fileName]),Dp=(0,V.useMemo)(()=>r.getQuestion(),[r]),ry=(0,V.useRef)(!1),ny=r.getGeminiClient();(0,V.useEffect)(()=>{Dp&&tt&&!ry.current&&!ka&&!Yl&&!jl&&!ql&&!D&&ny?.isInitialized?.()&&(ec(Dp),ry.current=!0)},[Dp,tt,ec,ka,Yl,jl,ql,D,ny]);let[P_,O_]=(0,V.useState)(!1),[Mp,L_]=(0,V.useState)(null);(0,V.useEffect)(()=>{(async()=>{let me=(await Vs.getInstance()).getCurrentIde();L_(me||null)})()},[]);let Pp=!!(Mp&&!r.getIdeMode()&&!i.merged.ide.hasSeenNudge&&!P_),[vu,oc]=(0,V.useState)(!1),[iy,N_]=(0,V.useState)(!1),[sy,B_]=(0,V.useState)(!0),ay=(0,V.useCallback)(U=>{U>2&&ST(r),U>1&&Ti("/quit",void 0,void 0,!1)},[r,Ti]),{pressCount:ly,handlePress:cy}=_l({windowMs:Si,onRepeat:ay}),{pressCount:uy,handlePress:dy}=_l({windowMs:Si,onRepeat:ay}),[Au,my]=(0,V.useState)(),[py,k_]=(0,V.useState)(!1),[Op,H_]=(0,V.useState)(!1),[fy,xi]=cp(Si),{isFolderTrustDialogOpen:Lp,discoveryResults:gy,handleFolderTrustSelect:hy,isRestarting:yy}=nA(i,La,x.addItem),Np=r.getPolicyUpdateConfirmationRequest(),[Bp,Ty]=(0,V.useState)(!!Np),{needsRestart:xy,restartReason:Sy}=cC(),Cy=(0,V.useRef)(!0);Xw(r,pi,x,Y);let zi=(0,V.useRef)(null);(0,V.useEffect)(()=>{let U=ve=>{xi({text:ve.message,type:ve.type})},fe=()=>{xi({text:"Press Ctrl-S to enter selection mode to copy text.",type:"warning"})},me=()=>{xi({text:"Paste Timed out. Possibly due to slow connection.",type:"warning"})};return Pt.on("transient-message",U),Pt.on("selection-warning",fe),Pt.on("paste-timeout",me),()=>{Pt.off("transient-message",U),Pt.off("selection-warning",fe),Pt.off("paste-timeout",me),zi.current&&clearTimeout(zi.current)}},[xi]);let kp=(0,V.useCallback)(U=>{xi({text:U,type:"warning"})},[xi]),{handleSuspend:by}=r_({handleWarning:kp,setRawMode:$t,refreshStatic:qt,setForceRerenderKey:R,shouldUseAlternateScreen:mp});(0,V.useEffect)(()=>{xy&&H_(!0)},[xy]),(0,V.useEffect)(()=>{if(Cy.current){Cy.current=!1;return}let U=setTimeout(()=>{qt()},300);return()=>{clearTimeout(U)}},[je,qt]),(0,V.useEffect)(()=>{let U=Xp.subscribe(my);return my(Xp.get()),U},[]),(0,V.useEffect)(()=>{let U=()=>{oc(!0),co(!1)};return Pt.on("open-debug-console",U),()=>{Pt.off("open-debug-console",U)}},[r]);let Ey=(0,V.useCallback)(U=>{k_(U)},[]),Ry=(0,V.useCallback)(U=>{U.userSelection==="yes"?(Ti("/ide install"),i.setValue("User","ide.hasSeenNudge",!0)):U.userSelection==="dismiss"&&i.setValue("User","ide.hasSeenNudge",!0),O_(!0)},[Ti,i]),F_=(0,V.useCallback)(U=>{if(i.merged.general.debugKeystrokeLogging&&ue.log("[DEBUG] Keystroke:",JSON.stringify(U)),Ha&&t(U)&&Fs(!1),o["app.toggleMouseMode"](U))return A(ve=>!ve),I&&!S&&Pt.emit("scroll-to-bottom"),!0;if(S&&o["app.toggleCopyMode"](U))return le(!0),Ji(),!0;if(o["basic.quit"](U))return Hh?.(),cy(),!0;if(o["basic.exit"](U))return dp.current.text.length>0?!1:(dy(),!0);if(o["app.suspend"](U))by();else if(o["app.dumpFrame"](U)){let ct=`snapshot-${new Date().toISOString().replace(/[:.]/g,"-")}.json`;return h&&(h(ct),ue.log(`Dumped frame to: ${ct}`)),!0}else if(o["app.startRecording"](U)){let ct=`recording-${new Date().toISOString().replace(/[:.]/g,"-")}.json`;return p&&(p(ct),g.current=ct,ue.log(`Started recording to: ${ct}`)),!0}else{if(o["app.stopRecording"](U))return y&&(y(),ue.log(`Stopped recording, saved to: ${g.current??"unknown"}`),g.current=null),!0;if(o["app.toggleCopyMode"](U)&&!S)return xi({text:"Use Ctrl+O to expand and collapse blocks of content.",type:"warning"}),!0}let fe=()=>{uo(!0);let ve=Gb(x.history,Eo);ve.length>0&&_e(ve)},me=!1;if(Ie||(me=!0,co(!0),o["app.showMoreLines"](U)&&fe(),S||qt()),o["app.showErrorDetails"](U))return i.merged.general.devtools?(async()=>{let{toggleDevToolsPanel:ve}=await import("./devtoolsService-EGQAB3JU.js");await ve(r,vu,()=>oc(ct=>!ct),()=>oc(!0))})():oc(ve=>!ve),!0;if(o["app.showFullTodos"](U))return N_(ve=>!ve),!0;if(o["app.toggleMarkdown"](U))return B_(ve=>{let ct=!ve;return qt(),ct}),!0;if(o["app.showIdeContextDetail"](U)&&r.getIdeMode()&&Au)return Ti("/ide status"),!0;if(o["app.showMoreLines"](U)&&!me)return co(!1),fe(),qt(),!0;if((o["app.focusShellInput"](U)||o["background.unfocusList"](U))&&(ji||kn&&Hn.size>0)){if(F){let ct=Jl.current;return zi.current&&clearTimeout(zi.current),zi.current=setTimeout(()=>{Jl.current===ct?B(!1):xi({text:"Use Shift+Tab to unfocus",type:"warning"})},150),!1}return Date.now()-Jl.current>=100&&!ji&&!kn?(zi.current&&clearTimeout(zi.current),Su(),B(!0),Hn.size>1&&Gs(!0),!0):(B(!0),!0)}else{if(o["app.unfocusShellInput"](U)||o["background.unfocus"](U))return F?(B(!1),!0):!1;if(o["background.toggle"](U))return ji?Uh():(Su(),!kn&&Hn.size>0?(B(!0),Hn.size>1&&Gs(!0)):B(!1)),!0;if(o["background.toggleList"](U))return Hn.size>0&&kn&&(F||B(!0),Gs(!0)),!0}return!1},[Ie,co,oc,r,Au,cy,dy,Ti,Hh,ji,by,F,i.merged.general.debugKeystrokeLogging,qt,le,zi,S,Ha,Uh,Su,Hn,kn,Gs,Jl,xi,i.merged.general.devtools,vu,uo,o,t,x.history,Eo,_e,h,p,y,I]);de(F_,{isActive:!0,priority:!0}),de(U=>o["scroll.up"](U)||o["scroll.down"](U)||o["scroll.pageUp"](U)||o["scroll.pageDown"](U)||o["scroll.home"](U)||o["scroll.end"](U)?!1:(le(!1),I&&Qi(),!0),{isActive:oe,priority:200}),(0,V.useEffect)(()=>{if(i.merged.ui.hideWindowTitle)return;let U=Um({streamingState:po,thoughtSubject:Ql?.subject,isConfirming:!!Us||Kh,isSilentWorking:jh,folderName:LN(r.getTargetDir()),showThoughts:!!i.merged.ui.showStatusInTitle,useDynamicTitle:i.merged.ui.dynamicWindowTitle});Xr.current!==U&&(Xr.current=U,Wo.write(`\x1B]0;${U}\x07`))},[po,Ql,Us,Kh,jh,i.merged.ui.showStatusInTitle,i.merged.ui.dynamicWindowTitle,i.merged.ui.hideWindowTitle,r,Wo]),(0,V.useEffect)(()=>{let U=me=>{let ve;switch(me.severity){case"error":ve="error";break;case"warning":ve="warning";break;case"info":ve="info";break;default:throw new Error(`Unexpected severity for user feedback: ${me.severity}`)}x.addItem({type:ve,text:me.message},Date.now()),me.error&&ue.warn(`[Feedback Details for "${me.message}"]`,me.error)},fe=me=>{x.addItem({type:"info",text:me.message,source:me.hookName},Date.now())};return xe.on("user-feedback",U),xe.on("hook-system-message",fe),xe.drainBacklogs(),()=>{xe.off("user-feedback",U),xe.off("hook-system-message",fe)}},[x]);let Iy=e.version.includes("nightly"),Hp=Bn==="awaiting_login_restart",vy=i.merged.security.auth.selectedType==="vertex-ai"?"Authenticating to Vertex AI in Cloud Shell requires a restart to apply project settings.":void 0,Ay=Pp||Lp||Bp||j||!!Us||!!Xl||!!hu||!!Z||Go.length>0||!!xu||jl||fp||Tp||xp||On||$i||ka||Yl||ql||D||Op||!!zl||!!au||!!lu||!!cu||yp||Bn==="awaiting_api_key_input"||Hp||!!ao,U_=(0,V.useMemo)(()=>Fd(Eo),[Eo]),wy=Go.length>0,_y=!!xu,rc=U_||!!Us||!!Xl||wy||_y||!!zl||!!au||!!lu||!!cu||!!Z,wu=i.merged.ui.loadingPhrases,G_=wu==="tips"||wu==="all",W_=wu==="witty"||wu==="all",V_=(!F||kn)&&po==="responding"&&!rc,_u=0;if(or.length>0&&i.merged.hooksConfig.notifications){let U=or.length>1?"Executing Hooks":"Executing Hook",fe=or.map(me=>me.name+(me.index&&me.total&&me.total>1?` (${me.index}/${me.total})`:"")).join(", ");_u=U.length+fe.length+10}else V_?_u=(Ql?.subject||"Waiting for model...").length+25:rc&&(_u=35);let $_=je-_u-5,{elapsedTime:Dy,currentLoadingPhrase:My,currentTip:Py,currentWittyPhrase:Oy}=oA({streamingState:po,shouldShowFocusHint:A_,retryStatus:v_,showTips:G_,showWit:W_,customWittyPhrases:i.merged.ui.customWittyPhrases,errorVerbosity:i.merged.ui.errorVerbosity,maxLength:$_}),Fp=r.isPlanEnabled()&&po==="idle"&&!rc,Ly=qw({config:r,addItem:x.addItem,onApprovalModeChange:w_,isActive:!F,allowPlanMode:Fp});m_({notificationsEnabled:d,notificationMethod:m,isFocused:Iu,hasReceivedFocusEvent:M_,streamingState:po,hasPendingActionRequired:rc,pendingHistoryItems:Eo,commandConfirmationRequest:Us,authConsentRequest:Xl,permissionConfirmationRequest:hu,hasConfirmUpdateExtensionRequests:wy,hasLoopDetectionConfirmationRequest:_y});let Ny=Ap&&po==="idle"&&!rc;(0,V.useEffect)(()=>{Ha&&!Ny&&Fs(!1)},[Ha,Ny,Fs]),(0,V.useEffect)(()=>{if(!tt||!r.isModelSteeringEnabled()||po!=="idle"||!Zl||Fd(Eo))return;let U=bp();U&&Fa([{text:Yu(U)}])},[r,x,tt,Zl,po,Fa,bp,Eo,E_]);let q_=(0,V.useMemo)(()=>Ud(Eo),[Eo]),[By,K_]=(0,V.useState)(r.getGeminiMdFileCount());(0,V.useEffect)(()=>{let U=fe=>{K_(fe.fileCount)};return xe.on("memory-changed",U),()=>{xe.off("memory-changed",U)}},[]),(0,V.useEffect)(()=>{let U=!0;return(async()=>{let[me,ve]=await Promise.all([r.getBannerTextNoCapacityIssues(),r.getBannerTextCapacityIssues()]);U&&(mo(me),Ui(ve),jr(!0))})(),()=>{U=!1}},[r,qt]);let j_=(0,V.useMemo)(()=>({buffer:yi,userMessages:Co,shellModeActive:ce,showEscapePrompt:py,copyModeEnabled:oe,inputWidth:Nn,suggestionsWidth:Vl}),[yi,Co,ce,py,oe,Nn,Vl]),z_=(0,V.useMemo)(()=>({userTier:Lr,stats:Re,proQuotaRequest:zl,validationRequest:au,overageMenuRequest:lu,emptyWalletRequest:cu}),[Lr,Re,zl,au,lu,cu]),Y_=(0,V.useMemo)(()=>({history:x.history,historyManager:x,isThemeDialogOpen:jl,themeError:O,isAuthenticating:ka,isConfigInitialized:tt,authError:uh,accountSuspensionInfo:ph,isAuthDialogOpen:Yl,isAwaitingApiKeyInput:Bn==="awaiting_api_key_input",isAwaitingLoginRestart:Hp,loginRestartMessage:vy,apiKeyDefaultValue:dh,editorError:rh,isEditorDialogOpen:ql,showPrivacyNotice:D,mouseMode:I,corgiMode:E,debugMessage:b,quittingMessages:w,isSettingsDialogOpen:fp,isSessionBrowserOpen:yp,isModelDialogOpen:Tp,isVoiceModelDialogOpen:xp,isAgentConfigDialogOpen:On,selectedAgentName:ie,selectedAgentDisplayName:ae,selectedAgentDefinition:ye,isPermissionsDialogOpen:$i,permissionsDialogProps:zr,slashCommands:fu,pendingSlashCommandHistoryItems:gu,commandContext:Ph,commandConfirmationRequest:Us,authConsentRequest:Xl,confirmUpdateExtensionRequests:Go,loopDetectionConfirmationRequest:xu,permissionConfirmationRequest:hu,geminiMdFileCount:By,streamingState:po,initError:Ep,pendingGeminiHistoryItems:Tu,thought:Ql,isInputActive:Ap,isVoiceModeEnabled:pt,isResuming:hp,shouldShowIdePrompt:Pp,isFolderTrustDialogOpen:Lp??!1,folderDiscoveryResults:gy,isPolicyUpdateDialogOpen:Bp,policyUpdateConfirmationRequest:Np,isTrustedFolder:pi,constrainHeight:Ie,showErrorDetails:vu,showFullTodos:iy,ideContextState:Au,renderMarkdown:sy,ctrlCPressedOnce:ly>=1,ctrlDPressedOnce:uy>=1,shortcutsHelpVisible:Ha,cleanUiDetailsVisible:mu,isFocused:Iu,elapsedTime:Dy,currentLoadingPhrase:My,currentTip:Py,currentWittyPhrase:Oy,historyRemountKey:tr,activeHooks:or,messageQueue:bu,queueErrorMessage:Ps,showApprovalModeIndicator:Ly,allowPlanMode:Fp,currentModel:nt,contextFileNames:oy,errorCount:Jr,availableTerminalHeight:_p,stableControlsHeight:wp,mainAreaWidth:Ln,staticAreaMaxItemHeight:$l,staticExtraHeight:Qr,dialogsVisible:Ay,pendingHistoryItems:Eo,nightly:Iy,branchName:Sn,sessionStats:bo,terminalWidth:je,terminalHeight:gt,mainControlsRef:ty,rootUiRef:Yr,currentIDE:Mp,updateInfo:Mn,showIdeRestartPrompt:Op,ideTrustRestartReason:Sy,isRestarting:yy,extensionsUpdateState:Wi,activePtyId:ji,backgroundTaskCount:Ip,isBackgroundTaskVisible:kn,embeddedShellFocused:F,showDebugProfiler:K,customDialog:Z,transientMessage:fy,bannerData:Cr,bannerVisible:Uo,terminalBackgroundColor:r.getTerminalBackground(),settingsNonce:Kr,backgroundTasks:Hn,activeBackgroundTaskPid:Wh,backgroundTaskHeight:vp,isBackgroundTaskListOpen:Vh,adminSettingsChanged:j,newAgents:ao,showIsExpandableHint:Or,hintMode:r.isModelSteeringEnabled()&&_f(Eo),hintBuffer:""}),[jl,O,ka,tt,uh,ph,Yl,rh,ql,D,I,E,b,w,fp,yp,Tp,xp,On,ie,ae,ye,$i,zr,fu,gu,Ph,Us,Xl,Go,xu,hu,By,po,Ep,Tu,Ql,Ap,pt,hp,Pp,Lp,gy,Bp,Np,pi,Ie,vu,iy,Au,sy,ly,uy,Ha,mu,Iu,Dy,My,Py,Oy,tr,or,bu,Ps,Ly,Fp,oy,Jr,_p,wp,Ln,$l,Qr,Ay,Eo,Iy,Sn,bo,je,gt,ty,Yr,Mp,Mn,Op,Sy,yy,nt,Wi,ji,Ip,kn,x,F,K,Z,dh,Bn,Hp,vy,fy,Cr,Uo,r,Kr,vp,Vh,Wh,Hn,j,ao,Or]),ky=(0,V.useCallback)(()=>N(!1),[N]),X_=(0,V.useMemo)(()=>({handleThemeSelect:gp,closeThemeDialog:su,handleThemeHighlight:ch,handleAuthSelect:Rh,setAuthState:Vo,onAuthError:Nr,handleEditorSelect:nh,exitEditorDialog:ih,exitPrivacyNotice:ky,closeSettingsDialog:ah,closeModelDialog:wh,openVoiceModelDialog:du,closeVoiceModelDialog:_h,openAgentConfigDialog:Ee,closeAgentConfigDialog:Tt,openPermissionsDialog:hi,closePermissionsDialog:Bs,setShellModeActive:Fe,vimHandleInput:Zh,handleIdePromptComplete:Ry,handleFolderTrustSelect:hy,setIsPolicyUpdateDialogOpen:Ty,setConstrainHeight:co,onEscapePromptChange:Ey,refreshStatic:qt,handleFinalSubmit:ec,handleClearScreen:Jh,handleProQuotaChoice:hh,handleValidationChoice:yh,handleOverageMenuChoice:Th,handleEmptyWalletChoice:xh,openSessionBrowser:uu,closeSessionBrowser:Sh,handleResumeSession:Ch,handleDeleteSession:Eh,setQueueErrorMessage:to,addMessage:Eu,popAllMessages:Xh,handleApiKeySubmit:Ih,handleApiKeyCancel:vh,setBannerVisible:jr,setShortcutsHelpVisible:Fs,setCleanUiDetailsVisible:Dh,toggleCleanUiDetailsVisible:Mh,revealCleanUiDetailsTemporarily:pu,handleWarning:kp,setEmbeddedShellFocused:B,dismissBackgroundTask:Gh,setActiveBackgroundTaskPid:$h,setIsBackgroundTaskListOpen:Gs,setAuthContext:Hs,dismissLoginRestart:()=>{Hs({}),Vo("updating")},onHintInput:()=>{},onHintBackspace:()=>{},onHintClear:()=>{},onHintSubmit:()=>{},handleRestart:async()=>{if(th.send){let U=r.getRemoteAdminSettings();U&&th.send({type:"admin-settings-update",settings:U})}await sr()},handleNewAgentsSelect:async U=>{if(ao&&U==="acknowledge"){let fe=r.getAgentRegistry();try{await Promise.all(ao.map(me=>fe.acknowledgeAgent(me)))}catch(me){ue.error("Failed to acknowledge agents:",me),x.addItem({type:"error",text:`Failed to acknowledge agents: ${Br(me)}`},Date.now())}}lo(null)},getPreferredEditor:Ba,clearAccountSuspension:()=>{fh(null),Vo("updating")},setVoiceModeEnabled:U=>{St(U)}}),[gp,su,ch,Rh,Vo,Nr,nh,ih,ky,ah,wh,du,_h,Ee,Tt,hi,Bs,Fe,Zh,Ry,hy,Ty,co,Ey,qt,ec,Jh,hh,yh,Th,xh,uu,Sh,Ch,Eh,to,Eu,Xh,Ih,vh,jr,Fs,Dh,Mh,pu,kp,B,Gh,$h,Gs,Hs,fh,ao,r,x,Ba,St]);return(0,Tn.jsx)(cd.Provider,{value:Y_,children:(0,Tn.jsx)(yC.Provider,{value:z_,children:(0,Tn.jsx)(xC.Provider,{value:j_,children:(0,Tn.jsx)(wf.Provider,{value:X_,children:(0,Tn.jsx)(ld.Provider,{value:r,children:(0,Tn.jsx)(Bf.Provider,{value:{version:e.version,startupWarnings:e.startupWarnings||[]},children:(0,Tn.jsx)(Eb,{config:r,toolCalls:q_,isExpanded:Be,toggleExpansion:Ce,toggleAllExpansion:_e,children:(0,Tn.jsx)(lg.Provider,{value:Iu,children:(0,Tn.jsx)(sd,{mouseEventsEnabled:I,children:(0,Tn.jsx)(hd,{children:(0,Tn.jsx)(Tv,{},`app-${v}`)})})})})})})})})})})};var Pr=C(P(),1);var HN=200;async function Ute(e,t,o,r=process.cwd(),n,s){rI();let i=$u(e.getUseAlternateBuffer(),e.getScreenReader()),a=i;a&&(Qi(),ts(()=>{Ji()}));let{matchers:d,errors:m}=await KS();m.forEach(v=>{xe.emitFeedback("warning",v)});let f=await ZT();FN(kN(r),t);let h=new ES({onNewMessage:v=>{xe.emitConsoleLog(v.type,v.content)},debugMode:e.getDebugMode()});h.patch();let{stdout:p,stderr:y}=wT(),g=!!process.env.SHPOOL_SESSION_NAME,x=()=>(Rm(),(0,Pr.jsx)($S.Provider,{value:t,children:(0,Pr.jsx)(jS,{value:d,children:(0,Pr.jsx)(qS,{config:e,children:(0,Pr.jsx)(sd,{mouseEventsEnabled:a,children:(0,Pr.jsx)(bv,{children:(0,Pr.jsx)(hd,{children:(0,Pr.jsx)(nl,{children:(0,Pr.jsx)(mE,{sessionId:e.getSessionId(),children:(0,Pr.jsx)(TC,{children:(0,Pr.jsx)(g_,{config:e,startupWarnings:o,version:f,resumedSessionData:n,initializationResult:s})})})})})})})})})}));g&&await new Promise(v=>setTimeout(v,100));let S=HS(process.env.DEBUG?(0,Pr.jsx)(h_.default.StrictMode,{children:(0,Pr.jsx)(x,{})}):(0,Pr.jsx)(x,{}),{stdout:p,stderr:y,stdin:process.stdin,exitOnCtrlC:!1,isScreenReaderEnabled:e.getScreenReader(),onRender:({renderTime:v})=>{v>HN&&CT(e,Math.round(v)),hC.reportFrameRendered()},standardReactLayoutTiming:i||e.getUseTerminalBuffer(),patchConsole:!1,alternateBuffer:i,terminalBuffer:e.getUseTerminalBuffer(),renderProcess:e.getUseRenderProcess()&&e.getUseTerminalBuffer(),incrementalRendering:t.merged.ui.incrementalRendering!==!1&&i&&!g,debugRainbow:t.merged.ui.debugRainbow===!0}),I;i&&(Wa(),I=()=>Wu(),ts(I)),Ww(t).then(v=>{Wx(v,t,e.getProjectRoot(),e.getSandboxEnabled())}).catch(v=>{e.getDebugMode()&&ue.warn("Update check failed:",v)});let A=()=>S.unmount();ts(A);let E=Fx();ts(E);let T=()=>h.cleanup();ts(T);try{await S.waitUntilExit()}finally{try{Ks(T),T()}catch(v){ue.error("Error cleaning up console patcher:",v)}try{Ks(A),S.unmount()}catch(v){ue.error("Error unmounting Ink instance:",v)}try{Ks(E),E()}catch(v){ue.error("Error in TTY cleanup:",v)}if(I)try{Ks(I),I()}catch(v){ue.error("Error restoring line wrapping:",v)}}}function FN(e,t){if(!t.merged.ui.hideWindowTitle){let o=Um({streamingState:"idle",isConfirming:!1,isSilentWorking:!1,folderName:e,showThoughts:!!t.merged.ui.showStatusInTitle,useDynamicTitle:t.merged.ui.dynamicWindowTitle});br(`\x1B]0;${o}\x07`),process.on("exit",()=>{br("\x1B]0;\x07")})}}export{Ute as startInteractiveUI};
119
+ ${ct}`:ct,zh()),ve&&yi.setText(ve)},[yi,Co,Yh,zh,Eo]);let Qh=(0,V.useCallback)(U=>{let fe=U.trim();fe&&(r.injectionService.addInjection(fe,"user_steering"),x.addItem({type:"hint",text:fe}))},[r,x]),ec=(0,V.useCallback)(async U=>{a(),uo(null),Ie||(co(!0),S||qt());let fe=ar(U.trim()),me=po==="idle",ve=po==="responding"||_f(Eo);if(fe&&ve){let{commandToExecute:Yi}=Ya(U,fu??[]);if(Yi?.isSafeConcurrent){Ti(U),Po(U);return}}if(r.isModelSteeringEnabled()&&ve&&!fe){Qh(U),Po(U);return}let ct=tt&&Zl;if(fe&&tt||!Cu&&me&&ct){if(!fe){let Yi=await vS(U,r);if(Yi.length>0){Lh({files:Yi,onComplete:Q_=>{Lh(null),Q_.allowed&&Yi.forEach(J_=>r.getWorkspaceContext().addReadOnlyPath(J_)),Fa(U)}}),Po(U);return}}Fa(U)}else me&&!Cu&&!ct&&bu.length===0&&xe.emitFeedback("info",tt?"Waiting for MCP servers to initialize... Slash commands are still available and prompts will be queued.":"Initializing... Prompts will be queued."),Eu(U);Po(U)},[Eu,Po,Fa,Ti,fu,Zl,po,Cu,bu.length,Eo,r,Ie,co,S,qt,a,Qh,tt,uo]),Jh=(0,V.useCallback)(()=>{a(),uo(null),x.clearItems(),Ki(),qt()},[x,Ki,qt,a,uo]),{handleInput:Zh}=eA(yi,ec),Ap=!Ep&&!L&&!hp&&(po==="idle"||po==="responding"||po==="waiting_for_confirmation")&&!zl,tc=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{tc.current?.disconnect()},[]);let[Ru,__]=(0,V.useState)(0),[ey,D_]=(0,V.useState)(0);(0,V.useLayoutEffect)(()=>{!oe&&Ru>0&&D_(Ru)},[oe,Ru]);let wp=oe&&ey>0?ey:Ru,ty=(0,V.useCallback)(U=>{if(tc.current&&(tc.current.disconnect(),tc.current=null),U){let fe=new qn(me=>{let ve=me[0];if(ve){let ct=Math.round(ve.contentRect.height);__(Yi=>ct!==Yi?ct:Yi)}});fe.observe(U),tc.current=fe}},[]),_p=Math.max(0,gt-wp-vp-1);r.setShellExecutionConfig({terminalWidth:Math.floor(je*NN),terminalHeight:Math.max(Math.floor(_p-BN),1),pager:i.merged.tools.shell.pager,showColor:i.merged.tools.shell.showColor,sanitizationConfig:r.sanitizationConfig,sandboxManager:r.sandboxManager});let{isFocused:Iu,hasReceivedFocusEvent:M_}=VS(),oy=(0,V.useMemo)(()=>{let U=i.merged.context.fileName;return U?Array.isArray(U)?U:[U]:fT()},[i.merged.context.fileName]),Dp=(0,V.useMemo)(()=>r.getQuestion(),[r]),ry=(0,V.useRef)(!1),ny=r.getGeminiClient();(0,V.useEffect)(()=>{Dp&&tt&&!ry.current&&!ka&&!Yl&&!jl&&!ql&&!D&&ny?.isInitialized?.()&&(ec(Dp),ry.current=!0)},[Dp,tt,ec,ka,Yl,jl,ql,D,ny]);let[P_,O_]=(0,V.useState)(!1),[Mp,L_]=(0,V.useState)(null);(0,V.useEffect)(()=>{(async()=>{let me=(await Vs.getInstance()).getCurrentIde();L_(me||null)})()},[]);let Pp=!!(Mp&&!r.getIdeMode()&&!i.merged.ide.hasSeenNudge&&!P_),[vu,oc]=(0,V.useState)(!1),[iy,N_]=(0,V.useState)(!1),[sy,B_]=(0,V.useState)(!0),ay=(0,V.useCallback)(U=>{U>2&&ST(r),U>1&&Ti("/quit",void 0,void 0,!1)},[r,Ti]),{pressCount:ly,handlePress:cy}=_l({windowMs:Si,onRepeat:ay}),{pressCount:uy,handlePress:dy}=_l({windowMs:Si,onRepeat:ay}),[Au,my]=(0,V.useState)(),[py,k_]=(0,V.useState)(!1),[Op,H_]=(0,V.useState)(!1),[fy,xi]=cp(Si),{isFolderTrustDialogOpen:Lp,discoveryResults:gy,handleFolderTrustSelect:hy,isRestarting:yy}=nA(i,La,x.addItem),Np=r.getPolicyUpdateConfirmationRequest(),[Bp,Ty]=(0,V.useState)(!!Np),{needsRestart:xy,restartReason:Sy}=cC(),Cy=(0,V.useRef)(!0);Xw(r,pi,x,Y);let zi=(0,V.useRef)(null);(0,V.useEffect)(()=>{let U=ve=>{xi({text:ve.message,type:ve.type})},fe=()=>{xi({text:"Press Ctrl-S to enter selection mode to copy text.",type:"warning"})},me=()=>{xi({text:"Paste Timed out. Possibly due to slow connection.",type:"warning"})};return Pt.on("transient-message",U),Pt.on("selection-warning",fe),Pt.on("paste-timeout",me),()=>{Pt.off("transient-message",U),Pt.off("selection-warning",fe),Pt.off("paste-timeout",me),zi.current&&clearTimeout(zi.current)}},[xi]);let kp=(0,V.useCallback)(U=>{xi({text:U,type:"warning"})},[xi]),{handleSuspend:by}=r_({handleWarning:kp,setRawMode:$t,refreshStatic:qt,setForceRerenderKey:R,shouldUseAlternateScreen:mp});(0,V.useEffect)(()=>{xy&&H_(!0)},[xy]),(0,V.useEffect)(()=>{if(Cy.current){Cy.current=!1;return}let U=setTimeout(()=>{qt()},300);return()=>{clearTimeout(U)}},[je,qt]),(0,V.useEffect)(()=>{let U=Xp.subscribe(my);return my(Xp.get()),U},[]),(0,V.useEffect)(()=>{let U=()=>{oc(!0),co(!1)};return Pt.on("open-debug-console",U),()=>{Pt.off("open-debug-console",U)}},[r]);let Ey=(0,V.useCallback)(U=>{k_(U)},[]),Ry=(0,V.useCallback)(U=>{U.userSelection==="yes"?(Ti("/ide install"),i.setValue("User","ide.hasSeenNudge",!0)):U.userSelection==="dismiss"&&i.setValue("User","ide.hasSeenNudge",!0),O_(!0)},[Ti,i]),F_=(0,V.useCallback)(U=>{if(i.merged.general.debugKeystrokeLogging&&ue.log("[DEBUG] Keystroke:",JSON.stringify(U)),Ha&&t(U)&&Fs(!1),o["app.toggleMouseMode"](U))return A(ve=>!ve),I&&!S&&Pt.emit("scroll-to-bottom"),!0;if(S&&o["app.toggleCopyMode"](U))return le(!0),Ji(),!0;if(o["basic.quit"](U))return Hh?.(),cy(),!0;if(o["basic.exit"](U))return dp.current.text.length>0?!1:(dy(),!0);if(o["app.suspend"](U))by();else if(o["app.dumpFrame"](U)){let ct=`snapshot-${new Date().toISOString().replace(/[:.]/g,"-")}.json`;return h&&(h(ct),ue.log(`Dumped frame to: ${ct}`)),!0}else if(o["app.startRecording"](U)){let ct=`recording-${new Date().toISOString().replace(/[:.]/g,"-")}.json`;return p&&(p(ct),g.current=ct,ue.log(`Started recording to: ${ct}`)),!0}else{if(o["app.stopRecording"](U))return y&&(y(),ue.log(`Stopped recording, saved to: ${g.current??"unknown"}`),g.current=null),!0;if(o["app.toggleCopyMode"](U)&&!S)return xi({text:"Use Ctrl+O to expand and collapse blocks of content.",type:"warning"}),!0}let fe=()=>{uo(!0);let ve=Gb(x.history,Eo);ve.length>0&&_e(ve)},me=!1;if(Ie||(me=!0,co(!0),o["app.showMoreLines"](U)&&fe(),S||qt()),o["app.showErrorDetails"](U))return i.merged.general.devtools?(async()=>{let{toggleDevToolsPanel:ve}=await import("./devtoolsService-B7SSRNHW.js");await ve(r,vu,()=>oc(ct=>!ct),()=>oc(!0))})():oc(ve=>!ve),!0;if(o["app.showFullTodos"](U))return N_(ve=>!ve),!0;if(o["app.toggleMarkdown"](U))return B_(ve=>{let ct=!ve;return qt(),ct}),!0;if(o["app.showIdeContextDetail"](U)&&r.getIdeMode()&&Au)return Ti("/ide status"),!0;if(o["app.showMoreLines"](U)&&!me)return co(!1),fe(),qt(),!0;if((o["app.focusShellInput"](U)||o["background.unfocusList"](U))&&(ji||kn&&Hn.size>0)){if(F){let ct=Jl.current;return zi.current&&clearTimeout(zi.current),zi.current=setTimeout(()=>{Jl.current===ct?B(!1):xi({text:"Use Shift+Tab to unfocus",type:"warning"})},150),!1}return Date.now()-Jl.current>=100&&!ji&&!kn?(zi.current&&clearTimeout(zi.current),Su(),B(!0),Hn.size>1&&Gs(!0),!0):(B(!0),!0)}else{if(o["app.unfocusShellInput"](U)||o["background.unfocus"](U))return F?(B(!1),!0):!1;if(o["background.toggle"](U))return ji?Uh():(Su(),!kn&&Hn.size>0?(B(!0),Hn.size>1&&Gs(!0)):B(!1)),!0;if(o["background.toggleList"](U))return Hn.size>0&&kn&&(F||B(!0),Gs(!0)),!0}return!1},[Ie,co,oc,r,Au,cy,dy,Ti,Hh,ji,by,F,i.merged.general.debugKeystrokeLogging,qt,le,zi,S,Ha,Uh,Su,Hn,kn,Gs,Jl,xi,i.merged.general.devtools,vu,uo,o,t,x.history,Eo,_e,h,p,y,I]);de(F_,{isActive:!0,priority:!0}),de(U=>o["scroll.up"](U)||o["scroll.down"](U)||o["scroll.pageUp"](U)||o["scroll.pageDown"](U)||o["scroll.home"](U)||o["scroll.end"](U)?!1:(le(!1),I&&Qi(),!0),{isActive:oe,priority:200}),(0,V.useEffect)(()=>{if(i.merged.ui.hideWindowTitle)return;let U=Um({streamingState:po,thoughtSubject:Ql?.subject,isConfirming:!!Us||Kh,isSilentWorking:jh,folderName:LN(r.getTargetDir()),showThoughts:!!i.merged.ui.showStatusInTitle,useDynamicTitle:i.merged.ui.dynamicWindowTitle});Xr.current!==U&&(Xr.current=U,Wo.write(`\x1B]0;${U}\x07`))},[po,Ql,Us,Kh,jh,i.merged.ui.showStatusInTitle,i.merged.ui.dynamicWindowTitle,i.merged.ui.hideWindowTitle,r,Wo]),(0,V.useEffect)(()=>{let U=me=>{let ve;switch(me.severity){case"error":ve="error";break;case"warning":ve="warning";break;case"info":ve="info";break;default:throw new Error(`Unexpected severity for user feedback: ${me.severity}`)}x.addItem({type:ve,text:me.message},Date.now()),me.error&&ue.warn(`[Feedback Details for "${me.message}"]`,me.error)},fe=me=>{x.addItem({type:"info",text:me.message,source:me.hookName},Date.now())};return xe.on("user-feedback",U),xe.on("hook-system-message",fe),xe.drainBacklogs(),()=>{xe.off("user-feedback",U),xe.off("hook-system-message",fe)}},[x]);let Iy=e.version.includes("nightly"),Hp=Bn==="awaiting_login_restart",vy=i.merged.security.auth.selectedType==="vertex-ai"?"Authenticating to Vertex AI in Cloud Shell requires a restart to apply project settings.":void 0,Ay=Pp||Lp||Bp||j||!!Us||!!Xl||!!hu||!!Z||Go.length>0||!!xu||jl||fp||Tp||xp||On||$i||ka||Yl||ql||D||Op||!!zl||!!au||!!lu||!!cu||yp||Bn==="awaiting_api_key_input"||Hp||!!ao,U_=(0,V.useMemo)(()=>Fd(Eo),[Eo]),wy=Go.length>0,_y=!!xu,rc=U_||!!Us||!!Xl||wy||_y||!!zl||!!au||!!lu||!!cu||!!Z,wu=i.merged.ui.loadingPhrases,G_=wu==="tips"||wu==="all",W_=wu==="witty"||wu==="all",V_=(!F||kn)&&po==="responding"&&!rc,_u=0;if(or.length>0&&i.merged.hooksConfig.notifications){let U=or.length>1?"Executing Hooks":"Executing Hook",fe=or.map(me=>me.name+(me.index&&me.total&&me.total>1?` (${me.index}/${me.total})`:"")).join(", ");_u=U.length+fe.length+10}else V_?_u=(Ql?.subject||"Waiting for model...").length+25:rc&&(_u=35);let $_=je-_u-5,{elapsedTime:Dy,currentLoadingPhrase:My,currentTip:Py,currentWittyPhrase:Oy}=oA({streamingState:po,shouldShowFocusHint:A_,retryStatus:v_,showTips:G_,showWit:W_,customWittyPhrases:i.merged.ui.customWittyPhrases,errorVerbosity:i.merged.ui.errorVerbosity,maxLength:$_}),Fp=r.isPlanEnabled()&&po==="idle"&&!rc,Ly=qw({config:r,addItem:x.addItem,onApprovalModeChange:w_,isActive:!F,allowPlanMode:Fp});m_({notificationsEnabled:d,notificationMethod:m,isFocused:Iu,hasReceivedFocusEvent:M_,streamingState:po,hasPendingActionRequired:rc,pendingHistoryItems:Eo,commandConfirmationRequest:Us,authConsentRequest:Xl,permissionConfirmationRequest:hu,hasConfirmUpdateExtensionRequests:wy,hasLoopDetectionConfirmationRequest:_y});let Ny=Ap&&po==="idle"&&!rc;(0,V.useEffect)(()=>{Ha&&!Ny&&Fs(!1)},[Ha,Ny,Fs]),(0,V.useEffect)(()=>{if(!tt||!r.isModelSteeringEnabled()||po!=="idle"||!Zl||Fd(Eo))return;let U=bp();U&&Fa([{text:Yu(U)}])},[r,x,tt,Zl,po,Fa,bp,Eo,E_]);let q_=(0,V.useMemo)(()=>Ud(Eo),[Eo]),[By,K_]=(0,V.useState)(r.getGeminiMdFileCount());(0,V.useEffect)(()=>{let U=fe=>{K_(fe.fileCount)};return xe.on("memory-changed",U),()=>{xe.off("memory-changed",U)}},[]),(0,V.useEffect)(()=>{let U=!0;return(async()=>{let[me,ve]=await Promise.all([r.getBannerTextNoCapacityIssues(),r.getBannerTextCapacityIssues()]);U&&(mo(me),Ui(ve),jr(!0))})(),()=>{U=!1}},[r,qt]);let j_=(0,V.useMemo)(()=>({buffer:yi,userMessages:Co,shellModeActive:ce,showEscapePrompt:py,copyModeEnabled:oe,inputWidth:Nn,suggestionsWidth:Vl}),[yi,Co,ce,py,oe,Nn,Vl]),z_=(0,V.useMemo)(()=>({userTier:Lr,stats:Re,proQuotaRequest:zl,validationRequest:au,overageMenuRequest:lu,emptyWalletRequest:cu}),[Lr,Re,zl,au,lu,cu]),Y_=(0,V.useMemo)(()=>({history:x.history,historyManager:x,isThemeDialogOpen:jl,themeError:O,isAuthenticating:ka,isConfigInitialized:tt,authError:uh,accountSuspensionInfo:ph,isAuthDialogOpen:Yl,isAwaitingApiKeyInput:Bn==="awaiting_api_key_input",isAwaitingLoginRestart:Hp,loginRestartMessage:vy,apiKeyDefaultValue:dh,editorError:rh,isEditorDialogOpen:ql,showPrivacyNotice:D,mouseMode:I,corgiMode:E,debugMessage:b,quittingMessages:w,isSettingsDialogOpen:fp,isSessionBrowserOpen:yp,isModelDialogOpen:Tp,isVoiceModelDialogOpen:xp,isAgentConfigDialogOpen:On,selectedAgentName:ie,selectedAgentDisplayName:ae,selectedAgentDefinition:ye,isPermissionsDialogOpen:$i,permissionsDialogProps:zr,slashCommands:fu,pendingSlashCommandHistoryItems:gu,commandContext:Ph,commandConfirmationRequest:Us,authConsentRequest:Xl,confirmUpdateExtensionRequests:Go,loopDetectionConfirmationRequest:xu,permissionConfirmationRequest:hu,geminiMdFileCount:By,streamingState:po,initError:Ep,pendingGeminiHistoryItems:Tu,thought:Ql,isInputActive:Ap,isVoiceModeEnabled:pt,isResuming:hp,shouldShowIdePrompt:Pp,isFolderTrustDialogOpen:Lp??!1,folderDiscoveryResults:gy,isPolicyUpdateDialogOpen:Bp,policyUpdateConfirmationRequest:Np,isTrustedFolder:pi,constrainHeight:Ie,showErrorDetails:vu,showFullTodos:iy,ideContextState:Au,renderMarkdown:sy,ctrlCPressedOnce:ly>=1,ctrlDPressedOnce:uy>=1,shortcutsHelpVisible:Ha,cleanUiDetailsVisible:mu,isFocused:Iu,elapsedTime:Dy,currentLoadingPhrase:My,currentTip:Py,currentWittyPhrase:Oy,historyRemountKey:tr,activeHooks:or,messageQueue:bu,queueErrorMessage:Ps,showApprovalModeIndicator:Ly,allowPlanMode:Fp,currentModel:nt,contextFileNames:oy,errorCount:Jr,availableTerminalHeight:_p,stableControlsHeight:wp,mainAreaWidth:Ln,staticAreaMaxItemHeight:$l,staticExtraHeight:Qr,dialogsVisible:Ay,pendingHistoryItems:Eo,nightly:Iy,branchName:Sn,sessionStats:bo,terminalWidth:je,terminalHeight:gt,mainControlsRef:ty,rootUiRef:Yr,currentIDE:Mp,updateInfo:Mn,showIdeRestartPrompt:Op,ideTrustRestartReason:Sy,isRestarting:yy,extensionsUpdateState:Wi,activePtyId:ji,backgroundTaskCount:Ip,isBackgroundTaskVisible:kn,embeddedShellFocused:F,showDebugProfiler:K,customDialog:Z,transientMessage:fy,bannerData:Cr,bannerVisible:Uo,terminalBackgroundColor:r.getTerminalBackground(),settingsNonce:Kr,backgroundTasks:Hn,activeBackgroundTaskPid:Wh,backgroundTaskHeight:vp,isBackgroundTaskListOpen:Vh,adminSettingsChanged:j,newAgents:ao,showIsExpandableHint:Or,hintMode:r.isModelSteeringEnabled()&&_f(Eo),hintBuffer:""}),[jl,O,ka,tt,uh,ph,Yl,rh,ql,D,I,E,b,w,fp,yp,Tp,xp,On,ie,ae,ye,$i,zr,fu,gu,Ph,Us,Xl,Go,xu,hu,By,po,Ep,Tu,Ql,Ap,pt,hp,Pp,Lp,gy,Bp,Np,pi,Ie,vu,iy,Au,sy,ly,uy,Ha,mu,Iu,Dy,My,Py,Oy,tr,or,bu,Ps,Ly,Fp,oy,Jr,_p,wp,Ln,$l,Qr,Ay,Eo,Iy,Sn,bo,je,gt,ty,Yr,Mp,Mn,Op,Sy,yy,nt,Wi,ji,Ip,kn,x,F,K,Z,dh,Bn,Hp,vy,fy,Cr,Uo,r,Kr,vp,Vh,Wh,Hn,j,ao,Or]),ky=(0,V.useCallback)(()=>N(!1),[N]),X_=(0,V.useMemo)(()=>({handleThemeSelect:gp,closeThemeDialog:su,handleThemeHighlight:ch,handleAuthSelect:Rh,setAuthState:Vo,onAuthError:Nr,handleEditorSelect:nh,exitEditorDialog:ih,exitPrivacyNotice:ky,closeSettingsDialog:ah,closeModelDialog:wh,openVoiceModelDialog:du,closeVoiceModelDialog:_h,openAgentConfigDialog:Ee,closeAgentConfigDialog:Tt,openPermissionsDialog:hi,closePermissionsDialog:Bs,setShellModeActive:Fe,vimHandleInput:Zh,handleIdePromptComplete:Ry,handleFolderTrustSelect:hy,setIsPolicyUpdateDialogOpen:Ty,setConstrainHeight:co,onEscapePromptChange:Ey,refreshStatic:qt,handleFinalSubmit:ec,handleClearScreen:Jh,handleProQuotaChoice:hh,handleValidationChoice:yh,handleOverageMenuChoice:Th,handleEmptyWalletChoice:xh,openSessionBrowser:uu,closeSessionBrowser:Sh,handleResumeSession:Ch,handleDeleteSession:Eh,setQueueErrorMessage:to,addMessage:Eu,popAllMessages:Xh,handleApiKeySubmit:Ih,handleApiKeyCancel:vh,setBannerVisible:jr,setShortcutsHelpVisible:Fs,setCleanUiDetailsVisible:Dh,toggleCleanUiDetailsVisible:Mh,revealCleanUiDetailsTemporarily:pu,handleWarning:kp,setEmbeddedShellFocused:B,dismissBackgroundTask:Gh,setActiveBackgroundTaskPid:$h,setIsBackgroundTaskListOpen:Gs,setAuthContext:Hs,dismissLoginRestart:()=>{Hs({}),Vo("updating")},onHintInput:()=>{},onHintBackspace:()=>{},onHintClear:()=>{},onHintSubmit:()=>{},handleRestart:async()=>{if(th.send){let U=r.getRemoteAdminSettings();U&&th.send({type:"admin-settings-update",settings:U})}await sr()},handleNewAgentsSelect:async U=>{if(ao&&U==="acknowledge"){let fe=r.getAgentRegistry();try{await Promise.all(ao.map(me=>fe.acknowledgeAgent(me)))}catch(me){ue.error("Failed to acknowledge agents:",me),x.addItem({type:"error",text:`Failed to acknowledge agents: ${Br(me)}`},Date.now())}}lo(null)},getPreferredEditor:Ba,clearAccountSuspension:()=>{fh(null),Vo("updating")},setVoiceModeEnabled:U=>{St(U)}}),[gp,su,ch,Rh,Vo,Nr,nh,ih,ky,ah,wh,du,_h,Ee,Tt,hi,Bs,Fe,Zh,Ry,hy,Ty,co,Ey,qt,ec,Jh,hh,yh,Th,xh,uu,Sh,Ch,Eh,to,Eu,Xh,Ih,vh,jr,Fs,Dh,Mh,pu,kp,B,Gh,$h,Gs,Hs,fh,ao,r,x,Ba,St]);return(0,Tn.jsx)(cd.Provider,{value:Y_,children:(0,Tn.jsx)(yC.Provider,{value:z_,children:(0,Tn.jsx)(xC.Provider,{value:j_,children:(0,Tn.jsx)(wf.Provider,{value:X_,children:(0,Tn.jsx)(ld.Provider,{value:r,children:(0,Tn.jsx)(Bf.Provider,{value:{version:e.version,startupWarnings:e.startupWarnings||[]},children:(0,Tn.jsx)(Eb,{config:r,toolCalls:q_,isExpanded:Be,toggleExpansion:Ce,toggleAllExpansion:_e,children:(0,Tn.jsx)(lg.Provider,{value:Iu,children:(0,Tn.jsx)(sd,{mouseEventsEnabled:I,children:(0,Tn.jsx)(hd,{children:(0,Tn.jsx)(Tv,{},`app-${v}`)})})})})})})})})})})};var Pr=C(P(),1);var HN=200;async function Ute(e,t,o,r=process.cwd(),n,s){rI();let i=$u(e.getUseAlternateBuffer(),e.getScreenReader()),a=i;a&&(Qi(),ts(()=>{Ji()}));let{matchers:d,errors:m}=await KS();m.forEach(v=>{xe.emitFeedback("warning",v)});let f=await ZT();FN(kN(r),t);let h=new ES({onNewMessage:v=>{xe.emitConsoleLog(v.type,v.content)},debugMode:e.getDebugMode()});h.patch();let{stdout:p,stderr:y}=wT(),g=!!process.env.SHPOOL_SESSION_NAME,x=()=>(Rm(),(0,Pr.jsx)($S.Provider,{value:t,children:(0,Pr.jsx)(jS,{value:d,children:(0,Pr.jsx)(qS,{config:e,children:(0,Pr.jsx)(sd,{mouseEventsEnabled:a,children:(0,Pr.jsx)(bv,{children:(0,Pr.jsx)(hd,{children:(0,Pr.jsx)(nl,{children:(0,Pr.jsx)(mE,{sessionId:e.getSessionId(),children:(0,Pr.jsx)(TC,{children:(0,Pr.jsx)(g_,{config:e,startupWarnings:o,version:f,resumedSessionData:n,initializationResult:s})})})})})})})})})}));g&&await new Promise(v=>setTimeout(v,100));let S=HS(process.env.DEBUG?(0,Pr.jsx)(h_.default.StrictMode,{children:(0,Pr.jsx)(x,{})}):(0,Pr.jsx)(x,{}),{stdout:p,stderr:y,stdin:process.stdin,exitOnCtrlC:!1,isScreenReaderEnabled:e.getScreenReader(),onRender:({renderTime:v})=>{v>HN&&CT(e,Math.round(v)),hC.reportFrameRendered()},standardReactLayoutTiming:i||e.getUseTerminalBuffer(),patchConsole:!1,alternateBuffer:i,terminalBuffer:e.getUseTerminalBuffer(),renderProcess:e.getUseRenderProcess()&&e.getUseTerminalBuffer(),incrementalRendering:t.merged.ui.incrementalRendering!==!1&&i&&!g,debugRainbow:t.merged.ui.debugRainbow===!0}),I;i&&(Wa(),I=()=>Wu(),ts(I)),Ww(t).then(v=>{Wx(v,t,e.getProjectRoot(),e.getSandboxEnabled())}).catch(v=>{e.getDebugMode()&&ue.warn("Update check failed:",v)});let A=()=>S.unmount();ts(A);let E=Fx();ts(E);let T=()=>h.cleanup();ts(T);try{await S.waitUntilExit()}finally{try{Ks(T),T()}catch(v){ue.error("Error cleaning up console patcher:",v)}try{Ks(A),S.unmount()}catch(v){ue.error("Error unmounting Ink instance:",v)}try{Ks(E),E()}catch(v){ue.error("Error in TTY cleanup:",v)}if(I)try{Ks(I),I()}catch(v){ue.error("Error restoring line wrapping:",v)}}}function FN(e,t){if(!t.merged.ui.hideWindowTitle){let o=Um({streamingState:"idle",isConfirming:!1,isSilentWorking:!1,folderName:e,showThoughts:!!t.merged.ui.showStatusInTitle,useDynamicTitle:t.merged.ui.dynamicWindowTitle});br(`\x1B]0;${o}\x07`),process.on("exit",()=>{br("\x1B]0;\x07")})}}export{Ute as startInteractiveUI};
120
120
  /**
121
121
  * @license
122
122
  * Copyright 2025 Google LLC