@xano/xanoscript-monaco-editor 0.1.0
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.
- package/README.md +181 -0
- package/dist/.vite/manifest.json +300 -0
- package/dist/assets/_.contribution-BThlLkzn.js +1 -0
- package/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/dist/assets/codicon-MLkmQ__h.ttf +0 -0
- package/dist/assets/dark_modern-0rclP-7t.json +1 -0
- package/dist/assets/dark_vs-BL-mUvcK.json +1 -0
- package/dist/assets/editor-BivTGeL1.js +1 -0
- package/dist/assets/editor.worker-BF3gnKDz.js +28 -0
- package/dist/assets/extensionHost.worker-bYZXB0kM.js +144 -0
- package/dist/assets/fake-DXkbmQ09.html +10 -0
- package/dist/assets/files.contribution._fileEditorFactory-vS4ZLYi1.js +4 -0
- package/dist/assets/hc_black-BX9MT4w9.json +1 -0
- package/dist/assets/hc_light-Bzw0ew6e.json +1 -0
- package/dist/assets/iconv-lite-umd-DQaTktu2.js +11 -0
- package/dist/assets/iconv-lite-umd-DYWd8cEa.js +11 -0
- package/dist/assets/index-51WpeTZl.js +11 -0
- package/dist/assets/index-B0wc3Rza.css +1 -0
- package/dist/assets/index-B132pG6E.js +11 -0
- package/dist/assets/index-BGwiFEyd.js +1 -0
- package/dist/assets/index-BPOe4Pu5.css +1 -0
- package/dist/assets/index-BwfWF2CI.js +1433 -0
- package/dist/assets/index-C25FTAfE.js +15 -0
- package/dist/assets/index-C3pnKX8a.js +1 -0
- package/dist/assets/index-CEhqlLL9.css +1 -0
- package/dist/assets/index-Cg3XqiaZ.html +1284 -0
- package/dist/assets/index-CrbRjSB_.js +1 -0
- package/dist/assets/index-D1zNXs16.css +1 -0
- package/dist/assets/index-DgK2LcnW.js +2 -0
- package/dist/assets/index-VRHnXpb2.js +18 -0
- package/dist/assets/index-no-csp-DMfG5HRS.html +1251 -0
- package/dist/assets/index-yPQeQvu7.js +1 -0
- package/dist/assets/layout.contribution.darwin-gdaUfoJf.js +1 -0
- package/dist/assets/layout.contribution.linux-xMjRz7iy.js +1 -0
- package/dist/assets/layout.contribution.win-DZRWibbm.js +1 -0
- package/dist/assets/light_modern-Bbk8M7yq.json +1 -0
- package/dist/assets/light_vs-DwwM7VRG.json +1 -0
- package/dist/assets/main-D6ceXGB_.js +4 -0
- package/dist/assets/main-DNugpDp4.js +4 -0
- package/dist/assets/main-FP17jmvp.js +1 -0
- package/dist/assets/main-b5eBH2vx.js +1 -0
- package/dist/assets/onig-Du5pRr7Y.wasm +0 -0
- package/dist/assets/service-worker-Ce0epi43.js +371 -0
- package/dist/assets/tokenClassificationRegistry-DcBtqg2t.js +2 -0
- package/dist/assets/views-C4cPu3oQ.css +1 -0
- package/dist/assets/views-hUfpm9tT.js +55 -0
- package/dist/assets/webWorkerExtensionHostIframe-636UTAtK.html +156 -0
- package/dist/assets/workbenchThemeService.service-qBFVnuYD.js +1 -0
- package/dist/assets/worker-BIMDXoFp.js +8 -0
- package/dist/index.html +14 -0
- package/dist/logic-assistant-script.js +21798 -0
- package/dist/logic-assistant-script.js.map +7 -0
- package/dist/worker.js +32433 -0
- package/dist/worker.js.map +7 -0
- package/package.json +46 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./layout.contribution.darwin-gdaUfoJf.js","./_.contribution-BThlLkzn.js","./layout.contribution.linux-xMjRz7iy.js","./layout.contribution.win-DZRWibbm.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{Z as Pe,bK as b,bL as X,gs as cb,bO as xe,aj as x,bA as He,ck as P,bN as G,bP as N,$ as y,ce as js,cp as Y,eu as Z,cR as L,gt as Rs,D as R,E,a7 as M,N as oi,gu as Ne,gv as Ht,gw as Vi,d as O,cG as ea,t as ae,gx as lb,bc as Er,A as Bo,gy as hb,gz as ub,gA as pb,eU as gb,gB as Ip,d5 as hs,f as D,g as u,m as mt,bx as ce,W as F,c0 as me,dl as at,bw as At,ch as bs,aH as z,gC as fb,ee as Lm,f3 as Ie,aJ as H,f7 as mb,gD as wb,gE as yb,dx as Ee,gF as vb,go as ta,gG as bb,aK as Re,fI as ia,b$ as Ec,q as c,fC as Hn,fH as sa,a8 as ge,eY as Dp,fn as Fo,dd as Ap,eV as Tp,d6 as Cb,d7 as Sb,fl as Wl,dw as jt,d8 as je,gH as Vm,bY as w,dr as zn,gI as md,db as ke,gJ as _b,da as J,fw as $a,ds as St,dc as te,di as Eg,dj as Ig,eT as Pm,f9 as Mm,gK as Eb,dS as Ko,gL as Ib,eX as wd,gM as Om,j as Ke,dn as it,dp as Tt,cf as Ye,dC as se,fD as Cs,gN as yd,g6 as $s,gO as Db,gP as Ab,gQ as Tb,gR as Nm,cx as qa,dR as Wt,gS as Cn,gT as Bm,cl as Ot,gU as xb,gV as kb,fh as $n,gW as Fm,gX as Km,gY as Wm,gZ as Gm,g_ as Um,g$ as Hm,d_ as Oe,h0 as Rb,h as ie,fi as Lb,ff as Vb,h1 as Ys,h2 as Pb,h3 as Mb,h4 as Ob,h5 as ll,h6 as vd,h7 as zm,h8 as Nb,h9 as Bb,ha as $m,hb as qm,hc as jm,hd as bd,d4 as cs,he as Dg,hf as Fb,d0 as wt,dv as Ym,hg as Sn,hh as Ds,hi as to,hj as Kb,hk as Wb,hl as Gl,hm as Pr,fe as Ul,bo as Ca,hn as Gb,eq as ut,g8 as Ub,ho as Hb,hp as zb,hq as $b,hr as qb,cz as Ag,hs as Jm,ht as jb,hu as ao,hv as Yb,hw as Jb,cv as Zb,G as Wo,hx as we,dt as Xb,bW as Q,cc as Je,hy as Zm,bu as re,hz as Hl,hA as Xm,hB as Tg,hC as Qb,cy as tn,co as Ge,cr as Ss,hD as Ls,hE as Nt,hF as _s,dH as Ic,du as eC,hG as ja,hH as tC,hI as nd,hJ as iC,a9 as qn,hK as sC,as as oC,hL as nC,cq as xp,hM as Js,hN as kp,hO as Rp,hP as rC,z as jn,dN as Zt,hQ as aC,hR as dC,hS as xg,hT as hl,hU as Lp,e5 as kg,e0 as Qm,f6 as cC,hV as lC,dF as Ui,eF as hC,hW as uC,hX as pC,ec as Go,cY as I,bE as k,f4 as ew,dU as Vp,an as or,dV as gC,e_ as fC,eb as Cd,hY as nr,hZ as Ut,h_ as xs,h$ as ot,i0 as Vs,i1 as mC,p as jo,i2 as zl,bh as Ce,x as is,gb as $l,bZ as S,ba as Dc,ak as ee,i3 as co,bb as wi,i4 as wC,i5 as yC,cS as ne,i6 as tw,i7 as ul,i8 as pl,e7 as Rg,dh as Yn,i9 as vC,ia as bC,ib as CC,ic as $t,id as SC,ie as Ya,ig as yi,ih as A,ii as _C,ij as si,aV as EC,bU as Te,ik as ho,aU as iw,il as sw,aR as ow,im as IC,io as Pp,bz as Le,ip as rr,O as Ue,iq as Sa,cj as _a,e1 as Uo,e2 as nw,be as Zs,bf as ql,ir as Lg,ah as _,is as DC,it as rw,iu as AC,iv as Vg,aT as TC,iw as Pg,_ as gl,cg as Mp,ix as Mg,eQ as Ho,iy as xC,iz as kC,u as aw,iA as RC,dP as jl,iB as LC,dg as Yl,iC as xi,iD as rd,R as ve,iE as VC,bD as le,V as ri,iF as $i,i as ar,iG as dr,eW as PC,br as dt,cu as Ir,iH as Ac,a0 as pe,d2 as cr,cO as _t,bd as Qe,iI as MC,U as $,iJ as _n,iK as OC,iL as dw,iM as NC,iN as BC,iO as FC,iP as KC,iQ as Tc,a4 as es,dD as WC,iR as Og,iS as Ng,iT as ft,iU as GC,iV as UC,dy as HC,ad as xc,ae as kc,iW as zC,iX as cw,iY as $C,iZ as lr,i_ as Op,i$ as Sd,j0 as qC,j1 as jC,j2 as Bg,al as YC,j3 as JC,j4 as Np,j5 as Bp,j6 as Fp,j7 as Kp,j8 as pt,j9 as lw,ja as ZC,jb as ji,jc as Wp,jd as br,cA as Ea,je as XC,jf as Fg,jg as gt,jh as q,ji as Kg,jj as Lt,jk as Bt,jl as Ni,jm as ad,jn as hw,jo as Ct,jp as fl,jq as Wg,jr as Ia,js as QC,jt as dd,ju as Gg,cC as De,jv as ii,jw as uw,jx as eS,jy as tS,jz as iS,aQ as Pi,bX as Se,jA as us,jB as sS,bH as Xt,jC as ps,jD as oS,jE as Vt,jF as nS,jG as rS,jH as aS,jI as dS,jJ as cS,jK as Jl,jL as Mr,jM as tt,jN as qe,jO as ml,jP as Ug,jQ as lS,jR as hS,ct as Zl,jS as Hg,bs as zg,ao as Da,jT as fi,jU as $g,jV as _d,jW as uS,jX as pS,jY as gS,jZ as Gp,j_ as Rc,j$ as Up,s as fS,k0 as pw,k1 as ct,k2 as gw,k3 as fw,k4 as Pt,em as Aa,k5 as Ta,k6 as cd,bm as mS,k7 as wS,aL as ln,k8 as yS,k9 as vS,ka as bS,kb as Or,kc as mw,kd as Dr,ke as qg,kf as Nr,kg as jg,kh as CS,ki as SS,bS as Hp,kj as _S,kk as wl,kl as ES,km as IS,gl as DS,kn as AS,ko as Yg,kp as Ar,kq as TS,kr as xS,ks as Jg,kt as he,ku as ww,kv as zp,kw as Lc,a3 as qs,b_ as kS,kx as RS,ky as yw,F as Br,kz as LS,kA as VS,kB as PS,kC as MS,kD as OS,kE as NS,eN as Zg,kF as BS,kG as Jt,kH as FS,kI as KS,kJ as vw,kK as bw,kL as Yo,kM as bi,kN as Cw,kO as Sw,kP as WS,de as _w,kQ as Xg,kR as GS,kS as US,kT as HS,kU as Xl,kV as zS,kW as $S,kX as qS,df as oa,kY as jS,P as Es,cJ as sn,cK as Qg,cL as YS,kZ as Ew,k_ as ef,dE as et,k$ as JS,cN as Ed,l0 as ZS,l1 as tf,l2 as XS,gm as Vc,l3 as sf,l4 as of,l5 as nf,l6 as QS,l7 as e_,dQ as Iw,l8 as rf,l9 as Dw,gq as t_,bJ as Jo,la as Fr,dm as xt,lb as i_,by as s_,eh as Id,lc as yl,eO as Aw,ld as o_,le as af,lf as df,et as n_,cn as pi,lg as r_,lh as a_,li as Ql,lj as cf,lk as d_,ll as Tw,lm as lf,ln as c_,lo as l_,lp as h_,lq as u_,ek as p_,lr as vl,ls as g_,lt as f_,lu as m_,bv as w_,lv as ld,lw as y_,aq as Dd,lx as Ci,ly as v_,lz as xw,lA as Pc,lB as hr,lC as $p,lD as hf,lE as b_,lF as gs,lG as Mc,lH as eh,lI as C_,lJ as Oc,lK as ur,lL as S_,J as __,lM as kw,ev as E_,lN as I_,lO as Mt,lP as D_,lQ as A_,lR as ni,lS as Ad,lT as T_,lU as Rw,lV as x_,lW as k_,lX as R_,lY as uf,b2 as ss,lZ as Jn,l_ as pf,l$ as Td,m0 as Nc,m1 as Tr,m2 as L_,m3 as Bc,m4 as Fc,m5 as V_,m6 as P_,m7 as Lw,m8 as Kc,m9 as M_,ma as Vw,mb as be,X as yt,Y as vt,mc as Pw,md as Mw,me as Ow,mf as nt,mg as Nw,mh as Bw,mi as Fw,mj as Kw,mk as Ww,ml as Gw,mm as Uw,mn as Hw,mo as zw,mp as $w,mq as Wc,mr as qw,ms as bl,mt as Zo,mu as qi,mv as na,mw as xd,mx as jw,my as rt,mz as Cl,cW as ue,mA as qp,mB as _i,mC as Ei,mD as kt,mE as O_,mF as N_,mG as jp,mH as xa,mI as ka,mJ as Ra,mK as Yw,mL as B_,mM as F_,mN as K_,bM as Jw,mO as Zw,mP as W_,mQ as Gc,mR as Sl,mS as _l,mT as Xw,mU as G_,mV as U_,mW as H_,mX as z_,bR as Qw,mY as $_,Q as Uc,fT as q_,mZ as ey,m_ as j_,m$ as th,n0 as gf,n1 as Bi,n2 as ff,n3 as Hc,n4 as Y_,n5 as J_,n6 as Z_,n7 as ty,fK as mf,gi as X_,n8 as Q_,n9 as eE,na as tE,nb as iE,nc as wf,nd as sE,ne as oE,c_ as iy,nf as ze,ng as Ve,nh as ls,ni as lo,nj as nE,nk as Et,nl as uo,nm as rE,nn as kd,no as Yp,np as It,nq as Ja,nr as aE,ns as dE,nt as El,nu as zo,nv as sy,d1 as ih,nw as En,nx as cE,ny as lE,nz as hE,nA as uE,nB as pE,bQ as zc,nC as hn,nD as Jp,nE as Il,nF as yf,nG as Ji,nH as Za,nI as Yi,nJ as sh,nK as vf,nL as Kr,nM as oy,nN as ny,nO as gE,nP as fE,nQ as ry,nR as mE,nS as wE,nT as bf,ge as ay,nU as Wr,nV as Cf,nW as dy,nX as cy,nY as La,nZ as pr,n_ as Hi,n$ as yE,o0 as vE,o1 as ly,o2 as hy,o3 as bE,o4 as uy,o5 as Zp,o6 as oh,o7 as CE,o8 as SE,bF as _E,o9 as EE,oa as mi,ob as Sf,oc as IE,od as _f,oe as DE,of as Dl,og as AE,oh as TE,oi as xE,oj as kE,ok as RE,ol as LE,om as VE,on as py,oo as PE,op as gy,oq as Zi,or as ME,os as Ef,ot as eo,ou as If,ov as OE,ow as Df,ox as Af,oy as $c,oz as nh,oA as fy,oB as qc,oC as Va,oD as my,oE as xr,oF as NE,oG as Tf,oH as BE,oI as FE,oJ as xf,oK as KE,oL as WE,oM as wy,oN as kf,oO as yy,oP as Rf,oQ as vy,oR as Lf,oS as rh,oT as ah,oU as GE,oV as UE,oW as HE,oX as zE,oY as $E,oZ as qE,o_ as jE,o$ as YE,p0 as JE,p1 as ZE,p2 as by,p3 as Cy,p4 as XE,p5 as QE,p6 as eI,p7 as tI,p8 as iI,p9 as sI,pa as oI,pb as nI,pc as rI,pd as aI,pe as dI,pf as cI,pg as lI,ph as hI,pi as uI,pj as pI,pk as gI,pl as fI,pm as mI,pn as wI,po as yI,pp as vI,pq as bI,pr as CI,ps as SI,pt as _I,pu as EI,pv as II,pw as DI,px as AI,py as TI,pz as xI,pA as kI,pB as RI,pC as LI,pD as VI,pE as PI,pF as MI,pG as OI,pH as NI,pI as BI,pJ as FI,pK as KI,pL as WI,pM as GI,pN as UI,pO as HI,pP as zI,pQ as $I,pR as qI,pS as jI,pT as YI,pU as JI,pV as ZI,pW as XI,pX as QI,pY as eD,pZ as tD,p_ as iD,p$ as sD,q0 as oD,q1 as nD,q2 as rD,q3 as aD,q4 as dD,q5 as cD,q6 as lD,q7 as hD,q8 as uD,q9 as pD,qa as Sy,qb as _y,qc as Ey,qd as Iy,qe as Dy,qf as Ay,qg as Ty,qh as xy,qi as gD,qj as fD,qk as mD,ql as wD,qm as yD,qn as vD,qo as bD,qp as CD,qq as SD,qr as _D,qs as ED,qt as ID,qu as DD,qv as ky,qw as AD,qx as Ry,qy as gr,qz as Ly,qA as Vy,qB as jc,qC as Pa,qD as Yc,qE as Ma,qF as TD,qG as Py,qH as Ii,qI as xD,qJ as kD,qK as My,qL as RD,qM as LD,qN as VD,qO as PD,qP as MD,qQ as OD,qR as ND,qS as BD,qT as FD,qU as KD,qV as fr,qW as WD,qX as Oy,qY as Oa,qZ as Ny,q_ as By,q$ as Jc,r0 as Xp,r1 as Na,r2 as Fy,r3 as Ky,r4 as GD,r5 as Wy,r6 as mr,r7 as Gy,r8 as Zc,r9 as Uy,ra as Hy,rb as Ba,rc as zy,rd as $y,re as qy,rf as UD,rg as HD,rh as zD,ri as jy,rj as $D,rk as Xc,rl as $o,rm as qD,rn as jD,ro as YD,rp as JD,rq as ZD,rr as XD,rs as QD,rt as Yy,ru as eA,rv as tA,rw as iA,rx as sA,ry as oA,rz as Zn,rA as Qp,rB as nA,ci as rA,rC as Jy,rD as ra,rE as Al,rF as Cr,gc as aA,rG as Vf,rH as dA,rI as cA,fL as lA,fS as Ki,gk as Pf,rJ as Mf,rK as Zy,rL as hA,rM as qo,rN as uA,rO as pA,M as Gr,rP as Of,rQ as gA,rR as ht,rS as Ae,c as Si,a6 as Wi,rT as Qc,eS as fA,rU as Nf,rV as Bf,rW as mA,o as hd,rX as wA,rY as Xy,rZ as yA,r_ as Ft,r$ as eg,s0 as tg,s1 as el,s2 as ig,s3 as vA,s4 as os,s5 as Xa,s6 as ts,s7 as bA,s8 as Ff,fX as CA,s9 as SA,sa as io,sb as Kf,sc as _A,sd as dh,se as Tl,sf as Wf,sg as Qa,sh as EA,si as IA,sj as Gf,sk as Qy,sl as ev,sm as ed,sn as DA,so as AA,sp as TA,sq as xA,sr as kA,ss as RA,st as LA,su as tv,sv as iv,sw as sv,sx as Rd,sy as VA,sz as Uf,sA as PA,sB as un,sC as xl,sD as MA,sE as Ld,sF as OA,sG as ye,sH as wr,sI as tl,sJ as sg,sK as NA,sL as BA,sM as ov,sN as FA,sO as Hf,sP as Ps,sQ as KA,sR as WA,sS as td,sT as Ur,sU as GA,sV as nv,sW as rv,sX as UA,ex as zf,sY as HA,ez as zA,eA as $A,sZ as qA,eP as jA,s_ as ch,s$ as lh,t0 as hh,t1 as YA,t2 as JA,t3 as ZA,t4 as XA,t5 as QA,t6 as eT,t7 as aa,t8 as og,t9 as tT,ta as iT,tb as $f,tc as sT,td as oT,te as nT,tf as rT,tg as qf,th as av,ti as aT,tj as dT,tk as jf,tl as cT,fs as lT,tm as hT,fr as uT,tn as pT,to as dv,tp as gT,tq as fT,tr as mT,ts as wT,tt as yT,tu as vT,tv as bT,tw as CT,tx as ST,ty as id,fE as _T}from"./index-BwfWF2CI.js";import{f as cv,T as ET}from"./files.contribution._fileEditorFactory-vS4ZLYi1.js";import{I as IT}from"./workbenchThemeService.service-qBFVnuYD.js";const lv=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Pe(lv);b(class extends X{constructor(){super({id:"workbench.action.closeSidebar",title:x(3479,"Close Primary Side Bar"),category:xe.View,f1:!0,precondition:cb})}run(a){a.get(He).setPartHidden(!0,P.SIDEBAR_PART)}});class DT extends X{constructor(){super({id:"workbench.action.focusSideBar",title:x(3480,"Focus into Primary Side Bar"),category:xe.View,f1:!0,keybinding:{weight:G.WorkbenchContrib,when:null,primary:N.CtrlCmd|y.Digit0}})}async run(e){const t=e.get(He),i=e.get(js);t.isVisible(P.SIDEBAR_PART)||t.setPartHidden(!1,P.SIDEBAR_PART),i.getActivePaneComposite(Y.Sidebar)?.focus()}}b(DT);const hv=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Pe(hv);const AT={separatorBorder:oi.transparent};function Fi(a){return a===Z.VERTICAL?Z.HORIZONTAL:Z.VERTICAL}class TT{constructor(e){this.isLayoutEnabled=e}}function xT(a,e){return e===Z.HORIZONTAL?{left:a.start,right:a.end,top:a.orthogonalStart,bottom:a.orthogonalEnd}:{top:a.start,bottom:a.end,left:a.orthogonalStart,right:a.orthogonalEnd}}function kT(a,e){return e===Z.HORIZONTAL?{start:a.left,end:a.right,orthogonalStart:a.top,orthogonalEnd:a.bottom}:{start:a.top,end:a.bottom,orthogonalStart:a.left,orthogonalEnd:a.right}}function hi(a,e){if(Math.abs(a)>e)throw new Error("Invalid index");return lb(a,e+1)}class _e{get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get absoluteOffset(){return this._absoluteOffset}get absoluteOrthogonalOffset(){return this._absoluteOrthogonalOffset}get styles(){return this._styles}get width(){return this.orientation===Z.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===Z.HORIZONTAL?this.orthogonalSize:this.size}get top(){return this.orientation===Z.HORIZONTAL?this._absoluteOffset:this._absoluteOrthogonalOffset}get left(){return this.orientation===Z.HORIZONTAL?this._absoluteOrthogonalOffset:this._absoluteOffset}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get priority(){if(this.children.length===0)return Vi.Normal;const e=this.children.map(t=>typeof t.priority>"u"?Vi.Normal:t.priority);return e.some(t=>t===Vi.High)?Vi.High:e.some(t=>t===Vi.Low)?Vi.Low:Vi.Normal}get proportionalLayout(){return this.children.length===0?!0:this.children.every(e=>e.proportionalLayout)}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get minimumWidth(){return this.orientation===Z.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===Z.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===Z.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===Z.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get boundarySashes(){return this._boundarySashes}set boundarySashes(e){if(!(this._boundarySashes.start===e.start&&this._boundarySashes.end===e.end&&this._boundarySashes.orthogonalStart===e.orthogonalStart&&this._boundarySashes.orthogonalEnd===e.orthogonalEnd)){this._boundarySashes=e,this.splitview.orthogonalStartSash=e.orthogonalStart,this.splitview.orthogonalEndSash=e.orthogonalEnd;for(let t=0;t<this.children.length;t++){const i=this.children[t],s=t===0,o=t===this.children.length-1;i.boundarySashes={start:e.orthogonalStart,end:e.orthogonalEnd,orthogonalStart:s?e.start:i.boundarySashes.orthogonalStart,orthogonalEnd:o?e.end:i.boundarySashes.orthogonalEnd}}}}get edgeSnapping(){return this._edgeSnapping}set edgeSnapping(e){if(this._edgeSnapping!==e){this._edgeSnapping=e;for(const t of this.children)t instanceof _e&&(t.edgeSnapping=e);this.updateSplitviewEdgeSnappingEnablement()}}constructor(e,t,i,s,o=0,n=0,r=!1,d){if(this.orientation=e,this.layoutController=t,this.splitviewProportionalLayout=s,this.children=[],this._absoluteOffset=0,this._absoluteOrthogonalOffset=0,this.absoluteOrthogonalSize=0,this._onDidChange=new E,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new E,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this.childrenVisibilityChangeDisposable=new O,this._onDidScroll=new E,this.onDidScrollDisposable=R.None,this.onDidScroll=this._onDidScroll.event,this.childrenChangeDisposable=R.None,this._onDidSashReset=new E,this.onDidSashReset=this._onDidSashReset.event,this.splitviewSashResetDisposable=R.None,this.childrenSashResetDisposable=R.None,this._boundarySashes={},this._edgeSnapping=!1,this._styles=i,this._size=o,this._orthogonalSize=n,this.element=M(".monaco-grid-branch-node"),!d)this.splitview=new ea(this.element,{orientation:e,styles:i,proportionalLayout:s}),this.splitview.layout(o,{orthogonalSize:n,absoluteOffset:0,absoluteOrthogonalOffset:0,absoluteSize:o,absoluteOrthogonalSize:n});else{const h={views:d.map(f=>({view:f.node,size:f.node.size,visible:f.visible!==!1})),size:this.orthogonalSize},p={proportionalLayout:s,orientation:e,styles:i};this.children=d.map(f=>f.node),this.splitview=new ea(this.element,{...p,descriptor:h}),this.children.forEach((f,g)=>{const m=g===0,v=g===this.children.length;f.boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:m?this.boundarySashes.start:this.splitview.sashes[g-1],orthogonalEnd:v?this.boundarySashes.end:this.splitview.sashes[g]}})}const l=L.map(this.splitview.onDidSashReset,h=>[h]);this.splitviewSashResetDisposable=l(this._onDidSashReset.fire,this._onDidSashReset),this.updateChildrenEvents()}style(e){this._styles=e,this.splitview.style(e);for(const t of this.children)t instanceof _e&&t.style(e)}layout(e,t,i){if(this.layoutController.isLayoutEnabled){if(typeof i>"u")throw new Error("Invalid state");this._size=i.orthogonalSize,this._orthogonalSize=e,this._absoluteOffset=i.absoluteOffset+t,this._absoluteOrthogonalOffset=i.absoluteOrthogonalOffset,this.absoluteOrthogonalSize=i.absoluteOrthogonalSize,this.splitview.layout(i.orthogonalSize,{orthogonalSize:e,absoluteOffset:this._absoluteOrthogonalOffset,absoluteOrthogonalOffset:this._absoluteOffset,absoluteSize:i.absoluteOrthogonalSize,absoluteOrthogonalSize:i.absoluteSize}),this.updateSplitviewEdgeSnappingEnablement()}}setVisible(e){for(const t of this.children)t.setVisible(e)}addChild(e,t,i,s){i=hi(i,this.children.length),this.splitview.addView(e,t,i,s),this.children.splice(i,0,e),this.updateBoundarySashes(),this.onDidChildrenChange()}removeChild(e,t){e=hi(e,this.children.length);const i=this.splitview.removeView(e,t);return this.children.splice(e,1),this.updateBoundarySashes(),this.onDidChildrenChange(),i}removeAllChildren(){const e=this.splitview.removeAllViews();return this.children.splice(0,this.children.length),this.updateBoundarySashes(),this.onDidChildrenChange(),e}moveChild(e,t){e=hi(e,this.children.length),t=hi(t,this.children.length),e!==t&&(e<t&&(t-=1),this.splitview.moveView(e,t),this.children.splice(t,0,this.children.splice(e,1)[0]),this.updateBoundarySashes(),this.onDidChildrenChange())}swapChildren(e,t){e=hi(e,this.children.length),t=hi(t,this.children.length),e!==t&&(this.splitview.swapViews(e,t),[this.children[e].boundarySashes,this.children[t].boundarySashes]=[this.children[e].boundarySashes,this.children[t].boundarySashes],[this.children[e],this.children[t]]=[this.children[t],this.children[e]],this.onDidChildrenChange())}resizeChild(e,t){e=hi(e,this.children.length),this.splitview.resizeView(e,t)}isChildExpanded(e){return this.splitview.isViewExpanded(e)}distributeViewSizes(e=!1){if(this.splitview.distributeViewSizes(),e)for(const t of this.children)t instanceof _e&&t.distributeViewSizes(!0)}getChildSize(e){return e=hi(e,this.children.length),this.splitview.getViewSize(e)}isChildVisible(e){return e=hi(e,this.children.length),this.splitview.isViewVisible(e)}setChildVisible(e,t){if(e=hi(e,this.children.length),this.splitview.isViewVisible(e)===t)return;const i=this.splitview.contentSize===0;this.splitview.setViewVisible(e,t);const s=this.splitview.contentSize===0;(t&&i||!t&&s)&&this._onDidVisibilityChange.fire(t)}getChildCachedVisibleSize(e){return e=hi(e,this.children.length),this.splitview.getViewCachedVisibleSize(e)}updateBoundarySashes(){for(let e=0;e<this.children.length;e++)this.children[e].boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:e===0?this.boundarySashes.start:this.splitview.sashes[e-1],orthogonalEnd:e===this.children.length-1?this.boundarySashes.end:this.splitview.sashes[e]}}onDidChildrenChange(){this.updateChildrenEvents(),this._onDidChange.fire(void 0)}updateChildrenEvents(){const e=L.map(L.any(...this.children.map(s=>s.onDidChange)),()=>{});this.childrenChangeDisposable.dispose(),this.childrenChangeDisposable=e(this._onDidChange.fire,this._onDidChange);const t=L.any(...this.children.map((s,o)=>L.map(s.onDidSashReset,n=>[o,...n])));this.childrenSashResetDisposable.dispose(),this.childrenSashResetDisposable=t(this._onDidSashReset.fire,this._onDidSashReset);const i=L.any(L.signal(this.splitview.onDidScroll),...this.children.map(s=>s.onDidScroll));this.onDidScrollDisposable.dispose(),this.onDidScrollDisposable=i(this._onDidScroll.fire,this._onDidScroll),this.childrenVisibilityChangeDisposable.clear(),this.children.forEach((s,o)=>{s instanceof _e&&this.childrenVisibilityChangeDisposable.add(s.onDidVisibilityChange(n=>{this.setChildVisible(o,n)}))})}trySet2x2(e){if(this.children.length!==2||e.children.length!==2)return R.None;if(this.getChildSize(0)!==e.getChildSize(0))return R.None;const[t,i]=this.children,[s,o]=e.children;if(!(t instanceof We)||!(i instanceof We))return R.None;if(!(s instanceof We)||!(o instanceof We))return R.None;this.orientation===Z.VERTICAL?(i.linkedWidthNode=s.linkedHeightNode=t,t.linkedWidthNode=o.linkedHeightNode=i,o.linkedWidthNode=t.linkedHeightNode=s,s.linkedWidthNode=i.linkedHeightNode=o):(s.linkedWidthNode=i.linkedHeightNode=t,o.linkedWidthNode=t.linkedHeightNode=i,t.linkedWidthNode=o.linkedHeightNode=s,i.linkedWidthNode=s.linkedHeightNode=o);const n=this.splitview.sashes[0],r=e.splitview.sashes[0];return n.linkedSash=r,r.linkedSash=n,this._onDidChange.fire(void 0),e._onDidChange.fire(void 0),ae(()=>{n.linkedSash=r.linkedSash=void 0,t.linkedHeightNode=t.linkedWidthNode=void 0,i.linkedHeightNode=i.linkedWidthNode=void 0,s.linkedHeightNode=s.linkedWidthNode=void 0,o.linkedHeightNode=o.linkedWidthNode=void 0})}updateSplitviewEdgeSnappingEnablement(){this.splitview.startSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset>0,this.splitview.endSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset+this._size<this.absoluteOrthogonalSize}dispose(){for(const e of this.children)e.dispose();this._onDidChange.dispose(),this._onDidSashReset.dispose(),this._onDidVisibilityChange.dispose(),this.childrenVisibilityChangeDisposable.dispose(),this.splitviewSashResetDisposable.dispose(),this.childrenSashResetDisposable.dispose(),this.childrenChangeDisposable.dispose(),this.onDidScrollDisposable.dispose(),this.splitview.dispose()}}function RT(a){const[e,t]=L.split(a.onDidChange,Er);return L.any(t,L.map(L.latch(L.map(e,i=>[a.minimumWidth,a.maximumWidth,a.minimumHeight,a.maximumHeight]),Bo),i=>{}))}class We{get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get linkedWidthNode(){return this._linkedWidthNode}set linkedWidthNode(e){this._onDidLinkedWidthNodeChange.input=e?e._onDidViewChange:L.None,this._linkedWidthNode=e,this._onDidSetLinkedNode.fire(void 0)}get linkedHeightNode(){return this._linkedHeightNode}set linkedHeightNode(e){this._onDidLinkedHeightNodeChange.input=e?e._onDidViewChange:L.None,this._linkedHeightNode=e,this._onDidSetLinkedNode.fire(void 0)}constructor(e,t,i,s,o=0){this.view=e,this.orientation=t,this.layoutController=i,this._size=0,this.absoluteOffset=0,this.absoluteOrthogonalOffset=0,this.onDidScroll=L.None,this.onDidSashReset=L.None,this._onDidLinkedWidthNodeChange=new Rs,this._linkedWidthNode=void 0,this._onDidLinkedHeightNodeChange=new Rs,this._linkedHeightNode=void 0,this._onDidSetLinkedNode=new E,this.disposables=new O,this._boundarySashes={},this.cachedWidth=0,this.cachedHeight=0,this.cachedTop=0,this.cachedLeft=0,this._orthogonalSize=s,this._size=o;const n=RT(e);this._onDidViewChange=L.map(n,r=>r&&(this.orientation===Z.VERTICAL?r.width:r.height),this.disposables),this.onDidChange=L.any(this._onDidViewChange,this._onDidSetLinkedNode.event,this._onDidLinkedWidthNodeChange.event,this._onDidLinkedHeightNodeChange.event)}get width(){return this.orientation===Z.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===Z.HORIZONTAL?this.size:this.orthogonalSize}get top(){return this.orientation===Z.HORIZONTAL?this.absoluteOffset:this.absoluteOrthogonalOffset}get left(){return this.orientation===Z.HORIZONTAL?this.absoluteOrthogonalOffset:this.absoluteOffset}get element(){return this.view.element}get minimumWidth(){return this.linkedWidthNode?Math.max(this.linkedWidthNode.view.minimumWidth,this.view.minimumWidth):this.view.minimumWidth}get maximumWidth(){return this.linkedWidthNode?Math.min(this.linkedWidthNode.view.maximumWidth,this.view.maximumWidth):this.view.maximumWidth}get minimumHeight(){return this.linkedHeightNode?Math.max(this.linkedHeightNode.view.minimumHeight,this.view.minimumHeight):this.view.minimumHeight}get maximumHeight(){return this.linkedHeightNode?Math.min(this.linkedHeightNode.view.maximumHeight,this.view.maximumHeight):this.view.maximumHeight}get minimumSize(){return this.orientation===Z.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===Z.HORIZONTAL?this.maximumHeight:this.maximumWidth}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return this.view.snap}get minimumOrthogonalSize(){return this.orientation===Z.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===Z.HORIZONTAL?this.maximumWidth:this.maximumHeight}get boundarySashes(){return this._boundarySashes}set boundarySashes(e){this._boundarySashes=e,this.view.setBoundarySashes?.(xT(e,this.orientation))}layout(e,t,i){if(this.layoutController.isLayoutEnabled){if(typeof i>"u")throw new Error("Invalid state");this._size=e,this._orthogonalSize=i.orthogonalSize,this.absoluteOffset=i.absoluteOffset+t,this.absoluteOrthogonalOffset=i.absoluteOrthogonalOffset,this._layout(this.width,this.height,this.top,this.left)}}_layout(e,t,i,s){this.cachedWidth===e&&this.cachedHeight===t&&this.cachedTop===i&&this.cachedLeft===s||(this.cachedWidth=e,this.cachedHeight=t,this.cachedTop=i,this.cachedLeft=s,this.view.layout(e,t,i,s))}setVisible(e){this.view.setVisible?.(e)}dispose(){this.disposables.dispose()}}function uv(a,e,t){if(a instanceof _e){const i=new _e(Fi(a.orientation),a.layoutController,a.styles,a.splitviewProportionalLayout,e,t,a.edgeSnapping);let s=0;for(let o=a.children.length-1;o>=0;o--){const n=a.children[o],r=n instanceof _e?n.orthogonalSize:n.size;let d=a.size===0?0:Math.round(e*r/a.size);s+=d,o===0&&(d+=e-s),i.addChild(uv(n,t,d),d,0,!0)}return a.dispose(),i}else{const i=new We(a.view,Fi(a.orientation),a.layoutController,t);return a.dispose(),i}}class In{get root(){return this._root}set root(e){const t=this._root;t&&(t.element.remove(),t.dispose()),this._root=e,this.element.appendChild(e.element),this.onDidSashResetRelay.input=e.onDidSashReset,this._onDidChange.input=L.map(e.onDidChange,()=>{}),this._onDidScroll.input=e.onDidScroll}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get orientation(){return this._root.orientation}get boundarySashes(){return this._boundarySashes}set orientation(e){if(this._root.orientation===e)return;const{size:t,orthogonalSize:i,absoluteOffset:s,absoluteOrthogonalOffset:o}=this._root;this.root=uv(this._root,i,t),this.root.layout(t,0,{orthogonalSize:i,absoluteOffset:o,absoluteOrthogonalOffset:s,absoluteSize:t,absoluteOrthogonalSize:i}),this.boundarySashes=this.boundarySashes}set boundarySashes(e){this._boundarySashes=e,this.root.boundarySashes=kT(e,this.orientation)}set edgeSnapping(e){this.root.edgeSnapping=e}constructor(e={}){this.onDidSashResetRelay=new Rs,this._onDidScroll=new Rs,this._onDidChange=new Rs,this._boundarySashes={},this.disposable2x2=R.None,this.onDidSashReset=this.onDidSashResetRelay.event,this.onDidScroll=this._onDidScroll.event,this.onDidChange=this._onDidChange.event,this.maximizedNode=void 0,this._onDidChangeViewMaximized=new E,this.onDidChangeViewMaximized=this._onDidChangeViewMaximized.event,this.element=M(".monaco-grid-view"),this.styles=e.styles||AT,this.proportionalLayout=typeof e.proportionalLayout<"u"?!!e.proportionalLayout:!0,this.layoutController=new TT(!1),this.root=new _e(Z.VERTICAL,this.layoutController,this.styles,this.proportionalLayout)}style(e){this.styles=e,this.root.style(e)}layout(e,t,i=0,s=0){this.layoutController.isLayoutEnabled=!0;const[o,n,r,d]=this.root.orientation===Z.HORIZONTAL?[t,e,i,s]:[e,t,s,i];this.root.layout(o,0,{orthogonalSize:n,absoluteOffset:r,absoluteOrthogonalOffset:d,absoluteSize:o,absoluteOrthogonalSize:n})}addView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=R.None;const[s,o]=Ne(i),[n,r]=this.getNode(s);if(r instanceof _e){const d=new We(e,Fi(r.orientation),this.layoutController,r.orthogonalSize);try{r.addChild(d,t,o)}catch(l){throw d.dispose(),l}}else{const[,d]=Ne(n),[,l]=Ne(s);let h=0;const p=d.getChildCachedVisibleSize(l);typeof p=="number"&&(h=Ht.Invisible(p)),d.removeChild(l).dispose();const g=new _e(r.orientation,r.layoutController,this.styles,this.proportionalLayout,r.size,r.orthogonalSize,d.edgeSnapping);d.addChild(g,r.size,l);const m=new We(r.view,d.orientation,this.layoutController,r.size);g.addChild(m,h,0),typeof t!="number"&&t.type==="split"&&(t=Ht.Split(0));const v=new We(e,d.orientation,this.layoutController,r.size);g.addChild(v,t,o)}this.trySet2x2()}removeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=R.None;const[i,s]=Ne(e),[o,n]=this.getNode(i);if(!(n instanceof _e))throw new Error("Invalid location");const r=n.children[s];if(!(r instanceof We))throw new Error("Invalid location");if(n.removeChild(s,t),r.dispose(),n.children.length===0)throw new Error("Invalid grid state");if(n.children.length>1)return this.trySet2x2(),r.view;if(o.length===0){const g=n.children[0];return g instanceof We||(n.removeChild(0),n.dispose(),this.root=g,this.boundarySashes=this.boundarySashes,this.trySet2x2()),r.view}const[,d]=Ne(o),[,l]=Ne(i),h=n.isChildVisible(0),p=n.removeChild(0),f=d.children.map((g,m)=>d.getChildSize(m));if(d.removeChild(l,t),n.dispose(),p instanceof _e){f.splice(l,1,...p.children.map(m=>m.size));const g=p.removeAllChildren();for(let m=0;m<g.length;m++)d.addChild(g[m],g[m].size,l+m)}else{const g=new We(p.view,Fi(p.orientation),this.layoutController,p.size),m=h?p.orthogonalSize:Ht.Invisible(p.orthogonalSize);d.addChild(g,m,l)}p.dispose();for(let g=0;g<f.length;g++)d.resizeChild(g,f[g]);return this.trySet2x2(),r.view}moveView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView();const[,s]=this.getNode(e);if(!(s instanceof _e))throw new Error("Invalid location");s.moveChild(t,i),this.trySet2x2()}swapViews(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[i,s]=Ne(e),[,o]=this.getNode(i);if(!(o instanceof _e))throw new Error("Invalid from location");const n=o.getChildSize(s),r=o.children[s];if(!(r instanceof We))throw new Error("Invalid from location");const[d,l]=Ne(t),[,h]=this.getNode(d);if(!(h instanceof _e))throw new Error("Invalid to location");const p=h.getChildSize(l),f=h.children[l];if(!(f instanceof We))throw new Error("Invalid to location");o===h?o.swapChildren(s,l):(o.removeChild(s),h.removeChild(l),o.addChild(f,n,s),h.addChild(r,p,l)),this.trySet2x2()}resizeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[i,s]=Ne(e),[o,n]=this.getNode(i);if(!(n instanceof _e))throw new Error("Invalid location");if(!t.width&&!t.height)return;const[r,d]=n.orientation===Z.HORIZONTAL?[t.width,t.height]:[t.height,t.width];if(typeof d=="number"&&o.length>0){const[,l]=Ne(o),[,h]=Ne(i);l.resizeChild(h,d)}typeof r=="number"&&n.resizeChild(s,r),this.trySet2x2()}getViewSize(e){if(!e)return{width:this.root.width,height:this.root.height};const[,t]=this.getNode(e);return{width:t.width,height:t.height}}getViewCachedVisibleSize(e){const[t,i]=Ne(e),[,s]=this.getNode(t);if(!(s instanceof _e))throw new Error("Invalid location");return s.getChildCachedVisibleSize(i)}expandView(e){this.hasMaximizedView()&&this.exitMaximizedView();const[t,i]=this.getNode(e);if(!(i instanceof We))throw new Error("Invalid location");for(let s=0;s<t.length;s++)t[s].resizeChild(e[s],Number.POSITIVE_INFINITY)}isViewExpanded(e){if(this.hasMaximizedView())return!1;const[t,i]=this.getNode(e);if(!(i instanceof We))throw new Error("Invalid location");for(let s=0;s<t.length;s++)if(!t[s].isChildExpanded(e[s]))return!1;return!0}maximizeView(e){const[,t]=this.getNode(e);if(!(t instanceof We))throw new Error("Location is not a LeafNode");if(this.maximizedNode===t)return;this.hasMaximizedView()&&this.exitMaximizedView();function i(s,o){for(let n=0;n<s.children.length;n++){const r=s.children[n];r instanceof We?r!==o&&s.setChildVisible(n,!1):i(r,o)}}i(this.root,t),this.maximizedNode=t,this._onDidChangeViewMaximized.fire(!0)}exitMaximizedView(){if(!this.maximizedNode)return;this.maximizedNode=void 0;function e(t){for(let i=t.children.length-1;i>=0;i--){const s=t.children[i];s instanceof We?t.setChildVisible(i,!0):e(s)}}e(this.root),this._onDidChangeViewMaximized.fire(!1)}hasMaximizedView(){return this.maximizedNode!==void 0}isViewMaximized(e){const[,t]=this.getNode(e);if(!(t instanceof We))throw new Error("Location is not a LeafNode");return t===this.maximizedNode}distributeViewSizes(e){if(this.hasMaximizedView()&&this.exitMaximizedView(),!e){this.root.distributeViewSizes(!0);return}const[,t]=this.getNode(e);if(!(t instanceof _e))throw new Error("Invalid location");t.distributeViewSizes(),this.trySet2x2()}isViewVisible(e){const[t,i]=Ne(e),[,s]=this.getNode(t);if(!(s instanceof _e))throw new Error("Invalid from location");return s.isChildVisible(i)}setViewVisible(e,t){if(this.hasMaximizedView()){this.exitMaximizedView();return}const[i,s]=Ne(e),[,o]=this.getNode(i);if(!(o instanceof _e))throw new Error("Invalid from location");o.setChildVisible(s,t)}getView(e){const t=e?this.getNode(e)[1]:this._root;return this._getViews(t,this.orientation)}static deserialize(e,t,i={}){if(typeof e.orientation!="number")throw new Error("Invalid JSON: 'orientation' property must be a number.");if(typeof e.width!="number")throw new Error("Invalid JSON: 'width' property must be a number.");if(typeof e.height!="number")throw new Error("Invalid JSON: 'height' property must be a number.");if(e.root?.type!=="branch")throw new Error("Invalid JSON: 'root' property must have 'type' value of branch.");const s=e.orientation,o=e.height,n=new In(i);return n._deserialize(e.root,s,t,o),n}_deserialize(e,t,i,s){this.root=this._deserializeNode(e,t,i,s)}_deserializeNode(e,t,i,s){let o;if(e.type==="branch"){const r=e.data.map(d=>({node:this._deserializeNode(d,Fi(t),i,e.size),visible:d.visible}));o=new _e(t,this.layoutController,this.styles,this.proportionalLayout,e.size,s,void 0,r)}else o=new We(i.fromJSON(e.data),t,this.layoutController,s,e.size),e.maximized&&!this.maximizedNode&&(this.maximizedNode=o,this._onDidChangeViewMaximized.fire(!0));return o}_getViews(e,t,i){const s={top:e.top,left:e.left,width:e.width,height:e.height};if(e instanceof We)return{view:e.view,box:s,cachedVisibleSize:i,maximized:this.maximizedNode===e};const o=[];for(let n=0;n<e.children.length;n++){const r=e.children[n],d=e.getChildCachedVisibleSize(n);o.push(this._getViews(r,Fi(t),d))}return{children:o,box:s}}getNode(e,t=this.root,i=[]){if(e.length===0)return[i,t];if(!(t instanceof _e))throw new Error("Invalid location");const[s,...o]=e;if(s<0||s>=t.children.length)throw new Error("Invalid location");const n=t.children[s];return i.push(t),this.getNode(o,n,i)}trySet2x2(){if(this.disposable2x2.dispose(),this.disposable2x2=R.None,this.root.children.length!==2)return;const[e,t]=this.root.children;!(e instanceof _e)||!(t instanceof _e)||(this.disposable2x2=e.trySet2x2(t))}getViewMap(e,t){t||(t=this.root),t instanceof _e?t.children.forEach(i=>this.getViewMap(e,i)):e.set(t.view,t.element)}dispose(){this.onDidSashResetRelay.dispose(),this.root.dispose(),this.element.remove()}}Pe(hv);var de;(function(a){a[a.Up=0]="Up",a[a.Down=1]="Down",a[a.Left=2]="Left",a[a.Right=3]="Right"})(de||(de={}));function LT(a){switch(a){case de.Up:return de.Down;case de.Down:return de.Up;case de.Left:return de.Right;case de.Right:return de.Left}}function po(a){return!!a.children}function pv(a,e){if(e.length===0)return a;if(!po(a))throw new Error("Invalid location");const[t,...i]=e;return pv(a.children[t],i)}function VT(a,e){return!(a.start>=e.end||e.start>=a.end)}function gv(a,e){const t=ng(e),i=e===de.Up?a.top:e===de.Right?a.left+a.width:e===de.Down?a.top+a.height:a.left,s={start:t===Z.HORIZONTAL?a.top:a.left,end:t===Z.HORIZONTAL?a.top+a.height:a.left+a.width};return{offset:i,range:s}}function PT(a,e,t){const i=[];function s(o,n,r){if(po(o))for(const d of o.children)s(d,n,r);else{const{offset:d,range:l}=gv(o.box,n);d===r.offset&&VT(l,r.range)&&i.push(o)}}return s(a,e,t),i}function uh(a,e){return e.length%2===0?Fi(a):a}function ng(a){return a===de.Up||a===de.Down?Z.VERTICAL:Z.HORIZONTAL}function Yf(a,e,t){const i=uh(a,e),s=ng(t);if(i===s){let[o,n]=Ne(e);return(t===de.Right||t===de.Down)&&(n+=1),[...o,n]}else{const o=t===de.Right||t===de.Down?1:0;return[...e,o]}}function MT(a){const e=a.parentElement;if(!e)throw new Error("Invalid grid element");let t=e.firstElementChild,i=0;for(;t!==a&&t!==e.lastElementChild&&t;)t=t.nextElementSibling,i++;return i}function fv(a){const e=a.parentElement;if(!e)throw new Error("Invalid grid element");if(/\bmonaco-grid-view\b/.test(e.className))return[];const t=MT(e),i=e.parentElement.parentElement.parentElement.parentElement;return[...fv(i),t]}var Dn;(function(a){a.Distribute={type:"distribute"},a.Split={type:"split"},a.Auto={type:"auto"};function e(t){return{type:"invisible",cachedVisibleSize:t}}a.Invisible=e})(Dn||(Dn={}));class OT extends R{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumWidth(){return this.gridview.minimumWidth}get minimumHeight(){return this.gridview.minimumHeight}get maximumWidth(){return this.gridview.maximumWidth}get maximumHeight(){return this.gridview.maximumHeight}get boundarySashes(){return this.gridview.boundarySashes}set boundarySashes(e){this.gridview.boundarySashes=e}set edgeSnapping(e){this.gridview.edgeSnapping=e}get element(){return this.gridview.element}constructor(e,t={}){super(),this.views=new Map,this.didLayout=!1,e instanceof In?(this.gridview=e,this.gridview.getViewMap(this.views)):this.gridview=new In(t),this._register(this.gridview),this._register(this.gridview.onDidSashReset(this.onDidSashReset,this)),e instanceof In||this._addView(e,0,[0]),this.onDidChange=this.gridview.onDidChange,this.onDidScroll=this.gridview.onDidScroll,this.onDidChangeViewMaximized=this.gridview.onDidChangeViewMaximized}style(e){this.gridview.style(e)}layout(e,t,i=0,s=0){this.gridview.layout(e,t,i,s),this.didLayout=!0}addView(e,t,i,s){if(this.views.has(e))throw new Error("Can't add same view twice");const o=ng(s);this.views.size===1&&this.orientation!==o&&(this.orientation=o);const n=this.getViewLocation(i),r=Yf(this.gridview.orientation,n,s);let d;if(typeof t=="number")d=t;else if(t.type==="split"){const[,l]=Ne(n);d=Ht.Split(l)}else if(t.type==="distribute")d=Ht.Distribute;else if(t.type==="auto"){const[,l]=Ne(n);d=Ht.Auto(l)}else d=t;this._addView(e,d,r)}addViewAt(e,t,i){if(this.views.has(e))throw new Error("Can't add same view twice");let s;typeof t=="number"?s=t:t.type==="distribute"?s=Ht.Distribute:s=t,this._addView(e,s,i)}_addView(e,t,i){this.views.set(e,e.element),this.gridview.addView(e,t,i)}removeView(e,t){if(this.views.size===1)throw new Error("Can't remove last view");const i=this.getViewLocation(e);let s;if(t?.type==="distribute")s=Ht.Distribute;else if(t?.type==="auto"){const o=i[i.length-1];s=Ht.Auto(o===0?1:o-1)}this.gridview.removeView(i,s),this.views.delete(e)}moveView(e,t,i,s){const o=this.getViewLocation(e),[n,r]=Ne(o),d=this.getViewLocation(i),l=Yf(this.gridview.orientation,d,s),[h,p]=Ne(l);Bo(n,h)?this.gridview.moveView(n,r,p):(this.removeView(e,typeof t=="number"?void 0:t),this.addView(e,t,i,s))}moveViewTo(e,t){const i=this.getViewLocation(e),[s,o]=Ne(i),[n,r]=Ne(t);if(Bo(s,n))this.gridview.moveView(s,o,r);else{const d=this.getViewSize(e),l=uh(this.gridview.orientation,i),h=this.getViewCachedVisibleSize(e),p=typeof h>"u"?l===Z.HORIZONTAL?d.width:d.height:Dn.Invisible(h);this.removeView(e),this.addViewAt(e,p,t)}}swapViews(e,t){const i=this.getViewLocation(e),s=this.getViewLocation(t);return this.gridview.swapViews(i,s)}resizeView(e,t){const i=this.getViewLocation(e);return this.gridview.resizeView(i,t)}isViewExpanded(e){const t=this.getViewLocation(e);return this.gridview.isViewExpanded(t)}isViewMaximized(e){const t=this.getViewLocation(e);return this.gridview.isViewMaximized(t)}hasMaximizedView(){return this.gridview.hasMaximizedView()}getViewSize(e){if(!e)return this.gridview.getViewSize();const t=this.getViewLocation(e);return this.gridview.getViewSize(t)}getViewCachedVisibleSize(e){const t=this.getViewLocation(e);return this.gridview.getViewCachedVisibleSize(t)}maximizeView(e){if(this.views.size<2)throw new Error("At least two views are required to maximize a view");const t=this.getViewLocation(e);this.gridview.maximizeView(t)}exitMaximizedView(){this.gridview.exitMaximizedView()}expandView(e){const t=this.getViewLocation(e);this.gridview.expandView(t)}distributeViewSizes(){this.gridview.distributeViewSizes()}isViewVisible(e){const t=this.getViewLocation(e);return this.gridview.isViewVisible(t)}setViewVisible(e,t){const i=this.getViewLocation(e);this.gridview.setViewVisible(i,t)}getViews(){return this.gridview.getView()}getNeighborViews(e,t,i=!1){if(!this.didLayout)throw new Error("Can't call getNeighborViews before first layout");const s=this.getViewLocation(e),o=this.getViews(),n=pv(o,s);let r=gv(n.box,t);return i&&(t===de.Up&&n.box.top===0?r={offset:o.box.top+o.box.height,range:r.range}:t===de.Right&&n.box.left+n.box.width===o.box.width?r={offset:0,range:r.range}:t===de.Down&&n.box.top+n.box.height===o.box.height?r={offset:0,range:r.range}:t===de.Left&&n.box.left===0&&(r={offset:o.box.left+o.box.width,range:r.range})),PT(o,LT(t),r).map(d=>d.view)}getViewLocation(e){const t=this.views.get(e);if(!t)throw new Error("View not found");return fv(t)}onDidSashReset(e){const t=o=>{const n=this.gridview.getView(o);if(po(n))return!1;const r=uh(this.orientation,o),d=r===Z.HORIZONTAL?n.view.preferredWidth:n.view.preferredHeight;if(typeof d!="number")return!1;const l=r===Z.HORIZONTAL?{width:Math.round(d)}:{height:Math.round(d)};return this.gridview.resizeView(o,l),!0};if(t(e))return;const[i,s]=Ne(e);t([...i,s+1])||this.gridview.distributeViewSizes(i)}}class ks extends OT{constructor(){super(...arguments),this.initialLayoutContext=!0}static serializeNode(e,t){const i=t===Z.VERTICAL?e.box.width:e.box.height;if(!po(e)){const o={type:"leaf",data:e.view.toJSON(),size:i};return typeof e.cachedVisibleSize=="number"?(o.size=e.cachedVisibleSize,o.visible=!1):e.maximized&&(o.maximized=!0),o}const s=e.children.map(o=>ks.serializeNode(o,Fi(t)));return s.some(o=>o.visible!==!1)?{type:"branch",data:s,size:i}:{type:"branch",data:s,size:i,visible:!1}}static deserialize(e,t,i={}){if(typeof e.orientation!="number")throw new Error("Invalid JSON: 'orientation' property must be a number.");if(typeof e.width!="number")throw new Error("Invalid JSON: 'width' property must be a number.");if(typeof e.height!="number")throw new Error("Invalid JSON: 'height' property must be a number.");const s=In.deserialize(e,t,i);return new ks(s,i)}static from(e,t={}){return ks.deserialize(bv(e),{fromJSON:i=>i},t)}serialize(){return{root:ks.serializeNode(this.getViews(),this.orientation),orientation:this.orientation,width:this.width,height:this.height}}layout(e,t,i=0,s=0){super.layout(e,t,i,s),this.initialLayoutContext&&(this.initialLayoutContext=!1,this.gridview.trySet2x2())}}function mv(a){return!!a.groups}function wv(a,e){if(!e&&a.groups&&a.groups.length<=1&&(a.groups=void 0),!mv(a))return;let t=0,i=0;for(const r of a.groups)wv(r,!1),r.size&&(t+=r.size,i++);const s=i>0?t:1,o=a.groups.length-i,n=s/o;for(const r of a.groups)r.size||(r.size=n)}function yv(a){return mv(a)?{type:"branch",data:a.groups.map(e=>yv(e)),size:a.size}:{type:"leaf",data:a.data,size:a.size}}function vv(a,e){if(a.type==="branch"){const t=a.data.map(i=>vv(i,Fi(e)));if(e===Z.VERTICAL){const i=a.size||(t.length===0?void 0:Math.max(...t.map(o=>o.width||0))),s=t.length===0?void 0:t.reduce((o,n)=>o+(n.height||0),0);return{width:i,height:s}}else{const i=t.length===0?void 0:t.reduce((o,n)=>o+(n.width||0),0),s=a.size||(t.length===0?void 0:Math.max(...t.map(o=>o.height||0)));return{width:i,height:s}}}else{const t=e===Z.VERTICAL?a.size:void 0,i=e===Z.VERTICAL?void 0:a.size;return{width:t,height:i}}}function bv(a){wv(a,!0);const e=yv(a),{width:t,height:i}=vv(e,a.orientation);return{root:e,orientation:a.orientation,width:t||1,height:i||1}}const NT=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));let ph=class extends ub{constructor(e,t,i,s,o,n,r,d){super(e,t,o,i),this.storageService=i,this.instantiationService=s,this.contextMenuService=n,this.extensionService=r,this.contextService=d}create(e){super.create(e),this.viewPaneContainer=this._register(this.createViewPaneContainer(e)),this._register(this.viewPaneContainer.onTitleAreaUpdate(()=>this.updateTitleArea())),this.viewPaneContainer.create(e)}setVisible(e){super.setVisible(e),this.viewPaneContainer?.setVisible(e)}layout(e){this.viewPaneContainer?.layout(e)}setBoundarySashes(e){this.viewPaneContainer?.setBoundarySashes(e)}getOptimalWidth(){return this.viewPaneContainer?.getOptimalWidth()??0}openView(e,t){return this.viewPaneContainer?.openView(e,t)}getViewPaneContainer(){return this.viewPaneContainer}getActionsContext(){return this.getViewPaneContainer()?.getActionsContext()}getContextMenuActions(){return this.viewPaneContainer?.menuActions?.getContextMenuActions()??[]}getMenuIds(){const e=[];return this.viewPaneContainer?.menuActions&&(e.push(this.viewPaneContainer.menuActions.menuId),this.viewPaneContainer.isViewMergedWithContainer()&&e.push(this.viewPaneContainer.panes[0].menuActions.menuId)),e}getActions(){const e=[];if(this.viewPaneContainer?.menuActions&&(e.push(...this.viewPaneContainer.menuActions.getPrimaryActions()),this.viewPaneContainer.isViewMergedWithContainer())){const t=this.viewPaneContainer.panes[0];t.shouldShowFilterInHeader()&&e.push(pb),e.push(...t.menuActions.getPrimaryActions())}return e}getSecondaryActions(){if(!this.viewPaneContainer?.menuActions)return[];const e=this.viewPaneContainer.isViewMergedWithContainer()?this.viewPaneContainer.panes[0].menuActions.getSecondaryActions():[];let t=this.viewPaneContainer.menuActions.getSecondaryActions();const i=t.findIndex(s=>s instanceof gb&&s.item.submenu===Ip);if(i!==-1){const s=t[i];s.actions.some(({enabled:o})=>o)?t.length===1&&e.length===0?t=s.actions.slice():i!==0&&(t=[s,...t.slice(0,i),...t.slice(i+1)]):t.splice(i,1)}return t.length&&e.length?[...t,new hs,...e]:t.length?t:e}getActionViewItem(e,t){return this.viewPaneContainer?.getActionViewItem(e,t)}getTitle(){return this.viewPaneContainer?.getTitle()??""}focus(){super.focus(),this.viewPaneContainer?.focus()}};ph=D([u(1,mt),u(2,ce),u(3,F),u(4,me),u(5,at),u(6,At),u(7,bs)],ph);class rg extends hb{static create(e,t,i,s,o,n,r){return new rg(e,t,i,s,o,n,r)}constructor(e,t,i,s,o,n,r){super(e,t,i,s,o,n),this.iconUrl=r}}const Gi={Viewlets:"workbench.contributions.viewlets",Panels:"workbench.contributions.panels",Auxiliary:"workbench.contributions.auxiliary"};class ag extends fb{registerPaneComposite(e){super.registerComposite(e)}deregisterPaneComposite(e){super.deregisterComposite(e)}getPaneComposite(e){return this.getComposite(e)}getPaneComposites(){return this.getComposites()}}z.add(Gi.Viewlets,new ag);z.add(Gi.Panels,new ag);z.add(Gi.Auxiliary,new ag);const BT=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Pe(BT);class FT extends Lm{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v,C,T){super(C,T,d,t,s),this.notificationService=e,this.storageService=t,this.contextMenuService=i,this.keybindingService=o,this.hoverService=n,this.instantiationService=r,this.registry=l,this.activeCompositeSettingsKey=h,this.defaultCompositeId=p,this.nameForTelemetry=f,this.compositeCSSClass=g,this.titleForegroundColor=m,this.titleBorderColor=v,this.onDidCompositeOpen=this._register(new E),this.onDidCompositeClose=this._register(new E),this.mapCompositeToCompositeContainer=new Map,this.mapActionsBindingToComposite=new Map,this.instantiatedCompositeItems=new Map,this.actionsListener=this._register(new Ie),this.lastActiveCompositeId=t.get(h,H.WORKSPACE,this.defaultCompositeId),this.toolbarHoverDelegate=this._register(mb())}openComposite(e,t){if(this.activeComposite?.getId()===e)return t&&this.activeComposite.focus(),this.activeComposite;if(this.element)return this.doOpenComposite(e,t)}doOpenComposite(e,t=!1){const i=wb.nextId();this.currentCompositeOpenToken=i,this.activeComposite&&this.hideActiveComposite(),this.updateTitle(e);const s=this.createComposite(e,!0);if(!(this.currentCompositeOpenToken!==i||this.activeComposite&&this.activeComposite.getId()!==s.getId()))return this.activeComposite?.getId()===s.getId()?(t&&s.focus(),this.onDidCompositeOpen.fire({composite:s,focus:t}),s):(this.showComposite(s),t&&s.focus(),s&&this.onDidCompositeOpen.fire({composite:s,focus:t}),s)}createComposite(e,t){const i=this.instantiatedCompositeItems.get(e);if(i)return i.composite;const s=this.registry.getComposite(e);if(s){const o=this,n=new yb(Ee(this.progressBar),new class extends vb{constructor(){super(s.id,!!t),this._register(o.onDidCompositeOpen.event(h=>this.onScopeOpened(h.composite.getId()))),this._register(o.onDidCompositeClose.event(h=>this.onScopeClosed(h.getId())))}}),r=this._register(this.instantiationService.createChild(new ta([bb,n]))),d=s.instantiate(r),l=new O;return this.instantiatedCompositeItems.set(e,{composite:d,disposable:l,progress:n}),l.add(d.onTitleAreaUpdate(()=>this.onTitleAreaUpdate(d.getId()),this)),l.add(r),d}throw new Error(`Unable to find composite with id ${e}`)}showComposite(e){this.activeComposite=e;const t=this.activeComposite.getId();t!==this.defaultCompositeId?this.storageService.store(this.activeCompositeSettingsKey,t,H.WORKSPACE,Re.MACHINE):this.storageService.remove(this.activeCompositeSettingsKey,H.WORKSPACE),this.lastActiveCompositeId=this.activeComposite.getId();let i=this.mapCompositeToCompositeContainer.get(e.getId());if(i||(i=M(".composite"),i.classList.add(...this.compositeCSSClass.split(" ")),i.id=e.getId(),e.create(i),e.updateStyles(),this.mapCompositeToCompositeContainer.set(e.getId(),i)),!this.activeComposite||e.getId()!==this.activeComposite.getId())return;this.getContentArea()?.appendChild(i),ia(i);const o=Ee(this.toolBar);o.actionRunner=e.getActionRunner();const n=this.registry.getComposite(e.getId());n&&n.name!==e.getTitle()&&this.updateTitle(e.getId(),e.getTitle());let r=this.mapActionsBindingToComposite.get(e.getId());r||(r=this.collectCompositeActions(e),this.mapActionsBindingToComposite.set(e.getId(),r)),r(),this.actionsListener.value=o.actionRunner.onDidRun(d=>{d.error&&!Ec(d.error)&&this.notificationService.error(d.error)}),e.setVisible(!0),!(!this.activeComposite||e.getId()!==this.activeComposite.getId())&&(this.contentAreaSize&&e.layout(this.contentAreaSize),this.boundarySashes&&e.setBoundarySashes(this.boundarySashes))}onTitleAreaUpdate(e){const t=this.instantiatedCompositeItems.get(e);if(t&&this.updateTitle(e,t.composite.getTitle()),this.activeComposite?.getId()===e){const i=this.collectCompositeActions(this.activeComposite);this.mapActionsBindingToComposite.set(this.activeComposite.getId(),i),i()}else this.mapActionsBindingToComposite.delete(e)}updateTitle(e,t){const i=this.registry.getComposite(e);if(!i||!this.titleLabel)return;t||(t=i.name);const s=this.keybindingService.lookupKeybinding(e);this.titleLabel.updateTitle(e,t,s?.getLabel()??void 0),Ee(this.toolBar).setAriaLabel(c(2899,"{0} actions",t))}collectCompositeActions(e){const t=e?.getMenuIds(),i=e?.getActions().slice(0)||[],s=e?.getSecondaryActions().slice(0)||[],o=Ee(this.toolBar);return o.context=this.actionsContextProvider(),()=>o.setActions(Hn(i),Hn(s),t)}getActiveComposite(){return this.activeComposite}getLastActiveCompositeId(){return this.lastActiveCompositeId}hideActiveComposite(){if(!this.activeComposite)return;const e=this.activeComposite;this.activeComposite=void 0;const t=this.mapCompositeToCompositeContainer.get(e.getId());return e.setVisible(!1),t&&(t.remove(),sa(t)),this.progressBar?.stop().hide(),this.toolBar&&this.collectCompositeActions()(),this.onDidCompositeClose.fire(e),e}createTitleArea(e){const t=ge(e,M(".composite"));t.classList.add("title"),this.titleLabel=this.createTitleLabel(t);const i=ge(t,M(".title-actions"));return this.toolBar=this._register(this.instantiationService.createInstance(Dp,i,{actionViewItemProvider:(s,o)=>this.actionViewItemProvider(s,o),orientation:Fo.HORIZONTAL,getKeyBinding:s=>this.keybindingService.lookupKeybinding(s.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),toggleMenuTitle:c(2900,"Views and More Actions..."),telemetrySource:this.nameForTelemetry,hoverDelegate:this.toolbarHoverDelegate})),this.collectCompositeActions()(),t}createTitleLabel(e){const t=ge(e,M(".title-label")),i=ge(t,M("h2"));this.titleLabelElement=i;const s=this._register(this.hoverService.setupManagedHover(Ap("mouse"),i,"")),o=this;return{updateTitle:(n,r,d)=>{(!this.activeComposite||this.activeComposite.getId()===n)&&(i.innerText=r,s.update(d?c(2901,"{0} ({1})",r,d):r))},updateStyles:()=>{i.style.color=o.titleForegroundColor&&o.getColor(o.titleForegroundColor)||"";const n=o.titleBorderColor?o.getColor(o.titleBorderColor):void 0;e.style.borderBottom=n?`1px solid ${n}`:""}}}createHeaderArea(){return M(".composite")}createFooterArea(){return M(".composite")}updateStyles(){super.updateStyles(),Ee(this.titleLabel).updateStyles()}actionViewItemProvider(e,t){return this.activeComposite?this.activeComposite.getActionViewItem(e,t):Tp(this.instantiationService,e,t)}actionsContextProvider(){return this.activeComposite?this.activeComposite.getActionsContext():null}createContentArea(e){const t=ge(e,M(".content"));return this.progressBar=this._register(new Cb(t,Sb)),this.progressBar.hide(),t}getProgressIndicator(e){const t=this.instantiatedCompositeItems.get(e);return t?t.progress:void 0}getTitleAreaDropDownAnchorAlignment(){return Wl.RIGHT}layout(e,t,i,s){super.layout(e,t,i,s),this.contentAreaSize=jt.lift(super.layoutContents(e,t).contentSize),this.activeComposite?.layout(this.contentAreaSize)}setBoundarySashes(e){this.boundarySashes=e,this.activeComposite?.setBoundarySashes(e)}removeComposite(e){if(this.activeComposite?.getId()===e)return!1;this.mapCompositeToCompositeContainer.delete(e),this.mapActionsBindingToComposite.delete(e);const t=this.instantiatedCompositeItems.get(e);return t&&(t.composite.dispose(),je(t.disposable),this.instantiatedCompositeItems.delete(e)),!0}dispose(){this.mapCompositeToCompositeContainer.clear(),this.mapActionsBindingToComposite.clear(),this.instantiatedCompositeItems.forEach(e=>{e.composite.dispose(),je(e.disposable)}),this.instantiatedCompositeItems.clear(),super.dispose()}}var gh;Pe(NT);var fe;(function(a){a[a.TOP=0]="TOP",a[a.TITLE=1]="TITLE",a[a.BOTTOM=2]="BOTTOM"})(fe||(fe={}));var wo;let da=(wo=class extends FT{get snap(){return this.layoutService.isVisible(this.partId)||!!this.paneCompositeBar.value?.getVisiblePaneCompositeIds().length}get onDidPaneCompositeOpen(){return L.map(this.onDidCompositeOpen.event,e=>e.composite)}constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v,C,T,B,V,U,W){let K=Y.Sidebar,j=Gi.Viewlets,oe=w.SidebarTitle;e===P.PANEL_PART?(K=Y.Panel,j=Gi.Panels,oe=w.PanelTitle):e===P.AUXILIARYBAR_PART&&(K=Y.AuxiliaryBar,j=Gi.Auxiliary,oe=w.AuxiliaryBarTitle),super(h,p,f,g,m,v,C,T,z.as(j),i,B.getDefaultViewContainer(K)?.id||"",n,r,d,l,e,t),this.partId=e,this.activePaneContextKey=s,this.paneFocusContextKey=o,this.viewDescriptorService=B,this.contextKeyService=V,this.extensionService=U,this.menuService=W,this.onDidPaneCompositeClose=this.onDidCompositeClose.event,this.headerFooterCompositeBarDispoables=this._register(new O),this.paneCompositeBar=this._register(new Ie),this.compositeBarPosition=void 0,this.blockOpening=void 0,this.location=K,this.globalActions=this._register(this.instantiationService.createInstance(Vm,oe,void 0,void 0)),this.registerListeners()}registerListeners(){this._register(this.onDidPaneCompositeOpen(e=>this.onDidOpen(e))),this._register(this.onDidPaneCompositeClose(this.onDidClose,this)),this._register(this.globalActions.onDidChange(()=>this.updateGlobalToolbarActions())),this._register(this.registry.onDidDeregister(e=>{const t=this.viewDescriptorService.getViewContainersByLocation(this.location).filter(i=>this.viewDescriptorService.getViewContainerModel(i).activeViewDescriptors.length>0);if(t.length){if(this.getActiveComposite()?.getId()===e.id){const i=this.viewDescriptorService.getDefaultViewContainer(this.location)?.id,s=t.filter(o=>o.id===i)[0]||t[0];this.doOpenPaneComposite(s.id)}}else this.layoutService.setPartHidden(!0,this.partId);this.removeComposite(e.id)})),this._register(this.extensionService.onDidRegisterExtensions(()=>{this.layoutCompositeBar()}))}onDidOpen(e){this.activePaneContextKey.set(e.getId())}onDidClose(e){const t=e.getId();this.activePaneContextKey.get()===t&&this.activePaneContextKey.reset()}showComposite(e){super.showComposite(e),this.layoutCompositeBar(),this.layoutEmptyMessage()}hideActiveComposite(){const e=super.hideActiveComposite();return this.layoutCompositeBar(),this.layoutEmptyMessage(),e}create(e){this.element=e,this.element.classList.add("pane-composite-part"),super.create(e);const t=this.getContentArea();t&&this.createEmptyPaneMessage(t),this.updateCompositeBar();const i=this._register(zn(e));this._register(i.onDidFocus(()=>this.paneFocusContextKey.set(!0))),this._register(i.onDidBlur(()=>this.paneFocusContextKey.set(!1)))}createEmptyPaneMessage(e){this.emptyPaneMessageElement=M(".empty-pane-message-area");const t=M(".empty-pane-message");t.innerText=c(3434,"Drag a view here to display."),this.emptyPaneMessageElement.appendChild(t),e.appendChild(this.emptyPaneMessageElement);const i=s=>{const o=!this.getActiveComposite()||!s,n=s&&this.theme.getColor(Om)?.toString()||"";this.titleContainer&&o&&(this.titleContainer.style.backgroundColor=n),this.headerFooterCompositeBarContainer&&o&&(this.headerFooterCompositeBarContainer.style.backgroundColor=n),this.emptyPaneMessageElement.style.backgroundColor=n};this._register(md.INSTANCE.registerTarget(this.element,{onDragOver:s=>{if(ke.stop(s.eventData,!0),this.paneCompositeBar.value){const o=this.paneCompositeBar.value.dndHandler.onDragEnter(s.dragAndDropData,void 0,s.eventData);_b(s.eventData.dataTransfer,"move",o)}},onDragEnter:s=>{if(ke.stop(s.eventData,!0),this.paneCompositeBar.value){const o=this.paneCompositeBar.value.dndHandler.onDragEnter(s.dragAndDropData,void 0,s.eventData);i(o)}},onDragLeave:s=>{ke.stop(s.eventData,!0),i(!1)},onDragEnd:s=>{ke.stop(s.eventData,!0),i(!1)},onDrop:s=>{if(ke.stop(s.eventData,!0),i(!1),this.paneCompositeBar.value)this.paneCompositeBar.value.dndHandler.drop(s.dragAndDropData,void 0,s.eventData);else{const o=s.dragAndDropData.getData();if(o.type==="composite"){const n=this.viewDescriptorService.getViewContainerById(o.id);this.viewDescriptorService.moveViewContainerToLocation(n,this.location,void 0,"dnd"),this.openPaneComposite(n.id,!0)}else if(o.type==="view"){const n=this.viewDescriptorService.getViewDescriptorById(o.id);if(n&&n.canMoveView){this.viewDescriptorService.moveViewToLocation(n,this.location,"dnd");const r=this.viewDescriptorService.getViewContainerByViewId(n.id);this.openPaneComposite(r.id,!0).then(d=>{d?.openView(n.id,!0)})}}}}}))}createTitleArea(e){const t=super.createTitleArea(e);this._register(J(t,te.CONTEXT_MENU,s=>{this.onTitleAreaContextMenu(new $a(St(t),s))})),this._register(Eg.addTarget(t)),this._register(J(t,Ig.Contextmenu,s=>{this.onTitleAreaContextMenu(new $a(St(t),s))}));const i=t.appendChild(M(".global-actions"));return this.globalToolBar=this._register(this.instantiationService.createInstance(Dp,i,{actionViewItemProvider:(s,o)=>this.actionViewItemProvider(s,o),orientation:Fo.HORIZONTAL,getKeyBinding:s=>this.keybindingService.lookupKeybinding(s.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),toggleMenuTitle:c(3435,"More Actions..."),hoverDelegate:this.toolbarHoverDelegate,hiddenItemStrategy:Pm.NoHide})),this.updateGlobalToolbarActions(),t}createTitleLabel(e){this.titleContainer=e;const t=super.createTitleLabel(e);this.titleLabelElement.draggable=!0;const i=()=>({type:"composite",id:this.getActivePaneComposite().getId()});return this._register(md.INSTANCE.registerDraggable(this.titleLabelElement,i,{})),t}updateCompositeBar(e=!1){const t=this.compositeBarPosition!==void 0,i=this.shouldShowCompositeBar(),s=this.compositeBarPosition,o=i?this.getCompositeBarPosition():void 0;if(!e&&s===o)return;if(t){const r=s===fe.TITLE?this.titleContainer:this.headerFooterCompositeBarContainer;if(!this.paneCompositeBarContainer||!this.paneCompositeBar.value||!r)throw new Error("Composite bar containers should exist when removing the previous composite bar");this.paneCompositeBarContainer.remove(),this.paneCompositeBarContainer=void 0,this.paneCompositeBar.value=void 0,r.classList.remove("has-composite-bar"),s===fe.TOP?this.removeFooterHeaderArea(!0):s===fe.BOTTOM&&this.removeFooterHeaderArea(!1)}let n;switch(o){case fe.TOP:n=this.createHeaderArea();break;case fe.TITLE:n=this.titleContainer;break;case fe.BOTTOM:n=this.createFooterArea();break}if(i){if(this.paneCompositeBarContainer||this.paneCompositeBar.value||!n)throw new Error("Invalid composite bar state when creating the new composite bar");n.classList.add("has-composite-bar"),this.paneCompositeBarContainer=Mm(n,M(".composite-bar-container")),this.paneCompositeBar.value=this.createCompositeBar(),this.paneCompositeBar.value.create(this.paneCompositeBarContainer),o===fe.TOP?this.setHeaderArea(n):o===fe.BOTTOM&&this.setFooterArea(n)}this.compositeBarPosition=o,e&&this.layoutCompositeBar()}createHeaderArea(){const e=super.createHeaderArea();return this.createHeaderFooterCompositeBarArea(e)}createFooterArea(){const e=super.createFooterArea();return this.createHeaderFooterCompositeBarArea(e)}createHeaderFooterCompositeBarArea(e){if(this.headerFooterCompositeBarContainer)throw new Error("Header or Footer composite bar already exists");return this.headerFooterCompositeBarContainer=e,this.headerFooterCompositeBarDispoables.add(J(e,te.CONTEXT_MENU,t=>{this.onCompositeBarAreaContextMenu(new $a(St(e),t))})),this.headerFooterCompositeBarDispoables.add(Eg.addTarget(e)),this.headerFooterCompositeBarDispoables.add(J(e,Ig.Contextmenu,t=>{this.onCompositeBarAreaContextMenu(new $a(St(e),t))})),e}removeFooterHeaderArea(e){this.headerFooterCompositeBarContainer=void 0,this.headerFooterCompositeBarDispoables.clear(),e?this.removeHeaderArea():this.removeFooterArea()}createCompositeBar(){return this.instantiationService.createInstance(Eb,this.getCompositeBarOptions(),this.partId,this)}onTitleAreaUpdate(e){super.onTitleAreaUpdate(e),this.layoutCompositeBar()}async openPaneComposite(e,t){if(typeof e=="string"&&this.getPaneComposite(e))return this.doOpenPaneComposite(e,t);if(await this.extensionService.whenInstalledExtensionsRegistered(),typeof e=="string"&&this.getPaneComposite(e))return this.doOpenPaneComposite(e,t)}async doOpenPaneComposite(e,t){if(this.blockOpening)return this.blockOpening.p;let i;if(!this.layoutService.isVisible(this.partId))try{i=this.blockOpening=new Ko,this.layoutService.setPartHidden(!1,this.partId)}finally{this.blockOpening=void 0}try{const s=this.openComposite(e,t);return i?.complete(s),s}catch(s){throw i?.error(s),s}}getPaneComposite(e){return this.registry.getPaneComposite(e)}getPaneComposites(){return this.registry.getPaneComposites().sort((e,t)=>typeof e.order!="number"?1:typeof t.order!="number"?-1:e.order-t.order)}getPinnedPaneCompositeIds(){return this.paneCompositeBar.value?.getPinnedPaneCompositeIds()??[]}getVisiblePaneCompositeIds(){return this.paneCompositeBar.value?.getVisiblePaneCompositeIds()??[]}getPaneCompositeIds(){return this.paneCompositeBar.value?.getPaneCompositeIds()??[]}getActivePaneComposite(){return this.getActiveComposite()}getLastActivePaneCompositeId(){return this.getLastActiveCompositeId()}hideActivePaneComposite(){this.layoutService.isVisible(this.partId)&&this.layoutService.setPartHidden(!0,this.partId),this.hideActiveComposite()}focusCompositeBar(){this.paneCompositeBar.value?.focus()}layout(e,t,i,s){this.layoutService.isVisible(this.partId)&&(this.contentDimension=new jt(e,t),super.layout(this.contentDimension.width,this.contentDimension.height,i,s),this.layoutCompositeBar(),this.layoutEmptyMessage())}layoutCompositeBar(){if(this.contentDimension&&this.dimension&&this.paneCompositeBar.value){const e=this.compositeBarPosition===fe.TITLE?16:8,t=this.partId===P.PANEL_PART?0:1;let i=this.contentDimension.width-e-t;i=Math.max(gh.MIN_COMPOSITE_BAR_WIDTH,i-this.getToolbarWidth()),this.paneCompositeBar.value.layout(i,this.dimension.height)}}layoutEmptyMessage(){const e=!this.getActiveComposite();this.element.classList.toggle("empty",e),e&&this.titleLabel?.updateTitle("","")}updateGlobalToolbarActions(){const e=this.globalActions.getPrimaryActions(),t=this.globalActions.getSecondaryActions();this.globalToolBar?.setActions(Hn(e),Hn(t))}getToolbarWidth(){if(!this.toolBar||this.compositeBarPosition!==fe.TITLE||!this.getActivePaneComposite())return 0;const t=this.toolBar.getItemsWidth()+this.toolBar.getItemsLength()*4,i=this.globalToolBar?this.globalToolBar.getItemsWidth()+this.globalToolBar.getItemsLength()*4:0;return t+i+5}onTitleAreaContextMenu(e){if(this.shouldShowCompositeBar()&&this.getCompositeBarPosition()===fe.TITLE)return this.onCompositeBarContextMenu(e);{const t=this.getActivePaneComposite(),i=t?t.getContextMenuActions():[];i.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>i,getActionViewItem:(s,o)=>this.actionViewItemProvider(s,o),actionRunner:t.getActionRunner(),skipTelemetry:!0})}}onCompositeBarAreaContextMenu(e){return this.onCompositeBarContextMenu(e)}onCompositeBarContextMenu(e){if(this.paneCompositeBar.value){const t=[...this.paneCompositeBar.value.getContextMenuActions()];t.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>t,skipTelemetry:!0})}}getViewsSubmenuAction(){const e=this.getActivePaneComposite()?.getViewPaneContainer();if(e){const t=new O,i=t.add(this.contextKeyService.createScoped(this.element));i.createKey("viewContainer",e.viewContainer.id);const s=this.menuService.getMenuActions(Ip,i,{shouldForwardArgs:!0,renderShortTitle:!0}),o=Ib(s,()=>!0).primary;return t.dispose(),o.length>1&&o.some(n=>n.enabled)?new wd("views",c(3436,"Views"),o):void 0}}},gh=wo,wo.MIN_COMPOSITE_BAR_WIDTH=50,wo);da=gh=D([u(9,Ke),u(10,ce),u(11,at),u(12,He),u(13,it),u(14,Tt),u(15,F),u(16,me),u(17,Ye),u(18,se),u(19,At),u(20,Cs)],da);var fh;Pe(lv);var yo;let mh=(yo=class extends da{get snap(){return!0}get preferredWidth(){const e=this.getActivePaneComposite();if(!e)return;const t=e.getOptimalWidth();if(typeof t=="number")return Math.max(t,300)}constructor(e,t,i,s,o,n,r,d,l,h,p,f,g){super(P.SIDEBAR_PART,{hasTitle:!0,borderWidth:()=>this.getColor(yd)||this.getColor($s)?1:0},fh.activeViewletSettingsKey,Db.bindTo(h),Ab.bindTo(h),"sideBar","viewlet",Tb,Nm,e,t,i,s,o,n,r,d,l,h,p,g),this.configurationService=f,this.minimumWidth=170,this.maximumWidth=Number.POSITIVE_INFINITY,this.minimumHeight=0,this.maximumHeight=Number.POSITIVE_INFINITY,this.priority=Vi.Low,this.activityBarPart=this._register(this.instantiationService.createInstance(qa,this)),this.rememberActivityBarVisiblePosition(),this._register(f.onDidChangeConfiguration(m=>{m.affectsConfiguration(Wt.ACTIVITY_BAR_LOCATION)&&this.onDidChangeActivityBarLocation()})),this.registerActions()}onDidChangeActivityBarLocation(){this.activityBarPart.hide(),this.updateCompositeBar();const e=this.getActiveComposite()?.getId();e&&this.onTitleAreaUpdate(e),this.shouldShowActivityBar()&&this.activityBarPart.show(),this.rememberActivityBarVisiblePosition()}updateStyles(){super.updateStyles();const e=Ee(this.getContainer());e.style.backgroundColor=this.getColor(Cn)||"",e.style.color=this.getColor(Bm)||"";const t=this.getColor(yd)||this.getColor($s),i=this.layoutService.getSideBarPosition()===Ot.LEFT;e.style.borderRightWidth=t&&i?"1px":"",e.style.borderRightStyle=t&&i?"solid":"",e.style.borderRightColor=i&&t||"",e.style.borderLeftWidth=t&&!i?"1px":"",e.style.borderLeftStyle=t&&!i?"solid":"",e.style.borderLeftColor=i?"":t||"",e.style.outlineColor=this.getColor(xb)??""}layout(e,t,i,s){this.layoutService.isVisible(P.SIDEBAR_PART)&&super.layout(e,t,i,s)}getTitleAreaDropDownAnchorAlignment(){return this.layoutService.getSideBarPosition()===Ot.LEFT?Wl.LEFT:Wl.RIGHT}createCompositeBar(){return this.instantiationService.createInstance(kb,this.getCompositeBarOptions(),this.partId,this,!1)}getCompositeBarOptions(){return{partContainerClass:"sidebar",pinnedViewContainersKey:qa.pinnedViewContainersKey,placeholderViewContainersKey:qa.placeholderViewContainersKey,viewContainersWorkspaceStateKey:qa.viewContainersWorkspaceStateKey,icon:!0,orientation:Fo.HORIZONTAL,recomputeSizes:!0,activityHoverOptions:{position:()=>this.getCompositeBarPosition()===fe.BOTTOM?$n.ABOVE:$n.BELOW},fillExtraContextMenuActions:e=>{if(this.getCompositeBarPosition()===fe.TITLE){const t=this.getViewsSubmenuAction();t&&(e.push(new hs),e.push(t))}},compositeSize:0,iconSize:16,overflowActionSize:30,colors:e=>({activeBackgroundColor:e.getColor(Cn),inactiveBackgroundColor:e.getColor(Cn),activeBorderBottomColor:e.getColor(Hm),activeForegroundColor:e.getColor(Um),inactiveForegroundColor:e.getColor(Gm),badgeBackground:e.getColor(Wm),badgeForeground:e.getColor(Km),dragAndDropBorder:e.getColor(Fm)}),compact:!0}}shouldShowCompositeBar(){const e=this.configurationService.getValue(Wt.ACTIVITY_BAR_LOCATION);return e===Oe.TOP||e===Oe.BOTTOM}shouldShowActivityBar(){return this.shouldShowCompositeBar()?!1:this.configurationService.getValue(Wt.ACTIVITY_BAR_LOCATION)!==Oe.HIDDEN}getCompositeBarPosition(){switch(this.configurationService.getValue(Wt.ACTIVITY_BAR_LOCATION)){case Oe.TOP:return fe.TOP;case Oe.BOTTOM:return fe.BOTTOM;case Oe.HIDDEN:case Oe.DEFAULT:default:return fe.TITLE}}rememberActivityBarVisiblePosition(){const e=this.configurationService.getValue(Wt.ACTIVITY_BAR_LOCATION);e!==Oe.HIDDEN&&this.storageService.store(Wt.ACTIVITY_BAR_LOCATION,e,H.PROFILE,Re.USER)}getRememberedActivityBarVisiblePosition(){switch(this.storageService.get(Wt.ACTIVITY_BAR_LOCATION,H.PROFILE)){case Oe.TOP:return Oe.TOP;case Oe.BOTTOM:return Oe.BOTTOM;default:return Oe.DEFAULT}}getPinnedPaneCompositeIds(){return this.shouldShowCompositeBar()?super.getPinnedPaneCompositeIds():this.activityBarPart.getPinnedPaneCompositeIds()}getVisiblePaneCompositeIds(){return this.shouldShowCompositeBar()?super.getVisiblePaneCompositeIds():this.activityBarPart.getVisiblePaneCompositeIds()}getPaneCompositeIds(){return this.shouldShowCompositeBar()?super.getPaneCompositeIds():this.activityBarPart.getPaneCompositeIds()}async focusActivityBar(){this.configurationService.getValue(Wt.ACTIVITY_BAR_LOCATION)===Oe.HIDDEN&&(await this.configurationService.updateValue(Wt.ACTIVITY_BAR_LOCATION,this.getRememberedActivityBarVisiblePosition()),this.onDidChangeActivityBarLocation()),this.shouldShowCompositeBar()?this.focusCompositeBar():(this.layoutService.isVisible(P.ACTIVITYBAR_PART)||this.layoutService.setPartHidden(!1,P.ACTIVITYBAR_PART),this.activityBarPart.show(!0))}registerActions(){const e=this;this._register(b(class extends X{constructor(){super({id:Rb,title:x(3481,"Toggle Activity Bar Visibility")})}run(){const t=e.configurationService.getValue(Wt.ACTIVITY_BAR_LOCATION)===Oe.HIDDEN?e.getRememberedActivityBarVisiblePosition():Oe.HIDDEN;return e.configurationService.updateValue(Wt.ACTIVITY_BAR_LOCATION,t)}}))}toJSON(){return{type:P.SIDEBAR_PART}}},fh=yo,yo.activeViewletSettingsKey="workbench.sidebar.activeviewletid",yo);mh=fh=D([u(0,Ke),u(1,ce),u(2,at),u(3,He),u(4,it),u(5,Tt),u(6,F),u(7,me),u(8,Ye),u(9,se),u(10,At),u(11,ie),u(12,Cs)],mh);let wh=class extends R{constructor(e,t,i){super(),this.viewId=e,this.viewDescriptorService=t,this.activityService=i,this.activity=void 0,this.activityDisposable=R.None,this._register(L.filter(this.viewDescriptorService.onDidChangeContainer,s=>s.views.some(o=>o.id===e))(()=>this.update())),this._register(L.filter(this.viewDescriptorService.onDidChangeLocation,s=>s.views.some(o=>o.id===e))(()=>this.update()))}setActivity(e){this.activity=e,this.update()}clearActivity(){this.activity=void 0,this.update()}update(){this.activityDisposable.dispose();const e=this.viewDescriptorService.getViewContainerByViewId(this.viewId);e&&this.activity&&(this.activityDisposable=this.activityService.showViewContainerActivity(e.id,this.activity))}dispose(){this.activityDisposable.dispose(),super.dispose()}};wh=D([u(1,Ye),u(2,Ys)],wh);let yh=class extends R{constructor(e,t){super(),this.viewDescriptorService=e,this.instantiationService=t,this.viewActivities=new Map,this._onDidChangeActivity=this._register(new E),this.onDidChangeActivity=this._onDidChangeActivity.event,this.viewContainerActivities=new Map,this.globalActivities=new Map}showViewContainerActivity(e,t){const i=this.viewDescriptorService.getViewContainerById(e);if(!i)return R.None;let s=this.viewContainerActivities.get(e);return s||(s=[],this.viewContainerActivities.set(e,s)),s.push(t),this._onDidChangeActivity.fire(i),ae(()=>{s.splice(s.indexOf(t),1),s.length===0&&this.viewContainerActivities.delete(e),this._onDidChangeActivity.fire(i)})}getViewContainerActivities(e){return this.viewDescriptorService.getViewContainerById(e)?this.viewContainerActivities.get(e)??[]:[]}showViewActivity(e,t){let i=this.viewActivities.get(e);i?i.id++:(i={id:1,activity:this.instantiationService.createInstance(wh,e)},this.viewActivities.set(e,i));const s=i.id;i.activity.setActivity(t);const o=i;return ae(()=>{o.id===s&&(o.activity.dispose(),this.viewActivities.delete(e))})}showAccountsActivity(e){return this.showActivity(Lb,e)}showGlobalActivity(e){return this.showActivity(Vb,e)}getActivity(e){return this.globalActivities.get(e)??[]}showActivity(e,t){let i=this.globalActivities.get(e);return i||(i=[],this.globalActivities.set(e,i)),i.push(t),this._onDidChangeActivity.fire(e),ae(()=>{i.splice(i.indexOf(t),1),i.length===0&&this.globalActivities.delete(e),this._onDidChangeActivity.fire(e)})}};yh=D([u(0,Ye),u(1,F)],yh);var vh;Pe(Fb);var vo;let bh=(vo=class extends da{get preferredHeight(){return this.layoutService.mainContainerDimension.height*.4}get preferredWidth(){const e=this.getActivePaneComposite();if(!e)return;const t=e.getOptimalWidth();if(typeof t=="number")return Math.max(t,300)}constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m){super(P.PANEL_PART,{hasTitle:!0},vh.activePanelSettingsKey,Pb.bindTo(h),Mb.bindTo(h),"panel","panel",void 0,Ob,e,t,i,s,o,n,r,d,l,h,p,g),this.commandService=f,this.configurationService=m,this.minimumWidth=300,this.maximumWidth=Number.POSITIVE_INFINITY,this.minimumHeight=77,this.maximumHeight=Number.POSITIVE_INFINITY,this._register(this.configurationService.onDidChangeConfiguration(v=>{v.affectsConfiguration("workbench.panel.showLabels")&&this.updateCompositeBar(!0)}))}updateStyles(){super.updateStyles();const e=Ee(this.getContainer());e.style.backgroundColor=this.getColor(ll)||"";const t=this.getColor(vd)||this.getColor($s)||"";e.style.borderLeftColor=t,e.style.borderRightColor=t,e.style.borderBottomColor=t;const i=this.getTitleArea();i&&(i.style.borderTopColor=this.getColor(vd)||this.getColor($s)||"")}getCompositeBarOptions(){return{partContainerClass:"panel",pinnedViewContainersKey:"workbench.panel.pinnedPanels",placeholderViewContainersKey:"workbench.panel.placeholderPanels",viewContainersWorkspaceStateKey:"workbench.panel.viewContainersWorkspaceState",icon:this.configurationService.getValue("workbench.panel.showLabels")===!1,orientation:Fo.HORIZONTAL,recomputeSizes:!0,activityHoverOptions:{position:()=>this.layoutService.getPanelPosition()===Ot.BOTTOM&&!this.layoutService.isPanelMaximized()?$n.ABOVE:$n.BELOW},fillExtraContextMenuActions:e=>this.fillExtraContextMenuActions(e),compositeSize:0,iconSize:16,compact:!0,overflowActionSize:44,colors:e=>({activeBackgroundColor:e.getColor(ll),inactiveBackgroundColor:e.getColor(ll),activeBorderBottomColor:e.getColor(jm),activeForegroundColor:e.getColor(qm),inactiveForegroundColor:e.getColor($m),badgeBackground:e.getColor(Bb),badgeForeground:e.getColor(Nb),dragAndDropBorder:e.getColor(zm)})}}fillExtraContextMenuActions(e){if(this.getCompositeBarPosition()===fe.TITLE){const d=this.getViewsSubmenuAction();d&&(e.push(new hs),e.push(d))}const t=this.menuService.getMenuActions(w.PanelPositionMenu,this.contextKeyService,{shouldForwardArgs:!0}),i=this.menuService.getMenuActions(w.PanelAlignmentMenu,this.contextKeyService,{shouldForwardArgs:!0}),s=bd(t).secondary,o=bd(i).secondary,n=this.configurationService.getValue("workbench.panel.showLabels"),r=cs({id:"workbench.action.panel.toggleShowLabels",label:n?c(3474,"Show Icons"):c(3475,"Show Labels"),run:()=>this.configurationService.updateValue("workbench.panel.showLabels",!n)});e.push(new hs,new wd("workbench.action.panel.position",c(3476,"Panel Position"),s),new wd("workbench.action.panel.align",c(3477,"Align Panel"),o),r,cs({id:Dg.ID,label:c(3478,"Hide Panel"),run:()=>this.commandService.executeCommand(Dg.ID)}))}layout(e,t,i,s){let o;switch(this.layoutService.getPanelPosition()){case Ot.RIGHT:o=new jt(e-1,t);break;case Ot.TOP:o=new jt(e,t-1);break;default:o=new jt(e,t);break}super.layout(o.width,o.height,i,s)}shouldShowCompositeBar(){return!0}getCompositeBarPosition(){return fe.TITLE}toJSON(){return{type:P.PANEL_PART}}},vh=vo,vo.activePanelSettingsKey="workbench.panelpart.activepanelid",vo);bh=vh=D([u(0,Ke),u(1,ce),u(2,at),u(3,He),u(4,it),u(5,Tt),u(6,F),u(7,me),u(8,Ye),u(9,se),u(10,At),u(11,wt),u(12,Cs),u(13,ie)],bh);const KT=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Ch;Pe(KT);function Cv(a){return a.getValue("editor.dropIntoEditor.enabled")}function Sv(a){return a.shiftKey}var bo;let Sh=(bo=class extends Ym{get disposed(){return!!this._disposed}constructor(e,t,i,s,o,n,r,d){super(t),this.groupView=e,this.configurationService=i,this.instantiationService=s,this.editorService=o,this.editorGroupService=n,this.treeViewsDragAndDropService=r,this.contextService=d,this.editorTransfer=Sn.getInstance(),this.groupTransfer=Sn.getInstance(),this.treeItemsTransfer=Sn.getInstance(),this.cleanupOverlayScheduler=this._register(new Ca(()=>this.dispose(),300)),this.enableDropIntoEditor=Cv(this.configurationService)&&this.isDropIntoActiveEditorEnabled(),this.create()}create(){const e=this.getOverlayOffsetHeight(),t=this.container=M("div",{id:Ch.OVERLAY_ID});t.style.top=`${e}px`,this.groupView.element.appendChild(t),this.groupView.element.classList.add("dragged-over"),this._register(ae(()=>{t.remove(),this.groupView.element.classList.remove("dragged-over")})),this.overlay=M(".editor-group-overlay-indicator"),t.appendChild(this.overlay),this.enableDropIntoEditor&&(this.dropIntoPromptElement=Gb(c(3250,"Hold __{0}__ to drop into editor",ut?"⇧":"Shift"),{}),this.dropIntoPromptElement.classList.add("editor-group-overlay-drop-into-prompt"),this.overlay.appendChild(this.dropIntoPromptElement)),this.registerListeners(t),this.updateStyles()}updateStyles(){const e=Ee(this.overlay);e.style.backgroundColor=this.getColor(Om)||"";const t=this.getColor(Ub);if(e.style.outlineColor=t||"",e.style.outlineOffset=t?"-2px":"",e.style.outlineStyle=t?"dashed":"",e.style.outlineWidth=t?"2px":"",this.dropIntoPromptElement){this.dropIntoPromptElement.style.backgroundColor=this.getColor(Hb)??"",this.dropIntoPromptElement.style.color=this.getColor(zb)??"";const i=this.getColor($b);i?(this.dropIntoPromptElement.style.borderWidth="1px",this.dropIntoPromptElement.style.borderStyle="solid",this.dropIntoPromptElement.style.borderColor=i):this.dropIntoPromptElement.style.borderWidth="0"}}registerListeners(e){this._register(new qb(e,{onDragOver:t=>{if(this.enableDropIntoEditor&&Sv(t)){this.dispose();return}const i=this.groupTransfer.hasData(to.prototype),s=this.editorTransfer.hasData(Ds.prototype);!s&&!i&&t.dataTransfer&&(t.dataTransfer.dropEffect="copy");let o=!0;if(i)o=this.isCopyOperation(t);else if(s){const r=this.editorTransfer.getData(Ds.prototype);Array.isArray(r)&&r.length>0&&(o=this.isCopyOperation(t,r[0].identifier))}if(!o){const r=this.findSourceGroupView();if(r===this.groupView&&(i||s&&r.count<2)){this.hideOverlay();return}}let n=!!this.editorGroupService.partOptions.splitOnDragAndDrop;this.isToggleSplitOperation(t)&&(n=!n),this.positionOverlay(t.offsetX,t.offsetY,i,n),this.cleanupOverlayScheduler.isScheduled()&&this.cleanupOverlayScheduler.cancel()},onDragLeave:t=>this.dispose(),onDragEnd:t=>this.dispose(),onDrop:t=>{ke.stop(t,!0),this.dispose(),this.currentDropOperation&&this.handleDrop(t,this.currentDropOperation.splitDirection)}})),this._register(J(e,te.MOUSE_OVER,()=>{this.cleanupOverlayScheduler.isScheduled()||this.cleanupOverlayScheduler.schedule()}))}isDropIntoActiveEditorEnabled(){return!!this.groupView.activeEditor?.hasCapability(Ag.CanDropIntoEditor)}findSourceGroupView(){if(this.groupTransfer.hasData(to.prototype)){const e=this.groupTransfer.getData(to.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier)}else if(this.editorTransfer.hasData(Ds.prototype)){const e=this.editorTransfer.getData(Ds.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier.groupId)}}async handleDrop(e,t){const i=()=>{let s;return typeof t=="number"?s=this.editorGroupService.addGroup(this.groupView,t):s=this.groupView,s};if(this.groupTransfer.hasData(to.prototype)){const s=this.groupTransfer.getData(to.prototype);if(Array.isArray(s)&&s.length>0){const o=this.editorGroupService.getGroup(s[0].identifier);if(o){if(typeof t!="number"&&o===this.groupView)return;let n;if(typeof t=="number")this.isCopyOperation(e)?n=this.editorGroupService.copyGroup(o,this.groupView,t):n=this.editorGroupService.moveGroup(o,this.groupView,t);else{let r;this.isCopyOperation(e)&&(r={mode:Jm.COPY_EDITORS}),this.editorGroupService.mergeGroup(o,this.groupView,r)}n&&this.editorGroupService.activateGroup(n)}this.groupTransfer.clearData(to.prototype)}}else if(this.editorTransfer.hasData(Ds.prototype)){const s=this.editorTransfer.getData(Ds.prototype);if(Array.isArray(s)&&s.length>0){const o=s,n=s[0].identifier,r=this.editorGroupService.getGroup(n.groupId);if(r){const d=this.isCopyOperation(e,n);let l;if(this.editorGroupService.partOptions.closeEmptyGroups&&r.count===1&&typeof t=="number"&&!d)l=this.editorGroupService.moveGroup(r,this.groupView,t);else{if(l=i(),r===l)return;const h=jb(this.groupView,o.map(p=>p.identifier.editor));d?r.copyEditors(h,l):r.moveEditors(h,l)}l.focus()}this.editorTransfer.clearData(Ds.prototype)}}else if(this.treeItemsTransfer.hasData(ao.prototype)){const s=this.treeItemsTransfer.getData(ao.prototype);if(Array.isArray(s)&&s.length>0){const o=[];for(const n of s){const r=await this.treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(r){const d=await Yb(r);o.push(...d.map(l=>({...l,options:{...l.options,pinned:!0}})))}}o.length&&this.editorService.openEditors(o,i(),{validateTrust:!0})}this.treeItemsTransfer.clearData(ao.prototype)}else this.instantiationService.createInstance(Jb,{allowWorkspaceOpen:!Wo||Zb(this.contextService.getWorkspace())}).handleDrop(e,St(this.groupView.element),()=>i(),o=>o?.focus())}isCopyOperation(e,t){return t?.editor.hasCapability(Ag.Singleton)?!1:e.ctrlKey&&!ut||e.altKey&&ut}isToggleSplitOperation(e){return e.altKey&&!ut||e.shiftKey&&ut}positionOverlay(e,t,i,s){const o=this.editorGroupService.partOptions.openSideBySideDirection==="right",n=this.groupView.element.clientWidth,r=this.groupView.element.clientHeight-this.getOverlayOffsetHeight();let d,l;s?(i?d=o?.3:.1:d=.1,i?l=o?.1:.3:l=.1):(d=0,l=0);const h=n*d,p=r*l,f=n/3,g=r/3;let m;switch(e>h&&e<n-h&&t>p&&t<r-p?m=void 0:o?e<f?m=we.LEFT:e>f*2?m=we.RIGHT:t<r/2?m=we.UP:m=we.DOWN:t<g?m=we.UP:t>g*2?m=we.DOWN:e<n/2?m=we.LEFT:m=we.RIGHT,m){case we.UP:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case we.DOWN:this.doPositionOverlay({top:"50%",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case we.LEFT:this.doPositionOverlay({top:"0",left:"0",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;case we.RIGHT:this.doPositionOverlay({top:"0",left:"50%",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;default:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),this.toggleDropIntoPrompt(!0)}const v=Ee(this.overlay);v.style.opacity="1",setTimeout(()=>v.classList.add("overlay-move-transition"),0),this.currentDropOperation={splitDirection:m}}doPositionOverlay(e){const[t,i]=Xb(this.container,this.overlay),s=this.getOverlayOffsetHeight();s?t.style.height=`calc(100% - ${s}px)`:t.style.height="100%",i.style.top=e.top,i.style.left=e.left,i.style.width=e.width,i.style.height=e.height}getOverlayOffsetHeight(){return!this.groupView.isEmpty&&this.editorGroupService.partOptions.showTabs==="multiple"?this.groupView.titleHeight.offset:0}hideOverlay(){const e=Ee(this.overlay);this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),e.style.opacity="0",e.classList.remove("overlay-move-transition"),this.currentDropOperation=void 0}toggleDropIntoPrompt(e){this.dropIntoPromptElement&&(this.dropIntoPromptElement.style.opacity=e?"1":"0")}contains(e){return e===this.container||e===this.overlay}dispose(){super.dispose(),this._disposed=!0}},Ch=bo,bo.OVERLAY_ID="monaco-workbench-editor-drop-overlay",bo);Sh=Ch=D([u(1,me),u(2,ie),u(3,F),u(4,Q),u(5,Je),u(6,Zm),u(7,bs)],Sh);let _h=class extends Ym{constructor(e,t,i,s,o,n){super(s),this.container=e,this.delegate=t,this.editorGroupService=i,this.configurationService=o,this.instantiationService=n,this.counter=0,this.editorTransfer=Sn.getInstance(),this.groupTransfer=Sn.getInstance(),this.registerListeners()}get overlay(){if(this._overlay&&!this._overlay.disposed)return this._overlay}registerListeners(){this._register(J(this.container,te.DRAG_ENTER,e=>this.onDragEnter(e))),this._register(J(this.container,te.DRAG_LEAVE,()=>this.onDragLeave()));for(const e of[this.container,St(this.container)])this._register(J(e,te.DRAG_END,()=>this.onDragEnd()))}onDragEnter(e){if(Cv(this.configurationService)&&Sv(e))return;if(this.counter++,!this.editorTransfer.hasData(Ds.prototype)&&!this.groupTransfer.hasData(to.prototype)&&e.dataTransfer){const i=z.as(Kb.DragAndDropContribution).getAll(),s=Array.from(i).map(o=>o.dataFormatKey);if(!Wb(e,Pr.FILES,Gl.FILES,Pr.RESOURCES,Gl.EDITORS,...s)){e.dataTransfer.dropEffect="none";return}}this.updateContainer(!0);const t=e.target;if(t&&(this.overlay&&!this.overlay.contains(t)&&this.disposeOverlay(),!this.overlay)){const i=this.findTargetGroupView(t);i&&(this._overlay=this.instantiationService.createInstance(Sh,i))}}onDragLeave(){this.counter--,this.counter===0&&this.updateContainer(!1)}onDragEnd(){this.counter=0,this.updateContainer(!1),this.disposeOverlay()}findTargetGroupView(e){return this.editorGroupService.groups.find(i=>Ul(e,i.element)||this.delegate.containsGroup?.(i))}updateContainer(e){this.container.classList.toggle("dragged-over",e)}dispose(){super.dispose(),this.disposeOverlay()}disposeOverlay(){this.overlay&&(this.overlay.dispose(),this._overlay=void 0)}};_h=D([u(2,Je),u(3,me),u(4,ie),u(5,F)],_h);const Sr={targetWidth:900,leftMarginRatio:.1909,rightMarginRatio:.1909},kl={type:"distribute"};function Jf(a){const e=M(".centered-layout-margin");return e.style.height="100%",a&&(e.style.backgroundColor=a.toString()),{element:e,layout:()=>{},minimumSize:60,maximumSize:Number.POSITIVE_INFINITY,onDidChange:L.None}}function WT(a,e){return{element:a.element,get maximumSize(){return a.maximumWidth},get minimumSize(){return a.minimumWidth},onDidChange:L.map(a.onDidChange,t=>t&&t.width),layout:(t,i,s)=>a.layout(t,e(),s?.top??0,(s?.left??0)+i)}}class GT{constructor(e,t,i={...Sr},s=!1){this.container=e,this.view=t,this.state=i,this.centeredLayoutFixedWidth=s,this.lastLayoutPosition={width:0,height:0,left:0,top:0},this.didLayout=!1,this.splitViewDisposables=new O,this._boundarySashes={},this.container.appendChild(this.view.element),this.container.style.overflow="hidden"}get minimumWidth(){return this.splitView?this.splitView.minimumSize:this.view.minimumWidth}get maximumWidth(){return this.splitView?this.splitView.maximumSize:this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get onDidChange(){return this.view.onDidChange}get boundarySashes(){return this._boundarySashes}set boundarySashes(e){this._boundarySashes=e,this.splitView&&(this.splitView.orthogonalStartSash=e.top,this.splitView.orthogonalEndSash=e.bottom)}layout(e,t,i,s){this.lastLayoutPosition={width:e,height:t,top:i,left:s},this.splitView?(this.splitView.layout(e,this.lastLayoutPosition),(!this.didLayout||this.centeredLayoutFixedWidth)&&this.resizeSplitViews()):this.view.layout(e,t,i,s),this.didLayout=!0}resizeSplitViews(){if(this.splitView)if(this.centeredLayoutFixedWidth){const e=Math.min(this.lastLayoutPosition.width,this.state.targetWidth),t=(this.lastLayoutPosition.width-e)/2;this.splitView.resizeView(0,Math.floor(t)),this.splitView.resizeView(1,e),this.splitView.resizeView(2,Math.ceil(t))}else{const e=this.state.leftMarginRatio*this.lastLayoutPosition.width,t=this.state.rightMarginRatio*this.lastLayoutPosition.width,i=this.lastLayoutPosition.width-e-t;this.splitView.resizeView(0,e),this.splitView.resizeView(1,i),this.splitView.resizeView(2,t)}}setFixedWidth(e){this.centeredLayoutFixedWidth=e,this.splitView&&(this.updateState(),this.resizeSplitViews())}updateState(){this.splitView&&(this.state.targetWidth=this.splitView.getViewSize(1),this.state.leftMarginRatio=this.splitView.getViewSize(0)/this.lastLayoutPosition.width,this.state.rightMarginRatio=this.splitView.getViewSize(2)/this.lastLayoutPosition.width)}isActive(){return!!this.splitView}styles(e){this.style=e,this.splitView&&this.emptyViews&&(this.splitView.style(this.style),this.emptyViews[0].element.style.backgroundColor=this.style.background.toString(),this.emptyViews[1].element.style.backgroundColor=this.style.background.toString())}activate(e){if(e!==this.isActive())if(e){this.view.element.remove(),this.splitView=new ea(this.container,{inverseAltBehavior:!0,orientation:Z.HORIZONTAL,styles:this.style}),this.splitView.orthogonalStartSash=this.boundarySashes.top,this.splitView.orthogonalEndSash=this.boundarySashes.bottom,this.splitViewDisposables.add(this.splitView.onDidSashChange(()=>{this.splitView&&this.updateState()})),this.splitViewDisposables.add(this.splitView.onDidSashReset(()=>{this.state={...Sr},this.resizeSplitViews()})),this.splitView.layout(this.lastLayoutPosition.width,this.lastLayoutPosition);const t=this.style?this.style.background:void 0;this.emptyViews=[Jf(t),Jf(t)],this.splitView.addView(this.emptyViews[0],kl,0),this.splitView.addView(WT(this.view,()=>this.lastLayoutPosition.height),kl,1),this.splitView.addView(this.emptyViews[1],kl,2),this.resizeSplitViews()}else this.splitView?.el.remove(),this.splitViewDisposables.clear(),this.splitView?.dispose(),this.splitView=void 0,this.emptyViews=void 0,this.container.appendChild(this.view.element),this.view.layout(this.lastLayoutPosition.width,this.lastLayoutPosition.height,this.lastLayoutPosition.top,this.lastLayoutPosition.left)}isDefault(e){return this.centeredLayoutFixedWidth?e.targetWidth===Sr.targetWidth:e.leftMarginRatio===Sr.leftMarginRatio&&e.rightMarginRatio===Sr.rightMarginRatio}dispose(){this.splitViewDisposables.dispose(),this.splitView&&(this.splitView.dispose(),this.splitView=void 0)}}var Xi;class UT{constructor(){this.element=M(".grid-view-container"),this._onDidChange=new Rs,this.onDidChange=this._onDidChange.event}get minimumWidth(){return this.gridWidget?this.gridWidget.minimumWidth:0}get maximumWidth(){return this.gridWidget?this.gridWidget.maximumWidth:Number.POSITIVE_INFINITY}get minimumHeight(){return this.gridWidget?this.gridWidget.minimumHeight:0}get maximumHeight(){return this.gridWidget?this.gridWidget.maximumHeight:Number.POSITIVE_INFINITY}get gridWidget(){return this._gridWidget}set gridWidget(e){this.element.innerText="",e?(this.element.appendChild(e.element),this._onDidChange.input=e.onDidChange):this._onDidChange.input=L.None,this._gridWidget=e}layout(e,t,i,s){this.gridWidget?.layout(e,t,i,s)}dispose(){this._onDidChange.dispose()}}var Ms;let Vd=(Ms=class extends Lm{constructor(e,t,i,s,o,n,r,d,l,h,p){super(t,{hasTitle:!1},n,d,l),this.editorPartsView=e,this.groupsLabel=i,this.windowId=s,this.instantiationService=o,this.configurationService=r,this.hostService=h,this.contextKeyService=p,this._onDidFocus=this._register(new E),this.onDidFocus=this._onDidFocus.event,this._onDidLayout=this._register(new E),this.onDidLayout=this._onDidLayout.event,this._onDidChangeActiveGroup=this._register(new E),this.onDidChangeActiveGroup=this._onDidChangeActiveGroup.event,this._onDidChangeGroupIndex=this._register(new E),this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event,this._onDidChangeGroupLabel=this._register(new E),this.onDidChangeGroupLabel=this._onDidChangeGroupLabel.event,this._onDidChangeGroupLocked=this._register(new E),this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event,this._onDidChangeGroupMaximized=this._register(new E),this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event,this._onDidActivateGroup=this._register(new E),this.onDidActivateGroup=this._onDidActivateGroup.event,this._onDidAddGroup=this._register(new Hl),this.onDidAddGroup=this._onDidAddGroup.event,this._onDidRemoveGroup=this._register(new Hl),this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidMoveGroup=this._register(new E),this.onDidMoveGroup=this._onDidMoveGroup.event,this.onDidSetGridWidget=this._register(new E),this._onDidChangeSizeConstraints=this._register(new Rs),this.onDidChangeSizeConstraints=L.any(this.onDidSetGridWidget.event,this._onDidChangeSizeConstraints.event),this._onDidScroll=this._register(new Rs),this.onDidScroll=L.any(this.onDidSetGridWidget.event,this._onDidScroll.event),this._onDidChangeEditorPartOptions=this._register(new E),this.onDidChangeEditorPartOptions=this._onDidChangeEditorPartOptions.event,this._onWillDispose=this._register(new E),this.onWillDispose=this._onWillDispose.event,this.workspaceMemento=this.getMemento(H.WORKSPACE,Re.USER),this.profileMemento=this.getMemento(H.PROFILE,Re.MACHINE),this.groupViews=new Map,this.mostRecentActiveGroups=[],this.container=M(".content"),this.gridWidgetDisposables=this._register(new O),this.gridWidgetView=this._register(new UT),this.enforcedPartOptions=[],this.top=0,this.left=0,this.sideGroup={openEditor:(f,g)=>{const[m]=this.scopedInstantiationService.invokeFunction(v=>cv(v,{editor:f,options:g},Xm));return m.openEditor(f,g)}},this._isReady=!1,this.whenReadyPromise=new Ko,this.whenReady=this.whenReadyPromise.p,this.whenRestoredPromise=new Ko,this.whenRestored=this.whenRestoredPromise.p,this._willRestoreState=!1,this.priority=Vi.High,this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.container)),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new ta([se,this.scopedContextKeyService]))),this._partOptions=Tg(this.configurationService,this.themeService),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e))),this._register(this.themeService.onDidFileIconThemeChange(()=>this.handleChangedPartOptions())),this._register(this.onDidChangeMementoValue(H.WORKSPACE,this._store)(e=>this.onDidChangeMementoState(e)))}onConfigurationUpdated(e){Qb(e)&&this.handleChangedPartOptions()}handleChangedPartOptions(){const e=this._partOptions,t=Tg(this.configurationService,this.themeService);for(const i of this.enforcedPartOptions)Object.assign(t,i);this._partOptions=t,this._onDidChangeEditorPartOptions.fire({oldPartOptions:e,newPartOptions:t})}get partOptions(){return this._partOptions}enforcePartOptions(e){return this.enforcedPartOptions.push(e),this.handleChangedPartOptions(),ae(()=>{this.enforcedPartOptions.splice(this.enforcedPartOptions.indexOf(e),1),this.handleChangedPartOptions()})}get contentDimension(){return this._contentDimension}get activeGroup(){return this._activeGroup}get groups(){return Array.from(this.groupViews.values())}get count(){return this.groupViews.size}get orientation(){return this.gridWidget&&this.gridWidget.orientation===Z.VERTICAL?tn.VERTICAL:tn.HORIZONTAL}get isReady(){return this._isReady}get hasRestorableState(){return!!this.workspaceMemento[Xi.EDITOR_PART_UI_STATE_STORAGE_KEY]}get willRestoreState(){return this._willRestoreState}getGroups(e=Ge.CREATION_TIME){switch(e){case Ge.CREATION_TIME:return this.groups;case Ge.MOST_RECENTLY_ACTIVE:{const t=Ss(this.mostRecentActiveGroups.map(i=>this.getGroup(i)));return Ls([...t,...this.groups])}case Ge.GRID_APPEARANCE:{const t=[];return this.gridWidget&&this.fillGridNodes(t,this.gridWidget.getViews()),t}}}fillGridNodes(e,t){po(t)?t.children.forEach(i=>this.fillGridNodes(e,i)):e.push(t.view)}hasGroup(e){return this.groupViews.has(e)}getGroup(e){return this.groupViews.get(e)}findGroup(e,t=this.activeGroup,i){if(typeof e.direction=="number")return this.doFindGroupByDirection(e.direction,t,i);if(typeof e.location=="number")return this.doFindGroupByLocation(e.location,t,i);throw new Error("invalid arguments")}doFindGroupByDirection(e,t,i){const s=this.assertGroupView(t),o=this.gridWidget.getNeighborViews(s,this.toGridViewDirection(e),i);return o.sort((n,r)=>this.mostRecentActiveGroups.indexOf(n.id)-this.mostRecentActiveGroups.indexOf(r.id)),o[0]}doFindGroupByLocation(e,t,i){const s=this.assertGroupView(t),o=this.getGroups(Ge.GRID_APPEARANCE),n=o.indexOf(s);switch(e){case Nt.FIRST:return o[0];case Nt.LAST:return o[o.length-1];case Nt.NEXT:{let r=o[n+1];return!r&&i&&(r=this.doFindGroupByLocation(Nt.FIRST,t)),r}case Nt.PREVIOUS:{let r=o[n-1];return!r&&i&&(r=this.doFindGroupByLocation(Nt.LAST,t)),r}}}activateGroup(e,t){const i=this.assertGroupView(e);return this.doSetGroupActive(i),t||this.hostService.moveTop(St(this.element)),i}restoreGroup(e){const t=this.assertGroupView(e);return this.doRestoreGroup(t),t}getSize(e){const t=this.assertGroupView(e);return this.gridWidget.getViewSize(t)}setSize(e,t){const i=this.assertGroupView(e);this.gridWidget.resizeView(i,t)}arrangeGroups(e,t=this.activeGroup){if(this.count<2||!this.gridWidget)return;const i=this.assertGroupView(t);switch(e){case _s.EVEN:this.gridWidget.distributeViewSizes();break;case _s.MAXIMIZE:if(this.groups.length<2)return;this.gridWidget.maximizeView(i),i.focus();break;case _s.EXPAND:this.gridWidget.expandView(i);break}}toggleMaximizeGroup(e=this.activeGroup){this.hasMaximizedGroup()?this.unmaximizeGroup():this.arrangeGroups(_s.MAXIMIZE,e)}toggleExpandGroup(e=this.activeGroup){this.isGroupExpanded(this.activeGroup)?this.arrangeGroups(_s.EVEN):this.arrangeGroups(_s.EXPAND,e)}unmaximizeGroup(){this.gridWidget.exitMaximizedView(),this._activeGroup.focus()}hasMaximizedGroup(){return this.gridWidget.hasMaximizedView()}isGroupMaximized(e){return this.gridWidget.isViewMaximized(e)}isGroupExpanded(e){return this.gridWidget.isViewExpanded(e)}setGroupOrientation(e){if(!this.gridWidget)return;const t=e===tn.HORIZONTAL?Z.HORIZONTAL:Z.VERTICAL;this.gridWidget.orientation!==t&&(this.gridWidget.orientation=t)}applyLayout(e){const t=this.shouldRestoreFocus(this.container);let i=0;function s(d){for(const l of d)Array.isArray(l.groups)?s(l.groups):i++}s(e.groups);let o=this.getGroups(Ge.GRID_APPEARANCE);if(i<o.length){const d=o[i-1];o.forEach((l,h)=>{h>=i&&this.mergeGroup(l,d)}),o=this.getGroups(Ge.GRID_APPEARANCE)}const n=this.activeGroup,r=bv({orientation:this.toGridViewOrientation(e.orientation,this.isTwoDimensionalGrid()?this.gridWidget.orientation:Fi(this.gridWidget.orientation)),groups:e.groups});this.doApplyGridState(r,n.id,o),t&&this._activeGroup.focus()}getLayout(){const e=this.gridWidget.serialize(),t=e.orientation===Z.HORIZONTAL?tn.HORIZONTAL:tn.VERTICAL,i=this.serializedNodeToGroupLayoutArgument(e.root);return{orientation:t,groups:i.groups}}serializedNodeToGroupLayoutArgument(e){return e.type==="branch"?{size:e.size,groups:e.data.map(t=>this.serializedNodeToGroupLayoutArgument(t))}:{size:e.size}}shouldRestoreFocus(e){return e?Ic()===e.ownerDocument.body?!0:eC(e):!1}isTwoDimensionalGrid(){const e=this.gridWidget.getViews();return po(e)?e.children.some(t=>po(t)):!1}addGroup(e,t,i){const s=this.assertGroupView(e);let o;if(s.groupsView===this){const n=this.shouldRestoreFocus(s.element),r=this.groupViews.size>1&&this.isGroupExpanded(s);o=this.doCreateGroupView(i),this.gridWidget.addView(o,this.getSplitSizingStyle(),s,this.toGridViewDirection(t)),this.updateContainer(),this._onDidAddGroup.fire(o),this.notifyGroupIndexChange(),r&&this.arrangeGroups(_s.EXPAND,o),n&&s.focus()}else o=s.groupsView.addGroup(s,t,i);return o}getSplitSizingStyle(){switch(this._partOptions.splitSizing){case"distribute":return Dn.Distribute;case"split":return Dn.Split;default:return Dn.Auto}}doCreateGroupView(e,t){let i;e instanceof ja?i=ja.createCopy(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):tC(e)?i=ja.createFromSerialized(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):i=ja.createNew(this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t),this.groupViews.set(i.id,i);const s=new O;return s.add(i.onDidFocus(()=>{this.doSetGroupActive(i),this._onDidFocus.fire()})),s.add(i.onDidModelChange(o=>{switch(o.kind){case nd.GROUP_LOCKED:this._onDidChangeGroupLocked.fire(i);break;case nd.GROUP_INDEX:this._onDidChangeGroupIndex.fire(i);break;case nd.GROUP_LABEL:this._onDidChangeGroupLabel.fire(i);break}})),s.add(i.onDidActiveEditorChange(()=>{this.updateContainer()})),L.once(i.onWillDispose)(()=>{je(s),this.groupViews.delete(i.id),this.doUpdateMostRecentActive(i)}),i}doSetGroupActive(e){if(this._activeGroup!==e){const t=this._activeGroup;this._activeGroup=e,this.doUpdateMostRecentActive(e,!0),t&&!t.disposed&&t.setActive(!1),e.setActive(!0),this.doRestoreGroup(e),this._onDidChangeActiveGroup.fire(e)}this._onDidActivateGroup.fire(e)}doRestoreGroup(e){if(this.gridWidget)try{this.hasMaximizedGroup()&&!this.isGroupMaximized(e)&&this.unmaximizeGroup();const t=this.gridWidget.getViewSize(e);(t.width===e.minimumWidth||t.height===e.minimumHeight)&&this.arrangeGroups(_s.EXPAND,e)}catch{}}doUpdateMostRecentActive(e,t){const i=this.mostRecentActiveGroups.indexOf(e.id);i!==-1&&this.mostRecentActiveGroups.splice(i,1),t&&this.mostRecentActiveGroups.unshift(e.id)}toGridViewDirection(e){switch(e){case we.UP:return de.Up;case we.DOWN:return de.Down;case we.LEFT:return de.Left;case we.RIGHT:return de.Right}}toGridViewOrientation(e,t){return typeof e=="number"?e===tn.HORIZONTAL?Z.HORIZONTAL:Z.VERTICAL:t}removeGroup(e,t){const i=this.assertGroupView(e);this.count!==1&&(i.isEmpty?this.doRemoveEmptyGroup(i,t):this.doRemoveGroupWithEditors(i))}doRemoveGroupWithEditors(e){const t=this.getGroups(Ge.MOST_RECENTLY_ACTIVE);let i;this._activeGroup===e?i=t[1]:i=t[0],this.mergeGroup(e,i)}doRemoveEmptyGroup(e,t){const i=!t&&this.shouldRestoreFocus(this.container);if(this._activeGroup===e){const o=this.getGroups(Ge.MOST_RECENTLY_ACTIVE)[1];this.doSetGroupActive(o)}this.gridWidget.removeView(e,this.getSplitSizingStyle()),e.dispose(),i&&this._activeGroup.focus(),this.notifyGroupIndexChange(),this.updateContainer(),this._onDidRemoveGroup.fire(e)}moveGroup(e,t,i){const s=this.assertGroupView(e),o=this.assertGroupView(t);if(s.id===o.id)throw new Error("Cannot move group into its own");const n=this.shouldRestoreFocus(s.element);let r;return s.groupsView===o.groupsView?(this.gridWidget.moveView(s,this.getSplitSizingStyle(),o,this.toGridViewDirection(i)),r=s):(r=o.groupsView.addGroup(o,i,s),s.closeAllEditors(),this.removeGroup(s,n)),n&&r.focus(),this._onDidMoveGroup.fire(r),this.notifyGroupIndexChange(),r}copyGroup(e,t,i){const s=this.assertGroupView(e),o=this.assertGroupView(t),n=this.shouldRestoreFocus(s.element),r=this.addGroup(o,i,s);return n&&r.focus(),r}mergeGroup(e,t,i){const s=this.assertGroupView(e),o=this.assertGroupView(t),n=[];let r=i&&typeof i.index=="number"?i.index:o.count;for(const l of s.editors){const h=!s.isActive(l)||this._activeGroup!==s;let p;o.contains(l)&&(o.isSticky(l)||i?.preserveExistingIndex)||(p=r,r++),n.push({editor:l,options:{index:p,inactive:h,preserveFocus:h}})}let d=!0;return i?.mode===Jm.COPY_EDITORS?s.copyEditors(n,o):d=s.moveEditors(n,o),s.isEmpty&&!s.disposed&&this.removeGroup(s,!0),d}mergeAllGroups(e,t){const i=this.assertGroupView(e);let s=!0;for(const o of this.getGroups(Ge.MOST_RECENTLY_ACTIVE)){if(o===i)continue;this.mergeGroup(o,i,t)||(s=!1)}return s}assertGroupView(e){let t;if(typeof e=="number"?t=this.editorPartsView.getGroup(e):t=e,!t)throw new Error("Invalid editor group provided!");return t}createEditorDropTarget(e,t){return iC(qn(e)),this.scopedInstantiationService.createInstance(_h,e,t)}get minimumWidth(){return Math.min(this.centeredLayoutWidget.minimumWidth,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(St(this.container))).width)}get maximumWidth(){return this.centeredLayoutWidget.maximumWidth}get minimumHeight(){return Math.min(this.centeredLayoutWidget.minimumHeight,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(St(this.container))).height)}get maximumHeight(){return this.centeredLayoutWidget.maximumHeight}get snap(){return this.layoutService.getPanelAlignment()==="center"}get onDidChange(){return L.any(this.centeredLayoutWidget.onDidChange,this.onDidSetGridWidget.event)}get gridSeparatorBorder(){return this.theme.getColor(sC)||this.theme.getColor($s)||oi.transparent}updateStyles(){this.container.style.backgroundColor=this.getColor(oC)||"";const e={separatorBorder:this.gridSeparatorBorder,background:this.theme.getColor(nC)||oi.transparent};this.gridWidget.style(e),this.centeredLayoutWidget.styles(e)}createContentArea(e,t){return this.element=e,this.windowId!==re.vscodeWindowId&&this.container.classList.add("auxiliary"),e.appendChild(this.container),this._willRestoreState=!t||t.restorePreviousState,this.doCreateGridControl(),this.centeredLayoutWidget=this._register(new GT(this.container,this.gridWidgetView,this.profileMemento[Xi.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY],this._partOptions.centeredLayoutFixedWidth)),this._register(this.onDidChangeEditorPartOptions(i=>this.centeredLayoutWidget.setFixedWidth(i.newPartOptions.centeredLayoutFixedWidth??!1))),this.setupDragAndDropSupport(e,this.container),this.handleContextKeys(),this.whenReadyPromise.complete(),this._isReady=!0,xp.settled(this.groups.map(i=>i.whenRestored)).finally(()=>{this.whenRestoredPromise.complete()}),this.container}handleContextKeys(){Js.bindTo(this.scopedContextKeyService).set(this.windowId!==re.vscodeWindowId);const t=kp.bindTo(this.scopedContextKeyService),i=Rp.bindTo(this.scopedContextKeyService),s=()=>{this.count>1?t.set(!0):t.reset(),this.hasMaximizedGroup()?i.set(!0):i.reset()};s(),this._register(this.onDidAddGroup(()=>s())),this._register(this.onDidRemoveGroup(()=>s())),this._register(this.onDidChangeGroupMaximized(()=>s()))}setupDragAndDropSupport(e,t){this._register(this.createEditorDropTarget(t,Object.create(null)));const i=M(".drop-block-overlay");e.appendChild(i),this._register(rC(i,()=>i.classList.remove("visible"))),this._register(md.INSTANCE.registerTarget(this.element,{onDragStart:h=>i.classList.add("visible"),onDragEnd:h=>i.classList.remove("visible")}));let s,o,n,r;const d=h=>{!this.layoutService.isVisible(P.PANEL_PART)&&h===this.layoutService.getPanelPosition()?this.layoutService.setPartHidden(!1,P.PANEL_PART):!this.layoutService.isVisible(P.AUXILIARYBAR_PART)&&h===(this.layoutService.getSideBarPosition()===Ot.RIGHT?Ot.LEFT:Ot.RIGHT)&&this.layoutService.setPartHidden(!1,P.AUXILIARYBAR_PART)},l=()=>{s&&(clearTimeout(s),s=void 0),o&&(clearTimeout(o),o=void 0)};this._register(md.INSTANCE.registerTarget(i,{onDragOver:h=>{ke.stop(h.eventData,!0),h.eventData.dataTransfer&&(h.eventData.dataTransfer.dropEffect="none");const p=i.getBoundingClientRect();let f,g;const m=100;h.eventData.clientX<p.left+m&&(f=Ot.LEFT),h.eventData.clientX>p.right-m&&(f=Ot.RIGHT),h.eventData.clientY>p.bottom-m&&(g=Ot.BOTTOM),h.eventData.clientY<p.top+m&&(g=Ot.TOP),s&&f!==n&&(clearTimeout(s),s=void 0),o&&g!==r&&(clearTimeout(o),o=void 0),!s&&f!==void 0&&(n=f,s=setTimeout(()=>d(f),200)),!o&&g!==void 0&&(r=g,o=setTimeout(()=>d(g),200))},onDragLeave:()=>l(),onDragEnd:()=>l(),onDrop:()=>l()}))}centerLayout(e){this.centeredLayoutWidget.activate(e)}isLayoutCentered(){return this.centeredLayoutWidget?this.centeredLayoutWidget.isActive():!1}doCreateGridControl(){let e=!1;if(this._willRestoreState&&(e=!this.doCreateGridControlWithPreviousState()),!this.gridWidget||e){const t=this.doCreateGroupView();this.doSetGridWidget(new ks(t)),this.doSetGroupActive(t)}this.updateContainer(),this.notifyGroupIndexChange()}doCreateGridControlWithPreviousState(){const e=this.loadState();if(e?.serializedGrid)try{this.mostRecentActiveGroups=e.mostRecentActiveGroups,this.doCreateGridControlWithState(e.serializedGrid,e.activeGroup)}catch(t){return jn(new Error(`Error restoring editor grid widget: ${t} (with state: ${JSON.stringify(e)})`)),this.disposeGroups(),!1}return!0}doCreateGridControlWithState(e,t,i,s){let o;i?o=i.slice(0):o=[];const n=[],r=ks.deserialize(e,{fromJSON:d=>{let l;return o.length>0?l=o.shift():l=this.doCreateGroupView(d,s),n.push(l),l.id===t&&this.doSetGroupActive(l),l}},{styles:{separatorBorder:this.gridSeparatorBorder}});this._activeGroup||this.doSetGroupActive(n[0]),this.mostRecentActiveGroups.some(d=>!this.getGroup(d))&&(this.mostRecentActiveGroups=n.map(d=>d.id)),this.doSetGridWidget(r)}doSetGridWidget(e){let t={};this.gridWidget&&(t=this.gridWidget.boundarySashes,this.gridWidget.dispose()),this.gridWidget=e,this.gridWidget.boundarySashes=t,this.gridWidgetView.gridWidget=e,this._onDidChangeSizeConstraints.input=e.onDidChange,this._onDidScroll.input=e.onDidScroll,this.gridWidgetDisposables.clear(),this.gridWidgetDisposables.add(e.onDidChangeViewMaximized(i=>this._onDidChangeGroupMaximized.fire(i))),this.onDidSetGridWidget.fire(void 0)}updateContainer(){this.container.classList.toggle("empty",this.isEmpty)}notifyGroupIndexChange(){this.getGroups(Ge.GRID_APPEARANCE).forEach((e,t)=>e.notifyIndexChanged(t))}notifyGroupsLabelChange(e){for(const t of this.groups)t.notifyLabelChanged(e)}get isEmpty(){return this.count===1&&this._activeGroup.isEmpty}setBoundarySashes(e){this.gridWidget.boundarySashes=e,this.centeredLayoutWidget.boundarySashes=e}layout(e,t,i,s){this.top=i,this.left=s;const o=super.layoutContents(e,t).contentSize;this.doLayout(jt.lift(o),i,s)}doLayout(e,t=this.top,i=this.left){this._contentDimension=e,this.centeredLayoutWidget.layout(this._contentDimension.width,this._contentDimension.height,t,i),this._onDidLayout.fire(e)}saveState(){if(this.gridWidget&&(this.isEmpty?delete this.workspaceMemento[Xi.EDITOR_PART_UI_STATE_STORAGE_KEY]:this.workspaceMemento[Xi.EDITOR_PART_UI_STATE_STORAGE_KEY]=this.createState()),this.centeredLayoutWidget){const e=this.centeredLayoutWidget.state;this.centeredLayoutWidget.isDefault(e)?delete this.profileMemento[Xi.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]:this.profileMemento[Xi.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]=e}super.saveState()}loadState(){return this.workspaceMemento[Xi.EDITOR_PART_UI_STATE_STORAGE_KEY]}createState(){return{serializedGrid:this.gridWidget.serialize(),activeGroup:this._activeGroup.id,mostRecentActiveGroups:this.mostRecentActiveGroups}}applyState(e,t){return e==="empty"?this.doApplyEmptyState():this.doApplyState(e,t)}async doApplyState(e,t){const i=await this.doPrepareApplyState();this._onDidAddGroup.pause(),this._onDidRemoveGroup.pause(),this.disposeGroups(),this.mostRecentActiveGroups=e.mostRecentActiveGroups;try{this.doApplyGridState(e.serializedGrid,e.activeGroup,void 0,t)}finally{this._onDidRemoveGroup.resume(),this._onDidAddGroup.resume()}await this.activeGroup.openEditors(i.flatMap(s=>s.editors).filter(s=>this.editorPartsView.groups.every(o=>!o.contains(s))).map(s=>({editor:s,options:{pinned:!0,preserveFocus:!0,inactive:!0}})))}async doApplyEmptyState(){await this.doPrepareApplyState(),this.mergeAllGroups(this.activeGroup)}async doPrepareApplyState(){const e=this.getGroups(Ge.MOST_RECENTLY_ACTIVE);for(const t of e)await t.closeAllEditors({excludeConfirming:!0});return e}doApplyGridState(e,t,i,s){this.doCreateGridControlWithState(e,t,i,s),this.doLayout(this._contentDimension),this.updateContainer();for(const o of this.getGroups(Ge.GRID_APPEARANCE))i?.includes(o)||this._onDidAddGroup.fire(o);this.notifyGroupIndexChange()}onDidChangeMementoState(e){if(e.external&&e.scope===H.WORKSPACE){this.reloadMemento(e.scope);const t=this.loadState();t&&this.applyState(t)}}toJSON(){return{type:P.EDITOR_PART}}disposeGroups(){for(const e of this.groups)e.dispose(),this._onDidRemoveGroup.fire(e);this.groupViews.clear(),this.mostRecentActiveGroups=[]}dispose(){this._onWillDispose.fire(),this.disposeGroups(),this.gridWidget?.dispose(),super.dispose()}},Xi=Ms,Ms.EDITOR_PART_UI_STATE_STORAGE_KEY="editorpart.state",Ms.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY="editorpart.centeredview",Ms);Vd=Xi=D([u(4,F),u(5,me),u(6,ie),u(7,ce),u(8,He),u(9,Zt),u(10,se)],Vd);let Eh=class extends Vd{constructor(e,t,i,s,o,n,r,d){super(e,P.EDITOR_PART,"",re.vscodeWindowId,t,i,s,o,n,r,d)}};Eh=D([u(1,F),u(2,me),u(3,ie),u(4,ce),u(5,He),u(6,Zt),u(7,se)],Eh);const HT=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var on;Pe(HT);var Mi;let Ih=(Mi=class extends da{get preferredHeight(){return this.layoutService.mainContainerDimension.height*.4}get preferredWidth(){const e=this.getActivePaneComposite();if(!e)return;const t=e.getOptimalWidth();if(typeof t=="number")return Math.max(t,300)}constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m){super(P.AUXILIARYBAR_PART,{hasTitle:!0,borderWidth:()=>this.getColor(yd)||this.getColor($s)?1:0},on.activeViewSettingsKey,aC.bindTo(h),dC.bindTo(h),"auxiliarybar","auxiliarybar",void 0,Nm,e,t,i,s,o,n,r,d,l,h,p,g),this.commandService=f,this.configurationService=m,this.minimumWidth=170,this.maximumWidth=Number.POSITIVE_INFINITY,this.minimumHeight=0,this.maximumHeight=Number.POSITIVE_INFINITY,this.priority=Vi.Low,this.configuration=this.resolveConfiguration(),this._register(m.onDidChangeConfiguration(v=>{v.affectsConfiguration(Wt.ACTIVITY_BAR_LOCATION)?(this.configuration=this.resolveConfiguration(),this.onDidChangeActivityBarLocation()):v.affectsConfiguration("workbench.secondarySideBar.showLabels")&&(this.configuration=this.resolveConfiguration(),this.updateCompositeBar(!0))}))}resolveConfiguration(){const e=this.configurationService.getValue(Wt.ACTIVITY_BAR_LOCATION),t=e!==Oe.TOP,i=t&&this.configurationService.getValue("workbench.secondarySideBar.showLabels")!==!1;return{position:e,canShowLabels:t,showLabels:i}}onDidChangeActivityBarLocation(){this.updateCompositeBar();const e=this.getActiveComposite()?.getId();e&&this.onTitleAreaUpdate(e)}updateStyles(){super.updateStyles();const e=Ee(this.getContainer());e.style.backgroundColor=this.getColor(Cn)||"";const t=this.getColor(yd)||this.getColor($s),i=this.layoutService.getSideBarPosition()===Ot.RIGHT;e.style.color=this.getColor(Bm)||"",e.style.borderLeftColor=t??"",e.style.borderRightColor=t??"",e.style.borderLeftStyle=t&&!i?"solid":"none",e.style.borderRightStyle=t&&i?"solid":"none",e.style.borderLeftWidth=t&&!i?"1px":"0px",e.style.borderRightWidth=t&&i?"1px":"0px"}getCompositeBarOptions(){const e=this;return{partContainerClass:"auxiliarybar",pinnedViewContainersKey:on.pinnedViewsKey,placeholderViewContainersKey:on.placeholdeViewContainersKey,viewContainersWorkspaceStateKey:on.viewContainersWorkspaceStateKey,icon:!this.configuration.showLabels,orientation:Fo.HORIZONTAL,recomputeSizes:!0,activityHoverOptions:{position:()=>this.getCompositeBarPosition()===fe.BOTTOM?$n.ABOVE:$n.BELOW},fillExtraContextMenuActions:t=>this.fillExtraContextMenuActions(t),compositeSize:0,iconSize:16,get overflowActionSize(){return e.getCompositeBarPosition()===fe.TITLE?40:30},colors:t=>({activeBackgroundColor:t.getColor(Cn),inactiveBackgroundColor:t.getColor(Cn),get activeBorderBottomColor(){return e.getCompositeBarPosition()===fe.TITLE?t.getColor(jm):t.getColor(Hm)},get activeForegroundColor(){return e.getCompositeBarPosition()===fe.TITLE?t.getColor(qm):t.getColor(Um)},get inactiveForegroundColor(){return e.getCompositeBarPosition()===fe.TITLE?t.getColor($m):t.getColor(Gm)},badgeBackground:t.getColor(Wm),badgeForeground:t.getColor(Km),get dragAndDropBorder(){return e.getCompositeBarPosition()===fe.TITLE?t.getColor(zm):t.getColor(Fm)}}),compact:!0}}fillExtraContextMenuActions(e){const t=this.layoutService.getSideBarPosition()===Ot.LEFT;if(this.getCompositeBarPosition()===fe.TITLE){const n=this.getViewsSubmenuAction();n&&(e.push(new hs),e.push(n))}const i=this.menuService.getMenuActions(w.ActivityBarPositionMenu,this.contextKeyService,{shouldForwardArgs:!0,renderShortTitle:!0}),s=bd(i).secondary,o=cs({id:"workbench.action.auxiliarybar.toggleShowLabels",label:this.configuration.showLabels?c(2881,"Show Icons"):c(2882,"Show Labels"),enabled:this.configuration.canShowLabels,run:()=>this.configurationService.updateValue("workbench.secondarySideBar.showLabels",!this.configuration.showLabels)});e.push(new hs,new wd("workbench.action.panel.position",c(2883,"Activity Bar Position"),s),cs({id:xg.ID,label:t?c(2884,"Move Secondary Side Bar Left"):c(2885,"Move Secondary Side Bar Right"),run:()=>this.commandService.executeCommand(xg.ID)}),o,cs({id:hl.ID,label:c(2886,"Hide Secondary Side Bar"),run:()=>this.commandService.executeCommand(hl.ID)}))}shouldShowCompositeBar(){return this.configuration.position!==Oe.HIDDEN}getCompositeBarPosition(){switch(this.configuration.position){case Oe.TOP:return fe.TOP;case Oe.BOTTOM:return fe.BOTTOM;case Oe.HIDDEN:return fe.TITLE;case Oe.DEFAULT:return fe.TITLE;default:return fe.TITLE}}createHeaderArea(){const e=super.createHeaderArea(),t=M(".auxiliary-bar-global-header"),i=this.headerFooterCompositeBarDispoables.add(this.instantiationService.createInstance(Vm,w.AuxiliaryBarHeader,void 0,void 0)),s=this.headerFooterCompositeBarDispoables.add(this.instantiationService.createInstance(Dp,t,{actionViewItemProvider:(o,n)=>this.headerActionViewItemProvider(o,n),orientation:Fo.HORIZONTAL,hiddenItemStrategy:Pm.NoHide,getKeyBinding:o=>this.keybindingService.lookupKeybinding(o.id)}));return s.setActions(Hn(i.getPrimaryActions())),this.headerFooterCompositeBarDispoables.add(i.onDidChange(()=>s.setActions(Hn(i.getPrimaryActions())))),e.appendChild(t),e}headerActionViewItemProvider(e,t){if(e.id===hl.ID)return this.instantiationService.createInstance(Lp,void 0,e,t)}toJSON(){return{type:P.AUXILIARYBAR_PART}}},on=Mi,Mi.activeViewSettingsKey="workbench.auxiliarybar.activepanelid",Mi.pinnedViewsKey="workbench.auxiliarybar.pinnedPanels",Mi.placeholdeViewContainersKey="workbench.auxiliarybar.placeholderPanels",Mi.viewContainersWorkspaceStateKey="workbench.auxiliarybar.viewContainersWorkspaceState",Mi);Ih=on=D([u(0,Ke),u(1,ce),u(2,at),u(3,He),u(4,it),u(5,Tt),u(6,F),u(7,me),u(8,Ye),u(9,se),u(10,At),u(11,wt),u(12,Cs),u(13,ie)],Ih);var nn,Dh;const il=lC(new E);b(class extends X{constructor(){super({id:"workbench.action.toggleCompactAuxiliaryWindow",title:x(2905,"Toggle Window Compact Mode"),category:xe.View,f1:!0,precondition:pC})}async run(){il.fire({windowId:Go().vscodeWindowId,compact:"toggle"})}});b(class extends X{constructor(){super({id:"workbench.action.enableCompactAuxiliaryWindow",title:c(2906,"Turn On Compact Mode"),icon:k.screenFull,menu:{id:w.LayoutControlMenu,when:I.and(ew.toNegated(),Js),order:0}})}async run(){il.fire({windowId:Go().vscodeWindowId,compact:!0})}});b(class extends X{constructor(){super({id:"workbench.action.disableCompactAuxiliaryWindow",title:c(2907,"Turn Off Compact Mode"),icon:k.screenNormal,menu:{id:w.LayoutControlMenu,when:I.and(ew,Js),order:0}})}async run(){il.fire({windowId:Go().vscodeWindowId,compact:!1})}});var Co;let Ah=(Co=class{constructor(e,t,i,s,o,n,r,d,l){this.editorPartsView=e,this.instantiationService=t,this.auxiliaryWindowService=i,this.lifecycleService=s,this.configurationService=o,this.statusbarService=n,this.titleService=r,this.editorService=d,this.layoutService=l}async create(e,t){const i=this,s=new O;let o=!!t?.compact;function n(){let W=0;return B&&(W+=T.height),m&&v&&(W+=m.height),W}function r(W){B?ia(T.container):sa(T.container),W&&h.layout()}function d(W){m&&(v?ia(m.container):sa(m.container),W&&h.layout())}function l(W){if(W===o)return;o=W,h.updateOptions({compact:o}),m?.updateOptions({compact:o}),f.updateOptions({compact:o});const K=B;B=!o&&i.configurationService.getValue(nn.STATUS_BAR_VISIBILITY)!==!1,K!==B&&r(!0)}const h=s.add(await this.auxiliaryWindowService.open(t)),p=M(".part.editor",{role:"main"});p.style.position="relative",h.container.appendChild(p);const f=s.add(this.instantiationService.createInstance(Th,h.window.vscodeWindowId,this.editorPartsView,t?.state,e));f.updateOptions({compact:o}),s.add(this.editorPartsView.registerPart(f)),f.create(p);const g=s.add(f.scopedInstantiationService.createChild(new ta([Q,this.editorService.createScoped(f,s)])));let m,v=!1;if(hC&&uC()){m=s.add(this.titleService.createAuxiliaryTitlebarPart(h.container,f,g)),m.updateOptions({compact:o}),v=kg(this.configurationService,h.window,void 0);const W=()=>{const K=v;v=kg(this.configurationService,h.window,void 0),K!==v&&d(!0)};s.add(m.onDidChange(()=>h.layout())),s.add(this.layoutService.onDidChangePartVisibility(()=>W())),s.add(Qm(K=>{K===h.window.vscodeWindowId&&W()})),d(!1)}else s.add(g.createInstance(cC,h.window));const T=s.add(this.statusbarService.createAuxiliaryStatusbarPart(h.container,g));let B=!o&&this.configurationService.getValue(nn.STATUS_BAR_VISIBILITY)!==!1;s.add(this.configurationService.onDidChangeConfiguration(W=>{W.affectsConfiguration(nn.STATUS_BAR_VISIBILITY)&&(B=!o&&this.configurationService.getValue(nn.STATUS_BAR_VISIBILITY)!==!1,r(!0))})),r(!1);const V=s.add(L.once(f.onWillClose)(()=>h.window.close()));s.add(L.once(h.onUnload)(()=>{s.isDisposed||(V.dispose(),f.close(),s.dispose())})),s.add(L.once(this.lifecycleService.onDidShutdown)(()=>s.dispose())),s.add(h.onBeforeUnload(W=>{for(const K of f.groups)for(const j of K.editors){const oe=j.canMove(K.id,this.editorPartsView.mainPart.activeGroup.id);if(typeof oe=="string"){K.openEditor(j),W.veto(oe);break}}})),s.add(h.onWillLayout(W=>{const K=m?.height??0;m?.layout(W.width,K,0,0);const j=W.height-n();f.layout(W.width,j,K,0),T.layout(W.width,T.height,W.height-T.height,0)})),h.layout(),s.add(il.event(W=>{if(W.windowId===h.window.vscodeWindowId){let K;typeof W.compact=="boolean"?K=W.compact:K=!o,l(K)}}));const U=s.add(g.createChild(new ta([Ui,this.statusbarService.createScoped(T,s)])));return{part:f,instantiationService:U,disposables:s}}},nn=Co,Co.STATUS_BAR_VISIBILITY="workbench.statusBar.visible",Co);Ah=nn=D([u(1,F),u(2,Vp),u(3,or),u(4,ie),u(5,Ui),u(6,gC),u(7,Q),u(8,He)],Ah);var So;let Th=(So=class extends Vd{constructor(e,t,i,s,o,n,r,d,l,h,p){const f=Dh.COUNTER++;super(t,`workbench.parts.auxiliaryEditor.${f}`,s,e,o,n,r,d,l,h,p),this.state=i,this._onWillClose=this._register(new E),this.onWillClose=this._onWillClose.event,this.optionsDisposable=this._register(new Ie),this.isCompact=!1}updateOptions(e){this.isCompact=e.compact,e.compact?this.optionsDisposable.value||(this.optionsDisposable.value=this.enforcePartOptions({showTabs:"none",closeEmptyGroups:!0})):this.optionsDisposable.clear()}addGroup(e,t,i){return this.isCompact&&(e=this.editorPartsView.mainPart.activeGroup),super.addGroup(e,t,i)}removeGroup(e,t){const i=this.assertGroupView(e);this.count===1&&this.activeGroup===i?this.doRemoveLastGroup(t):super.removeGroup(e,t)}doRemoveLastGroup(e){const t=!e&&this.shouldRestoreFocus(this.container),s=this.editorPartsView.getGroups(Ge.MOST_RECENTLY_ACTIVE)[1];s&&(s.groupsView.activateGroup(s),t&&s.focus()),this.doClose(!1)}loadState(){return this.state}saveState(){}close(){return this.doClose(!0)}doClose(e){let t=!0;if(e){for(const i of this.groups)i.closeAllEditors({excludeConfirming:!0});t=this.mergeGroupsToMainPart()}return this._onWillClose.fire(),t}mergeGroupsToMainPart(){if(!this.groups.some(i=>i.count>0))return!0;let e;for(const i of this.editorPartsView.mainPart.getGroups(Ge.MOST_RECENTLY_ACTIVE))if(!i.isLocked){e=i;break}e||(e=this.editorPartsView.mainPart.addGroup(this.editorPartsView.mainPart.activeGroup,this.partOptions.openSideBySideDirection==="right"?we.RIGHT:we.DOWN));const t=this.mergeAllGroups(e,{preserveExistingIndex:!0});return e.focus(),t}},Dh=So,So.COUNTER=1,So);Th=Dh=D([u(4,F),u(5,me),u(6,ie),u(7,ce),u(8,He),u(9,Zt),u(10,se)],Th);var so,Os;let Zf=(Os=class extends fC{constructor(e,t,i,s,o){super("workbench.editorParts",i,t),this.instantiationService=e,this.storageService=t,this.auxiliaryWindowService=s,this.contextKeyService=o,this.mapPartToInstantiationService=new Map,this._onDidCreateAuxiliaryEditorPart=this._register(new E),this.onDidCreateAuxiliaryEditorPart=this._onDidCreateAuxiliaryEditorPart.event,this.workspaceMemento=this.getMemento(H.WORKSPACE,Re.USER),this._isReady=!1,this.whenReadyPromise=new Ko,this.whenReady=this.whenReadyPromise.p,this.whenRestoredPromise=new Ko,this.whenRestored=this.whenRestoredPromise.p,this._onDidActiveGroupChange=this._register(new E),this.onDidChangeActiveGroup=this._onDidActiveGroupChange.event,this._onDidAddGroup=this._register(new E),this.onDidAddGroup=this._onDidAddGroup.event,this._onDidRemoveGroup=this._register(new E),this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidMoveGroup=this._register(new E),this.onDidMoveGroup=this._onDidMoveGroup.event,this._onDidActivateGroup=this._register(new E),this.onDidActivateGroup=this._onDidActivateGroup.event,this._onDidChangeGroupIndex=this._register(new E),this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event,this._onDidChangeGroupLocked=this._register(new E),this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event,this._onDidChangeGroupMaximized=this._register(new E),this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event,this.globalContextKeys=new Map,this.scopedContextKeys=new Map,this.contextKeyProviders=new Map,this.registeredContextKeys=new Map,this.contextKeyProviderDisposables=this._register(new Cd),this.editorWorkingSets=(()=>{const n=this.storageService.get(so.EDITOR_WORKING_SETS_STORAGE_KEY,H.WORKSPACE);return n?JSON.parse(n):[]})(),this.mainPart=this._register(this.createMainEditorPart()),this._register(this.registerPart(this.mainPart)),this.mostRecentActiveParts=[this.mainPart],this.restoreParts(),this.registerListeners()}registerListeners(){this._register(this.onDidChangeMementoValue(H.WORKSPACE,this._store)(e=>this.onDidChangeMementoState(e))),this.whenReady.then(()=>this.registerGroupsContextKeyListeners())}createMainEditorPart(){return this.instantiationService.createInstance(Eh,this)}getScopedInstantiationService(e){return e===this.mainPart&&(this.mapPartToInstantiationService.has(e.windowId)||this.instantiationService.invokeFunction(t=>{const i=t.get(Q),s=t.get(Ui);this.mapPartToInstantiationService.set(e.windowId,this._register(this.mainPart.scopedInstantiationService.createChild(new ta([Q,i.createScoped(this.mainPart,this._store)],[Ui,s.createScoped(s,this._store)]))))})),this.mapPartToInstantiationService.get(e.windowId)??this.instantiationService}async createAuxiliaryEditorPart(e){const{part:t,instantiationService:i,disposables:s}=await this.instantiationService.createInstance(Ah,this).create(this.getGroupsLabel(this._parts.size),e);return this.mapPartToInstantiationService.set(t.windowId,i),s.add(ae(()=>this.mapPartToInstantiationService.delete(t.windowId))),this._onDidAddGroup.fire(t.activeGroup),this._onDidCreateAuxiliaryEditorPart.fire(t),t}registerPart(e){const t=this._register(new O);return t.add(super.registerPart(e)),this.registerEditorPartListeners(e,t),t}unregisterPart(e){super.unregisterPart(e),this.parts.forEach((t,i)=>{t!==this.mainPart&&t.notifyGroupsLabelChange(this.getGroupsLabel(i))})}registerEditorPartListeners(e,t){t.add(e.onDidFocus(()=>{this.doUpdateMostRecentActive(e,!0),this._parts.size>1&&this._onDidActiveGroupChange.fire(this.activeGroup)})),t.add(ae(()=>this.doUpdateMostRecentActive(e))),t.add(e.onDidChangeActiveGroup(i=>this._onDidActiveGroupChange.fire(i))),t.add(e.onDidAddGroup(i=>this._onDidAddGroup.fire(i))),t.add(e.onDidRemoveGroup(i=>this._onDidRemoveGroup.fire(i))),t.add(e.onDidMoveGroup(i=>this._onDidMoveGroup.fire(i))),t.add(e.onDidActivateGroup(i=>this._onDidActivateGroup.fire(i))),t.add(e.onDidChangeGroupMaximized(i=>this._onDidChangeGroupMaximized.fire(i))),t.add(e.onDidChangeGroupIndex(i=>this._onDidChangeGroupIndex.fire(i))),t.add(e.onDidChangeGroupLocked(i=>this._onDidChangeGroupLocked.fire(i)))}doUpdateMostRecentActive(e,t){const i=this.mostRecentActiveParts.indexOf(e);i!==-1&&this.mostRecentActiveParts.splice(i,1),t&&this.mostRecentActiveParts.unshift(e)}getGroupsLabel(e){return c(3273,"Window {0}",e+1)}getPart(e){if(this._parts.size>1)if(qn(e)){const t=e;return this.getPartByDocument(t.ownerDocument)}else{const t=e;let i;typeof t=="number"?i=t:i=t.id;for(const s of this._parts)if(s.hasGroup(i))return s}return this.mainPart}get isReady(){return this._isReady}async restoreParts(){if(await this.mainPart.whenReady,this.mainPart.willRestoreState){const t=this.loadState();t&&await this.restoreState(t)}this.mostRecentActiveParts.at(0)?.activeGroup.focus(),this._isReady=!0,this.whenReadyPromise.complete(),await Promise.allSettled(this.parts.map(t=>t.whenRestored)),this.whenRestoredPromise.complete()}loadState(){return this.workspaceMemento[so.EDITOR_PARTS_UI_STATE_STORAGE_KEY]}saveState(){const e=this.createState();e.auxiliary.length===0?delete this.workspaceMemento[so.EDITOR_PARTS_UI_STATE_STORAGE_KEY]:this.workspaceMemento[so.EDITOR_PARTS_UI_STATE_STORAGE_KEY]=e}createState(){return{auxiliary:this.parts.filter(e=>e!==this.mainPart).map(e=>{const t=this.auxiliaryWindowService.getWindow(e.windowId);return{state:e.createState(),...t?.createState()}}),mru:this.mostRecentActiveParts.map(e=>this.parts.indexOf(e))}}async restoreState(e){if(e.auxiliary.length){const t=[];for(const i of e.auxiliary)t.push(this.createAuxiliaryEditorPart(i));await Promise.allSettled(t),e.mru.length===this.parts.length?this.mostRecentActiveParts=e.mru.map(i=>this.parts[i]):this.mostRecentActiveParts=[...this.parts],await Promise.allSettled(this.parts.map(i=>i.whenReady))}}get hasRestorableState(){return this.parts.some(e=>e.hasRestorableState)}onDidChangeMementoState(e){if(e.external&&e.scope===H.WORKSPACE){this.reloadMemento(e.scope);const t=this.loadState();t&&this.applyState(t)}}async applyState(e){for(const t of this.parts){if(t===this.mainPart)continue;for(const s of t.getGroups(Ge.MOST_RECENTLY_ACTIVE))await s.closeAllEditors({excludeConfirming:!0});if(!t.close())return!1}return e!=="empty"&&await this.restoreState(e),!0}saveWorkingSet(e){const t={id:nr(),name:e,main:this.mainPart.createState(),auxiliary:this.createState()};return this.editorWorkingSets.push(t),this.saveWorkingSets(),{id:t.id,name:t.name}}getWorkingSets(){return this.editorWorkingSets.map(e=>({id:e.id,name:e.name}))}deleteWorkingSet(e){const t=this.indexOfWorkingSet(e);typeof t=="number"&&(this.editorWorkingSets.splice(t,1),this.saveWorkingSets())}async applyWorkingSet(e,t){let i;if(e==="empty"?i="empty":i=this.editorWorkingSets[this.indexOfWorkingSet(e)??-1],!i||!await this.applyState(i==="empty"?i:i.auxiliary))return!1;if(await this.mainPart.applyState(i==="empty"?i:i.main,t),!t?.preserveFocus){const o=this.mostRecentActiveParts.at(0);o&&(await o.whenReady,o.activeGroup.focus())}return!0}indexOfWorkingSet(e){for(let t=0;t<this.editorWorkingSets.length;t++)if(this.editorWorkingSets[t].id===e.id)return t}saveWorkingSets(){this.storageService.store(so.EDITOR_WORKING_SETS_STORAGE_KEY,JSON.stringify(this.editorWorkingSets),H.WORKSPACE,Re.MACHINE)}get activeGroup(){return this.activePart.activeGroup}get sideGroup(){return this.activePart.sideGroup}get groups(){return this.getGroups()}get count(){return this.groups.length}getGroups(e=Ge.CREATION_TIME){if(this._parts.size>1){let t;switch(e){case Ge.GRID_APPEARANCE:case Ge.CREATION_TIME:t=this.parts;break;case Ge.MOST_RECENTLY_ACTIVE:t=Ls([...this.mostRecentActiveParts,...this.parts]);break}return t.map(i=>i.getGroups(e)).flat()}return this.mainPart.getGroups(e)}getGroup(e){if(this._parts.size>1)for(const t of this._parts){const i=t.getGroup(e);if(i)return i}return this.mainPart.getGroup(e)}assertGroupView(e){let t;if(typeof e=="number"?t=this.getGroup(e):t=e,!t)throw new Error("Invalid editor group provided!");return t}activateGroup(e){return this.getPart(e).activateGroup(e)}getSize(e){return this.getPart(e).getSize(e)}setSize(e,t){this.getPart(e).setSize(e,t)}arrangeGroups(e,t=this.activePart.activeGroup){this.getPart(t).arrangeGroups(e,t)}toggleMaximizeGroup(e=this.activePart.activeGroup){this.getPart(e).toggleMaximizeGroup(e)}toggleExpandGroup(e=this.activePart.activeGroup){this.getPart(e).toggleExpandGroup(e)}restoreGroup(e){return this.getPart(e).restoreGroup(e)}applyLayout(e){this.activePart.applyLayout(e)}getLayout(){return this.activePart.getLayout()}get orientation(){return this.activePart.orientation}setGroupOrientation(e){this.activePart.setGroupOrientation(e)}findGroup(e,t=this.activeGroup,i){const s=this.getPart(t);if(this._parts.size>1){const o=this.getGroups(Ge.GRID_APPEARANCE);if(e.location===Nt.FIRST||e.location===Nt.LAST)return e.location===Nt.FIRST?o[0]:o[o.length-1];const n=s.findGroup(e,t,!1);if(n)return n;if(e.location===Nt.NEXT||e.location===Nt.PREVIOUS){const r=this.assertGroupView(t),d=o.indexOf(r);if(e.location===Nt.NEXT){let l=o[d+1];return!l&&i&&(l=o[0]),l}else{let l=o[d-1];return!l&&i&&(l=o[o.length-1]),l}}}return s.findGroup(e,t,i)}addGroup(e,t){return this.getPart(e).addGroup(e,t)}removeGroup(e){this.getPart(e).removeGroup(e)}moveGroup(e,t,i){return this.getPart(e).moveGroup(e,t,i)}mergeGroup(e,t,i){return this.getPart(e).mergeGroup(e,t,i)}mergeAllGroups(e,t){return this.activePart.mergeAllGroups(e,t)}copyGroup(e,t,i){return this.getPart(e).copyGroup(e,t,i)}createEditorDropTarget(e,t){return this.getPart(e).createEditorDropTarget(e,t)}registerGroupsContextKeyListeners(){this._register(this.onDidChangeActiveGroup(()=>this.updateGlobalContextKeys())),this.groups.forEach(e=>this.registerGroupContextKeyProvidersListeners(e)),this._register(this.onDidAddGroup(e=>this.registerGroupContextKeyProvidersListeners(e))),this._register(this.onDidRemoveGroup(e=>{this.scopedContextKeys.delete(e.id),this.registeredContextKeys.delete(e.id),this.contextKeyProviderDisposables.deleteAndDispose(e.id)}))}updateGlobalContextKeys(){const e=this.scopedContextKeys.get(this.activeGroup.id);if(e)for(const[t,i]of this.globalContextKeys){const s=e.get(t);s?i.set(s.get()):i.reset()}}bind(e,t){let i=this.globalContextKeys.get(e.key);i||(i=e.bindTo(this.contextKeyService),this.globalContextKeys.set(e.key,i));let s=this.scopedContextKeys.get(t.id);s||(s=new Map,this.scopedContextKeys.set(t.id,s));let o=s.get(e.key);o||(o=e.bindTo(t.scopedContextKeyService),s.set(e.key,o));const n=this;return{get(){return o.get()},set(r){n.activeGroup===t&&i.set(r),o.set(r)},reset(){n.activeGroup===t&&i.reset(),o.reset()}}}registerContextKeyProvider(e){if(this.contextKeyProviders.has(e.contextKey.key)||this.globalContextKeys.has(e.contextKey.key))throw new Error(`A context key provider for key ${e.contextKey.key} already exists.`);this.contextKeyProviders.set(e.contextKey.key,e);const t=()=>{for(const s of this.groups)this.updateRegisteredContextKey(s,e)};t();const i=e.onDidChange?.(()=>t());return ae(()=>{i?.dispose(),this.globalContextKeys.delete(e.contextKey.key),this.scopedContextKeys.forEach(s=>s.delete(e.contextKey.key)),this.contextKeyProviders.delete(e.contextKey.key),this.registeredContextKeys.forEach(s=>s.delete(e.contextKey.key))})}registerGroupContextKeyProvidersListeners(e){const t=e.onDidActiveEditorChange(()=>{for(const i of this.contextKeyProviders.values())this.updateRegisteredContextKey(e,i)});this.contextKeyProviderDisposables.set(e.id,t)}updateRegisteredContextKey(e,t){let i=this.registeredContextKeys.get(e.id);i||(i=new Map,this.registeredContextKeys.set(e.id,i));let s=i.get(t.contextKey.key);s||(s=this.bind(t.contextKey,e),i.set(t.contextKey.key,s)),s.set(t.getGroupContextKeyValue(e))}get partOptions(){return this.mainPart.partOptions}get onDidChangeEditorPartOptions(){return this.mainPart.onDidChangeEditorPartOptions}enforcePartOptions(e){return this.mainPart.enforcePartOptions(e)}},so=Os,Os.EDITOR_PARTS_UI_STATE_STORAGE_KEY="editorparts.state",Os.EDITOR_WORKING_SETS_STORAGE_KEY="editor.workingSets",Os);Zf=so=D([u(0,F),u(1,ce),u(2,me),u(3,Vp),u(4,se)],Zf);class ca{static _readModifiers(e){e=e.toLowerCase().trim();let t=!1,i=!1,s=!1,o=!1,n;do n=!1,/^ctrl(\+|\-)/.test(e)&&(t=!0,e=e.substr(5),n=!0),/^shift(\+|\-)/.test(e)&&(i=!0,e=e.substr(6),n=!0),/^alt(\+|\-)/.test(e)&&(s=!0,e=e.substr(4),n=!0),/^meta(\+|\-)/.test(e)&&(o=!0,e=e.substr(5),n=!0),/^win(\+|\-)/.test(e)&&(o=!0,e=e.substr(4),n=!0),/^cmd(\+|\-)/.test(e)&&(o=!0,e=e.substr(4),n=!0);while(n);let r;const d=e.indexOf(" ");return d>0?(r=e.substring(0,d),e=e.substring(d)):(r=e,e=""),{remains:e,ctrl:t,shift:i,alt:s,meta:o,key:r}}static parseChord(e){const t=this._readModifiers(e),i=t.key.match(/^\[([^\]]+)\]$/);if(i){const o=i[1],n=Ut.lowerCaseToEnum(o);return[new xs(t.ctrl,t.shift,t.alt,t.meta,n),t.remains]}const s=ot.fromUserSettings(t.key);return[new Vs(t.ctrl,t.shift,t.alt,t.meta,s),t.remains]}static parseKeybinding(e){if(!e)return null;const t=[];let i;for(;e.length>0;)[i,e]=this.parseChord(e),t.push(i);return t.length>0?new mC(t):null}}const _v=[{key:"commandPalette",id:w.CommandPalette,description:c(12182,"The Command Palette"),supportsSubmenus:!1},{key:"touchBar",id:w.TouchBarContext,description:c(12183,"The touch bar (macOS only)"),supportsSubmenus:!1},{key:"editor/title",id:w.EditorTitle,description:c(12184,"The editor title menu")},{key:"editor/title/run",id:w.EditorTitleRun,description:c(12185,"Run submenu inside the editor title menu")},{key:"editor/context",id:w.EditorContext,description:c(12186,"The editor context menu")},{key:"editor/context/copy",id:w.EditorContextCopy,description:c(12187,"'Copy as' submenu in the editor context menu")},{key:"editor/context/share",id:w.EditorContextShare,description:c(12188,"'Share' submenu in the editor context menu"),proposed:"contribShareMenu"},{key:"explorer/context",id:w.ExplorerContext,description:c(12189,"The file explorer context menu")},{key:"explorer/context/share",id:w.ExplorerContextShare,description:c(12190,"'Share' submenu in the file explorer context menu"),proposed:"contribShareMenu"},{key:"editor/title/context",id:w.EditorTitleContext,description:c(12191,"The editor tabs context menu")},{key:"editor/title/context/share",id:w.EditorTitleContextShare,description:c(12192,"'Share' submenu inside the editor title context menu"),proposed:"contribShareMenu"},{key:"debug/callstack/context",id:w.DebugCallStackContext,description:c(12193,"The debug callstack view context menu")},{key:"debug/variables/context",id:w.DebugVariablesContext,description:c(12194,"The debug variables view context menu")},{key:"debug/toolBar",id:w.DebugToolBar,description:c(12195,"The debug toolbar menu")},{key:"debug/createConfiguration",id:w.DebugCreateConfiguration,proposed:"contribDebugCreateConfiguration",description:c(12196,"The debug create configuration menu")},{key:"notebook/variables/context",id:w.NotebookVariablesContext,description:c(12197,"The notebook variables view context menu")},{key:"menuBar/home",id:w.MenubarHomeMenu,description:c(12198,"The home indicator context menu (web only)"),proposed:"contribMenuBarHome",supportsSubmenus:!1},{key:"menuBar/edit/copy",id:w.MenubarCopy,description:c(12199,"'Copy as' submenu in the top level Edit menu")},{key:"scm/title",id:w.SCMTitle,description:c(12200,"The Source Control title menu")},{key:"scm/sourceControl",id:w.SCMSourceControl,description:c(12201,"The Source Control menu")},{key:"scm/sourceControl/title",id:w.SCMSourceControlTitle,description:c(12202,"The Source Control title menu"),proposed:"contribSourceControlTitleMenu"},{key:"scm/resourceState/context",id:w.SCMResourceContext,description:c(12203,"The Source Control resource state context menu")},{key:"scm/resourceFolder/context",id:w.SCMResourceFolderContext,description:c(12204,"The Source Control resource folder context menu")},{key:"scm/resourceGroup/context",id:w.SCMResourceGroupContext,description:c(12205,"The Source Control resource group context menu")},{key:"scm/change/title",id:w.SCMChangeContext,description:c(12206,"The Source Control inline change menu")},{key:"scm/inputBox",id:w.SCMInputBox,description:c(12207,"The Source Control input box menu"),proposed:"contribSourceControlInputBoxMenu"},{key:"scm/history/title",id:w.SCMHistoryTitle,description:c(12208,"The Source Control History title menu"),proposed:"contribSourceControlHistoryTitleMenu"},{key:"scm/historyItem/context",id:w.SCMHistoryItemContext,description:c(12209,"The Source Control history item context menu"),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/historyItem/hover",id:w.SCMHistoryItemHover,description:c(12210,"The Source Control history item hover menu"),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/historyItemRef/context",id:w.SCMHistoryItemRefContext,description:c(12211,"The Source Control history item reference context menu"),proposed:"contribSourceControlHistoryItemMenu"},{key:"statusBar/remoteIndicator",id:w.StatusBarRemoteIndicatorMenu,description:c(12212,"The remote indicator menu in the status bar"),supportsSubmenus:!1},{key:"terminal/context",id:w.TerminalInstanceContext,description:c(12213,"The terminal context menu")},{key:"terminal/title/context",id:w.TerminalTabContext,description:c(12214,"The terminal tabs context menu")},{key:"view/title",id:w.ViewTitle,description:c(12215,"The contributed view title menu")},{key:"viewContainer/title",id:w.ViewContainerTitle,description:c(12216,"The contributed view container title menu"),proposed:"contribViewContainerTitle"},{key:"view/item/context",id:w.ViewItemContext,description:c(12217,"The contributed view item context menu")},{key:"comments/comment/editorActions",id:w.CommentEditorActions,description:c(12218,"The contributed comment editor actions"),proposed:"contribCommentEditorActionsMenu"},{key:"comments/commentThread/title",id:w.CommentThreadTitle,description:c(12219,"The contributed comment thread title menu")},{key:"comments/commentThread/context",id:w.CommentThreadActions,description:c(12220,"The contributed comment thread context menu, rendered as buttons below the comment editor"),supportsSubmenus:!1},{key:"comments/commentThread/additionalActions",id:w.CommentThreadAdditionalActions,description:c(12220,"The contributed comment thread context menu, rendered as buttons below the comment editor"),supportsSubmenus:!0,proposed:"contribCommentThreadAdditionalMenu"},{key:"comments/commentThread/title/context",id:w.CommentThreadTitleContext,description:c(12221,"The contributed comment thread title's peek context menu, rendered as a right click menu on the comment thread's peek title."),proposed:"contribCommentPeekContext"},{key:"comments/comment/title",id:w.CommentTitle,description:c(12222,"The contributed comment title menu")},{key:"comments/comment/context",id:w.CommentActions,description:c(12223,"The contributed comment context menu, rendered as buttons below the comment editor"),supportsSubmenus:!1},{key:"comments/commentThread/comment/context",id:w.CommentThreadCommentContext,description:c(12224,"The contributed comment context menu, rendered as a right click menu on the an individual comment in the comment thread's peek view."),proposed:"contribCommentPeekContext"},{key:"commentsView/commentThread/context",id:w.CommentsViewThreadActions,description:c(12225,"The contributed comment thread context menu in the comments view"),proposed:"contribCommentsViewThreadMenus"},{key:"notebook/toolbar",id:w.NotebookToolbar,description:c(12226,"The contributed notebook toolbar menu")},{key:"notebook/kernelSource",id:w.NotebookKernelSource,description:c(12227,"The contributed notebook kernel sources menu"),proposed:"notebookKernelSource"},{key:"notebook/cell/title",id:w.NotebookCellTitle,description:c(12228,"The contributed notebook cell title menu")},{key:"notebook/cell/execute",id:w.NotebookCellExecute,description:c(12229,"The contributed notebook cell execution menu")},{key:"interactive/toolbar",id:w.InteractiveToolbar,description:c(12230,"The contributed interactive toolbar menu")},{key:"interactive/cell/title",id:w.InteractiveCellTitle,description:c(12231,"The contributed interactive cell title menu")},{key:"issue/reporter",id:w.IssueReporter,description:c(12232,"The contributed issue reporter menu")},{key:"testing/item/context",id:w.TestItem,description:c(12233,"The contributed test item menu")},{key:"testing/item/gutter",id:w.TestItemGutter,description:c(12234,"The menu for a gutter decoration for a test item")},{key:"testing/profiles/context",id:w.TestProfilesContext,description:c(12235,"The menu for configuring testing profiles.")},{key:"testing/item/result",id:w.TestPeekElement,description:c(12236,"The menu for an item in the Test Results view or peek.")},{key:"testing/message/context",id:w.TestMessageContext,description:c(12237,"A prominent button overlaying editor content where the message is displayed")},{key:"testing/message/content",id:w.TestMessageContent,description:c(12238,"Context menu for the message in the results tree")},{key:"extension/context",id:w.ExtensionContext,description:c(12239,"The extension context menu")},{key:"timeline/title",id:w.TimelineTitle,description:c(12240,"The Timeline view title menu")},{key:"timeline/item/context",id:w.TimelineItemContext,description:c(12241,"The Timeline view item context menu")},{key:"ports/item/context",id:w.TunnelContext,description:c(12242,"The Ports view item context menu")},{key:"ports/item/origin/inline",id:w.TunnelOriginInline,description:c(12243,"The Ports view item origin inline menu")},{key:"ports/item/port/inline",id:w.TunnelPortInline,description:c(12244,"The Ports view item port inline menu")},{key:"file/newFile",id:w.NewFile,description:c(12245,"The 'New File...' quick pick, shown on welcome page and File menu."),supportsSubmenus:!1},{key:"webview/context",id:w.WebviewContext,description:c(12246,"The webview context menu")},{key:"file/share",id:w.MenubarShare,description:c(12247,"Share submenu shown in the top level File menu."),proposed:"contribShareMenu"},{key:"editor/inlineCompletions/actions",id:w.InlineCompletionsActions,description:c(12248,"The actions shown when hovering on an inline completion"),supportsSubmenus:!1,proposed:"inlineCompletionsAdditions"},{key:"editor/content",id:w.EditorContent,description:c(12249,"The prominent button in an editor, overlays its content"),proposed:"contribEditorContentMenu"},{key:"editor/lineNumber/context",id:w.EditorLineNumberContext,description:c(12250,"The contributed editor line number context menu")},{key:"mergeEditor/result/title",id:w.MergeInputResultToolbar,description:c(12251,"The result toolbar of the merge editor"),proposed:"contribMergeEditorMenus"},{key:"multiDiffEditor/resource/title",id:w.MultiDiffEditorFileToolbar,description:c(12252,"The resource toolbar in the multi diff editor"),proposed:"contribMultiDiffEditorMenus"},{key:"diffEditor/gutter/hunk",id:w.DiffEditorHunkToolbar,description:c(12253,"The gutter toolbar in the diff editor"),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"diffEditor/gutter/selection",id:w.DiffEditorSelectionToolbar,description:c(12253,"The gutter toolbar in the diff editor"),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"searchPanel/aiResults/commands",id:w.SearchActionMenu,description:c(12254,"The commands that will contribute to the menu rendered as buttons next to the AI search title")},{key:"chat/modelPicker",id:w.ChatModelPicker,description:c(12255,"The chat model picker dropdown menu"),supportsSubmenus:!1,proposed:"chatParticipantPrivate"}];var fs;(function(a){function e(g){return typeof g.command=="string"}a.isMenuItem=e;function t(g,m){return typeof g.command!="string"?(m.error(c(12256,"property `{0}` is mandatory and must be of type `string`","command")),!1):g.alt&&typeof g.alt!="string"?(m.error(c(12257,"property `{0}` can be omitted or must be of type `string`","alt")),!1):g.when&&typeof g.when!="string"?(m.error(c(12257,"property `{0}` can be omitted or must be of type `string`","when")),!1):g.group&&typeof g.group!="string"?(m.error(c(12257,"property `{0}` can be omitted or must be of type `string`","group")),!1):!0}a.isValidMenuItem=t;function i(g,m){return typeof g.submenu!="string"?(m.error(c(12256,"property `{0}` is mandatory and must be of type `string`","submenu")),!1):g.when&&typeof g.when!="string"?(m.error(c(12257,"property `{0}` can be omitted or must be of type `string`","when")),!1):g.group&&typeof g.group!="string"?(m.error(c(12257,"property `{0}` can be omitted or must be of type `string`","group")),!1):!0}a.isValidSubmenuItem=i;function s(g,m){if(!Array.isArray(g))return m.error(c(12258,"submenu items must be an array")),!1;for(const v of g)if(e(v)){if(!t(v,m))return!1}else if(!i(v,m))return!1;return!0}a.isValidItems=s;function o(g,m){return typeof g!="object"?(m.error(c(12259,"submenu items must be an object")),!1):typeof g.id!="string"?(m.error(c(12256,"property `{0}` is mandatory and must be of type `string`","id")),!1):typeof g.label!="string"?(m.error(c(12256,"property `{0}` is mandatory and must be of type `string`","label")),!1):!0}a.isValidSubmenu=o;const n={type:"object",required:["command"],properties:{command:{description:c(12260,"Identifier of the command to execute. The command must be declared in the 'commands'-section"),type:"string"},alt:{description:c(12261,"Identifier of an alternative command to execute. The command must be declared in the 'commands'-section"),type:"string"},when:{description:c(12262,"Condition which must be true to show this item"),type:"string"},group:{description:c(12263,"Group into which this item belongs"),type:"string"}}},r={type:"object",required:["submenu"],properties:{submenu:{description:c(12264,"Identifier of the submenu to display in this item."),type:"string"},when:{description:c(12262,"Condition which must be true to show this item"),type:"string"},group:{description:c(12263,"Group into which this item belongs"),type:"string"}}},d={type:"object",required:["id","label"],properties:{id:{description:c(12265,"Identifier of the menu to display as a submenu."),type:"string"},label:{description:c(12266,"The label of the menu item which leads to this submenu."),type:"string"},icon:{description:c(12267,"(Optional) Icon which is used to represent the submenu in the UI. Either a file path, an object with file paths for dark and light themes, or a theme icon references, like `\\$(zap)`"),anyOf:[{type:"string"},{type:"object",properties:{light:{description:c(12268,"Icon path when a light theme is used"),type:"string"},dark:{description:c(12269,"Icon path when a dark theme is used"),type:"string"}}}]}}};a.menusContribution={description:c(12270,"Contributes menu items to the editor"),type:"object",properties:zl(_v,g=>g.key,g=>({markdownDescription:g.proposed?c(12271,'Proposed API, requires `enabledApiProposal: ["{0}"]` - {1}',g.proposed,g.description):g.description,type:"array",items:g.supportsSubmenus===!1?n:{oneOf:[n,r]}})),additionalProperties:{description:"Submenu",type:"array",items:{oneOf:[n,r]}}},a.submenusContribution={description:c(12272,"Contributes submenu items to the editor"),type:"array",items:d};function l(g,m){return g?co(g.command)?(m.error(c(12256,"property `{0}` is mandatory and must be of type `string`","command")),!1):!p(g.title,m,"title")||g.shortTitle&&!p(g.shortTitle,m,"shortTitle")?!1:g.enablement&&typeof g.enablement!="string"?(m.error(c(12257,"property `{0}` can be omitted or must be of type `string`","precondition")),!1):!(g.category&&!p(g.category,m,"category")||!h(g.icon,m)):(m.error(c(12273,"expected non-empty value.")),!1)}a.isValidCommand=l;function h(g,m){return typeof g>"u"||typeof g=="string"||typeof g.dark=="string"&&typeof g.light=="string"?!0:(m.error(c(12274,"property `icon` can be omitted or must be either a string or a literal like `{dark, light}`")),!1)}function p(g,m,v){return typeof g>"u"?(m.error(c(12275,"property `{0}` is mandatory and must be of type `string` or `object`",v)),!1):typeof g=="string"&&co(g)?(m.error(c(12256,"property `{0}` is mandatory and must be of type `string`",v)),!1):typeof g!="string"&&(co(g.original)||co(g.value))?(m.error(c(12276,"properties `{0}` and `{1}` are mandatory and must be of type `string`",`${v}.value`,`${v}.original`)),!1):!0}const f={type:"object",required:["command","title"],properties:{command:{description:c(12277,"Identifier of the command to execute"),type:"string"},title:{description:c(12278,"Title by which the command is represented in the UI"),type:"string"},shortTitle:{markdownDescription:c(12279,"(Optional) Short title by which the command is represented in the UI. Menus pick either `title` or `shortTitle` depending on the context in which they show commands."),type:"string"},category:{description:c(12280,"(Optional) Category string by which the command is grouped in the UI"),type:"string"},enablement:{description:c(12281,"(Optional) Condition which must be true to enable the command in the UI (menu and keybindings). Does not prevent executing the command by other means, like the `executeCommand`-api."),type:"string"},icon:{description:c(12282,"(Optional) Icon which is used to represent the command in the UI. Either a file path, an object with file paths for dark and light themes, or a theme icon references, like `\\$(zap)`"),anyOf:[{type:"string"},{type:"object",properties:{light:{description:c(12283,"Icon path when a light theme is used"),type:"string"},dark:{description:c(12284,"Icon path when a dark theme is used"),type:"string"}}}]}}};a.commandsContribution={description:c(12285,"Contributes commands to the command palette."),oneOf:[f,{type:"array",items:f}]}})(fs||(fs={}));const Xf=new O,Ev=jo.registerExtensionPoint({extensionPoint:"commands",jsonSchema:fs.commandsContribution,activationEventsGenerator:(a,e)=>{for(const t of a)t.command&&e.push(`onCommand:${t.command}`)}});Ev.setHandler(a=>{function e(t,i){if(!fs.isValidCommand(t,i.collector))return;const{icon:s,enablement:o,category:n,title:r,shortTitle:d,command:l}=t;let h;s&&(typeof s=="string"?h=Ce.fromString(s)??{dark:is(i.description.extensionLocation,s),light:is(i.description.extensionLocation,s)}:h={dark:is(i.description.extensionLocation,s.dark),light:is(i.description.extensionLocation,s.light)});const p=S.getCommand(l);p&&(p.source?i.collector.info(c(12286,"Command `{0}` already registered by {1} ({2})",t.command,p.source.title,p.source.id)):i.collector.info(c(12287,"Command `{0}` already registered",t.command))),Xf.add(S.addCommand({id:l,title:r,source:{id:i.description.identifier.value,title:i.description.displayName??i.description.name},shortTitle:d,tooltip:r,category:n,precondition:I.deserialize(o),icon:h}))}Xf.clear();for(const t of a){const{value:i}=t;if(Array.isArray(i))for(const s of i)e(s,t);else e(i,t)}});const Hr=new Map,Iv=jo.registerExtensionPoint({extensionPoint:"submenus",jsonSchema:fs.submenusContribution});Iv.setHandler(a=>{Hr.clear();for(const e of a){const{value:t,collector:i}=e;for(const[,s]of Object.entries(t)){if(!fs.isValidSubmenu(s,i))continue;if(!s.id){i.warn(c(12288,"`{0}` is not a valid submenu identifier",s.id));continue}if(Hr.has(s.id)){i.info(c(12289,"The `{0}` submenu was already previously registered.",s.id));continue}if(!s.label){i.warn(c(12290,"`{0}` is not a valid submenu label",s.label));continue}let o;s.icon&&(typeof s.icon=="string"?o=Ce.fromString(s.icon)||{dark:is(e.description.extensionLocation,s.icon)}:o={dark:is(e.description.extensionLocation,s.icon.dark),light:is(e.description.extensionLocation,s.icon.light)});const n={id:w.for(`api:${s.id}`),label:s.label,icon:o};Hr.set(s.id,n)}}});const zT=new Map(_v.map(a=>[a.key,a])),Qf=new O,Rl=new Map,$T=jo.registerExtensionPoint({extensionPoint:"menus",jsonSchema:fs.menusContribution,deps:[Iv]});$T.setHandler(a=>{Qf.clear(),Rl.clear();for(const e of a){const{value:t,collector:i}=e;for(const s of Object.entries(t)){if(!fs.isValidItems(s[1],i))continue;let o=zT.get(s[0]);if(!o){const n=Hr.get(s[0]);n&&(o={key:s[0],id:n.id,description:""})}if(o){if(o.proposed&&!$l(e.description,o.proposed)){i.error(c(12291,`{0} is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["{1}"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api {2}`,s[0],o.proposed,e.description.identifier.value));continue}for(const n of s[1]){let r;if(fs.isMenuItem(n)){const d=S.getCommand(n.command),l=n.alt&&S.getCommand(n.alt)||void 0;if(!d){i.error(c(12292,"Menu item references a command `{0}` which is not defined in the 'commands' section.",n.command));continue}n.alt&&!l&&i.warn(c(12293,"Menu item references an alt-command `{0}` which is not defined in the 'commands' section.",n.alt)),n.command===n.alt&&i.info(c(12294,"Menu item references the same command as default and alt-command")),r={command:d,alt:l,group:void 0,order:void 0,when:void 0}}else{if(o.supportsSubmenus===!1){i.error(c(12295,"Menu item references a submenu for a menu which doesn't have submenu support."));continue}const d=Hr.get(n.submenu);if(!d){i.error(c(12296,"Menu item references a submenu `{0}` which is not defined in the 'submenus' section.",n.submenu));continue}let l=Rl.get(o.id.id);if(l||(l=new Set,Rl.set(o.id.id,l)),l.has(d.id.id)){i.warn(c(12297,"The `{0}` submenu was already contributed to the `{1}` menu.",n.submenu,s[0]));continue}l.add(d.id.id),r={submenu:d.id,icon:d.icon,title:d.label,group:void 0,order:void 0,when:void 0}}if(n.group){const d=n.group.lastIndexOf("@");d>0?(r.group=n.group.substr(0,d),r.order=Number(n.group.substr(d+1))||void 0):r.group=n.group}if(o.id===w.ViewContainerTitle&&!n.when?.includes("viewContainer == workbench.view.debug")){i.error(c(12298,"The {0} menu contribution must check {1} in its {2} clause.","`viewContainer/title`","`viewContainer == workbench.view.debug`",'"when"'));continue}r.when=I.deserialize(n.when),Qf.add(S.appendMenuItem(o.id,r))}}}}});let xh=class extends R{constructor(e){super(),this._keybindingService=e,this.type="table"}shouldRender(e){return!!e.contributes?.commands}render(e){const i=(e.contributes?.commands||[]).map(h=>({id:h.command,title:h.title,keybindings:[],menus:[]})),s=zl(i,h=>h.id),o=e.contributes?.menus||{},n=zl(i,h=>h.id);if(o.commandPalette)for(const h of o.commandPalette)delete n[h.command];if(Object.keys(n).length){o.commandPalette||(o.commandPalette=[]);for(const h in n)o.commandPalette.push({command:h})}for(const h in o)for(const p of o[h])if(p.when!=="false"&&p.command){let f=s[p.command];f?f.menus.includes(h)||f.menus.push(h):(f={id:p.command,title:"",keybindings:[],menus:[h]},s[f.id]=f,i.push(f))}if((e.contributes?.keybindings?Array.isArray(e.contributes.keybindings)?e.contributes.keybindings:[e.contributes.keybindings]:[]).forEach(h=>{const p=this.resolveKeybinding(h);if(!p)return;let f=s[h.command];f?f.keybindings.push(p):(f={id:h.command,title:"",keybindings:[p],menus:[]},s[f.id]=f,i.push(f))}),!i.length)return{data:{headers:[],rows:[]},dispose:()=>{}};const d=[c(12299,"ID"),c(12300,"Title"),c(12301,"Keyboard Shortcuts"),c(12302,"Menu Contexts")],l=i.sort((h,p)=>h.id.localeCompare(p.id)).map(h=>[new wi().appendMarkdown(`\`${h.id}\``),typeof h.title=="string"?h.title:h.title.value,h.keybindings,new wi().appendMarkdown(`${h.menus.sort((p,f)=>p.localeCompare(f)).map(p=>`\`${p}\``).join(" ")}`)]);return{data:{headers:d,rows:l},dispose:()=>{}}}resolveKeybinding(e){let t;switch(wC){case"win32":t=e.win;break;case"linux":t=e.linux;break;case"darwin":t=e.mac;break}return this._keybindingService.resolveUserBinding(t??e.key)[0]}};xh=D([u(0,it)],xh);z.as(Dc.ExtensionFeaturesRegistry).registerExtensionFeature({id:"commands",label:c(12303,"Commands"),access:{canToggle:!1},renderer:new ee(xh)});class Dv{static writeKeybindingItem(e,t){if(!t.resolvedKeybinding)return;const i=JSON.stringify(t.resolvedKeybinding.getUserSettingsLabel());e.write(`{ "key": ${qT(i+",",25)} "command": `);const s=t.when?JSON.stringify(t.when.serialize()):"",o=JSON.stringify(t.command);s.length>0?(e.write(`${o},`),e.writeLine(),e.write(` "when": ${s}`)):e.write(`${o}`),t.commandArgs&&(e.write(","),e.writeLine(),e.write(` "args": ${JSON.stringify(t.commandArgs)}`)),e.write(" }")}static readUserKeybindingItem(e){const t="key"in e&&typeof e.key=="string"?ca.parseKeybinding(e.key):null,i="when"in e&&typeof e.when=="string"?I.deserialize(e.when):void 0,s="command"in e&&typeof e.command=="string"?e.command:null,o="args"in e&&typeof e.args<"u"?e.args:void 0;return{keybinding:t,command:s,commandArgs:o,when:i,_sourceKey:"key"in e&&typeof e.key=="string"?e.key:void 0}}}function qT(a,e){return a.length<e?a+new Array(e-a.length).join(" "):a}class jT{constructor(){this._lines=[],this._currentLine=""}write(e){this._currentLine+=e}writeLine(e=""){this._lines.push(this._currentLine+e),this._currentLine=""}toString(){return this.writeLine(),this._lines.join(`
|
|
3
|
+
`)}}var kr;function YT(a,e){return a?typeof a.command!="string"?(e.push(c(12693,"property `{0}` is mandatory and must be of type `string`","command")),!1):a.key&&typeof a.key!="string"?(e.push(c(12694,"property `{0}` can be omitted or must be of type `string`","key")),!1):a.when&&typeof a.when!="string"?(e.push(c(12694,"property `{0}` can be omitted or must be of type `string`","when")),!1):a.mac&&typeof a.mac!="string"?(e.push(c(12694,"property `{0}` can be omitted or must be of type `string`","mac")),!1):a.linux&&typeof a.linux!="string"?(e.push(c(12694,"property `{0}` can be omitted or must be of type `string`","linux")),!1):a.win&&typeof a.win!="string"?(e.push(c(12694,"property `{0}` can be omitted or must be of type `string`","win")),!1):!0:(e.push(c(12692,"expected non-empty value.")),!1)}const em={type:"object",default:{command:"",key:""},properties:{command:{description:c(12695,"Identifier of the command to run when keybinding is triggered."),type:"string"},args:{description:c(12696,"Arguments to pass to the command to execute.")},key:{description:c(12697,"Key or key sequence (separate keys with plus-sign and sequences with space, e.g. Ctrl+O and Ctrl+L L for a chord)."),type:"string"},mac:{description:c(12698,"Mac specific key or key sequence."),type:"string"},linux:{description:c(12699,"Linux specific key or key sequence."),type:"string"},win:{description:c(12700,"Windows specific key or key sequence."),type:"string"},when:{description:c(12701,"Condition when the key is active."),type:"string"}}},tm=jo.registerExtensionPoint({extensionPoint:"keybindings",deps:[Ev],jsonSchema:{description:c(12702,"Contributes keybindings."),oneOf:[em,{type:"array",items:em}]}}),JT=[A.NumpadDivide,A.NumpadMultiply,A.NumpadSubtract,A.NumpadAdd,A.Numpad1,A.Numpad2,A.Numpad3,A.Numpad4,A.Numpad5,A.Numpad6,A.Numpad7,A.Numpad8,A.Numpad9,A.Numpad0,A.NumpadDecimal],Di=new Map;Di.set(A.Numpad1,y.Digit1);Di.set(A.Numpad2,y.Digit2);Di.set(A.Numpad3,y.Digit3);Di.set(A.Numpad4,y.Digit4);Di.set(A.Numpad5,y.Digit5);Di.set(A.Numpad6,y.Digit6);Di.set(A.Numpad7,y.Digit7);Di.set(A.Numpad8,y.Digit8);Di.set(A.Numpad9,y.Digit9);Di.set(A.Numpad0,y.Digit0);let kh=kr=class extends yC{constructor(e,t,i,s,o,n,r,d,l,h,p,f){super(e,t,i,s,h),this.hostService=n,this.keyboardLayoutService=p,this.layoutService=f,this._contributions=[],this.isComposingGlobalContextKey=e.createKey("isComposing",!1),this.kbsJsonSchema=new Rh,this.updateKeybindingsJsonSchema(),this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this._register(this.keyboardLayoutService.onDidChangeKeyboardLayout(()=>{this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this.updateResolver()})),this._keybindingHoldMode=null,this._cachedResolver=null,this.userKeybindings=this._register(new ZT(o,l,d,h)),this.userKeybindings.initialize().then(()=>{this.userKeybindings.keybindings.length&&this.updateResolver()}),this._register(this.userKeybindings.onDidChange(()=>{h.debug("User keybindings changed"),this.updateResolver()})),tm.setHandler(g=>{const m=[];for(const v of g)this._handleKeybindingsExtensionPointUser(v.description.identifier,v.description.isBuiltin,v.value,v.collector,m);ne.setExtensionKeybindings(m),this.updateResolver()}),this.updateKeybindingsJsonSchema(),this._register(r.onDidRegisterExtensions(()=>this.updateKeybindingsJsonSchema())),this._register(L.runAndSubscribe(tw,({window:g,disposables:m})=>m.add(this._registerKeyListeners(g)),{window:re,disposables:this._store})),this._register(Qm(g=>{if(g!==re.vscodeWindowId)return;const m=navigator.keyboard;ul.keyboard!==pl.None&&(Rg(re)?m?.lock(["Escape"]):m?.unlock(),this._cachedResolver=null,this._onDidUpdateKeybindings.fire())}))}_registerKeyListeners(e){const t=new O,i=this.layoutService.getContainer(e);return t.add(J(i,te.KEY_DOWN,s=>{if(this._keybindingHoldMode)return;this.isComposingGlobalContextKey.set(s.isComposing);const o=new Yn(s);this._log(`/ Received keydown event - ${vC(s)}`),this._log(`| Converted keydown event - ${bC(o)}`),this._dispatch(o,o.target)&&o.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t.add(J(i,te.KEY_UP,s=>{this._resetKeybindingHoldMode(),this.isComposingGlobalContextKey.set(s.isComposing);const o=new Yn(s);this._singleModifierDispatch(o,o.target)&&o.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t}registerSchemaContribution(e){this._contributions.push(e),e.onDidChange&&this._register(e.onDidChange(()=>this.updateKeybindingsJsonSchema())),this.updateKeybindingsJsonSchema()}updateKeybindingsJsonSchema(){this.kbsJsonSchema.updateSchema(this._contributions.flatMap(e=>e.getSchemaAdditions()))}_printKeybinding(e){return CC.toLabel($t,e.chords,t=>t instanceof Vs?ot.toString(t.keyCode):Ut.toString(t.scanCode))||"[null]"}_printResolvedKeybinding(e){return e.getDispatchChords().map(t=>t||"[null]").join(" ")}_printResolvedKeybindings(e,t,i){const o=`${t.padStart(35," ")} => `;if(i.length===0){e.push(`${o}${"[NO BINDING]".padStart(35," ")}`);return}for(const n of i)e.push(`${o}${this._printResolvedKeybinding(n).padStart(35," ")}`)}_dumpResolveKeybindingDebugInfo(){const e=new Set,t=[];t.push("Default Resolved Keybindings (unique only):");for(const i of ne.getDefaultKeybindings()){if(!i.keybinding)continue;const s=this._printKeybinding(i.keybinding);if(e.has(s))continue;e.add(s);const o=this._keyboardMapper.resolveKeybinding(i.keybinding);this._printResolvedKeybindings(t,s,o)}t.push("User Resolved Keybindings (unique only):");for(const i of this.userKeybindings.keybindings){if(!i.keybinding)continue;const s=i._sourceKey??"Impossible: missing source key, but has keybinding";if(e.has(s))continue;e.add(s);const o=this._keyboardMapper.resolveKeybinding(i.keybinding);this._printResolvedKeybindings(t,s,o)}return t.join(`
|
|
4
|
+
`)}_dumpDebugInfo(){const e=JSON.stringify(this.keyboardLayoutService.getCurrentKeyboardLayout(),null," "),t=this._keyboardMapper.dumpDebugInfo(),i=this._dumpResolveKeybindingDebugInfo(),s=JSON.stringify(this.keyboardLayoutService.getRawKeyboardMapping(),null," ");return`Layout info:
|
|
5
|
+
${e}
|
|
6
|
+
|
|
7
|
+
${i}
|
|
8
|
+
|
|
9
|
+
${t}
|
|
10
|
+
|
|
11
|
+
Raw mapping:
|
|
12
|
+
${s}`}_dumpDebugInfoJSON(){const e={layout:this.keyboardLayoutService.getCurrentKeyboardLayout(),rawMapping:this.keyboardLayoutService.getRawKeyboardMapping()};return JSON.stringify(e,null," ")}enableKeybindingHoldMode(e){if(this._currentlyDispatchingCommandId!==e)return;this._keybindingHoldMode=new Ko;const t=zn(St(void 0)),i=t.onDidBlur(()=>this._resetKeybindingHoldMode());return this._keybindingHoldMode.p.finally(()=>{i.dispose(),t.dispose()}),this._log(`+ Enabled hold-mode for ${e}.`),this._keybindingHoldMode.p}_resetKeybindingHoldMode(){this._keybindingHoldMode&&(this._keybindingHoldMode?.complete(),this._keybindingHoldMode=null)}customKeybindingsCount(){return this.userKeybindings.keybindings.length}updateResolver(){this._cachedResolver=null,this._onDidUpdateKeybindings.fire()}getUserKeybindingItems(){return this._resolveUserKeybindingItems(this.userKeybindings.keybindings,!1)}_getResolver(){if(!this._cachedResolver){const e=this._resolveKeybindingItems(ne.getDefaultKeybindings(),!0),t=this.getUserKeybindingItems();this._cachedResolver=new SC(e,t,i=>this._log(i))}return this._cachedResolver}_documentHasFocus(){return this.hostService.hasFocus}_resolveKeybindingItems(e,t){const i=[];let s=0;for(const o of e){const n=o.when||void 0,r=o.keybinding;if(!r)i[s++]=new Ya(void 0,o.command,o.commandArgs,n,t,o.extensionId,o.isBuiltinExtension);else{if(this._assertBrowserConflicts(r))continue;const d=this._keyboardMapper.resolveKeybinding(r);for(let l=d.length-1;l>=0;l--){const h=d[l];i[s++]=new Ya(h,o.command,o.commandArgs,n,t,o.extensionId,o.isBuiltinExtension)}}}return i}_resolveUserKeybindingItems(e,t){const i=[];let s=0;for(const o of e){const n=o.when||void 0;if(!o.keybinding)i[s++]=new Ya(void 0,o.command,o.commandArgs,n,t,null,!1);else{const r=this._keyboardMapper.resolveKeybinding(o.keybinding);for(const d of r)i[s++]=new Ya(d,o.command,o.commandArgs,n,t,null,!1)}}return i}_assertBrowserConflicts(e){if(ul.keyboard===pl.Always||ul.keyboard===pl.FullScreen&&Rg(re))return!1;for(const t of e.chords){if(!t.metaKey&&!t.altKey&&!t.ctrlKey&&!t.shiftKey)continue;const i=N.CtrlCmd|N.Alt|N.Shift;let s=0;if(t.metaKey&&(s|=N.CtrlCmd),t.shiftKey&&(s|=N.Shift),t.altKey&&(s|=N.Alt),t.ctrlKey&&$t===yi.Macintosh&&(s|=N.WinCtrl),(s&i)===(N.CtrlCmd|N.Alt)&&(t instanceof xs&&(t.scanCode===A.ArrowLeft||t.scanCode===A.ArrowRight)||t instanceof Vs&&(t.keyCode===y.LeftArrow||t.keyCode===y.RightArrow))||(s&i)===N.CtrlCmd&&(t instanceof xs&&t.scanCode>=A.Digit1&&t.scanCode<=A.Digit0||t instanceof Vs&&t.keyCode>=y.Digit0&&t.keyCode<=y.Digit9))return!0}return!1}resolveKeybinding(e){return this._keyboardMapper.resolveKeybinding(e)}resolveKeyboardEvent(e){return this.keyboardLayoutService.validateCurrentKeyboardMapping(e),this._keyboardMapper.resolveKeyboardEvent(e)}resolveUserBinding(e){const t=ca.parseKeybinding(e);return t?this._keyboardMapper.resolveKeybinding(t):[]}_handleKeybindingsExtensionPointUser(e,t,i,s,o){if(Array.isArray(i))for(let n=0,r=i.length;n<r;n++)this._handleKeybinding(e,t,n+1,i[n],s,o);else this._handleKeybinding(e,t,1,i,s,o)}_handleKeybinding(e,t,i,s,o,n){const r=[];if(YT(s,r)){const d=this._asCommandRule(e,t,i++,s);d&&n.push(d)}r.length>0&&o.error(c(12703,"Invalid `contributes.{0}`: {1}",tm.name,r.join(`
|
|
13
|
+
`)))}static bindToCurrentPlatform(e,t,i,s){if($t===yi.Windows&&s){if(s)return s}else if($t===yi.Macintosh){if(t)return t}else if(i)return i;return e}_asCommandRule(e,t,i,s){const{command:o,args:n,when:r,key:d,mac:l,linux:h,win:p}=s,f=kr.bindToCurrentPlatform(d,l,h,p);if(!f)return;let g;t?g=G.BuiltinExtension+i:g=G.ExternalExtension+i;const m=S.getCommand(o),v=m&&m.precondition;let C;return r&&v?C=I.and(v,I.deserialize(r)):r?C=I.deserialize(r):v&&(C=v),{id:o,args:n,when:C,weight:g,keybinding:ca.parseKeybinding(f),extensionId:e.value,isBuiltinExtension:t}}getDefaultKeybindingsContent(){const e=this._getResolver(),t=e.getDefaultKeybindings(),i=e.getDefaultBoundCommands();return kr._getDefaultKeybindings(t)+`
|
|
14
|
+
|
|
15
|
+
`+kr._getAllCommandsAsComment(i)}static _getDefaultKeybindings(e){const t=new jT;t.writeLine("[");const i=e.length-1;return e.forEach((s,o)=>{Dv.writeKeybindingItem(t,s),o!==i?t.writeLine(","):t.writeLine()}),t.writeLine("]"),t.toString()}static _getAllCommandsAsComment(e){const i=_C(e).sort().join(`
|
|
16
|
+
// - `);return"// "+c(12704,"Here are other available commands: ")+`
|
|
17
|
+
// - `+i}mightProducePrintableCharacter(e){if(e.ctrlKey||e.metaKey||e.altKey)return!1;const t=Ut.toEnum(e.code);if(JT.indexOf(t)!==-1)return!!(e.keyCode===si[t]||ut&&e.keyCode===Di.get(t));if(si[t]!==-1)return!1;const s=this.keyboardLayoutService.getRawKeyboardMapping();if(!s)return!1;const o=s[e.code];return!(!o||!o.value||/\s/.test(o.value))}};kh=kr=D([u(0,se),u(1,wt),u(2,mt),u(3,Ke),u(4,Pp),u(5,Zt),u(6,At),u(7,Le),u(8,rr),u(9,Ue),u(10,Sa),u(11,_a)],kh);class ZT extends R{get keybindings(){return this._keybindings}constructor(e,t,i,s){super(),this.userDataProfileService=e,this.uriIdentityService=t,this.fileService=i,this._rawKeybindings=[],this._keybindings=[],this.watchDisposables=this._register(new O),this._onDidChange=this._register(new E),this.onDidChange=this._onDidChange.event,this.watch(),this.reloadConfigurationScheduler=this._register(new Ca(()=>this.reload().then(o=>{o&&this._onDidChange.fire()}),50)),this._register(L.filter(this.fileService.onDidFilesChange,o=>o.contains(this.userDataProfileService.currentProfile.keybindingsResource))(()=>{s.debug("Keybindings file changed"),this.reloadConfigurationScheduler.schedule()})),this._register(this.fileService.onDidRunOperation(o=>{o.operation===ho.WRITE&&o.resource.toString()===this.userDataProfileService.currentProfile.keybindingsResource.toString()&&(s.debug("Keybindings file written"),this.reloadConfigurationScheduler.schedule())})),this._register(e.onDidChangeCurrentProfile(o=>{this.uriIdentityService.extUri.isEqual(o.previous.keybindingsResource,o.profile.keybindingsResource)||o.join(this.whenCurrentProfileChanged())}))}async whenCurrentProfileChanged(){this.watch(),this.reloadConfigurationScheduler.schedule()}watch(){this.watchDisposables.clear(),this.watchDisposables.add(this.fileService.watch(iw(this.userDataProfileService.currentProfile.keybindingsResource))),this.watchDisposables.add(this.fileService.watch(this.userDataProfileService.currentProfile.keybindingsResource))}async initialize(){await this.reload()}async reload(){const e=await this.readUserKeybindings();return sw(this._rawKeybindings,e)?!1:(this._rawKeybindings=e,this._keybindings=this._rawKeybindings.map(t=>Dv.readUserKeybindingItem(t)),!0)}async readUserKeybindings(){try{const e=await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource),t=ow(e.value.toString());return Array.isArray(t)?t.filter(i=>i&&typeof i=="object"):[]}catch{return[]}}}const fn=class fn{constructor(){this.commandsSchemas=[],this.commandsEnum=[],this.removalCommandsEnum=[],this.commandsEnumDescriptions=[],this.schema={id:fn.schemaId,type:"array",title:c(12705,"Keybindings configuration"),allowTrailingCommas:!0,allowComments:!0,definitions:{editorGroupsSchema:{type:"array",items:{type:"object",properties:{groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]},size:{type:"number",default:.5}}}},commandNames:{type:"string",enum:this.commandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:c(12706,"Name of the command to execute")},commandType:{anyOf:[{$ref:"#/definitions/commandNames"},{type:"string",enum:this.removalCommandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:c(12707,"Name of the command to remove keyboard shortcut for")},{type:"string"}]},commandsSchemas:{allOf:this.commandsSchemas}},items:{required:["key"],type:"object",defaultSnippets:[{body:{key:"$1",command:"$2",when:"$3"}}],properties:{key:{type:"string",description:c(12708,"Key or key sequence (separated by space)")},command:{anyOf:[{if:{type:"array"},then:{not:{type:"array"},errorMessage:c(12709,`Incorrect type. Expected "{0}". The field 'command' does not support running multiple commands. Use command 'runCommands' to pass it multiple commands to run.`,"string")},else:{$ref:"#/definitions/commandType"}},{$ref:"#/definitions/commandType"}]},when:{type:"string",description:c(12710,"Condition when the key is active.")},args:{description:c(12711,"Arguments to pass to the command to execute.")}},$ref:"#/definitions/commandsSchemas"}},this.schemaRegistry=z.as(EC.JSONContribution),this.schemaRegistry.registerSchema(fn.schemaId,this.schema)}updateSchema(e){this.commandsSchemas.length=0,this.commandsEnum.length=0,this.removalCommandsEnum.length=0,this.commandsEnumDescriptions.length=0;const t=new Set,i=(n,r)=>{/^_/.test(n)||t.has(n)||(t.add(n),this.commandsEnum.push(n),this.commandsEnumDescriptions.push(IC(r)?r.value:r),this.removalCommandsEnum.push(`-${n}`))},s=Te.getCommands();for(const[n,r]of s){const d=r.metadata;if(i(n,d?.description??S.getCommand(n)?.title),!d||!d.args||d.args.length!==1||!d.args[0].schema)continue;const l=d.args[0].schema,h=typeof d.args[0].isOptional<"u"?!d.args[0].isOptional:Array.isArray(l.required)&&l.required.length>0,p={if:{required:["command"],properties:{command:{const:n}}},then:{required:[].concat(h?["args"]:[]),properties:{args:l}}};this.commandsSchemas.push(p)}const o=S.getCommands();for(const n of o.keys())i(n);this.commandsSchemas.push(...e),this.schemaRegistry.notifySchemaChanged(fn.schemaId)}};fn.schemaId="vscode://schemas/keybindings";let Rh=fn;function im(a,e){return!a||!e?!1:!!(a.name&&e.name&&a.name===e.name||a.id&&e.id&&a.id===e.id||a.model&&e.model&&a.model===e.model&&a.layout===e.layout)}function Pd(a){if(!a)return{label:"",description:""};if(a.name)return{label:a.text,description:""};if(a.id){const t=a;return t.localizedName?{label:t.localizedName,description:""}:/^com\.apple\.keylayout\./.test(t.id)?{label:t.id.replace(/^com\.apple\.keylayout\./,"").replace(/-/," "),description:""}:/^.*inputmethod\./.test(t.id)?{label:t.id.replace(/^.*inputmethod\./,"").replace(/[-\.]/," "),description:`Input Method (${t.lang})`}:{label:t.lang,description:""}}return{label:a.layout,description:""}}function la(a){return a.name?a.name:a.id?a.id:a.layout}function XT(a){const e=a,t={};for(const i in e){const s=e[i];if(s.length){const o=s[0],n=s[1],r=s[2],d=s[3],l=Number(s[4]),h=s.length===6?s[5]:void 0;t[i]={value:o,vkey:h,withShift:n,withAltGr:r,withShiftAltGr:d,valueIsDeadKey:(l&1)>0,withShiftIsDeadKey:(l&2)>0,withAltGrIsDeadKey:(l&4)>0,withShiftAltGrIsDeadKey:(l&8)>0}}else t[i]={value:"",valueIsDeadKey:!1,withShift:"",withShiftIsDeadKey:!1,withAltGr:"",withAltGrIsDeadKey:!1,withShiftAltGr:"",withShiftAltGrIsDeadKey:!1}}return t}class sl{constructor(e,t,i,s){this.layout=e,this.secondaryLayouts=t,this.mapping=XT(i),this.isUserKeyboardLayout=!!s,this.layout.isUserKeyboardLayout=!!s}static createKeyboardLayoutFromDebugInfo(e,t,i){const s=new sl(e,[],{},!0);return s.mapping=t,s}update(e){this.layout=e.layout,this.secondaryLayouts=e.secondaryLayouts,this.mapping=e.mapping,this.isUserKeyboardLayout=e.isUserKeyboardLayout,this.layout.isUserKeyboardLayout=e.isUserKeyboardLayout}getScore(e){let t=0;for(const i in e){if(Uo&&(i==="Backslash"||i==="KeyQ")||nw&&(i==="Backspace"||i==="Escape"))continue;const s=this.mapping[i];s===void 0&&(t-=1);const o=e[i];s&&o&&s.value!==o.value&&(t-=1)}return t}equal(e){return this.isUserKeyboardLayout!==e.isUserKeyboardLayout||la(this.layout)!==la(e.layout)?!1:this.fuzzyEqual(e.mapping)}fuzzyEqual(e){for(const t in e){if(Uo&&(t==="Backslash"||t==="KeyQ"))continue;if(this.mapping[t]===void 0)return!1;const i=this.mapping[t],s=e[t];if(i.value!==s.value)return!1}return!0}}var ha;(function(a){a[a.Code=0]="Code",a[a.KeyCode=1]="KeyCode"})(ha||(ha={}));function QT(a){const e=a.getValue("keyboard"),t=e?.dispatch==="keyCode"?ha.KeyCode:ha.Code,i=!!e?.mapAltGrToCtrlAlt;return{dispatch:t,mapAltGrToCtrlAlt:i}}const ex=z.as(Zs.Configuration),tx={id:"keyboard",order:15,type:"object",title:c(1894,"Keyboard"),properties:{"keyboard.dispatch":{scope:ql.APPLICATION,type:"string",enum:["code","keyCode"],default:"code",markdownDescription:c(1895,"Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."),included:$t===yi.Macintosh||$t===yi.Linux},"keyboard.mapAltGrToCtrlAlt":{scope:ql.APPLICATION,type:"boolean",default:!1,markdownDescription:c(1896,"Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+."),included:$t===yi.Windows}}};ex.registerConfiguration(tx);class ix{constructor(e){this._actual=e,this._cache=new Map}dumpDebugInfo(){return this._actual.dumpDebugInfo()}resolveKeyboardEvent(e){return this._actual.resolveKeyboardEvent(e)}resolveKeybinding(e){const t=e.getHashCode(),i=this._cache.get(t);if(!i){const s=this._actual.resolveKeybinding(e);return this._cache.set(t,s),s}return i}}class Rr extends rw{constructor(e,t){super(yi.Windows,t),this._mapper=e}_getLabel(e){return e.isDuplicateModifierCase()?"":this._mapper.getUILabelForKeyCode(e.keyCode)}_getUSLabelForKeybinding(e){return e.isDuplicateModifierCase()?"":ot.toString(e.keyCode)}getUSLabel(){return AC.toLabel(this._os,this._chords,e=>this._getUSLabelForKeybinding(e))}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":this._mapper.getAriaLabelForKeyCode(e.keyCode)}_getElectronAccelerator(e){return this._mapper.getElectronAcceleratorForKeyBinding(e)}_getUserSettingsLabel(e){if(e.isDuplicateModifierCase())return"";const t=this._mapper.getUserSettingsLabelForKeyCode(e.keyCode);return t&&t.toLowerCase()}_isWYSIWYG(e){return this.__isWYSIWYG(e.keyCode)}__isWYSIWYG(e){if(e===y.LeftArrow||e===y.UpArrow||e===y.RightArrow||e===y.DownArrow)return!0;const t=this._mapper.getAriaLabelForKeyCode(e),i=this._mapper.getUserSettingsLabelForKeyCode(e);return t===i}_getChordDispatch(e){if(e.isModifierKey())return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+=ot.toString(e.keyCode),t}_getSingleModifierChordDispatch(e){return e.keyCode===y.Ctrl&&!e.shiftKey&&!e.altKey&&!e.metaKey?"ctrl":e.keyCode===y.Shift&&!e.ctrlKey&&!e.altKey&&!e.metaKey?"shift":e.keyCode===y.Alt&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey?"alt":e.keyCode===y.Meta&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?"meta":null}static getProducedCharCode(e,t){return t?e.ctrlKey&&e.shiftKey&&e.altKey?t.withShiftAltGr:e.ctrlKey&&e.altKey?t.withAltGr:e.shiftKey?t.withShift:t.value:null}static getProducedChar(e,t){const i=this.getProducedCharCode(e,t);return i===null||i.length===0?" --- ":" "+i+" "}}class sx{constructor(e,t,i){this._isUSStandard=e,this._mapAltGrToCtrlAlt=i,this._keyCodeToLabel=[],this._scanCodeToKeyCode=[],this._keyCodeToLabel=[],this._keyCodeExists=[],this._keyCodeToLabel[y.Unknown]=ot.toString(y.Unknown);for(let r=A.None;r<A.MAX_VALUE;r++){const d=si[r];d!==y.DependsOnKbLayout&&(this._scanCodeToKeyCode[r]=d,this._keyCodeToLabel[d]=ot.toString(d),this._keyCodeExists[d]=!0)}const s=[];let o=!1;this._codeInfo=[];for(const r in t)if(t.hasOwnProperty(r)){const d=Ut.toEnum(r);if(d===A.None)continue;const l=t[r],h=si[d];if(h!==y.DependsOnKbLayout){const T=Lg[l.vkey]||y.Unknown;if(T===y.Unknown||h===T||d!==A.NumpadComma)continue}const p=l.value,f=l.withShift,g=l.withAltGr,m=l.withShiftAltGr,v=Lg[l.vkey]||y.Unknown,C={scanCode:d,keyCode:v,value:p,withShift:f,withAltGr:g,withShiftAltGr:m};if(this._codeInfo[d]=C,this._scanCodeToKeyCode[d]=v,v===y.Unknown)continue;if(this._keyCodeExists[v]=!0,p.length===0)this._keyCodeToLabel[v]=null;else if(p.length>1)this._keyCodeToLabel[v]=p;else{const T=p.charCodeAt(0);if(T>=_.a&&T<=_.z){const B=_.A+(T-_.a);s[B]=!0,o=!0,this._keyCodeToLabel[v]=String.fromCharCode(_.A+(T-_.a))}else T>=_.A&&T<=_.Z?(s[T]=!0,o=!0,this._keyCodeToLabel[v]=p):this._keyCodeToLabel[v]=p}}const n=(r,d)=>{s[r]||(this._keyCodeToLabel[d]=String.fromCharCode(r))};if(n(_.A,y.KeyA),n(_.B,y.KeyB),n(_.C,y.KeyC),n(_.D,y.KeyD),n(_.E,y.KeyE),n(_.F,y.KeyF),n(_.G,y.KeyG),n(_.H,y.KeyH),n(_.I,y.KeyI),n(_.J,y.KeyJ),n(_.K,y.KeyK),n(_.L,y.KeyL),n(_.M,y.KeyM),n(_.N,y.KeyN),n(_.O,y.KeyO),n(_.P,y.KeyP),n(_.Q,y.KeyQ),n(_.R,y.KeyR),n(_.S,y.KeyS),n(_.T,y.KeyT),n(_.U,y.KeyU),n(_.V,y.KeyV),n(_.W,y.KeyW),n(_.X,y.KeyX),n(_.Y,y.KeyY),n(_.Z,y.KeyZ),!o){const r=(d,l)=>{this._keyCodeToLabel[d]=String.fromCharCode(l)};r(y.Semicolon,_.Semicolon),r(y.Equal,_.Equals),r(y.Comma,_.Comma),r(y.Minus,_.Dash),r(y.Period,_.Period),r(y.Slash,_.Slash),r(y.Backquote,_.BackTick),r(y.BracketLeft,_.OpenSquareBracket),r(y.Backslash,_.Backslash),r(y.BracketRight,_.CloseSquareBracket),r(y.Quote,_.SingleQuote)}}dumpDebugInfo(){const e=[],t=[A.ArrowUp,A.Numpad0];let i=0;e.push("-----------------------------------------------------------------------------------------------------------------------------------------");for(let s=A.None;s<A.MAX_VALUE;s++){if(si[s]!==y.DependsOnKbLayout&&t.indexOf(s)===-1)continue;i%6===0&&(e.push("| HW Code combination | Key | KeyCode combination | UI label | User settings | WYSIWYG |"),e.push("-----------------------------------------------------------------------------------------------------------------------------------------")),i++;const o=this._codeInfo[s],n=Ut.toString(s),r=[0,2,5,7];for(const d of r){const l=!!(d&1),h=!!(d&2),p=!!(d&4),f=new xs(l,h,p,!1,s),g=this._resolveChord(f),m=g?ot.toString(g.keyCode):null,v=g?new Rr(this,[g]):null,C=`${l?"Ctrl+":""}${h?"Shift+":""}${p?"Alt+":""}${n}`,T=v?v.getAriaLabel():null,B=T?T.replace(/Control\+/,"Ctrl+"):null,V=v?v.getUserSettingsLabel():null,U=Rr.getProducedChar(f,o),W=m?`${l?"Ctrl+":""}${h?"Shift+":""}${p?"Alt+":""}${m}`:null,j=(v?v.isWYSIWYG():!1)?" ":" NO ";e.push(`| ${this._leftPad(C,30)} | ${U} | ${this._leftPad(W,25)} | ${this._leftPad(B,25)} | ${this._leftPad(V,25)} | ${j} |`)}e.push("-----------------------------------------------------------------------------------------------------------------------------------------")}return e.join(`
|
|
18
|
+
`)}_leftPad(e,t){for(e===null&&(e="null");e.length<t;)e=" "+e;return e}getUILabelForKeyCode(e){return this._getLabelForKeyCode(e)}getAriaLabelForKeyCode(e){return this._getLabelForKeyCode(e)}getUserSettingsLabelForKeyCode(e){return this._isUSStandard?ot.toUserSettingsUS(e):ot.toUserSettingsGeneral(e)}getElectronAcceleratorForKeyBinding(e){return ot.toElectronAccelerator(e.keyCode)}_getLabelForKeyCode(e){return this._keyCodeToLabel[e]||ot.toString(y.Unknown)}resolveKeyboardEvent(e){const t=e.ctrlKey||this._mapAltGrToCtrlAlt&&e.altGraphKey,i=e.altKey||this._mapAltGrToCtrlAlt&&e.altGraphKey,s=new Vs(t,e.shiftKey,i,e.metaKey,e.keyCode);return new Rr(this,[s])}_resolveChord(e){if(!e)return null;if(e instanceof Vs)return this._keyCodeExists[e.keyCode]?e:null;const t=this._scanCodeToKeyCode[e.scanCode]||y.Unknown;return t===y.Unknown||!this._keyCodeExists[t]?null:new Vs(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t)}resolveKeybinding(e){const t=DC(e.chords.map(i=>this._resolveChord(i)));return t.length>0?[new Rr(this,t)]:[]}}const zr=[];class sm extends rw{constructor(e,t,i){super(t,i),this._mapper=e}_getLabel(e){return this._mapper.getUILabelForScanCodeChord(e)}_getAriaLabel(e){return this._mapper.getAriaLabelForScanCodeChord(e)}_getElectronAccelerator(e){return this._mapper.getElectronAcceleratorLabelForScanCodeChord(e)}_getUserSettingsLabel(e){return this._mapper.getUserSettingsLabelForScanCodeChord(e)}_isWYSIWYG(e){if(!e||si[e.scanCode]!==y.DependsOnKbLayout)return!0;const t=this._mapper.getAriaLabelForScanCodeChord(e),i=this._mapper.getUserSettingsLabelForScanCodeChord(e);return!t&&!i?!0:!t||!i?!1:t.toLowerCase()===i.toLowerCase()}_getChordDispatch(e){return this._mapper.getDispatchStrForScanCodeChord(e)}_getSingleModifierChordDispatch(e){return(e.scanCode===A.ControlLeft||e.scanCode===A.ControlRight)&&!e.shiftKey&&!e.altKey&&!e.metaKey?"ctrl":(e.scanCode===A.AltLeft||e.scanCode===A.AltRight)&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey?"alt":(e.scanCode===A.ShiftLeft||e.scanCode===A.ShiftRight)&&!e.ctrlKey&&!e.altKey&&!e.metaKey?"shift":(e.scanCode===A.MetaLeft||e.scanCode===A.MetaRight)&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?"meta":null}}class $r{constructor(e,t,i,s){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.scanCode=s}toString(){return`${this.ctrlKey?"Ctrl+":""}${this.shiftKey?"Shift+":""}${this.altKey?"Alt+":""}${Ut.toString(this.scanCode)}`}equals(e){return this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.scanCode===e.scanCode}getProducedCharCode(e){return e?this.ctrlKey&&this.shiftKey&&this.altKey?e.withShiftAltGr:this.ctrlKey&&this.altKey?e.withAltGr:this.shiftKey?e.withShift:e.value:""}getProducedChar(e){const t=ti.getCharCode(this.getProducedCharCode(e));return t===0?" --- ":t>=_.U_Combining_Grave_Accent&&t<=_.U_Combining_Latin_Small_Letter_X?"U+"+t.toString(16):" "+String.fromCharCode(t)+" "}}class Lh{constructor(e,t,i,s){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.keyCode=s}toString(){return`${this.ctrlKey?"Ctrl+":""}${this.shiftKey?"Shift+":""}${this.altKey?"Alt+":""}${ot.toString(this.keyCode)}`}}class ox{constructor(){this._scanCodeToKeyCode=[],this._keyCodeToScanCode=[],this._scanCodeToKeyCode=[],this._keyCodeToScanCode=[]}registrationComplete(){this._moveToEnd(A.IntlHash),this._moveToEnd(A.IntlBackslash)}_moveToEnd(e){for(let t=0;t<8;t++){const i=this._scanCodeToKeyCode[(e<<3)+t];if(i)for(let s=0,o=i.length;s<o;s++){const n=this._keyCodeToScanCode[i[s]];if(n.length!==1)for(let r=0,d=n.length;r<d;r++){const l=n[r];if(l>>>3===e){for(let p=r+1;p<d;p++)n[p-1]=n[p];n[d-1]=l}}}}}registerIfUnknown(e,t){if(t.keyCode===y.Unknown)return;const i=this._encodeScanCodeCombo(e),s=this._encodeKeyCodeCombo(t),o=t.keyCode>=y.Digit0&&t.keyCode<=y.Digit9,n=t.keyCode>=y.KeyA&&t.keyCode<=y.KeyZ,r=this._scanCodeToKeyCode[i];if(o||n){if(r){for(let d=0,l=r.length;d<l;d++)if(r[d]===s)return}}else if(r&&r.length!==0)return;this._scanCodeToKeyCode[i]=this._scanCodeToKeyCode[i]||[],this._scanCodeToKeyCode[i].unshift(s),this._keyCodeToScanCode[s]=this._keyCodeToScanCode[s]||[],this._keyCodeToScanCode[s].unshift(i)}lookupKeyCodeCombo(e){const t=this._encodeKeyCodeCombo(e),i=this._keyCodeToScanCode[t];if(!i||i.length===0)return[];const s=[];for(let o=0,n=i.length;o<n;o++){const r=i[o],d=!!(r&1),l=!!(r&2),h=!!(r&4),p=r>>>3;s[o]=new $r(d,l,h,p)}return s}lookupScanCodeCombo(e){const t=this._encodeScanCodeCombo(e),i=this._scanCodeToKeyCode[t];if(!i||i.length===0)return[];const s=[];for(let o=0,n=i.length;o<n;o++){const r=i[o],d=!!(r&1),l=!!(r&2),h=!!(r&4),p=r>>>3;s[o]=new Lh(d,l,h,p)}return s}guessStableKeyCode(e){if(e>=A.Digit1&&e<=A.Digit0)switch(e){case A.Digit1:return y.Digit1;case A.Digit2:return y.Digit2;case A.Digit3:return y.Digit3;case A.Digit4:return y.Digit4;case A.Digit5:return y.Digit5;case A.Digit6:return y.Digit6;case A.Digit7:return y.Digit7;case A.Digit8:return y.Digit8;case A.Digit9:return y.Digit9;case A.Digit0:return y.Digit0}const t=this.lookupScanCodeCombo(new $r(!1,!1,!1,e)),i=this.lookupScanCodeCombo(new $r(!1,!0,!1,e));if(t.length===1&&i.length===1){const s=t[0].shiftKey,o=t[0].keyCode,n=i[0].shiftKey,r=i[0].keyCode;if(o===r&&s!==n)return o}return y.DependsOnKbLayout}_encodeScanCodeCombo(e){return this._encode(e.ctrlKey,e.shiftKey,e.altKey,e.scanCode)}_encodeKeyCodeCombo(e){return this._encode(e.ctrlKey,e.shiftKey,e.altKey,e.keyCode)}_encode(e,t,i,s){return((e?1:0)<<0|(t?1:0)<<1|(i?1:0)<<2|s<<3)>>>0}}class ti{constructor(e,t,i,s){this._isUSStandard=e,this._mapAltGrToCtrlAlt=i,this._OS=s,this._scanCodeToLabel=[],this._scanCodeToDispatch=[],this._codeInfo=[],this._scanCodeKeyCodeMapper=new ox,this._scanCodeToLabel=[],this._scanCodeToDispatch=[];const o=(h,p,f,g,m,v,C,T)=>{this._scanCodeKeyCodeMapper.registerIfUnknown(new $r(!!h,!!p,!!f,g),new Lh(!!m,!!v,!!C,T))},n=(h,p,f,g,m)=>{for(let v=h;v<=1;v++)for(let C=p;C<=1;C++)for(let T=f;T<=1;T++)o(v,C,T,g,v,C,T,m)};for(let h=A.None;h<A.MAX_VALUE;h++)this._scanCodeToLabel[h]=null;for(let h=A.None;h<A.MAX_VALUE;h++)this._scanCodeToDispatch[h]=null;for(let h=A.None;h<A.MAX_VALUE;h++){const p=si[h];p!==y.DependsOnKbLayout&&(n(0,0,0,h,p),this._scanCodeToLabel[h]=ot.toString(p),p===y.Unknown||p===y.Ctrl||p===y.Meta||p===y.Alt||p===y.Shift?this._scanCodeToDispatch[h]=null:this._scanCodeToDispatch[h]=`[${Ut.toString(h)}]`)}const r={};{const h=[];for(const f in t)if(t.hasOwnProperty(f)){const g=Ut.toEnum(f);if(g===A.None||si[g]!==y.DependsOnKbLayout)continue;const m=t[f],v=ti.getCharCode(m.value);if(v>=_.a&&v<=_.z){const C=_.A+(v-_.a);h[C]=!0}}const p=(f,g,m,v)=>{h[f]||(r[Ut.toString(g)]={value:m,withShift:v,withAltGr:"",withShiftAltGr:""})};p(_.A,A.KeyA,"a","A"),p(_.B,A.KeyB,"b","B"),p(_.C,A.KeyC,"c","C"),p(_.D,A.KeyD,"d","D"),p(_.E,A.KeyE,"e","E"),p(_.F,A.KeyF,"f","F"),p(_.G,A.KeyG,"g","G"),p(_.H,A.KeyH,"h","H"),p(_.I,A.KeyI,"i","I"),p(_.J,A.KeyJ,"j","J"),p(_.K,A.KeyK,"k","K"),p(_.L,A.KeyL,"l","L"),p(_.M,A.KeyM,"m","M"),p(_.N,A.KeyN,"n","N"),p(_.O,A.KeyO,"o","O"),p(_.P,A.KeyP,"p","P"),p(_.Q,A.KeyQ,"q","Q"),p(_.R,A.KeyR,"r","R"),p(_.S,A.KeyS,"s","S"),p(_.T,A.KeyT,"t","T"),p(_.U,A.KeyU,"u","U"),p(_.V,A.KeyV,"v","V"),p(_.W,A.KeyW,"w","W"),p(_.X,A.KeyX,"x","X"),p(_.Y,A.KeyY,"y","Y"),p(_.Z,A.KeyZ,"z","Z")}const d=[];let l=0;for(const h in t)if(t.hasOwnProperty(h)){const p=Ut.toEnum(h);if(p===A.None||si[p]!==y.DependsOnKbLayout)continue;this._codeInfo[p]=t[h];const f=r[h]||t[h],g=ti.getCharCode(f.value),m=ti.getCharCode(f.withShift),v=ti.getCharCode(f.withAltGr),C=ti.getCharCode(f.withShiftAltGr),T={scanCode:p,value:g,withShift:m,withAltGr:v,withShiftAltGr:C};if(d[l++]=T,this._scanCodeToDispatch[p]=`[${Ut.toString(p)}]`,g>=_.a&&g<=_.z){const B=_.A+(g-_.a);this._scanCodeToLabel[p]=String.fromCharCode(B)}else g>=_.A&&g<=_.Z?this._scanCodeToLabel[p]=String.fromCharCode(g):g?this._scanCodeToLabel[p]=String.fromCharCode(g):this._scanCodeToLabel[p]=null}for(let h=d.length-1;h>=0;h--){const p=d[h],f=p.scanCode,g=p.withShiftAltGr;if(g===p.withAltGr||g===p.withShift||g===p.value)continue;const m=ti._charCodeToKb(g);if(!m)continue;const v=m.shiftKey,C=m.keyCode;v?o(1,1,1,f,0,1,0,C):o(1,1,1,f,0,0,0,C)}for(let h=d.length-1;h>=0;h--){const p=d[h],f=p.scanCode,g=p.withAltGr;if(g===p.withShift||g===p.value)continue;const m=ti._charCodeToKb(g);if(!m)continue;const v=m.shiftKey,C=m.keyCode;v?o(1,0,1,f,0,1,0,C):o(1,0,1,f,0,0,0,C)}for(let h=d.length-1;h>=0;h--){const p=d[h],f=p.scanCode,g=p.withShift;if(g===p.value)continue;const m=ti._charCodeToKb(g);if(!m)continue;const v=m.shiftKey,C=m.keyCode;v?(o(0,1,0,f,0,1,0,C),o(0,1,1,f,0,1,1,C),o(1,1,0,f,1,1,0,C),o(1,1,1,f,1,1,1,C)):(o(0,1,0,f,0,0,0,C),o(0,1,0,f,0,1,0,C),o(0,1,1,f,0,0,1,C),o(0,1,1,f,0,1,1,C),o(1,1,0,f,1,0,0,C),o(1,1,0,f,1,1,0,C),o(1,1,1,f,1,0,1,C),o(1,1,1,f,1,1,1,C))}for(let h=d.length-1;h>=0;h--){const p=d[h],f=p.scanCode,g=ti._charCodeToKb(p.value);if(!g)continue;const m=g.shiftKey,v=g.keyCode;m?(o(0,0,0,f,0,1,0,v),o(0,0,1,f,0,1,1,v),o(1,0,0,f,1,1,0,v),o(1,0,1,f,1,1,1,v)):(o(0,0,0,f,0,0,0,v),o(0,0,1,f,0,0,1,v),o(0,1,0,f,0,1,0,v),o(0,1,1,f,0,1,1,v),o(1,0,0,f,1,0,0,v),o(1,0,1,f,1,0,1,v),o(1,1,0,f,1,1,0,v),o(1,1,1,f,1,1,1,v))}n(0,0,0,A.Digit1,y.Digit1),n(0,0,0,A.Digit2,y.Digit2),n(0,0,0,A.Digit3,y.Digit3),n(0,0,0,A.Digit4,y.Digit4),n(0,0,0,A.Digit5,y.Digit5),n(0,0,0,A.Digit6,y.Digit6),n(0,0,0,A.Digit7,y.Digit7),n(0,0,0,A.Digit8,y.Digit8),n(0,0,0,A.Digit9,y.Digit9),n(0,0,0,A.Digit0,y.Digit0),this._scanCodeKeyCodeMapper.registrationComplete()}dumpDebugInfo(){const e=[],t=[A.ArrowUp,A.Numpad0];let i=0;e.push(`isUSStandard: ${this._isUSStandard}`),e.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");for(let s=A.None;s<A.MAX_VALUE;s++){if(si[s]!==y.DependsOnKbLayout&&t.indexOf(s)===-1)continue;i%4===0&&(e.push("| HW Code combination | Key | KeyCode combination | Pri | UI label | User settings | Electron accelerator | Dispatching string | WYSIWYG |"),e.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")),i++;const o=this._codeInfo[s];for(let n=0;n<8;n++){const r=!!(n&1),d=!!(n&2),l=!!(n&4),h=new $r(r,d,l,s),p=this.resolveKeyboardEvent({_standardKeyboardEventBrand:!0,ctrlKey:h.ctrlKey,shiftKey:h.shiftKey,altKey:h.altKey,metaKey:!1,altGraphKey:!1,keyCode:y.DependsOnKbLayout,code:Ut.toString(s)}),f=h.toString(),g=h.getProducedChar(o),m=p.getAriaLabel(),v=m?m.replace(/Control\+/,"Ctrl+"):null,C=p.getUserSettingsLabel(),T=p.getElectronAccelerator(),B=p.getDispatchChords()[0],U=(p?p.isWYSIWYG():!1)?" ":" NO ",W=this._scanCodeKeyCodeMapper.lookupScanCodeCombo(h);if(W.length===0)e.push(`| ${this._leftPad(f,30)} | ${g} | ${this._leftPad("",25)} | ${this._leftPad("",3)} | ${this._leftPad(v,25)} | ${this._leftPad(C,30)} | ${this._leftPad(T,25)} | ${this._leftPad(B,30)} | ${U} |`);else for(let K=0,j=W.length;K<j;K++){const oe=W[K];let Me;const bt=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(oe);if(bt.length===1)Me="";else{let Ti=-1;for(let $e=0;$e<bt.length;$e++)if(bt[$e].equals(h)){Ti=$e+1;break}Me=String(Ti)}const lt=oe.toString();K===0?e.push(`| ${this._leftPad(f,30)} | ${g} | ${this._leftPad(lt,25)} | ${this._leftPad(Me,3)} | ${this._leftPad(v,25)} | ${this._leftPad(C,30)} | ${this._leftPad(T,25)} | ${this._leftPad(B,30)} | ${U} |`):e.push(`| ${this._leftPad("",30)} | | ${this._leftPad(lt,25)} | ${this._leftPad(Me,3)} | ${this._leftPad("",25)} | ${this._leftPad("",30)} | ${this._leftPad("",25)} | ${this._leftPad("",30)} | |`)}}e.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")}return e.join(`
|
|
19
|
+
`)}_leftPad(e,t){for(e===null&&(e="null");e.length<t;)e=" "+e;return e}keyCodeChordToScanCodeChord(e){if(e.keyCode===y.Enter)return[new xs(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,A.Enter)];const t=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(new Lh(e.ctrlKey,e.shiftKey,e.altKey,e.keyCode)),i=[];for(let s=0,o=t.length;s<o;s++){const n=t[s];i[s]=new xs(n.ctrlKey,n.shiftKey,n.altKey,e.metaKey,n.scanCode)}return i}getUILabelForScanCodeChord(e){if(!e)return null;if(e.isDuplicateModifierCase())return"";if(this._OS===yi.Macintosh)switch(e.scanCode){case A.ArrowLeft:return"←";case A.ArrowUp:return"↑";case A.ArrowRight:return"→";case A.ArrowDown:return"↓"}return this._scanCodeToLabel[e.scanCode]}getAriaLabelForScanCodeChord(e){return e?e.isDuplicateModifierCase()?"":this._scanCodeToLabel[e.scanCode]:null}getDispatchStrForScanCodeChord(e){const t=this._scanCodeToDispatch[e.scanCode];if(!t)return null;let i="";return e.ctrlKey&&(i+="ctrl+"),e.shiftKey&&(i+="shift+"),e.altKey&&(i+="alt+"),e.metaKey&&(i+="meta+"),i+=t,i}getUserSettingsLabelForScanCodeChord(e){if(!e)return null;if(e.isDuplicateModifierCase())return"";const t=si[e.scanCode];if(t!==y.DependsOnKbLayout)return ot.toUserSettingsUS(t).toLowerCase();const i=this._scanCodeKeyCodeMapper.guessStableKeyCode(e.scanCode);if(i!==y.DependsOnKbLayout){const s=this.keyCodeChordToScanCodeChord(new Vs(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,i));for(let o=0,n=s.length;o<n;o++)if(s[o].scanCode===e.scanCode)return ot.toUserSettingsUS(i).toLowerCase()}return this._scanCodeToDispatch[e.scanCode]}getElectronAcceleratorLabelForScanCodeChord(e){if(!e)return null;const t=si[e.scanCode];if(t!==y.DependsOnKbLayout)return ot.toElectronAccelerator(t);const i=this._scanCodeKeyCodeMapper.guessStableKeyCode(e.scanCode);return this._OS===yi.Linux&&!this._isUSStandard&&(i===y.Semicolon||i===y.Equal||i===y.Comma||i===y.Minus||i===y.Period||i===y.Slash||i===y.Backquote||i===y.BracketLeft||i===y.Backslash||i===y.BracketRight)?null:i!==y.DependsOnKbLayout?ot.toElectronAccelerator(i):null}_toResolvedKeybinding(e){if(e.length===0)return[];const t=[];return this._generateResolvedKeybindings(e,0,[],t),t}_generateResolvedKeybindings(e,t,i,s){const o=e[t],n=t===e.length-1;for(let r=0,d=o.length;r<d;r++){const l=[...i,o[r]];n?s.push(new sm(this,this._OS,l)):this._generateResolvedKeybindings(e,t+1,l,s)}}resolveKeyboardEvent(e){let t=Ut.toEnum(e.code);t===A.NumpadEnter&&(t=A.Enter);const i=e.keyCode;if(i===y.LeftArrow||i===y.UpArrow||i===y.RightArrow||i===y.DownArrow||i===y.Delete||i===y.Insert||i===y.Home||i===y.End||i===y.PageDown||i===y.PageUp||i===y.Backspace){const r=Vg[i];r!==A.DependsOnKbLayout&&(t=r)}else if((t===A.Numpad1||t===A.Numpad2||t===A.Numpad3||t===A.Numpad4||t===A.Numpad5||t===A.Numpad6||t===A.Numpad7||t===A.Numpad8||t===A.Numpad9||t===A.Numpad0||t===A.NumpadDecimal)&&i>=0){const r=Vg[i];r!==A.DependsOnKbLayout&&(t=r)}const s=e.ctrlKey||this._mapAltGrToCtrlAlt&&e.altGraphKey,o=e.altKey||this._mapAltGrToCtrlAlt&&e.altGraphKey,n=new xs(s,e.shiftKey,o,e.metaKey,t);return new sm(this,this._OS,[n])}_resolveChord(e){return e?e instanceof xs?[e]:this.keyCodeChordToScanCodeChord(e):[]}resolveKeybinding(e){const t=e.chords.map(i=>this._resolveChord(i));return this._toResolvedKeybinding(t)}static _redirectCharCode(e){switch(e){case _.U_IDEOGRAPHIC_FULL_STOP:return _.Period;case _.U_LEFT_CORNER_BRACKET:return _.OpenSquareBracket;case _.U_RIGHT_CORNER_BRACKET:return _.CloseSquareBracket;case _.U_LEFT_BLACK_LENTICULAR_BRACKET:return _.OpenSquareBracket;case _.U_RIGHT_BLACK_LENTICULAR_BRACKET:return _.CloseSquareBracket;case _.U_FULLWIDTH_SEMICOLON:return _.Semicolon;case _.U_FULLWIDTH_COMMA:return _.Comma}return e}static _charCodeToKb(e){return e=this._redirectCharCode(e),e<zr.length?zr[e]:null}static getCharCode(e){if(e.length===0)return 0;const t=e.charCodeAt(0);switch(t){case _.U_Combining_Grave_Accent:return _.U_GRAVE_ACCENT;case _.U_Combining_Acute_Accent:return _.U_ACUTE_ACCENT;case _.U_Combining_Circumflex_Accent:return _.U_CIRCUMFLEX;case _.U_Combining_Tilde:return _.U_SMALL_TILDE;case _.U_Combining_Macron:return _.U_MACRON;case _.U_Combining_Overline:return _.U_OVERLINE;case _.U_Combining_Breve:return _.U_BREVE;case _.U_Combining_Dot_Above:return _.U_DOT_ABOVE;case _.U_Combining_Diaeresis:return _.U_DIAERESIS;case _.U_Combining_Ring_Above:return _.U_RING_ABOVE;case _.U_Combining_Double_Acute_Accent:return _.U_DOUBLE_ACUTE_ACCENT}return t}}(function(){function a(e,t,i){for(let s=zr.length;s<e;s++)zr[s]=null;zr[e]={keyCode:t,shiftKey:i}}for(let e=_.A;e<=_.Z;e++)a(e,y.KeyA+(e-_.A),!0);for(let e=_.a;e<=_.z;e++)a(e,y.KeyA+(e-_.a),!1);a(_.Semicolon,y.Semicolon,!1),a(_.Colon,y.Semicolon,!0),a(_.Equals,y.Equal,!1),a(_.Plus,y.Equal,!0),a(_.Comma,y.Comma,!1),a(_.LessThan,y.Comma,!0),a(_.Dash,y.Minus,!1),a(_.Underline,y.Minus,!0),a(_.Period,y.Period,!1),a(_.GreaterThan,y.Period,!0),a(_.Slash,y.Slash,!1),a(_.QuestionMark,y.Slash,!0),a(_.BackTick,y.Backquote,!1),a(_.Tilde,y.Backquote,!0),a(_.OpenSquareBracket,y.BracketLeft,!1),a(_.OpenCurlyBrace,y.BracketLeft,!0),a(_.Backslash,y.Backslash,!1),a(_.Pipe,y.Backslash,!0),a(_.CloseSquareBracket,y.BracketRight,!1),a(_.CloseCurlyBrace,y.BracketRight,!0),a(_.SingleQuote,y.Quote,!1),a(_.DoubleQuote,y.Quote,!0)})();function nx(a){switch(a){case"./keyboardLayouts/layout.contribution.darwin.js":return gl(()=>import("./layout.contribution.darwin-gdaUfoJf.js"),__vite__mapDeps([0,1]),import.meta.url).then(e=>e.default??e);case"./keyboardLayouts/layout.contribution.linux.js":return gl(()=>import("./layout.contribution.linux-xMjRz7iy.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.default??e);case"./keyboardLayouts/layout.contribution.win.js":return gl(()=>import("./layout.contribution.win-DZRWibbm.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.default??e);default:return new Promise(function(e,t){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(t.bind(null,new Error("Unknown variable dynamic import: "+a)))})}}class rx extends R{get activeKeymap(){return this._activeKeymapInfo}get keymapInfos(){return this._keymapInfos}get activeKeyboardLayout(){return this._initialized?this._activeKeymapInfo?.layout??null:null}get activeKeyMapping(){return this._initialized?this._activeKeymapInfo?.mapping??null:null}get keyboardLayouts(){return this._keymapInfos.map(e=>e.layout)}constructor(e){super(),this._configurationService=e,this._onDidChangeKeyboardMapper=new E,this.onDidChangeKeyboardMapper=this._onDidChangeKeyboardMapper.event,this.keyboardLayoutMapAllowed=navigator.keyboard!==void 0,this._keyboardMapper=null,this._initialized=!1,this._keymapInfos=[],this._mru=[],this._activeKeymapInfo=null,navigator.keyboard&&navigator.keyboard.addEventListener&&navigator.keyboard.addEventListener("layoutchange",()=>{this._getBrowserKeyMapping().then(t=>{this.isKeyMappingActive(t)||this.setLayoutFromBrowserAPI()})}),this._register(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration("keyboard")&&(this._keyboardMapper=null,this._onDidChangeKeyboardMapper.fire())}))}registerKeyboardLayout(e){this._keymapInfos.push(e),this._mru=this._keymapInfos}removeKeyboardLayout(e){let t=this._mru.indexOf(e);this._mru.splice(t,1),t=this._keymapInfos.indexOf(e),this._keymapInfos.splice(t,1)}getMatchedKeymapInfo(e){if(!e)return null;const t=this.getUSStandardLayout();if(t){let i=t.getScore(e);if(i===0)return{result:t,score:0};let s=t;for(let o=0;o<this._mru.length;o++){const n=this._mru[o].getScore(e);if(n>i){if(n===0)return{result:this._mru[o],score:0};i=n,s=this._mru[o]}}return{result:s,score:i}}for(let i=0;i<this._mru.length;i++)if(this._mru[i].fuzzyEqual(e))return{result:this._mru[i],score:0};return null}getUSStandardLayout(){const e=this._mru.filter(t=>t.layout.isUSStandard);return e.length?e[0]:null}isKeyMappingActive(e){return this._activeKeymapInfo&&e&&this._activeKeymapInfo.fuzzyEqual(e)}setUSKeyboardLayout(){this._activeKeymapInfo=this.getUSStandardLayout()}setActiveKeyMapping(e){let t=!1;const i=this.getMatchedKeymapInfo(e);if(i&&(this._activeKeymapInfo?e&&i.result.getScore(e)>this._activeKeymapInfo.getScore(e)&&(this._activeKeymapInfo=i.result,t=!0):(this._activeKeymapInfo=i.result,t=!0)),this._activeKeymapInfo||(this._activeKeymapInfo=this.getUSStandardLayout(),t=!0),!this._activeKeymapInfo||!t)return;const s=this._mru.indexOf(this._activeKeymapInfo);this._mru.splice(s,1),this._mru.unshift(this._activeKeymapInfo),this._setKeyboardData(this._activeKeymapInfo)}setActiveKeymapInfo(e){this._activeKeymapInfo=e;const t=this._mru.indexOf(this._activeKeymapInfo);t!==0&&(this._mru.splice(t,1),this._mru.unshift(this._activeKeymapInfo),this._setKeyboardData(this._activeKeymapInfo))}setLayoutFromBrowserAPI(){this._updateKeyboardLayoutAsync(this._initialized)}_updateKeyboardLayoutAsync(e,t){e&&this._getBrowserKeyMapping(t).then(i=>{this.isKeyMappingActive(i)||this.setActiveKeyMapping(i)})}getKeyboardMapper(){const e=QT(this._configurationService);return e.dispatch===ha.KeyCode||!this._initialized||!this._activeKeymapInfo?new Pg(e.mapAltGrToCtrlAlt,$t):(this._keyboardMapper||(this._keyboardMapper=new ix(Av._createKeyboardMapper(this._activeKeymapInfo,e.mapAltGrToCtrlAlt))),this._keyboardMapper)}validateCurrentKeyboardMapping(e){!this._initialized||this._validateCurrentKeyboardMapping(e)||this._updateKeyboardLayoutAsync(!0,e)}setKeyboardLayout(e){const t=this.keymapInfos.filter(i=>la(i.layout)===e);t.length>0&&this.setActiveKeymapInfo(t[0])}_setKeyboardData(e){this._initialized=!0,this._keyboardMapper=null,this._onDidChangeKeyboardMapper.fire()}static _createKeyboardMapper(e,t){const i=e.mapping,s=!!e.layout.isUSStandard;return $t===yi.Windows?new sx(s,i,t):Object.keys(i).length===0?new Pg(t,$t):new ti(s,i,t,$t)}_validateCurrentKeyboardMapping(e){if(!this._initialized)return!0;const t=e,i=this._activeKeymapInfo;if(!i||t.browserEvent.key==="Dead"||t.browserEvent.isComposing)return!0;const s=i.mapping[t.code];if(!s)return!1;if(s.value==="")return(e.ctrlKey||e.metaKey)&&setTimeout(()=>{this._getBrowserKeyMapping().then(r=>{this.isKeyMappingActive(r)||this.setLayoutFromBrowserAPI()})},350),!0;const o=t.altKey&&t.shiftKey?s.withShiftAltGr:t.altKey?s.withAltGr:t.shiftKey?s.withShift:s.value,n=t.altKey&&t.shiftKey&&s.withShiftAltGrIsDeadKey||t.altKey&&s.withAltGrIsDeadKey||t.shiftKey&&s.withShiftIsDeadKey||s.valueIsDeadKey;return!(n&&t.browserEvent.key!=="Dead"||!n&&t.browserEvent.key!==o)}async _getBrowserKeyMapping(e){if(this.keyboardLayoutMapAllowed)try{return await navigator.keyboard.getLayoutMap().then(t=>{const i={};for(const s of t)i[s[0]]={value:s[1],withShift:"",withAltGr:"",withShiftAltGr:""};return i})}catch{this.keyboardLayoutMapAllowed=!1}if(e&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.metaKey){const t={},i=e;return t[i.browserEvent.code]={value:i.browserEvent.key,withShift:"",withAltGr:"",withShiftAltGr:""},this.getMatchedKeymapInfo(t)?t:null}return null}}class Av extends rx{constructor(e,t,i,s){super(e),nx(`./keyboardLayouts/layout.contribution.${Uo?"win":ut?"darwin":"linux"}.js`).then(n=>{const r=n.KeyboardLayoutContribution.INSTANCE.layoutInfos;this._keymapInfos.push(...r.map(d=>new sl(d.layout,d.secondaryLayouts,d.mapping,d.isUserKeyboardLayout))),this._mru=this._keymapInfos,this._initialized=!0,this.setLayoutFromBrowserAPI()})}}class ax extends R{get keyboardLayout(){return this._keyboardLayout}constructor(e,t){super(),this.keyboardLayoutResource=e,this.fileService=t,this._onDidChange=this._register(new E),this.onDidChange=this._onDidChange.event,this._keyboardLayout=null,this.reloadConfigurationScheduler=this._register(new Ca(()=>this.reload().then(i=>{i&&this._onDidChange.fire()}),50)),this._register(L.filter(this.fileService.onDidFilesChange,i=>i.contains(this.keyboardLayoutResource))(()=>this.reloadConfigurationScheduler.schedule()))}async initialize(){await this.reload()}async reload(){const e=this._keyboardLayout;try{const t=await this.fileService.readFile(this.keyboardLayoutResource),i=ow(t.value.toString());if(TC(i)==="object"){const s=i.layout,o=i.rawMapping;this._keyboardLayout=sl.createKeyboardLayoutFromDebugInfo(s,o,!0)}else this._keyboardLayout=null}catch{this._keyboardLayout=null}return e?!sw(e,this._keyboardLayout):!0}}let Vh=class extends R{constructor(e,t,i,s,o,n){super(),this.configurationService=n,this._onDidChangeKeyboardLayout=new E,this.onDidChangeKeyboardLayout=this._onDidChangeKeyboardLayout.event;const d=n.getValue("keyboard").layout;this._keyboardLayoutMode=d??"autodetect",this._factory=new Av(n,i,s,o),this._register(this._factory.onDidChangeKeyboardMapper(()=>{this._onDidChangeKeyboardLayout.fire()})),d&&d!=="autodetect"&&this._factory.setKeyboardLayout(d),this._register(n.onDidChangeConfiguration(l=>{if(l.affectsConfiguration("keyboard.layout")){const p=n.getValue("keyboard").layout;this._keyboardLayoutMode=p,p==="autodetect"?this._factory.setLayoutFromBrowserAPI():this._factory.setKeyboardLayout(p)}})),this._userKeyboardLayout=new ax(e.keyboardLayoutResource,t),this._userKeyboardLayout.initialize().then(()=>{this._userKeyboardLayout.keyboardLayout&&(this._factory.registerKeyboardLayout(this._userKeyboardLayout.keyboardLayout),this.setUserKeyboardLayoutIfMatched())}),this._register(this._userKeyboardLayout.onDidChange(()=>{const l=this._factory.keymapInfos.filter(h=>h.isUserKeyboardLayout);l.length?this._userKeyboardLayout.keyboardLayout?l[0].update(this._userKeyboardLayout.keyboardLayout):this._factory.removeKeyboardLayout(l[0]):this._userKeyboardLayout.keyboardLayout&&this._factory.registerKeyboardLayout(this._userKeyboardLayout.keyboardLayout),this.setUserKeyboardLayoutIfMatched()}))}setUserKeyboardLayoutIfMatched(){const t=this.configurationService.getValue("keyboard").layout;t&&this._userKeyboardLayout.keyboardLayout&&la(this._userKeyboardLayout.keyboardLayout.layout)===t&&this._factory.activeKeymap&&(this._userKeyboardLayout.keyboardLayout.equal(this._factory.activeKeymap)||this._factory.setActiveKeymapInfo(this._userKeyboardLayout.keyboardLayout))}getKeyboardMapper(){return this._factory.getKeyboardMapper()}getCurrentKeyboardLayout(){return this._factory.activeKeyboardLayout}getAllKeyboardLayouts(){return this._factory.keyboardLayouts}getRawKeyboardMapping(){return this._factory.activeKeyMapping}validateCurrentKeyboardMapping(e){this._keyboardLayoutMode==="autodetect"&&this._factory.validateCurrentKeyboardMapping(e)}};Vh=D([u(0,Mp),u(1,Le),u(2,Ke),u(3,ce),u(4,wt),u(5,ie)],Vh);const dx=z.as(Zs.Configuration),cx={id:"keyboard",order:15,type:"object",title:c(12712,"Keyboard"),properties:{"keyboard.layout":{type:"string",default:"autodetect",description:c(12713,"Control the keyboard layout used in web.")}}};dx.registerConfiguration(cx);let Ph=class extends R{constructor(e,t,i){super(),this._instantiationService=e,this._extensionService=t,this._logService=i,this._extensionHostIsReady=!1,this._onWillExecuteCommand=this._register(new E),this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new E,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this._extensionService.whenInstalledExtensionsRegistered().then(s=>this._extensionHostIsReady=s),this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Mg([this._extensionService.activateByEvent("*"),Ho(3e4)])),xC(this._starActivation)}async executeCommand(e,...t){this._logService.trace("CommandService#executeCommand",e);const i=`onCommand:${e}`;return Te.getCommand(e)?this._extensionService.activationEventIsDone(i)?this._tryExecuteCommand(e,t):this._extensionHostIsReady?(await this._extensionService.activateByEvent(i),this._tryExecuteCommand(e,t)):(this._extensionService.activateByEvent(i),this._tryExecuteCommand(e,t)):(await Promise.all([this._extensionService.activateByEvent(i),Mg([this._activateStar(),L.toPromise(L.filter(Te.onDidRegisterCommand,o=>o===e))])]),this._tryExecuteCommand(e,t))}_tryExecuteCommand(e,t){const i=Te.getCommand(e);if(!i)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});const s=this._instantiationService.invokeFunction(i.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(s)}catch(s){return Promise.reject(s)}}dispose(){super.dispose(),this._starActivation?.cancel()}};Ph=D([u(0,F),u(1,At),u(2,Ue)],Ph);class pn extends X{constructor(){super({id:"workbench.action.toggleKeybindingsLog",title:x(7552,"Toggle Keyboard Shortcuts Troubleshooting"),category:xe.Developer,f1:!0})}run(e){if(e.get(it).toggleLogging()&&e.get(wt).executeCommand(kC),pn.disposable){pn.disposable.dispose(),pn.disposable=void 0;return}const i=e.get(_a),s=new O,o=i.activeContainer,n=ge(o,M(".focus-troubleshooting-marker"));s.add(ae(()=>n.remove()));const r=aw(void 0,void 0,s);RC(".focus-troubleshooting-marker",`
|
|
20
|
+
position: fixed;
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
z-index: 100000;
|
|
23
|
+
background-color: rgba(255, 0, 0, 0.2);
|
|
24
|
+
border: 2px solid rgba(255, 0, 0, 0.8);
|
|
25
|
+
border-radius: 2px;
|
|
26
|
+
display: none;
|
|
27
|
+
`,r);const d=s.add(new E);function l(h,p){p.add(p.add(new Yl(h,"keydown",!0)).event(f=>d.fire(f)))}for(const{window:h,disposables:p}of jl())l(h,p);s.add(tw(({window:h,disposables:p})=>l(h,p))),s.add(i.onDidChangeActiveContainer(()=>{i.activeContainer.appendChild(n)})),s.add(d.event(h=>{const p=h.target;if(p){const f=LC(p);n.style.top=`${f.top}px`,n.style.left=`${f.left}px`,n.style.width=`${f.width}px`,n.style.height=`${f.height}px`,n.style.display="block",setTimeout(()=>{n.style.display="none"},800)}})),pn.disposable=s}}b(pn);class lx{static hasOpenBrace(e){for(;e.scan()!==xi.EOF;)if(e.getToken()===xi.OpenBraceToken)return!0;return!1}static offsetToPosition(e,t){let i=0;const s=e.getEOL().length,o=e.getLineCount();for(let n=1;n<=o;n++){const r=e.getLineLength(n)+s,d=i+r;if(d>t)return new rd(n,t-i+1);i=d}return new rd(o,e.getLineMaxColumn(o))}static insertSnippet(e,t){const i=e.getValueLengthInRange(new ve(1,1,t.lineNumber,t.column));let s;(function(g){g[g.INVALID=0]="INVALID",g[g.AFTER_OBJECT=1]="AFTER_OBJECT",g[g.BEFORE_OBJECT=2]="BEFORE_OBJECT"})(s||(s={}));let o=s.INVALID,n=-1,r=s.INVALID;const d=VC(e.getValue());let l=0,h=0;const p=(g,m)=>{m!==s.INVALID&&l===1&&h===0?(o=m,n=g,r=m):o!==s.INVALID&&(o=s.INVALID,n=d.getTokenOffset())};for(;d.scan()!==xi.EOF;){const g=d.getPosition(),m=d.getToken();let v=!1;switch(m){case xi.OpenBracketToken:v=!0,l++,p(g,s.BEFORE_OBJECT);break;case xi.CloseBracketToken:v=!0,l--,p(g,s.INVALID);break;case xi.CommaToken:v=!0,p(g,s.BEFORE_OBJECT);break;case xi.OpenBraceToken:v=!0,h++,p(g,s.INVALID);break;case xi.CloseBraceToken:v=!0,h--,p(g,s.AFTER_OBJECT);break;case xi.Trivia:case xi.LineBreakTrivia:v=!0}if(g>=i&&(o!==s.INVALID||n!==-1)){let C,T;return o!==s.INVALID?(C=v?g:d.getTokenOffset(),T=o):(C=n,T=r),T===s.AFTER_OBJECT?{position:this.offsetToPosition(e,C),prepend:",",append:""}:(d.setPosition(C),{position:this.offsetToPosition(e,C),prepend:"",append:this.hasOpenBrace(d)?",":""})}}const f=e.getLineCount();return{position:new rd(f,e.getLineMaxColumn(f)),prepend:`
|
|
28
|
+
[`,append:"]"}}}const hx=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),ux=le("settings-folder-dropdown",k.triangleDown,c(8864,"Icon for the folder dropdown button in the split JSON Settings editor."));le("settings-more-action",k.gear,c(8865,"Icon for the 'more actions' action in the Settings UI."));le("keybindings-record-keys",k.recordKeys,c(8866,"Icon for the 'record keys' action in the keybinding UI."));le("keybindings-sort",k.sortPrecedence,c(8867,"Icon for the 'sort by precedence' toggle in the keybinding UI."));le("keybindings-edit",k.edit,c(8868,"Icon for the edit action in the keybinding UI."));le("keybindings-add",k.add,c(8869,"Icon for the add action in the keybinding UI."));le("settings-edit",k.edit,c(8870,"Icon for the edit action in the Settings UI."));le("settings-remove",k.close,c(8871,"Icon for the remove action in the Settings UI."));le("settings-discard",k.discard,c(8872,"Icon for the discard action in the Settings UI."));le("preferences-clear-input",k.clearAll,c(8873,"Icon for clear input in the Settings and keybinding UI."));le("preferences-ai-results",k.sparkle,c(8874,"Icon for showing AI results in the Settings UI."));le("preferences-filter",k.filter,c(8875,"Icon for the button that suggests filters for the Settings UI."));le("preferences-open-settings",k.goToFile,c(8876,"Icon for open settings commands."));let Mh=class extends PC{constructor(e,t,i,s){super(null,e),this.contextService=t,this.contextMenuService=i,this.hoverService=s,this._folderSettingCounts=new Map;const o=this.contextService.getWorkspace();this._folder=o.folders.length===1?o.folders[0]:null,this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.onWorkspaceFoldersChanged()))}get folder(){return this._folder}set folder(e){this._folder=e,this.update()}setCount(e,t){const i=this.contextService.getWorkspaceFolder(e);if(!i)throw new Error("unknown folder");const s=i.uri;this._folderSettingCounts.set(s.toString(),t),this.update()}render(e){this.element=e,this.container=e,this.labelElement=M(".action-title"),this.detailsElement=M(".action-details"),this.dropDownElement=M(".dropdown-icon.hide"+Ce.asCSSSelector(ux)),this.anchorElement=M("a.action-label.folder-settings",{role:"button","aria-haspopup":"true",tabindex:"0"},this.labelElement,this.detailsElement,this.dropDownElement),this.anchorElementHover=this._register(this.hoverService.setupManagedHover(Ap("mouse"),this.anchorElement,"")),this._register(J(this.anchorElement,te.MOUSE_DOWN,t=>ke.stop(t))),this._register(J(this.anchorElement,te.CLICK,t=>this.onClick(t))),this._register(J(this.container,te.KEY_UP,t=>this.onKeyUp(t))),ge(this.container,this.anchorElement),this.update()}onKeyUp(e){switch(new Yn(e).keyCode){case y.Enter:case y.Space:this.onClick(e);return}}onClick(e){ke.stop(e,!0),!this.folder||this._action.checked?this.showMenu():this._action.run(this._folder)}updateEnabled(){this.update()}updateChecked(){this.update()}onWorkspaceFoldersChanged(){const e=this._folder,t=this.contextService.getWorkspace();e&&(this._folder=t.folders.filter(i=>dt(i.uri,e.uri))[0]||t.folders[0]),this._folder=this._folder?this._folder:t.folders.length===1?t.folders[0]:null,this.update(),this._action.checked&&this._action.run(this._folder)}update(){let e=0;this._folderSettingCounts.forEach(i=>e+=i);const t=this.contextService.getWorkspace();if(this._folder){this.labelElement.textContent=this._folder.name,this.anchorElementHover.update(this._folder.name);const i=this.labelWithCount(this._action.label,e);this.detailsElement.textContent=i,this.dropDownElement.classList.toggle("hide",t.folders.length===1||!this._action.checked)}else{const i=this.labelWithCount(this._action.label,e);this.labelElement.textContent=i,this.detailsElement.textContent="",this.anchorElementHover.update(this._action.label),this.dropDownElement.classList.remove("hide")}this.anchorElement.classList.toggle("checked",this._action.checked),this.container.classList.toggle("disabled",!this._action.enabled)}showMenu(){this.contextMenuService.showContextMenu({getAnchor:()=>this.container,getActions:()=>this.getDropdownMenuActions(),getActionViewItem:()=>{},onHide:()=>{this.anchorElement.blur()}})}getDropdownMenuActions(){const e=[],t=this.contextService.getWorkspace().folders;return this.contextService.getWorkbenchState()===Ir.WORKSPACE&&t.length>0&&e.push(...t.map((i,s)=>{const o=this._folderSettingCounts.get(i.uri.toString());return{id:"folderSettingsTarget"+s,label:this.labelWithCount(i.name,o),tooltip:this.labelWithCount(i.name,o),checked:!!this.folder&&dt(this.folder.uri,i.uri),enabled:!0,class:void 0,run:()=>this._action.run(i)}})),e}labelWithCount(e,t){return t&&(e+=` (${t})`),e}};Mh=D([u(1,bs),u(2,at),u(3,Tt)],Mh);let om=class extends Ac{constructor(e,t,i,s,o,n,r){super(),this.contextService=i,this.instantiationService=s,this.environmentService=o,this.labelService=n,this.languageService=r,this._settingsTarget=null,this._onDidTargetChange=this._register(new E),this.onDidTargetChange=this._onDidTargetChange.event,this.options=t??{},this.create(e),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onWorkbenchStateChanged())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.update()))}resetLabels(){const e=this.environmentService.remoteAuthority,t=e&&this.labelService.getHostLabel(pe.vscodeRemote,e);this.userLocalSettings.label=c(8892,"User"),this.userRemoteSettings.label=c(8893,"Remote")+(t?` [${t}]`:""),this.workspaceSettings.label=c(8894,"Workspace"),this.folderSettingsAction.label=c(8895,"Folder")}create(e){const t=ge(e,M(".settings-tabs-widget"));this.settingsSwitcherBar=this._register(new cr(t,{orientation:Fo.HORIZONTAL,focusOnlyEnabledItems:!0,ariaLabel:c(8896,"Settings Switcher"),ariaRole:"tablist",actionViewItemProvider:(o,n)=>o.id==="folderSettings"?this.folderSettings:void 0})),this.userLocalSettings=this._register(new _t("userSettings","",".settings-tab",!0,()=>this.updateTarget(Qe.USER_LOCAL))),this.userLocalSettings.tooltip=c(8892,"User"),this.userRemoteSettings=this._register(new _t("userSettingsRemote","",".settings-tab",!0,()=>this.updateTarget(Qe.USER_REMOTE)));const i=this.environmentService.remoteAuthority,s=i&&this.labelService.getHostLabel(pe.vscodeRemote,i);this.userRemoteSettings.tooltip=c(8893,"Remote")+(s?` [${s}]`:""),this.workspaceSettings=this._register(new _t("workspaceSettings","",".settings-tab",!1,()=>this.updateTarget(Qe.WORKSPACE))),this.folderSettingsAction=this._register(new _t("folderSettings","",".settings-tab",!1,async o=>{this.updateTarget(MC(o)?o.uri:Qe.USER_LOCAL)})),this.folderSettings=this._register(this.instantiationService.createInstance(Mh,this.folderSettingsAction)),this.resetLabels(),this.update(),this.settingsSwitcherBar.push([this.userLocalSettings,this.userRemoteSettings,this.workspaceSettings,this.folderSettingsAction])}get settingsTarget(){return this._settingsTarget}set settingsTarget(e){this._settingsTarget=e,this.userLocalSettings.checked=Qe.USER_LOCAL===this.settingsTarget,this.userRemoteSettings.checked=Qe.USER_REMOTE===this.settingsTarget,this.workspaceSettings.checked=Qe.WORKSPACE===this.settingsTarget,this.settingsTarget instanceof $?(this.folderSettings.action.checked=!0,this.folderSettings.folder=this.contextService.getWorkspaceFolder(this.settingsTarget)):this.folderSettings.action.checked=!1}setResultCount(e,t){if(e===Qe.WORKSPACE){let i=c(8894,"Workspace");t&&(i+=` (${t})`),this.workspaceSettings.label=i}else if(e===Qe.USER_LOCAL){let i=c(8892,"User");t&&(i+=` (${t})`),this.userLocalSettings.label=i}else e instanceof $&&this.folderSettings.setCount(e,t)}updateLanguageFilterIndicators(e){if(this.resetLabels(),e){const t=this.languageService.getLanguageName(e);if(t){const i=` [${t}]`;this.userLocalSettings.label+=i,this.userRemoteSettings.label+=i,this.workspaceSettings.label+=i,this.folderSettingsAction.label+=i}}}onWorkbenchStateChanged(){this.folderSettings.folder=null,this.update(),this.settingsTarget===Qe.WORKSPACE&&this.contextService.getWorkbenchState()===Ir.WORKSPACE&&this.updateTarget(Qe.USER_LOCAL)}updateTarget(e){return this.settingsTarget===e||e instanceof $&&this.settingsTarget instanceof $&&dt(this.settingsTarget,e)||(this.settingsTarget=e,this._onDidTargetChange.fire(this.settingsTarget)),Promise.resolve(void 0)}async update(){this.settingsSwitcherBar.domNode.classList.toggle("empty-workbench",this.contextService.getWorkbenchState()===Ir.EMPTY),this.userRemoteSettings.enabled=!!(this.options.enableRemoteSettings&&this.environmentService.remoteAuthority),this.workspaceSettings.enabled=this.contextService.getWorkbenchState()!==Ir.EMPTY,this.folderSettings.action.enabled=this.contextService.getWorkbenchState()===Ir.WORKSPACE&&this.contextService.getWorkspace().folders.length>0,this.workspaceSettings.tooltip=c(8894,"Workspace")}};om=D([u(2,bs),u(3,F),u(4,ri),u(5,$i),u(6,ar)],om);let Oh=class extends Ac{constructor(e,t,i,s,o,n){super(),this.options=t,this.contextViewService=i,this.instantiationService=s,this.contextKeyService=o,this.keybindingService=n,this._onDidChange=this._register(new E),this.onDidChange=this._onDidChange.event,this._onFocus=this._register(new E),this.onFocus=this._onFocus.event,this.create(e)}create(e){this.domNode=ge(e,M("div.settings-header-widget")),this.createSearchContainer(ge(this.domNode,M("div.settings-search-container"))),this.controlsDiv=ge(this.domNode,M("div.settings-search-controls")),this.options.showResultCount&&(this.countElement=ge(this.controlsDiv,M(".settings-count-widget")),this.countElement.style.backgroundColor=_n(BC),this.countElement.style.color=_n(FC),this.countElement.style.border=`1px solid ${_n($s)}`),this.inputBox.inputElement.setAttribute("aria-live",this.options.ariaLive||"off"),this.options.ariaLabelledBy&&this.inputBox.inputElement.setAttribute("aria-labelledBy",this.options.ariaLabelledBy);const t=this._register(zn(this.inputBox.inputElement));this._register(t.onDidFocus(()=>this._onFocus.fire()));const i=this.options.focusKey;i&&(this._register(t.onDidFocus(()=>i.set(!0))),this._register(t.onDidBlur(()=>i.set(!1))))}createSearchContainer(e){this.searchContainer=e;const t=ge(this.searchContainer,M("div.settings-search-input"));this.inputBox=this._register(this.createInputBox(t)),this._register(this.inputBox.onDidChange(i=>this._onDidChange.fire(i)))}createInputBox(e){const t=()=>dw(this.keybindingService);return new OC(e,this.contextViewService,{...this.options,showHistoryHint:t},this.contextKeyService)}showMessage(e){this.countElement&&e!==this.countElement.textContent&&(this.countElement.textContent=e,this.inputBox.inputElement.setAttribute("aria-label",e),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}layout(e){e.width<400?(this.countElement?.classList.add("hide"),this.inputBox.inputElement.style.paddingRight="0px"):(this.countElement?.classList.remove("hide"),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}getControlsWidth(){return(this.countElement?NC(this.countElement):0)+20}focus(){this.inputBox.focus(),this.getValue()&&this.inputBox.select()}hasFocus(){return this.inputBox.hasFocus()}clear(){this.inputBox.value=""}getValue(){return this.inputBox.value}setValue(e){return this.inputBox.value=e}dispose(){this.options.focusKey?.set(!1),super.dispose()}};Oh=D([u(2,dr),u(3,F),u(4,se),u(5,it)],Oh);var rn,Nh;Pe(hx);let Bh=class extends Oh{constructor(e,t,i,s,o,n){super(e,t,i,s,o,n),this.recordDisposables=this._register(new O),this._onKeybinding=this._register(new E),this.onKeybinding=this._onKeybinding.event,this._onEnter=this._register(new E),this.onEnter=this._onEnter.event,this._onEscape=this._register(new E),this.onEscape=this._onEscape.event,this._onBlur=this._register(new E),this.onBlur=this._onBlur.event,this._register(ae(()=>this.stopRecordingKeys())),this._chords=null,this._inputValue=""}clear(){this._chords=null,super.clear()}startRecordingKeys(){this.recordDisposables.add(J(this.inputBox.inputElement,te.KEY_DOWN,e=>this._onKeyDown(new Yn(e)))),this.recordDisposables.add(J(this.inputBox.inputElement,te.BLUR,()=>this._onBlur.fire())),this.recordDisposables.add(J(this.inputBox.inputElement,te.INPUT,()=>{this.setInputValue(this._inputValue)}))}stopRecordingKeys(){this._chords=null,this.recordDisposables.clear()}setInputValue(e){this._inputValue=e,this.inputBox.value=this._inputValue}_onKeyDown(e){if(e.preventDefault(),e.stopPropagation(),!this.options.recordEnter&&e.equals(y.Enter)){this._onEnter.fire();return}if(e.equals(y.Escape)){this._onEscape.fire();return}this.printKeybinding(e)}printKeybinding(e){const t=this.keybindingService.resolveKeyboardEvent(e),i=`code: ${e.browserEvent.code}, keyCode: ${e.browserEvent.keyCode}, key: ${e.browserEvent.key} => UI: ${t.getAriaLabel()}, user settings: ${t.getUserSettingsLabel()}, dispatch: ${t.getDispatchChords()[0]}`,s=this.options;this._chords||(this._chords=[]),this._chords.length>0&&this._chords[this._chords.length-1].getDispatchChords()[0]===null?this._chords[this._chords.length-1]=t:(this._chords.length===2&&(this._chords=[]),this._chords.push(t));const n=this._chords.map(r=>r.getUserSettingsLabel()||"").join(" ");this.setInputValue(s.quoteRecordedKeys?`"${n}"`:n),this.inputBox.inputElement.title=i,this._onKeybinding.fire(this._chords)}};Bh=D([u(2,dr),u(3,F),u(4,se),u(5,it)],Bh);var Ns;let Fh=(Ns=class extends Ac{constructor(e,t){super(),this.instantiationService=t,this._keybindingDisposables=this._register(new O),this._chords=null,this._isVisible=!1,this._onHide=this._register(new E),this._onDidChange=this._register(new E),this.onDidChange=this._onDidChange.event,this._onShowExistingKeybindings=this._register(new E),this.onShowExistingKeybidings=this._onShowExistingKeybindings.event,this._domNode=KC(document.createElement("div")),this._domNode.setDisplay("none"),this._domNode.setClassName("defineKeybindingWidget"),this._domNode.setWidth(rn.WIDTH),this._domNode.setHeight(rn.HEIGHT);const i=c(8766,"Press desired key combination and then press ENTER.");ge(this._domNode.domNode,M(".message",void 0,i)),this._domNode.domNode.style.backgroundColor=_n(GC),this._domNode.domNode.style.color=_n(UC),this._domNode.domNode.style.boxShadow=`0 2px 8px ${_n(HC)}`,this._keybindingInputWidget=this._register(this.instantiationService.createInstance(Bh,this._domNode.domNode,{ariaLabel:i,history:new Set([]),inputBoxStyles:Tc})),this._keybindingInputWidget.startRecordingKeys(),this._register(this._keybindingInputWidget.onKeybinding(s=>this.onKeybinding(s))),this._register(this._keybindingInputWidget.onEnter(()=>this.hide())),this._register(this._keybindingInputWidget.onEscape(()=>this.clearOrHide())),this._register(this._keybindingInputWidget.onBlur(()=>this.onCancel())),this._outputNode=ge(this._domNode.domNode,M(".output")),this._showExistingKeybindingsNode=ge(this._domNode.domNode,M(".existing")),e&&ge(e,this._domNode.domNode)}get domNode(){return this._domNode.domNode}define(){return this._keybindingInputWidget.clear(),xp.withAsyncBody(async e=>{this._isVisible||(this._isVisible=!0,this._domNode.setDisplay("block"),this._chords=null,this._keybindingInputWidget.setInputValue(""),es(this._outputNode),es(this._showExistingKeybindingsNode),await Ho(0),this._keybindingInputWidget.focus());const t=this._onHide.event(()=>{e(this.getUserSettingsLabel()),t.dispose()})})}layout(e){const t=Math.round((e.height-rn.HEIGHT)/2);this._domNode.setTop(t);const i=Math.round((e.width-rn.WIDTH)/2);this._domNode.setLeft(i)}printExisting(e){if(e>0){const t=M("span.existingText"),i=e===1?c(8767,"1 existing command has this keybinding",e):c(8768,"{0} existing commands have this keybinding",e);ge(t,document.createTextNode(i)),WC(i),this._showExistingKeybindingsNode.appendChild(t),t.onmousedown=s=>{s.preventDefault()},t.onmouseup=s=>{s.preventDefault()},t.onclick=()=>{this._onShowExistingKeybindings.fire(this.getUserSettingsLabel())}}}onKeybinding(e){if(this._keybindingDisposables.clear(),this._chords=e,es(this._outputNode),es(this._showExistingKeybindingsNode),this._keybindingDisposables.add(new Og(this._outputNode,$t,Ng)).set(this._chords?.[0]??void 0),this._chords)for(let s=1;s<this._chords.length;s++)this._outputNode.appendChild(document.createTextNode(c(8769,"chord to"))),this._keybindingDisposables.add(new Og(this._outputNode,$t,Ng)).set(this._chords[s]);const i=this.getUserSettingsLabel();i&&this._onDidChange.fire(i)}getUserSettingsLabel(){let e=null;return this._chords&&(e=this._chords.map(t=>t.getUserSettingsLabel()).join(" ")),e}onCancel(){this._chords=null,this.hide()}clearOrHide(){this._chords===null?this.hide():(this._chords=null,this._keybindingInputWidget.clear(),es(this._outputNode),es(this._showExistingKeybindingsNode))}hide(){this._domNode.setDisplay("none"),this._isVisible=!1,this._onHide.fire()}},rn=Ns,Ns.WIDTH=400,Ns.HEIGHT=110,Ns);Fh=rn=D([u(1,F)],Fh);var _o;let Kh=(_o=class extends R{constructor(e,t){super(),this._editor=e,this._widget=this._register(t.createInstance(Fh,null)),this._editor.addOverlayWidget(this)}getId(){return Nh.ID}getDomNode(){return this._widget.domNode}getPosition(){return{preference:null}}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}start(){this._editor.hasModel()&&this._editor.revealPositionInCenterIfOutsideViewport(this._editor.getPosition(),ft.Smooth);const e=this._editor.getLayoutInfo();return this._widget.layout(new jt(e.width,e.height)),this._widget.define()}},Nh=_o,_o.ID="editor.contrib.defineKeybindingWidget",_o);Kh=Nh=D([u(1,F)],Kh);var Wh;const px=c(8803,"You won't be able to produce this key combination under your current keyboard layout.");let Gh=class extends R{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._userDataProfileService=i,this._keybindingDecorationRenderer=this._register(new Ie),this._defineWidget=this._register(this._instantiationService.createInstance(Kh,this._editor)),this._register(this._editor.onDidChangeModel(s=>this._update())),this._update()}_update(){this._keybindingDecorationRenderer.value=nm(this._editor,this._userDataProfileService)?this._instantiationService.createInstance(Uh,this._editor):void 0}showDefineKeybindingWidget(){nm(this._editor,this._userDataProfileService)&&this._defineWidget.start().then(e=>this._onAccepted(e))}_onAccepted(e){if(this._editor.focus(),e&&this._editor.hasModel()){new RegExp(/\\/g).test(e)&&(e=e.slice(0,-1)+"\\\\");let s=["{",' "key": '+JSON.stringify(e)+",",' "command": "${1:commandId}",',' "when": "${2:editorTextFocus}"',"}$0"].join(`
|
|
29
|
+
`);const o=lx.insertSnippet(this._editor.getModel(),this._editor.getPosition());s=o.prepend+s+o.append,this._editor.setPosition(o.position),cw.get(this._editor)?.insert(s,{overwriteBefore:0,overwriteAfter:0})}}};Gh=D([u(1,F),u(2,Pp)],Gh);let Uh=Wh=class extends R{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._dec=this._editor.createDecorationsCollection(),this._updateDecorations=this._register(new Ca(()=>this._updateDecorationsNow(),500));const i=Ee(this._editor.getModel());this._register(i.onDidChangeContent(()=>this._updateDecorations.schedule())),this._register(this._keybindingService.onDidUpdateKeybindings(()=>this._updateDecorations.schedule())),this._register({dispose:()=>{this._dec.clear(),this._updateDecorations.cancel()}}),this._updateDecorations.schedule()}_updateDecorationsNow(){const e=Ee(this._editor.getModel()),t=[],i=$C(e.getValue());if(i&&Array.isArray(i.children))for(let s=0,o=i.children.length;s<o;s++){const n=i.children[s],r=this._getDecorationForEntry(e,n);r!==null&&t.push(r)}this._dec.set(t)}_getDecorationForEntry(e,t){if(!Array.isArray(t.children))return null;for(let i=0,s=t.children.length;i<s;i++){const o=t.children[i];if(o.type!=="property"||!Array.isArray(o.children)||o.children.length!==2||o.children[0].value!=="key")continue;const r=o.children[1];if(r.type!=="string")continue;const d=this._keybindingService.resolveUserBinding(r.value);if(d.length===0)return this._createDecoration(!0,null,null,e,r);const l=d[0];let h=null;if(l instanceof Rr&&(h=l.getUSLabel()),!l.isWYSIWYG()){const f=l.getLabel();return typeof f=="string"&&r.value.toLowerCase()===f.toLowerCase()?null:this._createDecoration(!1,l.getLabel(),h,e,r)}if(/abnt_|oem_/.test(r.value))return this._createDecoration(!1,l.getLabel(),h,e,r);const p=l.getUserSettingsLabel();return typeof p=="string"&&!Wh._userSettingsFuzzyEquals(r.value,p)?this._createDecoration(!1,l.getLabel(),h,e,r):null}return null}static _userSettingsFuzzyEquals(e,t){if(e=e.trim().toLowerCase(),t=t.trim().toLowerCase(),e===t)return!0;const i=ca.parseKeybinding(e),s=ca.parseKeybinding(t);return i===null&&s===null?!0:!i||!s?!1:i.equals(s)}_createDecoration(e,t,i,s,o){let n,r,d;e?(n=new wi().appendText(px),r="keybindingError",d=Sd(qC)):(i&&t!==i?n=new wi(c(8804,"**{0}** for your current keyboard layout (**{1}** for US standard).",t,i)):n=new wi(c(8805,"**{0}** for your current keyboard layout.",t)),r="keybindingInfo",d=Sd(jC));const l=s.getPositionAt(o.offset),h=s.getPositionAt(o.offset+o.length);return{range:new ve(l.lineNumber,l.column,h.lineNumber,h.column),options:{description:"keybindings-widget",stickiness:Op.NeverGrowsWhenTypingAtEdges,className:r,hoverMessage:n,overviewRuler:{color:d,position:lr.Right}}}}};Uh=Wh=D([u(1,it)],Uh);function nm(a,e){const t=a.getModel();return t?dt(t.uri,e.currentProfile.keybindingsResource):!1}xc(zC,Gh,kc.AfterFirstRender);class gx extends X{constructor(){super({id:"runCommands",title:x(5374,"Run Commands"),f1:!1,metadata:{description:c(5375,"Run several commands"),args:[{name:"args",schema:{type:"object",required:["commands"],properties:{commands:{type:"array",description:c(5376,"Commands to run"),items:{anyOf:[{$ref:"vscode://schemas/keybindings#/definitions/commandNames"},{type:"string"},{type:"object",required:["command"],properties:{command:{anyOf:[{$ref:"vscode://schemas/keybindings#/definitions/commandNames"},{type:"string"}]}},$ref:"vscode://schemas/keybindings#/definitions/commandsSchemas"}]}}}}}]}})}async run(e,t){const i=e.get(Ke);if(!this._isCommandArgs(t)){i.error(c(5377,"'runCommands' has received an argument with incorrect type. Please, review the argument passed to the command."));return}if(t.commands.length===0){i.warn(c(5378,"'runCommands' has not received commands to run. Did you forget to pass commands in the 'runCommands' argument?"));return}const s=e.get(wt),o=e.get(Ue);let n=0;try{for(;n<t.commands.length;++n){const r=t.commands[n];o.debug(`runCommands: executing ${n}-th command: ${Bg(r)}`),await this._runCommand(s,r),o.debug(`runCommands: executed ${n}-th command`)}}catch(r){o.debug(`runCommands: executing ${n}-th command resulted in an error: ${r instanceof Error?r.message:Bg(r)}`),i.error(r)}}_isCommandArgs(e){if(!e||typeof e!="object"||!("commands"in e)||!Array.isArray(e.commands))return!1;for(const t of e.commands)if(typeof t!="string"&&!(typeof t=="object"&&typeof t.command=="string"))return!1;return!0}_runCommand(e,t){let i,s;return typeof t=="string"?i=t:(i=t.command,s=t.args),s===void 0?e.executeCommand(i):Array.isArray(s)?e.executeCommand(i,...s):e.executeCommand(i,s)}}b(gx);$.from({scheme:pe.vscodeUserData,path:"/User/keybindings.json"});let Hh=class extends kh{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g){super(t,i,s,o,n,r,d,l,h,p,f,g),this.shouldUseGlobalKeybindings=e,this.keybindingProviders=[]}registerKeybindingProvider(e){this.keybindingProviders.push(e),this.updateResolver();const t=new O;return t.add(e.onDidChangeKeybindings(()=>{this.updateResolver()})),t.add(ae(()=>{const i=this.keybindingProviders.indexOf(e);i>=0&&(this.keybindingProviders.splice(i,1),this.updateResolver())})),t}_getResolver(){return super._getResolver()}_dispatch(e,t){return this.shouldUseGlobalKeybindings()?super._dispatch(e,t):!1}getUserKeybindingItems(){return[...super.getUserKeybindingItems(),...this.keybindingProviders.flatMap(e=>e.provideKeybindings())]}};Hh=D([u(1,se),u(2,wt),u(3,mt),u(4,Ke),u(5,Pp),u(6,Zt),u(7,At),u(8,Le),u(9,rr),u(10,Ue),u(11,Sa),u(12,_a)],Hh);function rV({shouldUseGlobalKeybindings:a=()=>!1}={}){return{...YC(),[it.toString()]:new ee(Hh,[a],!1),[Sa.toString()]:new ee(Vh,[],!0),[wt.toString()]:new ee(Ph,[],!0)}}function Tv(a){return`${a}.hidden`}let zh=class extends R{constructor(e,t,i,s){super(),this.viewContainerName=t,this.storageService=i,this._onDidChangeStoredState=this._register(new E),this.onDidChangeStoredState=this._onDidChangeStoredState.event,this.logger=new Np(()=>s.createLogger(Bp,{name:Kp,group:Fp})),this.globalViewsStateStorageId=Tv(e),this.workspaceViewsStateStorageId=e,this._register(this.storageService.onDidChangeValue(H.PROFILE,this.globalViewsStateStorageId,this._store)(()=>this.onDidStorageChange())),this.state=this.initialize()}set(e,t){this.state.set(e,t)}get(e){return this.state.get(e)}updateState(e){this.updateWorkspaceState(e),this.updateGlobalState(e)}updateWorkspaceState(e){const t=this.getStoredWorkspaceState();for(const i of e){const s=this.get(i.id);s&&(t[i.id]={collapsed:!!s.collapsed,isHidden:!s.visibleWorkspace,size:s.size,order:i.workspace&&s?s.order:void 0})}Object.keys(t).length>0?this.storageService.store(this.workspaceViewsStateStorageId,JSON.stringify(t),H.WORKSPACE,Re.MACHINE):this.storageService.remove(this.workspaceViewsStateStorageId,H.WORKSPACE)}updateGlobalState(e){const t=this.getStoredGlobalState();for(const i of e){const s=this.get(i.id);t.set(i.id,{id:i.id,isHidden:s&&i.canToggleVisibility?!s.visibleGlobal:!1,order:!i.workspace&&s?s.order:void 0})}this.setStoredGlobalState(t)}onDidStorageChange(){if(this.globalViewsStatesValue!==this.getStoredGlobalViewsStatesValue()){this._globalViewsStatesValue=void 0;const e=this.getStoredGlobalState(),t=this.getStoredWorkspaceState(),i=[];for(const[s,o]of e){const n=this.get(s);if(n)n.visibleGlobal!==!o.isHidden&&(o.isHidden||this.logger.value.trace(`View visibility state changed: ${s} is now visible`,this.viewContainerName),i.push({id:s,visible:!o.isHidden}));else{const r=t[s];this.set(s,{active:!1,visibleGlobal:!o.isHidden,visibleWorkspace:Er(r?.isHidden)?void 0:!r?.isHidden,collapsed:r?.collapsed,order:r?.order,size:r?.size})}}if(i.length){this._onDidChangeStoredState.fire(i);for(const s of i){const o=this.get(s.id);o&&(o.visibleGlobal=s.visible)}}}}initialize(){const e=new Map,t=this.getStoredWorkspaceState();for(const r of Object.keys(t)){const d=t[r];e.set(r,{active:!1,visibleGlobal:void 0,visibleWorkspace:Er(d.isHidden)?void 0:!d.isHidden,collapsed:d.collapsed,order:d.order,size:d.size})}const i=this.storageService.get(this.globalViewsStateStorageId,H.WORKSPACE,"[]"),{state:s}=this.parseStoredGlobalState(i);if(s.size>0){for(const{id:r,isHidden:d}of s.values()){const l=e.get(r);l?Er(l.visibleWorkspace)&&(l.visibleWorkspace=!d):e.set(r,{active:!1,collapsed:void 0,visibleGlobal:void 0,visibleWorkspace:!d})}this.storageService.remove(this.globalViewsStateStorageId,H.WORKSPACE)}const{state:o,hasDuplicates:n}=this.parseStoredGlobalState(this.globalViewsStatesValue);n&&this.setStoredGlobalState(o);for(const{id:r,isHidden:d,order:l}of o.values()){const h=e.get(r);h?(h.visibleGlobal=!d,Er(l)||(h.order=l)):e.set(r,{active:!1,visibleGlobal:!d,order:l,collapsed:void 0,visibleWorkspace:void 0})}return e}getStoredWorkspaceState(){return JSON.parse(this.storageService.get(this.workspaceViewsStateStorageId,H.WORKSPACE,"{}"))}getStoredGlobalState(){return this.parseStoredGlobalState(this.globalViewsStatesValue).state}setStoredGlobalState(e){this.globalViewsStatesValue=JSON.stringify([...e.values()])}parseStoredGlobalState(e){const t=JSON.parse(e);let i=!1;return{state:t.reduce((o,n)=>(typeof n=="string"?(i=i||o.has(n),o.set(n,{id:n,isHidden:!0})):(i=i||o.has(n.id),o.set(n.id,n)),o),new Map),hasDuplicates:i}}get globalViewsStatesValue(){return this._globalViewsStatesValue||(this._globalViewsStatesValue=this.getStoredGlobalViewsStatesValue()),this._globalViewsStatesValue}set globalViewsStatesValue(e){this.globalViewsStatesValue!==e&&(this._globalViewsStatesValue=e,this.setStoredGlobalViewsStatesValue(e))}getStoredGlobalViewsStatesValue(){return this.storageService.get(this.globalViewsStateStorageId,H.PROFILE,"[]")}setStoredGlobalViewsStatesValue(e){this.storageService.store(this.globalViewsStateStorageId,e,H.PROFILE,Re.USER)}};zh=D([u(2,ce),u(3,Wp)],zh);let $h=class extends R{get title(){return this._title}get icon(){return this._icon}get keybindingId(){return this._keybindingId}get allViewDescriptors(){return this.viewDescriptorItems.map(e=>e.viewDescriptor)}get activeViewDescriptors(){return this.viewDescriptorItems.filter(e=>e.state.active).map(e=>e.viewDescriptor)}get visibleViewDescriptors(){return this.viewDescriptorItems.filter(e=>this.isViewDescriptorVisible(e)).map(e=>e.viewDescriptor)}constructor(e,t,i,s){super(),this.viewContainer=e,this.contextKeyService=i,this.contextKeys=new JC,this.viewDescriptorItems=[],this._onDidChangeContainerInfo=this._register(new E),this.onDidChangeContainerInfo=this._onDidChangeContainerInfo.event,this._onDidChangeAllViewDescriptors=this._register(new E),this.onDidChangeAllViewDescriptors=this._onDidChangeAllViewDescriptors.event,this._onDidChangeActiveViewDescriptors=this._register(new E),this.onDidChangeActiveViewDescriptors=this._onDidChangeActiveViewDescriptors.event,this._onDidAddVisibleViewDescriptors=this._register(new E),this.onDidAddVisibleViewDescriptors=this._onDidAddVisibleViewDescriptors.event,this._onDidRemoveVisibleViewDescriptors=this._register(new E),this.onDidRemoveVisibleViewDescriptors=this._onDidRemoveVisibleViewDescriptors.event,this._onDidMoveVisibleViewDescriptors=this._register(new E),this.onDidMoveVisibleViewDescriptors=this._onDidMoveVisibleViewDescriptors.event,this.logger=new Np(()=>s.createLogger(Bp,{name:Kp,group:Fp})),this._register(L.filter(i.onDidChangeContext,o=>o.affectsSome(this.contextKeys))(()=>this.onDidChangeContext())),this.viewDescriptorsState=this._register(t.createInstance(zh,e.storageId||`${e.id}.state`,typeof e.title=="string"?e.title:e.title.original)),this._register(this.viewDescriptorsState.onDidChangeStoredState(o=>this.updateVisibility(o))),this.updateContainerInfo()}updateContainerInfo(){const e=this.viewContainer.alwaysUseContainerInfo||this.visibleViewDescriptors.length===0||this.visibleViewDescriptors.some(d=>z.as(pt.ViewsRegistry).getViewContainer(d.id)===this.viewContainer),t=e?typeof this.viewContainer.title=="string"?this.viewContainer.title:this.viewContainer.title.value:this.visibleViewDescriptors[0]?.containerTitle||this.visibleViewDescriptors[0]?.name?.value||"";let i=!1;this._title!==t&&(this._title=t,i=!0);const s=e?this.viewContainer.icon:this.visibleViewDescriptors[0]?.containerIcon||lw;let o=!1;this.isEqualIcon(s)||(this._icon=s,o=!0);const n=this.viewContainer.openCommandActionDescriptor?.id??this.activeViewDescriptors.find(d=>d.openCommandActionDescriptor)?.openCommandActionDescriptor?.id;let r=!1;this._keybindingId!==n&&(this._keybindingId=n,r=!0),(i||o||r)&&this._onDidChangeContainerInfo.fire({title:i,icon:o,keybindingId:r})}isEqualIcon(e){return $.isUri(e)?$.isUri(this._icon)&&dt(e,this._icon):Ce.isThemeIcon(e)?Ce.isThemeIcon(this._icon)&&Ce.isEqual(e,this._icon):e===this._icon}isVisible(e){const t=this.viewDescriptorItems.find(i=>i.viewDescriptor.id===e);if(!t)throw new Error(`Unknown view ${e}`);return this.isViewDescriptorVisible(t)}setVisible(e,t){this.updateVisibility([{id:e,visible:t}])}updateVisibility(e){const t=Ss(e.filter(({visible:o})=>!o).map(({id:o})=>this.findAndIgnoreIfNotFound(o))),i=[];for(const{viewDescriptorItem:o,visibleIndex:n}of t)this.updateViewDescriptorItemVisibility(o,!1)&&i.push({viewDescriptor:o.viewDescriptor,index:n});i.length&&this.broadCastRemovedVisibleViewDescriptors(i);const s=[];for(const{id:o,visible:n}of e){if(!n)continue;const r=this.findAndIgnoreIfNotFound(o);if(!r)continue;const{viewDescriptorItem:d,visibleIndex:l}=r;this.updateViewDescriptorItemVisibility(d,!0)&&s.push({index:l,viewDescriptor:d.viewDescriptor,size:d.state.size,collapsed:!!d.state.collapsed})}s.length&&this.broadCastAddedVisibleViewDescriptors(s)}updateViewDescriptorItemVisibility(e,t){return!e.viewDescriptor.canToggleVisibility||this.isViewDescriptorVisibleWhenActive(e)===t?!1:(e.viewDescriptor.workspace?e.state.visibleWorkspace=t:(e.state.visibleGlobal=t,t&&this.logger.value.trace(`Showing view ${e.viewDescriptor.id} in the container ${this.viewContainer.id}`)),this.isViewDescriptorVisible(e)===t)}isCollapsed(e){return!!this.find(e).viewDescriptorItem.state.collapsed}setCollapsed(e,t){const{viewDescriptorItem:i}=this.find(e);i.state.collapsed!==t&&(i.state.collapsed=t),this.viewDescriptorsState.updateState(this.allViewDescriptors)}getSize(e){return this.find(e).viewDescriptorItem.state.size}setSizes(e){for(const{id:t,size:i}of e){const{viewDescriptorItem:s}=this.find(t);s.state.size!==i&&(s.state.size=i)}this.viewDescriptorsState.updateState(this.allViewDescriptors)}move(e,t){const i=this.viewDescriptorItems.findIndex(r=>r.viewDescriptor.id===e),s=this.viewDescriptorItems.findIndex(r=>r.viewDescriptor.id===t),o=this.viewDescriptorItems[i],n=this.viewDescriptorItems[s];ZC(this.viewDescriptorItems,i,s);for(let r=0;r<this.viewDescriptorItems.length;r++)this.viewDescriptorItems[r].state.order=r;this.broadCastMovedViewDescriptors({index:i,viewDescriptor:o.viewDescriptor},{index:s,viewDescriptor:n.viewDescriptor})}add(e){const t=[];for(const o of e){const n=o.viewDescriptor;if(n.when)for(const d of n.when.keys())this.contextKeys.add(d);let r=this.viewDescriptorsState.get(n.id);if(r){if(n.workspace)r.visibleWorkspace=ji(o.visible)?ji(r.visibleWorkspace)?!n.hideByDefault:r.visibleWorkspace:o.visible;else{const d=r.visibleGlobal;r.visibleGlobal=ji(o.visible)?ji(r.visibleGlobal)?!n.hideByDefault:r.visibleGlobal:o.visible,r.visibleGlobal&&!d&&this.logger.value.trace(`Added view ${n.id} in the container ${this.viewContainer.id} and showing it.`,`${d}`,`${n.hideByDefault}`,`${o.visible}`)}r.collapsed=ji(o.collapsed)?ji(r.collapsed)?!!n.collapsed:r.collapsed:o.collapsed}else r={active:!1,visibleGlobal:ji(o.visible)?!n.hideByDefault:o.visible,visibleWorkspace:ji(o.visible)?!n.hideByDefault:o.visible,collapsed:ji(o.collapsed)?!!n.collapsed:o.collapsed};this.viewDescriptorsState.set(n.id,r),r.active=this.contextKeyService.contextMatchesRules(n.when),t.push({viewDescriptor:n,state:r})}this.viewDescriptorItems.push(...t),this.viewDescriptorItems.sort(this.compareViewDescriptors.bind(this)),this._onDidChangeAllViewDescriptors.fire({added:t.map(({viewDescriptor:o})=>o),removed:[]});const i=[];for(const o of t)o.state.active&&i.push({viewDescriptorItem:o,visible:this.isViewDescriptorVisible(o)});i.length&&this._onDidChangeActiveViewDescriptors.fire({added:i.map(({viewDescriptorItem:o})=>o.viewDescriptor),removed:[]});const s=[];for(const{viewDescriptorItem:o,visible:n}of i)if(n&&this.isViewDescriptorVisible(o)){const{visibleIndex:r}=this.find(o.viewDescriptor.id);s.push({index:r,viewDescriptor:o.viewDescriptor,size:o.state.size,collapsed:!!o.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(s)}remove(e){const t=[],i=[],s=[],o=[];for(const n of e){if(n.when)for(const d of n.when.keys())this.contextKeys.delete(d);const r=this.viewDescriptorItems.findIndex(d=>d.viewDescriptor.id===n.id);if(r!==-1){t.push(n);const d=this.viewDescriptorItems[r];if(d.state.active&&s.push(d.viewDescriptor),this.isViewDescriptorVisible(d)){const{visibleIndex:l}=this.find(d.viewDescriptor.id);o.push({index:l,viewDescriptor:d.viewDescriptor})}i.push(d)}}i.forEach(n=>this.viewDescriptorItems.splice(this.viewDescriptorItems.indexOf(n),1)),this.broadCastRemovedVisibleViewDescriptors(o),s.length&&this._onDidChangeActiveViewDescriptors.fire({added:[],removed:s}),t.length&&this._onDidChangeAllViewDescriptors.fire({added:[],removed:t})}onDidChangeContext(){const e=[],t=[];for(const o of this.viewDescriptorItems){const n=o.state.active,r=this.contextKeyService.contextMatchesRules(o.viewDescriptor.when);n!==r&&(r?e.push({item:o,visibleWhenActive:this.isViewDescriptorVisibleWhenActive(o)}):t.push(o))}const i=[];for(const o of t)if(this.isViewDescriptorVisible(o)){const{visibleIndex:n}=this.find(o.viewDescriptor.id);i.push({index:n,viewDescriptor:o.viewDescriptor})}t.forEach(o=>o.state.active=!1),e.forEach(({item:o})=>o.state.active=!0),this.broadCastRemovedVisibleViewDescriptors(i),(e.length||t.length)&&this._onDidChangeActiveViewDescriptors.fire({added:e.map(({item:o})=>o.viewDescriptor),removed:t.map(o=>o.viewDescriptor)});const s=[];for(const{item:o,visibleWhenActive:n}of e)if(n&&this.isViewDescriptorVisible(o)){const{visibleIndex:r}=this.find(o.viewDescriptor.id);s.push({index:r,viewDescriptor:o.viewDescriptor,size:o.state.size,collapsed:!!o.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(s)}broadCastAddedVisibleViewDescriptors(e){e.length&&(this._onDidAddVisibleViewDescriptors.fire(e.sort((t,i)=>t.index-i.index)),this.updateState(`Added views:${e.map(t=>t.viewDescriptor.id).join(",")} in ${this.viewContainer.id}`))}broadCastRemovedVisibleViewDescriptors(e){e.length&&(this._onDidRemoveVisibleViewDescriptors.fire(e.sort((t,i)=>i.index-t.index)),this.updateState(`Removed views:${e.map(t=>t.viewDescriptor.id).join(",")} from ${this.viewContainer.id}`))}broadCastMovedViewDescriptors(e,t){this._onDidMoveVisibleViewDescriptors.fire({from:e,to:t}),this.updateState(`Moved view ${e.viewDescriptor.id} to ${t.viewDescriptor.id} in ${this.viewContainer.id}`)}updateState(e){this.logger.value.trace(e),this.viewDescriptorsState.updateState(this.allViewDescriptors),this.updateContainerInfo()}isViewDescriptorVisible(e){return e.state.active?this.isViewDescriptorVisibleWhenActive(e):!1}isViewDescriptorVisibleWhenActive(e){return e.viewDescriptor.workspace?!!e.state.visibleWorkspace:!!e.state.visibleGlobal}find(e){const t=this.findAndIgnoreIfNotFound(e);if(t)return t;throw new Error(`view descriptor ${e} not found`)}findAndIgnoreIfNotFound(e){for(let t=0,i=0;t<this.viewDescriptorItems.length;t++){const s=this.viewDescriptorItems[t];if(s.viewDescriptor.id===e)return{index:t,visibleIndex:i,viewDescriptorItem:s};this.isViewDescriptorVisible(s)&&i++}}compareViewDescriptors(e,t){return e.viewDescriptor.id===t.viewDescriptor.id?0:this.getViewOrder(e)-this.getViewOrder(t)||this.getGroupOrderResult(e.viewDescriptor,t.viewDescriptor)}getViewOrder(e){const t=typeof e.state.order=="number"?e.state.order:e.viewDescriptor.order;return typeof t=="number"?t:Number.MAX_VALUE}getGroupOrderResult(e,t){return!e.group||!t.group||e.group===t.group?0:e.group<t.group?-1:1}};$h=D([u(1,F),u(2,se),u(3,Wp)],$h);var ki;function rm(a){return`${a}.state`}var Bs;let qh=(Bs=class extends R{get viewContainers(){return this.viewContainersRegistry.all}constructor(e,t,i,s,o,n){super(),this.instantiationService=e,this.contextKeyService=t,this.storageService=i,this.extensionService=s,this.telemetryService=o,this._onDidChangeContainer=this._register(new E),this.onDidChangeContainer=this._onDidChangeContainer.event,this._onDidChangeLocation=this._register(new E),this.onDidChangeLocation=this._onDidChangeLocation.event,this._onDidChangeContainerLocation=this._register(new E),this.onDidChangeContainerLocation=this._onDidChangeContainerLocation.event,this.viewContainerModels=this._register(new Cd),this.viewsVisibilityActionDisposables=this._register(new Cd),this.canRegisterViewsVisibilityActions=!1,this._onDidChangeViewContainers=this._register(new E),this.onDidChangeViewContainers=this._onDidChangeViewContainers.event,this.logger=new Np(()=>n.createLogger(Bp,{name:Kp,group:Fp})),this.activeViewContextKeys=new Map,this.movableViewContextKeys=new Map,this.defaultViewLocationContextKeys=new Map,this.defaultViewContainerLocationContextKeys=new Map,this.viewContainersRegistry=z.as(pt.ViewContainersRegistry),this.viewsRegistry=z.as(pt.ViewsRegistry),this.migrateToViewsCustomizationsStorage(),this.viewContainersCustomLocations=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),this.viewDescriptorsCustomLocations=new Map(Object.entries(this.viewCustomizations.viewLocations)),this.viewContainerBadgeEnablementStates=new Map(Object.entries(this.viewCustomizations.viewContainerBadgeEnablementStates)),this.viewContainers.forEach(r=>this.onDidRegisterViewContainer(r)),this._register(this.viewsRegistry.onViewsRegistered(r=>this.onDidRegisterViews(r))),this._register(this.viewsRegistry.onViewsDeregistered(({views:r,viewContainer:d})=>this.onDidDeregisterViews(r,d))),this._register(this.viewsRegistry.onDidChangeContainer(({views:r,from:d,to:l})=>this.onDidChangeDefaultContainer(r,d,l))),this._register(this.viewContainersRegistry.onDidRegister(({viewContainer:r})=>{this.onDidRegisterViewContainer(r),this._onDidChangeViewContainers.fire({added:[{container:r,location:this.getViewContainerLocation(r)}],removed:[]})})),this._register(this.viewContainersRegistry.onDidDeregister(({viewContainer:r,viewContainerLocation:d})=>{this.onDidDeregisterViewContainer(r),this._onDidChangeViewContainers.fire({removed:[{container:r,location:d}],added:[]})})),this._register(this.storageService.onDidChangeValue(H.PROFILE,ki.VIEWS_CUSTOMIZATIONS,this._store)(()=>this.onDidStorageChange())),this.extensionService.whenInstalledExtensionsRegistered().then(()=>this.whenExtensionsRegistered())}migrateToViewsCustomizationsStorage(){if(this.storageService.get(ki.VIEWS_CUSTOMIZATIONS,H.PROFILE))return;const e=this.storageService.get("views.cachedViewContainerLocations",H.PROFILE),t=this.storageService.get("views.cachedViewPositions",H.PROFILE);if(!e&&!t)return;const i=e?JSON.parse(e):[],s=t?JSON.parse(t):[],o={viewContainerLocations:i.reduce((n,[r,d])=>(n[r]=d,n),{}),viewLocations:s.reduce((n,[r,{containerId:d}])=>(n[r]=d,n),{}),viewContainerBadgeEnablementStates:{}};this.storageService.store(ki.VIEWS_CUSTOMIZATIONS,JSON.stringify(o),H.PROFILE,Re.USER),this.storageService.remove("views.cachedViewContainerLocations",H.PROFILE),this.storageService.remove("views.cachedViewPositions",H.PROFILE)}registerGroupedViews(e){for(const[t,i]of e.entries()){const s=this.viewContainersRegistry.get(t);if(!s||!this.viewContainerModels.has(s)){if(this.isGeneratedContainerId(t)){const n=this.viewContainersCustomLocations.get(t);n!==void 0&&this.registerGeneratedViewContainer(n,t)}continue}const o=i.filter(n=>this.getViewContainerModel(s).allViewDescriptors.filter(r=>r.id===n.id).length===0);this.addViews(s,o)}}deregisterGroupedViews(e){for(const[t,i]of e.entries()){const s=this.viewContainersRegistry.get(t);!s||!this.viewContainerModels.has(s)||this.removeViews(s,i)}}moveOrphanViewsToDefaultLocation(){for(const[e,t]of this.viewDescriptorsCustomLocations.entries()){if(this.viewContainersRegistry.get(t))continue;const i=this.viewsRegistry.getViewContainer(e),s=this.getViewDescriptorById(e);i&&s&&this.addViews(i,[s])}}whenExtensionsRegistered(){this.moveOrphanViewsToDefaultLocation();for(const e of[...this.viewContainersCustomLocations.keys()])this.cleanUpGeneratedViewContainer(e);this.saveViewCustomizations();for(const[e,t]of this.viewContainerModels)this.registerViewsVisibilityActions(e,t);this.canRegisterViewsVisibilityActions=!0}onDidRegisterViews(e){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(({views:t,viewContainer:i})=>{const s=this.regroupViews(i.id,t);this.registerGroupedViews(s),t.forEach(o=>this.getOrCreateMovableViewContextKey(o).set(!!o.canMoveView))})})}isGeneratedContainerId(e){return e.startsWith(ki.COMMON_CONTAINER_ID_PREFIX)}onDidDeregisterViews(e,t){const i=this.regroupViews(t.id,e);this.deregisterGroupedViews(i),this.contextKeyService.bufferChangeEvents(()=>{e.forEach(s=>this.getOrCreateMovableViewContextKey(s).set(!1))})}regroupViews(e,t){const i=new Map;for(const s of t){const o=this.viewDescriptorsCustomLocations.get(s.id)??e;let n=i.get(o);n||i.set(o,n=[]),n.push(s)}return i}getViewDescriptorById(e){return this.viewsRegistry.getView(e)}getViewLocationById(e){const t=this.getViewContainerByViewId(e);return t===null?null:this.getViewContainerLocation(t)}getViewContainerByViewId(e){const t=this.viewDescriptorsCustomLocations.get(e);return t?this.viewContainersRegistry.get(t)??null:this.getDefaultContainerById(e)}getViewContainerLocation(e){return this.viewContainersCustomLocations.get(e.id)??this.getDefaultViewContainerLocation(e)}getDefaultViewContainerLocation(e){return this.viewContainersRegistry.getViewContainerLocation(e)}getDefaultContainerById(e){return this.viewsRegistry.getViewContainer(e)??null}getViewContainerModel(e){return this.getOrRegisterViewContainerModel(e)}getViewContainerById(e){return this.viewContainersRegistry.get(e)||null}getViewContainersByLocation(e){return this.viewContainers.filter(t=>this.getViewContainerLocation(t)===e)}getDefaultViewContainer(e){return this.viewContainersRegistry.getDefaultViewContainer(e)}moveViewContainerToLocation(e,t,i,s){this.logger.value.trace(`moveViewContainerToLocation: viewContainer:${e.id} location:${t} reason:${s}`),this.moveViewContainerToLocationWithoutSaving(e,t,i),this.saveViewCustomizations()}getViewContainerBadgeEnablementState(e){return this.viewContainerBadgeEnablementStates.get(e)??!0}setViewContainerBadgeEnablementState(e,t){this.viewContainerBadgeEnablementStates.set(e,t),this.saveViewCustomizations()}moveViewToLocation(e,t,i){this.logger.value.trace(`moveViewToLocation: view:${e.id} location:${t} reason:${i}`);const s=this.registerGeneratedViewContainer(t);this.moveViewsToContainer([e],s)}moveViewsToContainer(e,t,i,s){if(!e.length)return;this.logger.value.trace(`moveViewsToContainer: views:${e.map(r=>r.id).join(",")} viewContainer:${t.id} reason:${s}`);const o=this.getViewContainerByViewId(e[0].id),n=t;o&&n&&o!==n&&(this.moveViewsWithoutSaving(e,o,n,i),this.cleanUpGeneratedViewContainer(o.id),this.saveViewCustomizations(),this.reportMovedViews(e,o,n))}reset(){for(const e of this.viewContainers){const t=this.getViewContainerModel(e);for(const o of t.allViewDescriptors){const n=this.getDefaultContainerById(o.id),r=this.getViewContainerByViewId(o.id);r&&n&&r!==n&&this.moveViewsWithoutSaving([o],r,n)}const i=this.getDefaultViewContainerLocation(e),s=this.getViewContainerLocation(e);i!==null&&s!==i&&this.moveViewContainerToLocationWithoutSaving(e,i),this.cleanUpGeneratedViewContainer(e.id)}this.viewContainersCustomLocations.clear(),this.viewDescriptorsCustomLocations.clear(),this.saveViewCustomizations()}isViewContainerRemovedPermanently(e){return this.isGeneratedContainerId(e)&&!this.viewContainersCustomLocations.has(e)}onDidChangeDefaultContainer(e,t,i){const s=e.filter(o=>!this.viewDescriptorsCustomLocations.has(o.id)||!this.viewContainers.includes(t)&&this.viewDescriptorsCustomLocations.get(o.id)===t.id);s.length&&this.moveViewsWithoutSaving(s,t,i)}reportMovedViews(e,t,i){const s=f=>f.id.startsWith(ki.COMMON_CONTAINER_ID_PREFIX)?"custom":f.extensionId?"extension":f.id,o=this.getViewContainerLocation(t),n=this.getViewContainerLocation(i),r=e.length,d=s(t),l=s(i),h=o===Y.Panel?"panel":"sidebar",p=n===Y.Panel?"panel":"sidebar";this.telemetryService.publicLog2("viewDescriptorService.moveViews",{viewCount:r,fromContainer:d,toContainer:l,fromLocation:h,toLocation:p})}moveViewsWithoutSaving(e,t,i,s=br.Expand){this.removeViews(t,e),this.addViews(i,e,s);const o=this.getViewContainerLocation(t),n=this.getViewContainerLocation(i);o!==n&&this._onDidChangeLocation.fire({views:e,from:o,to:n}),this._onDidChangeContainer.fire({views:e,from:t,to:i})}moveViewContainerToLocationWithoutSaving(e,t,i){const s=this.getViewContainerLocation(e),o=t;if(s!==o){const n=this.isGeneratedContainerId(e.id),r=o===this.getDefaultViewContainerLocation(e);n||!r?this.viewContainersCustomLocations.set(e.id,o):this.viewContainersCustomLocations.delete(e.id),this.getOrCreateDefaultViewContainerLocationContextKey(e).set(n||r),e.requestedIndex=i,this._onDidChangeContainerLocation.fire({viewContainer:e,from:s,to:o});const d=this.getViewsByContainer(e);this._onDidChangeLocation.fire({views:d,from:s,to:o})}}cleanUpGeneratedViewContainer(e){if(!this.isGeneratedContainerId(e))return;const t=this.getViewContainerById(e);t&&this.getViewContainerModel(t)?.allViewDescriptors.length||[...this.viewDescriptorsCustomLocations.values()].includes(e)||(t&&this.viewContainersRegistry.deregisterViewContainer(t),this.viewContainersCustomLocations.delete(e),this.viewContainerBadgeEnablementStates.delete(e),this.storageService.remove(Tv(t?.storageId||rm(e)),H.PROFILE))}registerGeneratedViewContainer(e,t){const i=t||this.generateContainerId(e),s=this.viewContainersRegistry.registerViewContainer({id:i,ctorDescriptor:new ee(Ea,[i,{mergeViewWithContainerWhenSingleView:!0}]),title:{value:c(13181,"User View Container"),original:"User View Container"},icon:e===Y.Sidebar?lw:void 0,storageId:rm(i),hideIfEmpty:!0},e,{doNotRegisterOpenCommand:!0});return this.viewContainersCustomLocations.get(s.id)!==e&&this.viewContainersCustomLocations.set(s.id,e),this.getOrCreateDefaultViewContainerLocationContextKey(s).set(!0),s}onDidStorageChange(){JSON.stringify(this.viewCustomizations)!==this.getStoredViewCustomizationsValue()&&this.onDidViewCustomizationsStorageChange()}onDidViewCustomizationsStorageChange(){this._viewCustomizations=void 0;const e=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),t=new Map(Object.entries(this.viewCustomizations.viewLocations)),i=[],s=[];for(const[o,n]of e.entries()){const r=this.getViewContainerById(o);r?n!==this.getViewContainerLocation(r)&&i.push([r,n]):this.isGeneratedContainerId(o)&&this.registerGeneratedViewContainer(n,o)}for(const o of this.viewContainers)if(!e.has(o.id)){const n=this.getViewContainerLocation(o),r=this.getDefaultViewContainerLocation(o);n!==r&&i.push([o,r])}for(const[o,n]of t.entries()){const r=this.getViewDescriptorById(o);if(r){const d=this.getViewContainerByViewId(o),l=this.viewContainersRegistry.get(n);d&&l&&l!==d&&s.push({views:[r],from:d,to:l})}}for(const o of this.viewContainers){const n=this.getViewContainerModel(o);for(const r of n.allViewDescriptors)if(!t.has(r.id)){const d=this.getViewContainerByViewId(r.id),l=this.getDefaultContainerById(r.id);d&&l&&d!==l&&s.push({views:[r],from:d,to:l})}}for(const[o,n]of i)this.moveViewContainerToLocationWithoutSaving(o,n);for(const{views:o,from:n,to:r}of s)this.moveViewsWithoutSaving(o,n,r,br.Default);this.viewContainersCustomLocations=e,this.viewDescriptorsCustomLocations=t}generateContainerId(e){return`${ki.COMMON_CONTAINER_ID_PREFIX}.${XC(e)}.${nr()}`}saveViewCustomizations(){const e={viewContainerLocations:{},viewLocations:{},viewContainerBadgeEnablementStates:{}};for(const[t,i]of this.viewContainersCustomLocations){const s=this.getViewContainerById(t);s&&!this.isGeneratedContainerId(t)&&i===this.getDefaultViewContainerLocation(s)||(e.viewContainerLocations[t]=i)}for(const[t,i]of this.viewDescriptorsCustomLocations){const s=this.getViewContainerById(i);s&&this.getDefaultContainerById(t)?.id===s.id||(e.viewLocations[t]=i)}for(const[t,i]of this.viewContainerBadgeEnablementStates)i===!1&&(e.viewContainerBadgeEnablementStates[t]=i);this.viewCustomizations=e}get viewCustomizations(){return this._viewCustomizations||(this._viewCustomizations=JSON.parse(this.getStoredViewCustomizationsValue()),this._viewCustomizations.viewContainerLocations=this._viewCustomizations.viewContainerLocations??{},this._viewCustomizations.viewLocations=this._viewCustomizations.viewLocations??{},this._viewCustomizations.viewContainerBadgeEnablementStates=this._viewCustomizations.viewContainerBadgeEnablementStates??{}),this._viewCustomizations}set viewCustomizations(e){const t=JSON.stringify(e);JSON.stringify(this.viewCustomizations)!==t&&(this._viewCustomizations=e,this.setStoredViewCustomizationsValue(t))}getStoredViewCustomizationsValue(){return this.storageService.get(ki.VIEWS_CUSTOMIZATIONS,H.PROFILE,"{}")}setStoredViewCustomizationsValue(e){this.storageService.store(ki.VIEWS_CUSTOMIZATIONS,e,H.PROFILE,Re.USER)}getViewsByContainer(e){const t=this.viewsRegistry.getViews(e).filter(i=>(this.viewDescriptorsCustomLocations.get(i.id)??e.id)===e.id);for(const[i,s]of this.viewDescriptorsCustomLocations.entries()){if(s!==e.id||this.viewsRegistry.getViewContainer(i)===e)continue;const o=this.getViewDescriptorById(i);o&&t.push(o)}return t}onDidRegisterViewContainer(e){const t=this.isGeneratedContainerId(e.id)?!0:this.getViewContainerLocation(e)===this.getDefaultViewContainerLocation(e);this.getOrCreateDefaultViewContainerLocationContextKey(e).set(t),this.getOrRegisterViewContainerModel(e)}getOrRegisterViewContainerModel(e){let t=this.viewContainerModels.get(e)?.viewContainerModel;if(!t){const i=new O;t=i.add(this.instantiationService.createInstance($h,e)),this.onDidChangeActiveViews({added:t.activeViewDescriptors,removed:[]}),t.onDidChangeActiveViewDescriptors(n=>this.onDidChangeActiveViews(n),this,i),this.onDidChangeVisibleViews({added:[...t.visibleViewDescriptors],removed:[]}),t.onDidAddVisibleViewDescriptors(n=>this.onDidChangeVisibleViews({added:n.map(({viewDescriptor:r})=>r),removed:[]}),this,i),t.onDidRemoveVisibleViewDescriptors(n=>this.onDidChangeVisibleViews({added:[],removed:n.map(({viewDescriptor:r})=>r)}),this,i),i.add(ae(()=>this.viewsVisibilityActionDisposables.deleteAndDispose(e))),i.add(this.registerResetViewContainerAction(e));const s={viewContainerModel:t,disposables:i,dispose:()=>i.dispose()};this.viewContainerModels.set(e,s),this.onDidRegisterViews([{views:this.viewsRegistry.getViews(e),viewContainer:e}]);const o=this.getViewsByContainer(e).filter(n=>this.getDefaultContainerById(n.id)!==e);o.length&&(this.addViews(e,o),this.contextKeyService.bufferChangeEvents(()=>{o.forEach(n=>this.getOrCreateMovableViewContextKey(n).set(!!n.canMoveView))})),this.canRegisterViewsVisibilityActions&&this.registerViewsVisibilityActions(e,s)}return t}onDidDeregisterViewContainer(e){this.viewContainerModels.deleteAndDispose(e),this.viewsVisibilityActionDisposables.deleteAndDispose(e)}onDidChangeActiveViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(i=>this.getOrCreateActiveViewContextKey(i).set(!0)),t.forEach(i=>this.getOrCreateActiveViewContextKey(i).set(!1))})}onDidChangeVisibleViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(i=>this.getOrCreateVisibleViewContextKey(i).set(!0)),t.forEach(i=>this.getOrCreateVisibleViewContextKey(i).set(!1))})}registerViewsVisibilityActions(e,{viewContainerModel:t,disposables:i}){this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t)),i.add(L.any(t.onDidChangeActiveViewDescriptors,t.onDidAddVisibleViewDescriptors,t.onDidRemoveVisibleViewDescriptors,t.onDidMoveVisibleViewDescriptors)(s=>{this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t))}))}registerViewsVisibilityActionsForContainer(e){const t=new O;return e.activeViewDescriptors.forEach((i,s)=>{i.remoteAuthority||(t.add(b(class extends Fg{constructor(){super({id:`${i.id}.toggleVisibility`,viewPaneContainerId:e.viewContainer.id,precondition:i.canToggleVisibility&&(!e.isVisible(i.id)||e.visibleViewDescriptors.length>1)?I.true():I.false(),toggled:I.has(`${i.id}.visible`),title:i.name,metadata:{description:x(13182,"Toggles the visibility of the {0} view if the view container it is located in is visible",i.name.value)},menu:[{id:Ip,when:I.equals("viewContainer",e.viewContainer.id),order:s},{id:w.ViewContainerTitleContext,when:I.equals("viewContainer",e.viewContainer.id),order:s,group:"1_toggleVisibility"},{id:w.ViewTitleContext,when:I.or(...e.visibleViewDescriptors.map(o=>I.equals("view",o.id))),order:s,group:"2_toggleVisibility"}]})}async runInViewPaneContainer(o,n){n.toggleViewVisibility(i.id)}})),t.add(b(class extends Fg{constructor(){super({id:`${i.id}.removeView`,viewPaneContainerId:e.viewContainer.id,title:c(13183,"Hide '{0}'",i.name.value),metadata:{description:x(13184,"Hides the {0} view if it is visible and the view container it is located in is visible",i.name.value)},precondition:i.canToggleVisibility&&(!e.isVisible(i.id)||e.visibleViewDescriptors.length>1)?I.true():I.false(),menu:[{id:w.ViewTitleContext,when:I.and(I.equals("view",i.id),I.has(`${i.id}.visible`)),group:"1_hide",order:1}]})}async runInViewPaneContainer(o,n){n.getView(i.id)?.isVisible()&&n.toggleViewVisibility(i.id)}})))}),t}registerResetViewContainerAction(e){const t=this;return b(class extends X{constructor(){super({id:`${e.id}.resetViewContainerLocation`,title:x(13185,"Reset Location"),menu:[{id:w.ViewContainerTitleContext,group:"1_viewActions",when:I.or(I.and(I.equals("viewContainer",e.id),I.equals(`${e.id}.defaultViewContainerLocation`,!1)))}]})}run(s){t.moveViewContainerToLocation(e,t.getDefaultViewContainerLocation(e),void 0,this.desc.id),s.get(gt).openViewContainer(e.id,!0)}})}addViews(e,t,i=br.Default){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(s=>{const o=this.getDefaultContainerById(s.id)===e;this.getOrCreateDefaultViewLocationContextKey(s).set(o),o?this.viewDescriptorsCustomLocations.delete(s.id):this.viewDescriptorsCustomLocations.set(s.id,e.id)})}),this.getViewContainerModel(e).add(t.map(s=>({viewDescriptor:s,collapsed:i===br.Default?void 0:!1,visible:i===br.Default?void 0:!0})))}removeViews(e,t){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(i=>{this.viewDescriptorsCustomLocations.get(i.id)===e.id&&this.viewDescriptorsCustomLocations.delete(i.id),this.getOrCreateDefaultViewLocationContextKey(i).set(!1)})}),this.getViewContainerModel(e).remove(t)}getOrCreateActiveViewContextKey(e){const t=`${e.id}.active`;let i=this.activeViewContextKeys.get(t);return i||(i=new q(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,i)),i}getOrCreateVisibleViewContextKey(e){const t=`${e.id}.visible`;let i=this.activeViewContextKeys.get(t);return i||(i=new q(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,i)),i}getOrCreateMovableViewContextKey(e){const t=`${e.id}.canMove`;let i=this.movableViewContextKeys.get(t);return i||(i=new q(t,!1).bindTo(this.contextKeyService),this.movableViewContextKeys.set(t,i)),i}getOrCreateDefaultViewLocationContextKey(e){const t=`${e.id}.defaultViewLocation`;let i=this.defaultViewLocationContextKeys.get(t);return i||(i=new q(t,!1).bindTo(this.contextKeyService),this.defaultViewLocationContextKeys.set(t,i)),i}getOrCreateDefaultViewContainerLocationContextKey(e){const t=`${e.id}.defaultViewContainerLocation`;let i=this.defaultViewContainerLocationContextKeys.get(t);return i||(i=new q(t,!1).bindTo(this.contextKeyService),this.defaultViewContainerLocationContextKeys.set(t,i)),i}},ki=Bs,Bs.VIEWS_CUSTOMIZATIONS="views.customizations",Bs.COMMON_CONTAINER_ID_PREFIX="workbench.views.service",Bs);qh=ki=D([u(0,F),u(1,se),u(2,ce),u(3,At),u(4,mt),u(5,Wp)],qh);var Qi,as;let jh=(as=class extends R{constructor(e,t,i,s,o,n,r,d){super(),this.editorGroupService=e,this.instantiationService=t,this.configurationService=i,this.quickInputService=s,this.notificationService=o,this.storageService=n,this.extensionService=r,this.logService=d,this._onDidChangeEditorRegistrations=this._register(new Hl),this.onDidChangeEditorRegistrations=this._onDidChangeEditorRegistrations.event,this._editors=new Map,this._flattenedEditors=new Map,this._shouldReFlattenEditors=!0,this.cache=new Set(JSON.parse(this.storageService.get(Qi.cacheStorageID,H.PROFILE,JSON.stringify([])))),this.storageService.remove(Qi.cacheStorageID,H.PROFILE),this._register(this.storageService.onWillSaveState(()=>{this.cacheEditors()})),this._register(this.extensionService.onDidRegisterExtensions(()=>{this.cache=void 0}))}resolveUntypedInputAndGroup(e,t){const i=e,s=this.instantiationService.invokeFunction(cv,i,t);if(s instanceof Promise)return s.then(([o,n])=>[i,o,n]);{const[o,n]=s;return[i,o,n]}}async resolveEditor(e,t){if(this._flattenedEditors=this._flattenEditorsMap(),Kg(e))return this.doResolveSideBySideEditor(e,t);let i;const s=this.resolveUntypedInputAndGroup(e,t);if(s instanceof Promise?i=await s:i=s,!i)return Lt.NONE;const[o,n,r]=i;r&&(o.options={...o.options,activation:r});let d=Bt.getCanonicalUri(o,{supportSideBySide:Ni.PRIMARY});if(this.cache&&d&&this.resourceMatchesCache(d)&&await this.extensionService.whenInstalledExtensionsRegistered(),d===void 0)d=$.from({scheme:pe.untitled});else if(d.scheme===void 0||d===null)return Lt.NONE;if(o.options?.override===ad.PICK){const f=await this.doPickEditor(o);if(!f)return Lt.ABORT;o.options=f}let{editor:l,conflictingDefault:h}=this.getEditor(d,o.options?.override);if(!l&&(o.options?.override||hw(e)))return Lt.NONE;if(!l){const f=this.getEditor(d,Ct.id);if(l=f?.editor,h=f?.conflictingDefault,!l)return Lt.NONE}if(fl(o)&&o.options?.override===void 0){let f=Bt.getCanonicalUri(o,{supportSideBySide:Ni.SECONDARY});f||(f=$.from({scheme:pe.untitled}));const{editor:g}=this.getEditor(f,void 0);if(!g||l.editorInfo.id!==g.editorInfo.id){const{editor:m,conflictingDefault:v}=this.getEditor(d,Ct.id);l=m,h=v}if(!l)return Lt.NONE}if(o.options={override:l.editorInfo.id,...o.options},l.editorFactoryObject.createDiffEditorInput===void 0&&fl(o))return Lt.NONE;const p=await this.doResolveEditor(o,n,l);return h&&p&&await this.doHandleConflictingDefaults(d,l.editorInfo.label,o,p.editor,n),p?(p.editor.editorId!==l.editorInfo.id&&this.logService.warn(`Editor ID Mismatch: ${p.editor.editorId} !== ${l.editorInfo.id}. This will cause bugs. Please ensure editorInput.editorId matches the registered id`),{...p,group:n}):Lt.ABORT}async doResolveSideBySideEditor(e,t){const i=await this.resolveEditor(e.primary,t);if(!Wg(i))return Lt.NONE;const s=await this.resolveEditor(e.secondary,i.group??t);return Wg(s)?{group:i.group??s.group,editor:this.instantiationService.createInstance(Ia,e.label,e.description,s.editor,i.editor),options:e.options}:Lt.NONE}bufferChangeEvents(e){this._onDidChangeEditorRegistrations.pause();try{e()}finally{this._onDidChangeEditorRegistrations.resume()}}registerEditor(e,t,i,s){let o=this._editors.get(e);o===void 0&&(o=new Map,this._editors.set(e,o));let n=o.get(t.id);n===void 0&&(n=[]);const r=QC(n,{globPattern:e,editorInfo:t,options:i,editorFactoryObject:s});return o.set(t.id,n),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire(),ae(()=>{r(),n&&n.length===0&&o?.delete(t.id),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire()})}getAssociationsForResource(e){let i=this.getAllUserAssociations().filter(o=>o.filenamePattern&&dd(o.filenamePattern,e));i=i.sort((o,n)=>(n.filenamePattern?.length??0)-(o.filenamePattern?.length??0));const s=this._registeredEditors;return i.filter(o=>s.find(n=>n.editorInfo.id===o.viewType))}getAllUserAssociations(){const e=this.configurationService.inspect(Gg)||{},t=e.defaultValue??{},i=e.workspaceValue??{},s=e.userValue??{},o={...i};for(const[r,d]of Object.entries({...t,...s}))o[r]===void 0&&(o[r]=d);const n=[];for(const[r,d]of Object.entries(o)){const l={filenamePattern:r,viewType:d};n.push(l)}return n}_flattenEditorsMap(){if(!this._shouldReFlattenEditors)return this._flattenedEditors;this._shouldReFlattenEditors=!1;const e=new Map;for(const[t,i]of this._editors){const s=[];for(const o of i.values()){let n;for(const r of o)n||(n={editorInfo:r.editorInfo,globPattern:r.globPattern,options:{},editorFactoryObject:{}}),n.options={...n.options,...r.options},n.editorFactoryObject={...n.editorFactoryObject,...r.editorFactoryObject};n&&s.push(n)}e.set(t,s)}return e}get _registeredEditors(){return Array.from(this._flattenedEditors.values()).flat()}updateUserAssociations(e,t){const i={viewType:t,filenamePattern:e},s=this.getAllUserAssociations(),o=Object.create(null);for(const n of[...s,i])n.filenamePattern&&(o[n.filenamePattern]=n.viewType);this.configurationService.updateValue(Gg,o)}findMatchingEditors(e){const t=this.getAssociationsForResource(e),i=[];for(const[s,o]of this._flattenedEditors)for(const n of o)(t.find(d=>d.viewType===n.editorInfo.id)&&n.editorInfo.priority!==De.exclusive||dd(s,e))&&i.push(n);return i.sort((s,o)=>ii(o.editorInfo.priority)===ii(s.editorInfo.priority)&&typeof o.globPattern=="string"&&typeof s.globPattern=="string"?o.globPattern.length-s.globPattern.length:ii(o.editorInfo.priority)-ii(s.editorInfo.priority))}getEditors(e){if(this._flattenedEditors=this._flattenEditorsMap(),$.isUri(e)){const t=this.findMatchingEditors(e);return t.find(i=>i.editorInfo.priority===De.exclusive)?[]:t.map(i=>i.editorInfo)}return Ls(this._registeredEditors.map(t=>t.editorInfo),t=>t.id)}getEditor(e,t){const i=(h,p)=>h.find(f=>f.options&&f.options.canSupportResource!==void 0?f.editorInfo.id===p&&f.options.canSupportResource(e):f.editorInfo.id===p);if(t&&t!==ad.EXCLUSIVE_ONLY){const h=this._registeredEditors;return{editor:i(h,t),conflictingDefault:!1}}const s=this.findMatchingEditors(e),o=this.getAssociationsForResource(e),n=t===ad.EXCLUSIVE_ONLY?De.exclusive:De.builtin;let r=s.filter(h=>ii(h.editorInfo.priority)>=ii(n)&&h.editorInfo.id!==Ct.id);if(r.length===0)return{editor:o[0]&&n!==De.exclusive?i(s,o[0].viewType):void 0,conflictingDefault:!1};const d=r[0].editorInfo.priority===De.exclusive?r[0].editorInfo.id:o[0]?.viewType||r.find(h=>!h.options?.canSupportResource||h.options.canSupportResource(e))?.editorInfo.id||r[0].editorInfo.id;let l=!1;return r=r.filter(h=>h.editorInfo.priority!==De.exclusive).filter(h=>!h.options?.canSupportResource||h.options.canSupportResource(e)),o.length===0&&r.length>1&&(l=!0),{editor:i(s,d),conflictingDefault:l}}async doResolveEditor(e,t,i){let s=e.options;const o=Bt.getCanonicalUri(e,{supportSideBySide:Ni.PRIMARY});if(s&&typeof s.activation>"u"&&(s={...s,activation:s.preserveFocus?uw.RESTORE:void 0}),eS(e)){if(!i.editorFactoryObject.createMergeEditorInput)return;const l=await i.editorFactoryObject.createMergeEditorInput(e,t);return{editor:l.editor,options:l.options??s}}if(fl(e)){if(!i.editorFactoryObject.createDiffEditorInput)return;const l=await i.editorFactoryObject.createDiffEditorInput(e,t);return{editor:l.editor,options:l.options??s}}if(tS(e)){if(!i.editorFactoryObject.createMultiDiffEditorInput)return;const l=await i.editorFactoryObject.createMultiDiffEditorInput(e,t);return{editor:l.editor,options:l.options??s}}if(Kg(e))throw new Error("Untyped side by side editor input not supported here.");if(iS(e)){if(!i.editorFactoryObject.createUntitledEditorInput)return;const l=await i.editorFactoryObject.createUntitledEditorInput(e,t);return{editor:l.editor,options:l.options??s}}if(o===void 0)throw new Error("Undefined resource on non untitled editor input.");if(typeof i.options?.singlePerResource=="function"?i.options.singlePerResource():i.options?.singlePerResource){const l=this.findExistingEditorsForResource(o,i.editorInfo.id);if(l.length){const h=await this.moveExistingEditorForResource(l,t);return h?{editor:h,options:s}:void 0}}if(!i.editorFactoryObject.createEditorInput)return;const r=await i.editorFactoryObject.createEditorInput(e,t);return s=r.options??s,{editor:r.editor,options:s}}async moveExistingEditorForResource(e,t){const i=e[0];for(const{editor:s,group:o}of e)if(s!==i.editor&&!await o.closeEditor(s))return;if(!(t.id!==i.group.id&&!i.group.moveEditor(i.editor,t)))return i.editor}findExistingEditorsForResource(e,t){const i=[],s=Ls([...this.editorGroupService.groups]);for(const o of s)for(const n of o.editors)dt(n.resource,e)&&n.editorId===t&&i.push({editor:n,group:o});return i}async doHandleConflictingDefaults(e,t,i,s,o){const n=this.findMatchingEditors(e),r=JSON.parse(this.storageService.get(Qi.conflictingDefaultsStorageID,H.PROFILE,"{}")),d=`*${Pi(e)}`,l=()=>{r[d]=[],n.forEach(f=>r[d].push(f.editorInfo.id)),this.storageService.store(Qi.conflictingDefaultsStorageID,JSON.stringify(r),H.PROFILE,Re.MACHINE)};if(r[d]&&r[d].find(f=>f===s.editorId))return;const p=this.notificationService.prompt(Se.Warning,c(12461,"There are multiple default editors available for the resource."),[{label:c(12462,"Configure Default"),run:async()=>{const f=await this.doPickEditor(i,!0);if(!f)return;i.options=f;const g=await this.resolveEditor(i,o);g===Lt.ABORT||g===Lt.NONE||o.replaceEditors([{editor:s,replacement:g.editor,options:g.options??f}])}},{label:c(12463,"Keep {0}",t),run:l}]).onDidClose(()=>{l(),p.dispose()})}mapEditorsToQuickPickEntry(e,t){const i=this.editorGroupService.activeGroup.findEditors(e).at(0);let s=e.scheme===pe.untitled?this._registeredEditors.filter(p=>p.editorInfo.priority!==De.exclusive):this.findMatchingEditors(e);s=Ls(s,p=>p.editorInfo.id);const o=this.getAssociationsForResource(e)[0]?.viewType;s=s.sort((p,f)=>p.editorInfo.id===Ct.id?-1:f.editorInfo.id===Ct.id?1:ii(f.editorInfo.priority)-ii(p.editorInfo.priority));const n=[],r=c(12464,"Active"),d=c(12465,"Default"),l=c(12466,"Active and Default");let h=o;if(!h&&s.length>2&&s[1]?.editorInfo.priority!==De.option&&(h=s[1]?.editorInfo.id),h||(h=Ct.id),s.forEach(p=>{const f=i?.editorId??Ct.id,g=i?p.editorInfo.id===f:!1,m=p.editorInfo.id===h,v={id:p.editorInfo.id,label:p.editorInfo.label,description:g&&m?l:g?r:m?d:void 0,detail:p.editorInfo.detail??p.editorInfo.priority};n.push(v)}),!t&&Pi(e)!==""){const p={type:"separator"};n.push(p);const f={id:Qi.configureDefaultID,label:c(12467,"Configure default editor for '{0}'...",`*${Pi(e)}`)};n.push(f)}return n}async doPickEditor(e,t){let i=Bt.getOriginalUri(e,{supportSideBySide:Ni.PRIMARY});i===void 0&&(i=$.from({scheme:pe.untitled}));const s=this.mapEditorsToQuickPickEntry(i,t),o=new O,n=o.add(this.quickInputService.createQuickPick({useSeparators:!0})),r=t?c(12468,"Select new default editor for '{0}'",`*${Pi(i)}`):c(12469,"Select editor for '{0}'",us(i));n.placeholder=r,n.canAcceptInBackground=!0,n.items=s;const d=n.items.find(h=>h.type==="item");d&&(n.selectedItems=[d]);const l=await new Promise(h=>{o.add(n.onDidAccept(p=>{let f;n.selectedItems.length===1&&(f={item:n.selectedItems[0],keyMods:n.keyMods,openInBackground:p.inBackground}),i&&t&&f?.item.id&&this.updateUserAssociations(`*${Pi(i)}`,f.item.id),h(f)})),o.add(n.onDidHide(()=>{o.dispose(),h(void 0)})),o.add(n.onDidTriggerItemButton(p=>{h({item:p.item,openInBackground:!1}),i&&p.item&&p.item.id&&this.updateUserAssociations(`*${Pi(i)}`,p.item.id)})),n.show()});if(n.dispose(),l)return l.item.id===Qi.configureDefaultID?this.doPickEditor(e,!0):{...e.options,override:l.item.id,preserveFocus:l.openInBackground||e.options?.preserveFocus}}cacheEditors(){const e=new Set;for(const[i,s]of this._flattenedEditors)s.find(n=>n.editorInfo.priority!==De.option&&n.editorInfo.id!==Ct.id)&&(sS(i)?e.add(`${i.pattern}`):e.add(i));const t=this.getAllUserAssociations();for(const i of t)i.filenamePattern&&e.add(i.filenamePattern);this.storageService.store(Qi.cacheStorageID,JSON.stringify(Array.from(e)),H.PROFILE,Re.MACHINE)}resourceMatchesCache(e){if(!this.cache)return!1;for(const t of this.cache)if(dd(t,e))return!0;return!1}},Qi=as,as.configureDefaultID="promptOpenWith.configureDefault",as.cacheStorageID="editorOverrideService.cache",as.conflictingDefaultsStorageID="editorOverrideService.conflictingDefaults",as);jh=Qi=D([u(0,Je),u(1,F),u(2,ie),u(3,Xt),u(4,Ke),u(5,ce),u(6,At),u(7,Ue)],jh);var Yh,Eo;let Jh=(Eo=class extends R{constructor(e,t){super(),this.instantiationService=e,this.configurationService=t,this._onDidSave=this._register(new E),this.onDidSave=this._onDidSave.event,this._onDidChangeDirty=this._register(new E),this.onDidChangeDirty=this._onDidChangeDirty.event,this._onDidChangeEncoding=this._register(new E),this.onDidChangeEncoding=this._onDidChangeEncoding.event,this._onDidCreate=this._register(new E),this.onDidCreate=this._onDidCreate.event,this._onWillDispose=this._register(new E),this.onWillDispose=this._onWillDispose.event,this._onDidChangeLabel=this._register(new E),this.onDidChangeLabel=this._onDidChangeLabel.event,this.mapResourceToModel=new ps}get(e){return this.mapResourceToModel.get(e)}getValue(e){return this.get(e)?.textEditorModel?.getValue()}async resolve(e){const t=this.doCreateOrGet(e);return await t.resolve(),t}create(e){return this.doCreateOrGet(e)}doCreateOrGet(e=Object.create(null)){const t=this.massageOptions(e);return t.untitledResource&&this.mapResourceToModel.has(t.untitledResource)?this.mapResourceToModel.get(t.untitledResource):this.doCreate(t)}massageOptions(e){const t=Object.create(null);if(e.associatedResource?(t.untitledResource=$.from({scheme:pe.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):e.untitledResource?.scheme===pe.untitled&&(t.untitledResource=e.untitledResource),e.languageId)t.languageId=e.languageId;else if(!t.associatedResource){const i=this.configurationService.getValue();i.files?.defaultLanguage&&(t.languageId=i.files.defaultLanguage)}return t.encoding=e.encoding,t.initialValue=e.initialValue,t}doCreate(e){let t=e.untitledResource;if(!t){let s=1;do t=$.from({scheme:pe.untitled,path:`Untitled-${s}`}),s++;while(this.mapResourceToModel.has(t))}const i=this._register(this.instantiationService.createInstance(oS,t,!!e.associatedResource,e.initialValue,e.languageId,e.encoding));return this.registerModel(i),i}registerModel(e){const t=new O;t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeName(()=>this._onDidChangeLabel.fire(e))),t.add(e.onDidChangeEncoding(()=>this._onDidChangeEncoding.fire(e))),t.add(e.onWillDispose(()=>this._onWillDispose.fire(e))),L.once(e.onWillDispose)(()=>{this.mapResourceToModel.delete(e.resource),t.dispose()}),this.mapResourceToModel.set(e.resource,e),this._onDidCreate.fire(e),e.isDirty()&&this._onDidChangeDirty.fire(e)}isUntitledWithAssociatedResource(e){return e.scheme===pe.untitled&&e.path.length>1&&!Yh.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX.test(e.path)}canDispose(e){return e.isDisposed()?!0:this.doCanDispose(e)}async doCanDispose(e){return e.isDirty()?(await L.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}},Yh=Eo,Eo.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX=/Untitled-\d+/,Eo);Jh=Yh=D([u(0,F),u(1,ie)],Jh);var Ri,Zh,gi;let Md=(gi=class extends R{constructor(e,t,i,s,o,n,r,d,l,h,p){super(),this.editorService=e,this.editorGroupService=t,this.contextService=i,this.storageService=s,this.configurationService=o,this.fileService=n,this.workspacesService=r,this.instantiationService=d,this.layoutService=l,this.contextKeyService=h,this.logService=p,this.activeEditorListeners=this._register(new O),this.lastActiveEditor=void 0,this._onDidChangeEditorNavigationStack=this._register(new E),this.onDidChangeEditorNavigationStack=this._onDidChangeEditorNavigationStack.event,this.defaultScopedEditorNavigationStack=void 0,this.editorGroupScopedNavigationStacks=new Map,this.editorScopedNavigationStacks=new Map,this.editorNavigationScope=Vt.DEFAULT,this.recentlyUsedEditorsStack=void 0,this.recentlyUsedEditorsStackIndex=0,this.recentlyUsedEditorsInGroupStack=void 0,this.recentlyUsedEditorsInGroupStackIndex=0,this.navigatingInRecentlyUsedEditorsStack=!1,this.navigatingInRecentlyUsedEditorsInGroupStack=!1,this.recentlyClosedEditors=[],this.ignoreEditorCloseEvent=!1,this.history=void 0,this.editorHistoryListeners=new Map,this.resourceExcludeMatcher=this._register(new nS(re,()=>{const f=this._register(this.instantiationService.createInstance(rS,g=>aS(g?this.configurationService.getValue({resource:g}):this.configurationService.getValue())||Object.create(null),g=>g.affectsConfiguration(dS)||g.affectsConfiguration(cS)));return this._register(f.onExpressionChange(()=>this.removeExcludedFromHistory())),f})),this.editorHelper=this.instantiationService.createInstance(Od),this.canNavigateBackContextKey=new q("canNavigateBack",!1,c(12679,"Whether it is possible to navigate back in editor history")).bindTo(this.contextKeyService),this.canNavigateForwardContextKey=new q("canNavigateForward",!1,c(12680,"Whether it is possible to navigate forward in editor history")).bindTo(this.contextKeyService),this.canNavigateBackInNavigationsContextKey=new q("canNavigateBackInNavigationLocations",!1,c(12681,"Whether it is possible to navigate back in editor navigation locations history")).bindTo(this.contextKeyService),this.canNavigateForwardInNavigationsContextKey=new q("canNavigateForwardInNavigationLocations",!1,c(12682,"Whether it is possible to navigate forward in editor navigation locations history")).bindTo(this.contextKeyService),this.canNavigateToLastNavigationLocationContextKey=new q("canNavigateToLastNavigationLocation",!1,c(12683,"Whether it is possible to navigate to the last editor navigation location")).bindTo(this.contextKeyService),this.canNavigateBackInEditsContextKey=new q("canNavigateBackInEditLocations",!1,c(12684,"Whether it is possible to navigate back in editor edit locations history")).bindTo(this.contextKeyService),this.canNavigateForwardInEditsContextKey=new q("canNavigateForwardInEditLocations",!1,c(12685,"Whether it is possible to navigate forward in editor edit locations history")).bindTo(this.contextKeyService),this.canNavigateToLastEditLocationContextKey=new q("canNavigateToLastEditLocation",!1,c(12686,"Whether it is possible to navigate to the last editor edit location")).bindTo(this.contextKeyService),this.canReopenClosedEditorContextKey=new q("canReopenClosedEditor",!1,c(12687,"Whether it is possible to reopen the last closed editor")).bindTo(this.contextKeyService),this.registerListeners(),this.editorService.activeEditorPane&&this.onDidActiveEditorChange()}registerListeners(){this.registerMouseNavigationListener(),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.editorService.onDidOpenEditorFail(e=>this.remove(e.editor))),this._register(this.editorService.onDidCloseEditor(e=>this.onDidCloseEditor(e))),this._register(this.editorService.onDidMostRecentlyActiveEditorsChange(()=>this.handleEditorEventInRecentEditorsStack())),this._register(this.editorGroupService.onDidRemoveGroup(e=>this.onDidRemoveGroup(e))),this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidRunOperation(e=>this.onDidFilesChange(e))),this._register(this.storageService.onWillSaveState(()=>this.saveState())),this.registerEditorNavigationScopeChangeListener(),this._register(this.onDidChangeEditorNavigationStack(()=>this.updateContextKeys())),this._register(this.editorGroupService.onDidChangeActiveGroup(()=>this.updateContextKeys()))}onDidCloseEditor(e){this.handleEditorCloseEventInHistory(e),this.handleEditorCloseEventInReopen(e)}registerMouseNavigationListener(){const e=this._register(new O),t=()=>{e.clear(),this.configurationService.getValue(Ri.MOUSE_NAVIGATION_SETTING)&&this._register(L.runAndSubscribe(this.layoutService.onDidAddContainer,({container:i,disposables:s})=>{const o=s.add(new O);o.add(J(i,te.MOUSE_DOWN,n=>this.onMouseDownOrUp(n,!0))),o.add(J(i,te.MOUSE_UP,n=>this.onMouseDownOrUp(n,!1))),e.add(o)},{container:this.layoutService.mainContainer,disposables:this._store}))};this._register(this.configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration(Ri.MOUSE_NAVIGATION_SETTING)&&t()})),t()}onMouseDownOrUp(e,t){switch(e.button){case 3:ke.stop(e),t&&this.goBack();break;case 4:ke.stop(e),t&&this.goForward();break}}onDidRemoveGroup(e){this.handleEditorGroupRemoveInNavigationStacks(e)}onDidActiveEditorChange(){const e=this.editorGroupService.activeGroup,t=e.activeEditorPane;if(!(this.lastActiveEditor&&this.editorHelper.matchesEditorIdentifier(this.lastActiveEditor,t))){if(this.lastActiveEditor=t?.input?{editor:t.input,groupId:t.group.id}:void 0,this.activeEditorListeners.clear(),!t?.group.isTransient(t.input))this.handleActiveEditorChange(e,t);else{this.logService.trace(`[History]: ignoring transient editor change until becoming non-transient (editor: ${t.input?.resource?.toString()}})`);const i=e.onDidModelChange(s=>{s.kind===nd.EDITOR_TRANSIENT&&s.editor===t.input&&!t.group.isTransient(t.input)&&(i.dispose(),this.handleActiveEditorChange(e,t))});this.activeEditorListeners.add(i)}Jl(t)&&this.activeEditorListeners.add(t.onDidChangeSelection(i=>{t.group.isTransient(t.input)?this.logService.trace(`[History]: ignoring transient editor selection change (editor: ${t.input?.resource?.toString()}})`):this.handleActiveEditorSelectionChangeEvent(e,t,i)})),this.updateContextKeys()}}onDidFilesChange(e){e instanceof Mr?e.gotDeleted()&&this.remove(e):e.isOperation(ho.DELETE)?this.remove(e):e.isOperation(ho.MOVE)&&e.target.isFile&&this.move(e)}handleActiveEditorChange(e,t){this.handleActiveEditorChangeInHistory(t),this.handleActiveEditorChangeInNavigationStacks(e,t)}handleActiveEditorSelectionChangeEvent(e,t,i){this.handleActiveEditorSelectionChangeInNavigationStacks(e,t,i)}move(e){this.moveInHistory(e),this.moveInEditorNavigationStacks(e)}remove(e){this.removeFromHistory(e),this.removeFromEditorNavigationStacks(e),this.removeFromRecentlyClosedEditors(e),this.removeFromRecentlyOpened(e)}removeFromRecentlyOpened(e){let t;tt(e)?t=Bt.getOriginalUri(e):e instanceof Mr||(t=e.resource),t&&this.workspacesService.removeRecentlyOpened([t])}clear(){this.clearRecentlyOpened(),this.clearEditorNavigationStacks(),this.recentlyClosedEditors=[],this.updateContextKeys()}updateContextKeys(){this.contextKeyService.bufferChangeEvents(()=>{const e=this.getStack();this.canNavigateBackContextKey.set(e.canGoBack(qe.NONE)),this.canNavigateForwardContextKey.set(e.canGoForward(qe.NONE)),this.canNavigateBackInNavigationsContextKey.set(e.canGoBack(qe.NAVIGATION)),this.canNavigateForwardInNavigationsContextKey.set(e.canGoForward(qe.NAVIGATION)),this.canNavigateToLastNavigationLocationContextKey.set(e.canGoLast(qe.NAVIGATION)),this.canNavigateBackInEditsContextKey.set(e.canGoBack(qe.EDITS)),this.canNavigateForwardInEditsContextKey.set(e.canGoForward(qe.EDITS)),this.canNavigateToLastEditLocationContextKey.set(e.canGoLast(qe.EDITS)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)})}registerEditorNavigationScopeChangeListener(){const e=()=>{this.disposeEditorNavigationStacks();const t=this.configurationService.getValue(Ri.NAVIGATION_SCOPE_SETTING);t==="editorGroup"?this.editorNavigationScope=Vt.EDITOR_GROUP:t==="editor"?this.editorNavigationScope=Vt.EDITOR:this.editorNavigationScope=Vt.DEFAULT};this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(Ri.NAVIGATION_SCOPE_SETTING)&&e()})),e()}getStack(e=this.editorGroupService.activeGroup,t=e.activeEditor){switch(this.editorNavigationScope){case Vt.EDITOR:{if(!t)return new fx;let i=this.editorScopedNavigationStacks.get(e.id);i||(i=new Map,this.editorScopedNavigationStacks.set(e.id,i));let s=i.get(t)?.stack;if(!s){const o=new O;s=o.add(this.instantiationService.createInstance(qr,Vt.EDITOR)),o.add(s.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),i.set(t,{stack:s,disposable:o})}return s}case Vt.EDITOR_GROUP:{let i=this.editorGroupScopedNavigationStacks.get(e.id)?.stack;if(!i){const s=new O;i=s.add(this.instantiationService.createInstance(qr,Vt.EDITOR_GROUP)),s.add(i.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),this.editorGroupScopedNavigationStacks.set(e.id,{stack:i,disposable:s})}return i}case Vt.DEFAULT:return this.defaultScopedEditorNavigationStack||(this.defaultScopedEditorNavigationStack=this._register(this.instantiationService.createInstance(qr,Vt.DEFAULT)),this._register(this.defaultScopedEditorNavigationStack.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire()))),this.defaultScopedEditorNavigationStack}}goForward(e){return this.getStack().goForward(e)}goBack(e){return this.getStack().goBack(e)}goPrevious(e){return this.getStack().goPrevious(e)}goLast(e){return this.getStack().goLast(e)}handleActiveEditorChangeInNavigationStacks(e,t){this.getStack(e,t?.input).handleActiveEditorChange(t)}handleActiveEditorSelectionChangeInNavigationStacks(e,t,i){this.getStack(e,t.input).handleActiveEditorSelectionChange(t,i)}handleEditorCloseEventInHistory(e){const t=this.editorScopedNavigationStacks.get(e.groupId);if(t){const i=t.get(e.editor);i&&(i.disposable.dispose(),t.delete(e.editor)),t.size===0&&this.editorScopedNavigationStacks.delete(e.groupId)}}handleEditorGroupRemoveInNavigationStacks(e){this.defaultScopedEditorNavigationStack?.remove(e.id);const t=this.editorGroupScopedNavigationStacks.get(e.id);t&&(t.disposable.dispose(),this.editorGroupScopedNavigationStacks.delete(e.id))}clearEditorNavigationStacks(){this.withEachEditorNavigationStack(e=>e.clear())}removeFromEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.remove(e))}moveInEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.move(e))}withEachEditorNavigationStack(e){this.defaultScopedEditorNavigationStack&&e(this.defaultScopedEditorNavigationStack);for(const[,t]of this.editorGroupScopedNavigationStacks)e(t.stack);for(const[,t]of this.editorScopedNavigationStacks)for(const[,i]of t)e(i.stack)}disposeEditorNavigationStacks(){this.defaultScopedEditorNavigationStack?.dispose(),this.defaultScopedEditorNavigationStack=void 0;for(const[,e]of this.editorGroupScopedNavigationStacks)e.disposable.dispose();this.editorGroupScopedNavigationStacks.clear();for(const[,e]of this.editorScopedNavigationStacks)for(const[,t]of e)t.disposable.dispose();this.editorScopedNavigationStacks.clear()}openNextRecentlyUsedEditor(e){const[t,i]=this.ensureRecentlyUsedStack(s=>s-1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[i],e)}openPreviouslyUsedEditor(e){const[t,i]=this.ensureRecentlyUsedStack(s=>s+1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[i],e)}async doNavigateInRecentlyUsedEditorsStack(e,t){if(e){const i=typeof t!="number"||!this.editorGroupService.getGroup(t);i?this.navigatingInRecentlyUsedEditorsStack=!0:this.navigatingInRecentlyUsedEditorsInGroupStack=!0;const s=this.editorGroupService.getGroup(e.groupId)??this.editorGroupService.activeGroup;try{await s.openEditor(e.editor)}finally{i?this.navigatingInRecentlyUsedEditorsStack=!1:this.navigatingInRecentlyUsedEditorsInGroupStack=!1}}}ensureRecentlyUsedStack(e,t){let i,s;const o=typeof t=="number"?this.editorGroupService.getGroup(t):void 0;o?(i=this.recentlyUsedEditorsInGroupStack||o.getEditors(ml.MOST_RECENTLY_ACTIVE).map(r=>({groupId:o.id,editor:r})),s=this.recentlyUsedEditorsInGroupStackIndex):(i=this.recentlyUsedEditorsStack||this.editorService.getEditors(ml.MOST_RECENTLY_ACTIVE),s=this.recentlyUsedEditorsStackIndex);let n=e(s);return n<0?n=0:n>i.length-1&&(n=i.length-1),o?(this.recentlyUsedEditorsInGroupStack=i,this.recentlyUsedEditorsInGroupStackIndex=n):(this.recentlyUsedEditorsStack=i,this.recentlyUsedEditorsStackIndex=n),[i,n]}handleEditorEventInRecentEditorsStack(){this.navigatingInRecentlyUsedEditorsStack||(this.recentlyUsedEditorsStack=void 0,this.recentlyUsedEditorsStackIndex=0),this.navigatingInRecentlyUsedEditorsInGroupStack||(this.recentlyUsedEditorsInGroupStack=void 0,this.recentlyUsedEditorsInGroupStackIndex=0)}handleEditorCloseEventInReopen(e){if(this.ignoreEditorCloseEvent)return;const{editor:t,context:i}=e;if(i===Ug.REPLACE||i===Ug.MOVE)return;const s=t.toUntyped();if(!s)return;const o=[],n=Bt.getOriginalUri(t,{supportSideBySide:Ni.BOTH});$.isUri(n)?o.push(n):n&&o.push(...Ss([n.primary,n.secondary])),this.removeFromRecentlyClosedEditors(t),this.recentlyClosedEditors.push({editorId:t.editorId,editor:s,resource:Bt.getOriginalUri(t),associatedResources:o,index:e.index,sticky:e.sticky}),this.recentlyClosedEditors.length>Ri.MAX_RECENTLY_CLOSED_EDITORS&&this.recentlyClosedEditors.shift(),this.canReopenClosedEditorContextKey.set(!0)}async reopenLastClosedEditor(){const e=this.recentlyClosedEditors.pop();let t;return e&&(t=this.doReopenLastClosedEditor(e)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0),t}async doReopenLastClosedEditor(e){const t={pinned:!0,sticky:e.sticky,index:e.index,ignoreError:!0};(e.sticky&&!this.editorGroupService.activeGroup.isSticky(e.index)||!e.sticky&&this.editorGroupService.activeGroup.isSticky(e.index))&&(t.index=void 0);let i;if(!this.editorGroupService.activeGroup.contains(e.editor)){this.ignoreEditorCloseEvent=!0;try{i=await this.editorService.openEditor({...e.editor,options:{...e.editor.options,...t}})}finally{this.ignoreEditorCloseEvent=!1}}i||(lS(this.recentlyClosedEditors,e),this.reopenLastClosedEditor())}removeFromRecentlyClosedEditors(e){this.recentlyClosedEditors=this.recentlyClosedEditors.filter(t=>tt(e)&&t.editorId!==e.editorId?!0:!(t.resource&&this.editorHelper.matchesFile(t.resource,e)||t.associatedResources.some(i=>this.editorHelper.matchesFile(i,e)))),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)}handleActiveEditorChangeInHistory(e){const t=e?.input;!t||t.isDisposed()||!this.includeInHistory(t)||(this.removeFromHistory(t),this.addToHistory(t))}addToHistory(e,t=!0){this.ensureHistoryLoaded(this.history);const i=this.editorHelper.preferResourceEditorInput(e);i&&(t?this.history.unshift(i):this.history.push(i),this.history.length>Ri.MAX_HISTORY_ITEMS&&this.editorHelper.clearOnEditorDispose(this.history.pop(),this.editorHistoryListeners),tt(e)&&this.editorHelper.onEditorDispose(e,()=>this.updateHistoryOnEditorDispose(i),this.editorHistoryListeners))}updateHistoryOnEditorDispose(e){if(tt(e))if(!hS(e))this.removeFromHistory(e);else{const t=[],i=e.primary.matches(e.secondary)?[e.primary]:[e.primary,e.secondary];for(const s of i){const o=this.editorHelper.preferResourceEditorInput(s);Zl(o)&&this.includeInHistory(o)&&t.push(o)}this.replaceInHistory(e,...t)}else this.includeInHistory(e)||this.removeFromHistory(e)}includeInHistory(e){return tt(e)?!0:!this.resourceExcludeMatcher.value.matches(e.resource)}removeExcludedFromHistory(){this.ensureHistoryLoaded(this.history),this.history=this.history.filter(e=>{const t=this.includeInHistory(e);return t||this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t})}moveInHistory(e){e.isOperation(ho.MOVE)&&this.removeFromHistory(e)&&this.addToHistory({resource:e.target.resource})}removeFromHistory(e){let t=!1;return this.ensureHistoryLoaded(this.history),this.history=this.history.filter(i=>{const s=this.editorHelper.matchesEditor(e,i);return s&&(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t=!0),!s}),t}replaceInHistory(e,...t){this.ensureHistoryLoaded(this.history);let i=!1;const s=[];for(const o of this.history)this.editorHelper.matchesEditor(e,o)?(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),i||(s.push(...t),i=!0)):t.some(n=>this.editorHelper.matchesEditor(n,o))||s.push(o);i||s.push(...t),this.history=s}clearRecentlyOpened(){this.history=[];for(const[,e]of this.editorHistoryListeners)je(e);this.editorHistoryListeners.clear()}getHistory(){return this.ensureHistoryLoaded(this.history),this.history}ensureHistoryLoaded(e){this.history||(this.history=[],this.editorGroupService.isReady?this.loadHistory():(async()=>(await this.editorGroupService.whenReady,this.loadHistory()))())}loadHistory(){this.history=[];const e=this.loadHistoryFromStorage(),t=[...this.editorService.getEditors(ml.MOST_RECENTLY_ACTIVE)].reverse(),i=new Set;for(const{editor:s}of t)if(this.includeInHistory(s)){if(s.resource){const o=`${s.resource.toString()}/${s.editorId}`;if(i.has(o))continue;i.add(o)}this.addToHistory(s)}for(const s of e){const o=`${s.resource.toString()}/${s.options?.override}`;!i.has(o)&&this.includeInHistory(s)&&(i.add(o),this.addToHistory(s,!1))}}loadHistoryFromStorage(){const e=[],t=this.storageService.get(Ri.HISTORY_STORAGE_KEY,H.WORKSPACE);if(t)try{const i=JSON.parse(t);for(const s of i)if(!(!s.editor||!s.editor.resource))try{e.push({...s.editor,resource:typeof s.editor.resource=="string"?$.parse(s.editor.resource):$.from(s.editor.resource)})}catch(o){jn(o)}}catch(i){jn(i)}return e}saveState(){if(!this.history)return;const e=[];for(const t of this.history)tt(t)||!Zl(t)||e.push({editor:{...t,resource:t.resource.toString()}});this.storageService.store(Ri.HISTORY_STORAGE_KEY,JSON.stringify(e),H.WORKSPACE,Re.MACHINE)}getLastActiveWorkspaceRoot(e,t){const i=this.contextService.getWorkspace().folders;if(i.length!==0){if(i.length===1){const s=i[0].uri;return(!e||s.scheme===e)&&(!t||s.authority===t)?s:void 0}for(const s of this.getHistory()){if(tt(s)||e&&s.resource.scheme!==e||t&&s.resource.authority!==t)continue;const o=this.contextService.getWorkspaceFolder(s.resource);if(o)return o.uri}for(const s of i){const o=s.uri;if((!e||o.scheme===e)&&(!t||o.authority===t))return o}}}getLastActiveFile(e,t){for(const i of this.getHistory()){let s;if(tt(i)?s=Bt.getOriginalUri(i,{filterByScheme:e}):s=i.resource,s&&s.scheme===e&&(!t||s.authority===t))return s}}dispose(){super.dispose();for(const[,e]of this.editorGroupScopedNavigationStacks)e.disposable.dispose();for(const[,e]of this.editorScopedNavigationStacks)for(const[,t]of e)t.disposable.dispose();for(const[,e]of this.editorHistoryListeners)e.dispose()}},Ri=gi,gi.MOUSE_NAVIGATION_SETTING="workbench.editor.mouseBackForwardToNavigate",gi.NAVIGATION_SCOPE_SETTING="workbench.editor.navigationScope",gi.MAX_RECENTLY_CLOSED_EDITORS=20,gi.MAX_HISTORY_ITEMS=200,gi.HISTORY_STORAGE_KEY="history.entries",gi);Md=Ri=D([u(0,Q),u(1,Je),u(2,bs),u(3,ce),u(4,ie),u(5,Le),u(6,uS),u(7,F),u(8,He),u(9,se),u(10,Ue)],Md);pS(Gp,Md,gS.Eager);class am{constructor(e,t,i){this.editorIdentifier=e,this.selection=t,this.reason=i}justifiesNewNavigationEntry(e){if(this.editorIdentifier.groupId!==e.editorIdentifier.groupId||!this.editorIdentifier.editor.matches(e.editorIdentifier.editor)||!this.selection||!e.selection)return!0;const t=this.selection.compare(e.selection);return t===_d.SIMILAR&&(e.reason===fi.NAVIGATION||e.reason===fi.JUMP)?!0:t===_d.DIFFERENT}}let qr=class extends R{constructor(e,t){super(),this.scope=e,this.instantiationService=t,this.selectionsStack=this._register(this.instantiationService.createInstance(jr,qe.NONE,this.scope)),this.editsStack=this._register(this.instantiationService.createInstance(jr,qe.EDITS,this.scope)),this.navigationsStack=this._register(this.instantiationService.createInstance(jr,qe.NAVIGATION,this.scope)),this.stacks=[this.selectionsStack,this.editsStack,this.navigationsStack],this.onDidChange=L.any(this.selectionsStack.onDidChange,this.editsStack.onDidChange,this.navigationsStack.onDidChange)}canGoForward(e){return this.getStack(e).canGoForward()}goForward(e){return this.getStack(e).goForward()}canGoBack(e){return this.getStack(e).canGoBack()}goBack(e){return this.getStack(e).goBack()}goPrevious(e){return this.getStack(e).goPrevious()}canGoLast(e){return this.getStack(e).canGoLast()}goLast(e){return this.getStack(e).goLast()}getStack(e=qe.NONE){switch(e){case qe.NONE:return this.selectionsStack;case qe.EDITS:return this.editsStack;case qe.NAVIGATION:return this.navigationsStack}}handleActiveEditorChange(e){this.selectionsStack.notifyNavigation(e)}handleActiveEditorSelectionChange(e,t){const i=this.selectionsStack.current;this.selectionsStack.notifyNavigation(e,t),t.reason===fi.EDIT?this.editsStack.notifyNavigation(e,t):(t.reason===fi.NAVIGATION||t.reason===fi.JUMP)&&!this.selectionsStack.isNavigating()&&(t.reason===fi.JUMP&&!this.navigationsStack.isNavigating()&&i&&this.navigationsStack.addOrReplace(i.groupId,i.editor,i.selection),this.navigationsStack.notifyNavigation(e,t))}clear(){for(const e of this.stacks)e.clear()}remove(e){for(const t of this.stacks)t.remove(e)}move(e){for(const t of this.stacks)t.move(e)}};qr=D([u(1,F)],qr);class fx{constructor(){this.onDidChange=L.None}canGoForward(){return!1}async goForward(){}canGoBack(){return!1}async goBack(){}async goPrevious(){}canGoLast(){return!1}async goLast(){}handleActiveEditorChange(){}handleActiveEditorSelectionChange(){}clear(){}remove(){}move(){}dispose(){}}var Io;let jr=(Io=class extends R{get current(){return this.stack[this.index]}set current(e){e&&(this.stack[this.index]=e)}constructor(e,t,i,s,o,n){super(),this.filter=e,this.scope=t,this.editorService=s,this.editorGroupService=o,this.logService=n,this._onDidChange=this._register(new E),this.onDidChange=this._onDidChange.event,this.mapEditorToDisposable=new Map,this.mapGroupToDisposable=new Map,this.stack=[],this.index=-1,this.previousIndex=-1,this.navigating=!1,this.currentSelectionState=void 0,this.editorHelper=i.createInstance(Od),this.registerListeners()}registerListeners(){this._register(this.onDidChange(()=>this.traceStack())),this._register(this.logService.onDidChangeLogLevel(()=>this.traceStack()))}traceStack(){if(this.logService.getLevel()!==$g.Trace)return;const e=[];for(const t of this.stack)typeof t.selection?.log=="function"?e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: ${t.selection.log()}`):e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: <none>`);e.length===0?this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}: <empty>`):this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}
|
|
30
|
+
${e.join(`
|
|
31
|
+
`)}
|
|
32
|
+
`)}trace(e,t=null,i){if(this.logService.getLevel()!==$g.Trace)return;let s;switch(this.filter){case qe.NONE:s="global";break;case qe.EDITS:s="edits";break;case qe.NAVIGATION:s="navigation";break}let o;switch(this.scope){case Vt.DEFAULT:o="default";break;case Vt.EDITOR_GROUP:o="editorGroup";break;case Vt.EDITOR:o="editor";break}t!==null?this.logService.trace(`[History stack ${s}-${o}]: ${e} (editor: ${t?.resource?.toString()}, event: ${this.traceEvent(i)})`):this.logService.trace(`[History stack ${s}-${o}]: ${e}`)}traceEvent(e){if(!e)return"<none>";switch(e.reason){case fi.EDIT:return"edit";case fi.NAVIGATION:return"navigation";case fi.JUMP:return"jump";case fi.PROGRAMMATIC:return"programmatic";case fi.USER:return"user"}}registerGroupListeners(e){if(!this.mapGroupToDisposable.has(e)){const t=this.editorGroupService.getGroup(e);t&&this.mapGroupToDisposable.set(e,t.onWillMoveEditor(i=>this.onWillMoveEditor(i)))}}onWillMoveEditor(e){if(this.trace("onWillMoveEditor()",e.editor),this.scope!==Vt.EDITOR_GROUP)for(const t of this.stack)t.groupId===e.groupId&&this.editorHelper.matchesEditor(e.editor,t.editor)&&(t.groupId=e.target)}notifyNavigation(e,t){this.trace("notifyNavigation()",e?.input,t);const i=Jl(e),s=e?.input&&!e.input.isDisposed();this.navigating?(this.trace("notifyNavigation() ignoring (navigating)",e?.input,t),i&&s?(this.trace("notifyNavigation() updating current selection state",e?.input,t),this.currentSelectionState=new am({groupId:e.group.id,editor:e.input},e.getSelection(),t?.reason)):(this.trace("notifyNavigation() dropping current selection state",e?.input,t),this.currentSelectionState=void 0)):(this.trace("notifyNavigation() not ignoring",e?.input,t),i&&s?this.onSelectionAwareEditorNavigation(e.group.id,e.input,e.getSelection(),t):(this.currentSelectionState=void 0,s&&this.onNonSelectionAwareEditorNavigation(e.group.id,e.input)))}onSelectionAwareEditorNavigation(e,t,i,s){if(this.current?.groupId===e&&!i&&this.editorHelper.matchesEditor(this.current.editor,t))return;this.trace("onSelectionAwareEditorNavigation()",t,s);const o=new am({groupId:e,editor:t},i,s?.reason);!this.currentSelectionState||this.currentSelectionState.justifiesNewNavigationEntry(o)?this.doAdd(e,t,o.selection):this.doReplace(e,t,o.selection),this.currentSelectionState=o}onNonSelectionAwareEditorNavigation(e,t){this.current?.groupId===e&&this.editorHelper.matchesEditor(this.current.editor,t)||(this.trace("onNonSelectionAwareEditorNavigation()",t),this.doAdd(e,t))}doAdd(e,t,i){this.navigating||this.addOrReplace(e,t,i)}doReplace(e,t,i){this.navigating||this.addOrReplace(e,t,i,!0)}addOrReplace(e,t,i,s){this.registerGroupListeners(e);let o=!1;this.current&&(s||this.shouldReplaceStackEntry(this.current,{groupId:e,editor:t,selection:i}))&&(o=!0);const n=this.editorHelper.preferResourceEditorInput(t);if(!n)return;o?this.trace("replace()",n):this.trace("add()",n);const r={groupId:e,editor:n,selection:i},d=[];if(o)this.current&&d.push(this.current),this.current=r;else{if(this.stack.length>this.index+1){for(let l=this.index+1;l<this.stack.length;l++)d.push(this.stack[l]);this.stack=this.stack.slice(0,this.index+1)}this.stack.splice(this.index+1,0,r),this.stack.length>Zh.MAX_STACK_SIZE?(d.push(this.stack.shift()),this.previousIndex>=0&&this.previousIndex--):this.setIndex(this.index+1,!0)}for(const l of d)this.editorHelper.clearOnEditorDispose(l.editor,this.mapEditorToDisposable);tt(n)&&this.editorHelper.onEditorDispose(n,()=>this.remove(n),this.mapEditorToDisposable),this._onDidChange.fire()}shouldReplaceStackEntry(e,t){return e.groupId!==t.groupId||!this.editorHelper.matchesEditor(e.editor,t.editor)?!1:e.selection?t.selection?e.selection.compare(t.selection)===_d.IDENTICAL:!1:!0}move(e){if(e.isOperation(ho.MOVE))for(const t of this.stack)this.editorHelper.matchesEditor(e,t.editor)&&(t.editor={resource:e.target.resource})}remove(e){const t=this.stack.length;this.stack=this.stack.filter(i=>{const s=typeof e=="number"?i.groupId===e:this.editorHelper.matchesEditor(e,i.editor);return s&&this.editorHelper.clearOnEditorDispose(i.editor,this.mapEditorToDisposable),!s}),t!==this.stack.length&&(this.flatten(),this.index=this.stack.length-1,this.previousIndex=-1,typeof e=="number"&&(this.mapGroupToDisposable.get(e)?.dispose(),this.mapGroupToDisposable.delete(e)),this._onDidChange.fire())}flatten(){const e=[];let t;for(const i of this.stack)t&&this.shouldReplaceStackEntry(i,t)||(t=i,e.push(i));this.stack=e}clear(){this.index=-1,this.previousIndex=-1,this.stack.splice(0);for(const[,e]of this.mapEditorToDisposable)je(e);this.mapEditorToDisposable.clear();for(const[,e]of this.mapGroupToDisposable)je(e);this.mapGroupToDisposable.clear()}dispose(){super.dispose(),this.clear()}canGoForward(){return this.stack.length>this.index+1}async goForward(){if(!await this.maybeGoCurrent()&&this.canGoForward())return this.setIndex(this.index+1),this.navigate()}canGoBack(){return this.index>0}async goBack(){if(!await this.maybeGoCurrent()&&this.canGoBack())return this.setIndex(this.index-1),this.navigate()}async goPrevious(){if(!await this.maybeGoCurrent())return this.previousIndex===-1?this.goBack():(this.setIndex(this.previousIndex),this.navigate())}canGoLast(){return this.stack.length>0}async goLast(){if(this.canGoLast())return this.setIndex(this.stack.length-1),this.navigate()}async maybeGoCurrent(){return this.filter===qe.NONE||this.isCurrentSelectionActive()?!1:(await this.navigate(),!0)}isCurrentSelectionActive(){if(!this.current?.selection)return!1;const e=this.editorService.activeEditorPane;if(!Jl(e)||e.group.id!==this.current.groupId||!e.input||!this.editorHelper.matchesEditor(e.input,this.current.editor))return!1;const t=e.getSelection();return t?t.compare(this.current.selection)===_d.IDENTICAL:!1}setIndex(e,t){this.previousIndex=this.index,this.index=e,t||this._onDidChange.fire()}async navigate(){this.navigating=!0;try{this.current&&await this.doNavigate(this.current)}finally{this.navigating=!1}}doNavigate(e){let t=Object.create(null);return e.selection&&(t=e.selection.restore(t)),tt(e.editor)?this.editorService.openEditor(e.editor,t,e.groupId):this.editorService.openEditor({...e.editor,options:{...e.editor.options,...t}},e.groupId)}isNavigating(){return this.navigating}},Zh=Io,Io.MAX_STACK_SIZE=50,Io);jr=Zh=D([u(2,F),u(3,Q),u(4,Je),u(5,Ue)],jr);let Od=class{constructor(e,t,i,s){this.uriIdentityService=e,this.lifecycleService=t,this.fileService=i,this.pathService=s}preferResourceEditorInput(e){const t=Bt.getOriginalUri(e);if(t?.scheme===pe.file||t?.scheme===pe.vscodeRemote||t?.scheme===pe.vscodeUserData||t?.scheme===this.pathService.defaultUriScheme){if(tt(e)){const s=e.toUntyped();if(Zl(s))return s}return e}else return tt(e)?e:void 0}matchesEditor(e,t){return e instanceof Mr||e instanceof Hg?tt(t)?!1:e instanceof Mr?e.contains(t.resource,zg.DELETED):this.matchesFile(t.resource,e):tt(e)?tt(t)?e.matches(t):this.matchesFile(t.resource,e):tt(t)?this.matchesFile(e.resource,t):e&&t&&this.uriIdentityService.extUri.isEqual(e.resource,t.resource)}matchesFile(e,t){if(t instanceof Mr)return t.contains(e,zg.DELETED);if(t instanceof Hg)return this.uriIdentityService.extUri.isEqualOrParent(e,t.resource);if(tt(t)){const i=t.resource;return!i||this.lifecycleService.phase>=Da.Restored&&!this.fileService.hasProvider(i)?!1:this.uriIdentityService.extUri.isEqual(i,e)}return this.uriIdentityService.extUri.isEqual(t?.resource,e)}matchesEditorIdentifier(e,t){return!t?.group||e.groupId!==t.group.id?!1:t.input?e.editor.matches(t.input):!1}onEditorDispose(e,t,i){const s=L.once(e.onWillDispose)(()=>t());let o=i.get(e);o||(o=new O,i.set(e,o)),o.add(s)}clearOnEditorDispose(e,t){if(!tt(e))return;const i=t.get(e);i&&(je(i),t.delete(e))}};Od=D([u(0,rr),u(1,or),u(2,Le),u(3,Rc)],Od);const mx=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),wx=new q("activeCustomEditorId","",{type:"string",description:c(5523,"The viewType of the currently active custom editor.")}),yx=new q("focusedCustomEditorIsEditable",!1);var Nd;(function(a){a.default="default",a.builtin="builtin",a.option="option"})(Nd||(Nd={}));class dm{constructor(e){this.id=e.id,this.displayName=e.displayName,this.providerDisplayName=e.providerDisplayName,this.priority=e.priority,this.selector=e.selector}matches(e){return this.selector.some(t=>t.filenamePattern&&dd(t.filenamePattern,e))}}class Ll{constructor(e){this.allEditors=Ls(e,t=>t.id)}get length(){return this.allEditors.length}get defaultEditor(){return this.allEditors.find(e=>{switch(e.priority){case De.default:case De.builtin:return this.allEditors.every(t=>t===e||vx(t,e));default:return!1}})}get bestAvailableEditor(){return Array.from(this.allEditors).sort((t,i)=>ii(t.priority)-ii(i.priority))[0]}}function vx(a,e){return ii(a.priority)<ii(e.priority)}class bx{constructor(e){this._references=new Map,this._uriIdentityService=e}async getAllModels(e){const t=`${e.toString()}@@@`,i=[];for(const[s,o]of this._references)s.startsWith(t)&&o.model&&i.push(await o.model);return i}async get(e,t){const i=this.key(e,t);return this._references.get(i)?.model}tryRetain(e,t){const i=this.key(e,t),s=this._references.get(i);if(s)return s.counter++,s.model.then(o=>({object:o,dispose:Up(()=>{--s.counter<=0&&(s.model.then(n=>n.dispose()),this._references.delete(i))})}))}add(e,t,i){const s=this.key(e,t);if(this._references.get(s))throw new Error("Model already exists");return this._references.set(s,{viewType:t,model:i,counter:0}),this.tryRetain(e,t)}disposeAllModelsForView(e){for(const[t,i]of this._references)i.viewType===e&&(i.model.then(s=>s.dispose()),this._references.delete(t))}key(e,t){return e=this._uriIdentityService.asCanonicalUri(e),`${e.toString()}@@@${t}`}}const ui=Object.freeze({viewType:"viewType",displayName:"displayName",selector:"selector",priority:"priority"}),Cx={description:c(5525,"Contributed custom editors."),type:"array",defaultSnippets:[{body:[{[ui.viewType]:"$1",[ui.displayName]:"$2",[ui.selector]:[{filenamePattern:"$3"}]}]}],items:{type:"object",required:[ui.viewType,ui.displayName,ui.selector],properties:{[ui.viewType]:{type:"string",markdownDescription:c(5526,"Identifier for the custom editor. This must be unique across all custom editors, so we recommend including your extension id as part of `viewType`. The `viewType` is used when registering custom editors with `vscode.registerCustomEditorProvider` and in the `onCustomEditor:${id}` [activation event](https://code.visualstudio.com/api/references/activation-events).")},[ui.displayName]:{type:"string",description:c(5527,"Human readable name of the custom editor. This is displayed to users when selecting which editor to use.")},[ui.selector]:{type:"array",description:c(5528,"Set of globs that the custom editor is enabled for."),items:{type:"object",defaultSnippets:[{body:{filenamePattern:"$1"}}],properties:{filenamePattern:{type:"string",description:c(5529,"Glob that the custom editor is enabled for.")}}}},[ui.priority]:{type:"string",markdownDeprecationMessage:c(5530,"Controls if the custom editor is enabled automatically when the user opens a file. This may be overridden by users using the `workbench.editorAssociations` setting."),enum:[Nd.default,Nd.option],markdownEnumDescriptions:[c(5531,"The editor is automatically used when the user opens a resource, provided that no other default custom editors are registered for that resource."),c(5532,"The editor is not automatically used when the user opens a resource, but a user can switch to the editor using the `Reopen With` command.")],default:"default"}}}},Sx=jo.registerExtensionPoint({extensionPoint:"customEditors",deps:[fS],jsonSchema:Cx,activationEventsGenerator:(a,e)=>{for(const t of a){const i=t[ui.viewType];i&&e.push(`onCustomEditor:${i}`)}}});class _x extends R{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.customEditors}render(e){const t=e.contributes?.customEditors||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};const i=[c(5533,"View Type"),c(5534,"Priority"),c(5535,"Filename Pattern")],s=t.map(o=>[o.viewType,o.priority??"",Ss(o.selector.map(n=>n.filenamePattern)).join(", ")]);return{data:{headers:i,rows:s},dispose:()=>{}}}}z.as(Dc.ExtensionFeaturesRegistry).registerExtensionFeature({id:"customEditors",label:c(5536,"Custom Editors"),access:{canToggle:!1},renderer:new ee(_x)});const ro=class ro extends R{constructor(e){super(),this._editors=new Map,this._onChange=this._register(new E),this.onChange=this._onChange.event,this._memento=new pw(ro.CUSTOM_EDITORS_STORAGE_ID,e);const t=this._memento.getMemento(H.PROFILE,Re.MACHINE);for(const i of t[ro.CUSTOM_EDITORS_ENTRY_ID]||[])this.add(new dm(i));Sx.setHandler(i=>{this.update(i)})}update(e){this._editors.clear();for(const i of e)for(const s of i.value)this.add(new dm({id:s.viewType,displayName:s.displayName,providerDisplayName:i.description.isBuiltin?c(5522,"Built-in"):i.description.displayName||i.description.identifier.value,selector:s.selector||[],priority:Ex(s,i.description)}));const t=this._memento.getMemento(H.PROFILE,Re.MACHINE);t[ro.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._editors.values()),this._memento.saveMemento(),this._onChange.fire()}[Symbol.iterator](){return this._editors.values()}get(e){return this._editors.get(e)}getContributedEditors(e){return Array.from(this._editors.values()).filter(t=>t.matches(e))}add(e){if(this._editors.has(e.id)){console.error(`Custom editor with id '${e.id}' already registered`);return}this._editors.set(e.id,e)}};ro.CUSTOM_EDITORS_STORAGE_ID="customEditors",ro.CUSTOM_EDITORS_ENTRY_ID="editors";let Xh=ro;function Ex(a,e){switch(a.priority){case De.default:case De.option:return a.priority;case De.builtin:return e.isBuiltin?De.builtin:De.default;default:return De.default}}Pe(mx);let Qh=class extends R{constructor(e,t,i,s,o,n,r){super(),this.editorService=i,this.editorGroupService=s,this.instantiationService=o,this.uriIdentityService=n,this.editorResolverService=r,this._untitledCounter=0,this._editorResolverDisposables=this._register(new O),this._editorCapabilities=new Map,this._onDidChangeEditorTypes=this._register(new E),this.onDidChangeEditorTypes=this._onDidChangeEditorTypes.event,this._fileEditorFactory=z.as(ct.EditorFactory).getFileEditorFactory(),this._models=new bx(this.uriIdentityService),this._contributedEditors=this._register(new Xh(t)),this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this)),this._register(this._contributedEditors.onChange(()=>{this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this)),this._onDidChangeEditorTypes.fire()}));const d={contextKey:wx,getGroupContextKeyValue:p=>this.getActiveCustomEditorId(p),onDidChange:this.onDidChangeEditorTypes},l={contextKey:yx,getGroupContextKeyValue:p=>this.getCustomEditorIsEditable(p),onDidChange:this.onDidChangeEditorTypes};this._register(this.editorGroupService.registerContextKeyProvider(d)),this._register(this.editorGroupService.registerContextKeyProvider(l)),this._register(e.onDidRunOperation(p=>{p.isOperation(ho.MOVE)&&this.handleMovedFileInOpenedFileEditors(p.resource,this.uriIdentityService.asCanonicalUri(p.target.resource))}));const h=105;this._register(gw.addImplementation(h,"custom-editor",()=>this.withActiveCustomEditor(p=>p.undo()))),this._register(fw.addImplementation(h,"custom-editor",()=>this.withActiveCustomEditor(p=>p.redo())))}getEditorTypes(){return[...this._contributedEditors]}withActiveCustomEditor(e){const t=this.editorService.activeEditor;if(t instanceof Pt){const i=e(t);return i||!0}return!1}registerContributionPoints(){this._editorResolverDisposables.clear();for(const e of this._contributedEditors)for(const t of e.selector)t.filenamePattern&&this._editorResolverDisposables.add(this.editorResolverService.registerEditor(t.filenamePattern,{id:e.id,label:e.displayName,detail:e.providerDisplayName,priority:e.priority},{singlePerResource:()=>!(this.getCustomEditorCapabilities(e.id)?.supportsMultipleEditorsPerDocument??!1)},{createEditorInput:({resource:i},s)=>({editor:Pt.create(this.instantiationService,i,e.id,s.id)}),createUntitledEditorInput:({resource:i},s)=>({editor:Pt.create(this.instantiationService,i??$.from({scheme:pe.untitled,authority:`Untitled-${this._untitledCounter++}`}),e.id,s.id)}),createDiffEditorInput:(i,s)=>({editor:this.createDiffEditorInput(i,e.id,s)})}))}createDiffEditorInput(e,t,i){const s=Pt.create(this.instantiationService,Ee(e.modified.resource),t,i.id,{customClasses:"modified"}),o=Pt.create(this.instantiationService,Ee(e.original.resource),t,i.id,{customClasses:"original"});return this.instantiationService.createInstance(Aa,e.label,e.description,o,s,!0)}get models(){return this._models}getCustomEditor(e){return this._contributedEditors.get(e)}getContributedCustomEditors(e){return new Ll(this._contributedEditors.getContributedEditors(e))}getUserConfiguredCustomEditors(e){const t=this.editorResolverService.getAssociationsForResource(e);return new Ll(Ss(t.map(i=>this._contributedEditors.get(i.viewType))))}getAllCustomEditors(e){return new Ll([...this.getUserConfiguredCustomEditors(e).allEditors,...this.getContributedCustomEditors(e).allEditors])}registerCustomEditorCapabilities(e,t){if(this._editorCapabilities.has(e))throw new Error(`Capabilities for ${e} already set`);return this._editorCapabilities.set(e,t),ae(()=>{this._editorCapabilities.delete(e)})}getCustomEditorCapabilities(e){return this._editorCapabilities.get(e)}getActiveCustomEditorId(e){const t=e.activeEditorPane;return t?.input?.resource&&t?.input instanceof Pt?t.input.viewType:""}getCustomEditorIsEditable(e){const t=e.activeEditorPane;return t?.input?.resource?t?.input instanceof Pt:!1}async handleMovedFileInOpenedFileEditors(e,t){if(Pi(e).toLowerCase()===Pi(t).toLowerCase())return;const i=this.getAllCustomEditors(t);if(!i.allEditors.some(o=>o.priority!==De.option))return;const s=new Map;for(const o of this.editorGroupService.groups)for(const n of o.editors)if(this._fileEditorFactory.isFileEditor(n)&&!(n instanceof Pt)&&dt(n.resource,t)){let r=s.get(o.id);r||(r=[],s.set(o.id,r)),r.push(n)}if(s.size)for(const[o,n]of s)this.editorService.replaceEditors(n.map(r=>{let d;if(i.defaultEditor){const l=i.defaultEditor.id;d=Pt.create(this.instantiationService,t,l,o)}else d={resource:t,options:{override:Ct.id}};return{editor:r,replacement:d,options:{preserveFocus:!0}}}),o)}};Qh=D([u(0,Le),u(1,ce),u(2,Q),u(3,Je),u(4,F),u(5,rr),u(6,Ta)],Qh);let eu=class extends R{constructor(e,t){super(),this._themeService=e,this._configurationService=t,this._cachedWebViewThemeData=void 0,this._onThemeDataChanged=this._register(new E),this.onThemeDataChanged=this._onThemeDataChanged.event,this._register(this._themeService.onDidColorThemeChange(()=>{this._reset()}));const i=["editor.fontFamily","editor.fontWeight","editor.fontSize","accessibility.underlineLinks"];this._register(this._configurationService.onDidChangeConfiguration(s=>{i.some(o=>s.affectsConfiguration(o))&&this._reset()}))}getTheme(){return this._themeService.getColorTheme()}getWebviewThemeData(){if(!this._cachedWebViewThemeData){const e=this._configurationService.getValue("editor"),t=e.fontFamily||cd.fontFamily,i=e.fontWeight||cd.fontWeight,s=e.fontSize||cd.fontSize,o=this._configurationService.getValue("accessibility.underlineLinks"),n=this._themeService.getColorTheme(),r=mS().getColors().reduce((h,p)=>{const f=n.getColor(p.id);return f&&(h["vscode-"+p.id.replace(".","-")]=f.toString()),h},{}),d={"vscode-font-family":wS,"vscode-font-weight":"normal","vscode-font-size":"13px","vscode-editor-font-family":t,"vscode-editor-font-weight":i,"vscode-editor-font-size":s+"px","text-link-decoration":o?"underline":"none",...r},l=ua.fromTheme(n);this._cachedWebViewThemeData={styles:d,activeTheme:l,themeLabel:n.label,themeId:n.settingsId}}return this._cachedWebViewThemeData}_reset(){this._cachedWebViewThemeData=void 0,this._onThemeDataChanged.fire()}};eu=D([u(0,IT),u(1,ie)],eu);var ua;(function(a){a.light="vscode-light",a.dark="vscode-dark",a.highContrast="vscode-high-contrast",a.highContrastLight="vscode-high-contrast-light"})(ua||(ua={}));(function(a){function e(t){switch(t.type){case ln.LIGHT:return a.light;case ln.DARK:return a.dark;case ln.HIGH_CONTRAST_DARK:return a.highContrast;case ln.HIGH_CONTRAST_LIGHT:return a.highContrastLight}}a.fromTheme=e})(ua||(ua={}));class Ix{constructor(e,t,i){this._getExtensionLocation=e,this._getMappings=t,this.tunnelService=i,this._tunnels=new Map}async getRedirect(e,t){const i=$.parse(t),s=yS(i);if(s){for(const o of this._getMappings())if(o.webviewPort===s.port){const n=this._getExtensionLocation();if(n&&n.scheme===pe.vscodeRemote){const r=e&&await this.getOrCreateTunnel(e,o.extensionHostPort);if(r)return r.tunnelLocalPort===o.webviewPort?void 0:encodeURI(i.with({authority:`127.0.0.1:${r.tunnelLocalPort}`}).toString(!0))}if(o.webviewPort!==o.extensionHostPort)return encodeURI(i.with({authority:`${s.address}:${o.extensionHostPort}`}).toString(!0))}}}async dispose(){for(const e of this._tunnels.values())await e.dispose();this._tunnels.clear()}async getOrCreateTunnel(e,t){const i=this._tunnels.get(t);if(i)return i;const s=await this.tunnelService.openTunnel({getAddress:async()=>e},void 0,t);let o;return typeof s=="string"&&(o=void 0),o&&this._tunnels.set(t,o),o}}const Dx=new Map([[".svg","image/svg+xml"],[".txt",Or.text],[".css","text/css"],[".js","application/javascript"],[".cjs","application/javascript"],[".mjs","application/javascript"],[".json","application/json"],[".html","text/html"],[".htm","text/html"],[".xhtml","application/xhtml+xml"],[".oft","font/otf"],[".xml","application/xml"],[".wasm","application/wasm"]]);function Ax(a){const e=vS(a.fsPath).toLowerCase();return Dx.get(e)||bS(a.fsPath)||Or.unknown}var ns;(function(a){let e;(function(s){s[s.Success=0]="Success",s[s.Failed=1]="Failed",s[s.AccessDenied=2]="AccessDenied",s[s.NotModified=3]="NotModified"})(e=a.Type||(a.Type={}));class t{constructor(o,n,r,d){this.stream=o,this.etag=n,this.mtime=r,this.mimeType=d,this.type=e.Success}}a.StreamSuccess=t,a.Failed={type:e.Failed},a.AccessDenied={type:e.AccessDenied};class i{constructor(o,n){this.mimeType=o,this.mtime=n,this.type=e.NotModified}}a.NotModified=i})(ns||(ns={}));async function Tx(a,e,t,i,s){i.debug(`loadLocalResource - begin. requestUri=${a}`);const o=xx(a,e.roots);if(i.debug(`loadLocalResource - found resource to load. requestUri=${a}, resourceToLoad=${o}`),!o)return ns.AccessDenied;const n=Ax(a);try{const r=await t.readFileStream(o,{etag:e.ifNoneMatch},s);return new ns.StreamSuccess(r.value,r.etag,r.mtime,n)}catch(r){return r instanceof mw&&r.fileOperationResult===Dr.FILE_NOT_MODIFIED_SINCE?new ns.NotModified(n,r.options?.mtime):(i.debug(`loadLocalResource - Error using fileReader. requestUri=${a}`),console.log(r),ns.Failed)}}function xx(a,e){for(const t of e)if(kx(t,a))return Rx(a)}function kx(a,e){if(a.scheme!==e.scheme)return!1;let t=qg(e.fsPath),i=qg(a.fsPath+(a.fsPath.endsWith(Nr)?"":Nr));return jg(a.fsPath)&&jg(e.fsPath)&&(i=i.toLowerCase(),t=t.toLowerCase()),t.startsWith(i)}function Rx(a){return a.scheme===pe.vscodeRemote?$.from({scheme:pe.vscodeRemote,authority:a.authority,path:"/vscode-resource",query:JSON.stringify({requestResourcePath:a.path})}):a}const Lx=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Pe(Lx);const Vx=c(5264,"Find"),Px=c(5265,"Find"),Mx=c(5266,"Previous Match"),Ox=c(5267,"Next Match"),Nx=c(5268,"Close"),sd=310,Bx=73;class Fx extends Ac{constructor(e,t,i,s,o){super(),this._keybindingService=o,this._isVisible=!1,this._foundMatch=!1,this._width=0,this.state=this._register(new CS),this._matchesLimit=e.matchesLimit??Number.MAX_SAFE_INTEGER,this._findInput=this._register(new SS(null,t,{label:Vx,placeholder:Px,validation:d=>{if(d.length===0||!this._findInput.getRegex())return null;try{return new RegExp(d),null}catch(l){return this._foundMatch=!1,this.updateButtons(this._foundMatch),{content:l.message}}},showCommonFindToggles:e.showCommonFindToggles,appendCaseSensitiveLabel:e.appendCaseSensitiveActionId?this._getKeybinding(e.appendCaseSensitiveActionId):void 0,appendRegexLabel:e.appendRegexActionId?this._getKeybinding(e.appendRegexActionId):void 0,appendWholeWordsLabel:e.appendWholeWordsActionId?this._getKeybinding(e.appendWholeWordsActionId):void 0,showHistoryHint:()=>dw(o),inputBoxStyles:Tc,toggleStyles:Hp},i)),this._updateHistoryDelayer=this._register(new _S(500)),this._register(this._findInput.onInput(async d=>{(!e.checkImeCompletionState||!this._findInput.isImeSessionInProgress)&&(this._foundMatch=this._onInputChanged(),e.showResultCount&&await this.updateResultCount(),this.updateButtons(this._foundMatch),this.focusFindBox(),this._delayedUpdateHistory())})),this._findInput.setRegex(!!this.state.isRegex),this._findInput.setCaseSensitive(!!this.state.matchCase),this._findInput.setWholeWords(!!this.state.wholeWord),this._register(this._findInput.onDidOptionChange(()=>{this.state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this.state.onFindReplaceStateChange(()=>{this._findInput.setRegex(this.state.isRegex),this._findInput.setWholeWords(this.state.wholeWord),this._findInput.setCaseSensitive(this.state.matchCase),this.findFirst()})),this.prevBtn=this._register(new wl({label:Mx+(e.previousMatchActionId?this._getKeybinding(e.previousMatchActionId):""),icon:ES,onTrigger:()=>{this.find(!0)}},s)),this.nextBtn=this._register(new wl({label:Ox+(e.nextMatchActionId?this._getKeybinding(e.nextMatchActionId):""),icon:IS,onTrigger:()=>{this.find(!1)}},s));const n=this._register(new wl({label:Nx+(e.closeWidgetActionId?this._getKeybinding(e.closeWidgetActionId):""),icon:DS,onTrigger:()=>{this.hide()}},s));this._innerDomNode=document.createElement("div"),this._innerDomNode.classList.add("simple-find-part"),this._innerDomNode.appendChild(this._findInput.domNode),this._innerDomNode.appendChild(this.prevBtn.domNode),this._innerDomNode.appendChild(this.nextBtn.domNode),this._innerDomNode.appendChild(n.domNode),this._domNode=document.createElement("div"),this._domNode.classList.add("simple-find-part-wrapper"),this._domNode.appendChild(this._innerDomNode),this.onkeyup(this._innerDomNode,d=>{if(d.equals(y.Escape)){this.hide(),d.preventDefault();return}}),this._focusTracker=this._register(zn(this._innerDomNode)),this._register(this._focusTracker.onDidFocus(this._onFocusTrackerFocus.bind(this))),this._register(this._focusTracker.onDidBlur(this._onFocusTrackerBlur.bind(this))),this._findInputFocusTracker=this._register(zn(this._findInput.domNode)),this._register(this._findInputFocusTracker.onDidFocus(this._onFindInputFocusTrackerFocus.bind(this))),this._register(this._findInputFocusTracker.onDidBlur(this._onFindInputFocusTrackerBlur.bind(this))),this._register(J(this._innerDomNode,"click",d=>{d.stopPropagation()})),e?.showResultCount&&(this._domNode.classList.add("result-count"),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._findInput.domNode.insertAdjacentElement("afterend",this._matchesCount),this._register(this._findInput.onDidChange(async()=>{await this.updateResultCount()})),this._register(this._findInput.onDidOptionChange(async()=>{this._foundMatch=this._onInputChanged(),await this.updateResultCount(),this.focusFindBox(),this._delayedUpdateHistory()})));let r=e?.initialWidth;if(r&&(r=r<sd?sd:r,this._domNode.style.width=`${r}px`),e?.enableSash){const d=r??sd;let l=d;const h=this._register(new AS(this._innerDomNode,this,{orientation:Z.VERTICAL,size:1}));this._register(h.onDidStart(()=>{l=parseFloat(Yg(this._domNode).width)})),this._register(h.onDidChange(p=>{const f=l+p.startX-p.currentX;f<d||(this._domNode.style.width=`${f}px`)})),this._register(h.onDidReset(p=>{parseFloat(Yg(this._domNode).width)===d?this._domNode.style.width="100%":this._domNode.style.width=`${d}px`}))}}getVerticalSashLeft(e){return 0}get inputValue(){return this._findInput.getValue()}get focusTracker(){return this._focusTracker}_getKeybinding(e){const t=this._keybindingService?.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}dispose(){super.dispose(),this._domNode?.remove()}isVisible(){return this._isVisible}getDomNode(){return this._domNode}getFindInputDomNode(){return this._findInput.domNode}reveal(e,t=!0){if(e&&this._findInput.setValue(e),this._isVisible){this._findInput.select();return}this._isVisible=!0,this.updateResultCount(),this.layout(),setTimeout(()=>{this._innerDomNode.classList.toggle("suppress-transition",!t),this._innerDomNode.classList.add("visible","visible-transition"),this._innerDomNode.setAttribute("aria-hidden","false"),this._findInput.select(),t||setTimeout(()=>{this._innerDomNode.classList.remove("suppress-transition")},0)},0)}show(e){e&&!this._isVisible&&this._findInput.setValue(e),this._isVisible=!0,this.layout(),setTimeout(()=>{this._innerDomNode.classList.add("visible","visible-transition"),this._innerDomNode.setAttribute("aria-hidden","false")},0)}hide(e=!0){this._isVisible&&(this._innerDomNode.classList.toggle("suppress-transition",!e),this._innerDomNode.classList.remove("visible-transition"),this._innerDomNode.setAttribute("aria-hidden","true"),setTimeout(()=>{this._isVisible=!1,this.updateButtons(this._foundMatch),this._innerDomNode.classList.remove("visible","suppress-transition")},e?200:0))}layout(e=this._width){if(this._width=e,!!this._isVisible&&this._matchesCount){let t=!1;sd+Bx+28>=e&&(t=!0),this._innerDomNode.classList.toggle("reduced-find-widget",t)}}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this))}_updateHistory(){this._findInput.inputBox.addToHistory()}_getRegexValue(){return this._findInput.getRegex()}_getWholeWordValue(){return this._findInput.getWholeWords()}_getCaseSensitiveValue(){return this._findInput.getCaseSensitive()}updateButtons(e){const t=this.inputValue.length>0;this.prevBtn.setEnabled(this._isVisible&&t&&e),this.nextBtn.setEnabled(this._isVisible&&t&&e)}focusFindBox(){this.nextBtn.focus(),this._findInput.inputBox.focus()}async updateResultCount(){if(!this._matchesCount){this.updateButtons(this._foundMatch);return}const e=await this._getResultCount();this._matchesCount.innerText="";const t=this.inputValue.length>0&&e?.resultCount===0;this._matchesCount.classList.toggle("no-results",t);let i="";if(e?.resultCount){let s=String(e.resultCount);e.resultCount>=this._matchesLimit&&(s+="+");let o=String(e.resultIndex+1);o==="0"&&(o="?"),i=Ar(TS,o,s)}else i=Jg;xS(this._announceSearchResults(i,this.inputValue)),this._matchesCount.appendChild(document.createTextNode(i)),this._foundMatch=!!e&&e.resultCount>0,this.updateButtons(this._foundMatch)}changeState(e){this.state.change(e,!1)}_announceSearchResults(e,t){return t?e===Jg?t===""?c(5270,"{0} found",e):c(5271,"{0} found for '{1}'",e,t):c(5272,"{0} found for '{1}'",e,t):c(5269,"Enter search input")}}const Kx=he("simpleFindWidget.sashBorder",{dark:"#454545",light:"#C8C8C8",hcDark:"#6FC3DF",hcLight:"#0F4A85"},c(5273,"Border color of the sash border."));ww((a,e)=>{const t=a.getColor(Kx);e.addRule(`.monaco-workbench .simple-find-part .monaco-sash { background-color: ${t}; border-color: ${t} }`)});let tu=class extends Fx{async _getResultCount(e){}constructor(e,t,i,s,o){super({showCommonFindToggles:!1,checkImeCompletionState:e.checkImeCompletionState,enableSash:!0},t,i,s,o),this._delegate=e,this._findWidgetFocused=zp.bindTo(i),this._register(e.hasFindResult(n=>{this.updateButtons(n),this.focusFindBox()})),this._register(e.onDidStopFind(()=>{this.updateButtons(!1)}))}find(e){const t=this.inputValue;t&&this._delegate.find(t,e)}hide(e=!0){super.hide(e),this._delegate.stopFind(!0),this._delegate.focus()}_onInputChanged(){const e=this.inputValue;return e?this._delegate.updateFind(e):this._delegate.stopFind(!1),!1}_onFocusTrackerFocus(){this._findWidgetFocused.set(!0)}_onFocusTrackerBlur(){this._findWidgetFocused.reset()}_onFindInputFocusTrackerFocus(){}_onFindInputFocusTrackerBlur(){}findFirst(){}};tu=D([u(1,dr),u(2,se),u(3,Tt),u(4,it)],tu);var no;(function(a){let e;(function(i){i[i.Initializing=0]="Initializing",i[i.Ready=1]="Ready"})(e=a.Type||(a.Type={}));class t{constructor(s){this.pendingMessages=s,this.type=e.Initializing}}a.Initializing=t,a.Ready={type:e.Ready}})(no||(no={}));const Wx="webviewId";let iu=class extends R{get window(){return typeof this._windowId=="number"?Lc(this._windowId)?.window:void 0}get platform(){return"browser"}get element(){return this._element}get isFocused(){return!(!this._focused||!this.window||this.window.document.activeElement&&this.window.document.activeElement!==this.element)}constructor(e,t,i,s,o,n,r,d,l,h,p,f){super(),this.webviewThemeDataProvider=t,this._environmentService=n,this._fileService=r,this._logService=d,this._remoteAuthorityResolverService=l,this._tunnelService=h,this._accessibilityService=f,this.id=nr(),this._windowId=void 0,this._expectedServiceWorkerVersion=4,this._state=new no.Initializing([]),this._resourceLoadingCts=this._register(new qs),this._focusDelayer=this._register(new kS(50)),this._onDidHtmlChange=this._register(new E),this.onDidHtmlChange=this._onDidHtmlChange.event,this._messageHandlers=new Map,this.checkImeCompletionState=!0,this._disposed=!1,this._onMissingCsp=this._register(new E),this.onMissingCsp=this._onMissingCsp.event,this._onDidClickLink=this._register(new E),this.onDidClickLink=this._onDidClickLink.event,this._onDidReload=this._register(new E),this.onDidReload=this._onDidReload.event,this._onMessage=this._register(new E),this.onMessage=this._onMessage.event,this._onDidScroll=this._register(new E),this.onDidScroll=this._onDidScroll.event,this._onDidWheel=this._register(new E),this.onDidWheel=this._onDidWheel.event,this._onDidUpdateState=this._register(new E),this.onDidUpdateState=this._onDidUpdateState.event,this._onDidFocus=this._register(new E),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new E),this.onDidBlur=this._onDidBlur.event,this._onFatalError=this._register(new E),this.onFatalError=this._onFatalError.event,this._onDidDispose=this._register(new E),this.onDidDispose=this._onDidDispose.event,this._hasAlertedAboutMissingCsp=!1,this._hasFindResult=this._register(new E),this.hasFindResult=this._hasFindResult.event,this._onDidStopFind=this._register(new E),this.onDidStopFind=this._onDidStopFind.event,this.providedViewType=e.providedViewType,this.origin=e.origin??this.id,this._options=e.options,this.extension=e.extension,this._content={html:"",title:e.title,options:e.contentOptions,state:void 0},this._portMappingManager=this._register(new Ix(()=>this.extension?.location,()=>this._content.options.portMapping||[],this._tunnelService)),this._element=this._createElement(e.options,e.contentOptions),this._register(this.on("no-csp-found",()=>{this.handleNoCspFound()})),this._register(this.on("did-click-link",({uri:g})=>{this._onDidClickLink.fire(g)})),this._register(this.on("onmessage",({message:g,transfer:m})=>{this._onMessage.fire({message:g,transfer:m})})),this._register(this.on("did-scroll",({scrollYPercentage:g})=>{this._onDidScroll.fire({scrollYPercentage:g})})),this._register(this.on("do-reload",()=>{this.reload()})),this._register(this.on("do-update-state",g=>{this.state=g,this._onDidUpdateState.fire(g)})),this._register(this.on("did-focus",()=>{this.handleFocusChange(!0)})),this._register(this.on("did-blur",()=>{this.handleFocusChange(!1)})),this._register(this.on("did-scroll-wheel",g=>{this._onDidWheel.fire(g)})),this._register(this.on("did-find",({didFind:g})=>{this._hasFindResult.fire(g)})),this._register(this.on("fatal-error",g=>{o.error(c(11741,"Error loading webview: {0}",g.message)),this._onFatalError.fire({message:g.message})})),this._register(this.on("did-keydown",g=>{this.handleKeyEvent("keydown",g)})),this._register(this.on("did-keyup",g=>{this.handleKeyEvent("keyup",g)})),this._register(this.on("did-context-menu",g=>{if(!this.element||!this._contextKeyService)return;const m=this.element.getBoundingClientRect(),v=this._contextKeyService.createOverlay([...Object.entries(g.context),[Wx,this.providedViewType]]);s.showContextMenu({menuId:w.WebviewContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:v,getActionsContext:()=>({...g.context,webview:this.providedViewType}),getAnchor:()=>({x:m.x+g.clientX,y:m.y+g.clientY})}),this._send("set-context-menu-visible",{visible:!0})})),this._register(this.on("load-resource",async g=>{try{const m=RS(g.authority),v=$.from({scheme:g.scheme,authority:m,path:decodeURIComponent(g.path),query:g.query?decodeURIComponent(g.query):g.query});this.loadResource(g.id,v,g.ifNoneMatch)}catch{this._send("did-load-resource",{id:g.id,status:404,path:g.path})}})),this._register(this.on("load-localhost",g=>{this.localLocalhost(g.id,g.origin)})),this._register(L.runAndSubscribe(t.onThemeDataChanged,()=>this.style())),this._register(f.onDidChangeReducedMotion(()=>this.style())),this._register(f.onDidChangeScreenReaderOptimized(()=>this.style())),this._register(s.onDidHideContextMenu(()=>this._send("set-context-menu-visible",{visible:!1}))),this._confirmBeforeClose=i.getValue("window.confirmBeforeClose"),this._register(i.onDidChangeConfiguration(g=>{g.affectsConfiguration("window.confirmBeforeClose")&&(this._confirmBeforeClose=i.getValue("window.confirmBeforeClose"),this._send("set-confirm-before-close",this._confirmBeforeClose))})),this._register(this.on("drag-start",()=>{this._startBlockingIframeDragEvents()})),this._register(this.on("drag",g=>{this.handleDragEvent("drag",g)})),e.options.enableFindWidget&&(this._webviewFindWidget=this._register(p.createInstance(tu,this)))}dispose(){if(this._disposed=!0,this.element?.remove(),this._element=void 0,this._messagePort=void 0,this._state.type===no.Type.Initializing){for(const e of this._state.pendingMessages)e.resolve(!1);this._state.pendingMessages=[]}this._onDidDispose.fire(),this._resourceLoadingCts.dispose(!0),super.dispose()}setContextKeyService(e){this._contextKeyService=e}postMessage(e,t){return this._send("message",{message:e,transfer:t})}async _send(e,t,i=[]){if(this._state.type===no.Type.Initializing){const{promise:s,resolve:o}=yw();return this._state.pendingMessages.push({channel:e,data:t,transferable:i,resolve:o}),s}else return this.doPostMessage(e,t,i)}_createElement(e,t){const i=document.createElement("iframe");i.name=this.id,i.className=`webview ${e.customClasses||""}`,i.sandbox.add("allow-scripts","allow-same-origin","allow-forms","allow-pointer-lock","allow-downloads");const s=["cross-origin-isolated","autoplay"];return Zg||s.push("clipboard-read","clipboard-write"),i.setAttribute("allow",s.join("; ")),i.style.border="none",i.style.width="100%",i.style.height="100%",i.focus=()=>{this._doFocus()},i}_initElement(e,t,i,s){const o={id:this.id,parentId:s.vscodeWindowId.toString(),origin:this.origin,swVersion:String(this._expectedServiceWorkerVersion),extensionId:t?.id.value??"",platform:this.platform,"vscode-resource-base-authority":VS,parentOrigin:s.origin};this._options.disableServiceWorker&&(o.disableServiceWorker="true"),this._environmentService.remoteAuthority&&(o.remoteAuthority=this._environmentService.remoteAuthority),i.purpose&&(o.purpose=i.purpose),o.serviceWorkerUri=Br.asBrowserUri("vs/workbench/contrib/webview/browser/pre/service-worker.js").toString(!0),o.fakeHtmlUri=Br.asBrowserUri("vs/workbench/contrib/webview/browser/pre/fake.html").toString(!0),LS.addSearchParam(o,!0,!0);const n=new URLSearchParams(o).toString(),r=Zg?"index-no-csp.html":"index.html",d=Br.asBrowserUri(`vs/workbench/contrib/webview/browser/pre/${r}`);this.element.setAttribute("src",`${d.toString(!0)}?${n}`)}mountTo(e,t){if(this.element){this._windowId=t.vscodeWindowId,this._encodedWebviewOriginPromise=PS(t.origin,this.origin).then(i=>this._encodedWebviewOrigin=i),this._encodedWebviewOriginPromise.then(i=>{this._disposed||this._initElement(i,this.extension,this._options,t)}),this._registerMessageHandler(t),this._webviewFindWidget&&e.appendChild(this._webviewFindWidget.getDomNode());for(const i of[te.MOUSE_DOWN,te.MOUSE_MOVE,te.DROP])this._register(J(e,i,()=>{this._stopBlockingIframeDragEvents()}));for(const i of[e,t])this._register(J(i,te.DRAG_END,()=>{this._stopBlockingIframeDragEvents()}));e.id=this.id,e.appendChild(this.element)}}_registerMessageHandler(e){const t=this._register(J(e,"message",i=>{if(!(!this._encodedWebviewOrigin||i?.data?.target!==this.id)&&i.data.channel==="webview-ready"){if(this._messagePort)return;this._logService.debug(`Webview(${this.id}): webview ready`),this._messagePort=i.ports[0],this._messagePort.onmessage=s=>{const o=this._messageHandlers.get(s.data.channel);if(!o){console.log(`No handlers found for '${s.data.channel}'`);return}o?.forEach(n=>n(s.data.data,s))},this.element?.classList.add("ready"),this._state.type===no.Type.Initializing&&this._state.pendingMessages.forEach(({channel:s,data:o,resolve:n})=>n(this.doPostMessage(s,o))),this._state=no.Ready,t.dispose()}}))}_startBlockingIframeDragEvents(){this.element&&(this.element.style.pointerEvents="none")}_stopBlockingIframeDragEvents(){this.element&&(this.element.style.pointerEvents="auto")}webviewContentEndpoint(e){const t=this._environmentService.webviewExternalEndpoint;if(!t)throw new Error("'webviewExternalEndpoint' has not been configured. Webviews will not work!");const i=t.replace("{{uuid}}",e);return i[i.length-1]==="/"?i.slice(0,i.length-1):i}doPostMessage(e,t,i=[]){return this.element&&this._messagePort?(this._messagePort.postMessage({channel:e,args:t},i),!0):!1}on(e,t){let i=this._messageHandlers.get(e);return i||(i=new Set,this._messageHandlers.set(e,i)),i.add(t),ae(()=>{this._messageHandlers.get(e)?.delete(t)})}handleNoCspFound(){this._hasAlertedAboutMissingCsp||(this._hasAlertedAboutMissingCsp=!0,this.extension?.id&&this._environmentService.isExtensionDevelopment&&this._onMissingCsp.fire(this.extension.id))}reload(){this.doUpdateContent(this._content);const e=this._register(this.on("did-load",()=>{this._onDidReload.fire(),e.dispose()}))}setHtml(e){this.doUpdateContent({...this._content,html:e}),this._onDidHtmlChange.fire(e)}setTitle(e){this._content={...this._content,title:e},this._send("set-title",e)}set contentOptions(e){if(this._logService.debug(`Webview(${this.id}): will update content options`),MS(e,this._content.options)){this._logService.debug(`Webview(${this.id}): skipping content options update`);return}this.doUpdateContent({...this._content,options:e})}set localResourcesRoot(e){this._content={...this._content,options:{...this._content.options,localResourceRoots:e}}}set state(e){this._content={...this._content,state:e}}set initialScrollProgress(e){this._send("initial-scroll-position",e)}doUpdateContent(e){this._logService.debug(`Webview(${this.id}): will update content`),this._content=e;const t=!!this._content.options.allowScripts;this._send("content",{contents:this._content.html,title:this._content.title,options:{allowMultipleAPIAcquire:!!this._content.options.allowMultipleAPIAcquire,allowScripts:t,allowForms:this._content.options.allowForms??t},state:this._content.state,cspSource:OS,confirmBeforeClose:this._confirmBeforeClose})}style(){let{styles:e,activeTheme:t,themeLabel:i,themeId:s}=this.webviewThemeDataProvider.getWebviewThemeData();this._options.transformCssVariables&&(e=this._options.transformCssVariables(e));const o=this._accessibilityService.isMotionReduced(),n=this._accessibilityService.isScreenReaderOptimized();this._send("styles",{styles:e,activeTheme:t,themeId:s,themeLabel:i,reduceMotion:o,screenReader:n})}handleFocusChange(e){this._focused=e,e?this._onDidFocus.fire():this._onDidBlur.fire()}handleKeyEvent(e,t){const i=new KeyboardEvent(e,t);Object.defineProperty(i,"target",{get:()=>this.element}),this.window?.dispatchEvent(i)}handleDragEvent(e,t){const i=new DragEvent(e,t);Object.defineProperty(i,"target",{get:()=>this.element}),this.window?.dispatchEvent(i)}windowDidDragStart(){this._startBlockingIframeDragEvents()}windowDidDragEnd(){this._stopBlockingIframeDragEvents()}selectAll(){this.execCommand("selectAll")}copy(){this.execCommand("copy")}paste(){this.execCommand("paste")}cut(){this.execCommand("cut")}undo(){this.execCommand("undo")}redo(){this.execCommand("redo")}execCommand(e){this.element&&this._send("execCommand",e)}async loadResource(e,t,i){try{const s=await Tx(t,{ifNoneMatch:i,roots:this._content.options.localResourceRoots||[]},this._fileService,this._logService,this._resourceLoadingCts.token);switch(s.type){case ns.Type.Success:{const o=await this.streamToBuffer(s.stream);return this._send("did-load-resource",{id:e,status:200,path:t.path,mime:s.mimeType,data:o,etag:s.etag,mtime:s.mtime},[o])}case ns.Type.NotModified:return this._send("did-load-resource",{id:e,status:304,path:t.path,mime:s.mimeType,mtime:s.mtime});case ns.Type.AccessDenied:return this._send("did-load-resource",{id:e,status:401,path:t.path})}}catch{}return this._send("did-load-resource",{id:e,status:404,path:t.path})}async streamToBuffer(e){return(await NS(e)).buffer.buffer}async localLocalhost(e,t){const i=this._environmentService.remoteAuthority,s=i?await this._remoteAuthorityResolverService.resolveAuthority(i):void 0,o=s?await this._portMappingManager.getRedirect(s.authority,t):void 0;return this._send("did-load-localhost",{id:e,origin:t,location:o})}focus(){this._doFocus(),this.handleFocusChange(!0)}_doFocus(){if(this.element){try{this.element.contentWindow?.focus()}catch{}this._focusDelayer.trigger(async()=>{!this.isFocused||!this.element||this.window?.document.activeElement&&this.window.document.activeElement!==this.element&&this.window.document.activeElement?.tagName!=="BODY"||(this.window?.document.body?.focus(),this._send("focus",void 0))})}}find(e,t){this.element&&this._send("find",{value:e,previous:t})}updateFind(e){!e||!this.element||this._send("find",{value:e})}stopFind(e){this.element&&(this._send("find-stop",{clearSelection:!e}),this._onDidStopFind.fire())}showFind(e=!0){this._webviewFindWidget?.reveal(void 0,e)}hideFind(e=!0){this._webviewFindWidget?.hide(e)}runFindAction(e){this._webviewFindWidget?.find(e)}};iu=D([u(2,ie),u(3,at),u(4,Ke),u(5,ri),u(6,Le),u(7,Ue),u(8,BS),u(9,Jt),u(10,F),u(11,FS)],iu);let su=class extends R{get window(){return Lc(this._windowId,!0).window}constructor(e,t,i,s){super(),this._layoutService=t,this._webviewService=i,this._baseContextKeyService=s,this._isFirstLoad=!0,this._firstLoadPendingMessages=new Set,this._webview=this._register(new Ie),this._webviewEvents=this._register(new O),this._html="",this._initialScrollProgress=0,this._state=void 0,this._owner=void 0,this._windowId=void 0,this._scopedContextKeyService=this._register(new Ie),this._shouldShowFindWidgetOnRestore=!1,this._isDisposed=!1,this._onDidDispose=this._register(new E),this.onDidDispose=this._onDidDispose.event,this._onDidFocus=this._register(new E),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new E),this.onDidBlur=this._onDidBlur.event,this._onDidClickLink=this._register(new E),this.onDidClickLink=this._onDidClickLink.event,this._onDidReload=this._register(new E),this.onDidReload=this._onDidReload.event,this._onDidScroll=this._register(new E),this.onDidScroll=this._onDidScroll.event,this._onDidUpdateState=this._register(new E),this.onDidUpdateState=this._onDidUpdateState.event,this._onMessage=this._register(new E),this.onMessage=this._onMessage.event,this._onMissingCsp=this._register(new E),this.onMissingCsp=this._onMissingCsp.event,this._onDidWheel=this._register(new E),this.onDidWheel=this._onDidWheel.event,this._onFatalError=this._register(new E),this.onFatalError=this._onFatalError.event,this.providedViewType=e.providedViewType,this.origin=e.origin??nr(),this._title=e.title,this._extension=e.extension,this._options=e.options,this._contentOptions=e.contentOptions}get isFocused(){return!!this._webview.value?.isFocused}dispose(){this._isDisposed=!0,this._container?.domNode.remove(),this._container=void 0;for(const e of this._firstLoadPendingMessages)e.resolve(!1);this._firstLoadPendingMessages.clear(),this._onDidDispose.fire(),super.dispose()}get container(){if(this._isDisposed)throw new Error("OverlayWebview has been disposed");if(!this._container){const e=document.createElement("div");e.style.position="absolute",e.style.overflow="hidden",this._container=new KS(e),this._container.setVisibility("hidden"),this._layoutService.getContainer(this.window).appendChild(e)}return this._container.domNode}claim(e,t,i){if(this._isDisposed)return;const s=this._owner;if(this._windowId!==t.vscodeWindowId&&(this.release(s),this._webview.clear(),this._webviewEvents.clear(),this._container?.domNode.remove(),this._container=void 0),this._owner=e,this._windowId=t.vscodeWindowId,this._show(t),s!==e){const o=i||this._baseContextKeyService;this._scopedContextKeyService.clear(),this._scopedContextKeyService.value=o.createScoped(this.container);const n=this._findWidgetVisible?.get();this._findWidgetVisible?.reset(),this._findWidgetVisible=vw.bindTo(o),this._findWidgetVisible.set(!!n),this._findWidgetEnabled?.reset(),this._findWidgetEnabled=bw.bindTo(o),this._findWidgetEnabled.set(!!this.options.enableFindWidget),this._webview.value?.setContextKeyService(this._scopedContextKeyService.value)}}release(e){this._owner===e&&(this._scopedContextKeyService.clear(),this._owner=void 0,this._container&&this._container.setVisibility("hidden"),this._options.retainContextWhenHidden?(this._shouldShowFindWidgetOnRestore=!!this._findWidgetVisible?.get(),this.hideFind(!1)):(this._webview.clear(),this._webviewEvents.clear()))}layoutWebviewOverElement(e,t,i){if(!this._container||!this._container.domNode.parentElement)return;const s=this._layoutService.whenContainerStylesLoaded(this.window);s?s.then(()=>this.doLayoutWebviewOverElement(e,t,i)):this.doLayoutWebviewOverElement(e,t,i)}doLayoutWebviewOverElement(e,t,i){if(!this._container||!this._container.domNode.parentElement)return;const s=e.getBoundingClientRect(),o=this._container.domNode.parentElement.getBoundingClientRect(),n=(o.height-this._container.domNode.parentElement.clientHeight)/2,r=(o.width-this._container.domNode.parentElement.clientWidth)/2;if(this._container.setTop(s.top-o.top-n),this._container.setLeft(s.left-o.left-r),this._container.setWidth(t?t.width:s.width),this._container.setHeight(t?t.height:s.height),i){const{top:d,left:l,right:h,bottom:p}=Gx(s,i);this._container.domNode.style.clipPath=`polygon(${l}px ${d}px, ${h}px ${d}px, ${h}px ${p}px, ${l}px ${p}px)`}}_show(e){if(this._isDisposed)throw new Error("OverlayWebview is disposed");if(!this._webview.value){const t=this._webviewService.createWebviewElement({providedViewType:this.providedViewType,origin:this.origin,title:this._title,options:this._options,contentOptions:this._contentOptions,extension:this.extension});this._webview.value=t,t.state=this._state,this._scopedContextKeyService.value&&this._webview.value.setContextKeyService(this._scopedContextKeyService.value),this._html&&t.setHtml(this._html),this._options.tryRestoreScrollPosition&&(t.initialScrollProgress=this._initialScrollProgress),this._findWidgetEnabled?.set(!!this.options.enableFindWidget),t.mountTo(this.container,e),this._webviewEvents.clear(),this._webviewEvents.add(t.onDidFocus(()=>{this._onDidFocus.fire()})),this._webviewEvents.add(t.onDidBlur(()=>{this._onDidBlur.fire()})),this._webviewEvents.add(t.onDidClickLink(i=>{this._onDidClickLink.fire(i)})),this._webviewEvents.add(t.onMessage(i=>{this._onMessage.fire(i)})),this._webviewEvents.add(t.onMissingCsp(i=>{this._onMissingCsp.fire(i)})),this._webviewEvents.add(t.onDidWheel(i=>{this._onDidWheel.fire(i)})),this._webviewEvents.add(t.onDidReload(()=>{this._onDidReload.fire()})),this._webviewEvents.add(t.onFatalError(i=>{this._onFatalError.fire(i)})),this._webviewEvents.add(t.onDidScroll(i=>{this._initialScrollProgress=i.scrollYPercentage,this._onDidScroll.fire(i)})),this._webviewEvents.add(t.onDidUpdateState(i=>{this._state=i,this._onDidUpdateState.fire(i)})),this._isFirstLoad&&this._firstLoadPendingMessages.forEach(async i=>{i.resolve(await t.postMessage(i.message,i.transfer))}),this._isFirstLoad=!1,this._firstLoadPendingMessages.clear()}this.options.retainContextWhenHidden&&this._shouldShowFindWidgetOnRestore&&(this.showFind(!1),this._shouldShowFindWidgetOnRestore=!1),this._container?.setVisibility("visible")}setHtml(e){this._html=e,this._withWebview(t=>t.setHtml(e))}setTitle(e){this._title=e,this._withWebview(t=>t.setTitle(e))}get initialScrollProgress(){return this._initialScrollProgress}set initialScrollProgress(e){this._initialScrollProgress=e,this._withWebview(t=>t.initialScrollProgress=e)}get state(){return this._state}set state(e){this._state=e,this._withWebview(t=>t.state=e)}get extension(){return this._extension}set extension(e){this._extension=e,this._withWebview(t=>t.extension=e)}get options(){return this._options}set options(e){this._options={customClasses:this._options.customClasses,...e}}get contentOptions(){return this._contentOptions}set contentOptions(e){this._contentOptions=e,this._withWebview(t=>t.contentOptions=e)}set localResourcesRoot(e){this._withWebview(t=>t.localResourcesRoot=e)}async postMessage(e,t){if(this._webview.value)return this._webview.value.postMessage(e,t);if(this._isFirstLoad){let i;const s=new Promise(o=>i=o);return this._firstLoadPendingMessages.add({message:e,transfer:t,resolve:i}),s}return!1}focus(){this._webview.value?.focus()}reload(){this._webview.value?.reload()}selectAll(){this._webview.value?.selectAll()}copy(){this._webview.value?.copy()}paste(){this._webview.value?.paste()}cut(){this._webview.value?.cut()}undo(){this._webview.value?.undo()}redo(){this._webview.value?.redo()}showFind(e=!0){this._webview.value&&(this._webview.value.showFind(e),this._findWidgetVisible?.set(!0))}hideFind(e=!0){this._findWidgetVisible?.reset(),this._webview.value?.hideFind(e)}runFindAction(e){this._webview.value?.runFindAction(e)}_withWebview(e){this._webview.value&&e(this._webview.value)}windowDidDragStart(){this._webview.value?.windowDidDragStart()}windowDidDragEnd(){this._webview.value?.windowDidDragEnd()}setContextKeyService(e){this._webview.value?.setContextKeyService(e)}};su=D([u(1,He),u(2,Yo),u(3,se)],su);function Gx(a,e){const t=e.getBoundingClientRect(),i=Math.max(t.top-a.top,0),s=Math.max(a.width-(a.right-t.right),0),o=Math.max(a.height-(a.bottom-t.bottom),0),n=Math.max(t.left-a.left,0);return{top:i,right:s,bottom:o,left:n}}let ou=class extends R{constructor(e){super(),this._instantiationService=e,this._webviews=new Set,this._onDidChangeActiveWebview=this._register(new E),this.onDidChangeActiveWebview=this._onDidChangeActiveWebview.event,this._webviewThemeDataProvider=this._instantiationService.createInstance(eu)}get activeWebview(){return this._activeWebview}_updateActiveWebview(e){e!==this._activeWebview&&(this._activeWebview=e,this._onDidChangeActiveWebview.fire(e))}get webviews(){return this._webviews.values()}createWebviewElement(e){const t=this._instantiationService.createInstance(iu,e,this._webviewThemeDataProvider);return this.registerNewWebview(t),t}createWebviewOverlay(e){const t=this._instantiationService.createInstance(su,e);return this.registerNewWebview(t),t}registerNewWebview(e){this._webviews.add(e);const t=new O;t.add(e.onDidFocus(()=>{this._updateActiveWebview(e)}));const i=()=>{this._activeWebview===e&&this._updateActiveWebview(void 0)};t.add(e.onDidBlur(i)),t.add(e.onDidDispose(()=>{i(),t.dispose(),this._webviews.delete(e)}))}};ou=D([u(0,F)],ou);class Ux extends R{constructor(){super(...arguments),this._resolvers=new Map,this._awaitingRevival=new Map,this._onNewResolverRegistered=this._register(new E),this.onNewResolverRegistered=this._onNewResolverRegistered.event}register(e,t){if(this._resolvers.has(e))throw new Error(`View resolver already registered for ${e}`);this._resolvers.set(e,t),this._onNewResolverRegistered.fire({viewType:e});const i=this._awaitingRevival.get(e);return i&&t.resolve(i.webview,bi.None).then(()=>{this._awaitingRevival.delete(e),i.resolve()}),ae(()=>{this._resolvers.delete(e)})}resolve(e,t,i){const s=this._resolvers.get(e);if(!s){if(this._awaitingRevival.has(e))throw new Error("View already awaiting revival");const{promise:o,resolve:n}=yw();return this._awaitingRevival.set(e,{webview:t,resolve:n}),o}return s.resolve(t,i)}}const Hx=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),zx=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Pe(zx);var Yr;(function(a){a[a.Horizontal=0]="Horizontal",a[a.Vertical=1]="Vertical"})(Yr||(Yr={}));class $x extends R{constructor(e,t,i,s){if(super(),this.container=e,this.message=t,this.options=s,this.modalElement=this.container.appendChild(M(".monaco-dialog-modal-block.dimmed")),this._register(Cw(this.modalElement,te.CLICK,d=>{d.target===this.modalElement&&this.element.focus()})),this.shadowElement=this.modalElement.appendChild(M(".dialog-shadow")),this.element=this.shadowElement.appendChild(M(".monaco-dialog-box")),s.alignment===Yr.Vertical&&this.element.classList.add("align-vertical"),s.extraClasses&&this.element.classList.add(...s.extraClasses),this.element.setAttribute("role","dialog"),this.element.tabIndex=-1,sa(this.element),this.options.renderFooter){this.footerContainer=this.element.appendChild(M(".dialog-footer-row"));const d=this.footerContainer.appendChild(M("#monaco-dialog-footer.dialog-footer"));this.options.renderFooter(d);for(const l of this.footerContainer.querySelectorAll("a"))l.tabIndex=0}this.buttonStyles=s.buttonStyles,Array.isArray(i)&&i.length>0?this.buttons=i:this.options.disableDefaultAction?this.buttons=[]:this.buttons=[c(3,"OK")];const o=this.element.appendChild(M(".dialog-buttons-row"));this.buttonsContainer=o.appendChild(M(".dialog-buttons"));const n=this.element.appendChild(M(".dialog-message-row"));if(this.iconElement=n.appendChild(M("#monaco-dialog-icon.dialog-icon")),this.iconElement.setAttribute("aria-label",this.getIconAriaLabel()),this.messageContainer=n.appendChild(M(".dialog-message-container")),this.options.detail||this.options.renderBody){const l=this.messageContainer.appendChild(M(".dialog-message")).appendChild(M("#monaco-dialog-message-text.dialog-message-text"));l.innerText=this.message}if(this.messageDetailElement=this.messageContainer.appendChild(M("#monaco-dialog-message-detail.dialog-message-detail")),this.options.detail||!this.options.renderBody?this.messageDetailElement.innerText=this.options.detail?this.options.detail:t:this.messageDetailElement.style.display="none",this.options.renderBody){const d=this.messageContainer.appendChild(M("#monaco-dialog-message-body.dialog-message-body"));this.options.renderBody(d);for(const l of this.messageContainer.querySelectorAll("a"))l.tabIndex=0}if(this.options.inputs?this.inputs=this.options.inputs.map(d=>{const l=this.messageContainer.appendChild(M(".dialog-message-input")),h=this._register(new Sw(l,void 0,{placeholder:d.placeholder,type:d.type??"text",inputBoxStyles:s.inputBoxStyles}));return d.value&&(h.value=d.value),h}):this.inputs=[],this.options.checkboxLabel){const d=this.messageContainer.appendChild(M(".dialog-checkbox-row")),l=this.checkbox=this._register(new WS(this.options.checkboxLabel,!!this.options.checkboxChecked,s.checkboxStyles));d.appendChild(l.domNode);const h=d.appendChild(M(".dialog-checkbox-message"));h.innerText=this.options.checkboxLabel,this._register(J(h,te.CLICK,()=>l.checked=!l.checked))}const r=this.element.appendChild(M(".dialog-toolbar-row"));this.toolbarContainer=r.appendChild(M(".dialog-toolbar")),this.applyStyles()}getIconAriaLabel(){let e=c(4,"Info");switch(this.options.type){case"error":e=c(5,"Error");break;case"warning":e=c(6,"Warning");break;case"pending":e=c(7,"In Progress");break}return e}updateMessage(e){this.messageDetailElement.innerText=e}async show(){return this.focusToReturn=Ic(this.container.ownerDocument),new Promise(e=>{es(this.buttonsContainer);const t=()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})};this._register(ae(t));const i=this.buttonBar=this._register(new _w(this.buttonsContainer,{alignment:this.options?.alignment===Yr.Vertical?Xg.Vertical:Xg.Horizontal})),s=this.rearrangeButtons(this.buttons,this.options.cancelId),o=d=>{e({button:s[d].index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(l=>l.value):void 0})};s.forEach((d,l)=>{const h=s[l].index===0;let p;const f=this.options.buttonOptions?.[s[l]?.index];if(h&&this.options?.primaryButtonDropdown){const g=GS(this.options.primaryButtonDropdown.actions)?this.options.primaryButtonDropdown.actions.getActions():this.options.primaryButtonDropdown.actions;p=this._register(i.addButtonWithDropdown({...this.options.primaryButtonDropdown,...this.buttonStyles,dropdownLayer:2600,actions:g.map(m=>cs({...m,run:async()=>{await m.run(),o(l)}}))}))}else f?.sublabel?p=this._register(i.addButtonWithDescription({secondary:!h,...this.buttonStyles})):p=this._register(i.addButton({secondary:!h,...this.buttonStyles}));f?.styleButton&&f.styleButton(p),p.label=US(s[l].label,!0),p instanceof HS&&f?.sublabel&&(p.description=f?.sublabel),this._register(p.onDidClick(g=>{g&&ke.stop(g),o(l)}))});const n=St(this.container);this._register(J(n,"keydown",d=>{const l=new Yn(d);if(l.equals(N.Alt)&&l.preventDefault(),l.equals(y.Enter)){this.inputs.some(p=>p.hasFocus())&&(ke.stop(d),e({button:s.find(p=>p.index!==this.options.cancelId)?.index??0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(p=>p.value):void 0}));return}if(ut&&l.equals(N.CtrlCmd|y.KeyD)){ke.stop(d);const p=s.find(f=>f.index===1&&f.index!==this.options.cancelId);p&&e({button:p.index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(f=>f.value):void 0});return}if(l.equals(y.Space))return;let h=!1;if(l.equals(y.Tab)||l.equals(y.RightArrow)||l.equals(N.Shift|y.Tab)||l.equals(y.LeftArrow)){const p=[];let f=-1;if(this.messageContainer){const g=this.messageContainer.querySelectorAll("a");for(const m of g)p.push(m),Xl(m)&&(f=p.length-1)}for(const g of this.inputs)p.push(g),g.hasFocus()&&(f=p.length-1);if(this.checkbox&&(p.push(this.checkbox),this.checkbox.hasFocus()&&(f=p.length-1)),this.buttonBar)for(const g of this.buttonBar.buttons)g instanceof zS?(p.push(g.primaryButton),g.primaryButton.hasFocus()&&(f=p.length-1),p.push(g.dropdownButton),g.dropdownButton.hasFocus()&&(f=p.length-1)):(p.push(g),g.hasFocus()&&(f=p.length-1));if(this.footerContainer){const g=this.footerContainer.querySelectorAll("a");for(const m of g)p.push(m),Xl(m)&&(f=p.length-1)}if(l.equals(y.Tab)||l.equals(y.RightArrow)){const g=(f+1)%p.length;p[g].focus()}else{f===-1&&(f=p.length);let g=f-1;g===-1&&(g=p.length-1),p[g].focus()}h=!0}h?ke.stop(d,!0):this.options.keyEventProcessor&&this.options.keyEventProcessor(l)},!0)),this._register(J(n,"keyup",d=>{ke.stop(d,!0);const l=new Yn(d);!this.options.disableCloseAction&&l.equals(y.Escape)&&t()},!0)),this._register(J(this.element,"focusout",d=>{d.relatedTarget&&this.element&&(Ul(d.relatedTarget,this.element)||(this.focusToReturn=d.relatedTarget,d.target&&(d.target.focus(),ke.stop(d,!0))))},!1));const r="codicon-modifier-spin";if(this.iconElement.classList.remove(...Ce.asClassNameArray(k.dialogError),...Ce.asClassNameArray(k.dialogWarning),...Ce.asClassNameArray(k.dialogInfo),...Ce.asClassNameArray(k.loading),r),this.options.icon)this.iconElement.classList.add(...Ce.asClassNameArray(this.options.icon));else switch(this.options.type){case"error":this.iconElement.classList.add(...Ce.asClassNameArray(k.dialogError));break;case"warning":this.iconElement.classList.add(...Ce.asClassNameArray(k.dialogWarning));break;case"pending":this.iconElement.classList.add(...Ce.asClassNameArray(k.loading),r);break;case"none":this.iconElement.classList.add("no-codicon");break;case"info":case"question":default:this.iconElement.classList.add(...Ce.asClassNameArray(k.dialogInfo));break}if(!this.options.disableCloseAction&&!this.options.disableCloseButton){const d=this._register(new cr(this.toolbarContainer,{})),l=this._register(new _t("dialog.close",c(8,"Close Dialog"),Ce.asClassName(k.dialogClose),!0,async()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})}));d.push(l,{icon:!0,label:!1})}this.applyStyles(),this.element.setAttribute("aria-modal","true"),this.element.setAttribute("aria-labelledby","monaco-dialog-icon monaco-dialog-message-text"),this.element.setAttribute("aria-describedby","monaco-dialog-icon monaco-dialog-message-text monaco-dialog-message-detail monaco-dialog-message-body monaco-dialog-footer"),ia(this.element),this.inputs.length>0?(this.inputs[0].focus(),this.inputs[0].select()):s.forEach((d,l)=>{d.index===0&&i.buttons[l].focus()})})}applyStyles(){const e=this.options.dialogStyles,t=e.dialogForeground,i=e.dialogBackground,s=e.dialogShadow?`0 0px 8px ${e.dialogShadow}`:"",o=e.dialogBorder?`1px solid ${e.dialogBorder}`:"",n=e.textLinkForeground;if(this.shadowElement.style.boxShadow=s,this.element.style.color=t??"",this.element.style.backgroundColor=i??"",this.element.style.border=o,n)for(const d of[...this.messageContainer.getElementsByTagName("a"),...this.footerContainer?.getElementsByTagName("a")??[]])d.style.color=n;let r;switch(this.options.type){case"none":break;case"error":r=e.errorIconForeground;break;case"warning":r=e.warningIconForeground;break;default:r=e.infoIconForeground;break}r&&(this.iconElement.style.color=r)}dispose(){super.dispose(),this.modalElement&&(this.modalElement.remove(),this.modalElement=void 0),this.focusToReturn&&Ul(this.focusToReturn,this.container.getRootNode())&&(this.focusToReturn.focus(),this.focusToReturn=void 0)}rearrangeButtons(e,t){const i=e.map((s,o)=>({label:s,index:o}));if(e.length<2||this.options.alignment===Yr.Vertical)return i;if(ut||nw){if(typeof t=="number"&&i[t]){const s=i.splice(t,1)[0];i.splice(1,0,s)}i.reverse()}else if(Uo&&typeof t=="number"&&i[t]){const s=i.splice(t,1)[0];i.push(s)}return i}}const qx=["workbench.action.quit","workbench.action.reloadWindow","copy","cut","editor.action.selectAll","editor.action.clipboardCopyAction","editor.action.clipboardCutAction","editor.action.clipboardPasteAction"];function jx(a,e,t,i=qx){return{keyEventProcessor:s=>{const o=e.softDispatch(s,t.activeContainer);o.kind===jS.KbFound&&o.commandId&&(i.includes(o.commandId)||ke.stop(s,!0))},buttonStyles:oa,checkboxStyles:qS,inputBoxStyles:Tc,dialogStyles:$S,...a}}Pe(Hx);let nu=class extends R{constructor(e,t,i,s,o,n,r,d,l){super(),this.activityService=e,this.paneCompositeService=t,this.viewDescriptorService=i,this.viewsService=s,this.notificationService=o,this.statusbarService=n,this.layoutService=r,this.keybindingService=d,this.userActivityService=l,this.windowProgressStack=[],this.windowProgressStatusEntry=void 0}async withProgress(e,t,i){const{location:s}=e,o=async r=>{const d=this.userActivityService.markActive({extendOnly:!0,whenHeldFor:15e3});try{return await t(r)}finally{d.dispose()}},n=r=>{const d=this.viewDescriptorService.getViewContainerById(r);if(d){const l=this.viewDescriptorService.getViewContainerLocation(d);if(l!==null)return this.withPaneCompositeProgress(r,l,o,{...e,location:r})}if(this.viewDescriptorService.getViewDescriptorById(r)!==null)return this.withViewProgress(r,o,{...e,location:r});throw new Error(`Bad progress location: ${r}`)};if(typeof s=="string")return n(s);switch(s){case Es.Notification:{let r=e.priority;return r!==sn.URGENT&&(this.notificationService.getFilter()===Qg.ERROR?r=sn.SILENT:YS(e.source)&&this.notificationService.getFilter(e.source)===Qg.ERROR&&(r=sn.SILENT)),this.withNotificationProgress({...e,location:s,priority:r},o,i)}case Es.Window:{const r=e.type;return e.command?this.withWindowProgress({...e,location:s,type:r},o):this.withNotificationProgress({delay:150,...e,priority:sn.SILENT,location:Es.Notification,type:r},o,i)}case Es.Explorer:return this.withPaneCompositeProgress("workbench.view.explorer",Y.Sidebar,o,{...e,location:s});case Es.Scm:return n("workbench.scm");case Es.Extensions:return this.withPaneCompositeProgress("workbench.view.extensions",Y.Sidebar,o,{...e,location:s});case Es.Dialog:return this.withDialogProgress(e,o,i);default:throw new Error(`Bad progress location: ${s}`)}}withWindowProgress(e,t){const i=[e,new Ew(()=>this.updateWindowProgress())],s=t(i[1]);let o=setTimeout(()=>{o=void 0,this.windowProgressStack.unshift(i),this.updateWindowProgress(),Promise.all([Ho(150),s]).finally(()=>{const n=this.windowProgressStack.indexOf(i);this.windowProgressStack.splice(n,1),this.updateWindowProgress()})},150);return s.finally(()=>clearTimeout(o))}updateWindowProgress(e=0){if(e<this.windowProgressStack.length){const[t,i]=this.windowProgressStack[e],s=t.title,o=i.value&&i.value.message,n=t.command;let r,d;const l=t.source&&typeof t.source!="string"?t.source.label:t.source;if(s&&o)r=c(12814,"{0}: {1}",s,o),d=l?c(12815,"[{0}] {1}: {2}",l,s,o):r;else if(s)r=s,d=l?c(12816,"[{0}]: {1}",l,s):r;else if(o)r=o,d=l?c(12816,"[{0}]: {1}",l,o):r;else{this.updateWindowProgress(e+1);return}const h={name:c(12817,"Progress Message"),text:r,showProgress:t.type||!0,ariaLabel:r,tooltip:ef(d).trim(),command:n};this.windowProgressStatusEntry?this.windowProgressStatusEntry.update(h):this.windowProgressStatusEntry=this.statusbarService.addEntry(h,"status.progress",et.LEFT,-Number.MAX_VALUE)}else this.windowProgressStatusEntry?.dispose(),this.windowProgressStatusEntry=void 0}withNotificationProgress(e,t,i){const s=new class extends R{get step(){return this._step}get done(){return this._done}constructor(){super(),this._onDidReport=this._register(new E),this.onDidReport=this._onDidReport.event,this._onWillDispose=this._register(new E),this.onWillDispose=this._onWillDispose.event,this._step=void 0,this._done=!1,this.promise=t(this),this.promise.finally(()=>{this.dispose()})}report(g){this._step=g,this._onDidReport.fire(g)}cancel(g){i?.(g),this.dispose()}dispose(){this._done=!0,this._onWillDispose.fire(),super.dispose()}},o=()=>{const g=new Ko;return this.withWindowProgress({location:Es.Window,title:e.title?Ed(e.title).toString():void 0,command:"notifications.showList",type:e.type},m=>{function v(T){T.message&&m.report({message:Ed(T.message).toString()})}s.step&&v(s.step);const C=s.onDidReport(T=>v(T));return g.p.finally(()=>C.dispose()),L.once(s.onWillDispose)(()=>g.complete()),g.p}),ae(()=>g.complete())},n=(g,m,v)=>{const C=new O,T=e.primaryActions?Array.from(e.primaryActions):[],B=e.secondaryActions?Array.from(e.secondaryActions):[];if(e.buttons&&e.buttons.forEach((K,j)=>{const oe=new class extends _t{constructor(){super(`progress.button.${K}`,K,void 0,!0)}async run(){s.cancel(j)}};C.add(oe),T.push(oe)}),e.cancellable){const K=new class extends _t{constructor(){super("progress.cancel",typeof e.cancellable=="string"?e.cancellable:c(12818,"Cancel"),void 0,!0)}async run(){s.cancel()}};C.add(K),T.push(K)}const V=this.notificationService.notify({severity:Se.Info,message:ef(g),source:e.source,actions:{primary:T,secondary:B},progress:typeof v=="number"&&v>=0?{total:100,worked:v}:{infinite:!0},priority:m});let U;const W=K=>{je(U),!K&&!s.done&&(U=o())};return C.add(V.onDidChangeVisibility(W)),m===sn.SILENT&&W(!1),L.once(V.onDidClose)(()=>{C.dispose(),je(U)}),V},r=(g,m)=>{typeof m=="number"&&m>=0?(g.progress.total(100),g.progress.worked(m)):g.progress.infinite()};let d,l,h;const p=g=>{g?.message&&e.title?h=`${e.title}: ${g.message}`:h=e.title||g?.message,!d&&h&&(typeof e.delay=="number"&&e.delay>0?l===void 0&&(l=setTimeout(()=>d=n(h,e.priority,g?.increment),e.delay)):d=n(h,e.priority,g?.increment)),d&&(h&&d.updateMessage(h),typeof g?.increment=="number"&&r(d,g.increment))};p(s.step);const f=s.onDidReport(g=>p(g));return L.once(s.onWillDispose)(()=>f.dispose()),(async()=>{try{typeof e.delay=="number"&&e.delay>0?await s.promise:await Promise.all([Ho(800),s.promise])}finally{clearTimeout(l),d?.close()}})(),s.promise}withPaneCompositeProgress(e,t,i,s){const o=this.paneCompositeService.getProgressIndicator(e,t),n=o?this.withCompositeProgress(o,i,s):i({report:()=>{}});return t===Y.Sidebar&&this.showOnActivityBar(e,s,n),n}withViewProgress(e,t,i){const s=this.viewsService.getViewProgressIndicator(e),o=s?this.withCompositeProgress(s,t,i):t({report:()=>{}}),n=this.viewDescriptorService.getViewContainerByViewId(e)?.id;return n===void 0||this.showOnActivityBar(n,i,o),o}showOnActivityBar(e,t,i){let s,o=setTimeout(()=>{o=void 0;const n=this.activityService.showViewContainerActivity(e,{badge:new JS(()=>"")}),r=Date.now(),d=300;s={dispose(){const l=Date.now()-r;l<d?setTimeout(()=>n.dispose(),d-l):n.dispose()}}},t.delay||300);i.finally(()=>{clearTimeout(o),je(s)})}withCompositeProgress(e,t,i){let s;function o(r){let d,l;return typeof r<"u"&&(typeof r=="number"?d=r:typeof r.increment=="number"&&(d=r.total??100,l=r.increment)),typeof d=="number"?(s||(s=e.show(d,i.delay),n.catch(()=>{}).finally(()=>s?.done())),typeof l=="number"&&s.worked(l)):(s?.done(),e.showWhile(n,i.delay)),s}const n=t({report:r=>{o(r)}});return o(i.total),n}withDialogProgress(e,t,i){const s=new O;let o,n=!1;const r=g=>{const m=e.buttons||[];return e.sticky||m.push(e.cancellable?typeof e.cancellable=="boolean"?c(12818,"Cancel"):e.cancellable:c(12819,"Dismiss")),o=new $x(this.layoutService.activeContainer,g,m,jx({type:"pending",detail:e.detail,cancelId:m.length-1,disableCloseAction:e.sticky,disableDefaultAction:e.sticky},this.keybindingService,this.layoutService)),s.add(o),o.show().then(v=>{n||i?.(v.button),je(o)}),o};let d=e.delay??0,l;const h=s.add(new Ca(()=>{d=0,l&&!o?o=r(l):l&&o.updateMessage(l)},0)),p=function(g){l=g,h.isScheduled()||h.schedule(d)},f=t({report:g=>{p(g.message)}});return f.finally(()=>{n=!0,je(s)}),e.title&&p(e.title),f}};nu=D([u(0,Ys),u(1,js),u(2,Ye),u(3,gt),u(4,Ke),u(5,Ui),u(6,_a),u(7,it),u(8,ZS)],nu);let ru=class extends R{constructor(e){super(),this.paneCompositeParts=new Map;const t=e.createInstance(bh),i=e.createInstance(mh),s=e.createInstance(Ih);this.paneCompositeParts.set(Y.Panel,t),this.paneCompositeParts.set(Y.Sidebar,i),this.paneCompositeParts.set(Y.AuxiliaryBar,s);const o=this._register(new O);this.onDidPaneCompositeOpen=L.any(...tf.map(n=>L.map(this.paneCompositeParts.get(n).onDidPaneCompositeOpen,r=>({composite:r,viewContainerLocation:n}),o))),this.onDidPaneCompositeClose=L.any(...tf.map(n=>L.map(this.paneCompositeParts.get(n).onDidPaneCompositeClose,r=>({composite:r,viewContainerLocation:n}),o)))}openPaneComposite(e,t,i){return this.getPartByLocation(t).openPaneComposite(e,i)}getActivePaneComposite(e){return this.getPartByLocation(e).getActivePaneComposite()}getPaneComposite(e,t){return this.getPartByLocation(t).getPaneComposite(e)}getPaneComposites(e){return this.getPartByLocation(e).getPaneComposites()}getPinnedPaneCompositeIds(e){return this.getPartByLocation(e).getPinnedPaneCompositeIds()}getVisiblePaneCompositeIds(e){return this.getPartByLocation(e).getVisiblePaneCompositeIds()}getPaneCompositeIds(e){return this.getPartByLocation(e).getPaneCompositeIds()}getProgressIndicator(e,t){return this.getPartByLocation(t).getProgressIndicator(e)}hideActivePaneComposite(e){this.getPartByLocation(e).hideActivePaneComposite()}getLastActivePaneCompositeId(e){return this.getPartByLocation(e).getLastActivePaneCompositeId()}getPartByLocation(e){return Ee(this.paneCompositeParts.get(e))}};ru=D([u(0,F)],ru);async function Yx(a){const e=navigator.usb;if(!e)return;const t=await e.requestDevice({filters:a?.filters??[]});if(t)return{deviceClass:t.deviceClass,deviceProtocol:t.deviceProtocol,deviceSubclass:t.deviceSubclass,deviceVersionMajor:t.deviceVersionMajor,deviceVersionMinor:t.deviceVersionMinor,deviceVersionSubminor:t.deviceVersionSubminor,manufacturerName:t.manufacturerName,productId:t.productId,productName:t.productName,serialNumber:t.serialNumber,usbVersionMajor:t.usbVersionMajor,usbVersionMinor:t.usbVersionMinor,usbVersionSubminor:t.usbVersionSubminor,vendorId:t.vendorId}}async function Jx(a){const e=navigator.serial;if(!e)return;const t=await e.requestPort({filters:a?.filters??[]});if(!t)return;const i=t.getInfo();return{usbVendorId:i.usbVendorId,usbProductId:i.usbProductId}}async function Zx(a){const e=navigator.hid;if(!e)return;const t=await e.requestDevice({filters:a?.filters??[]});if(!t.length)return;const i=t[0];return{opened:i.opened,vendorId:i.vendorId,productId:i.productId,productName:i.productName,collections:i.collections}}const Xx=c(1898,"open"),Qx=c(1899,"close"),ek=c(1900,"find");var Vl={open:Xx,close:Qx,find:ek};let au=class{constructor(e,t,i,s){this.fileService=e,this.environmentService=t,this.lifecycleService=i,this.logService=s}async getLogs(){return XS(this.fileService,this.environmentService)}async whenWorkbenchRestored(){this.logService.info("[driver] Waiting for restored lifecycle phase..."),await this.lifecycleService.when(Da.Restored),this.logService.info("[driver] Restored lifecycle phase reached. Waiting for contributions..."),await z.as(Vc.Workbench).whenRestored,this.logService.info("[driver] Workbench contributions created.")}async setValue(e,t){const i=re.document.querySelector(e);if(!i)return Promise.reject(new Error(`Element not found: ${e}`));const s=i;s.value=t;const o=new Event("input",{bubbles:!0,cancelable:!0});s.dispatchEvent(o)}async isActiveElement(e){if(re.document.querySelector(e)!==re.document.activeElement){const i=[];let s=re.document.activeElement;for(;s;){const o=s.tagName,n=s.id?`#${s.id}`:"",r=Ss(s.className.split(/\s+/g).map(d=>d.trim())).map(d=>`.${d}`).join("");i.unshift(`${o}${n}${r}`),s=s.parentElement}throw new Error(`Active element not found. Current active element is '${i.join(" > ")}'. Looking for ${e}`)}return!0}async getElements(e,t){const i=re.document.querySelectorAll(e),s=[];for(let o=0;o<i.length;o++){const n=i.item(o);s.push(this.serializeElement(n,t))}return s}serializeElement(e,t){const i=Object.create(null);for(let r=0;r<e.attributes.length;r++){const d=e.attributes.item(r);d&&(i[d.name]=d.value)}const s=[];if(t)for(let r=0;r<e.children.length;r++){const d=e.children.item(r);d&&s.push(this.serializeElement(d,!0))}const{left:o,top:n}=sf(e);return{tagName:e.tagName,className:e.className,textContent:e.textContent||"",attributes:i,children:s,left:o,top:n}}async getElementXY(e,t,i){const s=typeof t=="number"&&typeof i=="number"?{x:t,y:i}:void 0;return this._getElementXY(e,s)}async typeInEditor(e,t){const i=re.document.querySelector(e);if(!i)throw new Error(`Editor not found: ${e}`);if(of(i)){const s=i.editContext;if(!s)throw new Error(`Edit context not found: ${e}`);const o=s.selectionStart,n=s.selectionEnd,r=new TextUpdateEvent("textupdate",{updateRangeStart:o,updateRangeEnd:n,text:t,selectionStart:o+t.length,selectionEnd:o+t.length,compositionStart:0,compositionEnd:0});s.dispatchEvent(r)}else if(nf(i)){const s=i.selectionStart,o=s+t.length,n=i.value,r=n.substr(0,s)+t+n.substr(s);i.value=r,i.setSelectionRange(o,o);const d=new Event("input",{bubbles:!0,cancelable:!0});i.dispatchEvent(d)}}async getEditorSelection(e){const t=re.document.querySelector(e);if(!t)throw new Error(`Editor not found: ${e}`);if(of(t)){const i=t.editContext;if(!i)throw new Error(`Edit context not found: ${e}`);return{selectionStart:i.selectionStart,selectionEnd:i.selectionEnd}}else{if(nf(t))return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd};throw new Error(`Unknown type of element: ${e}`)}}async getTerminalBuffer(e){const t=re.document.querySelector(e);if(!t)throw new Error(`Terminal not found: ${e}`);const i=t.xterm;if(!i)throw new Error(`Xterm not found: ${e}`);const s=[];for(let o=0;o<i.buffer.active.length;o++)s.push(i.buffer.active.getLine(o).translateToString(!0));return s}async writeInTerminal(e,t){const i=re.document.querySelector(e);if(!i)throw new Error(`Element not found: ${e}`);const s=i.xterm;if(!s)throw new Error(`Xterm not found: ${e}`);s.input(t)}getLocaleInfo(){return Promise.resolve({language:e_,locale:QS})}getLocalizedStrings(){return Promise.resolve({open:Vl.open,close:Vl.close,find:Vl.find})}async _getElementXY(e,t){const i=re.document.querySelector(e);if(!i)return Promise.reject(new Error(`Element not found: ${e}`));const{left:s,top:o}=sf(i),{width:n,height:r}=Iw(i);let d,l;return t?(d=s+t.x,l=o+t.y):(d=s+n/2,l=o+r/2),d=Math.round(d),l=Math.round(l),{x:d,y:l}}};au=D([u(0,Le),u(1,Mp),u(2,or),u(3,Ue)],au);function tk(a){Object.assign(re,{driver:a.createInstance(au)})}var oo,Fs;let Bd=(Fs=class extends R{constructor(e,t={getWindowsCount:rf,getWindows:jl},i,s){super(),this.hostService=i,this.environmentService=s,this.enableWindowFocusOnElementFocus(e),this.enableMultiWindowAwareTimeout(e,t),this.registerFullScreenListeners(e.vscodeWindowId)}enableWindowFocusOnElementFocus(e){const t=e.HTMLElement.prototype.focus,i=this;e.HTMLElement.prototype.focus=function(s){i.onElementFocus(St(this)),t.apply(this,[s])}}onElementFocus(e){const t=Go();t!==e&&t.document.hasFocus()&&(e.focus(),!this.environmentService.extensionTestsLocationURI&&!e.document.hasFocus()&&this.hostService.focus(e))}enableMultiWindowAwareTimeout(e,t={getWindowsCount:rf,getWindows:jl}){const i=e.setTimeout;Object.defineProperty(e,"vscodeOriginalSetTimeout",{get:()=>i});const s=e.clearTimeout;Object.defineProperty(e,"vscodeOriginalClearTimeout",{get:()=>s}),e.setTimeout=function(o,n=0,...r){if(t.getWindowsCount()===1||typeof o=="string"||n===0)return i.apply(this,[o,n,...r]);const d=new Set,l=oo.TIMEOUT_HANDLES++;oo.TIMEOUT_DISPOSABLES.set(l,d);const h=Up(o,()=>{je(d),oo.TIMEOUT_DISPOSABLES.delete(l)});for(const{window:p,disposables:f}of t.getWindows()){if(Dw(p)&&p.document.visibilityState==="hidden")continue;let g=!1;const m=p.vscodeOriginalSetTimeout.apply(this,[(...C)=>{g||h(...C)},n,...r]),v=ae(()=>{g=!0,p.vscodeOriginalClearTimeout(m),d.delete(v)});f.add(v),d.add(v)}return l},e.clearTimeout=function(o){const n=typeof o=="number"?oo.TIMEOUT_DISPOSABLES.get(o):void 0;n?(je(n),oo.TIMEOUT_DISPOSABLES.delete(o)):s.apply(this,[o])}}registerFullScreenListeners(e){this._register(this.hostService.onDidChangeFullScreen(({windowId:t,fullscreen:i})=>{if(t===e){const s=Lc(e);s&&t_(i,s.window)}}))}static async confirmOnShutdown(e,t){const i=e.get(Jo),s=e.get(ie),o=t===Fr.QUIT?ut?c(3551,"Are you sure you want to quit?"):c(3552,"Are you sure you want to exit?"):c(3553,"Are you sure you want to close the window?"),n=t===Fr.QUIT?ut?c(3554,"&&Quit"):c(3555,"&&Exit"):c(3556,"&&Close Window"),r=await i.confirm({message:o,primaryButton:n,checkbox:{label:c(3557,"Do not ask me again")}});return r.confirmed&&r.checkboxChecked&&await s.updateValue("window.confirmBeforeClose","never"),r.confirmed}},oo=Fs,Fs.TIMEOUT_HANDLES=Number.MIN_SAFE_INTEGER,Fs.TIMEOUT_DISPOSABLES=new Map,Fs);Bd=oo=D([u(2,Zt),u(3,ri)],Bd);let cm=class extends Bd{constructor(e,t,i,s,o,n,r,d,l){super(re,void 0,l,n),this.openerService=e,this.lifecycleService=t,this.dialogService=i,this.labelService=s,this.productService=o,this.browserEnvironmentService=n,this.layoutService=r,this.instantiationService=d,this.registerListeners(),this.create()}registerListeners(){this._register(this.lifecycleService.onWillShutdown(()=>this.onWillShutdown()));const e=Id&&re.visualViewport?re.visualViewport:re;this._register(J(e,te.RESIZE,()=>{this.layoutService.layout(),Id&&re.scrollTo(0,0)})),this._register(J(this.layoutService.mainContainer,te.WHEEL,t=>t.preventDefault(),{passive:!1})),this._register(J(this.layoutService.mainContainer,te.CONTEXT_MENU,t=>ke.stop(t,!0))),this._register(J(this.layoutService.mainContainer,te.DROP,t=>ke.stop(t,!0)))}onWillShutdown(){L.toPromise(L.any(L.once(new Yl(re.document.body,te.KEY_DOWN,!0).event),L.once(new Yl(re.document.body,te.MOUSE_DOWN,!0).event))).then(async()=>{await Ho(3e3),await this.dialogService.prompt({type:Se.Error,message:c(3558,"An unexpected error occurred that requires a reload of this page."),detail:c(3559,"The workbench was unexpectedly disposed while running."),buttons:[{label:c(3560,"&&Reload"),run:()=>re.location.reload()}]})})}create(){this.setupOpenHandlers(),this.registerLabelFormatters(),this.registerCommands(),this.setupDriver()}setupDriver(){this.environmentService.enableSmokeTestDriver&&tk(this.instantiationService)}setupOpenHandlers(){this.openerService.setDefaultExternalOpener({openExternal:async e=>{let t=!1;if(this.browserEnvironmentService.options?.openerAllowedExternalUrlPrefixes){for(const i of this.browserEnvironmentService.options.openerAllowedExternalUrlPrefixes)if(e.startsWith(i)){t=!0;break}}if(yl(e,pe.http)||yl(e,pe.https))Aw?o_(e,!t)||await this.dialogService.prompt({type:Se.Warning,message:c(3561,"The browser blocked opening a new tab or window. Press 'Retry' to try again."),custom:{markdownDetails:[{markdown:new wi(c(3562,"Please allow pop-ups for this website in your [browser settings]({0}).","https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:c(3563,"&&Retry"),run:()=>t?af(e):df(e)}],cancelButton:!0}):t?af(e):df(e);else{const i=()=>{this.lifecycleService.withExpectedShutdown({disableShutdownHandling:!0},()=>re.location.href=e)};i();const s=async()=>{const{downloadUrl:o}=this.productService;let n;const r=[{label:c(3564,"&&Try Again"),run:()=>i()}];o!==void 0?(n=c(3565,`We launched {0} on your computer.
|
|
33
|
+
|
|
34
|
+
If {1} did not launch, try again or install it below.`,this.productService.nameLong,this.productService.nameLong),r.push({label:c(3566,"&&Install"),run:async()=>{await this.openerService.open($.parse(o)),s()}})):n=c(3567,`We launched {0} on your computer.
|
|
35
|
+
|
|
36
|
+
If {1} did not launch, try again below.`,this.productService.nameLong,this.productService.nameLong),await this.hostService.withExpectedShutdown(()=>this.dialogService.prompt({type:Se.Info,message:c(3568,"All done. You can close this tab now."),detail:n,buttons:r,cancelButton:!0}))};yl(e,this.productService.urlProtocol)&&await s()}return!0}})}registerLabelFormatters(){this._register(this.labelService.registerFormatter({scheme:pe.vscodeUserData,priority:!0,formatting:{label:"(Settings) ${path}",separator:"/"}}))}registerCommands(){Te.registerCommand("workbench.experimental.requestUsbDevice",async(e,t)=>Yx(t)),Te.registerCommand("workbench.experimental.requestSerialPort",async(e,t)=>Jx(t)),Te.registerCommand("workbench.experimental.requestHidDevice",async(e,t)=>Zx(t))}};cm=D([u(0,xt),u(1,or),u(2,Jo),u(3,$i),u(4,i_),u(5,s_),u(6,He),u(7,F),u(8,Zt)],cm);var du,Fd;(function(a){a[a.Maximized=0]="Maximized",a[a.Normal=1]="Normal",a[a.Fullscreen=2]="Fullscreen"})(Fd||(Fd={}));const ik=new jt(Ql.width,Ql.height);let cu=class extends Bd{constructor(e,t,i,s,o,n){super(e,void 0,o,n),this.window=e,this.container=t,this.configurationService=s,this._onWillLayout=this._register(new E),this.onWillLayout=this._onWillLayout.event,this._onDidLayout=this._register(new E),this.onDidLayout=this._onDidLayout.event,this._onBeforeUnload=this._register(new E),this.onBeforeUnload=this._onBeforeUnload.event,this._onUnload=this._register(new E),this.onUnload=this._onUnload.event,this._onWillDispose=this._register(new E),this.onWillDispose=this._onWillDispose.event,this.compact=!1,this.whenStylesHaveLoaded=i.wait().then(()=>{}),this.registerListeners()}updateOptions(e){this.compact=e.compact}registerListeners(){this._register(J(this.window,te.BEFORE_UNLOAD,e=>this.handleBeforeUnload(e))),this._register(J(this.window,te.UNLOAD,()=>this.handleUnload())),this._register(J(this.window,"unhandledrejection",e=>{jn(e.reason),e.preventDefault()})),this._register(J(this.window,te.RESIZE,()=>this.layout())),this._register(J(this.container,te.SCROLL,()=>this.container.scrollTop=0)),Wo?(this._register(J(this.container,te.DROP,e=>ke.stop(e,!0))),this._register(J(this.container,te.WHEEL,e=>e.preventDefault(),{passive:!1})),this._register(J(this.container,te.CONTEXT_MENU,e=>ke.stop(e,!0)))):(this._register(J(this.window.document.body,te.DRAG_OVER,e=>ke.stop(e))),this._register(J(this.window.document.body,te.DROP,e=>ke.stop(e))))}handleBeforeUnload(e){let t;if(this._onBeforeUnload.fire({veto(o){o&&(t=o)}}),t){this.handleVetoBeforeClose(e,t);return}const i=this.configurationService.getValue("window.confirmBeforeClose");(i==="always"||i==="keyboardOnly"&&f_.getInstance().isModifierPressed)&&this.confirmBeforeClose(e)}handleVetoBeforeClose(e,t){this.preventUnload(e)}preventUnload(e){e.preventDefault(),e.returnValue=c(12330,"Changes that you made may not be saved. Please check press 'Cancel' and try again.")}confirmBeforeClose(e){this.preventUnload(e)}handleUnload(){this._onUnload.fire()}layout(){const e=Iw(this.window.document.body,ik,this.container);this._onWillLayout.fire(e),this._onDidLayout.fire(e)}createState(){return{bounds:{x:this.window.screenX,y:this.window.screenY,width:this.window.outerWidth,height:this.window.outerHeight},zoomLevel:m_(this.window),compact:this.compact}}dispose(){this._store.isDisposed||(this._onWillDispose.fire(),super.dispose())}};cu=D([u(3,ie),u(4,Zt),u(5,ri)],cu);var Do;let lu=(Do=class extends R{constructor(e,t,i,s,o,n){super(),this.layoutService=e,this.dialogService=t,this.configurationService=i,this.telemetryService=s,this.hostService=o,this.environmentService=n,this._onDidOpenAuxiliaryWindow=this._register(new E),this.onDidOpenAuxiliaryWindow=this._onDidOpenAuxiliaryWindow.event,this.windows=new Map}async open(e){pi("code/auxiliaryWindow/willOpen");const t=await this.openWindow(e);if(!t)throw new Error(c(12331,"Unable to open a new window."));const i=await this.resolveWindowId(t);r_(t,i);const s=new O,{container:o,stylesLoaded:n}=this.createContainer(t,s,e),r=this.createAuxiliaryWindow(t,o,n);r.updateOptions({compact:e?.compact??!1});const d=new O;this.windows.set(t.vscodeWindowId,r),d.add(ae(()=>this.windows.delete(t.vscodeWindowId)));const l=new O;return L.once(r.onWillDispose)(()=>{t.close(),s.dispose(),d.dispose(),l.dispose()}),d.add(a_(t)),this._onDidOpenAuxiliaryWindow.fire({window:r,disposables:l}),pi("code/auxiliaryWindow/didOpen"),this.telemetryService.publicLog2("auxiliaryWindowOpen",{bounds:!!e?.bounds}),r}createAuxiliaryWindow(e,t,i){return new cu(e,t,i,this.configurationService,this.hostService,this.environmentService)}async openWindow(e){const t=Go(),i={x:t.screenX,y:t.screenY,width:t.outerWidth,height:t.outerHeight},s=Ql,o=Math.max(e?.bounds?.width??s.width,cf.WIDTH),n=Math.max(e?.bounds?.height??s.height,cf.HEIGHT);let r={x:e?.bounds?.x??Math.max(i.x+i.width/2-o/2,0),y:e?.bounds?.y??Math.max(i.y+i.height/2-n/2,0),width:o,height:n};!e?.bounds&&r.x===i.x&&r.y===i.y&&(r={...r,x:r.x+30,y:r.y+30});const d=Ss(["popup=yes",`left=${r.x}`,`top=${r.y}`,`width=${r.width}`,`height=${r.height}`,e?.nativeTitlebar?"window-native-titlebar=yes":void 0,e?.disableFullscreen?"window-disable-fullscreen=yes":void 0,e?.alwaysOnTop?"window-always-on-top=yes":void 0,e?.mode===Fd.Maximized?"window-maximized=yes":void 0,e?.mode===Fd.Fullscreen?"window-fullscreen=yes":void 0]),l=re.open(d_?"":"about:blank",void 0,d.join(","));return!l&&Wo?(await this.dialogService.prompt({type:Se.Warning,message:c(12332,"The browser blocked opening a new window. Press 'Retry' to try again."),custom:{markdownDetails:[{markdown:new wi(c(12333,"Please allow pop-ups for this website in your [browser settings]({0}).","https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:c(12334,"&&Retry"),run:()=>this.openWindow(e)}],cancelButton:!0})).result:l?.window}async resolveWindowId(e){return du.WINDOW_IDS++}createContainer(e,t,i){this.applyMeta(e);const{stylesLoaded:s}=this.applyCSS(e,t),o=this.applyHTML(e,t);return{stylesLoaded:s,container:o}}applyMeta(e){for(const i of['meta[charset="utf-8"]','meta[http-equiv="Content-Security-Policy"]','meta[name="viewport"]','meta[name="theme-color"]']){const s=re.document.querySelector(i);if(s){const o=Tw(e.document.head);if(lf(s,o),i==='meta[http-equiv="Content-Security-Policy"]'){const n=o.getAttribute("content");n&&o.setAttribute("content",n.replace(/(script-src[^\;]*)/,"script-src 'none'"))}}}const t=re.document.querySelector('link[rel="icon"]');if(t){const i=c_(e.document.head);lf(t,i)}}applyCSS(e,t){pi("code/auxiliaryWindow/willApplyCSS"),e.document.adoptedStyleSheets=[...e.document.adoptedStyleSheets,...(w_??re.document).adoptedStyleSheets.map(l=>{const h=new e.CSSStyleSheet;for(const p of l.cssRules)h.insertRule(p.cssText);return h})];const i=new Map,s=new l_;s.wait().then(()=>pi("code/auxiliaryWindow/didLoadCSSStyles"));const o=t.add(new O);let n=0;function r(){--n===0&&(o.dispose(),s.open())}function d(l){if(g_(l))return;const h=e.document.head.appendChild(l.cloneNode(!0));l.tagName.toLowerCase()==="link"&&(n++,o.add(J(h,"load",r)),o.add(J(h,"error",r))),i.set(l,h)}n++;try{for(const l of re.document.head.querySelectorAll('link[rel="stylesheet"], style'))d(l)}finally{r()}return t.add(h_(e)),t.add(u_.observe(re.document.head,t,{childList:!0,subtree:!0})(l=>{for(const h of l)if(!(h.type!=="childList"||h.target.nodeName.toLowerCase()==="title"||h.target.nodeName.toLowerCase()==="script"||h.target.nodeName.toLowerCase()==="meta")){for(const p of h.addedNodes)if(qn(p)&&(p.tagName.toLowerCase()==="style"||p.tagName.toLowerCase()==="link"))d(p);else if(p.nodeType===Node.TEXT_NODE&&p.parentNode){const f=i.get(p.parentNode);f&&(f.textContent=p.textContent)}for(const p of h.removedNodes){const f=i.get(p);f&&(f.parentNode?.removeChild(f),i.delete(p))}}})),pi("code/auxiliaryWindow/didApplyCSS"),{stylesLoaded:s}}applyHTML(e,t){pi("code/auxiliaryWindow/willApplyHTML");const i=M("div",{role:"application"});return p_(i,0,0,0,0,"relative"),i.style.display="flex",i.style.height="100%",i.style.flexDirection="column",e.document.body.append(i),t.add(vl(re.document.documentElement,e.document.documentElement)),t.add(vl(re.document.body,e.document.body)),t.add(vl(this.layoutService.mainContainer,i,["class"])),pi("code/auxiliaryWindow/didApplyHTML"),i}getWindow(e){return this.windows.get(e)}},du=Do,Do.WINDOW_IDS=n_(re)+1,Do);lu=du=D([u(0,He),u(1,Jo),u(2,ie),u(3,mt),u(4,Zt),u(5,ri)],lu);let hu=class extends Ea{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g){super(e,{mergeViewWithContainerWhenSingleView:!1},r,i,s,l,o,h,d,n,p,f,g),this.constantViewDescriptors=new Map,this.allViews=new Map,this._register(t(m=>{this.filterValue=m,this.onFilterChanged(m)})),this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(()=>{this.updateAllViews(this.viewContainerModel.activeViewDescriptors)}))}updateAllViews(e){e.forEach(t=>{const i=this.getFilterOn(t);i&&(this.allViews.has(i)||this.allViews.set(i,new Map),this.allViews.get(i).set(t.id,t),this.filterValue&&!this.filterValue.includes(i)&&this.panes.find(s=>s.id===t.id)&&this.viewContainerModel.setVisible(t.id,!1))})}addConstantViewDescriptors(e){e.forEach(t=>this.constantViewDescriptors.set(t.id,t))}onFilterChanged(e){this.allViews.size===0&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),this.getViewsNotForTarget(e).forEach(t=>this.viewContainerModel.setVisible(t.id,!1)),this.getViewsForTarget(e).forEach(t=>this.viewContainerModel.setVisible(t.id,!0))}getViewsForTarget(e){const t=[];for(let i=0;i<e.length;i++)this.allViews.has(e[i])&&t.push(...Array.from(this.allViews.get(e[i]).values()));return t}getViewsNotForTarget(e){const t=this.allViews.keys();let i=t.next(),s=[];for(;!i.done;){let o=!1;e.forEach(n=>{i.value===n&&(o=!0)}),o||(s=s.concat(this.getViewsForTarget([i.value]))),i=t.next()}return s}onDidAddViewDescriptors(e){const t=super.onDidAddViewDescriptors(e);for(let i=0;i<e.length;i++)this.constantViewDescriptors.has(e[i].viewDescriptor.id)&&t[i].setExpanded(!1);return this.allViews.size===0&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),t}openView(e,t){const i=super.openView(e,t);if(i){const s=Array.from(this.allViews.entries()).find(o=>o[1].has(e));s&&!this.filterValue?.includes(s[0])&&this.setFilter(s[1].get(e))}return i}};hu=D([u(2,ie),u(3,He),u(4,mt),u(5,ce),u(6,F),u(7,me),u(8,at),u(9,At),u(10,bs),u(11,Ye),u(12,Ue)],hu);let uu=class extends R{constructor(e,t,i,s,o){super(),this.viewDescriptorService=e,this.paneCompositeService=t,this.contextKeyService=i,this.layoutService=s,this.editorService=o,this._onDidChangeViewVisibility=this._register(new E),this.onDidChangeViewVisibility=this._onDidChangeViewVisibility.event,this._onDidChangeViewContainerVisibility=this._register(new E),this.onDidChangeViewContainerVisibility=this._onDidChangeViewContainerVisibility.event,this._onDidChangeFocusedView=this._register(new E),this.onDidChangeFocusedView=this._onDidChangeFocusedView.event,this.viewContainerDisposables=this._register(new Cd),this.viewDisposable=new Map,this.enabledViewContainersContextKeys=new Map,this.visibleViewContextKeys=new Map,this.viewPaneContainers=new Map,this._register(ae(()=>{this.viewDisposable.forEach(n=>n.dispose()),this.viewDisposable.clear()})),this.viewDescriptorService.viewContainers.forEach(n=>this.onDidRegisterViewContainer(n,this.viewDescriptorService.getViewContainerLocation(n))),this._register(this.viewDescriptorService.onDidChangeViewContainers(({added:n,removed:r})=>this.onDidChangeContainers(n,r))),this._register(this.viewDescriptorService.onDidChangeContainerLocation(({viewContainer:n,from:r,to:d})=>this.onDidChangeContainerLocation(n,r,d))),this._register(this.paneCompositeService.onDidPaneCompositeOpen(n=>this._onDidChangeViewContainerVisibility.fire({id:n.composite.getId(),visible:!0,location:n.viewContainerLocation}))),this._register(this.paneCompositeService.onDidPaneCompositeClose(n=>this._onDidChangeViewContainerVisibility.fire({id:n.composite.getId(),visible:!1,location:n.viewContainerLocation}))),this.focusedViewContextKey=ld.bindTo(i)}onViewsAdded(e){for(const t of e)this.onViewsVisibilityChanged(t,t.isBodyVisible())}onViewsVisibilityChanged(e,t){this.getOrCreateActiveViewContextKey(e).set(t),this._onDidChangeViewVisibility.fire({id:e.id,visible:t})}onViewsRemoved(e){for(const t of e)this.onViewsVisibilityChanged(t,!1)}getOrCreateActiveViewContextKey(e){const t=y_(e.id);let i=this.visibleViewContextKeys.get(t);return i||(i=new q(t,!1).bindTo(this.contextKeyService),this.visibleViewContextKeys.set(t,i)),i}onDidChangeContainers(e,t){for(const{container:i,location:s}of t)this.onDidDeregisterViewContainer(i,s);for(const{container:i,location:s}of e)this.onDidRegisterViewContainer(i,s)}onDidRegisterViewContainer(e,t){this.registerPaneComposite(e,t);const i=new O,s=this.viewDescriptorService.getViewContainerModel(e);this.onViewDescriptorsAdded(s.allViewDescriptors,e),i.add(s.onDidChangeAllViewDescriptors(({added:o,removed:n})=>{this.onViewDescriptorsAdded(o,e),this.onViewDescriptorsRemoved(n)})),this.updateViewContainerEnablementContextKey(e),i.add(s.onDidChangeActiveViewDescriptors(()=>this.updateViewContainerEnablementContextKey(e))),i.add(this.registerOpenViewContainerAction(e)),this.viewContainerDisposables.set(e.id,i)}onDidDeregisterViewContainer(e,t){this.deregisterPaneComposite(e,t),this.viewContainerDisposables.deleteAndDispose(e.id)}onDidChangeContainerLocation(e,t,i){this.deregisterPaneComposite(e,t),this.registerPaneComposite(e,i),this.layoutService.isVisible(Ml(i))&&this.viewDescriptorService.getViewContainersByLocation(i).filter(s=>this.isViewContainerActive(s.id)).length===1&&this.openViewContainer(e.id)}onViewDescriptorsAdded(e,t){if(this.viewDescriptorService.getViewContainerLocation(t)!==null)for(const s of e){const o=new O;o.add(this.registerOpenViewAction(s)),o.add(this.registerFocusViewAction(s,t.title)),o.add(this.registerResetViewLocationAction(s)),this.viewDisposable.set(s,o)}}onViewDescriptorsRemoved(e){for(const t of e){const i=this.viewDisposable.get(t);i&&(i.dispose(),this.viewDisposable.delete(t))}}updateViewContainerEnablementContextKey(e){let t=this.enabledViewContainersContextKeys.get(e.id);t||(t=this.contextKeyService.createKey(Pl(e.id),!1),this.enabledViewContainersContextKeys.set(e.id,t)),t.set(!(e.hideIfEmpty&&this.viewDescriptorService.getViewContainerModel(e).activeViewDescriptors.length===0))}async openComposite(e,t,i){return this.paneCompositeService.openPaneComposite(e,t,i)}getComposite(e,t){return this.paneCompositeService.getPaneComposite(e,t)}isViewContainerVisible(e){const t=this.viewDescriptorService.getViewContainerById(e);if(!t)return!1;const i=this.viewDescriptorService.getViewContainerLocation(t);return i===null?!1:this.paneCompositeService.getActivePaneComposite(i)?.getId()===e}isViewContainerActive(e){const t=this.viewDescriptorService.getViewContainerById(e);return t?t.hideIfEmpty?this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length>0:!0:!1}getVisibleViewContainer(e){const t=this.paneCompositeService.getActivePaneComposite(e)?.getId();return t?this.viewDescriptorService.getViewContainerById(t):null}getActiveViewPaneContainerWithId(e){const t=this.viewDescriptorService.getViewContainerById(e);return t?this.getActiveViewPaneContainer(t):null}async openViewContainer(e,t){const i=this.viewDescriptorService.getViewContainerById(e);if(i){const s=this.viewDescriptorService.getViewContainerLocation(i);if(s!==null)return await this.paneCompositeService.openPaneComposite(e,s,t)||null}return null}async closeViewContainer(e){const t=this.viewDescriptorService.getViewContainerById(e);if(t){const i=this.viewDescriptorService.getViewContainerLocation(t),s=i!==null&&this.paneCompositeService.getActivePaneComposite(i);if(i!==null)return s?this.layoutService.setPartHidden(!0,Ml(i)):void 0}}isViewVisible(e){return this.getActiveViewWithId(e)?.isBodyVisible()||!1}getActiveViewWithId(e){const t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){const i=this.getActiveViewPaneContainer(t);if(i)return i.getView(e)}return null}getViewWithId(e){const t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){const i=this.viewPaneContainers.get(t.id);if(i)return i.getView(e)}return null}getFocusedView(){const e=this.contextKeyService.getContextKeyValue(ld.key)??"";return this.viewDescriptorService.getViewDescriptorById(e.toString())}getFocusedViewName(){const e=this.editorService.activeTextEditorControl?.hasTextFocus()?c(13186,"Text Editor"):void 0;return this.getFocusedView()?.name?.value??e??""}async openView(e,t){const i=this.viewDescriptorService.getViewContainerByViewId(e);if(!i||!this.viewDescriptorService.getViewContainerModel(i).activeViewDescriptors.some(n=>n.id===e))return null;const s=this.viewDescriptorService.getViewContainerLocation(i),o=this.getComposite(i.id,s);if(o){const n=await this.openComposite(o.id,s);if(n&&n.openView)return n.openView(e,t)||null;t&&n?.focus()}return null}closeView(e){const t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){const i=this.getActiveViewPaneContainer(t);if(i){const s=i.getView(e);if(s)if(i.views.length===1){const o=this.viewDescriptorService.getViewContainerLocation(t);o===Y.Sidebar?this.layoutService.setPartHidden(!0,P.SIDEBAR_PART):(o===Y.Panel||o===Y.AuxiliaryBar)&&this.paneCompositeService.hideActivePaneComposite(o),this.focusedViewContextKey.get()===e&&this.focusedViewContextKey.reset()}else s.setExpanded(!1)}}}getActiveViewPaneContainer(e){const t=this.viewDescriptorService.getViewContainerLocation(e);if(t===null)return null;const i=this.paneCompositeService.getActivePaneComposite(t);return i?.getId()===e.id&&i.getViewPaneContainer()||null}getViewProgressIndicator(e){const t=this.viewDescriptorService.getViewContainerByViewId(e);if(!t)return;const i=this.viewPaneContainers.get(t.id);if(!i)return;const s=i.getView(e);if(s)return i.isViewMergedWithContainer()?this.getViewContainerProgressIndicator(t):s.getProgressIndicator()}getViewContainerProgressIndicator(e){const t=this.viewDescriptorService.getViewContainerLocation(e);if(t!==null)return this.paneCompositeService.getProgressIndicator(e.id,t)}registerOpenViewContainerAction(e){const t=new O;if(e.openCommandActionDescriptor){const{id:i,mnemonicTitle:s,keybindings:o,order:n}=e.openCommandActionDescriptor??{id:e.id},r=e.openCommandActionDescriptor.title??e.title,d=this;if(t.add(b(class extends X{constructor(){super({id:i,get title(){const h=d.viewDescriptorService.getViewContainerLocation(e),p=typeof r=="string"?r:r.value,f=typeof r=="string"?r:r.original;return h===Y.Sidebar?{value:c(13187,"Show {0}",p),original:`Show ${f}`}:{value:c(13188,"Toggle {0}",p),original:`Toggle ${f}`}},category:xe.View,precondition:I.has(Pl(e.id)),keybinding:o?{...o,weight:G.WorkbenchContrib}:void 0,f1:!0})}async run(h){const p=h.get(Je),f=h.get(Ye),g=h.get(He),m=h.get(gt),v=f.getViewContainerLocation(e);switch(v){case Y.AuxiliaryBar:case Y.Sidebar:{const C=v===Y.Sidebar?P.SIDEBAR_PART:P.AUXILIARYBAR_PART;!m.isViewContainerVisible(e.id)||!g.hasFocus(C)?await m.openViewContainer(e.id,!0):p.activeGroup.focus();break}case Y.Panel:!m.isViewContainerVisible(e.id)||!g.hasFocus(P.PANEL_PART)?await m.openViewContainer(e.id,!0):m.closeViewContainer(e.id);break}}})),s){const l=this.viewDescriptorService.getDefaultViewContainerLocation(e);t.add(S.appendMenuItem(w.MenubarViewMenu,{command:{id:i,title:s},group:l===Y.Sidebar?"3_sidebar":l===Y.AuxiliaryBar?"4_auxbar":"5_panel",when:I.has(Pl(e.id)),order:n??Number.MAX_VALUE}))}}return t}registerOpenViewAction(e){const t=new O,i=e.openCommandActionDescriptor?.title??e.name,s=e.openCommandActionDescriptor?.id??`${e.id}.open`,o=this;if(t.add(b(class extends X{constructor(){super({id:s,get title(){const r=o.viewDescriptorService.getViewLocationById(e.id),d=typeof i=="string"?i:i.value,l=typeof i=="string"?i:i.original;return r===Y.Sidebar?{value:c(13187,"Show {0}",d),original:`Show ${l}`}:{value:c(13188,"Toggle {0}",d),original:`Toggle ${l}`}},category:xe.View,precondition:I.has(`${e.id}.active`),keybinding:e.openCommandActionDescriptor?.keybindings?{...e.openCommandActionDescriptor.keybindings,weight:G.WorkbenchContrib}:void 0,f1:e.openCommandActionDescriptor?!0:void 0,metadata:{description:c(13189,"Opens view {0}",e.name.value),args:[{name:"options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1,description:c(13190,"Whether to preserve the existing focus when opening the view.")}}}}]}})}async run(r,d){const l=r.get(Je),h=r.get(Ye),p=r.get(He),f=r.get(gt),g=r.get(se);if(ld.getValue(g)===e.id&&!d?.preserveFocus){const v=h.getViewLocationById(e.id);h.getViewLocationById(e.id)===Y.Sidebar?l.activeGroup.focus():v!==null&&p.setPartHidden(!0,Ml(v))}else f.openView(e.id,!d?.preserveFocus)}})),e.openCommandActionDescriptor?.mnemonicTitle){const n=this.viewDescriptorService.getDefaultContainerById(e.id);if(n){const r=this.viewDescriptorService.getDefaultViewContainerLocation(n);t.add(S.appendMenuItem(w.MenubarViewMenu,{command:{id:s,title:e.openCommandActionDescriptor.mnemonicTitle},group:r===Y.Sidebar?"3_sidebar":r===Y.AuxiliaryBar?"4_auxbar":"5_panel",when:I.has(`${e.id}.active`),order:e.openCommandActionDescriptor.order??Number.MAX_VALUE}))}}return t}registerFocusViewAction(e,t){return b(class extends X{constructor(){const s=x(13191,"Focus on {0} View",e.name.value);super({id:e.focusCommand?e.focusCommand.id:`${e.id}.focus`,title:s,category:t,menu:[{id:w.CommandPalette,when:e.when}],keybinding:{when:I.has(`${e.id}.active`),weight:G.WorkbenchContrib,primary:e.focusCommand?.keybindings?.primary,secondary:e.focusCommand?.keybindings?.secondary,linux:e.focusCommand?.keybindings?.linux,mac:e.focusCommand?.keybindings?.mac,win:e.focusCommand?.keybindings?.win},metadata:{description:s.value,args:[{name:"focusOptions",description:"Focus Options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1}}}}]}})}run(s,o){s.get(gt).openView(e.id,!o?.preserveFocus)}})}registerResetViewLocationAction(e){return b(class extends X{constructor(){super({id:`${e.id}.resetViewLocation`,title:x(13192,"Reset Location"),menu:[{id:w.ViewTitleContext,when:I.or(I.and(I.equals("view",e.id),I.equals(`${e.id}.defaultViewLocation`,!1))),group:"1_hide",order:2}]})}run(i){const s=i.get(Ye),o=s.getDefaultContainerById(e.id),n=s.getViewContainerModel(o);if(o.hideIfEmpty&&n.visibleViewDescriptors.length===0){const r=s.getDefaultViewContainerLocation(o);s.moveViewContainerToLocation(o,r,void 0,this.desc.id)}s.moveViewsToContainer([e],o,void 0,this.desc.id),i.get(gt).openView(e.id,!0)}})}registerPaneComposite(e,t){const i=this;let s=class extends ph{constructor(n,r,d,l,h,p,f){super(e.id,n,d,l,h,p,f,r)}createViewPaneContainer(n){const r=this._register(new O),d=i.createViewPaneContainer(n,e,t,r,this.instantiationService);return d instanceof hu||r.add(L.any(d.onDidAddViews,d.onDidRemoveViews,d.onTitleAreaUpdate)(()=>{this.updateTitleArea()})),d}};s=D([u(0,mt),u(1,bs),u(2,ce),u(3,F),u(4,me),u(5,at),u(6,At)],s),z.as(lm(t)).registerPaneComposite(rg.create(s,e.id,typeof e.title=="string"?e.title:e.title.value,Dd(e.icon)?e.icon:void 0,e.order,e.requestedIndex,e.icon instanceof $?e.icon:void 0))}deregisterPaneComposite(e,t){z.as(lm(t)).deregisterPaneComposite(e.id)}createViewPaneContainer(e,t,i,s,o){const n=o.createInstance(t.ctorDescriptor.ctor,...t.ctorDescriptor.staticArguments||[]);return this.viewPaneContainers.set(n.getId(),n),s.add(ae(()=>this.viewPaneContainers.delete(n.getId()))),s.add(n.onDidAddViews(r=>this.onViewsAdded(r))),s.add(n.onDidChangeViewVisibility(r=>this.onViewsVisibilityChanged(r,r.isBodyVisible()))),s.add(n.onDidRemoveViews(r=>this.onViewsRemoved(r))),s.add(n.onDidFocusView(r=>{this.focusedViewContextKey.get()!==r.id&&(this.focusedViewContextKey.set(r.id),this._onDidChangeFocusedView.fire())})),s.add(n.onDidBlurView(r=>{this.focusedViewContextKey.get()===r.id&&(this.focusedViewContextKey.reset(),this._onDidChangeFocusedView.fire())})),n}};uu=D([u(0,Ye),u(1,js),u(2,se),u(3,He),u(4,Q)],uu);function Pl(a){return`viewContainer.${a}.enabled`}function lm(a){switch(a){case Y.AuxiliaryBar:return Gi.Auxiliary;case Y.Panel:return Gi.Panels;case Y.Sidebar:default:return Gi.Viewlets}}function Ml(a){switch(a){case Y.AuxiliaryBar:return P.AUXILIARYBAR_PART;case Y.Panel:return P.PANEL_PART;case Y.Sidebar:default:return P.SIDEBAR_PART}}class sk{constructor(){this.onWillInstantiateEditorPane=Ci.onWillInstantiateEditorPane}didInstantiateEditorPane(e){return Ci.didInstantiateEditorPane(e)}}class ok{constructor(){this._providers=new Map,this._onDidChange=new E,this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}register(e,t,i,s){const o=this._makeKey(e,t);if(this._providers.has(o))throw new Error(`A provider for the command ${t} and menu ${e} is already registered.`);this._providers.set(o,i);const n=s?.(()=>{this._onDidChange.fire(e)});return ae(()=>{n?.dispose(),this._providers.delete(o)})}lookUp(e,t){return this._providers.get(this._makeKey(e,t))}_makeKey(e,t){return`${e.id}/${t instanceof w?t.id:t}`}}var pu;class pa{constructor(){this.uris=[]}async perform(){return this}toString(){return"(noop)"}}class xv{constructor(e,t,i){this.newUri=e,this.oldUri=t,this.options=i,this.type="rename"}}let gu=pu=class{constructor(e,t,i,s){this._edits=e,this._undoRedoInfo=t,this._workingCopyFileService=i,this._fileService=s}get uris(){return this._edits.flatMap(e=>[e.newUri,e.oldUri])}async perform(e){const t=[],i=[];for(const s of this._edits)s.options.overwrite===void 0&&s.options.ignoreIfExists&&await this._fileService.exists(s.newUri)||(t.push({file:{source:s.oldUri,target:s.newUri},overwrite:s.options.overwrite}),i.push(new xv(s.oldUri,s.newUri,s.options)));return t.length===0?new pa:(await this._workingCopyFileService.move(t,e,this._undoRedoInfo),new pu(i,{isUndoing:!0},this._workingCopyFileService,this._fileService))}toString(){return`(rename ${this._edits.map(e=>`${e.oldUri} to ${e.newUri}`).join(", ")})`}};gu=pu=D([u(2,Pc),u(3,Le)],gu);class nk{constructor(e,t,i){this.newUri=e,this.oldUri=t,this.options=i,this.type="copy"}}let fu=class{constructor(e,t,i,s,o){this._edits=e,this._undoRedoInfo=t,this._workingCopyFileService=i,this._fileService=s,this._instaService=o}get uris(){return this._edits.flatMap(e=>[e.newUri,e.oldUri])}async perform(e){const t=[];for(const o of this._edits)o.options.overwrite===void 0&&o.options.ignoreIfExists&&await this._fileService.exists(o.newUri)||t.push({file:{source:o.oldUri,target:o.newUri},overwrite:o.options.overwrite});if(t.length===0)return new pa;const i=await this._workingCopyFileService.copy(t,e,this._undoRedoInfo),s=[];for(let o=0;o<i.length;o++){const n=i[o],r=this._edits[o];s.push(new dg(n.resource,{recursive:!0,folder:this._edits[o].options.folder||n.isDirectory,...r.options},!1))}return this._instaService.createInstance(ga,s,{isUndoing:!0})}toString(){return`(copy ${this._edits.map(e=>`${e.oldUri} to ${e.newUri}`).join(", ")})`}};fu=D([u(2,Pc),u(3,Le),u(4,F)],fu);class kv{constructor(e,t,i){this.newUri=e,this.options=t,this.contents=i,this.type="create"}}let Kd=class{constructor(e,t,i,s,o,n){this._edits=e,this._undoRedoInfo=t,this._fileService=i,this._workingCopyFileService=s,this._instaService=o,this._textFileService=n}get uris(){return this._edits.map(e=>e.newUri)}async perform(e){const t=[],i=[],s=[];for(const o of this._edits)if(o.newUri.scheme!==pe.untitled&&!(o.options.overwrite===void 0&&o.options.ignoreIfExists&&await this._fileService.exists(o.newUri))){if(o.options.folder)t.push({resource:o.newUri});else{const n=typeof o.contents<"u"?o.contents:await this._textFileService.getEncodedReadable(o.newUri);i.push({resource:o.newUri,contents:n,overwrite:o.options.overwrite})}s.push(new dg(o.newUri,o.options,!o.options.folder&&!o.contents))}return t.length===0&&i.length===0?new pa:(await this._workingCopyFileService.createFolder(t,e,this._undoRedoInfo),await this._workingCopyFileService.create(i,e,this._undoRedoInfo),this._instaService.createInstance(ga,s,{isUndoing:!0}))}toString(){return`(create ${this._edits.map(e=>e.options.folder?`folder ${e.newUri}`:`file ${e.newUri} with ${e.contents?.byteLength||0} bytes`).join(", ")})`}};Kd=D([u(2,Le),u(3,Pc),u(4,F),u(5,hr)],Kd);class dg{constructor(e,t,i){this.oldUri=e,this.options=t,this.undoesCreate=i,this.type="delete"}}let ga=class{constructor(e,t,i,s,o,n,r){this._edits=e,this._undoRedoInfo=t,this._workingCopyFileService=i,this._fileService=s,this._configurationService=o,this._instaService=n,this._logService=r}get uris(){return this._edits.map(e=>e.oldUri)}async perform(e){const t=[],i=[];for(const s of this._edits){let o;try{o=await this._fileService.resolve(s.oldUri,{resolveMetadata:!0})}catch{if(!s.options.ignoreIfNotExists)throw new Error(`${s.oldUri} does not exist and can not be deleted`);continue}t.push({resource:s.oldUri,recursive:s.options.recursive,useTrash:!s.options.skipTrashBin&&this._fileService.hasCapability(s.oldUri,v_.Trash)&&this._configurationService.getValue("files.enableTrash")});let n,r=!1;if(!s.undoesCreate&&!s.options.folder&&(r=typeof s.options.maxSize=="number"&&o.size>s.options.maxSize,!r))try{n=await this._fileService.readFile(s.oldUri)}catch(d){this._logService.error(d)}r||i.push(new kv(s.oldUri,s.options,n?.value))}return t.length===0?new pa:(await this._workingCopyFileService.delete(t,e,this._undoRedoInfo),i.length===0?new pa:this._instaService.createInstance(Kd,i,{isUndoing:!0}))}toString(){return`(delete ${this._edits.map(e=>e.oldUri).join(", ")})`}};ga=D([u(2,Pc),u(3,Le),u(4,ie),u(5,F),u(6,Ue)],ga);class rk{constructor(e,t,i,s){this.label=e,this.code=t,this.operations=i,this.confirmBeforeUndo=s,this.type=xw.Workspace,this.resources=i.flatMap(o=>o.uris)}async undo(){await this._reverse()}async redo(){await this._reverse()}async _reverse(){for(let e=0;e<this.operations.length;e++){const i=await this.operations[e].perform(bi.None);this.operations[e]=i}}toString(){return this.operations.map(e=>String(e)).join(", ")}}let mu=class{constructor(e,t,i,s,o,n,r,d,l,h){this._label=e,this._code=t,this._undoRedoGroup=i,this._undoRedoSource=s,this._confirmBeforeUndo=o,this._progress=n,this._token=r,this._edits=d,this._instaService=l,this._undoRedoService=h}async apply(){const e=[],t={undoRedoGroupId:this._undoRedoGroup.id},i=[];for(const n of this._edits)n.newResource&&n.oldResource&&!n.options?.copy?i.push(new xv(n.newResource,n.oldResource,n.options??{})):n.newResource&&n.oldResource&&n.options?.copy?i.push(new nk(n.newResource,n.oldResource,n.options??{})):!n.newResource&&n.oldResource?i.push(new dg(n.oldResource,n.options??{},!1)):n.newResource&&!n.oldResource&&i.push(new kv(n.newResource,n.options??{},await n.options.contents));if(i.length===0)return[];const s=[];s[0]=[i[0]];for(let n=1;n<i.length;n++){const r=i[n],d=s.at(-1);d?.[0].type===r.type?d.push(r):s.push([r])}for(const n of s){if(this._token.isCancellationRequested)break;let r;switch(n[0].type){case"rename":r=this._instaService.createInstance(gu,n,t);break;case"copy":r=this._instaService.createInstance(fu,n,t);break;case"delete":r=this._instaService.createInstance(ga,n,t);break;case"create":r=this._instaService.createInstance(Kd,n,t);break}if(r){const d=await r.perform(this._token);e.push(d)}this._progress.report(void 0)}const o=new rk(this._label,this._code,e,this._confirmBeforeUndo);return this._undoRedoService.pushElement(o,this._undoRedoGroup,this._undoRedoSource),o.resources}};mu=D([u(8,F),u(9,$p)],mu);class Rv{constructor(e){this._modelReference=e,this.model=this._modelReference.object.textEditorModel,this._edits=[]}dispose(){this._modelReference.dispose()}isNoOp(){return!(this._edits.length>0||this._newEol!==void 0&&this._newEol!==this.model.getEndOfLineSequence())}addEdit(e){this._expectedModelVersionId=e.versionId;const{textEdit:t}=e;if(typeof t.eol=="number"&&(this._newEol=t.eol),!t.range&&!t.text||ve.isEmpty(t.range)&&!t.text)return;let i;t.range?i=ve.lift(t.range):i=this.model.getFullModelRange(),this._edits.push({...eh.replaceMove(i,t.text),insertAsSnippet:t.insertAsSnippet,keepWhitespace:t.keepWhitespace})}validate(){return typeof this._expectedModelVersionId>"u"||this.model.getVersionId()===this._expectedModelVersionId?{canApply:!0}:{canApply:!1,reason:this.model.uri}}getBeforeCursorState(){return null}apply(){this._edits.length>0&&(this._edits=this._edits.map(this._transformSnippetStringToInsertText,this).sort((e,t)=>ve.compareRangesUsingStarts(e.range,t.range)),this.model.pushEditOperations(null,this._edits,()=>null)),this._newEol!==void 0&&this.model.pushEOL(this._newEol)}_transformSnippetStringToInsertText(e){if(!e.insertAsSnippet||!e.text)return e;const t=Mc.asInsertText(e.text);return{...e,insertAsSnippet:!1,text:t}}}class ak extends Rv{constructor(e,t){super(e),this._editor=t}getBeforeCursorState(){return this._canUseEditor()?this._editor.getSelections():null}apply(){if(!this._canUseEditor()){super.apply();return}if(this._edits.length>0){const e=cw.get(this._editor);if(e&&this._edits.some(t=>t.insertAsSnippet)){const t=[];for(const i of this._edits)i.range&&i.text!==null&&t.push({range:ve.lift(i.range),template:i.insertAsSnippet?i.text:Mc.escape(i.text),keepWhitespace:i.keepWhitespace});e.apply(t,{undoStopBefore:!1,undoStopAfter:!1})}else this._edits=this._edits.map(this._transformSnippetStringToInsertText,this).sort((t,i)=>ve.compareRangesUsingStarts(t.range,i.range)),this._editor.executeEdits("",this._edits)}this._newEol!==void 0&&this._editor.hasModel()&&this._editor.getModel().pushEOL(this._newEol)}_canUseEditor(){return this._editor?.getModel()?.uri.toString()===this.model.uri.toString()}}let wu=class{constructor(e,t,i,s,o,n,r,d,l,h,p,f){this._label=e,this._code=t,this._editor=i,this._undoRedoGroup=s,this._undoRedoSource=o,this._progress=n,this._token=r,this._editorWorker=l,this._modelService=h,this._textModelResolverService=p,this._undoRedoService=f,this._edits=new ps;for(const g of d){let m=this._edits.get(g.resource);m||(m=[],this._edits.set(g.resource,m)),m.push(g)}}_validateBeforePrepare(){for(const e of this._edits.values())for(const t of e)if(typeof t.versionId=="number"){const i=this._modelService.getModel(t.resource);if(i&&i.getVersionId()!==t.versionId)throw new Error(`${i.uri.toString()} has changed in the meantime`)}}async _createEditsTasks(){const e=[],t=[];for(const[i,s]of this._edits){const o=this._textModelResolverService.createModelReference(i).then(async n=>{let r,d=!1;if(this._editor?.getModel()?.uri.toString()===n.object.textEditorModel.uri.toString()?(r=new ak(n,this._editor),d=!0):r=new Rv(n),e.push(r),!d){s.forEach(r.addEdit,r);return}const l=async(f,g)=>{const m=s.slice(f,g),v=await this._editorWorker.computeMoreMinimalEdits(n.object.textEditorModel.uri,m.map(C=>C.textEdit),!1);v?v.forEach(C=>r.addEdit(new gs(n.object.textEditorModel.uri,C,void 0,void 0))):m.forEach(r.addEdit,r)};let h=0,p=0;for(;p<s.length;p++)(s[p].textEdit.insertAsSnippet||s[p].metadata)&&(await l(h,p),r.addEdit(s[p]),h=p+1);await l(h,p)});t.push(o)}return await Promise.all(t),e}_validateTasks(e){for(const t of e){const i=t.validate();if(!i.canApply)return i}return{canApply:!0}}async apply(){this._validateBeforePrepare();const e=await this._createEditsTasks();try{if(this._token.isCancellationRequested)return[];const t=[],i=this._validateTasks(e);if(!i.canApply)throw new Error(`${i.reason.toString()} has changed in the meantime`);if(e.length===1){const s=e[0];if(!s.isNoOp()){const o=new hf(this._label,this._code,s.model,s.getBeforeCursorState());this._undoRedoService.pushElement(o,this._undoRedoGroup,this._undoRedoSource),s.apply(),o.close(),t.push(s.model.uri)}this._progress.report(void 0)}else{const s=new b_(this._label,this._code,e.map(o=>new hf(this._label,this._code,o.model,o.getBeforeCursorState())));this._undoRedoService.pushElement(s,this._undoRedoGroup,this._undoRedoSource);for(const o of e)o.apply(),this._progress.report(void 0),t.push(o.model.uri);s.close()}return t}finally{je(e)}}};wu=D([u(8,C_),u(9,Oc),u(10,ur),u(11,$p)],wu);class go extends S_{static is(e){return e instanceof go?!0:__(e)&&!!(e.undo&&e.redo)}static lift(e){return e instanceof go?e:new go(e.resource,e.undo,e.redo,e.metadata)}constructor(e,t,i,s){super(s),this.resource=e,this.undo=t,this.redo=i}}let yu=class{constructor(e,t,i,s,o,n){this._undoRedoGroup=e,this._undoRedoSource=t,this._progress=i,this._token=s,this._edits=o,this._undoRedoService=n}async apply(){const e=[];for(const t of this._edits){if(this._token.isCancellationRequested)break;await t.redo(),this._undoRedoService.pushElement({type:xw.Resource,resource:t.resource,label:t.metadata?.label||"Custom Edit",code:"paste",undo:t.undo,redo:t.redo},this._undoRedoGroup,this._undoRedoSource),this._progress.report(void 0),e.push(t.resource)}return e}};yu=D([u(5,$p)],yu);function dk(a){return a.map(e=>{if(gs.is(e))return gs.lift(e);if(ni.is(e))return ni.lift(e);if(Ad.is(e))return Ad.lift(e);if(go.is(e))return go.lift(e);throw new Error("Unsupported edit")})}let vu=class{constructor(e,t,i,s,o,n,r,d,l,h,p){this._label=e,this._code=t,this._editor=i,this._progress=s,this._token=o,this._edits=n,this._undoRedoGroup=r,this._undoRedoSource=d,this._confirmBeforeUndo=l,this._instaService=h,this._logService=p}ariaMessage(){const e=new ps,t=new ps;let i=0;for(const s of this._edits)s instanceof gs?(i+=1,t.set(s.resource,!0)):s instanceof ni&&e.set(s.oldResource??s.newResource,!0);return this._edits.length===0?c(4259,"Made no edits"):e.size===0?i>1&&t.size>1?c(4260,"Made {0} text edits in {1} files",i,t.size):c(4261,"Made {0} text edits in one file",i):c(4262,"Made {0} text edits in {1} files, also created or deleted {2} files",i,t.size,e.size)}async perform(){if(this._edits.length===0)return[];const e=[1];for(let n=1;n<this._edits.length;n++)Object.getPrototypeOf(this._edits[n-1])===Object.getPrototypeOf(this._edits[n])?e[e.length-1]++:e.push(1);const t=this._edits.length>1?0:void 0;this._progress.report({increment:t,total:100});const i={report:n=>this._progress.report({increment:100/this._edits.length})},s=[];let o=0;for(const n of e){if(this._token.isCancellationRequested)break;const r=this._edits.slice(o,o+n);r[0]instanceof ni?s.push(await this._performFileEdits(r,this._undoRedoGroup,this._undoRedoSource,this._confirmBeforeUndo,i)):r[0]instanceof gs?s.push(await this._performTextEdits(r,this._undoRedoGroup,this._undoRedoSource,i)):r[0]instanceof Ad?s.push(await this._performCellEdits(r,this._undoRedoGroup,this._undoRedoSource,i)):r[0]instanceof go?s.push(await this._performOpaqueEdits(r,this._undoRedoGroup,this._undoRedoSource,i)):console.log("UNKNOWN EDIT"),o=o+n}return s.flat()}async _performFileEdits(e,t,i,s,o){return this._logService.debug("_performFileEdits",JSON.stringify(e)),await this._instaService.createInstance(mu,this._label||c(4263,"Workspace Edit"),this._code||"undoredo.workspaceEdit",t,i,s,o,this._token,e).apply()}async _performTextEdits(e,t,i,s){return this._logService.debug("_performTextEdits",JSON.stringify(e)),await this._instaService.createInstance(wu,this._label||c(4263,"Workspace Edit"),this._code||"undoredo.workspaceEdit",this._editor,t,i,s,this._token,e).apply()}async _performCellEdits(e,t,i,s){return this._logService.debug("_performCellEdits",JSON.stringify(e)),await this._instaService.createInstance(T_,t,i,s,this._token,e).apply()}async _performOpaqueEdits(e,t,i,s){return this._logService.debug("_performOpaqueEdits",JSON.stringify(e)),await this._instaService.createInstance(yu,t,i,s,this._token,e).apply()}};vu=D([u(9,F),u(10,Ue)],vu);let bu=class{constructor(e,t,i,s,o,n,r){this._instaService=e,this._logService=t,this._editorService=i,this._lifecycleService=s,this._dialogService=o,this._workingCopyService=n,this._configService=r,this._activeUndoRedoGroups=new kw}setPreviewHandler(e){return this._previewHandler=e,ae(()=>{this._previewHandler===e&&(this._previewHandler=void 0)})}hasPreviewHandler(){return!!this._previewHandler}async apply(e,t){let i=dk(Array.isArray(e)?e:e.edits);if(i.length===0)return{ariaSummary:c(4264,"Made no edits"),isApplied:!1};this._previewHandler&&(t?.showPreview||i.some(h=>h.metadata?.needsConfirmation))&&(i=await this._previewHandler(i,t));let s=t?.editor;if(!s){const h=this._editorService.activeTextEditorControl;E_(h)?s=h:I_(h)&&(s=h.getModifiedEditor())}s&&s.getOption(Mt.readOnly)&&(s=void 0);let o,n=()=>{};if(typeof t?.undoRedoGroupId=="number"){for(const h of this._activeUndoRedoGroups)if(h.id===t.undoRedoGroupId){o=h;break}}o||(o=new D_,n=this._activeUndoRedoGroups.push(o));const r=t?.quotableLabel||t?.label,d=this._instaService.createInstance(vu,r,t?.code,s,t?.progress??Ew.None,t?.token??bi.None,i,o,t?.undoRedoSource,!!t?.confirmBeforeUndo);let l;try{l=this._lifecycleService.onBeforeShutdown(p=>p.veto(this._shouldVeto(r,p.reason),"veto.blukEditService"));const h=await d.perform();return t?.respectAutoSaveConfig&&this._configService.getValue(Lv)===!0&&h.length>1&&await this._saveAll(h),{ariaSummary:d.ariaMessage(),isApplied:i.length>0}}catch(h){throw this._logService.error(h),h}finally{l?.dispose(),n()}}async _saveAll(e){const t=new A_(e),i=this._workingCopyService.dirtyWorkingCopies.map(async o=>{t.has(o.resource)&&await o.save()}),s=await Promise.allSettled(i);for(const o of s)o.status==="rejected"&&this._logService.warn(o.reason)}async _shouldVeto(e,t){let i,s;switch(t){case Fr.CLOSE:i=c(4265,"Are you sure you want to close the window?"),s=c(4266,"&&Close Window");break;case Fr.LOAD:i=c(4267,"Are you sure you want to change the workspace?"),s=c(4268,"Change &&Workspace");break;case Fr.RELOAD:i=c(4269,"Are you sure you want to reload the window?"),s=c(4270,"&&Reload Window");break;default:i=c(4271,"Are you sure you want to quit?"),s=c(4272,"&&Quit");break}return!(await this._dialogService.confirm({message:i,detail:c(4273,"'{0}' is in progress.",e||c(4274,"File operation")),primaryButton:s})).confirmed}};bu=D([u(0,F),u(1,Ue),u(2,Q),u(3,or),u(4,Jo),u(5,Rw),u(6,ie)],bu);const Lv="files.refactoring.autoSave";z.as(Zs.Configuration).registerConfiguration({id:"files",properties:{[Lv]:{description:c(4275,"Controls if files that were part of a refactoring are saved automatically"),default:!0,type:"boolean"}}});const ck=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));let Cu=class{constructor(e,t,i,s){this._conflicts=new ps,this._disposables=new O,this._onDidConflict=new E,this.onDidConflict=this._onDidConflict.event;const o=new ps;for(const r of e)if(r instanceof gs){if(o.set(r.resource,!0),typeof r.versionId=="number"){const d=i.getModel(r.resource);d&&d.getVersionId()!==r.versionId&&(this._conflicts.set(r.resource,!0),this._onDidConflict.fire(this))}}else r instanceof ni?r.newResource?o.set(r.newResource,!0):r.oldResource&&o.set(r.oldResource,!0):r instanceof Ad?o.set(r.resource,!0):s.warn("UNKNOWN edit type",r);this._disposables.add(t.onDidFilesChange(r=>{for(const d of o.keys())if(!i.getModel(d)&&r.contains(d)){this._conflicts.set(d,!0),this._onDidConflict.fire(this);break}}));const n=r=>{o.has(r.uri)&&(this._conflicts.set(r.uri,!0),this._onDidConflict.fire(this))};for(const r of i.getModels())this._disposables.add(r.onDidChangeContent(()=>n(r)))}dispose(){this._disposables.dispose(),this._onDidConflict.dispose()}list(){return[...this._conflicts.keys()]}hasConflicts(){return this._conflicts.size>0}};Cu=D([u(1,Le),u(2,Oc),u(3,Ue)],Cu);var Su,Lr;class lk{constructor(){this._states=new WeakMap,this._checkedCount=0,this._onDidChange=new E,this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}get checkedCount(){return this._checkedCount}isChecked(e){return this._states.get(e)??!1}updateChecked(e,t){const i=this._states.get(e);i!==t&&(i===void 0?t&&(this._checkedCount+=1):t?this._checkedCount+=1:this._checkedCount-=1,this._states.set(e,t),this._onDidChange.fire(e))}}class hk{constructor(e,t){this.parent=e,this.textEdit=t}}var Be;(function(a){a[a.TextEdit=1]="TextEdit",a[a.Create=2]="Create",a[a.Delete=4]="Delete",a[a.Rename=8]="Rename"})(Be||(Be={}));class uk{constructor(e,t){this.uri=e,this.parent=t,this.type=0,this.textEdits=[],this.originalEdits=new Map}addEdit(e,t,i){this.type|=t,this.originalEdits.set(e,i),i instanceof gs?this.textEdits.push(new hk(this,i)):t===Be.Rename&&(this.newUri=i.newResource)}needsConfirmation(){for(const[,e]of this.originalEdits)if(!this.parent.checked.isChecked(e))return!0;return!1}}const yc=class yc{static keyOf(e){return e?.label||"<default>"}constructor(e=yc._defaultMetadata){this.metadata=e,this.operationByResource=new Map}get fileOperations(){return this.operationByResource.values()}};yc._defaultMetadata=Object.freeze({label:c(4292,"Other"),icon:k.symbolFile,needsConfirmation:!1});let Wd=yc,Gd=Su=class{static async create(e,t){return await e.get(F).createInstance(Su,t)._init()}constructor(e,t,i){this._bulkEdit=e,this._fileService=t,this.checked=new lk,this.fileOperations=[],this.categories=[],this.conflicts=i.createInstance(Cu,e)}dispose(){this.checked.dispose(),this.conflicts.dispose()}async _init(){const e=new Map,t=new Map,i=new ps;for(let s=0;s<this._bulkEdit.length;s++){const o=this._bulkEdit[s];let n,r;if(this.checked.updateChecked(o,!o.metadata?.needsConfirmation),o instanceof gs)r=Be.TextEdit,n=o.resource;else if(o instanceof ni)if(o.newResource&&o.oldResource){if(r=Be.Rename,n=o.oldResource,o.options?.overwrite===void 0&&o.options?.ignoreIfExists&&await this._fileService.exists(n))continue;i.set(o.newResource,n)}else if(o.oldResource){if(r=Be.Delete,n=o.oldResource,o.options?.ignoreIfNotExists&&!await this._fileService.exists(n))continue}else if(o.newResource){if(r=Be.Create,n=o.newResource,o.options?.overwrite===void 0&&o.options?.ignoreIfExists&&await this._fileService.exists(n))continue}else continue;else continue;const d=(p,f)=>{let g=uf.getComparisonKey(p,!0),m=f.get(g);!m&&i.has(p)&&(p=i.get(p),g=uf.getComparisonKey(p,!0),m=f.get(g)),m||(m=new uk(p,this),f.set(g,m)),m.addEdit(s,r,o)};d(n,e);const l=Wd.keyOf(o.metadata);let h=t.get(l);h||(h=new Wd(o.metadata),t.set(l,h)),d(n,h.operationByResource)}e.forEach(s=>this.fileOperations.push(s)),t.forEach(s=>this.categories.push(s));for(const s of this.fileOperations)if(s.type!==Be.TextEdit){let o=!0;for(const n of s.originalEdits.values())n instanceof ni&&(o=o&&this.checked.isChecked(n));if(!o)for(const n of s.originalEdits.values())this.checked.updateChecked(n,o)}return this.categories.sort((s,o)=>s.metadata.needsConfirmation===o.metadata.needsConfirmation?s.metadata.label.localeCompare(o.metadata.label):s.metadata.needsConfirmation?-1:1),this}getWorkspaceEdit(){const e=[];let t=!0;for(let i=0;i<this._bulkEdit.length;i++){const s=this._bulkEdit[i];if(this.checked.isChecked(s)){e[i]=s;continue}t=!1}return t?this._bulkEdit:(R_(e),e)}async getFileEditOperation(e){const t=await e.options.contents;if(t)return eh.replaceMove(ve.lift({startLineNumber:0,startColumn:0,endLineNumber:Number.MAX_VALUE,endColumn:0}),t.toString())}async getFileEdits(e){for(const t of this.fileOperations)if(t.uri.toString()===e.toString()){const i=[];let s=!1;for(const o of t.originalEdits.values())o instanceof ni?i.push(this.getFileEditOperation(o)):o instanceof gs?this.checked.isChecked(o)&&i.push(Promise.resolve(eh.replaceMove(ve.lift(o.textEdit.range),o.textEdit.insertAsSnippet?Mc.asInsertText(o.textEdit.text):o.textEdit.text))):this.checked.isChecked(o)||(s=!0);return s?[]:(await Promise.all(i)).filter(o=>o!==void 0).sort((o,n)=>ve.compareRangesUsingStarts(o.range,n.range))}return[]}getUriOfEdit(e){for(const t of this.fileOperations)for(const i of t.originalEdits.values())if(i===e)return t.uri;throw new Error("invalid edit")}};Gd=Su=D([u(1,Le),u(2,F)],Gd);var ds;let Ud=(ds=class{static fromPreviewUri(e){return $.parse(e.query)}constructor(e,t,i,s){this._operations=e,this._languageService=t,this._modelService=i,this._textModelResolverService=s,this._disposables=new O,this._modelPreviewEdits=new Map,this._instanceId=nr(),this._disposables.add(this._textModelResolverService.registerTextModelContentProvider(Lr.Schema,this)),this._ready=this._init()}dispose(){this._disposables.dispose()}asPreviewUri(e){return $.from({scheme:Lr.Schema,authority:this._instanceId,path:e.path,query:e.toString()})}async _init(){for(const e of this._operations.fileOperations)await this._applyTextEditsToPreviewModel(e.uri);this._disposables.add(L.debounce(this._operations.checked.onDidChange,(e,t)=>t,x_)(e=>{const t=this._operations.getUriOfEdit(e);this._applyTextEditsToPreviewModel(t)}))}async _applyTextEditsToPreviewModel(e){const t=await this._getOrCreatePreviewModel(e),i=this._modelPreviewEdits.get(t.id);i&&t.applyEdits(i);const s=await this._operations.getFileEdits(e),o=t.applyEdits(s,!0);this._modelPreviewEdits.set(t.id,o)}async _getOrCreatePreviewModel(e){const t=this.asPreviewUri(e);let i=this._modelService.getModel(t);if(!i){try{const s=await this._textModelResolverService.createModelReference(e),o=s.object.textEditorModel;i=this._modelService.createModel(k_(o.createSnapshot()),this._languageService.createById(o.getLanguageId()),t),s.dispose()}catch{i=this._modelService.createModel("",this._languageService.createByFilepathOrFirstLine(t),t)}queueMicrotask(async()=>{this._disposables.add(await this._textModelResolverService.createModelReference(i.uri))})}return i}async provideTextContent(e){return e.toString()===Lr.emptyPreview.toString()?this._modelService.createModel("",null,e):(await this._ready,this._modelService.getModel(e))}},Lr=ds,ds.Schema="vscode-bulkeditpreview-editor",ds.emptyPreview=$.from({scheme:ds.Schema,fragment:"empty"}),ds);Ud=Lr=D([u(1,ar),u(2,Oc),u(3,ur)],Ud);var _u,Eu,Iu;class zt{constructor(e,t){this.parent=e,this.category=t}isChecked(){const e=this.parent;let t=!0;for(const i of this.category.fileOperations)for(const s of i.originalEdits.values())t=t&&e.checked.isChecked(s);return t}setChecked(e){const t=this.parent;for(const i of this.category.fileOperations)for(const s of i.originalEdits.values())t.checked.updateChecked(s,e)}}class qt{constructor(e,t){this.parent=e,this.edit=t}isChecked(){const e=this.parent instanceof zt?this.parent.parent:this.parent;let t=!0;this.edit.type===Be.TextEdit&&(t=!this.edit.textEdits.every(i=>!e.checked.isChecked(i.textEdit)));for(const i of this.edit.originalEdits.values())i instanceof ni&&(t=t&&e.checked.isChecked(i));if(this.parent instanceof zt&&this.edit.type===Be.TextEdit){for(const i of e.categories)for(const s of i.fileOperations)if(s.uri.toString()===this.edit.uri.toString())for(const o of s.originalEdits.values())o instanceof ni&&(t=t&&e.checked.isChecked(o))}return t}setChecked(e){const t=this.parent instanceof zt?this.parent.parent:this.parent;for(const i of this.edit.originalEdits.values())t.checked.updateChecked(i,e);if(this.parent instanceof zt&&this.edit.type!==Be.TextEdit){for(const i of t.categories)for(const s of i.fileOperations)if(s.uri.toString()===this.edit.uri.toString())for(const o of s.originalEdits.values())t.checked.updateChecked(o,e)}}isDisabled(){if(this.parent instanceof zt&&this.edit.type===Be.TextEdit){const e=this.parent.parent;let t=!0;for(const i of e.categories)for(const s of i.fileOperations)if(s.uri.toString()===this.edit.uri.toString())for(const o of s.originalEdits.values())o instanceof ni&&(t=t&&e.checked.isChecked(o));return!t}return!1}}class ms{constructor(e,t,i,s,o,n,r){this.parent=e,this.idx=t,this.edit=i,this.prefix=s,this.selecting=o,this.inserting=n,this.suffix=r}isChecked(){let e=this.parent.parent;return e instanceof zt&&(e=e.parent),e.checked.isChecked(this.edit.textEdit)}setChecked(e){let t=this.parent.parent;if(t instanceof zt&&(t=t.parent),t.checked.updateChecked(this.edit.textEdit,e),e)for(const i of this.parent.edit.originalEdits.values())i instanceof ni&&t.checked.updateChecked(i,e)}isDisabled(){return this.parent.isDisabled()}}let Du=class{constructor(e,t){this._textModelService=e,this._instantiationService=t,this.groupByFile=!0}hasChildren(e){return e instanceof qt?e.edit.textEdits.length>0:!(e instanceof ms)}async getChildren(e){if(e instanceof Gd)return this.groupByFile?e.fileOperations.map(t=>new qt(e,t)):e.categories.map(t=>new zt(e,t));if(e instanceof zt)return Array.from(e.category.fileOperations,t=>new qt(e,t));if(e instanceof qt&&e.edit.textEdits.length>0){let t,i;try{const o=await this._textModelService.createModelReference(e.edit.uri);t=o.object.textEditorModel,i=o}catch{t=this._instantiationService.createInstance(pf,"",Td,pf.DEFAULT_CREATION_OPTIONS,null),i=t}const s=e.edit.textEdits.map((o,n)=>{const r=t.validateRange(o.textEdit.textEdit.range),d=t.tokenization.getLineTokens(r.startLineNumber);let l=23;for(let f=d.findTokenIndexAtOffset(r.startColumn-1)-1;l<50&&f>=0;f--)l=r.startColumn-d.getStartOffset(f);const h=t.tokenization.getLineTokens(r.endLineNumber);let p=0;for(let f=h.findTokenIndexAtOffset(r.endColumn-1);p<50&&f<h.getCount();f++)p+=h.getEndOffset(f)-h.getStartOffset(f);return new ms(e,n,o,t.getValueInRange(new ve(r.startLineNumber,r.startColumn-l,r.startLineNumber,r.startColumn)),t.getValueInRange(r),o.textEdit.textEdit.insertAsSnippet?Mc.asInsertText(o.textEdit.textEdit.text):o.textEdit.textEdit.text,t.getValueInRange(new ve(r.endLineNumber,r.endColumn,r.endLineNumber,r.endColumn+p)))});return i.dispose(),s}return[]}};Du=D([u(0,ur),u(1,F)],Du);class pk{compare(e,t){return e instanceof qt&&t instanceof qt?Vv(e.edit,t.edit):e instanceof ms&&t instanceof ms?ve.compareRangesUsingStarts(e.edit.textEdit.textEdit.range,t.edit.textEdit.textEdit.range):0}}function Vv(a,e){return Bc(a.uri.toString(),e.uri.toString())}let Au=class{constructor(e){this._labelService=e}getWidgetAriaLabel(){return c(4293,"Bulk Edit")}getRole(e){return"checkbox"}getAriaLabel(e){if(e instanceof qt){if(e.edit.textEdits.length>0)return e.edit.type&Be.Rename&&e.edit.newUri?c(4294,"Renaming {0} to {1}, also making text edits",this._labelService.getUriLabel(e.edit.uri,{relative:!0}),this._labelService.getUriLabel(e.edit.newUri,{relative:!0})):e.edit.type&Be.Create?c(4295,"Creating {0}, also making text edits",this._labelService.getUriLabel(e.edit.uri,{relative:!0})):e.edit.type&Be.Delete?c(4296,"Deleting {0}, also making text edits",this._labelService.getUriLabel(e.edit.uri,{relative:!0})):c(4297,"{0}, making text edits",this._labelService.getUriLabel(e.edit.uri,{relative:!0}));if(e.edit.type&Be.Rename&&e.edit.newUri)return c(4298,"Renaming {0} to {1}",this._labelService.getUriLabel(e.edit.uri,{relative:!0}),this._labelService.getUriLabel(e.edit.newUri,{relative:!0}));if(e.edit.type&Be.Create)return c(4299,"Creating {0}",this._labelService.getUriLabel(e.edit.uri,{relative:!0}));if(e.edit.type&Be.Delete)return c(4300,"Deleting {0}",this._labelService.getUriLabel(e.edit.uri,{relative:!0}))}if(e instanceof ms){if(e.selecting.length>0&&e.inserting.length>0)return c(4301,"line {0}, replacing {1} with {2}",e.edit.textEdit.textEdit.range.startLineNumber,e.selecting,e.inserting);if(e.selecting.length>0&&e.inserting.length===0)return c(4302,"line {0}, removing {1}",e.edit.textEdit.textEdit.range.startLineNumber,e.selecting);if(e.selecting.length===0&&e.inserting.length>0)return c(4303,"line {0}, inserting {1}",e.edit.textEdit.textEdit.range.startLineNumber,e.selecting)}return null}};Au=D([u(0,$i)],Au);class gk{getId(e){return e instanceof qt?e.edit.uri+(e.parent instanceof zt?JSON.stringify(e.parent.category.metadata):""):e instanceof ms?e.parent.edit.uri.toString()+e.idx:JSON.stringify(e.category.metadata)}}class fk{constructor(e){e.classList.add("category"),this.icon=document.createElement("div"),e.appendChild(this.icon),this.label=new Nc(e)}}var Ao;let Hd=(Ao=class{constructor(e){this._themeService=e,this.templateId=_u.id}renderTemplate(e){return new fk(e)}renderElement(e,t,i){i.icon.style.setProperty("--background-dark",null),i.icon.style.setProperty("--background-light",null),i.icon.style.color="";const{metadata:s}=e.element.category;if(Ce.isThemeIcon(s.iconPath)){const o=Ce.asClassName(s.iconPath);i.icon.className=o?`theme-icon ${o}`:"",i.icon.style.color=s.iconPath.color?this._themeService.getColorTheme().getColor(s.iconPath.color.id)?.toString()??"":""}else $.isUri(s.iconPath)?(i.icon.className="uri-icon",i.icon.style.setProperty("--background-dark",ss(s.iconPath)),i.icon.style.setProperty("--background-light",ss(s.iconPath))):s.iconPath&&(i.icon.className="uri-icon",i.icon.style.setProperty("--background-dark",ss(s.iconPath.dark)),i.icon.style.setProperty("--background-light",ss(s.iconPath.light)));i.label.setLabel(s.label,s.description,{descriptionMatches:Jn(e.filterData)})}disposeTemplate(e){e.label.dispose()}},_u=Ao,Ao.id="CategoryElementRenderer",Ao);Hd=_u=D([u(0,me)],Hd);let Tu=class{constructor(e,t,i){this._labelService=i,this._disposables=new O,this._localDisposables=new O,this._checkbox=document.createElement("input"),this._checkbox.className="edit-checkbox",this._checkbox.type="checkbox",this._checkbox.setAttribute("role","checkbox"),e.appendChild(this._checkbox),this._label=t.create(e,{supportHighlights:!0}),this._details=document.createElement("span"),this._details.className="details",e.appendChild(this._details)}dispose(){this._localDisposables.dispose(),this._disposables.dispose(),this._label.dispose()}set(e,t){if(this._localDisposables.clear(),this._checkbox.checked=e.isChecked(),this._checkbox.disabled=e.isDisabled(),this._localDisposables.add(J(this._checkbox,"change",()=>{e.setChecked(this._checkbox.checked)})),e.edit.type&Be.Rename&&e.edit.newUri)this._label.setResource({resource:e.edit.uri,name:c(4304,"{0} → {1}",this._labelService.getUriLabel(e.edit.uri,{relative:!0}),this._labelService.getUriLabel(e.edit.newUri,{relative:!0}))},{fileDecorations:{colors:!0,badges:!1}}),this._details.innerText=c(4305,"(renaming)");else{const i={matches:Jn(t),fileKind:Tr.FILE,fileDecorations:{colors:!0,badges:!1},extraClasses:[]};e.edit.type&Be.Create?this._details.innerText=c(4306,"(creating)"):e.edit.type&Be.Delete?(this._details.innerText=c(4307,"(deleting)"),i.extraClasses.push("delete")):this._details.innerText="",this._label.setFile(e.edit.uri,i)}}};Tu=D([u(2,$i)],Tu);var To;let zd=(To=class{constructor(e,t){this._resourceLabels=e,this._labelService=t,this.templateId=Eu.id}renderTemplate(e){return new Tu(e,this._resourceLabels,this._labelService)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}},Eu=To,To.id="FileElementRenderer",To);zd=Eu=D([u(1,$i)],zd);let xu=class{constructor(e,t){this._themeService=t,this._disposables=new O,this._localDisposables=new O,e.classList.add("textedit"),this._checkbox=document.createElement("input"),this._checkbox.className="edit-checkbox",this._checkbox.type="checkbox",this._checkbox.setAttribute("role","checkbox"),e.appendChild(this._checkbox),this._icon=document.createElement("div"),e.appendChild(this._icon),this._label=this._disposables.add(new L_(e))}dispose(){this._localDisposables.dispose(),this._disposables.dispose()}set(e){this._localDisposables.clear(),this._localDisposables.add(J(this._checkbox,"change",d=>{e.setChecked(this._checkbox.checked),d.preventDefault()})),e.parent.isChecked()?(this._checkbox.checked=e.isChecked(),this._checkbox.disabled=e.isDisabled()):(this._checkbox.checked=e.isChecked(),this._checkbox.disabled=e.isDisabled());let t="";t+=e.prefix,t+=e.selecting,t+=e.inserting,t+=e.suffix;const i={start:e.prefix.length,end:e.prefix.length+e.selecting.length,extraClasses:["remove"]},s={start:i.end,end:i.end+e.inserting.length,extraClasses:["insert"]};let o;const{metadata:n}=e.edit.textEdit;n&&n.description?o=c(4308,"{0} - {1}",n.label,n.description):n&&(o=n.label);const r=n?.iconPath;if(!r)this._icon.style.display="none";else if(this._icon.style.display="block",this._icon.style.setProperty("--background-dark",null),this._icon.style.setProperty("--background-light",null),Ce.isThemeIcon(r)){const d=Ce.asClassName(r);this._icon.className=d?`theme-icon ${d}`:"",this._icon.style.color=r.color?this._themeService.getColorTheme().getColor(r.color.id)?.toString()??"":""}else $.isUri(r)?(this._icon.className="uri-icon",this._icon.style.setProperty("--background-dark",ss(r)),this._icon.style.setProperty("--background-light",ss(r))):(this._icon.className="uri-icon",this._icon.style.setProperty("--background-dark",ss(r.dark)),this._icon.style.setProperty("--background-light",ss(r.light)));this._label.set(t,[i,s],o,!0),this._icon.title=o||""}};xu=D([u(1,me)],xu);var xo;let $d=(xo=class{constructor(e){this._themeService=e,this.templateId=Iu.id}renderTemplate(e){return new xu(e,this._themeService)}renderElement({element:e},t,i){i.set(e)}disposeTemplate(e){}},Iu=xo,xo.id="TextEditElementRenderer",xo);$d=Iu=D([u(0,me)],$d);class mk{getHeight(){return 23}getTemplateId(e){return e instanceof qt?zd.id:e instanceof ms?$d.id:Hd.id}}class wk{getKeyboardNavigationLabel(e){if(e instanceof qt)return us(e.edit.uri);if(e instanceof zt)return e.category.metadata.label}}var As;Pe(ck);var Jr;(function(a){a.Data="data",a.Message="message"})(Jr||(Jr={}));var Gt;let Fe=(Gt=class extends Fc{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v,C){super({...e,titleMenuId:w.BulkEditTitle},p,f,g,l,h,t,m,v,C),this._instaService=t,this._editorService=i,this._labelService=s,this._textModelService=o,this._dialogService=n,this._contextMenuService=r,this._storageService=d,this._treeViewStates=new Map,this._disposables=new O,this._sessionDisposables=new O,this._computeResourceDiffEditorInputs=new V_(async T=>{const B=new P_(async K=>{const j=K.uri,oe=this._currentProvider.asPreviewUri(j);if(K.type&Be.Delete)return{original:{resource:$.revive(oe)},modified:{resource:void 0},goToFileResource:K.uri};{let Me;try{(await this._textModelService.createModelReference(j)).dispose(),Me=j}catch{Me=Ud.emptyPreview}return{original:{resource:$.revive(Me)},modified:{resource:$.revive(oe)},goToFileResource:Me}}}),V=T.slice().sort(Vv),U=[];for(const K of V)U.push(await B.get(K));return{resources:U,getResourceDiffEditorInputIdOfOperation:async K=>{const j=await B.get(K);return{original:j.original.resource,modified:j.modified.resource}}}}),this.element.classList.add("bulk-edit-panel","show-file-icons"),this._ctxHasCategories=As.ctxHasCategories.bindTo(l),this._ctxGroupByFile=As.ctxGroupByFile.bindTo(l),this._ctxHasCheckedChanges=As.ctxHasCheckedChanges.bindTo(l)}dispose(){this._tree.dispose(),this._disposables.dispose(),super.dispose()}renderBody(e){super.renderBody(e);const t=this._instaService.createInstance(Lw,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._disposables.add(t);const i=document.createElement("div");i.className="content",e.appendChild(i);const s=document.createElement("div");i.appendChild(s),this._treeDataSource=this._instaService.createInstance(Du),this._treeDataSource.groupByFile=this._storageService.getBoolean(As._memGroupByFile,H.PROFILE,!0),this._ctxGroupByFile.set(this._treeDataSource.groupByFile),this._tree=this._instaService.createInstance(Kc,this.id,s,new mk,[this._instaService.createInstance($d),this._instaService.createInstance(zd,t),this._instaService.createInstance(Hd)],this._treeDataSource,{accessibilityProvider:this._instaService.createInstance(Au),identityProvider:new gk,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,keyboardNavigationLabelProvider:new wk,sorter:new pk,selectionNavigation:!0}),this._disposables.add(this._tree.onContextMenu(this._onContextMenu,this)),this._disposables.add(this._tree.onDidOpen(l=>this._openElementInMultiDiffEditor(l)));const o=document.createElement("div");o.className="buttons",i.appendChild(o);const n=new _w(o);this._disposables.add(n);const r=n.addButton({supportIcons:!0,...oa});r.label=c(4287,"Apply"),r.onDidClick(()=>this.accept(),this,this._disposables);const d=n.addButton({...oa,secondary:!0});d.label=c(4288,"Discard"),d.onDidClick(()=>this.discard(),this,this._disposables),this._message=document.createElement("span"),this._message.className="message",this._message.innerText=c(4289,"Invoke a code action, like rename, to see a preview of its changes here."),e.appendChild(this._message),this._setState(Jr.Message)}layoutBody(e,t){super.layoutBody(e,t);const i=e-50;this._tree.getHTMLElement().parentElement.style.height=`${i}px`,this._tree.layout(i,t)}_setState(e){this.element.dataset.state=e}async setInput(e,t){this._setState(Jr.Data),this._sessionDisposables.clear(),this._treeViewStates.clear(),this._currentResolve&&(this._currentResolve(void 0),this._currentResolve=void 0);const i=await this._instaService.invokeFunction(Gd.create,e);this._currentProvider=this._instaService.createInstance(Ud,i),this._sessionDisposables.add(this._currentProvider),this._sessionDisposables.add(i);const s=i.categories.length>1;return this._ctxHasCategories.set(s),this._treeDataSource.groupByFile=!s||this._treeDataSource.groupByFile,this._ctxHasCheckedChanges.set(i.checked.checkedCount>0),this._currentInput=i,new Promise(o=>{t.onCancellationRequested(()=>o(void 0)),this._currentResolve=o,this._setTreeInput(i),this._sessionDisposables.add(i.checked.onDidChange(()=>{this._tree.updateChildren(),this._ctxHasCheckedChanges.set(i.checked.checkedCount>0)}))})}hasInput(){return!!this._currentInput}async _setTreeInput(e){const t=this._treeViewStates.get(this._treeDataSource.groupByFile);if(await this._tree.setInput(e,t),this._tree.domFocus(),t)return;const i=[...this._tree.getNode(e).children].slice(0,10);for(;i.length>0;){const{element:s}=i.shift();s instanceof qt&&await this._tree.expand(s,!0),s instanceof zt&&(await this._tree.expand(s,!0),i.push(...this._tree.getNode(s).children))}}accept(){const e=this._currentInput?.conflicts.list();if(!e||e.length===0){this._done(!0);return}let t;e.length===1?t=c(4290,"Cannot apply refactoring because '{0}' has changed in the meantime.",this._labelService.getUriLabel(e[0],{relative:!0})):t=c(4291,"Cannot apply refactoring because {0} other files have changed in the meantime.",e.length),this._dialogService.warn(t).finally(()=>this._done(!1))}discard(){this._done(!1)}_done(e){this._currentResolve?.(e?this._currentInput?.getWorkspaceEdit():void 0),this._currentInput=void 0,this._setState(Jr.Message),this._sessionDisposables.clear()}toggleChecked(){const[e]=this._tree.getFocus();((e instanceof qt||e instanceof ms)&&!e.isDisabled()||e instanceof zt)&&e.setChecked(!e.isChecked())}groupByFile(){this._treeDataSource.groupByFile||this.toggleGrouping()}groupByType(){this._treeDataSource.groupByFile&&this.toggleGrouping()}toggleGrouping(){const e=this._tree.getInput();if(e){const t=this._tree.getViewState();this._treeViewStates.set(this._treeDataSource.groupByFile,t),this._treeDataSource.groupByFile=!this._treeDataSource.groupByFile,this._setTreeInput(e),this._storageService.store(As._memGroupByFile,this._treeDataSource.groupByFile,H.PROFILE,Re.USER),this._ctxGroupByFile.set(this._treeDataSource.groupByFile)}}async _openElementInMultiDiffEditor(e){const t=this._currentInput?.fileOperations;if(!t)return;let i,s;if(e.element instanceof ms)s=e.element.parent,i=e.element.edit.textEdit.textEdit.range;else if(e.element instanceof qt)s=e.element,i=e.element.edit.textEdits[0]?.textEdit.textEdit.range;else return;const o=await this._computeResourceDiffEditorInputs.get(t),n=await o.getResourceDiffEditorInputIdOfOperation(s.edit),r={...e.editorOptions,viewState:{revealData:{resource:n,range:i}}},d=$.from({scheme:As.Schema}),l="Refactor Preview";this._editorService.openEditor({multiDiffSource:d,label:l,options:r,isTransient:!0,description:l,resources:o.resources},e.sideBySide?Xm:M_)}_onContextMenu(e){this._contextMenuService.showContextMenu({menuId:w.BulkEditContext,contextKeyService:this.contextKeyService,getAnchor:()=>e.anchor})}},As=Gt,Gt.ID="refactorPreview",Gt.Schema="vscode-bulkeditpreview-multieditor",Gt.ctxHasCategories=new q("refactorPreview.hasCategories",!1),Gt.ctxGroupByFile=new q("refactorPreview.groupByFile",!0),Gt.ctxHasCheckedChanges=new q("refactorPreview.hasCheckedChanges",!0),Gt._memGroupByFile=`${Gt.ID}.groupByFile`,Gt);Fe=As=D([u(1,F),u(2,Q),u(3,$i),u(4,ur),u(5,Jo),u(6,at),u(7,ce),u(8,se),u(9,Ye),u(10,it),u(11,at),u(12,ie),u(13,xt),u(14,me),u(15,Tt)],Fe);var ku;async function Xo(a){const e=await a.openView(Fe.ID,!0);if(e instanceof Fe)return e}let Ru=class{constructor(e,t){this._paneCompositeService=e,this._editorGroupsService=t,this._activePanel=e.getActivePaneComposite(Y.Panel)?.getId()}async restore(e,t){if(e&&(typeof this._activePanel=="string"?await this._paneCompositeService.openPaneComposite(this._activePanel,Y.Panel):this._paneCompositeService.hideActivePaneComposite(Y.Panel)),t)for(const i of this._editorGroupsService.groups){const s=[];for(const o of i.editors)Bt.getCanonicalUri(o,{supportSideBySide:Ni.PRIMARY})?.scheme===Fe.Schema&&s.push(o);s.length&&i.closeEditors(s,{preserveFocus:!0})}}};Ru=D([u(0,js),u(1,Je)],Ru);class hm{constructor(e,t=new qs){this.uxState=e,this.cts=t}}var Ks;let ai=(Ks=class{constructor(e,t,i,s,o,n){this._paneCompositeService=e,this._viewsService=t,this._editorGroupsService=i,this._dialogService=s,o.setPreviewHandler(r=>this._previewEdit(r)),this._ctxEnabled=ku.ctxEnabled.bindTo(n)}async _previewEdit(e){this._ctxEnabled.set(!0);const t=this._activeSession?.uxState??new Ru(this._paneCompositeService,this._editorGroupsService),i=await Xo(this._viewsService);if(!i)return this._ctxEnabled.set(!1),e;if(i.hasInput()){const{confirmed:o}=await this._dialogService.confirm({type:Se.Info,message:c(4276,"Another refactoring is being previewed."),detail:c(4277,"Press 'Continue' to discard the previous refactoring and continue with the current refactoring."),primaryButton:c(4278,"&&Continue")});if(!o)return[]}let s;this._activeSession?(await this._activeSession.uxState.restore(!1,!0),this._activeSession.cts.dispose(!0),s=new hm(t)):s=new hm(t),this._activeSession=s;try{return await i.setInput(e,s.cts.token)??[]}finally{this._activeSession===s&&(await this._activeSession.uxState.restore(!0,!0),this._activeSession.cts.dispose(),this._ctxEnabled.set(!1),this._activeSession=void 0)}}},ku=Ks,Ks.ID="workbench.contrib.bulkEditPreview",Ks.ctxEnabled=new q("refactorPreview.enabled",!1),Ks);ai=ku=D([u(0,js),u(1,gt),u(2,Je),u(3,Jo),u(4,Vw),u(5,se)],ai);b(class extends X{constructor(){super({id:"refactorPreview.apply",title:x(4279,"Apply Refactoring"),category:x(4280,"Refactor Preview"),icon:k.check,precondition:I.and(ai.ctxEnabled,Fe.ctxHasCheckedChanges),menu:[{id:w.BulkEditContext,order:1}],keybinding:{weight:G.EditorContrib-10,when:I.and(ai.ctxEnabled,ld.isEqualTo(Fe.ID)),primary:N.CtrlCmd+y.Enter}})}async run(e){const t=e.get(gt);(await Xo(t))?.accept()}});b(class extends X{constructor(){super({id:"refactorPreview.discard",title:x(4281,"Discard Refactoring"),category:x(4280,"Refactor Preview"),icon:k.clearAll,precondition:ai.ctxEnabled,menu:[{id:w.BulkEditContext,order:2}]})}async run(e){const t=e.get(gt);(await Xo(t))?.discard()}});b(class extends X{constructor(){super({id:"refactorPreview.toggleCheckedState",title:x(4282,"Toggle Change"),category:x(4280,"Refactor Preview"),precondition:ai.ctxEnabled,keybinding:{weight:G.WorkbenchContrib,when:be,primary:y.Space},menu:{id:w.BulkEditContext,group:"navigation"}})}async run(e){const t=e.get(gt);(await Xo(t))?.toggleChecked()}});b(class extends X{constructor(){super({id:"refactorPreview.groupByFile",title:x(4283,"Group Changes By File"),category:x(4280,"Refactor Preview"),icon:k.ungroupByRefType,precondition:I.and(Fe.ctxHasCategories,Fe.ctxGroupByFile.negate(),ai.ctxEnabled),menu:[{id:w.BulkEditTitle,when:I.and(Fe.ctxHasCategories,Fe.ctxGroupByFile.negate()),group:"navigation",order:3}]})}async run(e){const t=e.get(gt);(await Xo(t))?.groupByFile()}});b(class extends X{constructor(){super({id:"refactorPreview.groupByType",title:x(4284,"Group Changes By Type"),category:x(4280,"Refactor Preview"),icon:k.groupByRefType,precondition:I.and(Fe.ctxHasCategories,Fe.ctxGroupByFile,ai.ctxEnabled),menu:[{id:w.BulkEditTitle,when:I.and(Fe.ctxHasCategories,Fe.ctxGroupByFile),group:"navigation",order:3}]})}async run(e){const t=e.get(gt);(await Xo(t))?.groupByType()}});b(class extends X{constructor(){super({id:"refactorPreview.toggleGrouping",title:x(4284,"Group Changes By Type"),category:x(4280,"Refactor Preview"),icon:k.listTree,toggled:Fe.ctxGroupByFile.negate(),precondition:I.and(Fe.ctxHasCategories,ai.ctxEnabled),menu:[{id:w.BulkEditContext,order:3}]})}async run(e){const t=e.get(gt);(await Xo(t))?.toggleGrouping()}});yt(ai.ID,ai,vt.BlockRestore);const Pv=le("refactor-preview-view-icon",k.lightbulb,c(4285,"View icon of the refactor preview view.")),yk=z.as(pt.ViewContainersRegistry).registerViewContainer({id:Fe.ID,title:x(4286,"Refactor Preview"),hideIfEmpty:!0,ctorDescriptor:new ee(Ea,[Fe.ID,{mergeViewWithContainerWhenSingleView:!0}]),icon:Pv,storageId:Fe.ID},Y.Panel);z.as(pt.ViewsRegistry).registerViews([{id:Fe.ID,name:x(4286,"Refactor Preview"),when:ai.ctxEnabled,ctorDescriptor:new ee(Fe),containerIcon:Pv}],yk);function vk(){return{[Vw.toString()]:new ee(bu,[],!0)}}const bk=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class ud{constructor(e,t,i,s){this.item=e,this.locations=t,this.model=i,this.parent=s}static compare(e,t){let i=Bc(e.item.uri.toString(),t.item.uri.toString());return i===0&&(i=ve.compareRangesUsingStarts(e.item.range,t.item.range)),i}}let Ck=class{constructor(e){this.getDirection=e}hasChildren(){return!0}async getChildren(e){if(e instanceof Ow)return e.roots.map(s=>new ud(s,void 0,e,void 0));const{model:t,item:i}=e;return this.getDirection()===nt.CallsFrom?(await t.resolveOutgoingCalls(i,bi.None)).map(s=>new ud(s.to,s.fromRanges.map(o=>({range:o,uri:i.uri})),t,e)):(await t.resolveIncomingCalls(i,bi.None)).map(s=>new ud(s.from,s.fromRanges.map(o=>({range:o,uri:s.from.uri})),t,e))}},Sk=class{compare(e,t){return ud.compare(e,t)}},_k=class{constructor(e){this.getDirection=e}getId(e){let t=this.getDirection()+JSON.stringify(e.item.uri)+JSON.stringify(e.item.range);return e.parent&&(t+=this.getId(e.parent)),t}};class Ek{constructor(e,t){this.icon=e,this.label=t}}const vc=class vc{constructor(){this.templateId=vc.id}renderTemplate(e){e.classList.add("callhierarchy-element");const t=document.createElement("div");e.appendChild(t);const i=new Nc(e,{supportHighlights:!0});return new Ek(t,i)}renderElement(e,t,i){const{element:s,filterData:o}=e,n=s.item.tags?.includes(Pw.Deprecated);i.icon.className="",i.icon.classList.add("inline",...Ce.asClassNameArray(Mw.toIcon(s.item.kind))),i.label.setLabel(s.item.name,s.item.detail,{labelEscapeNewLines:!0,matches:Jn(o),strikethrough:n})}disposeTemplate(e){e.label.dispose()}};vc.id="CallRenderer";let qd=vc,Ik=class{getHeight(e){return 22}getTemplateId(e){return qd.id}},Dk=class{constructor(e){this.getDirection=e}getWidgetAriaLabel(){return c(4326,"Call Hierarchy")}getAriaLabel(e){return this.getDirection()===nt.CallsFrom?c(4327,"calls from {0}",e.item.name):c(4328,"callers of {0}",e.item.name)}};var Lu;Pe(bk);var Zr;(function(a){a.Loading="loading",a.Message="message",a.Data="data"})(Zr||(Zr={}));let um=class{static store(e,t){t.store("callHierarchyPeekLayout",JSON.stringify(e),H.PROFILE,Re.MACHINE)}static retrieve(e){const t=e.get("callHierarchyPeekLayout",H.PROFILE,"{}"),i={ratio:.7,height:17};try{return{...i,...JSON.parse(t)}}catch{return i}}constructor(e,t){this.ratio=e,this.height=t}};class Ak extends Kc{}var ko;let Xn=(ko=class extends Nw{constructor(e,t,i,s,o,n,r,d,l,h,p){super(e,{showFrame:!0,showArrow:!0,isResizeable:!0,isAccessible:!0},p),this._where=t,this._direction=i,this._peekViewService=o,this._editorService=n,this._textModelService=r,this._storageService=d,this._menuService=l,this._contextKeyService=h,this._instantiationService=p,this._treeViewStates=new Map,this._previewDisposable=new O,this.create(),this._peekViewService.addExclusiveWidget(e,this),this._applyTheme(s.getColorTheme()),this._disposables.add(s.onDidColorThemeChange(this._applyTheme,this)),this._disposables.add(this._previewDisposable)}dispose(){um.store(this._layoutInfo,this._storageService),this._splitView.dispose(),this._tree.dispose(),this._editor.dispose(),super.dispose()}get direction(){return this._direction}_applyTheme(e){const t=e.getColor(Bw)||oi.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(Ww)||oi.transparent,primaryHeadingColor:e.getColor(Kw),secondaryHeadingColor:e.getColor(Fw)})}_fillHead(e){super._fillHead(e,!0);const t=this._menuService.createMenu(Lu.TitleMenu,this._contextKeyService),i=()=>{const s=Wc(t.getActions());this._actionbarWidget.clear(),this._actionbarWidget.push(s,{label:!1,icon:!0})};this._disposables.add(t),this._disposables.add(t.onDidChange(i)),i()}_fillBody(e){this._layoutInfo=um.retrieve(this._storageService),this._dim=new jt(0,0),this._parent=e,e.classList.add("call-hierarchy");const t=document.createElement("div");t.classList.add("message"),e.appendChild(t),this._message=t,this._message.tabIndex=0;const i=document.createElement("div");i.classList.add("results"),e.appendChild(i),this._splitView=new ea(i,{orientation:Z.HORIZONTAL});const s=document.createElement("div");s.classList.add("editor"),i.appendChild(s);const o={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._editor=this._instantiationService.createInstance(Gw,s,o,{},this.editor);const n=document.createElement("div");n.classList.add("tree"),i.appendChild(n);const r={sorter:new Sk,accessibilityProvider:new Dk(()=>this._direction),identityProvider:new _k(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:Uw}};this._tree=this._instantiationService.createInstance(Ak,"CallHierarchyPeek",n,new Ik,[this._instantiationService.createInstance(qd)],this._instantiationService.createInstance(Ck,()=>this._direction),r),this._splitView.addView({onDidChange:L.None,element:s,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:d=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:d})}},Ht.Distribute),this._splitView.addView({onDidChange:L.None,element:n,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:d=>{this._dim.height&&this._tree.layout(this._dim.height,d)}},Ht.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this._layoutInfo.ratio=this._splitView.getViewSize(0)/this._dim.width)})),this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview,this)),this._disposables.add(this._editor.onMouseDown(d=>{const{event:l,target:h}=d;if(l.detail!==2)return;const[p]=this._tree.getFocus();p&&(this.dispose(),this._editorService.openEditor({resource:p.item.uri,options:{selection:h.range}}))})),this._disposables.add(this._tree.onMouseDblClick(d=>{d.target!==Hw.Twistie&&d.element&&(this.dispose(),this._editorService.openEditor({resource:d.element.item.uri,options:{selection:d.element.item.selectionRange,pinned:!0}}))})),this._disposables.add(this._tree.onDidChangeSelection(d=>{const[l]=d.elements;l&&zw(d.browserEvent)&&(this.dispose(),this._editorService.openEditor({resource:l.item.uri,options:{selection:l.item.selectionRange,pinned:!0}}))}))}async _updatePreview(){const[e]=this._tree.getFocus();if(!e)return;this._previewDisposable.clear();const t={description:"call-hierarchy-decoration",stickiness:Op.NeverGrowsWhenTypingAtEdges,className:"call-decoration",overviewRuler:{color:Sd(qw),position:lr.Center}};let i;this._direction===nt.CallsFrom?i=e.parent?e.parent.item.uri:e.model.root.uri:i=e.item.uri;const s=await this._textModelService.createModelReference(i);this._editor.setModel(s.object.textEditorModel);const o=[];let n,r=e.locations;r||(r=[{uri:e.item.uri,range:e.item.selectionRange}]);for(const l of r)l.uri.toString()===i.toString()&&(o.push({range:l.range,options:t}),n=n?ve.plusRange(l.range,n):l.range);if(n){this._editor.revealRangeInCenter(n,ft.Immediate);const l=this._editor.createDecorationsCollection(o);this._previewDisposable.add(ae(()=>l.clear()))}this._previewDisposable.add(s);const d=this._direction===nt.CallsFrom?c(4321,"Calls from '{0}'",e.model.root.name):c(4322,"Callers of '{0}'",e.model.root.name);this.setTitle(d)}showLoading(){this._parent.dataset.state=Zr.Loading,this.setTitle(c(4323,"Loading...")),this._show()}showMessage(e){this._parent.dataset.state=Zr.Message,this.setTitle(""),this.setMetaTitle(""),this._message.innerText=e,this._show(),this._message.focus()}async showModel(e){this._show();const t=this._treeViewStates.get(this._direction);await this._tree.setInput(e,t);const i=this._tree.getNode(e).children[0];await this._tree.expand(i.element),i.children.length===0?this.showMessage(this._direction===nt.CallsFrom?c(4324,"No calls from '{0}'",e.root.name):c(4325,"No callers of '{0}'",e.root.name)):(this._parent.dataset.state=Zr.Data,(!t||this._tree.getFocus().length===0)&&this._tree.setFocus([i.children[0].element]),this._tree.domFocus(),this._updatePreview())}getModel(){return this._tree.getInput()}getFocused(){return this._tree.getFocus()[0]}async updateDirection(e){const t=this._tree.getInput();t&&e!==this._direction&&(this._treeViewStates.set(this._direction,this._tree.getViewState()),this._direction=e,await this.showModel(t))}_show(){this._isShowing||(this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber,ft.Smooth),super.show(ve.fromPositions(this._where),this._layoutInfo.height))}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){(this._dim.height!==e||this._dim.width!==t)&&(super._doLayoutBody(e,t),this._dim=new jt(t,e),this._layoutInfo.height=this._viewZone?this._viewZone.heightInLines:this._layoutInfo.height,this._splitView.layout(t),this._splitView.resizeView(0,t*this._layoutInfo.ratio))}},Lu=ko,ko.TitleMenu=new w("callhierarchy/title"),ko);Xn=Lu=D([u(3,me),u(4,$w),u(5,Q),u(6,ur),u(7,ce),u(8,Cs),u(9,se),u(10,F)],Xn);var an;const Vu=new q("editorHasCallHierarchyProvider",!1,c(4309,"Whether a call hierarchy provider is available")),Fa=new q("callHierarchyVisible",!1,c(4310,"Whether call hierarchy peek is currently showing")),fa=new q("callHierarchyDirection",void 0,{type:"string",description:c(4311,"Whether call hierarchy shows incoming or outgoing calls")});function Tk(a){return a===nt.CallsFrom||a===nt.CallsTo?a:nt.CallsTo}var Ws;let ws=(Ws=class{static get(e){return e.getContribution(an.Id)}constructor(e,t,i,s,o){this._editor=e,this._contextKeyService=t,this._storageService=i,this._editorService=s,this._instantiationService=o,this._dispoables=new O,this._sessionDisposables=new O,this._ctxIsVisible=Fa.bindTo(this._contextKeyService),this._ctxHasProvider=Vu.bindTo(this._contextKeyService),this._ctxDirection=fa.bindTo(this._contextKeyService),this._dispoables.add(L.any(e.onDidChangeModel,e.onDidChangeModelLanguage,bl.onDidChange)(()=>{this._ctxHasProvider.set(e.hasModel()&&bl.has(e.getModel()))})),this._dispoables.add(this._sessionDisposables)}dispose(){this._ctxHasProvider.reset(),this._ctxIsVisible.reset(),this._dispoables.dispose()}async startCallHierarchyFromEditor(){if(this._sessionDisposables.clear(),!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getPosition();if(!bl.has(e))return;const i=new qs,s=Ow.create(e,t,i.token),o=Tk(this._storageService.get(an._StorageDirection,H.PROFILE,nt.CallsTo));this._showCallHierarchyWidget(t,o,s,i)}async startCallHierarchyFromCallHierarchy(){if(!this._widget)return;const e=this._widget.getModel(),t=this._widget.getFocused();if(!t||!e)return;const i=await this._editorService.openCodeEditor({resource:t.item.uri},this._editor);if(!i)return;const s=e.fork(t.item);this._sessionDisposables.clear(),an.get(i)?._showCallHierarchyWidget(ve.lift(s.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(s),new qs)}_showCallHierarchyWidget(e,t,i,s){this._ctxIsVisible.set(!0),this._ctxDirection.set(t),L.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endCallHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(Xn,this._editor,e,t),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endCallHierarchy(),this._storageService.store(an._StorageDirection,this._widget.direction,H.PROFILE,Re.USER)})),this._sessionDisposables.add({dispose(){s.dispose(!0)}}),this._sessionDisposables.add(this._widget),i.then(o=>{s.token.isCancellationRequested||(o?(this._sessionDisposables.add(o),this._widget.showModel(o)):this._widget.showMessage(c(4312,"No results")))}).catch(o=>{if(Ec(o)){this.endCallHierarchy();return}this._widget.showMessage(c(4313,"Failed to show call hierarchy"))})}showOutgoingCalls(){this._widget?.updateDirection(nt.CallsFrom),this._ctxDirection.set(nt.CallsFrom)}showIncomingCalls(){this._widget?.updateDirection(nt.CallsTo),this._ctxDirection.set(nt.CallsTo)}endCallHierarchy(){this._sessionDisposables.clear(),this._ctxIsVisible.set(!1),this._editor.focus()}},an=Ws,Ws.Id="callHierarchy",Ws._StorageDirection="callHierarchy/defaultDirection",Ws);ws=an=D([u(1,se),u(2,ce),u(3,Zo),u(4,F)],ws);xc(ws.Id,ws,kc.Eager);b(class extends qi{constructor(){super({id:"editor.showCallHierarchy",title:x(4314,"Peek Call Hierarchy"),menu:{id:w.EditorContextPeek,group:"navigation",order:1e3,when:I.and(Vu,xd.notInPeekEditor,na.isInEmbeddedEditor.toNegated())},keybinding:{when:na.editorTextFocus,weight:G.WorkbenchContrib,primary:N.Shift+N.Alt+y.KeyH},precondition:I.and(Vu,xd.notInPeekEditor),f1:!0})}async runEditorCommand(e,t){return ws.get(t)?.startCallHierarchyFromEditor()}});b(class extends qi{constructor(){super({id:"editor.showIncomingCalls",title:x(4315,"Show Incoming Calls"),icon:le("callhierarchy-incoming",k.callIncoming,c(4316,"Icon for incoming calls in the call hierarchy view.")),precondition:I.and(Fa,fa.isEqualTo(nt.CallsFrom)),keybinding:{weight:G.WorkbenchContrib,primary:N.Shift+N.Alt+y.KeyH},menu:{id:Xn.TitleMenu,when:fa.isEqualTo(nt.CallsFrom),order:1}})}runEditorCommand(a,e){return ws.get(e)?.showIncomingCalls()}});b(class extends qi{constructor(){super({id:"editor.showOutgoingCalls",title:x(4317,"Show Outgoing Calls"),icon:le("callhierarchy-outgoing",k.callOutgoing,c(4318,"Icon for outgoing calls in the call hierarchy view.")),precondition:I.and(Fa,fa.isEqualTo(nt.CallsTo)),keybinding:{weight:G.WorkbenchContrib,primary:N.Shift+N.Alt+y.KeyH},menu:{id:Xn.TitleMenu,when:fa.isEqualTo(nt.CallsTo),order:1}})}runEditorCommand(a,e){return ws.get(e)?.showOutgoingCalls()}});b(class extends qi{constructor(){super({id:"editor.refocusCallHierarchy",title:x(4319,"Refocus Call Hierarchy"),precondition:Fa,keybinding:{weight:G.WorkbenchContrib,primary:N.Shift+y.Enter}})}async runEditorCommand(a,e){return ws.get(e)?.startCallHierarchyFromCallHierarchy()}});b(class extends qi{constructor(){super({id:"editor.closeCallHierarchy",title:c(4320,"Close"),icon:k.close,precondition:Fa,keybinding:{weight:G.WorkbenchContrib+10,primary:y.Escape,when:I.not("config.editor.stablePeek")},menu:{id:Xn.TitleMenu,order:1e3}})}runEditorCommand(a,e){return ws.get(e)?.endCallHierarchy()}});const xk=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class pd{constructor(e,t,i){this.item=e,this.model=t,this.parent=i}static compare(e,t){let i=Bc(e.item.uri.toString(),t.item.uri.toString());return i===0&&(i=ve.compareRangesUsingStarts(e.item.range,t.item.range)),i}}class kk{constructor(e){this.getDirection=e}hasChildren(){return!0}async getChildren(e){if(e instanceof jw)return e.roots.map(s=>new pd(s,e,void 0));const{model:t,item:i}=e;return this.getDirection()===rt.Supertypes?(await t.provideSupertypes(i,bi.None)).map(s=>new pd(s,t,e)):(await t.provideSubtypes(i,bi.None)).map(s=>new pd(s,t,e))}}class Rk{compare(e,t){return pd.compare(e,t)}}class Lk{constructor(e){this.getDirection=e}getId(e){let t=this.getDirection()+JSON.stringify(e.item.uri)+JSON.stringify(e.item.range);return e.parent&&(t+=this.getId(e.parent)),t}}class Vk{constructor(e,t){this.icon=e,this.label=t}}const bc=class bc{constructor(){this.templateId=bc.id}renderTemplate(e){e.classList.add("typehierarchy-element");const t=document.createElement("div");e.appendChild(t);const i=new Nc(e,{supportHighlights:!0});return new Vk(t,i)}renderElement(e,t,i){const{element:s,filterData:o}=e,n=s.item.tags?.includes(Pw.Deprecated);i.icon.classList.add("inline",...Ce.asClassNameArray(Mw.toIcon(s.item.kind))),i.label.setLabel(s.item.name,s.item.detail,{labelEscapeNewLines:!0,matches:Jn(o),strikethrough:n})}disposeTemplate(e){e.label.dispose()}};bc.id="TypeRenderer";let jd=bc;class Pk{getHeight(e){return 22}getTemplateId(e){return jd.id}}class Mk{constructor(e){this.getDirection=e}getWidgetAriaLabel(){return c(11440,"Type Hierarchy")}getAriaLabel(e){return this.getDirection()===rt.Supertypes?c(11441,"supertypes of {0}",e.item.name):c(11442,"subtypes of {0}",e.item.name)}}var Pu;Pe(xk);var Xr;(function(a){a.Loading="loading",a.Message="message",a.Data="data"})(Xr||(Xr={}));class pm{static store(e,t){t.store("typeHierarchyPeekLayout",JSON.stringify(e),H.PROFILE,Re.MACHINE)}static retrieve(e){const t=e.get("typeHierarchyPeekLayout",H.PROFILE,"{}"),i={ratio:.7,height:17};try{return{...i,...JSON.parse(t)}}catch{return i}}constructor(e,t){this.ratio=e,this.height=t}}class Ok extends Kc{}var Ro;let Qn=(Ro=class extends Nw{constructor(e,t,i,s,o,n,r,d,l,h,p){super(e,{showFrame:!0,showArrow:!0,isResizeable:!0,isAccessible:!0},p),this._where=t,this._direction=i,this._peekViewService=o,this._editorService=n,this._textModelService=r,this._storageService=d,this._menuService=l,this._contextKeyService=h,this._instantiationService=p,this._treeViewStates=new Map,this._previewDisposable=new O,this.create(),this._peekViewService.addExclusiveWidget(e,this),this._applyTheme(s.getColorTheme()),this._disposables.add(s.onDidColorThemeChange(this._applyTheme,this)),this._disposables.add(this._previewDisposable)}dispose(){pm.store(this._layoutInfo,this._storageService),this._splitView.dispose(),this._tree.dispose(),this._editor.dispose(),super.dispose()}get direction(){return this._direction}_applyTheme(e){const t=e.getColor(Bw)||oi.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(Ww)||oi.transparent,primaryHeadingColor:e.getColor(Kw),secondaryHeadingColor:e.getColor(Fw)})}_fillHead(e){super._fillHead(e,!0);const t=this._menuService.createMenu(Pu.TitleMenu,this._contextKeyService),i=()=>{const s=Wc(t.getActions());this._actionbarWidget.clear(),this._actionbarWidget.push(s,{label:!1,icon:!0})};this._disposables.add(t),this._disposables.add(t.onDidChange(i)),i()}_fillBody(e){this._layoutInfo=pm.retrieve(this._storageService),this._dim=new jt(0,0),this._parent=e,e.classList.add("type-hierarchy");const t=document.createElement("div");t.classList.add("message"),e.appendChild(t),this._message=t,this._message.tabIndex=0;const i=document.createElement("div");i.classList.add("results"),e.appendChild(i),this._splitView=new ea(i,{orientation:Z.HORIZONTAL});const s=document.createElement("div");s.classList.add("editor"),i.appendChild(s);const o={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._editor=this._instantiationService.createInstance(Gw,s,o,{},this.editor);const n=document.createElement("div");n.classList.add("tree"),i.appendChild(n);const r={sorter:new Rk,accessibilityProvider:new Mk(()=>this._direction),identityProvider:new Lk(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:Uw}};this._tree=this._instantiationService.createInstance(Ok,"TypeHierarchyPeek",n,new Pk,[this._instantiationService.createInstance(jd)],this._instantiationService.createInstance(kk,()=>this._direction),r),this._splitView.addView({onDidChange:L.None,element:s,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:d=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:d})}},Ht.Distribute),this._splitView.addView({onDidChange:L.None,element:n,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:d=>{this._dim.height&&this._tree.layout(this._dim.height,d)}},Ht.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this._layoutInfo.ratio=this._splitView.getViewSize(0)/this._dim.width)})),this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview,this)),this._disposables.add(this._editor.onMouseDown(d=>{const{event:l,target:h}=d;if(l.detail!==2)return;const[p]=this._tree.getFocus();p&&(this.dispose(),this._editorService.openEditor({resource:p.item.uri,options:{selection:h.range}}))})),this._disposables.add(this._tree.onMouseDblClick(d=>{d.target!==Hw.Twistie&&d.element&&(this.dispose(),this._editorService.openEditor({resource:d.element.item.uri,options:{selection:d.element.item.selectionRange,pinned:!0}}))})),this._disposables.add(this._tree.onDidChangeSelection(d=>{const[l]=d.elements;l&&zw(d.browserEvent)&&(this.dispose(),this._editorService.openEditor({resource:l.item.uri,options:{selection:l.item.selectionRange,pinned:!0}}))}))}async _updatePreview(){const[e]=this._tree.getFocus();if(!e)return;this._previewDisposable.clear();const t={description:"type-hierarchy-decoration",stickiness:Op.NeverGrowsWhenTypingAtEdges,className:"type-decoration",overviewRuler:{color:Sd(qw),position:lr.Center}};let i;this._direction===rt.Supertypes?i=e.parent?e.parent.item.uri:e.model.root.uri:i=e.item.uri;const s=await this._textModelService.createModelReference(i);this._editor.setModel(s.object.textEditorModel);const o=[];let n;const r={uri:e.item.uri,range:e.item.selectionRange};if(r.uri.toString()===i.toString()&&(o.push({range:r.range,options:t}),n=n?ve.plusRange(r.range,n):r.range),n){this._editor.revealRangeInCenter(n,ft.Immediate);const l=this._editor.createDecorationsCollection(o);this._previewDisposable.add(ae(()=>l.clear()))}this._previewDisposable.add(s);const d=this._direction===rt.Supertypes?c(11435,"Supertypes of '{0}'",e.model.root.name):c(11436,"Subtypes of '{0}'",e.model.root.name);this.setTitle(d)}showLoading(){this._parent.dataset.state=Xr.Loading,this.setTitle(c(11437,"Loading...")),this._show()}showMessage(e){this._parent.dataset.state=Xr.Message,this.setTitle(""),this.setMetaTitle(""),this._message.innerText=e,this._show(),this._message.focus()}async showModel(e){this._show();const t=this._treeViewStates.get(this._direction);await this._tree.setInput(e,t);const i=this._tree.getNode(e).children[0];await this._tree.expand(i.element),i.children.length===0?this.showMessage(this._direction===rt.Supertypes?c(11438,"No supertypes of '{0}'",e.root.name):c(11439,"No subtypes of '{0}'",e.root.name)):(this._parent.dataset.state=Xr.Data,(!t||this._tree.getFocus().length===0)&&this._tree.setFocus([i.children[0].element]),this._tree.domFocus(),this._updatePreview())}getModel(){return this._tree.getInput()}getFocused(){return this._tree.getFocus()[0]}async updateDirection(e){const t=this._tree.getInput();t&&e!==this._direction&&(this._treeViewStates.set(this._direction,this._tree.getViewState()),this._direction=e,await this.showModel(t))}_show(){this._isShowing||(this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber,ft.Smooth),super.show(ve.fromPositions(this._where),this._layoutInfo.height))}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){(this._dim.height!==e||this._dim.width!==t)&&(super._doLayoutBody(e,t),this._dim=new jt(t,e),this._layoutInfo.height=this._viewZone?this._viewZone.heightInLines:this._layoutInfo.height,this._splitView.layout(t),this._splitView.resizeView(0,t*this._layoutInfo.ratio))}},Pu=Ro,Ro.TitleMenu=new w("typehierarchy/title"),Ro);Qn=Pu=D([u(3,me),u(4,$w),u(5,Q),u(6,ur),u(7,ce),u(8,Cs),u(9,se),u(10,F)],Qn);var dn;const Mu=new q("editorHasTypeHierarchyProvider",!1,c(11425,"Whether a type hierarchy provider is available")),Ka=new q("typeHierarchyVisible",!1,c(11426,"Whether type hierarchy peek is currently showing")),ma=new q("typeHierarchyDirection",void 0,{type:"string",description:c(11427,"whether type hierarchy shows super types or subtypes")});function Nk(a){return a===rt.Subtypes||a===rt.Supertypes?a:rt.Subtypes}var Gs;let ys=(Gs=class{static get(e){return e.getContribution(dn.Id)}constructor(e,t,i,s,o){this._editor=e,this._contextKeyService=t,this._storageService=i,this._editorService=s,this._instantiationService=o,this._disposables=new O,this._sessionDisposables=new O,this._ctxHasProvider=Mu.bindTo(this._contextKeyService),this._ctxIsVisible=Ka.bindTo(this._contextKeyService),this._ctxDirection=ma.bindTo(this._contextKeyService),this._disposables.add(L.any(e.onDidChangeModel,e.onDidChangeModelLanguage,Cl.onDidChange)(()=>{this._ctxHasProvider.set(e.hasModel()&&Cl.has(e.getModel()))})),this._disposables.add(this._sessionDisposables)}dispose(){this._disposables.dispose()}async startTypeHierarchyFromEditor(){if(this._sessionDisposables.clear(),!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getPosition();if(!Cl.has(e))return;const i=new qs,s=jw.create(e,t,i.token),o=Nk(this._storageService.get(dn._storageDirectionKey,H.PROFILE,rt.Subtypes));this._showTypeHierarchyWidget(t,o,s,i)}_showTypeHierarchyWidget(e,t,i,s){this._ctxIsVisible.set(!0),this._ctxDirection.set(t),L.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endTypeHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(Qn,this._editor,e,t),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endTypeHierarchy(),this._storageService.store(dn._storageDirectionKey,this._widget.direction,H.PROFILE,Re.USER)})),this._sessionDisposables.add({dispose(){s.dispose(!0)}}),this._sessionDisposables.add(this._widget),i.then(o=>{s.token.isCancellationRequested||(o?(this._sessionDisposables.add(o),this._widget.showModel(o)):this._widget.showMessage(c(11428,"No results")))}).catch(o=>{if(Ec(o)){this.endTypeHierarchy();return}this._widget.showMessage(c(11429,"Failed to show type hierarchy"))})}async startTypeHierarchyFromTypeHierarchy(){if(!this._widget)return;const e=this._widget.getModel(),t=this._widget.getFocused();if(!t||!e)return;const i=await this._editorService.openCodeEditor({resource:t.item.uri},this._editor);if(!i)return;const s=e.fork(t.item);this._sessionDisposables.clear(),dn.get(i)?._showTypeHierarchyWidget(ve.lift(s.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(s),new qs)}showSupertypes(){this._widget?.updateDirection(rt.Supertypes),this._ctxDirection.set(rt.Supertypes)}showSubtypes(){this._widget?.updateDirection(rt.Subtypes),this._ctxDirection.set(rt.Subtypes)}endTypeHierarchy(){this._sessionDisposables.clear(),this._ctxIsVisible.set(!1),this._editor.focus()}},dn=Gs,Gs.Id="typeHierarchy",Gs._storageDirectionKey="typeHierarchy/defaultDirection",Gs);ys=dn=D([u(1,se),u(2,ce),u(3,Zo),u(4,F)],ys);xc(ys.Id,ys,kc.Eager);b(class extends qi{constructor(){super({id:"editor.showTypeHierarchy",title:x(11430,"Peek Type Hierarchy"),menu:{id:w.EditorContextPeek,group:"navigation",order:1e3,when:I.and(Mu,xd.notInPeekEditor)},precondition:I.and(Mu,xd.notInPeekEditor),f1:!0})}async runEditorCommand(e,t){return ys.get(t)?.startTypeHierarchyFromEditor()}});b(class extends qi{constructor(){super({id:"editor.showSupertypes",title:x(11431,"Show Supertypes"),icon:k.typeHierarchySuper,precondition:I.and(Ka,ma.isEqualTo(rt.Subtypes)),keybinding:{weight:G.WorkbenchContrib,primary:N.Shift+N.Alt+y.KeyH},menu:{id:Qn.TitleMenu,when:ma.isEqualTo(rt.Subtypes),order:1}})}runEditorCommand(a,e){return ys.get(e)?.showSupertypes()}});b(class extends qi{constructor(){super({id:"editor.showSubtypes",title:x(11432,"Show Subtypes"),icon:k.typeHierarchySub,precondition:I.and(Ka,ma.isEqualTo(rt.Supertypes)),keybinding:{weight:G.WorkbenchContrib,primary:N.Shift+N.Alt+y.KeyH},menu:{id:Qn.TitleMenu,when:ma.isEqualTo(rt.Supertypes),order:1}})}runEditorCommand(a,e){return ys.get(e)?.showSubtypes()}});b(class extends qi{constructor(){super({id:"editor.refocusTypeHierarchy",title:x(11433,"Refocus Type Hierarchy"),precondition:Ka,keybinding:{weight:G.WorkbenchContrib,primary:N.Shift+y.Enter}})}async runEditorCommand(a,e){return ys.get(e)?.startTypeHierarchyFromTypeHierarchy()}});b(class extends qi{constructor(){super({id:"editor.closeTypeHierarchy",title:c(11434,"Close"),icon:k.close,precondition:Ka,keybinding:{weight:G.WorkbenchContrib+10,primary:y.Escape,when:I.not("config.editor.stablePeek")},menu:{id:Qn.TitleMenu,order:1e3}})}runEditorCommand(a,e){return ys.get(e)?.endTypeHierarchy()}});function cg(a){const e=a?.getHTMLElement();e&&!Xl(e)&&a?.domFocus()}async function Bk(a,e){if(!Zw.getValue(a.contextKeyService))return e(a);const t=a.getFocus(),i=a.getSelection();await e(a);const s=a.getFocus();if(i.length>1||!Bo(t,i)||Bo(t,s))return;const o=new KeyboardEvent("keydown");a.setSelection(s,o)}async function Kt(a,e){if(!a)return;await Bk(a,e);const t=a.getFocus();t.length&&a.reveal(t[0]),a.setAnchor(t[0]),cg(a)}ne.registerCommandAndKeybindingRule({id:"list.focusDown",weight:G.WorkbenchContrib,when:be,primary:y.DownArrow,mac:{primary:y.DownArrow,secondary:[N.WinCtrl|y.KeyN]},handler:(a,e)=>{Kt(a.get(ue).lastFocusedList,async t=>{const i=new KeyboardEvent("keydown");await t.focusNext(typeof e=="number"?e:1,!1,i)})}});ne.registerCommandAndKeybindingRule({id:"list.focusUp",weight:G.WorkbenchContrib,when:be,primary:y.UpArrow,mac:{primary:y.UpArrow,secondary:[N.WinCtrl|y.KeyP]},handler:(a,e)=>{Kt(a.get(ue).lastFocusedList,async t=>{const i=new KeyboardEvent("keydown");await t.focusPrevious(typeof e=="number"?e:1,!1,i)})}});ne.registerCommandAndKeybindingRule({id:"list.focusAnyDown",weight:G.WorkbenchContrib,when:be,primary:N.Alt|y.DownArrow,mac:{primary:N.Alt|y.DownArrow,secondary:[N.WinCtrl|N.Alt|y.KeyN]},handler:(a,e)=>{Kt(a.get(ue).lastFocusedList,async t=>{const i=new KeyboardEvent("keydown",{altKey:!0});await t.focusNext(typeof e=="number"?e:1,!1,i)})}});ne.registerCommandAndKeybindingRule({id:"list.focusAnyUp",weight:G.WorkbenchContrib,when:be,primary:N.Alt|y.UpArrow,mac:{primary:N.Alt|y.UpArrow,secondary:[N.WinCtrl|N.Alt|y.KeyP]},handler:(a,e)=>{Kt(a.get(ue).lastFocusedList,async t=>{const i=new KeyboardEvent("keydown",{altKey:!0});await t.focusPrevious(typeof e=="number"?e:1,!1,i)})}});ne.registerCommandAndKeybindingRule({id:"list.focusPageDown",weight:G.WorkbenchContrib,when:be,primary:y.PageDown,handler:a=>{Kt(a.get(ue).lastFocusedList,async e=>{const t=new KeyboardEvent("keydown");await e.focusNextPage(t)})}});ne.registerCommandAndKeybindingRule({id:"list.focusPageUp",weight:G.WorkbenchContrib,when:be,primary:y.PageUp,handler:a=>{Kt(a.get(ue).lastFocusedList,async e=>{const t=new KeyboardEvent("keydown");await e.focusPreviousPage(t)})}});ne.registerCommandAndKeybindingRule({id:"list.focusFirst",weight:G.WorkbenchContrib,when:be,primary:y.Home,handler:a=>{Kt(a.get(ue).lastFocusedList,async e=>{const t=new KeyboardEvent("keydown");await e.focusFirst(t)})}});ne.registerCommandAndKeybindingRule({id:"list.focusLast",weight:G.WorkbenchContrib,when:be,primary:y.End,handler:a=>{Kt(a.get(ue).lastFocusedList,async e=>{const t=new KeyboardEvent("keydown");await e.focusLast(t)})}});ne.registerCommandAndKeybindingRule({id:"list.focusAnyFirst",weight:G.WorkbenchContrib,when:be,primary:N.Alt|y.Home,handler:a=>{Kt(a.get(ue).lastFocusedList,async e=>{const t=new KeyboardEvent("keydown",{altKey:!0});await e.focusFirst(t)})}});ne.registerCommandAndKeybindingRule({id:"list.focusAnyLast",weight:G.WorkbenchContrib,when:be,primary:N.Alt|y.End,handler:a=>{Kt(a.get(ue).lastFocusedList,async e=>{const t=new KeyboardEvent("keydown",{altKey:!0});await e.focusLast(t)})}});function Mv(a,e){if(a instanceof xa||a instanceof ka||a instanceof Ra){const t=a,i=t.getFocus()?t.getFocus()[0]:void 0,s=t.getSelection();s&&typeof i=="number"&&s.indexOf(i)>=0?t.setSelection(s.filter(o=>o!==e)):typeof i=="number"&&t.setSelection(s.concat(i))}else if(a instanceof _i||a instanceof Ei||a instanceof kt){const t=a,i=t.getFocus()?t.getFocus()[0]:void 0;if(e===i)return;const s=t.getSelection(),o=new KeyboardEvent("keydown",{shiftKey:!0});s&&s.indexOf(i)>=0?t.setSelection(s.filter(n=>n!==e),o):t.setSelection(s.concat(i),o)}}function lg(a,e){const t=a.getStickyScrollFocus();if(t.length===0)throw new Error("StickyScroll has no focus");if(t.length>1)throw new Error("StickyScroll can only have a single focused item");a.reveal(t[0]),a.getHTMLElement().focus(),a.setFocus(t),e?.(t[0])}ne.registerCommandAndKeybindingRule({id:"list.expandSelectionDown",weight:G.WorkbenchContrib,when:I.and(be,qp),primary:N.Shift|y.DownArrow,handler:(a,e)=>{const t=a.get(ue).lastFocusedList;if(!t)return;const i=t.getFocus()?t.getFocus()[0]:void 0,s=new KeyboardEvent("keydown");t.focusNext(typeof e=="number"?e:1,!1,s),Mv(t,i);const o=t.getFocus();o.length&&t.reveal(o[0]),cg(t)}});ne.registerCommandAndKeybindingRule({id:"list.expandSelectionUp",weight:G.WorkbenchContrib,when:I.and(be,qp),primary:N.Shift|y.UpArrow,handler:(a,e)=>{const t=a.get(ue).lastFocusedList;if(!t)return;const i=t.getFocus()?t.getFocus()[0]:void 0,s=new KeyboardEvent("keydown");t.focusPrevious(typeof e=="number"?e:1,!1,s),Mv(t,i);const o=t.getFocus();o.length&&t.reveal(o[0]),cg(t)}});ne.registerCommandAndKeybindingRule({id:"list.collapse",weight:G.WorkbenchContrib,when:I.and(be,I.or(O_,N_)),primary:y.LeftArrow,mac:{primary:y.LeftArrow,secondary:[N.CtrlCmd|y.UpArrow]},handler:a=>{const e=a.get(ue).lastFocusedList;if(!e||!(e instanceof _i||e instanceof Ei||e instanceof kt))return;const t=e,i=t.getFocus();if(i.length===0)return;const s=i[0];if(!t.collapse(s)){const o=t.getParentElement(s);o&&Kt(e,n=>{const r=new KeyboardEvent("keydown");n.setFocus([o],r)})}}});ne.registerCommandAndKeybindingRule({id:"list.stickyScroll.collapse",weight:G.WorkbenchContrib+50,when:jp,primary:y.LeftArrow,mac:{primary:y.LeftArrow,secondary:[N.CtrlCmd|y.UpArrow]},handler:a=>{const e=a.get(ue).lastFocusedList;!e||!(e instanceof _i||e instanceof Ei||e instanceof kt)||lg(e,t=>e.collapse(t))}});ne.registerCommandAndKeybindingRule({id:"list.collapseAll",weight:G.WorkbenchContrib,when:be,primary:N.CtrlCmd|y.LeftArrow,mac:{primary:N.CtrlCmd|y.LeftArrow,secondary:[N.CtrlCmd|N.Shift|y.UpArrow]},handler:a=>{const e=a.get(ue).lastFocusedList;e&&!(e instanceof xa||e instanceof ka||e instanceof Ra)&&e.collapseAll()}});ne.registerCommandAndKeybindingRule({id:"list.collapseAllToFocus",weight:G.WorkbenchContrib,when:be,handler:a=>{const e=a.get(ue).lastFocusedList,t=Yw("keydown",!0);if(e instanceof _i||e instanceof Ei||e instanceof kt){const i=e,s=i.getFocus();s.length>0&&i.collapse(s[0],!0),i.setSelection(s,t),i.setAnchor(s[0])}}});ne.registerCommandAndKeybindingRule({id:"list.focusParent",weight:G.WorkbenchContrib,when:be,handler:a=>{const e=a.get(ue).lastFocusedList;if(!e||!(e instanceof _i||e instanceof Ei||e instanceof kt))return;const t=e,i=t.getFocus();if(i.length===0)return;const s=i[0],o=t.getParentElement(s);o&&Kt(e,n=>{const r=new KeyboardEvent("keydown");n.setFocus([o],r)})}});ne.registerCommandAndKeybindingRule({id:"list.expand",weight:G.WorkbenchContrib,when:I.and(be,I.or(B_,F_)),primary:y.RightArrow,handler:a=>{const e=a.get(ue).lastFocusedList;if(e){if(e instanceof _i||e instanceof Ei){const t=e.getFocus();if(t.length===0)return;const i=t[0];if(!e.expand(i)){const s=e.getFirstElementChild(i);s&&e.getNode(s).visible&&Kt(e,n=>{const r=new KeyboardEvent("keydown");n.setFocus([s],r)})}}else if(e instanceof kt){const t=e.getFocus();if(t.length===0)return;const i=t[0];e.expand(i).then(s=>{if(i&&!s){const o=e.getFirstElementChild(i);o&&e.getNode(o).visible&&Kt(e,r=>{const d=new KeyboardEvent("keydown");r.setFocus([o],d)})}})}}}});function hg(a,e){const t=a.get(ue).lastFocusedList,i=Yw("keydown",e);if(t instanceof xa||t instanceof ka||t instanceof Ra){const s=t;s.setAnchor(s.getFocus()[0]),s.setSelection(s.getFocus(),i)}else if(t instanceof _i||t instanceof Ei||t instanceof kt){const s=t,o=s.getFocus();if(o.length>0){let n=!0;(s.expandOnlyOnTwistieClick===!0||typeof s.expandOnlyOnTwistieClick!="boolean"&&s.expandOnlyOnTwistieClick(o[0]))&&(n=!1),n&&s.toggleCollapsed(o[0])}s.setAnchor(o[0]),s.setSelection(o,i)}}ne.registerCommandAndKeybindingRule({id:"list.select",weight:G.WorkbenchContrib,when:be,primary:y.Enter,mac:{primary:y.Enter,secondary:[N.CtrlCmd|y.DownArrow]},handler:a=>{hg(a,!1)}});ne.registerCommandAndKeybindingRule({id:"list.stickyScrollselect",weight:G.WorkbenchContrib+50,when:jp,primary:y.Enter,mac:{primary:y.Enter,secondary:[N.CtrlCmd|y.DownArrow]},handler:a=>{const e=a.get(ue).lastFocusedList;!e||!(e instanceof _i||e instanceof Ei||e instanceof kt)||lg(e,t=>e.setSelection([t]))}});ne.registerCommandAndKeybindingRule({id:"list.selectAndPreserveFocus",weight:G.WorkbenchContrib,when:be,handler:a=>{hg(a,!0)}});ne.registerCommandAndKeybindingRule({id:"list.selectAll",weight:G.WorkbenchContrib,when:I.and(be,qp),primary:N.CtrlCmd|y.KeyA,handler:a=>{const e=a.get(ue).lastFocusedList;if(e instanceof xa||e instanceof ka||e instanceof Ra){const t=e,i=new KeyboardEvent("keydown");t.setSelection(K_(t.length),i)}else if(e instanceof _i||e instanceof Ei||e instanceof kt){const t=e,i=t.getFocus(),s=t.getSelection();let o;i.length>0&&(s.length===0||!s.includes(i[0]))&&(o=i[0]),!o&&s.length>0&&(o=s[0]);let n;o?n=t.getParentElement(o):n=void 0;const r=[],d=h=>{for(const p of h.children)p.visible&&(r.push(p.element),p.collapsed||d(p))};d(t.getNode(n)),n&&s.length===r.length&&r.unshift(n);const l=new KeyboardEvent("keydown");t.setSelection(r,l)}}});ne.registerCommandAndKeybindingRule({id:"list.toggleSelection",weight:G.WorkbenchContrib,when:be,primary:N.CtrlCmd|N.Shift|y.Enter,handler:a=>{const e=a.get(ue).lastFocusedList;if(!e)return;const t=e.getFocus();if(t.length===0)return;const i=e.getSelection(),s=i.indexOf(t[0]);s>-1?e.setSelection([...i.slice(0,s),...i.slice(s+1)]):e.setSelection([...i,t[0]])}});ne.registerCommandAndKeybindingRule({id:"list.showHover",weight:G.WorkbenchContrib,primary:Jw(N.CtrlCmd|y.KeyK,N.CtrlCmd|y.KeyI),when:be,handler:async(a,...e)=>{const i=a.get(ue).lastFocusedList;if(!i)return;const s=i.getFocus();if(!s||s.length===0)return;const d=i.getHTMLElement().querySelector(".monaco-scrollable-element")?.querySelector(".monaco-list-rows")?.querySelector(".focused");if(!d)return;const l=Fk(d);l&&a.get(Tt).showManagedHover(l)}});function Fk(a){if(a.matches('[custom-hover="true"]'))return a;const e=a.querySelector('[custom-hover="true"]:not([tabindex]):not(.action-item)');if(e)return e}ne.registerCommandAndKeybindingRule({id:"list.toggleExpand",weight:G.WorkbenchContrib,when:be,primary:y.Space,handler:a=>{const e=a.get(ue).lastFocusedList;if(e instanceof _i||e instanceof Ei||e instanceof kt){const t=e,i=t.getFocus();if(i.length>0&&t.isCollapsible(i[0])){t.toggleCollapsed(i[0]);return}}hg(a,!0)}});ne.registerCommandAndKeybindingRule({id:"list.stickyScrolltoggleExpand",weight:G.WorkbenchContrib+50,when:jp,primary:y.Space,handler:a=>{const e=a.get(ue).lastFocusedList;!e||!(e instanceof _i||e instanceof Ei||e instanceof kt)||lg(e)}});ne.registerCommandAndKeybindingRule({id:"list.clear",weight:G.WorkbenchContrib,when:I.and(be,W_),primary:y.Escape,handler:a=>{const e=a.get(ue).lastFocusedList;if(!e)return;const t=e.getSelection(),i=new KeyboardEvent("keydown");if(t.length>1)if(Zw.getValue(e.contextKeyService)){const o=e.getFocus();e.setSelection([o[0]],i)}else e.setSelection([],i);else e.setSelection([],i),e.setFocus([],i);e.setAnchor(void 0)}});Te.registerCommand({id:"list.triggerTypeNavigation",handler:a=>{a.get(ue).lastFocusedList?.triggerTypeNavigation()}});Te.registerCommand({id:"list.toggleFindMode",handler:a=>{const e=a.get(ue).lastFocusedList;if(e instanceof Gc||e instanceof kt){const t=e;t.findMode=t.findMode===Sl.Filter?Sl.Highlight:Sl.Filter}}});Te.registerCommand({id:"list.toggleFindMatchType",handler:a=>{const e=a.get(ue).lastFocusedList;if(e instanceof Gc||e instanceof kt){const t=e;t.findMatchType=t.findMatchType===_l.Contiguous?_l.Fuzzy:_l.Contiguous}}});Te.registerCommandAlias("list.toggleKeyboardNavigation","list.triggerTypeNavigation");Te.registerCommandAlias("list.toggleFilterOnType","list.toggleFindMode");ne.registerCommandAndKeybindingRule({id:"list.find",weight:G.WorkbenchContrib,when:I.and(Xw,G_),primary:N.CtrlCmd|N.Alt|y.KeyF,secondary:[y.F3],handler:a=>{const e=a.get(ue).lastFocusedList;e instanceof xa||e instanceof ka||e instanceof Ra||(e instanceof Gc||e instanceof kt)&&e.openFind()}});ne.registerCommandAndKeybindingRule({id:"list.closeFind",weight:G.WorkbenchContrib,when:I.and(Xw,U_),primary:y.Escape,handler:a=>{const e=a.get(ue).lastFocusedList;(e instanceof Gc||e instanceof kt)&&e.closeFind()}});ne.registerCommandAndKeybindingRule({id:"list.scrollUp",weight:G.WorkbenchContrib,when:I.and(be,H_?.negate()),primary:N.CtrlCmd|y.UpArrow,handler:a=>{const e=a.get(ue).lastFocusedList;e&&(e.scrollTop-=10)}});ne.registerCommandAndKeybindingRule({id:"list.scrollDown",weight:G.WorkbenchContrib,when:I.and(be,z_?.negate()),primary:N.CtrlCmd|y.DownArrow,handler:a=>{const e=a.get(ue).lastFocusedList;e&&(e.scrollTop+=10)}});ne.registerCommandAndKeybindingRule({id:"list.scrollLeft",weight:G.WorkbenchContrib,when:be,handler:a=>{const e=a.get(ue).lastFocusedList;e&&(e.scrollLeft-=10)}});ne.registerCommandAndKeybindingRule({id:"list.scrollRight",weight:G.WorkbenchContrib,when:be,handler:a=>{const e=a.get(ue).lastFocusedList;e&&(e.scrollLeft+=10)}});b(class extends X{constructor(){super({id:"tree.toggleStickyScroll",title:{...x(2771,"Toggle Tree Sticky Scroll"),mnemonicTitle:c(2772,"&&Toggle Tree Sticky Scroll")},category:"View",metadata:{description:c(2773,"Toggles Sticky Scroll widget at the top of tree structures such as the File Explorer and Debug variables View.")},f1:!0})}run(e){const t=e.get(ie),i=!t.getValue("workbench.tree.enableStickyScroll");t.updateValue("workbench.tree.enableStickyScroll",i)}});const Kk=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class Wk extends _t{constructor(e,t){super("vs.tree.collapse",c(42,"Collapse All"),"collapse-all",t),this.viewer=e}async run(){this.viewer.collapseAll(),this.viewer.setSelection([]),this.viewer.setFocus([])}}class Gk extends R{constructor(){super(...arguments),this._onDidChangeCheckboxState=this._register(new E),this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e){this._onDidChangeCheckboxState.fire([e])}}const Cc=class Cc extends R{constructor(e,t,i,s){super(),this.checkboxStateHandler=t,this.hoverDelegate=i,this.hoverService=s,this.checkboxContainer=e}render(e){e.checkbox&&(this.toggle?(this.toggle.checked=e.checkbox.isChecked,this.toggle.setIcon(this.toggle.checked?k.check:void 0)):this.createCheckbox(e))}createCheckbox(e){e.checkbox&&(this.toggle=new Qw({isChecked:e.checkbox.isChecked,title:"",icon:e.checkbox.isChecked?k.check:void 0,...Hp}),this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.toggle.domNode.classList.add(Cc.checkboxClass),this.toggle.domNode.tabIndex=1,ge(this.checkboxContainer,this.toggle.domNode),this.registerListener(e))}registerListener(e){this.toggle&&(this._register({dispose:()=>this.removeCheckbox()}),this._register(this.toggle),this._register(this.toggle.onChange(()=>{this.setCheckbox(e)})))}setHover(e){this.toggle&&(this.hover?this.hover.update(e.tooltip):this.hover=this._register(this.hoverService.setupManagedHover(this.hoverDelegate,this.toggle.domNode,this.checkboxHoverContent(e))))}setCheckbox(e){this.toggle&&e.checkbox&&(e.checkbox.isChecked=this.toggle.checked,this.toggle.setIcon(this.toggle.checked?k.check:void 0),this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.checkboxStateHandler.setCheckboxState(e))}checkboxHoverContent(e){return e.tooltip?e.tooltip:e.isChecked?c(3530,"Checked"):c(3531,"Unchecked")}setAccessibilityInformation(e){this.toggle&&e.accessibilityInformation&&(this.toggle.domNode.ariaLabel=e.accessibilityInformation.label,e.accessibilityInformation.role&&(this.toggle.domNode.role=e.accessibilityInformation.role))}removeCheckbox(){const e=this.checkboxContainer.children;for(const t of e)t.remove()}};Cc.checkboxClass="custom-view-tree-node-item-checkbox";let Yd=Cc;var Ou;Pe(Kk);let Nu=class extends Fc{constructor(e,t,i,s,o,n,r,d,l,h,p,f){super({...e,titleMenuId:w.ViewTitle,donotForwardArgs:!1},t,i,s,o,n,r,d,l,p,f);const{treeView:g}=z.as(pt.ViewsRegistry).getView(e.id);this.treeView=g,this._register(this.treeView.onDidChangeActions(()=>this.updateActions(),this)),this._register(this.treeView.onDidChangeTitle(m=>this.updateTitle(m))),this._register(this.treeView.onDidChangeDescription(m=>this.updateTitleDescription(m))),this._register(ae(()=>{this._container&&this.treeView.container&&this._container===this.treeView.container&&this.treeView.setVisibility(!1)})),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.treeView.onDidChangeWelcomeState(()=>this._onDidChangeViewWelcomeState.fire())),e.title!==this.treeView.title&&this.updateTitle(this.treeView.title),e.titleDescription!==this.treeView.description&&this.updateTitleDescription(this.treeView.description),this._actionRunner=this._register(new Bv(h,()=>this.treeView.getSelection())),this.updateTreeVisibility()}focus(){super.focus(),this.treeView.focus()}renderBody(e){this._container=e,super.renderBody(e),this.renderTreeView(e)}shouldShowWelcome(){return(this.treeView.dataProvider===void 0||!!this.treeView.dataProvider.isTreeEmpty)&&(this.treeView.message===void 0||this.treeView.message==="")}layoutBody(e,t){super.layoutBody(e,t),this.layoutTreeView(e,t)}getOptimalWidth(){return this.treeView.getOptimalWidth()}renderTreeView(e){this.treeView.show(e)}layoutTreeView(e,t){this.treeView.layout(e,t)}updateTreeVisibility(){this.treeView.setVisibility(this.isBodyVisible())}getActionRunner(){return this._actionRunner}getActionsContext(){return{$treeViewId:this.id,$focusedTreeItem:!0,$selectedTreeItems:!0}}};Nu=D([u(1,it),u(2,at),u(3,ie),u(4,se),u(5,Ye),u(6,F),u(7,xt),u(8,me),u(9,Ke),u(10,Tt),u(11,$_)],Nu);class Ol{constructor(){this.label={label:"root"},this.handle="0",this.parentHandle=void 0,this.collapsibleState=Bi.Expanded,this.children=void 0}}function Ov(a){const e=Te.getCommand(a);if(e){const t=S.getCommand(e.id);return t&&t.precondition}}function Nv(a,e){const t=a.originalId?a.originalId:a.id,i=Ov(t);return i?e.contextMatchesRules(i):!0}function gm(a){return!!a&&typeof a!="string"&&!!a.element&&!!a.disposables}const Uk=c(3532,"There is no data provider registered that can provide view data."),Hk=new q("customTreeView",!1);class zk extends Kc{}let Bu=class extends R{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v,C){super(),this.id=e,this._title=t,this.themeService=i,this.instantiationService=s,this.commandService=o,this.configurationService=n,this.progressService=r,this.contextMenuService=d,this.keybindingService=l,this.notificationService=h,this.viewDescriptorService=p,this.hoverService=f,this.contextKeyService=g,this.activityService=m,this.logService=v,this.openerService=C,this.isVisible=!1,this._hasIconForParentNode=!1,this._hasIconForLeafNode=!1,this.focused=!1,this._canSelectMany=!1,this._manuallyManageCheckboxes=!1,this.elementsToRefresh=[],this.lastSelection=[],this._onDidExpandItem=this._register(new E),this.onDidExpandItem=this._onDidExpandItem.event,this._onDidCollapseItem=this._register(new E),this.onDidCollapseItem=this._onDidCollapseItem.event,this._onDidChangeSelectionAndFocus=this._register(new E),this.onDidChangeSelectionAndFocus=this._onDidChangeSelectionAndFocus.event,this._onDidChangeVisibility=this._register(new E),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this._onDidChangeActions=this._register(new E),this.onDidChangeActions=this._onDidChangeActions.event,this._onDidChangeWelcomeState=this._register(new E),this.onDidChangeWelcomeState=this._onDidChangeWelcomeState.event,this._onDidChangeTitle=this._register(new E),this.onDidChangeTitle=this._onDidChangeTitle.event,this._onDidChangeDescription=this._register(new E),this.onDidChangeDescription=this._onDidChangeDescription.event,this._onDidChangeCheckboxState=this._register(new E),this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event,this._onDidCompleteRefresh=this._register(new E),this._isInitialized=!1,this._activity=this._register(new Ie),this.activated=!1,this.treeDisposables=this._register(new O),this._height=0,this._width=0,this.refreshing=!1,this.root=new Ol,this.lastActive=this.root}initialize(){this._isInitialized||(this._isInitialized=!0,this.contextKeyService.bufferChangeEvents(()=>{this.initializeShowCollapseAllAction(),this.initializeCollapseAllToggle(),this.initializeShowRefreshAction()}),this.treeViewDnd=this.instantiationService.createInstance(Gu,this.id),this._dragAndDropController&&(this.treeViewDnd.controller=this._dragAndDropController),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("explorer.decorations")&&this.doRefresh([this.root])})),this._register(this.viewDescriptorService.onDidChangeLocation(({views:e,from:t,to:i})=>{e.some(s=>s.id===this.id)&&this.tree?.updateOptions({overrideStyles:ff(this.viewLocation).listOverrideStyles})})),this.registerActions(),this.create())}get viewContainer(){return this.viewDescriptorService.getViewContainerByViewId(this.id)}get viewLocation(){return this.viewDescriptorService.getViewLocationById(this.id)}get dragAndDropController(){return this._dragAndDropController}set dragAndDropController(e){this._dragAndDropController=e,this.treeViewDnd&&(this.treeViewDnd.controller=e)}get dataProvider(){return this._dataProvider}set dataProvider(e){if(e){this.visible&&this.activate();const t=this;this._dataProvider=new class{constructor(){this._isEmpty=!0,this._onDidChangeEmpty=new E,this.onDidChangeEmpty=this._onDidChangeEmpty.event}get isTreeEmpty(){return this._isEmpty}async getChildren(i){return(await this.getChildrenBatch(i?[i]:void 0))?.[0]}updateEmptyState(i,s){if(i.length===1&&i[0]instanceof Ol){const o=this._isEmpty;this._isEmpty=s.length===0||s[0].length===0,o!==this._isEmpty&&this._onDidChangeEmpty.fire()}}findCheckboxesUpdated(i,s){if(s.length===0)return[];const o=[];for(let n=0;n<i.length;n++){const r=i[n],d=s[n];for(const l of d)l.parent=r,!t.manuallyManageCheckboxes&&r?.checkbox?.isChecked===!0&&l.checkbox?.isChecked===!1&&(l.checkbox.isChecked=!0,o.push(l))}return o}async getChildrenBatch(i){let s,o=[];if(i&&i.every(n=>!!n.children))s=i.map(n=>n.children);else{i=i??[t.root];const n=await(i.length===1&&i[0]instanceof Ol?Fu(e,void 0):Fu(e,i));for(let r=0;r<i.length;r++){const d=i[r];d.children=n?n[r]:void 0}s=n??[],o=this.findCheckboxesUpdated(i,s)}return this.updateEmptyState(i,s),o.length>0&&t._onDidChangeCheckboxState.fire(o),s}},this._dataProvider.onDidChangeEmpty&&this._register(this._dataProvider.onDidChangeEmpty(()=>{this.updateCollapseAllToggle(),this._onDidChangeWelcomeState.fire()})),this.updateMessage(),this.refresh()}else this._dataProvider=void 0,this.treeDisposables.clear(),this.activated=!1,this.updateMessage();this._onDidChangeWelcomeState.fire()}get message(){return this._message}set message(e){this._message=e,this.updateMessage(),this._onDidChangeWelcomeState.fire()}get title(){return this._title}set title(e){this._title=e,this.tree&&(this.tree.ariaLabel=this._title),this._onDidChangeTitle.fire(this._title)}get description(){return this._description}set description(e){this._description=e,this._onDidChangeDescription.fire(this._description)}get badge(){return this._badge}set badge(e){if(!(this._badge?.value===e?.value&&this._badge?.tooltip===e?.tooltip))if(this._badge=e,e){const t={badge:new Hc(e.value,()=>e.tooltip),priority:50};this._activity.value=this.activityService.showViewActivity(this.id,t)}else this._activity.clear()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){const t=this._canSelectMany;this._canSelectMany=e,this._canSelectMany!==t&&this.tree?.updateOptions({multipleSelectionSupport:this.canSelectMany})}get manuallyManageCheckboxes(){return this._manuallyManageCheckboxes}set manuallyManageCheckboxes(e){this._manuallyManageCheckboxes=e}get hasIconForParentNode(){return this._hasIconForParentNode}get hasIconForLeafNode(){return this._hasIconForLeafNode}get visible(){return this.isVisible}initializeShowCollapseAllAction(e=!1){return this.collapseAllContext||(this.collapseAllContextKey=new q(`treeView.${this.id}.enableCollapseAll`,e,c(3533,"Whether the tree view with id {0} enables collapse all.",this.id)),this.collapseAllContext=this.collapseAllContextKey.bindTo(this.contextKeyService)),!0}get showCollapseAllAction(){return this.initializeShowCollapseAllAction(),!!this.collapseAllContext?.get()}set showCollapseAllAction(e){this.initializeShowCollapseAllAction(e),this.collapseAllContext?.set(e)}initializeShowRefreshAction(e=!1){this.refreshContext||(this.refreshContextKey=new q(`treeView.${this.id}.enableRefresh`,e,c(3534,"Whether the tree view with id {0} enables refresh.",this.id)),this.refreshContext=this.refreshContextKey.bindTo(this.contextKeyService))}get showRefreshAction(){return this.initializeShowRefreshAction(),!!this.refreshContext?.get()}set showRefreshAction(e){this.initializeShowRefreshAction(e),this.refreshContext?.set(e)}registerActions(){const e=this;this._register(b(class extends X{constructor(){super({id:`workbench.actions.treeView.${e.id}.refresh`,title:c(3535,"Refresh"),menu:{id:w.ViewTitle,when:I.and(I.equals("view",e.id),e.refreshContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER-1},icon:k.refresh})}async run(){return e.refresh()}})),this._register(b(class extends X{constructor(){super({id:`workbench.actions.treeView.${e.id}.collapseAll`,title:c(3536,"Collapse All"),menu:{id:w.ViewTitle,when:I.and(I.equals("view",e.id),e.collapseAllContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER},precondition:e.collapseAllToggleContextKey,icon:k.collapseAll})}async run(){if(e.tree)return new Wk(e.tree,!0).run()}}))}setVisibility(e){this.initialize(),e=!!e,this.isVisible!==e&&(this.isVisible=e,this.tree&&(this.isVisible?ia(this.tree.getHTMLElement()):sa(this.tree.getHTMLElement()),this.isVisible&&this.elementsToRefresh.length&&this.dataProvider&&(this.doRefresh(this.elementsToRefresh),this.elementsToRefresh=[])),Y_(()=>{this.dataProvider&&this._onDidChangeVisibility.fire(this.isVisible)}),this.visible&&this.activate())}focus(e=!0,t){if(this.tree&&this.root.children&&this.root.children.length>0){const i=t??this.tree.getSelection()[0];i&&e&&this.tree.reveal(i,.5),this.tree.domFocus()}else this.tree&&this.treeContainer&&!this.treeContainer.classList.contains("hide")?this.tree.domFocus():this.domNode.focus()}show(e){this._container=e,ge(e,this.domNode)}create(){this.domNode=M(".tree-explorer-viewlet-tree-view"),this.messageElement=ge(this.domNode,M(".message")),this.updateMessage(),this.treeContainer=ge(this.domNode,M(".customview-tree")),this.treeContainer.classList.add("file-icon-themable-tree","show-file-icons");const e=this._register(zn(this.domNode));this._register(e.onDidFocus(()=>this.focused=!0)),this._register(e.onDidBlur(()=>this.focused=!1))}createTree(){this.treeDisposables.clear();const e=Tp.bind(void 0,this.instantiationService),t=this.treeDisposables.add(this.instantiationService.createInstance(Ku,this.id));this.treeLabels=this.treeDisposables.add(this.instantiationService.createInstance(Lw,this));const i=this.instantiationService.createInstance(jk,this,h=>this.progressService.withProgress({location:this.id},()=>h)),s=this.treeDisposables.add(new Yk(this.themeService)),o=this.treeDisposables.add(new Gk),n=this.treeDisposables.add(this.instantiationService.createInstance(wa,this.id,t,this.treeLabels,e,s,o,()=>this.manuallyManageCheckboxes));this.treeDisposables.add(n.onDidChangeCheckboxState(h=>this._onDidChangeCheckboxState.fire(h)));const r=this._title;this.tree=this.treeDisposables.add(this.instantiationService.createInstance(zk,this.id,this.treeContainer,new qk,[n],i,{identityProvider:new $k,accessibilityProvider:{getAriaLabel(h){if(h.accessibilityInformation)return h.accessibilityInformation.label;if(Dd(h.tooltip))return h.tooltip;{if(h.resourceUri&&!h.label)return null;let p="";return h.label&&(p+=h.label.label+" "),h.description&&(p+=h.description),p}},getRole(h){return h.accessibilityInformation?.role??"treeitem"},getWidgetAriaLabel(){return r}},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:h=>h.label?h.label.label:h.resourceUri?us($.revive(h.resourceUri)):void 0},expandOnlyOnTwistieClick:h=>!!h.command||!!h.checkbox||this.configurationService.getValue("workbench.tree.expandMode")==="doubleClick",collapseByDefault:h=>h.collapsibleState!==Bi.Expanded,multipleSelectionSupport:this.canSelectMany,dnd:this.treeViewDnd,overrideStyles:ff(this.viewLocation).listOverrideStyles})),this.treeDisposables.add(n.onDidChangeMenuContext(h=>h.forEach(p=>this.tree?.rerender(p)))),this.treeDisposables.add(this.tree),t.setContextKeyService(this.tree.contextKeyService),s.tree=this.tree;const d=this.treeDisposables.add(new Bv(this.notificationService,()=>this.tree.getSelection()));n.actionRunner=d,this.tree.contextKeyService.createKey(this.id,!0),Hk.bindTo(this.tree.contextKeyService).set(!0),this.treeDisposables.add(this.tree.onContextMenu(h=>this.onContextMenu(t,h,d))),this.treeDisposables.add(this.tree.onDidChangeSelection(h=>{this.lastSelection=h.elements,this.lastActive=this.tree?.getFocus()[0]??this.lastActive,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})})),this.treeDisposables.add(this.tree.onDidChangeFocus(h=>{h.elements.length&&h.elements[0]!==this.lastActive&&(this.lastActive=h.elements[0],this.lastSelection=this.tree?.getSelection()??this.lastSelection,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive}))})),this.treeDisposables.add(this.tree.onDidChangeCollapseState(h=>{if(!h.node.element)return;const p=Array.isArray(h.node.element.element)?h.node.element.element[0]:h.node.element.element;h.node.collapsed?this._onDidCollapseItem.fire(p):this._onDidExpandItem.fire(p)})),this.tree.setInput(this.root).then(()=>this.updateContentAreas()),this.treeDisposables.add(this.tree.onDidOpen(async h=>{if(!h.browserEvent||h.browserEvent.target&&h.browserEvent.target.classList.contains(Yd.checkboxClass))return;const p=this.tree.getSelection(),f=await this.resolveCommand(p.length===1?p[0]:void 0);if(f&&Nv(f,this.contextKeyService)){let g=f.arguments||[];(f.id===J_||f.id===Z_)&&(g=[...g,h]);try{await this.commandService.executeCommand(f.id,...g)}catch(m){this.notificationService.error(m)}}})),this.treeDisposables.add(t.onDidChange(h=>{this.tree?.hasNode(h)&&this.tree?.rerender(h)}))}async resolveCommand(e){let t=e?.command;return e&&!t&&e instanceof ey&&e.hasResolve&&(await e.resolve(bi.None),t=e.command),t}onContextMenu(e,t,i){this.hoverService.hideHover();const s=t.element;if(s===null)return;const o=t.browserEvent;o.preventDefault(),o.stopPropagation(),this.tree.setFocus([s]);let n=this.canSelectMany?this.getSelection():[];n.find(d=>d.handle===s.handle)||(n=[s]);const r=e.getResourceContextActions(n);r.length&&this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>r,getActionViewItem:d=>{const l=this.keybindingService.lookupKeybinding(d.id);if(l)return new Lp(d,d,{label:!0,keybinding:l.getLabel()})},onHide:d=>{d&&this.tree.domFocus()},getActionsContext:()=>({$treeViewId:this.id,$treeItemHandle:s.handle}),actionRunner:i})}updateMessage(){this._message?this.showMessage(this._message):this.dataProvider?this.hideMessage():this.showMessage(Uk),this.updateContentAreas()}processMessage(e,t){const i=e.value.split(`
|
|
37
|
+
`),s=[];let o=!1;for(const r of i){const d=Ed(r);if(d.nodes.length===1&&typeof d.nodes[0]!="string"){const l=d.nodes[0],h=document.createElement("div");h.classList.add("button-container");const p=new ty(h,{title:l.title,secondary:o,supportIcons:!0,...oa});p.label=l.label,p.onDidClick(g=>{this.openerService.open(l.href,{allowCommands:!0})},null,t);const f=$.parse(l.href);if(f.scheme===pe.command){const g=Ov(f.path);g&&(p.enabled=this.contextKeyService.contextMatchesRules(g),t.add(this.contextKeyService.onDidChangeContext(m=>{m.affectsSome(new Set(g.keys()))&&(p.enabled=this.contextKeyService.contextMatchesRules(g))})))}t.add(p),o=!0,s.push(h)}else{o=!1;const l=this.markdownRenderer.render(new wi(r,{isTrusted:e.isTrusted,supportThemeIcons:e.supportThemeIcons,supportHtml:e.supportHtml}));s.push(l.element),t.add(l)}}const n=document.createElement("div");n.classList.add("rendered-message");for(const r of s)qn(r)?n.appendChild(r):n.appendChild(r.element);return n}showMessage(e){if(gm(this._messageValue)&&this._messageValue.disposables.dispose(),mf(e)&&!this.markdownRenderer&&(this.markdownRenderer=this.instantiationService.createInstance(X_,{})),mf(e)){const t=new O,i=this.processMessage(e,t);this._messageValue={element:i,disposables:t}}else this._messageValue=e;this.messageElement&&(this.messageElement.classList.remove("hide"),this.resetMessageElement(),typeof this._messageValue=="string"&&!co(this._messageValue)?this.messageElement.textContent=this._messageValue:gm(this._messageValue)&&this.messageElement.appendChild(this._messageValue.element),this.layout(this._height,this._width))}hideMessage(){this.resetMessageElement(),this.messageElement?.classList.add("hide"),this.layout(this._height,this._width)}resetMessageElement(){this.messageElement&&es(this.messageElement)}layout(e,t){if(e&&t&&this.messageElement&&this.treeContainer){this._height=e,this._width=t;const i=e-Q_(this.messageElement);this.treeContainer.style.height=i+"px",this.tree?.layout(i,t)}}getOptimalWidth(){if(this.tree){const e=this.tree.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".outline-item-label > a"));return eE(e,t)}return 0}updateCheckboxes(e){return Fv(e)}async refresh(e,t){if(this.dataProvider&&this.tree){this.refreshing&&await L.toPromise(this._onDidCompleteRefresh.event),e||(e=[this.root],this.elementsToRefresh=[]);for(const i of e)i.children=void 0;if(this.isVisible){const i=this.updateCheckboxes(t??[]);return this.doRefresh(e.concat(i))}else if(this.elementsToRefresh.length){const i=new Set;this.elementsToRefresh.forEach(s=>i.add(s.handle));for(const s of e)i.has(s.handle)||this.elementsToRefresh.push(s)}else this.elementsToRefresh.push(...e)}}async expand(e){const t=this.tree;if(t)try{e=Array.isArray(e)?e:[e];for(const i of e)await t.expand(i,!1)}catch{}}isCollapsed(e){return!!this.tree?.isCollapsed(e)}setSelection(e){this.tree?.setSelection(e)}getSelection(){return this.tree?.getSelection()??[]}setFocus(e){this.tree&&(e?(this.focus(!0,e),this.tree.setFocus([e])):this.tree.getFocus().length===0&&this.tree.setFocus([]))}async reveal(e){if(this.tree)return this.tree.reveal(e)}async doRefresh(e){const t=this.tree;if(t&&this.visible){this.refreshing=!0;const i=t.getSelection();try{await Promise.all(e.map(o=>t.updateChildren(o,!0,!0)))}catch(o){this.logService.error(o)}const s=t.getSelection();(i.length!==s.length||i.some((o,n)=>o.handle!==s[n].handle))&&(this.lastSelection=s,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})),this.refreshing=!1,this._onDidCompleteRefresh.fire(),this.updateContentAreas(),this.focused&&this.focus(!1),this.updateCollapseAllToggle()}}initializeCollapseAllToggle(){this.collapseAllToggleContext||(this.collapseAllToggleContextKey=new q(`treeView.${this.id}.toggleCollapseAll`,!1,c(3537,"Whether collapse all is toggled for the tree view with id {0}.",this.id)),this.collapseAllToggleContext=this.collapseAllToggleContextKey.bindTo(this.contextKeyService))}updateCollapseAllToggle(){this.showCollapseAllAction&&(this.initializeCollapseAllToggle(),this.collapseAllToggleContext?.set(!!this.root.children&&this.root.children.length>0&&this.root.children.some(e=>e.collapsibleState!==Bi.None)))}updateContentAreas(){const e=!this.root.children||this.root.children.length===0;this._messageValue&&e&&!this.refreshing&&this.treeContainer?(this.dragAndDropController||this.treeContainer.classList.add("hide"),this.domNode.setAttribute("tabindex","0")):this.treeContainer&&(this.treeContainer.classList.remove("hide"),this.domNode===Ic()&&this.focus(),this.domNode.removeAttribute("tabindex"))}get container(){return this._container}};Bu=D([u(2,me),u(3,F),u(4,wt),u(5,ie),u(6,Uc),u(7,at),u(8,it),u(9,Ke),u(10,Ye),u(11,Tt),u(12,se),u(13,Ys),u(14,Ue),u(15,xt)],Bu);class $k{getId(e){return e.handle}}class qk{getHeight(e){return wa.ITEM_HEIGHT}getTemplateId(e){return wa.TREE_TEMPLATE_ID}}async function Fu(a,e){return a.getChildrenBatch?a.getChildrenBatch(e):e?Promise.all(e.map(t=>a.getChildren(t).then(i=>i??[]))):[await a.getChildren()].filter(t=>t!==void 0)}class jk{constructor(e,t){this.treeView=e,this.withProgress=t}hasChildren(e){return!!this.treeView.dataProvider&&e.collapsibleState!==Bi.None}async getChildren(e){const t=this.treeView.dataProvider;if(!t)return[];this.batch===void 0?(this.batch=[e],this.batchPromise=void 0):this.batch.push(e);const i=this.batch.length-1;return new Promise((s,o)=>{setTimeout(async()=>{const n=this.batch;this.batch=void 0,this.batchPromise||(this.batchPromise=this.withProgress(Fu(t,n)));try{const r=await this.batchPromise;s(r&&i<r.length?r[i]:[])}catch(r){r.message.startsWith("Bad progress location:")||o(r)}},0)})}}var Us;let wa=(Us=class extends R{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g){super(),this.treeViewId=e,this.menus=t,this.labels=i,this.actionViewItemProvider=s,this.aligner=o,this.checkboxStateHandler=n,this.manuallyManageCheckboxes=r,this.themeService=d,this.configurationService=l,this.labelService=h,this.contextKeyService=p,this.hoverService=f,this._onDidChangeCheckboxState=this._register(new E),this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event,this._onDidChangeMenuContext=this._register(new E),this.onDidChangeMenuContext=this._onDidChangeMenuContext.event,this._hasCheckbox=!1,this._renderedElements=new Map,this._hoverDelegate=this._register(g.createInstance(q_,"mouse",void 0,{})),this._register(this.themeService.onDidFileIconThemeChange(()=>this.rerender())),this._register(this.themeService.onDidColorThemeChange(()=>this.rerender())),this._register(n.onDidChangeCheckboxState(m=>{this.updateCheckboxes(m)})),this._register(this.contextKeyService.onDidChangeContext(m=>this.onDidChangeContext(m)))}get templateId(){return Ou.TREE_TEMPLATE_ID}set actionRunner(e){this._actionRunner=e}renderTemplate(e){e.classList.add("custom-view-tree-node-item");const t=ge(e,M("")),i=this.labels.create(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate}),s=Mm(i.element,M(".custom-view-tree-node-item-icon")),o=ge(i.element,M(".actions")),n=new cr(o,{actionViewItemProvider:this.actionViewItemProvider});return{resourceLabel:i,icon:s,checkboxContainer:t,actionBar:n,container:e}}getHover(e,t,i){return!(i instanceof ey)||!i.hasResolve?t&&!i.tooltip?void 0:i.tooltip===void 0?e:Dd(i.tooltip)?i.tooltip!==""?i.tooltip:void 0:{markdown:i.tooltip,markdownNotSupportedFallback:t?void 0:j_(i.tooltip)}:{markdown:typeof i.tooltip=="string"?i.tooltip:s=>new Promise(o=>{i.resolve(s).then(()=>o(i.tooltip))}),markdownNotSupportedFallback:t?void 0:e??""}}renderElement(e,t,i){const s=e.element,o=s.resourceUri?$.revive(s.resourceUri):null,n=s.label?s.label:o?{label:us(o)}:void 0,r=Dd(s.description)?s.description:o&&s.description===!0?this.labelService.getUriLabel(iw(o),{relative:!0}):void 0,d=n?n.label:void 0,l=n&&n.highlights&&d?n.highlights.map(([C,T])=>{if(C<0&&(C=d.length+C),T<0&&(T=d.length+T),C>=d.length||T>d.length)return{start:0,end:0};if(C>T){const B=C;C=T,T=B}return{start:C,end:T}}):void 0,h=this.themeService.getColorTheme().type===ln.LIGHT?s.icon:s.iconDark,p=h?$.revive(h):void 0,f=this.getHover(d,o,s);i.actionBar.clear(),i.icon.style.color="";let g=!0;if(s.command&&(g=Nv(s.command,this.contextKeyService)),this.renderCheckbox(s,i),o){const C=this.configurationService.getValue("explorer.decorations"),T=o||$.parse("missing:_icon_resource");i.resourceLabel.setResource({name:d,description:r,resource:T},{fileKind:this.getFileKind(s),title:f,hideIcon:this.shouldHideResourceLabelIcon(p,s.themeIcon),fileDecorations:C,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:l||Jn(e.filterData),strikethrough:n?.strikethrough,disabledCommand:!g,labelEscapeNewLines:!0,forceLabel:!!s.label})}else i.resourceLabel.setResource({name:d,description:r},{title:f,hideIcon:!0,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:l||Jn(e.filterData),strikethrough:n?.strikethrough,disabledCommand:!g,labelEscapeNewLines:!0});if(p)i.icon.className="custom-view-tree-node-item-icon",i.icon.style.backgroundImage=ss(p);else{let C;this.shouldShowThemeIcon(!!o,s.themeIcon)&&(C=Ce.asClassName(s.themeIcon),s.themeIcon.color&&(i.icon.style.color=this.themeService.getColorTheme().getColor(s.themeIcon.color.id)?.toString()??"")),i.icon.className=C?`custom-view-tree-node-item-icon ${C}`:"",i.icon.style.backgroundImage=""}g||(i.icon.className=i.icon.className+" disabled",i.container.parentElement&&(i.container.parentElement.className=i.container.parentElement.className+" disabled")),i.actionBar.context={$treeViewId:this.treeViewId,$treeItemHandle:s.handle};const m=this.menus.getResourceActions([s]);i.actionBar.push(m,{icon:!0,label:!1}),this._actionRunner&&(i.actionBar.actionRunner=this._actionRunner),this.setAlignment(i.container,s);const v=this._renderedElements.get(e.element.handle)??[];this._renderedElements.set(e.element.handle,[...v,{original:e,rendered:i}])}rerender(){const e=new Set(this._renderedElements.keys());for(const t of e){const i=this._renderedElements.get(t)??[];for(const s of i)this.disposeElement(s.original,0,s.rendered),this.renderElement(s.original,0,s.rendered)}}renderCheckbox(e,t){if(e.checkbox){if(this._hasCheckbox||(this._hasCheckbox=!0,this.rerender()),!t.checkbox){const i=new Yd(t.checkboxContainer,this.checkboxStateHandler,this._hoverDelegate,this.hoverService);t.checkbox=i}t.checkbox.render(e)}else t.checkbox&&(t.checkbox.dispose(),t.checkbox=void 0)}setAlignment(e,t){e.parentElement.classList.toggle("align-icon-with-twisty",!this._hasCheckbox&&this.aligner.alignIconWithTwisty(t))}shouldHideResourceLabelIcon(e,t){return!!e||!!t&&!this.isFileKindThemeIcon(t)}shouldShowThemeIcon(e,t){return t?!(e&&this.isFileKindThemeIcon(t)):!1}isFolderThemeIcon(e){return e?.id===th.id}isFileKindThemeIcon(e){return e?e.id===gf.id||this.isFolderThemeIcon(e):!1}getFileKind(e){if(e.themeIcon)switch(e.themeIcon.id){case gf.id:return Tr.FILE;case th.id:return Tr.FOLDER}return e.collapsibleState===Bi.Collapsed||e.collapsibleState===Bi.Expanded?Tr.FOLDER:Tr.FILE}onDidChangeContext(e){const t=[];for(const[i,s]of this._renderedElements)for(const o of s)(e.affectsSome(this.menus.getElementOverlayContexts(o.original.element))||e.affectsSome(this.menus.getEntireMenuContexts()))&&t.push(o.original.element);t.length&&this._onDidChangeMenuContext.fire(t)}updateCheckboxes(e){let t=[];this.manuallyManageCheckboxes()?t=e:t=Fv(e),t.forEach(i=>{const s=this._renderedElements.get(i.handle);s&&s.forEach(o=>o.rendered.checkbox?.render(i))}),this._onDidChangeCheckboxState.fire(t)}disposeElement(e,t,i){const s=this._renderedElements.get(e.element.handle)??[],o=s.findIndex(n=>i===n.rendered);s.length===1?this._renderedElements.delete(e.element.handle):s.length>0&&s.splice(o,1),i.checkbox?.dispose(),i.checkbox=void 0}disposeTemplate(e){e.resourceLabel.dispose(),e.actionBar.dispose()}},Ou=Us,Us.ITEM_HEIGHT=22,Us.TREE_TEMPLATE_ID="treeExplorer",Us);wa=Ou=D([u(7,me),u(8,ie),u(9,$i),u(10,se),u(11,Tt),u(12,F)],wa);class Yk extends R{constructor(e){super(),this.themeService=e}set tree(e){this._tree=e}alignIconWithTwisty(e){if(e.collapsibleState!==Bi.None||!this.hasIcon(e))return!1;if(this._tree){const t=this._tree.getParentElement(e)||this._tree.getInput();return this.hasIcon(t)?!!t.children&&t.children.some(i=>i.collapsibleState!==Bi.None&&!this.hasIcon(i)):!!t.children&&t.children.every(i=>i.collapsibleState===Bi.None||!this.hasIcon(i))}else return!1}hasIcon(e){if(this.themeService.getColorTheme().type===ln.LIGHT?e.icon:e.iconDark)return!0;if(e.resourceUri||e.themeIcon){const i=this.themeService.getFileIconTheme();return(e.themeIcon?e.themeIcon.id===th.id:e.collapsibleState!==Bi.None)?i.hasFileIcons&&i.hasFolderIcons:i.hasFileIcons}return!1}}class Bv extends iy{constructor(e,t){super(),this.getSelectedResources=t,this._register(this.onDidRun(i=>{i.error&&!Ec(i.error)&&e.error(c(3538,"Error running command {1}: {0}. This is likely caused by the extension that contributes {1}.",i.error.message,i.action.id))}))}async runAction(e,t){const i=this.getSelectedResources();let s,o=!1;i.length>1&&(s=i.map(n=>((n.handle===t.$treeItemHandle||t.$selectedTreeItems)&&(o=!0),{$treeViewId:t.$treeViewId,$treeItemHandle:n.handle}))),!o&&s&&(s=void 0),await e.run(t,s)}}let Ku=class{constructor(e,t){this.id=e,this.menuService=t,this._onDidChange=new E,this.onDidChange=this._onDidChange.event}getResourceActions(e){return this.getActions(this.getMenuId(),e).primary}getResourceContextActions(e){return this.getActions(this.getMenuId(),e).secondary}setContextKeyService(e){this.contextKeyService=e}filterNonUniversalActions(e,t){const i=new Set(t.map(s=>s.id));for(const s of e){const o=s.keys();for(const n of o)i.has(n)||s.delete(n)}}buildMenu(e){const t=[];for(const i of e)i.size>0&&(t.length&&t.push(new hs),t.push(...i.values()));return t}createGroups(e){const t=[];let i=new Map;for(const s of e)s instanceof hs?(t.push(i),i=new Map):i.set(s.id,s);return t.push(i),t}getElementOverlayContexts(e){return new Map([["view",this.id],["viewItem",e.contextValue]])}getEntireMenuContexts(){return this.menuService.getMenuContexts(this.getMenuId())}getMenuId(){return w.ViewItemContext}getActions(e,t){if(!this.contextKeyService)return{primary:[],secondary:[]};let i=[],s=[];for(let o=0;o<t.length;o++){const n=t[o],r=this.contextKeyService.createOverlay(this.getElementOverlayContexts(n)),d=this.menuService.getMenuActions(e,r,{shouldForwardArgs:!0}),l=bd(d,"inline");o===0?(i=this.createGroups(l.primary),s=this.createGroups(l.secondary)):(this.filterNonUniversalActions(i,l.primary),this.filterNonUniversalActions(s,l.secondary))}return{primary:this.buildMenu(i),secondary:this.buildMenu(s)}}dispose(){this.contextKeyService=void 0}};Ku=D([u(1,Cs)],Ku);let Wu=class extends Bu{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v,C,T,B,V){super(e,t,s,o,n,r,d,l,h,p,f,m,g,C,B,V),this.extensionId=i,this.extensionService=v,this.telemetryService=T}activate(){this.activated||(this.telemetryService.publicLog2("Extension:ViewActivate",{extensionId:new tE(this.extensionId),id:this.id}),this.createTree(),this.progressService.withProgress({location:this.id},()=>this.extensionService.activateByEvent(`onView:${this.id}`)).then(()=>Ho(2e3)).then(()=>{this.updateMessage()}),this.activated=!0)}};Wu=D([u(3,me),u(4,F),u(5,wt),u(6,ie),u(7,Uc),u(8,at),u(9,it),u(10,Ke),u(11,Ye),u(12,se),u(13,Tt),u(14,At),u(15,Ys),u(16,mt),u(17,Ue),u(18,xt)],Wu);let Gu=class{constructor(e,t,i,s,o){this.treeId=e,this.labelService=t,this.instantiationService=i,this.treeViewsDragAndDropService=s,this.logService=o,this.treeItemsTransfer=Sn.getInstance(),this.treeMimeType=`application/vnd.code.tree.${e.toLowerCase()}`}set controller(e){this.dndController=e}handleDragAndLog(e,t,i,s){return e.handleDrag(t,i,s).then(o=>{if(o){const n=[];for(const r of o)r[0]!==this.treeMimeType&&e.dragMimeTypes.findIndex(d=>d===r[0])<0&&n.push(r[0]);n.length&&this.logService.warn(`Drag and drop controller for tree ${this.treeId} adds the following data transfer types but does not declare them in dragMimeTypes: ${n.join(", ")}`)}return o})}addExtensionProvidedTransferTypes(e,t){if(!e.dataTransfer||!this.dndController)return;const i=nr();this.dragCancellationToken=new qs,this.treeViewsDragAndDropService.addDragOperationTransfer(i,this.handleDragAndLog(this.dndController,t,i,this.dragCancellationToken.token)),this.treeItemsTransfer.setData([new ao(i)],ao.prototype),e.dataTransfer.clearData(Or.text),this.dndController.dragMimeTypes.find(s=>s===Or.uriList)&&e.dataTransfer?.setData(Pr.RESOURCES,""),this.dndController.dragMimeTypes.forEach(s=>{e.dataTransfer?.setData(s,"")})}addResourceInfoToTransfer(e,t){if(t.length&&e.dataTransfer){this.instantiationService.invokeFunction(s=>iE(s,t,e));const i=t.filter(s=>s.scheme===pe.file).map(s=>s.fsPath);i.length&&e.dataTransfer.setData(Gl.FILES,JSON.stringify(i))}}onDragStart(e,t){if(t.dataTransfer){const i=e.getData(),s=[],o={id:this.treeId,itemHandles:[]};i.forEach(n=>{o.itemHandles.push(n.handle),n.resourceUri&&s.push($.revive(n.resourceUri))}),this.addResourceInfoToTransfer(t,s),this.addExtensionProvidedTransferTypes(t,o.itemHandles),t.dataTransfer.setData(this.treeMimeType,JSON.stringify(o))}}debugLog(e){e.size?this.logService.debug(`TreeView dragged mime types: ${Array.from(e).join(", ")}`):this.logService.debug("TreeView dragged with no supported mime types.")}onDragOver(e,t,i,s,o){const n=wf(o.dataTransfer),r=new Set(Array.from(n,h=>h[0]));if(o.dataTransfer){for(const h of o.dataTransfer.items)if(h.kind==="file"||h.type===Pr.RESOURCES.toLowerCase()){r.add(Or.uriList);break}}this.debugLog(r);const d=this.dndController;return!d||!o.dataTransfer||d.dropMimeTypes.length===0?!1:Array.from(r).some((h,p)=>h===this.treeMimeType?!0:d.dropMimeTypes.indexOf(h)>=0)?{accept:!0,bubble:sE.Down,autoExpand:!0}:!1}getDragURI(e){return this.dndController?e.resourceUri?$.revive(e.resourceUri).toString():e.handle:null}getDragLabel(e){if(!this.dndController)return;if(e.length>1)return String(e.length);const t=e[0];return t.label?t.label.label:t.resourceUri?this.labelService.getUriLabel($.revive(t.resourceUri)):void 0}async drop(e,t,i,s,o){const n=this.dndController;if(!o.dataTransfer||!n)return;let r,d;this.treeItemsTransfer.hasData(ao.prototype)&&(d=this.treeItemsTransfer.getData(ao.prototype)[0].identifier);const l=wf(o.dataTransfer,!0),h=new oE;for(const[f,g]of l)if((f===this.treeMimeType||n.dropMimeTypes.includes(f)||g.asFile()&&n.dropMimeTypes.includes(Pr.FILES.toLowerCase()))&&(h.append(f,g),f===this.treeMimeType))try{r=JSON.parse(await g.asString())}catch{}const p=await this.treeViewsDragAndDropService.removeDragOperationTransfer(d);if(p)for(const[f,g]of p)h.append(f,g);return n.handleDrop(h,t,bi.None,d,r?.id,r?.itemHandles)}onDragEnd(e){e.dataTransfer?.dropEffect==="none"&&this.dragCancellationToken?.cancel()}dispose(){}};Gu=D([u(1,$i),u(2,F),u(3,Zm),u(4,Ue)],Gu);function Fv(a){const e=[];for(const t of a)if(t.checkbox!==void 0){const i=n=>{for(const r of n.children??[])r.checkbox!==void 0&&n.checkbox!==void 0&&r.checkbox.isChecked!==n.checkbox.isChecked&&(r.checkbox.isChecked=n.checkbox.isChecked,e.push(r),i(r))};i(t);const s=new Set,o=n=>{if(n.parent&&n.parent.checkbox!==void 0&&n.parent.children){if(s.has(n.parent))return;s.add(n.parent);let r=!1,d=!1;for(const l of n.parent.children){if(r&&d)break;l.checkbox!==void 0&&(l.checkbox.isChecked?d=!0:r=!0)}d&&!r&&n.parent.checkbox.isChecked!==!0?(n.parent.checkbox.isChecked=!0,e.push(n.parent),o(n.parent)):r&&n.parent.checkbox.isChecked!==!1&&(n.parent.checkbox.isChecked=!1,e.push(n.parent),o(n.parent))}};o(t)}return a.concat(e)}const Jk=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));le("remote-explorer-get-started",k.star,c(9164,"Getting started icon in the remote explorer view."));le("remote-explorer-documentation",k.book,c(9165,"Documentation icon in the remote explorer view."));le("remote-explorer-feedback",k.twitter,c(9166,"Feedback icon in the remote explorer view."));le("remote-explorer-review-issues",k.issues,c(9167,"Review issue icon in the remote explorer view."));le("remote-explorer-report-issues",k.comment,c(9168,"Report issue icon in the remote explorer view."));le("remote-explorer-view-icon",k.remoteExplorer,c(9169,"View icon of the remote explorer view."));const Kv=le("ports-view-icon",k.plug,c(9170,"View icon of the remote ports view."));le("ports-view-icon",k.plug,c(9171,"Icon representing a remote port."));const Wv=le("private-ports-view-icon",k.lock,c(9172,"Icon representing a private remote port.")),Zk=le("ports-forward-icon",k.plus,c(9173,"Icon for the forward action.")),Xk=le("ports-stop-forward-icon",k.x,c(9174,"Icon for the stop forwarding action.")),Qk=le("ports-open-browser-icon",k.globe,c(9175,"Icon for the open browser action.")),eR=le("ports-open-preview-icon",k.openPreview,c(9176,"Icon for the open preview action.")),tR=le("ports-copy-address-icon",k.clippy,c(9177,"Icon for the copy local address action.")),Gv=le("ports-label-icon",k.tag,c(9178,"Icon for the label port action.")),iR=le("ports-forwarded-without-process-icon",k.circleOutline,c(9179,"Icon for forwarded ports that don't have a running process.")),sR=le("ports-forwarded-with-process-icon",k.circleFilled,c(9180,"Icon for forwarded ports that do have a running process."));var Uu;Pe(Jk);const oR=new q("openPreviewEnabled",!1);class nR{constructor(e){this.remoteExplorerService=e,this.headerRowHeight=22}getHeight(e){return e.tunnelType===Ve.Add&&!this.remoteExplorerService.getEditableData(void 0)?30:22}}let Hu=class{constructor(e,t){this.remoteExplorerService=e,this.tunnelService=t,this._candidates=new Map,this.input={label:c(9210,"Add Port"),icon:void 0,tunnelType:Ve.Add,hasRunningProcess:!1,remoteHost:"",remotePort:0,processDescription:"",tooltipPostfix:"",iconTooltip:"",portTooltip:"",processTooltip:"",originTooltip:"",privacyTooltip:"",source:{source:Yp.User,description:""},protocol:ls.Http,privacy:{id:kd.Private,themeIcon:Wv.id,label:c(9211,"Private")},strip:()=>{}},this.model=e.tunnelModel,this.onForwardedPortsChanged=L.any(this.model.onForwardPort,this.model.onClosePort,this.model.onPortName,this.model.onCandidatesChanged)}get all(){const e=[];return this._candidates=new Map,this.model.candidates.forEach(t=>{this._candidates.set(Et(t.host,t.port),t)}),(this.model.forwarded.size>0||this.remoteExplorerService.getEditableData(void 0))&&e.push(...this.forwarded),this.model.detected.size>0&&e.push(...this.detected),e.push(this.input),e}addProcessInfoFromCandidate(e){const t=Et(e.remoteHost,e.remotePort);this._candidates.has(t)&&(e.processDescription=this._candidates.get(t).detail)}get forwarded(){return Array.from(this.model.forwarded.values()).map(t=>{const i=Ze.createFromTunnel(this.remoteExplorerService,this.tunnelService,t);return this.addProcessInfoFromCandidate(i),i}).sort((t,i)=>t.remotePort===i.remotePort?t.remoteHost<i.remoteHost?-1:1:t.remotePort<i.remotePort?-1:1)}get detected(){return Array.from(this.model.detected.values()).map(e=>{const t=Ze.createFromTunnel(this.remoteExplorerService,this.tunnelService,e,Ve.Detected,!1);return this.addProcessInfoFromCandidate(t),t})}isEmpty(){return this.detected.length===0&&(this.forwarded.length===0||this.forwarded.length===1&&this.forwarded[0].tunnelType===Ve.Add&&!this.remoteExplorerService.getEditableData(void 0))}};Hu=D([u(0,ze),u(1,Jt)],Hu);function Wa(a){return{label:"",tunnel:a,editId:It.None,tooltip:""}}class rR{constructor(){this.label="",this.tooltip="",this.weight=1,this.minimumWidth=40,this.maximumWidth=40,this.templateId="actionbar"}project(e){if(e.tunnelType===Ve.Add)return Wa(e);const t=e.processDescription?sR:iR;let i="";return e instanceof Ze&&(i=`${e.iconTooltip} ${e.tooltipPostfix}`),{label:"",icon:t,tunnel:e,editId:It.None,tooltip:i}}}class aR{constructor(){this.label=c(9212,"Port"),this.tooltip=c(9213,"The label and remote port number of the forwarded port."),this.weight=1,this.templateId="actionbar"}project(e){const t=e.tunnelType===Ve.Add,i=e.label;let s="";return e instanceof Ze&&!t?s=`${e.portTooltip} ${e.tooltipPostfix}`:s=i,{label:i,tunnel:e,menuId:w.TunnelPortInline,editId:e.tunnelType===Ve.Add?It.New:It.Label,tooltip:s}}}class ug{constructor(){this.label=c(9214,"Forwarded Address"),this.tooltip=c(9215,"The address that the forwarded port is available at."),this.weight=1,this.templateId="actionbar"}project(e){if(e.tunnelType===Ve.Add)return Wa(e);const t=e.localAddress??"";let i=t;return e instanceof Ze&&(i=e.tooltipPostfix),{label:t,menuId:w.TunnelLocalAddressInline,tunnel:e,editId:It.LocalPort,tooltip:i,markdownTooltip:t?ug.getHoverText(t):void 0}}static getHoverText(e){return function(t){const i=t.getValue("editor");let s="";i.multiCursorModifier==="ctrlCmd"?ut?s=c(9216,"option + click"):s=c(9217,"alt + click"):ut?s=c(9218,"cmd + click"):s=c(9219,"ctrl + click");const o=new wi("",!0),n=e.startsWith("http")?e:`http://${e}`;return o.appendLink(n,"Follow link").appendMarkdown(` (${s})`)}}}class dR{constructor(){this.label=c(9220,"Running Process"),this.tooltip=c(9221,"The command line of the process that is using the port."),this.weight=2,this.templateId="actionbar"}project(e){return e.tunnelType===Ve.Add?Wa(e):{label:e.processDescription??"",tunnel:e,editId:It.None,tooltip:e instanceof Ze?e.processTooltip:""}}}class cR{constructor(){this.label=c(9222,"Origin"),this.tooltip=c(9223,"The source that a forwarded port originates from. Can be an extension, user forwarded, statically forwarded, or automatically forwarded."),this.weight=1,this.templateId="actionbar"}project(e){if(e.tunnelType===Ve.Add)return Wa(e);const t=e.source.description,i=`${e instanceof Ze?e.originTooltip:""}. ${e instanceof Ze?e.tooltipPostfix:""}`;return{label:t,menuId:w.TunnelOriginInline,tunnel:e,editId:It.None,tooltip:i}}}class lR{constructor(){this.label=c(9224,"Visibility"),this.tooltip=c(9225,"The availability of the forwarded port."),this.weight=1,this.templateId="actionbar"}project(e){if(e.tunnelType===Ve.Add)return Wa(e);const t=e.privacy?.label;let i="";return e instanceof Ze&&(i=`${e.privacy.label} ${e.tooltipPostfix}`),{label:t,tunnel:e,icon:{id:e.privacy.themeIcon},editId:It.None,tooltip:i}}}let zu=class extends R{constructor(e,t,i,s,o,n,r){super(),this.instantiationService=e,this.contextKeyService=t,this.menuService=i,this.contextViewService=s,this.remoteExplorerService=o,this.commandService=n,this.configurationService=r,this.templateId="actionbar",this._hoverDelegate=Ap("mouse")}set actionRunner(e){this._actionRunner=e}renderTemplate(e){const t=ge(e,M(".ports-view-actionbar-cell")),i=ge(t,M(".ports-view-actionbar-cell-icon")),s=new Nc(t,{supportHighlights:!0,hoverDelegate:this._hoverDelegate}),o=ge(t,M(".actions")),n=new cr(o,{actionViewItemProvider:Tp.bind(void 0,this.instantiationService),hoverDelegate:this._hoverDelegate});return{label:s,icon:i,actionBar:n,container:t,elementDisposable:R.None}}renderElement(e,t,i){i.actionBar.clear(),i.icon.className="ports-view-actionbar-cell-icon",i.icon.style.display="none",i.label.setLabel(""),i.label.element.style.display="none",i.container.style.height="22px",i.button&&(i.button.element.style.display="none",i.button.dispose()),i.container.style.paddingLeft="0px",i.elementDisposable.dispose();let s;e.editId===It.New&&(s=this.remoteExplorerService.getEditableData(void 0))?this.renderInputBox(i.container,s):(s=this.remoteExplorerService.getEditableData(e.tunnel,e.editId),s?this.renderInputBox(i.container,s):e.tunnel.tunnelType===Ve.Add&&e.menuId===w.TunnelPortInline?this.renderButton(e,i):this.renderActionBarItem(e,i))}renderButton(e,t){t.container.style.paddingLeft="7px",t.container.style.height="28px",t.button=this._register(new ty(t.container,oa)),t.button.label=e.label,t.button.element.title=e.tooltip,this._register(t.button.onDidClick(()=>{this.commandService.executeCommand(Xe.INLINE_ID)}))}tunnelContext(e){let t;return e instanceof Ze&&(t=e.strip()),t||(t={tunnelType:e.tunnelType,remoteHost:e.remoteHost,remotePort:e.remotePort,localAddress:e.localAddress,protocol:e.protocol,localUri:e.localUri,localPort:e.localPort,name:e.name,closeable:e.closeable,source:e.source,privacy:e.privacy,processDescription:e.processDescription,label:e.label}),t}renderActionBarItem(e,t){t.label.element.style.display="flex",t.label.setLabel(e.label,void 0,{title:e.markdownTooltip?{markdown:e.markdownTooltip(this.configurationService),markdownNotSupportedFallback:e.tooltip}:e.tooltip,extraClasses:e.menuId===w.TunnelLocalAddressInline?["ports-view-actionbar-cell-localaddress"]:void 0}),t.actionBar.context=this.tunnelContext(e.tunnel),t.container.style.paddingLeft="10px";const i=[["view",lo],[Ga.key,e.tunnel.tunnelType],[Ua.key,e.tunnel.closeable],[$u.key,e.tunnel.privacy.id],[ol.key,e.tunnel.protocol]],s=this.contextKeyService.createOverlay(i),o=new O;if(t.elementDisposable=o,e.menuId){const n=o.add(this.menuService.createMenu(e.menuId,s));let r=Wc(n.getActions({shouldForwardArgs:!0}));if(r){const d=r.filter(l=>l.id.toLowerCase().indexOf("label")>=0);d.length>1&&(d.sort((l,h)=>l.label.length-h.label.length),d.pop(),r=r.filter(l=>d.indexOf(l)<0)),t.actionBar.push(r,{icon:!0,label:!1}),this._actionRunner&&(t.actionBar.actionRunner=this._actionRunner)}}e.icon&&(t.icon.className=`ports-view-actionbar-cell-icon ${Ce.asClassName(e.icon)}`,t.icon.title=e.tooltip,t.icon.style.display="inline")}renderInputBox(e,t){this.inputDone&&(this.inputDone(!1,!1),this.inputDone=void 0),e.style.paddingLeft="5px";const i=t.startingValue||"",s=new Sw(e,this.contextViewService,{ariaLabel:c(9226,"Press Enter to confirm or Escape to cancel."),validationOptions:{validation:r=>{const d=t.validationMessage(r);return d?{content:d.content,formatContent:!0,type:d.severity===Se.Error?Ja.ERROR:Ja.INFO}:null}},placeholder:t.placeholder||"",inputBoxStyles:Tc});s.value=i,s.focus(),s.select({start:0,end:t.startingValue?t.startingValue.length:0});const o=Up(async(r,d)=>{je(n),this.inputDone&&(this.inputDone=void 0),s.element.style.display="none";const l=s.value;if(d)return t.onFinish(l,r)});this.inputDone=o;const n=[s,Cw(s.inputElement,te.KEY_DOWN,async r=>{if(r.equals(y.Enter))return r.stopPropagation(),s.validate()!==Ja.ERROR?o(!0,!0):o(!1,!0);if(r.equals(y.Escape))return r.preventDefault(),r.stopPropagation(),o(!1,!0)}),J(s.inputElement,te.BLUR,()=>o(s.validate()!==Ja.ERROR,!0))];return ae(()=>{o(!1,!1)})}disposeElement(e,t,i){i.elementDisposable.dispose()}disposeTemplate(e){e.label.dispose(),e.actionBar.dispose(),e.elementDisposable.dispose(),e.button?.dispose()}};zu=D([u(0,F),u(1,se),u(2,Cs),u(3,dr),u(4,ze),u(5,wt),u(6,ie)],zu);class Ze{static createFromTunnel(e,t,i,s=Ve.Forwarded,o){return new Ze(s,i.remoteHost,i.remotePort,i.source,!!i.hasRunningProcess,i.protocol,i.localUri,i.localAddress,i.localPort,o===void 0?i.closeable:o,i.name,i.runningProcess,i.pid,i.privacy,e,t)}strip(){return new Ze(this.tunnelType,this.remoteHost,this.remotePort,this.source,this.hasRunningProcess,this.protocol,this.localUri,this.localAddress,this.localPort,this.closeable,this.name,this.runningProcess,this.pid,this._privacy)}constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v,C){this.tunnelType=e,this.remoteHost=t,this.remotePort=i,this.source=s,this.hasRunningProcess=o,this.protocol=n,this.localUri=r,this.localAddress=d,this.localPort=l,this.closeable=h,this.name=p,this.runningProcess=f,this.pid=g,this._privacy=m,this.remoteExplorerService=v,this.tunnelService=C}get label(){if(this.tunnelType===Ve.Add&&this.name)return this.name;const e=aE(this.remoteHost)||dE(this.remoteHost)?`${this.remotePort}`:`${this.remoteHost}:${this.remotePort}`;return this.name?`${this.name} (${e})`:e}set processDescription(e){this.runningProcess=e}get processDescription(){let e="";return this.runningProcess?(this.pid&&this.remoteExplorerService?.namedProcesses.has(this.pid)?e=this.remoteExplorerService.namedProcesses.get(this.pid):e=this.runningProcess.replace(/\0/g," ").trim(),this.pid&&(e+=` (${this.pid})`)):this.hasRunningProcess&&(e=c(9227,"Process information unavailable")),e}get tooltipPostfix(){let e;return this.localAddress?e=c(9228,"Remote port {0}:{1} forwarded to local address {2}. ",this.remoteHost,this.remotePort,this.localAddress):e=c(9229,"Remote port {0}:{1} not forwarded. ",this.remoteHost,this.remotePort),e}get iconTooltip(){return this.tunnelType===Ve.Add?this.label:`${this.processDescription?c(9230,"Port has running process."):c(9231,"No running process.")}`}get portTooltip(){return this.tunnelType===Ve.Add?"":`${this.name?c(9232,"Port labeled {0}. ",this.name):""}`}get processTooltip(){return this.processDescription??""}get originTooltip(){return this.source.description}get privacy(){return this.tunnelService?.privacyOptions?this.tunnelService?.privacyOptions.find(e=>e.id===this._privacy)??{id:"",themeIcon:k.question.id,label:c(9233,"Unknown")}:{id:kd.Private,themeIcon:Wv.id,label:c(9211,"Private")}}}const Ga=new q("tunnelType",Ve.Add,!0),Ua=new q("tunnelCloseable",!1,!0),$u=new q("tunnelPrivacy",void 0,!0),Uv=new q("tunnelPrivacyEnabled",!1,!0),ol=new q("tunnelProtocol",ls.Http,!0),nl=new q("tunnelViewFocus",!1,c(9234,"Whether the Ports view has focus.")),Ha="tunnelViewSelection",hR=new q(Ha,void 0,!0),Hv="tunnelViewMultiSelection",zv=new q(Hv,void 0,!0),$v=new q("portChangable",!1,!0),qv=new q("protocolChangable",!0,!0);var Hs;let fo=(Hs=class extends Fc{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v,C,T){super(t,i,s,n,o,d,r,l,g,v),this.viewModel=e,this.quickInputService=h,this.commandService=p,this.menuService=f,this.remoteExplorerService=m,this.tunnelService=C,this.contextViewService=T,this.tableDisposables=this._register(new O),this.isEditing=!1,this.titleActions=[],this.lastFocus=[],this.height=0,this.width=0,this.tunnelTypeContext=Ga.bindTo(o),this.tunnelCloseableContext=Ua.bindTo(o),this.tunnelPrivacyContext=$u.bindTo(o),this.tunnelPrivacyEnabledContext=Uv.bindTo(o),this.tunnelPrivacyEnabledContext.set(C.canChangePrivacy),this.protocolChangableContextKey=qv.bindTo(o),this.protocolChangableContextKey.set(C.canChangeProtocol),this.tunnelProtocolContext=ol.bindTo(o),this.tunnelViewFocusContext=nl.bindTo(o),this.tunnelViewSelectionContext=hR.bindTo(o),this.tunnelViewMultiSelectionContext=zv.bindTo(o),this.portChangableContextKey=$v.bindTo(o);const B=this.contextKeyService.createOverlay([["view",Uu.ID]]),V=this._register(this.menuService.createMenu(w.TunnelTitle,B)),U=()=>{this.titleActions=Wc(V.getActions()),this.updateActions()};this._register(V.onDidChange(U)),U(),this._register(ae(()=>{this.titleActions=[]})),this.registerPrivacyActions(),this._register(L.once(this.tunnelService.onAddedTunnelProvider)(()=>{let W=!1;this.tunnelPrivacyEnabledContext.get()===!1&&(this.tunnelPrivacyEnabledContext.set(C.canChangePrivacy),W=!0),this.protocolChangableContextKey.get()===!0&&(this.protocolChangableContextKey.set(C.canChangeProtocol),W=!0),W&&(U(),this.registerPrivacyActions(),this.createTable(),this.table?.layout(this.height,this.width))}))}registerPrivacyActions(){for(const e of this.tunnelService.privacyOptions){const t=`remote.tunnel.privacy${e.id}`;Te.registerCommand(t,qu.handler(e.id)),S.appendMenuItem(w.TunnelPrivacy,{order:0,command:{id:t,title:e.label,toggled:$u.isEqualTo(e.id)}})}}get portCount(){return this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size}createTable(){if(!this.panelContainer)return;this.tableDisposables.clear(),es(this.panelContainer);const e=ge(this.panelContainer,M(".customview-tree"));e.classList.add("ports-view"),e.classList.add("file-icon-themable-tree","show-file-icons");const t=new zu(this.instantiationService,this.contextKeyService,this.menuService,this.contextViewService,this.remoteExplorerService,this.commandService,this.configurationService),i=[new rR,new aR,new ug,new dR];this.tunnelService.canChangePrivacy&&i.push(new lR),i.push(new cR),this.table=this.instantiationService.createInstance(nE,"RemoteTunnels",e,new nR(this.remoteExplorerService),i,[t],{keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:r=>r.label},multipleSelectionSupport:!0,accessibilityProvider:{getAriaLabel:r=>r instanceof Ze?`${r.tooltipPostfix} ${r.portTooltip} ${r.iconTooltip} ${r.processTooltip} ${r.originTooltip} ${this.tunnelService.canChangePrivacy?r.privacy.label:""}`:r.label,getWidgetAriaLabel:()=>c(9236,"Tunnel View")},openOnSingleClick:!0});const s=this.tableDisposables.add(new iy);t.actionRunner=s,this.tableDisposables.add(this.table),this.tableDisposables.add(this.table.onContextMenu(r=>this.onContextMenu(r,s))),this.tableDisposables.add(this.table.onMouseDblClick(r=>this.onMouseDblClick(r))),this.tableDisposables.add(this.table.onDidChangeFocus(r=>this.onFocusChanged(r))),this.tableDisposables.add(this.table.onDidChangeSelection(r=>this.onSelectionChanged(r))),this.tableDisposables.add(this.table.onDidFocus(()=>this.tunnelViewFocusContext.set(!0))),this.tableDisposables.add(this.table.onDidBlur(()=>this.tunnelViewFocusContext.set(!1)));const o=()=>this.table?.splice(0,Number.POSITIVE_INFINITY,this.viewModel.all);o();let n=this.portCount;this.tableDisposables.add(L.debounce(this.viewModel.onForwardedPortsChanged,(r,d)=>d,50)(()=>{const r=this.portCount;(n===0||r===0)&&n!==r&&this._onDidChangeViewWelcomeState.fire(),n=r,o()})),this.tableDisposables.add(this.table.onMouseClick(r=>{if(this.hasOpenLinkModifier(r.browserEvent)&&this.table){const d=this.table.getSelectedElements();(d.length===0||d.length===1&&d[0]===r.element)&&this.commandService.executeCommand(Yt.ID,r.element)}})),this.tableDisposables.add(this.table.onDidOpen(r=>{!r.element||r.element.tunnelType!==Ve.Forwarded||r.browserEvent?.type==="dblclick"&&this.commandService.executeCommand(vs.ID)})),this.tableDisposables.add(this.remoteExplorerService.onDidChangeEditable(r=>{this.isEditing=!!this.remoteExplorerService.getEditableData(r?.tunnel,r?.editId),this._onDidChangeViewWelcomeState.fire(),this.isEditing||e.classList.remove("highlight"),o(),this.isEditing?(e.classList.add("highlight"),r||this.table?.reveal(this.table.indexOf(this.viewModel.input))):(r&&r.tunnel.tunnelType!==Ve.Add&&this.table?.setFocus(this.lastFocus),this.focus())}))}renderBody(e){super.renderBody(e),this.panelContainer=ge(e,M(".tree-explorer-viewlet-tree-view")),this.createTable()}shouldShowWelcome(){return this.viewModel.isEmpty()&&!this.isEditing}focus(){super.focus(),this.table?.domFocus()}onFocusChanged(e){e.indexes.length>0&&e.elements.length>0&&(this.lastFocus=[...e.indexes]);const t=e.elements,i=t&&t.length?t[0]:void 0;i?(this.tunnelViewSelectionContext.set(Et(i.remoteHost,i.remotePort)),this.tunnelTypeContext.set(i.tunnelType),this.tunnelCloseableContext.set(!!i.closeable),this.tunnelPrivacyContext.set(i.privacy.id),this.tunnelProtocolContext.set(i.protocol===ls.Https?ls.Https:ls.Https),this.portChangableContextKey.set(!!i.localPort)):(this.tunnelTypeContext.reset(),this.tunnelViewSelectionContext.reset(),this.tunnelCloseableContext.reset(),this.tunnelPrivacyContext.reset(),this.tunnelProtocolContext.reset(),this.portChangableContextKey.reset())}hasOpenLinkModifier(e){const t=this.configurationService.getValue("editor");let i=!1;return t.multiCursorModifier==="ctrlCmd"?i=e.altKey:ut?i=e.metaKey:i=e.ctrlKey,i}onSelectionChanged(e){const t=e.elements;t.length>1?this.tunnelViewMultiSelectionContext.set(t.map(i=>Et(i.remoteHost,i.remotePort))):this.tunnelViewMultiSelectionContext.set(void 0)}onContextMenu(e,t){if(e.element!==void 0&&!(e.element instanceof Ze))return;e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();const i=e.element;i?(this.table?.setFocus([this.table.indexOf(i)]),this.tunnelTypeContext.set(i.tunnelType),this.tunnelCloseableContext.set(!!i.closeable),this.tunnelPrivacyContext.set(i.privacy.id),this.tunnelProtocolContext.set(i.protocol),this.portChangableContextKey.set(!!i.localPort)):(this.tunnelTypeContext.set(Ve.Add),this.tunnelCloseableContext.set(!1),this.tunnelPrivacyContext.set(void 0),this.tunnelProtocolContext.set(void 0),this.portChangableContextKey.set(!1)),this.contextMenuService.showContextMenu({menuId:w.TunnelContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this.table?.contextKeyService,getAnchor:()=>e.anchor,getActionViewItem:s=>{const o=this.keybindingService.lookupKeybinding(s.id);if(o)return new Lp(s,s,{label:!0,keybinding:o.getLabel()})},onHide:s=>{s&&this.table?.domFocus()},getActionsContext:()=>i?.strip(),actionRunner:t})}onMouseDblClick(e){e.element||this.commandService.executeCommand(Xe.INLINE_ID)}layoutBody(e,t){this.height=e,this.width=t,super.layoutBody(e,t),this.table?.layout(e,t)}},Uu=Hs,Hs.ID=lo,Hs.TITLE=x(9235,"Ports"),Hs);fo=Uu=D([u(2,it),u(3,at),u(4,se),u(5,ie),u(6,F),u(7,Ye),u(8,xt),u(9,Xt),u(10,wt),u(11,Cs),u(12,me),u(13,ze),u(14,Tt),u(15,Jt),u(16,dr)],fo);class uR{constructor(e,t){this.id=fo.ID,this.name=fo.TITLE,this.canToggleVisibility=!0,this.hideByDefault=!1,this.group="details@0",this.order=-500,this.canMoveView=!0,this.containerIcon=Kv,this.ctorDescriptor=new ee(fo,[e]),this.remoteAuthority=t.remoteAuthority?t.remoteAuthority.split("+")[0]:void 0}}function Xs(a){return a&&a.tunnelType&&a.remoteHost&&a.source}var vs;(function(a){a.ID="remote.tunnel.label",a.LABEL=c(9237,"Set Port Label"),a.COMMAND_ID_KEYWORD="label";function e(){return async(t,i)=>{const s=t.get(ze);let o;if(Xs(i))o=i;else{const n=t.get(se).getContextKeyValue(Ha),r=n?s.tunnelModel.forwarded.get(n):void 0;if(r){const d=t.get(Jt);o=Ze.createFromTunnel(s,d,r)}}if(o){const n=o;return new Promise(r=>{const d=n.name?n.name:`${n.remotePort}`;s.setEditable(n,It.Label,{onFinish:async(l,h)=>{l=l.trim(),s.setEditable(n,It.Label,null);const p=h&&l!==d;p&&await s.tunnelModel.name(n.remoteHost,n.remotePort,l),r(p?{port:n.remotePort,label:l}:void 0)},validationMessage:()=>null,placeholder:c(9238,"Port label"),startingValue:d})})}}}a.handler=e})(vs||(vs={}));const pR=c(9239,"Forwarded port should be a number or a host:port."),pg=65536,jv=c(9240,"Port number must be ≥ 0 and < {0}.",pg),Yv=c(9241,"May Require Sudo"),gR=c(9242,"Port is already forwarded");var Xe;(function(a){a.INLINE_ID="remote.tunnel.forwardInline",a.COMMANDPALETTE_ID="remote.tunnel.forwardCommandPalette",a.LABEL=x(9243,"Forward a Port"),a.TREEITEM_LABEL=c(9244,"Forward Port");const e=c(9245,"Port number or address (eg. 3000 or 10.10.10.10:2000).");function t(n,r,d,l){const h=El(d);if(h){if(h.port>=pg)return{content:jv,severity:Se.Error};if(l&&r.isPortPrivileged(h.port))return{content:Yv,severity:Se.Info};if(En(n.tunnelModel.forwarded,h.host,h.port))return{content:gR,severity:Se.Error}}else return{content:pR,severity:Se.Error};return null}function i(n,r,d,l){r?typeof r=="string"&&n.warn(c(9247,"Unable to forward {0}:{1}. {2}",d,l,r)):n.warn(c(9246,"Unable to forward {0}:{1}. The host may not be available or that remote port may already be forwarded",d,l))}function s(){return async(n,r)=>{const d=n.get(ze),l=n.get(Ke),h=n.get(Jt);d.setEditable(void 0,It.New,{onFinish:async(p,f)=>{d.setEditable(void 0,It.New,null);let g;f&&(g=El(p))&&d.forward({remote:{host:g.host,port:g.port},elevateIfNeeded:!0}).then(m=>i(l,m,g.host,g.port))},validationMessage:p=>t(d,h,p,h.canElevate),placeholder:e})}}a.inlineHandler=s;function o(){return async(n,r)=>{const d=n.get(ze),l=n.get(Ke),h=n.get(gt),p=n.get(Xt),f=n.get(Jt);await h.openView(fo.ID,!0);const g=await p.input({prompt:e,validateInput:v=>Promise.resolve(t(d,f,v,f.canElevate))});let m;g&&(m=El(g))&&d.forward({remote:{host:m.host,port:m.port},elevateIfNeeded:!0}).then(v=>i(l,v,m.host,m.port))}}a.commandPaletteHandler=o})(Xe||(Xe={}));function Jv(a,e,t){const i=a.map(s=>{const o=Ze.createFromTunnel(e,t,s);return{label:o.label,description:o.processDescription,tunnel:o}});return i.length===0&&i.push({label:c(9248,"No ports currently forwarded. Try running the {0} command",Xe.LABEL.value)}),i}var di;(function(a){a.INLINE_ID="remote.tunnel.closeInline",a.COMMANDPALETTE_ID="remote.tunnel.closeCommandPalette",a.LABEL=x(9249,"Stop Forwarding Port");function e(){return async(i,s)=>{const o=i.get(se),n=i.get(ze);let r=[];const d=o.getContextKeyValue(Hv);if(d)d.forEach(l=>{const h=n.tunnelModel.forwarded.get(l);h&&r?.push(h)});else if(Xs(s))r=[s];else{const l=o.getContextKeyValue(Ha),h=l?n.tunnelModel.forwarded.get(l):void 0;h&&(r=[h])}if(!(!r||r.length===0))return Promise.all(r.map(l=>n.close({host:l.remoteHost,port:l.remotePort},zo.User)))}}a.inlineHandler=e;function t(){return async i=>{const s=i.get(Xt),o=i.get(ze),n=i.get(Jt),r=i.get(wt),d=Jv(Array.from(o.tunnelModel.forwarded.values()).filter(h=>h.closeable),o,n),l=await s.pick(d,{placeHolder:c(9250,"Choose a port to stop forwarding")});l&&l.tunnel?await o.close({host:l.tunnel.remoteHost,port:l.tunnel.remotePort},zo.User):l&&await r.executeCommand(Xe.COMMANDPALETTE_ID)}}a.commandPaletteHandler=t})(di||(di={}));var Yt;(function(a){a.ID="remote.tunnel.open",a.LABEL=c(9251,"Open in Browser");function e(){return async(i,s)=>{let o;if(Xs(s)?o=Et(s.remoteHost,s.remotePort):s.tunnelRemoteHost&&s.tunnelRemotePort&&(o=Et(s.tunnelRemoteHost,s.tunnelRemotePort)),o){const n=i.get(ze).tunnelModel,r=i.get(xt);return t(n,r,o)}}}a.handler=e;function t(i,s,o){const n=i.forwarded.get(o)||i.detected.get(o);return n?s.open(n.localUri,{allowContributedOpeners:!1}):Promise.resolve()}a.run=t})(Yt||(Yt={}));var vi;(function(a){a.ID="remote.tunnel.openPreview",a.LABEL=c(9252,"Preview in Editor");function e(){return async(i,s)=>{let o;if(Xs(s)?o=Et(s.remoteHost,s.remotePort):s.tunnelRemoteHost&&s.tunnelRemotePort&&(o=Et(s.tunnelRemoteHost,s.tunnelRemotePort)),o){const n=i.get(ze).tunnelModel,r=i.get(xt),d=i.get(sy);return t(n,r,d,o)}}}a.handler=e;async function t(i,s,o,n){const r=i.forwarded.get(n)||i.detected.get(n);if(r){const d=r.remoteHost.includes(":")?`[${r.remoteHost}]`:r.remoteHost,l=$.parse(`http://${d}:${r.remotePort}`),h=await o.getOpener(r.localUri,{sourceUri:l},bi.None);return h?h.openExternalUri(r.localUri,{sourceUri:l},bi.None):s.open(r.localUri)}return Promise.resolve()}a.run=t})(vi||(vi={}));var er;(function(a){a.ID="remote.tunnel.openCommandPalette",a.LABEL=c(9253,"Open Port in Browser");function e(){return async(t,i)=>{const s=t.get(ze),o=t.get(Jt),n=s.tunnelModel,r=t.get(Xt),d=t.get(xt),l=t.get(wt),h=[...n.forwarded,...n.detected].map(f=>{const g=Ze.createFromTunnel(s,o,f[1]);return{label:g.label,description:g.processDescription,tunnel:g}});h.length===0?h.push({label:c(9254,"No ports currently forwarded. Open the Ports view to get started.")}):h.push({label:c(9255,"Open the Ports view...")});const p=await r.pick(h,{placeHolder:c(9256,"Choose the port to open")});if(p&&p.tunnel)return Yt.run(n,d,Et(p.tunnel.remoteHost,p.tunnel.remotePort));if(p)return l.executeCommand(`${lo}.focus`)}}a.handler=e})(er||(er={}));var ci;(function(a){a.INLINE_ID="remote.tunnel.copyAddressInline",a.COMMANDPALETTE_ID="remote.tunnel.copyAddressCommandPalette",a.INLINE_LABEL=c(9257,"Copy Local Address"),a.COMMANDPALETTE_LABEL=c(9258,"Copy Forwarded Port Address");async function e(s,o,n){const r=s.tunnelModel.address(n.remoteHost,n.remotePort);r&&await o.writeText(r.toString())}function t(){return async(s,o)=>{const n=s.get(ze);let r;if(Xs(o))r=o;else{const d=s.get(se).getContextKeyValue(Ha);r=d?n.tunnelModel.forwarded.get(d):void 0}if(r)return e(n,s.get(ih),r)}}a.inlineHandler=t;function i(){return async(s,o)=>{const n=s.get(Xt),r=s.get(ze),d=s.get(Jt),l=s.get(wt),h=s.get(ih),p=Array.from(r.tunnelModel.forwarded.values()).concat(Array.from(r.tunnelModel.detected.values())),f=await n.pick(Jv(p,r,d),{placeHolder:c(9259,"Choose a forwarded port")});f&&f.tunnel?await e(r,h,f.tunnel):f&&await l.executeCommand(Xe.COMMANDPALETTE_ID)}}a.commandPaletteHandler=i})(ci||(ci={}));var tr;(function(a){a.ID="remote.tunnel.changeLocalPort",a.LABEL=c(9260,"Change Local Address Port");function e(i,s,o){if(s.match(/^[0-9]+$/)){if(Number(s)>=pg)return{content:jv,severity:Se.Error};if(o&&i.isPortPrivileged(Number(s)))return{content:Yv,severity:Se.Info}}else return{content:c(9261,"Local port should be a number."),severity:Se.Error};return null}function t(){return async(i,s)=>{const o=i.get(ze),n=i.get(Ke),r=i.get(Jt);let d;if(Xs(s))d=s;else{const l=i.get(se).getContextKeyValue(Ha),h=l?o.tunnelModel.forwarded.get(l):void 0;if(h){const p=i.get(Jt);d=Ze.createFromTunnel(o,p,h)}}if(d){const l=d;o.setEditable(l,It.LocalPort,{onFinish:async(h,p)=>{if(o.setEditable(l,It.LocalPort,null),p){await o.close({host:l.remoteHost,port:l.remotePort},zo.Other);const f=Number(h),g=await o.forward({remote:{host:l.remoteHost,port:l.remotePort},local:f,name:l.name,elevateIfNeeded:!0,source:l.source});g&&typeof g!="string"&&g.tunnelLocalPort!==f&&n.warn(c(9262,"The local port {0} is not available. Port number {1} has been used instead",h,g.tunnelLocalPort??g.localAddress))}},validationMessage:h=>e(r,h,r.canElevate),placeholder:c(9263,"New local port")})}}}a.handler=t})(tr||(tr={}));var qu;(function(a){function e(t){return async(i,s)=>{if(Xs(s)){const o=i.get(ze);return await o.close({host:s.remoteHost,port:s.remotePort},zo.Other),o.forward({remote:{host:s.remoteHost,port:s.remotePort},local:s.localPort,name:s.name,elevateIfNeeded:!0,privacy:t,source:s.source})}}}a.handler=e})(qu||(qu={}));var zi;(function(a){a.ID_HTTP="remote.tunnel.setProtocolHttp",a.ID_HTTPS="remote.tunnel.setProtocolHttps",a.LABEL_HTTP=c(9264,"HTTP"),a.LABEL_HTTPS=c(9265,"HTTPS");async function e(s,o,n,r){if(Xs(s)){const d={protocol:o},l=r.remoteAuthority?Qe.USER_REMOTE:Qe.USER_LOCAL;return n.tunnelModel.configPortsAttributes.addAttributes(s.remotePort,d,l)}}function t(){return async(s,o)=>e(o,ls.Http,s.get(ze),s.get(ri))}a.handlerHttp=t;function i(){return async(s,o)=>e(o,ls.Https,s.get(ze),s.get(ri))}a.handlerHttps=i})(zi||(zi={}));const gg=10,Qo=Ga.isEqualTo(Ve.Forwarded),en=I.or(Qo,Ga.isEqualTo(Ve.Detected)),Qs=zv.isEqualTo(void 0);ne.registerCommandAndKeybindingRule({id:vs.ID,weight:G.WorkbenchContrib+gg,when:I.and(nl,Qo,Qs),primary:y.F2,mac:{primary:y.Enter},handler:vs.handler()});Te.registerCommand(Xe.INLINE_ID,Xe.inlineHandler());Te.registerCommand(Xe.COMMANDPALETTE_ID,Xe.commandPaletteHandler());ne.registerCommandAndKeybindingRule({id:di.INLINE_ID,weight:G.WorkbenchContrib+gg,when:I.and(Ua,nl),primary:y.Delete,mac:{primary:N.CtrlCmd|y.Backspace,secondary:[y.Delete]},handler:di.inlineHandler()});Te.registerCommand(di.COMMANDPALETTE_ID,di.commandPaletteHandler());Te.registerCommand(Yt.ID,Yt.handler());Te.registerCommand(vi.ID,vi.handler());Te.registerCommand(er.ID,er.handler());ne.registerCommandAndKeybindingRule({id:ci.INLINE_ID,weight:G.WorkbenchContrib+gg,when:I.and(nl,en,Qs),primary:N.CtrlCmd|y.KeyC,handler:ci.inlineHandler()});Te.registerCommand(ci.COMMANDPALETTE_ID,ci.commandPaletteHandler());Te.registerCommand(tr.ID,tr.handler());Te.registerCommand(zi.ID_HTTP,zi.handlerHttp());Te.registerCommand(zi.ID_HTTPS,zi.handlerHttps());S.appendMenuItem(w.CommandPalette,{command:{id:di.COMMANDPALETTE_ID,title:di.LABEL},when:uo});S.appendMenuItem(w.CommandPalette,{command:{id:Xe.COMMANDPALETTE_ID,title:Xe.LABEL},when:uo});S.appendMenuItem(w.CommandPalette,{command:{id:ci.COMMANDPALETTE_ID,title:ci.COMMANDPALETTE_LABEL},when:uo});S.appendMenuItem(w.CommandPalette,{command:{id:er.ID,title:er.LABEL},when:uo});S.appendMenuItem(w.TunnelContext,{group:"._open",order:0,command:{id:Yt.ID,title:Yt.LABEL},when:I.and(en,Qs)});S.appendMenuItem(w.TunnelContext,{group:"._open",order:1,command:{id:vi.ID,title:vi.LABEL},when:I.and(en,Qs)});S.appendMenuItem(w.TunnelContext,{group:"0_manage",order:1,command:{id:vs.ID,title:vs.LABEL,icon:Gv},when:I.and(Qo,Qs)});S.appendMenuItem(w.TunnelContext,{group:"2_localaddress",order:0,command:{id:ci.INLINE_ID,title:ci.INLINE_LABEL},when:I.and(en,Qs)});S.appendMenuItem(w.TunnelContext,{group:"2_localaddress",order:1,command:{id:tr.ID,title:tr.LABEL},when:I.and(Qo,$v,Qs)});S.appendMenuItem(w.TunnelContext,{group:"2_localaddress",order:2,submenu:w.TunnelPrivacy,title:c(9266,"Port Visibility"),when:I.and(Qo,Uv)});S.appendMenuItem(w.TunnelContext,{group:"2_localaddress",order:3,submenu:w.TunnelProtocol,title:c(9267,"Change Port Protocol"),when:I.and(Qo,Qs,qv)});S.appendMenuItem(w.TunnelContext,{group:"3_forward",order:0,command:{id:di.INLINE_ID,title:di.LABEL},when:Ua});S.appendMenuItem(w.TunnelContext,{group:"3_forward",order:1,command:{id:Xe.INLINE_ID,title:Xe.LABEL}});S.appendMenuItem(w.TunnelProtocol,{order:0,command:{id:zi.ID_HTTP,title:zi.LABEL_HTTP,toggled:ol.isEqualTo(ls.Http)}});S.appendMenuItem(w.TunnelProtocol,{order:1,command:{id:zi.ID_HTTPS,title:zi.LABEL_HTTPS,toggled:ol.isEqualTo(ls.Https)}});S.appendMenuItem(w.TunnelPortInline,{group:"0_manage",order:0,command:{id:Xe.INLINE_ID,title:Xe.TREEITEM_LABEL,icon:Zk},when:Ga.isEqualTo(Ve.Candidate)});S.appendMenuItem(w.TunnelPortInline,{group:"0_manage",order:4,command:{id:vs.ID,title:vs.LABEL,icon:Gv},when:Qo});S.appendMenuItem(w.TunnelPortInline,{group:"0_manage",order:5,command:{id:di.INLINE_ID,title:di.LABEL,icon:Xk},when:Ua});S.appendMenuItem(w.TunnelLocalAddressInline,{order:-1,command:{id:ci.INLINE_ID,title:ci.INLINE_LABEL,icon:tR},when:en});S.appendMenuItem(w.TunnelLocalAddressInline,{order:0,command:{id:Yt.ID,title:Yt.LABEL,icon:Qk},when:en});S.appendMenuItem(w.TunnelLocalAddressInline,{order:1,command:{id:vi.ID,title:vi.LABEL,icon:eR},when:en});he("ports.iconRunningProcessForeground",rE,c(9268,"The color of the icon for a port that has an associated running process."));const Li=class Li extends R{constructor(e,t){super(),this._onDidMatchLocalUrl=new E,this.onDidMatchLocalUrl=this._onDidMatchLocalUrl.event,this.listeners=new Map,this.replPositions=new Map,e.instances.forEach(i=>{this.registerTerminalInstance(i)}),this._register(e.onDidCreateInstance(i=>{this.registerTerminalInstance(i)})),this._register(e.onDidDisposeInstance(i=>{this.listeners.get(i)?.dispose(),this.listeners.delete(i)})),this._register(t.onDidNewSession(i=>{(!i.parentSession||i.parentSession&&i.hasSeparateRepl())&&this.listeners.set(i.getId(),i.onDidChangeReplElements(()=>{this.processNewReplElements(i)}))})),this._register(t.onDidEndSession(({session:i})=>{this.listeners.has(i.getId())&&(this.listeners.get(i.getId())?.dispose(),this.listeners.delete(i.getId()))}))}registerTerminalInstance(e){Li.excludeTerminals.includes(e.title)||this.listeners.set(e,e.onData(t=>{this.processData(t)}))}processNewReplElements(e){const t=this.replPositions.get(e.getId()),i=e.getReplElements();if(this.replPositions.set(e.getId(),{position:i.length-1,tail:i[i.length-1]}),!t&&i.length>0)i.forEach(s=>this.processData(s.toString()));else if(t&&i.length-1!==t.position)for(let s=i.length-1;s>=0;s--){const o=i[s];if(o===t.tail)break;this.processData(o.toString())}}dispose(){super.dispose();const e=this.listeners.values();for(const t of e)t.dispose()}processData(e){e=cE(e);const t=e.match(Li.localUrlRegex)||[];if(t&&t.length>0)t.forEach(i=>{let s;try{s=new URL(i)}catch{}if(s){const o=i.match(Li.extractPortRegex),n=parseFloat(s.port?s.port:o?o[2]:"NaN");if(!isNaN(n)&&Number.isInteger(n)&&n>0&&n<=65535){let r=s.hostname;if(r!=="0.0.0.0"&&r!=="127.0.0.1"&&(r="localhost"),n!==9229&&e.startsWith("Debugger listening on"))return;this._onDidMatchLocalUrl.fire({port:n,host:r})}}});else{const i=e.match(Li.localPythonServerRegex);i&&i.length===3&&this._onDidMatchLocalUrl.fire({host:i[1],port:Number(i[2])})}}};Li.localUrlRegex=/\b\w{0,20}(?::\/\/)?(?:localhost|127\.0\.0\.1|0\.0\.0\.0|:\d{2,5})[\w\-\.\~:\/\?\#[\]\@!\$&\(\)\*\+\,\;\=]*/gim,Li.extractPortRegex=/(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d{1,5})/,Li.localPythonServerRegex=/HTTP\son\s(127\.0\.0\.1|0\.0\.0\.0)\sport\s(\d+)/,Li.excludeTerminals=["Dev Containers"];let ju=Li;const Nl="workbench.view.remote";let fm=class extends R{constructor(e,t,i,s,o,n){super(),this.contextKeyService=e,this.environmentService=t,this.remoteExplorerService=i,this.tunnelService=s,this.activityService=o,this.statusbarService=n,this.contextKeyListener=this._register(new Ie),this.activityBadge=this._register(new Ie),this.hasPortsInSession=!1,this._register(z.as(pt.ViewsRegistry).registerViewWelcomeContent(lo,{content:this.environmentService.remoteAuthority?c(9148,`No forwarded ports. Forward a port to access your running services locally.
|
|
38
|
+
[Forward a Port]({0})`,`command:${Xe.INLINE_ID}`):c(9149,`No forwarded ports. Forward a port to access your locally running services over the internet.
|
|
39
|
+
[Forward a Port]({0})`,`command:${Xe.INLINE_ID}`)})),this.enableBadgeAndStatusBar(),this.enableForwardedPortsFeatures(),this.environmentService.remoteAuthority||this._register(L.once(this.tunnelService.onTunnelOpened)(()=>{this.hasPortsInSession=!0}))}async getViewContainer(){return z.as(pt.ViewContainersRegistry).registerViewContainer({id:Il,title:x(9150,"Ports"),icon:Kv,ctorDescriptor:new ee(Ea,[Il,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Il,hideIfEmpty:!0,order:5},Y.Panel)}async enableForwardedPortsFeatures(){this.contextKeyListener.clear();const e=!!yf.getValue(this.contextKeyService),t=!!uo.getValue(this.contextKeyService);if(e||t){t||this.contextKeyService.createKey(uo.key,!0);const i=await this.getViewContainer(),s=new uR(new Hu(this.remoteExplorerService,this.tunnelService),this.environmentService),o=z.as(pt.ViewsRegistry);i&&(this.remoteExplorerService.enablePortsFeatures(!e),o.registerViews([s],i))}else this.contextKeyListener.value=this.contextKeyService.onDidChangeContext(i=>{i.affectsSome(new Set([...yf.keys(),...uo.keys()]))&&this.enableForwardedPortsFeatures()})}enableBadgeAndStatusBar(){const e=z.as(pt.ViewsRegistry).onViewsRegistered(t=>{t.find(i=>i.views.find(s=>s.id===lo))&&(this._register(L.debounce(this.remoteExplorerService.tunnelModel.onForwardPort,(i,s)=>s,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this._register(L.debounce(this.remoteExplorerService.tunnelModel.onClosePort,(i,s)=>s,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this.updateActivityBadge(),this.updateStatusBar(),e.dispose())})}async updateActivityBadge(){this.remoteExplorerService.tunnelModel.forwarded.size>0?this.activityBadge.value=this.activityService.showViewActivity(lo,{badge:new Hc(this.remoteExplorerService.tunnelModel.forwarded.size,e=>e===1?c(9151,"1 forwarded port"):c(9152,"{0} forwarded ports",e))}):this.activityBadge.clear()}updateStatusBar(){!this.environmentService.remoteAuthority&&!this.hasPortsInSession||(this.entryAccessor?this.entryAccessor.update(this.entry):this._register(this.entryAccessor=this.statusbarService.addEntry(this.entry,"status.forwardedPorts",et.LEFT,40)))}get entry(){let e;const t=this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size,i=`${t}`;if(t===0)e=c(9153,"No Ports Forwarded");else{const s=Array.from(this.remoteExplorerService.tunnelModel.forwarded.values());s.push(...Array.from(this.remoteExplorerService.tunnelModel.detected.values())),e=c(9154,"Forwarded Ports: {0}",s.map(o=>o.remotePort).join(", "))}return{name:c(9155,"Forwarded Ports"),text:`$(radio-tower) ${i}`,ariaLabel:e,tooltip:e,command:`${lo}.focus`}}};fm=D([u(0,se),u(1,ri),u(2,ze),u(3,Jt),u(4,Ys),u(5,Ui)],fm);let mm=class{constructor(e,t){this.remoteExplorerService=e,this.logService=t,this.remoteExplorerService.tunnelModel.environmentTunnelsSet?this.restore():L.once(this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet)(async()=>{await this.restore()})}async restore(){return this.logService.trace("ForwardedPorts: Doing first restore."),this.remoteExplorerService.restore()}};mm=D([u(0,ze),u(1,Ue)],mm);let wm=class extends R{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v){super(),this.terminalService=e,this.notificationService=t,this.openerService=i,this.externalOpenerService=s,this.remoteExplorerService=o,this.contextKeyService=r,this.configurationService=d,this.debugService=l,this.tunnelService=p,this.hostService=f,this.logService=g,this.storageService=m,this.preferencesService=v,n.remoteAuthority&&(d.whenRemoteConfigurationLoaded().then(()=>h.getEnvironment()).then(C=>{this.setup(C),this._register(d.onDidChangeConfiguration(T=>{T.affectsConfiguration(Ji)?this.setup(C):T.affectsConfiguration(Za)&&!this.portListener&&this.listenForPorts()}))}),this.storageService.getBoolean("processPortForwardingFallback",H.WORKSPACE,!0)||this.configurationService.updateValue(Za,0,Qe.WORKSPACE))}getPortAutoFallbackNumber(){const e=this.configurationService.inspect(Za);if(e.value!==void 0&&(e.value===0||e.value!==e.defaultValue))return e.value;const t=this.configurationService.inspect(Ji);return t.applicationValue===Yi||t.userValue===Yi||t.userLocalValue===Yi||t.userRemoteValue===Yi||t.workspaceFolderValue===Yi||t.workspaceValue===Yi?0:e.value??20}listenForPorts(){let e=this.getPortAutoFallbackNumber();if(e===0){this.portListener?.dispose();return}this.procForwarder&&!this.portListener&&this.configurationService.getValue(Ji)===Yi?this.portListener=this._register(this.remoteExplorerService.tunnelModel.onForwardPort(async()=>{if(e=this.getPortAutoFallbackNumber(),e===0){this.portListener?.dispose();return}Array.from(this.remoteExplorerService.tunnelModel.forwarded.values()).filter(t=>t.source.source===Yp.Auto).length>e&&(await this.configurationService.updateValue(Ji,sh),this.notificationService.notify({message:c(9156,"Over 20 ports have been automatically forwarded. The `process` based automatic port forwarding has been switched to `hybrid` in settings. Some ports may no longer be detected."),severity:Se.Warning,actions:{primary:[new _t("switchBack",c(9157,"Undo"),void 0,!0,async()=>{await this.configurationService.updateValue(Ji,Yi),await this.configurationService.updateValue(Za,0,Qe.WORKSPACE),this.portListener?.dispose(),this.portListener=void 0}),new _t("showPortSourceSetting",c(9158,"Show Setting"),void 0,!0,async()=>{await this.preferencesService.openSettings({query:"remote.autoForwardPortsSource"})})]}}))})):(this.portListener?.dispose(),this.portListener=void 0)}setup(e){const t=this.procForwarder?.forwarded,i=this.outputForwarder||this.procForwarder;if(this.procForwarder?.dispose(),this.procForwarder=void 0,this.outputForwarder?.dispose(),this.outputForwarder=void 0,e?.os!==yi.Linux)this.configurationService.inspect(Ji).default?.value!==vf&&z.as(Zs.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":vf}}]),this.outputForwarder=this._register(new ym(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,()=>!1));else{const s=()=>this.configurationService.getValue(Ji)===Yi;s()?this.procForwarder=this._register(new vm(!1,t,!i,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService)):this.configurationService.getValue(Ji)===sh&&(this.procForwarder=this._register(new vm(!0,t,!i,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService))),this.outputForwarder=this._register(new ym(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,s))}this.listenForPorts()}};wm=D([u(0,lE),u(1,Ke),u(2,xt),u(3,sy),u(4,ze),u(5,ri),u(6,se),u(7,hE),u(8,uE),u(9,pE),u(10,Jt),u(11,Zt),u(12,Ue),u(13,ce),u(14,zc)],wm);const Sc=class Sc extends R{constructor(e,t,i,s,o,n,r,d){super(),this.notificationService=e,this.remoteExplorerService=t,this.openerService=i,this.externalOpenerService=s,this.tunnelService=o,this.hostService=n,this.logService=r,this.contextKeyService=d,this.alreadyOpenedOnce=new Set,this.lastNotifyTime=new Date,this.lastNotifyTime.setFullYear(this.lastNotifyTime.getFullYear()-1)}async doAction(e){this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Starting action for ${e[0]?.tunnelRemotePort}`),this.doActionTunnels=e;const t=await this.portNumberHeuristicDelay();if(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose ${t?.tunnelRemotePort}`),t){const s=(await this.remoteExplorerService.tunnelModel.getAttributes([{port:t.tunnelRemotePort,host:t.tunnelRemoteHost}]))?.get(t.tunnelRemotePort)?.onAutoForward;switch(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) onAutoForward action is ${s}`),s){case hn.OpenBrowserOnce:{if(this.alreadyOpenedOnce.has(t.localAddress))break;this.alreadyOpenedOnce.add(t.localAddress)}case hn.OpenBrowser:{const o=Et(t.tunnelRemoteHost,t.tunnelRemotePort);await Yt.run(this.remoteExplorerService.tunnelModel,this.openerService,o);break}case hn.OpenPreview:{const o=Et(t.tunnelRemoteHost,t.tunnelRemotePort);await vi.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,o);break}case hn.Silent:break;default:{const o=new Date().getTime()-this.lastNotifyTime.getTime();this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) time elapsed since last notification ${o} ms`),o>Sc.NOTIFY_COOL_DOWN&&await this.showNotification(t)}}}}hide(e){this.doActionTunnels&&(this.doActionTunnels=this.doActionTunnels.filter(t=>!e.includes(t.tunnelRemotePort))),this.lastShownPort&&e.indexOf(this.lastShownPort)>=0&&this.lastNotification?.close()}async portNumberHeuristicDelay(){if(this.logService.trace("ForwardedPorts: (OnAutoForwardedAction) Starting heuristic delay"),!this.doActionTunnels||this.doActionTunnels.length===0)return;this.doActionTunnels=this.doActionTunnels.sort((t,i)=>t.tunnelRemotePort-i.tunnelRemotePort);const e=this.doActionTunnels.shift();return e.tunnelRemotePort%1e3===0?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because % 1000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):e.tunnelRemotePort<1e4&&e.tunnelRemotePort!==9229?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because < 10000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Waiting for "better" tunnel than ${e.tunnelRemotePort}`),this.newerTunnel=void 0,new Promise(t=>{setTimeout(()=>{this.newerTunnel?t(void 0):this.doActionTunnels?.includes(e)?t(e):t(void 0)},3e3)}))}async basicMessage(e){const i=(await this.remoteExplorerService.tunnelModel.getAttributes([{host:e.tunnelRemoteHost,port:e.tunnelRemotePort}],!1))?.get(e.tunnelRemotePort)?.label;return c(9159,"Your application{0} running on port {1} is available. ",i?` (${i})`:"",e.tunnelRemotePort)}linkMessage(){return c(9160,"[See all forwarded ports]({0})",`command:${fo.ID}.focus`)}async showNotification(e){if(!await this.hostService.hadLastFocus())return;this.lastNotification?.close();let t=await this.basicMessage(e);const i=[this.openBrowserChoice(e)];(!Wo||oR.getValue(this.contextKeyService))&&i.push(this.openPreviewChoice(e)),e.tunnelLocalPort!==e.tunnelRemotePort&&this.tunnelService.canElevate&&this.tunnelService.isPortPrivileged(e.tunnelRemotePort)&&(t+=c(9161,"You'll need to run as superuser to use port {0} locally. ",e.tunnelRemotePort),i.unshift(this.elevateChoice(e))),e.privacy===kd.Private&&Wo&&this.tunnelService.canChangePrivacy&&i.push(this.makePublicChoice(e)),t+=this.linkMessage(),this.lastNotification=this.notificationService.prompt(Se.Info,t,i,{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.lastShownPort=e.tunnelRemotePort,this.lastNotifyTime=new Date,this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0})}makePublicChoice(e){return{label:c(9162,"Make Public"),run:async()=>{const t=En(this.remoteExplorerService.tunnelModel.forwarded,e.tunnelRemoteHost,e.tunnelRemotePort);return await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},zo.Other),this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelLocalPort,name:t?.name,elevateIfNeeded:!0,privacy:kd.Public,source:t?.source})}}}openBrowserChoice(e){const t=Et(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:Yt.LABEL,run:()=>Yt.run(this.remoteExplorerService.tunnelModel,this.openerService,t)}}openPreviewChoice(e){const t=Et(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:vi.LABEL,run:()=>vi.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,t)}}elevateChoice(e){return{label:c(9163,"Use Port {0} as Sudo...",e.tunnelRemotePort),run:async()=>{await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},zo.Other);const t=await this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelRemotePort,elevateIfNeeded:!0,source:Jp});!t||typeof t=="string"||(this.lastNotification?.close(),this.lastShownPort=t.tunnelRemotePort,this.lastNotification=this.notificationService.prompt(Se.Info,await this.basicMessage(t)+this.linkMessage(),[this.openBrowserChoice(t),this.openPreviewChoice(e)],{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0}))}}}};Sc.NOTIFY_COOL_DOWN=5e3;let Jd=Sc;class ym extends R{constructor(e,t,i,s,o,n,r,d,l,h,p,f){super(),this.terminalService=e,this.notificationService=t,this.openerService=i,this.externalOpenerService=s,this.remoteExplorerService=o,this.configurationService=n,this.debugService=r,this.tunnelService=d,this.hostService=l,this.logService=h,this.contextKeyService=p,this.privilegedOnly=f,this.notifier=new Jd(t,o,i,s,d,l,h,p),this._register(n.onDidChangeConfiguration(g=>{g.affectsConfiguration(Kr)&&this.tryStartStopUrlFinder()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(()=>{this.tryStartStopUrlFinder()})),this.tryStartStopUrlFinder(),n.getValue(Ji)===sh&&this._register(this.tunnelService.onTunnelClosed(g=>this.notifier.hide([g.port])))}tryStartStopUrlFinder(){this.configurationService.getValue(Kr)?this.startUrlFinder():this.stopUrlFinder()}startUrlFinder(){!this.urlFinder&&this.remoteExplorerService.portsFeaturesEnabled!==oy.AdditionalFeatures||(this.portsFeatures?.dispose(),this.urlFinder=this._register(new ju(this.terminalService,this.debugService)),this._register(this.urlFinder.onDidMatchLocalUrl(async e=>{if(En(this.remoteExplorerService.tunnelModel.detected,e.host,e.port))return;const t=(await this.remoteExplorerService.tunnelModel.getAttributes([e]))?.get(e.port);if(t?.onAutoForward===hn.Ignore||this.privilegedOnly()&&!this.tunnelService.isPortPrivileged(e.port))return;const i=await this.remoteExplorerService.forward({remote:e,source:Jp},t??null);i&&typeof i!="string"&&this.notifier.doAction([i])})))}stopUrlFinder(){this.urlFinder&&(this.urlFinder.dispose(),this.urlFinder=void 0)}}class vm extends R{constructor(e,t,i,s,o,n,r,d,l,h,p,f){super(),this.unforwardOnly=e,this.alreadyAutoForwarded=t,this.needsInitialCandidates=i,this.configurationService=s,this.remoteExplorerService=o,this.notificationService=n,this.openerService=r,this.externalOpenerService=d,this.tunnelService=l,this.hostService=h,this.logService=p,this.contextKeyService=f,this.autoForwarded=new Set,this.notifiedOnly=new Set,this.initialCandidates=new Set,this.notifier=new Jd(n,o,r,d,l,h,p,f),t?.forEach(g=>this.autoForwarded.add(g)),this.initialize()}get forwarded(){return this.autoForwarded}async initialize(){this.remoteExplorerService.tunnelModel.environmentTunnelsSet||await new Promise(e=>this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet(()=>e())),this._register(this.configurationService.onDidChangeConfiguration(async e=>{e.affectsConfiguration(Kr)&&await this.startStopCandidateListener()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(async()=>{await this.startStopCandidateListener()})),this.startStopCandidateListener()}async startStopCandidateListener(){this.configurationService.getValue(Kr)?await this.startCandidateListener():this.stopCandidateListener()}stopCandidateListener(){this.candidateListener&&(this.candidateListener.dispose(),this.candidateListener=void 0)}async startCandidateListener(){this.candidateListener||this.remoteExplorerService.portsFeaturesEnabled!==oy.AdditionalFeatures||(this.portsFeatures?.dispose(),await this.setInitialCandidates(),this.configurationService.getValue(Kr)&&(this.candidateListener=this._register(this.remoteExplorerService.tunnelModel.onCandidatesChanged(this.handleCandidateUpdate,this))))}async setInitialCandidates(){if(!this.needsInitialCandidates){this.logService.debug("ForwardedPorts: (ProcForwarding) Not setting initial candidates");return}let e=this.remoteExplorerService.tunnelModel.candidatesOrUndefined;e||(await new Promise(t=>this.remoteExplorerService.tunnelModel.onCandidatesChanged(()=>t())),e=this.remoteExplorerService.tunnelModel.candidates);for(const t of e)this.initialCandidates.add(Et(t.host,t.port));this.logService.debug(`ForwardedPorts: (ProcForwarding) Initial candidates set to ${e.map(t=>t.port).join(", ")}`)}async forwardCandidates(){let e;const t=[];this.logService.trace(`ForwardedPorts: (ProcForwarding) Attempting to forward ${this.remoteExplorerService.tunnelModel.candidates.length} candidates`);for(const i of this.remoteExplorerService.tunnelModel.candidates){if(!i.detail){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${i.port} missing detail`);continue}e||(e=await this.remoteExplorerService.tunnelModel.getAttributes(this.remoteExplorerService.tunnelModel.candidates));const s=e?.get(i.port),o=Et(i.host,i.port);if(this.initialCandidates.has(o)&&s?.onAutoForward===void 0||this.notifiedOnly.has(o)||this.autoForwarded.has(o))continue;const n=En(this.remoteExplorerService.tunnelModel.forwarded,i.host,i.port);if(En(this.remoteExplorerService.tunnelModel.detected,i.host,i.port))continue;if(s?.onAutoForward===hn.Ignore){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${i.port} is ignored`);continue}const r=await this.remoteExplorerService.forward({remote:i,source:Jp},s??null);!n&&r?(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${i.port} has been forwarded`),this.autoForwarded.add(o)):r&&(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${i.port} has been notified`),this.notifiedOnly.add(o)),r&&typeof r!="string"&&t.push(r)}if(this.logService.trace(`ForwardedPorts: (ProcForwarding) Forwarded ${t.length} candidates`),t.length!==0)return t}async handleCandidateUpdate(e){const t=[];let i;if(this.unforwardOnly){i=new Map;for(const o of this.remoteExplorerService.tunnelModel.forwarded.entries())o[1].source.source===Yp.Auto&&i.set(o[0],o[1])}else i=new Map(this.autoForwarded.entries());for(const o of e){const n=o[0];let r=o[1];const d=En(i,r.host,r.port);d?(typeof d=="string"?this.autoForwarded.delete(n):r={host:d.remoteHost,port:d.remotePort},await this.remoteExplorerService.close(r,zo.AutoForwardEnd),t.push(r.port)):this.notifiedOnly.has(n)?(this.notifiedOnly.delete(n),t.push(r.port)):this.initialCandidates.has(n)&&this.initialCandidates.delete(n)}if(this.unforwardOnly)return;t.length>0&&await this.notifier.hide(t);const s=await this.forwardCandidates();s&&await this.notifier.doAction(s)}}const bm="workbench.view.scm";var Cm;(function(a){a.List="list",a.Tree="tree"})(Cm||(Cm={}));var Sm;(function(a){a[a.Error=0]="Error",a[a.Warning=1]="Warning",a[a.Information=2]="Information"})(Sm||(Sm={}));var _m;(function(a){a[a.HistoryPrevious=0]="HistoryPrevious",a[a.HistoryNext=1]="HistoryNext"})(_m||(_m={}));var Em;(function(a){a.DiscoveryTime="discoveryTime",a.Name="name",a.Path="path"})(Em||(Em={}));var Yu;const Bl={webviewState:"webviewState"};var An;let Ju=(An=class extends Fc{static getOriginStore(e){return this._originStore??=new gE("webviewViews.origins",e),this._originStore}constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v,C,T){super({...e,titleMenuId:w.ViewTitle,showActions:fE.WhenExpanded},n,s,t,i,h,o,r,l,d),this.activityService=p,this.extensionService=f,this.progressService=g,this.storageService=m,this.viewService=v,this.webviewService=C,this.webviewViewService=T,this._webview=this._register(new Ie),this._webviewDisposables=this._register(new O),this._activated=!1,this.activity=this._register(new Ie),this._onDidChangeVisibility=this._register(new E),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this._onDispose=this._register(new E),this.onDispose=this._onDispose.event,this.extensionId=e.fromExtensionId,this.defaultTitle=this.title,this.memento=new pw(`webviewView.${this.id}`,m),this.viewState=this.memento.getMemento(H.WORKSPACE,Re.MACHINE),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.webviewViewService.onNewResolverRegistered(B=>{B.viewType===this.id&&this.updateTreeVisibility()})),this.updateTreeVisibility()}dispose(){this._onDispose.fire(),clearTimeout(this._repositionTimeout),super.dispose()}focus(){super.focus(),this._webview.value?.focus()}renderBody(e){super.renderBody(e),this._container=e,this._rootContainer=void 0,this._resizeObserver||(this._resizeObserver=new ResizeObserver(()=>{setTimeout(()=>{this.layoutWebview()},0)}),this._register(ae(()=>{this._resizeObserver.disconnect()})),this._resizeObserver.observe(e))}saveState(){this._webview.value&&(this.viewState[Bl.webviewState]=this._webview.value.state),this.memento.saveMemento(),super.saveState()}layoutBody(e,t){super.layoutBody(e,t),this.layoutWebview(new jt(t,e))}updateTreeVisibility(){this.isBodyVisible()?(this.activate(),this._webview.value?.claim(this,St(this.element),void 0)):this._webview.value?.release(this)}activate(){if(this._activated)return;this._activated=!0;const e=this.extensionId?Yu.getOriginStore(this.storageService).getOrigin(this.id,this.extensionId):void 0,t=this.webviewService.createWebviewOverlay({origin:e,providedViewType:this.id,title:this.title,options:{purpose:ry.WebviewView},contentOptions:{},extension:this.extensionId?{id:this.extensionId}:void 0});t.state=this.viewState[Bl.webviewState],this._webview.value=t,this._container&&this.layoutWebview(),this._webviewDisposables.add(ae(()=>{this._webview.value?.release(this)})),this._webviewDisposables.add(t.onDidUpdateState(()=>{this.viewState[Bl.webviewState]=t.state}));for(const s of[te.DRAG,te.DRAG_END,te.DRAG_ENTER,te.DRAG_LEAVE,te.DRAG_START])this._webviewDisposables.add(J(this._webview.value.container,s,o=>{o.preventDefault(),o.stopImmediatePropagation(),this.dropTargetElement.dispatchEvent(new DragEvent(o.type,o))}));this._webviewDisposables.add(new mE(St(this.element),()=>this._webview.value));const i=this._webviewDisposables.add(new qs);this.withProgress(async()=>{await this.extensionService.activateByEvent(`onView:${this.id}`);const s=this,o={webview:t,onDidChangeVisibility:this.onDidChangeBodyVisibility,onDispose:this.onDispose,get title(){return s.setTitle},set title(n){s.updateTitle(n)},get description(){return s.titleDescription},set description(n){s.updateTitleDescription(n)},get badge(){return s.badge},set badge(n){s.updateBadge(n)},dispose:()=>{this._activated=!1,this._webview.clear(),this._webviewDisposables.clear()},show:n=>{this.viewService.openView(this.id,!n)}};await this.webviewViewService.resolve(this.id,o,i.token)})}updateTitle(e){this.setTitle=e,super.updateTitle(typeof e=="string"?e:this.defaultTitle)}updateBadge(e){if(!(this.badge?.value===e?.value&&this.badge?.tooltip===e?.tooltip)&&(this.badge=e,e)){const t={badge:new Hc(e.value,()=>e.tooltip),priority:150};this.activity.value=this.activityService.showViewActivity(this.id,t)}}async withProgress(e){return this.progressService.withProgress({location:this.id,delay:500},e)}onDidScrollRoot(){this.layoutWebview()}doLayoutWebview(e){const t=this._webview.value;!this._container||!t||((!this._rootContainer||!this._rootContainer.isConnected)&&(this._rootContainer=this.findRootContainer(this._container)),t.layoutWebviewOverElement(this._container,e,this._rootContainer))}layoutWebview(e){this.doLayoutWebview(e),clearTimeout(this._repositionTimeout),this._repositionTimeout=setTimeout(()=>this.doLayoutWebview(e),200)}findRootContainer(e){return wE(e,"monaco-scrollable-element")??void 0}},Yu=An,An);Ju=Yu=D([u(1,ie),u(2,se),u(3,at),u(4,F),u(5,it),u(6,xt),u(7,Tt),u(8,me),u(9,Ye),u(10,Ys),u(11,At),u(12,Uc),u(13,ce),u(14,gt),u(15,Yo),u(16,ny)],Ju);const Im={type:"object",properties:{id:{description:c(2478,"Unique id used to identify the container in which views can be contributed using 'views' contribution point"),type:"string",pattern:"^[a-zA-Z0-9_-]+$"},title:{description:c(2479,"Human readable string used to render the container"),type:"string"},icon:{description:c(2480,"Path to the container icon. Icons are 24x24 centered on a 50x40 block and have a fill color of 'rgb(215, 218, 224)' or '#d7dae0'. It is recommended that icons be in SVG, though any image file type is accepted."),type:"string"}},required:["id","title","icon"]},fR={description:c(2481,"Contributes views containers to the editor"),type:"object",properties:{activitybar:{description:c(2482,"Contribute views containers to Activity Bar"),type:"array",items:Im},panel:{description:c(2483,"Contribute views containers to Panel"),type:"array",items:Im}},additionalProperties:!1};var Ts;(function(a){a.Tree="tree",a.Webview="webview"})(Ts||(Ts={}));var gn;(function(a){a.Visible="visible",a.Hidden="hidden",a.Collapsed="collapsed"})(gn||(gn={}));const _r={type:"object",required:["id","name","icon"],defaultSnippets:[{body:{id:"${1:id}",name:"${2:name}",icon:"${3:icon}"}}],properties:{type:{markdownDescription:c(2484,"Type of the view. This can either be `tree` for a tree view based view or `webview` for a webview based view. The default is `tree`."),type:"string",enum:["tree","webview"],markdownEnumDescriptions:[c(2485,"The view is backed by a `TreeView` created by `createTreeView`."),c(2486,"The view is backed by a `WebviewView` registered by `registerWebviewViewProvider`.")]},id:{markdownDescription:c(2487,"Identifier of the view. This should be unique across all views. It is recommended to include your extension id as part of the view id. Use this to register a data provider through `vscode.window.registerTreeDataProviderForView` API. Also to trigger activating your extension by registering `onView:${id}` event to `activationEvents`."),type:"string"},name:{description:c(2488,"The human-readable name of the view. Will be shown"),type:"string"},when:{description:c(2489,"Condition which must be true to show this view"),type:"string"},icon:{description:c(2490,"Path to the view icon. View icons are displayed when the name of the view cannot be shown. It is recommended that icons be in SVG, though any image file type is accepted."),type:"string"},contextualTitle:{description:c(2491,"Human-readable context for when the view is moved out of its original location. By default, the view's container name will be used."),type:"string"},visibility:{description:c(2492,"Initial state of the view when the extension is first installed. Once the user has changed the view state by collapsing, moving, or hiding the view, the initial state will not be used again."),type:"string",enum:["visible","hidden","collapsed"],default:"visible",enumDescriptions:[c(2493,"The default initial state for the view. In most containers the view will be expanded, however; some built-in containers (explorer, scm, and debug) show all contributed views collapsed regardless of the `visibility`."),c(2494,"The view will not be shown in the view container, but will be discoverable through the views menu and other view entry points and can be un-hidden by the user."),c(2495,"The view will show in the view container, but will be collapsed.")]},initialSize:{type:"number",description:c(2496,"The initial size of the view. The size will behave like the css 'flex' property, and will set the initial size when the view is first shown. In the side bar, this is the height of the view. This value is only respected when the same extension owns both the view and the view container.")},accessibilityHelpContent:{type:"string",markdownDescription:c(2497,"When the accessibility help dialog is invoked in this view, this content will be presented to the user as a markdown string. Keybindings will be resolved when provided in the format of <keybinding:commandId>. If there is no keybinding, that will be indicated and this command will be included in a quickpick for easy configuration.")}}},mR={type:"object",required:["id","name"],properties:{id:{description:c(2487,"Identifier of the view. This should be unique across all views. It is recommended to include your extension id as part of the view id. Use this to register a data provider through `vscode.window.registerTreeDataProviderForView` API. Also to trigger activating your extension by registering `onView:${id}` event to `activationEvents`."),type:"string"},name:{description:c(2488,"The human-readable name of the view. Will be shown"),type:"string"},when:{description:c(2489,"Condition which must be true to show this view"),type:"string"},group:{description:c(2498,"Nested group in the viewlet"),type:"string"},remoteName:{description:c(2499,"The name of the remote type associated with this view"),type:["string","array"],items:{type:"string"}}}},wR={description:c(2500,"Contributes views to the editor"),type:"object",properties:{explorer:{description:c(2501,"Contributes views to Explorer container in the Activity bar"),type:"array",items:_r,default:[]},debug:{description:c(2502,"Contributes views to Debug container in the Activity bar"),type:"array",items:_r,default:[]},scm:{description:c(2503,"Contributes views to SCM container in the Activity bar"),type:"array",items:_r,default:[]},test:{description:c(2504,"Contributes views to Test container in the Activity bar"),type:"array",items:_r,default:[]},remote:{description:c(2505,"Contributes views to Remote container in the Activity bar. To contribute to this container, enableProposedApi needs to be turned on"),type:"array",items:mR,default:[]}},additionalProperties:{description:c(2506,"Contributes views to contributed views container"),type:"array",items:_r,default:[]}},Zv=jo.registerExtensionPoint({extensionPoint:"viewsContainers",jsonSchema:fR}),yR=jo.registerExtensionPoint({extensionPoint:"views",deps:[Zv],jsonSchema:wR,activationEventsGenerator:(a,e)=>{for(const t of a)for(const i of Object.values(t))for(const s of i)s.id&&e.push(`onView:${s.id}`)}}),vR=7;var Tn;let Zd=(Tn=class{constructor(e,t){this.instantiationService=e,this.logService=t,this.viewContainersRegistry=z.as(pt.ViewContainersRegistry),this.viewsRegistry=z.as(pt.ViewsRegistry),this.handleAndRegisterCustomViewContainers(),this.handleAndRegisterCustomViews()}handleAndRegisterCustomViewContainers(){Zv.setHandler((e,{added:t,removed:i})=>{i.length&&this.removeCustomViewContainers(i),t.length&&this.addCustomViewContainers(t,this.viewContainersRegistry.all)})}addCustomViewContainers(e,t){const i=z.as(pt.ViewContainersRegistry);let s=vR+i.all.filter(n=>!!n.extensionId&&i.getViewContainerLocation(n)===Y.Sidebar).length,o=5+i.all.filter(n=>!!n.extensionId&&i.getViewContainerLocation(n)===Y.Panel).length+1;for(const{value:n,collector:r,description:d}of e)Object.entries(n).forEach(([l,h])=>{if(this.isValidViewsContainer(h,r))switch(l){case"activitybar":s=this.registerCustomViewContainers(h,d,s,t,Y.Sidebar);break;case"panel":o=this.registerCustomViewContainers(h,d,o,t,Y.Panel);break}})}removeCustomViewContainers(e){const t=z.as(pt.ViewContainersRegistry),i=e.reduce((s,o)=>(s.add(o.description.identifier),s),new bf);for(const s of t.all)if(s.extensionId&&i.has(s.extensionId)){const o=this.viewsRegistry.getViews(s);o.length&&this.viewsRegistry.moveViews(o,this.getDefaultViewContainer()),this.deregisterCustomViewContainer(s)}}isValidViewsContainer(e,t){if(!Array.isArray(e))return t.error(c(2507,"views containers must be an array")),!1;for(const i of e){if(typeof i.id!="string"&&co(i.id))return t.error(c(2508,"property `{0}` is mandatory and must be of type `string` with non-empty value. Only alphanumeric characters, '_', and '-' are allowed.","id")),!1;if(!/^[a-z0-9_-]+$/i.test(i.id))return t.error(c(2508,"property `{0}` is mandatory and must be of type `string` with non-empty value. Only alphanumeric characters, '_', and '-' are allowed.","id")),!1;if(typeof i.title!="string")return t.error(c(2509,"property `{0}` is mandatory and must be of type `string`","title")),!1;if(typeof i.icon!="string")return t.error(c(2509,"property `{0}` is mandatory and must be of type `string`","icon")),!1;if(co(i.title))return t.warn(c(2510,"property `{0}` is mandatory and must be of type `string` with non-empty value","title")),!0}return!0}registerCustomViewContainers(e,t,i,s,o){return e.forEach(n=>{const d=Ce.fromString(n.icon)||is(t.extensionLocation,n.icon),l=`workbench.view.extension.${n.id}`,h=n.title||l,p=this.registerCustomViewContainer(l,h,d,i++,t.identifier,o);if(s.length){const f=[];for(const g of s)p!==g&&f.push(...this.viewsRegistry.getViews(g).filter(m=>m.originalContainerId===n.id));f.length&&this.viewsRegistry.moveViews(f,p)}}),i}registerCustomViewContainer(e,t,i,s,o,n){let r=this.viewContainersRegistry.get(e);return r||(r=this.viewContainersRegistry.registerViewContainer({id:e,title:{value:t,original:t},extensionId:o,ctorDescriptor:new ee(Ea,[e,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,order:s,icon:i},n)),r}deregisterCustomViewContainer(e){this.viewContainersRegistry.deregisterViewContainer(e),z.as(Gi.Viewlets).deregisterPaneComposite(e.id)}handleAndRegisterCustomViews(){yR.setHandler((e,{added:t,removed:i})=>{i.length&&this.removeViews(i),t.length&&this.addViews(t)})}addViews(e){const t=new Set,i=[];for(const s of e){const{value:o,collector:n}=s;Object.entries(o).forEach(([r,d])=>{if(!this.isValidViewDescriptors(d,n))return;if(r==="remote"&&!$l(s.description,"contribViewsRemote")){n.warn(c(2511,`View container '{0}' requires 'enabledApiProposals: ["contribViewsRemote"]' to be added to 'Remote'.`,r));return}const l=this.getViewContainer(r);l||n.warn(c(2512,"View container '{0}' does not exist and all views registered to it will be added to 'Explorer'.",r));const h=l||this.getDefaultViewContainer(),p=[];for(let f=0;f<d.length;f++){const g=d[f];if(t.has(g.id)){n.error(c(2513,"Cannot register multiple views with same id `{0}`",g.id));continue}if(this.viewsRegistry.getView(g.id)!==null){n.error(c(2514,"A view with id `{0}` is already registered.",g.id));continue}const m=ay.equals(s.description.identifier,h.extensionId)?f+1:h.viewOrderDelegate?h.viewOrderDelegate.getOrder(g.group):void 0;let v;typeof g.icon=="string"&&(v=Ce.fromString(g.icon)||is(s.description.extensionLocation,g.icon));const C=this.convertInitialVisibility(g.visibility),T=this.getViewType(g.type);if(!T){n.error(c(2515,"Unknown view type `{0}`.",g.type));continue}let B;typeof g.initialSize=="number"&&(h.extensionId?.value===s.description.identifier.value?B=g.initialSize:this.logService.warn(`${s.description.identifier.value} tried to set the view size of ${g.id} but it was ignored because the view container does not belong to it.`));let V;$l(s.description,"contribAccessibilityHelpContent")&&g.accessibilityHelpContent&&(V=new wi(g.accessibilityHelpContent));const U={type:T,ctorDescriptor:T===Ts.Tree?new ee(Nu):new ee(Ju),id:g.id,name:{value:g.name,original:g.name},when:I.deserialize(g.when),containerIcon:v||l?.icon,containerTitle:g.contextualTitle||l&&(typeof l.title=="string"?l.title:l.title.value),canToggleVisibility:!0,canMoveView:l?.id!==Nl,treeView:T===Ts.Tree?this.instantiationService.createInstance(Wu,g.id,g.name,s.description.identifier.value):void 0,collapsed:this.showCollapsed(h)||C===gn.Collapsed,order:m,extensionId:s.description.identifier,originalContainerId:r,group:g.group,remoteAuthority:g.remoteName||g.remoteAuthority,virtualWorkspace:g.virtualWorkspace,hideByDefault:C===gn.Hidden,workspace:l?.id===Nl?!0:void 0,weight:B,accessibilityHelpContent:V};t.add(U.id),p.push(U)}i.push({viewContainer:h,views:p})})}this.viewsRegistry.registerViews2(i)}getViewType(e){if(e===Ts.Webview)return Ts.Webview;if(!e||e===Ts.Tree)return Ts.Tree}getDefaultViewContainer(){return this.viewContainersRegistry.get(Wr)}removeViews(e){const t=e.reduce((i,s)=>(i.add(s.description.identifier),i),new bf);for(const i of this.viewContainersRegistry.all){const s=this.viewsRegistry.getViews(i).filter(o=>o.extensionId&&t.has(o.extensionId));if(s.length){this.viewsRegistry.deregisterViews(s,i);for(const o of s){const n=o;n.treeView&&n.treeView.dispose()}}}}convertInitialVisibility(e){if(Object.values(gn).includes(e))return e}isValidViewDescriptors(e,t){if(!Array.isArray(e))return t.error(c(2516,"views must be an array")),!1;for(const i of e){if(typeof i.id!="string")return t.error(c(2509,"property `{0}` is mandatory and must be of type `string`","id")),!1;if(typeof i.name!="string")return t.error(c(2509,"property `{0}` is mandatory and must be of type `string`","name")),!1;if(i.when&&typeof i.when!="string")return t.error(c(2517,"property `{0}` can be omitted or must be of type `string`","when")),!1;if(i.icon&&typeof i.icon!="string")return t.error(c(2517,"property `{0}` can be omitted or must be of type `string`","icon")),!1;if(i.contextualTitle&&typeof i.contextualTitle!="string")return t.error(c(2517,"property `{0}` can be omitted or must be of type `string`","contextualTitle")),!1;if(i.visibility&&!this.convertInitialVisibility(i.visibility))return t.error(c(2518,"property `{0}` can be omitted or must be one of {1}","visibility",Object.values(gn).join(", "))),!1}return!0}getViewContainer(e){switch(e){case"explorer":return this.viewContainersRegistry.get(Wr);case"debug":return this.viewContainersRegistry.get(Cf);case"scm":return this.viewContainersRegistry.get(bm);case"remote":return this.viewContainersRegistry.get(Nl);default:return this.viewContainersRegistry.get(`workbench.view.extension.${e}`)}}showCollapsed(e){switch(e.id){case Wr:case bm:case Cf:return!0}return!1}},Tn.ID="workbench.contrib.viewsExtensionHandler",Tn);Zd=D([u(0,F),u(1,Ue)],Zd);class bR extends R{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.viewsContainers}render(e){const t=e.contributes?.viewsContainers||{},i=Object.keys(t).reduce((n,r)=>{const d=t[r];return n.push(...d.map(l=>({...l,location:r}))),n},[]);if(!i.length)return{data:{headers:[],rows:[]},dispose:()=>{}};const s=[c(2519,"ID"),c(2520,"Title"),c(2521,"Where")],o=i.sort((n,r)=>n.id.localeCompare(r.id)).map(n=>[n.id,n.title,n.location]);return{data:{headers:s,rows:o},dispose:()=>{}}}}class CR extends R{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.views}render(e){const t=e.contributes?.views||{},i=Object.keys(t).reduce((n,r)=>{const d=t[r];return n.push(...d.map(l=>({...l,location:r}))),n},[]);if(!i.length)return{data:{headers:[],rows:[]},dispose:()=>{}};const s=[c(2522,"ID"),c(2523,"Name"),c(2521,"Where")],o=i.sort((n,r)=>n.id.localeCompare(r.id)).map(n=>[n.id,n.name,n.location]);return{data:{headers:s,rows:o},dispose:()=>{}}}}z.as(Dc.ExtensionFeaturesRegistry).registerExtensionFeature({id:"viewsContainers",label:c(2524,"View Containers"),access:{canToggle:!1},renderer:new ee(bR)});z.as(Dc.ExtensionFeaturesRegistry).registerExtensionFeature({id:"views",label:c(2525,"Views"),access:{canToggle:!1},renderer:new ee(CR)});yt(Zd.ID,Zd,vt.BlockStartup);class Xv extends dy{constructor(){super(...arguments),this.editorControl=void 0}get scopedContextKeyService(){return this.editorControl?.invokeWithinContext(e=>e.get(se))}getTitle(){return this.input?this.input.getName():c(3349,"Text Editor")}createEditorControl(e,t){this.editorControl=this._register(this.instantiationService.createInstance(cy,e,t,this.getCodeEditorWidgetOptions()))}getCodeEditorWidgetOptions(){return Object.create(null)}updateEditorControlOptions(e){this.editorControl?.updateOptions(e)}getMainControl(){return this.editorControl}getControl(){return this.editorControl}computeEditorViewState(e){if(!this.editorControl)return;const t=this.editorControl.getModel();if(!t)return;const i=t.uri;if(i&&dt(i,e))return this.editorControl.saveViewState()??void 0}setOptions(e){super.setOptions(e),e&&La(e,Ee(this.editorControl),ft.Smooth)}focus(){super.focus(),this.editorControl?.focus()}hasFocus(){return this.editorControl?.hasTextFocus()||super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e),e?this.editorControl?.onVisible():this.editorControl?.onHide()}layout(e){this.editorControl?.layout(e)}}var Zu;let Xu=class extends Xv{constructor(e,t,i,s,o,n,r,d,l,h){super(e,t,i,s,o,n,r,l,d,h)}async setInput(e,t,i,s){await super.setInput(e,t,i,s);const o=await e.resolve();if(s.isCancellationRequested)return;if(!(o instanceof vE))throw new Error("Unable to open file as text");const n=Ee(this.editorControl),r=o.textEditorModel;if(n.setModel(r),!ly(t?.viewState)){const d=this.loadEditorViewState(e,i);d&&(t?.selection&&(d.cursorState=[]),n.restoreViewState(d))}t&&La(t,n,ft.Immediate),n.updateOptions(this.getReadonlyConfiguration(o.isReadonly()))}revealLastLine(){const e=this.editorControl;if(!e)return;const t=e.getModel();if(t){const i=t.getLineCount();e.revealPosition({lineNumber:i,column:t.getLineMaxColumn(i)},ft.Smooth)}}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}tracksEditorViewState(e){return e instanceof Hi||e instanceof hy}};Xu=D([u(2,mt),u(3,F),u(4,ce),u(5,pr),u(6,me),u(7,Je),u(8,Q),u(9,Le)],Xu);var Lo;let Xd=(Lo=class extends Xu{constructor(e,t,i,s,o,n,r,d,l,h,p){super(Zu.ID,e,t,i,s,o,n,d,r,p),this.modelService=l,this.languageService=h}createEditorControl(e,t){super.createEditorControl(e,t);const i=this.editorControl;i&&this._register(i.onDidPaste(s=>this.onDidEditorPaste(s,i)))}onDidEditorPaste(e,t){if(this.input instanceof Hi&&this.input.hasLanguageSetExplicitly||e.range.startLineNumber!==1||e.range.startColumn!==1||t.getOption(Mt.readOnly))return;const i=t.getModel();if(!i||!(i.getLineCount()===e.range.endLineNumber&&i.getLineMaxColumn(e.range.endLineNumber)===e.range.endColumn)||i.getLanguageId()!==Td)return;let n;if(e.languageId)n={id:e.languageId,source:"event"};else{const r=this.languageService.guessLanguageIdByFilepathOrFirstLine(i.uri,i.getLineContent(1).substr(0,yE.FIRST_LINE_DETECTION_LENGTH_LIMIT))??void 0;r&&(n={id:r,source:"guess"})}if(n&&n.id!==Td){this.input instanceof Hi&&n.source==="event"?this.input.setLanguageId(n.id):i.setLanguage(this.languageService.createById(n.id));const r=this.modelService.getCreationOptions(i.getLanguageId(),i.uri,i.isForSimpleWidget);i.detectIndentation(r.insertSpaces,r.tabSize)}}},Zu=Lo,Lo.ID="workbench.editors.textResourceEditor",Lo);Xd=Zu=D([u(1,mt),u(2,F),u(3,ce),u(4,pr),u(5,me),u(6,Q),u(7,Je),u(8,Oc),u(9,ar),u(10,Le)],Xd);let rs=class extends bE{constructor(e,t,i,s,o,n){super(e,t,s,o,n),this.callbacks=i,this._onDidChangeMetadata=this._register(new E),this.onDidChangeMetadata=this._onDidChangeMetadata.event,this._onDidOpenInPlace=this._register(new E),this.onDidOpenInPlace=this._onDidOpenInPlace.event}getTitle(){return this.input?this.input.getName():c(2909,"Binary Viewer")}async getContents(e,t){const i=await e.resolve();if(!(i instanceof uy))throw new Error("Unable to open file as binary");const s=i.getSize();return this.handleMetadataChanged(typeof s=="number"?Zp.formatSize(s):""),{icon:"$(warning)",label:c(2910,"The file is not displayed in the text editor because it is either binary or uses an unsupported text encoding."),actions:[{label:c(2911,"Open Anyway"),run:async()=>{await this.callbacks.openInternal(e,t),this._onDidOpenInPlace.fire()}}]}}handleMetadataChanged(e){this.metadata=e,this._onDidChangeMetadata.fire()}getMetadata(){return this.metadata}};rs=D([u(5,ce)],rs);var xn;let mo=(xn=class extends oh{constructor(e,t,i,s,o,n,r,d,l){super(e,t,i,s,o,n,r,d,l)}getMetadata(){const e=this.getPrimaryEditorPane(),t=this.getSecondaryEditorPane();if(e instanceof rs&&t instanceof rs)return c(2908,"{0} ↔ {1}",t.getMetadata(),e.getMetadata())}},xn.ID=CE,xn);mo=D([u(1,mt),u(2,F),u(3,me),u(4,ce),u(5,ie),u(6,pr),u(7,Q),u(8,Je)],mo);const SR=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Qu;Pe(SR);class _R{constructor(e,t){this.primary=e,this.secondary=t}getEncoding(){return this.primary.getEncoding()}async setEncoding(e,t){await xp.settled([this.primary,this.secondary].map(i=>i.setEncoding(e,t)))}}class ER{constructor(e,t){this.primary=e,this.secondary=t}setLanguageId(e,t){[this.primary,this.secondary].forEach(i=>i.setLanguageId(e,t))}}function ya(a){if(a instanceof Hi)return a;if(a instanceof Ia){const t=ya(a.primary),i=ya(a.secondary);return t&&i?new _R(t,i):t}const e=a;return OE(e.setEncoding,e.getEncoding)?e:null}function Qd(a){if(a instanceof Hi)return a;if(a instanceof Ia){const t=Qd(a.primary),i=Qd(a.secondary);return t&&i?new ER(t,i):t}const e=a;return typeof e.setLanguageId=="function"?e:null}class IR{constructor(){this.indentation=!1,this.selectionStatus=!1,this.languageId=!1,this.languageStatus=!1,this.encoding=!1,this.EOL=!1,this.tabFocusMode=!1,this.inputMode=!1,this.columnSelectionMode=!1,this.metadata=!1}combine(e){this.indentation=this.indentation||e.indentation,this.selectionStatus=this.selectionStatus||e.selectionStatus,this.languageId=this.languageId||e.languageId,this.languageStatus=this.languageStatus||e.languageStatus,this.encoding=this.encoding||e.encoding,this.EOL=this.EOL||e.EOL,this.tabFocusMode=this.tabFocusMode||e.tabFocusMode,this.inputMode=this.inputMode||e.inputMode,this.columnSelectionMode=this.columnSelectionMode||e.columnSelectionMode,this.metadata=this.metadata||e.metadata}hasChanges(){return this.indentation||this.selectionStatus||this.languageId||this.languageStatus||this.encoding||this.EOL||this.tabFocusMode||this.inputMode||this.columnSelectionMode||this.metadata}}class DR{get selectionStatus(){return this._selectionStatus}get languageId(){return this._languageId}get encoding(){return this._encoding}get EOL(){return this._EOL}get indentation(){return this._indentation}get tabFocusMode(){return this._tabFocusMode}get inputMode(){return this._inputMode}get columnSelectionMode(){return this._columnSelectionMode}get metadata(){return this._metadata}update(e){const t=new IR;switch(e.type){case"selectionStatus":this._selectionStatus!==e.selectionStatus&&(this._selectionStatus=e.selectionStatus,t.selectionStatus=!0);break;case"indentation":this._indentation!==e.indentation&&(this._indentation=e.indentation,t.indentation=!0);break;case"languageId":this._languageId!==e.languageId&&(this._languageId=e.languageId,t.languageId=!0);break;case"encoding":this._encoding!==e.encoding&&(this._encoding=e.encoding,t.encoding=!0);break;case"EOL":this._EOL!==e.EOL&&(this._EOL=e.EOL,t.EOL=!0);break;case"tabFocusMode":this._tabFocusMode!==e.tabFocusMode&&(this._tabFocusMode=e.tabFocusMode,t.tabFocusMode=!0);break;case"inputMode":this._inputMode!==e.inputMode&&(this._inputMode=e.inputMode,t.inputMode=!0);break;case"columnSelectionMode":this._columnSelectionMode!==e.columnSelectionMode&&(this._columnSelectionMode=e.columnSelectionMode,t.columnSelectionMode=!0);break;case"metadata":this._metadata!==e.metadata&&(this._metadata=e.metadata,t.metadata=!0);break}return t}}let ep=class extends R{constructor(e){super(),this.configurationService=e,this._onDidChange=this._register(new E),this.onDidChange=this._onDidChange.event,this.registerListeners();const t=e.getValue("editor.tabFocusMode")===!0;Dl.setTabFocusMode(t)}registerListeners(){this._register(Dl.onDidChangeTabFocus(e=>this._onDidChange.fire(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration("editor.tabFocusMode")){const t=this.configurationService.getValue("editor.tabFocusMode")===!0;Dl.setTabFocusMode(t),this._onDidChange.fire(t)}}))}};ep=D([u(0,ie)],ep);class AR extends R{constructor(){super(),this._onDidChange=this._register(new E),this.onDidChange=this._onDidChange.event,If.setInputMode("insert"),this._register(If.onDidChangeInputMode(e=>this._onDidChange.fire(e)))}}const TR=c(3288,"Ln {0}, Col {1} ({2} selected)"),xR=c(3289,"Ln {0}, Col {1}"),kR=c(3290,"{0} selections ({1} characters selected)"),RR=c(3291,"{0} selections"),Qv=c(3292,"LF"),eb=c(3293,"CRLF");let tp=class extends R{constructor(e,t,i,s,o,n,r,d){super(),this.targetWindowId=e,this.editorService=t,this.quickInputService=i,this.languageService=s,this.textFileService=o,this.statusbarService=n,this.configurationService=d,this.tabFocusModeElement=this._register(new Ie),this.inputModeElement=this._register(new Ie),this.columnSelectionModeElement=this._register(new Ie),this.indentationElement=this._register(new Ie),this.selectionElement=this._register(new Ie),this.encodingElement=this._register(new Ie),this.eolElement=this._register(new Ie),this.languageElement=this._register(new Ie),this.metadataElement=this._register(new Ie),this.state=new DR,this.toRender=void 0,this.activeEditorListeners=this._register(new O),this.delayedRender=this._register(new Ie),this.currentMarkerStatus=this._register(r.createInstance(ip)),this.tabFocusMode=this._register(r.createInstance(ep)),this.inputMode=this._register(r.createInstance(AR)),this.registerCommands(),this.registerListeners()}registerListeners(){this._register(this.editorService.onDidActiveEditorChange(()=>this.updateStatusBar())),this._register(this.textFileService.untitled.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(this.textFileService.files.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(L.runAndSubscribe(this.tabFocusMode.onDidChange,e=>{e!==void 0?this.onTabFocusModeChange(e):this.onTabFocusModeChange(this.configurationService.getValue("editor.tabFocusMode"))})),this._register(L.runAndSubscribe(this.inputMode.onDidChange,e=>this.onInputModeChange(e??"insert")))}registerCommands(){this._register(Te.registerCommand({id:`changeEditorIndentation${this.targetWindowId}`,handler:()=>this.showIndentationPicker()}))}async showIndentationPicker(){const e=mi(this.editorService.activeTextEditorControl);if(!e)return this.quickInputService.pick([{label:c(3294,"No text editor active at this time")}]);if(this.editorService.activeEditor?.isReadonly())return this.quickInputService.pick([{label:c(3295,"The active code editor is read-only.")}]);const t=[Ee(e.getAction(AE.ID)),Ee(e.getAction(TE.ID)),Ee(e.getAction(xE.ID)),Ee(e.getAction(kE.ID)),Ee(e.getAction(RE.ID)),Ee(e.getAction(LE.ID)),Ee(e.getAction(VE.ID))].map(s=>({id:s.id,label:s.label,detail:py.isDefaultVariant()||s.label===s.alias?void 0:s.alias,run:()=>{e.focus(),s.run()}}));return t.splice(3,0,{type:"separator",label:c(3296,"convert file")}),t.unshift({type:"separator",label:c(3297,"change view")}),(await this.quickInputService.pick(t,{placeHolder:c(3298,"Select Action"),matchOnDetail:!0}))?.run()}updateTabFocusModeElement(e){if(e){if(!this.tabFocusModeElement.value){const t=c(3299,"Tab Moves Focus");this.tabFocusModeElement.value=this.statusbarService.addEntry({name:c(3300,"Accessibility Mode"),text:t,ariaLabel:t,tooltip:c(3301,"Disable Accessibility Mode"),command:"editor.action.toggleTabFocusMode",kind:"prominent"},"status.editor.tabFocusMode",et.RIGHT,100.7)}}else this.tabFocusModeElement.clear()}updateInputModeElement(e){if(e==="overtype"){if(!this.inputModeElement.value){const t=c(3302,"OVR"),i=c(3303,"Enable Insert Mode");this.inputModeElement.value=this.statusbarService.addEntry({name:i,text:t,ariaLabel:t,tooltip:i,command:"editor.action.toggleOvertypeInsertMode",kind:"prominent"},"status.editor.inputMode",et.RIGHT,100.6)}}else this.inputModeElement.clear()}updateColumnSelectionModeElement(e){if(e){if(!this.columnSelectionModeElement.value){const t=c(3304,"Column Selection");this.columnSelectionModeElement.value=this.statusbarService.addEntry({name:c(3305,"Column Selection Mode"),text:t,ariaLabel:t,tooltip:c(3306,"Disable Column Selection Mode"),command:"editor.action.toggleColumnSelection",kind:"prominent"},"status.editor.columnSelectionMode",et.RIGHT,100.8)}}else this.columnSelectionModeElement.clear()}updateSelectionElement(e){if(!e){this.selectionElement.clear();return}if(mi(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===pe.vscodeNotebookCell){this.selectionElement.clear();return}const i={name:c(3307,"Editor Selection"),text:e,ariaLabel:e,tooltip:c(3308,"Go to Line/Column"),command:"workbench.action.gotoLine"};this.updateElement(this.selectionElement,i,"status.editor.selection",et.RIGHT,100.5)}updateIndentationElement(e){if(!e){this.indentationElement.clear();return}if(mi(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===pe.vscodeNotebookCell){this.indentationElement.clear();return}const i={name:c(3309,"Editor Indentation"),text:e,ariaLabel:e,tooltip:c(3310,"Select Indentation"),command:`changeEditorIndentation${this.targetWindowId}`};this.updateElement(this.indentationElement,i,"status.editor.indentation",et.RIGHT,100.4)}updateEncodingElement(e){if(!e){this.encodingElement.clear();return}const t={name:c(3311,"Editor Encoding"),text:e,ariaLabel:e,tooltip:c(3312,"Select Encoding"),command:"workbench.action.editor.changeEncoding"};this.updateElement(this.encodingElement,t,"status.editor.encoding",et.RIGHT,100.3)}updateEOLElement(e){if(!e){this.eolElement.clear();return}const t={name:c(3313,"Editor End of Line"),text:e,ariaLabel:e,tooltip:c(3314,"Select End of Line Sequence"),command:"workbench.action.editor.changeEOL"};this.updateElement(this.eolElement,t,"status.editor.eol",et.RIGHT,100.2)}updateLanguageIdElement(e){if(!e){this.languageElement.clear();return}const t={name:c(3315,"Editor Language"),text:e,ariaLabel:e,tooltip:c(3316,"Select Language Mode"),command:"workbench.action.editor.changeLanguageMode"};this.updateElement(this.languageElement,t,"status.editor.mode",et.RIGHT,100.1)}updateMetadataElement(e){if(!e){this.metadataElement.clear();return}const t={name:c(3317,"File Information"),text:e,ariaLabel:e,tooltip:c(3318,"File Information")};this.updateElement(this.metadataElement,t,"status.editor.info",et.RIGHT,100)}updateElement(e,t,i,s,o){e.value?e.value.update(t):e.value=this.statusbarService.addEntry(t,i,s,o)}updateState(e){const t=this.state.update(e);t.hasChanges()&&(this.toRender?this.toRender.combine(t):(this.toRender=t,this.delayedRender.value=PE(Lc(this.targetWindowId,!0).window,()=>{this.delayedRender.clear();const i=this.toRender;this.toRender=void 0,i&&this.doRenderNow()})))}doRenderNow(){this.updateTabFocusModeElement(!!this.state.tabFocusMode),this.updateInputModeElement(this.state.inputMode),this.updateColumnSelectionModeElement(!!this.state.columnSelectionMode),this.updateIndentationElement(this.state.indentation),this.updateSelectionElement(this.state.selectionStatus),this.updateEncodingElement(this.state.encoding),this.updateEOLElement(this.state.EOL?this.state.EOL===`\r
|
|
40
|
+
`?eb:Qv:void 0),this.updateLanguageIdElement(this.state.languageId),this.updateMetadataElement(this.state.metadata)}getSelectionLabel(e){if(!(!e||!e.selections)){if(e.selections.length===1)return e.charactersSelected?Ar(TR,e.selections[0].positionLineNumber,e.selections[0].positionColumn,e.charactersSelected):Ar(xR,e.selections[0].positionLineNumber,e.selections[0].positionColumn);if(e.charactersSelected)return Ar(kR,e.selections.length,e.charactersSelected);if(e.selections.length>0)return Ar(RR,e.selections.length)}}updateStatusBar(){const e=this.editorService.activeEditor,t=this.editorService.activeEditorPane,i=t?mi(t.getControl())??void 0:void 0;if(this.onColumnSelectionModeChange(i),this.onSelectionChange(i),this.onLanguageChange(i,e),this.onEOLChange(i),this.onEncodingChange(t,i),this.onIndentationChange(i),this.onMetadataChange(t),this.currentMarkerStatus.update(i),this.activeEditorListeners.clear(),t&&this.activeEditorListeners.add(t.onDidChangeControl(()=>{this.updateStatusBar()})),i)this.activeEditorListeners.add(i.onDidChangeConfiguration(s=>{s.hasChanged(Mt.columnSelection)&&this.onColumnSelectionModeChange(i)})),this.activeEditorListeners.add(L.defer(i.onDidChangeCursorPosition)(()=>{this.onSelectionChange(i),this.currentMarkerStatus.update(i)})),this.activeEditorListeners.add(i.onDidChangeModelLanguage(()=>{this.onLanguageChange(i,e)})),this.activeEditorListeners.add(L.accumulate(i.onDidChangeModelContent)(s=>{this.onEOLChange(i),this.currentMarkerStatus.update(i);const o=i.getSelections();if(o){for(const n of s)for(const r of n.changes)if(o.some(d=>ve.areIntersecting(d,r.range))){this.onSelectionChange(i);break}}})),this.activeEditorListeners.add(i.onDidChangeModelOptions(()=>{this.onIndentationChange(i)}));else if(t instanceof rs||t instanceof mo){const s=[];if(t instanceof mo){const o=t.getPrimaryEditorPane();o instanceof rs&&s.push(o);const n=t.getSecondaryEditorPane();n instanceof rs&&s.push(n)}else s.push(t);for(const o of s)this.activeEditorListeners.add(o.onDidChangeMetadata(()=>{this.onMetadataChange(t)})),this.activeEditorListeners.add(o.onDidOpenInPlace(()=>{this.updateStatusBar()}))}}onLanguageChange(e,t){const i={type:"languageId",languageId:void 0};if(e&&t&&Qd(t)){const s=e.getModel();if(s){const o=s.getLanguageId();i.languageId=this.languageService.getLanguageName(o)??void 0}}this.updateState(i)}onIndentationChange(e){const t={type:"indentation",indentation:void 0};if(e){const i=e.getModel();if(i){const s=i.getOptions();t.indentation=s.insertSpaces?s.tabSize===s.indentSize?c(3319,"Spaces: {0}",s.indentSize):c(3320,"Spaces: {0} (Tab Size: {1})",s.indentSize,s.tabSize):c(3321,"Tab Size: {0}",s.tabSize)}}this.updateState(t)}onMetadataChange(e){const t={type:"metadata",metadata:void 0};(e instanceof rs||e instanceof mo)&&(t.metadata=e.getMetadata()),this.updateState(t)}onColumnSelectionModeChange(e){const t={type:"columnSelectionMode",columnSelectionMode:!1};e?.getOption(Mt.columnSelection)&&(t.columnSelectionMode=!0),this.updateState(t)}onSelectionChange(e){const t=Object.create(null);if(e){t.selections=e.getSelections()||[],t.charactersSelected=0;const i=e.getModel();if(i)for(const s of t.selections)typeof t.charactersSelected!="number"&&(t.charactersSelected=0),t.charactersSelected+=i.getCharacterCountInRange(s);if(t.selections.length===1){const s=e.getPosition(),o=new gy(t.selections[0].selectionStartLineNumber,t.selections[0].selectionStartColumn,t.selections[0].positionLineNumber,s?e.getStatusbarColumn(s):t.selections[0].positionColumn);t.selections[0]=o}}this.updateState({type:"selectionStatus",selectionStatus:this.getSelectionLabel(t)})}onEOLChange(e){const t={type:"EOL",EOL:void 0};if(e&&!e.getOption(Mt.readOnly)){const i=e.getModel();i&&(t.EOL=i.getEOL())}this.updateState(t)}onEncodingChange(e,t){if(e&&!this.isActiveEditor(e))return;const i={type:"encoding",encoding:void 0};if(e&&t?.hasModel()){const s=e.input?ya(e.input):null;if(s){const o=s.getEncoding(),n=typeof o=="string"?Zi[o]:void 0;n?i.encoding=n.labelShort:i.encoding=o}}this.updateState(i)}onResourceEncodingChange(e){const t=this.editorService.activeEditorPane;if(t){const i=Bt.getCanonicalUri(t.input,{supportSideBySide:Ni.PRIMARY});if(i&&dt(i,e)){const s=mi(t.getControl())??void 0;return this.onEncodingChange(t,s)}}}onTabFocusModeChange(e){const t={type:"tabFocusMode",tabFocusMode:e};this.updateState(t)}onInputModeChange(e){const t={type:"inputMode",inputMode:e};this.updateState(t)}isActiveEditor(e){const t=this.editorService.activeEditorPane;return!!t&&t===e}};tp=D([u(1,Q),u(2,Xt),u(3,ar),u(4,hr),u(5,Ui),u(6,F),u(7,ie)],tp);var kn;let ec=(kn=class extends R{constructor(e){super(),this.editorGroupService=e;for(const t of e.parts)this.createEditorStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createEditorStatus(t)))}createEditorStatus(e){const t=new O;L.once(e.onWillDispose)(()=>t.dispose());const i=this.editorGroupService.getScopedInstantiationService(e);t.add(i.createInstance(tp,e.windowId))}},kn.ID="workbench.contrib.editorStatus",kn);ec=D([u(0,Je)],ec);let ip=class extends R{constructor(e,t,i){super(),this.statusbarService=e,this.markerService=t,this.configurationService=i,this.editor=void 0,this.markers=[],this.currentMarker=null,this.statusBarEntryAccessor=this._register(new Ie),this._register(t.onMarkerChanged(s=>this.onMarkerChanged(s))),this._register(L.filter(i.onDidChangeConfiguration,s=>s.affectsConfiguration("problems.showCurrentInStatus"))(()=>this.updateStatus()))}update(e){this.editor=e,this.updateMarkers(),this.updateStatus()}updateStatus(){const e=this.currentMarker;if(this.currentMarker=this.getMarker(),this.hasToUpdateStatus(e,this.currentMarker))if(this.currentMarker){const t=ME(this.currentMarker.message)[0],i=`${this.getType(this.currentMarker)} ${t}`;this.statusBarEntryAccessor.value?this.statusBarEntryAccessor.value.update({name:c(3322,"Current Problem"),text:i,ariaLabel:i}):this.statusBarEntryAccessor.value=this.statusbarService.addEntry({name:c(3322,"Current Problem"),text:i,ariaLabel:i},"statusbar.currentProblem",et.LEFT)}else this.statusBarEntryAccessor.clear()}hasToUpdateStatus(e,t){return!t||!e?!0:Ef.makeKey(e)!==Ef.makeKey(t)}getType(e){switch(e.severity){case eo.Error:return"$(error)";case eo.Warning:return"$(warning)";case eo.Info:return"$(info)"}return""}getMarker(){if(!this.configurationService.getValue("problems.showCurrentInStatus")||!this.editor||!this.editor.getModel())return null;const t=this.editor.getPosition();return t&&this.markers.find(i=>ve.containsPosition(i,t))||null}onMarkerChanged(e){if(!this.editor)return;const t=this.editor.getModel();t&&(t&&!e.some(i=>dt(t.uri,i))||this.updateMarkers())}updateMarkers(){if(!this.editor)return;const e=this.editor.getModel();e&&(e?(this.markers=this.markerService.read({resource:e.uri,severities:eo.Error|eo.Warning|eo.Info}),this.markers.sort(this.compareMarker)):this.markers=[],this.updateStatus())}compareMarker(e,t){let i=Bc(e.resource.toString(),t.resource.toString());return i===0&&(i=eo.compare(e.severity,t.severity)),i===0&&(i=ve.compareRangesUsingStarts(e,t)),i}};ip=D([u(0,Ui),u(1,SE),u(2,ie)],ip);var Vo;let sp=(Vo=class extends _t{constructor(e,t,i){super(Qu.ID,c(3323,"Search Marketplace Extensions for '{0}'...",e)),this.fileExtension=e,this.commandService=t,this.enabled=i.isEnabled()}async run(){await this.commandService.executeCommand("workbench.extensions.action.showExtensionsForLanguage",this.fileExtension)}},Qu=Vo,Vo.ID="workbench.action.showLanguageExtensions",Vo);sp=Qu=D([u(1,wt),u(2,_E)],sp);const Qr=class Qr extends X{constructor(){super({id:Qr.ID,title:x(3324,"Change Language Mode"),f1:!0,keybinding:{weight:G.WorkbenchContrib,primary:Jw(N.CtrlCmd|y.KeyK,y.KeyM)},precondition:I.not("notebookEditorFocused"),metadata:{description:c(3325,"Change the language mode of the active text editor."),args:[{name:c(3326,"The name of the language mode to change to."),constraint:e=>typeof e=="string"}]}})}async run(e,t){const i=e.get(Xt),s=e.get(Q),o=e.get(ar),n=e.get(EE),r=e.get(hr),d=e.get(zc),l=e.get(F),h=e.get(ie),p=e.get(mt),f=mi(s.activeTextEditorControl);if(!f){await i.pick([{label:c(3294,"No text editor active at this time")}]);return}const g=f.getModel(),m=Bt.getOriginalUri(s.activeEditor,{supportSideBySide:Ni.PRIMARY});let v,C;g&&(C=g.getLanguageId(),v=o.getLanguageName(C)??void 0);let T=!!m;m?.scheme===pe.untitled&&!r.untitled.get(m)?.hasAssociatedFilePath&&(T=!1);const V=o.getSortedRegisteredLanguageNames().map(({languageName:bt,languageId:lt})=>{const Ti=o.getExtensions(lt).join(" ");let $e;return v===bt?$e=c(3327,"({0}) - Configured Language",lt):$e=c(3328,"({0})",lt),{label:bt,meta:Ti,iconClasses:Sf(lt),description:$e}});V.unshift({type:"separator",label:c(3329,"languages (identifier)")});let U,W,K;if(T&&m){const bt=Pi(m)||us(m);K=l.createInstance(sp,bt),K.enabled&&V.unshift(K),W={label:c(3330,"Configure '{0}' language based settings...",v)},V.unshift(W),U={label:c(3331,"Configure File Association for '{0}'...",bt)},V.unshift(U)}const j={label:c(3332,"Auto Detect")};V.unshift(j);const oe=typeof t=="string"?{label:t}:await i.pick(V,{placeHolder:c(3333,"Select Language Mode"),matchOnDescription:!0});if(!oe)return;if(oe===K){K.run();return}if(oe===U){m&&this.configureFileAssociation(m,o,i,h);return}if(oe===W){d.openUserSettings({jsonEditor:!0,revealSetting:{key:`[${C??null}]`,edit:!0}});return}const Me=s.activeEditor;if(Me){const bt=Qd(Me);if(bt){let lt,Ti;if(oe===j){if(g){const $e=Bt.getOriginalUri(Me,{supportSideBySide:Ni.PRIMARY});if($e){let Qt=o.guessLanguageIdByFilepathOrFirstLine($e,g.getLineContent(1))??void 0;(!Qt||Qt==="unknown")&&(Ti=await n.detectLanguage($e),Qt=Ti),Qt&&(lt=o.createById(Qt))}}}else{const $e=o.getLanguageIdByLanguageName(oe.label);lt=o.createById($e),m&&n.detectLanguage(m).then(Qt=>{const st=o.getLanguageIdByLanguageName(oe.label)||"unknown";if(Qt===C&&C!==st){const db=h.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";p.publicLog2(IE,{currentLanguageId:v??"unknown",nextLanguageId:oe.label,lineCount:g?.getLineCount()??-1,modelPreference:db})}})}if(typeof lt<"u"&&(bt.setLanguageId(lt.languageId,Qr.ID),m?.scheme===pe.untitled)){const $e=h.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";p.publicLog2("setUntitledDocumentLanguage",{to:lt.languageId,from:C??"none",modelPreference:$e})}}f.focus()}}configureFileAssociation(e,t,i,s){const o=Pi(e),n=us(e),r=t.guessLanguageIdByFilepathOrFirstLine($.file(n)),l=t.getSortedRegisteredLanguageNames().map(({languageName:h,languageId:p})=>({id:p,label:h,iconClasses:Sf(p),description:p===r?c(3334,"Current Association"):void 0}));setTimeout(async()=>{const h=await i.pick(l,{placeHolder:c(3335,"Select Language Mode to Associate with '{0}'",o||n)});if(h){const p=s.inspect(_f);let f;o&&n[0]!=="."?f=`*${o}`:f=n;let g=Qe.USER;p.workspaceValue&&p.workspaceValue[f]&&(g=Qe.WORKSPACE);const m=DE(g===Qe.WORKSPACE?p.workspaceValue:p.userValue)||Object.create(null);m[f]=h.id,s.updateValue(_f,m,g)}},50)}};Qr.ID="workbench.action.editor.changeLanguageMode";let op=Qr;class LR extends X{constructor(){super({id:"workbench.action.editor.changeEOL",title:x(3336,"Change End of Line Sequence"),f1:!0})}async run(e){const t=e.get(Q),i=e.get(Xt),s=mi(t.activeTextEditorControl);if(!s){await i.pick([{label:c(3294,"No text editor active at this time")}]);return}if(t.activeEditor?.isReadonly()){await i.pick([{label:c(3295,"The active code editor is read-only.")}]);return}let o=s.getModel();const n=[{label:Qv,eol:Df.LF},{label:eb,eol:Df.CRLF}],r=o?.getEOL()===`
|
|
41
|
+
`?0:1,d=await i.pick(n,{placeHolder:c(3337,"Select End of Line Sequence"),activeItem:n[r]});if(d){const l=mi(t.activeTextEditorControl);l?.hasModel()&&!t.activeEditor?.isReadonly()&&(o=l.getModel(),o.pushStackElement(),o.pushEOL(d.eol),o.pushStackElement())}s.focus()}}class VR extends X{constructor(){super({id:"workbench.action.editor.changeEncoding",title:x(3338,"Change File Encoding"),f1:!0})}async run(e){const t=e.get(Q),i=e.get(Xt),s=e.get(Le),o=e.get(hr),n=e.get(pr),r=mi(t.activeTextEditorControl);if(!r){await i.pick([{label:c(3294,"No text editor active at this time")}]);return}const d=t.activeEditorPane;if(!d){await i.pick([{label:c(3294,"No text editor active at this time")}]);return}const l=ya(d.input);if(!l){await i.pick([{label:c(3339,"No file active at this time")}]);return}const h={label:c(3340,"Save with Encoding")},p={label:c(3341,"Reopen with Encoding")};if(!py.isDefaultVariant()){const j="Save with Encoding";j!==h.label&&(h.detail=j);const oe="Reopen with Encoding";oe!==p.label&&(p.detail=oe)}let f;if(l instanceof Hi?f=h:d.input.isReadonly()?f=p:f=await i.pick([p,h],{placeHolder:c(3298,"Select Action"),matchOnDetail:!0}),!f)return;await Ho(50);const g=Bt.getOriginalUri(d.input,{supportSideBySide:Ni.PRIMARY});if(!g||!s.hasProvider(g)&&g.scheme!==pe.untitled)return;let m;s.hasProvider(g)&&(m=(await o.readStream(g,{autoGuessEncoding:!0,candidateGuessEncodings:n.getValue(g,"files.candidateGuessEncodings")})).encoding);const v=f===p,C=n.getValue(g,"files.encoding");let T,B;const V=Object.keys(Zi).sort((j,oe)=>j===C?-1:oe===C?1:Zi[j].order-Zi[oe].order).filter(j=>j===m&&m!==C?!1:!v||!Zi[j].encodeOnly).map((j,oe)=>(j===l.getEncoding()?T=oe:Zi[j].alias===l.getEncoding()&&(B=oe),{id:j,label:Zi[j].labelLong,description:j})),U=V.slice();m&&C!==m&&Zi[m]&&(V.unshift({type:"separator"}),V.unshift({id:m,label:Zi[m].labelLong,description:c(3342,"Guessed from content")}));const W=await i.pick(V,{placeHolder:v?c(3343,"Select File Encoding to Reopen File"):c(3344,"Select File Encoding to Save with"),activeItem:U[typeof T=="number"?T:typeof B=="number"?B:-1]});if(!W||!t.activeEditorPane)return;const K=ya(t.activeEditorPane.input);typeof W.id<"u"&&K&&await K.setEncoding(W.id,v?Af.Decode:Af.Encode),r.focus()}}let np=class{constructor(e,t,i){this.filesConfigurationService=e,this.environmentService=t,this.pathService=i}canSerialize(e){return this.filesConfigurationService.isHotExitEnabled&&!e.isDisposed()}serialize(e){if(!this.canSerialize(e))return;const t=e;let i=t.resource;t.hasAssociatedFilePath&&(i=fy(i,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme));let s;const o=t.getLanguageId();(o!==Td||t.hasLanguageSetExplicitly)&&(s=o);const n={resourceJSON:i.toJSON(),modeId:s,encoding:t.getEncoding()};return JSON.stringify(n)}deserialize(e,t){return e.invokeFunction(i=>{const s=JSON.parse(t),o=$.revive(s.resourceJSON),n=s.modeId,r=s.encoding;return i.get(Va).createTextEditor({resource:o,languageId:n,encoding:r,forceUntitled:!0})})}};np=D([u(0,$c),u(1,ri),u(2,Rc)],np);var Rn;let tc=(Rn=class extends R{constructor(e,t,i,s,o){super(),this.environmentService=t,this.pathService=i,this.textEditorService=s,this.untitledTextEditorService=o,this._register(e.registerHandler(this))}handles(e){return e.resource.scheme===pe.untitled&&e.typeId===nh}isOpen(e,t){return this.handles(e)?t instanceof Hi&&dt(e.resource,t.resource):!1}createEditor(e){let t;return this.untitledTextEditorService.isUntitledWithAssociatedResource(e.resource)?t=fy(e.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme):t=e.resource,this.textEditorService.createTextEditor({resource:t,forceUntitled:!0})}},Rn.ID="workbench.contrib.untitledTextEditorWorkingCopyEditorHandler",Rn);tc=D([u(0,qc),u(1,ri),u(2,Rc),u(3,Va),u(4,my)],tc);var cn,Oi;let ic=(Oi=class extends R{constructor(e,t,i){super(),this.editorResolverService=e,this.environmentService=i,this.configurationRegistry=z.as(Zs.Configuration),(async()=>(await t.whenInstalledExtensionsRegistered(),this.updateDynamicEditorConfigurations(),this.registerListeners()))()}registerListeners(){this._register(L.debounce(this.editorResolverService.onDidChangeEditorRegistrations,(e,t)=>t)(()=>this.updateDynamicEditorConfigurations()))}updateDynamicEditorConfigurations(){const e=[...this.editorResolverService.getEditors(),...cn.AUTO_LOCK_EXTRA_EDITORS].filter(l=>!cn.AUTO_LOCK_REMOVE_EDITORS.has(l.id)),t=this.editorResolverService.getEditors().filter(l=>l.priority!==De.exclusive).map(l=>l.id),i=Object.create(null);for(const l of e)i[l.id]={type:"boolean",default:cn.AUTO_LOCK_DEFAULT_ENABLED.has(l.id),description:l.label};const s=Object.create(null);for(const l of e)s[l.id]=cn.AUTO_LOCK_DEFAULT_ENABLED.has(l.id);const o=this.autoLockConfigurationNode;this.autoLockConfigurationNode={...xr,properties:{"workbench.editor.autoLockGroups":{type:"object",description:c(3246,"If an editor matching one of the listed types is opened as the first in an editor group and more than one group is open, the group is automatically locked. Locked groups will only be used for opening editors when explicitly chosen by a user gesture (for example drag and drop), but not by default. Consequently, the active editor in a locked group is less likely to be replaced accidentally with a different editor."),properties:i,default:s,additionalProperties:!1}}};const n=this.defaultBinaryEditorConfigurationNode;this.defaultBinaryEditorConfigurationNode={...xr,properties:{"workbench.editor.defaultBinaryEditor":{type:"string",default:"",enum:[...t,""],description:c(3247,"The default editor for files detected as binary. If undefined, the user will be presented with a picker.")}}};const r=this.editorAssociationsConfigurationNode;this.editorAssociationsConfigurationNode={...xr,properties:{"workbench.editorAssociations":{type:"object",markdownDescription:c(3248,'Configure [glob patterns](https://aka.ms/vscode-glob-patterns) to editors (for example `"*.hex": "hexEditor.hexedit"`). These have precedence over the default behavior.'),patternProperties:{".*":{type:"string",enum:t}}}}};const d=this.editorLargeFileConfirmationConfigurationNode;this.editorLargeFileConfirmationConfigurationNode={...xr,properties:{"workbench.editorLargeFileConfirmation":{type:"number",default:NE(this.environmentService.remoteAuthority)/Zp.MB,minimum:1,scope:ql.RESOURCE,markdownDescription:c(3249,"Controls the minimum size of a file in MB before asking for confirmation when opening in the editor. Note that this setting may not apply to all editor types and environments.")}}},this.configurationRegistry.updateConfigurations({add:[this.autoLockConfigurationNode,this.defaultBinaryEditorConfigurationNode,this.editorAssociationsConfigurationNode,this.editorLargeFileConfirmationConfigurationNode],remove:Ss([o,n,r,d])})}},cn=Oi,Oi.ID="workbench.contrib.dynamicEditorConfigurations",Oi.AUTO_LOCK_DEFAULT_ENABLED=new Set(["terminalEditor","mainThreadWebview-simpleBrowser.view","mainThreadWebview-browserPreview","workbench.editor.chatSession","workbench.editor.processExplorer"]),Oi.AUTO_LOCK_EXTRA_EDITORS=[{id:"workbench.input.interactive",label:c(3242,"Interactive Window"),priority:De.builtin},{id:"mainThreadWebview-markdown.preview",label:c(3243,"Markdown Preview"),priority:De.builtin},{id:"mainThreadWebview-simpleBrowser.view",label:c(3244,"Simple Browser"),priority:De.builtin},{id:"mainThreadWebview-browserPreview",label:c(3245,"Live Preview"),priority:De.builtin}],Oi.AUTO_LOCK_REMOVE_EDITORS=new Set(["vscode-interactive-input","interactive","vscode.markdown.preview.editor"]),Oi);ic=cn=D([u(0,Ta),u(1,At),u(2,ri)],ic);z.as(ct.EditorPane).registerEditorPane(Ci.create(Xd,Xd.ID,c(2970,"Text Editor")),[new ee(Hi),new ee(hy)]);z.as(ct.EditorPane).registerEditorPane(Ci.create(Tf,Tf.ID,c(2971,"Text Diff Editor")),[new ee(Aa)]);z.as(ct.EditorPane).registerEditorPane(Ci.create(mo,mo.ID,c(2972,"Binary Diff Editor")),[new ee(Aa)]);z.as(ct.EditorPane).registerEditorPane(Ci.create(oh,oh.ID,c(2973,"Side by Side Editor")),[new ee(Ia)]);z.as(ct.EditorFactory).registerEditorSerializer(Hi.ID,np);z.as(ct.EditorFactory).registerEditorSerializer(Ia.ID,BE);z.as(ct.EditorFactory).registerEditorSerializer(Aa.ID,FE);yt(ec.ID,ec,vt.BlockRestore);yt(tc.ID,tc,vt.BlockRestore);yt(ic.ID,ic,vt.BlockRestore);xc(xf.ID,xf,kc.AfterFirstRender);const fg=z.as(KE.Quickaccess),rl="inEditorsPicker",tb=I.and(WE,I.has(rl));fg.registerQuickAccessProvider({ctor:kf,prefix:kf.PREFIX,contextKey:rl,placeholder:c(2974,"Type the name of an editor to open it."),helpEntries:[{description:c(2975,"Show Editors in Active Group by Most Recently Used"),commandId:wy.ID}]});fg.registerQuickAccessProvider({ctor:Rf,prefix:Rf.PREFIX,contextKey:rl,placeholder:c(2974,"Type the name of an editor to open it."),helpEntries:[{description:c(2976,"Show All Opened Editors By Appearance"),commandId:yy.ID}]});fg.registerQuickAccessProvider({ctor:Lf,prefix:Lf.PREFIX,contextKey:rl,placeholder:c(2974,"Type the name of an editor to open it."),helpEntries:[{description:c(2977,"Show All Opened Editors By Most Recently Used"),commandId:vy.ID}]});b(op);b(LR);b(VR);b(rh);b(ah);b(GE);b(UE);b(HE);b(zE);b($E);b(qE);b(jE);b(YE);b(JE);b(ZE);b(by);b(Cy);b(yy);b(vy);b(wy);b(XE);b(QE);b(eI);b(tI);b(iI);b(sI);b(oI);b(nI);b(rI);b(aI);b(dI);b(cI);b(lI);b(hI);b(uI);b(pI);b(gI);b(fI);b(mI);b(wI);b(yI);b(vI);b(bI);b(CI);b(SI);b(_I);b(EI);b(II);b(DI);b(AI);b(TI);b(xI);b(kI);b(RI);b(LI);b(VI);b(PI);b(MI);b(OI);b(NI);b(BI);b(FI);b(KI);b(WI);b(GI);b(UI);b(HI);b(zI);b($I);b(qI);b(jI);b(YI);b(JI);b(ZI);b(XI);b(QI);b(eD);b(tD);b(iD);b(sD);b(oD);b(nD);b(rD);b(aD);b(dD);b(cD);b(lD);b(hD);b(uD);b(pD);b(Sy);b(_y);b(Ey);b(Iy);b(Dy);b(Ay);b(Ty);b(xy);b(gD);b(fD);b(mD);b(wD);b(yD);b(vD);b(bD);b(CD);b(SD);b(_D);b(ED);b(ID);b(DD);const Dm="workbench.action.quickOpenNavigateNextInEditorPicker";ne.registerCommandAndKeybindingRule({id:Dm,weight:G.WorkbenchContrib+50,handler:ky(Dm,!0),when:tb,primary:N.CtrlCmd|y.Tab,mac:{primary:N.WinCtrl|y.Tab}});const Am="workbench.action.quickOpenNavigatePreviousInEditorPicker";ne.registerCommandAndKeybindingRule({id:Am,weight:G.WorkbenchContrib+50,handler:ky(Am,!1),when:tb,primary:N.CtrlCmd|N.Shift|y.Tab,mac:{primary:N.WinCtrl|N.Shift|y.Tab}});AD();ut&&(S.appendMenuItem(w.TouchBarContext,{command:{id:ah.ID,title:ah.LABEL,icon:{dark:Br.asFileUri("vs/workbench/browser/parts/editor/media/back-tb.png")}},group:"navigation",order:0}),S.appendMenuItem(w.TouchBarContext,{command:{id:rh.ID,title:rh.LABEL,icon:{dark:Br.asFileUri("vs/workbench/browser/parts/editor/media/forward-tb.png")}},group:"navigation",order:1}));S.appendMenuItem(w.EmptyEditorGroup,{command:{id:Ry,title:c(2978,"Lock Group"),icon:k.unlock},group:"navigation",order:10,when:I.and(Js,gr.toNegated())});S.appendMenuItem(w.EmptyEditorGroup,{command:{id:Ly,title:c(2979,"Unlock Group"),icon:k.lock,toggled:I.true()},group:"navigation",order:10,when:gr});S.appendMenuItem(w.EmptyEditorGroup,{command:{id:Vy,title:c(2980,"Close Group"),icon:k.close},group:"navigation",order:20,when:I.or(Js,kp)});S.appendMenuItem(w.EmptyEditorGroupContext,{command:{id:jc,title:c(2981,"Split Up")},group:"2_split",order:10});S.appendMenuItem(w.EmptyEditorGroupContext,{command:{id:Pa,title:c(2982,"Split Down")},group:"2_split",order:20});S.appendMenuItem(w.EmptyEditorGroupContext,{command:{id:Yc,title:c(2983,"Split Left")},group:"2_split",order:30});S.appendMenuItem(w.EmptyEditorGroupContext,{command:{id:Ma,title:c(2984,"Split Right")},group:"2_split",order:40});S.appendMenuItem(w.EmptyEditorGroupContext,{command:{id:TD,title:c(2985,"New Window")},group:"3_window",order:10});S.appendMenuItem(w.EmptyEditorGroupContext,{command:{id:Py,title:c(2986,"Lock Group"),toggled:gr},group:"4_lock",order:10,when:Js.toNegated()});S.appendMenuItem(w.EmptyEditorGroupContext,{command:{id:Vy,title:c(2987,"Close")},group:"5_close",order:10,when:Ii});S.appendMenuItem(w.EditorTabsBarContext,{command:{id:jc,title:c(2981,"Split Up")},group:"2_split",order:10});S.appendMenuItem(w.EditorTabsBarContext,{command:{id:Pa,title:c(2982,"Split Down")},group:"2_split",order:20});S.appendMenuItem(w.EditorTabsBarContext,{command:{id:Yc,title:c(2983,"Split Left")},group:"2_split",order:30});S.appendMenuItem(w.EditorTabsBarContext,{command:{id:Ma,title:c(2984,"Split Right")},group:"2_split",order:40});S.appendMenuItem(w.EditorTabsBarContext,{command:{id:xD,title:c(2988,"Move into New Window")},group:"3_window",order:10});S.appendMenuItem(w.EditorTabsBarContext,{command:{id:kD,title:c(2989,"Copy into New Window")},group:"3_window",order:20});S.appendMenuItem(w.EditorTabsBarContext,{submenu:w.EditorTabsBarShowTabsSubmenu,title:c(2990,"Tab Bar"),group:"4_config",order:10,when:My.negate()});S.appendMenuItem(w.EditorTabsBarShowTabsSubmenu,{command:{id:RD.ID,title:c(2991,"Multiple Tabs"),toggled:I.equals("config.workbench.editor.showTabs","multiple")},group:"1_config",order:10});S.appendMenuItem(w.EditorTabsBarShowTabsSubmenu,{command:{id:LD.ID,title:c(2992,"Single Tab"),toggled:I.equals("config.workbench.editor.showTabs","single")},group:"1_config",order:20});S.appendMenuItem(w.EditorTabsBarShowTabsSubmenu,{command:{id:VD.ID,title:c(2993,"Hidden"),toggled:I.equals("config.workbench.editor.showTabs","none")},group:"1_config",order:30});S.appendMenuItem(w.EditorTabsBarContext,{submenu:w.EditorTabsBarShowTabsZenModeSubmenu,title:c(2990,"Tab Bar"),group:"4_config",order:10,when:My});S.appendMenuItem(w.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:PD.ID,title:c(2991,"Multiple Tabs"),toggled:I.equals("config.zenMode.showTabs","multiple")},group:"1_config",order:10});S.appendMenuItem(w.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:MD.ID,title:c(2992,"Single Tab"),toggled:I.equals("config.zenMode.showTabs","single")},group:"1_config",order:20});S.appendMenuItem(w.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:OD.ID,title:c(2993,"Hidden"),toggled:I.equals("config.zenMode.showTabs","none")},group:"1_config",order:30});S.appendMenuItem(w.EditorTabsBarContext,{submenu:w.EditorActionsPositionSubmenu,title:c(2994,"Editor Actions Position"),group:"4_config",order:20});S.appendMenuItem(w.EditorActionsPositionSubmenu,{command:{id:ND.ID,title:c(2990,"Tab Bar"),toggled:I.equals("config.workbench.editor.editorActionsLocation","default")},group:"1_config",order:10,when:I.equals("config.workbench.editor.showTabs","none").negate()});S.appendMenuItem(w.EditorActionsPositionSubmenu,{command:{id:BD.ID,title:c(2995,"Title Bar"),toggled:I.or(I.equals("config.workbench.editor.editorActionsLocation","titleBar"),I.and(I.equals("config.workbench.editor.showTabs","none"),I.equals("config.workbench.editor.editorActionsLocation","default")))},group:"1_config",order:20});S.appendMenuItem(w.EditorActionsPositionSubmenu,{command:{id:FD.ID,title:c(2996,"Hidden"),toggled:I.equals("config.workbench.editor.editorActionsLocation","hidden")},group:"1_config",order:30});S.appendMenuItem(w.EditorTabsBarContext,{command:{id:KD.ID,title:c(2997,"Configure Tabs")},group:"9_configure",order:10});S.appendMenuItem(w.EditorTitleContext,{command:{id:fr,title:c(2987,"Close")},group:"1_close",order:10});S.appendMenuItem(w.EditorTitleContext,{command:{id:Oy,title:c(2998,"Close Others"),precondition:WD.notEqualsTo("1")},group:"1_close",order:20});S.appendMenuItem(w.EditorTitleContext,{command:{id:Ny,title:c(2999,"Close to the Right"),precondition:I.and(By.toNegated(),Jc.negate())},group:"1_close",order:30,when:Oa});S.appendMenuItem(w.EditorTitleContext,{command:{id:Xp,title:c(3e3,"Close Saved")},group:"1_close",order:40});S.appendMenuItem(w.EditorTitleContext,{command:{id:Na,title:c(3001,"Close All")},group:"1_close",order:50});S.appendMenuItem(w.EditorTitleContext,{command:{id:Ky,title:c(3002,"Reopen Editor With...")},group:"1_open",order:10,when:Fy});S.appendMenuItem(w.EditorTitleContext,{command:{id:Wy,title:c(3003,"Keep Open"),precondition:GD.toNegated()},group:"3_preview",order:10,when:I.has("config.workbench.editor.enablePreview")});S.appendMenuItem(w.EditorTitleContext,{command:{id:Gy,title:c(3004,"Pin")},group:"3_preview",order:20,when:mr.toNegated()});S.appendMenuItem(w.EditorTitleContext,{command:{id:Zc,title:c(3005,"Unpin")},group:"3_preview",order:20,when:mr});S.appendMenuItem(w.EditorTitleContext,{command:{id:jc,title:c(2981,"Split Up")},group:"5_split",order:10});S.appendMenuItem(w.EditorTitleContext,{command:{id:Pa,title:c(2982,"Split Down")},group:"5_split",order:20});S.appendMenuItem(w.EditorTitleContext,{command:{id:Yc,title:c(2983,"Split Left")},group:"5_split",order:30});S.appendMenuItem(w.EditorTitleContext,{command:{id:Ma,title:c(2984,"Split Right")},group:"5_split",order:40});S.appendMenuItem(w.EditorTitleContext,{command:{id:Hy,title:c(3006,"Split in Group"),precondition:Jc.negate()},group:"6_split_in_group",order:10,when:Uy});S.appendMenuItem(w.EditorTitleContext,{command:{id:zy,title:c(3007,"Join in Group"),precondition:Jc.negate()},group:"6_split_in_group",order:10,when:Ba});S.appendMenuItem(w.EditorTitleContext,{command:{id:$y,title:c(3008,"Move into New Window")},group:"7_new_window",order:10});S.appendMenuItem(w.EditorTitleContext,{command:{id:qy,title:c(3009,"Copy into New Window")},group:"7_new_window",order:20});S.appendMenuItem(w.EditorTitleContext,{submenu:w.EditorTitleContextShare,title:c(3010,"Share"),group:"11_share",order:-1,when:Jc.negate()});S.appendMenuItem(w.EditorTitle,{command:{id:UD,title:c(3011,"Inline View"),toggled:I.equals("config.diffEditor.renderSideBySide",!1)},group:"1_diff",order:10,when:I.has("isInDiffEditor")});S.appendMenuItem(w.EditorTitle,{command:{id:HD,title:c(3012,"Show Opened Editors")},group:"3_open",order:10});S.appendMenuItem(w.EditorTitle,{command:{id:Na,title:c(3001,"Close All")},group:"5_close",order:10});S.appendMenuItem(w.EditorTitle,{command:{id:Xp,title:c(3e3,"Close Saved")},group:"5_close",order:20});S.appendMenuItem(w.EditorTitle,{command:{id:zD,title:c(3013,"Enable Preview Editors"),toggled:I.has("config.workbench.editor.enablePreview")},group:"7_settings",order:10});S.appendMenuItem(w.EditorTitle,{command:{id:jy,title:c(3014,"Maximize Group")},group:"8_group_operations",order:5,when:I.and(Rp.negate(),kp)});S.appendMenuItem(w.EditorTitle,{command:{id:jy,title:c(3015,"Unmaximize Group")},group:"8_group_operations",order:5,when:Rp});S.appendMenuItem(w.EditorTitle,{command:{id:Py,title:c(3016,"Lock Group"),toggled:gr},group:"8_group_operations",order:10,when:Js.toNegated()});S.appendMenuItem(w.EditorTitle,{command:{id:$D.ID,title:c(3017,"Configure Editors")},group:"9_configure",order:10});function li(a,e,t,i,s,o){const n={command:{id:a.id,title:a.title,icon:a.icon,toggled:a.toggled,precondition:s},group:"navigation",when:e,order:t};i&&(n.alt={id:i.id,title:i.title,icon:i.icon}),S.appendMenuItem(w.EditorTitle,n),o&&S.appendMenuItem(w.CompactWindowEditorTitle,n)}const mg=1e5,yr=1e6;li({id:Yy,title:c(3018,"Split Editor Right"),icon:k.splitHorizontal},I.not("splitEditorsVertically"),mg,{id:Pa,title:c(3019,"Split Editor Down"),icon:k.splitVertical});li({id:Yy,title:c(3019,"Split Editor Down"),icon:k.splitVertical},I.has("splitEditorsVertically"),mg,{id:Ma,title:c(3018,"Split Editor Right"),icon:k.splitHorizontal});li({id:eA,title:c(3020,"Toggle Layout"),icon:k.editorLayout},Ba,mg-1);li({id:fr,title:c(2987,"Close"),icon:k.close},I.and(Oa.toNegated(),Xc.toNegated(),mr.toNegated()),yr,{id:Na,title:c(3001,"Close All"),icon:k.closeAll});li({id:fr,title:c(2987,"Close"),icon:k.closeDirty},I.and(Oa.toNegated(),Xc,mr.toNegated()),yr,{id:Na,title:c(3001,"Close All"),icon:k.closeAll});li({id:Zc,title:c(3005,"Unpin"),icon:k.pinned},I.and(Oa.toNegated(),Xc.toNegated(),mr),yr,{id:fr,title:c(2987,"Close"),icon:k.close});li({id:Zc,title:c(3005,"Unpin"),icon:k.pinnedDirty},I.and(Oa.toNegated(),Xc,mr),yr,{id:fr,title:c(2987,"Close"),icon:k.close});li({id:Ry,title:c(3021,"Lock Group"),icon:k.unlock},I.and(Js,gr.toNegated()),yr-1);li({id:Ly,title:c(3022,"Unlock Group"),icon:k.lock,toggled:I.true()},gr,yr-1);const PR=le("diff-editor-previous-change",k.arrowUp,c(3023,"Icon for the previous change action in the diff editor."));li({id:tA,title:c(3024,"Previous Change"),icon:PR},$o,10,void 0,na.hasChanges,!0);const MR=le("diff-editor-next-change",k.arrowDown,c(3025,"Icon for the next change action in the diff editor."));li({id:iA,title:c(3026,"Next Change"),icon:MR},$o,11,void 0,na.hasChanges,!0);li({id:sA,title:c(3027,"Swap Left and Right Side"),icon:k.arrowSwap},I.and($o,qD),15,void 0,void 0);const OR=le("diff-editor-toggle-whitespace",k.whitespace,c(3028,"Icon for the toggle whitespace action in the diff editor."));S.appendMenuItem(w.EditorTitle,{command:{id:jD,title:c(3029,"Show Leading/Trailing Whitespace Differences"),icon:OR,precondition:$o,toggled:I.equals("config.diffEditor.ignoreTrimWhitespace",!1)},group:"navigation",when:$o,order:20});S.appendMenuItem(w.CommandPalette,{command:{id:Wy,title:x(3030,"Keep Editor"),category:xe.View},when:I.has("config.workbench.editor.enablePreview")});S.appendMenuItem(w.CommandPalette,{command:{id:Gy,title:x(3031,"Pin Editor"),category:xe.View}});S.appendMenuItem(w.CommandPalette,{command:{id:Zc,title:x(3032,"Unpin Editor"),category:xe.View}});S.appendMenuItem(w.CommandPalette,{command:{id:fr,title:x(3033,"Close Editor"),category:xe.View}});S.appendMenuItem(w.CommandPalette,{command:{id:YD,title:x(3034,"Close Pinned Editor"),category:xe.View}});S.appendMenuItem(w.CommandPalette,{command:{id:Na,title:x(3035,"Close All Editors in Group"),category:xe.View}});S.appendMenuItem(w.CommandPalette,{command:{id:Xp,title:x(3036,"Close Saved Editors in Group"),category:xe.View}});S.appendMenuItem(w.CommandPalette,{command:{id:Oy,title:x(3037,"Close Other Editors in Group"),category:xe.View}});S.appendMenuItem(w.CommandPalette,{command:{id:Ny,title:x(3038,"Close Editors to the Right in Group"),category:xe.View},when:By.toNegated()});S.appendMenuItem(w.CommandPalette,{command:{id:JD,title:x(3039,"Close Editor Group"),category:xe.View},when:Ii});S.appendMenuItem(w.CommandPalette,{command:{id:Ky,title:x(3002,"Reopen Editor With..."),category:xe.View},when:Fy});S.appendMenuItem(w.MenubarRecentMenu,{group:"1_editor",command:{id:by.ID,title:c(3040,"&&Reopen Closed Editor"),precondition:I.has("canReopenClosedEditor")},order:1});S.appendMenuItem(w.MenubarRecentMenu,{group:"z_clear",command:{id:Cy.ID,title:c(3041,"&&Clear Recently Opened...")},order:1});S.appendMenuItem(w.MenubarFileMenu,{title:c(3042,"Share"),submenu:w.MenubarShare,group:"45_share",order:1});S.appendMenuItem(w.MenubarViewMenu,{group:"2_appearance",title:c(3043,"Editor &&Layout"),submenu:w.MenubarLayoutMenu,order:2});S.appendMenuItem(w.MenubarLayoutMenu,{group:"1_split",command:{id:jc,title:{...x(3044,"Split Up"),mnemonicTitle:c(3045,"Split &&Up")}},order:1});S.appendMenuItem(w.MenubarLayoutMenu,{group:"1_split",command:{id:Pa,title:{...x(3046,"Split Down"),mnemonicTitle:c(3047,"Split &&Down")}},order:2});S.appendMenuItem(w.MenubarLayoutMenu,{group:"1_split",command:{id:Yc,title:{...x(3048,"Split Left"),mnemonicTitle:c(3049,"Split &&Left")}},order:3});S.appendMenuItem(w.MenubarLayoutMenu,{group:"1_split",command:{id:Ma,title:{...x(3050,"Split Right"),mnemonicTitle:c(3051,"Split &&Right")}},order:4});S.appendMenuItem(w.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:Hy,title:{...x(3052,"Split in Group"),mnemonicTitle:c(3053,"Split in &&Group")}},when:Uy,order:1});S.appendMenuItem(w.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:zy,title:{...x(3054,"Join in Group"),mnemonicTitle:c(3055,"Join in &&Group")}},when:Ba,order:1});S.appendMenuItem(w.MenubarLayoutMenu,{group:"3_new_window",command:{id:$y,title:{...x(3056,"Move Editor into New Window"),mnemonicTitle:c(3057,"&&Move Editor into New Window")}},order:1});S.appendMenuItem(w.MenubarLayoutMenu,{group:"3_new_window",command:{id:qy,title:{...x(3058,"Copy Editor into New Window"),mnemonicTitle:c(3059,"&&Copy Editor into New Window")}},order:2});S.appendMenuItem(w.MenubarLayoutMenu,{group:"4_layouts",command:{id:Sy.ID,title:{...x(3060,"Single"),mnemonicTitle:c(3061,"&&Single")}},order:1});S.appendMenuItem(w.MenubarLayoutMenu,{group:"4_layouts",command:{id:_y.ID,title:{...x(3062,"Two Columns"),mnemonicTitle:c(3063,"&&Two Columns")}},order:3});S.appendMenuItem(w.MenubarLayoutMenu,{group:"4_layouts",command:{id:Ey.ID,title:{...x(3064,"Three Columns"),mnemonicTitle:c(3065,"T&&hree Columns")}},order:4});S.appendMenuItem(w.MenubarLayoutMenu,{group:"4_layouts",command:{id:Iy.ID,title:{...x(3066,"Two Rows"),mnemonicTitle:c(3067,"T&&wo Rows")}},order:5});S.appendMenuItem(w.MenubarLayoutMenu,{group:"4_layouts",command:{id:Dy.ID,title:{...x(3068,"Three Rows"),mnemonicTitle:c(3069,"Three &&Rows")}},order:6});S.appendMenuItem(w.MenubarLayoutMenu,{group:"4_layouts",command:{id:Ay.ID,title:{...x(3070,"Grid (2x2)"),mnemonicTitle:c(3071,"&&Grid (2x2)")}},order:7});S.appendMenuItem(w.MenubarLayoutMenu,{group:"4_layouts",command:{id:Ty.ID,title:{...x(3072,"Two Rows Right"),mnemonicTitle:c(3073,"Two R&&ows Right")}},order:8});S.appendMenuItem(w.MenubarLayoutMenu,{group:"4_layouts",command:{id:xy.ID,title:{...x(3074,"Two Columns Bottom"),mnemonicTitle:c(3075,"Two &&Columns Bottom")}},order:9});S.appendMenuItem(w.MenubarGoMenu,{group:"1_history_nav",command:{id:"workbench.action.navigateToLastEditLocation",title:c(3076,"&&Last Edit Location"),precondition:I.has("canNavigateToLastEditLocation")},order:3});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:ZD,title:c(3077,"&&First Side in Editor")},when:I.or(Ba,$o),order:1});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:XD,title:c(3078,"&&Second Side in Editor")},when:I.or(Ba,$o),order:2});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.nextEditor",title:c(3079,"&&Next Editor")},order:1});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.previousEditor",title:c(3080,"&&Previous Editor")},order:2});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openNextRecentlyUsedEditor",title:c(3081,"&&Next Used Editor")},order:1});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditor",title:c(3082,"&&Previous Used Editor")},order:2});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.nextEditorInGroup",title:c(3083,"&&Next Editor in Group")},order:1});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.previousEditorInGroup",title:c(3084,"&&Previous Editor in Group")},order:2});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:c(3085,"&&Next Used Editor in Group")},order:1});S.appendMenuItem(w.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:c(3086,"&&Previous Used Editor in Group")},order:2});S.appendMenuItem(w.MenubarGoMenu,{group:"2_editor_nav",title:c(3087,"Switch &&Editor"),submenu:w.MenubarSwitchEditorMenu,order:1});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFirstEditorGroup",title:c(3088,"Group &&1")},order:1});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusSecondEditorGroup",title:c(3089,"Group &&2")},order:2});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusThirdEditorGroup",title:c(3090,"Group &&3"),precondition:Ii},order:3});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFourthEditorGroup",title:c(3091,"Group &&4"),precondition:Ii},order:4});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFifthEditorGroup",title:c(3092,"Group &&5"),precondition:Ii},order:5});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusNextGroup",title:c(3093,"&&Next Group"),precondition:Ii},order:1});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusPreviousGroup",title:c(3094,"&&Previous Group"),precondition:Ii},order:2});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusLeftGroup",title:c(3095,"Group &&Left"),precondition:Ii},order:1});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusRightGroup",title:c(3096,"Group &&Right"),precondition:Ii},order:2});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusAboveGroup",title:c(3097,"Group &&Above"),precondition:Ii},order:3});S.appendMenuItem(w.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusBelowGroup",title:c(3098,"Group &&Below"),precondition:Ii},order:4});S.appendMenuItem(w.MenubarGoMenu,{group:"2_editor_nav",title:c(3099,"Switch &&Group"),submenu:w.MenubarSwitchGroupMenu,order:2});QD(oA);var Ln;let va=(Ln=class{constructor(e){this._webviewWorkbenchService=e}canSerialize(e){return this._webviewWorkbenchService.shouldPersist(e)}serialize(e){if(!this.canSerialize(e))return;const t=this.toJson(e);try{return JSON.stringify(t)}catch{return}}deserialize(e,t){const i=this.fromJson(JSON.parse(t));return this._webviewWorkbenchService.openRevivedWebview({webviewInitInfo:{providedViewType:i.providedId,origin:i.origin,title:i.title,options:i.webviewOptions,contentOptions:i.contentOptions,extension:i.extension},viewType:i.viewType,title:i.title,iconPath:i.iconPath,state:i.state,group:i.group})}fromJson(e){return{...e,extension:ib(e.extensionId,e.extensionLocation),iconPath:NR(e.iconPath),state:BR(e.state),webviewOptions:e.options,contentOptions:sb(e.options)}}toJson(e){return{origin:e.webview.origin,viewType:e.viewType,providedId:e.providedId,title:e.getName(),options:{...e.webview.options,...e.webview.contentOptions},extensionLocation:e.extension?.location,extensionId:e.extension?.id.value,state:e.webview.state,iconPath:e.iconPath?{light:e.iconPath.light,dark:e.iconPath.dark}:void 0,group:e.group}}},Ln.ID=Zn.typeId,Ln);va=D([u(0,Qp)],va);function ib(a,e){if(!a)return;const t=sc(e);if(t)return{id:new ay(a),location:t}}function NR(a){if(!a)return;const e=sc(a.light),t=sc(a.dark);return e&&t?{light:e,dark:t}:void 0}function sc(a){if(a)try{return typeof a=="string"?$.parse(a):$.from(a)}catch{return}}function BR(a){return typeof a=="string"?a:void 0}function sb(a){return{...a,localResourceRoots:a.localResourceRoots?.map(e=>sc(e))}}var Vn;let oc=(Vn=class extends va{constructor(e,t,i){super(e),this._instantiationService=t,this._webviewService=i}serialize(e){const t=e.isDirty(),i={...this.toJson(e),editorResource:e.resource.toJSON(),dirty:t,backupId:t?e.backupId:void 0};try{return JSON.stringify(i)}catch{return}}fromJson(e){return{...super.fromJson(e),editorResource:$.from(e.editorResource),dirty:e.dirty}}deserialize(e,t){const i=this.fromJson(JSON.parse(t)),s=ob(this._webviewService,i),o=this._instantiationService.createInstance(Pt,{resource:i.editorResource,viewType:i.viewType},s,{startsDirty:i.dirty,backupId:i.backupId});return typeof i.group=="number"&&o.updateGroup(i.group),o}},Vn.ID=Pt.typeId,Vn);oc=D([u(0,Qp),u(1,F),u(2,Yo)],oc);function ob(a,e){const t=a.createWebviewOverlay({providedViewType:e.viewType,origin:e.origin,title:void 0,options:{purpose:ry.CustomEditor,enableFindWidget:e.webviewOptions.enableFindWidget,retainContextWhenHidden:e.webviewOptions.retainContextWhenHidden},contentOptions:e.contentOptions,extension:e.extension});return t.state=e.state,t}var Pn;let nc=(Pn=class extends R{constructor(e,t,i,s,o){super(),this._instantiationService=e,this._workingCopyBackupService=i,this._webviewService=s,this._register(t.registerHandler(this))}handles(e){return e.resource.scheme===pe.vscodeCustomEditor}isOpen(e,t){if(!this.handles(e))return!1;if(e.resource.authority==="jupyter-notebook-ipynb"&&t instanceof nA)try{const i=JSON.parse(e.resource.query),s=$.from(i);return dt(s,t.resource)}catch{return!1}if(!(t instanceof Pt)||e.resource.authority!==t.viewType.replace(/[^a-z0-9\-_]/gi,"-").toLowerCase())return!1;try{const i=JSON.parse(e.resource.query),s=$.from(i);return dt(s,t.resource)}catch{return!1}}async createEditor(e){const t=await this._workingCopyBackupService.resolve(e);if(!t?.meta)throw new Error(`No backup found for custom editor: ${e.resource}`);const i=t.meta,s=ib(i.extension?.id,i.extension?.location),o=ob(this._webviewService,{viewType:i.viewType,origin:i.webview.origin,webviewOptions:i.webview.options,contentOptions:sb(i.webview.options),state:i.webview.state,extension:s}),n=this._instantiationService.createInstance(Pt,{resource:$.revive(i.editorResource),viewType:i.viewType},o,{backupId:i.backupId});return n.updateGroup(0),n}},Pn.ID="workbench.contrib.complexCustomWorkingCopyEditorHandler",Pn);nc=D([u(0,F),u(1,qc),u(2,rA),u(3,Yo),u(4,Jy)],nc);z.as(ct.EditorPane).registerEditorPane(Ci.create(ra,ra.ID,"Webview Editor"),[new ee(Pt)]);z.as(ct.EditorFactory).registerEditorSerializer(oc.ID,oc);yt(nc.ID,nc,vt.BlockStartup);const al=I.and(I.equals("activeEditor",ra.ID),na.focus.toNegated()),mn=class mn extends X{constructor(){super({id:mn.ID,title:mn.LABEL,keybinding:{when:I.and(al,bw),primary:N.CtrlCmd|y.KeyF,weight:G.EditorContrib}})}run(e){dl(e)?.showFind()}};mn.ID="editor.action.webvieweditor.showFind",mn.LABEL=c(11742,"Show find");let rp=mn;const wn=class wn extends X{constructor(){super({id:wn.ID,title:wn.LABEL,keybinding:{when:I.and(al,vw),primary:y.Escape,weight:G.EditorContrib}})}run(e){dl(e)?.hideFind()}};wn.ID="editor.action.webvieweditor.hideFind",wn.LABEL=c(11743,"Stop find");let ap=wn;const yn=class yn extends X{constructor(){super({id:yn.ID,title:yn.LABEL,keybinding:{when:I.and(al,zp),primary:y.Enter,weight:G.EditorContrib}})}run(e){dl(e)?.runFindAction(!1)}};yn.ID="editor.action.webvieweditor.findNext",yn.LABEL=c(11744,"Find next");let dp=yn;const vn=class vn extends X{constructor(){super({id:vn.ID,title:vn.LABEL,keybinding:{when:I.and(al,zp),primary:N.Shift|y.Enter,weight:G.EditorContrib}})}run(e){dl(e)?.runFindAction(!0)}};vn.ID="editor.action.webvieweditor.findPrevious",vn.LABEL=c(11745,"Find previous");let cp=vn;const bn=class bn extends X{constructor(){super({id:bn.ID,title:bn.LABEL,category:xe.Developer,menu:[{id:w.CommandPalette}]})}async run(e){const t=e.get(Yo);for(const i of t.webviews)i.reload()}};bn.ID="workbench.action.webview.reloadWebviewAction",bn.LABEL=x(11746,"Reload Webviews");let lp=bn;function dl(a){const t=a.get(Q).activeEditor;return t instanceof Zn?t.webview:void 0}z.as(ct.EditorPane).registerEditorPane(Ci.create(ra,ra.ID,c(11748,"webview editor")),[new ee(Zn)]);var Mn;let rc=(Mn=class extends R{constructor(e,t){super(),this.editorGroupService=t,this._register(e.onWillOpenEditor(i=>{const s=t.getGroup(i.groupId);s&&this.onEditorOpening(i.editor,s)}))}onEditorOpening(e,t){if(!(e instanceof Zn)||e.typeId!==Zn.typeId||t.contains(e))return;let i;const s=this.editorGroupService.groups;for(const o of s)if(o.contains(e)){i=o;break}i&&i.closeEditor(e)}},Mn.ID="workbench.contrib.webviewPanel",Mn);rc=D([u(0,Q),u(1,Je)],rc);yt(rc.ID,rc,vt.BlockStartup);z.as(ct.EditorFactory).registerEditorSerializer(va.ID,va);b(rp);b(ap);b(dp);b(cp);b(lp);let Tm=class extends R{constructor(e,t,i,s,o){super(),this.configurationService=t,this.logService=i,this.preferencesService=s,this.quickInputService=o,this._providers=new kw,this._register(e.registerExternalOpener(this))}registerExternalOpenerProvider(e){return{dispose:this._providers.push(e)}}async getOpeners(e,t,i,s){const o=await this.getAllOpenersForUri(e);if(o.size===0)return[];if(i.preferredOpenerId){if(i.preferredOpenerId===Al)return[];const l=o.get(i.preferredOpenerId);if(l)return[l]}const n=this.getConfiguredOpenerForUri(o,e);if(n)return n===Al?[]:[n];const r=[];if(await Promise.all(Array.from(o.values()).map(async l=>{let h;try{h=await l.canOpen(i.sourceUri,s)}catch(p){this.logService.error(p);return}switch(h){case Cr.Option:case Cr.Default:case Cr.Preferred:r.push({opener:l,priority:h});break}})),r.length===0)return[];const d=r.filter(l=>l.priority===Cr.Preferred).at(0);return d?[d.opener]:!t&&r.every(l=>l.priority===Cr.Option)?[]:r.map(l=>l.opener)}async openExternal(e,t,i){const s=typeof e=="string"?$.parse(e):e,o=await this.getOpeners(s,!1,t,i);return o.length===0?!1:o.length===1?o[0].openExternalUri(s,t,i):this.showOpenerPrompt(o,s,t,i)}async getOpener(e,t,i){const s=await this.getOpeners(e,!0,t,i);if(s.length>=1)return s[0]}async getAllOpenersForUri(e){const t=new Map;return await Promise.all(aA.map(this._providers,async i=>{for await(const s of i.getOpeners(e))t.set(s.id,s)})),t}getConfiguredOpenerForUri(e,t){const i=this.configurationService.getValue(Vf)||{};for(const[s,o]of Object.entries(i))if(dA(t,s)){if(o===Al)return"default";const n=e.get(o);if(n)return n}}async showOpenerPrompt(e,t,i,s){const o=e.map(r=>({label:r.label,opener:r}));o.push({label:Wo?c(6942,"Open in new browser window"):c(6943,"Open in default browser"),opener:void 0},{type:"separator"},{label:c(6944,"Configure default opener..."),opener:"configureDefault"});const n=await this.quickInputService.pick(o,{placeHolder:c(6945,"How would you like to open: {0}",t.toString())});return n?typeof n.opener>"u"?!1:n.opener==="configureDefault"?(await this.preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:Vf,edit:!0}}),!0):n.opener.openExternalUri(t,i,s):!0}};Tm=D([u(0,xt),u(1,ie),u(2,Ue),u(3,zc),u(4,Xt)],Tm);z.as(Zs.Configuration).registerConfiguration(cA);const FR=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var ei;Pe(FR);class xm{constructor(e,t){this.combined=e,this.dedicated=t}isEqual(e){return Bo(this.combined,e.combined)&&Bo(this.dedicated,e.dedicated)}}let hp=class{constructor(e,t){this._storageService=e,this._key=t}get value(){return this._storageService.getNumber(this._key,H.PROFILE,0)}increment(){const e=this.value+1;return this._storageService.store(this._key,e,H.PROFILE,Re.MACHINE),e}};hp=D([u(0,ce)],hp);var On;let ac=(On=class extends R{constructor(e){super(),this.editorGroupService=e;for(const t of e.parts)this.createLanguageStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createLanguageStatus(t)))}createLanguageStatus(e){const t=new O;L.once(e.onWillDispose)(()=>t.dispose());const i=this.editorGroupService.getScopedInstantiationService(e);t.add(i.createInstance(up))}},On.Id="status.languageStatus",On);ac=D([u(0,Je)],ac);var zs;let up=(zs=class{constructor(e,t,i,s,o,n){this._languageStatusService=e,this._statusBarService=t,this._editorService=i,this._hoverService=s,this._openerService=o,this._storageService=n,this._disposables=new O,this._dedicated=new Set,this._dedicatedEntries=new Map,this._renderDisposables=new O,this._combinedEntryTooltip=document.createElement("div"),n.onDidChangeValue(H.PROFILE,ei._keyDedicatedItems,this._disposables)(this._handleStorageChange,this,this._disposables),this._restoreState(),this._interactionCounter=new hp(n,"languageStatus.interactCount"),e.onDidChange(this._update,this,this._disposables),i.onDidActiveEditorChange(this._update,this,this._disposables),this._update(),t.onDidChangeEntryVisibility(r=>{!r.visible&&this._dedicated.has(r.id)&&(this._dedicated.delete(r.id),this._update(),this._storeState())},void 0,this._disposables)}dispose(){this._disposables.dispose(),this._combinedEntry?.dispose(),je(this._dedicatedEntries.values()),this._renderDisposables.dispose()}_handleStorageChange(){this._restoreState(),this._update()}_restoreState(){const e=this._storageService.get(ei._keyDedicatedItems,H.PROFILE,"[]");try{const t=JSON.parse(e);this._dedicated=new Set(t)}catch{this._dedicated.clear()}}_storeState(){if(this._dedicated.size===0)this._storageService.remove(ei._keyDedicatedItems,H.PROFILE);else{const e=JSON.stringify(Array.from(this._dedicated.keys()));this._storageService.store(ei._keyDedicatedItems,e,H.PROFILE,Re.USER)}}_createViewModel(e){if(!e?.hasModel())return new xm([],[]);const t=this._languageStatusService.getLanguageStatus(e.getModel()),i=[],s=[];for(const o of t)this._dedicated.has(o.id)&&s.push(o),i.push(o);return new xm(i,s)}_update(){const e=mi(this._editorService.activeTextEditorControl),t=this._createViewModel(e);if(this._model?.isEqual(t))return;if(this._renderDisposables.clear(),this._model=t,e?.onDidChangeModelLanguage(this._update,this,this._renderDisposables),t.combined.length===0)this._combinedEntry?.dispose(),this._combinedEntry=void 0;else{const[s]=t.combined,o=s.severity>=Se.Warning,n=ei._severityToComboCodicon(s.severity);let r=!1;const d=[];for(const m of t.combined){const v=t.dedicated.includes(m);this._renderStatus(this._combinedEntryTooltip,m,o,v,this._renderDisposables),d.push(ei._accessibilityInformation(m).label),r=r||!v&&m.busy}const l={name:c(7558,"Editor Language Status"),ariaLabel:c(7559,"Editor Language Status: {0}",d.join(", next: ")),tooltip:this._combinedEntryTooltip,command:lA,text:r?"$(loading~spin)":n};this._combinedEntry?this._combinedEntry.update(l):this._combinedEntry=this._statusBarService.addEntry(l,ei._id,et.RIGHT,{location:{id:"status.editor.mode",priority:100.1},alignment:et.LEFT,compact:!0});const h=this._interactionCounter.value>=3,p=St(e?.getContainerDomNode()),f=p.document.querySelector(".monaco-workbench .statusbar DIV#status\\.languageStatus A>SPAN.codicon"),g=p.document.querySelector(".monaco-workbench .statusbar DIV#status\\.languageStatus");if(qn(f)&&g){const m="wiggle",v="flash";r?(f.classList.remove(m),g.classList.remove(v)):(f.classList.toggle(m,o||!h),this._renderDisposables.add(J(f,"animationend",C=>f.classList.remove(m))),g.classList.toggle(v,o),this._renderDisposables.add(J(g,"animationend",C=>g.classList.remove(v))))}if(!h){const m=p.document.querySelector(".monaco-workbench .context-view");if(qn(m)){const v=new MutationObserver(()=>{p.document.contains(this._combinedEntryTooltip)&&(this._interactionCounter.increment(),v.disconnect())});v.observe(m,{childList:!0,subtree:!0}),this._renderDisposables.add(ae(()=>v.disconnect()))}}}const i=new Map;for(const s of t.dedicated){const o=ei._asStatusbarEntry(s);let n=this._dedicatedEntries.get(s.id);n?(n.update(o),this._dedicatedEntries.delete(s.id)):n=this._statusBarService.addEntry(o,s.id,et.RIGHT,{location:{id:"status.editor.mode",priority:100.1},alignment:et.RIGHT}),i.set(s.id,n)}je(this._dedicatedEntries.values()),this._dedicatedEntries=i}_renderStatus(e,t,i,s,o){const n=document.createElement("div");n.classList.add("hover-language-status"),e.appendChild(n),o.add(ae(()=>n.remove()));const r=document.createElement("div");r.classList.add("severity",`sev${t.severity}`),r.classList.toggle("show",i);const d=ei._severityToSingleCodicon(t.severity);ge(r,...Ki(d)),n.appendChild(r);const l=document.createElement("div");l.classList.add("element"),n.appendChild(l);const h=document.createElement("div");h.classList.add("left"),l.appendChild(h);const p=typeof t.label=="string"?t.label:t.label.value;ge(h,...Ki(km(p,t.busy))),this._renderTextPlus(h,t.detail,o);const f=document.createElement("div");f.classList.add("right"),l.appendChild(f);const{command:g}=t;g&&o.add(new Pf(f,{label:g.title,title:g.tooltip,href:$.from({scheme:"command",path:g.id,query:g.arguments&&JSON.stringify(g.arguments)}).toString()},{hoverDelegate:Mf},this._hoverService,this._openerService));const m=new cr(f,{hoverDelegate:Mf}),v=s?c(7560,"Remove from Status Bar"):c(7561,"Add to Status Bar");m.setAriaLabel(v),o.add(m);let C;return s?C=new _t("unpin",v,Ce.asClassName(k.pinned),!0,()=>{this._dedicated.delete(t.id),this._statusBarService.updateEntryVisibility(t.id,!1),this._update(),this._storeState()}):C=new _t("pin",v,Ce.asClassName(k.pin),!0,()=>{this._dedicated.add(t.id),this._statusBarService.updateEntryVisibility(t.id,!0),this._update(),this._storeState()}),m.push(C,{icon:!0,label:!1}),o.add(C),n}static _severityToComboCodicon(e){switch(e){case Se.Error:return"$(bracket-error)";case Se.Warning:return"$(bracket-dot)";default:return"$(bracket)"}}static _severityToSingleCodicon(e){switch(e){case Se.Error:return"$(error)";case Se.Warning:return"$(info)";default:return"$(check)"}}_renderTextPlus(e,t,i){let s=!1;for(const o of Ed(t).nodes)if(s||(ge(e,M("span.separator")),s=!0),typeof o=="string"){const n=Ki(o);ge(e,...n)}else i.add(new Pf(e,o,void 0,this._hoverService,this._openerService))}static _accessibilityInformation(e){if(e.accessibilityInfo)return e.accessibilityInfo;const t=typeof e.label=="string"?e.label:e.label.value;return e.detail?{label:c(7562,"{0}, {1}",t,e.detail)}:{label:c(7563,"{0}",t)}}static _asStatusbarEntry(e){let t;e.severity===Se.Warning?t="warning":e.severity===Se.Error&&(t="error");const i=typeof e.label=="string"?e.label:e.label.shortValue;return{name:c(7564,"{0} (Language Status)",e.name),text:km(i,e.busy),ariaLabel:ei._accessibilityInformation(e).label,role:e.accessibilityInfo?.role,tooltip:e.command?.tooltip||new wi(e.detail,{isTrusted:!0,supportThemeIcons:!0}),kind:t,command:e.command}}},ei=zs,zs._id="status.languageStatus",zs._keyDedicatedItems="languageStatus.dedicated",zs);up=ei=D([u(0,Zy),u(1,Ui),u(2,Q),u(3,Tt),u(4,xt),u(5,ce)],up);class KR extends X{constructor(){super({id:"editor.inlayHints.Reset",title:x(7565,"Reset Language Status Interaction Counter"),category:xe.View,f1:!0})}run(e){e.get(ce).remove("languageStatus.interactCount",H.PROFILE)}}function km(a,e){return hA([a!==""&&a,e&&"$(loading~spin)"]," ")}yt(ac.Id,ac,vt.AfterRestored);b(KR);const WR=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));he("mergeEditor.change.background","#9bb95533",c(8071,"The background color for changes."));he("mergeEditor.change.word.background",{dark:"#9ccc2c33",light:"#9ccc2c66",hcDark:"#9ccc2c33",hcLight:"#9ccc2c66"},c(8072,"The background color for word changes."));he("mergeEditor.changeBase.background",{dark:"#4B1818FF",light:"#FFCCCCFF",hcDark:"#4B1818FF",hcLight:"#FFCCCCFF"},c(8073,"The background color for changes in base."));he("mergeEditor.changeBase.word.background",{dark:"#6F1313FF",light:"#FFA3A3FF",hcDark:"#6F1313FF",hcLight:"#FFA3A3FF"},c(8074,"The background color for word changes in base."));he("mergeEditor.conflict.unhandledUnfocused.border",{dark:"#ffa6007a",light:"#ffa600FF",hcDark:"#ffa6007a",hcLight:"#ffa6007a"},c(8075,"The border color of unhandled unfocused conflicts."));he("mergeEditor.conflict.unhandledFocused.border","#ffa600",c(8076,"The border color of unhandled focused conflicts."));he("mergeEditor.conflict.handledUnfocused.border","#86868649",c(8077,"The border color of handled unfocused conflicts."));he("mergeEditor.conflict.handledFocused.border","#c1c1c1cc",c(8078,"The border color of handled focused conflicts."));const ir=he("mergeEditor.conflict.handled.minimapOverViewRuler","#adaca8ee",c(8079,"The foreground color for changes in input 1.")),sr=he("mergeEditor.conflict.unhandled.minimapOverViewRuler","#fcba03FF",c(8080,"The foreground color for changes in input 1."));he("mergeEditor.conflictingLines.background","#ffea0047",c(8081,'The background of the "Conflicting Lines" text.'));const nb=.4;he("mergeEditor.conflict.input1.background",qo(uA,nb),c(8082,"The background color of decorations in input 1."));he("mergeEditor.conflict.input2.background",qo(pA,nb),c(8083,"The background color of decorations in input 2."));class wg extends R{constructor(e,t,i){super(),this._editor=e,this._domNode=t,this.itemProvider=i,this.scrollTop=Gr(this,this._editor.onDidScrollChange,n=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(n=>n===0),this.modelAttached=Gr(this,this._editor.onDidChangeModel,n=>this._editor.hasModel()),this.editorOnDidChangeViewZones=Of("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=Of("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=gA("domNodeSizeChanged"),this.views=new Map,this._domNode.className="gutter monaco-editor";const s=this._domNode.appendChild(ht("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),o=new ResizeObserver(()=>{Ae(n=>{this.domNodeSizeChanged.trigger(n)})});o.observe(this._domNode),this._register(ae(()=>o.disconnect())),this._register(Si(n=>{s.className=this.isScrollTopZero.read(n)?"":"scroll-decoration"})),this._register(Si(n=>this.render(n)))}dispose(){super.dispose(),Wi(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);const t=this.scrollTop.read(e),i=this._editor.getVisibleRanges(),s=new Set(this.views.keys());if(i.length>0){const o=i[0],n=Qc.fromLength(o.startLineNumber,o.endLineNumber-o.startLineNumber).deltaEnd(1),r=this.itemProvider.getIntersectingGutterItems(n,e);for(const d of r){if(!d.range.intersectsOrTouches(n))continue;s.delete(d.id);let l=this.views.get(d.id);if(l)l.gutterItemView.update(d);else{const g=document.createElement("div");this._domNode.appendChild(g);const m=this.itemProvider.createView(d,g);l=new GR(m,g),this.views.set(d.id,l)}const h=d.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(d.range.startLineNumber,!0)-t:this._editor.getBottomForLineNumber(d.range.startLineNumber-1,!1)-t,f=this._editor.getBottomForLineNumber(d.range.endLineNumberExclusive-1,!0)-t-h;l.domNode.style.top=`${h}px`,l.domNode.style.height=`${f}px`,l.gutterItemView.layout(h,f,0,this._domNode.clientHeight)}}for(const o of s){const n=this.views.get(o);n.gutterItemView.dispose(),n.domNode.remove(),this.views.delete(o)}}}class GR{constructor(e,t){this.gutterItemView=e,this.domNode=t}}class yg extends R{updateOptions(e){this.editor.updateOptions(e)}constructor(e,t,i){super(),this.instantiationService=e,this.viewModel=t,this.configurationService=i,this.model=this.viewModel.map(s=>s?.model),this.htmlElements=ht("div.code-view",[ht("div.header@header",[ht("span.title@title"),ht("span.description@description"),ht("span.detail@detail"),ht("span.toolbar@toolbar")]),ht("div.container",[ht("div.gutter@gutterDiv"),ht("div@editor")])]),this._onDidViewChange=new E,this.view={element:this.htmlElements.root,minimumWidth:Bf.width,maximumWidth:Nf.width,minimumHeight:Bf.height,maximumHeight:Nf.height,onDidChange:this._onDidViewChange.event,layout:(s,o,n,r)=>{mA(this.htmlElements.root,{width:s,height:o,top:n,left:r}),this.editor.layout({width:s-this.htmlElements.gutterDiv.clientWidth,height:o-this.htmlElements.header.clientHeight})}},this.checkboxesVisible=hd("mergeEditor.showCheckboxes",!1,this.configurationService),this.showDeletionMarkers=hd("mergeEditor.showDeletionMarkers",!0,this.configurationService),this.useSimplifiedDecorations=hd("mergeEditor.useSimplifiedDecorations",!1,this.configurationService),this.editor=this.instantiationService.createInstance(cy,this.htmlElements.editor,{},{contributions:this.getEditorContributions()}),this.isFocused=Gr(this,L.any(this.editor.onDidBlurEditorWidget,this.editor.onDidFocusEditorWidget),()=>this.editor.hasWidgetFocus()),this.cursorPosition=Gr(this,this.editor.onDidChangeCursorPosition,()=>this.editor.getPosition()),this.selection=Gr(this,this.editor.onDidChangeCursorSelection,()=>this.editor.getSelections()),this.cursorLineNumber=this.cursorPosition.map(s=>s?.lineNumber)}getEditorContributions(){return wA.getEditorContributions().filter(e=>e.id!==Xy.ID&&e.id!==yA.ID)}}function vg(a,e){const t=Ft(i=>{const s=a.viewModel.read(i);if(!s)return[];const o=s.selectionInBase.read(i);return!o||o.sourceEditor===a?[]:o.rangesInBase.map(n=>e(n,s))});return Si(i=>{const s=t.read(i);s.length!==0&&a.editor.setSelections(s.map(o=>new gy(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn)))})}let ba=class extends R{constructor(e,t,i){super();const s=i.createInstance(fA,t,e,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:o=>o==="primary"}});this._store.add(s)}};ba=D([u(2,F)],ba);let pp=class extends yg{constructor(e,t,i){super(t,e,i),this.decorations=Ft(this,s=>{const o=this.viewModel.read(s);if(!o)return[];const n=o.model,r=n.base,d=o.activeModifiedBaseRange.read(s),l=o.showNonConflictingChanges.read(s),h=this.showDeletionMarkers.read(s),p=[];for(const f of n.modifiedBaseRanges.read(s)){const g=f.baseRange;if(!g)continue;const m=n.isHandled(f).read(s);if(!f.isConflicting&&m&&!l)continue;const v=["merge-editor-block"];let C=[0,0,0,0];m&&v.push("handled"),f===d&&(v.push("focused"),C=[0,2,0,2]),v.push("base");const T=o.baseShowDiffAgainst.read(s);if(T)for(const B of f.getInputDiffs(T)){const V=B.inputRange.toInclusiveRange();V&&p.push({range:V,options:{className:"merge-editor-diff base",description:"Merge Editor",isWholeLine:!0}});for(const U of B.rangeMappings)(h||!U.inputRange.isEmpty())&&p.push({range:U.inputRange,options:{className:U.inputRange.isEmpty()?"merge-editor-diff-empty-word base":"merge-editor-diff-word base",description:"Merge Editor",showIfCollapsed:!0}})}p.push({range:g.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:v.join(" "),blockPadding:C,blockIsAfterEnd:g.startLineNumber>r.getLineCount(),description:"Merge Editor",minimap:{position:eg.Gutter,color:{id:m?ir:sr}},overviewRuler:f.isConflicting?{position:lr.Center,color:{id:m?ir:sr}}:void 0}})}return p}),this._register(vg(this,(s,o)=>s)),this._register(t.createInstance(ba,w.MergeBaseToolbar,this.htmlElements.title)),this._register(tg((s,o)=>{this.checkboxesVisible.read(s)&&o.add(new wg(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(n,r)=>[],createView:(n,r)=>{throw new el}}))})),this._register(Si(s=>{const o=this.viewModel.read(s);if(!o)return;this.editor.setModel(o.model.base),Wi(this.htmlElements.title,...Ki(c(8102,"Base")));const n=o.baseShowDiffAgainst.read(s);let r;if(n){const d=c(8103,"Comparing with {0}",n===1?o.model.input1.title:o.model.input2.title),l=c(8104,"Differences are highlighted with a background color.");r=ht("span",{title:l},[d]).root}Wi(this.htmlElements.description,...r?[r]:[])})),this._register(ig(this.editor,this.decorations))}};pp=D([u(1,F),u(2,ie)],pp);class UR extends R{get model(){return this.viewModel.get()?.model}get lockResultWithInputs(){return this.layout.get().kind==="columns"}get lockBaseWithInputs(){return this.layout.get().kind==="mixed"&&!this.layout.get().showBaseAtTop}constructor(e,t,i,s,o,n){super(),this.viewModel=e,this.input1View=t,this.input2View=i,this.baseView=s,this.inputResultView=o,this.layout=n,this.reentrancyBarrier=new vA,this._isSyncing=!0;const r=Ft(d=>{const l=this.baseView.read(d),h=[this.input1View,this.input2View,this.inputResultView,l].filter(os),p=(f,g,m)=>{this.reentrancyBarrier.runExclusivelyOrSkip(()=>{if(g){const v=f.editor.getScrollLeft();for(const C of h)C!==f&&C.editor.setScrollLeft(v,ft.Immediate)}if(m){const v=f.editor.getScrollTop();for(const C of h)if(C!==f)if(this._shouldLock(f,C))C.editor.setScrollTop(v,ft.Immediate);else{const T=this._getMapping(f,C);T&&this._synchronizeScrolling(f.editor,C.editor,T)}}})};for(const f of h)d.store.add(f.editor.onDidScrollChange(g=>{this._isSyncing&&p(f,g.scrollLeftChanged,g.scrollTopChanged)}));return{update:()=>{p(this.inputResultView,!0,!0)}}}).recomputeInitiallyAndOnChange(this._store);this.updateScrolling=()=>{r.get().update()}}stopSync(){this._isSyncing=!1}startSync(){this._isSyncing=!0}_shouldLock(e,t){const i=s=>s===this.input1View||s===this.input2View;return i(e)&&t===this.inputResultView||i(t)&&e===this.inputResultView?this.lockResultWithInputs:i(e)&&t===this.baseView.get()||i(t)&&e===this.baseView.get()?this.lockBaseWithInputs:!!(i(e)&&i(t))}_getMapping(e,t){if(e===this.input1View){if(t===this.input2View)return;if(t===this.inputResultView)return this.model?.input1ResultMapping.get();if(t===this.baseView.get()){const i=this.model?.baseInput1Diffs.get();return i?new Xa(i,-1).reverse():void 0}}else if(e===this.input2View){if(t===this.input1View)return;if(t===this.inputResultView)return this.model?.input2ResultMapping.get();if(t===this.baseView.get()){const i=this.model?.baseInput2Diffs.get();return i?new Xa(i,-1).reverse():void 0}}else if(e===this.inputResultView){if(t===this.input1View)return this.model?.resultInput1Mapping.get();if(t===this.input2View)return this.model?.resultInput2Mapping.get();if(t===this.baseView.get()){const i=this.model?.resultBaseMapping.get();return i||void 0}}else if(e===this.baseView.get()){if(t===this.input1View){const i=this.model?.baseInput1Diffs.get();return i?new Xa(i,-1):void 0}else if(t===this.input2View){const i=this.model?.baseInput2Diffs.get();return i?new Xa(i,-1):void 0}else if(t===this.inputResultView){const i=this.model?.baseResultMapping.get();return i||void 0}}throw new el}_synchronizeScrolling(e,t,i){if(!i)return;const s=e.getVisibleRanges();if(s.length===0)return;const o=s[0].startLineNumber-1,n=i.project(o),r=n.inputRange,d=n.outputRange,l=t.getTopForLineNumber(d.startLineNumber),h=t.getTopForLineNumber(d.endLineNumberExclusive),p=e.getTopForLineNumber(r.startLineNumber),f=e.getTopForLineNumber(r.endLineNumberExclusive),g=Math.min((e.getScrollTop()-p)/(f-p),1),m=l+(h-l)*g;t.setScrollTop(m,ft.Immediate)}}let gp=class extends R{constructor(e,t,i,s,o,n,r,d){super(),this.model=e,this.inputCodeEditorView1=t,this.inputCodeEditorView2=i,this.resultCodeEditorView=s,this.baseCodeEditorView=o,this.showNonConflictingChanges=n,this.configurationService=r,this.notificationService=d,this.manuallySetActiveModifiedBaseRange=ts(this,{range:void 0,counter:0}),this.attachedHistory=this._register(new HR(this.model.resultTextModel)),this.shouldUseAppendInsteadOfAccept=hd("mergeEditor.shouldUseAppendInsteadOfAccept",!1,this.configurationService),this.counter=0,this.lastFocusedEditor=bA(this,(l,h)=>{const f=[this.inputCodeEditorView1,this.inputCodeEditorView2,this.resultCodeEditorView,this.baseCodeEditorView.read(l)].find(g=>g&&g.isFocused.read(l));return f?{view:f,counter:this.counter++}:h||{view:void 0,counter:this.counter++}}),this.baseShowDiffAgainst=Ft(this,l=>{const h=this.lastFocusedEditor.read(l);if(h.view===this.inputCodeEditorView1)return 1;if(h.view===this.inputCodeEditorView2)return 2}),this.focusedEditorType=Ft(this,l=>{const h=this.lastFocusedEditor.read(l);if(h.view){if(h.view===this.inputCodeEditorView1)return"input1";if(h.view===this.inputCodeEditorView2)return"input2";if(h.view===this.resultCodeEditorView)return"result";if(h.view===this.baseCodeEditorView.read(l))return"base"}}),this.selectionInBase=Ft(this,l=>{const h=this.lastFocusedEditor.read(l).view;return h?{rangesInBase:(h.selection.read(l)||[]).map(g=>h===this.inputCodeEditorView1?this.model.translateInputRangeToBase(1,g):h===this.inputCodeEditorView2?this.model.translateInputRangeToBase(2,g):h===this.resultCodeEditorView?this.model.translateResultRangeToBase(g):(h===this.baseCodeEditorView.read(l),g)),sourceEditor:h}:void 0}),this.activeModifiedBaseRange=Ft(this,l=>{const h=this.lastFocusedEditor.read(l),p=this.manuallySetActiveModifiedBaseRange.read(l);if(p.counter>h.counter)return p.range;if(!h.view)return;const f=h.view.cursorLineNumber.read(l);return f?this.model.modifiedBaseRanges.read(l).find(m=>{const v=this.getRangeOfModifiedBaseRange(h.view,m,l);return v.isEmpty?v.startLineNumber===f:v.contains(f)}):void 0}),this._register(s.editor.onDidChangeModelContent(l=>{if(this.model.isApplyingEditInResult||l.isRedoing||l.isUndoing)return;const h=[];for(const f of l.changes){const g=this.model.translateResultRangeToBase(ve.lift(f.range)),m=this.model.findModifiedBaseRangesInRange(Qc.fromLength(g.startLineNumber,g.endLineNumber-g.startLineNumber));m.length===1&&(this.model.isHandled(m[0]).get()||h.push(m[0]))}if(h.length===0)return;const p={model:this.model,redo(){Ae(f=>{for(const g of h)this.model.setHandled(g,!0,f)})},undo(){Ae(f=>{for(const g of h)this.model.setHandled(g,!1,f)})}};this.attachedHistory.pushAttachedHistoryElement(p),p.redo()}))}getRangeOfModifiedBaseRange(e,t,i){if(e===this.resultCodeEditorView)return this.model.getLineRangeInResult(t.baseRange,i);if(e===this.baseCodeEditorView.get())return t.baseRange;{const s=e===this.inputCodeEditorView1?1:2;return t.getInputRange(s)}}setActiveModifiedBaseRange(e,t){this.manuallySetActiveModifiedBaseRange.set({range:e,counter:this.counter++},t)}setState(e,t,i,s){this.manuallySetActiveModifiedBaseRange.set({range:e,counter:this.counter++},i),this.model.setState(e,t,s,i),this.lastFocusedEditor.clearCache(i)}goToConflict(e){let t=this.lastFocusedEditor.get().view;t||(t=this.resultCodeEditorView);const i=t.editor.getPosition()?.lineNumber;if(i===void 0)return;const s=e(t,i);if(s){const o=this.getRangeOfModifiedBaseRange(t,s,void 0);t.editor.focus();let n=o.startLineNumber,r=o.endLineNumberExclusive;o.startLineNumber>t.editor.getModel().getLineCount()&&(Ae(d=>{this.setActiveModifiedBaseRange(s,d)}),n=r=t.editor.getModel().getLineCount()),t.editor.setPosition({lineNumber:n,column:t.editor.getModel().getLineFirstNonWhitespaceColumn(n)}),t.editor.revealLinesNearTop(n,r,ft.Smooth)}}goToNextModifiedBaseRange(e){this.goToConflict((t,i)=>this.model.modifiedBaseRanges.get().find(s=>e(s)&&this.getRangeOfModifiedBaseRange(t,s,void 0).startLineNumber>i)||this.model.modifiedBaseRanges.get().find(s=>e(s)))}goToPreviousModifiedBaseRange(e){this.goToConflict((t,i)=>Ff(this.model.modifiedBaseRanges.get(),s=>e(s)&&this.getRangeOfModifiedBaseRange(t,s,void 0).endLineNumberExclusive<i)||Ff(this.model.modifiedBaseRanges.get(),s=>e(s)))}toggleActiveConflict(e){const t=this.activeModifiedBaseRange.get();if(!t){this.notificationService.error(c(8121,"There is currently no conflict focused that can be toggled."));return}Ae(i=>{this.setState(t,this.model.getState(t).get().toggle(e),i,e)})}acceptAll(e){Ae(t=>{for(const i of this.model.modifiedBaseRanges.get())this.setState(i,this.model.getState(i).get().withInputValue(e,!0),t,e)})}};gp=D([u(6,ie),u(7,Ke)],gp);class HR extends R{constructor(e){super(),this.model=e,this.attachedHistory=[],this.previousAltId=this.model.getAlternativeVersionId(),this._register(e.onDidChangeContent(t=>{const i=e.getAlternativeVersionId();if(t.isRedoing)for(const s of this.attachedHistory)this.previousAltId<s.altId&&s.altId<=i&&s.element.redo();else if(t.isUndoing)for(let s=this.attachedHistory.length-1;s>=0;s--){const o=this.attachedHistory[s];i<o.altId&&o.altId<=this.previousAltId&&o.element.undo()}else for(;this.attachedHistory.length>0&&this.attachedHistory[this.attachedHistory.length-1].altId>this.previousAltId;)this.attachedHistory.pop();this.previousAltId=i}))}pushAttachedHistoryElement(e){this.attachedHistory.push({altId:this.model.getAlternativeVersionId(),element:e})}}const _c=class _c extends R{constructor(e,t,i,s,o){super(),this.editor=e,this.overlayWidgetId=`fixedZoneWidget-${_c.counter++}`,this.widgetDomNode=ht("div.fixed-zone-widget").root,this.overlayWidget={getId:()=>this.overlayWidgetId,getDomNode:()=>this.widgetDomNode,getPosition:()=>null},this.viewZoneId=t.addZone({domNode:document.createElement("div"),afterLineNumber:i,heightInPx:s,ordinal:50001,onComputedHeight:n=>{this.widgetDomNode.style.height=`${n}px`},onDomNodeTop:n=>{this.widgetDomNode.style.top=`${n}px`}}),o.push(this.viewZoneId),this._register(L.runAndSubscribe(this.editor.onDidLayoutChange,()=>{this.widgetDomNode.style.left=this.editor.getLayoutInfo().contentLeft+"px"})),this.editor.addOverlayWidget(this.overlayWidget),this._register({dispose:()=>{this.editor.removeOverlayWidget(this.overlayWidget)}})}};_c.counter=0;let fp=_c;class Fl extends R{constructor(e){super(),this._editor=e,this._register(this._editor.onDidChangeConfiguration(t=>{(t.hasChanged(Mt.fontInfo)||t.hasChanged(Mt.codeLensFontSize)||t.hasChanged(Mt.codeLensFontFamily))&&this._updateLensStyle()})),this._styleClassName="_conflictActionsFactory_"+CA(this._editor.getId()).toString(16),this._styleElement=aw(SA(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,void 0,this._store),this._updateLensStyle()}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(Mt.codeLensFontFamily),s=this._editor.getOption(Mt.fontInfo),o=`--codelens-font-family${this._styleClassName}`,n=`--codelens-font-features${this._styleClassName}`;let r=`
|
|
42
|
+
.${this._styleClassName} { line-height: ${e}px; font-size: ${t}px; padding-right: ${Math.round(t*.5)}px; font-feature-settings: var(${n}) }
|
|
43
|
+
.monaco-workbench .${this._styleClassName} span.codicon { line-height: ${e}px; font-size: ${t}px; }
|
|
44
|
+
`;i&&(r+=`${this._styleClassName} { font-family: var(${o}), ${cd.fontFamily}}`),this._styleElement.textContent=r,this._editor.getContainerDomNode().style?.setProperty(o,i??"inherit"),this._editor.getContainerDomNode().style?.setProperty(n,s.fontFeatureSettings)}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(Mt.lineHeight)/this._editor.getOption(Mt.fontSize));let t=this._editor.getOption(Mt.codeLensFontSize);return(!t||t<5)&&(t=this._editor.getOption(Mt.fontSize)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}createWidget(e,t,i,s){const o=this._getLayoutInfo();return new $R(this._editor,e,t,o.codeLensHeight+2,this._styleClassName,i,s)}}class zR{constructor(e,t){this.viewModel=e,this.modifiedBaseRange=t,this.itemsInput1=this.getItemsInput(1),this.itemsInput2=this.getItemsInput(2),this.resultItems=Ft(this,i=>{const s=this.viewModel,o=this.modifiedBaseRange,n=s.model.getState(o).read(i),r=s.model,d=[];if(n.kind===io.unrecognized)d.push({text:c(8084,"Manual Resolution"),tooltip:c(8085,"This conflict has been resolved manually.")});else if(n.kind===io.base)d.push({text:c(8086,"No Changes Accepted"),tooltip:c(8087,"The current resolution of this conflict equals the common ancestor of both the right and left changes.")});else{const h=[];n.includesInput1&&h.push(r.input1.title),n.includesInput2&&h.push(r.input2.title),n.kind===io.both&&n.firstInput===2&&h.reverse(),d.push({text:`${h.join(" + ")}`})}const l=[];return n.includesInput1&&l.push(Is(c(8088,"Remove {0}",r.input1.title),async()=>{Ae(h=>{r.setState(o,n.withInputValue(1,!1),!0,h),r.telemetry.reportRemoveInvoked(1,n.includesInput(2))})},c(8089,"Remove {0} from the result document.",r.input1.title))),n.includesInput2&&l.push(Is(c(8088,"Remove {0}",r.input2.title),async()=>{Ae(h=>{r.setState(o,n.withInputValue(2,!1),!0,h),r.telemetry.reportRemoveInvoked(2,n.includesInput(1))})},c(8089,"Remove {0} from the result document.",r.input2.title))),n.kind===io.both&&n.firstInput===2&&l.reverse(),d.push(...l),n.kind===io.unrecognized&&d.push(Is(c(8090,"Reset to base"),async()=>{Ae(h=>{r.setState(o,Kf.base,!0,h),r.telemetry.reportResetToBaseInvoked()})},c(8091,"Reset this conflict to the common ancestor of both the right and left changes."))),d}),this.isEmpty=Ft(this,i=>this.itemsInput1.read(i).length+this.itemsInput2.read(i).length+this.resultItems.read(i).length===0),this.inputIsEmpty=Ft(this,i=>this.itemsInput1.read(i).length+this.itemsInput2.read(i).length===0)}getItemsInput(e){return Ft(t=>{const i=this.viewModel,s=this.modifiedBaseRange;if(!i.model.hasBaseRange(s))return[];const o=i.model.getState(s).read(t),n=i.model.isHandled(s).read(t),r=i.model,d=[],l=e===1?i.model.input1:i.model.input2,h=i.showNonConflictingChanges.read(t);if(!s.isConflicting&&n&&!h)return[];const p=e===1?2:1;if(o.kind!==io.unrecognized&&!o.isInputIncluded(e)){if(!o.isInputIncluded(p)||!this.viewModel.shouldUseAppendInsteadOfAccept.read(t)){if(d.push(Is(c(8092,"Accept {0}",l.title),async()=>{Ae(f=>{r.setState(s,o.withInputValue(e,!0,!1),e,f),r.telemetry.reportAcceptInvoked(e,o.includesInput(p))})},c(8093,"Accept {0} in the result document.",l.title))),s.canBeCombined){const f=s.isOrderRelevant?c(8094,"Accept Combination ({0} First)",l.title):c(8095,"Accept Combination");d.push(Is(f,async()=>{Ae(g=>{r.setState(s,Kf.base.withInputValue(e,!0).withInputValue(p,!0,!0),!0,g),r.telemetry.reportSmartCombinationInvoked(o.includesInput(p))})},c(8096,"Accept an automatic combination of both sides in the result document.")))}}else d.push(Is(c(8097,"Append {0}",l.title),async()=>{Ae(f=>{r.setState(s,o.withInputValue(e,!0,!1),e,f),r.telemetry.reportAcceptInvoked(e,o.includesInput(p))})},c(8098,"Append {0} to the result document.",l.title))),s.canBeCombined&&d.push(Is(c(8099,"Accept Combination",l.title),async()=>{Ae(f=>{r.setState(s,o.withInputValue(e,!0,!0),e,f),r.telemetry.reportSmartCombinationInvoked(o.includesInput(p))})},c(8096,"Accept an automatic combination of both sides in the result document.")));r.isInputHandled(s,e).read(t)||d.push(Is(c(8100,"Ignore"),async()=>{Ae(f=>{r.setInputHandled(s,e,!0,f)})},c(8101,"Don't take this side of the conflict.")))}return d})}}function Is(a,e,t){return{text:a,action:e,tooltip:t}}class $R extends fp{constructor(e,t,i,s,o,n,r){super(e,t,i,s,r),this._domNode=ht("div.merge-editor-conflict-actions").root,this.widgetDomNode.appendChild(this._domNode),this._domNode.classList.add(o),this._register(Si(d=>{const l=n.read(d);this.setState(l)}))}setState(e){const t=[];let i=!0;for(const s of e){i?i=!1:t.push(M("span",void 0," | "));const o=Ki(s.text);s.action?t.push(M("a",{title:s.tooltip,role:"button",onclick:()=>s.action()},...o)):t.push(M("span",{title:s.tooltip},...o))}Wi(this._domNode,...t)}}function qR(a){const e=Rm(a.input1Diffs.flatMap(r=>r.rangeMappings),a.baseRange.toExclusiveRange(),a.input1Range.toExclusiveRange()),t=Rm(a.input2Diffs.flatMap(r=>r.rangeMappings),a.baseRange.toExclusiveRange(),a.input2Range.toExclusiveRange()),i=jR(e,t);let s=[];s.push([a.input1Range.startLineNumber-1,a.baseRange.startLineNumber-1,a.input2Range.startLineNumber-1]);function o(r){return r.every(d=>d!==void 0)}for(const r of i){const d=[r.output1Pos?.lineNumber,r.inputPos.lineNumber,r.output2Pos?.lineNumber],l=o(d);let h=!0;if(l){const p=!s.some(f=>o(f)&&f.some((g,m)=>g!==void 0&&g===d[m]));p&&(s=s.filter(f=>!f.some((g,m)=>g!==void 0&&g===d[m]))),h=p}else h=!s.some(f=>f.some((g,m)=>g!==void 0&&g===d[m]));h?s.push(d):r.length.isGreaterThan(new _A(1,0))&&s.push([r.output1Pos?r.output1Pos.lineNumber+1:void 0,r.inputPos.lineNumber+1,r.output2Pos?r.output2Pos.lineNumber+1:void 0])}const n=[a.input1Range.endLineNumberExclusive,a.baseRange.endLineNumberExclusive,a.input2Range.endLineNumberExclusive];return s=s.filter(r=>r.every((d,l)=>d!==n[l])),s.push(n),dh(()=>Tl(s.map(r=>r[0]).filter(os),(r,d)=>r<d)&&Tl(s.map(r=>r[1]).filter(os),(r,d)=>r<=d)&&Tl(s.map(r=>r[2]).filter(os),(r,d)=>r<d)&&s.every(r=>r.filter(os).length>=2)),s}function Rm(a,e,t){const i=[];let s=e.getStartPosition(),o=t.getStartPosition();for(const r of a){const d=new Wf(ve.fromPositions(s,r.inputRange.getStartPosition()),ve.fromPositions(o,r.outputRange.getStartPosition()));dh(()=>Qa(d.inputRange).equals(Qa(d.outputRange))),d.inputRange.isEmpty()||i.push(d),s=r.inputRange.getEndPosition(),o=r.outputRange.getEndPosition()}const n=new Wf(ve.fromPositions(s,e.getEndPosition()),ve.fromPositions(o,t.getEndPosition()));return dh(()=>Qa(n.inputRange).equals(Qa(n.outputRange))),n.inputRange.isEmpty()||i.push(n),i}function jR(a,e){const t=[],i=[];for(const[n,r]of[[0,a],[1,e]])for(const d of r)i.push({input:n,start:!0,inputPos:d.inputRange.getStartPosition(),outputPos:d.outputRange.getStartPosition()}),i.push({input:n,start:!1,inputPos:d.inputRange.getEndPosition(),outputPos:d.outputRange.getEndPosition()});i.sort(EA(n=>n.inputPos,rd.compare));const s=[void 0,void 0];let o;for(const n of i){if(o&&s.some(r=>!!r)){const r=IA(o,n.inputPos);r.isZero()||(t.push({inputPos:o,length:r,output1Pos:s[0],output2Pos:s[1]}),s[0]&&(s[0]=Gf(s[0],r)),s[1]&&(s[1]=Gf(s[1],r)))}s[n.input]=n.start?n.outputPos:void 0,o=n.inputPos}return t}class YR{constructor(e,t,i){this.input1Editor=e,this.input2Editor=t,this.resultEditor=i,this.conflictActionsFactoryInput1=new Fl(this.input1Editor),this.conflictActionsFactoryInput2=new Fl(this.input2Editor),this.conflictActionsFactoryResult=new Fl(this.resultEditor)}computeViewZones(e,t,i){let s=0,o=0,n=0,r=0;const d=[],l=[],h=[],p=[],f=t.model,g=f.baseResultDiffs.read(e),m=Qy(f.modifiedBaseRanges.read(e),g,(V,U)=>V.baseRange.intersectsOrTouches(U.inputRange)?ev.neitherLessOrGreaterThan:Qc.compareByStart(V.baseRange,U.inputRange)),v=i.codeLensesVisible,C=i.showNonConflictingChanges;let T,B;for(const V of m){if(v&&V.left&&(V.left.isConflicting||C||!f.isHandled(V.left).read(e))){const K=new zR(t,V.left);(i.shouldAlignResult||!K.inputIsEmpty.read(e))&&(d.push(new Kl(this.conflictActionsFactoryInput1,V.left.input1Range.startLineNumber-1,K.itemsInput1)),l.push(new Kl(this.conflictActionsFactoryInput2,V.left.input2Range.startLineNumber-1,K.itemsInput2)),i.shouldAlignBase&&h.push(new ZR(V.left.baseRange.startLineNumber-1,16)));const j=V.left.baseRange.startLineNumber+(B?.resultingDeltaFromOriginalToModified??0)-1;p.push(new Kl(this.conflictActionsFactoryResult,j,K.resultItems))}const U=V.rights.at(-1);U&&(B=U);let W;V.left?(W=qR(V.left).map(K=>({input1Line:K[0],baseLine:K[1],input2Line:K[2],resultLine:void 0})),T=V.left,W[W.length-1].resultLine=V.left.baseRange.endLineNumberExclusive+(B?B.resultingDeltaFromOriginalToModified:0)):W=[{baseLine:U.inputRange.endLineNumberExclusive,input1Line:U.inputRange.endLineNumberExclusive+(T?T.input1Range.endLineNumberExclusive-T.baseRange.endLineNumberExclusive:0),input2Line:U.inputRange.endLineNumberExclusive+(T?T.input2Range.endLineNumberExclusive-T.baseRange.endLineNumberExclusive:0),resultLine:U.outputRange.endLineNumberExclusive}];for(const{input1Line:K,baseLine:j,input2Line:oe,resultLine:Me}of W){if(!i.shouldAlignBase&&(K===void 0||oe===void 0))continue;const bt=K!==void 0?K+s:-1,lt=oe!==void 0?oe+o:-1,Ti=j+n,$e=Me!==void 0?Me+r:-1,Qt=Math.max(i.shouldAlignBase?Ti:0,bt,lt,i.shouldAlignResult?$e:0);if(K!==void 0){const st=Qt-bt;st>0&&(d.push(new od(K-1,st)),s+=st)}if(oe!==void 0){const st=Qt-lt;st>0&&(l.push(new od(oe-1,st)),o+=st)}if(i.shouldAlignBase){const st=Qt-Ti;st>0&&(h.push(new od(j-1,st)),n+=st)}if(i.shouldAlignResult&&Me!==void 0){const st=Qt-$e;st>0&&(p.push(new od(Me-1,st)),r+=st)}}}return new JR(d,l,h,p)}}class JR{constructor(e,t,i,s){this.input1ViewZones=e,this.input2ViewZones=t,this.baseViewZones=i,this.resultViewZones=s}}class bg{}class od extends bg{constructor(e,t){super(),this.afterLineNumber=e,this.heightInLines=t}create(e,t,i){t.push(e.addZone({afterLineNumber:this.afterLineNumber,heightInLines:this.heightInLines,domNode:M("div.diagonal-fill")}))}}class ZR extends bg{constructor(e,t){super(),this.afterLineNumber=e,this.heightPx=t}create(e,t,i){t.push(e.addZone({afterLineNumber:this.afterLineNumber,heightInPx:this.heightPx,domNode:M("div.conflict-actions-placeholder")}))}}class Kl extends bg{constructor(e,t,i){super(),this.conflictActionsFactory=e,this.lineNumber=t,this.items=i}create(e,t,i){i.add(this.conflictActionsFactory.createWidget(e,this.lineNumber,this.items,t))}}const XR=he("settings.headerForeground",{light:"#444444",dark:"#e7e7e7",hcDark:"#ffffff",hcLight:"#292929"},c(9066,"The foreground color for a section header or active title."));he("settings.settingsHeaderHoverForeground",qo(XR,.7),c(9067,"The foreground color for a section header or hovered title."));he("settings.modifiedItemIndicator",{light:new oi(new ed(102,175,224)),dark:new oi(new ed(12,125,157)),hcDark:new oi(new ed(0,73,122)),hcLight:new oi(new ed(102,175,224))},c(9068,"The color of the modified setting indicator."));he("settings.headerBorder",vd,c(9069,"The color of the header container border."));const QR=he("settings.sashBorder",vd,c(9070,"The color of the Settings editor splitview sash border."));he("settings.dropdownBackground",DA,c(9071,"Settings editor dropdown background."));he("settings.dropdownForeground",AA,c(9072,"Settings editor dropdown foreground."));he("settings.dropdownBorder",TA,c(9073,"Settings editor dropdown border."));he("settings.dropdownListBorder",xA,c(9074,"Settings editor dropdown list border. This surrounds the options and separates the options from the description."));he("settings.checkboxBackground",kA,c(9075,"Settings editor checkbox background."));he("settings.checkboxForeground",RA,c(9076,"Settings editor checkbox foreground."));he("settings.checkboxBorder",LA,c(9077,"Settings editor checkbox border."));he("settings.textInputBackground",tv,c(9078,"Settings editor text input box background."));he("settings.textInputForeground",iv,c(9079,"Settings editor text input box foreground."));he("settings.textInputBorder",sv,c(9080,"Settings editor text input box border."));he("settings.numberInputBackground",tv,c(9081,"Settings editor number input box background."));he("settings.numberInputForeground",iv,c(9082,"Settings editor number input box foreground."));he("settings.numberInputBorder",sv,c(9083,"Settings editor number input box border."));he("settings.focusedRowBackground",{dark:qo(Rd,.6),light:qo(Rd,.6),hcDark:null,hcLight:null},c(9084,"The background color of a settings row when focused."));he("settings.rowHoverBackground",{dark:qo(Rd,.3),light:qo(Rd,.3),hcDark:null,hcLight:null},c(9085,"The background color of a settings row when hovered."));he("settings.focusedRowBorder",VA,c(9086,"The color of the row's top and bottom border when the row is focused."));let dc=class extends yg{constructor(e,t,i,s,o){super(i,t,o),this.inputNumber=e,this.otherInputNumber=this.inputNumber===1?2:1,this.modifiedBaseRangeGutterItemInfos=Uf({debugName:`input${this.inputNumber}.modifiedBaseRangeGutterItemInfos`},n=>{const r=this.viewModel.read(n);if(!r)return[];const d=r.model,l=this.inputNumber,h=r.showNonConflictingChanges.read(n);return d.modifiedBaseRanges.read(n).filter(p=>p.getInputDiffs(this.inputNumber).length>0&&(h||p.isConflicting||!d.isHandled(p).read(n))).map((p,f)=>new eL(f.toString(),p,l,r))}),this.decorations=Uf({debugName:`input${this.inputNumber}.decorations`},n=>{const r=this.viewModel.read(n);if(!r)return[];const d=r.model,l=(this.inputNumber===1?d.input1:d.input2).textModel,h=r.activeModifiedBaseRange.read(n),p=new Array,f=r.showNonConflictingChanges.read(n),g=this.showDeletionMarkers.read(n),v=!(r.baseCodeEditorView.read(n)!==void 0&&r.baseShowDiffAgainst.read(n)===this.inputNumber)&&this.useSimplifiedDecorations.read(n);for(const C of d.modifiedBaseRanges.read(n)){const T=C.getInputRange(this.inputNumber);if(!T)continue;const B=["merge-editor-block"];let V=[0,0,0,0];const U=d.isInputHandled(C,this.inputNumber).read(n);U&&B.push("handled"),C===h&&(B.push("focused"),V=[0,2,0,2]),C.isConflicting&&B.push("conflicting");const W=this.inputNumber===1?"input i1":"input i2";if(B.push(W),!(!C.isConflicting&&!f&&U)&&(v&&!U&&B.push("use-simplified-decorations"),p.push({range:T.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:B.join(" "),blockPadding:V,blockIsAfterEnd:T.startLineNumber>l.getLineCount(),description:"Merge Editor",minimap:{position:eg.Gutter,color:{id:U?ir:sr}},overviewRuler:C.isConflicting?{position:lr.Center,color:{id:U?ir:sr}}:void 0}}),!v&&(C.isConflicting||!d.isHandled(C).read(n)))){const K=C.getInputDiffs(this.inputNumber);for(const j of K){const oe=j.outputRange.toInclusiveRange();if(oe&&p.push({range:oe,options:{className:`merge-editor-diff ${W}`,description:"Merge Editor",isWholeLine:!0}}),j.rangeMappings)for(const Me of j.rangeMappings)(g||!Me.outputRange.isEmpty())&&p.push({range:Me.outputRange,options:{className:Me.outputRange.isEmpty()?`merge-editor-diff-empty-word ${W}`:`merge-editor-diff-word ${W}`,description:"Merge Editor",showIfCollapsed:!0}})}}}return p}),this.htmlElements.root.classList.add("input"),this._register(new wg(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(n,r)=>this.checkboxesVisible.read(r)?this.modifiedBaseRangeGutterItemInfos.read(r):[],createView:(n,r)=>new tL(n,r,s)})),this._register(vg(this,(n,r)=>r.model.translateBaseRangeToInput(this.inputNumber,n))),this._register(i.createInstance(ba,e===1?w.MergeInput1Toolbar:w.MergeInput2Toolbar,this.htmlElements.toolbar)),this._register(PA({debugName:`input${this.inputNumber}: update labels & text model`},n=>{const r=this.viewModel.read(n);if(!r)return;this.editor.setModel(this.inputNumber===1?r.model.input1.textModel:r.model.input2.textModel);const d=this.inputNumber===1?r.model.input1.title||c(8105,"Input 1"):r.model.input2.title||c(8106,"Input 2"),l=this.inputNumber===1?r.model.input1.description:r.model.input2.description,h=this.inputNumber===1?r.model.input1.detail:r.model.input2.detail;Wi(this.htmlElements.title,...Ki(d)),Wi(this.htmlElements.description,...l?Ki(l):[]),Wi(this.htmlElements.detail,...h?Ki(h):[])})),this._register(ig(this.editor,this.decorations))}};dc=D([u(2,F),u(3,at),u(4,ie)],dc);class eL{constructor(e,t,i,s){this.id=e,this.baseRange=t,this.inputNumber=i,this.viewModel=s,this.model=this.viewModel.model,this.range=this.baseRange.getInputRange(this.inputNumber),this.enabled=this.model.isUpToDate,this.toggleState=Ft(this,o=>{const n=this.model.getState(this.baseRange).read(o).getInput(this.inputNumber);return n===un.second&&!this.baseRange.isOrderRelevant?un.first:n}),this.state=Ft(this,o=>{const n=this.viewModel.activeModifiedBaseRange.read(o);return this.model.hasBaseRange(this.baseRange)?{handled:this.model.isHandled(this.baseRange).read(o),focused:this.baseRange===n}:{handled:!1,focused:!1}})}setState(e,t){this.viewModel.setState(this.baseRange,this.model.getState(this.baseRange).get().withInputValue(this.inputNumber,e),t,this.inputNumber)}toggleBothSides(){Ae(e=>{const t=this.model.getState(this.baseRange).get();this.model.setState(this.baseRange,t.toggle(this.inputNumber).toggle(this.inputNumber===1?2:1),!0,e)})}getContextMenuActions(){const e=this.model.getState(this.baseRange).get(),t=this.model.isHandled(this.baseRange).get(),i=n=>{Ae(r=>this.viewModel.setState(this.baseRange,n,r,this.inputNumber))};function s(n,r,d,l){const h=new _t(n,r,void 0,!0,()=>{i(d)});return h.checked=l,h}const o=e.includesInput1&&e.includesInput2;return[this.baseRange.input1Diffs.length>0?s("mergeEditor.acceptInput1",c(8107,"Accept {0}",this.model.input1.title),e.toggle(1),e.includesInput1):void 0,this.baseRange.input2Diffs.length>0?s("mergeEditor.acceptInput2",c(8107,"Accept {0}",this.model.input2.title),e.toggle(2),e.includesInput2):void 0,this.baseRange.isConflicting?xl(s("mergeEditor.acceptBoth",c(8108,"Accept Both"),e.withInputValue(1,!o).withInputValue(2,!o),o),{enabled:this.baseRange.canBeCombined}):void 0,new hs,this.baseRange.isConflicting?xl(s("mergeEditor.swap",c(8109,"Swap"),e.swap(),!1),{enabled:!e.kind&&(!o||this.baseRange.isOrderRelevant)}):void 0,xl(new _t("mergeEditor.markAsHandled",c(8110,"Mark as Handled"),void 0,!0,()=>{Ae(n=>{this.model.setHandled(this.baseRange,!t,n)})}),{checked:t})].filter(os)}}class tL extends R{constructor(e,t,i){super(),this.isMultiLine=ts(this,!1),this.item=ts(this,e);const s=new Qw({isChecked:!1,title:"",icon:k.check,...Hp});s.domNode.classList.add("accept-conflict-group"),this._register(J(s.domNode,te.MOUSE_DOWN,o=>{const n=this.item.get();n&&(o.button===2?(o.stopPropagation(),o.preventDefault(),i.showContextMenu({getAnchor:()=>s.domNode,getActions:()=>n.getContextMenuActions()})):o.button===1&&(o.stopPropagation(),o.preventDefault(),n.toggleBothSides()))})),this._register(Si(o=>{const n=this.item.read(o),r=n.toggleState.read(o),l={[un.excluded]:{icon:void 0,checked:!1,title:c(8111,"Accept")},[un.unrecognized]:{icon:k.circleFilled,checked:!1,title:c(8112,"Accept (result is dirty)")},[un.first]:{icon:k.check,checked:!0,title:c(8113,"Undo accept")},[un.second]:{icon:k.checkAll,checked:!0,title:c(8114,"Undo accept (currently second)")}}[r];s.setIcon(l.icon),s.checked=l.checked,s.setTitle(l.title),n.enabled.read(o)?s.enable():s.disable()})),this._register(Si(o=>{const n=this.item.read(o).state.read(o),r=["merge-accept-gutter-marker",n.handled&&"handled",n.focused&&"focused",this.isMultiLine.read(o)?"multi-line":"single-line"];t.className=r.filter(d=>typeof d=="string").join(" ")})),this._register(s.onChange(()=>{Ae(o=>{this.item.get().setState(s.checked,o)})})),t.appendChild(ht("div.background",[MA]).root),t.appendChild(this.checkboxDiv=ht("div.checkbox",[ht("div.checkbox-background",[s.domNode])]).root)}layout(e,t,i,s){const o=this.checkboxDiv.clientHeight,n=t/2-o/2,r=o;let d=e+n;const l=[r,i+s-r-o],h=[e+r,e+t-o-r];h[0]<h[1]&&(d=Ld(d,l[0],l[1]),d=Ld(d,h[0],h[1])),this.checkboxDiv.style.top=`${d-e}px`,Ae(p=>{this.isMultiLine.set(t>30,p)})}update(e){Ae(t=>{this.item.set(e,t)})}}let mp=class extends yg{constructor(e,t,i,s){super(t,e,s),this._labelService=i,this.decorations=Ft(this,n=>{const r=this.viewModel.read(n);if(!r)return[];const d=r.model,l=d.resultTextModel,h=new Array,p=Qy(d.modifiedBaseRanges.read(n),d.baseResultDiffs.read(n),(m,v)=>m.baseRange.intersectsOrTouches(v.inputRange)?ev.neitherLessOrGreaterThan:Qc.compareByStart(m.baseRange,v.inputRange)),f=r.activeModifiedBaseRange.read(n),g=r.showNonConflictingChanges.read(n);for(const m of p){const v=m.left;if(v){const C=["merge-editor-block"];let T=[0,0,0,0];const B=d.isHandled(v).read(n);if(B&&C.push("handled"),v===f&&(C.push("focused"),T=[0,2,0,2]),v.isConflicting&&C.push("conflicting"),C.push("result"),!v.isConflicting&&!g&&B)continue;const V=d.getLineRangeInResult(v.baseRange,n);h.push({range:V.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:C.join(" "),blockPadding:T,blockIsAfterEnd:V.startLineNumber>l.getLineCount(),description:"Result Diff",minimap:{position:eg.Gutter,color:{id:B?ir:sr}},overviewRuler:v.isConflicting?{position:lr.Center,color:{id:B?ir:sr}}:void 0}})}if(!v||v.isConflicting)for(const C of m.rights){const T=C.outputRange.toInclusiveRange();if(T&&h.push({range:T,options:{className:"merge-editor-diff result",description:"Merge Editor",isWholeLine:!0}}),C.rangeMappings)for(const B of C.rangeMappings)h.push({range:B.outputRange,options:{className:"merge-editor-diff-word result",description:"Merge Editor"}})}}return h}),this.editor.invokeWithinContext(n=>{const r=n.get(se),d=OA.bindTo(r);d.set(!0),this._register(ae(()=>d.reset()))}),this.htmlElements.gutterDiv.style.width="5px",this.htmlElements.root.classList.add("result"),this._register(tg((n,r)=>{this.checkboxesVisible.read(n)&&r.add(new wg(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(d,l)=>[],createView:(d,l)=>{throw new el}}))})),this._register(Si(n=>{const r=this.viewModel.read(n);r&&(this.editor.setModel(r.model.resultTextModel),Wi(this.htmlElements.title,...Ki(c(8115,"Result"))),Wi(this.htmlElements.description,...Ki(this._labelService.getUriLabel(r.model.resultTextModel.uri,{relative:!0}))))}));const o=this._register(new cr(this.htmlElements.detail));this._register(Si(n=>{const r=this.viewModel.read(n);if(!r)return;const d=r.model;if(!d)return;const l=d.unhandledConflictsCount.read(n),h=l===1?c(8116,"{0} Conflict Remaining",l):c(8117,"{0} Conflicts Remaining ",l);o.clear(),o.push({class:void 0,enabled:l>0,id:"nextConflict",label:h,run(){r.model.telemetry.reportConflictCounterClicked(),r.goToNextModifiedBaseRange(p=>!d.isHandled(p).get())},tooltip:l>0?c(8118,"Go to next conflict"):c(8119,"All conflicts handled, the merge can be completed now.")})})),this._register(ig(this.editor,this.decorations)),this._register(vg(this,(n,r)=>r.model.translateBaseRangeToResult(n))),this._register(t.createInstance(ba,w.MergeInputResultToolbar,this.htmlElements.toolbar))}};mp=D([u(1,F),u(2,$i),u(3,ie)],mp);var wp,gd;Pe(WR);var Po;let Dt=(Po=class extends dy{get viewModel(){return this._viewModel}get inputModel(){return this._inputModel}get model(){return this.inputModel.get()?.model}constructor(e,t,i,s,o,n,r,d,l,h,p){super(wp.ID,e,s,t,o,r,n,d,l,h),this.contextKeyService=i,this._codeEditorService=p,this._sessionDisposables=new O,this._viewModel=ts(this,void 0),this._grid=this._register(new Ie),this.input1View=this._register(this.instantiationService.createInstance(dc,1,this._viewModel)),this.baseView=ts(this,void 0),this.baseViewOptions=ts(this,void 0),this.input2View=this._register(this.instantiationService.createInstance(dc,2,this._viewModel)),this.inputResultView=this._register(this.instantiationService.createInstance(mp,this._viewModel)),this._layoutMode=this.instantiationService.createInstance(yp),this._layoutModeObs=ts(this,this._layoutMode.value),this._ctxIsMergeEditor=ye.bindTo(this.contextKeyService),this._ctxUsesColumnLayout=wr.bindTo(this.contextKeyService),this._ctxShowBase=tl.bindTo(this.contextKeyService),this._ctxShowBaseAtTop=sg.bindTo(this.contextKeyService),this._ctxResultUri=NA.bindTo(this.contextKeyService),this._ctxBaseUri=BA.bindTo(this.contextKeyService),this._ctxShowNonConflictingChanges=ov.bindTo(this.contextKeyService),this._inputModel=ts(this,void 0),this.viewZoneComputer=new YR(this.input1View.editor,this.input2View.editor,this.inputResultView.editor),this.scrollSynchronizer=this._register(new UR(this._viewModel,this.input1View,this.input2View,this.baseView,this.inputResultView,this._layoutModeObs)),this._onDidChangeSizeConstraints=new E,this.onDidChangeSizeConstraints=this._onDidChangeSizeConstraints.event,this.baseViewDisposables=this._register(new O),this.showNonConflictingChangesStore=this.instantiationService.createInstance(FA,"mergeEditor/showNonConflictingChanges"),this.showNonConflictingChanges=ts(this,this.showNonConflictingChangesStore.get()??!1)}dispose(){this._sessionDisposables.dispose(),this._ctxIsMergeEditor.reset(),this._ctxUsesColumnLayout.reset(),this._ctxShowNonConflictingChanges.reset(),super.dispose()}get minimumWidth(){return this._layoutMode.value.kind==="mixed"?this.input1View.view.minimumWidth+this.input2View.view.minimumWidth:this.input1View.view.minimumWidth+this.input2View.view.minimumWidth+this.inputResultView.view.minimumWidth}getTitle(){return this.input?this.input.getName():c(8120,"Text Merge Editor")}createEditorControl(e,t){this.rootHtmlElement=e,e.classList.add("merge-editor"),this.applyLayout(this._layoutMode.value),this.applyOptions(t)}updateEditorControlOptions(e){this.applyOptions(e)}applyOptions(e){const t=Hf(e,{minimap:{enabled:!1},glyphMargin:!1,lineNumbersMinChars:2}),i=Hf(t,{readOnly:!0,readOnlyMessage:void 0});this.input1View.updateOptions(i),this.input2View.updateOptions(i),this.baseViewOptions.set({...this.input2View.editor.getRawOptions()},void 0),this.inputResultView.updateOptions(t)}getMainControl(){return this.inputResultView.editor}layout(e){this._grid.value?.layout(e.width,e.height)}async setInput(e,t,i,s){if(!(e instanceof Ps))throw new el("ONLY MergeEditorInput is supported");await super.setInput(e,t,i,s),this._sessionDisposables.clear(),Ae(f=>{this._viewModel.set(void 0,f),this._inputModel.set(void 0,f)});const o=await e.resolve(),n=o.model,r=this.instantiationService.createInstance(gp,n,this.input1View,this.input2View,this.inputResultView,this.baseView,this.showNonConflictingChanges);n.telemetry.reportMergeEditorOpened({combinableConflictCount:n.combinableConflictCount,conflictCount:n.conflictCount,baseTop:this._layoutModeObs.get().showBaseAtTop,baseVisible:this._layoutModeObs.get().showBase,isColumnView:this._layoutModeObs.get().kind==="columns"}),Ae(f=>{this._viewModel.set(r,f),this._inputModel.set(o,f)}),this._sessionDisposables.add(r),this._sessionDisposables.add(Si(f=>{const g=r.focusedEditorType.read(f);e instanceof Ps&&e.updateFocusedEditor(g||"result")})),this._ctxResultUri.set(o.resultUri.toString()),this._ctxBaseUri.set(n.base.uri.toString()),this._sessionDisposables.add(ae(()=>{this._ctxBaseUri.reset(),this._ctxResultUri.reset()}));const d=new O;this._sessionDisposables.add(d),this._sessionDisposables.add(tg(f=>{const g=this.baseView.read(f),m=this.inputResultView.editor.getScrollTop();this.scrollSynchronizer.stopSync(),d.clear(),this.inputResultView.editor.changeViewZones(v=>{const C=this._layoutModeObs.read(f),T=C.kind==="columns",B=C.kind==="mixed"&&!C.showBaseAtTop;this.input1View.editor.changeViewZones(V=>{this.input2View.editor.changeViewZones(U=>{g?g.editor.changeViewZones(W=>{d.add(this.setViewZones(f,r,this.input1View.editor,V,this.input2View.editor,U,g.editor,W,B,this.inputResultView.editor,v,T))}):d.add(this.setViewZones(f,r,this.input1View.editor,V,this.input2View.editor,U,void 0,void 0,!1,this.inputResultView.editor,v,T))})})}),this.inputResultView.editor.setScrollTop(m,ft.Smooth),this.scrollSynchronizer.startSync(),this.scrollSynchronizer.updateScrolling()}));const l=this.loadEditorViewState(e,i);l?this._applyViewState(l):this._sessionDisposables.add(KA(n.onInitialized,()=>{const f=n.modifiedBaseRanges.get().find(g=>g.isConflicting);f&&(this.input1View.editor.revealLineInCenter(f.input1Range.startLineNumber),Ae(g=>{r.setActiveModifiedBaseRange(f,g)}))}));const h=f=>{const g=WA(f,this._codeEditorService);td(n.input2.textModel,g,this._codeEditorService),td(n.input1.textModel,g,this._codeEditorService),td(n.resultTextModel,g,this._codeEditorService);const m=this.baseView.get()?.editor.getModel();m&&td(m,g,this._codeEditorService)};this._sessionDisposables.add(this._codeEditorService.onDidChangeTransientModelProperty(f=>{h(f)})),h(this.inputResultView.editor.getModel());const p=this;this._sessionDisposables.add(new class{constructor(){this._disposable=new O;for(const f of this.baseInput1Input2())this._disposable.add(f.onDidChangeContent(()=>this._checkBaseInput1Input2AllEmpty()))}dispose(){this._disposable.dispose()}*baseInput1Input2(){yield n.base,yield n.input1.textModel,yield n.input2.textModel}_checkBaseInput1Input2AllEmpty(){for(const f of this.baseInput1Input2())if(f.getValueLength()>0)return;p.editorService.replaceEditors([{editor:e,replacement:{resource:e.result,options:{preserveFocus:!0}},forceReplaceDirty:!0}],p.group)}})}setViewZones(e,t,i,s,o,n,r,d,l,h,p,f){const g=[],m=[],v=[],C=[],T=this.viewZoneComputer.computeViewZones(e,t,{codeLensesVisible:!0,showNonConflictingChanges:this.showNonConflictingChanges.read(e),shouldAlignBase:l,shouldAlignResult:f}),B=new O;if(d)for(const V of T.baseViewZones)V.create(d,v,B);for(const V of T.resultViewZones)V.create(p,C,B);for(const V of T.input1ViewZones)V.create(s,g,B);for(const V of T.input2ViewZones)V.create(n,m,B);return B.add({dispose:()=>{i.changeViewZones(V=>{for(const U of g)V.removeZone(U)}),o.changeViewZones(V=>{for(const U of m)V.removeZone(U)}),r?.changeViewZones(V=>{for(const U of v)V.removeZone(U)}),h.changeViewZones(V=>{for(const U of C)V.removeZone(U)})}}),B}setOptions(e){super.setOptions(e),e&&La(e,this.inputResultView.editor,ft.Smooth)}clearInput(){super.clearInput(),this._sessionDisposables.clear();for(const{editor:e}of[this.input1View,this.input2View,this.inputResultView])e.setModel(null)}focus(){super.focus(),(this.getControl()??this.inputResultView.editor).focus()}hasFocus(){for(const{editor:e}of[this.input1View,this.input2View,this.inputResultView])if(e.hasTextFocus())return!0;return super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e);for(const{editor:t}of[this.input1View,this.input2View,this.inputResultView])e?t.onVisible():t.onHide();this._ctxIsMergeEditor.set(e)}getControl(){return this.inputResultView.editor}get scopedContextKeyService(){return this.getControl()?.invokeWithinContext(t=>t.get(se))}toggleBase(){this.setLayout({...this._layoutMode.value,showBase:!this._layoutMode.value.showBase})}toggleShowBaseTop(){const e=this._layoutMode.value.showBase&&this._layoutMode.value.showBaseAtTop;this.setLayout({...this._layoutMode.value,showBaseAtTop:!0,showBase:!e})}toggleShowBaseCenter(){const e=this._layoutMode.value.showBase&&!this._layoutMode.value.showBaseAtTop;this.setLayout({...this._layoutMode.value,showBaseAtTop:!1,showBase:!e})}setLayoutKind(e){this.setLayout({...this._layoutMode.value,kind:e})}setLayout(e){const t=this._layoutMode.value;JSON.stringify(t)!==JSON.stringify(e)&&(this.model?.telemetry.reportLayoutChange({baseTop:e.showBaseAtTop,baseVisible:e.showBase,isColumnView:e.kind==="columns"}),this.applyLayout(e))}applyLayout(e){Ae(t=>{if(e.showBase&&!this.baseView.get()){this.baseViewDisposables.clear();const i=this.baseViewDisposables.add(this.instantiationService.createInstance(pp,this.viewModel));this.baseViewDisposables.add(Si(s=>{const o=this.baseViewOptions.read(s);o&&i.updateOptions(o)})),this.baseView.set(i,t)}else!e.showBase&&this.baseView.get()&&(this.baseView.set(void 0,t),this.baseViewDisposables.clear());e.kind==="mixed"?this.setGrid([e.showBaseAtTop&&e.showBase?{size:38,data:this.baseView.get().view}:void 0,{size:38,groups:[{data:this.input1View.view},!e.showBaseAtTop&&e.showBase?{data:this.baseView.get().view}:void 0,{data:this.input2View.view}].filter(os)},{size:62,data:this.inputResultView.view}].filter(os)):e.kind==="columns"&&this.setGrid([e.showBase?{size:40,data:this.baseView.get().view}:void 0,{size:60,groups:[{data:this.input1View.view},{data:this.inputResultView.view},{data:this.input2View.view}]}].filter(os)),this._layoutMode.value=e,this._ctxUsesColumnLayout.set(e.kind),this._ctxShowBase.set(e.showBase),this._ctxShowBaseAtTop.set(e.showBaseAtTop),this._onDidChangeSizeConstraints.fire(),this._layoutModeObs.set(e,t)})}setGrid(e){let t=-1,i=-1;this._grid.value&&(t=this._grid.value.width,i=this._grid.value.height),this._grid.value=ks.from({orientation:Z.VERTICAL,size:100,groups:e},{styles:{separatorBorder:this.theme.getColor(QR)??oi.transparent},proportionalLayout:!0}),Wi(this.rootHtmlElement,this._grid.value.element),t!==-1&&this._grid.value.layout(t,i)}_applyViewState(e){e&&(this.inputResultView.editor.restoreViewState(e),e.input1State&&this.input1View.editor.restoreViewState(e.input1State),e.input2State&&this.input2View.editor.restoreViewState(e.input2State),e.focusIndex>=0&&[this.input1View.editor,this.input2View.editor,this.inputResultView.editor][e.focusIndex].focus())}computeEditorViewState(e){if(!dt(this.inputModel.get()?.resultUri,e))return;const t=this.inputResultView.editor.saveViewState();if(!t)return;const i=this.input1View.editor.saveViewState()??void 0,s=this.input2View.editor.saveViewState()??void 0,o=[this.input1View.editor,this.input2View.editor,this.inputResultView.editor].findIndex(n=>n.hasWidgetFocus());return{...t,input1State:i,input2State:s,focusIndex:o}}tracksEditorViewState(e){return e instanceof Ps}toggleShowNonConflictingChanges(){this.showNonConflictingChanges.set(!this.showNonConflictingChanges.get(),void 0),this.showNonConflictingChangesStore.set(this.showNonConflictingChanges.get()),this._ctxShowNonConflictingChanges.set(this.showNonConflictingChanges.get())}},wp=Po,Po.ID="mergeEditor",Po);Dt=wp=D([u(1,F),u(2,se),u(3,mt),u(4,ce),u(5,me),u(6,pr),u(7,Q),u(8,Je),u(9,Le),u(10,Zo)],Dt);var Mo;let yp=(Mo=class{constructor(e){this._storageService=e,this._value={kind:"mixed",showBase:!1,showBaseAtTop:!0};const t=e.get(gd._key,H.PROFILE,"mixed");if(t==="mixed"||t==="columns")this._value={kind:t,showBase:!1,showBaseAtTop:!0};else if(t)try{this._value=JSON.parse(t)}catch(i){jn(i)}}get value(){return this._value}set value(e){this._value!==e&&(this._value=e,this._storageService.store(gd._key,JSON.stringify(this._value),H.PROFILE,Re.USER))}},gd=Mo,Mo._key="mergeEditor/layout",Mo);yp=gd=D([u(0,ce)],yp);let vp=class extends R{constructor(e,t){super(),this._editorService=e,this._store.add(t.registerCodeEditorOpenHandler(this.openCodeEditorFromMergeEditor.bind(this)))}async openCodeEditorFromMergeEditor(e,t,i){const s=this._editorService.activeEditorPane;if(!i&&e.options&&s instanceof Dt&&s.getControl()&&s.input instanceof Ps&&dt(e.resource,s.input.result)){const o=s.getControl();return La(e.options,o,ft.Smooth),o}return null}};vp=D([u(0,Q),u(1,Zo)],vp);var Nn;let cc=(Nn=class extends R{constructor(e,t){super();const i=s=>({editor:t.createInstance(Ps,s.base.resource,{uri:s.input1.resource,title:s.input1.label??us(s.input1.resource),description:s.input1.description??"",detail:s.input1.detail},{uri:s.input2.resource,title:s.input2.label??us(s.input2.resource),description:s.input2.description??"",detail:s.input2.detail},s.result.resource)});this._register(e.registerEditor("*",{id:Ct.id,label:Ct.displayName,detail:Ct.providerDisplayName,priority:De.builtin},{},{createMergeEditorInput:i}))}},Nn.ID="workbench.contrib.mergeEditorResolver",Nn);cc=D([u(0,Ta),u(1,F)],cc);class Ai extends X{constructor(e){super(e)}run(e){const{activeEditorPane:t}=e.get(Q);if(t instanceof Dt){const i=t.viewModel.get();if(!i)return;this.runWithViewModel(i,e)}}}class Cg extends X{constructor(e){super(e)}run(e,...t){const{activeEditorPane:i}=e.get(Q);if(i instanceof Dt){const s=i.viewModel.get();return s?this.runWithMergeEditor({viewModel:s,inputModel:i.inputModel.get(),input:i.input,editorIdentifier:{editor:i.input,groupId:i.group.id}},e,...t):void 0}}}class iL extends X{constructor(){super({id:"_open.mergeEditor",title:x(7991,"Open Merge Editor")})}run(e,...t){const i=bp.validate(t[0]),s={base:{resource:i.base},input1:{resource:i.input1.uri,label:i.input1.title,description:i.input1.description,detail:i.input1.detail},input2:{resource:i.input2.uri,label:i.input2.title,description:i.input2.description,detail:i.input2.detail},result:{resource:i.output},options:{preserveFocus:!0}};e.get(Q).openEditor(s)}}var bp;(function(a){function e(o){if(!o||typeof o!="object")throw new TypeError("invalid argument");const n=o,r=i(n.base),d=i(n.output),l=t(n.input1),h=t(n.input2);return{base:r,input1:l,input2:h,output:d}}a.validate=e;function t(o){if(typeof o=="string")return new Ur($.parse(o,!0),void 0,void 0,void 0);if(!o||typeof o!="object")throw new TypeError("invalid argument");if(s(o))return new Ur($.revive(o),void 0,void 0,void 0);const n=o,r=n.title,d=i(n.uri),l=n.detail,h=n.description;return new Ur(d,r,l,h)}function i(o){if(typeof o=="string")return $.parse(o,!0);if(o&&typeof o=="object")return $.revive(o);throw new TypeError("invalid argument")}function s(o){if(!o||typeof o!="object")return!1;const n=o;return typeof n.scheme=="string"&&typeof n.authority=="string"&&typeof n.path=="string"&&typeof n.query=="string"&&typeof n.fragment=="string"}})(bp||(bp={}));class sL extends X{constructor(){super({id:"merge.mixedLayout",title:x(7992,"Mixed Layout"),toggled:wr.isEqualTo("mixed"),menu:[{id:w.EditorTitle,when:ye,group:"1_merge",order:9}],precondition:ye})}run(e){const{activeEditorPane:t}=e.get(Q);t instanceof Dt&&t.setLayoutKind("mixed")}}class oL extends X{constructor(){super({id:"merge.columnLayout",title:x(7993,"Column Layout"),toggled:wr.isEqualTo("columns"),menu:[{id:w.EditorTitle,when:ye,group:"1_merge",order:10}],precondition:ye})}run(e){const{activeEditorPane:t}=e.get(Q);t instanceof Dt&&t.setLayoutKind("columns")}}class nL extends X{constructor(){super({id:"merge.showNonConflictingChanges",title:x(7994,"Show Non-Conflicting Changes"),toggled:ov.isEqualTo(!0),menu:[{id:w.EditorTitle,when:ye,group:"3_merge",order:9}],precondition:ye})}run(e){const{activeEditorPane:t}=e.get(Q);t instanceof Dt&&t.toggleShowNonConflictingChanges()}}class rL extends X{constructor(){super({id:"merge.showBase",title:x(7995,"Show Base"),toggled:tl.isEqualTo(!0),menu:[{id:w.EditorTitle,when:I.and(ye,wr.isEqualTo("columns")),group:"2_merge",order:9}]})}run(e){const{activeEditorPane:t}=e.get(Q);t instanceof Dt&&t.toggleBase()}}class aL extends X{constructor(){super({id:"merge.showBaseTop",title:x(7996,"Show Base Top"),toggled:I.and(tl,sg),menu:[{id:w.EditorTitle,when:I.and(ye,wr.isEqualTo("mixed")),group:"2_merge",order:10}]})}run(e){const{activeEditorPane:t}=e.get(Q);t instanceof Dt&&t.toggleShowBaseTop()}}class dL extends X{constructor(){super({id:"merge.showBaseCenter",title:x(7997,"Show Base Center"),toggled:I.and(tl,sg.negate()),menu:[{id:w.EditorTitle,when:I.and(ye,wr.isEqualTo("mixed")),group:"2_merge",order:11}]})}run(e){const{activeEditorPane:t}=e.get(Q);t instanceof Dt&&t.toggleShowBaseCenter()}}const Rt=x(7998,"Merge Editor");class cL extends Ai{constructor(){super({id:"merge.openResult",icon:k.goToFile,title:x(7999,"Open File"),category:Rt,menu:[{id:w.EditorTitle,when:ye,group:"navigation",order:1}],precondition:ye})}runWithViewModel(e,t){t.get(Q).openEditor({resource:e.model.resultTextModel.uri})}}class lL extends Ai{constructor(){super({id:"merge.goToNextUnhandledConflict",category:Rt,title:x(8e3,"Go to Next Unhandled Conflict"),icon:k.arrowDown,menu:[{id:w.EditorTitle,when:ye,group:"navigation",order:3}],f1:!0,precondition:ye})}runWithViewModel(e){e.model.telemetry.reportNavigationToNextConflict(),e.goToNextModifiedBaseRange(t=>!e.model.isHandled(t).get())}}class hL extends Ai{constructor(){super({id:"merge.goToPreviousUnhandledConflict",category:Rt,title:x(8001,"Go to Previous Unhandled Conflict"),icon:k.arrowUp,menu:[{id:w.EditorTitle,when:ye,group:"navigation",order:2}],f1:!0,precondition:ye})}runWithViewModel(e){e.model.telemetry.reportNavigationToPreviousConflict(),e.goToPreviousModifiedBaseRange(t=>!e.model.isHandled(t).get())}}class uL extends Ai{constructor(){super({id:"merge.toggleActiveConflictInput1",category:Rt,title:x(8002,"Toggle Current Conflict from Left"),f1:!0,precondition:ye})}runWithViewModel(e){e.toggleActiveConflict(1)}}class pL extends Ai{constructor(){super({id:"merge.toggleActiveConflictInput2",category:Rt,title:x(8003,"Toggle Current Conflict from Right"),f1:!0,precondition:ye})}runWithViewModel(e){e.toggleActiveConflict(2)}}class gL extends Ai{constructor(){super({id:"mergeEditor.compareInput1WithBase",category:Rt,title:x(8004,"Compare Input 1 With Base"),shortTitle:c(8005,"Compare With Base"),f1:!0,precondition:ye,menu:{id:w.MergeInput1Toolbar,group:"primary"},icon:k.compareChanges})}runWithViewModel(e,t){const i=t.get(Q);rb(e,i,1)}}class fL extends Ai{constructor(){super({id:"mergeEditor.compareInput2WithBase",category:Rt,title:x(8006,"Compare Input 2 With Base"),shortTitle:c(8005,"Compare With Base"),f1:!0,precondition:ye,menu:{id:w.MergeInput2Toolbar,group:"primary"},icon:k.compareChanges})}runWithViewModel(e,t){const i=t.get(Q);rb(e,i,2)}}async function rb(a,e,t){e.openEditor(e.activeEditor,{pinned:!0});const s=a.model.base,o=t===1?a.inputCodeEditorView1.editor:a.inputCodeEditorView2.editor,n=o.getPosition().lineNumber;await e.openEditor({original:{resource:s.uri},modified:{resource:o.getModel().uri},options:{selection:{startLineNumber:n,startColumn:1},revealIfOpened:!0,revealIfVisible:!0}})}class mL extends Ai{constructor(){super({id:"merge.openBaseEditor",category:Rt,title:x(8007,"Open Base File"),f1:!0,precondition:ye})}runWithViewModel(e,t){t.get(xt).open(e.model.base.uri)}}class wL extends Ai{constructor(){super({id:"merge.acceptAllInput1",category:Rt,title:x(8008,"Accept All Incoming Changes from Left"),f1:!0,precondition:ye,menu:{id:w.MergeInput1Toolbar,group:"primary"},icon:k.checkAll})}runWithViewModel(e){e.acceptAll(1)}}class yL extends Ai{constructor(){super({id:"merge.acceptAllInput2",category:Rt,title:x(8009,"Accept All Current Changes from Right"),f1:!0,precondition:ye,menu:{id:w.MergeInput2Toolbar,group:"primary"},icon:k.checkAll})}runWithViewModel(e){e.acceptAll(2)}}class vL extends Ai{constructor(){super({id:"mergeEditor.resetResultToBaseAndAutoMerge",category:Rt,title:x(8010,"Reset Result"),shortTitle:c(8011,"Reset"),f1:!0,precondition:ye,menu:{id:w.MergeInputResultToolbar,group:"primary"},icon:k.discard})}runWithViewModel(e,t){e.model.reset()}}class bL extends X{constructor(){super({id:"mergeEditor.resetCloseWithConflictsChoice",category:Rt,title:x(8012,"Reset Choice for 'Close with Conflicts'"),f1:!0})}run(e){e.get(ce).remove(GA,H.PROFILE)}}class CL extends Cg{constructor(){super({id:"mergeEditor.acceptAllCombination",category:Rt,title:x(8013,"Accept All Combination"),f1:!0})}runWithMergeEditor(e,t,...i){const{viewModel:s}=e,o=s.model.modifiedBaseRanges.get(),n=s.model;return Ae(r=>{for(const d of o){const l=n.getState(d).get();l.kind!==io.unrecognized&&!l.isInputIncluded(1)&&(!l.isInputIncluded(2)||!s.shouldUseAppendInsteadOfAccept.get())&&d.canBeCombined&&(n.setState(d,l.withInputValue(1,!0).withInputValue(2,!0,!0),!0,r),n.telemetry.reportSmartCombinationInvoked(l.includesInput(2)))}}),{success:!0}}}class SL extends Cg{constructor(){super({id:"mergeEditor.acceptMerge",category:Rt,title:x(8014,"Complete Merge"),f1:!0,precondition:ye,keybinding:[{primary:N.CtrlCmd|y.Enter,weight:G.EditorContrib,when:ye}]})}async runWithMergeEditor({inputModel:e,editorIdentifier:t,viewModel:i},s){const o=s.get(Jo),n=s.get(Q);if(i.model.unhandledConflictsCount.get()>0){const{confirmed:r}=await o.confirm({message:c(8015,"Do you want to complete the merge of {0}?",us(e.resultUri)),detail:c(8016,"The file contains unhandled conflicts."),primaryButton:c(8017,"&&Complete with Conflicts")});if(!r)return{successful:!1}}return await e.accept(),await n.closeEditor(t),{successful:!0}}}class _L extends Cg{constructor(){super({id:"mergeEditor.toggleBetweenInputs",category:Rt,title:x(8018,"Toggle Between Merge Editor Inputs"),f1:!0,precondition:ye,keybinding:[{primary:N.CtrlCmd|N.Shift|y.KeyT,weight:G.WorkbenchContrib+10,when:ye}]})}runWithMergeEditor({viewModel:e},t){e.inputCodeEditorView1.editor.hasWidgetFocus()?e.inputCodeEditorView2.editor.focus():e.inputCodeEditorView1.editor.focus()}}const Sg=x(8019,"Merge Editor (Dev)");class EL extends X{constructor(){super({id:"merge.dev.copyContentsJson",category:Sg,title:x(8020,"Copy Merge Editor State as JSON"),icon:k.layoutCentered,f1:!0,precondition:ye})}run(e){const{activeEditorPane:t}=e.get(Q),i=e.get(ih),s=e.get(Ke);if(!(t instanceof Dt)){s.info({name:c(8021,"Merge Editor"),message:c(8022,"No active merge editor")});return}const o=t.model;if(!o)return;const n={languageId:o.resultTextModel.getLanguageId(),base:o.base.getValue(),input1:o.input1.textModel.getValue(),input2:o.input2.textModel.getValue(),result:o.resultTextModel.getValue(),initialResult:o.getInitialResultValue()},r=JSON.stringify(n,void 0,4);i.writeText(r),s.info({name:c(8021,"Merge Editor"),message:c(8023,"Successfully copied merge editor state")})}}class IL extends X{constructor(){super({id:"merge.dev.saveContentsToFolder",category:Sg,title:x(8024,"Save Merge Editor State to Folder"),icon:k.layoutCentered,f1:!0,precondition:ye})}async run(e){const{activeEditorPane:t}=e.get(Q),i=e.get(Ke),s=e.get(nv),o=e.get(Le),n=e.get(ar);if(!(t instanceof Dt)){i.info({name:c(8021,"Merge Editor"),message:c(8022,"No active merge editor")});return}const r=t.model;if(!r)return;const d=await s.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:c(8025,"Select folder to save to")});if(!d)return;const l=d[0],h=n.getExtensions(r.resultTextModel.getLanguageId())[0]||"";async function p(f,g){await o.writeFile($.joinPath(l,f+h),rv.fromString(g),{})}await Promise.all([p("base",r.base.getValue()),p("input1",r.input1.textModel.getValue()),p("input2",r.input2.textModel.getValue()),p("result",r.resultTextModel.getValue()),p("initialResult",r.getInitialResultValue())]),i.info({name:c(8021,"Merge Editor"),message:c(8026,"Successfully saved merge editor state to folder")})}}class DL extends X{constructor(){super({id:"merge.dev.loadContentsFromFolder",category:Sg,title:x(8027,"Load Merge Editor State from Folder"),icon:k.layoutCentered,f1:!0})}async run(e,t){const i=e.get(nv),s=e.get(Q),o=e.get(Le),n=e.get(Xt);t||(t={});let r;if(t.folderUri)r=t.folderUri;else{const C=await i.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:c(8025,"Select folder to save to")});if(!C)return;r=C[0]}const d=await o.resolve(r);function l(C){return d.children.find(T=>T.name.startsWith(C))?.resource}const h=await AL(n,t.resultState),p=l("base"),f=l("input1"),g=l("input2"),m=l(h?"initialResult":"result"),v={base:{resource:p},input1:{resource:f,label:"Input 1",description:"Input 1",detail:"(from file)"},input2:{resource:g,label:"Input 2",description:"Input 2",detail:"(from file)"},result:{resource:m}};s.openEditor(v)}}async function AL(a,e){return e?e==="initial":(await a.pick([{label:"result",result:!1},{label:"initial result",result:!0}],{canPickMany:!1}))?.result}class TL{canSerialize(){return!0}serialize(e){return JSON.stringify(this.toJSON(e))}toJSON(e){return{base:e.base,input1:e.input1,input2:e.input2,result:e.result}}deserialize(e,t){try{const i=UA(t);return e.createInstance(Ps,i.base,new Ur(i.input1.uri,i.input1.title,i.input1.detail,i.input1.description),new Ur(i.input2.uri,i.input2.title,i.input2.detail,i.input2.description),i.result)}catch(i){jn(i);return}}}class xL{constructor(){this.name="mergeEditor",this.type=zf.Help,this.priority=125,this.when=HA.create("isMergeEditor",!0)}getProvider(e){const t=e.get(Zo),i=t.getActiveCodeEditor()||t.getFocusedCodeEditor();if(!i)return;const s=[c(8031,"You are in a merge editor."),c(8032,"Navigate between merge conflicts using the commands Go to Next Unhandled Conflict{0} and Go to Previous Unhandled Conflict{1}.","<keybinding:merge.goToNextUnhandledConflict>","<keybinding:merge.goToPreviousUnhandledConflict>"),c(8033,"Run the command Merge Editor: Accept All Incoming Changes from the Left{0} and Merge Editor: Accept All Current Changes from the Right{1}","<keybinding:merge.acceptAllInput1>","<keybinding:merge.acceptAllInput2>"),c(8034,"Complete the Merge{0}.","<keybinding:mergeEditor.acceptMerge>"),c(8035,"Toggle between merge editor inputs, incoming and current changes {0}.","<keybinding:mergeEditor.toggleBetweenInputs>")];return new zA($A.MergeEditor,{type:zf.Help},()=>s.join(`
|
|
45
|
+
`),()=>i.focus(),qA.MergeEditor)}}z.as(ct.EditorPane).registerEditorPane(Ci.create(Dt,Dt.ID,c(8028,"Merge Editor")),[new ee(Ps)]);z.as(ct.EditorFactory).registerEditorSerializer(Ps.ID,TL);z.as(Zs.Configuration).registerConfiguration({properties:{"mergeEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:"advanced",markdownEnumDescriptions:[c(8029,"Uses the legacy diffing algorithm."),c(8030,"Uses the advanced diffing algorithm.")]},"mergeEditor.showDeletionMarkers":{type:"boolean",default:!0,description:"Controls if deletions in base or one of the inputs should be indicated by a vertical bar."}}});b(cL);b(sL);b(oL);b(iL);b(mL);b(nL);b(rL);b(aL);b(dL);b(lL);b(hL);b(uL);b(pL);b(gL);b(fL);b(wL);b(yL);b(vL);b(SL);b(bL);b(CL);b(_L);b(EL);b(IL);b(DL);z.as(Vc.Workbench).registerWorkbenchContribution(vp,Da.Restored);yt(cc.ID,cc,vt.BlockStartup);jA.register(new xL);const kL=100;function vr(a,e){a?.addImplementation(kL,"webview",t=>{const s=t.get(Yo).activeWebview;if(s?.isFocused)return e(s),!0;if(Ic()?.classList.contains("action-menu-item")){const o=t.get(Q);if(o.activeEditor instanceof Zn)return e(o.activeEditor.webview),!0}return!1})}vr(gw,a=>a.undo());vr(fw,a=>a.redo());vr(YA,a=>a.selectAll());vr(lh,a=>a.copy());vr(hh,a=>a.paste());vr(ch,a=>a.cut());const _g="preventDefaultContextMenuItems";ch&&S.appendMenuItem(w.WebviewContext,{command:{id:ch.id,title:c(11738,"Cut")},group:"5_cutcopypaste",order:1,when:I.not(_g)});lh&&S.appendMenuItem(w.WebviewContext,{command:{id:lh.id,title:c(11739,"Copy")},group:"5_cutcopypaste",order:2,when:I.not(_g)});hh&&S.appendMenuItem(w.WebviewContext,{command:{id:hh.id,title:c(11740,"Paste")},group:"5_cutcopypaste",order:3,when:I.not(_g)});const RL="workbench.action.openSettings",LL=c(7566,"Configure");let Cp=class extends R{constructor(e,t){super();const s=[new VL,new PL].map(r=>new ML(t,r));s.forEach(r=>this._register(r));let o;const n=()=>{const r=e.activeTextEditorControl;if(r===o)return;o=r;const d=mi(r);s.forEach(l=>l.onActiveEditorChanged(d))};this._register(e.onDidActiveEditorChange(n)),n()}};Cp=D([u(0,Q),u(1,Zy)],Cp);class VL{constructor(){this.id="decoratorsLimitInfo",this.name=c(7567,"Color Decorator Status"),this.label=c(7568,"Color decorators"),this.source=c(7569,"Color Decorators"),this.settingsId="editor.colorDecoratorsLimit"}getLimitReporter(e){return JA.get(e)?.limitReporter}}class PL{constructor(){this.id="foldingLimitInfo",this.name=c(7570,"Folding Status"),this.label=c(7571,"Folding ranges"),this.source=c(7572,"Folding"),this.settingsId="editor.foldingMaximumRegions"}getLimitReporter(e){return Xy.get(e)?.limitReporter}}class ML{constructor(e,t){this.languageStatusService=e,this.accessor=t}onActiveEditorChanged(e){this._indicatorChangeListener&&(this._indicatorChangeListener.dispose(),this._indicatorChangeListener=void 0);let t;return e&&(t=this.accessor.getLimitReporter(e)),this.updateStatusItem(t),t?(this._indicatorChangeListener=t.onDidChange(i=>{this.updateStatusItem(t)}),!0):!1}updateStatusItem(e){if(this._limitStatusItem&&(this._limitStatusItem.dispose(),this._limitStatusItem=void 0),e&&e.limited!==!1){const t={id:this.accessor.id,selector:"*",name:this.accessor.name,severity:Se.Warning,label:this.accessor.label,detail:c(7573,"only {0} shown for performance reasons",e.limited),command:{id:RL,arguments:[this.accessor.settingsId],title:LL},accessibilityInfo:void 0,source:this.accessor.source,busy:!1};this._limitStatusItem=this.languageStatusService.addStatus(t)}}dispose(){this._limitStatusItem=void 0,this._indicatorChangeListener=void 0}}z.as(Vc.Workbench).registerWorkbenchContribution(Cp,Da.Restored);let Sp=class{constructor(e,t){this.configurationService=e,this.layoutService=t,this.disposables=new O,L.filter(e.onDidChangeConfiguration,o=>o.affectsConfiguration("workbench.sash.size"))(this.onDidChangeSize,this,this.disposables),this.onDidChangeSize(),L.filter(e.onDidChangeConfiguration,o=>o.affectsConfiguration("workbench.sash.hoverDelay"))(this.onDidChangeHoverDelay,this,this.disposables),this.onDidChangeHoverDelay()}onDidChangeSize(){const e=this.configurationService.getValue("workbench.sash.size"),t=Ld(e,4,20),i=Ld(e,1,8);this.layoutService.mainContainer.style.setProperty("--vscode-sash-size",t+"px"),this.layoutService.mainContainer.style.setProperty("--vscode-sash-hover-size",i+"px"),ZA(t)}onDidChangeHoverDelay(){XA(this.configurationService.getValue("workbench.sash.hoverDelay"))}dispose(){this.disposables.dispose()}};Sp=D([u(0,ie),u(1,_a)],Sp);z.as(Vc.Workbench).registerWorkbenchContribution(Sp,Da.Restored);z.as(Zs.Configuration).registerConfiguration({...xr,properties:{"workbench.sash.size":{type:"number",default:Id?20:4,minimum:1,maximum:20,description:c(9306,"Controls the feedback area size in pixels of the dragging area in between views/editors. Set it to a larger value if you feel it's hard to resize views using the mouse.")},"workbench.sash.hoverDelay":{type:"number",default:300,minimum:0,maximum:2e3,description:c(9307,"Controls the hover feedback delay in milliseconds of the dragging area in between views/editors.")}}});new q("inPreferencesSearch",!1);new q("inSettingsEditor",!1);new q("inSettingsJSONEditor",!1);new q("inSettingsSearch",!1);new q("settingsTocRowFocus",!1);new q("settingRowFocus",!1);new q("inKeybindings",!1);new q("inKeybindingsSearch",!1);new q("keybindingFocus",!1);new q("whenFocus",!1);const fd="workbench.action.openKeyboardLayoutPicker";c(9059,"Preview setting: this setting controls a new feature that is still under refinement yet ready to use. Feedback is welcome.");c(9060,"Experimental setting: this setting controls a new feature that is actively being developed and may be unstable. It is subject to change or removal.");const OL=new Set;["css","html","scss","less","json","js","ts","ie","id","php","scm"].forEach(a=>OL.add(a));const za=new Map;za.set("power shell","PowerShell");za.set("powershell","PowerShell");za.set("javascript","JavaScript");za.set("typescript","TypeScript");za.set("github","GitHub");var Bn;let lc=(Bn=class extends R{constructor(e,t){super(),this.keyboardLayoutService=e,this.statusbarService=t,this.pickerElement=this._register(new Ie);const i=c(8806,"Keyboard Layout"),s=this.keyboardLayoutService.getCurrentKeyboardLayout();if(s){const o=Pd(s),n=c(8807,"Layout: {0}",o.label);this.pickerElement.value=this.statusbarService.addEntry({name:i,text:n,ariaLabel:n,command:fd},"status.workbench.keyboardLayout",et.RIGHT)}this._register(this.keyboardLayoutService.onDidChangeKeyboardLayout(()=>{const o=this.keyboardLayoutService.getCurrentKeyboardLayout(),n=Pd(o);if(this.pickerElement.value){const r=c(8807,"Layout: {0}",n.label);this.pickerElement.value.update({name:i,text:r,ariaLabel:r,command:fd})}else{const r=c(8807,"Layout: {0}",n.label);this.pickerElement.value=this.statusbarService.addEntry({name:i,text:r,ariaLabel:r,command:fd},"status.workbench.keyboardLayout",et.RIGHT)}}))}},Bn.ID="workbench.contrib.keyboardLayoutPicker",Bn);lc=D([u(0,Sa),u(1,Ui)],lc);yt(lc.ID,lc,vt.BlockStartup);const NL=[`// ${c(8808,"Defines the keyboard layout used in VS Code in the browser environment.")}`,`// ${c(8809,'Open VS Code and run "Developer: Inspect Key Mappings (JSON)" from Command Palette.')}`,"","// Once you have the keyboard layout info, please paste it below.",`
|
|
46
|
+
`].join(`
|
|
47
|
+
`);b(class extends X{constructor(){super({id:fd,title:x(8810,"Change Keyboard Layout"),f1:!0})}async run(a){const e=a.get(Sa),t=a.get(Xt),i=a.get(ie),s=a.get(Mp),o=a.get(Q),n=a.get(Le),r=e.getAllKeyboardLayouts(),d=e.getCurrentKeyboardLayout(),h=i.getValue("keyboard.layout")==="autodetect",p=r.map(v=>{const C=!h&&im(d,v),T=Pd(v);return{layout:v,label:[T.label,v&&v.isUserKeyboardLayout?"(User configured layout)":""].join(" "),id:v.text||v.lang||v.layout,description:T.description+(C?" (Current layout)":""),picked:!h&&im(d,v)}}).sort((v,C)=>v.label<C.label?-1:v.label>C.label?1:0);if(p.length>0){const v=ut?"Mac":Uo?"Win":"Linux";p.unshift({type:"separator",label:c(8811,"Keyboard Layouts ({0})",v)})}const f={label:c(8812,"Configure Keyboard Layout")};p.unshift(f);const g={label:c(8813,"Auto Detect"),description:h?`Current: ${Pd(d).label}`:void 0,picked:h?!0:void 0};p.unshift(g);const m=await t.pick(p,{placeHolder:c(8814,"Select Keyboard Layout"),matchOnDescription:!0});if(m){if(m===g){i.updateValue("keyboard.layout","autodetect");return}if(m===f){const v=s.keyboardLayoutResource;return await n.stat(v).then(void 0,()=>n.createFile(v,rv.fromString(NL))).then(C=>{if(C)return o.openEditor({resource:C.resource,languageId:"jsonc",options:{pinned:!0}})},C=>{throw new Error(c(8815,"Unable to create '{0}' ({1}).",v.toString(),C))}),Promise.resolve()}i.updateValue("keyboard.layout",la(m.layout))}}});var Fn;let hc=(Fn=class extends R{constructor(e,t,i){super(),this.activityService=e,this.workingCopyService=t,this.filesConfigurationService=i,this.badgeHandle=this._register(new Ie),this.lastKnownDirtyCount=0,this.updateActivityBadge(),this.registerListeners()}registerListeners(){this._register(this.workingCopyService.onDidChangeDirty(e=>this.onWorkingCopyDidChangeDirty(e)))}onWorkingCopyDidChangeDirty(e){const t=e.isDirty();t&&!(e.capabilities&QA.Untitled)&&this.filesConfigurationService.hasShortAutoSaveDelay(e.resource)||(t||this.lastKnownDirtyCount>0)&&this.updateActivityBadge()}updateActivityBadge(){const e=this.lastKnownDirtyCount=this.workingCopyService.dirtyCount;e>0?this.badgeHandle.value=this.activityService.showViewContainerActivity(Wr,{badge:new Hc(e,t=>t===1?c(7312,"1 unsaved file"):c(7313,"{0} unsaved files",e))}):this.badgeHandle.clear()}},Fn.ID="workbench.contrib.dirtyFilesIndicator",Fn);hc=D([u(0,Ys),u(1,Rw),u(2,$c)],hc);var _p,Oo;let uc=(Oo=class extends rs{constructor(e,t,i,s,o){super(_p.ID,e,{openInternal:(n,r)=>this.openInternal(n,r)},t,i,o),this.editorResolverService=s}async openInternal(e,t){if(e instanceof aa&&this.group.activeEditor){const i=this.group.activeEditor,s=i?.toUntyped();if(!s)return;let o=await this.editorResolverService.resolveEditor({...s,options:{...t,override:ad.PICK}},this.group);if(o===Lt.NONE)o=void 0;else if(o===Lt.ABORT)return;if(hw(o))for(const n of o.editor instanceof Aa?[o.editor.original,o.editor.modified]:[o.editor])n instanceof aa&&(n.setForceOpenAsText(),n.setPreferredLanguageId(og));await this.group.replaceEditors([{editor:i,replacement:o?.editor??e,options:{...o?.options??t}}])}}getTitle(){return this.input?this.input.getName():c(6946,"Binary File Viewer")}},_p=Oo,Oo.ID=eT,Oo);uc=_p=D([u(1,mt),u(2,me),u(3,Ta),u(4,ce)],uc);class BL{canSerialize(e){return!0}serialize(e){const t=e,i=t.resource,s=t.preferredResource,o={resourceJSON:i.toJSON(),preferredResourceJSON:dt(i,s)?void 0:s,name:t.getPreferredName(),description:t.getPreferredDescription(),encoding:t.getEncoding(),modeId:t.getPreferredLanguageId()};return JSON.stringify(o)}deserialize(e,t){return e.invokeFunction(i=>{const s=JSON.parse(t),o=$.revive(s.resourceJSON),n=$.revive(s.preferredResourceJSON),r=s.name,d=s.description,l=s.encoding,h=s.modeId,p=i.get(Va).createTextEditor({resource:o,label:r,description:d,encoding:l,languageId:h,forceFile:!0});return n&&p.setPreferredResource(n),p})}}var Kn;let pc=(Kn=class extends R{constructor(e,t,i){super(),this.textEditorService=t,this.fileService=i,this._register(e.registerHandler(this))}handles(e){return e.typeId===nh&&this.fileService.canHandleResource(e.resource)}handlesSync(e){return e.typeId===nh&&this.fileService.hasProvider(e.resource)}isOpen(e,t){return this.handlesSync(e)?dt(e.resource,t.resource):!1}createEditor(e){return this.textEditorService.createTextEditor({resource:e.resource,forceFile:!0})}},Kn.ID="workbench.contrib.fileEditorWorkingCopyEditorHandler",Kn);pc=D([u(0,qc),u(1,Va),u(2,Le)],pc);var Ep,No;let gc=(No=class extends Xv{constructor(e,t,i,s,o,n,r,d,l,h,p,f,g,m,v,C,T,B,V){super(Ep.ID,e,t,o,r,d,h,l,p,i),this.paneCompositeService=s,this.contextService=n,this.textFileService=f,this.explorerService=g,this.uriIdentityService=m,this.pathService=v,this.configurationService=C,this.preferencesService=T,this.hostService=B,this.filesConfigurationService=V,this._register(this.fileService.onDidFilesChange(U=>this.onDidFilesChange(U))),this._register(this.fileService.onDidRunOperation(U=>this.onDidRunOperation(U)))}onDidFilesChange(e){for(const t of e.rawDeleted)this.clearEditorViewState(t)}onDidRunOperation(e){e.operation===ho.MOVE&&e.target&&this.moveEditorViewState(e.resource,e.target.resource,this.uriIdentityService.extUri)}getTitle(){return this.input?this.input.getName():c(6947,"Text File Editor")}get input(){return this._input}async setInput(e,t,i,s){pi("code/willSetInputToTextFileEditor"),await super.setInput(e,t,i,s);try{const o=await e.resolve(t);if(s.isCancellationRequested)return;if(o instanceof uy)return this.openAsBinary(e,t);const n=o,r=Ee(this.editorControl);if(r.setModel(n.textEditorModel),!ly(t?.viewState)){const d=this.loadEditorViewState(e,i);d&&(t?.selection&&(d.cursorState=[]),r.restoreViewState(d))}t&&La(t,r,ft.Immediate),r.updateOptions(this.getReadonlyConfiguration(n.isReadonly())),r.handleInitialized&&r.handleInitialized()}catch(o){await this.handleSetInputError(o,e,t)}pi("code/didSetInputToTextFileEditor")}async handleSetInputError(e,t,i){if(e.textFileOperationResult===iT.FILE_IS_BINARY)return this.openAsBinary(t,i);if(e.fileOperationResult===Dr.FILE_IS_DIRECTORY){const s=[];throw s.push(cs({id:"workbench.files.action.openFolder",label:c(6948,"Open Folder"),run:async()=>this.hostService.openWindow([{folderUri:t.resource}],{forceNewWindow:!0})})),this.contextService.isInsideWorkspace(t.preferredResource)&&s.push(cs({id:"workbench.files.action.reveal",label:c(6949,"Reveal Folder"),run:async()=>(await this.paneCompositeService.openPaneComposite(Wr,Y.Sidebar,!0),this.explorerService.select(t.preferredResource,!0))})),$f(c(6950,"The file is not displayed in the text editor because it is a directory."),s,{forceMessage:!0})}if(e.fileOperationResult===Dr.FILE_TOO_LARGE){let s;throw e instanceof sT?s=c(6951,"The file is not displayed in the text editor because it is very large ({0}).",Zp.formatSize(e.size)):s=c(6952,"The file is not displayed in the text editor because it is very large."),oT(this.group,t,i,s,this.preferencesService)}throw e.fileOperationResult===Dr.FILE_NOT_FOUND&&!this.filesConfigurationService.isReadonly(t.preferredResource)&&await this.pathService.hasValidBasename(t.preferredResource)?$f(new mw(c(6953,"The editor could not be opened because the file was not found."),Dr.FILE_NOT_FOUND),[cs({id:"workbench.files.action.createMissingFile",label:c(6954,"Create File"),run:async()=>(await this.textFileService.create([{resource:t.preferredResource}]),this.editorService.openEditor({resource:t.preferredResource,options:{pinned:!0}}))})],{allowDialog:!0}):e}openAsBinary(e,t){const i=this.configurationService.getValue("workbench.editor.defaultBinaryEditor"),s={...t,activation:uw.PRESERVE};i&&i!==""&&i!==Ct.id?this.doOpenAsBinaryInDifferentEditor(this.group,i,e,s):this.doOpenAsBinaryInSameEditor(this.group,i,e,s)}doOpenAsBinaryInDifferentEditor(e,t,i,s){this.editorService.replaceEditors([{editor:i,replacement:{resource:i.resource,options:{...s,override:t}}}],e)}doOpenAsBinaryInSameEditor(e,t,i,s){t===Ct.id?(i.setForceOpenAsText(),i.setPreferredLanguageId(og),s={...s,forceReload:!0}):i.setForceOpenAsBinary(),e.openEditor(i,s)}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}createEditorControl(e,t){pi("code/willCreateTextFileEditorControl"),super.createEditorControl(e,t),pi("code/didCreateTextFileEditorControl")}tracksEditorViewState(e){return e instanceof aa}tracksDisposedEditorViewState(){return!0}},Ep=No,No.ID=tT,No);gc=Ep=D([u(1,mt),u(2,Le),u(3,js),u(4,F),u(5,bs),u(6,ce),u(7,pr),u(8,Q),u(9,me),u(10,Je),u(11,hr),u(12,nT),u(13,rr),u(14,Rc),u(15,ie),u(16,zc),u(17,Zt),u(18,$c)],gc);var Wn;let fc=(Wn=class extends R{constructor(e,t,i,s,o,n,r){super(),this.editorService=e,this.textFileService=t,this.lifecycleService=i,this.hostService=s,this.codeEditorService=o,this.filesConfigurationService=n,this.workingCopyEditorService=r,this.ensureDirtyFilesAreOpenedWorker=this._register(new rT(d=>this.ensureDirtyTextFilesAreOpened(d),this.getDirtyTextFileTrackerDelay())),this.registerListeners()}registerListeners(){this._register(this.textFileService.files.onDidChangeDirty(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.textFileService.files.onDidSaveError(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.textFileService.untitled.onDidChangeDirty(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.hostService.onDidChangeFocus(e=>e?this.reloadVisibleTextFileEditors():void 0)),this._register(this.lifecycleService.onDidShutdown(()=>this.dispose()))}getDirtyTextFileTrackerDelay(){return 800}ensureDirtyTextFilesAreOpened(e){this.doEnsureDirtyTextFilesAreOpened(Ls(e.filter(t=>{if(!this.textFileService.isDirty(t))return!1;const i=this.textFileService.files.get(t);if(i?.hasState(qf.PENDING_SAVE)||t.scheme!==pe.untitled&&!i?.hasState(qf.ERROR)&&this.filesConfigurationService.hasShortAutoSaveDelay(t)||this.editorService.isOpened({resource:t,typeId:t.scheme===pe.untitled?Hi.ID:av,editorId:Ct.id}))return!1;const s=i??this.textFileService.untitled.get(t);return!(s&&this.workingCopyEditorService.findEditor(s))}),t=>t.toString()))}doEnsureDirtyTextFilesAreOpened(e){e.length&&this.editorService.openEditors(e.map(t=>({resource:t,options:{inactive:!0,pinned:!0,preserveFocus:!0}})))}reloadVisibleTextFileEditors(){Ls(Ss(this.codeEditorService.listCodeEditors().map(e=>{const t=e.getModel()?.uri;if(!t)return;const i=this.textFileService.files.get(t);if(!(!i||i.isDirty()||!i.isResolved()))return i})),e=>e.resource.toString()).forEach(e=>this.textFileService.files.resolve(e.resource,{reload:{async:!0}}))}},Wn.ID="workbench.contrib.textFileEditorTracker",Wn);fc=D([u(0,Q),u(1,hr),u(2,or),u(3,Zt),u(4,Zo),u(5,$c),u(6,qc)],fc);var Gn;let mc=(Gn=class extends R{constructor(e,t,i,s,o,n,r,d){super(),this.fileService=e,this.configurationService=t,this.contextService=i,this.notificationService=s,this.openerService=o,this.uriIdentityService=n,this.hostService=r,this.telemetryService=d,this.watchedWorkspaces=new ps(l=>this.uriIdentityService.extUri.getComparisonKey(l)),this.registerListeners(),this.refresh()}registerListeners(){this._register(this.contextService.onDidChangeWorkspaceFolders(e=>this.onDidChangeWorkspaceFolders(e))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onDidChangeWorkbenchState())),this._register(this.configurationService.onDidChangeConfiguration(e=>this.onDidChangeConfiguration(e))),this._register(this.fileService.onDidWatchError(e=>this.onDidWatchError(e)))}onDidChangeWorkspaceFolders(e){for(const t of e.removed)this.unwatchWorkspace(t);for(const t of e.added)this.watchWorkspace(t)}onDidChangeWorkbenchState(){this.refresh()}onDidChangeConfiguration(e){(e.affectsConfiguration("files.watcherExclude")||e.affectsConfiguration("files.watcherInclude"))&&this.refresh()}onDidWatchError(e){const t=e.toString();let i;t.indexOf("ENOSPC")>=0?(i="ENOSPC",this.notificationService.prompt(Se.Warning,c(7308,"Unable to watch for file changes. Please follow the instructions link to resolve this issue."),[{label:c(7309,"Instructions"),run:()=>this.openerService.open($.parse("https://go.microsoft.com/fwlink/?linkid=867693"))}],{sticky:!0,neverShowAgain:{id:"ignoreEnospcError",isSecondary:!0,scope:aT.WORKSPACE}})):t.indexOf("EUNKNOWN")>=0?(i="EUNKNOWN",this.notificationService.prompt(Se.Warning,c(7310,"File changes watcher stopped unexpectedly. A reload of the window may enable the watcher again unless the workspace cannot be watched for file changes."),[{label:c(7311,"Reload"),run:()=>this.hostService.reload()}],{sticky:!0,priority:sn.SILENT})):t.indexOf("ETERM")>=0&&(i="ETERM"),i&&this.telemetryService.publicLog2("fileWatcherError",{reason:i})}watchWorkspace(e){const t=[],i=this.configurationService.getValue({resource:e.uri});if(i.files?.watcherExclude)for(const n in i.files.watcherExclude)n&&i.files.watcherExclude[n]===!0&&t.push(n);const s=new ps(n=>this.uriIdentityService.extUri.getComparisonKey(n));if(s.set(e.uri,e.uri),i.files?.watcherInclude){for(const n of i.files.watcherInclude)if(n)if(dT(n)){const r=$.file(n).with({scheme:e.uri.scheme});this.uriIdentityService.extUri.isEqualOrParent(r,e.uri)&&s.set(r,r)}else{const r=e.toResource(n);s.set(r,r)}}const o=new O;for(const[,n]of s)o.add(this.fileService.watch(n,{recursive:!0,excludes:t}));this.watchedWorkspaces.set(e.uri,o)}unwatchWorkspace(e){this.watchedWorkspaces.has(e.uri)&&(je(this.watchedWorkspaces.get(e.uri)),this.watchedWorkspaces.delete(e.uri))}refresh(){this.unwatchWorkspaces();for(const e of this.contextService.getWorkspace().folders)this.watchWorkspace(e)}unwatchWorkspaces(){for(const[,e]of this.watchedWorkspaces)e.dispose();this.watchedWorkspaces.clear()}dispose(){super.dispose(),this.unwatchWorkspaces()}},Gn.ID="workbench.contrib.workspaceWatcher",Gn);mc=D([u(0,Le),u(1,ie),u(2,bs),u(3,Ke),u(4,xt),u(5,rr),u(6,Zt),u(7,mt)],mc);var Un;let wc=(Un=class{constructor(e){e.registerFormatter({scheme:pe.file,formatting:{label:"${authority}${path}",separator:Nr,tildify:!Uo,normalizeDriveLetter:Uo,authorityPrefix:Nr+Nr,workspaceSuffix:""}})}},Un.ID="workbench.contrib.fileUriLabel",Un);wc=D([u(0,$i)],wc);z.as(ct.EditorPane).registerEditorPane(Ci.create(gc,gc.ID,c(7214,"Text File Editor")),[new ee(aa)]);z.as(ct.EditorPane).registerEditorPane(Ci.create(uc,uc.ID,c(7215,"Binary File Editor")),[new ee(aa)]);z.as(ct.EditorFactory).registerEditorSerializer(av,BL);yt(pc.ID,pc,vt.BlockRestore);yt(fc.ID,fc,vt.BlockStartup);yt(jf.ID,jf,vt.BlockStartup);yt(wc.ID,wc,vt.BlockStartup);yt(mc.ID,mc,vt.AfterRestored);yt(hc.ID,hc,vt.BlockStartup);cT.registerLanguage({id:og,aliases:["Binary"],mimetypes:["text/x-code-binary"]});class cl extends X{constructor(e,t){super(e),this.direction=t}run(e){const t=e.get(He),i=e.get(Je),s=e.get(js),o=t.hasFocus(P.EDITOR_PART),n=t.hasFocus(P.PANEL_PART),r=t.hasFocus(P.SIDEBAR_PART),d=t.hasFocus(P.AUXILIARYBAR_PART);let l;if(o){if(this.navigateAcrossEditorGroup(this.toGroupDirection(this.direction),i))return;l=t.getVisibleNeighborPart(P.EDITOR_PART,this.direction)}n&&(l=t.getVisibleNeighborPart(P.PANEL_PART,this.direction)),r&&(l=t.getVisibleNeighborPart(P.SIDEBAR_PART,this.direction)),d&&(l=l=t.getVisibleNeighborPart(P.AUXILIARYBAR_PART,this.direction)),l===P.EDITOR_PART?this.navigateBackToEditorGroup(this.toGroupDirection(this.direction),i)||this.navigateToEditorGroup(this.direction===de.Right?Nt.FIRST:Nt.LAST,i):l===P.SIDEBAR_PART?this.navigateToSidebar(t,s):l===P.PANEL_PART?this.navigateToPanel(t,s):l===P.AUXILIARYBAR_PART&&this.navigateToAuxiliaryBar(t,s)}async navigateToPanel(e,t){if(!e.isVisible(P.PANEL_PART))return!1;const i=t.getActivePaneComposite(Y.Panel);if(!i)return!1;const s=i.getId(),o=await t.openPaneComposite(s,Y.Panel,!0);return o||!1}async navigateToSidebar(e,t){if(!e.isVisible(P.SIDEBAR_PART))return!1;const i=t.getActivePaneComposite(Y.Sidebar);if(!i)return!1;const s=i.getId();return!!await t.openPaneComposite(s,Y.Sidebar,!0)}async navigateToAuxiliaryBar(e,t){if(!e.isVisible(P.AUXILIARYBAR_PART))return!1;const i=t.getActivePaneComposite(Y.AuxiliaryBar);if(!i)return!1;const s=i.getId(),o=await t.openPaneComposite(s,Y.AuxiliaryBar,!0);return o||!1}navigateAcrossEditorGroup(e,t){return this.doNavigateToEditorGroup({direction:e},t)}navigateToEditorGroup(e,t){return this.doNavigateToEditorGroup({location:e},t)}navigateBackToEditorGroup(e,t){if(!t.activeGroup)return!1;const i=this.toOppositeDirection(e);return t.findGroup({direction:i},t.activeGroup)?!1:(t.activeGroup.focus(),!0)}toGroupDirection(e){switch(e){case de.Down:return we.DOWN;case de.Left:return we.LEFT;case de.Right:return we.RIGHT;case de.Up:return we.UP}}toOppositeDirection(e){switch(e){case we.UP:return we.DOWN;case we.RIGHT:return we.LEFT;case we.LEFT:return we.RIGHT;case we.DOWN:return we.UP}}doNavigateToEditorGroup(e,t){const i=t.findGroup(e,t.activeGroup);return i?(i.focus(),!0):!1}}b(class extends cl{constructor(){super({id:"workbench.action.navigateLeft",title:x(2774,"Navigate to the View on the Left"),category:xe.View,f1:!0},de.Left)}});b(class extends cl{constructor(){super({id:"workbench.action.navigateRight",title:x(2775,"Navigate to the View on the Right"),category:xe.View,f1:!0},de.Right)}});b(class extends cl{constructor(){super({id:"workbench.action.navigateUp",title:x(2776,"Navigate to the View Above"),category:xe.View,f1:!0},de.Up)}});b(class extends cl{constructor(){super({id:"workbench.action.navigateDown",title:x(2777,"Navigate to the View Below"),category:xe.View,f1:!0},de.Down)}});class ab extends X{constructor(e,t){super(e),this.focusNext=t}run(e){const t=e.get(He),i=e.get(Q);this.focusNextOrPreviousPart(t,i,this.focusNext)}findVisibleNeighbour(e,t,i){const s=Go(),o=Dw(s);let n;if(o)switch(t){case P.EDITOR_PART:n=P.STATUSBAR_PART;break;default:n=P.EDITOR_PART}else switch(t){case P.EDITOR_PART:n=i?P.PANEL_PART:P.SIDEBAR_PART;break;case P.PANEL_PART:n=i?P.AUXILIARYBAR_PART:P.EDITOR_PART;break;case P.AUXILIARYBAR_PART:n=i?P.STATUSBAR_PART:P.PANEL_PART;break;case P.STATUSBAR_PART:n=i?P.ACTIVITYBAR_PART:P.AUXILIARYBAR_PART;break;case P.ACTIVITYBAR_PART:n=i?P.SIDEBAR_PART:P.STATUSBAR_PART;break;case P.SIDEBAR_PART:n=i?P.EDITOR_PART:P.ACTIVITYBAR_PART;break;default:n=P.EDITOR_PART}return e.isVisible(n,s)||n===P.EDITOR_PART?n:this.findVisibleNeighbour(e,n,i)}focusNextOrPreviousPart(e,t,i){let s;t.activeEditorPane?.hasFocus()||e.hasFocus(P.EDITOR_PART)?s=P.EDITOR_PART:e.hasFocus(P.ACTIVITYBAR_PART)?s=P.ACTIVITYBAR_PART:e.hasFocus(P.STATUSBAR_PART)?s=P.STATUSBAR_PART:e.hasFocus(P.SIDEBAR_PART)?s=P.SIDEBAR_PART:e.hasFocus(P.AUXILIARYBAR_PART)?s=P.AUXILIARYBAR_PART:e.hasFocus(P.PANEL_PART)&&(s=P.PANEL_PART),e.focusPart(s?this.findVisibleNeighbour(e,s,i):P.EDITOR_PART,Go())}}b(class extends ab{constructor(){super({id:"workbench.action.focusNextPart",title:x(2778,"Focus Next Part"),category:xe.View,f1:!0,keybinding:{primary:y.F6,weight:G.WorkbenchContrib}},!0)}});b(class extends ab{constructor(){super({id:"workbench.action.focusPreviousPart",title:x(2779,"Focus Previous Part"),category:xe.View,f1:!0,keybinding:{primary:N.Shift|y.F6,weight:G.WorkbenchContrib}},!1)}});const FL=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Pe(FL);ww((a,e)=>{const t=lT(a);e.addRule(`.monaco-workbench-part { background-color: ${t}; }`);const i=a.getColor(hT);if(i&&e.addRule(`.monaco-workbench-part ::selection { background-color: ${i}; }`),Wo){const s=a.getColor(uT);if(s){const o="monaco-workbench-meta-theme-color";let n=re.document.getElementById(o);n||(n=Tw(),n.name="theme-color",n.id=o),n.content=s.toString()}}Aw&&e.addRule(`
|
|
48
|
+
.monaco-workbench-part.web {
|
|
49
|
+
touch-action: none;
|
|
50
|
+
}
|
|
51
|
+
.monaco-workbench-part .monaco-editor .view-lines {
|
|
52
|
+
user-select: text;
|
|
53
|
+
-webkit-user-select: text;
|
|
54
|
+
}
|
|
55
|
+
`),Id&&pT()&&e.addRule(`.monaco-workbench-part { background-color: ${t}; }`)});var KL={"vs/workbench/contrib/debug/browser/media/continue-tb.png":new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIxSURBVHgB7dlNbtNAGMbxZyaUBSuOYHOBYlYskEhPwscFoKsqIBRHCCKyKNADQLkAR0jCiqBIhH6wAim+AWyAVKlnmDdKJUNTimT7nVm8v13SStGjfyauG0AIIYQQQgghBKPu5HGzO0kjBEahYjRUN3QbFk33MHMvkW6tP3iDQFQ6eDFW68GpF1HYzfN5p5WkGTzTYGAtbmu9Nni29/QWPGMZvBS56bu9/SevfZ5tzsELvmvXO1jZoTGms+Inka/atRduJY9SY3SMxSf2n5a1+5y1Wd7SraSVba0/jM+oHXPWZj3DIdRm/9DyXZt98Alftb0NJlT7ornEWtvrYLKZbOL61RtU+woYansfTDbUBtWectQOYvCJ/6nd0GtvUUJQg8l5tS1wGSUEN5gM7ABHmMXuvvomKnYBAaGhB18PMN4f3dfatN1b+FRNdwP/DSUEM3j7cFt9+DSKVMO8cg+bK37F7Tcvf5m8gxK8D6aqH/feq+P86N4ZVd2xRebO8x33x8o7lOT1DO982YGrGh9r23f1nq/4QFpWnV+rYizxUpiqjj+P1eznD5aqReyDqerIVdXnnNWZO6tpkn5HxdgGF6s2mKsWsQz2XbWo9sG9w96/qpJp3VWL6h1sVWTNvA/PVYvqLhy5kxmteJ6q3nVVh2DGfR2mqi+W19UhPOC8LHmrWlRpYQNNZ3H619PeqxbV8HVpN9LI29CK/iWThVCVBQ1PJ2mpm3UhhBBCCCFEOH4DIKF0k8sm4ZEAAAAASUVORK5CYII=",import.meta.url).href,"vs/workbench/contrib/debug/browser/media/pause-tb.png":new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADASURBVHgB7dmxDcIwEEbh3xGLMAIbgFiADWADKmqoEUPAJFY2YAOyBRUxR2GLjkgxzeV9VWLlFD+3lgAAAAAAmJ6gyg4x7ZW0KT8Iup5X4fZr7hiTntI2Je3ymj23l3U4qaKZKrNNLuwUl/n91asdMvc5+b7X3A6ozIZGD1XWaGII9o5g7wj2jmDvCPaOYO8I9o5g7wj2jmDvCPaO4NpGXG0k/UH1mwfbZmeVMb9acDdsrHwbv5bvAgAAAAAAo70BgzIgmYCKG/cAAAAASUVORK5CYII=",import.meta.url).href,"vs/workbench/contrib/debug/browser/media/restart-tb.png":new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAASRSURBVHgB7ZlPTxtHGMafGUNsStWEQ6QcTauemha76r1GvZf0CzQ410iBcgiCNGVpipE5ADnkWuMec4hoP4BNbtzstBwqVWq2UlUhBTUoqgv2emf6jg1lcW1iZsdWkeYnGbyz9s48nnnn/TOAxWKxWCwWi8VisXQBQx9ZKS0lfCAR4bjsCzHSbOUuINwq/LKTdPbRY7QEOyXnShS4cnxdBfY7DXa59CDFI5EpJmVKBr7TYTRbkGxDiNrTuaTjogcMQIMoItOc84Xj65jEBv1LBz/TEMp5jt7GISVkNw+WSNEf+t6gXPkps+jXa3nTwjkMs1xajmd/XCqS2CKUWD2YFNIh4YVM6cENGMSoYCWWc1FszlQHpCzThG+cvOQW2VUn2x2NcP6EZnsBhtBa0u1QGxJIbDs7VaKkZPkqvM12tp57nsPu/u8pDjYJzm623FazvUCicff9+UWERGvTIvt0gjbc3Gwayzfe8lFXCJGeS97fQhcUZRHb5e04h++0ES4h2Mxscn4dITCzpJtLOH66jW0eCC/ZrVjFOBvHXHLOHXrzrUlfyJmW2wxcrjZWUgiMb1pNZH42Mf+Zrl+98+4dXB4cWRMCt1puMcnxLULQC8HugahPIyS3r99GDG/kyCRa7TaRfZa5CU3M2HAAmpW0ipyCbWGiqJWdFSbqXoGxk52fBl26O3bvQ2hgfIY5R0754OAr+roI6wyuDl+lTV58HWwjT5BQgQ006JENmyM9mkZkMEpujTzBCYxxTEADLcEx+Mo1lNEnYtGYpFj8h2AbB/8YGmgJ/oLs8ZLwxo9+dbeLVyiuVa+hDrYVbFPLGhr0NT3URUoH62WM1Pjgn8FmIby3z5tc/O9tWMGYo9a1kVz5Qgg2yYURLKpdZdSv5UIIfrzzGIdS/meT0ikOXAjBu9FdymNlKtjGNN2ikXxY5bMvKy8bO/7M9Rkzay9A5a8KIz4NuhQB8RQahJphtdRUrEvJ+3jNr6x54nBVtZlE/ZhAPRWMpaE8lcAmNAgl2PV+SUjhFSheLlCyOkXDmKa2pEN+0xR7r/5g9PzWlNClPLv/MzwIz2USY8G2Rr5KQQIMkH2WZQJMZWXxYBdkwQ40CR1pZUrfTEc4Wzv1UIYNJi/d+uiDihzXHFv25yxD1ae8V+Zabv06O3bvHWgSepeeT365TjF1MdhG15OCeU+2yxh9tPMI50HVtVZ3MoxVxVQbsSqc/AQhMBJLH5VnC/R2tOWWS10ssshAfhjD8sV7L+B0mHG1Oe292mO+qMd5RK5REtya/tFSFouzY/dDVS6NJQ/NMi0KNKqRNr2oI5T8gah9PzQ0tM+rVJCNNbv2pY+BQx816acox71Bad/nbUq9RsQ2h2KQM2Y6SJmM3KVacyMZIHtP0CDiZ5w7GRPb6A+GaYiGv3BUVw7zfBXAHNe1tVxQO3qWDy+XliapvvUVmi7lPP1IdfRCx6kPqfj30PQRas8LANnGYRibYJxNBJZtsN9/Q1F1JMMZ2/xbeN/16qy47wfidF4SF6fKM/w52ehv/ToQt1gsFovFYrFYLJau+AfCNPXR3BjmUgAAAABJRU5ErkJggg==",import.meta.url).href,"vs/workbench/contrib/debug/browser/media/run-with-debugging-tb.png":new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAUfSURBVHgB7ZpNTxtHGMefmbWTktICh1x66bqXXqpit5ccKmHovSVfoGCukUqJUlEaqixKE0Qb4RQpxwL9Amn6BWJzKlKl2Ea5VJXqvfVYU1xsx96ZPI+9gxdjwtpmd1G0Pwn2bWZ3/vOft2cAICQkJCQkJCQkJCTkQrKau5tczRk6XBAYeAQJ5Rq/AxKSeGnip4zF8W9/gYDxRPBa7u40cP7riY8x2Las+spSwjAhIDh4gAA+2u2+lDDLeTSzVrg/AwHhieAz0FH69g9797aC6NtBCG4SlNv+CGYyK4RY6fJE99tt3xxeSnxnCMFj0Byxj2O7/dQPt31t0kuJJXNx/HbsFLdjfrgdSB8O0u3ABq2g3A5MsOJa/BNy+z3wye3ABU+ySXK7eElc8cXtwAUrFhILvrh9YQQTfrjtkWCeBSGug5AUHZnQI27c1nj0MfRBBDyARmBoFfQJXVOoCD1CbiPFdC4dq0LZ4BxDTQcSYBT6wJcmjfNuFvogIzNQhWoM4+oJOCcGdlgF+kxCnGodA+ySZCyLFjwZJODf+GsD/tjbnde4MLAJn3ATv/Mv9MFADtPggU0tQ7saqok1j1JO0+Dy4979NPQIubqaW41VKgcZCeJht6ZL9w9F/VPoA1c7HlSIncLO2PDQcOnW+7fko+ePoCz20yjsK1UGJIuvM/FUZ4wl1btpl+PqW++kUrEUPPjzAasflt+9FgdzkhknvvGs8DuzGPsStxCMLkLxFpg4eqewi+xAn7gSTDXOuXiKhc/yy5fn6oe1Gc5hy35cxELMOfspptcpPTSnESy+EJPRK0M7olbbxOaZFKI+hds8RZV+/fk6e1Gv6UwTm/YeWCeYTfxUFdaKkTBKMACu+jBj4mc86DQdYKHJNV09swtvOtPTKI2ip1B0UxT1ccxnUv7WdZTeN0Xn5HqjWpvHtHe69NVzcdWJK8FS8jkU3XSMCs1Uu8DA/u3oVZOaeBfMg0Ypi2mTdh9XFIVVn1MXtcNaPMIh3fWz5+SqE1eCHY4dNdMWDP6rl1Kn5eMatDxqU+xsEVpUyzPLKjn67Lm76qSnbdrmFESjcp9QX+6ck1v99/8043wePHLVSY/zMNcdFxLcY1es1DsfvFndl3UtksXTz7xy1Ykrwbi8ax6rcHh0DxUsWEIUzsorgcU1ztKd76L1MvHPxwxG8lZ2X1gfeeWqE1eCaS1LR860cWUsiXWzZMRuAMpgrkU+r1pl3X5kNH+15mPPhSpcCW4v3HtpxV3AFRi+a9q+MiAA3PZhp9JB/h41YI0NjivBOJVQXIoL7wj+kazVHyMaG4Ee4Uxe//rD5d8gQFwFDzRv0s8laGyre5aUk4Y0XpmP1secs1l13bAaZw5yXtNjtDRCg0uezhjwGTwbOy0lVcZufhcXKWyilR7yb4yOmBAwrgXTdFLjFQNP4/at0SEt+nitsMYyHU5vFbeoWsY4BQPQWndj543XyxWD4twgcTUA0Vr5wNo3GEi1zSIdeU1aLvKhIVNjGjZ1C0TlBa3I1qFdOe30gt0cjo6kb3xwA4LAlcNla3/mmFghb+JRhXcYCkb/hlrjWaNS26QjiqU1txJblCBXQI3QXK7T+yAgXDZpkbRPpBAwt5hYfog7ilM4r9K/NaipJo6R0Sw4XEUy5P4348srlK+d9uh9vuN6Tl0rfL8lBNtZStzePnaf/p+DsS9ol8OOeEyUmhdSbnSuxFZz93AzXU4sji+nICQkJCQkJCTkdecljQujDnl0mKoAAAAASUVORK5CYII=",import.meta.url).href,"vs/workbench/contrib/debug/browser/media/stepinto-tb.png":new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJRSURBVHgB7ZpNbtNAFMf/zzYCdnACcoQKLlCzYAviAvQIoFLEroUVUoXoCZpwBLYg6nKDcoLkBsmCL6luH/Ocpoqjtnbdea9S+n5SFI89mpmfx56PlwCO4ziO4ziODgRj1gtenU9/zGkfhmQwJmEUC6dMb3qCG4YLLzsuvOy48LLjwldl/Vt9JdWVzYLxuohT1jxRhd8U/CJJUWx85z6uwFbB9A/oE2NPykREoglLw5gxqBKEta7SIvsX2D1mrElJocx+TOkowi8LvhcauFM72UF6Qfa0pJD+JHUgAlGEd3KaUImcgUntwiWkz5FFKHNMhMdSByIQ7ZHefkIHXaWbZLdzOkAkog5aXaQtZadNUWDjK69whiIUXn/vZFCjulhCGFjJCmqb73OlG9CUFVSjDZeV1pYV1MMrbaUtZAWTeFKTtJWsYLJ5mBu9x4vXLGUF04jhSU/vzXpapi9LWcE8Lv224F5ZoifHWYbRh5xGcJxomD7Ssqmn26FOnqY5RbWu3MrtmmFWU1gz4xeQ0xGehoHqgZzjBD/CNPHlDjB8ZyRtUovI/glfYTO/ecZlmZZe3QU+W0irz8MNssJ9iWr8LrEKA9SFQ2yqd4HsDKIUu/KOa6MuXB7jWcusPYte1l9aElZaZ02mCxJN1IXD49w6FhWCAWMoo9/DjP22WcNo/RPKqAsfpZXwsCFbWJFgYLGuVheuwqslnp+1NTxBhuZhCryHAWb74YzwMBzKH1p49qluQujZQ8Ijq13TtW0Pw+9Gk8NbGMUKsDuO4ziO4zjXzX/ncxVIRDwWzgAAAABJRU5ErkJggg==",import.meta.url).href,"vs/workbench/contrib/debug/browser/media/stepout-tb.png":new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJSSURBVHgB7ZpRbtNAEIb/cYIAqQ/tCQg3qOACOEi8Aj1BOQIPEbw14amoIHECKBcA8cpDDTeAEyQ3oA9AK9XpdsbxSlGUNk60M62i+aRIlr3S5vPYuzvjBRzHcRzHcRwdCMa8KkKnBDpy3AZGb3MawRBT4V4RtkNAwZ1u1qeOUSI/eEK/YEQGI+bICpsc5qPe97ANI0wifInsNH840l2LSKsLN5CNmEirCi8hG1GXVhNeQTaiKq0yaF0mG4DPs23nnNvSHMiSC18l+65Lu7PtNwgvLKWTCi8rK/RzCpbSyYRXkY1YSqeLcMDXWdnzgMEi2Ugtvcs3bTBzSaS/IBHphEs8D7JUrBHZ94+pjyVgaWxk6E9LBxm1CTtIRDJhmUaI18UivYpsZFpaZIl4isrTTVFJBy2RLgn3V5WNROk24UFKWcE8PewdceymOOiS6X8wy5ZuCi687rjwuuPC604b9gRcI+bCYYwuHEcN03XsXhFAt7nP+i0OLQQ6mSQLVpj11GfZv0BOYzzldOGenAsZfvI08e0OMBwYSZv0IrL/UeW4e3MuS8778i6Xdyyk1efhBbLCFl/79K/EIxigLnzKn0avkI0QtfBR3nFt1IXLczxr2LRjEWX9pSWhcYmVssmHck3UhflxPm7aNiOuUCqjH+GAH02b8mj9G8qoC49blfBwQTNekeBw32C/h7rwh5xkH8dOVVCfjwzNwxbwBgaY5MNSr5YaMx8WmAhWv/qrwuEZ4eG+0W4e87r0a9m2VKJDPJid3cKoegIcx3Ecx3GcNeAC4UEBaURTA6MAAAAASUVORK5CYII=",import.meta.url).href,"vs/workbench/contrib/debug/browser/media/stepover-tb.png":new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMnSURBVHgB7ZldTttAFIXPOA5Sfx5YgmEDzQ6agPpcdgB0BVQ09JHQp7a0aruBClZA+9qWOKygdAONl5BKhf4AuT0DQXKCG8cTzwik+SQLezzGc3zv3Dt3Ang8Ho/H4/F4PB4TFG4IrVjQA6J029uGSlAQp4LXYokqqUEHQO8ESDjwXt6zT2NRfUE/1SQnCvNFRYewiBY4AyyLoC5ATQlmR/tUeTTbkkDQUQE+vmyoD7CIFcHrsdQDwSYuhJ6T40oRO6zww6xo8Uphh9bffW7gsnkEKBG6XcQBxxQb87IOMyIKb50J2huxLKNkSrOwtioHuUdLzuZ0TVLn0Zh+cxS+s7Ev9/4GeMbrHyiBUgRrS+jBZd2jS/d47x3DTecsxOFogGp+khoqqPH0Id166crzCo+rnBp/FBarmJ6po/TGF1mSAHsZt/RcbDEI7WICdNr5TYuf0p05qCxXPuRRS10bRempBOs5Szf+esWNadGTAK1J0s0omxR+dIqGquA9xru8keCpghbzYjwqlm1b24tqzUSsZquhcDdEHCgsYHi+l4Kx4Oa+rGDEAlrs60XVwpS0KPoW0NWidQxAiZgHLcU8O0xiIjZryagZqJSqwhanyBuUhJHgdQYqjAyS1mjAgGN+uhlODRk/XzMJT8+fSQo8YubSnLdD6YOD7bywsCrKIQnD4nPcTHCA+0P/RGXnYIt0K5zfJkvPwoJZEOioHKXbaOFvcIexWE3hPNyMuTJi7k23bS+oG1NXFw5aun7lUm/18lpJuWnD4/F4xuE8uupq6PKlevtHFwsucfY2LfQX39fXWz/9wcIlwAEXAh0WCuJKuJO3nNe4YI0rmTVuImdYvROi40J0qZt4/2Mgto3sAiFisd9m0V+HA6x/Um3dY0EX+dVQ9zZ3MGxb2bqFjy62a6MJukY/HVjZumDpTyxCsQqbtK8x1gUXcFAZHFaxH7S4H22lryFO0hJ/fvnOP3M53bosM+dhGSdpiXn2Eca7q+hcDAc4EfzqgepQkN5n1ukpLVyfd3mvwT4HcIDztfSTz1LHZTTmnNUfAx6Px+PxeDwej8dz3fgHnygaDf8DyT4AAAAASUVORK5CYII=",import.meta.url).href,"vs/workbench/contrib/debug/browser/media/stop-tb.png":new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADLSURBVHgB7dkxDoJAEEbhf4ml3gFvwpGsNFSWxEqPxEmMdzDRRHRXSGjsZIEQhvclhJaXHZodCQAAAAD+4BThXuwyeWWaUqJyk19KdbRSjDrWJe6oCQUfmlepjhItzOKC40b6122dn7ca2bM4uI9eXj0x0tYRbB3B1hFsHcHWEWwdwdYRbB3B1hFsHcHWEWzdEBfxepz2UUu5LqrwdklQb0MEp95XV41sqFEc5IRrqWZirv9waJ/O4k64Xka3+9mphOYbBAAAAABj+QJmPCRPyVBXxgAAAABJRU5ErkJggg==",import.meta.url).href};dv(KL);let Vr;dv({"vs/workbench/contrib/webview/browser/pre/service-worker.js":()=>id(new URL(""+new URL("service-worker-Ce0epi43.js",import.meta.url).href,import.meta.url).href,Vr),"vs/workbench/contrib/webview/browser/pre/index.html":()=>id(new URL(""+new URL("index-Cg3XqiaZ.html",import.meta.url).href,import.meta.url).href,Vr),"vs/workbench/contrib/webview/browser/pre/index-no-csp.html":()=>id(new URL(""+new URL("index-no-csp-DMfG5HRS.html",import.meta.url).href,import.meta.url).href,Vr),"vs/workbench/contrib/webview/browser/pre/fake.html":()=>id(new URL(""+new URL("fake-DXkbmQ09.html",import.meta.url).href,import.meta.url).href,Vr)});_T(async a=>{a.get(Gp)});function VP(a){return a!=null&&(Vr=a),{...vk(),[gt.toString()]:new ee(uu,[],!1),[Ye.toString()]:new ee(qh,[],!0),[Ys.toString()]:new ee(yh,[],!0),[js.toString()]:new ee(ru,[],!0),[Zo.toString()]:new ee(ST,[],!0),[Va.toString()]:new ee(ET,[],!1),[Ta.toString()]:new ee(jh,[],!1),[bT.toString()]:new ee(CT,[],!0),[dr.toString()]:new ee(vT,[],!0),[my.toString()]:new ee(Jh,[],!0),[Gp.toString()]:new ee(Md,[],!1),[Jy.toString()]:new ee(Qh,[],!0),[Yo.toString()]:new ee(ou,[],!0),[ny.toString()]:new ee(Ux,[],!0),[Qp.toString()]:new ee(yT,[],!0),[Uc.toString()]:new ee(nu,[],!0),[Vp.toString()]:new ee(lu,[],!0),[wT.toString()]:new ee(sk,[],!0),[fT.toString()]:new ee(mT,[],!0),[gT.toString()]:new ee(ok,[],!0)}}z.as(pt.ViewContainersRegistry);z.as(pt.ViewsRegistry);export{Ih as A,cm as B,de as D,Zf as E,bh as P,mh as S,VP as a,yh as b,ks as c,Dn as d,rV as g};
|