@xano/xanoscript-monaco-editor 0.1.0 → 0.1.2
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 +77 -126
- package/dist/.vite/manifest.json +54 -54
- package/dist/assets/{editor-BivTGeL1.js → editor-4HUBGwOu.js} +1 -1
- package/dist/assets/{extensionHost.worker-bYZXB0kM.js → extensionHost.worker-BEj8h9xB.js} +7 -7
- package/dist/assets/{files.contribution._fileEditorFactory-vS4ZLYi1.js → files.contribution._fileEditorFactory-YNF_vxMj.js} +1 -1
- package/dist/assets/{iconv-lite-umd-DQaTktu2.js → iconv-lite-umd-BCZHOywd.js} +2 -7
- package/dist/assets/{iconv-lite-umd-DYWd8cEa.js → iconv-lite-umd-BGIeO9cR.js} +2 -7
- package/dist/assets/{index-CrbRjSB_.js → index-9GTRLRSC.js} +1 -1
- package/dist/assets/{index-BGwiFEyd.js → index-B48SQPT2.js} +1 -1
- package/dist/assets/{index-VRHnXpb2.js → index-B7W-kS7G.js} +1 -1
- package/dist/assets/{index-51WpeTZl.js → index-CBODr4QR.js} +3 -3
- package/dist/assets/{index-C3pnKX8a.js → index-Cw1WVxjJ.js} +1 -1
- package/dist/assets/{index-BwfWF2CI.js → index-DSexFukl.js} +47 -47
- package/dist/assets/{index-C25FTAfE.js → index-DV2XmbY1.js} +1 -1
- package/dist/assets/{index-B132pG6E.js → index-DoXiLhIy.js} +2 -2
- package/dist/assets/{index-DgK2LcnW.js → index-r-mEMSNw.js} +2 -2
- package/dist/assets/{index-yPQeQvu7.js → index-sQEJqDvC.js} +1 -1
- package/dist/assets/main--VvQJcub.js +4 -0
- package/dist/assets/main-DUUA0eUQ.js +4 -0
- package/dist/assets/main-DWv94O3B.js +1 -0
- package/dist/assets/main-Du3mMy1c.js +1 -0
- package/dist/assets/{tokenClassificationRegistry-DcBtqg2t.js → tokenClassificationRegistry-CZyxOMX0.js} +1 -1
- package/dist/assets/{views-hUfpm9tT.js → views-Bu3Oa5Y-.js} +3 -3
- package/dist/assets/{views-C4cPu3oQ.css → views-qXWInm-E.css} +1 -1
- package/dist/assets/workbenchThemeService.service-CXlQNmVU.js +1 -0
- package/dist/assets/{worker-BIMDXoFp.js → worker-BiA-ZZ0u.js} +2 -2
- package/dist/index.html +1 -1
- package/dist/logic-assistant-script.js +22301 -16325
- package/dist/logic-assistant-script.js.map +4 -4
- package/dist/worker.js +20541 -14435
- package/dist/worker.js.map +4 -4
- package/package.json +3 -1
- package/dist/assets/main-D6ceXGB_.js +0 -4
- package/dist/assets/main-DNugpDp4.js +0 -4
- package/dist/assets/main-FP17jmvp.js +0 -1
- package/dist/assets/main-b5eBH2vx.js +0 -1
- package/dist/assets/workbenchThemeService.service-qBFVnuYD.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
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(`
|
|
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-DSexFukl.js";import{f as cv,T as ET}from"./files.contribution._fileEditorFactory-YNF_vxMj.js";import{I as IT}from"./workbenchThemeService.service-CXlQNmVU.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
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
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
5
|
${e}
|
|
@@ -29,7 +29,7 @@ ${s}`}_dumpDebugInfoJSON(){const e={layout:this.keyboardLayoutService.getCurrent
|
|
|
29
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
30
|
${e.join(`
|
|
31
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.
|
|
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;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
33
|
|
|
34
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
35
|
|
|
@@ -44,7 +44,7 @@ If {1} did not launch, try again below.`,this.productService.nameLong,this.produ
|
|
|
44
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
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
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(`
|
|
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)t===P.EDITOR_PART?n=P.STATUSBAR_PART: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
48
|
.monaco-workbench-part.web {
|
|
49
49
|
touch-action: none;
|
|
50
50
|
}
|