smart-home-engine 0.19.9 → 0.20.1
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/dist/web/assets/index-CZEb06G1.js +225 -0
- package/dist/web/assets/{index-ChpDowYT.css → index-bwhJdsUd.css} +1 -1
- package/dist/web/assets/{tsMode-CFaMfW0s.js → tsMode-C7N40v-8.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/src/index.js +8 -1
- package/src/web/auth.js +10 -3
- package/src/web/server.js +2 -1
- package/dist/web/assets/index-BMmVmcNK.js +0 -225
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonMode-CXWNuhmR.js","assets/monaco-langs-BW2J83t5.js","assets/monaco-langs-DyX1CsEw.css","assets/tsMode-CFaMfW0s.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var iA=Object.defineProperty;var wL=o=>{throw TypeError(o)};var nA=(o,e,t)=>e in o?iA(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var Mi=(o,e,t)=>nA(o,typeof e!="symbol"?e+"":e,t),Mw=(o,e,t)=>e.has(o)||wL("Cannot "+t);var J=(o,e,t)=>(Mw(o,e,"read from private field"),t?t.call(o):e.get(o)),bi=(o,e,t)=>e.has(o)?wL("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),wi=(o,e,t,i)=>(Mw(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t),un=(o,e,t)=>(Mw(o,e,"access private method"),t);import{_ as AD,m as OD,l as ht,A as Vs,C as le,I as pn,D as _p,a as Un,g as FD,M as Ye,b as Ot,E as Pr,c as M,r as Yi,d as sr,e as w,f as sA,h as dn,R as yi,S as Mt,i as Is,j as or,k as Ri,n as oi,o as ie,p as Se,K as Gn,q as at,s as Be,t as ts,u as H,v as pi,O as aa,w as Yn,P as ut,x as Nw,y as vp,z as HD,B as za,F as Tr,G as Ty,H as ps,U as nn,J as Tu,L as gt,N as Ka,Q as oA,T as Fs,V as My,W as rA,X as WD,$ as rt,Y as Wi,Z as Ni,a0 as Cn,a1 as qt,a2 as So,a3 as Cf,a4 as Oe,a5 as Fm,a6 as aA,a7 as lA,a8 as es,a9 as cA,aa as Mr,ab as js,ac as bt,ad as BD,ae as gn,af as dA,ag as hA,ah as Ws,ai as lg,aj as Zn,ak as xb,al as Rs,am as dc,an as n0,ao as Lb,ap as us,aq as Mu,ar as gs,as as Ib,at as kb,au as uA,av as bp,aw as cg,ax as nl,ay as gA,az as dg,aA as fA,aB as s0,aC as pA,aD as mA,aE as yL,aF as jn,aG as Va,aH as As,aI as ii,aJ as Fa,aK as _A,aL as ua,aM as bo,aN as ls,aO as Nr,aP as o0,aQ as is,aR as Wn,aS as c_,aT as ti,aU as zD,aV as vA,aW as r0,aX as Db,aY as a0,aZ as l0,a_ as Bc,a$ as bA,b0 as c0,b1 as wA,b2 as d0,b3 as sl,b4 as ol,b5 as Nu,b6 as xf,b7 as oo,b8 as wp,b9 as d_,ba as Rw,bb as on,bc as h0,bd as yp,be as Eb,bf as yA,bg as VD,bh as Lf,bi as Ru,bj as If,bk as Sp,bl as Pb,bm as Oi,bn as hc,bo as Cp,bp as SA,bq as CA,br as u0,bs as xA,bt as h_,bu as Wo,bv as g0,bw as Au,bx as rl,by as hg,bz as ui,bA as Ou,bB as jD,bC as xp,bD as LA,bE as zc,bF as Qe,bG as SL,bH as Hm,bI as UD,bJ as lr,bK as Ir,bL as an,bM as Fu,bN as Jo,bO as Hu,bP as Sn,bQ as kf,bR as nh,bS as Ny,bT as $D,bU as qD,bV as KD,bW as f0,bX as Ys,bY as Zi,bZ as Lp,b_ as GD,b$ as ja,c0 as Tb,c1 as IA,c2 as Uh,c3 as CL,c4 as Ip,c5 as ZD,c6 as $h,c7 as kA,c8 as $o,c9 as Mb,ca as DA,cb as Us,cc as Rr,cd as kp,ce as Df,cf as XD,cg as Ao,ch as Dp,ci as Nb,cj as EA,ck as PA,cl as TA,cm as ug,cn as ga,co as cs,cp as MA,cq as p0,cr as NA,cs as RA,ct as xL,cu as AA,cv as Ep,cw as Ga,cx as Ry,cy as Hd,cz as Za,cA as OA,cB as la,cC as Qo,cD as mo,cE as LL,cF as Ds,cG as Pp,cH as tc,cI as fa,cJ as FA,cK as Ar,cL as Ef,cM as Rb,cN as YD,cO as HA,cP as WA,cQ as m0,cR as BA,cS as Pf,cT as zA,cU as Il,cV as Tf,cW as IL,cX as VA,cY as jA,cZ as _a,c_ as UA,c$ as _0,d0 as JD,d1 as QD,d2 as eE,d3 as tE,d4 as $A,d5 as qA,d6 as iE,d7 as nE,d8 as KA,d9 as v0,da as GA,db as ZA,dc as En,dd as XA,de as b0,df as YA,dg as qh,dh as kL,di as JA,dj as QA,dk as eO,dl as tO,dm as iO,dn as nO,dp as Wu,dq as Ab,dr as Ay,ds as sO,dt as oO,du as DL,dv as Oy,dw as rO,dx as EL,dy as Aw,dz as aO,dA as sE,dB as lO,dC as oE,dD as Fy,dE as cO,dF as dO,dG as hO,dH as rE,dI as aE,dJ as uO,dK as u_,dL as lE,dM as Ob,dN as gO,dO as fO,dP as ic,dQ as w0,dR as pO,dS as PL,dT as TL,dU as mO,dV as Kh,dW as cE,dX as _O,dY as vO,dZ as bO,d_ as wO,d$ as dE,e0 as hE,e1 as uE,e2 as gE,e3 as yO,e4 as ca,e5 as ML,e6 as SO,e7 as Tp,e8 as CO,e9 as Wg,ea as fE,eb as NL,ec as Mf,ed as pE,ee as g_,ef as xO,eg as mE,eh as LO,ei as _E,ej as IO,ek as kO,el as vE,em as bE,en as Xa,eo as Fb,ep as DO,eq as wE,er as wo,es as Vc,et as yE,eu as EO,ev as PO,ew as SE,ex as CE,ey as TO,ez as xE,eA as LE,eB as Nf,eC as MO,eD as NO,eE as RO,eF as AO,eG as Dg,eH as RL,eI as OO,eJ as FO,eK as HO,eL as f_,eM as vs,eN as WO,eO as Hy,eP as sh,eQ as BO,eR as Oa,eS as zO,eT as VO,eU as IE,eV as jO,eW as nf,eX as UO,eY as $O,eZ as qO,e_ as KO,e$ as AL,f0 as OL,f1 as FL,f2 as oh,f3 as y0,f4 as kE,f5 as Wy,f6 as Wm,f7 as DE,f8 as p_,f9 as GO,fa as ZO,fb as XO,fc as YO,fd as S0,fe as EE,ff as JO,fg as m_,fh as PE,fi as TE,fj as QO,fk as e2,fl as t2,fm as i2,fn as n2,fo as s2,fp as o2,fq as r2,fr as ME,fs as a2,ft as __,fu as NE,fv as l2,fw as RE,fx as c2,fy as AE,fz as OE,fA as d2,fB as HL,fC as FE,fD as WL,fE as h2,fF as Ow,fG as BL,fH as u2,fI as g2,fJ as f2,fK as ea,fL as nc,fM as p2,fN as zL,fO as Bm,fP as m2,fQ as Ha,fR as Hb,fS as By,fT as _2,fU as HE,fV as WE,fW as Es,fX as VL,fY as am,fZ as C0,f_ as v2,f$ as b2,g0 as w2,g1 as y2,g2 as S2,g3 as C2,g4 as x2,g5 as L2,g6 as jL,g7 as I2,g8 as k2,g9 as D2,ga as Bu,gb as sf,gc as BE,gd as E2,ge as x0,gf as zm,gg as lm,gh as Fw,gi as P2,gj as T2,gk as zE,gl as M2,gm as L0,gn as N2,go as R2,gp as VE,gq as Wb,gr as A2,gs as v_,gt as I0,gu as k0,gv as D0,gw as jE,gx as UE,gy as $E,gz as qE,gA as KE,gB as GE,gC as ZE,gD as UL,gE as XE,gF as Sh,gG as O2,gH as F2,gI as H2,gJ as W2,gK as YE,gL as B2,gM as z2,gN as $L,gO as zy,gP as Al,gQ as V2,gR as j2,gS as U2,gT as $2,gU as q2,gV as K2,gW as qL,gX as E0,gY as Vy,gZ as G2,g_ as jy,g$ as Z2,h0 as X2,h1 as Y2,h2 as J2,h3 as P0,h4 as JE,h5 as KL,h6 as GL,h7 as Q2,h8 as eF,h9 as tF,ha as ZL,hb as Hw,hc as iF,hd as nF,he as sF,hf as Ww,hg as QE,hh as eP,hi as tP,hj as iP,hk as Ya,hl as nP,hm as T0,hn as XL,ho as oF,hp as sP,hq as rF,hr as aF,hs as Bb,ht as zb,hu as rh,hv as Vb,hw as Mp,hx as lF,hy as jb,hz as cF,hA as dF,hB as hF,hC as oP,hD as Eg,hE as uF,hF as gF,hG as fF,hH as pF,hI as Np,hJ as mF,hK as rP,hL as aP,hM as lP,hN as Uy,hO as _F,hP as vF,hQ as bF,hR as wF,hS as yF,hT as $y,hU as SF,hV as CF,hW as xF,hX as LF,hY as IF,hZ as kF,h_ as DF,h$ as EF,i0 as cP,i1 as PF,i2 as TF,i3 as MF,i4 as YL,i5 as NF,i6 as RF,i7 as Ic,i8 as Da,i9 as AF,ia as OF}from"./monaco-langs-BW2J83t5.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function t(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(n){if(n.ep)return;n.ep=!0;const s=t(n);fetch(n.href,s)}})();const dP=!1;var M0=Array.isArray,FF=Array.prototype.indexOf,b_=Array.prototype.includes,Ub=Array.from,HF=Object.defineProperty,lu=Object.getOwnPropertyDescriptor,WF=Object.getOwnPropertyDescriptors,BF=Object.prototype,zF=Array.prototype,hP=Object.getPrototypeOf,JL=Object.isExtensible;const $b=()=>{};function VF(o){for(var e=0;e<o.length;e++)o[e]()}function uP(){var o,e,t=new Promise((i,n)=>{o=i,e=n});return{promise:t,resolve:o,reject:e}}function QL(o,e){if(Array.isArray(o))return o;if(!(Symbol.iterator in o))return Array.from(o);const t=[];for(const i of o)if(t.push(i),t.length===e)break;return t}const Ms=2,zu=4,qb=8,gP=1<<24,kr=16,Er=32,sc=64,qy=128,ir=512,bs=1024,Cs=2048,pa=4096,to=8192,nr=16384,gg=32768,Ky=1<<25,Vu=65536,w_=1<<17,jF=1<<18,fg=1<<19,UF=1<<20,sa=1<<25,Wd=65536,y_=1<<21,cu=1<<22,Ol=1<<23,jc=Symbol("$state"),$F=Symbol("legacy props"),qF=Symbol(""),Vm=Symbol("attributes"),Gy=Symbol("class"),Zy=Symbol("style"),Bg=Symbol("text"),jm=Symbol("form reset"),Kb=new class extends Error{constructor(){super(...arguments);Mi(this,"name","StaleReactionError");Mi(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function fP(o){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function KF(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function GF(o,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function ZF(o){throw new Error("https://svelte.dev/e/effect_in_teardown")}function XF(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function YF(o){throw new Error("https://svelte.dev/e/effect_orphan")}function JF(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function QF(o){throw new Error("https://svelte.dev/e/props_invalid_value")}function eH(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function tH(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function iH(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function nH(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const sH=1,oH=2,pP=4,rH=8,aH=16,lH=1,cH=4,dH=8,hH=16,uH=1,gH=2,_s=Symbol("uninitialized"),mP="http://www.w3.org/1999/xhtml",fH="http://www.w3.org/2000/svg",pH="http://www.w3.org/1998/Math/MathML";function mH(){console.warn("https://svelte.dev/e/derived_inert")}function _H(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function vH(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function _P(o){return o===this.v}function bH(o,e){return o!=o?e==e:o!==e||o!==null&&typeof o=="object"||typeof o=="function"}function vP(o){return!bH(o,this.v)}let wH=!1,Ts=null;function ju(o){Ts=o}function xo(o,e=!1,t){Ts={p:Ts,i:!1,c:null,e:null,s:o,x:null,r:Xi,l:null}}function Lo(o){var e=Ts,t=e.e;if(t!==null){e.e=null;for(var i of t)zP(i)}return o!==void 0&&(e.x=o),e.i=!0,Ts=e.p,o??{}}function bP(){return!0}let Tc=[];function wP(){var o=Tc;Tc=[],VF(o)}function Fl(o){if(Tc.length===0&&!rf){var e=Tc;queueMicrotask(()=>{e===Tc&&wP()})}Tc.push(o)}function yH(){for(;Tc.length>0;)wP()}function yP(o){var e=Xi;if(e===null)return Gi.f|=Ol,o;if((e.f&gg)===0&&(e.f&zu)===0)throw o;kl(o,e)}function kl(o,e){for(;e!==null;){if((e.f&qy)!==0){if((e.f&gg)===0)throw o;try{e.b.error(o);return}catch(t){o=t}}e=e.parent}throw o}const SH=-7169;function rs(o,e){o.f=o.f&SH|e}function N0(o){(o.f&ir)!==0||o.deps===null?rs(o,bs):rs(o,pa)}function SP(o){if(o!==null)for(const e of o)(e.f&Ms)===0||(e.f&Wd)===0||(e.f^=Wd,SP(e.deps))}function CP(o,e,t){(o.f&Cs)!==0?e.add(o):(o.f&pa)!==0&&t.add(o),SP(o.deps),rs(o,bs)}let cm=!1;function CH(o){var e=cm;try{return cm=!1,[o(),cm]}finally{cm=e}}let Bw=null,Ch=null,Jt=null,of=null,ks=null,Xy=null,rf=!1,zw=!1,Gh=null,Um=null;var eI=0;let xH=1;var gu,Cl,Ac,fu,pu,mu,Ma,_u,go,hp,Na,_r,Xr,vu,Oc,Pn,Yy,zg,Jy,xP,LP,Hh,LH,Vg;const Tv=class Tv{constructor(){bi(this,Pn);Mi(this,"id",xH++);bi(this,gu,!1);Mi(this,"linked",!0);bi(this,Cl,null);bi(this,Ac,null);Mi(this,"async_deriveds",new Map);Mi(this,"current",new Map);Mi(this,"previous",new Map);bi(this,fu,new Set);bi(this,pu,new Set);bi(this,mu,0);bi(this,Ma,new Map);bi(this,_u,null);bi(this,go,[]);bi(this,hp,[]);bi(this,Na,new Set);bi(this,_r,new Set);bi(this,Xr,new Map);bi(this,vu,new Set);Mi(this,"is_fork",!1);bi(this,Oc,!1);Ch===null?Bw=Ch=this:(wi(Ch,Ac,this),wi(this,Cl,Ch)),Ch=this}skip_effect(e){J(this,Xr).has(e)||J(this,Xr).set(e,{d:[],m:[]}),J(this,vu).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=J(this,Xr).get(e);if(i){J(this,Xr).delete(e);for(var n of i.d)rs(n,Cs),t(n);for(n of i.m)rs(n,pa),t(n)}J(this,vu).add(e)}capture(e,t,i=!1){e.v!==_s&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&Ol)===0&&(this.current.set(e,[t,i]),ks==null||ks.set(e,t)),this.is_fork||(e.v=t)}activate(){Jt=this}deactivate(){Jt=null,ks=null}flush(){try{zw=!0,Jt=this,un(this,Pn,zg).call(this)}finally{eI=0,Xy=null,Gh=null,Um=null,zw=!1,Jt=null,ks=null,Uc.clear()}}discard(){var e;for(const t of J(this,pu))t(this);J(this,pu).clear(),un(this,Pn,Vg).call(this),(e=J(this,_u))==null||e.resolve()}register_created_effect(e){J(this,hp).push(e)}increment(e,t){if(wi(this,mu,J(this,mu)+1),e){let i=J(this,Ma).get(t)??0;J(this,Ma).set(t,i+1)}}decrement(e,t){if(wi(this,mu,J(this,mu)-1),e){let i=J(this,Ma).get(t)??0;i===1?J(this,Ma).delete(t):J(this,Ma).set(t,i-1)}J(this,Oc)||(wi(this,Oc,!0),Fl(()=>{wi(this,Oc,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)J(this,Na).add(i);for(const i of t)J(this,_r).add(i);e.clear(),t.clear()}oncommit(e){J(this,fu).add(e)}ondiscard(e){J(this,pu).add(e)}settled(){return(J(this,_u)??wi(this,_u,uP())).promise}static ensure(){if(Jt===null){const e=Jt=new Tv;!zw&&!rf&&Fl(()=>{J(e,gu)||e.flush()})}return Jt}apply(){{ks=null;return}}schedule(e){var n;if(Xy=e,(n=e.b)!=null&&n.is_pending&&(e.f&(zu|qb|gP))!==0&&(e.f&gg)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(Gh!==null&&t===Xi&&(Gi===null||(Gi.f&Ms)===0))return;if((i&(sc|Er))!==0){if((i&bs)===0)return;t.f^=bs}}J(this,go).push(t)}};gu=new WeakMap,Cl=new WeakMap,Ac=new WeakMap,fu=new WeakMap,pu=new WeakMap,mu=new WeakMap,Ma=new WeakMap,_u=new WeakMap,go=new WeakMap,hp=new WeakMap,Na=new WeakMap,_r=new WeakMap,Xr=new WeakMap,vu=new WeakMap,Oc=new WeakMap,Pn=new WeakSet,Yy=function(){if(this.is_fork)return!0;for(const i of J(this,Ma).keys()){for(var e=i,t=!1;e.parent!==null;){if(J(this,Xr).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},zg=function(){var c,d,u,f;wi(this,gu,!0),eI++>1e3&&(un(this,Pn,Vg).call(this),kH());for(const m of J(this,Na))J(this,_r).delete(m),rs(m,Cs),this.schedule(m);for(const m of J(this,_r))rs(m,pa),this.schedule(m);const e=J(this,go);wi(this,go,[]),this.apply();var t=Gh=[],i=[],n=Um=[];for(const m of e)try{un(this,Pn,Jy).call(this,m,t,i)}catch(v){throw DP(m),un(this,Pn,Yy).call(this)||this.discard(),v}if(Jt=null,n.length>0){var s=Tv.ensure();for(const m of n)s.schedule(m)}if(Gh=null,Um=null,un(this,Pn,Yy).call(this)){un(this,Pn,Hh).call(this,i),un(this,Pn,Hh).call(this,t);for(const[m,v]of J(this,Xr))kP(m,v);n.length>0&&un(c=Jt,Pn,zg).call(c);return}const r=un(this,Pn,xP).call(this);if(r){un(this,Pn,Hh).call(this,i),un(this,Pn,Hh).call(this,t),un(d=r,Pn,LP).call(d,this);return}J(this,Na).clear(),J(this,_r).clear();for(const m of J(this,fu))m(this);J(this,fu).clear(),of=this,tI(i),tI(t),of=null,(u=J(this,_u))==null||u.resolve();var a=Jt;if(J(this,mu)===0&&(J(this,go).length===0||a!==null)&&un(this,Pn,Vg).call(this),J(this,go).length>0)if(a!==null){const m=a;J(m,go).push(...J(this,go).filter(v=>!J(m,go).includes(v)))}else a=this;a!==null&&un(f=a,Pn,zg).call(f)},Jy=function(e,t,i){e.f^=bs;for(var n=e.first;n!==null;){var s=n.f,r=(s&(Er|sc))!==0,a=r&&(s&bs)!==0,c=a||(s&to)!==0||J(this,Xr).has(n);if(!c&&n.fn!==null){r?n.f^=bs:(s&zu)!==0?t.push(n):Ap(n)&&((s&kr)!==0&&J(this,_r).add(n),$u(n));var d=n.first;if(d!==null){n=d;continue}}for(;n!==null;){var u=n.next;if(u!==null){n=u;break}n=n.parent}}},xP=function(){for(var e=J(this,Cl);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=J(e,Cl)}return null},LP=function(e){var i;for(const[n,s]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,s);for(const[n,s]of e.async_deriveds){const r=this.async_deriveds.get(n);r&&s.promise.then(r.resolve).catch(r.reject)}this.transfer_effects(J(e,Na),J(e,_r));const t=n=>{var s=n.reactions;if(s!==null)for(const c of s){var r=c.f;if((r&Ms)!==0)t(c);else{var a=c;r&(cu|kr)&&!this.async_deriveds.has(a)&&(J(this,_r).delete(a),rs(a,Cs),this.schedule(a))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),un(i=e,Pn,Vg).call(i),Jt=this,un(this,Pn,zg).call(this)},Hh=function(e){for(var t=0;t<e.length;t+=1)CP(e[t],J(this,Na),J(this,_r))},LH=function(){var u;for(let f=Bw;f!==null;f=J(f,Ac)){var e=f.id<this.id,t=[];for(const[m,[v,_]]of this.current){if(f.current.has(m)){var i=f.current.get(m)[0];if(e&&v!==i)f.current.set(m,[v,_]);else continue}t.push(m)}if(e)for(const[m,v]of this.async_deriveds){const _=f.async_deriveds.get(m);_&&v.promise.then(_.resolve).catch(_.reject)}if(J(f,gu)){var n=[...f.current.keys()].filter(m=>!f.current.get(m)[1]&&!this.current.has(m));if(n.length===0)e&&f.discard();else if(t.length>0){if(e)for(const m of J(this,vu))f.unskip_effect(m,v=>{var _;(v.f&(kr|cu))!==0?f.schedule(v):un(_=f,Pn,Hh).call(_,[v])});f.activate();var s=new Set,r=new Map;for(var a of t)IP(a,n,s,r);r=new Map;var c=[...f.current].filter(([m,v])=>{const _=this.current.get(m);return _?_[0]!==v[0]||_[1]!==v[1]:!0}).map(([m])=>m);if(c.length>0)for(const m of J(this,hp))(m.f&(nr|to|w_))===0&&R0(m,c,r)&&((m.f&(cu|kr))!==0?(rs(m,Cs),f.schedule(m)):J(f,Na).add(m));if(J(f,go).length>0&&!J(f,Oc)){f.apply();for(var d of J(f,go))un(u=f,Pn,Jy).call(u,d,[],[]);wi(f,go,[])}f.deactivate()}}}},Vg=function(){if(this.linked){var e=J(this,Cl),t=J(this,Ac);e===null?Bw=t:wi(e,Ac,t),t===null?Ch=e:wi(t,Cl,e),this.linked=!1}};let Bd=Tv;function IH(o){var e=rf;rf=!0;try{for(var t;;){if(yH(),Jt===null)return t;Jt.flush()}}finally{rf=e}}function kH(){try{JF()}catch(o){kl(o,Xy)}}let fr=null;function tI(o){var e=o.length;if(e!==0){for(var t=0;t<e;){var i=o[t++];if((i.f&(nr|to))===0&&Ap(i)&&(fr=new Set,$u(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&UP(i),(fr==null?void 0:fr.size)>0)){Uc.clear();for(const n of fr){if((n.f&(nr|to))!==0)continue;const s=[n];let r=n.parent;for(;r!==null;)fr.has(r)&&(fr.delete(r),s.push(r)),r=r.parent;for(let a=s.length-1;a>=0;a--){const c=s[a];(c.f&(nr|to))===0&&$u(c)}}fr.clear()}}fr=null}}function IP(o,e,t,i){if(!t.has(o)&&(t.add(o),o.reactions!==null))for(const n of o.reactions){const s=n.f;(s&Ms)!==0?IP(n,e,t,i):(s&(cu|kr))!==0&&(s&Cs)===0&&R0(n,e,i)&&(rs(n,Cs),A0(n))}}function R0(o,e,t){const i=t.get(o);if(i!==void 0)return i;if(o.deps!==null)for(const n of o.deps){if(b_.call(e,n))return!0;if((n.f&Ms)!==0&&R0(n,e,t))return t.set(n,!0),!0}return t.set(o,!1),!1}function A0(o){Jt.schedule(o)}function kP(o,e){if(!((o.f&Er)!==0&&(o.f&bs)!==0)){(o.f&Cs)!==0?e.d.push(o):(o.f&pa)!==0&&e.m.push(o),rs(o,bs);for(var t=o.first;t!==null;)kP(t,e),t=t.next}}function DP(o){rs(o,bs);for(var e=o.first;e!==null;)DP(e),e=e.next}function DH(o){let e=0,t=zd(0),i;return()=>{H0()&&(g(t),Zb(()=>(e===0&&(i=ll(()=>o(()=>af(t)))),e+=1,()=>{Fl(()=>{e-=1,e===0&&(i==null||i(),i=void 0,af(t))})})))}}var EH=Vu|fg;function PH(o,e,t,i){new TH(o,e,t,i)}var Ko,i0,Go,Fc,fo,Zo,Zs,To,Ra,Hc,xl,bu,up,gp,Aa,Mv,as,MH,NH,RH,Qy,$m,qm,eS,tS;class TH{constructor(e,t,i,n){bi(this,as);Mi(this,"parent");Mi(this,"is_pending",!1);Mi(this,"transform_error");bi(this,Ko);bi(this,i0,null);bi(this,Go);bi(this,Fc);bi(this,fo);bi(this,Zo,null);bi(this,Zs,null);bi(this,To,null);bi(this,Ra,null);bi(this,Hc,0);bi(this,xl,0);bi(this,bu,!1);bi(this,up,new Set);bi(this,gp,new Set);bi(this,Aa,null);bi(this,Mv,DH(()=>(wi(this,Aa,zd(J(this,Hc))),()=>{wi(this,Aa,null)})));var s;wi(this,Ko,e),wi(this,Go,t),wi(this,Fc,r=>{var a=Xi;a.b=this,a.f|=qy,i(r)}),this.parent=Xi.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(r=>r),wi(this,fo,z0(()=>{un(this,as,Qy).call(this)},EH))}defer_effect(e){CP(e,J(this,up),J(this,gp))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!J(this,Go).pending}update_pending_count(e,t){un(this,as,eS).call(this,e,t),wi(this,Hc,J(this,Hc)+e),!(!J(this,Aa)||J(this,bu))&&(wi(this,bu,!0),Fl(()=>{wi(this,bu,!1),J(this,Aa)&&Uu(J(this,Aa),J(this,Hc))}))}get_effect_pending(){return J(this,Mv).call(this),g(J(this,Aa))}error(e){if(!J(this,Go).onerror&&!J(this,Go).failed)throw e;Jt!=null&&Jt.is_fork?(J(this,Zo)&&Jt.skip_effect(J(this,Zo)),J(this,Zs)&&Jt.skip_effect(J(this,Zs)),J(this,To)&&Jt.skip_effect(J(this,To)),Jt.oncommit(()=>{un(this,as,tS).call(this,e)})):un(this,as,tS).call(this,e)}}Ko=new WeakMap,i0=new WeakMap,Go=new WeakMap,Fc=new WeakMap,fo=new WeakMap,Zo=new WeakMap,Zs=new WeakMap,To=new WeakMap,Ra=new WeakMap,Hc=new WeakMap,xl=new WeakMap,bu=new WeakMap,up=new WeakMap,gp=new WeakMap,Aa=new WeakMap,Mv=new WeakMap,as=new WeakSet,MH=function(){try{wi(this,Zo,Xo(()=>J(this,Fc).call(this,J(this,Ko))))}catch(e){this.error(e)}},NH=function(e){const t=J(this,Go).failed;t&&wi(this,To,Xo(()=>{t(J(this,Ko),()=>e,()=>()=>{})}))},RH=function(){const e=J(this,Go).pending;e&&(this.is_pending=!0,wi(this,Zs,Xo(()=>e(J(this,Ko)))),Fl(()=>{var t=wi(this,Ra,document.createDocumentFragment()),i=Ua();t.append(i),wi(this,Zo,un(this,as,qm).call(this,()=>Xo(()=>J(this,Fc).call(this,i)))),J(this,xl)===0&&(J(this,Ko).before(t),wi(this,Ra,null),qc(J(this,Zs),()=>{wi(this,Zs,null)}),un(this,as,$m).call(this,Jt))}))},Qy=function(){try{if(this.is_pending=this.has_pending_snippet(),wi(this,xl,0),wi(this,Hc,0),wi(this,Zo,Xo(()=>{J(this,Fc).call(this,J(this,Ko))})),J(this,xl)>0){var e=wi(this,Ra,document.createDocumentFragment());j0(J(this,Zo),e);const t=J(this,Go).pending;wi(this,Zs,Xo(()=>t(J(this,Ko))))}else un(this,as,$m).call(this,Jt)}catch(t){this.error(t)}},$m=function(e){this.is_pending=!1,e.transfer_effects(J(this,up),J(this,gp))},qm=function(e){var t=Xi,i=Gi,n=Ts;ma(J(this,fo)),rr(J(this,fo)),ju(J(this,fo).ctx);try{return Bd.ensure(),e()}catch(s){return yP(s),null}finally{ma(t),rr(i),ju(n)}},eS=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&un(i=this.parent,as,eS).call(i,e,t);return}wi(this,xl,J(this,xl)+e),J(this,xl)===0&&(un(this,as,$m).call(this,t),J(this,Zs)&&qc(J(this,Zs),()=>{wi(this,Zs,null)}),J(this,Ra)&&(J(this,Ko).before(J(this,Ra)),wi(this,Ra,null)))},tS=function(e){J(this,Zo)&&(yo(J(this,Zo)),wi(this,Zo,null)),J(this,Zs)&&(yo(J(this,Zs)),wi(this,Zs,null)),J(this,To)&&(yo(J(this,To)),wi(this,To,null));var t=J(this,Go).onerror;let i=J(this,Go).failed;var n=!1,s=!1;const r=()=>{if(n){vH();return}n=!0,s&&nH(),J(this,To)!==null&&qc(J(this,To),()=>{wi(this,To,null)}),un(this,as,qm).call(this,()=>{un(this,as,Qy).call(this)})},a=c=>{try{s=!0,t==null||t(c,r),s=!1}catch(d){kl(d,J(this,fo)&&J(this,fo).parent)}i&&wi(this,To,un(this,as,qm).call(this,()=>{try{return Xo(()=>{var d=Xi;d.b=this,d.f|=qy,i(J(this,Ko),()=>c,()=>r)})}catch(d){return kl(d,J(this,fo).parent),null}}))};Fl(()=>{var c;try{c=this.transform_error(e)}catch(d){kl(d,J(this,fo)&&J(this,fo).parent);return}c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(a,d=>kl(d,J(this,fo)&&J(this,fo).parent)):a(c)})};function AH(o,e,t,i){const n=Rf;var s=o.filter(m=>!m.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var r=Xi,a=OH(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(m=>m.promise)):null;function d(m){if((r.f&nr)===0){a();try{i(m)}catch(v){kl(v,r)}S_()}}var u=EP();if(t.length===0){c.then(()=>d(e.map(n))).finally(u);return}function f(){Promise.all(t.map(m=>FH(m))).then(m=>d([...e.map(n),...m])).catch(m=>kl(m,r)).finally(u)}c?c.then(()=>{a(),f(),S_()}):f()}function OH(){var o=Xi,e=Gi,t=Ts,i=Jt;return function(s=!0){ma(o),rr(e),ju(t),s&&(o.f&nr)===0&&(i==null||i.activate(),i==null||i.apply())}}function S_(o=!0){ma(null),rr(null),ju(null),o&&(Jt==null||Jt.deactivate())}function EP(){var o=Xi,e=o.b,t=Jt,i=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,t),t.increment(i,o),()=>{e==null||e.update_pending_count(-1,t),t.decrement(i,o)}}function Rf(o){var e=Ms|Cs;return Xi!==null&&(Xi.f|=fg),{ctx:Ts,deps:null,effects:null,equals:_P,f:e,fn:o,reactions:null,rv:0,v:_s,wv:0,parent:Xi,ac:null}}const dm=Symbol("obsolete");function FH(o,e,t){let i=Xi;i===null&&KF();var n=void 0,s=zd(_s),r=!Gi,a=new Set;return ZH(()=>{var v,_;var c=Xi,d=uP();n=d.promise;try{Promise.resolve(o()).then(d.resolve,y=>{y!==Kb&&d.reject(y)}).finally(S_)}catch(y){d.reject(y),S_()}var u=Jt;if(r){if((c.f&gg)!==0)var f=EP();if((v=i.b)!=null&&v.is_rendered())(_=u.async_deriveds.get(c))==null||_.reject(dm);else for(const y of a.values())y.reject(dm);a.add(d),u.async_deriveds.set(c,d)}const m=(y,S=void 0)=>{f==null||f(),a.delete(d),S!==dm&&(u.activate(),S?(s.f|=Ol,Uu(s,S)):((s.f&Ol)!==0&&(s.f^=Ol),Uu(s,y)),u.deactivate())};d.promise.then(m,y=>m(null,y||"unknown"))}),W0(()=>{for(const c of a)c.reject(dm)}),new Promise(c=>{function d(u){function f(){u===n?c(s):d(n)}u.then(f,f)}d(n)})}function ct(o){const e=Rf(o);return KP(e),e}function PP(o){const e=Rf(o);return e.equals=vP,e}function HH(o){var e=o.effects;if(e!==null){o.effects=null;for(var t=0;t<e.length;t+=1)yo(e[t])}}function O0(o){var e,t=Xi,i=o.parent;if(!Ja&&i!==null&&o.v!==_s&&(i.f&(nr|to))!==0)return mH(),o.v;ma(i);try{o.f&=~Wd,HH(o),e=YP(o)}finally{ma(t)}return e}function TP(o){var e=O0(o);if(!o.equals(e)&&(o.wv=ZP(),(!(Jt!=null&&Jt.is_fork)||o.deps===null)&&(Jt!==null?(Jt.capture(o,e,!0),of==null||of.capture(o,e,!0)):o.v=e,o.deps===null))){rs(o,bs);return}Ja||(ks!==null?(H0()||Jt!=null&&Jt.is_fork)&&ks.set(o,e):N0(o))}function WH(o){var e,t;if(o.effects!==null)for(const i of o.effects)(i.teardown||i.ac)&&((e=i.teardown)==null||e.call(i),(t=i.ac)==null||t.abort(Kb),i.fn!==null&&(i.teardown=$b),i.ac=null,Af(i,0),V0(i))}function MP(o){if(o.effects!==null)for(const e of o.effects)e.teardown&&e.fn!==null&&$u(e)}let C_=new Set;const Uc=new Map;let NP=!1;function zd(o,e){var t={f:0,v:o,reactions:null,equals:_P,rv:0,wv:0};return t}function U(o,e){const t=zd(o);return KP(t),t}function BH(o,e=!1,t=!0){const i=zd(o);return e||(i.equals=vP),i}function k(o,e,t=!1){Gi!==null&&(!Dr||(Gi.f&w_)!==0)&&bP()&&(Gi.f&(Ms|kr|cu|w_))!==0&&(da===null||!da.has(o))&&iH();let i=t?Si(e):e;return Uu(o,i,Um)}function Uu(o,e,t=null){if(!o.equals(e)){Uc.set(o,Ja?e:o.v);var i=Bd.ensure();if(i.capture(o,e),(o.f&Ms)!==0){const n=o;(o.f&Cs)!==0&&O0(n),ks===null&&N0(n)}o.wv=ZP(),RP(o,Cs,t),Xi!==null&&(Xi.f&bs)!==0&&(Xi.f&(Er|sc))===0&&(qo===null?YH([o]):qo.push(o)),!i.is_fork&&C_.size>0&&!NP&&zH()}return e}function zH(){NP=!1;for(const o of C_){(o.f&bs)!==0&&rs(o,pa);let e;try{e=Ap(o)}catch{e=!0}e&&$u(o)}C_.clear()}function iI(o,e=1){var t=g(o),i=e===1?t++:t--;return k(o,t),i}function af(o){k(o,o.v+1)}function RP(o,e,t){var i=o.reactions;if(i!==null)for(var n=i.length,s=0;s<n;s++){var r=i[s],a=r.f,c=(a&Cs)===0;if(c&&rs(r,e),(a&w_)!==0)C_.add(r);else if((a&Ms)!==0){var d=r;ks==null||ks.delete(d),(a&Wd)===0&&(a&ir&&(Xi===null||(Xi.f&y_)===0)&&(r.f|=Wd),RP(d,pa,t))}else if(c){var u=r;(a&kr)!==0&&fr!==null&&fr.add(u),t!==null?t.push(u):A0(u)}}}function Si(o){if(typeof o!="object"||o===null||jc in o)return o;const e=hP(o);if(e!==BF&&e!==zF)return o;var t=new Map,i=M0(o),n=U(0),s=Kc,r=a=>{if(Kc===s)return a();var c=Gi,d=Kc;rr(null),rI(s);var u=a();return rr(c),rI(d),u};return i&&t.set("length",U(o.length)),new Proxy(o,{defineProperty(a,c,d){(!("value"in d)||d.configurable===!1||d.enumerable===!1||d.writable===!1)&&eH();var u=t.get(c);return u===void 0?r(()=>{var f=U(d.value);return t.set(c,f),f}):k(u,d.value,!0),!0},deleteProperty(a,c){var d=t.get(c);if(d===void 0){if(c in a){const u=r(()=>U(_s));t.set(c,u),af(n)}}else k(d,_s),af(n);return!0},get(a,c,d){var v;if(c===jc)return o;var u=t.get(c),f=c in a;if(u===void 0&&(!f||(v=lu(a,c))!=null&&v.writable)&&(u=r(()=>{var _=Si(f?a[c]:_s),y=U(_);return y}),t.set(c,u)),u!==void 0){var m=g(u);return m===_s?void 0:m}return Reflect.get(a,c,d)},getOwnPropertyDescriptor(a,c){var d=Reflect.getOwnPropertyDescriptor(a,c);if(d&&"value"in d){var u=t.get(c);u&&(d.value=g(u))}else if(d===void 0){var f=t.get(c),m=f==null?void 0:f.v;if(f!==void 0&&m!==_s)return{enumerable:!0,configurable:!0,value:m,writable:!0}}return d},has(a,c){var m;if(c===jc)return!0;var d=t.get(c),u=d!==void 0&&d.v!==_s||Reflect.has(a,c);if(d!==void 0||Xi!==null&&(!u||(m=lu(a,c))!=null&&m.writable)){d===void 0&&(d=r(()=>{var v=u?Si(a[c]):_s,_=U(v);return _}),t.set(c,d));var f=g(d);if(f===_s)return!1}return u},set(a,c,d,u){var N;var f=t.get(c),m=c in a;if(i&&c==="length")for(var v=d;v<f.v;v+=1){var _=t.get(v+"");_!==void 0?k(_,_s):v in a&&(_=r(()=>U(_s)),t.set(v+"",_))}if(f===void 0)(!m||(N=lu(a,c))!=null&&N.writable)&&(f=r(()=>U(void 0)),k(f,Si(d)),t.set(c,f));else{m=f.v!==_s;var y=r(()=>Si(d));k(f,y)}var S=Reflect.getOwnPropertyDescriptor(a,c);if(S!=null&&S.set&&S.set.call(u,d),!m){if(i&&typeof c=="string"){var D=t.get("length"),E=Number(c);Number.isInteger(E)&&E>=D.v&&k(D,E+1)}af(n)}return!0},ownKeys(a){g(n);var c=Reflect.ownKeys(a).filter(f=>{var m=t.get(f);return m===void 0||m.v!==_s});for(var[d,u]of t)u.v!==_s&&!(d in a)&&c.push(d);return c},setPrototypeOf(){tH()}})}function nI(o){try{if(o!==null&&typeof o=="object"&&jc in o)return o[jc]}catch{}return o}function VH(o,e){return Object.is(nI(o),nI(e))}var $c,AP,OP,FP,HP;function jH(){if($c===void 0){$c=window,AP=document,OP=/Firefox/.test(navigator.userAgent);var o=Element.prototype,e=Node.prototype,t=Text.prototype;FP=lu(e,"firstChild").get,HP=lu(e,"nextSibling").get,JL(o)&&(o[Gy]=void 0,o[Vm]=null,o[Zy]=void 0,o.__e=void 0),JL(t)&&(t[Bg]=void 0)}}function Ua(o=""){return document.createTextNode(o)}function oa(o){return FP.call(o)}function Rp(o){return HP.call(o)}function x(o,e){return oa(o)}function xt(o,e=!1){{var t=oa(o);return t instanceof Comment&&t.data===""?Rp(t):t}}function I(o,e=1,t=!1){let i=o;for(;e--;)i=Rp(i);return i}function UH(o){o.textContent=""}function WP(){return!1}function BP(o,e,t){return e==null||e===mP?t?document.createElement(o,{is:t}):document.createElement(o):t?document.createElementNS(e,o,{is:t}):document.createElementNS(e,o)}let sI=!1;function $H(){sI||(sI=!0,document.addEventListener("reset",o=>{Promise.resolve().then(()=>{var e;if(!o.defaultPrevented)for(const t of o.target.elements)(e=t[jm])==null||e.call(t)})},{capture:!0}))}function Gb(o){var e=Gi,t=Xi;rr(null),ma(null);try{return o()}finally{rr(e),ma(t)}}function F0(o,e,t,i=t){o.addEventListener(e,()=>Gb(t));const n=o[jm];n?o[jm]=()=>{n(),i(!0)}:o[jm]=()=>i(!0),$H()}function qH(o){Xi===null&&(Gi===null&&YF(),XF()),Ja&&ZF()}function KH(o,e){var t=e.last;t===null?e.last=e.first=o:(t.next=o,o.prev=t,e.last=o)}function al(o,e){var t=Xi;t!==null&&(t.f&to)!==0&&(o|=to);var i={ctx:Ts,deps:null,nodes:null,f:o|Cs|ir,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};Jt==null||Jt.register_created_effect(i);var n=i;if((o&zu)!==0)Gh!==null?Gh.push(i):Bd.ensure().schedule(i);else if(e!==null){try{$u(i)}catch(r){throw yo(i),r}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&fg)===0&&(n=n.first,(o&kr)!==0&&(o&Vu)!==0&&n!==null&&(n.f|=Vu))}if(n!==null&&(n.parent=t,t!==null&&KH(n,t),Gi!==null&&(Gi.f&Ms)!==0&&(o&sc)===0)){var s=Gi;(s.effects??(s.effects=[])).push(n)}return i}function H0(){return Gi!==null&&!Dr}function W0(o){const e=al(qb,null);return rs(e,bs),e.teardown=o,e}function kn(o){qH();var e=Xi.f,t=!Gi&&(e&Er)!==0&&Ts!==null&&!Ts.i;if(t){var i=Ts;(i.e??(i.e=[])).push(o)}else return zP(o)}function zP(o){return al(zu|UF,o)}function GH(o){Bd.ensure();const e=al(sc|fg,o);return(t={})=>new Promise(i=>{t.outro?qc(e,()=>{yo(e),i(void 0)}):(yo(e),i(void 0))})}function B0(o){return al(zu,o)}function ZH(o){return al(cu|fg,o)}function Zb(o,e=0){return al(qb|e,o)}function Y(o,e=[],t=[],i=[]){AH(i,e,t,n=>{al(qb,()=>o(...n.map(g)))})}function z0(o,e=0){var t=al(kr|e,o);return t}function Xo(o){return al(Er|fg,o)}function VP(o){var e=o.teardown;if(e!==null){const t=Ja,i=Gi;oI(!0),rr(null);try{e.call(null)}finally{oI(t),rr(i)}}}function V0(o,e=!1){var t=o.first;for(o.first=o.last=null;t!==null;){const n=t.ac;n!==null&&Gb(()=>{n.abort(Kb)});var i=t.next;(t.f&sc)!==0?t.parent=null:yo(t,e),t=i}}function XH(o){for(var e=o.first;e!==null;){var t=e.next;(e.f&Er)===0&&yo(e),e=t}}function yo(o,e=!0){var t=!1;(e||(o.f&jF)!==0)&&o.nodes!==null&&o.nodes.end!==null&&(jP(o.nodes.start,o.nodes.end),t=!0),rs(o,Ky),V0(o,e&&!t),Af(o,0);var i=o.nodes&&o.nodes.t;if(i!==null)for(const s of i)s.stop();VP(o),o.f^=Ky,o.f|=nr;var n=o.parent;n!==null&&n.first!==null&&UP(o),o.next=o.prev=o.teardown=o.ctx=o.deps=o.fn=o.nodes=o.ac=o.b=null}function jP(o,e){for(;o!==null;){var t=o===e?null:Rp(o);o.remove(),o=t}}function UP(o){var e=o.parent,t=o.prev,i=o.next;t!==null&&(t.next=i),i!==null&&(i.prev=t),e!==null&&(e.first===o&&(e.first=i),e.last===o&&(e.last=t))}function qc(o,e,t=!0){var i=[];$P(o,i,!0);var n=()=>{t&&yo(o),e&&e()},s=i.length;if(s>0){var r=()=>--s||n();for(var a of i)a.out(r)}else n()}function $P(o,e,t){if((o.f&to)===0){o.f^=to;var i=o.nodes&&o.nodes.t;if(i!==null)for(const a of i)(a.is_global||t)&&e.push(a);for(var n=o.first;n!==null;){var s=n.next;if((n.f&sc)===0){var r=(n.f&Vu)!==0||(n.f&Er)!==0&&(o.f&kr)!==0;$P(n,e,r?t:!1)}n=s}}}function x_(o){qP(o,!0)}function qP(o,e){if((o.f&to)!==0){o.f^=to,(o.f&bs)===0&&(rs(o,Cs),Bd.ensure().schedule(o));for(var t=o.first;t!==null;){var i=t.next,n=(t.f&Vu)!==0||(t.f&Er)!==0;qP(t,n?e:!1),t=i}var s=o.nodes&&o.nodes.t;if(s!==null)for(const r of s)(r.is_global||e)&&r.in()}}function j0(o,e){if(o.nodes)for(var t=o.nodes.start,i=o.nodes.end;t!==null;){var n=t===i?null:Rp(t);e.append(t),t=n}}let Km=!1,Ja=!1;function oI(o){Ja=o}let Gi=null,Dr=!1;function rr(o){Gi=o}let Xi=null;function ma(o){Xi=o}let da=null;function KP(o){Gi!==null&&(da??(da=new Set)).add(o)}let po=null,Eo=0,qo=null;function YH(o){qo=o}let GP=1,Mc=0,Kc=Mc;function rI(o){Kc=o}function ZP(){return++GP}function Ap(o){var e=o.f;if((e&Cs)!==0)return!0;if(e&Ms&&(o.f&=~Wd),(e&pa)!==0){for(var t=o.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(Ap(s)&&TP(s),s.wv>o.wv)return!0}(e&ir)!==0&&ks===null&&rs(o,bs)}return!1}function XP(o,e,t=!0){var i=o.reactions;if(i!==null&&!(da!==null&&da.has(o)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&Ms)!==0?XP(s,e,!1):e===s&&(t?rs(s,Cs):(s.f&bs)!==0&&rs(s,pa),A0(s))}}function YP(o){var y;var e=po,t=Eo,i=qo,n=Gi,s=da,r=Ts,a=Dr,c=Kc,d=o.f;po=null,Eo=0,qo=null,Gi=(d&(Er|sc))===0?o:null,da=null,ju(o.ctx),Dr=!1,Kc=++Mc,o.ac!==null&&(Gb(()=>{o.ac.abort(Kb)}),o.ac=null);try{o.f|=y_;var u=o.fn,f=u();o.f|=gg;var m=o.deps,v=Jt==null?void 0:Jt.is_fork;if(po!==null){var _;if(v||Af(o,Eo),m!==null&&Eo>0)for(m.length=Eo+po.length,_=0;_<po.length;_++)m[Eo+_]=po[_];else o.deps=m=po;if(H0()&&(o.f&ir)!==0)for(_=Eo;_<m.length;_++)((y=m[_]).reactions??(y.reactions=[])).push(o)}else!v&&m!==null&&Eo<m.length&&(Af(o,Eo),m.length=Eo);if(bP()&&qo!==null&&!Dr&&m!==null&&(o.f&(Ms|pa|Cs))===0)for(_=0;_<qo.length;_++)XP(qo[_],o);if(n!==null&&n!==o){if(Mc++,n.deps!==null)for(let S=0;S<t;S+=1)n.deps[S].rv=Mc;if(e!==null)for(const S of e)S.rv=Mc;qo!==null&&(i===null?i=qo:i.push(...qo))}return(o.f&Ol)!==0&&(o.f^=Ol),f}catch(S){return yP(S)}finally{o.f^=y_,po=e,Eo=t,qo=i,Gi=n,da=s,ju(r),Dr=a,Kc=c}}function JH(o,e){let t=e.reactions;if(t!==null){var i=FF.call(t,o);if(i!==-1){var n=t.length-1;n===0?t=e.reactions=null:(t[i]=t[n],t.pop())}}if(t===null&&(e.f&Ms)!==0&&(po===null||!b_.call(po,e))){var s=e;(s.f&ir)!==0&&(s.f^=ir,s.f&=~Wd),s.v!==_s&&N0(s),WH(s),Af(s,0)}}function Af(o,e){var t=o.deps;if(t!==null)for(var i=e;i<t.length;i++)JH(o,t[i])}function $u(o){var e=o.f;if((e&nr)===0){rs(o,bs);var t=Xi,i=Km;Xi=o,Km=!0;try{(e&(kr|gP))!==0?XH(o):V0(o),VP(o);var n=YP(o);o.teardown=typeof n=="function"?n:null,o.wv=GP;var s;dP&&wH&&(o.f&Cs)!==0&&o.deps}finally{Km=i,Xi=t}}}async function iS(){await Promise.resolve(),IH()}function g(o){var e=o.f,t=(e&Ms)!==0;if(Gi!==null&&!Dr){var i=Xi!==null&&(Xi.f&nr)!==0;if(!i&&(da===null||!da.has(o))){var n=Gi.deps;if((Gi.f&y_)!==0)o.rv<Mc&&(o.rv=Mc,po===null&&n!==null&&n[Eo]===o?Eo++:po===null?po=[o]:po.push(o));else{Gi.deps??(Gi.deps=[]),b_.call(Gi.deps,o)||Gi.deps.push(o);var s=o.reactions;s===null?o.reactions=[Gi]:b_.call(s,Gi)||s.push(Gi)}}}if(Ja&&Uc.has(o))return Uc.get(o);if(t){var r=o;if(Ja){var a=r.v;return((r.f&bs)===0&&r.reactions!==null||QP(r))&&(a=O0(r)),Uc.set(r,a),a}var c=(r.f&ir)===0&&!Dr&&Gi!==null&&(Km||(Gi.f&ir)!==0),d=(r.f&gg)===0;Ap(r)&&(c&&(r.f|=ir),TP(r)),c&&!d&&(MP(r),JP(r))}if(ks!=null&&ks.has(o))return ks.get(o);if((o.f&Ol)!==0)throw o.v;return o.v}function JP(o){if(o.f|=ir,o.deps!==null)for(const e of o.deps)(e.reactions??(e.reactions=[])).push(o),(e.f&Ms)!==0&&(e.f&ir)===0&&(MP(e),JP(e))}function QP(o){if(o.v===_s)return!0;if(o.deps===null)return!1;for(const e of o.deps)if(Uc.has(e)||(e.f&Ms)!==0&&QP(e))return!0;return!1}function ll(o){var e=Dr;try{return Dr=!0,o()}finally{Dr=e}}const QH=["touchstart","touchmove"];function eW(o){return QH.includes(o)}const Nc=Symbol("events"),eT=new Set,nS=new Set;function tW(o,e,t,i={}){function n(s){if(i.capture||sS.call(e,s),!s.cancelBubble)return Gb(()=>t==null?void 0:t.call(this,s))}return o.startsWith("pointer")||o.startsWith("touch")||o==="wheel"?Fl(()=>{e.addEventListener(o,n,i)}):e.addEventListener(o,n,i),n}function Kn(o,e,t,i,n){var s={capture:i,passive:n},r=tW(o,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&W0(()=>{e.removeEventListener(o,r,s)})}function oe(o,e,t){(e[Nc]??(e[Nc]={}))[o]=t}function cr(o){for(var e=0;e<o.length;e++)eT.add(o[e]);for(var t of nS)t(o)}let aI=null;function sS(o){var y,S;var e=this,t=e.ownerDocument,i=o.type,n=((y=o.composedPath)==null?void 0:y.call(o))||[],s=n[0]||o.target;aI=o;var r=0,a=aI===o&&o[Nc];if(a){var c=n.indexOf(a);if(c!==-1&&(e===document||e===window)){o[Nc]=e;return}var d=n.indexOf(e);if(d===-1)return;c<=d&&(r=c)}if(s=n[r]||o.target,s!==e){HF(o,"currentTarget",{configurable:!0,get(){return s||t}});var u=Gi,f=Xi;rr(null),ma(null);try{for(var m,v=[];s!==null&&s!==e;){try{var _=(S=s[Nc])==null?void 0:S[i];_!=null&&(!s.disabled||o.target===s)&&_.call(s,o)}catch(D){m?v.push(D):m=D}if(o.cancelBubble)break;r++,s=r<n.length?n[r]:null}if(m){for(let D of v)queueMicrotask(()=>{throw D});throw m}}finally{o[Nc]=e,delete o.currentTarget,rr(u),ma(f)}}}var ND;const Vw=((ND=globalThis==null?void 0:globalThis.window)==null?void 0:ND.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:o=>o});function iW(o){return(Vw==null?void 0:Vw.createHTML(o))??o}function tT(o){var e=BP("template");return e.innerHTML=iW(o.replaceAll("<!>","<!---->")),e.content}function Vd(o,e){var t=Xi;t.nodes===null&&(t.nodes={start:o,end:e,a:null,t:null})}function A(o,e){var t=(e&uH)!==0,i=(e&gH)!==0,n,s=!o.startsWith("<!>");return()=>{n===void 0&&(n=tT(s?o:"<!>"+o),t||(n=oa(n)));var r=i||OP?document.importNode(n,!0):n.cloneNode(!0);if(t){var a=oa(r),c=r.lastChild;Vd(a,c)}else Vd(r,r);return r}}function nW(o,e,t="svg"){var i=!o.startsWith("<!>"),n=`<${t}>${i?o:"<!>"+o}</${t}>`,s;return()=>{if(!s){var r=tT(n),a=oa(r);s=oa(a)}var c=s.cloneNode(!0);return Vd(c,c),c}}function iT(o,e){return nW(o,e,"svg")}function ha(o=""){{var e=Ua(o+"");return Vd(e,e),e}}function xs(){var o=document.createDocumentFragment(),e=document.createComment(""),t=Ua();return o.append(e,t),Vd(e,t),o}function T(o,e){o!==null&&o.before(e)}function q(o,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(o[Bg]??(o[Bg]=o.nodeValue))&&(o[Bg]=t,o.nodeValue=`${t}`)}function sW(o,e){return oW(o,e)}const hm=new Map;function oW(o,{target:e,anchor:t,props:i={},events:n,context:s,intro:r=!0,transformError:a}){jH();var c=void 0,d=GH(()=>{var u=t??e.appendChild(Ua());PH(u,{pending:()=>{}},v=>{xo({});var _=Ts;s&&(_.c=s),n&&(i.$$events=n),c=o(v,i)||{},Lo()},a);var f=new Set,m=v=>{for(var _=0;_<v.length;_++){var y=v[_];if(!f.has(y)){f.add(y);var S=eW(y);for(const N of[e,document]){var D=hm.get(N);D===void 0&&(D=new Map,hm.set(N,D));var E=D.get(y);E===void 0?(N.addEventListener(y,sS,{passive:S}),D.set(y,1)):D.set(y,E+1)}}}};return m(Ub(eT)),nS.add(m),()=>{var S;for(var v of f)for(const D of[e,document]){var _=hm.get(D),y=_.get(v);--y==0?(D.removeEventListener(v,sS),_.delete(v),_.size===0&&hm.delete(D)):_.set(v,y)}nS.delete(m),u!==t&&((S=u.parentNode)==null||S.removeChild(u))}});return rW.set(c,d),c}let rW=new WeakMap;var vr,Yr,Mo,Wc,fp,pp,Nv;class aW{constructor(e,t=!0){Mi(this,"anchor");bi(this,vr,new Map);bi(this,Yr,new Map);bi(this,Mo,new Map);bi(this,Wc,new Set);bi(this,fp,!0);bi(this,pp,e=>{if(J(this,vr).has(e)){var t=J(this,vr).get(e),i=J(this,Yr).get(t);if(i)x_(i),J(this,Wc).delete(t);else{var n=J(this,Mo).get(t);n&&(x_(n.effect),J(this,Yr).set(t,n.effect),J(this,Mo).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,r]of J(this,vr)){if(J(this,vr).delete(s),s===e)break;const a=J(this,Mo).get(r);a&&(yo(a.effect),J(this,Mo).delete(r))}for(const[s,r]of J(this,Yr)){if(s===t||J(this,Wc).has(s))continue;const a=()=>{if(Array.from(J(this,vr).values()).includes(s)){var d=document.createDocumentFragment();j0(r,d),d.append(Ua()),J(this,Mo).set(s,{effect:r,fragment:d})}else yo(r);J(this,Wc).delete(s),J(this,Yr).delete(s)};J(this,fp)||!i?(J(this,Wc).add(s),qc(r,a,!1)):a()}}});bi(this,Nv,e=>{J(this,vr).delete(e);const t=Array.from(J(this,vr).values());for(const[i,n]of J(this,Mo))t.includes(i)||(yo(n.effect),J(this,Mo).delete(i))});this.anchor=e,wi(this,fp,t)}ensure(e,t){var i=Jt,n=WP();if(t&&!J(this,Yr).has(e)&&!J(this,Mo).has(e))if(n){var s=document.createDocumentFragment(),r=Ua();s.append(r),J(this,Mo).set(e,{effect:Xo(()=>t(r)),fragment:s})}else J(this,Yr).set(e,Xo(()=>t(this.anchor)));if(J(this,vr).set(i,e),n){for(const[a,c]of J(this,Yr))a===e?i.unskip_effect(c):i.skip_effect(c);for(const[a,c]of J(this,Mo))a===e?i.unskip_effect(c.effect):i.skip_effect(c.effect);i.oncommit(J(this,pp)),i.ondiscard(J(this,Nv))}else J(this,pp).call(this,i)}}vr=new WeakMap,Yr=new WeakMap,Mo=new WeakMap,Wc=new WeakMap,fp=new WeakMap,pp=new WeakMap,Nv=new WeakMap;function K(o,e,t=!1){var i=new aW(o),n=t?Vu:0;function s(r,a){i.ensure(r,a)}z0(()=>{var r=!1;e((a,c=0)=>{r=!0,s(c,a)}),r||s(-1,null)},n)}function In(o,e){return e}function lW(o,e,t){for(var i=[],n=e.length,s,r=e.length,a=0;a<n;a++){let f=e[a];qc(f,()=>{if(s){if(s.pending.delete(f),s.done.add(f),s.pending.size===0){var m=o.outrogroups;oS(o,Ub(s.done)),m.delete(s),m.size===0&&(o.outrogroups=null)}}else r-=1},!1)}if(r===0){var c=i.length===0&&t!==null;if(c){var d=t,u=d.parentNode;UH(u),u.append(d),o.items.clear()}oS(o,e,!c)}else s={pending:new Set(e),done:new Set},(o.outrogroups??(o.outrogroups=new Set)).add(s)}function oS(o,e,t=!0){var i;if(o.pending.size>0){i=new Set;for(const r of o.pending.values())for(const a of r)i.add(o.items.get(a).e)}for(var n=0;n<e.length;n++){var s=e[n];if(i!=null&&i.has(s)){s.f|=sa;const r=document.createDocumentFragment();j0(s,r)}else yo(e[n],t)}}var lI;function di(o,e,t,i,n,s=null){var r=o,a=new Map,c=(e&pP)!==0;if(c){var d=o;r=d.appendChild(Ua())}var u=null,f=PP(()=>{var N=t();return M0(N)?N:N==null?[]:Ub(N)}),m,v=new Map,_=!0;function y(N){(E.effect.f&nr)===0&&(E.pending.delete(N),E.fallback=u,cW(E,m,r,e,i),u!==null&&(m.length===0?(u.f&sa)===0?x_(u):(u.f^=sa,jg(u,null,r)):qc(u,()=>{u=null})))}function S(N){E.pending.delete(N)}var D=z0(()=>{m=g(f);for(var N=m.length,B=new Set,F=Jt,Q=WP(),$=0;$<N;$+=1){var fe=m[$],Pe=i(fe,$),ze=_?null:a.get(Pe);ze?(ze.v&&Uu(ze.v,fe),ze.i&&Uu(ze.i,$),Q&&F.unskip_effect(ze.e)):(ze=dW(a,_?r:lI??(lI=Ua()),fe,Pe,$,n,e,t),_||(ze.e.f|=sa),a.set(Pe,ze)),B.add(Pe)}if(N===0&&s&&!u&&(_?u=Xo(()=>s(r)):(u=Xo(()=>s(lI??(lI=Ua()))),u.f|=sa)),N>B.size&&GF(),!_)if(v.set(F,B),Q){for(const[me,Ve]of a)B.has(me)||F.skip_effect(Ve.e);F.oncommit(y),F.ondiscard(S)}else y(F);g(f)}),E={effect:D,items:a,pending:v,outrogroups:null,fallback:u};_=!1}function Pg(o){for(;o!==null&&(o.f&Er)===0;)o=o.next;return o}function cW(o,e,t,i,n){var ze,me,Ve,dt,Ke,Ut,lt,Kt,Ie;var s=(i&rH)!==0,r=e.length,a=o.items,c=Pg(o.effect.first),d,u=null,f,m=[],v=[],_,y,S,D;if(s)for(D=0;D<r;D+=1)_=e[D],y=n(_,D),S=a.get(y).e,(S.f&sa)===0&&((me=(ze=S.nodes)==null?void 0:ze.a)==null||me.measure(),(f??(f=new Set)).add(S));for(D=0;D<r;D+=1){if(_=e[D],y=n(_,D),S=a.get(y).e,o.outrogroups!==null)for(const Pt of o.outrogroups)Pt.pending.delete(S),Pt.done.delete(S);if((S.f&to)!==0&&(x_(S),s&&((dt=(Ve=S.nodes)==null?void 0:Ve.a)==null||dt.unfix(),(f??(f=new Set)).delete(S))),(S.f&sa)!==0)if(S.f^=sa,S===c)jg(S,null,t);else{var E=u?u.next:c;S===o.effect.last&&(o.effect.last=S.prev),S.prev&&(S.prev.next=S.next),S.next&&(S.next.prev=S.prev),hl(o,u,S),hl(o,S,E),jg(S,E,t),u=S,m=[],v=[],c=Pg(u.next);continue}if(S!==c){if(d!==void 0&&d.has(S)){if(m.length<v.length){var N=v[0],B;u=N.prev;var F=m[0],Q=m[m.length-1];for(B=0;B<m.length;B+=1)jg(m[B],N,t);for(B=0;B<v.length;B+=1)d.delete(v[B]);hl(o,F.prev,Q.next),hl(o,u,F),hl(o,Q,N),c=N,u=Q,D-=1,m=[],v=[]}else d.delete(S),jg(S,c,t),hl(o,S.prev,S.next),hl(o,S,u===null?o.effect.first:u.next),hl(o,u,S),u=S;continue}for(m=[],v=[];c!==null&&c!==S;)(d??(d=new Set)).add(c),v.push(c),c=Pg(c.next);if(c===null)continue}(S.f&sa)===0&&m.push(S),u=S,c=Pg(S.next)}if(o.outrogroups!==null){for(const Pt of o.outrogroups)Pt.pending.size===0&&(oS(o,Ub(Pt.done)),(Ke=o.outrogroups)==null||Ke.delete(Pt));o.outrogroups.size===0&&(o.outrogroups=null)}if(c!==null||d!==void 0){var $=[];if(d!==void 0)for(S of d)(S.f&to)===0&&$.push(S);for(;c!==null;)(c.f&to)===0&&c!==o.fallback&&$.push(c),c=Pg(c.next);var fe=$.length;if(fe>0){var Pe=(i&pP)!==0&&r===0?t:null;if(s){for(D=0;D<fe;D+=1)(lt=(Ut=$[D].nodes)==null?void 0:Ut.a)==null||lt.measure();for(D=0;D<fe;D+=1)(Ie=(Kt=$[D].nodes)==null?void 0:Kt.a)==null||Ie.fix()}lW(o,$,Pe)}}s&&Fl(()=>{var Pt,Fe;if(f!==void 0)for(S of f)(Fe=(Pt=S.nodes)==null?void 0:Pt.a)==null||Fe.apply()})}function dW(o,e,t,i,n,s,r,a){var c=(r&sH)!==0?(r&aH)===0?BH(t,!1,!1):zd(t):null,d=(r&oH)!==0?zd(n):null;return{v:c,i:d,e:Xo(()=>(s(e,c??t,d??n,a),()=>{o.delete(i)}))}}function jg(o,e,t){if(o.nodes)for(var i=o.nodes.start,n=o.nodes.end,s=e&&(e.f&sa)===0?e.nodes.start:t;i!==null;){var r=Rp(i);if(s.before(i),i===n)return;i=r}}function hl(o,e,t){e===null?o.effect.first=t:e.next=t,t===null?o.effect.last=e:t.prev=e}function Dl(o,e,t=!1,i=!1,n=!1,s=!1){var r=o,a="";if(t)var c=o;Y(()=>{var d=Xi;if(a!==(a=e()??"")){if(t){d.nodes=null,c.innerHTML=a,a!==""&&Vd(oa(c),c.lastChild);return}if(d.nodes!==null&&(jP(d.nodes.start,d.nodes.end),d.nodes=null),a!==""){var u=i?fH:n?pH:void 0,f=BP(i?"svg":n?"math":"template",u);f.innerHTML=a;var m=i||n?f:f.content;if(Vd(oa(m),m.lastChild),i||n)for(;oa(m);)r.before(oa(m));else r.before(m)}}})}const cI=[...`
|
|
3
|
-
\r\f \v\uFEFF`];function hW(o,e,t){var i=o==null?"":""+o;if(e&&(i=i?i+" "+e:e),t){for(var n of Object.keys(t))if(t[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,r=0;(r=i.indexOf(n,r))>=0;){var a=r+s;(r===0||cI.includes(i[r-1]))&&(a===i.length||cI.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function dI(o,e=!1){var t=e?" !important;":";",i="";for(var n of Object.keys(o)){var s=o[n];s!=null&&s!==""&&(i+=" "+n+": "+s+t)}return i}function jw(o){return o[0]!=="-"||o[1]!=="-"?o.toLowerCase():o}function uW(o,e){if(e){var t="",i,n;if(Array.isArray(e)?(i=e[0],n=e[1]):i=e,o){o=String(o).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,r=0,a=!1,c=[];i&&c.push(...Object.keys(i).map(jw)),n&&c.push(...Object.keys(n).map(jw));var d=0,u=-1;const y=o.length;for(var f=0;f<y;f++){var m=o[f];if(a?m==="/"&&o[f-1]==="*"&&(a=!1):s?s===m&&(s=!1):m==="/"&&o[f+1]==="*"?a=!0:m==='"'||m==="'"?s=m:m==="("?r++:m===")"&&r--,!a&&s===!1&&r===0){if(m===":"&&u===-1)u=f;else if(m===";"||f===y-1){if(u!==-1){var v=jw(o.substring(d,u).trim());if(!c.includes(v)){m!==";"&&f++;var _=o.substring(d,f).trim();t+=" "+_+";"}}d=f+1,u=-1}}}}return i&&(t+=dI(i)),n&&(t+=dI(n,!0)),t=t.trim(),t===""?null:t}return o==null?null:String(o)}function Bt(o,e,t,i,n,s){var r=o[Gy];if(r!==t||r===void 0){var a=hW(t,i,s);a==null?o.removeAttribute("class"):o.className=a,o[Gy]=t}else if(s&&n!==s)for(var c in s){var d=!!s[c];(n==null||d!==!!n[c])&&o.classList.toggle(c,d)}return s}function Uw(o,e={},t,i){for(var n in t){var s=t[n];e[n]!==s&&(t[n]==null?o.style.removeProperty(n):o.style.setProperty(n,s,i))}}function Fo(o,e,t,i){var n=o[Zy];if(n!==e){var s=uW(e,i);s==null?o.removeAttribute("style"):o.style.cssText=s,o[Zy]=e}else i&&(Array.isArray(i)?(Uw(o,t==null?void 0:t[0],i[0]),Uw(o,t==null?void 0:t[1],i[1],"important")):Uw(o,t,i));return i}function nT(o,e,t=!1){if(o.multiple){if(e==null)return;if(!M0(e))return _H();for(var i of o.options)i.selected=e.includes(lf(i));return}for(i of o.options){var n=lf(i);if(VH(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(o.selectedIndex=-1)}function gW(o){var e=new MutationObserver(()=>{nT(o,o.__value)});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),W0(()=>{e.disconnect()})}function El(o,e,t=e){var i=new WeakSet,n=!0;F0(o,"change",s=>{var r=s?"[selected]":":checked",a;if(o.multiple)a=[].map.call(o.querySelectorAll(r),lf);else{var c=o.querySelector(r)??o.querySelector("option:not([disabled])");a=c&&lf(c)}t(a),o.__value=a,Jt!==null&&i.add(Jt)}),B0(()=>{var s=e();if(o===document.activeElement){var r=Jt;if(i.has(r))return}if(nT(o,s,n),n&&s===void 0){var a=o.querySelector(":checked");a!==null&&(s=lf(a),t(s))}o.__value=s,n=!1}),gW(o)}function lf(o){return"__value"in o?o.__value:o.value}const fW=Symbol("is custom element"),pW=Symbol("is html");function $w(o,e){var t=sT(o);t.checked!==(t.checked=e??void 0)&&(o.checked=e)}function Jn(o,e,t,i){var n=sT(o);n[e]!==(n[e]=t)&&(e==="loading"&&(o[qF]=t),t==null?o.removeAttribute(e):typeof t!="string"&&mW(o).includes(e)?o[e]=t:o.setAttribute(e,t))}function sT(o){return o[Vm]??(o[Vm]={[fW]:o.nodeName.includes("-"),[pW]:o.namespaceURI===mP})}var hI=new Map;function mW(o){var e=o.getAttribute("is")||o.nodeName,t=hI.get(e);if(t)return t;hI.set(e,t=[]);for(var i,n=o,s=Element.prototype;s!==n;){i=WF(n);for(var r in i)i[r].set&&r!=="innerHTML"&&r!=="textContent"&&r!=="innerText"&&t.push(r);n=hP(n)}return t}function Ki(o,e,t=e){var i=new WeakSet;F0(o,"input",async n=>{var s=n?o.defaultValue:o.value;if(s=qw(o)?Kw(s):s,t(s),Jt!==null&&i.add(Jt),await iS(),s!==(s=e())){var r=o.selectionStart,a=o.selectionEnd,c=o.value.length;if(o.value=s??"",a!==null){var d=o.value.length;r===a&&a===c&&d>c?(o.selectionStart=d,o.selectionEnd=d):(o.selectionStart=r,o.selectionEnd=Math.min(a,d))}}}),ll(e)==null&&o.value&&(t(qw(o)?Kw(o.value):o.value),Jt!==null&&i.add(Jt)),Zb(()=>{var n=e();if(o===document.activeElement){var s=Jt;if(i.has(s))return}qw(o)&&n===Kw(o.value)||o.type==="date"&&!n&&!o.value||n!==o.value&&(o.value=n??"")})}function eo(o,e,t=e){F0(o,"change",i=>{var n=i?o.defaultChecked:o.checked;t(n)}),ll(e)==null&&t(o.checked),Zb(()=>{var i=e();o.checked=!!i})}function qw(o){var e=o.type;return e==="number"||e==="range"}function Kw(o){return o===""?null:+o}var Ll,wu,mp,Rv,oT;const Av=class Av{constructor(e){bi(this,Rv);bi(this,Ll,new WeakMap);bi(this,wu);bi(this,mp);wi(this,mp,e)}observe(e,t){var i=J(this,Ll).get(e)||new Set;return i.add(t),J(this,Ll).set(e,i),un(this,Rv,oT).call(this).observe(e,J(this,mp)),()=>{var n=J(this,Ll).get(e);n.delete(t),n.size===0&&(J(this,Ll).delete(e),J(this,wu).unobserve(e))}}};Ll=new WeakMap,wu=new WeakMap,mp=new WeakMap,Rv=new WeakSet,oT=function(){return J(this,wu)??wi(this,wu,new ResizeObserver(e=>{for(var t of e){Av.entries.set(t.target,t);for(var i of J(this,Ll).get(t.target)||[])i(t)}}))},Mi(Av,"entries",new WeakMap);let rS=Av;var _W=new rS({box:"border-box"});function vW(o,e,t){var i=_W.observe(o,()=>t(o[e]));B0(()=>(ll(()=>t(o[e])),i))}function Gw(o,e){return o===e||(o==null?void 0:o[jc])===e}function Qs(o={},e,t,i){var n=Ts.r,s=Xi;return B0(()=>{var r,a;return Zb(()=>{r=a,a=[],ll(()=>{Gw(t(...a),o)||(e(o,...a),r&&Gw(t(...r),o)&&e(null,...r))})}),()=>{let c=s;for(;c!==n&&c.parent!==null&&c.parent.f&Ky;)c=c.parent;const d=()=>{a&&Gw(t(...a),o)&&e(null,...a)},u=c.teardown;c.teardown=()=>{d(),u==null||u()}}}),o}function qu(o,e,t,i){var B;var n=!0,s=(t&dH)!==0,r=(t&hH)!==0,a=i,c=!0,d=void 0,u=()=>r&&n?(d??(d=Rf(i)),g(d)):(c&&(c=!1,a=r?ll(i):i),a);let f;if(s){var m=jc in o||$F in o;f=((B=lu(o,e))==null?void 0:B.set)??(m&&e in o?F=>o[e]=F:void 0)}var v,_=!1;s?[v,_]=CH(()=>o[e]):v=o[e],v===void 0&&i!==void 0&&(v=u(),f&&(QF(),f(v)));var y;if(y=()=>{var F=o[e];return F===void 0?u():(c=!0,F)},(t&cH)===0)return y;if(f){var S=o.$$legacy;return(function(F,Q){return arguments.length>0?((!Q||S||_)&&f(Q?y():F),F):y()})}var D=!1,E=((t&lH)!==0?Rf:PP)(()=>(D=!1,y()));s&&g(E);var N=Xi;return(function(F,Q){if(arguments.length>0){const $=Q?g(E):s?Si(F):F;return k(E,$),D=!0,a!==void 0&&(a=$),F}return Ja&&D||(N.f&nr)!==0?E.v:g(E)})}function va(o){Ts===null&&fP(),kn(()=>{const e=ll(o);if(typeof e=="function")return e})}function Xb(o){Ts===null&&fP(),va(()=>()=>ll(o))}const bW="5";var RD;typeof window<"u"&&((RD=window.__svelte??(window.__svelte={})).v??(RD.v=new Set)).add(bW);/*!-----------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
6
|
-
* Released under the MIT license
|
|
7
|
-
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
8
|
-
*-----------------------------------------------------------------------------*/var wW=Object.defineProperty,yW=Object.getOwnPropertyDescriptor,SW=Object.getOwnPropertyNames,CW=Object.prototype.hasOwnProperty,xW=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of SW(e))!CW.call(o,n)&&n!==t&&wW(o,n,{get:()=>e[n],enumerable:!(i=yW(e,n))||i.enumerable});return o},LW=(o,e,t)=>(xW(o,e,"default"),t),Op={};LW(Op,OD);var IW=class{constructor(e,t,i){this._onDidChange=new Op.Emitter,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},kW={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},DW={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},rT=new IW("json",kW,DW),EW=()=>aT().then(o=>o.getWorker());Op.languages.json={jsonDefaults:rT,getWorker:EW};function aT(){return AD(()=>import("./jsonMode-CXWNuhmR.js"),__vite__mapDeps([0,1,2]))}Op.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});Op.languages.onLanguage("json",()=>{aT().then(o=>o.setupMode(rT))});/*!-----------------------------------------------------------------------------
|
|
9
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
-
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
11
|
-
* Released under the MIT license
|
|
12
|
-
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
13
|
-
*-----------------------------------------------------------------------------*/var PW=Object.defineProperty,TW=Object.getOwnPropertyDescriptor,MW=Object.getOwnPropertyNames,NW=Object.prototype.hasOwnProperty,RW=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of MW(e))!NW.call(o,n)&&n!==t&&PW(o,n,{get:()=>e[n],enumerable:!(i=TW(e,n))||i.enumerable});return o},AW=(o,e,t)=>(RW(o,e,"default"),t),OW="5.4.5",Ku={};AW(Ku,OD);var lT=(o=>(o[o.None=0]="None",o[o.CommonJS=1]="CommonJS",o[o.AMD=2]="AMD",o[o.UMD=3]="UMD",o[o.System=4]="System",o[o.ES2015=5]="ES2015",o[o.ESNext=99]="ESNext",o))(lT||{}),cT=(o=>(o[o.None=0]="None",o[o.Preserve=1]="Preserve",o[o.React=2]="React",o[o.ReactNative=3]="ReactNative",o[o.ReactJSX=4]="ReactJSX",o[o.ReactJSXDev=5]="ReactJSXDev",o))(cT||{}),dT=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(dT||{}),hT=(o=>(o[o.ES3=0]="ES3",o[o.ES5=1]="ES5",o[o.ES2015=2]="ES2015",o[o.ES2016=3]="ES2016",o[o.ES2017=4]="ES2017",o[o.ES2018=5]="ES2018",o[o.ES2019=6]="ES2019",o[o.ES2020=7]="ES2020",o[o.ESNext=99]="ESNext",o[o.JSON=100]="JSON",o[o.Latest=99]="Latest",o))(hT||{}),uT=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(uT||{}),gT=class{constructor(o,e,t,i,n){this._onDidChange=new Ku.Emitter,this._onDidExtraLibsChange=new Ku.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(o),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(n),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(o,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===o)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:o,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let n=this._extraLibs[t];n&&n.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(o){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),o&&o.length>0)for(const e of o){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let n=1;this._removedExtraLibs[t]&&(n=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:n}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(o){this._compilerOptions=o||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(o){this._diagnosticsOptions=o||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(o){this._workerOptions=o||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(o){this._inlayHintsOptions=o||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(o){}setEagerModelSync(o){this._eagerModelSync=o}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(o){this._modeConfiguration=o||Object.create(null),this._onDidChange.fire(void 0)}},FW=OW,fT={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},pT=new gT({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},fT),mT=new gT({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},fT),HW=()=>Yb().then(o=>o.getTypeScriptWorker()),WW=()=>Yb().then(o=>o.getJavaScriptWorker());Ku.languages.typescript={ModuleKind:lT,JsxEmit:cT,NewLineKind:dT,ScriptTarget:hT,ModuleResolutionKind:uT,typescriptVersion:FW,typescriptDefaults:pT,javascriptDefaults:mT,getTypeScriptWorker:HW,getJavaScriptWorker:WW};function Yb(){return AD(()=>import("./tsMode-CFaMfW0s.js"),__vite__mapDeps([3,1,2]))}Ku.languages.onLanguage("typescript",()=>Yb().then(o=>o.setupTypeScript(pT)));Ku.languages.onLanguage("javascript",()=>Yb().then(o=>o.setupJavaScript(mT)));class BW extends Vs{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:ht("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Ot.map,toggled:le.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:le.has("isInDiffEditor"),menu:{when:le.has("isInDiffEditor"),id:Ye.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(pn),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class _T extends Vs{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:ht("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:le.has("isInDiffEditor")})}run(e,...t){const i=e.get(pn),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class vT extends Vs{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:ht("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:le.has("isInDiffEditor")})}run(e,...t){const i=e.get(pn),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const Fp=ht("diffEditor","Diff Editor");class zW extends Pr{constructor(){super({id:"diffEditor.switchSide",title:ht("switchSide","Switch Side"),icon:Ot.arrowSwap,precondition:le.has("isInDiffEditor"),f1:!0,category:Fp})}runEditorCommand(e,t,i){const n=pg(e);if(n instanceof _p){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class VW extends Pr{constructor(){super({id:"diffEditor.exitCompareMove",title:ht("exitCompareMove","Exit Compare Move"),icon:Ot.close,precondition:M.comparingMovedCode,f1:!1,category:Fp,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=pg(e);n instanceof _p&&n.exitCompareMove()}}class jW extends Pr{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:ht("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Ot.fold,precondition:le.has("isInDiffEditor"),f1:!0,category:Fp})}runEditorCommand(e,t,...i){const n=pg(e);n instanceof _p&&n.collapseAllUnchangedRegions()}}class UW extends Pr{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:ht("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Ot.unfold,precondition:le.has("isInDiffEditor"),f1:!0,category:Fp})}runEditorCommand(e,t,...i){const n=pg(e);n instanceof _p&&n.showAllUnchangedRegions()}}class aS extends Vs{constructor(){super({id:"diffEditor.revert",title:ht("revert","Revert"),f1:!1,category:Fp})}run(e,t){const i=$W(e,t.originalUri,t.modifiedUri);i instanceof _p&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const bT=ht("accessibleDiffViewer","Accessible Diff Viewer"),Ov=class Ov extends Vs{constructor(){super({id:Ov.id,title:ht("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:bT,precondition:le.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=pg(e);t==null||t.accessibleDiffViewerNext()}};Ov.id="editor.action.accessibleDiffViewer.next";let Of=Ov;const Fv=class Fv extends Vs{constructor(){super({id:Fv.id,title:ht("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:bT,precondition:le.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=pg(e);t==null||t.accessibleDiffViewerPrev()}};Fv.id="editor.action.accessibleDiffViewer.prev";let L_=Fv;function $W(o,e,t){return o.get(Un).listDiffEditors().find(s=>{var c,d;const r=s.getModifiedEditor(),a=s.getOriginalEditor();return r&&((c=r.getModel())==null?void 0:c.uri.toString())===t.toString()&&a&&((d=a.getModel())==null?void 0:d.uri.toString())===e.toString()})||null}function pg(o){const t=o.get(Un).listDiffEditors(),i=FD();if(i)for(const n of t){const s=n.getContainerDomNode();if(qW(s,i))return n}return null}function qW(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}Yi(BW);Yi(_T);Yi(vT);sr.appendMenuItem(Ye.EditorTitle,{command:{id:new vT().desc.id,title:w("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:le.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:le.has("isInDiffEditor")},order:11,group:"1_diff",when:le.and(M.diffEditorRenderSideBySideInlineBreakpointReached,le.has("isInDiffEditor"))});sr.appendMenuItem(Ye.EditorTitle,{command:{id:new _T().desc.id,title:w("showMoves","Show Moved Code Blocks"),icon:Ot.move,toggled:sA.create("config.diffEditor.experimental.showMoves",!0),precondition:le.has("isInDiffEditor")},order:10,group:"1_diff",when:le.has("isInDiffEditor")});Yi(aS);for(const o of[{icon:Ot.arrowRight,key:M.diffEditorInlineMode.toNegated()},{icon:Ot.discard,key:M.diffEditorInlineMode}])sr.appendMenuItem(Ye.DiffEditorHunkToolbar,{command:{id:new aS().desc.id,title:w("revertHunk","Revert Block"),icon:o.icon},when:le.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),sr.appendMenuItem(Ye.DiffEditorSelectionToolbar,{command:{id:new aS().desc.id,title:w("revertSelection","Revert Selection"),icon:o.icon},when:le.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"});Yi(zW);Yi(VW);Yi(jW);Yi(UW);sr.appendMenuItem(Ye.EditorTitle,{command:{id:Of.id,title:w("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:le.has("isInDiffEditor")},order:10,group:"2_diff",when:le.and(M.accessibleDiffViewerVisible.negate(),le.has("isInDiffEditor"))});dn.registerCommandAlias("editor.action.diffReview.next",Of.id);Yi(Of);dn.registerCommandAlias("editor.action.diffReview.prev",L_.id);Yi(L_);var KW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},GW=function(o,e){return function(t,i){e(t,i,o)}},lS;const Jb=new yi("selectionAnchorSet",!1);var Yc;let oc=(Yc=class{static get(e){return e.getContribution(lS.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=Jb.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(Mt.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new Is().appendText(w("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),or(w("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(Mt.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}},lS=Yc,Yc.ID="editor.contrib.selectionAnchorController",Yc);oc=lS=KW([GW(1,Ri)],oc);class ZW extends Se{constructor(){super({id:"editor.action.setSelectionAnchor",label:w("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2080),weight:100}})}async run(e,t){var i;(i=oc.get(t))==null||i.setSelectionAnchor()}}class XW extends Se{constructor(){super({id:"editor.action.goToSelectionAnchor",label:w("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:Jb})}async run(e,t){var i;(i=oc.get(t))==null||i.goToSelectionAnchor()}}class YW extends Se{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:w("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:Jb,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2089),weight:100}})}async run(e,t){var i;(i=oc.get(t))==null||i.selectFromAnchorToCursor()}}class JW extends Se{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:w("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:Jb,kbOpts:{kbExpr:M.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=oc.get(t))==null||i.cancelSelectionAnchor()}}oi(oc.ID,oc,4);ie(ZW);ie(XW);ie(YW);ie(JW);const QW=at("editorOverviewRuler.bracketMatchForeground","#A0A0A0",w("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class e3 extends Se{constructor(){super({id:"editor.action.jumpToBracket",label:w("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=jd.get(t))==null||i.jumpToBracket()}}class t3 extends Se{constructor(){super({id:"editor.action.selectToBracket",label:w("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:ht("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){var s;let n=!0;i&&i.selectBrackets===!1&&(n=!1),(s=jd.get(t))==null||s.selectToBracket(n)}}class i3 extends Se{constructor(){super({id:"editor.action.removeBrackets",label:w("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=jd.get(t))==null||i.removeBrackets(this.id)}}class n3{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const vl=class vl extends Be{static get(e){return e.getContribution(vl.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new ts(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(72),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(72)&&(this._matchBrackets=this._editor.getOption(72),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),s=e.bracketPairs.matchBracket(n);let r=null;if(s)s[0].containsPosition(n)&&!s[1].containsPosition(n)?r=s[1].getStartPosition():s[1].containsPosition(n)&&(r=s[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)r=a[1].getStartPosition();else{const c=e.bracketPairs.findNextBracket(n);c&&c.range&&(r=c.range.getStartPosition())}}return r?new Mt(r.lineNumber,r.column,r.lineNumber,r.column):new Mt(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const s=n.getStartPosition();let r=t.bracketPairs.matchBracket(s);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(s),!r)){const d=t.bracketPairs.findNextBracket(s);d&&d.range&&(r=t.bracketPairs.matchBracket(d.range.getStartPosition()))}let a=null,c=null;if(r){r.sort(H.compareRangesUsingStarts);const[d,u]=r;if(a=e?d.getStartPosition():d.getEndPosition(),c=e?u.getEndPosition():u.getStartPosition(),u.containsPosition(s)){const f=a;a=c,c=f}}a&&c&&i.push(new Mt(a.lineNumber,a.column,c.lineNumber,c.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const n=i.getPosition();let s=t.bracketPairs.matchBracket(n);s||(s=t.bracketPairs.findEnclosingBrackets(n)),s&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:s[0],text:""},{range:s[1],text:""}]),this._editor.pushUndoStop())})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);const s=[];let r=0;for(let f=0,m=e.length;f<m;f++){const v=e[f];v.isEmpty()&&(s[r++]=v.getStartPosition())}s.length>1&&s.sort(ut.compare);const a=[];let c=0,d=0;const u=n.length;for(let f=0,m=s.length;f<m;f++){const v=s[f];for(;d<u&&n[d].position.isBefore(v);)d++;if(d<u&&n[d].position.equals(v))a[c++]=n[d];else{let _=t.bracketPairs.matchBracket(v,20),y=vl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!_&&this._matchBrackets==="always"&&(_=t.bracketPairs.findEnclosingBrackets(v,20),y=vl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[c++]=new n3(v,_,y)}}this._lastBracketsData=a,this._lastVersionId=i}};vl.ID="editor.contrib.bracketMatchingController",vl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=pi.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Yn(QW),position:aa.Center}}),vl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=pi.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let jd=vl;oi(jd.ID,jd,1);ie(t3);ie(e3);ie(i3);sr.appendMenuItem(Ye.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:w({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class s3{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const i=this._selection.startLineNumber,n=this._selection.startColumn,s=this._selection.endColumn;if(!(this._isMovingLeft&&n===1)&&!(!this._isMovingLeft&&s===e.getLineMaxColumn(i)))if(this._isMovingLeft){const r=new H(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new H(i,s,i,s),a)}else{const r=new H(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new H(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new Mt(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new Mt(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class wT extends Se{constructor(e,t){super(t),this.left=e}run(e,t){if(!t.hasModel())return;const i=[],n=t.getSelections();for(const s of n)i.push(new s3(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class o3 extends wT{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:w("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:M.writable})}}class r3 extends wT{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:w("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:M.writable})}}ie(o3);ie(r3);class a3 extends Se{constructor(){super({id:"editor.action.transposeLetters",label:w("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=[],s=t.getSelections();for(const r of s){if(!r.isEmpty())continue;const a=r.startLineNumber,c=r.startColumn,d=i.getLineMaxColumn(a);if(a===1&&(c===1||c===2&&d===2))continue;const u=c===d?r.getPosition():Nw.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),f=Nw.leftPosition(i,u),m=Nw.leftPosition(i,f),v=i.getValueInRange(H.fromPositions(m,f)),_=i.getValueInRange(H.fromPositions(f,u)),y=H.fromPositions(m,u);n.push(new vp(y,_+v))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}ie(a3);const Qb=(function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let o;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?o=crypto.getRandomValues.bind(crypto):o=function(i){for(let n=0;n<i.length;n++)i[n]=Math.floor(Math.random()*256);return i};const e=new Uint8Array(16),t=[];for(let i=0;i<256;i++)t.push(i.toString(16).padStart(2,"0"));return function(){o(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let n=0,s="";return s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s}})();function U0(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function l3(o,e,t){const i={id:Qb(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class yT{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return za.some(this,([i,n])=>n.asFile())&&t.push("files"),CT(I_(e),t)}get(e){var t;return(t=this._entries.get(this.toKey(e)))==null?void 0:t[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return I_(e)}}function I_(o){return o.toLowerCase()}function ST(o,e){return CT(I_(o),e.map(I_))}function CT(o,e){if(o==="*/*")return e.length>0;if(e.includes(o))return!0;const t=o.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,s]=t;return s==="*"?e.some(r=>r.startsWith(n+"/")):!1}const ew=Object.freeze({create:o=>HD(o.map(e=>e.toString())).join(`\r
|
|
14
|
-
`),split:o=>o.split(`\r
|
|
15
|
-
`),parse:o=>ew.split(o).filter(e=>!e.startsWith("#"))}),qr=class qr{constructor(e){this.value=e}equals(e){return this.value===e.value}contains(e){return this.equals(e)||this.value===""||e.value.startsWith(this.value+qr.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new qr((this.value?[this.value,...e]:e).join(qr.sep))}};qr.sep=".",qr.None=new qr("@@none@@"),qr.Empty=new qr("");let fn=qr;const uI={EDITORS:"CodeEditors",FILES:"CodeFiles"};class c3{}const d3={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Tr.add(d3.DragAndDropContribution,new c3);const bf=class bf{constructor(){}static getInstance(){return bf.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};bf.INSTANCE=new bf;let cS=bf;function xT(o){const e=new yT;for(const t of o.items){const i=t.type;if(t.kind==="string"){const n=new Promise(s=>t.getAsString(s));e.append(i,U0(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,h3(n))}}return e}function h3(o){const e=o.path?nn.parse(o.path):void 0;return l3(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const u3=Object.freeze([uI.EDITORS,uI.FILES,Ty.RESOURCES,Ty.INTERNAL_URI_LIST]);function LT(o,e=!1){const t=xT(o),i=t.get(Ty.INTERNAL_URI_LIST);if(i)t.replace(ps.uriList,i);else if(e||!t.has(ps.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(nn.file(a).toString()):n.push(nn.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(ps.uriList,U0(ew.create(n)))}for(const n of u3)t.delete(n);return t}var $0=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ff=function(o,e){return function(t,i){e(t,i,o)}};class q0{async provideDocumentPasteEdits(e,t,i,n,s){const r=await this.getEdit(i,s);if(r)return{edits:[{insertText:r.insertText,title:r.title,kind:r.kind,handledMimeType:r.handledMimeType,yieldTo:r.yieldTo}],dispose(){}}}async provideDocumentDropEdits(e,t,i,n){const s=await this.getEdit(i,n);if(s)return{edits:[{insertText:s.insertText,title:s.title,kind:s.kind,handledMimeType:s.handledMimeType,yieldTo:s.yieldTo}],dispose(){}}}}const wf=class wf extends q0{constructor(){super(...arguments),this.kind=wf.kind,this.dropMimeTypes=[ps.text],this.pasteMimeTypes=[ps.text]}async getEdit(e,t){const i=e.get(ps.text);if(!i||e.has(ps.uriList))return;const n=await i.asString();return{handledMimeType:ps.text,title:w("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};wf.id="text",wf.kind=new fn("text.plain");let Ud=wf;class IT extends q0{constructor(){super(...arguments),this.kind=new fn("uri.absolute"),this.dropMimeTypes=[ps.uriList],this.pasteMimeTypes=[ps.uriList]}async getEdit(e,t){const i=await kT(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:c})=>a.scheme===Fs.file?a.fsPath:(n++,c)).join(" ");let r;return n>0?r=i.length>1?w("defaultDropProvider.uriList.uris","Insert Uris"):w("defaultDropProvider.uriList.uri","Insert Uri"):r=i.length>1?w("defaultDropProvider.uriList.paths","Insert Paths"):w("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:ps.uriList,insertText:s,title:r,kind:this.kind}}}let k_=class extends q0{constructor(e){super(),this._workspaceContextService=e,this.kind=new fn("uri.relative"),this.dropMimeTypes=[ps.uriList],this.pasteMimeTypes=[ps.uriList]}async getEdit(e,t){const i=await kT(e);if(!i.length||t.isCancellationRequested)return;const n=Ka(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?oA(r.uri,s):void 0}));if(n.length)return{handledMimeType:ps.uriList,insertText:n.join(" "),title:i.length>1?w("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):w("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};k_=$0([Ff(0,Tu)],k_);class g3{constructor(){this.kind=new fn("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:ps.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var c;if(n.triggerKind!==My.PasteAs&&!((c=n.only)!=null&&c.contains(this.kind)))return;const r=i.get("text/html"),a=await(r==null?void 0:r.asString());if(!(!a||s.isCancellationRequested))return{dispose(){},edits:[{insertText:a,yieldTo:this._yieldTo,title:w("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function kT(o){const e=o.get(ps.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of ew.parse(t))try{i.push({uri:nn.parse(n),originalText:n})}catch{}return i}let dS=class extends Be{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new Ud)),this._register(e.documentDropEditProvider.register("*",new IT)),this._register(e.documentDropEditProvider.register("*",new k_(t)))}};dS=$0([Ff(0,gt),Ff(1,Tu)],dS);let hS=class extends Be{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new Ud)),this._register(e.documentPasteEditProvider.register("*",new IT)),this._register(e.documentPasteEditProvider.register("*",new k_(t))),this._register(e.documentPasteEditProvider.register("*",new g3))}};hS=$0([Ff(0,gt),Ff(1,Tu)],hS);const Vo=class Vo{constructor(){this.value="",this.pos=0}static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return e===95||e>=97&&e<=122||e>=65&&e<=90}text(e){this.value=e,this.pos=0}tokenText(e){return this.value.substr(e.pos,e.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const e=this.pos;let t=0,i=this.value.charCodeAt(e),n;if(n=Vo._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(Vo.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(Vo.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(Vo.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(Vo.isVariableCharacter(i)||Vo.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}n=10;do t+=1,i=this.value.charCodeAt(e+t);while(!isNaN(i)&&typeof Vo._table[i]>"u"&&!Vo.isDigitCharacter(i)&&!Vo.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};Vo._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let uS=Vo;class mg{constructor(){this._children=[]}appendChild(e){return e instanceof Js&&this._children[this._children.length-1]instanceof Js?this._children[this._children.length-1].value+=e.value:(e.parent=this,this._children.push(e)),this}replace(e,t){const{parent:i}=e,n=i.children.indexOf(e),s=i.children.slice(0);s.splice(n,1,...t),i._children=s,(function r(a,c){for(const d of a)d.parent=c,r(d.children,d)})(t,i)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof Hp)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let Js=class DT extends mg{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new DT(this.value)}};class ET extends mg{}class Oo extends ET{static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:e.index>t.index?1:0}constructor(e){super(),this.index=e}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof _g?this._children[0]:void 0}clone(){const e=new Oo(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class _g extends mg{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof Js&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new _g;return this.options.forEach(e.appendChild,e),e}}class K0 extends mg{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(e){const t=this;let i=!1,n=e.replace(this.regexp,function(){return i=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!i&&this._children.some(s=>s instanceof br&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof br){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new K0;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}}class br extends mg{constructor(e,t,i,n){super(),this.index=e,this.shorthandName=t,this.ifValue=i,this.elseValue=n}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toPascalCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map(i=>i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}_toCamelCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map((i,n)=>n===0?i.charAt(0).toLowerCase()+i.substr(1):i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}clone(){return new br(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class Hf extends ET{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new Js(t)],!0):!1}clone(){const e=new Hf(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function gI(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class Hp extends mg{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof Oo&&(e.push(i),t=!t||t.index<i.index?i:t),!0}),this._placeholders={all:e,last:t}}return this._placeholders}get placeholders(){const{all:e}=this.placeholderInfo;return e}offset(e){let t=0,i=!1;return this.walk(n=>n===e?(i=!0,!1):(t+=n.len(),!0)),i?t:-1}fullLen(e){let t=0;return gI([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof Oo&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof Hf&&t.resolve(e)&&(this._placeholders=void 0),!0)),this}appendChild(e){return this._placeholders=void 0,super.appendChild(e)}replace(e,t){return this._placeholders=void 0,super.replace(e,t)}clone(){const e=new Hp;return this._children=this.children.map(t=>t.clone()),e}walk(e){gI(this.children,e)}}class $d{constructor(){this._scanner=new uS,this._token={type:14,pos:0,len:0}}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(e){return/\${?CLIPBOARD/.test(e)}parse(e,t,i){const n=new Hp;return this.parseFragment(e,n),this.ensureFinalTabstop(n,i??!1,t??!1),n}parseFragment(e,t){const i=t.children.length;for(this._scanner.text(e),this._token=this._scanner.next();this._parse(t););const n=new Map,s=[];t.walk(c=>(c instanceof Oo&&(c.isFinalTabstop?n.set(0,void 0):!n.has(c.index)&&c.children.length>0?n.set(c.index,c.children):s.push(c)),!0));const r=(c,d)=>{const u=n.get(c.index);if(!u)return;const f=new Oo(c.index);f.transform=c.transform;for(const m of u){const v=m.clone();f.appendChild(v),v instanceof Oo&&n.has(v.index)&&!d.has(v.index)&&(d.add(v.index),r(v,d),d.delete(v.index))}t.replace(c,[f])},a=new Set;for(const c of s)r(c,a);return t.children.slice(i)}ensureFinalTabstop(e,t,i){(t||i&&e.placeholders.length>0)&&(e.placeholders.find(s=>s.index===0)||e.appendChild(new Oo(0)))}_accept(e,t){if(e===void 0||this._token.type===e){const i=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),i}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){const t=this._token;for(;this._token.type!==e;){if(this._token.type===14)return!1;if(this._token.type===5){const n=this._scanner.next();if(n.type!==0&&n.type!==4&&n.type!==5)return!1}this._token=this._scanner.next()}const i=this._scanner.value.substring(t.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),i}_parse(e){return this._parseEscaped(e)||this._parseTabstopOrVariableName(e)||this._parseComplexPlaceholder(e)||this._parseComplexVariable(e)||this._parseAnything(e)}_parseEscaped(e){let t;return(t=this._accept(5,!0))?(t=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||t,e.appendChild(new Js(t)),!0):!1}_parseTabstopOrVariableName(e){let t;const i=this._token;return this._accept(0)&&(t=this._accept(9,!0)||this._accept(8,!0))?(e.appendChild(/^\d+$/.test(t)?new Oo(Number(t)):new Hf(t)),!0):this._backTo(i)}_parseComplexPlaceholder(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(8,!0))))return this._backTo(i);const s=new Oo(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Js("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new _g;for(;;){if(this._parseChoiceElement(r)){if(this._accept(2))continue;if(this._accept(7)&&(s.appendChild(r),this._accept(4)))return e.appendChild(s),!0}return this._backTo(i),!1}}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseChoiceElement(e){const t=this._token,i=[];for(;!(this._token.type===2||this._token.type===7);){let n;if((n=this._accept(5,!0))?n=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||n:n=this._accept(void 0,!0),!n)return this._backTo(t),!1;i.push(n)}return i.length===0?(this._backTo(t),!1):(e.appendChild(new Js(i.join(""))),!0)}_parseComplexVariable(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(9,!0))))return this._backTo(i);const s=new Hf(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Js("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseTransform(e){const t=new K0;let i="",n="";for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(6,!0)||s,i+=s;continue}if(this._token.type!==14){i+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(5,!0)||this._accept(6,!0)||s,t.appendChild(new Js(s));continue}if(!(this._parseFormatString(t)||this._parseAnything(t)))return!1}for(;!this._accept(4);){if(this._token.type!==14){n+=this._accept(void 0,!0);continue}return!1}try{t.regexp=new RegExp(i,n)}catch{return!1}return e.transform=t,!0}_parseFormatString(e){const t=this._token;if(!this._accept(0))return!1;let i=!1;this._accept(3)&&(i=!0);const n=this._accept(8,!0);if(n)if(i){if(this._accept(4))return e.appendChild(new br(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new br(Number(n))),!0;else return this._backTo(t),!1;if(this._accept(6)){const s=this._accept(9,!0);return!s||!this._accept(4)?(this._backTo(t),!1):(e.appendChild(new br(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new br(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new br(Number(n),void 0,void 0,s)),!0}else if(this._accept(13)){const s=this._until(1);if(s){const r=this._until(4);if(r)return e.appendChild(new br(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new br(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new Js(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function PT(o,e,t){var i,n;return(typeof t.insertText=="string"?t.insertText==="":t.insertText.snippet==="")?{edits:((i=t.additionalEdit)==null?void 0:i.edits)??[]}:{edits:[...e.map(s=>new rA(o,{range:s,text:typeof t.insertText=="string"?$d.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function TT(o){function e(r,a){return"mimeType"in r?r.mimeType===a.handledMimeType:!!a.kind&&r.kind.contains(a.kind)}const t=new Map;for(const r of o)for(const a of r.yieldTo??[])for(const c of o)if(c!==r&&e(a,c)){let d=t.get(r);d||(d=[],t.set(r,d)),d.push(c)}if(!t.size)return Array.from(o);const i=new Set,n=[];function s(r){if(!r.length)return[];const a=r[0];if(n.includes(a))return console.warn("Yield to cycle detected",a),r;if(i.has(a))return s(r.slice(1));let c=[];const d=t.get(a);return d&&(n.push(a),c=s(d),n.pop()),i.add(a),[...c,a,...s(r.slice(1))]}return s(Array.from(o))}var f3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},p3=function(o,e){return function(t,i){e(t,i,o)}};const m3=pi.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:WD,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),Hv=class Hv extends Be{constructor(e,t,i,n,s){super(),this.typeId=e,this.editor=t,this.range=i,this.delegate=s,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(n),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=rt(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=rt("span.icon");this.domNode.append(t),t.classList.add(...Wi.asClassNameArray(Ot.loading),"codicon-modifier-spin");const i=()=>{const n=this.editor.getOption(67);this.domNode.style.height=`${n}px`,this.domNode.style.width=`${Math.ceil(.8*n)}px`};i(),this._register(this.editor.onDidChangeConfiguration(n=>{(n.hasChanged(52)||n.hasChanged(67))&&i()})),this._register(Ni(this.domNode,Cn.CLICK,n=>{this.delegate.cancel()}))}getId(){return Hv.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}};Hv.baseId="editor.widget.inlineProgressWidget";let gS=Hv,D_=class extends Be{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new So),this._currentWidget=this._register(new So),this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,i,n,s){const r=this._operationIdPool++;this._currentOperation=r,this.clear(),this._showPromise.value=Cf(()=>{const a=H.fromPositions(e);this._currentDecorations.set([{range:a,options:m3}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(gS,this.id,this._editor,a,t,n))},s??this._showDelay);try{return await i}finally{this._currentOperation===r&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};D_=f3([p3(2,qt)],D_);var _3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fI=function(o,e){return function(t,i){e(t,i,o)}},Gm,Wl;let io=(Wl=class{static get(e){return e.getContribution(Gm.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new So,this._messageListeners=new Oe,this._mouseOverMessage=!1,this._editor=e,this._visible=Gm.MESSAGE_VISIBLE.bindTo(t)}dispose(){var e;(e=this._message)==null||e.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){or(Fm(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=Fm(e)?aA(e,{actionHandler:{callback:n=>{this.closeMessage(),lA(this._openerService,n,Fm(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new pI(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(es.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&cA(FD(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(Ni(this._messageWidget.value.getDomNode(),Cn.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Ni(this._messageWidget.value.getDomNode(),Cn.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(n=>{n.target.position&&(i?i.containsPosition(n.target.position)||this.closeMessage():i=new H(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(pI.fadeOut(this._messageWidget.value))}},Gm=Wl,Wl.ID="editor.contrib.messageController",Wl.MESSAGE_VISIBLE=new yi("messageVisible",!1,w("messageVisible","Whether the editor is currently showing an inline message")),Wl);io=Gm=_3([fI(1,Ri),fI(2,Mr)],io);const v3=js.bindToContribution(io.get);bt(new v3({id:"leaveEditorMessage",precondition:io.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let pI=class{static fadeOut(e){const t=()=>{e.dispose(),clearTimeout(i),e.getDomNode().removeEventListener("animationend",t)},i=setTimeout(t,110);return e.getDomNode().addEventListener("animationend",t),e.getDomNode().classList.add("fadeOut"),{dispose:t}}constructor(e,{lineNumber:t,column:i},n){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:i},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const s=document.createElement("div");s.classList.add("anchor","top"),this._domNode.appendChild(s);const r=document.createElement("div");typeof n=="string"?(r.classList.add("message"),r.textContent=n):(n.classList.add("message"),r.appendChild(n)),this._domNode.appendChild(r);const a=document.createElement("div");a.classList.add("anchor","below"),this._domNode.appendChild(a),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",e===2)}};oi(io.ID,io,4);function Zw(o,e){return e&&(o.stack||o.stacktrace)?w("stackTrace.format","{0}: {1}",_I(o),mI(o.stack)||mI(o.stacktrace)):_I(o)}function mI(o){return Array.isArray(o)?o.join(`
|
|
16
|
-
`):o}function _I(o){return o.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${o.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof o.code=="string"&&typeof o.errno=="number"&&typeof o.syscall=="string"?w("nodeExceptionMessage","A system error occurred ({0})",o.message):o.message||w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function E_(o=null,e=!1){if(!o)return w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(o)){const t=Ka(o),i=E_(t[0],e);return t.length>1?w("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(BD(o))return o;if(o.detail){const t=o.detail;if(t.error)return Zw(t.error,e);if(t.exception)return Zw(t.exception,e)}return o.stack?Zw(o,e):o.message?o.message:w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var MT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},du=function(o,e){return function(t,i){e(t,i,o)}},fS,Jc;let pS=(Jc=class extends Be{constructor(e,t,i,n,s,r,a,c,d,u){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=s,this.edits=r,this.onSelectNewEdit=a,this._contextMenuService=c,this._keybindingService=u,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(d),this.visibleContext.set(!0),this._register(gn(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(gn((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(f=>{s.containsPosition(f.position)||this.dispose()})),this._register(es.runAndSubscribe(u.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){var t;const e=(t=this._keybindingService.lookupKeybinding(this.showCommand.id))==null?void 0:t.getLabel();this.button.element.title=this.showCommand.label+(e?` (${e})`:"")}create(){this.domNode=rt(".post-edit-widget"),this.button=this._register(new dA(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Ni(this.domNode,Cn.CLICK,()=>this.showSelector()))}getId(){return fS.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=Ws(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>hA({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},fS=Jc,Jc.baseId="editor.widget.postEditWidget",Jc);pS=fS=MT([du(7,lg),du(8,Ri),du(9,Zn)],pS);let P_=class extends Be{constructor(e,t,i,n,s,r,a){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=n,this._instantiationService=s,this._bulkEditService=r,this._notificationService=a,this._currentWidget=this._register(new So),this._register(es.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,n,s){const r=this._editor.getModel();if(!r||!e.length)return;const a=t.allEdits.at(t.activeEditIndex);if(!a)return;const c=async S=>{const D=this._editor.getModel();D&&(await D.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:S,allEdits:t.allEdits},i,n,s))},d=(S,D)=>{dc(S)||(this._notificationService.error(D),i&&this.show(e[0],t,c))};let u;try{u=await n(a,s)}catch(S){return d(S,w("resolveError",`Error resolving edit '{0}':
|
|
17
|
-
{1}`,a.title,E_(S)))}if(s.isCancellationRequested)return;const f=PT(r.uri,e,u),m=e[0],v=r.deltaDecorations([],[{range:m,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let _,y;try{_=await this._bulkEditService.apply(f,{editor:this._editor,token:s}),y=r.getDecorationRange(v[0])}catch(S){return d(S,w("applyError",`Error applying edit '{0}':
|
|
18
|
-
{1}`,a.title,E_(S)))}finally{r.deltaDecorations(v,[])}s.isCancellationRequested||i&&_.isApplied&&t.allEdits.length>1&&this.show(y??m,t,c)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(pS,this._id,this._editor,this._visibleContext,this._showCommand,e,t,i))}clear(){this._currentWidget.clear()}tryShowSelector(){var e;(e=this._currentWidget.value)==null||e.showSelector()}};P_=MT([du(4,qt),du(5,xb),du(6,Rs)],P_);var b3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xh=function(o,e){return function(t,i){e(t,i,o)}},Cc;const NT="editor.changePasteType",G0=new yi("pasteWidgetVisible",!1,w("pasteWidgetVisible","Whether the paste widget is showing")),Xw="application/vnd.code.copyMetadata";var Qc;let Qa=(Qc=class extends Be{static get(e){return e.getContribution(Cc.ID)}constructor(e,t,i,n,s,r,a){super(),this._bulkEditService=i,this._clipboardService=n,this._languageFeaturesService=s,this._quickInputService=r,this._progressService=a,this._editor=e;const c=e.getContainerDomNode();this._register(Ni(c,"copy",d=>this.handleCopy(d))),this._register(Ni(c,"cut",d=>this.handleCopy(d))),this._register(Ni(c,"paste",d=>this.handlePaste(d),!0)),this._pasteProgressManager=this._register(new D_("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(P_,"pasteIntoEditor",e,G0,{id:NT,label:w("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},n0().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(85).enabled}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){var y,S,D,E;if(!this._editor.hasTextFocus()||((S=(y=this._clipboardService).clearInternalState)==null||S.call(y),!e.clipboardData||!this.isPasteAsEnabled()))return;const t=this._editor.getModel(),i=this._editor.getSelections();if(!t||!(i!=null&&i.length))return;const n=this._editor.getOption(37);let s=i;const r=i.length===1&&i[0].isEmpty();if(r){if(!n)return;s=[new H(s[0].startLineNumber,1,s[0].startLineNumber,1+t.getLineLength(s[0].startLineNumber))]}const a=(D=this._editor._getViewModel())==null?void 0:D.getPlainTextToCopy(i,n,Lb),d={multicursorText:Array.isArray(a)?a:null,pasteOnNewLine:r,mode:null},u=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(N=>!!N.prepareDocumentPaste);if(!u.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:d});return}const f=xT(e.clipboardData),m=u.flatMap(N=>N.copyMimeTypes??[]),v=Qb();this.setCopyMetadata(e.clipboardData,{id:v,providerCopyMimeTypes:m,defaultPastePayload:d});const _=us(async N=>{const B=Ka(await Promise.all(u.map(async F=>{try{return await F.prepareDocumentPaste(t,s,f,N)}catch(Q){console.error(Q);return}})));B.reverse();for(const F of B)for(const[Q,$]of F)f.replace(Q,$);return f});(E=Cc._currentCopyOperation)==null||E.dataTransferPromise.cancel(),Cc._currentCopyOperation={handle:v,dataTransferPromise:_}}async handlePaste(e){var c,d,u;if(!e.clipboardData||!this._editor.hasTextFocus())return;(c=io.get(this._editor))==null||c.closeMessage(),(d=this._currentPasteOperation)==null||d.cancel(),this._currentPasteOperation=void 0;const t=this._editor.getModel(),i=this._editor.getSelections();if(!(i!=null&&i.length)||!t||this._editor.getOption(92)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;const n=this.fetchCopyMetadata(e),s=LT(e.clipboardData);s.delete(Xw);const r=[...e.clipboardData.types,...(n==null?void 0:n.providerCopyMimeTypes)??[],ps.uriList],a=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(f=>{var v,_;const m=(v=this._pasteAsActionContext)==null?void 0:v.preferred;return m&&f.providedPasteEditKinds&&!this.providerMatchesPreference(f,m)?!1:(_=f.pasteMimeTypes)==null?void 0:_.some(y=>ST(y,r))});if(!a.length){(u=this._pasteAsActionContext)!=null&&u.preferred&&this.showPasteAsNoEditMessage(i,this._pasteAsActionContext.preferred);return}e.preventDefault(),e.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,a,i,s,n):this.doPasteInline(a,i,s,n,e)}showPasteAsNoEditMessage(e,t){var i;(i=io.get(this._editor))==null||i.showMessage(w("pasteAsError","No paste edits for '{0}' found",t instanceof fn?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,n,s){const r=this._editor;if(!r.hasModel())return;const a=new Mu(r,3,void 0),c=us(async d=>{const u=this._editor;if(!u.hasModel())return;const f=u.getModel(),m=new Oe,v=m.add(new gs(d));m.add(a.token.onCancellationRequested(()=>v.cancel()));const _=v.token;try{if(await this.mergeInDataFromCopy(i,n,_),_.isCancellationRequested)return;const y=e.filter(E=>this.isSupportedPasteProvider(E,i));if(!y.length||y.length===1&&y[0]instanceof Ud)return this.applyDefaultPasteHandler(i,n,_,s);const S={triggerKind:My.Automatic},D=await this.getPasteEdits(y,i,f,t,S,_);if(m.add(D),_.isCancellationRequested)return;if(D.edits.length===1&&D.edits[0].provider instanceof Ud)return this.applyDefaultPasteHandler(i,n,_,s);if(D.edits.length){const E=u.getOption(85).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:D.edits},E,(N,B)=>new Promise((F,Q)=>{(async()=>{var $,fe;try{const Pe=(fe=($=N.provider).resolveDocumentPasteEdit)==null?void 0:fe.call($,N,B),ze=new Ib,me=Pe&&await this._pasteProgressManager.showWhile(t[0].getEndPosition(),w("resolveProcess","Resolving paste edit. Click to cancel"),Promise.race([ze.p,Pe]),{cancel:()=>(ze.cancel(),Q(new kb))},0);return me&&(N.additionalEdit=me.additionalEdit),F(N)}catch(Pe){return Q(Pe)}})()}),_)}await this.applyDefaultPasteHandler(i,n,_,s)}finally{m.dispose(),this._currentPasteOperation===c&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),w("pasteIntoEditorProgress","Running paste handlers. Click to cancel and do basic paste"),c,{cancel:async()=>{try{if(c.cancel(),a.token.isCancellationRequested)return;await this.applyDefaultPasteHandler(i,n,a.token,s)}finally{a.dispose()}}}).then(()=>{a.dispose()}),this._currentPasteOperation=c}showPasteAsPick(e,t,i,n,s){const r=us(async a=>{const c=this._editor;if(!c.hasModel())return;const d=c.getModel(),u=new Oe,f=u.add(new Mu(c,3,void 0,a));try{if(await this.mergeInDataFromCopy(n,s,f.token),f.token.isCancellationRequested)return;let m=t.filter(D=>this.isSupportedPasteProvider(D,n,e));e&&(m=m.filter(D=>this.providerMatchesPreference(D,e)));const v={triggerKind:My.PasteAs,only:e&&e instanceof fn?e:void 0};let _=u.add(await this.getPasteEdits(m,n,d,i,v,f.token));if(f.token.isCancellationRequested)return;if(e&&(_={edits:_.edits.filter(D=>e instanceof fn?e.contains(D.kind):e.providerId===D.provider.id),dispose:_.dispose}),!_.edits.length){v.only&&this.showPasteAsNoEditMessage(i,v.only);return}let y;if(e)y=_.edits.at(0);else{const D=await this._quickInputService.pick(_.edits.map(E=>{var N;return{label:E.title,description:(N=E.kind)==null?void 0:N.value,edit:E}}),{placeHolder:w("pasteAsPickerPlaceholder","Select Paste Action")});y=D==null?void 0:D.edit}if(!y)return;const S=PT(d.uri,i,y);await this._bulkEditService.apply(S,{editor:this._editor})}finally{u.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:w("pasteAsProgress","Running paste handlers")},()=>r)}setCopyMetadata(e,t){e.setData(Xw,JSON.stringify(t))}fetchCopyMetadata(e){if(!e.clipboardData)return;const t=e.clipboardData.getData(Xw);if(t)try{return JSON.parse(t)}catch{return}const[i,n]=uA.getTextData(e.clipboardData);if(n)return{defaultPastePayload:{mode:n.mode,multicursorText:n.multicursorText??null,pasteOnNewLine:!!n.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,i){var n;if(t!=null&&t.id&&((n=Cc._currentCopyOperation)==null?void 0:n.handle)===t.id){const s=await Cc._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[r,a]of s)e.replace(r,a)}if(!e.has(ps.uriList)){const s=await this._clipboardService.readResources();if(i.isCancellationRequested)return;s.length&&e.append(ps.uriList,U0(ew.create(s)))}}async getPasteEdits(e,t,i,n,s,r){const a=new Oe,c=await bp(Promise.all(e.map(async u=>{var f,m;try{const v=await((f=u.provideDocumentPasteEdits)==null?void 0:f.call(u,i,n,t,s,r));return v&&a.add(v),(m=v==null?void 0:v.edits)==null?void 0:m.map(_=>({..._,provider:u}))}catch(v){dc(v)||console.error(v);return}})),r),d=Ka(c??[]).flat().filter(u=>!s.only||s.only.contains(u.kind));return{edits:TT(d),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,n){const s=e.get(ps.text)??e.get("text"),r=await(s==null?void 0:s.asString())??"";if(i.isCancellationRequested)return;const a={clipboardEvent:n,text:r,pasteOnNewLine:(t==null?void 0:t.defaultPastePayload.pasteOnNewLine)??!1,multicursorText:(t==null?void 0:t.defaultPastePayload.multicursorText)??null,mode:null};this._editor.trigger("keyboard","paste",a)}isSupportedPasteProvider(e,t,i){var n;return(n=e.pasteMimeTypes)!=null&&n.some(s=>t.matches(s))?!i||this.providerMatchesPreference(e,i):!1}providerMatchesPreference(e,t){return t instanceof fn?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}},Cc=Qc,Qc.ID="editor.contrib.copyPasteActionController",Qc);Qa=Cc=b3([xh(1,qt),xh(2,xb),xh(3,cg),xh(4,gt),xh(5,nl),xh(6,gA)],Qa);const qd="9_cutcopypaste",w3=dg||document.queryCommandSupported("cut"),RT=dg||document.queryCommandSupported("copy"),y3=typeof navigator.clipboard>"u"||fA?document.queryCommandSupported("paste"):!0;function Z0(o){return o.register(),o}const S3=w3?Z0(new s0({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:dg?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:Ye.MenubarEditMenu,group:"2_ccp",title:w({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:Ye.EditorContext,group:qd,title:w("actions.clipboard.cutLabel","Cut"),when:M.writable,order:1},{menuId:Ye.CommandPalette,group:"",title:w("actions.clipboard.cutLabel","Cut"),order:1},{menuId:Ye.SimpleEditorContext,group:qd,title:w("actions.clipboard.cutLabel","Cut"),when:M.writable,order:1}]})):void 0,C3=RT?Z0(new s0({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:dg?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:Ye.MenubarEditMenu,group:"2_ccp",title:w({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:Ye.EditorContext,group:qd,title:w("actions.clipboard.copyLabel","Copy"),order:2},{menuId:Ye.CommandPalette,group:"",title:w("actions.clipboard.copyLabel","Copy"),order:1},{menuId:Ye.SimpleEditorContext,group:qd,title:w("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;sr.appendMenuItem(Ye.MenubarEditMenu,{submenu:Ye.MenubarCopy,title:ht("copy as","Copy As"),group:"2_ccp",order:3});sr.appendMenuItem(Ye.EditorContext,{submenu:Ye.EditorContextCopy,title:ht("copy as","Copy As"),group:qd,order:3});sr.appendMenuItem(Ye.EditorContext,{submenu:Ye.EditorContextShare,title:ht("share","Share"),group:"11_share",order:-1,when:le.and(le.notEquals("resourceScheme","output"),M.editorTextFocus)});sr.appendMenuItem(Ye.ExplorerContext,{submenu:Ye.ExplorerContextShare,title:ht("share","Share"),group:"11_share",order:-1});const Yw=y3?Z0(new s0({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:dg?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:Ye.MenubarEditMenu,group:"2_ccp",title:w({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:Ye.EditorContext,group:qd,title:w("actions.clipboard.pasteLabel","Paste"),when:M.writable,order:4},{menuId:Ye.CommandPalette,group:"",title:w("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:Ye.SimpleEditorContext,group:qd,title:w("actions.clipboard.pasteLabel","Paste"),when:M.writable,order:4}]})):void 0;class x3 extends Se{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:w("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(yL.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),yL.forceCopyWithSyntaxHighlighting=!1)}}function AT(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(Un).getFocusedCodeEditor();if(n&&n.hasTextFocus()){const s=n.getOption(37),r=n.getSelection();return r&&r.isEmpty()&&!s||n.getContainerDomNode().ownerDocument.execCommand(e),!0}return!1}),o.addImplementation(0,"generic-dom",(t,i)=>(n0().execCommand(e),!0)))}AT(S3,"cut");AT(C3,"copy");Yw&&(Yw.addImplementation(1e4,"code-editor",(o,e)=>{var s;const t=o.get(Un),i=o.get(cg),n=t.getFocusedCodeEditor();return n&&n.hasTextFocus()?n.getContainerDomNode().ownerDocument.execCommand("paste")?((s=Qa.get(n))==null?void 0:s.finishedPaste())??Promise.resolve():pA?(async()=>{const a=await i.readText();if(a!==""){const c=mA.INSTANCE.get(a);let d=!1,u=null,f=null;c&&(d=n.getOption(37)&&!!c.isFromEmptySelection,u=typeof c.multicursorText<"u"?c.multicursorText:null,f=c.mode),n.trigger("keyboard","paste",{text:a,pasteOnNewLine:d,multicursorText:u,mode:f})}})():!0:!1}),Yw.addImplementation(0,"generic-dom",(o,e)=>(n0().execCommand("paste"),!0)));RT&&ie(x3);const ln=new class{constructor(){this.QuickFix=new fn("quickfix"),this.Refactor=new fn("refactor"),this.RefactorExtract=this.Refactor.append("extract"),this.RefactorInline=this.Refactor.append("inline"),this.RefactorMove=this.Refactor.append("move"),this.RefactorRewrite=this.Refactor.append("rewrite"),this.Notebook=new fn("notebook"),this.Source=new fn("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var ro;(function(o){o.Refactor="refactor",o.RefactorPreview="refactor preview",o.Lightbulb="lightbulb",o.Default="other (default)",o.SourceAction="source action",o.QuickFix="quick fix action",o.FixAll="fix all",o.OrganizeImports="organize imports",o.AutoFix="auto fix",o.QuickFixHover="quick fix hover window",o.OnSave="save participants",o.ProblemsView="problems view"})(ro||(ro={}));function L3(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>OT(e,t,o.include))||!o.includeSourceActions&&ln.Source.contains(e))}function I3(o,e){const t=e.kind?new fn(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>OT(t,i,o.include))||!o.includeSourceActions&&t&&ln.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function OT(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class ta{static fromUser(e,t){return!e||typeof e!="object"?new ta(t.kind,t.apply,!1):new ta(ta.getKindFromUser(e,t.kind),ta.getApplyFromUser(e,t.apply),ta.getPreferredUser(e))}static getApplyFromUser(e,t){switch(typeof e.apply=="string"?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return typeof e.kind=="string"?new fn(e.kind):t}static getPreferredUser(e){return typeof e.preferred=="boolean"?e.preferred:!1}constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}}class k3{constructor(e,t,i){this.action=e,this.provider=t,this.highlightRange=i}async resolve(e){var t;if((t=this.provider)!=null&&t.resolveCodeAction&&!this.action.edit){let i;try{i=await this.provider.resolveCodeAction(this.action,e)}catch(n){jn(n)}i&&(this.action.edit=i.edit)}return this}}const FT="editor.action.codeAction",X0="editor.action.quickFix",HT="editor.action.autoFix",WT="editor.action.refactor",BT="editor.action.sourceAction",mS="editor.action.organizeImports",_S="editor.action.fixAll";class cf extends Be{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:bo(e.diagnostics)?bo(t.diagnostics)?cf.codeActionsPreferredComparator(e,t):-1:bo(t.diagnostics)?1:cf.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(cf.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&ln.QuickFix.contains(new fn(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}}const vI={actions:[],documentation:void 0};async function Zh(o,e,t,i,n,s){var y;const r=i.filter||{},a={...r,excludes:[...r.excludes||[],ln.Notebook]},c={only:(y=r.include)==null?void 0:y.value,trigger:i.type},d=new _A(e,s),u=i.type===2,f=D3(o,e,u?a:r),m=new Oe,v=f.map(async S=>{try{n.report(S);const D=await S.provideCodeActions(e,t,c,d.token);if(D&&m.add(D),d.token.isCancellationRequested)return vI;const E=((D==null?void 0:D.actions)||[]).filter(B=>B&&I3(r,B)),N=P3(S,E,r.include);return{actions:E.map(B=>new k3(B,S)),documentation:N}}catch(D){if(dc(D))throw D;return jn(D),vI}}),_=o.onDidChange(()=>{const S=o.all(e);ua(S,f)||d.cancel()});try{const S=await Promise.all(v),D=S.map(N=>N.actions).flat(),E=[...Ka(S.map(N=>N.documentation)),...E3(o,e,i,D)];return new cf(D,E,m)}finally{_.dispose(),d.dispose()}}function D3(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>L3(t,new fn(n))):!0)}function*E3(o,e,t,i){var n,s,r;if(e&&i.length)for(const a of o.all(e))a._getAdditionalMenuItems&&(yield*(r=a._getAdditionalMenuItems)==null?void 0:r.call(a,{trigger:t.type,only:(s=(n=t.filter)==null?void 0:n.include)==null?void 0:s.value},i.map(c=>c.action)))}function P3(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new fn(n.kind),command:n.command}));if(t){let n;for(const s of i)s.kind.contains(t)&&(n?n.kind.contains(s.kind)&&(n=s):n=s);if(n)return n==null?void 0:n.command}for(const n of e)if(n.kind){for(const s of i)if(s.kind.contains(new fn(n.kind)))return s.command}}var Rc;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions",o.FromAILightbulb="fromAILightbulb"})(Rc||(Rc={}));async function T3(o,e,t,i,n=ii.None){var d;const s=o.get(xb),r=o.get(ls),a=o.get(Nr),c=o.get(Rs);if(a.publicLog2("codeAction.applyCodeAction",{codeActionTitle:e.action.title,codeActionKind:e.action.kind,codeActionIsPreferred:!!e.action.isPreferred,reason:t}),await e.resolve(n),!n.isCancellationRequested&&!((d=e.action.edit)!=null&&d.edits.length&&!(await s.apply(e.action.edit,{editor:i==null?void 0:i.editor,label:e.action.title,quotableLabel:e.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:t!==Rc.OnSave,showPreview:i==null?void 0:i.preview})).isApplied)&&e.action.command)try{await r.executeCommand(e.action.command.id,...e.action.command.arguments||[])}catch(u){const f=M3(u);c.error(typeof f=="string"?f:w("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function M3(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}dn.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof nn))throw Va();const{codeActionProvider:s}=o.get(gt),r=o.get(As).getModel(e);if(!r)throw Va();const a=Mt.isISelection(t)?Mt.liftSelection(t):H.isIRange(t)?r.validateRange(t):void 0;if(!a)throw Va();const c=typeof i=="string"?new fn(i):void 0,d=await Zh(s,r,a,{type:1,triggerAction:ro.Default,filter:{includeSourceActions:!0,include:c}},Fa.None,ii.None),u=[],f=Math.min(d.validActions.length,typeof n=="number"?n:0);for(let m=0;m<f;m++)u.push(d.validActions[m].resolve(ii.None));try{return await Promise.all(u),d.validActions.map(m=>m.action)}finally{setTimeout(()=>d.dispose(),100)}});var N3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},R3=function(o,e){return function(t,i){e(t,i,o)}},vS,ed;let bS=(ed=class{constructor(e){this.keybindingService=e}getResolver(){const e=new o0(()=>this.keybindingService.getKeybindings().filter(t=>vS.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===mS?i={kind:ln.SourceOrganizeImports.value}:t.command===_S&&(i={kind:ln.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...ta.fromUser(i,{kind:fn.None,apply:"never"})}}));return t=>{if(t.kind){const i=this.bestKeybindingForCodeAction(t,e.value);return i==null?void 0:i.resolvedKeybinding}}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new fn(e.kind);return t.filter(n=>n.kind.contains(i)).filter(n=>n.preferred?e.isPreferred:!0).reduceRight((n,s)=>n?n.kind.contains(s.kind)?s:n:s,void 0)}},vS=ed,ed.codeActionCommands=[WT,FT,BT,mS,_S],ed);bS=vS=N3([R3(0,Zn)],bS);at("symbolIcon.arrayForeground",is,w("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.booleanForeground",is,w("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.colorForeground",is,w("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.constantForeground",is,w("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.fileForeground",is,w("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.folderForeground",is,w("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.keyForeground",is,w("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.keywordForeground",is,w("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.moduleForeground",is,w("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.namespaceForeground",is,w("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.nullForeground",is,w("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.numberForeground",is,w("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.objectForeground",is,w("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.operatorForeground",is,w("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.packageForeground",is,w("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.propertyForeground",is,w("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.referenceForeground",is,w("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.snippetForeground",is,w("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.stringForeground",is,w("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.structForeground",is,w("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.textForeground",is,w("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.typeParameterForeground",is,w("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.unitForeground",is,w("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));at("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const zT=Object.freeze({kind:fn.Empty,title:w("codeAction.widget.id.more","More Actions...")}),A3=Object.freeze([{kind:ln.QuickFix,title:w("codeAction.widget.id.quickfix","Quick Fix")},{kind:ln.RefactorExtract,title:w("codeAction.widget.id.extract","Extract"),icon:Ot.wrench},{kind:ln.RefactorInline,title:w("codeAction.widget.id.inline","Inline"),icon:Ot.wrench},{kind:ln.RefactorRewrite,title:w("codeAction.widget.id.convert","Rewrite"),icon:Ot.wrench},{kind:ln.RefactorMove,title:w("codeAction.widget.id.move","Move"),icon:Ot.wrench},{kind:ln.SurroundWith,title:w("codeAction.widget.id.surround","Surround With"),icon:Ot.surroundWith},{kind:ln.Source,title:w("codeAction.widget.id.source","Source Action"),icon:Ot.symbolFile},zT]);function O3(o,e,t){if(!e)return o.map(s=>{var r;return{kind:"action",item:s,group:zT,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!((r=s.action.edit)!=null&&r.edits.length)}});const i=A3.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new fn(s.action.kind):fn.None;for(const a of i)if(a.group.kind.contains(r)){a.actions.push(s);break}}const n=[];for(const s of i)if(s.actions.length){n.push({kind:"header",group:s.group});for(const r of s.actions){const a=s.group;n.push({kind:"action",item:r,group:r.action.isAI?{title:a.title,kind:a.kind,icon:Ot.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}var F3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},H3=function(o,e){return function(t,i){e(t,i,o)}},Wh;const bI=Wn("gutter-lightbulb",Ot.lightBulb,w("gutterLightbulbWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor.")),wI=Wn("gutter-lightbulb-auto-fix",Ot.lightbulbAutofix,w("gutterLightbulbAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),yI=Wn("gutter-lightbulb-sparkle",Ot.lightbulbSparkle,w("gutterLightbulbAIFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),SI=Wn("gutter-lightbulb-aifix-auto-fix",Ot.lightbulbSparkleAutofix,w("gutterLightbulbAIFixAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")),CI=Wn("gutter-lightbulb-sparkle-filled",Ot.sparkleFilled,w("gutterLightbulbSparkleFilledWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available."));var pr;(function(o){o.Hidden={type:0};class e{constructor(i,n,s,r){this.actions=i,this.trigger=n,this.editorPosition=s,this.widgetPosition=r,this.type=1}}o.Showing=e})(pr||(pr={}));var Wa;let Wf=(Wa=class extends Be{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new ti),this.onClick=this._onClick.event,this._state=pr.Hidden,this._gutterState=pr.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+bI.id,"codicon-"+SI.id,"codicon-"+wI.id,"codicon-"+yI.id,"codicon-"+CI.id],this.gutterDecoration=Wh.GUTTER_DECORATION,this._domNode=rt("div.lightBulbWidget"),this._domNode.role="listbox",this._register(zD.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(i=>{const n=this._editor.getModel();(this.state.type!==1||!n||this.state.editorPosition.lineNumber>=n.getLineCount())&&this.hide(),(this.gutterState.type!==1||!n||this.gutterState.editorPosition.lineNumber>=n.getLineCount())&&this.gutterHide()})),this._register(vA(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:n,height:s}=Ws(this._domNode),r=this._editor.getOption(67);let a=Math.floor(r/3);this.state.widgetPosition.position!==null&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(a+=r),this._onClick.fire({x:i.posx,y:n+s+a,actions:this.state.actions,trigger:this.state.trigger})})),this._register(Ni(this._domNode,"mouseenter",i=>{(i.buttons&1)===1&&this.hide()})),this._register(es.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var i,n;this._preferredKbLabel=((i=this._keybindingService.lookupKeybinding(HT))==null?void 0:i.getLabel())??void 0,this._quickFixKbLabel=((n=this._keybindingService.lookupKeybinding(X0))==null?void 0:n.getLabel())??void 0,this._updateLightBulbTitleAndIcon()})),this._register(this._editor.onMouseDown(async i=>{if(!i.target.element||!this.lightbulbClasses.some(c=>i.target.element&&i.target.element.classList.contains(c))||this.gutterState.type!==1)return;this._editor.focus();const{top:n,height:s}=Ws(i.target.element),r=this._editor.getOption(67);let a=Math.floor(r/3);this.gutterState.widgetPosition.position!==null&&this.gutterState.widgetPosition.position.lineNumber<this.gutterState.editorPosition.lineNumber&&(a+=r),this._onClick.fire({x:i.event.posx,y:n+s+a,actions:this.gutterState.actions,trigger:this.gutterState.trigger})}))}dispose(){super.dispose(),this._editor.removeContentWidget(this),this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return this._state.type===1?this._state.widgetPosition:null}update(e,t,i){if(e.validActions.length<=0)return this.gutterHide(),this.hide();if(!this._editor.hasTextFocus())return this.gutterHide(),this.hide();if(!this._editor.getOptions().get(65).enabled)return this.gutterHide(),this.hide();const r=this._editor.getModel();if(!r)return this.gutterHide(),this.hide();const{lineNumber:a,column:c}=r.validatePosition(i),d=r.getOptions().tabSize,u=this._editor.getOptions().get(50),f=r.getLineContent(a),m=r0(f,d),v=u.spaceWidth*m>22,_=F=>F>2&&this._editor.getTopForLineNumber(F)===this._editor.getTopForLineNumber(F-1),y=this._editor.getLineDecorations(a);let S=!1;if(y)for(const F of y){const Q=F.options.glyphMarginClassName;if(Q&&!this.lightbulbClasses.some($=>Q.includes($))){S=!0;break}}let D=a,E=1;if(!v){const F=Q=>{const $=r.getLineContent(Q);return/^\s*$|^\s+/.test($)||$.length<=E};if(a>1&&!_(a-1)){const Q=r.getLineCount(),$=a===Q,fe=a>1&&F(a-1),Pe=!$&&F(a+1),ze=F(a),me=!Pe&&!fe;if(!Pe&&!fe&&!S)return this.gutterState=new pr.Showing(e,t,i,{position:{lineNumber:D,column:E},preference:Wh._posPref}),this.renderGutterLightbub(),this.hide();fe||$||fe&&!ze?D-=1:(Pe||me&&ze)&&(D+=1)}else if(a===1&&(a===r.getLineCount()||!F(a+1)&&!F(a)))if(this.gutterState=new pr.Showing(e,t,i,{position:{lineNumber:D,column:E},preference:Wh._posPref}),S)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(a<r.getLineCount()&&!_(a+1))D+=1;else if(c*u.spaceWidth<22)return this.hide();E=/^\S\s*$/.test(r.getLineContent(D))?2:1}this.state=new pr.Showing(e,t,i,{position:{lineNumber:D,column:E},preference:Wh._posPref}),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());const N=e.validActions,B=e.validActions[0].action.kind;if(N.length!==1||!B){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this.state!==pr.Hidden&&(this.state=pr.Hidden,this._editor.layoutContentWidget(this))}gutterHide(){this.gutterState!==pr.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this.gutterState=pr.Hidden)}get state(){return this._state}set state(e){this._state=e,this._updateLightBulbTitleAndIcon()}get gutterState(){return this._gutterState}set gutterState(e){this._gutterState=e,this._updateGutterLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],this.state.type!==1)return;let e,t=!1;this.state.actions.allAIFixes?(e=Ot.sparkleFilled,this.state.actions.validActions.length===1&&(t=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?e=Ot.lightbulbSparkleAutofix:e=Ot.lightbulbAutofix:this.state.actions.hasAIFix?e=Ot.lightbulbSparkle:e=Ot.lightBulb,this._updateLightbulbTitle(this.state.actions.hasAutoFix,t),this._iconClasses=Wi.asClassNameArray(e),this._domNode.classList.add(...this._iconClasses)}_updateGutterLightBulbTitleAndIcon(){if(this.gutterState.type!==1)return;let e,t=!1;this.gutterState.actions.allAIFixes?(e=CI,this.gutterState.actions.validActions.length===1&&(t=!0)):this.gutterState.actions.hasAutoFix?this.gutterState.actions.hasAIFix?e=SI:e=wI:this.gutterState.actions.hasAIFix?e=yI:e=bI,this._updateLightbulbTitle(this.gutterState.actions.hasAutoFix,t);const i=pi.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Wi.asClassName(e),glyphMargin:{position:c_.Left},stickiness:1});this.gutterDecoration=i}renderGutterLightbub(){const e=this._editor.getSelection();e&&(this._gutterDecorationID===void 0?this._addGutterDecoration(e.startLineNumber):this._updateGutterDecoration(this._gutterDecorationID,e.startLineNumber))}_addGutterDecoration(e){this._editor.changeDecorations(t=>{this._gutterDecorationID=t.addDecoration(new H(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(i=>{i.changeDecoration(e,new H(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}_updateLightbulbTitle(e,t){this.state.type===1&&(t?this.title=w("codeActionAutoRun","Run: {0}",this.state.actions.validActions[0].action.title):e&&this._preferredKbLabel?this.title=w("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):!e&&this._quickFixKbLabel?this.title=w("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):e||(this.title=w("codeAction","Show Code Actions")))}set title(e){this._domNode.title=e}},Wh=Wa,Wa.GUTTER_DECORATION=pi.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Wi.asClassName(Ot.lightBulb),glyphMargin:{position:c_.Left},stickiness:1}),Wa.ID="editor.contrib.lightbulbWidget",Wa._posPref=[0],Wa);Wf=Wh=F3([H3(1,Zn)],Wf);var VT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},wS=function(o,e){return function(t,i){e(t,i,o)}};const jT="acceptSelectedCodeAction",UT="previewSelectedCodeAction";class W3{get templateId(){return"header"}renderTemplate(e){e.classList.add("group-header");const t=document.createElement("span");return e.append(t),{container:e,text:t}}renderElement(e,t,i){var n;i.text.textContent=((n=e.group)==null?void 0:n.title)??""}disposeTemplate(e){}}let yS=class{get templateId(){return"action"}constructor(e,t){this._supportsPreview=e,this._keybindingService=t}renderTemplate(e){e.classList.add(this.templateId);const t=document.createElement("div");t.className="icon",e.append(t);const i=document.createElement("span");i.className="title",e.append(i);const n=new a0(e,l0);return{container:e,icon:t,text:i,keybinding:n}}renderElement(e,t,i){var r,a,c;if((r=e.group)!=null&&r.icon?(i.icon.className=Wi.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=Bc(e.group.icon.color.id))):(i.icon.className=Wi.asClassName(Ot.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=$T(e.label),i.keybinding.set(e.keybinding),bA(!!e.keybinding,i.keybinding.element);const n=(a=this._keybindingService.lookupKeybinding(jT))==null?void 0:a.getLabel(),s=(c=this._keybindingService.lookupKeybinding(UT))==null?void 0:c.getLabel();i.container.classList.toggle("option-disabled",e.disabled),e.disabled?i.container.title=e.label:n&&s?this._supportsPreview&&e.canPreview?i.container.title=w({key:"label-preview",comment:['placeholders are keybindings, e.g "F2 to Apply, Shift+F2 to Preview"']},"{0} to Apply, {1} to Preview",n,s):i.container.title=w({key:"label",comment:['placeholder is a keybinding, e.g "F2 to Apply"']},"{0} to Apply",n):i.container.title=""}disposeTemplate(e){e.keybinding.dispose()}};yS=VT([wS(1,Zn)],yS);class B3 extends UIEvent{constructor(){super("acceptSelectedAction")}}class xI extends UIEvent{constructor(){super("previewSelectedAction")}}function z3(o){if(o.kind==="action")return o.label}let SS=class extends Be{constructor(e,t,i,n,s,r){super(),this._delegate=n,this._contextViewService=s,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new gs),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:c=>c.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:c=>c.kind};this._list=this._register(new c0(e,this.domNode,a,[new yS(t,this._keybindingService),new W3],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:z3},accessibilityProvider:{getAriaLabel:c=>{if(c.kind==="action"){let d=c.label?$T(c==null?void 0:c.label):"";return c.disabled&&(d=w({key:"customQuickFixWidget.labels",comment:["Action widget labels for accessibility."]},"{0}, Disabled Reason: {1}",d,c.disabled)),d}return null},getWidgetAriaLabel:()=>w({key:"customQuickFixWidget",comment:["An action widget option"]},"Action Widget"),getRole:c=>c.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(wA),this._register(this._list.onMouseClick(c=>this.onListClick(c))),this._register(this._list.onMouseOver(c=>this.onListHover(c))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(c=>this.onListSelection(c))),this._allMenuItems=i,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(e){return!e.disabled&&e.kind==="action"}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._contextViewService.hideContextView()}layout(e){const t=this._allMenuItems.filter(c=>c.kind==="header").length,n=this._allMenuItems.length*this._actionLineHeight+t*this._headerLineHeight-t*this._actionLineHeight;this._list.layout(n);let s=e;if(this._allMenuItems.length>=50)s=380;else{const c=this._allMenuItems.map((d,u)=>{const f=this.domNode.ownerDocument.getElementById(this._list.getElementID(u));if(f){f.style.width="auto";const m=f.getBoundingClientRect().width;return f.style.width="",m}return 0});s=Math.max(...c,e)}const a=Math.min(n,this.domNode.ownerDocument.body.clientHeight*.7);return this._list.layout(a,s),this.domNode.style.height=`${a}px`,this._list.domFocus(),s}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(e){const t=this._list.getFocus();if(t.length===0)return;const i=t[0],n=this._list.element(i);if(!this.focusCondition(n))return;const s=e?new xI:new B3;this._list.setSelection([i],s)}onListSelection(e){if(!e.elements.length)return;const t=e.elements[0];t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof xI):this._list.setSelection([])}onFocus(){var n,s;const e=this._list.getFocus();if(e.length===0)return;const t=e[0],i=this._list.element(t);(s=(n=this._delegate).onFocus)==null||s.call(n,i.item)}async onListHover(e){const t=e.element;if(t&&t.item&&this.focusCondition(t)){if(this._delegate.onHover&&!t.disabled&&t.kind==="action"){const i=await this._delegate.onHover(t.item,this.cts.token);t.canPreview=i?i.canPreview:void 0}e.index&&this._list.splice(e.index,1,[t])}this._list.setFocus(typeof e.index=="number"?[e.index]:[])}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};SS=VT([wS(4,Db),wS(5,Zn)],SS);function $T(o){return o.replace(/\r\n|\r|\n/g," ")}var V3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Jw=function(o,e){return function(t,i){e(t,i,o)}};at("actionBar.toggledBackground",d0,w("actionBar.toggledBackground","Background color for toggled action items in action bar."));const Kd={Visible:new yi("codeActionMenuVisible",!1,w("codeActionMenuVisible","Whether the action widget list is visible"))},ah=sl("actionWidgetService");let Gd=class extends Be{get isVisible(){return Kd.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new So)}show(e,t,i,n,s,r,a){const c=Kd.Visible.bindTo(this._contextKeyService),d=this._instantiationService.createInstance(SS,e,t,i,n);this._contextViewService.showContextView({getAnchor:()=>s,render:u=>(c.set(!0),this._renderWidget(u,d,a??[])),onHide:u=>{c.reset(),this._onWidgetClosed(u)}},r,!1)}acceptSelected(e){var t;(t=this._list.value)==null||t.acceptSelected(e)}focusPrevious(){var e,t;(t=(e=this._list)==null?void 0:e.value)==null||t.focusPrevious()}focusNext(){var e,t;(t=(e=this._list)==null?void 0:e.value)==null||t.focusNext()}hide(e){var t;(t=this._list.value)==null||t.hide(e),this._list.clear()}_renderWidget(e,t,i){var v;const n=document.createElement("div");if(n.classList.add("action-widget"),e.appendChild(n),this._list.value=t,this._list.value)n.appendChild(this._list.value.domNode);else throw new Error("List has no value");const s=new Oe,r=document.createElement("div"),a=e.appendChild(r);a.classList.add("context-view-block"),s.add(Ni(a,Cn.MOUSE_DOWN,_=>_.stopPropagation()));const c=document.createElement("div"),d=e.appendChild(c);d.classList.add("context-view-pointerBlock"),s.add(Ni(d,Cn.POINTER_MOVE,()=>d.remove())),s.add(Ni(d,Cn.MOUSE_DOWN,()=>d.remove()));let u=0;if(i.length){const _=this._createActionBar(".action-widget-action-bar",i);_&&(n.appendChild(_.getContainer().parentElement),s.add(_),u=_.getContainer().offsetWidth)}const f=(v=this._list.value)==null?void 0:v.layout(u);n.style.width=`${f}px`;const m=s.add(Nu(e));return s.add(m.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=rt(e),n=new xf(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)==null||t.hide(e)}};Gd=V3([Jw(0,Db),Jw(1,Ri),Jw(2,qt)],Gd);ol(ah,Gd,1);const Wp=1100;Yi(class extends Vs{constructor(){super({id:"hideCodeActionWidget",title:ht("hideCodeActionWidget.title","Hide action widget"),precondition:Kd.Visible,keybinding:{weight:Wp,primary:9,secondary:[1033]}})}run(o){o.get(ah).hide(!0)}});Yi(class extends Vs{constructor(){super({id:"selectPrevCodeAction",title:ht("selectPrevCodeAction.title","Select previous action"),precondition:Kd.Visible,keybinding:{weight:Wp,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(ah);e instanceof Gd&&e.focusPrevious()}});Yi(class extends Vs{constructor(){super({id:"selectNextCodeAction",title:ht("selectNextCodeAction.title","Select next action"),precondition:Kd.Visible,keybinding:{weight:Wp,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(ah);e instanceof Gd&&e.focusNext()}});Yi(class extends Vs{constructor(){super({id:jT,title:ht("acceptSelected.title","Accept selected action"),precondition:Kd.Visible,keybinding:{weight:Wp,primary:3,secondary:[2137]}})}run(o){const e=o.get(ah);e instanceof Gd&&e.acceptSelected()}});Yi(class extends Vs{constructor(){super({id:UT,title:ht("previewSelected.title","Preview selected action"),precondition:Kd.Visible,keybinding:{weight:Wp,primary:2051}})}run(o){const e=o.get(ah);e instanceof Gd&&e.acceptSelected(!0)}});const qT=new yi("supportedCodeAction",""),LI="_typescript.applyFixAllCodeAction";class j3 extends Be{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new wp),this._register(this._markerService.onMarkerChanged(s=>this._onMarkerChanges(s))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){const t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){const t=this._editor.getModel();t&&e.some(i=>d_(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:ro.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;const t=this._editor.getSelection();if(e.type===1)return t;const i=this._editor.getOption(65).enabled;if(i!==Rw.Off){{if(i===Rw.On)return t;if(i===Rw.OnCode){if(!t.isEmpty())return t;const s=this._editor.getModel(),{lineNumber:r,column:a}=t.getPosition(),c=s.getLineContent(r);if(c.length===0)return;if(a===1){if(/\s/.test(c[0]))return}else if(a===s.getLineMaxColumn(r)){if(/\s/.test(c[c.length-1]))return}else if(/\s/.test(c[a-2])&&/\s/.test(c[a-1]))return}}return t}}}var kc;(function(o){o.Empty={type:0};class e{constructor(i,n,s){this.trigger=i,this.position=n,this._cancellablePromise=s,this.type=1,this.actions=s.catch(r=>{if(dc(r))return KT;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(kc||(kc={}));const KT=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class U3 extends Be{constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._registry=t,this._markerService=i,this._progressService=s,this._configurationService=r,this._telemetryService=a,this._codeActionOracle=this._register(new So),this._state=kc.Empty,this._onDidChangeState=this._register(new ti),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=qT.bindTo(n),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(c=>{c.hasChanged(65)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(kc.Empty,!0))}_settingEnabledNearbyQuickfixes(){var t;const e=(t=this._editor)==null?void 0:t.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:e==null?void 0:e.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(kc.Empty);const e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(92)){const t=this._registry.all(e).flatMap(i=>i.providedCodeActionKinds??[]);this._supportedCodeActions.set(t.join(" ")),this._codeActionOracle.value=new j3(this._editor,this._markerService,i=>{var c;if(!i){this.setState(kc.Empty);return}const n=i.selection.getStartPosition(),s=us(async d=>{var u,f,m,v,_,y,S,D,E,N;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===ro.QuickFix||(f=(u=i.trigger.filter)==null?void 0:u.include)!=null&&f.contains(ln.QuickFix))){const B=await Zh(this._registry,e,i.selection,i.trigger,Fa.None,d),F=[...B.allActions];if(d.isCancellationRequested)return KT;const Q=(m=B.validActions)==null?void 0:m.some(fe=>fe.action.kind?ln.QuickFix.contains(new fn(fe.action.kind)):!1),$=this._markerService.read({resource:e.uri});if(Q){for(const fe of B.validActions)(_=(v=fe.action.command)==null?void 0:v.arguments)!=null&&_.some(Pe=>typeof Pe=="string"&&Pe.includes(LI))&&(fe.action.diagnostics=[...$.filter(Pe=>Pe.relatedInformation)]);return{validActions:B.validActions,allActions:F,documentation:B.documentation,hasAutoFix:B.hasAutoFix,hasAIFix:B.hasAIFix,allAIFixes:B.allAIFixes,dispose:()=>{B.dispose()}}}else if(!Q&&$.length>0){const fe=i.selection.getPosition();let Pe=fe,ze=Number.MAX_VALUE;const me=[...B.validActions];for(const dt of $){const Ke=dt.endColumn,Ut=dt.endLineNumber,lt=dt.startLineNumber;if(Ut===fe.lineNumber||lt===fe.lineNumber){Pe=new ut(Ut,Ke);const Kt={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(y=i.trigger.filter)!=null&&y.include?(S=i.trigger.filter)==null?void 0:S.include:ln.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((D=i.trigger.context)==null?void 0:D.notAvailableMessage)||"",position:Pe}},Ie=new Mt(Pe.lineNumber,Pe.column,Pe.lineNumber,Pe.column),Pt=await Zh(this._registry,e,Ie,Kt,Fa.None,d);if(Pt.validActions.length!==0){for(const Fe of Pt.validActions)(N=(E=Fe.action.command)==null?void 0:E.arguments)!=null&&N.some(ft=>typeof ft=="string"&&ft.includes(LI))&&(Fe.action.diagnostics=[...$.filter(ft=>ft.relatedInformation)]);B.allActions.length===0&&F.push(...Pt.allActions),Math.abs(fe.column-Ke)<ze?me.unshift(...Pt.validActions):me.push(...Pt.validActions)}ze=Math.abs(fe.column-Ke)}}const Ve=me.filter((dt,Ke,Ut)=>Ut.findIndex(lt=>lt.action.title===dt.action.title)===Ke);return Ve.sort((dt,Ke)=>dt.action.isPreferred&&!Ke.action.isPreferred?-1:!dt.action.isPreferred&&Ke.action.isPreferred||dt.action.isAI&&!Ke.action.isAI?1:!dt.action.isAI&&Ke.action.isAI?-1:0),{validActions:Ve,allActions:F,documentation:B.documentation,hasAutoFix:B.hasAutoFix,hasAIFix:B.hasAIFix,allAIFixes:B.allAIFixes,dispose:()=>{B.dispose()}}}}if(i.trigger.type===1){const B=new oo,F=await Zh(this._registry,e,i.selection,i.trigger,Fa.None,d);return this._telemetryService&&this._telemetryService.publicLog2("codeAction.invokedDurations",{codeActions:F.validActions.length,duration:B.elapsed()}),F}return Zh(this._registry,e,i.selection,i.trigger,Fa.None,d)});i.trigger.type===1&&((c=this._progressService)==null||c.showWhile(s,250));const r=new kc.Triggered(i.trigger,n,s);let a=!1;this._state.type===1&&(a=this._state.trigger.type===1&&r.type===1&&r.trigger.type===2&&this._state.position!==r.position),a?setTimeout(()=>{this.setState(r)},500):this.setState(r)},void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:ro.Default})}else this._supportedCodeActions.reset()}trigger(e){var t;(t=this._codeActionOracle.value)==null||t.trigger(e)}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}}var $3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zr=function(o,e){return function(t,i){e(t,i,o)}},Bh;const q3="quickfix-edit-highlight";var Bl;let Gu=(Bl=class extends Be{static get(e){return e.getContribution(Bh.ID)}constructor(e,t,i,n,s,r,a,c,d,u,f){super(),this._commandService=a,this._configurationService=c,this._actionWidgetService=d,this._instantiationService=u,this._telemetryService=f,this._activeCodeActions=this._register(new So),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new U3(this._editor,s.codeActionProvider,t,i,r,c,this._telemetryService)),this._register(this._model.onDidChangeState(m=>this.update(m))),this._lightBulbWidget=new o0(()=>{const m=this._editor.getContribution(Wf.ID);return m&&this._register(m.onClick(v=>this.showCodeActionsFromLightbulb(v.actions,v))),m}),this._resolver=n.createInstance(bS),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(e.allAIFixes&&e.validActions.length===1){const i=e.validActions[0],n=i.action.command;n&&n.id==="inlineChat.start"&&n.arguments&&n.arguments.length>=1&&(n.arguments[0]={...n.arguments[0],autoSend:!1}),await this._applyCodeAction(i,!1,!1,Rc.FromAILightbulb);return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,i){return this.showCodeActionList(t,i,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,i,n){var r;if(!this._editor.hasModel())return;(r=io.get(this._editor))==null||r.closeMessage();const s=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:i,autoApply:n,context:{notAvailableMessage:e,position:s}})}_trigger(e){return this._model.trigger(e)}async _applyCodeAction(e,t,i,n){try{await this._instantiationService.invokeFunction(T3,e,n,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:ro.QuickFix,filter:{}})}}hideLightBulbWidget(){var e,t;(e=this._lightBulbWidget.rawValue)==null||e.hide(),(t=this._lightBulbWidget.rawValue)==null||t.gutterHide()}async update(e){var n,s,r,a,c;if(e.type!==1){this.hideLightBulbWidget();return}let t;try{t=await e.actions}catch(d){on(d);return}if(this._disposed)return;const i=this._editor.getSelection();if((i==null?void 0:i.startLineNumber)===e.position.lineNumber)if((n=this._lightBulbWidget.value)==null||n.update(t,e.trigger,e.position),e.trigger.type===1){if((s=e.trigger.filter)!=null&&s.include){const u=this.tryGetValidActionToApply(e.trigger,t);if(u){try{this.hideLightBulbWidget(),await this._applyCodeAction(u,!1,!1,Rc.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const f=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(f&&f.action.disabled){(r=io.get(this._editor))==null||r.showMessage(f.action.disabled,e.trigger.context.position),t.dispose();return}}}const d=!!((a=e.trigger.filter)!=null&&a.include);if(e.trigger.context&&(!t.allActions.length||!d&&!t.validActions.length)){(c=io.get(this._editor))==null||c.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=t,t.dispose();return}this._activeCodeActions.value=t,this.showCodeActionList(t,this.toCoords(e.position),{includeDisabledActions:d,fromLightbulb:!1})}else this._actionWidgetService.isVisible?t.dispose():this._activeCodeActions.value=t}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:i})=>i.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}async showCodeActionList(e,t,i){const n=this._editor.createDecorationsCollection(),s=this._editor.getDomNode();if(!s)return;const r=i.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!r.length)return;const a=ut.isIPosition(t)?this.toCoords(t):t,c={onSelect:async(d,u)=>{this._applyCodeAction(d,!0,!!u,i.fromLightbulb?Rc.FromAILightbulb:Rc.FromCodeActions),this._actionWidgetService.hide(!1),n.clear()},onHide:d=>{var u;(u=this._editor)==null||u.focus(),n.clear()},onHover:async(d,u)=>{var v;if(u.isCancellationRequested)return;let f=!1;const m=d.action.kind;if(m){const _=new fn(m);f=[ln.RefactorExtract,ln.RefactorInline,ln.RefactorRewrite,ln.RefactorMove,ln.Source].some(S=>S.contains(_))}return{canPreview:f||!!((v=d.action.edit)!=null&&v.edits.length)}},onFocus:d=>{var u,f;if(d&&d.action){const m=d.action.ranges,v=d.action.diagnostics;if(n.clear(),m&&m.length>0){const _=v&&(v==null?void 0:v.length)>1?v.map(y=>({range:y,options:Bh.DECORATION})):m.map(y=>({range:y,options:Bh.DECORATION}));n.set(_)}else if(v&&v.length>0){const _=v.map(S=>({range:S,options:Bh.DECORATION}));n.set(_);const y=v[0];if(y.startLineNumber&&y.startColumn){const S=(f=(u=this._editor.getModel())==null?void 0:u.getWordAtPosition({lineNumber:y.startLineNumber,column:y.startColumn}))==null?void 0:f.word;Ru(w("editingNewSelection","Context: {0} at line {1} and column {2}.",S,y.startLineNumber,y.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,O3(r,this._shouldShowHeaders(),this._resolver.getResolver()),c,a,s,this._getActionBarActions(e,t,i))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(e),i=Ws(this._editor.getDomNode()),n=i.left+t.left,s=i.top+t.top+t.height;return{x:n,y:s}}_shouldShowHeaders(){var t;const e=(t=this._editor)==null?void 0:t.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:e==null?void 0:e.uri})}_getActionBarActions(e,t,i){if(i.fromLightbulb)return[];const n=e.documentation.map(s=>({id:s.id,label:s.title,tooltip:s.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(s.id,...s.arguments??[])}));return i.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:w("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:w("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),n}},Bh=Bl,Bl.ID="editor.contrib.codeActionController",Bl.DECORATION=pi.register({description:"quickfix-highlight",className:q3}),Bl);Gu=Bh=$3([zr(1,h0),zr(2,Ri),zr(3,qt),zr(4,gt),zr(5,yp),zr(6,ls),zr(7,pn),zr(8,ah),zr(9,qt),zr(10,Nr)],Gu);Eb((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(yA));const i=o.getColor(VD);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Lf(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function Bp(o){return le.regex(qT.keys()[0],new RegExp("(\\s|^)"+If(o.value)+"\\b"))}const Y0={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:w("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:w("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[w("args.schema.apply.first","Always apply the first returned code action."),w("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),w("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:w("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function lh(o,e,t,i,n=ro.Default){if(o.hasModel()){const s=Gu.get(o);s==null||s.manualTriggerAtCurrentPosition(e,n,t,i)}}class K3 extends Se{constructor(){super({id:X0,label:w("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:le.and(M.writable,M.hasCodeActionsProvider),kbOpts:{kbExpr:M.textInputFocus,primary:2137,weight:100}})}run(e,t){return lh(t,w("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,ro.QuickFix)}}class G3 extends js{constructor(){super({id:FT,precondition:le.and(M.writable,M.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:Y0}]}})}runEditorCommand(e,t,i){const n=ta.fromUser(i,{kind:fn.Empty,apply:"ifSingle"});return lh(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?w("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):w("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):n.preferred?w("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):w("editor.action.codeAction.noneMessage","No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}class Z3 extends Se{constructor(){super({id:WT,label:w("refactor.label","Refactor..."),alias:"Refactor...",precondition:le.and(M.writable,M.hasCodeActionsProvider),kbOpts:{kbExpr:M.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:le.and(M.writable,Bp(ln.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:Y0}]}})}run(e,t,i){const n=ta.fromUser(i,{kind:ln.Refactor,apply:"never"});return lh(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?w("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):w("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):n.preferred?w("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):w("editor.action.refactor.noneMessage","No refactorings available"),{include:ln.Refactor.contains(n.kind)?n.kind:fn.None,onlyIncludePreferredActions:n.preferred},n.apply,ro.Refactor)}}class X3 extends Se{constructor(){super({id:BT,label:w("source.label","Source Action..."),alias:"Source Action...",precondition:le.and(M.writable,M.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:le.and(M.writable,Bp(ln.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:Y0}]}})}run(e,t,i){const n=ta.fromUser(i,{kind:ln.Source,apply:"never"});return lh(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?w("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):w("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):n.preferred?w("editor.action.source.noneMessage.preferred","No preferred source actions available"):w("editor.action.source.noneMessage","No source actions available"),{include:ln.Source.contains(n.kind)?n.kind:fn.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,ro.SourceAction)}}class Y3 extends Se{constructor(){super({id:mS,label:w("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:le.and(M.writable,Bp(ln.SourceOrganizeImports)),kbOpts:{kbExpr:M.textInputFocus,primary:1581,weight:100}})}run(e,t){return lh(t,w("editor.action.organize.noneMessage","No organize imports action available"),{include:ln.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",ro.OrganizeImports)}}class J3 extends Se{constructor(){super({id:_S,label:w("fixAll.label","Fix All"),alias:"Fix All",precondition:le.and(M.writable,Bp(ln.SourceFixAll))})}run(e,t){return lh(t,w("fixAll.noneMessage","No fix all action available"),{include:ln.SourceFixAll,includeSourceActions:!0},"ifSingle",ro.FixAll)}}class Q3 extends Se{constructor(){super({id:HT,label:w("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:le.and(M.writable,Bp(ln.QuickFix)),kbOpts:{kbExpr:M.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return lh(t,w("editor.action.autoFix.noneMessage","No auto fixes available"),{include:ln.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",ro.AutoFix)}}oi(Gu.ID,Gu,3);oi(Wf.ID,Wf,4);ie(K3);ie(Z3);ie(X3);ie(Y3);ie(Q3);ie(J3);bt(new G3);Tr.as(Sp.Configuration).registerConfiguration({...Pb,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:w("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});Tr.as(Sp.Configuration).registerConfiguration({...Pb,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:w("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});Tr.as(Sp.Configuration).registerConfiguration({...Pb,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:5,markdownDescription:w("triggerOnFocusChange","Enable triggering {0} when {1} is set to {2}. Code Actions must be set to {3} to be triggered for window and focus changes.","`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});class CS{constructor(){this.lenses=[],this._disposables=new Oe}dispose(){this._disposables.dispose()}get isDisposed(){return this._disposables.isDisposed}add(e,t){this._disposables.add(e);for(const i of e.lenses)this.lenses.push({symbol:i,provider:t})}}async function GT(o,e,t){const i=o.ordered(e),n=new Map,s=new CS,r=i.map(async(a,c)=>{n.set(a,c);try{const d=await Promise.resolve(a.provideCodeLenses(e,t));d&&s.add(d,a)}catch(d){jn(d)}});return await Promise.all(r),s.lenses=s.lenses.sort((a,c)=>a.symbol.range.startLineNumber<c.symbol.range.startLineNumber?-1:a.symbol.range.startLineNumber>c.symbol.range.startLineNumber?1:n.get(a.provider)<n.get(c.provider)?-1:n.get(a.provider)>n.get(c.provider)?1:a.symbol.range.startColumn<c.symbol.range.startColumn?-1:a.symbol.range.startColumn>c.symbol.range.startColumn?1:0),s}dn.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;Oi(nn.isUri(t)),Oi(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(gt),s=o.get(As).getModel(t);if(!s)throw Va();const r=[],a=new Oe;return GT(n,s,ii.None).then(c=>{a.add(c);const d=[];for(const u of c.lenses)i==null||u.symbol.command?r.push(u.symbol):i-- >0&&u.provider.resolveCodeLens&&d.push(Promise.resolve(u.provider.resolveCodeLens(s,u.symbol,ii.None)).then(f=>r.push(f||u.symbol)));return Promise.all(d)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var eB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},tB=function(o,e){return function(t,i){e(t,i,o)}};const ZT=sl("ICodeLensCache");class II{constructor(e,t){this.lineCount=e,this.data=t}}let xS=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new Cp(20,.75);const t="codelens/cache";SA(CA,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n);const s=es.filter(e.onWillSaveState,r=>r.reason===u0.SHUTDOWN);es.once(s)(r=>{e.store(i,this._serialize(),1,1)})}put(e,t){const i=t.lenses.map(r=>{var a;return{range:r.symbol.range,command:r.symbol.command&&{id:"",title:(a=r.symbol.command)==null?void 0:a.title}}}),n=new CS;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new II(e.getLineCount(),n);this._cache.set(e.uri.toString(),s)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const n=new Set;for(const s of i.data.lenses)n.add(s.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...n.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const n=t[i],s=[];for(const a of n.lines)s.push({range:new H(a,1,a,11)});const r=new CS;r.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new II(n.lineCount,r))}}catch{}}};xS=eB([tB(0,hc)],xS);ol(ZT,xS,1);class iB{constructor(e,t,i){this.afterColumn=1073741824,this.afterLineNumber=e,this.heightInPx=t,this._onHeight=i,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(e){this._lastHeight===void 0?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}}const yf=class yf{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${yf._idPool++}`,this.updatePosition(t),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(e,t){this._commands.clear();const i=[];let n=!1;for(let s=0;s<e.length;s++){const r=e[s];if(r&&(n=!0,r.command)){const a=xA(r.command.title.trim());if(r.command.id){const c=`c${yf._idPool++}`;i.push(rt("a",{id:c,title:r.command.tooltip,role:"button"},...a)),this._commands.set(c,r.command)}else i.push(rt("span",{title:r.command.tooltip},...a));s+1<e.length&&i.push(rt("span",void 0," | "))}}n?(h_(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):h_(this._domNode,rt("span",void 0,"no commands"))}getCommand(e){return e.parentElement===this._domNode?this._commands.get(e.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(e){const t=this._editor.getModel().getLineFirstNonWhitespaceColumn(e);this._widgetPosition={position:{lineNumber:e,column:t},preference:[1]}}getPosition(){return this._widgetPosition||null}};yf._idPool=0;let LS=yf;class Qw{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(e,t){this._addDecorations.push(e),this._addDecorationsCallbacks.push(t)}removeDecoration(e){this._removeDecorations.push(e)}commit(e){const t=e.deltaDecorations(this._removeDecorations,this._addDecorations);for(let i=0,n=t.length;i<n;i++)this._addDecorationsCallbacks[i](t[i])}}const kI=pi.register({collapseOnReplaceEdit:!0,description:"codelens"});class DI{constructor(e,t,i,n,s,r){this._isDisposed=!1,this._editor=t,this._data=e,this._decorationIds=[];let a;const c=[];this._data.forEach((d,u)=>{d.symbol.command&&c.push(d.symbol),i.addDecoration({range:d.symbol.range,options:kI},f=>this._decorationIds[u]=f),a?a=H.plusRange(a,d.symbol.range):a=H.lift(d.symbol.range)}),this._viewZone=new iB(a.startLineNumber-1,s,r),this._viewZoneId=n.addZone(this._viewZone),c.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(c,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new LS(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t==null||t.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{const i=this._editor.getModel().getDecorationRange(e),n=this._data[t].symbol;return!!(i&&H.isEmpty(n.range)===i.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((i,n)=>{t.addDecoration({range:i.symbol.range,options:kI},s=>this._decorationIds[n]=s)})}updateHeight(e,t){this._viewZone.heightInPx=e,t.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(e){if(!this._viewZone.isVisible())return null;for(let t=0;t<this._decorationIds.length;t++){const i=e.getDecorationRange(this._decorationIds[t]);i&&(this._data[t].symbol.range=i)}return this._data}updateCommands(e){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(e,!0);for(let t=0;t<this._data.length;t++){const i=e[t];if(i){const{symbol:n}=this._data[t];n.command=i.command||n.command}}}getCommand(e){var t;return(t=this._contentWidget)==null?void 0:t.getCommand(e)}getLineNumber(){const e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return e?e.startLineNumber:-1}update(e){if(this.isValid()){const t=this._editor.getModel().getDecorationRange(this._decorationIds[0]);t&&(this._viewZone.afterLineNumber=t.startLineNumber-1,e.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(t.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}}var nB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Tg=function(o,e){return function(t,i){e(t,i,o)}},yu;let Bf=(yu=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageFeaturesService=t,this._commandService=n,this._notificationService=s,this._codeLensCache=r,this._disposables=new Oe,this._localToDispose=new Oe,this._lenses=[],this._oldCodeLensModels=new Oe,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new ts(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{(a.hasChanged(50)||a.hasChanged(19)||a.hasChanged(18))&&this._updateLensStyle(),a.hasChanged(17)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var e;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),(e=this._currentCodeLensModel)==null||e.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(67)/this._editor.getOption(52));let t=this._editor.getOption(19);return(!t||t<5)&&(t=this._editor.getOption(52)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(18),n=this._editor.getOption(50),{style:s}=this._editor.getContainerDomNode();s.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),s.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),s.setProperty("--vscode-editorCodeLens-fontFeatureSettings",n.fontFeatureSettings),i&&(s.setProperty("--vscode-editorCodeLens-fontFamily",i),s.setProperty("--vscode-editorCodeLens-fontFamilyDefault",g0.fontFamily)),this._editor.changeViewZones(r=>{for(const a of this._lenses)a.updateHeight(e,r)})}_localDispose(){var e,t,i;(e=this._getCodeLensModelPromise)==null||e.cancel(),this._getCodeLensModelPromise=void 0,(t=this._resolveCodeLensesPromise)==null||t.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),(i=this._currentCodeLensModel)==null||i.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e||!this._editor.getOption(17)||e.isTooLargeForTokenization())return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&Cf(()=>{const n=this._codeLensCache.get(e);t===n&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(const n of this._languageFeaturesService.codeLensProvider.all(e))if(typeof n.onDidChange=="function"){const s=n.onDidChange(()=>i.schedule());this._localToDispose.add(s)}const i=new ts(()=>{var s;const n=Date.now();(s=this._getCodeLensModelPromise)==null||s.cancel(),this._getCodeLensModelPromise=us(r=>GT(this._languageFeaturesService.codeLensProvider,e,r)),this._getCodeLensModelPromise.then(r=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=r,this._codeLensCache.put(e,r);const a=this._provideCodeLensDebounce.update(e,Date.now()-n);i.delay=a,this._renderCodeLensSymbols(r),this._resolveCodeLensesInViewportSoon()},on)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(gn(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{var n;this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{const a=[];let c=-1;this._lenses.forEach(u=>{!u.isValid()||c===u.getLineNumber()?a.push(u):(u.update(r),c=u.getLineNumber())});const d=new Qw;a.forEach(u=>{u.dispose(d,r),this._lenses.splice(this._lenses.indexOf(u),1)}),d.commit(s)})}),i.schedule(),this._resolveCodeLensesScheduler.cancel(),(n=this._resolveCodeLensesPromise)==null||n.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{i.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{i.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(n=>{n.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(gn(()=>{if(this._editor.getModel()){const n=Au.capture(this._editor);this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(s,r)})}),n.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(n=>{if(n.target.type!==9)return;let s=n.target.element;if((s==null?void 0:s.tagName)==="SPAN"&&(s=s.parentElement),(s==null?void 0:s.tagName)==="A")for(const r of this._lenses){const a=r.getCommand(s);if(a){this._commandService.executeCommand(a.id,...a.arguments||[]).catch(c=>this._notificationService.error(c));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new Qw;for(const n of this._lenses)n.dispose(i,t);e&&i.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;const t=this._editor.getModel().getLineCount(),i=[];let n;for(const a of e.lenses){const c=a.symbol.range.startLineNumber;c<1||c>t||(n&&n[n.length-1].symbol.range.startLineNumber===c?n.push(a):(n=[a],i.push(n)))}if(!i.length&&!this._lenses.length)return;const s=Au.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(c=>{const d=new Qw;let u=0,f=0;for(;f<i.length&&u<this._lenses.length;){const m=i[f][0].symbol.range.startLineNumber,v=this._lenses[u].getLineNumber();v<m?(this._lenses[u].dispose(d,c),this._lenses.splice(u,1)):v===m?(this._lenses[u].updateCodeLensSymbols(i[f],d),f++,u++):(this._lenses.splice(u,0,new DI(i[f],this._editor,d,c,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),u++,f++)}for(;u<this._lenses.length;)this._lenses[u].dispose(d,c),this._lenses.splice(u,1);for(;f<i.length;)this._lenses.push(new DI(i[f],this._editor,d,c,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),f++;d.commit(a)})}),s.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){var r;(r=this._resolveCodeLensesPromise)==null||r.cancel(),this._resolveCodeLensesPromise=void 0;const e=this._editor.getModel();if(!e)return;const t=[],i=[];if(this._lenses.forEach(a=>{const c=a.computeIfNecessary(e);c&&(t.push(c),i.push(a))}),t.length===0)return;const n=Date.now(),s=us(a=>{const c=t.map((d,u)=>{const f=new Array(d.length),m=d.map((v,_)=>!v.symbol.command&&typeof v.provider.resolveCodeLens=="function"?Promise.resolve(v.provider.resolveCodeLens(e,v.symbol,a)).then(y=>{f[_]=y},jn):(f[_]=v.symbol,Promise.resolve(void 0)));return Promise.all(m).then(()=>{!a.isCancellationRequested&&!i[u].isDisposed()&&i[u].updateCommands(f)})});return Promise.all(c)});this._resolveCodeLensesPromise=s,this._resolveCodeLensesPromise.then(()=>{const a=this._resolveCodeLensesDebounce.update(e,Date.now()-n);this._resolveCodeLensesScheduler.delay=a,this._currentCodeLensModel&&this._codeLensCache.put(e,this._currentCodeLensModel),this._oldCodeLensModels.clear(),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},a=>{on(a),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){var e;return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,(e=this._currentCodeLensModel)!=null&&e.isDisposed?void 0:this._currentCodeLensModel}},yu.ID="css.editor.codeLens",yu);Bf=nB([Tg(1,gt),Tg(2,Wo),Tg(3,ls),Tg(4,Rs),Tg(5,ZT)],Bf);oi(Bf.ID,Bf,1);ie(class extends Se{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:M.hasCodeLensProvider,label:w("showLensOnLine","Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}async run(e,t){if(!t.hasModel())return;const i=e.get(nl),n=e.get(ls),s=e.get(Rs),r=t.getSelection().positionLineNumber,a=t.getContribution(Bf.ID);if(!a)return;const c=await a.getModel();if(!c)return;const d=[];for(const m of c.lenses)m.symbol.command&&m.symbol.range.startLineNumber===r&&d.push({label:m.symbol.command.title,command:m.symbol.command});if(d.length===0)return;const u=await i.pick(d,{canPickMany:!1,placeHolder:w("placeHolder","Select a command")});if(!u)return;let f=u.command;if(c.isDisposed){const m=await a.getModel(),v=m==null?void 0:m.lenses.find(_=>{var y;return _.symbol.range.startLineNumber===r&&((y=_.symbol.command)==null?void 0:y.title)===f.title});if(!v||!v.symbol.command)return;f=v.symbol.command}try{await n.executeCommand(f.id,...f.arguments||[])}catch(m){s.error(m)}}});var XT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},IS=function(o,e){return function(t,i){e(t,i,o)}};let zf=class{constructor(e){this._editorWorkerService=e}async provideDocumentColors(e,t){return this._editorWorkerService.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,i){const n=t.range,s=t.color,r=s.alpha,a=new ui(new Ou(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),c=r?ui.Format.CSS.formatRGB(a):ui.Format.CSS.formatRGBA(a),d=r?ui.Format.CSS.formatHSL(a):ui.Format.CSS.formatHSLA(a),u=r?ui.Format.CSS.formatHex(a):ui.Format.CSS.formatHexA(a),f=[];return f.push({label:c,textEdit:{range:n,text:c}}),f.push({label:d,textEdit:{range:n,text:d}}),f.push({label:u,textEdit:{range:n,text:u}}),f}};zf=XT([IS(0,rl)],zf);let kS=class extends Be{constructor(e,t){super(),this._register(e.colorProvider.register("*",new zf(t)))}};kS=XT([IS(0,gt),IS(1,rl)],kS);hg(kS);async function YT(o,e,t,i=!0){return J0(new sB,o,e,t,i)}function JT(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class sB{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({colorInfo:r,provider:e});return Array.isArray(s)}}class oB{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(s)}}class rB{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,ii.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function J0(o,e,t,i,n){let s=!1,r;const a=[],c=e.ordered(t);for(let d=c.length-1;d>=0;d--){const u=c[d];if(u instanceof zf)r=u;else try{await o.compute(u,t,i,a)&&(s=!0)}catch(f){jn(f)}}return s?a:r&&n?(await o.compute(r,t,i,a),a):[]}function QT(o,e){const{colorProvider:t}=o.get(gt),i=o.get(As).getModel(e);if(!i)throw Va();const n=o.get(pn).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}dn.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof nn))throw Va();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:s}=QT(o,t);return J0(new oB,n,i,ii.None,s)});dn.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof nn)||!Array.isArray(t)||t.length!==4||!H.isIRange(s))throw Va();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:c}=QT(o,n),[d,u,f,m]=t;return J0(new rB({range:s,color:{red:d,green:u,blue:f,alpha:m}}),a,r,ii.None,c)});var aB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ey=function(o,e){return function(t,i){e(t,i,o)}},DS;const eM=Object.create({});var zl;let Zu=(zl=class extends Be{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new Oe),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new jD(this._editor),this._decoratorLimitReporter=new lB,this._colorDecorationClassRefs=this._register(new Oe),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:DS.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(i.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(s=>{const r=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(148);const a=r!==this._isColorDecoratorsEnabled||s.hasChanged(21),c=s.hasChanged(148);(a||c)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(148),this.updateColors()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&typeof i=="object"){const n=i.colorDecorators;if(n&&n.enable!==void 0&&!n.enable)return n.enable}return this._editor.getOption(20)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new wp,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=us(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new oo(!1),n=await YT(this._languageFeaturesService.colorProvider,t,e,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(t,i.elapsed()),n});try{const e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){on(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){const t=e.map(i=>({range:{startLineNumber:i.colorInfo.range.startLineNumber,startColumn:i.colorInfo.range.startColumn,endLineNumber:i.colorInfo.range.endLineNumber,endColumn:i.colorInfo.range.endColumn},options:pi.EMPTY}));this._editor.changeDecorations(i=>{this._decorationsIds=i.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((n,s)=>this._colorDatas.set(n,e[s]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();const t=[],i=this._editor.getOption(21);for(let s=0;s<e.length&&t.length<i;s++){const{red:r,green:a,blue:c,alpha:d}=e[s].colorInfo.color,u=new Ou(Math.round(r*255),Math.round(a*255),Math.round(c*255),d),f=`rgba(${u.r}, ${u.g}, ${u.b}, ${u.a})`,m=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:f}));t.push({range:{startLineNumber:e[s].colorInfo.range.startLineNumber,startColumn:e[s].colorInfo.range.startColumn,endLineNumber:e[s].colorInfo.range.endLineNumber,endColumn:e[s].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:WD,inlineClassName:`${m.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:eM}}})}const n=i<e.length?i:!1;this._decoratorLimitReporter.update(e.length,n),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){const t=this._editor.getModel();if(!t)return null;const i=t.getDecorationsInRange(H.fromPositions(e,e)).filter(n=>this._colorDatas.has(n.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}},DS=zl,zl.ID="editor.contrib.colorDetector",zl.RECOMPUTE_TIME=1e3,zl);Zu=DS=aB([ey(1,pn),ey(2,gt),ey(3,Wo)],Zu);class lB{constructor(){this._onDidChange=new ti,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}oi(Zu.ID,Zu,1);class cB{get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(e,t,i){this.presentationIndex=i,this._onColorFlushed=new ti,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new ti,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new ti,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let i=-1;for(let n=0;n<this.colorPresentations.length;n++)if(t.toLowerCase()===this.colorPresentations[n].label){i=n;break}if(i===-1){const n=t.split("(")[0].toLowerCase();for(let s=0;s<this.colorPresentations.length;s++)if(this.colorPresentations[s].label.toLowerCase().startsWith(n)){i=s;break}}i!==-1&&i!==this.presentationIndex&&(this.presentationIndex=i,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}}const vo=rt;class dB extends Be{constructor(e,t,i,n=!1){super(),this.model=t,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=vo(".colorpicker-header"),Qe(e,this._domNode),this._pickedColorNode=Qe(this._domNode,vo(".picked-color")),Qe(this._pickedColorNode,vo("span.codicon.codicon-color-mode")),this._pickedColorPresentation=Qe(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const s=w("clickToToggleColorOptions","Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",s),this._originalColorNode=Qe(this._domNode,vo(".original-color")),this._originalColorNode.style.backgroundColor=ui.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(SL)||ui.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor(SL)||ui.white})),this._register(Ni(this._pickedColorNode,Cn.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Ni(this._originalColorNode,Cn.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=ui.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.showingStandaloneColorPicker&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new hB(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=ui.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class hB extends Be{constructor(e){super(),this._onClicked=this._register(new ti),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Qe(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),Qe(this._button,t),Qe(t,vo(".button"+Wi.asCSSSelector(Wn("color-picker-close",Ot.close,w("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(Ni(this._button,Cn.CLICK,()=>{this._onClicked.fire()}))}}class uB extends Be{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=vo(".colorpicker-body"),Qe(e,this._domNode),this._saturationBox=new gB(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new fB(this._domNode,this.model,n),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new pB(this._domNode,this.model,n),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),n&&(this._insertButton=this._register(new mB(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){const i=this.model.color.hsva;this.model.color=new ui(new Hm(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new ui(new Hm(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new ui(new Hm(i===360?0:i,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}class gB extends Be{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new ti,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ti,this.onColorFlushed=this._onColorFlushed.event,this._domNode=vo(".saturation-wrap"),Qe(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Qe(this._domNode,this._canvas),this.selection=vo(".saturation-selection"),Qe(this._domNode,this.selection),this.layout(),this._register(Ni(this._domNode,Cn.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new UD);const t=Ws(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>this.onDidChangePosition(n.pageX-t.left,n.pageY-t.top),()=>null);const i=Ni(e.target.ownerDocument,Cn.POINTER_UP,()=>{this._onColorFlushed.fire(),i.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){const i=Math.max(0,Math.min(1,e/this.width)),n=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(i,n),this._onDidChange.fire({s:i,v:n})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){const e=this.model.color.hsva,t=new ui(new Hm(e.h,1,1,1)),i=this._canvas.getContext("2d"),n=i.createLinearGradient(0,0,this._canvas.width,0);n.addColorStop(0,"rgba(255, 255, 255, 1)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),n.addColorStop(1,"rgba(255, 255, 255, 0)");const s=i.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=ui.Format.CSS.format(t),i.fill(),i.fillStyle=n,i.fill(),i.fillStyle=s,i.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const t=e.hsva;this.paintSelection(t.s,t.v)}}class tM extends Be{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new ti,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ti,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=Qe(e,vo(".standalone-strip")),this.overlay=Qe(this.domNode,vo(".standalone-overlay"))):(this.domNode=Qe(e,vo(".strip")),this.overlay=Qe(this.domNode,vo(".overlay"))),this.slider=Qe(this.domNode,vo(".slider")),this.slider.style.top="0px",this._register(Ni(this.domNode,Cn.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){const t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._register(new UD),i=Ws(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,s=>this.onDidChangeTop(s.pageY-i.top),()=>null);const n=Ni(e.target.ownerDocument,Cn.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){const t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}}class fB extends tM{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){super.onDidChangeColor(e);const{r:t,g:i,b:n}=e.rgba,s=new ui(new Ou(t,i,n,1)),r=new ui(new Ou(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class pB extends tM{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class mB extends Be{constructor(e){super(),this._onClicked=this._register(new ti),this.onClicked=this._onClicked.event,this._button=Qe(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(Ni(this._button,Cn.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class _B extends xp{constructor(e,t,i,n,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(LA.getInstance(zc(e)).onDidChange(()=>this.layout())),this._domNode=vo(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new dB(this._domNode,this.model,n,s)),this.body=this._register(new uB(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class ty{constructor(e,t,i,n){this.priority=e,this.range=t,this.initialMousePosX=i,this.initialMousePosY=n,this.type=1}equals(e){return e.type===1&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return e.type===1&&t.lineNumber===this.range.startLineNumber}}class Zm{constructor(e,t,i,n,s,r){this.priority=e,this.owner=t,this.range=i,this.initialMousePosX=n,this.initialMousePosY=s,this.supportsMarkerHover=r,this.type=2}equals(e){return e.type===2&&this.owner===e.owner}canAdoptVisibleHover(e,t){return e.type===2&&this.owner===e.owner}}class Zd{constructor(e){this.renderedHoverParts=e}dispose(){for(const e of this.renderedHoverParts)e.dispose()}}const ch=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};var iM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nM=function(o,e){return function(t,i){e(t,i,o)}};class vB{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let Vf=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return Ir.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=Zu.get(this._editor);if(!n)return[];for(const s of t){if(!n.isColorDecoration(s))continue;const r=n.getColorData(s.range.getStartPosition());if(r)return[await sM(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){const i=oM(this,this._editor,this._themeService,t,e);if(!i)return new Zd([]);this._colorPicker=i.colorPicker;const n={hoverPart:i.hoverPart,hoverElement:this._colorPicker.domNode,dispose(){i.disposables.dispose()}};return new Zd([n])}handleResize(){var e;(e=this._colorPicker)==null||e.layout()}isColorPickerVisible(){return!!this._colorPicker}};Vf=iM([nM(1,lr)],Vf);class bB{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let jf=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!Zu.get(this._editor))return null;const s=await YT(i,this._editor.getModel(),ii.None);let r=null,a=null;for(const f of s){const m=f.colorInfo;H.containsRange(m.range,e.range)&&(r=m,a=f.provider)}const c=r??e,d=a??t,u=!!r;return{colorHover:await sM(this,this._editor.getModel(),c,d),foundInEditor:u}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new H(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await Xm(this._editor.getModel(),t,this._color,i,e),i=rM(this._editor,i,t))}renderHoverParts(e,t){return oM(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};jf=iM([nM(1,lr)],jf);async function sM(o,e,t,i){const n=e.getValueInRange(t.range),{red:s,green:r,blue:a,alpha:c}=t.color,d=new Ou(Math.round(s*255),Math.round(r*255),Math.round(a*255),c),u=new ui(d),f=await JT(e,t,i,ii.None),m=new cB(u,[],0);return m.colorPresentations=f||[],m.guessColorPresentation(u,n),o instanceof Vf?new vB(o,H.lift(t.range),m,i):new bB(o,H.lift(t.range),m,i)}function oM(o,e,t,i,n){if(i.length===0||!e.hasModel())return;if(n.setMinimumDimensions){const m=e.getOption(67)+8;n.setMinimumDimensions(new an(302,m))}const s=new Oe,r=i[0],a=e.getModel(),c=r.model,d=s.add(new _B(n.fragment,c,e.getOption(144),t,o instanceof jf));let u=!1,f=new H(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(o instanceof jf){const m=r.model.color;o.color=m,Xm(a,c,m,f,r),s.add(c.onColorFlushed(v=>{o.color=v}))}else s.add(c.onColorFlushed(async m=>{await Xm(a,c,m,f,r),u=!0,f=rM(e,f,c)}));return s.add(c.onDidChangeColor(m=>{Xm(a,c,m,f,r)})),s.add(e.onDidChangeModelContent(m=>{u?u=!1:(n.hide(),e.focus())})),{hoverPart:r,colorPicker:d,disposables:s}}function rM(o,e,t){const i=[],n=t.presentation.textEdit??{range:e,text:t.presentation.label,forceMoveMarkers:!1};i.push(n),t.presentation.additionalTextEdits&&i.push(...t.presentation.additionalTextEdits);const s=H.lift(n.range),r=o.getModel()._setTrackedRange(null,s,3);return o.executeEdits("colorpicker",i),o.pushUndoStop(),o.getModel()._getTrackedRange(r)??s}async function Xm(o,e,t,i,n){const s=await JT(o,{range:i,color:{red:t.rgba.r/255,green:t.rgba.g/255,blue:t.rgba.b/255,alpha:t.rgba.a}},n.provider,ii.None);e.colorPresentations=s||[]}const aM="editor.action.showHover",wB="editor.action.showDefinitionPreviewHover",yB="editor.action.scrollUpHover",SB="editor.action.scrollDownHover",CB="editor.action.scrollLeftHover",xB="editor.action.scrollRightHover",LB="editor.action.pageUpHover",IB="editor.action.pageDownHover",kB="editor.action.goToTopHover",DB="editor.action.goToBottomHover",tw="editor.action.increaseHoverVerbosityLevel",EB=w({key:"increaseHoverVerbosityLevel",comment:["Label for action that will increase the hover verbosity level."]},"Increase Hover Verbosity Level"),iw="editor.action.decreaseHoverVerbosityLevel",PB=w({key:"decreaseHoverVerbosityLevel",comment:["Label for action that will decrease the hover verbosity level."]},"Decrease Hover Verbosity Level"),lM="editor.action.inlineSuggest.commit",cM="editor.action.inlineSuggest.showPrevious",dM="editor.action.inlineSuggest.showNext";var Q0=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Yo=function(o,e){return function(t,i){e(t,i,o)}},Ym;let ES=class extends Be{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Ys(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=Zi(this,n=>{var c,d;const s=(c=this.model.read(n))==null?void 0:c.primaryGhostText.read(n);if(!this.alwaysShowToolbar.read(n)||!s||s.parts.length===0)return this.sessionPosition=void 0,null;const r=s.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==s.lineNumber&&(this.sessionPosition=void 0);const a=new ut(s.lineNumber,Math.min(r,((d=this.sessionPosition)==null?void 0:d.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Lp((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=GD((d,u)=>{const f=u.add(this.instantiationService.createInstance(Xu,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands));return e.addContentWidget(f),u.add(gn(()=>e.removeContentWidget(f))),u.add(Sn(m=>{this.position.read(m)&&r.lastTriggerKind.read(m)!==ja.Explicit&&r.triggerExplicitly()})),f}),c=Tb(this,(d,u)=>!!this.position.read(d)||!!u);s.add(Sn(d=>{c.read(d)&&a.read(d)}))}))}};ES=Q0([Yo(2,qt)],ES);const TB=Wn("inline-suggestion-hints-next",Ot.chevronRight,w("parameterHintsNextIcon","Icon for show next parameter hint.")),MB=Wn("inline-suggestion-hints-previous",Ot.chevronLeft,w("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var Vl;let Xu=(Vl=class extends Be{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new Fu(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let r=t;return s&&(r=w({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",t,s.getLabel())),n.tooltip=r,n}constructor(e,t,i,n,s,r,a,c,d,u,f){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=n,this._suggestionCount=s,this._extraCommands=r,this._commandService=a,this.keybindingService=d,this._contextKeyService=u,this._menuService=f,this.id=`InlineSuggestionHintsContentWidget${Ym.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Jo("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Jo("div@toolBar")]),this.previousAction=this.createCommandAction(cM,w("previous","Previous"),Wi.asClassName(MB)),this.availableSuggestionCountAction=new Fu("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(dM,w("next","Next"),Wi.asClassName(TB)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(Ye.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new ts(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new ts(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(c.createInstance(PS,this.nodes.toolBar,Ye.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:m=>m.startsWith("primary")},actionViewItemProvider:(m,v)=>{if(m instanceof Hu)return c.createInstance(RB,m,void 0);if(m===this.availableSuggestionCountAction){const _=new NB(void 0,m,{label:!0,icon:!1});return _.setClass("availableSuggestionCount"),_}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(m=>{Ym._dropDownVisible=m})),this._register(Sn(m=>{this._position.read(m),this.editor.layoutContentWidget(this)})),this._register(Sn(m=>{const v=this._suggestionCount.read(m),_=this._currentSuggestionIdx.read(m);v!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${_+1}/${v}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),v!==void 0&&v>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(Sn(m=>{const _=this._extraCommands.read(m).map(y=>({class:void 0,id:y.id,enabled:!0,tooltip:y.tooltip||"",label:y.title,run:S=>this._commandService.executeCommand(y.id)}));for(const[y,S]of this.inlineCompletionsActionsMenus.getActions())for(const D of S)D instanceof Hu&&_.push(D);_.length>0&&_.unshift(new kf),this.toolBar.setAdditionalSecondaryActions(_)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},Ym=Vl,Vl._dropDownVisible=!1,Vl.id=0,Vl);Xu=Ym=Q0([Yo(6,ls),Yo(7,qt),Yo(8,Zn),Yo(9,Ri),Yo(10,nh)],Xu);class NB extends Ny{constructor(){super(...arguments),this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}}let RB=class extends $D{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Jo("div.keybinding").root;this._register(new a0(t,l0,{disableTitle:!0,...qD})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},PS=class extends KD{constructor(e,t,i,n,s,r,a,c,d){super(e,{resetMenu:t,...i},n,s,r,a,c,d),this.menuId=t,this.options2=i,this.menuService=n,this.contextKeyService=s,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){var i,n,s,r,a,c,d;const e=[],t=[];f0(this.menu,(i=this.options2)==null?void 0:i.menuOptions,{primary:e,secondary:t},(s=(n=this.options2)==null?void 0:n.toolbarOptions)==null?void 0:s.primaryGroup,(a=(r=this.options2)==null?void 0:r.toolbarOptions)==null?void 0:a.shouldInlineSubmenu,(d=(c=this.options2)==null?void 0:c.toolbarOptions)==null?void 0:d.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){ua(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){ua(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};PS=Q0([Yo(3,nh),Yo(4,Ri),Yo(5,lg),Yo(6,Zn),Yo(7,ls),Yo(8,Nr)],PS);function nw(o,e,t){const i=Ws(o);return!(e<i.left||e>i.left+i.width||t<i.top||t>i.top+i.height)}let AB=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class hM extends Be{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new ti),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new ts(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new ts(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new ts(()=>this._triggerLoadingMessage(),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t=!0){this._state=e,t&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=IA(e=>this._computer.computeAsync(e)),(async()=>{try{for await(const e of this._asyncIterable)e&&(this._result.push(e),this._fireResult());this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0)}catch(e){on(e)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){this._state===3&&this._setState(4)}_fireResult(){if(this._state===1||this._state===2)return;const e=this._state===0,t=this._state===4;this._onResult.fire(new AB(this._result.slice(0),e,t))}start(e){if(e===0)this._state===0&&(this._setState(1),this._firstWaitScheduler.schedule(this._firstWaitTime),this._loadingMessageScheduler.schedule(this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(),this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break;case 2:this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break}}cancel(){this._firstWaitScheduler.cancel(),this._secondWaitScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._setState(0,!1)}}class e1{constructor(){this._onDidWillResize=new ti,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new ti,this.onDidResize=this._onDidResize.event,this._sashListener=new Oe,this._size=new an(0,0),this._minSize=new an(0,0),this._maxSize=new an(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new Uh(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new Uh(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new Uh(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:CL.North}),this._southSash=new Uh(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:CL.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let e,t=0,i=0;this._sashListener.add(es.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{e===void 0&&(this._onDidWillResize.fire(),e=this._size,t=0,i=0)})),this._sashListener.add(es.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{e!==void 0&&(e=void 0,t=0,i=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(n=>{e&&(i=n.currentX-n.startX,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(n=>{e&&(i=-(n.currentX-n.startX),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(n=>{e&&(t=-(n.currentY-n.startY),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(n=>{e&&(t=n.currentY-n.startY,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(es.any(this._eastSash.onDidReset,this._westSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(es.any(this._northSash.onDidReset,this._southSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(e,t,i,n){this._northSash.state=e?3:0,this._eastSash.state=t?3:0,this._southSash.state=i?3:0,this._westSash.state=n?3:0}layout(e=this.size.height,t=this.size.width){const{height:i,width:n}=this._minSize,{height:s,width:r}=this._maxSize;e=Math.max(i,Math.min(s,e)),t=Math.max(n,Math.min(r,t));const a=new an(t,e);an.equals(a,this._size)||(this.domNode.style.height=e+"px",this.domNode.style.width=t+"px",this._size=a,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(e){this._maxSize=e}get maxSize(){return this._maxSize}set minSize(e){this._minSize=e}get minSize(){return this._minSize}set preferredSize(e){this._preferredSize=e}get preferredSize(){return this._preferredSize}}const OB=30,FB=24;class HB extends Be{constructor(e,t=new an(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new e1),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=an.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(i=>{this._resize(new an(i.dimension.width,i.dimension.height)),i.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){var e;return(e=this._contentPosition)!=null&&e.position?ut.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:Ws(t).top+i.top-OB}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=Ws(t),s=Ip(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-FB}_findPositionPreference(e,t){const i=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),n=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),s=Math.min(Math.max(n,i),e),r=Math.min(e,s);let a;return this._editor.getOption(60).above?a=r<=n?1:2:a=r<=i?2:1,a===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),a}_resize(e){this._resizableNode.layout(e.height,e.width)}}var WB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},um=function(o,e){return function(t,i){e(t,i,o)}},Ur;const EI=30,BB=6;var jl;let TS=(jl=class extends HB{get isVisibleFromKeyboard(){var e;return((e=this._renderedHover)==null?void 0:e.source)===1}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}constructor(e,t,i,n,s){const r=e.getOption(67)+8,a=150,c=new an(a,r);super(e,c),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new ZD),this._onDidResize=this._register(new ti),this.onDidResize=this._onDidResize.event,this._minimumSize=c,this._hoverVisibleKey=M.hoverVisible.bindTo(t),this._hoverFocusedKey=M.hoverFocused.bindTo(t),Qe(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(u=>{u.hasChanged(50)&&this._updateFont()}));const d=this._register(Nu(this._resizableNode.domNode));this._register(d.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(d.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}dispose(){var e;super.dispose(),(e=this._renderedHover)==null||e.dispose(),this._editor.removeContentWidget(this)}getId(){return Ur.ID}static _applyDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.width=n,e.style.height=s}_setContentsDomNodeDimensions(e,t){const i=this._hover.contentsDomNode;return Ur._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return Ur._applyDimensions(i,e,t)}_setHoverWidgetDimensions(e,t){this._setContentsDomNodeDimensions(e,t),this._setContainerDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.maxWidth=n,e.style.maxHeight=s}_setHoverWidgetMaxDimensions(e,t){Ur._applyMaxDimensions(this._hover.contentsDomNode,e,t),Ur._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none");const t=e.width,i=e.height;this._setHoverWidgetDimensions(t,i)}_updateResizableNodeMaxDimensions(){const e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new an(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){Ur._lastDimensions=new an(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){var t;const e=(t=this._renderedHover)==null?void 0:t.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){const e=this._findAvailableSpaceVertically();if(!e)return;let t=BB;return Array.from(this._hover.contentsDomNode.children).forEach(i=>{t+=i.clientHeight}),Math.min(e,t)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;const e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth-2;return e||this._hover.containerDomNode.clientWidth<t?Ip(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth+2}isMouseGettingCloser(e,t){if(!this._renderedHover)return!1;if(this._renderedHover.initialMousePosX===void 0||this._renderedHover.initialMousePosY===void 0)return this._renderedHover.initialMousePosX=e,this._renderedHover.initialMousePosY=t,!1;const i=Ws(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=PI(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,i.left,i.top,i.width,i.height));const n=PI(e,t,i.left,i.top,i.width,i.height);return n>this._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,n),!0)}_setRenderedHover(e){var t;(t=this._renderedHover)==null||t.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){const{fontSize:e,lineHeight:t}=this._editor.getOption(50),i=this._hover.contentsDomNode;i.style.fontSize=`${e}px`,i.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(s=>this._editor.applyFontInfo(s))}_updateContent(e){const t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const e=Math.max(this._editor.getLayoutInfo().height/4,250,Ur._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,Ur._lastDimensions.width);this._setHoverWidgetMaxDimensions(t,e)}_render(e){this._setRenderedHover(e),this._updateFont(),this._updateContent(e.domNode),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){return this._renderedHover?{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}:null}show(e){var r;if(!this._editor||!this._editor.hasModel())return;this._render(e);const t=$h(this._hover.containerDomNode),i=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,i)??1,this.onContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();const s=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&kA(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),((r=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))==null?void 0:r.getAriaLabel())??"");s&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+s)}hide(){if(!this._renderedHover)return;const e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new an(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){const e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto")}setMinimumDimensions(e){this._minimumSize=new an(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new an(e,this._minimumSize.height)}onContentsChanged(){var n;this._removeConstraintsRenderNormally();const e=this._hover.containerDomNode;let t=$h(e),i=$o(e);if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=$h(e),i=$o(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),(n=this._renderedHover)!=null&&n.showAtPosition){const s=$h(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(s,this._renderedHover.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-EI})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+EI})}pageUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}},Ur=jl,jl.ID="editor.contrib.resizableContentHoverWidget",jl._lastDimensions=new an(0,0),jl);TS=Ur=WB([um(1,Ri),um(2,pn),um(3,Mb),um(4,Zn)],TS);function PI(o,e,t,i,n,s){const r=t+n/2,a=i+s/2,c=Math.max(Math.abs(o-r)-n/2,0),d=Math.max(Math.abs(e-a)-s/2,0);return Math.sqrt(c*c+d*d)}class T_{get anchor(){return this._anchor}set anchor(e){this._anchor=e}get shouldFocus(){return this._shouldFocus}set shouldFocus(e){this._shouldFocus=e}get source(){return this._source}set source(e){this._source=e}get insistOnKeepingHoverVisible(){return this._insistOnKeepingHoverVisible}set insistOnKeepingHoverVisible(e){this._insistOnKeepingHoverVisible=e}constructor(e,t){this._editor=e,this._participants=t,this._anchor=null,this._shouldFocus=!1,this._source=0,this._insistOnKeepingHoverVisible=!1}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];const i=e.getModel(),n=t.range.startLineNumber;if(n>i.getLineCount())return[];const s=i.getLineMaxColumn(n);return e.getLineDecorations(n).filter(r=>{if(r.options.isWholeLine)return!0;const a=r.range.startLineNumber===n?r.range.startColumn:1,c=r.range.endLineNumber===n?r.range.endColumn:s;if(r.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>c)return!1}else if(a>t.range.startColumn||t.range.endColumn>c)return!1;return!0})}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return Ir.EMPTY;const i=T_._getLineDecorations(this._editor,t);return Ir.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):Ir.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=T_._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return Ka(t)}}class uM{constructor(e,t,i){this.anchor=e,this.hoverParts=t,this.isComplete=i}filter(e){const t=this.hoverParts.filter(i=>i.isValidForHoverAnchor(e));return t.length===this.hoverParts.length?this:new zB(this,this.anchor,t,this.isComplete)}}class zB extends uM{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}var VB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jB=function(o,e){return function(t,i){e(t,i,o)}};const TI=rt;let M_=class extends Be{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this.actions=[],this._hasContent=!1,this.hoverElement=TI("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=Qe(this.hoverElement,TI("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const n=this._register(DA.render(this.actionsElement,e,i));return this.actions.push(n),n}append(e){const t=Qe(this.actionsElement,e);return this._hasContent=!0,t}};M_=VB([jB(0,Zn)],M_);class UB{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function $B(o,e,t,i,n){const s=await Promise.resolve(o.provideHover(t,i,n)).catch(jn);if(!(!s||!qB(s)))return new UB(o,s,e)}function t1(o,e,t,i,n=!1){const r=o.ordered(e,n).map((a,c)=>$B(a,c,e,t,i));return Ir.fromPromises(r).coalesce()}function gM(o,e,t,i,n=!1){return t1(o,e,t,i,n).map(s=>s.hover).toPromise()}Us("_executeHoverProvider",(o,e,t)=>{const i=o.get(gt);return gM(i.hoverProvider,e,t,ii.None)});Us("_executeHoverProvider_recursive",(o,e,t)=>{const i=o.get(gt);return gM(i.hoverProvider,e,t,ii.None,!0)});function qB(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}var KB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},vc=function(o,e){return function(t,i){e(t,i,o)}};const Xh=rt,GB=Wn("hover-increase-verbosity",Ot.add,w("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),ZB=Wn("hover-decrease-verbosity",Ot.remove,w("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class er{constructor(e,t,i,n,s,r=void 0){this.owner=e,this.range=t,this.contents=i,this.isBeforeContent=n,this.ordinal=s,this.source=r}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}class fM{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case Ao.Increase:return this.hover.canIncreaseVerbosity??!1;case Ao.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let Uf=class{constructor(e,t,i,n,s,r,a,c){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=n,this._languageFeaturesService=s,this._keybindingService=r,this._hoverService=a,this._commandService=c,this.hoverOrdinal=3}createLoadingMessage(e){return new er(this,e.range,[new Is().appendText(w("modesContentHover.loading","Loading..."))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];let a=1e3;const c=i.getLineLength(n),d=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),u=this._editor.getOption(118),f=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:d});let m=!1;u>=0&&c>u&&e.range.startColumn>=u&&(m=!0,r.push(new er(this,e.range,[{value:w("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!m&&typeof f=="number"&&c>=f&&r.push(new er(this,e.range,[{value:w("too many characters","Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let v=!1;for(const _ of t){const y=_.range.startLineNumber===n?_.range.startColumn:1,S=_.range.endLineNumber===n?_.range.endColumn:s,D=_.options.hoverMessage;if(!D||Df(D))continue;_.options.beforeContentClassName&&(v=!0);const E=new H(e.range.startLineNumber,y,e.range.startLineNumber,S);r.push(new er(this,E,XD(D),v,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return Ir.EMPTY;const n=this._editor.getModel(),s=this._languageFeaturesService.hoverProvider;return s.has(n)?this._getMarkdownHovers(s,n,e,i):Ir.EMPTY}_getMarkdownHovers(e,t,i,n){const s=i.range.getStartPosition();return t1(e,t,s,n).filter(c=>!Df(c.hover.contents)).map(c=>{const d=c.hover.range?H.lift(c.hover.range):i.range,u=new fM(c.hover,c.provider,s);return new er(this,d,c.hover.contents,!1,c.ordinal,u)})}renderHoverParts(e,t){return this._renderedHoverParts=new XB(t,e.fragment,this,this._editor,this._languageService,this._openerService,this._commandService,this._keybindingService,this._hoverService,this._configurationService,e.onContentsChanged),this._renderedHoverParts}updateMarkdownHoverVerbosityLevel(e,t,i){var n;return Promise.resolve((n=this._renderedHoverParts)==null?void 0:n.updateMarkdownHoverPartVerbosityLevel(e,t,i))}};Uf=KB([vc(1,Rr),vc(2,Mr),vc(3,pn),vc(4,gt),vc(5,Zn),vc(6,kp),vc(7,ls)],Uf);class gm{constructor(e,t,i){this.hoverPart=e,this.hoverElement=t,this.disposables=i}dispose(){this.disposables.dispose()}}class XB{constructor(e,t,i,n,s,r,a,c,d,u,f){this._hoverParticipant=i,this._editor=n,this._languageService=s,this._openerService=r,this._commandService=a,this._keybindingService=c,this._hoverService=d,this._configurationService=u,this._onFinishedRendering=f,this._ongoingHoverOperations=new Map,this._disposables=new Oe,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(gn(()=>{this.renderedHoverParts.forEach(m=>{m.dispose()}),this._ongoingHoverOperations.forEach(m=>{m.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort(Dp(n=>n.ordinal,Nb)),e.map(n=>{const s=this._renderHoverPart(n,i);return t.appendChild(s.hoverElement),s})}_renderHoverPart(e,t){const i=this._renderMarkdownHover(e,t),n=i.hoverElement,s=e.source,r=new Oe;if(r.add(i),!s)return new gm(e,n,r);const a=s.supportsVerbosityAction(Ao.Increase),c=s.supportsVerbosityAction(Ao.Decrease);if(!a&&!c)return new gm(e,n,r);const d=Xh("div.verbosity-actions");return n.prepend(d),r.add(this._renderHoverExpansionAction(d,Ao.Increase,a)),r.add(this._renderHoverExpansionAction(d,Ao.Decrease,c)),new gm(e,n,r)}_renderMarkdownHover(e,t){return pM(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const n=new Oe,s=t===Ao.Increase,r=Qe(e,Xh(Wi.asCSSSelector(s?GB:ZB)));r.tabIndex=0;const a=new EA("mouse",!1,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(n.add(this._hoverService.setupManagedHover(a,r,JB(this._keybindingService,t))),!i)return r.classList.add("disabled"),n;r.classList.add("enabled");const c=()=>this._commandService.executeCommand(t===Ao.Increase?tw:iw);return n.add(new PA(r,c)),n.add(new TA(r,c,[3,10])),n}async updateMarkdownHoverPartVerbosityLevel(e,t,i=!0){const n=this._editor.getModel();if(!n)return;const s=this._getRenderedHoverPartAtIndex(t),r=s==null?void 0:s.hoverPart.source;if(!s||!(r!=null&&r.supportsVerbosityAction(e)))return;const a=await this._fetchHover(r,n,e);if(!a)return;const c=new fM(a,r.hoverProvider,r.hoverPosition),d=s.hoverPart,u=new er(this._hoverParticipant,d.range,a.contents,d.isBeforeContent,d.ordinal,c),f=this._renderHoverPart(u,this._onFinishedRendering);return this._replaceRenderedHoverPartAtIndex(t,f,u),i&&this._focusOnHoverPartWithIndex(t),{hoverPart:u,hoverElement:f.hoverElement}}async _fetchHover(e,t,i){let n=i===Ao.Increase?1:-1;const s=e.hoverProvider,r=this._ongoingHoverOperations.get(s);r&&(r.tokenSource.cancel(),n+=r.verbosityDelta);const a=new gs;this._ongoingHoverOperations.set(s,{verbosityDelta:n,tokenSource:a});const c={verbosityRequest:{verbosityDelta:n,previousHover:e.hover}};let d;try{d=await Promise.resolve(s.provideHover(t,e.hoverPosition,a.token,c))}catch(u){jn(u)}return a.dispose(),this._ongoingHoverOperations.delete(s),d}_replaceRenderedHoverPartAtIndex(e,t,i){if(e>=this.renderedHoverParts.length||e<0)return;const n=this.renderedHoverParts[e],s=n.hoverElement,r=t.hoverElement,a=Array.from(r.children);s.replaceChildren(...a);const c=new gm(i,s,t.disposables);s.focus(),n.dispose(),this.renderedHoverParts[e]=c}_focusOnHoverPartWithIndex(e){this.renderedHoverParts[e].hoverElement.focus()}_getRenderedHoverPartAtIndex(e){return this.renderedHoverParts[e]}dispose(){this._disposables.dispose()}}function YB(o,e,t,i,n){e.sort(Dp(r=>r.ordinal,Nb));const s=[];for(const r of e)s.push(pM(t,r,i,n,o.onContentsChanged));return new Zd(s)}function pM(o,e,t,i,n){const s=new Oe,r=Xh("div.hover-row"),a=Xh("div.hover-row-contents");r.appendChild(a);const c=e.contents;for(const u of c){if(Df(u))continue;const f=Xh("div.markdown-hover"),m=Qe(f,Xh("div.hover-contents")),v=s.add(new ug({editor:o},t,i));s.add(v.onDidRenderAsync(()=>{m.className="hover-contents code-hover-contents",n()}));const _=s.add(v.render(u));m.appendChild(_.element),a.appendChild(f)}return{hoverPart:e,hoverElement:r,dispose(){s.dispose()}}}function JB(o,e){switch(e){case Ao.Increase:{const t=o.lookupKeybinding(tw);return t?w("increaseVerbosityWithKb","Increase Hover Verbosity ({0})",t.getLabel()):w("increaseVerbosity","Increase Hover Verbosity")}case Ao.Decrease:{const t=o.lookupKeybinding(iw);return t?w("decreaseVerbosityWithKb","Decrease Hover Verbosity ({0})",t.getLabel()):w("decreaseVerbosity","Decrease Hover Verbosity")}}}function MS(o,e){return!!o[e]}class iy{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=MS(e.event,t.triggerModifier),this.hasSideBySideModifier=MS(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class MI{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=MS(e,t.triggerModifier)}}class fm{constructor(e,t,i,n){this.triggerKey=e,this.triggerModifier=t,this.triggerSideBySideKey=i,this.triggerSideBySideModifier=n}equals(e){return this.triggerKey===e.triggerKey&&this.triggerModifier===e.triggerModifier&&this.triggerSideBySideKey===e.triggerSideBySideKey&&this.triggerSideBySideModifier===e.triggerSideBySideModifier}}function NI(o){return o==="altKey"?ga?new fm(57,"metaKey",6,"altKey"):new fm(5,"ctrlKey",6,"altKey"):ga?new fm(6,"altKey",57,"metaKey"):new fm(6,"altKey",5,"ctrlKey")}class sw extends Be{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new ti),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new ti),this.onExecute=this._onExecute.event,this._onCancel=this._register(new ti),this.onCancel=this._onCancel.event,this._editor=e,this._extractLineNumberFromMouseEvent=(t==null?void 0:t.extractLineNumberFromMouseEvent)??(i=>i.target.position?i.target.position.lineNumber:0),this._opts=NI(this._editor.getOption(78)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(i=>{if(i.hasChanged(78)){const n=NI(this._editor.getOption(78));if(this._opts.equals(n))return;this._opts=n,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(i=>this._onEditorMouseMove(new iy(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new iy(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new iy(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new MI(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new MI(i,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(i=>this._onDidChangeCursorSelection(i))),this._register(this._editor.onDidChangeModel(i=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(i=>{(i.scrollTopChanged||i.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){const t=this._extractLineNumberFromMouseEvent(e);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}class mM{constructor(e,t){this.range=e,this.direction=t}}class i1{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new i1(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}async resolve(e){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,e.isCancellationRequested?void 0:this.resolve(e);this._isResolved||(this._currentResolve=this._doResolve(e).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(e){try{const t=await Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=(t==null?void 0:t.tooltip)??this.hint.tooltip,this.hint.label=(t==null?void 0:t.label)??this.hint.label,this.hint.textEdits=(t==null?void 0:t.textEdits)??this.hint.textEdits,this._isResolved=!0}catch(t){jn(t),this._isResolved=!1}}}const nu=class nu{static async create(e,t,i,n){const s=[],r=e.ordered(t).reverse().map(a=>i.map(async c=>{try{const d=await a.provideInlayHints(t,c,n);(d!=null&&d.hints.length||a.onDidChangeInlayHints)&&s.push([d??nu._emptyInlayHintList,a])}catch(d){jn(d)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new kb;return new nu(i,s,t)}constructor(e,t,i){this._disposables=new Oe,this.ranges=e,this.provider=new Set;const n=[];for(const[s,r]of t){this._disposables.add(s),this.provider.add(r);for(const a of s.hints){const c=i.validatePosition(a.position);let d="before";const u=nu._getRangeAtPosition(i,c);let f;u.getStartPosition().isBefore(c)?(f=H.fromPositions(u.getStartPosition(),c),d="after"):(f=H.fromPositions(c,u.getEndPosition()),d="before"),n.push(new i1(a,new mM(f,d),r))}}this.items=n.sort((s,r)=>ut.compare(s.hint.position,r.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,n=e.getWordAtPosition(t);if(n)return new H(i,n.startColumn,i,n.endColumn);e.tokenization.tokenizeIfCheap(i);const s=e.tokenization.getLineTokens(i),r=t.column-1,a=s.findTokenIndexAtOffset(r);let c=s.getStartOffset(a),d=s.getEndOffset(a);return d-c===1&&(c===r&&a>1?(c=s.getStartOffset(a-1),d=s.getEndOffset(a-1)):d===r&&a<s.getCount()-1&&(c=s.getStartOffset(a+1),d=s.getEndOffset(a+1))),new H(i,c+1,i,d+1)}};nu._emptyInlayHintList=Object.freeze({dispose(){},hints:[]});let N_=nu;function QB(o){return nn.from({scheme:Fs.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()}var ez=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ia=function(o,e){return function(t,i){e(t,i,o)}};let ar=class extends MA{constructor(e,t,i,n,s,r,a,c,d,u,f,m,v){super(e,{...n.getRawOptions(),overflowWidgetsDomNode:n.getOverflowWidgetsDomNode()},i,s,r,a,c,d,u,f,m,v),this._parentEditor=n,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(n.onDidChangeConfiguration(_=>this._onParentConfigurationChanged(_)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){p0(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};ar=ez([Ia(4,qt),Ia(5,Un),Ia(6,ls),Ia(7,Ri),Ia(8,lr),Ia(9,Rs),Ia(10,Mb),Ia(11,cs),Ia(12,gt)],ar);const RI=new ui(new Ou(0,122,204)),tz={showArrow:!0,showFrame:!0,className:"",frameColor:RI,arrowColor:RI,keepEditorSelection:!1},iz="vs.editor.contrib.zoneWidget";class nz{constructor(e,t,i,n,s,r,a,c){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=n,this.showInHiddenAreas=a,this.ordinal=c,this._onDomNodeTop=s,this._onComputedHeight=r}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class sz{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}const Wv=class Wv{constructor(e){this._editor=e,this._ruleName=Wv._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),xL(this._ruleName)}set color(e){this._color!==e&&(this._color=e,this._updateStyle())}set height(e){this._height!==e&&(this._height=e,this._updateStyle())}_updateStyle(){xL(this._ruleName),AA(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:H.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};Wv._IdGenerator=new RA(".arrow-decoration-");let NS=Wv;class oz{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Oe,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=NA(t),p0(this.options,tz,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(i=>{const n=this._getWidth(i);this.domNode.style.width=n+"px",this.domNode.style.left=this._getLeft(i)+"px",this._onWidth(n)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new NS(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){const e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){var t;if(this.domNode.style.height=`${e}px`,this.container){const i=e-this._decoratingElementsHeight();this.container.style.height=`${i}px`;const n=this.editor.getLayoutInfo();this._doLayout(i,this._getWidth(n))}(t=this._resizeSash)==null||t.layout()}get position(){const e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){const i=H.isIRange(e)?H.lift(e):H.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:pi.EMPTY}])}hide(){var e;this._viewZone&&(this.editor.changeViewZones(t=>{this._viewZone&&t.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),(e=this._arrow)==null||e.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const e=this.editor.getOption(67);let t=0;if(this.options.showArrow){const i=Math.round(e/3);t+=2*i}if(this.options.showFrame){const i=Math.round(e/9);t+=2*i}return t}_showImpl(e,t){const i=e.getStartPosition(),n=this.editor.getLayoutInfo(),s=this._getWidth(n);this.domNode.style.width=`${s}px`,this.domNode.style.left=this._getLeft(n)+"px";const r=document.createElement("div");r.style.overflow="hidden";const a=this.editor.getOption(67);if(!this.options.allowUnlimitedHeight){const m=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,m)}let c=0,d=0;if(this._arrow&&this.options.showArrow&&(c=Math.round(a/3),this._arrow.height=c,this._arrow.show(i)),this.options.showFrame&&(d=Math.round(a/9)),this.editor.changeViewZones(m=>{this._viewZone&&m.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new nz(r,i.lineNumber,i.column,t,v=>this._onViewZoneTop(v),v=>this._onViewZoneHeight(v),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=m.addZone(this._viewZone),this._overlayWidget=new sz(iz+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const m=this.options.frameWidth?this.options.frameWidth:d;this.container.style.borderTopWidth=m+"px",this.container.style.borderBottomWidth=m+"px"}const u=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=c+"px",this.container.style.height=u+"px",this.container.style.overflow="hidden"),this._doLayout(u,s),this.options.keepEditorSelection||this.editor.setSelection(e);const f=this.editor.getModel();if(f){const m=f.validateRange(new H(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(m,m.startLineNumber===f.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e){this._viewZone&&this._viewZone.heightInLines!==e&&this.editor.changeViewZones(t=>{this._viewZone&&(this._viewZone.heightInLines=e,t.layoutZone(this._viewZone.id))})}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new Uh(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let e;this._disposables.add(this._resizeSash.onDidStart(t=>{this._viewZone&&(e={startY:t.startY,heightInLines:this._viewZone.heightInLines})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{e=void 0})),this._disposables.add(this._resizeSash.onDidChange(t=>{if(e){const i=(t.currentY-e.startY)/this.editor.getOption(67),n=i<0?Math.ceil(i):Math.floor(i),s=e.heightInLines+n;s>5&&s<35&&this._relayout(s)}}))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}}var _M=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},vM=function(o,e){return function(t,i){e(t,i,o)}};const bM=sl("IPeekViewService");ol(bM,class{constructor(){this._widgets=new Map}addExclusiveWidget(o,e){const t=this._widgets.get(o);t&&(t.listener.dispose(),t.widget.dispose());const i=()=>{const n=this._widgets.get(o);n&&n.widget===e&&(n.listener.dispose(),this._widgets.delete(o))};this._widgets.set(o,{widget:e,listener:e.onDidClose(i)})}},1);var Bs;(function(o){o.inPeekEditor=new yi("inReferenceSearchEditor",!0,w("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(Bs||(Bs={}));var Su;let R_=(Su=class{constructor(e,t){e instanceof ar&&Bs.inPeekEditor.bindTo(t)}dispose(){}},Su.ID="editor.contrib.referenceController",Su);R_=_M([vM(1,Ri)],R_);oi(R_.ID,R_,0);function rz(o){const e=o.get(Un).getFocusedCodeEditor();return e instanceof ar?e.getParentEditor():e}const az={headerBackgroundColor:ui.white,primaryHeadingColor:ui.fromHex("#333333"),secondaryHeadingColor:ui.fromHex("#6c6c6cb3")};let A_=class extends oz{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new ti,this.onDidClose=this._onDidClose.event,p0(this.options,az,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(e){const t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();const e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=rt(".head"),this._bodyElement=rt(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=rt(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Za(this._titleElement,"click",s=>this._onTitleClick(s))),Qe(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=rt("span.filename"),this._secondaryHeading=rt("span.dirname"),this._metaHeading=rt("span.meta"),Qe(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=rt(".peekview-actions");Qe(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new xf(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new Fu("peekview.close",w("label.close","Close"),Wi.asClassName(Ot.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:OA.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:la(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Qo(this._metaHeading)):mo(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}const i=Math.ceil(this.editor.getOption(67)*1.2),n=Math.round(e-(i+2));this._doLayoutHead(i,t),this._doLayoutBody(n,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};A_=_M([vM(2,qt)],A_);const lz=at("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:ui.black,hcLight:ui.white},w("peekViewTitleBackground","Background color of the peek view title area.")),wM=at("peekViewTitleLabel.foreground",{dark:ui.white,light:ui.black,hcDark:ui.white,hcLight:Ep},w("peekViewTitleForeground","Color of the peek view title.")),yM=at("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},w("peekViewTitleInfoForeground","Color of the peek view title info.")),cz=at("peekView.border",{dark:Ry,light:Ry,hcDark:Ga,hcLight:Ga},w("peekViewBorder","Color of the peek view borders and arrow.")),dz=at("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:ui.black,hcLight:ui.white},w("peekViewResultsBackground","Background color of the peek view result list."));at("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:ui.white,hcLight:Ep},w("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));at("peekViewResult.fileForeground",{dark:ui.white,light:"#1E1E1E",hcDark:ui.white,hcLight:Ep},w("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));at("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},w("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));at("peekViewResult.selectionForeground",{dark:ui.white,light:"#6C6C6C",hcDark:ui.white,hcLight:Ep},w("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const SM=at("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:ui.black,hcLight:ui.white},w("peekViewEditorBackground","Background color of the peek view editor."));at("peekViewEditorGutter.background",SM,w("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));at("peekViewEditorStickyScroll.background",SM,w("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));at("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},w("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));at("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},w("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));at("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Hd,hcLight:Hd},w("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class rc{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=FA.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){var t;const e=(t=this.parent.getPreview(this))==null?void 0:t.preview(this.range);return e?w({key:"aria.oneReference.preview",comment:["Placeholders are: 0: filename, 1:line number, 2: column number, 3: preview snippet of source code"]},"{0} in {1} on line {2} at column {3}",e.value,fa(this.uri),this.range.startLineNumber,this.range.startColumn):w("aria.oneReference","in {0} on line {1} at column {2}",fa(this.uri),this.range.startLineNumber,this.range.startColumn)}}class hz{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){const i=this._modelReference.object.textEditorModel;if(!i)return;const{startLineNumber:n,startColumn:s,endLineNumber:r,endColumn:a}=e,c=i.getWordUntilPosition({lineNumber:n,column:s-t}),d=new H(n,c.startColumn,n,s),u=new H(r,a,r,1073741824),f=i.getValueInRange(d).replace(/^\s+/,""),m=i.getValueInRange(e),v=i.getValueInRange(u).replace(/\s+$/,"");return{value:f+m+v,highlight:{start:f.length,end:f.length+m.length}}}}class $f{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new tc}dispose(){Ds(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?w("aria.fileReferences.1","1 symbol in {0}, full path {1}",fa(this.uri),this.uri.fsPath):w("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,fa(this.uri),this.uri.fsPath)}async resolve(e){if(this._previews.size!==0)return this;for(const t of this.children)if(!this._previews.has(t.uri))try{const i=await e.createModelReference(t.uri);this._previews.set(t.uri,new hz(i))}catch(i){on(i)}return this}}class no{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new ti,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(no._compareReferences);let n;for(const s of e)if((!n||!LL.isEqual(n.uri,s.uri,!0))&&(n=new $f(this,s.uri),this.groups.push(n)),n.children.length===0||no._compareReferences(s,n.children[n.children.length-1])!==0){const r=new rc(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){Ds(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new no(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?w("aria.result.0","No results found"):this.references.length===1?w("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?w("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):w("aria.result.nm","Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){const{parent:i}=e;let n=i.children.indexOf(e);const s=i.children.length,r=i.parent.groups.length;return r===1||t&&n+1<s||!t&&n>0?(t?n=(n+1)%s:n=(n+s-1)%s,i.children[n]):(n=i.parent.groups.indexOf(i),t?(n=(n+1)%r,i.parent.groups[n].children[0]):(n=(n+r-1)%r,i.parent.groups[n].children[i.parent.groups[n].children.length-1]))}nearestReference(e,t){const i=this.references.map((n,s)=>({idx:s,prefixLen:Pp(n.uri.toString(),e.toString()),offsetDist:Math.abs(n.range.startLineNumber-t.lineNumber)*100+Math.abs(n.range.startColumn-t.column)})).sort((n,s)=>n.prefixLen>s.prefixLen?-1:n.prefixLen<s.prefixLen?1:n.offsetDist<s.offsetDist?-1:n.offsetDist>s.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&H.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return LL.compare(e.uri,t.uri)||H.compareRangesUsingStarts(e.range,t.range)}}var ow=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},rw=function(o,e){return function(t,i){e(t,i,o)}},RS;let AS=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof no||e instanceof $f}getChildren(e){if(e instanceof no)return e.groups;if(e instanceof $f)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};AS=ow([rw(0,Ar)],AS);class uz{getHeight(){return 23}getTemplateId(e){return e instanceof $f?O_.id:F_.id}}let OS=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof rc){const i=(t=e.parent.getPreview(e))==null?void 0:t.preview(e.range);if(i)return i.value}return fa(e.uri)}};OS=ow([rw(0,Zn)],OS);class gz{getId(e){return e instanceof rc?e.id:e.uri}}let FS=class extends Be{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new YD(i,{supportHighlights:!0})),this.badge=new HA(Qe(i,rt(".count")),{},WA),e.appendChild(i)}set(e,t){const i=m0(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(i,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});const n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(w("referencesCount","{0} references",n)):this.badge.setTitleFormat(w("referenceCount","{0} reference",n))}};FS=ow([rw(1,Ef)],FS);var td;let O_=(td=class{constructor(e){this._instantiationService=e,this.templateId=RS.id}renderTemplate(e){return this._instantiationService.createInstance(FS,e)}renderElement(e,t,i){i.set(e.element,Rb(e.filterData))}disposeTemplate(e){e.dispose()}},RS=td,td.id="FileReferencesRenderer",td);O_=RS=ow([rw(0,qt)],O_);class fz extends Be{constructor(e){super(),this.label=this._register(new BA(e))}set(e,t){var n;const i=(n=e.parent.getPreview(e))==null?void 0:n.preview(e.range);if(!i||!i.value)this.label.set(`${fa(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:s,highlight:r}=i;t&&!Pf.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(s,Rb(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(s,[r]))}}}const Bv=class Bv{constructor(){this.templateId=Bv.id}renderTemplate(e){return new fz(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}};Bv.id="OneReferenceRenderer";let F_=Bv;class pz{getWidgetAriaLabel(){return w("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var mz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Lh=function(o,e){return function(t,i){e(t,i,o)}};const zv=class zv{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Oe,this._callOnModelChange=new Oe,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const e=this._editor.getModel();if(e){for(const t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));const t=[],i=[];for(let n=0,s=e.children.length;n<s;n++){const r=e.children[n];this._decorationIgnoreSet.has(r.id)||r.uri.toString()===this._editor.getModel().uri.toString()&&(t.push({range:r.range,options:zv.DecorationOptions}),i.push(n))}this._editor.changeDecorations(n=>{const s=n.deltaDecorations([],t);for(let r=0;r<s.length;r++)this._decorations.set(s[r],e.children[i[r]])})}_onDecorationChanged(){const e=[],t=this._editor.getModel();if(t){for(const[i,n]of this._decorations){const s=t.getDecorationRange(i);if(!s)continue;let r=!1;if(!H.equalsRange(s,n.range)){if(H.spansMultipleLines(s))r=!0;else{const a=n.range.endColumn-n.range.startColumn,c=s.endColumn-s.startColumn;a!==c&&(r=!0)}r?(this._decorationIgnoreSet.add(n.id),e.push(i)):n.range=s}}for(let i=0,n=e.length;i<n;i++)this._decorations.delete(e[i]);this._editor.removeDecorations(e)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}};zv.DecorationOptions=pi.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});let HS=zv;class _z{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(e){let t,i;try{const n=JSON.parse(e);t=n.ratio,i=n.heightInLines}catch{}return{ratio:t||.7,heightInLines:i||18}}}class vz extends jA{}let WS=class extends A_{constructor(e,t,i,n,s,r,a,c,d){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},r),this._defaultTreeKeyboardSupport=t,this.layoutData=i,this._textModelResolverService=s,this._instantiationService=r,this._peekViewService=a,this._uriLabel=c,this._keybindingService=d,this._disposeOnNewModel=new Oe,this._callOnDispose=new Oe,this._onDidSelectReference=new ti,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new an(0,0),this._isClosing=!1,this._applyTheme(n.getColorTheme()),this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}get isClosing(){return this._isClosing}dispose(){this._isClosing=!0,this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),Ds(this._preview),Ds(this._previewNotAvailableMessage),Ds(this._tree),Ds(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(cz)||ui.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(lz)||ui.transparent,primaryHeadingColor:e.getColor(wM),secondaryHeadingColor:e.getColor(yM)})}show(e){super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=Qe(e,rt("div.messages")),mo(this._messageContainer),this._splitView=new zA(e,{orientation:1}),this._previewContainer=Qe(e,rt("div.preview.inline"));const t={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._preview=this._instantiationService.createInstance(ar,this._previewContainer,t,{},this.editor),mo(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(Il,w("missingPreviewMessage","no preview available"),Tf,Il.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=Qe(e,rt("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new pz,keyboardNavigationLabelProvider:this._instantiationService.createInstance(OS),identityProvider:new gz,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:dz}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Za(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(vz,"ReferencesWidget",this._treeContainer,new uz,[this._instantiationService.createInstance(O_),this._instantiationService.createInstance(F_)],this._instantiationService.createInstance(AS),i),this._splitView.addView({onDidChange:es.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},IL.Distribute),this._splitView.addView({onDidChange:es.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:s=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${s}px`,this._tree.layout(this._dim.height,s)}},IL.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));const n=(s,r)=>{s instanceof rc&&(r==="show"&&this._revealReference(s,!1),this._onDidSelectReference.fire({element:s,kind:r,source:"tree"}))};this._disposables.add(this._tree.onDidOpen(s=>{s.sideBySide?n(s.element,"side"):s.editorOptions.pinned?n(s.element,"goto"):n(s.element,"show")})),mo(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new an(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=w("noResults","No results"),Qo(this._messageContainer),Promise.resolve(void 0)):(mo(this._messageContainer),this._decorationsManager=new HS(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{const{event:t,target:i}=e;if(t.detail!==2)return;const n=this._getFocusedReference();n&&this._onDidSelectReference.fire({element:{uri:n.uri,range:i.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),Qo(this._treeContainer),Qo(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();if(e instanceof rc)return e;if(e instanceof $f&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==Fs.inMemory?this.setTitle(VA(e.uri),this._uriLabel.getUriLabel(m0(e.uri))):this.setTitle(w("peekView.alternateTitle","References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));const n=await i;if(!this._model){n.dispose();return}Ds(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=H.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(s.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,r)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};WS=mz([Lh(3,lr),Lh(4,Ar),Lh(5,qt),Lh(6,bM),Lh(7,Ef),Lh(8,Zn)],WS);var bz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ih=function(o,e){return function(t,i){e(t,i,o)}},Jm;const dh=new yi("referenceSearchVisible",!1,w("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));var id;let Xd=(id=class{static get(e){return e.getContribution(Jm.ID)}constructor(e,t,i,n,s,r,a,c){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=n,this._notificationService=s,this._instantiationService=r,this._storageService=a,this._configurationService=c,this._disposables=new Oe,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=dh.bindTo(i)}dispose(){var e,t;this._referenceSearchVisible.reset(),this._disposables.dispose(),(e=this._widget)==null||e.dispose(),(t=this._model)==null||t.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,i){let n;if(this._widget&&(n=this._widget.position),this.closeWidget(),n&&e.containsPosition(n))return;this._peekMode=i,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));const s="peekViewLayout",r=_z.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(WS,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(w("labelLoading","Loading...")),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget?(this._storageService.store(s,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(c=>{const{element:d,kind:u}=c;if(d)switch(u){case"open":(c.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(d,!1,!1);break;case"side":this.openReference(d,!0,!1);break;case"goto":i?this._gotoReference(d,!0):this.openReference(d,!1,!0);break}}));const a=++this._requestIdPool;t.then(c=>{var d;if(a!==this._requestIdPool||!this._widget){c.dispose();return}return(d=this._model)==null||d.dispose(),this._model=c,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(w("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const u=this._editor.getModel().uri,f=new ut(e.startLineNumber,e.startColumn),m=this._model.nearestReference(u,f);if(m)return this._widget.setSelection(m).then(()=>{this._widget&&this._editor.getOption(87)==="editor"&&this._widget.focusOnPreviewEditor()})}})},c=>{this._notificationService.error(c)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const n=this._model.nextOrPreviousReference(i,e),s=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(n),await this._gotoReference(n,!1),s?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){var t,i;(t=this._widget)==null||t.dispose(),(i=this._model)==null||i.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){var n;(n=this._widget)==null||n.hide(),this._ignoreModelChangeEvent=!0;const i=H.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:i,selectionSource:"code.jump",pinned:t}},this._editor).then(s=>{if(this._ignoreModelChangeEvent=!1,!s||!this._widget){this.closeWidget();return}if(this._editor===s)this._widget.show(i),this._widget.focusOnReferenceTree();else{const r=Jm.get(s),a=this._model.clone();this.closeWidget(),s.focus(),r==null||r.toggleWidget(i,us(c=>Promise.resolve(a)),this._peekMode??!1)}},s=>{this._ignoreModelChangeEvent=!1,on(s)})}openReference(e,t,i){t||this.closeWidget();const{uri:n,range:s}=e;this._editorService.openCodeEditor({resource:n,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor,t)}},Jm=id,id.ID="editor.contrib.referencesController",id);Xd=Jm=bz([Ih(2,Ri),Ih(3,Un),Ih(4,Rs),Ih(5,qt),Ih(6,hc),Ih(7,pn)],Xd);function hh(o,e){const t=rz(o);if(!t)return;const i=Xd.get(t);i&&e(i)}_a.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Gn(2089,60),when:le.or(dh,Bs.inPeekEditor),handler(o){hh(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}});_a.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:le.or(dh,Bs.inPeekEditor),handler(o){hh(o,e=>{e.goToNextOrPreviousReference(!0)})}});_a.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:le.or(dh,Bs.inPeekEditor),handler(o){hh(o,e=>{e.goToNextOrPreviousReference(!1)})}});dn.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");dn.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");dn.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");dn.registerCommand("closeReferenceSearch",o=>hh(o,e=>e.closeWidget()));_a.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:le.and(Bs.inPeekEditor,le.not("config.editor.stablePeek"))});_a.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:le.and(dh,le.not("config.editor.stablePeek"),le.or(M.editorTextFocus,UA.negate()))});_a.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:le.and(dh,JD,QD.negate(),eE.negate()),handler(o){var i;const t=(i=o.get(_0).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof rc&&hh(o,n=>n.revealReference(t[0]))}});_a.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:le.and(dh,JD,QD.negate(),eE.negate()),handler(o){var i;const t=(i=o.get(_0).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof rc&&hh(o,n=>n.openReference(t[0],!0,!0))}});dn.registerCommand("openReference",o=>{var i;const t=(i=o.get(_0).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof rc&&hh(o,n=>n.openReference(t[0],!1,!0))});var CM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ug=function(o,e){return function(t,i){e(t,i,o)}};const n1=new yi("hasSymbols",!1,w("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),aw=sl("ISymbolNavigationService");let BS=class{constructor(e,t,i,n){this._editorService=t,this._notificationService=i,this._keybindingService=n,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=n1.bindTo(e)}reset(){var e,t;this._ctxHasSymbols.reset(),(e=this._currentState)==null||e.dispose(),(t=this._currentMessage)==null||t.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1){this.reset();return}this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new zS(this._editorService),n=i.onDidChange(s=>{if(this._ignoreEditorChange)return;const r=this._editorService.getActiveCodeEditor();if(!r)return;const a=r.getModel(),c=r.getPosition();if(!a||!c)return;let d=!1,u=!1;for(const f of t.references)if(d_(f.uri,a.uri))d=!0,u=u||H.containsPosition(f.range,c);else if(d)break;(!d||!u)&&this.reset()});this._currentState=tE(i,n)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:H.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){var i;(i=this._currentMessage)==null||i.dispose();const e=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),t=e?w("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):w("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};BS=CM([Ug(0,Ri),Ug(1,Un),Ug(2,Rs),Ug(3,Zn)],BS);ol(aw,BS,1);bt(new class extends js{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:n1,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(aw).revealNext(e)}});_a.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:n1,primary:9,handler(o){o.get(aw).reset()}});let zS=class{constructor(e){this._listener=new Map,this._disposables=new Oe,this._onDidChange=new ti,this.onDidChange=this._onDidChange.event,this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor,this)),e.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),Ds(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,tE(e.onDidChangeCursorPosition(t=>this._onDidChange.fire({editor:e})),e.onDidChangeModelContent(t=>this._onDidChange.fire({editor:e}))))}_onDidRemoveEditor(e){var t;(t=this._listener.get(e))==null||t.dispose(),this._listener.delete(e)}};zS=CM([Ug(0,Un)],zS);function VS(o,e){return e.uri.scheme===o.uri.scheme?!0:!$A(e.uri,Fs.walkThroughSnippet,Fs.vscodeChatCodeBlock,Fs.vscodeChatCodeCompareBlock)}async function zp(o,e,t,i,n){const r=t.ordered(o,i).map(c=>Promise.resolve(n(c,o,e)).then(void 0,d=>{jn(d)})),a=await Promise.all(r);return Ka(a.flat()).filter(c=>VS(o,c))}function Vp(o,e,t,i,n){return zp(e,t,o,i,(s,r,a)=>s.provideDefinition(r,a,n))}function s1(o,e,t,i,n){return zp(e,t,o,i,(s,r,a)=>s.provideDeclaration(r,a,n))}function o1(o,e,t,i,n){return zp(e,t,o,i,(s,r,a)=>s.provideImplementation(r,a,n))}function r1(o,e,t,i,n){return zp(e,t,o,i,(s,r,a)=>s.provideTypeDefinition(r,a,n))}function jp(o,e,t,i,n,s){return zp(e,t,o,n,async(r,a,c)=>{var f,m;const d=(f=await r.provideReferences(a,c,{includeDeclaration:!0},s))==null?void 0:f.filter(v=>VS(a,v));if(!i||!d||d.length!==2)return d;const u=(m=await r.provideReferences(a,c,{includeDeclaration:!1},s))==null?void 0:m.filter(v=>VS(a,v));return u&&u.length===1?u:d})}async function ba(o){const e=await o(),t=new no(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}Us("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(gt),n=Vp(i.definitionProvider,e,t,!1,ii.None);return ba(()=>n)});Us("_executeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(gt),n=Vp(i.definitionProvider,e,t,!0,ii.None);return ba(()=>n)});Us("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(gt),n=r1(i.typeDefinitionProvider,e,t,!1,ii.None);return ba(()=>n)});Us("_executeTypeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(gt),n=r1(i.typeDefinitionProvider,e,t,!0,ii.None);return ba(()=>n)});Us("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(gt),n=s1(i.declarationProvider,e,t,!1,ii.None);return ba(()=>n)});Us("_executeDeclarationProvider_recursive",(o,e,t)=>{const i=o.get(gt),n=s1(i.declarationProvider,e,t,!0,ii.None);return ba(()=>n)});Us("_executeReferenceProvider",(o,e,t)=>{const i=o.get(gt),n=jp(i.referenceProvider,e,t,!1,!1,ii.None);return ba(()=>n)});Us("_executeReferenceProvider_recursive",(o,e,t)=>{const i=o.get(gt),n=jp(i.referenceProvider,e,t,!1,!0,ii.None);return ba(()=>n)});Us("_executeImplementationProvider",(o,e,t)=>{const i=o.get(gt),n=o1(i.implementationProvider,e,t,!1,ii.None);return ba(()=>n)});Us("_executeImplementationProvider_recursive",(o,e,t)=>{const i=o.get(gt),n=o1(i.implementationProvider,e,t,!0,ii.None);return ba(()=>n)});sr.appendMenuItem(Ye.EditorContext,{submenu:Ye.EditorContextPeek,title:w("peek.submenu","Peek"),group:"navigation",order:100});class Yu{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof Yu||ut.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}const jo=class jo extends Pr{static all(){return jo._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of za.wrap(t.menu))(i.id===Ye.EditorContext||i.id===Ye.EditorContextPeek)&&(i.when=le.and(e.precondition,i.when));return t}constructor(e,t){super(jo._patchConfig(t)),this.configuration=e,jo._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(Rs),r=e.get(Un),a=e.get(yp),c=e.get(aw),d=e.get(gt),u=e.get(qt),f=t.getModel(),m=t.getPosition(),v=Yu.is(i)?i:new Yu(f,m),_=new Mu(t,5),y=bp(this._getLocationModel(d,v.model,v.position,_.token),_.token).then(async S=>{var N;if(!S||_.token.isCancellationRequested)return;or(S.ariaMessage);let D;if(S.referenceAt(f.uri,m)){const B=this._getAlternativeCommand(t);!jo._activeAlternativeCommands.has(B)&&jo._allSymbolNavigationCommands.has(B)&&(D=jo._allSymbolNavigationCommands.get(B))}const E=S.references.length;if(E===0){if(!this.configuration.muteMessage){const B=f.getWordAtPosition(m);(N=io.get(t))==null||N.showMessage(this._getNoResultFoundMessage(B),m)}}else if(E===1&&D)jo._activeAlternativeCommands.add(this.desc.id),u.invokeFunction(B=>D.runEditorCommand(B,t,i,n).finally(()=>{jo._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,c,t,S,n)},S=>{s.error(S)}).finally(()=>{_.dispose()});return a.showWhile(y,250),y}async _onResult(e,t,i,n,s){const r=this._getGoToPreference(i);if(!(i instanceof ar)&&(this.configuration.openInPeek||r==="peek"&&n.references.length>1))this._openInPeek(i,n,s);else{const a=n.firstReference(),c=n.references.length>1&&r==="gotoAndPeek",d=await this._openReference(i,e,a,this.configuration.openToSide,!c);c&&d?this._openInPeek(d,n,s):n.dispose(),r==="goto"&&t.put(a)}}async _openReference(e,t,i,n,s){let r;if(qA(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:H.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(a){if(s){const c=a.getModel(),d=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===c&&d.clear()},350)}return a}}_openInPeek(e,t,i){const n=Xd.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),us(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}};jo._allSymbolNavigationCommands=new Map,jo._activeAlternativeCommands=new Set;let el=jo;class Up extends el{async _getLocationModel(e,t,i,n){return new no(await Vp(e.definitionProvider,t,i,!1,n),w("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?w("noResultWord","No definition found for '{0}'",e.word):w("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}var Ul;Yi((Ul=class extends Up{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Ul.id,title:{...ht("actions.goToDecl.label","Go to Definition"),mnemonicTitle:w({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:M.hasDefinitionProvider,keybinding:[{when:M.editorTextFocus,primary:70,weight:100},{when:le.and(M.editorTextFocus,iE),primary:2118,weight:100}],menu:[{id:Ye.EditorContext,group:"navigation",order:1.1},{id:Ye.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),dn.registerCommandAlias("editor.action.goToDeclaration",Ul.id)}},Ul.id="editor.action.revealDefinition",Ul));var $l;Yi(($l=class extends Up{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:$l.id,title:ht("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:le.and(M.hasDefinitionProvider,M.isInEmbeddedEditor.toNegated()),keybinding:[{when:M.editorTextFocus,primary:Gn(2089,70),weight:100},{when:le.and(M.editorTextFocus,iE),primary:Gn(2089,2118),weight:100}]}),dn.registerCommandAlias("editor.action.openDeclarationToTheSide",$l.id)}},$l.id="editor.action.revealDefinitionAside",$l));var ql;Yi((ql=class extends Up{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:ql.id,title:ht("actions.previewDecl.label","Peek Definition"),precondition:le.and(M.hasDefinitionProvider,Bs.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),keybinding:{when:M.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:Ye.EditorContextPeek,group:"peek",order:2}}),dn.registerCommandAlias("editor.action.previewDeclaration",ql.id)}},ql.id="editor.action.peekDefinition",ql));class xM extends el{async _getLocationModel(e,t,i,n){return new no(await s1(e.declarationProvider,t,i,!1,n),w("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?w("decl.noResultWord","No declaration found for '{0}'",e.word):w("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}var nd;Yi((nd=class extends xM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:nd.id,title:{...ht("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:w({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:le.and(M.hasDeclarationProvider,M.isInEmbeddedEditor.toNegated()),menu:[{id:Ye.EditorContext,group:"navigation",order:1.3},{id:Ye.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?w("decl.noResultWord","No declaration found for '{0}'",e.word):w("decl.generic.noResults","No declaration found")}},nd.id="editor.action.revealDeclaration",nd));Yi(class extends xM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:ht("actions.peekDecl.label","Peek Declaration"),precondition:le.and(M.hasDeclarationProvider,Bs.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),menu:{id:Ye.EditorContextPeek,group:"peek",order:3}})}});class LM extends el{async _getLocationModel(e,t,i,n){return new no(await r1(e.typeDefinitionProvider,t,i,!1,n),w("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?w("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):w("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}var sd;Yi((sd=class extends LM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:sd.ID,title:{...ht("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:w({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:M.hasTypeDefinitionProvider,keybinding:{when:M.editorTextFocus,primary:0,weight:100},menu:[{id:Ye.EditorContext,group:"navigation",order:1.4},{id:Ye.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},sd.ID="editor.action.goToTypeDefinition",sd));var od;Yi((od=class extends LM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:od.ID,title:ht("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:le.and(M.hasTypeDefinitionProvider,Bs.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),menu:{id:Ye.EditorContextPeek,group:"peek",order:4}})}},od.ID="editor.action.peekTypeDefinition",od));class IM extends el{async _getLocationModel(e,t,i,n){return new no(await o1(e.implementationProvider,t,i,!1,n),w("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?w("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):w("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}var rd;Yi((rd=class extends IM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:rd.ID,title:{...ht("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:w({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:M.hasImplementationProvider,keybinding:{when:M.editorTextFocus,primary:2118,weight:100},menu:[{id:Ye.EditorContext,group:"navigation",order:1.45},{id:Ye.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},rd.ID="editor.action.goToImplementation",rd));var ad;Yi((ad=class extends IM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:ad.ID,title:ht("actions.peekImplementation.label","Peek Implementations"),precondition:le.and(M.hasImplementationProvider,Bs.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),keybinding:{when:M.editorTextFocus,primary:3142,weight:100},menu:{id:Ye.EditorContextPeek,group:"peek",order:5}})}},ad.ID="editor.action.peekImplementation",ad));class kM extends el{_getNoResultFoundMessage(e){return e?w("references.no","No references found for '{0}'",e.word):w("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}Yi(class extends kM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...ht("goToReferences.label","Go to References"),mnemonicTitle:w({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:le.and(M.hasReferenceProvider,Bs.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),keybinding:{when:M.editorTextFocus,primary:1094,weight:100},menu:[{id:Ye.EditorContext,group:"navigation",order:1.45},{id:Ye.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new no(await jp(e.referenceProvider,t,i,!0,!1,n),w("ref.title","References"))}});Yi(class extends kM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:ht("references.action.label","Peek References"),precondition:le.and(M.hasReferenceProvider,Bs.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),menu:{id:Ye.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new no(await jp(e.referenceProvider,t,i,!1,!1,n),w("ref.title","References"))}});class wz extends el{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:ht("label.generic","Go to Any Symbol"),precondition:le.and(Bs.notInPeekEditor,M.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new no(this._references,w("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&w("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}dn.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:nn},{name:"position",description:"The position at which to start",constraint:ut.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(o,e,t,i,n,s,r)=>{Oi(nn.isUri(e)),Oi(ut.isIPosition(t)),Oi(Array.isArray(i)),Oi(typeof n>"u"||typeof n=="string"),Oi(typeof r>"u"||typeof r=="boolean");const a=o.get(Un),c=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(nE(c))return c.setPosition(t),c.revealPositionInCenterIfOutsideViewport(t,0),c.invokeWithinContext(d=>{const u=new class extends wz{_getNoResultFoundMessage(f){return s||super._getNoResultFoundMessage(f)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);d.get(qt).invokeFunction(u.run.bind(u),c)})}});dn.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:nn},{name:"position",description:"The position at which to start",constraint:ut.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(o,e,t,i,n)=>{o.get(ls).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});dn.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{Oi(nn.isUri(e)),Oi(ut.isIPosition(t));const i=o.get(gt),n=o.get(Un);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!nE(s)||!s.hasModel())return;const r=Xd.get(s);if(!r)return;const a=us(d=>jp(i.referenceProvider,s.getModel(),ut.lift(t),!1,!1,d).then(u=>new no(u,w("ref.title","References")))),c=new H(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(c,a,!1))})}});dn.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function yz(o,e,t,i){const n=o.get(Ar),s=o.get(lg),r=o.get(ls),a=o.get(qt),c=o.get(Rs);if(await i.item.resolve(ii.None),!i.part.location)return;const d=i.part.location,u=[],f=new Set(sr.getMenuItems(Ye.EditorContext).map(v=>KA(v)?v.command.id:Qb()));for(const v of el.all())f.has(v.desc.id)&&u.push(new Fu(v.desc.id,Hu.label(v.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const _=await n.createModelReference(d.uri);try{const y=new Yu(_.object.textEditorModel,H.getStartPosition(d.range)),S=i.item.anchor.range;await a.invokeFunction(v.runEditorCommand.bind(v),e,y,S)}finally{_.dispose()}}));if(i.part.command){const{command:v}=i.part;u.push(new kf),u.push(new Fu(v.id,v.title,void 0,!0,async()=>{try{await r.executeCommand(v.id,...v.arguments??[])}catch(_){c.notify({severity:v0.Error,source:i.item.provider.displayName,message:_})}}))}const m=e.getOption(128);s.showContextMenu({domForShadowRoot:m?e.getDomNode()??void 0:void 0,getAnchor:()=>{const v=Ws(t);return{x:v.left,y:v.top+v.height+8}},getActions:()=>u,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function DM(o,e,t,i){const s=await o.get(Ar).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,c=r.get(Ri),d=Bs.inPeekEditor.getValue(c),u=!a&&t.getOption(89)&&!d;return new Up({openToSide:a,openInPeek:u,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new Yu(s.object.textEditorModel,H.getStartPosition(i.range)),H.lift(i.range))}),s.dispose()}var Sz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kh=function(o,e){return function(t,i){e(t,i,o)}},zh;class H_{constructor(){this._entries=new Cp(50)}get(e){const t=H_._key(e);return this._entries.get(t)}set(e,t){const i=H_._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const EM=sl("IInlayHintsCache");ol(EM,H_,1);class jS{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return typeof e=="string"?{label:e}:e[this.index]}}class Cz{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}var Ba;let qf=(Ba=class{static get(e){return e.getContribution(zh.ID)??void 0}constructor(e,t,i,n,s,r,a){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=n,this._commandService=s,this._notificationService=r,this._instaService=a,this._disposables=new Oe,this._sessionDisposables=new Oe,this._decorationsMetadata=new Map,this._ruleFactory=new jD(this._editor),this._activeRenderMode=0,this._debounceInfo=i.for(t.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(t.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(c=>{c.hasChanged(142)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const e=this._editor.getOption(142);if(e.enabled==="off")return;const t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;if(e.enabled==="on")this._activeRenderMode=0;else{let a,c;e.enabled==="onUnlessPressed"?(a=0,c=1):(a=1,c=0),this._activeRenderMode=a,this._sessionDisposables.add(GA.getInstance().event(d=>{if(!this._editor.hasModel())return;const u=d.altKey&&d.ctrlKey&&!(d.shiftKey||d.metaKey)?c:a;if(u!==this._activeRenderMode){this._activeRenderMode=u;const f=this._editor.getModel(),m=this._copyInlayHintsWithCurrentAnchor(f);this._updateHintsDecorators([f.getFullModelRange()],m),r.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(gn(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new ts(async()=>{const a=Date.now();n==null||n.dispose(!0),n=new gs;const c=t.onWillDispose(()=>n==null?void 0:n.cancel());try{const d=n.token,u=await N_.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),d);if(r.delay=this._debounceInfo.update(t,Date.now()-a),d.isCancellationRequested){u.dispose();return}for(const f of u.provider)typeof f.onDidChangeInlayHints=="function"&&!s.has(f)&&(s.add(f),this._sessionDisposables.add(f.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));this._sessionDisposables.add(u),this._updateHintsDecorators(u.ranges,u.items),this._cacheHintsForFastRestore(t)}catch(d){on(d)}finally{n.dispose(),c.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(r),this._sessionDisposables.add(gn(()=>n==null?void 0:n.dispose(!0))),r.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(a=>{(a.scrollTopChanged||!r.isScheduled())&&r.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeModelContent(a=>{n==null||n.cancel();const c=Math.max(r.delay,1250);r.schedule(c)})),this._sessionDisposables.add(this._installDblClickGesture(()=>r.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new Oe,t=e.add(new sw(this._editor)),i=new Oe;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(n=>{const[s]=n,r=this._getInlayHintLabelPart(s),a=this._editor.getModel();if(!r||!a){i.clear();return}const c=new gs;i.add(gn(()=>c.dispose(!0))),r.item.resolve(c.token),this._activeInlayHintPart=r.part.command||r.part.location?new Cz(r,s.hasTriggerModifier):void 0;const d=a.validatePosition(r.item.hint.position).lineNumber,u=new H(d,1,d,a.getLineMaxColumn(d)),f=this._getInlineHintsForRange(u);this._updateHintsDecorators([u],f),i.add(gn(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([u],f)}))})),e.add(t.onCancel(()=>i.clear())),e.add(t.onExecute(async n=>{const s=this._getInlayHintLabelPart(n);if(s){const r=s.part;r.location?this._instaService.invokeFunction(DM,n,this._editor,r.location):ZA.is(r.command)&&await this._invokeCommand(r.command,s.item)}})),e}_getInlineHintsForRange(e){const t=new Set;for(const i of this._decorationsMetadata.values())e.containsRange(i.item.anchor.range)&&t.add(i.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;const i=this._getInlayHintLabelPart(t);if(i&&(t.event.preventDefault(),await i.item.resolve(ii.None),bo(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>En.replace(H.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!XA(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(yz,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){var i;if(e.target.type!==6)return;const t=(i=e.target.detail.injectedText)==null?void 0:i.options;if(t instanceof b0&&(t==null?void 0:t.attachedData)instanceof jS)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:v0.Error,source:t.provider.displayName,message:i})}}_cacheHintsForFastRestore(e){const t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){const t=new Map;for(const[i,n]of this._decorationsMetadata){if(t.has(n.item))continue;const s=e.getDecorationRange(i);if(s){const r=new mM(s,n.item.anchor.direction),a=n.item.with({anchor:r});t.set(n.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),n=[];for(const s of i.sort(H.compareRangesUsingStarts)){const r=t.validateRange(new H(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!H.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=H.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var _,y;const i=[],n=(S,D,E,N,B)=>{const F={content:E,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:D.className,cursorStops:N,attachedData:B};i.push({item:S,classNameRef:D,decoration:{range:S.anchor.range,options:{description:"InlayHint",showIfCollapsed:S.anchor.range.isEmpty(),collapseOnReplaceEdit:!S.anchor.range.isEmpty(),stickiness:0,[S.anchor.direction]:this._activeRenderMode===0?F:void 0}}})},s=(S,D)=>{const E=this._ruleFactory.createClassNameRef({width:`${r/3|0}px`,display:"inline-block"});n(S,E," ",D?qh.Right:qh.None)},{fontSize:r,fontFamily:a,padding:c,isUniform:d}=this._getLayoutInfo(),u="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(u,a);let f={line:0,totalLen:0};for(const S of t){if(f.line!==S.anchor.range.startLineNumber&&(f={line:S.anchor.range.startLineNumber,totalLen:0}),f.totalLen>zh._MAX_LABEL_LEN)continue;S.hint.paddingLeft&&s(S,!1);const D=typeof S.hint.label=="string"?[{label:S.hint.label}]:S.hint.label;for(let E=0;E<D.length;E++){const N=D[E],B=E===0,F=E===D.length-1,Q={fontSize:`${r}px`,fontFamily:`var(${u}), ${g0.fontFamily}`,verticalAlign:d?"baseline":"middle",unicodeBidi:"isolate"};bo(S.hint.textEdits)&&(Q.cursor="default"),this._fillInColors(Q,S.hint),(N.command||N.location)&&((_=this._activeInlayHintPart)==null?void 0:_.part.item)===S&&this._activeInlayHintPart.part.index===E&&(Q.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(Q.color=Yn(YA),Q.cursor="pointer")),c&&(B&&F?(Q.padding=`1px ${Math.max(1,r/4)|0}px`,Q.borderRadius=`${r/4|0}px`):B?(Q.padding=`1px 0 1px ${Math.max(1,r/4)|0}px`,Q.borderRadius=`${r/4|0}px 0 0 ${r/4|0}px`):F?(Q.padding=`1px ${Math.max(1,r/4)|0}px 1px 0`,Q.borderRadius=`0 ${r/4|0}px ${r/4|0}px 0`):Q.padding="1px 0 1px 0");let $=N.label;f.totalLen+=$.length;let fe=!1;const Pe=f.totalLen-zh._MAX_LABEL_LEN;if(Pe>0&&($=$.slice(0,-Pe)+"…",fe=!0),n(S,this._ruleFactory.createClassNameRef(Q),xz($),F&&!S.hint.paddingRight?qh.Right:qh.None,new jS(S,E)),fe)break}if(S.hint.paddingRight&&s(S,!0),i.length>zh._MAX_DECORATORS)break}const m=[];for(const[S,D]of this._decorationsMetadata){const E=(y=this._editor.getModel())==null?void 0:y.getDecorationRange(S);E&&e.some(N=>N.containsRange(E))&&(m.push(S),D.classNameRef.dispose(),this._decorationsMetadata.delete(S))}const v=Au.capture(this._editor);this._editor.changeDecorations(S=>{const D=S.deltaDecorations(m,i.map(E=>E.decoration));for(let E=0;E<D.length;E++){const N=i[E];this._decorationsMetadata.set(D[E],N)}}),v.restore(this._editor)}_fillInColors(e,t){t.kind===kL.Parameter?(e.backgroundColor=Yn(JA),e.color=Yn(QA)):t.kind===kL.Type?(e.backgroundColor=Yn(eO),e.color=Yn(tO)):(e.backgroundColor=Yn(iO),e.color=Yn(nO))}_getLayoutInfo(){const e=this._editor.getOption(142),t=e.padding,i=this._editor.getOption(52),n=this._editor.getOption(49);let s=e.fontSize;(!s||s<5||s>i)&&(s=i);const r=e.fontFamily||n;return{fontSize:s,fontFamily:r,padding:t,isUniform:!t&&r===n&&s===i}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}},zh=Ba,Ba.ID="editor.contrib.InlayHints",Ba._MAX_DECORATORS=1500,Ba._MAX_LABEL_LEN=43,Ba);qf=zh=Sz([kh(1,gt),kh(2,Wo),kh(3,EM),kh(4,ls),kh(5,Rs),kh(6,qt)],qf);function xz(o){return o.replace(/[ \t]/g," ")}dn.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;Oi(nn.isUri(t)),Oi(H.isIRange(i));const{inlayHintsProvider:n}=o.get(gt),s=await o.get(Ar).createModelReference(t);try{const r=await N_.create(n,s.object.textEditorModel,[H.lift(i)],ii.None),a=r.items.map(c=>c.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});var Lz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ul=function(o,e){return function(t,i){e(t,i,o)}};class AI extends Zm{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let W_=class extends Uf{constructor(e,t,i,n,s,r,a,c,d){super(e,t,i,r,c,n,s,d),this._resolverService=a,this.hoverOrdinal=6}suggestHoverAnchor(e){var n;if(!qf.get(this._editor)||e.target.type!==6)return null;const i=(n=e.target.detail.injectedText)==null?void 0:n.options;return i instanceof b0&&i.attachedData instanceof jS?new AI(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof AI?new Ir(async n=>{const{part:s}=e;if(await s.item.resolve(i),i.isCancellationRequested)return;let r;typeof s.item.hint.tooltip=="string"?r=new Is().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&n.emitOne(new er(this,e.range,[r],!1,0)),bo(s.item.hint.textEdits)&&n.emitOne(new er(this,e.range,[new Is().appendText(w("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new Is().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&n.emitOne(new er(this,e.range,[a],!1,1)),s.part.location||s.part.command){let d;const f=this._editor.getOption(78)==="altKey"?ga?w("links.navigate.kb.meta.mac","cmd + click"):w("links.navigate.kb.meta","ctrl + click"):ga?w("links.navigate.kb.alt.mac","option + click"):w("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?d=new Is().appendText(w("hint.defAndCommand","Go to Definition ({0}), right click for more",f)):s.part.location?d=new Is().appendText(w("hint.def","Go to Definition ({0})",f)):s.part.command&&(d=new Is(`[${w("hint.cmd","Execute Command")}](${QB(s.part.command)} "${s.part.command.title}") (${f})`,{isTrusted:!0})),d&&n.emitOne(new er(this,e.range,[d],!1,1e4))}const c=await this._resolveInlayHintLabelPartHover(s,i);for await(const d of c)n.emitOne(d)}):Ir.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return Ir.EMPTY;const{uri:i,range:n}=e.part.location,s=await this._resolverService.createModelReference(i);try{const r=s.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(r)?t1(this._languageFeaturesService.hoverProvider,r,new ut(n.startLineNumber,n.startColumn),t).filter(a=>!Df(a.hover.contents)).map(a=>new er(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):Ir.EMPTY}finally{s.dispose()}}};W_=Lz([ul(1,Rr),ul(2,Mr),ul(3,Zn),ul(4,kp),ul(5,pn),ul(6,Ar),ul(7,gt),ul(8,ls)],W_);class a1 extends Be{constructor(e,t,i,n,s,r){super();const a=t.anchor,c=t.hoverParts;this._renderedHoverParts=this._register(new US(e,i,c,r,s));const{showAtPosition:d,showAtSecondaryPosition:u}=a1.computeHoverPositions(e,a.range,c);this.shouldAppearBeforeContent=c.some(f=>f.isBeforeContent),this.showAtPosition=d,this.showAtSecondaryPosition=u,this.initialMousePosX=a.initialMousePosX,this.initialMousePosY=a.initialMousePosY,this.shouldFocus=n.shouldFocus,this.source=n.source}get domNode(){return this._renderedHoverParts.domNode}get domNodeHasChildren(){return this._renderedHoverParts.domNodeHasChildren}get focusedHoverPartIndex(){return this._renderedHoverParts.focusedHoverPartIndex}async updateHoverVerbosityLevel(e,t,i){this._renderedHoverParts.updateHoverVerbosityLevel(e,t,i)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(e,t,i){let n=1;if(e.hasModel()){const u=e._getViewModel(),f=u.coordinatesConverter,m=f.convertModelRangeToViewRange(t),v=u.getLineMinColumn(m.startLineNumber),_=new ut(m.startLineNumber,v);n=f.convertViewPositionToModelPosition(_).column}const s=t.startLineNumber;let r=t.startColumn,a;for(const u of i){const f=u.range,m=f.startLineNumber===s,v=f.endLineNumber===s;if(m&&v){const y=f.startColumn,S=Math.min(r,y);r=Math.max(S,n)}u.forceShowAtRange&&(a=f)}let c,d;if(a){const u=a.getStartPosition();c=u,d=u}else c=t.getStartPosition(),d=new ut(s,r);return{showAtPosition:c,showAtSecondaryPosition:d}}}class Iz{constructor(e,t){this._statusBar=t,e.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}}const Vv=class Vv extends Be{constructor(e,t,i,n,s){super(),this._renderedParts=[],this._focusedHoverPartIndex=-1,this._context=s,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,i,s,n)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,i)),this._updateMarkdownAndColorParticipantInfo(t)}_createEditorDecorations(e,t){if(t.length===0)return Be.None;let i=t[0].range;for(const s of t){const r=s.range;i=H.plusRange(i,r)}const n=e.createDecorationsCollection();return n.set([{range:i,options:Vv._DECORATION_OPTIONS}]),gn(()=>{n.clear()})}_renderParts(e,t,i,n){const s=new M_(n),r={fragment:this._fragment,statusBar:s,...i},a=new Oe;for(const d of e){const u=this._renderHoverPartsForParticipant(t,d,r);a.add(u);for(const f of u.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:d,hoverPart:f.hoverPart,hoverElement:f.hoverElement})}const c=this._renderStatusBar(this._fragment,s);return c&&(a.add(c),this._renderedParts.push({type:"statusBar",hoverElement:c.hoverElement,actions:c.actions})),gn(()=>{a.dispose()})}_renderHoverPartsForParticipant(e,t,i){const n=e.filter(r=>r.owner===t);return n.length>0?t.renderHoverParts(i,n):new Zd([])}_renderStatusBar(e,t){if(t.hasContent)return new Iz(e,t)}_registerListenersOnRenderedParts(){const e=new Oe;return this._renderedParts.forEach((t,i)=>{const n=t.hoverElement;n.tabIndex=0,e.add(Ni(n,Cn.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(Ni(n,Cn.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof Uf&&!(i instanceof W_));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof Vf)}async updateHoverVerbosityLevel(e,t,i){if(!this._markdownHoverParticipant)return;const n=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,t);if(n===void 0)return;const s=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,n,i);s&&(this._renderedParts[t]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:s.hoverPart,hoverElement:s.hoverElement},this._context.onContentsChanged())}isColorPickerVisible(){var e;return((e=this._colorHoverParticipant)==null?void 0:e.isColorPickerVisible())??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){const i=this._renderedParts[t];if(!i||i.type!=="hoverPart"||!(i.participant===e))return;const s=this._renderedParts.findIndex(r=>r.type==="hoverPart"&&r.participant===e);if(s===-1)throw new Wu;return t-s}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}};Vv._DECORATION_OPTIONS=pi.register({description:"content-hover-highlight",className:"hoverHighlight"});let US=Vv;var kz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},OI=function(o,e){return function(t,i){e(t,i,o)}};let $S=class extends Be{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._onContentsChanged=this._register(new ti),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(TS,this._editor)),this._participants=this._initializeHoverParticipants(),this._computer=new T_(this._editor,this._participants),this._hoverOperation=this._register(new hM(this._editor,this._computer)),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of ch.getAll()){const i=this._instantiationService.createInstance(t,this._editor);e.push(i)}return e.sort((t,i)=>t.hoverOrdinal-i.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(t=>{var i;return(i=t.handleResize)==null?void 0:i.call(t)})})),e}_registerListeners(){this._register(this._hoverOperation.onResult(t=>{if(!this._computer.anchor)return;const i=t.hasLoadingMessage?this._addLoadingMessage(t.value):t.value;this._withResult(new uM(this._computer.anchor,i,t.isComplete))}));const e=this._contentHoverWidget.getDomNode();this._register(Za(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Za(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(Ab.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)}))}_startShowingOrUpdateHover(e,t,i,n,s){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):!1;const a=this._editor.getOption(60).sticky,c=s&&this._contentHoverWidget.isMouseGettingCloser(s.event.posx,s.event.posy);return a&&c?(e&&this._startHoverOperationIfNecessary(e,t,i,n,!0),!0):e?this._currentResult.anchor.equals(e)?!0:e.canAdoptVisibleHover(this._currentResult.anchor,this._contentHoverWidget.position)?(this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,i,n,s){this._computer.anchor&&this._computer.anchor.equals(e)||(this._hoverOperation.cancel(),this._computer.anchor=e,this._computer.shouldFocus=n,this._computer.source=i,this._computer.insistOnKeepingHoverVisible=s,this._hoverOperation.start(t))}_setCurrentResult(e){let t=e;if(this._currentResult===t)return;t&&t.hoverParts.length===0&&(t=null),this._currentResult=t,this._currentResult?this._showHover(this._currentResult):this._hideHover()}_addLoadingMessage(e){if(!this._computer.anchor)return e;for(const t of this._participants){if(!t.createLoadingMessage)continue;const i=t.createLoadingMessage(this._computer.anchor);if(i)return e.slice(0).concat([i])}return e}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;const n=e.hoverParts.length===0,s=this._computer.insistOnKeepingHoverVisible;n&&s||this._setCurrentResult(e)}_showHover(e){const t=this._getHoverContext();this._renderedContentHover=new a1(this._editor,e,this._participants,this._computer,t,this._keybindingService),this._renderedContentHover.domNodeHasChildren?this._contentHoverWidget.show(this._renderedContentHover):this._renderedContentHover.dispose()}_hideHover(){this._contentHoverWidget.hide()}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._onContentsChanged.fire(),this._contentHoverWidget.onContentsChanged()},setMinimumDimensions:n=>{this._contentHoverWidget.setMinimumDimensions(n)}}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing)return!0;const i=this._findHoverAnchorCandidates(e);if(!(i.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);const s=i[0];return this._startShowingOrUpdateHover(s,0,0,!1,e)}_findHoverAnchorCandidates(e){const t=[];for(const n of this._participants){if(!n.suggestHoverAnchor)continue;const s=n.suggestHoverAnchor(e);s&&t.push(s)}const i=e.target;switch(i.type){case 6:{t.push(new ty(0,i.range,e.event.posx,e.event.posy));break}case 7:{const n=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;if(!(!i.detail.isAfterLines&&typeof i.detail.horizontalDistanceToText=="number"&&i.detail.horizontalDistanceToText<n))break;t.push(new ty(0,i.range,e.event.posx,e.event.posy));break}}return t.sort((n,s)=>s.priority-n.priority),t}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!nw(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new ty(0,e,void 0,void 0),t,i,n,null)}async updateHoverVerbosityLevel(e,t,i){var n;(n=this._renderedContentHover)==null||n.updateHoverVerbosityLevel(e,t,i)}focusedHoverPartIndex(){var e;return((e=this._renderedContentHover)==null?void 0:e.focusedHoverPartIndex)??-1}containsNode(e){return e?this._contentHoverWidget.getDomNode().contains(e):!1}focus(){this._contentHoverWidget.focus()}scrollUp(){this._contentHoverWidget.scrollUp()}scrollDown(){this._contentHoverWidget.scrollDown()}scrollLeft(){this._contentHoverWidget.scrollLeft()}scrollRight(){this._contentHoverWidget.scrollRight()}pageUp(){this._contentHoverWidget.pageUp()}pageDown(){this._contentHoverWidget.pageDown()}goToTop(){this._contentHoverWidget.goToTop()}goToBottom(){this._contentHoverWidget.goToBottom()}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}getDomNode(){return this._contentHoverWidget.getDomNode()}get isColorPickerVisible(){var e;return((e=this._renderedContentHover)==null?void 0:e.isColorPickerVisible())??!1}get isVisibleFromKeyboard(){return this._contentHoverWidget.isVisibleFromKeyboard}get isVisible(){return this._contentHoverWidget.isVisible}get isFocused(){return this._contentHoverWidget.isFocused}get isResizing(){return this._contentHoverWidget.isResizing}get widget(){return this._contentHoverWidget}};$S=kz([OI(1,qt),OI(2,Zn)],$S);var Dz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},FI=function(o,e){return function(t,i){e(t,i,o)}},qS,ld;let Ls=(ld=class extends Be{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._onHoverContentsChanged=this._register(new ti),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Oe,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new ts(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}static get(e){return e.getContribution(qS.ID)}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._shouldNotHideCurrentHoverWidget(e)&&this._hideWidgets()}_shouldNotHideCurrentHoverWidget(e){return this._isMouseOnContentHoverWidget(e)||this._isContentWidgetResizing()}_isMouseOnContentHoverWidget(e){var i;const t=(i=this._contentWidget)==null?void 0:i.getDomNode();return t?nw(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._shouldNotHideCurrentHoverWidget(e))||this._hideWidgets()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=(r,a)=>{const c=this._isMouseOnContentHoverWidget(r);return a&&c},n=r=>{var d;const a=this._isMouseOnContentHoverWidget(r),c=((d=this._contentWidget)==null?void 0:d.isColorPickerVisible)??!1;return a&&c},s=(r,a)=>{var c,d,u,f;return(a&&((d=this._contentWidget)==null?void 0:d.containsNode((c=r.event.browserEvent.view)==null?void 0:c.document.activeElement))&&!((f=(u=r.event.browserEvent.view)==null?void 0:u.getSelection())!=null&&f.isCollapsed))??!1};return i(e,t)||n(e)||s(e,t)}_onEditorMouseMove(e){var a,c,d,u;if(this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._mouseMoveEvent=e,(a=this._contentWidget)!=null&&a.isFocused||(c=this._contentWidget)!=null&&c.isResizing))return;const t=this._hoverSettings.sticky;if(t&&((d=this._contentWidget)!=null&&d.isVisibleFromKeyboard))return;if(this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}const n=this._hoverSettings.hidingDelay;if(((u=this._contentWidget)==null?void 0:u.isVisible)&&t&&n>0){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(n);return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){var c;if(!e)return;const i=(c=e.target.element)==null?void 0:c.classList.contains("colorpicker-color-decoration"),n=this._editor.getOption(149),s=this._hoverSettings.enabled,r=this._hoverState.activatedByDecoratorClick;if(i&&(n==="click"&&!r||n==="hover"&&!s||n==="clickAndHover"&&!s&&!r)||!i&&!s&&!r){this._hideWidgets();return}this._tryShowHoverWidget(e)||this._hideWidgets()}_tryShowHoverWidget(e){return this._getOrCreateContentWidget().showsOrWillShow(e)}_onKeyDown(e){var n;if(!this._editor.hasModel())return;const t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),i=t.kind===1||t.kind===2&&(t.commandId===aM||t.commandId===tw||t.commandId===iw)&&((n=this._contentWidget)==null?void 0:n.isVisible);e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||i||this._hideWidgets()}_hideWidgets(){var e,t;this._hoverState.mouseDown&&((e=this._contentWidget)!=null&&e.isColorPickerVisible)||Xu.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,(t=this._contentWidget)==null||t.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance($S,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,i,n,s=!1){this._hoverState.activatedByDecoratorClick=s,this._getOrCreateContentWidget().startShowingAtRange(e,t,i,n)}_isContentWidgetResizing(){var e;return((e=this._contentWidget)==null?void 0:e.widget.isResizing)||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}updateHoverVerbosityLevel(e,t,i){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,i)}focus(){var e;(e=this._contentWidget)==null||e.focus()}scrollUp(){var e;(e=this._contentWidget)==null||e.scrollUp()}scrollDown(){var e;(e=this._contentWidget)==null||e.scrollDown()}scrollLeft(){var e;(e=this._contentWidget)==null||e.scrollLeft()}scrollRight(){var e;(e=this._contentWidget)==null||e.scrollRight()}pageUp(){var e;(e=this._contentWidget)==null||e.pageUp()}pageDown(){var e;(e=this._contentWidget)==null||e.pageDown()}goToTop(){var e;(e=this._contentWidget)==null||e.goToTop()}goToBottom(){var e;(e=this._contentWidget)==null||e.goToBottom()}get isColorPickerVisible(){var e;return(e=this._contentWidget)==null?void 0:e.isColorPickerVisible}get isHoverVisible(){var e;return(e=this._contentWidget)==null?void 0:e.isVisible}dispose(){var e;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._contentWidget)==null||e.dispose()}},qS=ld,ld.ID="editor.contrib.contentHover",ld);Ls=qS=Dz([FI(1,qt),FI(2,Zn)],Ls);const q1=class q1 extends Be{constructor(e){super(),this._editor=e,this._register(e.onMouseDown(t=>this.onMouseDown(t)))}dispose(){super.dispose()}onMouseDown(e){const t=this._editor.getOption(149);if(t!=="click"&&t!=="clickAndHover")return;const i=e.target;if(i.type!==6||!i.detail.injectedText||i.detail.injectedText.options.attachedData!==eM||!i.range)return;const n=this._editor.getContribution(Ls.ID);if(n&&!n.isColorPickerVisible){const s=new H(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(s,1,0,!1,!0)}}};q1.ID="editor.contrib.colorContribution";let B_=q1;oi(B_.ID,B_,2);ch.register(Vf);var PM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Yh=function(o,e){return function(t,i){e(t,i,o)}},KS,GS,cd;let Yd=(cd=class extends Be{constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=M.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=M.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){var e;this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||(e=this._standaloneColorPickerWidget)==null||e.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(ZS,this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused))}hide(){var e;this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),(e=this._standaloneColorPickerWidget)==null||e.hide(),this._editor.focus()}insertColor(){var e;(e=this._standaloneColorPickerWidget)==null||e.updateEditor(),this.hide()}static get(e){return e.getContribution(KS.ID)}},KS=cd,cd.ID="editor.contrib.standaloneColorPickerController",cd);Yd=KS=PM([Yh(1,Ri),Yh(2,qt)],Yd);oi(Yd.ID,Yd,1);const HI=8,Ez=22;var dd;let ZS=(dd=class extends Be{constructor(e,t,i,n,s,r,a){var f;super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=i,this._keybindingService=s,this._languageFeaturesService=r,this._editorWorkerService=a,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new ti),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(jf,this._editor),this._position=(f=this._editor._getViewModel())==null?void 0:f.getPrimaryCursorState().modelState.position;const c=this._editor.getSelection(),d=c?{startLineNumber:c.startLineNumber,startColumn:c.startColumn,endLineNumber:c.endLineNumber,endColumn:c.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},u=this._register(Nu(this._body));this._register(u.onDidBlur(m=>{this.hide()})),this._register(u.onDidFocus(m=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(m=>{var _;const v=(_=m.target.element)==null?void 0:_.classList;v&&v.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(m=>{this._render(m.value,m.foundInEditor)})),this._start(d),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return GS.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const e=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){const t=await this._computeAsync(e);t&&this._onResult.fire(new Pz(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;const t={range:e,color:{red:0,green:0,blue:0,alpha:1}},i=await this._standaloneColorPickerParticipant.createColorHover(t,new zf(this._editorWorkerService),this._languageFeaturesService.colorProvider);return i?{result:i.colorHover,foundInEditor:i.foundInEditor}:null}_render(e,t){const i=document.createDocumentFragment(),n=this._register(new M_(this._keybindingService)),s={fragment:i,statusBar:n,onContentsChanged:()=>{},hide:()=>this.hide()};this._colorHover=e;const r=this._standaloneColorPickerParticipant.renderHoverParts(s,[e]);if(!r)return;this._register(r.disposables);const a=r.colorPicker;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(i),a.layout();const c=a.body,d=c.saturationBox.domNode.clientWidth,u=c.domNode.clientWidth-d-Ez-HI,f=a.body.enterButton;f==null||f.onClicked(()=>{this.updateEditor(),this.hide()});const m=a.header,v=m.pickedColorNode;v.style.width=d+HI+"px";const _=m.originalColorNode;_.style.width=u+"px";const y=a.header.closeButton;y==null||y.onClicked(()=>{this.hide()}),t&&(f&&(f.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}},GS=dd,dd.ID="editor.contrib.standaloneColorPickerWidget",dd);ZS=GS=PM([Yh(3,qt),Yh(4,Zn),Yh(5,gt),Yh(6,rl)],ZS);class Pz{constructor(e,t){this.value=e,this.foundInEditor=t}}class Tz extends Pr{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...ht("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:w({key:"mishowOrFocusStandaloneColorPicker",comment:["&& denotes a mnemonic"]},"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:Ye.CommandPalette}],metadata:{description:ht("showOrFocusStandaloneColorPickerDescription","Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(e,t){var i;(i=Yd.get(t))==null||i.showOrFocus()}}class Mz extends Se{constructor(){super({id:"editor.action.hideColorPicker",label:w({key:"hideColorPicker",comment:["Action that hides the color picker"]},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:M.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:ht("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){var i;(i=Yd.get(t))==null||i.hide()}}class Nz extends Se{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:w({key:"insertColorWithStandaloneColorPicker",comment:["Action that inserts color with standalone color picker"]},"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:M.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:ht("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){var i;(i=Yd.get(t))==null||i.insertColor()}}ie(Mz);ie(Nz);Yi(Tz);class Pl{constructor(e,t,i){this.languageConfigurationService=i,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,i){if(i<0)return!1;const n=t.length,s=e.length;if(i+n>s)return!1;for(let r=0;r<n;r++){const a=e.charCodeAt(i+r),c=t.charCodeAt(r);if(a!==c&&!(a>=65&&a<=90&&a+32===c)&&!(c>=65&&c<=90&&c+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,n,s,r){const a=e.startLineNumber,c=e.startColumn,d=e.endLineNumber,u=e.endColumn,f=s.getLineContent(a),m=s.getLineContent(d);let v=f.lastIndexOf(t,c-1+t.length),_=m.indexOf(i,u-1-i.length);if(v!==-1&&_!==-1)if(a===d)f.substring(v+t.length,_).indexOf(i)>=0&&(v=-1,_=-1);else{const S=f.substring(v+t.length),D=m.substring(0,_);(S.indexOf(i)>=0||D.indexOf(i)>=0)&&(v=-1,_=-1)}let y;v!==-1&&_!==-1?(n&&v+t.length<f.length&&f.charCodeAt(v+t.length)===32&&(t=t+" "),n&&_>0&&m.charCodeAt(_-1)===32&&(i=" "+i,_-=1),y=Pl._createRemoveBlockCommentOperations(new H(a,v+t.length+1,d,_+1),t,i)):(y=Pl._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=y.length===1?i:null);for(const S of y)r.addTrackedEditOperation(S.range,S.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return H.isEmpty(e)?n.push(En.delete(new H(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(En.delete(new H(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(En.delete(new H(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return H.isEmpty(e)?s.push(En.replace(new H(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(En.insert(new ut(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(En.insert(new ut(e.endLineNumber,e.endColumn),(n?" ":"")+i))),s}getEditOperations(e,t){const i=this._selection.startLineNumber,n=this._selection.startColumn;e.tokenization.tokenizeIfCheap(i);const s=e.getLanguageIdAtPosition(i,n),r=this.languageConfigurationService.getLanguageConfiguration(s).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length===2){const n=i[0],s=i[1];return new Mt(n.range.endLineNumber,n.range.endColumn,s.range.startLineNumber,s.range.startColumn)}else{const n=i[0].range,s=this._usedEndToken?-this._usedEndToken.length-1:0;return new Mt(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class Ea{constructor(e,t,i,n,s,r,a){this.languageConfigurationService=e,this._selection=t,this._indentSize=i,this._type=n,this._insertSpace=s,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=a||!1}static _gatherPreflightCommentStrings(e,t,i,n){e.tokenization.tokenizeIfCheap(t);const s=e.getLanguageIdAtPosition(t,1),r=n.getLanguageConfiguration(s).comments,a=r?r.lineCommentToken:null;if(!a)return null;const c=[];for(let d=0,u=i-t+1;d<u;d++)c[d]={ignore:!1,commentStr:a,commentStrOffset:0,commentStrLength:a.length};return c}static _analyzeLines(e,t,i,n,s,r,a,c){let d=!0,u;e===0?u=!0:e===1?u=!1:u=!0;for(let f=0,m=n.length;f<m;f++){const v=n[f],_=s+f;if(_===s&&a){v.ignore=!0;continue}const y=i.getLineContent(_),S=Ay(y);if(S===-1){v.ignore=r,v.commentStrOffset=y.length;continue}if(d=!1,v.ignore=!1,v.commentStrOffset=S,u&&!Pl._haystackHasNeedleAtOffset(y,v.commentStr,S)&&(e===0?u=!1:e===1||(v.ignore=!0)),u&&t){const D=S+v.commentStrLength;D<y.length&&y.charCodeAt(D)===32&&(v.commentStrLength+=1)}}if(e===0&&d){u=!1;for(let f=0,m=n.length;f<m;f++)n[f].ignore=!1}return{supported:!0,shouldRemoveComments:u,lines:n}}static _gatherPreflightData(e,t,i,n,s,r,a,c){const d=Ea._gatherPreflightCommentStrings(i,n,s,c);return d===null?{supported:!1}:Ea._analyzeLines(e,t,i,d,n,r,a,c)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=Ea._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(Ea._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._indentSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new ut(n.positionLineNumber,n.positionColumn);for(let a=0,c=s.length;a<c;a++)t.addEditOperation(s[a].range,s[a].text),H.isEmpty(s[a].range)&&H.getStartPosition(s[a].range).equals(r)&&e.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(s[a].text||"").length);this._selectionId=t.trackSelection(n)}_attemptRemoveBlockComment(e,t,i,n){let s=t.startLineNumber,r=t.endLineNumber;const a=n.length+Math.max(e.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.startColumn);let c=e.getLineContent(s).lastIndexOf(i,a-1),d=e.getLineContent(r).indexOf(n,t.endColumn-1-i.length);return c!==-1&&d===-1&&(d=e.getLineContent(s).indexOf(n,c+i.length),r=s),c===-1&&d!==-1&&(c=e.getLineContent(r).lastIndexOf(i,d),s=r),t.isEmpty()&&(c===-1||d===-1)&&(c=e.getLineContent(s).indexOf(i),c!==-1&&(d=e.getLineContent(s).indexOf(n,c+i.length))),c!==-1&&e.getLineContent(s).charCodeAt(c+i.length)===32&&(i+=" "),d!==-1&&e.getLineContent(r).charCodeAt(d-1)===32&&(n=" "+n,d-=1),c!==-1&&d!==-1?Pl._createRemoveBlockCommentOperations(new H(s,c+i.length+1,r,d+1),i,n):null}_executeBlockComment(e,t,i){e.tokenization.tokenizeIfCheap(i.startLineNumber);const n=e.getLanguageIdAtPosition(i.startLineNumber,1),s=this.languageConfigurationService.getLanguageConfiguration(n).comments;if(!s||!s.blockCommentStartToken||!s.blockCommentEndToken)return;const r=s.blockCommentStartToken,a=s.blockCommentEndToken;let c=this._attemptRemoveBlockComment(e,i,r,a);if(!c){if(i.isEmpty()){const d=e.getLineContent(i.startLineNumber);let u=Ay(d);u===-1&&(u=d.length),c=Pl._createAddBlockCommentOperations(new H(i.startLineNumber,u+1,i.startLineNumber,d.length+1),r,a,this._insertSpace)}else c=Pl._createAddBlockCommentOperations(new H(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),r,a,this._insertSpace);c.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=t.trackSelection(i);for(const d of c)t.addEditOperation(d.range,d.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine){t.addEditOperation(new H(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":`
|
|
19
|
-
`),this._selectionId=t.trackSelection(i);return}i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._moveEndPositionDown=!0,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=Ea._gatherPreflightData(this._type,this._insertSpace,e,i.startLineNumber,i.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return n.supported?this._executeLineComments(e,t,n,i):this._executeBlockComment(e,t,i)}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),new Mt(i.selectionStartLineNumber,i.selectionStartColumn+this._deltaColumn,i.positionLineNumber,i.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(e,t){const i=[];for(let n=0,s=e.length;n<s;n++){const r=e[n];r.ignore||i.push(En.delete(new H(t+n,r.commentStrOffset+1,t+n,r.commentStrOffset+r.commentStrLength+1)))}return i}_createAddLineCommentsOperations(e,t){const i=[],n=this._insertSpace?" ":"";for(let s=0,r=e.length;s<r;s++){const a=e[s];a.ignore||i.push(En.insert(new ut(t+s,a.commentStrOffset+1),a.commentStr+n))}return i}static nextVisibleColumn(e,t,i,n){return i?e+(t-e%t):e+n}static _normalizeInsertionPoint(e,t,i,n){let s=1073741824,r,a;for(let c=0,d=t.length;c<d;c++){if(t[c].ignore)continue;const u=e.getLineContent(i+c);let f=0;for(let m=0,v=t[c].commentStrOffset;f<s&&m<v;m++)f=Ea.nextVisibleColumn(f,n,u.charCodeAt(m)===9,1);f<s&&(s=f)}s=Math.floor(s/n)*n;for(let c=0,d=t.length;c<d;c++){if(t[c].ignore)continue;const u=e.getLineContent(i+c);let f=0;for(r=0,a=t[c].commentStrOffset;f<s&&r<a;r++)f=Ea.nextVisibleColumn(f,n,u.charCodeAt(r)===9,1);f>s?t[c].commentStrOffset=r-1:t[c].commentStrOffset=r}}}class l1 extends Se{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(cs);if(!t.hasModel())return;const n=t.getModel(),s=[],r=n.getOptions(),a=t.getOption(23),c=t.getSelections().map((u,f)=>({selection:u,index:f,ignoreFirstLine:!1}));c.sort((u,f)=>H.compareRangesUsingStarts(u.selection,f.selection));let d=c[0];for(let u=1;u<c.length;u++){const f=c[u];d.selection.endLineNumber===f.selection.startLineNumber&&(d.index<f.index?f.ignoreFirstLine=!0:(d.ignoreFirstLine=!0,d=f))}for(const u of c)s.push(new Ea(i,u.selection,r.indentSize,this._type,a.insertSpace,a.ignoreEmptyLines,u.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class Rz extends l1{constructor(){super(0,{id:"editor.action.commentLine",label:w("comment.line","Toggle Line Comment"),alias:"Toggle Line Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:Ye.MenubarEditMenu,group:"5_insert",title:w({key:"miToggleLineComment",comment:["&& denotes a mnemonic"]},"&&Toggle Line Comment"),order:1}})}}class Az extends l1{constructor(){super(1,{id:"editor.action.addCommentLine",label:w("comment.line.add","Add Line Comment"),alias:"Add Line Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2081),weight:100}})}}class Oz extends l1{constructor(){super(2,{id:"editor.action.removeCommentLine",label:w("comment.line.remove","Remove Line Comment"),alias:"Remove Line Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2099),weight:100}})}}class Fz extends Se{constructor(){super({id:"editor.action.blockComment",label:w("comment.block","Toggle Block Comment"),alias:"Toggle Block Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:Ye.MenubarEditMenu,group:"5_insert",title:w({key:"miToggleBlockComment",comment:["&& denotes a mnemonic"]},"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(cs);if(!t.hasModel())return;const n=t.getOption(23),s=[],r=t.getSelections();for(const a of r)s.push(new Pl(a,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}ie(Rz);ie(Az);ie(Oz);ie(Fz);var Hz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bc=function(o,e){return function(t,i){e(t,i,o)}},XS,hd;let Ju=(hd=class{static get(e){return e.getContribution(XS.ID)}constructor(e,t,i,n,s,r,a,c){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=n,this._keybindingService=s,this._menuService=r,this._configurationService=a,this._workspaceContextService=c,this._toDispose=new Oe,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(d=>this._onContextMenu(d))),this._toDispose.add(this._editor.onMouseWheel(d=>{if(this._contextMenuIsBeingShownCount>0){const u=this._contextViewService.getContextViewElement(),f=d.srcElement;f.shadowRoot&&sO(u)===f.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(d=>{this._editor.getOption(24)&&d.keyCode===58&&(d.preventDefault(),d.stopPropagation(),this.showContextMenu())}))}_onContextMenu(e){if(!this._editor.hasModel())return;if(!this._editor.getOption(24)){this._editor.focus(),e.target.position&&!this._editor.getSelection().containsPosition(e.target.position)&&this._editor.setPosition(e.target.position);return}if(e.target.type===12||e.target.type===6&&e.target.detail.injectedText)return;if(e.event.preventDefault(),e.event.stopPropagation(),e.target.type===11)return this._showScrollbarContextMenu(e.event);if(e.target.type!==6&&e.target.type!==7&&e.target.type!==1)return;if(this._editor.focus(),e.target.position){let i=!1;for(const n of this._editor.getSelections())if(n.containsPosition(e.target.position)){i=!0;break}i||this._editor.setPosition(e.target.position)}let t=null;e.target.type!==1&&(t=e.event),this.showContextMenu(t)}showContextMenu(e){if(!this._editor.getOption(24)||!this._editor.hasModel())return;const t=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);t.length>0&&this._doShowContextMenu(t,e)}_getMenuActions(e,t){const i=[],n=this._menuService.getMenuActions(t,this._contextKeyService,{arg:e.uri});for(const s of n){const[,r]=s;let a=0;for(const c of r)if(c instanceof oO){const d=this._getMenuActions(e,c.item.submenu);d.length>0&&(i.push(new DL(c.id,c.label,d)),a++)}else i.push(c),a++;a&&i.push(new kf)}return i.length&&i.pop(),i}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;const i=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let n=t;if(!n){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const r=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),a=Ws(this._editor.getDomNode()),c=a.left+r.left,d=a.top+r.top+r.height;n={x:c,y:d}}const s=this._editor.getOption(128)&&!Oy;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:s?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,getAnchor:()=>n,getActions:()=>e,getActionViewItem:r=>{const a=this._keybindingFor(r);if(a)return new Ny(r,r,{label:!0,keybinding:a.getLabel(),isMenu:!0});const c=r;return typeof c.getActionViewItem=="function"?c.getActionViewItem():new Ny(r,r,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:r=>this._keybindingFor(r),onHide:r=>{this._contextMenuIsBeingShownCount--,this._editor.updateOptions({hover:i})}})}_showScrollbarContextMenu(e){if(!this._editor.hasModel()||rO(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(73);let i=0;const n=d=>({id:`menu-action-${++i}`,label:d.label,tooltip:"",class:void 0,enabled:typeof d.enabled>"u"?!0:d.enabled,checked:d.checked,run:d.run}),s=(d,u)=>new DL(`menu-action-${++i}`,d,u,void 0),r=(d,u,f,m,v)=>{if(!u)return n({label:d,enabled:u,run:()=>{}});const _=S=>()=>{this._configurationService.updateValue(f,S)},y=[];for(const S of v)y.push(n({label:S.label,checked:m===S.value,run:_(S.value)}));return s(d,y)},a=[];a.push(n({label:w("context.minimap.minimap","Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new kf),a.push(n({label:w("context.minimap.renderCharacters","Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(r(w("context.minimap.size","Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:w("context.minimap.size.proportional","Proportional"),value:"proportional"},{label:w("context.minimap.size.fill","Fill"),value:"fill"},{label:w("context.minimap.size.fit","Fit"),value:"fit"}])),a.push(r(w("context.minimap.slider","Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:w("context.minimap.slider.mouseover","Mouse Over"),value:"mouseover"},{label:w("context.minimap.slider.always","Always"),value:"always"}]));const c=this._editor.getOption(128)&&!Oy;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:c?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>a,onHide:d=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}},XS=hd,hd.ID="editor.contrib.contextmenu",hd);Ju=XS=Hz([bc(1,lg),bc(2,Db),bc(3,Ri),bc(4,Zn),bc(5,nh),bc(6,pn),bc(7,Tu)],Ju);class Wz extends Se{constructor(){super({id:"editor.action.showContextMenu",label:w("action.showContextMenu.label","Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;(i=Ju.get(t))==null||i.showContextMenu()}}oi(Ju.ID,Ju,2);ie(Wz);class ny{constructor(e){this.selections=e}equals(e){const t=this.selections.length,i=e.selections.length;if(t!==i)return!1;for(let n=0;n<t;n++)if(!this.selections[n].equalsSelection(e.selections[n]))return!1;return!0}}class sy{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}const jv=class jv extends Be{static get(e){return e.getContribution(jv.ID)}constructor(e){super(),this._editor=e,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(e.onDidChangeModel(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeModelContent(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeCursorSelection(t=>{if(this._isCursorUndoRedo||!t.oldSelections||t.oldModelVersionId!==t.modelVersionId)return;const i=new ny(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new sy(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new sy(new ny(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new sy(new ny(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(e){this._isCursorUndoRedo=!0,this._editor.setSelections(e.cursorState.selections),this._editor.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),this._isCursorUndoRedo=!1}};jv.ID="editor.contrib.cursorUndoRedoController";let Qu=jv;class Bz extends Se{constructor(){super({id:"cursorUndo",label:w("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;(n=Qu.get(t))==null||n.cursorUndo()}}class zz extends Se{constructor(){super({id:"cursorRedo",label:w("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;(n=Qu.get(t))==null||n.cursorRedo()}}oi(Qu.ID,Qu,0);ie(Bz);ie(zz);class Vz{constructor(e,t,i){this.selection=e,this.targetPosition=t,this.copy=i,this.targetSelection=null}getEditOperations(e,t){const i=e.getValueInRange(this.selection);if(this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new H(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),i),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new Mt(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new Mt(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber<this.selection.endLineNumber){this.targetSelection=new Mt(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}this.selection.endColumn<=this.targetPosition.column?this.targetSelection=new Mt(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column-this.selection.endColumn+this.selection.startColumn:this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new Mt(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn)}computeCursorState(e,t){return this.targetSelection}}function Dh(o){return ga?o.altKey:o.ctrlKey}const bl=class bl extends Be{constructor(e){super(),this._editor=e,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._register(this._editor.onMouseUp(t=>this._onEditorMouseUp(t))),this._register(this._editor.onMouseDrag(t=>this._onEditorMouseDrag(t))),this._register(this._editor.onMouseDrop(t=>this._onEditorMouseDrop(t))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(t=>this.onEditorKeyDown(t))),this._register(this._editor.onKeyUp(t=>this.onEditorKeyUp(t))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(e){!this._editor.getOption(35)||this._editor.getOption(22)||(Dh(e)&&(this._modifierPressed=!0),this._mouseDown&&Dh(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(Dh(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===bl.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(e){this._mouseDown=!0}_onEditorMouseUp(e){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(e){const t=e.target;if(this._dragSelection===null){const n=(this._editor.getSelections()||[]).filter(s=>t.position&&s.containsPosition(t.position));if(n.length===1)this._dragSelection=n[0];else return}Dh(e.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),t.position&&(this._dragSelection.containsPosition(t.position)?this._removeDecoration():this.showAt(t.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(e){if(e.target&&(this._hitContent(e.target)||this._hitMargin(e.target))&&e.target.position){const t=new ut(e.target.position.lineNumber,e.target.position.column);if(this._dragSelection===null){let i=null;if(e.event.shiftKey){const n=this._editor.getSelection();if(n){const{selectionStartLineNumber:s,selectionStartColumn:r}=n;i=[new Mt(s,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new Mt(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(Dh(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(bl.ID,new Vz(this._dragSelection,t,Dh(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}showAt(e){this._dndDecorationIds.set([{range:new H(e.lineNumber,e.column,e.lineNumber,e.column),options:bl._DECORATION_OPTIONS}]),this._editor.revealPosition(e,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(e){return e.type===6||e.type===7}_hitMargin(e){return e.type===2||e.type===3||e.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}};bl.ID="editor.contrib.dragAndDrop",bl.TRIGGER_KEY_VALUE=ga?6:5,bl._DECORATION_OPTIONS=pi.register({description:"dnd-target",className:"dnd-target"});let z_=bl;oi(z_.ID,z_,2);oi(Qa.ID,Qa,0);hg(hS);bt(new class extends js{constructor(){super({id:NT,precondition:G0,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e){var t;return(t=Qa.get(e))==null?void 0:t.changePasteType()}});bt(new class extends js{constructor(){super({id:"editor.hidePasteWidget",precondition:G0,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e){var t;(t=Qa.get(e))==null||t.clearWidgets()}});var ud;ie((ud=class extends Se{constructor(){super({id:"editor.action.pasteAs",label:w("pasteAs","Paste As..."),alias:"Paste As...",precondition:M.writable,metadata:{description:"Paste as",args:[{name:"args",schema:ud.argsSchema}]}})}run(e,t,i){var s;let n=typeof(i==null?void 0:i.kind)=="string"?i.kind:void 0;return!n&&i&&(n=typeof i.id=="string"?i.id:void 0),(s=Qa.get(t))==null?void 0:s.pasteAs(n?new fn(n):void 0)}},ud.argsSchema={type:"object",properties:{kind:{type:"string",description:w("pasteAs.kind","The kind of the paste edit to try applying. If not provided or there are multiple edits for this kind, the editor will show a picker.")}}},ud));ie(class extends Se{constructor(){super({id:"editor.action.pasteAsText",label:w("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:M.writable})}run(o,e){var t;return(t=Qa.get(e))==null?void 0:t.pasteAs({providerId:Ud.id})}});class jz{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(e){if(e&&this._dragOperations.has(e)){const t=this._dragOperations.get(e);return this._dragOperations.delete(e),t}}}class WI{constructor(e){this.identifier=e}}const TM=sl("treeViewsDndService");ol(TM,jz,1);var Uz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},pm=function(o,e){return function(t,i){e(t,i,o)}},YS;const MM="editor.experimental.dropIntoEditor.defaultProvider",NM="editor.changeDropType",c1=new yi("dropWidgetVisible",!1,w("dropWidgetVisible","Whether the drop widget is showing"));var gd;let eg=(gd=class extends Be{static get(e){return e.getContribution(YS.ID)}constructor(e,t,i,n,s){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=cS.getInstance(),this._dropProgressManager=this._register(t.createInstance(D_,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(P_,"dropIntoEditor",e,c1,{id:NM,label:w("postDropWidgetTitle","Show drop options...")})),this._register(e.onDropIntoEditor(r=>this.onDropIntoEditor(e,r.position,r.event)))}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,i){var s;if(!i.dataTransfer||!e.hasModel())return;(s=this._currentOperation)==null||s.cancel(),e.focus(),e.setPosition(t);const n=us(async r=>{const a=new Oe,c=a.add(new Mu(e,1,void 0,r));try{const d=await this.extractDataTransferData(i);if(d.size===0||c.token.isCancellationRequested)return;const u=e.getModel();if(!u)return;const f=this._languageFeaturesService.documentDropEditProvider.ordered(u).filter(v=>v.dropMimeTypes?v.dropMimeTypes.some(_=>d.matches(_)):!0),m=a.add(await this.getDropEdits(f,u,t,d,c));if(c.token.isCancellationRequested)return;if(m.edits.length){const v=this.getInitialActiveEditIndex(u,m.edits),_=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([H.fromPositions(t)],{activeEditIndex:v,allEdits:m.edits},_,async y=>y,r)}}finally{a.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,w("dropIntoEditorProgress","Running drop handlers. Click to cancel"),n,{cancel:()=>n.cancel()}),this._currentOperation=n}async getDropEdits(e,t,i,n,s){const r=new Oe,a=await bp(Promise.all(e.map(async d=>{try{const u=await d.provideDocumentDropEdits(t,i,n,s.token);return u&&r.add(u),u==null?void 0:u.edits.map(f=>({...f,providerId:d.id}))}catch(u){console.error(u)}})),s.token),c=Ka(a??[]).flat();return{edits:TT(c),dispose:()=>r.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(MM,{resource:e.uri});for(const[n,s]of Object.entries(i)){const r=new fn(s),a=t.findIndex(c=>r.value===c.providerId&&c.handledMimeType&&ST(n,[c.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new yT;const t=LT(e.dataTransfer);if(this.treeItemsTransfer.hasData(WI.prototype)){const i=this.treeItemsTransfer.getData(WI.prototype);if(Array.isArray(i))for(const n of i){const s=await this._treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(s)for(const[r,a]of s)t.replace(r,a)}}return t}},YS=gd,gd.ID="editor.contrib.dropIntoEditorController",gd);eg=YS=Uz([pm(1,qt),pm(2,pn),pm(3,gt),pm(4,TM)],eg);oi(eg.ID,eg,2);hg(dS);bt(new class extends js{constructor(){super({id:NM,precondition:c1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){var i;(i=eg.get(e))==null||i.changeDropType()}});bt(new class extends js{constructor(){super({id:"editor.hideDropWidget",precondition:c1,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e,t){var i;(i=eg.get(e))==null||i.clearWidgets()}});Tr.as(Sp.Configuration).registerConfiguration({...Pb,properties:{[MM]:{type:"object",scope:5,description:w("defaultProviderDescription","Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});const Ss=class Ss{constructor(e){this._editor=e,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){const e=this._findScopeDecorationIds.map(t=>this._editor.getModel().getDecorationRange(t)).filter(t=>!!t);if(e.length)return e}return null}getStartPosition(){return this._startPosition}setStartPosition(e){this._startPosition=e,this.setCurrentFindMatch(null)}_getDecorationIndex(e){const t=this._decorations.indexOf(e);return t>=0?t+1:1}getDecorationRangeAt(e){const t=e<this._decorations.length?this._decorations[e]:null;return t?this._editor.getModel().getDecorationRange(t):null}getCurrentMatchesPosition(e){const t=this._editor.getModel().getDecorationsInRange(e);for(const i of t){const n=i.options;if(n===Ss._FIND_MATCH_DECORATION||n===Ss._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(i.id)}return 0}setCurrentFindMatch(e){let t=null,i=0;if(e)for(let n=0,s=this._decorations.length;n<s;n++){const r=this._editor.getModel().getDecorationRange(this._decorations[n]);if(e.equalsRange(r)){t=this._decorations[n],i=n+1;break}}return(this._highlightedDecorationId!==null||t!==null)&&this._editor.changeDecorations(n=>{if(this._highlightedDecorationId!==null&&(n.changeDecorationOptions(this._highlightedDecorationId,Ss._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,Ss._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(n.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),t!==null){let s=this._editor.getModel().getDecorationRange(t);if(s.startLineNumber!==s.endLineNumber&&s.endColumn===1){const r=s.endLineNumber-1,a=this._editor.getModel().getLineMaxColumn(r);s=new H(s.startLineNumber,s.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(s,Ss._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=Ss._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){n=Ss._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),d=this._editor.getLayoutInfo().height/a,u=Math.max(2,Math.ceil(3/d));let f=e[0].range.startLineNumber,m=e[0].range.endLineNumber;for(let v=1,_=e.length;v<_;v++){const y=e[v].range;m+u>=y.startLineNumber?y.endLineNumber>m&&(m=y.endLineNumber):(s.push({range:new H(f,1,m,1),options:Ss._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),f=y.startLineNumber,m=y.endLineNumber)}s.push({range:new H(f,1,m,1),options:Ss._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(e.length);for(let a=0,c=e.length;a<c;a++)r[a]={range:e[a].range,options:n};this._decorations=i.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=i.deltaDecorations(this._overviewRulerApproximateDecorations,s),this._rangeHighlightDecorationId&&(i.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach(a=>i.removeDecoration(a)),this._findScopeDecorationIds=[]),t!=null&&t.length&&(this._findScopeDecorationIds=t.map(a=>i.addDecoration(a,Ss._FIND_SCOPE_DECORATION)))})}matchBeforePosition(e){if(this._decorations.length===0)return null;for(let t=this._decorations.length-1;t>=0;t--){const i=this._decorations[t],n=this._editor.getModel().getDecorationRange(i);if(!(!n||n.endLineNumber>e.lineNumber)){if(n.endLineNumber<e.lineNumber)return n;if(!(n.endColumn>e.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(this._decorations.length===0)return null;for(let t=0,i=this._decorations.length;t<i;t++){const n=this._decorations[t],s=this._editor.getModel().getDecorationRange(n);if(!(!s||s.startLineNumber<e.lineNumber)){if(s.startLineNumber>e.lineNumber)return s;if(!(s.startColumn<e.column))return s}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let e=[];return e=e.concat(this._decorations),e=e.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&e.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&e.push(this._rangeHighlightDecorationId),e}};Ss._CURRENT_FIND_MATCH_DECORATION=pi.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:Yn(Aw),position:aa.Center},minimap:{color:Yn(EL),position:1}}),Ss._FIND_MATCH_DECORATION=pi.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:Yn(Aw),position:aa.Center},minimap:{color:Yn(EL),position:1}}),Ss._FIND_MATCH_NO_OVERVIEW_DECORATION=pi.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),Ss._FIND_MATCH_ONLY_OVERVIEW_DECORATION=pi.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Yn(Aw),position:aa.Center}}),Ss._RANGE_HIGHLIGHT_DECORATION=pi.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),Ss._FIND_SCOPE_DECORATION=pi.register({description:"find-scope",className:"findScope",isWholeLine:!0});let JS=Ss;class $z{constructor(e,t,i){this._editorSelection=e,this._ranges=t,this._replaceStrings=i,this._trackedEditorSelectionId=null}getEditOperations(e,t){if(this._ranges.length>0){const i=[];for(let r=0;r<this._ranges.length;r++)i.push({range:this._ranges[r],text:this._replaceStrings[r]});i.sort((r,a)=>H.compareRangesUsingStarts(r.range,a.range));const n=[];let s=i[0];for(let r=1;r<i.length;r++)s.range.endLineNumber===i[r].range.startLineNumber&&s.range.endColumn===i[r].range.startColumn?(s.range=s.range.plusRange(i[r].range),s.text=s.text+i[r].text):(n.push(s),s=i[r]);n.push(s);for(const r of n)t.addEditOperation(r.range,r.text)}this._trackedEditorSelectionId=t.trackSelection(this._editorSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._trackedEditorSelectionId)}}function RM(o,e){if(o&&o[0]!==""){const t=BI(o,e,"-"),i=BI(o,e,"_");return t&&!i?zI(o,e,"-"):!t&&i?zI(o,e,"_"):o[0].toUpperCase()===o[0]?e.toUpperCase():o[0].toLowerCase()===o[0]?e.toLowerCase():aO(o[0][0])&&e.length>0?e[0].toUpperCase()+e.substr(1):o[0][0].toUpperCase()!==o[0][0]&&e.length>0?e[0].toLowerCase()+e.substr(1):e}else return e}function BI(o,e,t){return o[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&o[0].split(t).length===e.split(t).length}function zI(o,e,t){const i=e.split(t),n=o[0].split(t);let s="";return i.forEach((r,a)=>{s+=RM([n[a]],r)+t}),s.slice(0,-1)}class VI{constructor(e){this.staticValue=e,this.kind=0}}class qz{constructor(e){this.pieces=e,this.kind=1}}class tg{static fromStaticValue(e){return new tg([Gc.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new VI(""):e.length===1&&e[0].staticValue!==null?this._state=new VI(e[0].staticValue):this._state=new qz(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?RM(e,this._state.staticValue):this._state.staticValue;let i="";for(let n=0,s=this._state.pieces.length;n<s;n++){const r=this._state.pieces[n];if(r.staticValue!==null){i+=r.staticValue;continue}let a=tg._substitute(r.matchIndex,e);if(r.caseOps!==null&&r.caseOps.length>0){const c=[],d=r.caseOps.length;let u=0;for(let f=0,m=a.length;f<m;f++){if(u>=d){c.push(a.slice(f));break}switch(r.caseOps[u]){case"U":c.push(a[f].toUpperCase());break;case"u":c.push(a[f].toUpperCase()),u++;break;case"L":c.push(a[f].toLowerCase());break;case"l":c.push(a[f].toLowerCase()),u++;break;default:c.push(a[f])}}a=c.join("")}i+=a}return i}static _substitute(e,t){if(t===null)return"";if(e===0)return t[0];let i="";for(;e>0;){if(e<t.length)return(t[e]||"")+i;i=String(e%10)+i,e=Math.floor(e/10)}return"$"+i}}class Gc{static staticValue(e){return new Gc(e,-1,null)}static caseOps(e,t){return new Gc(null,e,t)}constructor(e,t,i){this.staticValue=e,this.matchIndex=t,!i||i.length===0?this.caseOps=null:this.caseOps=i.slice(0)}}class Kz{constructor(e){this._source=e,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(e){this._emitStatic(this._source.substring(this._lastCharIndex,e)),this._lastCharIndex=e}emitStatic(e,t){this._emitStatic(e),this._lastCharIndex=t}_emitStatic(e){e.length!==0&&(this._currentStaticPiece+=e)}emitMatchIndex(e,t,i){this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Gc.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Gc.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Gc.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new tg(this._result)}}function Gz(o){if(!o||o.length===0)return new tg(null);const e=[],t=new Kz(o);for(let i=0,n=o.length;i<n;i++){const s=o.charCodeAt(i);if(s===92){if(i++,i>=n)break;const r=o.charCodeAt(i);switch(r){case 92:t.emitUnchanged(i-1),t.emitStatic("\\",i+1);break;case 110:t.emitUnchanged(i-1),t.emitStatic(`
|
|
20
|
-
`,i+1);break;case 116:t.emitUnchanged(i-1),t.emitStatic(" ",i+1);break;case 117:case 85:case 108:case 76:t.emitUnchanged(i-1),t.emitStatic("",i+1),e.push(String.fromCharCode(r));break}continue}if(s===36){if(i++,i>=n)break;const r=o.charCodeAt(i);if(r===36){t.emitUnchanged(i-1),t.emitStatic("$",i+1);continue}if(r===48||r===38){t.emitUnchanged(i-1),t.emitMatchIndex(0,i+1,e),e.length=0;continue}if(49<=r&&r<=57){let a=r-48;if(i+1<n){const c=o.charCodeAt(i+1);if(48<=c&&c<=57){i++,a=a*10+(c-48),t.emitUnchanged(i-2),t.emitMatchIndex(a,i+1,e),e.length=0;continue}}t.emitUnchanged(i-1),t.emitMatchIndex(a,i+1,e),e.length=0;continue}}}return t.finalize()}const cl=new yi("findWidgetVisible",!1);cl.toNegated();const lw=new yi("findInputFocussed",!1),d1=new yi("replaceInputFocussed",!1),mm={primary:545,mac:{primary:2593}},_m={primary:565,mac:{primary:2613}},vm={primary:560,mac:{primary:2608}},bm={primary:554,mac:{primary:2602}},wm={primary:558,mac:{primary:2606}},sn={StartFindAction:"actions.find",StartFindWithSelection:"actions.findWithSelection",StartFindWithArgs:"editor.actions.findWithArgs",NextMatchFindAction:"editor.action.nextMatchFindAction",PreviousMatchFindAction:"editor.action.previousMatchFindAction",GoToMatchFindAction:"editor.action.goToMatchFindAction",NextSelectionMatchFindAction:"editor.action.nextSelectionMatchFindAction",PreviousSelectionMatchFindAction:"editor.action.previousSelectionMatchFindAction",StartFindReplaceAction:"editor.action.startFindReplaceAction",CloseFindWidgetCommand:"closeFindWidget",ToggleCaseSensitiveCommand:"toggleFindCaseSensitive",ToggleWholeWordCommand:"toggleFindWholeWord",ToggleRegexCommand:"toggleFindRegex",ToggleSearchScopeCommand:"toggleFindInSelection",TogglePreserveCaseCommand:"togglePreserveCase",ReplaceOneAction:"editor.action.replaceOne",ReplaceAllAction:"editor.action.replaceAll",SelectAllMatchesAction:"editor.action.selectAllMatches"},Tl=19999,Zz=240;class df{constructor(e,t){this._toDispose=new Oe,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new wp,this._decorations=new JS(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new ts(()=>{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(i=>{(i.reason===3||i.reason===5||i.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(i=>{this._ignoreModelContentChanged||(i.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(i=>this._onStateChanged(i))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,Ds(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(e){this._isDisposed||this._editor.hasModel()&&(e.searchString||e.isReplaceRevealed||e.isRegex||e.wholeWord||e.matchCase||e.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor)},Zz)):e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor))}static _getSearchRange(e,t){return t||e.getFullModelRange()}research(e,t){let i=null;typeof t<"u"?t!==null&&(Array.isArray(t)?i=t:i=[t]):i=this._decorations.getFindScopes(),i!==null&&(i=i.map(a=>{if(a.startLineNumber!==a.endLineNumber){let c=a.endLineNumber;return a.endColumn===1&&(c=c-1),new H(a.startLineNumber,1,c,this._editor.getModel().getLineMaxColumn(c))}return a}));const n=this._findMatches(i,!1,Tl);this._decorations.set(n,i);const s=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(s);if(r===0&&n.length>0){const a=sE(n.map(c=>c.range),c=>H.compareRangesUsingStarts(c,s)>=0);r=a>0?a-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),e&&this._editor.getOption(41).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const e=this._decorations.getFindScope();return e&&this._editor.revealRangeInCenterIfOutsideViewport(e,0),!0}return!1}_setCurrentFindMatch(e){const t=this._decorations.setCurrentFindMatch(e);this._state.changeMatchInfo(t,this._decorations.getCount(),e),this._editor.setSelection(e),this._editor.revealRangeInCenterIfOutsideViewport(e,0)}_prevSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:n}=e;const s=this._editor.getModel();return t||n===1?(i===1?i=s.getLineCount():i--,n=s.getLineMaxColumn(i)):n--,new ut(i,n)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const u=this._decorations.matchAfterPosition(e);u&&this._setCurrentFindMatch(u);return}if(this._decorations.getCount()<Tl){let u=this._decorations.matchBeforePosition(e);u&&u.isEmpty()&&u.getStartPosition().equals(e)&&(e=this._prevSearchPosition(e),u=this._decorations.matchBeforePosition(e)),u&&this._setCurrentFindMatch(u);return}if(this._cannotFind())return;const i=this._decorations.getFindScope(),n=df._getSearchRange(this._editor.getModel(),i);n.getEndPosition().isBefore(e)&&(e=n.getEndPosition()),e.isBefore(n.getStartPosition())&&(e=n.getEndPosition());const{lineNumber:s,column:r}=e,a=this._editor.getModel();let c=new ut(s,r),d=a.findPreviousMatch(this._state.searchString,c,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,!1);if(d&&d.range.isEmpty()&&d.range.getStartPosition().equals(c)&&(c=this._prevSearchPosition(c),d=a.findPreviousMatch(this._state.searchString,c,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,!1)),!!d){if(!t&&!n.containsRange(d.range))return this._moveToPrevMatch(d.range.getStartPosition(),!0);this._setCurrentFindMatch(d.range)}}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:n}=e;const s=this._editor.getModel();return t||n===s.getLineMaxColumn(i)?(i===s.getLineCount()?i=1:i++,n=1):n++,new ut(i,n)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()<Tl){let i=this._decorations.matchAfterPosition(e);i&&i.isEmpty()&&i.getStartPosition().equals(e)&&(e=this._nextSearchPosition(e),i=this._decorations.matchAfterPosition(e)),i&&this._setCurrentFindMatch(i);return}const t=this._getNextMatch(e,!1,!0);t&&this._setCurrentFindMatch(t.range)}_getNextMatch(e,t,i,n=!1){if(this._cannotFind())return null;const s=this._decorations.getFindScope(),r=df._getSearchRange(this._editor.getModel(),s);r.getEndPosition().isBefore(e)&&(e=r.getStartPosition()),e.isBefore(r.getStartPosition())&&(e=r.getStartPosition());const{lineNumber:a,column:c}=e,d=this._editor.getModel();let u=new ut(a,c),f=d.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t);return i&&f&&f.range.isEmpty()&&f.range.getStartPosition().equals(u)&&(u=this._nextSearchPosition(u),f=d.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t)),f?!n&&!r.containsRange(f.range)?this._getNextMatch(f.range.getEndPosition(),t,i,!0):f:null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(e){const t=this._decorations.getDecorationRangeAt(e);t&&this._setCurrentFindMatch(t)}moveToMatch(e){this._moveToMatch(e)}_getReplacePattern(){return this._state.isRegex?Gz(this._state.replaceString):tg.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;const e=this._getReplacePattern(),t=this._editor.getSelection(),i=this._getNextMatch(t.getStartPosition(),!0,!1);if(i)if(t.equalsRange(i.range)){const n=e.buildReplaceString(i.matches,this._state.preserveCase),s=new vp(t,n);this._executeEditorCommand("replace",s),this._decorations.setStartPosition(new ut(t.startLineNumber,t.startColumn+n.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(i.range)}_findMatches(e,t,i){const n=(e||[null]).map(s=>df._getSearchRange(this._editor.getModel(),s));return this._editor.getModel().findMatches(this._state.searchString,n,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t,i)}replaceAll(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();e===null&&this._state.matchesCount>=Tl?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new lO(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null).parseSearchRequest();if(!t)return;let i=t.regex;if(!i.multiline){let f="mu";i.ignoreCase&&(f+="i"),i.global&&(f+="g"),i=new RegExp(i.source,f)}const n=this._editor.getModel(),s=n.getValue(1),r=n.getFullModelRange(),a=this._getReplacePattern();let c;const d=this._state.preserveCase;a.hasReplacementPatterns||d?c=s.replace(i,function(){return a.buildReplaceString(arguments,d)}):c=s.replace(i,a.buildReplaceString(null,d));const u=new oE(r,c,this._editor.getSelection());this._executeEditorCommand("replaceAll",u)}_regularReplaceAll(e){const t=this._getReplacePattern(),i=this._findMatches(e,t.hasReplacementPatterns||this._state.preserveCase,1073741824),n=[];for(let r=0,a=i.length;r<a;r++)n[r]=t.buildReplaceString(i[r].matches,this._state.preserveCase);const s=new $z(this._editor.getSelection(),i.map(r=>r.range),n);this._executeEditorCommand("replaceAll",s)}selectAllMatches(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();let i=this._findMatches(e,!1,1073741824).map(s=>new Mt(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn));const n=this._editor.getSelection();for(let s=0,r=i.length;s<r;s++)if(i[s].equalsRange(n)){i=[n].concat(i.slice(0,s)).concat(i.slice(s+1));break}this._editor.setSelections(i)}_executeEditorCommand(e,t){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(e,t),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}}const Uv=class Uv extends xp{constructor(e,t,i){super(),this._hideSoon=this._register(new ts(()=>this._hide(),2e3)),this._isVisible=!1,this._editor=e,this._state=t,this._keybindingService=i,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");const n={inputActiveOptionBorder:Bc(aE),inputActiveOptionForeground:Bc(rE),inputActiveOptionBackground:Bc(d0)},s=this._register(Fy());this.caseSensitive=this._register(new cO({appendTitle:this._keybindingLabelFor(sn.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverDelegate:s,...n})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new dO({appendTitle:this._keybindingLabelFor(sn.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverDelegate:s,...n})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new hO({appendTitle:this._keybindingLabelFor(sn.ToggleRegexCommand),isChecked:this._state.isRegex,hoverDelegate:s,...n})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange(()=>{this._state.change({isRegex:this.regex.checked},!1)})),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange(r=>{let a=!1;r.isRegex&&(this.regex.checked=this._state.isRegex,a=!0),r.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,a=!0),r.matchCase&&(this.caseSensitive.checked=this._state.matchCase,a=!0),!this._state.isRevealed&&a&&this._revealTemporarily()})),this._register(Ni(this._domNode,Cn.MOUSE_LEAVE,r=>this._onMouseLeave())),this._register(Ni(this._domNode,"mouseover",r=>this._onMouseOver()))}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return Uv.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}};Uv.ID="editor.contrib.findOptionsWidget";let QS=Uv;function ym(o,e){return o===1?!0:o===2?!1:e}class Xz extends Be{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return ym(this._isRegexOverride,this._isRegex)}get wholeWord(){return ym(this._wholeWordOverride,this._wholeWord)}get matchCase(){return ym(this._matchCaseOverride,this._matchCase)}get preserveCase(){return ym(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}constructor(){super(),this._onFindReplaceStateChange=this._register(new ti),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}changeMatchInfo(e,t,i){const n={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,n.matchesPosition=!0,s=!0),this._matchesCount!==t&&(this._matchesCount=t,n.matchesCount=!0,s=!0),typeof i<"u"&&(H.equalsRange(this._currentMatch,i)||(this._currentMatch=i,n.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(n)}change(e,t,i=!0){var u;const n={moveCursor:t,updateHistory:i,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;const r=this.isRegex,a=this.wholeWord,c=this.matchCase,d=this.preserveCase;typeof e.searchString<"u"&&this._searchString!==e.searchString&&(this._searchString=e.searchString,n.searchString=!0,s=!0),typeof e.replaceString<"u"&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,n.replaceString=!0,s=!0),typeof e.isRevealed<"u"&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,n.isRevealed=!0,s=!0),typeof e.isReplaceRevealed<"u"&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,n.isReplaceRevealed=!0,s=!0),typeof e.isRegex<"u"&&(this._isRegex=e.isRegex),typeof e.wholeWord<"u"&&(this._wholeWord=e.wholeWord),typeof e.matchCase<"u"&&(this._matchCase=e.matchCase),typeof e.preserveCase<"u"&&(this._preserveCase=e.preserveCase),typeof e.searchScope<"u"&&((u=e.searchScope)!=null&&u.every(f=>{var m;return(m=this._searchScope)==null?void 0:m.some(v=>!H.equalsRange(v,f))})||(this._searchScope=e.searchScope,n.searchScope=!0,s=!0)),typeof e.loop<"u"&&this._loop!==e.loop&&(this._loop=e.loop,n.loop=!0,s=!0),typeof e.isSearching<"u"&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,n.isSearching=!0,s=!0),typeof e.filters<"u"&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,n.filters=!0,s=!0),this._isRegexOverride=typeof e.isRegexOverride<"u"?e.isRegexOverride:0,this._wholeWordOverride=typeof e.wholeWordOverride<"u"?e.wholeWordOverride:0,this._matchCaseOverride=typeof e.matchCaseOverride<"u"?e.matchCaseOverride:0,this._preserveCaseOverride=typeof e.preserveCaseOverride<"u"?e.preserveCaseOverride:0,r!==this.isRegex&&(s=!0,n.isRegex=!0),a!==this.wholeWord&&(s=!0,n.wholeWord=!0),c!==this.matchCase&&(s=!0,n.matchCase=!0),d!==this.preserveCase&&(s=!0,n.preserveCase=!0),s&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=Tl}}const Yz=w("defaultLabel","input"),Jz=w("label.preserveCaseToggle","Preserve Case");class Qz extends lE{constructor(e){super({icon:Ot.preserveCase,title:Jz+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Ob("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class eV extends xp{constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new ti),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new ti),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new ti),this._onInput=this._register(new ti),this._onKeyUp=this._register(new ti),this._onPreserveCaseKeyDown=this._register(new ti),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||Yz;const s=n.appendPreserveCaseLabel||"",r=n.history||[],a=!!n.flexibleHeight,c=!!n.flexibleWidth,d=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new uO(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:r,showHistoryHint:n.showHistoryHint,flexibleHeight:a,flexibleWidth:c,flexibleMaxHeight:d,inputBoxStyles:n.inputBoxStyles})),this.preserveCase=this._register(new Qz({appendTitle:s,isChecked:!1,...n.toggleStyles})),this._register(this.preserveCase.onChange(m=>{this._onDidOptionChange.fire(m),!m&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(m=>{this._onPreserveCaseKeyDown.fire(m)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;const u=[this.preserveCase.domNode];this.onkeydown(this.domNode,m=>{if(m.equals(15)||m.equals(17)||m.equals(9)){const v=u.indexOf(this.domNode.ownerDocument.activeElement);if(v>=0){let _=-1;m.equals(17)?_=(v+1)%u.length:m.equals(15)&&(v===0?_=u.length-1:_=v-1),m.equals(9)?(u[v].blur(),this.inputBox.focus()):_>=0&&u[_].focus(),u_.stop(m,!0)}}});const f=document.createElement("div");f.className="controls",f.style.display=this._showOptionButtons?"block":"none",f.appendChild(this.preserveCase.domNode),this.domNode.appendChild(f),e==null||e.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,m=>this._onKeyDown.fire(m)),this.onkeyup(this.inputBox.inputElement,m=>this._onKeyUp.fire(m)),this.oninput(this.inputBox.inputElement,m=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,m=>this._onMouseDown.fire(m))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setEnabled(e){e?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}validate(){var e;(e=this.inputBox)==null||e.validate()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+"px"}dispose(){super.dispose()}}var AM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},OM=function(o,e){return function(t,i){e(t,i,o)}};const h1=new yi("suggestWidgetVisible",!1,w("suggestWidgetVisible","Whether suggestion are visible")),u1="historyNavigationWidgetFocus",FM="historyNavigationForwardsEnabled",HM="historyNavigationBackwardsEnabled";let $a;const Sm=[];function WM(o,e){if(Sm.includes(e))throw new Error("Cannot register the same widget multiple times");Sm.push(e);const t=new Oe,i=new yi(u1,!1).bindTo(o),n=new yi(FM,!0).bindTo(o),s=new yi(HM,!0).bindTo(o),r=()=>{i.set(!0),$a=e},a=()=>{i.set(!1),$a===e&&($a=void 0)};return fO(e.element)&&r(),t.add(e.onDidFocus(()=>r())),t.add(e.onDidBlur(()=>a())),t.add(gn(()=>{Sm.splice(Sm.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let eC=class extends gO{constructor(e,t,i,n){super(e,t,i);const s=this._register(n.createScoped(this.inputBox.element));this._register(WM(s,this.inputBox))}};eC=AM([OM(3,Ri)],eC);let tC=class extends eV{constructor(e,t,i,n,s=!1){super(e,t,s,i);const r=this._register(n.createScoped(this.inputBox.element));this._register(WM(r,this.inputBox))}};tC=AM([OM(3,Ri)],tC);_a.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:le.and(le.has(u1),le.equals(HM,!0),le.not("isComposing"),h1.isEqualTo(!1)),primary:16,secondary:[528],handler:o=>{$a==null||$a.showPreviousValue()}});_a.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:le.and(le.has(u1),le.equals(FM,!0),le.not("isComposing"),h1.isEqualTo(!1)),primary:18,secondary:[530],handler:o=>{$a==null||$a.showNextValue()}});function jI(o){var e,t;return((e=o.lookupKeybinding("history.showPrevious"))==null?void 0:e.getElectronAccelerator())==="Up"&&((t=o.lookupKeybinding("history.showNext"))==null?void 0:t.getElectronAccelerator())==="Down"}const UI=Wn("find-collapsed",Ot.chevronRight,w("findCollapsedIcon","Icon to indicate that the editor find widget is collapsed.")),$I=Wn("find-expanded",Ot.chevronDown,w("findExpandedIcon","Icon to indicate that the editor find widget is expanded.")),tV=Wn("find-selection",Ot.selection,w("findSelectionIcon","Icon for 'Find in Selection' in the editor find widget.")),iV=Wn("find-replace",Ot.replace,w("findReplaceIcon","Icon for 'Replace' in the editor find widget.")),nV=Wn("find-replace-all",Ot.replaceAll,w("findReplaceAllIcon","Icon for 'Replace All' in the editor find widget.")),sV=Wn("find-previous-match",Ot.arrowUp,w("findPreviousMatchIcon","Icon for 'Find Previous' in the editor find widget.")),oV=Wn("find-next-match",Ot.arrowDown,w("findNextMatchIcon","Icon for 'Find Next' in the editor find widget.")),rV=w("label.findDialog","Find / Replace"),aV=w("label.find","Find"),lV=w("placeholder.find","Find"),cV=w("label.previousMatchButton","Previous Match"),dV=w("label.nextMatchButton","Next Match"),hV=w("label.toggleSelectionFind","Find in Selection"),uV=w("label.closeButton","Close"),gV=w("label.replace","Replace"),fV=w("placeholder.replace","Replace"),pV=w("label.replaceButton","Replace"),mV=w("label.replaceAllButton","Replace All"),_V=w("label.toggleReplaceButton","Toggle Replace"),vV=w("title.matchesCountLimit","Only the first {0} results are highlighted, but all find operations work on the entire text.",Tl),bV=w("label.matchesLocation","{0} of {1}"),qI=w("label.noResults","No results"),Vr=419,wV=275,yV=wV-54;let Mg=69;const SV=33,KI="ctrlEnterReplaceAll.windows.donotask",GI=ga?256:2048;class oy{constructor(e){this.afterLineNumber=e,this.heightInPx=SV,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function ZI(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){o.stopPropagation();return}}function XI(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEnd<t.value.length){o.stopPropagation();return}}const $v=class $v extends xp{constructor(e,t,i,n,s,r,a,c,d,u){super(),this._hoverService=u,this._cachedHeight=null,this._revealTimeouts=[],this._codeEditor=e,this._controller=t,this._state=i,this._contextViewProvider=n,this._keybindingService=s,this._contextKeyService=r,this._storageService=c,this._notificationService=d,this._ctrlEnterReplaceAllWarningPrompted=!!c.getBoolean(KI,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new ic(500),this._register(gn(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(f=>this._onStateChanged(f))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(f=>{if(f.hasChanged(92)&&(this._codeEditor.getOption(92)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),f.hasChanged(146)&&this._tryUpdateWidgetWidth(),f.hasChanged(2)&&this.updateAccessibilitySupport(),f.hasChanged(41)){const m=this._codeEditor.getOption(41).loop;this._state.change({loop:m},!1);const v=this._codeEditor.getOption(41).addExtraSpaceOnTop;v&&!this._viewZone&&(this._viewZone=new oy(0),this._showViewZone()),!v&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){const f=await this._controller.getGlobalBufferTerm();f&&f!==this._state.searchString&&(this._state.change({searchString:f},!1),this._findInput.select())}})),this._findInputFocused=lw.bindTo(r),this._findFocusTracker=this._register(Nu(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus(()=>{this._findInputFocused.set(!0),this._updateSearchScope()})),this._register(this._findFocusTracker.onDidBlur(()=>{this._findInputFocused.set(!1)})),this._replaceInputFocused=d1.bindTo(r),this._replaceFocusTracker=this._register(Nu(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus(()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()})),this._register(this._replaceFocusTracker.onDidBlur(()=>{this._replaceInputFocused.set(!1)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(41).addExtraSpaceOnTop&&(this._viewZone=new oy(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(f=>{if(f.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return $v.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?!this._codeEditor.getOption(92)&&!this._isReplaceVisible&&(this._isReplaceVisible=!0,this._replaceInput.width=$o(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){const t=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",t),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,on)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){var t;this._matchesCount.style.minWidth=Mg+"px",this._state.matchesCount>=Tl?this._matchesCount.title=vV:this._matchesCount.title="",(t=this._matchesCount.firstChild)==null||t.remove();let e;if(this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=Tl&&(i+="+");let n=String(this._state.matchesPosition);n==="0"&&(n="?"),e=w0(bV,n,i)}else e=qI;this._matchesCount.appendChild(document.createTextNode(e)),or(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),Mg=Math.max(Mg,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===qI)return i===""?w("ariaSearchNoResultEmpty","{0} found",e):w("ariaSearchNoResult","{0} found for '{1}'",e,i);if(t){const n=w("ariaSearchNoResultWithLineNum","{0} found for '{1}', at {2}",e,i,t.startLineNumber+":"+t.startColumn),s=this._codeEditor.getModel();return s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1?`${s.getLineContent(t.startLineNumber)}, ${n}`:n}return w("ariaSearchNoResultWithLineNumNoCurrentMatch","{0} found for '{1}'",e,i)}_updateToggleSelectionFindButton(){const e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,i=this._toggleSelectionFind.checked;this._isVisible&&(i||t)?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);const e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const i=!this._codeEditor.getOption(92);this._toggleReplaceBtn.setEnabled(this._isVisible&&i)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(41).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{const i=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=i;break}}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout(()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")},0)),this._revealTimeouts.push(setTimeout(()=>{this._findInput.validate()},200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(41).seedSearchStringFromSelection&&e){const i=this._codeEditor.getDomNode();if(i){const n=Ws(i),s=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),r=n.left+(s?s.left:0),a=s?s.top:0;if(this._viewZone&&a<this._viewZone.heightInPx){e.endLineNumber>e.startLineNumber&&(t=!1);const c=pO(this._domNode).left;r>c&&(t=!1);const d=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());n.left+(d?d.left:0)>c&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(t=>{clearTimeout(t)}),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(41).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;const i=this._viewZone;this._viewZoneId!==void 0||!i||this._codeEditor.changeViewZones(n=>{i.heightInPx=this._getHeight(),this._viewZoneId=n.addZone(i),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+i.heightInPx)})}_showViewZone(e=!0){if(!this._isVisible||!this._codeEditor.getOption(41).addExtraSpaceOnTop)return;this._viewZone===void 0&&(this._viewZone=new oy(0));const i=this._viewZone;this._codeEditor.changeViewZones(n=>{if(this._viewZoneId!==void 0){const s=this._getHeight();if(s===i.heightInPx)return;const r=s-i.heightInPx;i.heightInPx=s,n.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+r);return}else{let s=this._getHeight();if(s-=this._codeEditor.getOption(84).top,s<=0)return;i.heightInPx=s,this._viewZoneId=n.addZone(i),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}})}_removeViewZone(){this._codeEditor.changeViewZones(e=>{this._viewZoneId!==void 0&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))})}_tryUpdateWidgetWidth(){if(!this._isVisible||!this._domNode.isConnected)return;const e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");const i=e.width,n=e.minimap.minimapWidth;let s=!1,r=!1,a=!1;if(this._resized&&$o(this._domNode)>Vr){this._domNode.style.maxWidth=`${i-28-n-15}px`,this._replaceInput.width=$o(this._findInput.domNode);return}if(Vr+28+n>=i&&(r=!0),Vr+28+n-Mg>=i&&(a=!0),Vr+28+n-Mg>=i+50&&(s=!0),this._domNode.classList.toggle("collapsed-find-widget",s),this._domNode.classList.toggle("narrow-find-widget",a),this._domNode.classList.toggle("reduced-find-widget",r),!a&&!s&&(this._domNode.style.maxWidth=`${i-28-n-15}px`),this._findInput.layout({collapsedFindWidget:s,narrowFindWidget:a,reducedFindWidget:r}),this._resized){const c=this._findInput.inputBox.element.clientWidth;c>0&&(this._replaceInput.width=c)}else this._isReplaceVisible&&(this._replaceInput.width=$o(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){const e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){const e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));const i=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!H.equalsRange(t,i)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(GI|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
|
|
21
|
-
`),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return ZI(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return XI(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(GI|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{Lb&&dg&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(w("ctrlEnter.keybindingChanged","Ctrl+Enter now inserts line break instead of replacing all. You can modify the keybinding for editor.action.replaceAll to override this behavior.")),this._ctrlEnterReplaceAllWarningPrompted=!0,this._storageService.store(KI,!0,0,0)),this._replaceInput.inputBox.insertAtCursor(`
|
|
22
|
-
`),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return ZI(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return XI(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new eC(null,this._contextViewProvider,{width:yV,label:aV,placeholder:lV,appendCaseSensitiveLabel:this._keybindingLabelFor(sn.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(sn.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(sn.ToggleRegexCommand),validation:u=>{if(u.length===0||!this._findInput.getRegex())return null;try{return new RegExp(u,"gu"),null}catch(f){return{content:f.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>jI(this._keybindingService),inputBoxStyles:TL,toggleStyles:PL},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown(u=>this._onFindInputKeyDown(u))),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||this._state.change({searchString:this._findInput.getValue()},!0)})),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._findInput.onCaseSensitiveKeyDown(u=>{u.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),u.preventDefault())})),this._register(this._findInput.onRegexKeyDown(u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),u.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(u=>{this._tryUpdateHeight()&&this._showViewZone()})),mO&&this._register(this._findInput.onMouseDown(u=>this._onFindInputMouseDown(u))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(Fy());this._prevBtn=this._register(new Eh({label:cV+this._keybindingLabelFor(sn.PreviousMatchFindAction),icon:sV,hoverDelegate:i,onTrigger:()=>{Kh(this._codeEditor.getAction(sn.PreviousMatchFindAction)).run().then(void 0,on)}},this._hoverService)),this._nextBtn=this._register(new Eh({label:dV+this._keybindingLabelFor(sn.NextMatchFindAction),icon:oV,hoverDelegate:i,onTrigger:()=>{Kh(this._codeEditor.getAction(sn.NextMatchFindAction)).run().then(void 0,on)}},this._hoverService));const n=document.createElement("div");n.className="find-part",n.appendChild(this._findInput.domNode);const s=document.createElement("div");s.className="find-actions",n.appendChild(s),s.appendChild(this._matchesCount),s.appendChild(this._prevBtn.domNode),s.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new lE({icon:tV,title:hV+this._keybindingLabelFor(sn.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:Bc(d0),inputActiveOptionBorder:Bc(aE),inputActiveOptionForeground:Bc(rE)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let u=this._codeEditor.getSelections();u=u.map(f=>(f.endColumn===1&&f.endLineNumber>f.startLineNumber&&(f=f.setEndPosition(f.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(f.endLineNumber-1))),f.isEmpty()?null:f)).filter(f=>!!f),u.length&&this._state.change({searchScope:u},!0)}}else this._state.change({searchScope:null},!0)})),s.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new Eh({label:uV+this._keybindingLabelFor(sn.CloseFindWidgetCommand),icon:cE,hoverDelegate:i,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),u.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new tC(null,void 0,{label:gV,placeholder:fV,appendPreserveCaseLabel:this._keybindingLabelFor(sn.TogglePreserveCaseCommand),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>jI(this._keybindingService),inputBoxStyles:TL,toggleStyles:PL},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(u=>this._onReplaceInputKeyDown(u))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(u=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(u=>{u.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),u.preventDefault())}));const r=this._register(Fy());this._replaceBtn=this._register(new Eh({label:pV+this._keybindingLabelFor(sn.ReplaceOneAction),icon:iV,hoverDelegate:r,onTrigger:()=>{this._controller.replace()},onKeyDown:u=>{u.equals(1026)&&(this._closeBtn.focus(),u.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new Eh({label:mV+this._keybindingLabelFor(sn.ReplaceAllAction),icon:nV,hoverDelegate:r,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));const a=document.createElement("div");a.className="replace-part",a.appendChild(this._replaceInput.domNode);const c=document.createElement("div");c.className="replace-actions",a.appendChild(c),c.appendChild(this._replaceBtn.domNode),c.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new Eh({label:_V,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=$o(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}},this._hoverService)),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=rV,this._domNode.role="dialog",this._domNode.style.width=`${Vr}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(n),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(a),this._resizeSash=this._register(new Uh(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let d=Vr;this._register(this._resizeSash.onDidStart(()=>{d=$o(this._domNode)})),this._register(this._resizeSash.onDidChange(u=>{this._resized=!0;const f=d+u.startX-u.currentX;if(f<Vr)return;const m=parseFloat(_O(this._domNode).maxWidth)||0;f>m||(this._domNode.style.width=`${f}px`,this._isReplaceVisible&&(this._replaceInput.width=$o(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const u=$o(this._domNode);if(u<Vr)return;let f=Vr;if(!this._resized||u===Vr){const m=this._codeEditor.getLayoutInfo();f=m.width-28-m.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${f}px`,this._isReplaceVisible&&(this._replaceInput.width=$o(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2)}};$v.ID="editor.contrib.findWidget";let iC=$v;class Eh extends xp{constructor(e,t){super(),this._opts=e;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+Wi.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.tabIndex=0,this._domNode.className=i,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this._register(t.setupManagedHover(e.hoverDelegate??Ob("element"),this._domNode,this._opts.label)),this.onclick(this._domNode,n=>{this._opts.onTrigger(),n.preventDefault()}),this.onkeydown(this._domNode,n=>{var s,r;if(n.equals(10)||n.equals(3)){this._opts.onTrigger(),n.preventDefault();return}(r=(s=this._opts).onKeyDown)==null||r.call(s,n)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(e){this._domNode.classList.toggle("disabled",!e),this._domNode.setAttribute("aria-disabled",String(!e)),this._domNode.tabIndex=e?0:-1}setExpanded(e){this._domNode.setAttribute("aria-expanded",String(!!e)),e?(this._domNode.classList.remove(...Wi.asClassNameArray(UI)),this._domNode.classList.add(...Wi.asClassNameArray($I))):(this._domNode.classList.remove(...Wi.asClassNameArray($I)),this._domNode.classList.add(...Wi.asClassNameArray(UI)))}}Eb((o,e)=>{const t=o.getColor(VD);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${Lf(o.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=o.getColor(vO);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${Lf(o.type)?"dashed":"solid"} ${i}; }`);const n=o.getColor(Ga);n&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${n}; }`);const s=o.getColor(bO);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const r=o.getColor(wO);r&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var BM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},No=function(o,e){return function(t,i){e(t,i,o)}},nC;const CV=524288;function sC(o,e="single",t=!1){if(!o.hasModel())return null;const i=o.getSelection();if(e==="single"&&i.startLineNumber===i.endLineNumber||e==="multiple"){if(i.isEmpty()){const n=o.getConfiguredWordAtPosition(i.getStartPosition());if(n&&t===!1)return n.word}else if(o.getModel().getValueLengthInRange(i)<CV)return o.getModel().getValueInRange(i)}return null}var fd;let zs=(fd=class extends Be{get editor(){return this._editor}static get(e){return e.getContribution(nC.ID)}constructor(e,t,i,n,s,r){super(),this._editor=e,this._findWidgetVisible=cl.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._notificationService=s,this._hoverService=r,this._updateHistoryDelayer=new ic(500),this._state=this._register(new Xz),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange(a=>this._onStateChanged(a))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{const a=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),a&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(41).loop})}))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(e){this.saveQueryState(e),e.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),e.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(e){e.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),e.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),e.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),e.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!lw.getValue(this._contextKeyService)}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){let e=this._editor.getSelections();e=e.map(t=>(t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._editor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t)).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}setSearchString(e){this._state.isRegex&&(e=If(e)),this._state.change({searchString:e},!1)}highlightFindOptions(e=!1){}async _start(e,t){if(this.disposeModel(),!this._editor.hasModel())return;const i={...t,isRevealed:!0};if(e.seedSearchStringFromSelection==="single"){const n=sC(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);n&&(this._state.isRegex?i.searchString=If(n):i.searchString=n)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const n=sC(this._editor,e.seedSearchStringFromSelection);n&&(i.searchString=n)}if(!i.searchString&&e.seedSearchStringFromGlobalClipboard){const n=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;n&&(i.searchString=n)}if(e.forceRevealReplace||i.isReplaceRevealed?i.isReplaceRevealed=!0:this._findWidgetVisible.get()||(i.isReplaceRevealed=!1),e.updateSearchScope){const n=this._editor.getSelections();n.some(s=>!s.isEmpty())&&(i.searchScope=n)}i.loop=e.loop,this._state.change(i,!1),this._model||(this._model=new df(this._editor,this._state))}start(e,t){return this._start(e,t)}moveToNextMatch(){return this._model?(this._model.moveToNextMatch(),!0):!1}moveToPrevMatch(){return this._model?(this._model.moveToPrevMatch(),!0):!1}goToMatch(e){return this._model?(this._model.moveToMatch(e),!0):!1}replace(){return this._model?(this._model.replace(),!0):!1}replaceAll(){var e;return this._model?(e=this._editor.getModel())!=null&&e.isTooLargeForHeapOperation()?(this._notificationService.warn(w("too.large.for.replaceall","The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0):!1}selectAllMatches(){return this._model?(this._model.selectAllMatches(),this._editor.focus(),!0):!1}async getGlobalBufferTerm(){return this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(e){this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(e)}},nC=fd,fd.ID="editor.contrib.findController",fd);zs=nC=BM([No(1,Ri),No(2,hc),No(3,cg),No(4,Rs),No(5,kp)],zs);let oC=class extends zs{constructor(e,t,i,n,s,r,a,c,d){super(e,i,a,c,r,d),this._contextViewService=t,this._keybindingService=n,this._themeService=s,this._widget=null,this._findOptionsWidget=null}async _start(e,t){this._widget||this._createFindWidget();const i=this._editor.getSelection();let n=!1;switch(this._editor.getOption(41).autoFindInSelection){case"always":n=!0;break;case"never":n=!1;break;case"multiline":{n=!!i&&i.startLineNumber!==i.endLineNumber;break}}e.updateSearchScope=e.updateSearchScope||n,await super._start(e,t),this._widget&&(e.shouldFocus===2?this._widget.focusReplaceInput():e.shouldFocus===1&&this._widget.focusFindInput())}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new iC(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService,this._hoverService)),this._findOptionsWidget=this._register(new QS(this._editor,this._state,this._keybindingService))}};oC=BM([No(1,Db),No(2,Ri),No(3,Zn),No(4,lr),No(5,Rs),No(6,hc),No(7,cg),No(8,kp)],oC);const xV=dE(new hE({id:sn.StartFindAction,label:w("startFindAction","Find"),alias:"Find",precondition:le.or(M.focus,le.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:Ye.MenubarEditMenu,group:"3_find",title:w({key:"miFind",comment:["&& denotes a mnemonic"]},"&&Find"),order:1}}));xV.addImplementation(0,(o,e,t)=>{const i=zs.get(e);return i?i.start({forceRevealReplace:!1,seedSearchStringFromSelection:e.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(41).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(41).loop}):!1});const LV={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},isRegex:{type:"boolean"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},preserveCase:{type:"boolean"},findInSelection:{type:"boolean"}}}}]};class IV extends Se{constructor(){super({id:sn.StartFindWithArgs,label:w("startFindWithArgsAction","Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:LV})}async run(e,t,i){const n=zs.get(t);if(n){const s=i?{searchString:i.searchString,replaceString:i.replaceString,isReplaceRevealed:i.replaceString!==void 0,isRegex:i.isRegex,wholeWord:i.matchWholeWord,matchCase:i.isCaseSensitive,preserveCase:i.preserveCase}:{};await n.start({forceRevealReplace:!1,seedSearchStringFromSelection:n.getState().searchString.length===0&&t.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:(i==null?void 0:i.findInSelection)||!1,loop:t.getOption(41).loop},s),n.setGlobalBufferTerm(n.getState().searchString)}}}class kV extends Se{constructor(){super({id:sn.StartFindWithSelection,label:w("startFindWithSelectionAction","Find With Selection"),alias:"Find With Selection",precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(e,t){const i=zs.get(t);i&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),i.setGlobalBufferTerm(i.getState().searchString))}}class zM extends Se{async run(e,t){const i=zs.get(t);i&&!this._run(i)&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:i.getState().searchString.length===0&&t.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),this._run(i))}}class DV extends zM{constructor(){super({id:sn.NextMatchFindAction,label:w("findNextMatchAction","Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:M.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:le.and(M.focus,lw),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class EV extends zM{constructor(){super({id:sn.PreviousMatchFindAction,label:w("findPreviousMatchAction","Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:M.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:le.and(M.focus,lw),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class PV extends Se{constructor(){super({id:sn.GoToMatchFindAction,label:w("findMatchAction.goToMatch","Go to Match..."),alias:"Go to Match...",precondition:cl}),this._highlightDecorations=[]}run(e,t,i){const n=zs.get(t);if(!n)return;const s=n.getState().matchesCount;if(s<1){e.get(Rs).notify({severity:v0.Warning,message:w("findMatchAction.noResults","No matches. Try searching for something else.")});return}const r=e.get(nl),a=new Oe,c=a.add(r.createInputBox());c.placeholder=w("findMatchAction.inputPlaceHolder","Type a number to go to a specific match (between 1 and {0})",s);const d=f=>{const m=parseInt(f);if(isNaN(m))return;const v=n.getState().matchesCount;if(m>0&&m<=v)return m-1;if(m<0&&m>=-v)return v+m},u=f=>{const m=d(f);if(typeof m=="number"){c.validationMessage=void 0,n.goToMatch(m);const v=n.getState().currentMatch;v&&this.addDecorations(t,v)}else c.validationMessage=w("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",n.getState().matchesCount),this.clearDecorations(t)};a.add(c.onDidChangeValue(f=>{u(f)})),a.add(c.onDidAccept(()=>{const f=d(c.value);typeof f=="number"?(n.goToMatch(f),c.hide()):c.validationMessage=w("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",n.getState().matchesCount)})),a.add(c.onDidHide(()=>{this.clearDecorations(t),a.dispose()})),c.show()}clearDecorations(e){e.changeDecorations(t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])})}addDecorations(e,t){e.changeDecorations(i=>{this._highlightDecorations=i.deltaDecorations(this._highlightDecorations,[{range:t,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:Yn(uE),position:aa.Full}}}])})}}class VM extends Se{async run(e,t){const i=zs.get(t);if(!i)return;const n=sC(t,"single",!1);n&&i.setSearchString(n),this._run(i)||(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),this._run(i))}}class TV extends VM{constructor(){super({id:sn.NextSelectionMatchFindAction,label:w("nextSelectionMatchFindAction","Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class MV extends VM{constructor(){super({id:sn.PreviousSelectionMatchFindAction,label:w("previousSelectionMatchFindAction","Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}const NV=dE(new hE({id:sn.StartFindReplaceAction,label:w("startReplace","Replace"),alias:"Replace",precondition:le.or(M.focus,le.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:Ye.MenubarEditMenu,group:"3_find",title:w({key:"miReplace",comment:["&& denotes a mnemonic"]},"&&Replace"),order:2}}));NV.addImplementation(0,(o,e,t)=>{if(!e.hasModel()||e.getOption(92))return!1;const i=zs.get(e);if(!i)return!1;const n=e.getSelection(),s=i.isFindInputFocused(),r=!n.isEmpty()&&n.startLineNumber===n.endLineNumber&&e.getOption(41).seedSearchStringFromSelection!=="never"&&!s,a=s||r?2:1;return i.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(41).seedSearchStringFromSelection!=="never",shouldFocus:a,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(41).loop})});oi(zs.ID,oC,0);ie(IV);ie(kV);ie(DV);ie(EV);ie(PV);ie(TV);ie(MV);const Or=js.bindToContribution(zs.get);bt(new Or({id:sn.CloseFindWidgetCommand,precondition:cl,handler:o=>o.closeFindWidget(),kbOpts:{weight:105,kbExpr:le.and(M.focus,le.not("isComposing")),primary:9,secondary:[1033]}}));bt(new Or({id:sn.ToggleCaseSensitiveCommand,precondition:void 0,handler:o=>o.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:M.focus,primary:mm.primary,mac:mm.mac,win:mm.win,linux:mm.linux}}));bt(new Or({id:sn.ToggleWholeWordCommand,precondition:void 0,handler:o=>o.toggleWholeWords(),kbOpts:{weight:105,kbExpr:M.focus,primary:_m.primary,mac:_m.mac,win:_m.win,linux:_m.linux}}));bt(new Or({id:sn.ToggleRegexCommand,precondition:void 0,handler:o=>o.toggleRegex(),kbOpts:{weight:105,kbExpr:M.focus,primary:vm.primary,mac:vm.mac,win:vm.win,linux:vm.linux}}));bt(new Or({id:sn.ToggleSearchScopeCommand,precondition:void 0,handler:o=>o.toggleSearchScope(),kbOpts:{weight:105,kbExpr:M.focus,primary:bm.primary,mac:bm.mac,win:bm.win,linux:bm.linux}}));bt(new Or({id:sn.TogglePreserveCaseCommand,precondition:void 0,handler:o=>o.togglePreserveCase(),kbOpts:{weight:105,kbExpr:M.focus,primary:wm.primary,mac:wm.mac,win:wm.win,linux:wm.linux}}));bt(new Or({id:sn.ReplaceOneAction,precondition:cl,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:M.focus,primary:3094}}));bt(new Or({id:sn.ReplaceOneAction,precondition:cl,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:le.and(M.focus,d1),primary:3}}));bt(new Or({id:sn.ReplaceAllAction,precondition:cl,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:M.focus,primary:2563}}));bt(new Or({id:sn.ReplaceAllAction,precondition:cl,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:le.and(M.focus,d1),primary:void 0,mac:{primary:2051}}}));bt(new Or({id:sn.SelectAllMatchesAction,precondition:cl,handler:o=>o.selectAllMatches(),kbOpts:{weight:105,kbExpr:M.focus,primary:515}}));const RV={0:" ",1:"u",2:"r"},YI=65535,wr=16777215,JI=4278190080;class ry{constructor(e){const t=Math.ceil(e/32);this._states=new Uint32Array(t)}get(e){const t=e/32|0,i=e%32;return(this._states[t]&1<<i)!==0}set(e,t){const i=e/32|0,n=e%32,s=this._states[i];t?this._states[i]=s|1<<n:this._states[i]=s&~(1<<n)}}class _o{constructor(e,t,i){if(e.length!==t.length||e.length>YI)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new ry(e.length),this._userDefinedStates=new ry(e.length),this._recoveredStates=new ry(e.length),this._types=i,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;const e=[],t=(i,n)=>{const s=e[e.length-1];return this.getStartLineNumber(s)<=i&&this.getEndLineNumber(s)>=n};for(let i=0,n=this._startIndexes.length;i<n;i++){const s=this._startIndexes[i],r=this._endIndexes[i];if(s>wr||r>wr)throw new Error("startLineNumber or endLineNumber must not exceed "+wr);for(;e.length>0&&!t(s,r);)e.pop();const a=e.length>0?e[e.length-1]:-1;e.push(i),this._startIndexes[i]=s+((a&255)<<24),this._endIndexes[i]=r+((a&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(e){return this._startIndexes[e]&wr}getEndLineNumber(e){return this._endIndexes[e]&wr}getType(e){return this._types?this._types[e]:void 0}hasTypes(){return!!this._types}isCollapsed(e){return this._collapseStates.get(e)}setCollapsed(e,t){this._collapseStates.set(e,t)}isUserDefined(e){return this._userDefinedStates.get(e)}setUserDefined(e,t){return this._userDefinedStates.set(e,t)}isRecovered(e){return this._recoveredStates.get(e)}setRecovered(e,t){return this._recoveredStates.set(e,t)}getSource(e){return this.isUserDefined(e)?1:this.isRecovered(e)?2:0}setSource(e,t){t===1?(this.setUserDefined(e,!0),this.setRecovered(e,!1)):t===2?(this.setUserDefined(e,!1),this.setRecovered(e,!0)):(this.setUserDefined(e,!1),this.setRecovered(e,!1))}setCollapsedAllOfType(e,t){let i=!1;if(this._types)for(let n=0;n<this._types.length;n++)this._types[n]===e&&(this.setCollapsed(n,t),i=!0);return i}toRegion(e){return new AV(this,e)}getParentIndex(e){this.ensureParentIndices();const t=((this._startIndexes[e]&JI)>>>24)+((this._endIndexes[e]&JI)>>>16);return t===YI?-1:t}contains(e,t){return this.getStartLineNumber(e)<=t&&this.getEndLineNumber(e)>=t}findIndex(e){let t=0,i=this._startIndexes.length;if(i===0)return-1;for(;t<i;){const n=Math.floor((t+i)/2);e<this.getStartLineNumber(n)?i=n:t=n+1}return t-1}findRange(e){let t=this.findIndex(e);if(t>=0){if(this.getEndLineNumber(t)>=e)return t;for(t=this.getParentIndex(t);t!==-1;){if(this.contains(t,e))return t;t=this.getParentIndex(t)}}return-1}toString(){const e=[];for(let t=0;t<this.length;t++)e[t]=`[${RV[this.getSource(t)]}${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&wr,endLineNumber:this._endIndexes[e]&wr,type:this._types?this._types[e]:void 0,isCollapsed:this.isCollapsed(e),source:this.getSource(e)}}static fromFoldRanges(e){const t=e.length,i=new Uint32Array(t),n=new Uint32Array(t);let s=[],r=!1;for(let c=0;c<t;c++){const d=e[c];i[c]=d.startLineNumber,n[c]=d.endLineNumber,s.push(d.type),d.type&&(r=!0)}r||(s=void 0);const a=new _o(i,n,s);for(let c=0;c<t;c++)e[c].isCollapsed&&a.setCollapsed(c,!0),a.setSource(c,e[c].source);return a}static sanitizeAndMerge(e,t,i,n){i=i??Number.MAX_VALUE;const s=(S,D)=>Array.isArray(S)?(E=>E<D?S[E]:void 0):(E=>E<D?S.toFoldRange(E):void 0),r=s(e,e.length),a=s(t,t.length);let c=0,d=0,u=r(0),f=a(0);const m=[];let v,_=0;const y=[];for(;u||f;){let S;if(f&&(!u||u.startLineNumber>=f.startLineNumber))u&&u.startLineNumber===f.startLineNumber?(f.source===1?S=f:(S=u,S.isCollapsed=f.isCollapsed&&(u.endLineNumber===f.endLineNumber||!(n!=null&&n.startsInside(u.startLineNumber+1,u.endLineNumber+1))),S.source=0),u=r(++c)):(S=f,f.isCollapsed&&f.source===0&&(S.source=2)),f=a(++d);else{let D=d,E=f;for(;;){if(!E||E.startLineNumber>u.endLineNumber){S=u;break}if(E.source===1&&E.endLineNumber>u.endLineNumber)break;E=a(++D)}u=r(++c)}if(S){for(;v&&v.endLineNumber<S.startLineNumber;)v=m.pop();S.endLineNumber>S.startLineNumber&&S.startLineNumber>_&&S.endLineNumber<=i&&(!v||v.endLineNumber>=S.endLineNumber)&&(y.push(S),_=S.startLineNumber,v&&m.push(v),v=S)}}return y}}class AV{constructor(e,t){this.ranges=e,this.index=t}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(e){return e.startLineNumber<=this.startLineNumber&&e.endLineNumber>=this.endLineNumber}containsLine(e){return this.startLineNumber<=e&&e<=this.endLineNumber}}class OV{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new ti,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new _o(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(e){if(!e.length)return;e=e.sort((i,n)=>i.regionIndex-n.regionIndex);const t={};this._decorationProvider.changeDecorations(i=>{let n=0,s=-1,r=-1;const a=c=>{for(;n<c;){const d=this._regions.getEndLineNumber(n),u=this._regions.isCollapsed(n);if(d<=s){const f=this.regions.getSource(n)!==0;i.changeDecorationOptions(this._editorDecorationIds[n],this._decorationProvider.getDecorationOption(u,d<=r,f))}u&&d>r&&(r=d),n++}};for(const c of e){const d=c.regionIndex,u=this._editorDecorationIds[d];if(u&&!t[u]){t[u]=!0,a(d);const f=!this._regions.isCollapsed(d);this._regions.setCollapsed(d,f),s=Math.max(s,this._regions.getEndLineNumber(d))}}a(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:e})}removeManualRanges(e){const t=new Array,i=n=>{for(const s of e)if(!(s.startLineNumber>n.endLineNumber||n.startLineNumber>s.endLineNumber))return!0;return!1};for(let n=0;n<this._regions.length;n++){const s=this._regions.toFoldRange(n);(s.source===0||!i(s))&&t.push(s)}this.updatePost(_o.fromFoldRanges(t))}update(e,t){const i=this._currentFoldedOrManualRanges(t),n=_o.sanitizeAndMerge(e,i,this._textModel.getLineCount(),t);this.updatePost(_o.fromFoldRanges(n))}updatePost(e){const t=[];let i=-1;for(let n=0,s=e.length;n<s;n++){const r=e.getStartLineNumber(n),a=e.getEndLineNumber(n),c=e.isCollapsed(n),d=e.getSource(n)!==0,u={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:a,endColumn:this._textModel.getLineMaxColumn(a)+1};t.push({range:u,options:this._decorationProvider.getDecorationOption(c,a<=i,d)}),c&&a>i&&(i=a)}this._decorationProvider.changeDecorations(n=>this._editorDecorationIds=n.deltaDecorations(this._editorDecorationIds,t)),this._regions=e,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(e){const t=[];for(let i=0,n=this._regions.length;i<n;i++){let s=this.regions.isCollapsed(i);const r=this.regions.getSource(i);if(s||r!==0){const a=this._regions.toFoldRange(i),c=this._textModel.getDecorationRange(this._editorDecorationIds[i]);c&&(s&&(e!=null&&e.startsInside(c.startLineNumber+1,c.endLineNumber))&&(s=!1),t.push({startLineNumber:c.startLineNumber,endLineNumber:c.endLineNumber,type:a.type,isCollapsed:s,source:r}))}}return t}getMemento(){const e=this._currentFoldedOrManualRanges(),t=[],i=this._textModel.getLineCount();for(let n=0,s=e.length;n<s;n++){const r=e[n];if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>i)continue;const a=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);t.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,isCollapsed:r.isCollapsed,source:r.source,checksum:a})}return t.length>0?t:void 0}applyMemento(e){if(!Array.isArray(e))return;const t=[],i=this._textModel.getLineCount();for(const s of e){if(s.startLineNumber>=s.endLineNumber||s.startLineNumber<1||s.endLineNumber>i)continue;const r=this._getLinesChecksum(s.startLineNumber+1,s.endLineNumber);(!s.checksum||r===s.checksum)&&t.push({startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,type:void 0,isCollapsed:s.isCollapsed??!0,source:s.source??0})}const n=_o.sanitizeAndMerge(this._regions,t,i);this.updatePost(_o.fromFoldRanges(n))}_getLinesChecksum(e,t){return gE(this._textModel.getLineContent(e)+this._textModel.getLineContent(t))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds)}getAllRegionsAtLine(e,t){const i=[];if(this._regions){let n=this._regions.findRange(e),s=1;for(;n>=0;){const r=this._regions.toRegion(n);(!t||t(r,s))&&i.push(r),s++,n=r.parentIndex}}return i}getRegionAtLine(e){if(this._regions){const t=this._regions.findRange(e);if(t>=0)return this._regions.toRegion(t)}return null}getRegionsInside(e,t){const i=[],n=e?e.regionIndex+1:0,s=e?e.endLineNumber:Number.MAX_VALUE;if(t&&t.length===2){const r=[];for(let a=n,c=this._regions.length;a<c;a++){const d=this._regions.toRegion(a);if(this._regions.getStartLineNumber(a)<s){for(;r.length>0&&!d.containedBy(r[r.length-1]);)r.pop();r.push(d),t(d,r.length)&&i.push(d)}else break}}else for(let r=n,a=this._regions.length;r<a;r++){const c=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<s)(!t||t(c))&&i.push(c);else break}return i}}function g1(o,e,t){const i=[];for(const n of t){const s=o.getRegionAtLine(n);if(s){const r=!s.isCollapsed;if(i.push(s),e>1){const a=o.getRegionsInside(s,(c,d)=>c.isCollapsed!==r&&d<e);i.push(...a)}}}o.toggleCollapseState(i)}function vg(o,e,t=Number.MAX_VALUE,i){const n=[];if(i&&i.length>0)for(const s of i){const r=o.getRegionAtLine(s);if(r&&(r.isCollapsed!==e&&n.push(r),t>1)){const a=o.getRegionsInside(r,(c,d)=>c.isCollapsed!==e&&d<t);n.push(...a)}}else{const s=o.getRegionsInside(null,(r,a)=>r.isCollapsed!==e&&a<t);n.push(...s)}o.toggleCollapseState(n)}function jM(o,e,t,i){const n=[];for(const s of i){const r=o.getAllRegionsAtLine(s,(a,c)=>a.isCollapsed!==e&&c<=t);n.push(...r)}o.toggleCollapseState(n)}function FV(o,e,t){const i=[];for(const n of t){const s=o.getAllRegionsAtLine(n,r=>r.isCollapsed!==e);s.length>0&&i.push(s[0])}o.toggleCollapseState(i)}function HV(o,e,t,i){const n=(r,a)=>a===e&&r.isCollapsed!==t&&!i.some(c=>r.containsLine(c)),s=o.getRegionsInside(null,n);o.toggleCollapseState(s)}function UM(o,e,t){const i=[];for(const r of t){const a=o.getAllRegionsAtLine(r,void 0);a.length>0&&i.push(a[0])}const n=r=>i.every(a=>!a.containedBy(r)&&!r.containedBy(a))&&r.isCollapsed!==e,s=o.getRegionsInside(null,n);o.toggleCollapseState(s)}function f1(o,e,t){const i=o.textModel,n=o.regions,s=[];for(let r=n.length-1;r>=0;r--)if(t!==n.isCollapsed(r)){const a=n.getStartLineNumber(r);e.test(i.getLineContent(a))&&s.push(n.toRegion(r))}o.toggleCollapseState(s)}function p1(o,e,t){const i=o.regions,n=[];for(let s=i.length-1;s>=0;s--)t!==i.isCollapsed(s)&&e===i.getType(s)&&n.push(i.toRegion(s));o.toggleCollapseState(n)}function WV(o,e){let t=null;const i=e.getRegionAtLine(o);if(i!==null&&(t=i.startLineNumber,o===t)){const n=i.parentIndex;n!==-1?t=e.regions.getStartLineNumber(n):t=null}return t}function BV(o,e){let t=e.getRegionAtLine(o);if(t!==null&&t.startLineNumber===o){if(o!==t.startLineNumber)return t.startLineNumber;{const i=t.parentIndex;let n=0;for(i!==-1&&(n=e.regions.getStartLineNumber(t.parentIndex));t!==null;)if(t.regionIndex>0){if(t=e.regions.toRegion(t.regionIndex-1),t.startLineNumber<=n)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}}else if(e.regions.length>0)for(t=e.regions.toRegion(e.regions.length-1);t!==null;){if(t.startLineNumber<o)return t.startLineNumber;t.regionIndex>0?t=e.regions.toRegion(t.regionIndex-1):t=null}return null}function zV(o,e){let t=e.getRegionAtLine(o);if(t!==null&&t.startLineNumber===o){const i=t.parentIndex;let n=0;if(i!==-1)n=e.regions.getEndLineNumber(t.parentIndex);else{if(e.regions.length===0)return null;n=e.regions.getEndLineNumber(e.regions.length-1)}for(;t!==null;)if(t.regionIndex<e.regions.length){if(t=e.regions.toRegion(t.regionIndex+1),t.startLineNumber>=n)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}else if(e.regions.length>0)for(t=e.regions.toRegion(0);t!==null;){if(t.startLineNumber>o)return t.startLineNumber;t.regionIndex<e.regions.length?t=e.regions.toRegion(t.regionIndex+1):t=null}return null}class VV{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(e){this._updateEventEmitter=new ti,this._hasLineChanges=!1,this._foldingModel=e,this._foldingModelListener=e.onDidChange(t=>this.updateHiddenRanges()),this._hiddenRanges=[],e.regions.length&&this.updateHiddenRanges()}notifyChangeModelContent(e){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=e.changes.some(t=>t.range.endLineNumber!==t.range.startLineNumber||yO(t.text)[0]!==0))}updateHiddenRanges(){let e=!1;const t=[];let i=0,n=0,s=Number.MAX_VALUE,r=-1;const a=this._foldingModel.regions;for(;i<a.length;i++){if(!a.isCollapsed(i))continue;const c=a.getStartLineNumber(i)+1,d=a.getEndLineNumber(i);s<=c&&d<=r||(!e&&n<this._hiddenRanges.length&&this._hiddenRanges[n].startLineNumber===c&&this._hiddenRanges[n].endLineNumber===d?(t.push(this._hiddenRanges[n]),n++):(e=!0,t.push(new H(c,1,d,1))),s=c,r=d)}(this._hasLineChanges||e||n<this._hiddenRanges.length)&&this.applyHiddenRanges(t)}applyHiddenRanges(e){this._hiddenRanges=e,this._hasLineChanges=!1,this._updateEventEmitter.fire(e)}hasRanges(){return this._hiddenRanges.length>0}isHidden(e){return QI(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let n=null;const s=r=>((!n||!jV(r,n))&&(n=QI(this._hiddenRanges,r)),n?n.startLineNumber-1:null);for(let r=0,a=e.length;r<a;r++){let c=e[r];const d=s(c.startLineNumber);d&&(c=c.setStartPosition(d,i.getLineMaxColumn(d)),t=!0);const u=s(c.endLineNumber);u&&(c=c.setEndPosition(u,i.getLineMaxColumn(u)),t=!0),e[r]=c}return t}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function jV(o,e){return o>=e.startLineNumber&&o<=e.endLineNumber}function QI(o,e){const t=sE(o,i=>e<i.startLineNumber)-1;return t>=0&&o[t].endLineNumber>=e?o[t]:null}const UV=5e3,$V="indent";class m1{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=$V}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,n=t&&t.markers;return Promise.resolve(GV(this.editorModel,i,n,this.foldingRangesLimit))}}let qV=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>wr||t>wr)return;const n=this._length;this._startIndexes[n]=e,this._endIndexes[n]=t,this._length++,i<1e3&&(this._indentOccurrences[i]=(this._indentOccurrences[i]||0)+1)}toIndentRanges(e){const t=this._foldingRangesLimit.limit;if(this._length<=t){this._foldingRangesLimit.update(this._length,!1);const i=new Uint32Array(this._length),n=new Uint32Array(this._length);for(let s=this._length-1,r=0;s>=0;s--,r++)i[r]=this._startIndexes[s],n[r]=this._endIndexes[s];return new _o(i,n)}else{this._foldingRangesLimit.update(this._length,t);let i=0,n=this._indentOccurrences.length;for(let c=0;c<this._indentOccurrences.length;c++){const d=this._indentOccurrences[c];if(d){if(d+i>t){n=c;break}i+=d}}const s=e.getOptions().tabSize,r=new Uint32Array(t),a=new Uint32Array(t);for(let c=this._length-1,d=0;c>=0;c--){const u=this._startIndexes[c],f=e.getLineContent(u),m=r0(f,s);(m<n||m===n&&i++<t)&&(r[d]=u,a[d]=this._endIndexes[c],d++)}return new _o(r,a)}}};const KV={limit:UV,update:()=>{}};function GV(o,e,t,i=KV){const n=o.getOptions().tabSize,s=new qV(i);let r;t&&(r=new RegExp(`(${t.start.source})|(?:${t.end.source})`));const a=[],c=o.getLineCount()+1;a.push({indent:-1,endAbove:c,line:c});for(let d=o.getLineCount();d>0;d--){const u=o.getLineContent(d),f=r0(u,n);let m=a[a.length-1];if(f===-1){e&&(m.endAbove=d);continue}let v;if(r&&(v=u.match(r)))if(v[1]){let _=a.length-1;for(;_>0&&a[_].indent!==-2;)_--;if(_>0){a.length=_+1,m=a[_],s.insertFirst(d,m.line,f),m.line=d,m.indent=f,m.endAbove=d;continue}}else{a.push({indent:-2,endAbove:d,line:d});continue}if(m.indent>f){do a.pop(),m=a[a.length-1];while(m.indent>f);const _=m.endAbove-1;_-d>=1&&s.insertFirst(d,_,f)}m.indent===f?m.endAbove=d:a.push({indent:f,endAbove:d,line:d})}return s.toIndentRanges(o)}const ZV=at("editor.foldBackground",{light:ca(ML,.3),dark:ca(ML,.3),hcDark:null,hcLight:null},w("foldBackgroundBackground","Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);at("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},w("collapsedTextColor","Color of the collapsed text after the first line of a folded range."));at("editorGutter.foldingControlForeground",SO,w("editorGutter.foldingControlForeground","Color of the folding control in the editor gutter."));const V_=Wn("folding-expanded",Ot.chevronDown,w("foldingExpandedIcon","Icon for expanded ranges in the editor glyph margin.")),j_=Wn("folding-collapsed",Ot.chevronRight,w("foldingCollapsedIcon","Icon for collapsed ranges in the editor glyph margin.")),ek=Wn("folding-manual-collapsed",j_,w("foldingManualCollapedIcon","Icon for manually collapsed ranges in the editor glyph margin.")),tk=Wn("folding-manual-expanded",V_,w("foldingManualExpandedIcon","Icon for manually expanded ranges in the editor glyph margin.")),ay={color:Yn(ZV),position:1},Ph=w("linesCollapsed","Click to expand the range."),Cm=w("linesExpanded","Click to collapse the range."),Vn=class Vn{constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?Vn.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?Vn.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:Vn.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:Vn.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?Vn.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Vn.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?Vn.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Vn.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?Vn.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:Vn.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?Vn.MANUALLY_EXPANDED_VISUAL_DECORATION:Vn.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}};Vn.COLLAPSED_VISUAL_DECORATION=pi.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Ph,firstLineDecorationClassName:Wi.asClassName(j_)}),Vn.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=pi.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:ay,isWholeLine:!0,linesDecorationsTooltip:Ph,firstLineDecorationClassName:Wi.asClassName(j_)}),Vn.MANUALLY_COLLAPSED_VISUAL_DECORATION=pi.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Ph,firstLineDecorationClassName:Wi.asClassName(ek)}),Vn.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=pi.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:ay,isWholeLine:!0,linesDecorationsTooltip:Ph,firstLineDecorationClassName:Wi.asClassName(ek)}),Vn.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=pi.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Ph}),Vn.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=pi.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:ay,isWholeLine:!0,linesDecorationsTooltip:Ph}),Vn.EXPANDED_VISUAL_DECORATION=pi.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Wi.asClassName(V_),linesDecorationsTooltip:Cm}),Vn.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=pi.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:Wi.asClassName(V_),linesDecorationsTooltip:Cm}),Vn.MANUALLY_EXPANDED_VISUAL_DECORATION=pi.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Wi.asClassName(tk),linesDecorationsTooltip:Cm}),Vn.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=pi.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:Wi.asClassName(tk),linesDecorationsTooltip:Cm}),Vn.NO_CONTROLS_EXPANDED_RANGE_DECORATION=pi.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),Vn.HIDDEN_RANGE_DECORATION=pi.register({description:"folding-hidden-range-decoration",stickiness:1});let rC=Vn;const XV={},YV="syntax";class _1{constructor(e,t,i,n,s){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=i,this.foldingRangesLimit=n,this.fallbackRangeProvider=s,this.id=YV,this.disposables=new Oe,s&&this.disposables.add(s);for(const r of t)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(i))}compute(e){return JV(this.providers,this.editorModel,e).then(t=>{var i;return t?e4(t,this.foldingRangesLimit):((i=this.fallbackRangeProvider)==null?void 0:i.compute(e))??null})}dispose(){this.disposables.dispose()}}function JV(o,e,t){let i=null;const n=o.map((s,r)=>Promise.resolve(s.provideFoldingRanges(e,XV,t)).then(a=>{if(!t.isCancellationRequested&&Array.isArray(a)){Array.isArray(i)||(i=[]);const c=e.getLineCount();for(const d of a)d.start>0&&d.end>d.start&&d.end<=c&&i.push({start:d.start,end:d.end,rank:r,kind:d.kind})}},jn));return Promise.all(n).then(s=>i)}class QV{constructor(e){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=e}add(e,t,i,n){if(e>wr||t>wr)return;const s=this._length;this._startIndexes[s]=e,this._endIndexes[s]=t,this._nestingLevels[s]=n,this._types[s]=i,this._length++,n<30&&(this._nestingLevelCounts[n]=(this._nestingLevelCounts[n]||0)+1)}toIndentRanges(){const e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let n=0;n<this._length;n++)t[n]=this._startIndexes[n],i[n]=this._endIndexes[n];return new _o(t,i,this._types)}else{this._foldingRangesLimit.update(this._length,e);let t=0,i=this._nestingLevelCounts.length;for(let a=0;a<this._nestingLevelCounts.length;a++){const c=this._nestingLevelCounts[a];if(c){if(c+t>e){i=a;break}t+=c}}const n=new Uint32Array(e),s=new Uint32Array(e),r=[];for(let a=0,c=0;a<this._length;a++){const d=this._nestingLevels[a];(d<i||d===i&&t++<e)&&(n[c]=this._startIndexes[a],s[c]=this._endIndexes[a],r[c]=this._types[a],c++)}return new _o(n,s,r)}}}function e4(o,e){const t=o.sort((r,a)=>{let c=r.start-a.start;return c===0&&(c=r.rank-a.rank),c}),i=new QV(e);let n;const s=[];for(const r of t)if(!n)n=r,i.add(r.start,r.end,r.kind&&r.kind.value,s.length);else if(r.start>n.start)if(r.end<=n.end)s.push(n),n=r,i.add(r.start,r.end,r.kind&&r.kind.value,s.length);else{if(r.start>n.end){do n=s.pop();while(n&&r.start>n.end);n&&s.push(n),n=r}i.add(r.start,r.end,r.kind&&r.kind.value,s.length)}return i.toIndentRanges()}var t4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ng=function(o,e){return function(t,i){e(t,i,o)}},xc;const ms=new yi("foldingEnabled",!1);var pd;let ac=(pd=class extends Be{static get(e){return e.getContribution(xc.ID)}static getFoldingRangeProviders(e,t){var n;const i=e.foldingRangeProvider.ordered(t);return((n=xc._foldingRangeSelector)==null?void 0:n.call(xc,i,t))??i}constructor(e,t,i,n,s,r){super(),this.contextKeyService=t,this.languageConfigurationService=i,this.languageFeaturesService=r,this.localToDispose=this._register(new Oe),this.editor=e,this._foldingLimitReporter=new $M(e);const a=this.editor.getOptions();this._isEnabled=a.get(43),this._useFoldingProviders=a.get(44)!=="indentation",this._unfoldOnClickAfterEndOfLine=a.get(48),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=a.get(46),this.updateDebounceInfo=s.for(r.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new rC(e),this.foldingDecorationProvider.showFoldingControls=a.get(111),this.foldingDecorationProvider.showFoldingHighlights=a.get(45),this.foldingEnabled=ms.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(c=>{if(c.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),c.hasChanged(47)&&this.onModelChanged(),c.hasChanged(111)||c.hasChanged(45)){const d=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=d.get(111),this.foldingDecorationProvider.showFoldingHighlights=d.get(45),this.triggerFoldingModelChanged()}c.hasChanged(44)&&(this._useFoldingProviders=this.editor.getOptions().get(44)!=="indentation",this.onFoldingStrategyChanged()),c.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),c.hasChanged(46)&&(this._foldingImportsByDefault=this.editor.getOptions().get(46))})),this.onModelChanged()}saveViewState(){const e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){const t=this.foldingModel.getMemento(),i=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:i,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){const t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new OV(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new VV(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new ic(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new ts(()=>this.revealCursor(),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelContent(t=>this.onDidChangeModelContent(t))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.localToDispose.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.localToDispose.add({dispose:()=>{var t,i;this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),(t=this.updateScheduler)==null||t.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,(i=this.rangeProvider)==null||i.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){var e;(e=this.rangeProvider)==null||e.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;const t=new m1(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=xc.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new _1(e,i,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,t))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){var t;(t=this.hiddenRangeModel)==null||t.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{const e=this.foldingModel;if(!e)return null;const t=new oo,i=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=us(s=>i.compute(s));return n.then(s=>{if(s&&n===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const d=s.setCollapsedAllOfType(Tp.Imports.value,!0);d&&(r=Au.capture(this.editor),this._currentModelHasFoldedImports=d)}const a=this.editor.getSelections();e.update(s,i4(a)),r==null||r.restore(this.editor);const c=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=c)}return e})}).then(void 0,e=>(on(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){const t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){const e=this.getFoldingModel();e&&e.then(t=>{if(t){const i=this.editor.getSelections();if(i&&i.length>0){const n=[];for(const s of i){const r=s.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(r)&&n.push(...t.getAllRegionsAtLine(r,a=>a.isCollapsed&&r>a.startLineNumber))}n.length&&(t.toggleCollapseState(n),this.reveal(i[0].getPosition()))}}}).then(void 0,on)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;const t=e.target.range;let i=!1;switch(e.target.type){case 4:{const n=e.target.detail,s=e.target.element.offsetLeft;if(n.offsetX-s<4)return;i=!0;break}case 7:{if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return}case 6:{if(this.hiddenRangeModel.hasRanges()){const n=this.editor.getModel();if(n&&t.startColumn===n.getLineMaxColumn(t.startLineNumber))break}return}default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:i}}onEditorMouseUp(e){const t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;const i=this.mouseDownInfo.lineNumber,n=this.mouseDownInfo.iconClicked,s=e.target.range;if(!s||s.startLineNumber!==i)return;if(n){if(e.target.type!==4)return}else{const a=this.editor.getModel();if(!a||s.startColumn!==a.getLineMaxColumn(i))return}const r=t.getRegionAtLine(i);if(r&&r.startLineNumber===i){const a=r.isCollapsed;if(n||a){const c=e.event.altKey;let d=[];if(c){const u=m=>!m.containedBy(r)&&!r.containedBy(m),f=t.getRegionsInside(null,u);for(const m of f)m.isCollapsed&&d.push(m);d.length===0&&(d=f)}else{const u=e.event.middleButton||e.event.shiftKey;if(u)for(const f of t.getRegionsInside(r))f.isCollapsed===a&&d.push(f);(a||!u||d.length===0)&&d.push(r)}t.toggleCollapseState(d),this.reveal({lineNumber:i,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}},xc=pd,pd.ID="editor.contrib.folding",pd);ac=xc=t4([Ng(1,Ri),Ng(2,cs),Ng(3,Rs),Ng(4,Wo),Ng(5,gt)],ac);class $M{constructor(e){this.editor=e,this._onDidChange=new ti,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(47)}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}class ws extends Se{runEditorCommand(e,t,i){const n=e.get(cs),s=ac.get(t);if(!s)return;const r=s.getFoldingModel();if(r)return this.reportTelemetry(e,t),r.then(a=>{if(a){this.invoke(s,a,t,i,n);const c=t.getSelection();c&&s.reveal(c.getStartPosition())}})}getSelectedLines(e){const t=e.getSelections();return t?t.map(i=>i.startLineNumber):[]}getLineNumbers(e,t){return e&&e.selectionLines?e.selectionLines.map(i=>i+1):this.getSelectedLines(t)}run(e,t){}}function i4(o){return!o||o.length===0?{startsInside:()=>!1}:{startsInside(e,t){for(const i of o){const n=i.startLineNumber;if(n>=e&&n<=t)return!0}return!1}}}function qM(o){if(!Wg(o)){if(!fE(o))return!1;const e=o;if(!Wg(e.levels)&&!NL(e.levels)||!Wg(e.direction)&&!BD(e.direction)||!Wg(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(NL)))return!1}return!0}class n4 extends ws{constructor(){super({id:"editor.unfold",label:w("unfoldAction.label","Unfold"),alias:"Unfold",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument:
|
|
23
|
-
* 'levels': Number of levels to unfold. If not set, defaults to 1.
|
|
24
|
-
* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
|
|
25
|
-
* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.
|
|
26
|
-
`,constraint:qM,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){const s=n&&n.levels||1,r=this.getLineNumbers(n,i);n&&n.direction==="up"?jM(t,!1,s,r):vg(t,!1,s,r)}}class s4 extends ws{constructor(){super({id:"editor.unfoldRecursively",label:w("unFoldRecursivelyAction.label","Unfold Recursively"),alias:"Unfold Recursively",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2142),weight:100}})}invoke(e,t,i,n){vg(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}class o4 extends ws{constructor(){super({id:"editor.fold",label:w("foldAction.label","Fold"),alias:"Fold",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:`Property-value pairs that can be passed through this argument:
|
|
27
|
-
* 'levels': Number of levels to fold.
|
|
28
|
-
* 'direction': If 'up', folds given number of levels up otherwise folds down.
|
|
29
|
-
* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.
|
|
30
|
-
If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
|
|
31
|
-
`,constraint:qM,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){const s=this.getLineNumbers(n,i),r=n&&n.levels,a=n&&n.direction;typeof r!="number"&&typeof a!="string"?FV(t,!0,s):a==="up"?jM(t,!0,r||1,s):vg(t,!0,r||1,s)}}class r4 extends ws{constructor(){super({id:"editor.toggleFold",label:w("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2090),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);g1(t,1,n)}}class a4 extends ws{constructor(){super({id:"editor.foldRecursively",label:w("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2140),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);vg(t,!0,Number.MAX_VALUE,n)}}class l4 extends ws{constructor(){super({id:"editor.toggleFoldRecursively",label:w("toggleFoldRecursivelyAction.label","Toggle Fold Recursively"),alias:"Toggle Fold Recursively",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,3114),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);g1(t,Number.MAX_VALUE,n)}}class c4 extends ws{constructor(){super({id:"editor.foldAllBlockComments",label:w("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2138),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())p1(t,Tp.Comment.value,!0);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).comments;if(a&&a.blockCommentStartToken){const c=new RegExp("^\\s*"+If(a.blockCommentStartToken));f1(t,c,!0)}}}}class d4 extends ws{constructor(){super({id:"editor.foldAllMarkerRegions",label:w("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2077),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())p1(t,Tp.Region.value,!0);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const c=new RegExp(a.markers.start);f1(t,c,!0)}}}}class h4 extends ws{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:w("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2078),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())p1(t,Tp.Region.value,!1);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const c=new RegExp(a.markers.start);f1(t,c,!1)}}}}class u4 extends ws{constructor(){super({id:"editor.foldAllExcept",label:w("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2136),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);UM(t,!0,n)}}class g4 extends ws{constructor(){super({id:"editor.unfoldAllExcept",label:w("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2134),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);UM(t,!1,n)}}class f4 extends ws{constructor(){super({id:"editor.foldAll",label:w("foldAllAction.label","Fold All"),alias:"Fold All",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2069),weight:100}})}invoke(e,t,i){vg(t,!0)}}class p4 extends ws{constructor(){super({id:"editor.unfoldAll",label:w("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2088),weight:100}})}invoke(e,t,i){vg(t,!1)}}const su=class su extends ws{getFoldingLevel(){return parseInt(this.id.substr(su.ID_PREFIX.length))}invoke(e,t,i){HV(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}};su.ID_PREFIX="editor.foldLevel",su.ID=e=>su.ID_PREFIX+e;let U_=su;class m4 extends ws{constructor(){super({id:"editor.gotoParentFold",label:w("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=WV(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class _4 extends ws{constructor(){super({id:"editor.gotoPreviousFold",label:w("gotoPreviousFold.label","Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=BV(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class v4 extends ws{constructor(){super({id:"editor.gotoNextFold",label:w("gotoNextFold.label","Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=zV(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class b4 extends ws{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:w("createManualFoldRange.label","Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2135),weight:100}})}invoke(e,t,i){var r;const n=[],s=i.getSelections();if(s){for(const a of s){let c=a.endLineNumber;a.endColumn===1&&--c,c>a.startLineNumber&&(n.push({startLineNumber:a.startLineNumber,endLineNumber:c,type:void 0,isCollapsed:!0,source:1}),i.setSelection({startLineNumber:a.startLineNumber,startColumn:1,endLineNumber:a.startLineNumber,endColumn:1}))}if(n.length>0){n.sort((c,d)=>c.startLineNumber-d.startLineNumber);const a=_o.sanitizeAndMerge(t.regions,n,(r=i.getModel())==null?void 0:r.getLineCount());t.updatePost(_o.fromFoldRanges(a))}}}}class w4 extends ws{constructor(){super({id:"editor.removeManualFoldingRanges",label:w("removeManualFoldingRanges.label","Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2137),weight:100}})}invoke(e,t,i){const n=i.getSelections();if(n){const s=[];for(const r of n){const{startLineNumber:a,endLineNumber:c}=r;s.push(c>=a?{startLineNumber:a,endLineNumber:c}:{endLineNumber:c,startLineNumber:a})}t.removeManualRanges(s),e.triggerFoldingModelChanged()}}}oi(ac.ID,ac,0);ie(n4);ie(s4);ie(o4);ie(a4);ie(l4);ie(f4);ie(p4);ie(c4);ie(d4);ie(h4);ie(u4);ie(g4);ie(r4);ie(m4);ie(_4);ie(v4);ie(b4);ie(w4);for(let o=1;o<=7;o++)CO(new U_({id:U_.ID(o),label:w("foldLevelAction.label","Fold Level {0}",o),alias:`Fold Level ${o}`,precondition:ms,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2048|21+o),weight:100}}));dn.registerCommand("_executeFoldingRangeProvider",async function(o,...e){const[t]=e;if(!(t instanceof nn))throw Va();const i=o.get(gt),n=o.get(As).getModel(t);if(!n)throw Va();const s=o.get(pn);if(!s.getValue("editor.folding",{resource:t}))return[];const r=o.get(cs),a=s.getValue("editor.foldingStrategy",{resource:t}),c={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(v,_)=>{}},d=new m1(n,r,c);let u=d;if(a!=="indentation"){const v=ac.getFoldingRangeProviders(i,n);v.length&&(u=new _1(n,v,()=>{},c,d))}const f=await u.compute(ii.None),m=[];try{if(f)for(let v=0;v<f.length;v++){const _=f.getType(v);m.push({start:f.getStartLineNumber(v),end:f.getEndLineNumber(v),kind:_?Tp.fromValue(_):void 0})}return m}finally{u.dispose()}});class y4 extends Se{constructor(){super({id:"editor.action.fontZoomIn",label:w("EditorFontZoomIn.label","Increase Editor Font Size"),alias:"Increase Editor Font Size",precondition:void 0})}run(e,t){Mf.setZoomLevel(Mf.getZoomLevel()+1)}}class S4 extends Se{constructor(){super({id:"editor.action.fontZoomOut",label:w("EditorFontZoomOut.label","Decrease Editor Font Size"),alias:"Decrease Editor Font Size",precondition:void 0})}run(e,t){Mf.setZoomLevel(Mf.getZoomLevel()-1)}}class C4 extends Se{constructor(){super({id:"editor.action.fontZoomReset",label:w("EditorFontZoomReset.label","Reset Editor Font Size"),alias:"Reset Editor Font Size",precondition:void 0})}run(e,t){Mf.setZoomLevel(0)}}ie(y4);ie(S4);ie(C4);var KM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},hf=function(o,e){return function(t,i){e(t,i,o)}},Cu;let $_=(Cu=class{constructor(e,t,i,n){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=n,this._disposables=new Oe,this._sessionDisposables=new Oe,this._disposables.add(t.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(s=>{s.hasChanged(56)&&this._update()})),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(56)||!this._editor.hasModel())return;const e=this._editor.getModel(),[t]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);if(!t||!t.autoFormatTriggerCharacters)return;const i=new g_;for(const n of t.autoFormatTriggerCharacters)i.add(n.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(n=>{const s=n.charCodeAt(n.length-1);i.has(s)&&this._trigger(String.fromCharCode(s))}))}_trigger(e){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const t=this._editor.getModel(),i=this._editor.getPosition(),n=new gs,s=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){n.cancel(),s.dispose();return}for(let a=0,c=r.changes.length;a<c;a++)if(r.changes[a].range.endLineNumber<=i.lineNumber){n.cancel(),s.dispose();return}});xO(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then(r=>{n.token.isCancellationRequested||bo(r)&&(this._accessibilitySignalService.playSignal(mE.format,{userGesture:!1}),LO.execute(this._editor,r,!0))}).finally(()=>{s.dispose()})}},Cu.ID="editor.contrib.autoFormat",Cu);$_=KM([hf(1,gt),hf(2,rl),hf(3,pE)],$_);var xu;let q_=(xu=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new Oe,this._callOnModel=new Oe,this._callOnDispose.add(e.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(e.onDidChangeModel(()=>this._update())),this._callOnDispose.add(e.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(t.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(55)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste(({range:e})=>this._trigger(e)))}_trigger(e){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(_E,this.editor,e,2,Fa.None,ii.None,!1).catch(on))}},xu.ID="editor.contrib.formatOnPaste",xu);q_=KM([hf(1,gt),hf(2,qt)],q_);class x4 extends Se{constructor(){super({id:"editor.action.formatDocument",label:w("formatDocument.label","Format Document"),alias:"Format Document",precondition:le.and(M.notInCompositeEditor,M.writable,M.hasDocumentFormattingProvider),kbOpts:{kbExpr:M.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(e,t){if(t.hasModel()){const i=e.get(qt);await e.get(yp).showWhile(i.invokeFunction(IO,t,1,Fa.None,ii.None,!0),250)}}}class L4 extends Se{constructor(){super({id:"editor.action.formatSelection",label:w("formatSelection.label","Format Selection"),alias:"Format Selection",precondition:le.and(M.writable,M.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2084),weight:100},contextMenuOpts:{when:M.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(qt),n=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new H(a.startLineNumber,1,a.startLineNumber,n.getLineMaxColumn(a.startLineNumber)):a);await e.get(yp).showWhile(i.invokeFunction(_E,t,s,1,Fa.None,ii.None,!0),250)}}oi($_.ID,$_,2);oi(q_.ID,q_,2);ie(x4);ie(L4);dn.registerCommand("editor.action.format",async o=>{const e=o.get(Un).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=o.get(ls);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var I4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ly=function(o,e){return function(t,i){e(t,i,o)}};class Jh{remove(){var e;(e=this.parent)==null||e.children.delete(this.id)}static findId(e,t){let i;typeof e=="string"?i=`${t.id}/${e}`:(i=`${t.id}/${e.name}`,t.children.get(i)!==void 0&&(i=`${t.id}/${e.name}_${e.range.startLineNumber}_${e.range.startColumn}`));let n=i;for(let s=0;t.children.get(n)!==void 0;s++)n=`${i}_${s}`;return n}static empty(e){return e.children.size===0}}class aC extends Jh{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class GM extends Jh{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class Ta extends Jh{static create(e,t,i){const n=new gs(i),s=new Ta(t.uri),r=e.ordered(t),a=r.map((d,u)=>{const f=Jh.findId(`provider_${u}`,s),m=new GM(f,s,d.displayName??"Unknown Outline Provider",u);return Promise.resolve(d.provideDocumentSymbols(t,n.token)).then(v=>{for(const _ of v||[])Ta._makeOutlineElement(_,m);return m},v=>(jn(v),m)).then(v=>{Jh.empty(v)?v.remove():s._groups.set(f,v)})}),c=e.onDidChange(()=>{const d=e.ordered(t);ua(d,r)||n.cancel()});return Promise.all(a).then(()=>n.token.isCancellationRequested&&!i.isCancellationRequested?Ta.create(e,t,i):s._compact()).finally(()=>{n.dispose(),c.dispose(),n.dispose()})}static _makeOutlineElement(e,t){const i=Jh.findId(e,t),n=new aC(i,t,e);if(e.children)for(const s of e.children)Ta._makeOutlineElement(s,n);t.children.set(n.id,n)}constructor(e){super(),this.uri=e,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}_compact(){let e=0;for(const[t,i]of this._groups)i.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{const t=za.first(this._groups.values());for(const[,i]of t.children)i.parent=this,this.children.set(i.id,i)}return this}getTopLevelSymbols(){const e=[];for(const t of this.children.values())t instanceof aC?e.push(t.symbol):e.push(...za.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>H.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return Ta._flattenDocumentSymbols(t,e,""),t.sort((i,n)=>ut.compare(H.getStartPosition(i.range),H.getStartPosition(n.range))||ut.compare(H.getEndPosition(n.range),H.getEndPosition(i.range)))}static _flattenDocumentSymbols(e,t,i){for(const n of t)e.push({kind:n.kind,tags:n.tags,name:n.name,detail:n.detail,containerName:n.containerName||i,range:n.range,selectionRange:n.selectionRange,children:void 0}),n.children&&Ta._flattenDocumentSymbols(e,n.children,n.name)}}const $p=sl("IOutlineModelService");let lC=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new Oe,this._cache=new Cp(10,.7),this._debounceInformation=t.for(e.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(i.onModelRemoved(n=>{this._cache.delete(n.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(e,t){const i=this._languageFeaturesService.documentSymbolProvider,n=i.ordered(e);let s=this._cache.get(e.id);if(!s||s.versionId!==e.getVersionId()||!ua(s.provider,n)){const a=new gs;s={versionId:e.getVersionId(),provider:n,promiseCnt:0,source:a,promise:Ta.create(i,e,a.token),model:void 0},this._cache.set(e.id,s);const c=Date.now();s.promise.then(d=>{s.model=d,this._debounceInformation.update(e,Date.now()-c)}).catch(d=>{this._cache.delete(e.id)})}if(s.model)return s.model;s.promiseCnt+=1;const r=t.onCancellationRequested(()=>{--s.promiseCnt===0&&(s.source.cancel(),this._cache.delete(e.id))});try{return await s.promise}finally{r.dispose()}}};lC=I4([ly(0,gt),ly(1,Wo),ly(2,As)],lC);ol($p,lC,1);dn.registerCommand("_executeDocumentSymbolProvider",async function(o,...e){const[t]=e;Oi(nn.isUri(t));const i=o.get($p),s=await o.get(Ar).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,ii.None)).getTopLevelSymbols()}finally{s.dispose()}});const Kr=class Kr extends Be{constructor(e,t){super(),this.contextKeyService=e,this.model=t,this.inlineCompletionVisible=Kr.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=Kr.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=Kr.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=Kr.suppressSuggestions.bindTo(this.contextKeyService),this._register(Sn(i=>{const n=this.model.read(i),s=n==null?void 0:n.state.read(i),r=!!(s!=null&&s.inlineCompletion)&&(s==null?void 0:s.primaryGhostText)!==void 0&&!(s!=null&&s.primaryGhostText.isEmpty());this.inlineCompletionVisible.set(r),s!=null&&s.primaryGhostText&&(s!=null&&s.inlineCompletion)&&this.suppressSuggestions.set(s.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions)})),this._register(Sn(i=>{const n=this.model.read(i);let s=!1,r=!0;const a=n==null?void 0:n.primaryGhostText.read(i);if(n!=null&&n.selectedSuggestItem&&a&&a.parts.length>0){const{column:c,lines:d}=a.parts[0],u=d[0],f=n.textModel.getLineIndentColumn(a.lineNumber);if(c<=f){let v=Ay(u);v===-1&&(v=u.length-1),s=v>0;const _=n.textModel.getOptions().tabSize;r=kO.visibleColumnFromColumn(u,v+1,_)<_}}this.inlineCompletionSuggestsIndentation.set(s),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(r)}))}};Kr.inlineSuggestionVisible=new yi("inlineSuggestionVisible",!1,w("inlineSuggestionVisible","Whether an inline suggestion is visible")),Kr.inlineSuggestionHasIndentation=new yi("inlineSuggestionHasIndentation",!1,w("inlineSuggestionHasIndentation","Whether the inline suggestion starts with whitespace")),Kr.inlineSuggestionHasIndentationLessThanTabSize=new yi("inlineSuggestionHasIndentationLessThanTabSize",!0,w("inlineSuggestionHasIndentationLessThanTabSize","Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),Kr.suppressSuggestions=new yi("inlineSuggestionSuppressSuggestions",void 0,w("suppressSuggestions","Whether suggestions should be suppressed for the current suggestion"));let so=Kr;function k4(o){const e=new Oe,t=e.add(vE());return e.add(Sn(i=>{t.setStyle(o.read(i))})),e}class Kf{constructor(e,t){this.lineNumber=e,this.parts=t}equals(e){return this.lineNumber===e.lineNumber&&this.parts.length===e.parts.length&&this.parts.every((t,i)=>t.equals(e.parts[i]))}renderForScreenReader(e){if(this.parts.length===0)return"";const t=this.parts[this.parts.length-1],i=e.substr(0,t.column-1);return new bE([...this.parts.map(s=>new Xa(H.fromPositions(new ut(1,s.column)),s.lines.join(`
|
|
32
|
-
`)))]).applyToString(i).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(e=>e.lines.length===0)}get lineCount(){return 1+this.parts.reduce((e,t)=>e+t.lines.length-1,0)}}class K_{constructor(e,t,i){this.column=e,this.text=t,this.preview=i,this.lines=Fb(this.text)}equals(e){return this.column===e.column&&this.lines.length===e.lines.length&&this.lines.every((t,i)=>t===e.lines[i])}}class cC{constructor(e,t,i,n=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=n,this.parts=[new K_(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=Fb(this.text)}renderForScreenReader(e){return this.newLines.join(`
|
|
33
|
-
`)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(e=>e.lines.length===0)}equals(e){return this.lineNumber===e.lineNumber&&this.columnRange.equals(e.columnRange)&&this.newLines.length===e.newLines.length&&this.newLines.every((t,i)=>t===e.newLines[i])&&this.additionalReservedLineCount===e.additionalReservedLineCount}}function ik(o,e){return ua(o,e,ZM)}function ZM(o,e){return o===e?!0:!o||!e?!1:o instanceof Kf&&e instanceof Kf||o instanceof cC&&e instanceof cC?o.equals(e):!1}const D4=[];function E4(){return D4}class XM{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new Wu(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new H(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function YM(o,e){const t=new Oe,i=o.createDecorationsCollection();return t.add(DO({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function P4(o,e){return new ut(o.lineNumber+e.lineNumber-1,e.lineNumber===1?o.column+e.column-1:e.column)}function nk(o,e){return new ut(o.lineNumber-e.lineNumber+1,o.lineNumber-e.lineNumber===0?o.column-e.column+1:o.column)}var T4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},M4=function(o,e){return function(t,i){e(t,i,o)}};const sk="ghost-text";let dC=class extends Be{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=wo(this,!1),this.currentTextModel=Ys(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=Zi(this,n=>{if(this.isDisposed.read(n))return;const s=this.currentTextModel.read(n);if(s!==this.model.targetTextModel.read(n))return;const r=this.model.ghostText.read(n);if(!r)return;const a=r instanceof cC?r.columnRange:void 0,c=[],d=[];function u(y,S){if(d.length>0){const D=d[d.length-1];S&&D.decorations.push(new Nf(D.content.length+1,D.content.length+1+y[0].length,S,0)),D.content+=y[0],y=y.slice(1)}for(const D of y)d.push({content:D,decorations:S?[new Nf(1,D.length+1,S,0)]:[]})}const f=s.getLineContent(r.lineNumber);let m,v=0;for(const y of r.parts){let S=y.lines;m===void 0?(c.push({column:y.column,text:S[0],preview:y.preview}),S=S.slice(1)):u([f.substring(v,y.column-1)],void 0),S.length>0&&(u(S,sk),m===void 0&&y.column<=f.length&&(m=y.column)),v=y.column-1}m!==void 0&&u([f.substring(v)],void 0);const _=m!==void 0?new XM(m,f.length+1):void 0;return{replacedRange:a,inlineTexts:c,additionalLines:d,hiddenRange:_,lineNumber:r.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s}}),this.decorations=Zi(this,n=>{const s=this.uiState.read(n);if(!s)return[];const r=[];s.replacedRange&&r.push({range:s.replacedRange.toRange(s.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),s.hiddenRange&&r.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const a of s.inlineTexts)r.push({range:H.fromPositions(new ut(s.lineNumber,a.column)),options:{description:sk,after:{content:a.text,inlineClassName:a.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:qh.Left},showIfCollapsed:!0}});return r}),this.additionalLinesWidget=this._register(new N4(this.editor,this.languageService.languageIdCodec,Zi(n=>{const s=this.uiState.read(n);return s?{lineNumber:s.lineNumber,additionalLines:s.additionalLines,minReservedLineCount:s.additionalReservedLineCount,targetTextModel:s.targetTextModel}:void 0}))),this._register(gn(()=>{this.isDisposed.set(!0,void 0)})),this._register(YM(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};dC=T4([M4(2,Rr)],dC);class N4 extends Be{get viewZoneId(){return this._viewZoneId}constructor(e,t,i){super(),this.editor=e,this.languageIdCodec=t,this.lines=i,this._viewZoneId=void 0,this.editorOptionsChanged=Vc("editorOptionChanged",es.filter(this.editor.onDidChangeConfiguration,n=>n.hasChanged(33)||n.hasChanged(118)||n.hasChanged(100)||n.hasChanged(95)||n.hasChanged(51)||n.hasChanged(50)||n.hasChanged(67))),this._register(Sn(n=>{const s=this.lines.read(n);this.editorOptionsChanged.read(n),s?this.updateLines(s.lineNumber,s.additionalLines,s.minReservedLineCount):this.clear()}))}dispose(){super.dispose(),this.clear()}clear(){this.editor.changeViewZones(e=>{this._viewZoneId&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0)})}updateLines(e,t,i){const n=this.editor.getModel();if(!n)return;const{tabSize:s}=n.getOptions();this.editor.changeViewZones(r=>{this._viewZoneId&&(r.removeZone(this._viewZoneId),this._viewZoneId=void 0);const a=Math.max(t.length,i);if(a>0){const c=document.createElement("div");R4(c,s,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=r.addZone({afterLineNumber:e,heightInLines:a,domNode:c,afterColumnAffinity:1})}})}}function R4(o,e,t,i,n){const s=i.get(33),r=i.get(118),a="none",c=i.get(95),d=i.get(51),u=i.get(50),f=i.get(67),m=new yE(1e4);m.appendString('<div class="suggest-preview-text">');for(let y=0,S=t.length;y<S;y++){const D=t[y],E=D.content;m.appendString('<div class="view-line'),m.appendString('" style="top:'),m.appendString(String(y*f)),m.appendString('px;width:1000000px;">');const N=LE(E),B=EO(E),F=PO.createEmpty(E,n);SE(new CE(u.isMonospace&&!s,u.canUseHalfwidthRightwardsArrow,E,!1,N,B,0,F,D.decorations,e,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,r,a,c,d!==TO.OFF,null),m),m.appendString("</div>")}m.appendString("</div>"),xE(o,u);const v=m.build(),_=ok?ok.createHTML(v):v;o.innerHTML=_}const ok=wE("editorGhostText",{createHTML:o=>o});function A4(o,e){const t=new AO,i=new NO(t,d=>e.getLanguageConfiguration(d)),n=new MO(new O4([o]),i),s=RO(n,[],void 0,!0);let r="";const a=o.getLineContent();function c(d,u){if(d.kind===2)if(c(d.openingBracket,u),u=Dg(u,d.openingBracket.length),d.child&&(c(d.child,u),u=Dg(u,d.child.length)),d.closingBracket)c(d.closingBracket,u),u=Dg(u,d.closingBracket.length);else{const m=i.getSingleLanguageBracketTokens(d.openingBracket.languageId).findClosingTokenText(d.openingBracket.bracketIds);r+=m}else if(d.kind!==3){if(d.kind===0||d.kind===1)r+=a.substring(RL(u),RL(Dg(u,d.length)));else if(d.kind===4)for(const f of d.children)c(f,u),u=Dg(u,f.length)}}return c(s,OO),r}class O4{constructor(e){this.lines=e,this.tokenization={getLineTokens:t=>this.lines[t-1]}}getLineCount(){return this.lines.length}getLineLength(e){return this.lines[e-1].getLineContent().length}}async function JM(o,e,t,i,n=ii.None,s){const r=e instanceof ut?W4(e,t):e,a=o.all(t),c=new FO;for(const D of a)D.groupId&&c.add(D.groupId,D);function d(D){if(!D.yieldsToGroupIds)return[];const E=[];for(const N of D.yieldsToGroupIds||[]){const B=c.get(N);for(const F of B)E.push(F)}return E}const u=new Map,f=new Set;function m(D,E){if(E=[...E,D],f.has(D))return E;f.add(D);try{const N=d(D);for(const B of N){const F=m(B,E);if(F)return F}}finally{f.delete(D)}}function v(D){const E=u.get(D);if(E)return E;const N=m(D,[]);N&&jn(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${N.map(F=>F.toString?F.toString():""+F).join(" -> ")}`));const B=new Ib;return u.set(D,B.p),(async()=>{var F;if(!N){const Q=d(D);for(const $ of Q){const fe=await v($);if(fe&&fe.items.length>0)return}}try{return e instanceof ut?await D.provideInlineCompletions(t,e,i,n):await((F=D.provideInlineEdits)==null?void 0:F.call(D,t,e,i,n))}catch(Q){jn(Q);return}})().then(F=>B.complete(F),F=>B.error(F)),B.p}const _=await Promise.all(a.map(async D=>({provider:D,completions:await v(D)}))),y=new Map,S=[];for(const D of _){const E=D.completions;if(!E)continue;const N=new H4(E,D.provider);S.push(N);for(const B of E.items){const F=G_.from(B,N,r,t,s);y.set(F.hash(),F)}}return new F4(Array.from(y.values()),new Set(y.keys()),S)}class F4{constructor(e,t,i){this.completions=e,this.hashs=t,this.providerResults=i}has(e){return this.hashs.has(e.hash())}dispose(){for(const e of this.providerResults)e.removeRef()}}class H4{constructor(e,t){this.inlineCompletions=e,this.provider=t,this.refCount=1}addRef(){this.refCount++}removeRef(){this.refCount--,this.refCount===0&&this.provider.freeInlineCompletions(this.inlineCompletions)}}class G_{static from(e,t,i,n,s){let r,a,c=e.range?H.lift(e.range):i;if(typeof e.insertText=="string"){if(r=e.insertText,s&&e.completeBracketPairs){r=rk(r,c.getStartPosition(),n,s);const d=r.length-e.insertText.length;d!==0&&(c=new H(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn+d))}a=void 0}else if("snippet"in e.insertText){const d=e.insertText.snippet.length;if(s&&e.completeBracketPairs){e.insertText.snippet=rk(e.insertText.snippet,c.getStartPosition(),n,s);const f=e.insertText.snippet.length-d;f!==0&&(c=new H(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn+f))}const u=new $d().parse(e.insertText.snippet);u.children.length===1&&u.children[0]instanceof Js?(r=u.children[0].value,a=void 0):(r=u.toString(),a={snippet:e.insertText.snippet,range:c})}else HO(e.insertText);return new G_(r,e.command,c,r,a,e.additionalTextEdits||E4(),e,t)}constructor(e,t,i,n,s,r,a,c){this.filterText=e,this.command=t,this.range=i,this.insertText=n,this.snippetInfo=s,this.additionalTextEdits=r,this.sourceInlineCompletion=a,this.source=c,e=e.replace(/\r\n|\r/g,`
|
|
34
|
-
`),n=e.replace(/\r\n|\r/g,`
|
|
35
|
-
`)}withRange(e){return new G_(this.filterText,this.command,e,this.insertText,this.snippetInfo,this.additionalTextEdits,this.sourceInlineCompletion,this.source)}hash(){return JSON.stringify({insertText:this.insertText,range:this.range.toString()})}toSingleTextEdit(){return new Xa(this.range,this.insertText)}}function W4(o,e){const t=e.getWordAtPosition(o),i=e.getLineMaxColumn(o.lineNumber);return t?new H(o.lineNumber,t.startColumn,o.lineNumber,i):H.fromPositions(o,o.with(void 0,i))}function rk(o,e,t,i){const s=t.getLineContent(e.lineNumber).substring(0,e.column-1)+o,r=t.tokenization.tokenizeLineWithEdit(e,s.length-(e.column-1),o),a=r==null?void 0:r.sliceAndInflate(e.column-1,s.length,0);return a?A4(a,i):o}function Zc(o,e,t){const i=t?o.range.intersectRanges(t):o.range;if(!i)return o;const n=e.getValueInRange(i,1),s=Pp(n,o.text),r=f_.ofText(n.substring(0,s)).addToPosition(o.range.getStartPosition()),a=o.text.substring(s),c=H.fromPositions(r,o.range.getEndPosition());return new Xa(c,a)}function QM(o,e){return o.text.startsWith(e.text)&&B4(o.range,e.range)}function ak(o,e,t,i,n=0){let s=Zc(o,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const r=e.getLineContent(s.range.startLineNumber),a=vs(r).length;if(s.range.startColumn-1<=a){const _=vs(s.text).length,y=r.substring(s.range.startColumn-1,a),[S,D]=[s.range.getStartPosition(),s.range.getEndPosition()],E=S.column+y.length<=D.column?S.delta(0,y.length):D,N=H.fromPositions(E,D),B=s.text.startsWith(y)?s.text.substring(y.length):s.text.substring(_);s=new Xa(N,B)}const d=e.getValueInRange(s.range),u=z4(d,s.text);if(!u)return;const f=s.range.startLineNumber,m=new Array;if(t==="prefix"){const _=u.filter(y=>y.originalLength===0);if(_.length>1||_.length===1&&_[0].originalStart!==d.length)return}const v=s.text.length-n;for(const _ of u){const y=s.range.startColumn+_.originalStart+_.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===s.range.startLineNumber&&y<i.column||_.originalLength>0)return;if(_.modifiedLength===0)continue;const S=_.modifiedStart+_.modifiedLength,D=Math.max(_.modifiedStart,Math.min(S,v)),E=s.text.substring(_.modifiedStart,D),N=s.text.substring(D,Math.max(_.modifiedStart,S));E.length>0&&m.push(new K_(y,E,!1)),N.length>0&&m.push(new K_(y,N,!0))}return new Kf(f,m)}function B4(o,e){return e.getStartPosition().equals(o.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(o.getEndPosition())}let jr;function z4(o,e){if((jr==null?void 0:jr.originalValue)===o&&(jr==null?void 0:jr.newValue)===e)return jr==null?void 0:jr.changes;{let t=ck(o,e,!0);if(t){const i=lk(t);if(i>0){const n=ck(o,e,!1);n&&lk(n)<i&&(t=n)}}return jr={originalValue:o,newValue:e,changes:t},t}}function lk(o){let e=0;for(const t of o)e+=t.originalLength;return e}function ck(o,e,t){if(o.length>5e3||e.length>5e3)return;function i(d){let u=0;for(let f=0,m=d.length;f<m;f++){const v=d.charCodeAt(f);v>u&&(u=v)}return u}const n=Math.max(i(o),i(e));function s(d){if(d<0)throw new Error("unexpected");return n+d+1}function r(d){let u=0,f=0;const m=new Int32Array(d.length);for(let v=0,_=d.length;v<_;v++)if(t&&d[v]==="("){const y=f*100+u;m[v]=s(2*y),u++}else if(t&&d[v]===")"){u=Math.max(u-1,0);const y=f*100+u;m[v]=s(2*y+1),u===0&&f++}else m[v]=d.charCodeAt(v);return m}const a=r(o),c=r(e);return new WO({getElements:()=>a},{getElements:()=>c}).ComputeDiff(!1).changes}var V4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},dk=function(o,e){return function(t,i){e(t,i,o)}};let hC=class extends Be{constructor(e,t,i,n,s){super(),this.textModel=e,this.versionId=t,this._debounceValue=i,this.languageFeaturesService=n,this.languageConfigurationService=s,this._updateOperation=this._register(new So),this.inlineCompletions=Hy("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=Hy("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){var u,f;const n=new U4(e,t,this.textModel.getVersionId()),s=t.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if((u=this._updateOperation.value)!=null&&u.request.satisfies(n))return this._updateOperation.value.promise;if((f=s.get())!=null&&f.request.satisfies(n))return Promise.resolve(!0);const r=!!this._updateOperation.value;this._updateOperation.clear();const a=new gs,c=(async()=>{if((r||t.triggerKind===ja.Automatic)&&await j4(this._debounceValue.get(this.textModel),a.token),a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==n.versionId)return!1;const v=new Date,_=await JM(this.languageFeaturesService.inlineCompletionsProvider,e,this.textModel,t,a.token,this.languageConfigurationService);if(a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==n.versionId)return!1;const y=new Date;this._debounceValue.update(this.textModel,y.getTime()-v.getTime());const S=new q4(_,n,this.textModel,this.versionId);if(i){const D=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!_.has(D)&&S.prepend(i.inlineCompletion,D.range,!0)}return this._updateOperation.clear(),sh(D=>{s.set(S,D)}),!0})(),d=new $4(n,a,c);return this._updateOperation.value=d,c}clear(e){this._updateOperation.clear(),this.inlineCompletions.set(void 0,e),this.suggestWidgetInlineCompletions.set(void 0,e)}clearSuggestWidgetInlineCompletions(e){var t;(t=this._updateOperation.value)!=null&&t.request.context.selectedSuggestionInfo&&this._updateOperation.clear(),this.suggestWidgetInlineCompletions.set(void 0,e)}cancelUpdate(){this._updateOperation.clear()}};hC=V4([dk(3,gt),dk(4,cs)],hC);function j4(o,e){return new Promise(t=>{let i;const n=setTimeout(()=>{i&&i.dispose(),t()},o);e&&(i=e.onCancellationRequested(()=>{clearTimeout(n),i&&i.dispose(),t()}))})}class U4{constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&BO(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,VO())&&(e.context.triggerKind===ja.Automatic||this.context.triggerKind===ja.Explicit)&&this.versionId===e.versionId}}class $4{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class q4{get inlineCompletions(){return this._inlineCompletions}constructor(e,t,i,n){this.inlineCompletionProviderResult=e,this.request=t,this._textModel=i,this._versionId=n,this._refCount=1,this._prependedInlineCompletionItems=[];const s=i.deltaDecorations([],e.completions.map(r=>({range:r.range,options:{description:"inline-completion-tracking-range"}})));this._inlineCompletions=e.completions.map((r,a)=>new hk(r,s[a],this._textModel,this._versionId))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,this._refCount===0){setTimeout(()=>{this._textModel.isDisposed()||this._textModel.deltaDecorations(this._inlineCompletions.map(e=>e.decorationId),[])},0),this.inlineCompletionProviderResult.dispose();for(const e of this._prependedInlineCompletionItems)e.source.removeRef()}}prepend(e,t,i){i&&e.source.addRef();const n=this._textModel.deltaDecorations([],[{range:t,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new hk(e,n,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class hk{get forwardStable(){return this.inlineCompletion.source.inlineCompletions.enableForwardStability??!1}constructor(e,t,i,n){this.inlineCompletion=e,this.decorationId=t,this._textModel=i,this._modelVersion=n,this.semanticId=JSON.stringify([this.inlineCompletion.filterText,this.inlineCompletion.insertText,this.inlineCompletion.range.getStartPosition().toString()]),this._updatedRange=Oa({owner:this,equalsFn:H.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){return this.inlineCompletion.withRange(this._updatedRange.read(e)??cy)}toSingleTextEdit(e){return new Xa(this._updatedRange.read(e)??cy,this.inlineCompletion.insertText)}isVisible(e,t,i){const n=Zc(this._toFilterTextReplacement(i),e),s=this._updatedRange.read(i);if(!s||!this.inlineCompletion.range.getStartPosition().equals(s.getStartPosition())||t.lineNumber!==n.range.startLineNumber)return!1;const r=e.getValueInRange(n.range,1),a=n.text,c=Math.max(0,t.column-n.range.startColumn);let d=a.substring(0,c),u=a.substring(c),f=r.substring(0,c),m=r.substring(c);const v=e.getLineIndentColumn(n.range.startLineNumber);return n.range.startColumn<=v&&(f=f.trimStart(),f.length===0&&(m=m.trimStart()),d=d.trimStart(),d.length===0&&(u=u.trimStart())),d.startsWith(f)&&!!zO(m,u)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&f_.ofRange(i).isGreaterThanOrEqualTo(f_.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){return new Xa(this._updatedRange.read(e)??cy,this.inlineCompletion.filterText)}}const cy=new H(1,1,1,1),Rt={Visible:h1,HasFocusedSuggestion:new yi("suggestWidgetHasFocusedSuggestion",!1,w("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new yi("suggestWidgetDetailsVisible",!1,w("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new yi("suggestWidgetMultipleSuggestions",!1,w("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new yi("suggestionMakesTextEdit",!0,w("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new yi("acceptSuggestionOnEnter",!0,w("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new yi("suggestionHasInsertAndReplaceRange",!1,w("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new yi("suggestionInsertMode",void 0,{type:"string",description:w("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new yi("suggestionCanResolve",!1,w("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},Hl=new Ye("suggestWidgetStatusBar");class K4{constructor(e,t,i,n){var s;this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=Pf.Default,this.distance=0,this.textLabel=typeof t.label=="string"?t.label:(s=t.label)==null?void 0:s.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=t.sortText&&t.sortText.toLowerCase(),this.filterTextLow=t.filterText&&t.filterText.toLowerCase(),this.extensionId=t.extensionId,H.isIRange(t.range)?(this.editStart=new ut(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new ut(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new ut(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||H.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new ut(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new ut(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new ut(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||H.spansMultipleLines(t.range.insert)||H.spansMultipleLines(t.range.replace)||t.range.insert.startLineNumber!==e.lineNumber||t.range.replace.startLineNumber!==e.lineNumber||t.range.insert.startColumn!==t.range.replace.startColumn),typeof n.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(e){if(!this._resolveCache){const t=e.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),i=new oo(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(n=>{Object.assign(this.completion,n),this._resolveDuration=i.elapsed()},n=>{dc(n)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}}const qv=class qv{constructor(e=2,t=new Set,i=new Set,n=new Map,s=!0){this.snippetSortOrder=e,this.kindFilter=t,this.providerFilter=i,this.providerItemsToReuse=n,this.showDeprecated=s}};qv.default=new qv;let Gf=qv;class G4{constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}async function v1(o,e,t,i=Gf.default,n={triggerKind:0},s=ii.None){const r=new oo;t=t.clone();const a=e.getWordAtPosition(t),c=a?new H(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):H.fromPositions(t),d={replace:c,insert:c.setEndPosition(t.lineNumber,t.column)},u=[],f=new Oe,m=[];let v=!1;const _=(S,D,E)=>{var B;let N=!1;if(!D)return N;for(const F of D.suggestions)if(!i.kindFilter.has(F.kind)){if(!i.showDeprecated&&((B=F==null?void 0:F.tags)!=null&&B.includes(1)))continue;F.range||(F.range=d),F.sortText||(F.sortText=typeof F.label=="string"?F.label:F.label.label),!v&&F.insertTextRules&&F.insertTextRules&4&&(v=$d.guessNeedsClipboard(F.insertText)),u.push(new K4(t,F,D,S)),N=!0}return IE(D)&&f.add(D),m.push({providerName:S._debugDisplayName??"unknown_provider",elapsedProvider:D.duration??-1,elapsedOverall:E.elapsed()}),N},y=(async()=>{})();for(const S of o.orderedGroups(e)){let D=!1;if(await Promise.all(S.map(async E=>{if(i.providerItemsToReuse.has(E)){const N=i.providerItemsToReuse.get(E);N.forEach(B=>u.push(B)),D=D||N.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(E)))try{const N=new oo,B=await E.provideCompletionItems(e,t,n,s);D=_(E,B,N)||D}catch(N){jn(N)}})),D||s.isCancellationRequested)break}return await y,s.isCancellationRequested?(f.dispose(),Promise.reject(new kb)):new G4(u.sort(Y4(i.snippetSortOrder)),v,{entries:m,elapsed:r.elapsed()},f)}function b1(o,e){if(o.sortTextLow&&e.sortTextLow){if(o.sortTextLow<e.sortTextLow)return-1;if(o.sortTextLow>e.sortTextLow)return 1}return o.textLabel<e.textLabel?-1:o.textLabel>e.textLabel?1:o.completion.kind-e.completion.kind}function Z4(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return-1;if(e.completion.kind===27)return 1}return b1(o,e)}function X4(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return 1;if(e.completion.kind===27)return-1}return b1(o,e)}const cw=new Map;cw.set(0,Z4);cw.set(2,X4);cw.set(1,b1);function Y4(o){return cw.get(o)}dn.registerCommand("_executeCompletionItemProvider",async(o,...e)=>{const[t,i,n,s]=e;Oi(nn.isUri(t)),Oi(ut.isIPosition(i)),Oi(typeof n=="string"||!n),Oi(typeof s=="number"||!s);const{completionProvider:r}=o.get(gt),a=await o.get(Ar).createModelReference(t);try{const c={incomplete:!1,suggestions:[]},d=[],u=a.object.textEditorModel.validatePosition(i),f=await v1(r,a.object.textEditorModel,u,void 0,{triggerCharacter:n??void 0,triggerKind:n?1:0});for(const m of f.items)d.length<(s??0)&&d.push(m.resolve(ii.None)),c.incomplete=c.incomplete||m.container.incomplete,c.suggestions.push(m.completion);try{return await Promise.all(d),c}finally{setTimeout(()=>f.disposable.dispose(),100)}}finally{a.dispose()}});function J4(o,e){var t;(t=o.getContribution("editor.contrib.suggestController"))==null||t.triggerSuggest(new Set().add(e),void 0,!0)}class Qh{static isAllOff(e){return e.other==="off"&&e.comments==="off"&&e.strings==="off"}static isAllOn(e){return e.other==="on"&&e.comments==="on"&&e.strings==="on"}static valueFor(e,t){switch(t){case 1:return e.comments;case 2:return e.strings;default:return e.other}}}function uk(o,e=Lb){return jO(o,e)?o.charAt(0).toUpperCase()+o.slice(1):o}var Q4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ej=function(o,e){return function(t,i){e(t,i,o)}};class gk{constructor(e){this._delegates=e}resolve(e){for(const t of this._delegates){const i=t.resolve(e);if(i!==void 0)return i}}}class fk{constructor(e,t,i,n){this._model=e,this._selection=t,this._selectionIdx=i,this._overtypingCapturer=n}resolve(e){const{name:t}=e;if(t==="SELECTION"||t==="TM_SELECTED_TEXT"){let i=this._model.getValueInRange(this._selection)||void 0,n=this._selection.startLineNumber!==this._selection.endLineNumber;if(!i&&this._overtypingCapturer){const s=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);s&&(i=s.value,n=s.multiline)}if(i&&n&&e.snippet){const s=this._model.getLineContent(this._selection.startLineNumber),r=vs(s,0,this._selection.startColumn-1);let a=r;e.snippet.walk(d=>d===e?!1:(d instanceof Js&&(a=vs(Fb(d.value).pop())),!0));const c=Pp(a,r);i=i.replace(/(\r\n|\r|\n)(.*)/g,(d,u,f)=>`${u}${a.substr(c)}${f}`)}return i}else{if(t==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(t==="TM_CURRENT_WORD"){const i=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return i&&i.word||void 0}else{if(t==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(t==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(t==="CURSOR_INDEX")return String(this._selectionIdx);if(t==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}}class pk{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return nf(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=nf(this._model.uri.fsPath),n=i.lastIndexOf(".");return n<=0?i:i.slice(0,n)}else{if(t==="TM_DIRECTORY")return UO(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(m0(this._model.uri));if(t==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(t==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}}class mk{constructor(e,t,i,n){this._readClipboardText=e,this._selectionIdx=t,this._selectionCount=i,this._spread=n}resolve(e){if(e.name!=="CLIPBOARD")return;const t=this._readClipboardText();if(t){if(this._spread){const i=t.split(/\r\n|\n|\r/).filter(n=>!$O(n));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let Z_=class{constructor(e,t,i){this._model=e,this._selection=t,this._languageConfigurationService=i}resolve(e){const{name:t}=e,i=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),n=this._languageConfigurationService.getLanguageConfiguration(i).comments;if(n){if(t==="LINE_COMMENT")return n.lineCommentToken||void 0;if(t==="BLOCK_COMMENT_START")return n.blockCommentStartToken||void 0;if(t==="BLOCK_COMMENT_END")return n.blockCommentEndToken||void 0}}};Z_=Q4([ej(2,cs)],Z_);const Gr=class Gr{constructor(){this._date=new Date}resolve(e){const{name:t}=e;if(t==="CURRENT_YEAR")return String(this._date.getFullYear());if(t==="CURRENT_YEAR_SHORT")return String(this._date.getFullYear()).slice(-2);if(t==="CURRENT_MONTH")return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if(t==="CURRENT_DATE")return String(this._date.getDate().valueOf()).padStart(2,"0");if(t==="CURRENT_HOUR")return String(this._date.getHours().valueOf()).padStart(2,"0");if(t==="CURRENT_MINUTE")return String(this._date.getMinutes().valueOf()).padStart(2,"0");if(t==="CURRENT_SECOND")return String(this._date.getSeconds().valueOf()).padStart(2,"0");if(t==="CURRENT_DAY_NAME")return Gr.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return Gr.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return Gr.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return Gr.monthNamesShort[this._date.getMonth()];if(t==="CURRENT_SECONDS_UNIX")return String(Math.floor(this._date.getTime()/1e3));if(t==="CURRENT_TIMEZONE_OFFSET"){const i=this._date.getTimezoneOffset(),n=i>0?"-":"+",s=Math.trunc(Math.abs(i/60)),r=s<10?"0"+s:s,a=Math.abs(i)-s*60,c=a<10?"0"+a:a;return n+r+":"+c}}};Gr.dayNames=[w("Sunday","Sunday"),w("Monday","Monday"),w("Tuesday","Tuesday"),w("Wednesday","Wednesday"),w("Thursday","Thursday"),w("Friday","Friday"),w("Saturday","Saturday")],Gr.dayNamesShort=[w("SundayShort","Sun"),w("MondayShort","Mon"),w("TuesdayShort","Tue"),w("WednesdayShort","Wed"),w("ThursdayShort","Thu"),w("FridayShort","Fri"),w("SaturdayShort","Sat")],Gr.monthNames=[w("January","January"),w("February","February"),w("March","March"),w("April","April"),w("May","May"),w("June","June"),w("July","July"),w("August","August"),w("September","September"),w("October","October"),w("November","November"),w("December","December")],Gr.monthNamesShort=[w("JanuaryShort","Jan"),w("FebruaryShort","Feb"),w("MarchShort","Mar"),w("AprilShort","Apr"),w("MayShort","May"),w("JuneShort","Jun"),w("JulyShort","Jul"),w("AugustShort","Aug"),w("SeptemberShort","Sep"),w("OctoberShort","Oct"),w("NovemberShort","Nov"),w("DecemberShort","Dec")];let X_=Gr;class _k{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=qO(this._workspaceService.getWorkspace());if(!KO(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(AL(e))return nf(e.uri.path);let t=nf(e.configPath.path);return t.endsWith(OL)&&(t=t.substr(0,t.length-OL.length-1)),t}_resoveWorkspacePath(e){if(AL(e))return uk(e.uri.fsPath);const t=nf(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?uk(i):"/"}}class vk{resolve(e){const{name:t}=e;if(t==="RANDOM")return Math.random().toString().slice(-6);if(t==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(t==="UUID")return Qb()}}var tj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ij=function(o,e){return function(t,i){e(t,i,o)}},gr;const Uo=class Uo{constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=FL(t.placeholders,Oo.compareByIndex),this._placeholderGroupsIdx=-1}initialize(e){this._offset=e.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const e=this._editor.getModel();this._editor.changeDecorations(t=>{for(const i of this._snippet.placeholders){const n=this._snippet.offset(i),s=this._snippet.fullLen(i),r=H.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+s)),a=i.isFinalTabstop?Uo._decor.inactiveFinal:Uo._decor.inactive,c=t.addDecoration(r,a);this._placeholderDecorations.set(i,c)}})}move(e){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){const n=[];for(const s of this._placeholderGroups[this._placeholderGroupsIdx])if(s.transform){const r=this._placeholderDecorations.get(s),a=this._editor.getModel().getDecorationRange(r),c=this._editor.getModel().getValueInRange(a),d=s.transform.resolve(c).split(/\r\n|\r|\n/);for(let u=1;u<d.length;u++)d[u]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+d[u]);n.push(En.replace(a,d.join(this._editor.getModel().getEOL())))}n.length>0&&this._editor.executeEdits("snippet.placeholderTransform",n)}let t=!1;e===!0&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,t=!0):e===!1&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,t=!0);const i=this._editor.getModel().changeDecorations(n=>{const s=new Set,r=[];for(const a of this._placeholderGroups[this._placeholderGroupsIdx]){const c=this._placeholderDecorations.get(a),d=this._editor.getModel().getDecorationRange(c);r.push(new Mt(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),n.changeDecorationOptions(c,a.isFinalTabstop?Uo._decor.activeFinal:Uo._decor.active),s.add(a);for(const u of this._snippet.enclosingPlaceholders(a)){const f=this._placeholderDecorations.get(u);n.changeDecorationOptions(f,u.isFinalTabstop?Uo._decor.activeFinal:Uo._decor.active),s.add(u)}}for(const[a,c]of this._placeholderDecorations)s.has(a)||n.changeDecorationOptions(c,a.isFinalTabstop?Uo._decor.inactiveFinal:Uo._decor.inactive);return r});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof Oo){const i=this._placeholderDecorations.get(t);if(this._editor.getModel().getDecorationRange(i).isEmpty()&&t.toString().length>0)return!0}t=t.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){const[e]=this._snippet.placeholders;if(e.isFinalTabstop&&this._snippet.rightMostDescendant===e)return!0}return!1}computePossibleSelections(){const e=new Map;for(const t of this._placeholderGroups){let i;for(const n of t){if(n.isFinalTabstop)break;i||(i=[],e.set(n.index,i));const s=this._placeholderDecorations.get(n),r=this._editor.getModel().getDecorationRange(s);if(!r){e.delete(n.index);break}i.push(r)}}return e}get activeChoice(){if(!this._placeholderDecorations)return;const e=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!(e!=null&&e.choice))return;const t=this._placeholderDecorations.get(e);if(!t)return;const i=this._editor.getModel().getDecorationRange(t);if(i)return{range:i,choice:e.choice}}get hasChoice(){let e=!1;return this._snippet.walk(t=>(e=t instanceof _g,!e)),e}merge(e){const t=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(i=>{for(const n of this._placeholderGroups[this._placeholderGroupsIdx]){const s=e.shift();console.assert(s._offset!==-1),console.assert(!s._placeholderDecorations);const r=s._snippet.placeholderInfo.last.index;for(const c of s._snippet.placeholderInfo.all)c.isFinalTabstop?c.index=n.index+(r+1)/this._nestingLevel:c.index=n.index+c.index/this._nestingLevel;this._snippet.replace(n,s._snippet.children);const a=this._placeholderDecorations.get(n);i.removeDecoration(a),this._placeholderDecorations.delete(n);for(const c of s._snippet.placeholders){const d=s._snippet.offset(c),u=s._snippet.fullLen(c),f=H.fromPositions(t.getPositionAt(s._offset+d),t.getPositionAt(s._offset+d+u)),m=i.addDecoration(f,Uo._decor.inactive);this._placeholderDecorations.set(c,m)}}this._placeholderGroups=FL(this._snippet.placeholders,Oo.compareByIndex)})}};Uo._decor={active:pi.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:pi.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:pi.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:pi.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};let Y_=Uo;const bk={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let J_=gr=class{static adjustWhitespace(e,t,i,n,s){const r=e.getLineContent(t.lineNumber),a=vs(r,0,t.column-1);let c;return n.walk(d=>{if(!(d instanceof Js)||d.parent instanceof _g||s&&!s.has(d))return!0;const u=d.value.split(/\r\n|\r|\n/);if(i){const m=n.offset(d);if(m===0)u[0]=e.normalizeIndentation(u[0]);else{c=c??n.toString();const v=c.charCodeAt(m-1);(v===10||v===13)&&(u[0]=e.normalizeIndentation(a+u[0]))}for(let v=1;v<u.length;v++)u[v]=e.normalizeIndentation(a+u[v])}const f=u.join(e.getEOL());return f!==d.value&&(d.parent.replace(d,[new Js(f)]),c=void 0),!0}),a}static adjustSelection(e,t,i,n){if(i!==0||n!==0){const{positionLineNumber:s,positionColumn:r}=t,a=r-i,c=r+n,d=e.validateRange({startLineNumber:s,startColumn:a,endLineNumber:s,endColumn:c});t=Mt.createWithDirection(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn,t.getDirection())}return t}static createEditsAndSnippetsFromSelections(e,t,i,n,s,r,a,c,d){const u=[],f=[];if(!e.hasModel())return{edits:u,snippets:f};const m=e.getModel(),v=e.invokeWithinContext(B=>B.get(Tu)),_=e.invokeWithinContext(B=>new pk(B.get(Ef),m)),y=()=>a,S=m.getValueInRange(gr.adjustSelection(m,e.getSelection(),i,0)),D=m.getValueInRange(gr.adjustSelection(m,e.getSelection(),0,n)),E=m.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),N=e.getSelections().map((B,F)=>({selection:B,idx:F})).sort((B,F)=>H.compareRangesUsingStarts(B.selection,F.selection));for(const{selection:B,idx:F}of N){let Q=gr.adjustSelection(m,B,i,0),$=gr.adjustSelection(m,B,0,n);S!==m.getValueInRange(Q)&&(Q=B),D!==m.getValueInRange($)&&($=B);const fe=B.setStartPosition(Q.startLineNumber,Q.startColumn).setEndPosition($.endLineNumber,$.endColumn),Pe=new $d().parse(t,!0,s),ze=fe.getStartPosition(),me=gr.adjustWhitespace(m,ze,r||F>0&&E!==m.getLineFirstNonWhitespaceColumn(B.positionLineNumber),Pe);Pe.resolveVariables(new gk([_,new mk(y,F,N.length,e.getOption(79)==="spread"),new fk(m,B,F,c),new Z_(m,B,d),new X_,new _k(v),new vk])),u[F]=En.replace(fe,Pe.toString()),u[F].identifier={major:F,minor:0},u[F]._isTracked=!0,f[F]=new Y_(e,Pe,me)}return{edits:u,snippets:f}}static createEditsAndSnippetsFromEdits(e,t,i,n,s,r,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const c=[],d=e.getModel(),u=new $d,f=new Hp,m=new gk([e.invokeWithinContext(_=>new pk(_.get(Ef),d)),new mk(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new fk(d,e.getSelection(),0,r),new Z_(d,e.getSelection(),a),new X_,new _k(e.invokeWithinContext(_=>_.get(Tu))),new vk]);t=t.sort((_,y)=>H.compareRangesUsingStarts(_.range,y.range));let v=0;for(let _=0;_<t.length;_++){const{range:y,template:S}=t[_];if(_>0){const F=t[_-1].range,Q=H.fromPositions(F.getEndPosition(),y.getStartPosition()),$=new Js(d.getValueInRange(Q));f.appendChild($),v+=$.value.length}const D=u.parseFragment(S,f);gr.adjustWhitespace(d,y.getStartPosition(),!0,f,new Set(D)),f.resolveVariables(m);const E=f.toString(),N=E.slice(v);v=E.length;const B=En.replace(y,N);B.identifier={major:_,minor:0},B._isTracked=!0,c.push(B)}return u.ensureFinalTabstop(f,i,!0),{edits:c,snippets:[new Y_(e,f,"")]}}constructor(e,t,i=bk,n){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=n,this._templateMerges=[],this._snippets=[]}dispose(){Ds(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:e,snippets:t}=typeof this._template=="string"?gr.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):gr.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=t,this._editor.executeEdits("snippet",e,i=>{const n=i.filter(s=>!!s.identifier);for(let s=0;s<t.length;s++)t[s].initialize(n[s].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):n.map(s=>Mt.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=bk){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=gr.createEditsAndSnippetsFromSelections(this._editor,e,t.overwriteBefore,t.overwriteAfter,!0,t.adjustWhitespace,t.clipboardText,t.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",i,s=>{const r=s.filter(c=>!!c.identifier);for(let c=0;c<n.length;c++)n[c].initialize(r[c].textChange);const a=n[0].isTrivialSnippet;if(!a){for(const c of this._snippets)c.merge(n);console.assert(n.length===0)}return this._snippets[0].hasPlaceholder&&!a?this._move(void 0):r.map(c=>Mt.fromPositions(c.range.getEndPosition()))})}next(){const e=this._move(!0);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}prev(){const e=this._move(!1);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}_move(e){const t=[];for(const i of this._snippets){const n=i.move(e);t.push(...n)}return t}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const e=this._editor.getSelections();if(e.length<this._snippets.length)return!1;const t=new Map;for(const i of this._snippets){const n=i.computePossibleSelections();if(t.size===0)for(const[s,r]of n){r.sort(H.compareRangesUsingStarts);for(const a of e)if(r[0].containsRange(a)){t.set(s,[]);break}}if(t.size===0)return!1;t.forEach((s,r)=>{s.push(...n.get(r))})}e.sort(H.compareRangesUsingStarts);for(const[i,n]of t){if(n.length!==e.length){t.delete(i);continue}n.sort(H.compareRangesUsingStarts);for(let s=0;s<n.length;s++)if(!n[s].containsRange(e[s])){t.delete(i);continue}}return t.size>0}};J_=gr=tj([ij(3,cs)],J_);var nj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xm=function(o,e){return function(t,i){e(t,i,o)}},Vh;const wk={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};var ia;let Ns=(ia=class{static get(e){return e.getContribution(Vh.ID)}constructor(e,t,i,n,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new Oe,this._modelVersionId=-1,this._inSnippet=Vh.InSnippetMode.bindTo(n),this._hasNextTabstop=Vh.HasNextTabstop.bindTo(n),this._hasPrevTabstop=Vh.HasPrevTabstop.bindTo(n)}dispose(){var e;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),(e=this._session)==null||e.dispose(),this._snippetListener.dispose()}insert(e,t){try{this._doInsert(e,typeof t>"u"?wk:{...wk,...t})}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",e),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(e,t){var i;if(this._editor.hasModel()){if(this._snippetListener.clear(),t.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof e!="string"&&this.cancel(),this._session?(Oi(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new J_(this._editor,e,t,this._languageConfigurationService),this._session.insert()),t.undoStopAfter&&this._editor.getModel().pushStackElement(),(i=this._session)!=null&&i.hasChoice){const n={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(u,f)=>{if(!this._session||u!==this._editor.getModel()||!ut.equals(this._editor.getPosition(),f))return;const{activeChoice:m}=this._session;if(!m||m.choice.options.length===0)return;const v=u.getValueInRange(m.range),_=!!m.choice.options.find(S=>S.value===v),y=[];for(let S=0;S<m.choice.options.length;S++){const D=m.choice.options[S];y.push({kind:13,label:D.value,insertText:D.value,sortText:"a".repeat(S+1),range:m.range,filterText:_?`${v}_${D.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:w("next","Go to next placeholder...")}})}return{suggestions:y}}},s=this._editor.getModel();let r,a=!1;const c=()=>{r==null||r.dispose(),a=!1},d=()=>{a||(r=this._languageFeaturesService.completionProvider.register({language:s.getLanguageId(),pattern:s.uri.fsPath,scheme:s.uri.scheme,exclusive:!0},n),this._snippetListener.add(r),a=!0)};this._choiceCompletions={provider:n,enable:d,disable:c}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(n=>n.isFlush&&this.cancel())),this._snippetListener.add(this._editor.onDidChangeModel(()=>this.cancel())),this._snippetListener.add(this._editor.onDidChangeCursorSelection(()=>this._updateState()))}}_updateState(){if(!(!this._session||!this._editor.hasModel())){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){var t;if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0;return}const{activeChoice:e}=this._session;if(!e||!this._choiceCompletions){(t=this._choiceCompletions)==null||t.disable(),this._currentChoice=void 0;return}this._currentChoice!==e.choice&&(this._currentChoice=e.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{J4(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(e=!1){var t;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,(t=this._session)==null||t.dispose(),this._session=void 0,this._modelVersionId=-1,e&&this._editor.setSelections([this._editor.getSelection()])}prev(){var e;(e=this._session)==null||e.prev(),this._updateState()}next(){var e;(e=this._session)==null||e.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}},Vh=ia,ia.ID="snippetController2",ia.InSnippetMode=new yi("inSnippetMode",!1,w("inSnippetMode","Whether the editor in current in snippet mode")),ia.HasNextTabstop=new yi("hasNextTabstop",!1,w("hasNextTabstop","Whether there is a next tab stop when in snippet mode")),ia.HasPrevTabstop=new yi("hasPrevTabstop",!1,w("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode")),ia);Ns=Vh=nj([xm(1,oh),xm(2,gt),xm(3,Ri),xm(4,cs)],Ns);oi(Ns.ID,Ns,4);const dw=js.bindToContribution(Ns.get);bt(new dw({id:"jumpToNextSnippetPlaceholder",precondition:le.and(Ns.InSnippetMode,Ns.HasNextTabstop),handler:o=>o.next(),kbOpts:{weight:130,kbExpr:M.textInputFocus,primary:2}}));bt(new dw({id:"jumpToPrevSnippetPlaceholder",precondition:le.and(Ns.InSnippetMode,Ns.HasPrevTabstop),handler:o=>o.prev(),kbOpts:{weight:130,kbExpr:M.textInputFocus,primary:1026}}));bt(new dw({id:"leaveSnippet",precondition:Ns.InSnippetMode,handler:o=>o.cancel(!0),kbOpts:{weight:130,kbExpr:M.textInputFocus,primary:9,secondary:[1033]}}));bt(new dw({id:"acceptSnippet",precondition:Ns.InSnippetMode,handler:o=>o.finish()}));var sj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},dy=function(o,e){return function(t,i){e(t,i,o)}};let uC=class extends Be{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(e,t,i,n,s,r,a,c,d,u,f,m){super(),this.textModel=e,this.selectedSuggestItem=t,this._textModelVersionId=i,this._positions=n,this._debounceValue=s,this._suggestPreviewEnabled=r,this._suggestPreviewMode=a,this._inlineSuggestMode=c,this._enabled=d,this._instantiationService=u,this._commandService=f,this._languageConfigurationService=m,this._source=this._register(this._instantiationService.createInstance(hC,this.textModel,this._textModelVersionId,this._debounceValue)),this._isActive=wo(this,!1),this._forceUpdateExplicitlySignal=y0(this),this._selectedInlineCompletionId=wo(this,void 0),this._primaryPosition=Zi(this,_=>this._positions.read(_)[0]??new ut(1,1)),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([Pa.Redo,Pa.Undo,Pa.AcceptWord]),this._fetchInlineCompletionsPromise=kE({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:ja.Automatic}),handleChange:(_,y)=>(_.didChange(this._textModelVersionId)&&this._preserveCurrentCompletionReasons.has(this._getReason(_.change))?y.preserveCurrentCompletion=!0:_.didChange(this._forceUpdateExplicitlySignal)&&(y.inlineCompletionTriggerKind=ja.Explicit),!0)},(_,y)=>{if(this._forceUpdateExplicitlySignal.read(_),!(this._enabled.read(_)&&this.selectedSuggestItem.read(_)||this._isActive.read(_))){this._source.cancelUpdate();return}this._textModelVersionId.read(_);const D=this._source.suggestWidgetInlineCompletions.get(),E=this.selectedSuggestItem.read(_);if(D&&!E){const $=this._source.inlineCompletions.get();sh(fe=>{(!$||D.request.versionId>$.request.versionId)&&this._source.inlineCompletions.set(D.clone(),fe),this._source.clearSuggestWidgetInlineCompletions(fe)})}const N=this._primaryPosition.read(_),B={triggerKind:y.inlineCompletionTriggerKind,selectedSuggestionInfo:E==null?void 0:E.toSelectedSuggestionInfo()},F=this.selectedInlineCompletion.get(),Q=y.preserveCurrentCompletion||F!=null&&F.forwardStable?F:void 0;return this._source.fetch(N,B,Q)}),this._filteredInlineCompletionItems=Oa({owner:this,equalsFn:Wy()},_=>{const y=this._source.inlineCompletions.read(_);if(!y)return[];const S=this._primaryPosition.read(_);return y.inlineCompletions.filter(E=>E.isVisible(this.textModel,S,_))}),this.selectedInlineCompletionIndex=Zi(this,_=>{const y=this._selectedInlineCompletionId.read(_),S=this._filteredInlineCompletionItems.read(_),D=this._selectedInlineCompletionId===void 0?-1:S.findIndex(E=>E.semanticId===y);return D===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):D}),this.selectedInlineCompletion=Zi(this,_=>{const y=this._filteredInlineCompletionItems.read(_),S=this.selectedInlineCompletionIndex.read(_);return y[S]}),this.activeCommands=Oa({owner:this,equalsFn:Wy()},_=>{var y;return((y=this.selectedInlineCompletion.read(_))==null?void 0:y.inlineCompletion.source.inlineCompletions.commands)??[]}),this.lastTriggerKind=this._source.inlineCompletions.map(this,_=>_==null?void 0:_.request.context.triggerKind),this.inlineCompletionsCount=Zi(this,_=>{if(this.lastTriggerKind.read(_)===ja.Explicit)return this._filteredInlineCompletionItems.read(_).length}),this.state=Oa({owner:this,equalsFn:(_,y)=>!_||!y?_===y:ik(_.ghostTexts,y.ghostTexts)&&_.inlineCompletion===y.inlineCompletion&&_.suggestItem===y.suggestItem},_=>{const y=this.textModel,S=this.selectedSuggestItem.read(_);if(S){const D=Zc(S.toSingleTextEdit(),y),E=this._computeAugmentation(D,_);if(!this._suggestPreviewEnabled.read(_)&&!E)return;const B=(E==null?void 0:E.edit)??D,F=E?E.edit.text.length-D.text.length:0,Q=this._suggestPreviewMode.read(_),$=this._positions.read(_),fe=[B,...hy(this.textModel,$,B)],Pe=fe.map((me,Ve)=>ak(me,y,Q,$[Ve],F)).filter(Wm),ze=Pe[0]??new Kf(B.range.endLineNumber,[]);return{edits:fe,primaryGhostText:ze,ghostTexts:Pe,inlineCompletion:E==null?void 0:E.completion,suggestItem:S}}else{if(!this._isActive.read(_))return;const D=this.selectedInlineCompletion.read(_);if(!D)return;const E=D.toSingleTextEdit(_),N=this._inlineSuggestMode.read(_),B=this._positions.read(_),F=[E,...hy(this.textModel,B,E)],Q=F.map(($,fe)=>ak($,y,N,B[fe],0)).filter(Wm);return Q[0]?{edits:F,primaryGhostText:Q[0],ghostTexts:Q,inlineCompletion:D,suggestItem:void 0}:void 0}}),this.ghostTexts=Oa({owner:this,equalsFn:ik},_=>{const y=this.state.read(_);if(y)return y.ghostTexts}),this.primaryGhostText=Oa({owner:this,equalsFn:ZM},_=>{const y=this.state.read(_);if(y)return y==null?void 0:y.primaryGhostText}),this._register(DE(this._fetchInlineCompletionsPromise));let v;this._register(Sn(_=>{var D,E;const y=this.state.read(_),S=y==null?void 0:y.inlineCompletion;if((S==null?void 0:S.semanticId)!==(v==null?void 0:v.semanticId)&&(v=S,S)){const N=S.inlineCompletion,B=N.source;(E=(D=B.provider).handleItemDidShow)==null||E.call(D,B.inlineCompletions,N.sourceInlineCompletion,N.insertText)}}))}_getReason(e){return e!=null&&e.isUndoing?Pa.Undo:e!=null&&e.isRedoing?Pa.Redo:this.isAcceptingPartially?Pa.AcceptWord:Pa.Other}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){p_(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){p_(e,t=>{this._isActive.set(!1,t),this._source.clear(t)})}_computeAugmentation(e,t){const i=this.textModel,n=this._source.suggestWidgetInlineCompletions.read(t),s=n?n.inlineCompletions:[this.selectedInlineCompletion.read(t)].filter(Wm);return GO(s,a=>{let c=a.toSingleTextEdit(t);return c=Zc(c,i,H.fromPositions(c.range.getStartPosition(),e.range.getEndPosition())),QM(c,e)?{completion:a,edit:c}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineCompletionItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(e){var n;if(e.getModel()!==this.textModel)throw new Wu;const t=this.state.get();if(!t||t.primaryGhostText.isEmpty()||!t.inlineCompletion)return;const i=t.inlineCompletion.toInlineCompletion(void 0);if(i.command&&i.source.addRef(),e.pushUndoStop(),i.snippetInfo)e.executeEdits("inlineSuggestion.accept",[En.replace(i.range,""),...i.additionalTextEdits]),e.setPosition(i.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),(n=Ns.get(e))==null||n.insert(i.snippetInfo.snippet,{undoStopBefore:!1});else{const s=t.edits,r=yk(s).map(a=>Mt.fromPositions(a));e.executeEdits("inlineSuggestion.accept",[...s.map(a=>En.replace(a.range,a.text)),...i.additionalTextEdits]),e.setSelections(r,"inlineCompletionAccept")}this.stop(),i.command&&(await this._commandService.executeCommand(i.command.id,...i.command.arguments||[]).then(void 0,jn),i.source.removeRef())}async acceptNextWord(e){await this._acceptNext(e,(t,i)=>{const n=this.textModel.getLanguageIdAtPosition(t.lineNumber,t.column),s=this._languageConfigurationService.getLanguageConfiguration(n),r=new RegExp(s.wordDefinition.source,s.wordDefinition.flags.replace("g","")),a=i.match(r);let c=0;a&&a.index!==void 0?a.index===0?c=a[0].length:c=a.index:c=i.length;const u=/\s+/g.exec(i);return u&&u.index!==void 0&&u.index+u[0].length<c&&(c=u.index+u[0].length),c},0)}async acceptNextLine(e){await this._acceptNext(e,(t,i)=>{const n=i.match(/\n/);return n&&n.index!==void 0?n.index+1:i.length},1)}async _acceptNext(e,t,i){if(e.getModel()!==this.textModel)throw new Wu;const n=this.state.get();if(!n||n.primaryGhostText.isEmpty()||!n.inlineCompletion)return;const s=n.primaryGhostText,r=n.inlineCompletion.toInlineCompletion(void 0);if(r.snippetInfo||r.filterText!==r.insertText){await this.accept(e);return}const a=s.parts[0],c=new ut(s.lineNumber,a.column),d=a.text,u=t(c,d);if(u===d.length&&s.parts.length===1){this.accept(e);return}const f=d.substring(0,u),m=this._positions.get(),v=m[0];r.source.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const _=H.fromPositions(v,c),y=e.getModel().getValueInRange(_)+f,S=new Xa(_,y),D=[S,...hy(this.textModel,m,S)],E=yk(D).map(N=>Mt.fromPositions(N));e.executeEdits("inlineSuggestion.accept",D.map(N=>En.replace(N.range,N.text))),e.setSelections(E,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}if(r.source.provider.handlePartialAccept){const _=H.fromPositions(r.range.getStartPosition(),f_.ofText(f).addToPosition(c)),y=e.getModel().getValueInRange(_,1);r.source.provider.handlePartialAccept(r.source.inlineCompletions,r.sourceInlineCompletion,y.length,{kind:i})}}finally{r.source.removeRef()}}handleSuggestAccepted(e){var s,r;const t=Zc(e.toSingleTextEdit(),this.textModel),i=this._computeAugmentation(t,void 0);if(!i)return;const n=i.completion.inlineCompletion;(r=(s=n.source.provider).handlePartialAccept)==null||r.call(s,n.source.inlineCompletions,n.sourceInlineCompletion,t.text.length,{kind:2})}};uC=sj([dy(9,qt),dy(10,ls),dy(11,cs)],uC);var Pa;(function(o){o[o.Undo=0]="Undo",o[o.Redo=1]="Redo",o[o.AcceptWord=2]="AcceptWord",o[o.Other=3]="Other"})(Pa||(Pa={}));function hy(o,e,t){if(e.length===1)return[];const i=e[0],n=e.slice(1),s=t.range.getStartPosition(),r=t.range.getEndPosition(),a=o.getValueInRange(H.fromPositions(i,r)),c=nk(i,s);if(c.lineNumber<1)return on(new Wu(`positionWithinTextEdit line number should be bigger than 0.
|
|
36
|
-
Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const d=oj(t.text,c);return n.map(u=>{const f=P4(nk(u,s),r),m=o.getValueInRange(H.fromPositions(u,f)),v=Pp(a,m),_=H.fromPositions(u,u.delta(0,v));return new Xa(_,d)})}function oj(o,e){let t="";const i=XO(o);for(let n=e.lineNumber-1;n<i.length;n++)t+=i[n].substring(n===e.lineNumber-1?e.column-1:0);return t}function yk(o){const e=ZO.createSortPermutation(o,Dp(s=>s.range,H.compareRangesUsingStarts)),i=new bE(e.apply(o)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}var rj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Sk=function(o,e){return function(t,i){e(t,i,o)}},$g;class w1{constructor(e){this.name=e}select(e,t,i){if(i.length===0)return 0;const n=i[0].score[0];for(let s=0;s<i.length;s++){const{score:r,completion:a}=i[s];if(r[0]!==n)break;if(a.preselect)return s}return 0}}class Ck extends w1{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}class aj extends w1{constructor(){super("recentlyUsed"),this._cache=new Cp(300,.66),this._seq=0}memorize(e,t,i){const n=`${e.getLanguageId()}/${i.textLabel}`;this._cache.set(n,{touch:this._seq++,type:i.completion.kind,insertText:i.completion.insertText})}select(e,t,i){if(i.length===0)return 0;const n=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(n))return super.select(e,t,i);const s=i[0].score[0];let r=-1,a=-1,c=-1;for(let d=0;d<i.length&&i[d].score[0]===s;d++){const u=`${e.getLanguageId()}/${i[d].textLabel}`,f=this._cache.peek(u);if(f&&f.touch>c&&f.type===i[d].completion.kind&&f.insertText===i[d].completion.insertText&&(c=f.touch,a=d),i[d].completion.preselect&&r===-1)return r=d}return a!==-1?a:r!==-1?r:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();const t=0;for(const[i,n]of e)n.touch=t,n.type=typeof n.type=="number"?n.type:S0.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class lj extends w1{constructor(){super("recentlyUsedByPrefix"),this._trie=YO.forStrings(),this._seq=0}memorize(e,t,i){const{word:n}=e.getWordUntilPosition(t),s=`${e.getLanguageId()}/${n}`;this._trie.set(s,{type:i.completion.kind,insertText:i.completion.insertText,touch:this._seq++})}select(e,t,i){const{word:n}=e.getWordUntilPosition(t);if(!n)return super.select(e,t,i);const s=`${e.getLanguageId()}/${n}`;let r=this._trie.get(s);if(r||(r=this._trie.findSubstr(s)),r)for(let a=0;a<i.length;a++){const{kind:c,insertText:d}=i[a].completion;if(c===r.type&&d===r.insertText)return a}return super.select(e,t,i)}toJSON(){const e=[];return this._trie.forEach((t,i)=>e.push([i,t])),e.sort((t,i)=>-(t[1].touch-i[1].touch)).forEach((t,i)=>t[1].touch=i),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(const[t,i]of e)i.type=typeof i.type=="number"?i.type:S0.fromString(i.type),this._trie.set(t,i)}}}var Kl;let gC=(Kl=class{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new Oe,this._persistSoon=new ts(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===u0.SHUTDOWN&&this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,i){this._withStrategy(e,t).memorize(e,t,i),this._persistSoon.schedule()}select(e,t,i){return this._withStrategy(e,t).select(e,t,i)}_withStrategy(e,t){var n;const i=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:e.getLanguageIdAtPosition(t.lineNumber,t.column),resource:e.uri});if(((n=this._strategy)==null?void 0:n.name)!==i){this._saveState();const s=$g._strategyCtors.get(i)||Ck;this._strategy=new s;try{const a=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,c=this._storageService.get(`${$g._storagePrefix}/${i}`,a);c&&this._strategy.fromJSON(JSON.parse(c))}catch{}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${$g._storagePrefix}/${this._strategy.name}`,i,t,1)}}},$g=Kl,Kl._strategyCtors=new Map([["recentlyUsedByPrefix",lj],["recentlyUsed",aj],["first",Ck]]),Kl._storagePrefix="suggest/memories",Kl);gC=$g=rj([Sk(0,hc),Sk(1,pn)],gC);const hw=sl("ISuggestMemories");ol(hw,gC,1);var cj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},dj=function(o,e){return function(t,i){e(t,i,o)}},fC,md;let Q_=(md=class{constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=fC.AtEnd.bindTo(t),this._configListener=this._editor.onDidChangeConfiguration(i=>i.hasChanged(124)&&this._update()),this._update()}dispose(){var e;this._configListener.dispose(),(e=this._selectionListener)==null||e.dispose(),this._ckAtEnd.reset()}_update(){const e=this._editor.getOption(124)==="on";if(this._enabled!==e)if(this._enabled=e,this._enabled){const t=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}const i=this._editor.getModel(),n=this._editor.getSelection(),s=i.getWordAtPosition(n.getStartPosition());if(!s){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(s.endColumn===n.getStartPosition().column)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}},fC=md,md.AtEnd=new yi("atEndOfWord",!1),md);Q_=fC=cj([dj(1,Ri)],Q_);var hj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},uj=function(o,e){return function(t,i){e(t,i,o)}},qg,_d;let ig=(_d=class{constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=qg.OtherSuggestions.bindTo(t)}dispose(){this.reset()}reset(){var e;this._ckOtherSuggestions.reset(),(e=this._listener)==null||e.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:e,index:t},i){if(e.items.length===0){this.reset();return}if(qg._moveIndex(!0,e,t)===t){this.reset();return}this._acceptNext=i,this._model=e,this._index=t,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(e,t,i){let n=i;for(let s=t.items.length;s>0&&(n=(n+t.items.length+(e?1:-1))%t.items.length,!(n===i||!t.items[n].completion.additionalTextEdits));s--);return n}next(){this._move(!0)}prev(){this._move(!1)}_move(e){if(this._model)try{this._ignore=!0,this._index=qg._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}},qg=_d,_d.OtherSuggestions=new yi("hasOtherSuggestions",!1),_d);ig=qg=hj([uj(1,Ri)],ig);class gj{constructor(e,t,i,n){this._disposables=new Oe,this._disposables.add(i.onDidSuggest(s=>{s.completionModel.items.length===0&&this.reset()})),this._disposables.add(i.onDidCancel(s=>{this.reset()})),this._disposables.add(t.onDidShow(()=>this._onItem(t.getFocusedItem()))),this._disposables.add(t.onDidFocus(this._onItem,this)),this._disposables.add(t.onDidHide(this.reset,this)),this._disposables.add(e.onWillType(s=>{if(this._active&&!t.isFrozen()&&i.state!==0){const r=s.charCodeAt(s.length-1);this._active.acceptCharacters.has(r)&&e.getOption(0)&&n(this._active.item)}}))}_onItem(e){if(!e||!bo(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new g_;for(const i of e.item.completion.commitCharacters)i.length>0&&t.add(i.charCodeAt(0));this._active={acceptCharacters:t,item:e}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}const Po=class Po{async provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s);const r=new Map;await new Promise(a=>Po._bracketsRightYield(a,0,e,n,r)),await new Promise(a=>Po._bracketsLeftYield(a,0,e,n,r,s))}return i}static _bracketsRightYield(e,t,i,n,s){const r=new Map,a=Date.now();for(;;){if(t>=Po._maxRounds){e();break}if(!n){e();break}const c=i.bracketPairs.findNextBracket(n);if(!c){e();break}if(Date.now()-a>Po._maxDuration){setTimeout(()=>Po._bracketsRightYield(e,t+1,i,n,s));break}if(c.bracketInfo.isOpeningBracket){const u=c.bracketInfo.bracketText,f=r.has(u)?r.get(u):0;r.set(u,f+1)}else{const u=c.bracketInfo.getOpeningBrackets()[0].bracketText;let f=r.has(u)?r.get(u):0;if(f-=1,r.set(u,Math.max(0,f)),f<0){let m=s.get(u);m||(m=new EE,s.set(u,m)),m.push(c.range)}}n=c.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,n,s,r){const a=new Map,c=Date.now();for(;;){if(t>=Po._maxRounds&&s.size===0){e();break}if(!n){e();break}const d=i.bracketPairs.findPrevBracket(n);if(!d){e();break}if(Date.now()-c>Po._maxDuration){setTimeout(()=>Po._bracketsLeftYield(e,t+1,i,n,s,r));break}if(d.bracketInfo.isOpeningBracket){const f=d.bracketInfo.bracketText;let m=a.has(f)?a.get(f):0;if(m-=1,a.set(f,Math.max(0,m)),m<0){const v=s.get(f);if(v){const _=v.shift();v.size===0&&s.delete(f);const y=H.fromPositions(d.range.getEndPosition(),_.getStartPosition()),S=H.fromPositions(d.range.getStartPosition(),_.getEndPosition());r.push({range:y}),r.push({range:S}),Po._addBracketLeading(i,S,r)}}}else{const f=d.bracketInfo.getOpeningBrackets()[0].bracketText,m=a.has(f)?a.get(f):0;a.set(f,m+1)}n=d.range.getStartPosition()}}static _addBracketLeading(e,t,i){if(t.startLineNumber===t.endLineNumber)return;const n=t.startLineNumber,s=e.getLineFirstNonWhitespaceColumn(n);s!==0&&s!==t.startColumn&&(i.push({range:H.fromPositions(new ut(n,s),t.getEndPosition())}),i.push({range:H.fromPositions(new ut(n,1),t.getEndPosition())}));const r=n-1;if(r>0){const a=e.getLineFirstNonWhitespaceColumn(r);a===t.startColumn&&a!==e.getLineLastNonWhitespaceColumn(r)&&(i.push({range:H.fromPositions(new ut(r,a),t.getEndPosition())}),i.push({range:H.fromPositions(new ut(r,1),t.getEndPosition())}))}}};Po._maxDuration=30,Po._maxRounds=2;let ev=Po;const Zr=class Zr{static async create(e,t){if(!t.getOption(119).localityBonus||!t.hasModel())return Zr.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return Zr.None;const[s]=await new ev().provideSelectionRanges(i,[n]);if(s.length===0)return Zr.None;const r=await e.computeWordRanges(i.uri,s[0].range);if(!r)return Zr.None;const a=i.getWordUntilPosition(n);return delete r[a.word],new class extends Zr{distance(c,d){if(!n.equals(t.getPosition()))return 0;if(d.kind===17)return 2<<20;const u=typeof d.label=="string"?d.label:d.label.label,f=r[u];if(JO(f))return 2<<20;const m=m_(f,H.fromPositions(c),H.compareRangesUsingStarts),v=m>=0?f[m]:f[Math.max(0,~m-1)];let _=s.length;for(const y of s){if(!H.containsRange(y.range,v))break;_-=1}return _}}}};Zr.None=new class extends Zr{distance(){return 0}};let tv=Zr,xk=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class yl{constructor(e,t,i,n,s,r,a=PE.default,c=void 0){this.clipboardText=c,this._snippetCompareFn=yl._compareCompletionItems,this._items=e,this._column=t,this._wordDistance=n,this._options=s,this._refilterKind=1,this._lineContext=i,this._fuzzyScoreOptions=a,r==="top"?this._snippetCompareFn=yl._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=yl._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(e){(this._lineContext.leadingLineContent!==e.leadingLineContent||this._lineContext.characterCountDelta!==e.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta<e.characterCountDelta&&this._filteredItems?2:1,this._lineContext=e)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();const e=new Set;for(const[t,i]of this.getItemsByProvider())i.length>0&&i[0].container.incomplete&&e.add(t);return e}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const e=[],{leadingLineContent:t,characterCountDelta:i}=this._lineContext;let n="",s="";const r=this._refilterKind===1?this._items:this._filteredItems,a=[],c=!this._options.filterGraceful||r.length>2e3?TE:QO;for(let d=0;d<r.length;d++){const u=r[d];if(u.isInvalid)continue;const f=this._itemsByProvider.get(u.provider);f?f.push(u):this._itemsByProvider.set(u.provider,[u]);const m=u.position.column-u.editStart.column,v=m+i-(u.position.column-this._column);if(n.length!==v&&(n=v===0?"":t.slice(-v),s=n.toLowerCase()),u.word=n,v===0)u.score=Pf.Default;else{let _=0;for(;_<m;){const y=n.charCodeAt(_);if(y===32||y===9)_+=1;else break}if(_>=v)u.score=Pf.Default;else if(typeof u.completion.filterText=="string"){const y=c(n,s,_,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!y)continue;e2(u.completion.filterText,u.textLabel)===0?u.score=y:(u.score=t2(n,s,_,u.textLabel,u.labelLow,0),u.score[0]=y[0])}else{const y=c(n,s,_,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!y)continue;u.score=y}}u.idx=d,u.distance=this._wordDistance.distance(u.position,u.completion),a.push(u),e.push(u.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?i2(e.length-.85,e,(d,u)=>d-u):0}}static _compareCompletionItems(e,t){return e.score[0]>t.score[0]?-1:e.score[0]<t.score[0]?1:e.distance<t.distance?-1:e.distance>t.distance?1:e.idx<t.idx?-1:e.idx>t.idx?1:0}static _compareCompletionItemsSnippetsDown(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return 1;if(t.completion.kind===27)return-1}return yl._compareCompletionItems(e,t)}static _compareCompletionItemsSnippetsUp(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return-1;if(t.completion.kind===27)return 1}return yl._compareCompletionItems(e,t)}}var fj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gl=function(o,e){return function(t,i){e(t,i,o)}},pC;class wc{static shouldAutoTrigger(e){if(!e.hasModel())return!1;const t=e.getModel(),i=e.getPosition();t.tokenization.tokenizeIfCheap(i.lineNumber);const n=t.getWordAtPosition(i);return!(!n||n.endColumn!==i.column&&n.startColumn+1!==i.column||!isNaN(Number(n.word)))}constructor(e,t,i){this.leadingLineContent=e.getLineContent(t.lineNumber).substr(0,t.column-1),this.leadingWord=e.getWordUntilPosition(t),this.lineNumber=t.lineNumber,this.column=t.column,this.triggerOptions=i}}function pj(o,e,t){if(!e.getContextKeyValue(so.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(so.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}function mj(o,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(so.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}let iv=pC=class{constructor(e,t,i,n,s,r,a,c,d){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=n,this._logService=s,this._contextKeyService=r,this._configurationService=a,this._languageFeaturesService=c,this._envService=d,this._toDispose=new Oe,this._triggerCharacterListener=new Oe,this._triggerQuickSuggest=new wp,this._triggerState=void 0,this._completionDisposables=new Oe,this._onDidCancel=new ti,this._onDidTrigger=new ti,this._onDidSuggest=new ti,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new Mt(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let u=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{u=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{u=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(f=>{u||this._onCursorChange(f)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!u&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){Ds(this._triggerCharacterListener),Ds([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(92)||!this._editor.hasModel()||!this._editor.getOption(122))return;const e=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const n of i.triggerCharacters||[]){let s=e.get(n);s||(s=new Set,e.set(n,s)),s.add(i)}const t=i=>{var r;if(!mj(this._editor,this._contextKeyService,this._configurationService)||wc.shouldAutoTrigger(this._editor))return;if(!i){const a=this._editor.getPosition();i=this._editor.getModel().getLineContent(a.lineNumber).substr(0,a.column-1)}let n="";s2(i.charCodeAt(i.length-1))?o2(i.charCodeAt(i.length-2))&&(n=i.substr(i.length-2)):n=i.charAt(i.length-1);const s=e.get(n);if(s){const a=new Map;if(this._completionModel)for(const[c,d]of this._completionModel.getItemsByProvider())s.has(c)||a.set(c,d);this.trigger({auto:!0,triggerKind:1,triggerCharacter:n,retrigger:!!this._completionModel,clipboardText:(r=this._completionModel)==null?void 0:r.clipboardText,completionOptions:{providerFilter:s,providerItemsToReuse:a}})}};this._triggerCharacterListener.add(this._editor.onDidType(t)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>t()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(e=!1){var t;this._triggerState!==void 0&&(this._triggerQuickSuggest.cancel(),(t=this._requestToken)==null||t.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:e}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(e){if(!this._editor.hasModel())return;const t=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!e.selection.isEmpty()||e.reason!==0&&e.reason!==3||e.source!=="keyboard"&&e.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&e.reason===0?(t.containsRange(this._currentSelection)||t.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&e.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){var e;Qh.isAllOff(this._editor.getOption(90))||this._editor.getOption(119).snippetsPreventQuickSuggestions&&((e=Ns.get(this._editor))!=null&&e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!wc.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const t=this._editor.getModel(),i=this._editor.getPosition(),n=this._editor.getOption(90);if(!Qh.isAllOff(n)){if(!Qh.isAllOn(n)){t.tokenization.tokenizeIfCheap(i.lineNumber);const s=t.tokenization.getLineTokens(i.lineNumber),r=s.getStandardTokenType(s.findTokenIndexAtOffset(Math.max(i.column-1-1,0)));if(Qh.valueFor(n,r)!=="on")return}pj(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}},this._editor.getOption(91)))}_refilterCompletionItems(){Oi(this._editor.hasModel()),Oi(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new wc(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){var m,v,_;if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=new wc(t,this._editor.getPosition(),e);this.cancel(e.retrigger),this._triggerState=e,this._onDidTrigger.fire({auto:e.auto,shy:e.shy??!1,position:this._editor.getPosition()}),this._context=i;let n={triggerKind:e.triggerKind??0};e.triggerCharacter&&(n={triggerKind:1,triggerCharacter:e.triggerCharacter}),this._requestToken=new gs;const s=this._editor.getOption(113);let r=1;switch(s){case"top":r=0;break;case"bottom":r=2;break}const{itemKind:a,showDeprecated:c}=pC.createSuggestFilter(this._editor),d=new Gf(r,((m=e.completionOptions)==null?void 0:m.kindFilter)??a,(v=e.completionOptions)==null?void 0:v.providerFilter,(_=e.completionOptions)==null?void 0:_.providerItemsToReuse,c),u=tv.create(this._editorWorkerService,this._editor),f=v1(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),d,n,this._requestToken.token);Promise.all([f,u]).then(async([y,S])=>{var F;if((F=this._requestToken)==null||F.dispose(),!this._editor.hasModel())return;let D=e==null?void 0:e.clipboardText;if(!D&&y.needsClipboard&&(D=await this._clipboardService.readText()),this._triggerState===void 0)return;const E=this._editor.getModel(),N=new wc(E,this._editor.getPosition(),e),B={...PE.default,firstMatchCanBeWeak:!this._editor.getOption(119).matchOnWordStartOnly};if(this._completionModel=new yl(y.items,this._context.column,{leadingLineContent:N.leadingLineContent,characterCountDelta:N.column-this._context.column},S,this._editor.getOption(119),this._editor.getOption(113),B,D),this._completionDisposables.add(y.disposable),this._onNewContext(N),this._reportDurationsTelemetry(y.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const Q of y.items)Q.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${Q.provider._debugDisplayName}`,Q.completion)}).catch(on)}_reportDurationsTelemetry(e){this._telemetryGate++%230===0&&setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(e)}),this._logService.debug("suggest.durations.json",e)})}static createSuggestFilter(e){const t=new Set;e.getOption(113)==="none"&&t.add(27);const n=e.getOption(119);return n.showMethods||t.add(0),n.showFunctions||t.add(1),n.showConstructors||t.add(2),n.showFields||t.add(3),n.showVariables||t.add(4),n.showClasses||t.add(5),n.showStructs||t.add(6),n.showInterfaces||t.add(7),n.showModules||t.add(8),n.showProperties||t.add(9),n.showEvents||t.add(10),n.showOperators||t.add(11),n.showUnits||t.add(12),n.showValues||t.add(13),n.showConstants||t.add(14),n.showEnums||t.add(15),n.showEnumMembers||t.add(16),n.showKeywords||t.add(17),n.showWords||t.add(18),n.showColors||t.add(19),n.showFiles||t.add(20),n.showReferences||t.add(21),n.showColors||t.add(22),n.showFolders||t.add(23),n.showTypeParameters||t.add(24),n.showSnippets||t.add(27),n.showUsers||t.add(25),n.showIssues||t.add(26),{itemKind:t,showDeprecated:n.showDeprecated}}_onNewContext(e){if(this._context){if(e.lineNumber!==this._context.lineNumber){this.cancel();return}if(vs(e.leadingLineContent)!==vs(this._context.leadingLineContent)){this.cancel();return}if(e.column<this._context.column){e.leadingWord.word?this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0}):this.cancel();return}if(this._completionModel){if(e.leadingWord.word.length!==0&&e.leadingWord.startColumn>this._context.leadingWord.startColumn){if(wc.shouldAutoTrigger(this._editor)&&this._context){const i=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:i}})}return}if(e.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&e.leadingWord.word.length!==0){const t=new Map,i=new Set;for(const[n,s]of this._completionModel.getItemsByProvider())s.length>0&&s[0].container.incomplete?i.add(n):t.set(n,s);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:i,providerItemsToReuse:t}})}else{const t=this._completionModel.lineContext;let i=!1;if(this._completionModel.lineContext={leadingLineContent:e.leadingLineContent,characterCountDelta:e.column-this._context.column},this._completionModel.items.length===0){const n=wc.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(n&&this._context.leadingWord.endColumn<e.leadingWord.startColumn){this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});return}if(this._context.triggerOptions.auto){this.cancel();return}else if(this._completionModel.lineContext=t,i=this._completionModel.items.length>0,i&&e.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:e.triggerOptions,isFrozen:i})}}}}};iv=pC=fj([gl(1,rl),gl(2,cg),gl(3,Nr),gl(4,oh),gl(5,Ri),gl(6,pn),gl(7,gt),gl(8,n2)],iv);const Kv=class Kv{constructor(e,t){this._disposables=new Oe,this._lastOvertyped=[],this._locked=!1,this._disposables.add(e.onWillType(()=>{if(this._locked||!e.hasModel())return;const i=e.getSelections(),n=i.length;let s=!1;for(let a=0;a<n;a++)if(!i[a].isEmpty()){s=!0;break}if(!s){this._lastOvertyped.length!==0&&(this._lastOvertyped.length=0);return}this._lastOvertyped=[];const r=e.getModel();for(let a=0;a<n;a++){const c=i[a];if(r.getValueLengthInRange(c)>Kv._maxSelectionLength)return;this._lastOvertyped[a]={value:r.getValueInRange(c),multiline:c.startLineNumber!==c.endLineNumber}}})),this._disposables.add(t.onDidTrigger(i=>{this._locked=!0})),this._disposables.add(t.onDidCancel(i=>{this._locked=!1}))}getLastOvertypedInfo(e){if(e>=0&&e<this._lastOvertyped.length)return this._lastOvertyped[e]}dispose(){this._disposables.dispose()}};Kv._maxSelectionLength=51200;let mC=Kv;var _j=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},uy=function(o,e){return function(t,i){e(t,i,o)}};let _C=class{constructor(e,t,i,n,s){this._menuId=t,this._menuService=n,this._contextKeyService=s,this._menuDisposables=new Oe,this.element=Qe(e,rt(".suggest-status-bar"));const r=(a=>a instanceof Hu?i.createInstance(r2,a,{useComma:!0}):void 0);this._leftActions=new xf(this.element,{actionViewItemProvider:r}),this._rightActions=new xf(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const e=this._menuService.createMenu(this._menuId,this._contextKeyService),t=()=>{const i=[],n=[];for(const[s,r]of e.getActions())s==="left"?i.push(...r):n.push(...r);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(n)};this._menuDisposables.add(e.onDidChange(()=>t())),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};_C=_j([uy(2,qt),uy(3,nh),uy(4,Ri)],_C);var vj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bj=function(o,e){return function(t,i){e(t,i,o)}};function y1(o){return!!o&&!!(o.completion.documentation||o.completion.detail&&o.completion.detail!==o.completion.label)}let vC=class{constructor(e,t){this._editor=e,this._onDidClose=new ti,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new ti,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Oe,this._renderDisposeable=new Oe,this._borderWidth=1,this._size=new an(330,0),this.domNode=rt(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(ug,{editor:e}),this._body=rt(".body"),this._scrollbar=new ME(this._body,{alwaysConsumeMouseWheel:!0}),Qe(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Qe(this._body,rt(".header")),this._close=Qe(this._header,rt("span"+Wi.asCSSSelector(Ot.close))),this._close.title=w("details.close","Close"),this._type=Qe(this._header,rt("p.type")),this._docs=Qe(this._body,rt("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(50)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const e=this._editor.getOptions(),t=e.get(50),i=t.getMassagedFontFamily(),n=e.get(120)||t.fontSize,s=e.get(121)||t.lineHeight,r=t.fontWeight,a=`${n}px`,c=`${s}px`;this.domNode.style.fontSize=a,this.domNode.style.lineHeight=`${s/n}`,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=t.fontFeatureSettings,this._type.style.fontFamily=i,this._close.style.height=c,this._close.style.width=c}getLayoutInfo(){const e=this._editor.getOption(121)||this._editor.getOption(50).lineHeight,t=this._borderWidth,i=t*2;return{lineHeight:e,borderWidth:t,borderHeight:i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=w("loading","Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(e,t){var s;this._renderDisposeable.clear();let{detail:i,documentation:n}=e.completion;if(t){let r="";r+=`score: ${e.score[0]}
|
|
37
|
-
`,r+=`prefix: ${e.word??"(no prefix)"}
|
|
38
|
-
`,r+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel}
|
|
39
|
-
`,r+=`distance: ${e.distance} (localityBonus-setting)
|
|
40
|
-
`,r+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}
|
|
41
|
-
`,r+=`commit_chars: ${(s=e.completion.commitCharacters)==null?void 0:s.join("")}
|
|
42
|
-
`,n=new Is().appendCodeblock("empty",r),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!y1(e)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),i){const r=i.length>1e5?`${i.substr(0,1e5)}…`:i;this._type.textContent=r,this._type.title=r,Qo(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(r))}else la(this._type),this._type.title="",mo(this._type),this.domNode.classList.add("no-type");if(la(this._docs),typeof n=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=n;else if(n){this._docs.classList.add("markdown-docs"),la(this._docs);const r=this._markdownRenderer.render(n);this._docs.appendChild(r.element),this._renderDisposeable.add(r),this._renderDisposeable.add(this._markdownRenderer.onDidRenderAsync(()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}))}this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=r=>{r.preventDefault(),r.stopPropagation()},this._close.onclick=r=>{r.preventDefault(),r.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(e,t){const i=new an(e,t);an.equals(i,this._size)||(this._size=i,a2(this.domNode,e,t)),this._scrollbar.scanDomNode()}scrollDown(e=8){this._body.scrollTop+=e}scrollUp(e=8){this._body.scrollTop-=e}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(e){this._borderWidth=e}get borderWidth(){return this._borderWidth}};vC=vj([bj(1,qt)],vC);class wj{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new Oe,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new e1,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let i,n,s=0,r=0;this._disposables.add(this._resizable.onDidWillResize(()=>{i=this._topLeft,n=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(a=>{if(i&&n){this.widget.layout(a.dimension.width,a.dimension.height);let c=!1;a.west&&(r=n.width-a.dimension.width,c=!0),a.north&&(s=n.height-a.dimension.height,c=!0),c&&this._applyTopLeft({top:i.top+s,left:i.left+r})}a.done&&(i=void 0,n=void 0,s=0,r=0,this._userSize=a.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,this._preferAlignAtTop)}))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(e=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),e&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(e,t){const i=e.getBoundingClientRect();this._anchorBox=i,this._preferAlignAtTop=t,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,t)}_placeAtAnchor(e,t,i){const n=Ip(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),r=new an(220,2*s.lineHeight),a=e.top,c=(function(){const F=n.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),Q=-s.borderWidth+e.left+e.width,$=new an(F,n.height-e.top-s.borderHeight-s.verticalPadding),fe=$.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:Q,fit:F-t.width,maxSizeTop:$,maxSizeBottom:fe,minSize:r.with(Math.min(F,r.width))}})(),d=(function(){const F=e.left-s.borderWidth-s.horizontalPadding,Q=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),$=new an(F,n.height-e.top-s.borderHeight-s.verticalPadding),fe=$.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:Q,fit:F-t.width,maxSizeTop:$,maxSizeBottom:fe,minSize:r.with(Math.min(F,r.width))}})(),u=(function(){const F=e.left,Q=-s.borderWidth+e.top+e.height,$=new an(e.width-s.borderHeight,n.height-e.top-e.height-s.verticalPadding);return{top:Q,left:F,fit:$.height-t.height,maxSizeBottom:$,maxSizeTop:$,minSize:r.with($.width)}})(),f=[c,d,u],m=f.find(F=>F.fit>=0)??f.sort((F,Q)=>Q.fit-F.fit)[0],v=e.top+e.height-s.borderHeight;let _,y=t.height;const S=Math.max(m.maxSizeTop.height,m.maxSizeBottom.height);y>S&&(y=S);let D;i?y<=m.maxSizeTop.height?(_=!0,D=m.maxSizeTop):(_=!1,D=m.maxSizeBottom):y<=m.maxSizeBottom.height?(_=!1,D=m.maxSizeBottom):(_=!0,D=m.maxSizeTop);let{top:E,left:N}=m;!_&&y>e.height&&(E=v-y);const B=this._editor.getDomNode();if(B){const F=B.getBoundingClientRect();E-=F.top,N-=F.left}this._applyTopLeft({left:N,top:E}),this._resizable.enableSashes(!_,m===c,_,m!==c),this._resizable.minSize=m.minSize,this._resizable.maxSize=D,this._resizable.layout(y,Math.min(D.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}}var ra;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(ra||(ra={}));const yj=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function Lm(o,e,t,i,n){if(Wi.isThemeIcon(n))return[`codicon-${n.id}`,"predefined-file-icon"];if(nn.isUri(n))return[];const s=i===ra.ROOT_FOLDER?["rootfolder-icon"]:i===ra.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===Fs.data)r=__.parseMetaData(t).get(__.META_DATA_LABEL);else{const a=t.path.match(yj);a?(r=Im(a[2].toLowerCase()),a[1]&&s.push(`${Im(a[1].toLowerCase())}-name-dir-icon`)):r=Im(t.authority.toLowerCase())}if(i===ra.ROOT_FOLDER)s.push(`${r}-root-name-folder-icon`);else if(i===ra.FOLDER)s.push(`${r}-name-folder-icon`);else{if(r){if(s.push(`${r}-name-file-icon`),s.push("name-file-icon"),r.length<=255){const c=r.split(".");for(let d=1;d<c.length;d++)s.push(`${c.slice(d).join(".")}-ext-file-icon`)}s.push("ext-file-icon")}const a=Sj(o,e,t);a&&s.push(`${Im(a)}-lang-file-icon`)}}return s}function Sj(o,e,t){if(!t)return null;let i=null;if(t.scheme===Fs.data){const s=__.parseMetaData(t).get(__.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==Tf?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function Im(o){return o.replace(/[\s]/g,"/")}var Cj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gy=function(o,e){return function(t,i){e(t,i,o)}};function eN(o){return`suggest-aria-id:${o}`}const xj=Wn("suggest-more-info",Ot.chevronRight,w("suggestMoreInfoIcon","Icon for more information in the suggest widget."));var Cr;const Lj=new(Cr=class{extract(e,t){if(e.textLabel.match(Cr._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(Cr._regexStrict))return t[0]=e.completion.detail,!0;if(e.completion.documentation){const i=typeof e.completion.documentation=="string"?e.completion.documentation:e.completion.documentation.value,n=Cr._regexRelaxed.exec(i);if(n&&(n.index===0||n.index+n[0].length===i.length))return t[0]=n[0],!0}return!1}},Cr._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,Cr._regexStrict=new RegExp(`^${Cr._regexRelaxed.source}$`,"i"),Cr);let bC=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new ti,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new Oe,i=e;i.classList.add("show-file-icons");const n=Qe(e,rt(".icon")),s=Qe(n,rt("span.colorspan")),r=Qe(e,rt(".contents")),a=Qe(r,rt(".main")),c=Qe(a,rt(".icon-label.codicon")),d=Qe(a,rt("span.left")),u=Qe(a,rt("span.right")),f=new YD(d,{supportHighlights:!0,supportIcons:!0});t.add(f);const m=Qe(d,rt("span.signature-label")),v=Qe(d,rt("span.qualifier-label")),_=Qe(u,rt("span.details-label")),y=Qe(u,rt("span.readMore"+Wi.asCSSSelector(xj)));return y.title=w("readMore","Read More"),{root:i,left:d,right:u,icon:n,colorspan:s,iconLabel:f,iconContainer:c,parametersLabel:m,qualifierLabel:v,detailsLabel:_,readMore:y,disposables:t,configureFont:()=>{const D=this._editor.getOptions(),E=D.get(50),N=E.getMassagedFontFamily(),B=E.fontFeatureSettings,F=D.get(120)||E.fontSize,Q=D.get(121)||E.lineHeight,$=E.fontWeight,fe=E.letterSpacing,Pe=`${F}px`,ze=`${Q}px`,me=`${fe}px`;i.style.fontSize=Pe,i.style.fontWeight=$,i.style.letterSpacing=me,a.style.fontFamily=N,a.style.fontFeatureSettings=B,a.style.lineHeight=ze,n.style.height=ze,n.style.width=ze,y.style.height=ze,y.style.width=ze}}}renderElement(e,t,i){i.configureFont();const{completion:n}=e;i.root.id=eN(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:Rb(e.score)},r=[];if(n.kind===19&&Lj.extract(e,r))i.icon.className="icon customcolor",i.iconContainer.className="icon hide",i.colorspan.style.backgroundColor=r[0];else if(n.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){i.icon.className="icon hide",i.iconContainer.className="icon hide";const a=Lm(this._modelService,this._languageService,nn.from({scheme:"fake",path:e.textLabel}),ra.FILE),c=Lm(this._modelService,this._languageService,nn.from({scheme:"fake",path:n.detail}),ra.FILE);s.extraClasses=a.length>c.length?a:c}else n.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",s.extraClasses=[Lm(this._modelService,this._languageService,nn.from({scheme:"fake",path:e.textLabel}),ra.FOLDER),Lm(this._modelService,this._languageService,nn.from({scheme:"fake",path:n.detail}),ra.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Wi.asClassNameArray(S0.toIcon(n.kind))));n.tags&&n.tags.indexOf(1)>=0&&(s.extraClasses=(s.extraClasses||[]).concat(["deprecated"]),s.matches=[]),i.iconLabel.setLabel(e.textLabel,void 0,s),typeof n.label=="string"?(i.parametersLabel.textContent="",i.detailsLabel.textContent=fy(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=fy(n.label.detail||""),i.detailsLabel.textContent=fy(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(119).showInlineDetails?Qo(i.detailsLabel):mo(i.detailsLabel),y1(e)?(i.right.classList.add("can-expand-details"),Qo(i.readMore),i.readMore.onmousedown=a=>{a.stopPropagation(),a.preventDefault()},i.readMore.onclick=a=>{a.stopPropagation(),a.preventDefault(),this._onDidToggleDetails.fire()}):(i.right.classList.remove("can-expand-details"),mo(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};bC=Cj([gy(1,As),gy(2,Rr),gy(3,lr)],bC);function fy(o){return o.replace(/\r\n|\r|\n/g,"")}var Ij=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},km=function(o,e){return function(t,i){e(t,i,o)}},jh;at("editorSuggestWidget.background",NE,w("editorSuggestWidgetBackground","Background color of the suggest widget."));at("editorSuggestWidget.border",l2,w("editorSuggestWidgetBorder","Border color of the suggest widget."));const kj=at("editorSuggestWidget.foreground",Ep,w("editorSuggestWidgetForeground","Foreground color of the suggest widget."));at("editorSuggestWidget.selectedForeground",RE,w("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));at("editorSuggestWidget.selectedIconForeground",c2,w("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const Dj=at("editorSuggestWidget.selectedBackground",AE,w("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));at("editorSuggestWidget.highlightForeground",OE,w("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));at("editorSuggestWidget.focusHighlightForeground",d2,w("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));at("editorSuggestWidgetStatus.foreground",ca(kj,.5),w("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class Ej{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof ar}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if(an.is(t))return an.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}var Gl;let wC=(Gl=class{constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new So,this._pendingShowDetails=new So,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new wp,this._disposables=new Oe,this._onDidSelect=new HL,this._onDidFocus=new HL,this._onDidHide=new ti,this._onDidShow=new ti,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new ti,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new e1,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Pj(this,e),this._persistedSize=new Ej(t,e);class r{constructor(v,_,y=!1,S=!1){this.persistedSize=v,this.currentSize=_,this.persistHeight=y,this.persistWidth=S}}let a;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),a=new r(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(m=>{var v,_;if(this._resize(m.dimension.width,m.dimension.height),a&&(a.persistHeight=a.persistHeight||!!m.north||!!m.south,a.persistWidth=a.persistWidth||!!m.east||!!m.west),!!m.done){if(a){const{itemHeight:y,defaultSize:S}=this.getLayoutInfo(),D=Math.round(y/2);let{width:E,height:N}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-N)<=D)&&(N=((v=a.persistedSize)==null?void 0:v.height)??S.height),(!a.persistWidth||Math.abs(a.currentSize.width-E)<=D)&&(E=((_=a.persistedSize)==null?void 0:_.width)??S.width),this._persistedSize.store(new an(E,N))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=Qe(this.element.domNode,rt(".message")),this._listElement=Qe(this.element.domNode,rt(".tree"));const c=this._disposables.add(s.createInstance(vC,this.editor));c.onDidClose(this.toggleDetails,this,this._disposables),this._details=new wj(c,this.editor);const d=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(119).showIcons);d();const u=s.createInstance(bC,this.editor);this._disposables.add(u),this._disposables.add(u.onDidToggleDetails(()=>this.toggleDetails())),this._list=new c0("SuggestWidget",this._listElement,{getHeight:m=>this.getLayoutInfo().itemHeight,getTemplateId:m=>"suggestion"},[u],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>w("suggest","Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:m=>{let v=m.textLabel;if(typeof m.completion.label!="string"){const{detail:D,description:E}=m.completion.label;D&&E?v=w("label.full","{0} {1}, {2}",v,D,E):D?v=w("label.detail","{0} {1}",v,D):E&&(v=w("label.desc","{0}, {1}",v,E))}if(!m.isResolved||!this._isDetailsVisible())return v;const{documentation:_,detail:y}=m.completion,S=w0("{0}{1}",y||"",_?typeof _=="string"?_:_.value:"");return w("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",v,S)}}}),this._list.style(FE({listInactiveFocusBackground:Dj,listInactiveFocusOutline:Hd})),this._status=s.createInstance(_C,this.element.domNode,Hl);const f=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(119).showStatusBar);f(),this._disposables.add(n.onDidColorThemeChange(m=>this._onThemeChange(m))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown(m=>this._onListMouseDownOrTap(m))),this._disposables.add(this._list.onTap(m=>this._onListMouseDownOrTap(m))),this._disposables.add(this._list.onDidChangeSelection(m=>this._onListSelection(m))),this._disposables.add(this._list.onDidChangeFocus(m=>this._onListFocus(m))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(m=>{m.hasChanged(119)&&(f(),d()),this._completionModel&&(m.hasChanged(50)||m.hasChanged(120)||m.hasChanged(121))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=Rt.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Rt.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Rt.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=Rt.HasFocusedSuggestion.bindTo(i),this._disposables.add(Za(this._details.widget.domNode,"keydown",m=>{this._onDetailsKeydown.fire(m)})),this._disposables.add(this.editor.onMouseDown(m=>this._onEditorMouseDown(m)))}dispose(){var e;this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),(e=this._loadingTimeout)==null||e.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onThemeChange(e){this._details.widget.borderWidth=Lf(e.type)?2:1}_onListFocus(e){var n;if(this._ignoreFocusEvents)return;if(!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const t=e.elements[0],i=e.indexes[0];t!==this._focusedItem&&((n=this._currentSuggestionDetails)==null||n.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=t,this._list.reveal(i),this._currentSuggestionDetails=us(async s=>{const r=Cf(()=>{this._isDetailsVisible()&&this.showDetails(!0)},250),a=s.onCancellationRequested(()=>r.dispose());try{return await t.resolve(s)}finally{r.dispose(),a.dispose()}}),this._currentSuggestionDetails.then(()=>{i>=this._list.length||t!==this._list.element(i)||(this._ignoreFocusEvents=!0,this._list.splice(i,1,[t]),this._list.setFocus([i]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:eN(i)}))}).catch(on)),this._onDidFocus.fire({item:t,index:i,model:this._completionModel})}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:mo(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=jh.LOADING_MESSAGE,mo(this._listElement,this._status.element),Qo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Ru(jh.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=jh.NO_SUGGESTIONS_MESSAGE,mo(this._listElement,this._status.element),Qo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Ru(jh.NO_SUGGESTIONS_MESSAGE);break;case 3:mo(this._messageElement),Qo(this._listElement,this._status.element),this._show();break;case 4:mo(this._messageElement),Qo(this._listElement,this._status.element),this._show();break;case 5:mo(this._messageElement),Qo(this._listElement,this._status.element),this._details.show(),this._show();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(e,t){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!e,this._isAuto||(this._loadingTimeout=Cf(()=>this._setState(1),t)))}showSuggestions(e,t,i,n,s){var c,d;if(this._contentWidget.setPosition(this.editor.getPosition()),(c=this._loadingTimeout)==null||c.dispose(),(d=this._currentSuggestionDetails)==null||d.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),i&&this._state!==2&&this._state!==0){this._setState(4);return}const r=this._completionModel.items.length,a=r===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(r>1),a){this._setState(n?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(i?4:3),this._list.reveal(t,0),this._list.setFocus(s?[]:[t])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=WL(zc(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._setState(3),this._details.widget.domNode.classList.remove("focused")):this._state===3&&this._isDetailsVisible()&&(this._setState(5),this._details.widget.domNode.classList.add("focused"))}toggleDetails(){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(y1(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this.showDetails(!1))}showDetails(e){this._pendingShowDetails.value=WL(zc(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show(),e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details")),this.editor.focus()})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this.showDetails(!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){var i;this._pendingLayout.clear(),this._pendingShowDetails.clear(),(i=this._loadingTimeout)==null||i.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const e=this._persistedSize.restore(),t=Math.ceil(this.getLayoutInfo().itemHeight*4.3);e&&e.height<t&&this._persistedSize.store(e.with(void 0,t))}isFrozen(){return this._state===4}_afterRender(e){if(e===null){this._isDetailsVisible()&&this._details.hide();return}this._state===2||this._state===1||(this._isDetailsVisible()&&!this._details.widget.isEmpty&&this._details.show(),this._positionDetails())}_layout(e){var r,a;if(!this.editor.hasModel()||!this.editor.getDomNode())return;const t=Ip(this.element.domNode.ownerDocument.body),i=this.getLayoutInfo();e||(e=i.defaultSize);let n=e.height,s=e.width;if(this._status.element.style.height=`${i.itemHeight}px`,this._state===2||this._state===1)n=i.itemHeight+i.borderHeight,s=i.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new an(s,n),this._contentWidget.setPreference(2);else{const c=t.width-i.borderHeight-2*i.horizontalPadding;s>c&&(s=c);const d=this._completionModel?this._completionModel.stats.pLabelLen*i.typicalHalfwidthCharacterWidth:s,u=i.statusBarHeight+this._list.contentHeight+i.borderHeight,f=i.itemHeight+i.statusBarHeight,m=Ws(this.editor.getDomNode()),v=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),_=m.top+v.top+v.height,y=Math.min(t.height-_-i.verticalPadding,u),S=m.top+v.top-i.verticalPadding,D=Math.min(S,u);let E=Math.min(Math.max(D,y)+i.borderHeight,u);n===((r=this._cappedHeight)==null?void 0:r.capped)&&(n=this._cappedHeight.wanted),n<f&&(n=f),n>E&&(n=E),n>y||this._forceRenderingAbove&&S>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),E=D):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),E=y),this.element.preferredSize=new an(d,i.defaultSize.height),this.element.maxSize=new an(c,E),this.element.minSize=new an(220,f),this._cappedHeight=n===u?{wanted:((a=this._cappedHeight)==null?void 0:a.wanted)??e.height,capped:n}:void 0}this._resize(s,n)}_resize(e,t){const{width:i,height:n}=this.element.maxSize;e=Math.min(i,e),t=Math.min(n,t);const{statusBarHeight:s}=this.getLayoutInfo();this._list.layout(t-s,e),this._listElement.style.height=`${t-s}px`,this.element.layout(t,e),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){var e;this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,((e=this._contentWidget.getPosition())==null?void 0:e.preference[0])===2)}getLayoutInfo(){const e=this.editor.getOption(50),t=h2(this.editor.getOption(121)||e.lineHeight,8,1e3),i=!this.editor.getOption(119).showStatusBar||this._state===2||this._state===1?0:t,n=this._details.widget.borderWidth,s=2*n;return{itemHeight:t,statusBarHeight:i,borderWidth:n,borderHeight:s,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new an(430,i+12*t+s)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}},jh=Gl,Gl.LOADING_MESSAGE=w("suggestWidget.loading","Loading..."),Gl.NO_SUGGESTIONS_MESSAGE=w("suggestWidget.noSuggestions","No suggestions."),Gl);wC=jh=Ij([km(1,hc),km(2,Ri),km(3,lr),km(4,qt)],wC);class Pj{constructor(e,t){this._widget=e,this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){const{height:e,width:t}=this._widget.element.size,{borderWidth:i,horizontalPadding:n}=this._widget.getLayoutInfo();return new an(t+2*i+n,e+2*i)}afterRender(e){this._widget._afterRender(e)}setPreference(e){this._preferenceLocked||(this._preference=e)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(e){this._position=e}}var Tj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Th=function(o,e){return function(t,i){e(t,i,o)}},yC;class Mj{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=pi.register({description:"suggest-line-suffix",stickiness:1}),e.getLineMaxColumn(t.lineNumber)!==t.column){const n=e.getOffsetAt(t),s=e.getPositionAt(n+1);e.changeDecorations(r=>{this._marker&&r.removeDecoration(this._marker),this._marker=r.addDecoration(H.fromPositions(t,s),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(e=>{e.removeDecoration(this._marker),this._marker=void 0})}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}}var vd;let tr=(vd=class{static get(e){return e.getContribution(yC.ID)}constructor(e,t,i,n,s,r,a){this._memoryService=t,this._commandService=i,this._contextKeyService=n,this._instantiationService=s,this._logService=r,this._telemetryService=a,this._lineSuffix=new So,this._toDispose=new Oe,this._selectors=new Nj(f=>f.priority),this._onWillInsertSuggestItem=new ti,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(iv,this.editor),this._selectors.register({priority:0,select:(f,m,v)=>this._memoryService.select(f,m,v)});const c=Rt.InsertMode.bindTo(n);c.set(e.getOption(119).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>c.set(e.getOption(119).insertMode))),this.widget=this._toDispose.add(new Ow(zc(e.getDomNode()),()=>{const f=this._instantiationService.createInstance(wC,this.editor);this._toDispose.add(f),this._toDispose.add(f.onDidSelect(S=>this._insertSuggestion(S,0),this));const m=new gj(this.editor,f,this.model,S=>this._insertSuggestion(S,2));this._toDispose.add(m);const v=Rt.MakesTextEdit.bindTo(this._contextKeyService),_=Rt.HasInsertAndReplaceRange.bindTo(this._contextKeyService),y=Rt.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(gn(()=>{v.reset(),_.reset(),y.reset()})),this._toDispose.add(f.onDidFocus(({item:S})=>{const D=this.editor.getPosition(),E=S.editStart.column,N=D.column;let B=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!S.completion.additionalTextEdits&&!(S.completion.insertTextRules&4)&&N-E===S.completion.insertText.length&&(B=this.editor.getModel().getValueInRange({startLineNumber:D.lineNumber,startColumn:E,endLineNumber:D.lineNumber,endColumn:N})!==S.completion.insertText),v.set(B),_.set(!ut.equals(S.editInsertEnd,S.editReplaceEnd)),y.set(!!S.provider.resolveCompletionItem||!!S.completion.documentation||S.completion.detail!==S.completion.label)})),this._toDispose.add(f.onDetailsKeyDown(S=>{if(S.toKeyCodeChord().equals(new BL(!0,!1,!1,!1,33))||ga&&S.toKeyCodeChord().equals(new BL(!1,!1,!1,!0,33))){S.stopPropagation();return}S.toKeyCodeChord().isModifierKey()||this.editor.focus()})),f})),this._overtypingCapturer=this._toDispose.add(new Ow(zc(e.getDomNode()),()=>this._toDispose.add(new mC(this.editor,this.model)))),this._alternatives=this._toDispose.add(new Ow(zc(e.getDomNode()),()=>this._toDispose.add(new ig(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(Q_,e)),this._toDispose.add(this.model.onDidTrigger(f=>{this.widget.value.showTriggered(f.auto,f.shy?250:50),this._lineSuffix.value=new Mj(this.editor.getModel(),f.position)})),this._toDispose.add(this.model.onDidSuggest(f=>{if(f.triggerOptions.shy)return;let m=-1;for(const _ of this._selectors.itemsOrderedByPriorityDesc)if(m=_.select(this.editor.getModel(),this.editor.getPosition(),f.completionModel.items),m!==-1)break;if(m===-1&&(m=0),this.model.state===0)return;let v=!1;if(f.triggerOptions.auto){const _=this.editor.getOption(119);_.selectionMode==="never"||_.selectionMode==="always"?v=_.selectionMode==="never":_.selectionMode==="whenTriggerCharacter"?v=f.triggerOptions.triggerKind!==1:_.selectionMode==="whenQuickSuggestion"&&(v=f.triggerOptions.triggerKind===1&&!f.triggerOptions.refilter)}this.widget.value.showSuggestions(f.completionModel,m,f.isFrozen,f.triggerOptions.auto,v)})),this._toDispose.add(this.model.onDidCancel(f=>{f.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const d=Rt.AcceptSuggestionsOnEnter.bindTo(n),u=()=>{const f=this.editor.getOption(1);d.set(f==="on"||f==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>u())),u()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(e,t){if(!e||!e.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;const i=Ns.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const n=this.editor.getModel(),s=n.getAlternativeVersionId(),{item:r}=e,a=[],c=new gs;t&1||this.editor.pushUndoStop();const d=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const u=r.isResolved;let f=-1,m=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const _=Au.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(y=>{let S=H.lift(y.range);if(S.startLineNumber===r.position.lineNumber&&S.startColumn>r.position.column){const D=this.editor.getPosition().column-r.position.column,E=D,N=H.spansMultipleLines(S)?0:D;S=new H(S.startLineNumber,S.startColumn+E,S.endLineNumber,S.endColumn+N)}return En.replaceMove(S,y.text)})),_.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!u){const _=new oo;let y;const S=n.onDidChangeContent(B=>{if(B.isFlush){c.cancel(),S.dispose();return}for(const F of B.changes){const Q=H.getEndPosition(F.range);(!y||ut.isBefore(Q,y))&&(y=Q)}}),D=t;t|=2;let E=!1;const N=this.editor.onWillType(()=>{N.dispose(),E=!0,D&2||this.editor.pushUndoStop()});a.push(r.resolve(c.token).then(()=>{if(!r.completion.additionalTextEdits||c.token.isCancellationRequested)return;if(y&&r.completion.additionalTextEdits.some(F=>ut.isBefore(y,H.getStartPosition(F.range))))return!1;E&&this.editor.pushUndoStop();const B=Au.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(F=>En.replaceMove(H.lift(F.range),F.text))),B.restoreRelativeVerticalPositionOfCursor(this.editor),(E||!(D&2))&&this.editor.pushUndoStop(),!0}).then(B=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",_.elapsed(),B),m=B===!0?1:B===!1?0:-2}).finally(()=>{S.dispose(),N.dispose()}))}let{insertText:v}=r.completion;if(r.completion.insertTextRules&4||(v=$d.escape(v)),this.model.cancel(),i.insert(v,{overwriteBefore:d.overwriteBefore,overwriteAfter:d.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(r.completion.insertTextRules&1),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),t&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===nv.id)this.model.trigger({auto:!0,retrigger:!0});else{const _=new oo;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(y=>{r.completion.extensionId?jn(y):on(y)}).finally(()=>{f=_.elapsed()}))}t&4&&this._alternatives.value.set(e,_=>{for(c.cancel();n.canUndo();){s!==n.getAlternativeVersionId()&&n.undo(),this._insertSuggestion(_,3|(t&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,n,u,f,m,e.index,e.model.items),this.model.clear(),c.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,n,s,r,a){var m;if(Math.floor(Math.random()*100)===0)return;const c=new Map;for(let v=0;v<Math.min(30,a.length);v++){const _=a[v].textLabel;c.has(_)?c.get(_).push(v):c.set(_,[v])}const d=c.get(e.textLabel),f=d&&d.length>1?d[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:((m=e.extensionId)==null?void 0:m.value)??"unknown",providerId:e.provider._debugDisplayName??"unknown",kind:e.completion.kind,basenameHash:gE(fa(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:u2(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s,index:r,firstIndex:f})}getOverwriteInfo(e,t){Oi(this.editor.hasModel());let i=this.editor.getOption(119).insertMode==="replace";t&&(i=!i);const n=e.position.column-e.editStart.column,s=(i?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column,r=this.editor.getPosition().column-e.position.column,a=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:n+r,overwriteAfter:s+a}}_alertCompletionItem(e){if(bo(e.completion.additionalTextEdits)){const t=w("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);or(t)}}triggerSuggest(e,t,i){this.editor.hasModel()&&(this.model.trigger({auto:t??!1,completionOptions:{providerFilter:e,kindFilter:i?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;const t=this.editor.getPosition(),i=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},n=s=>{if(s.completion.insertTextRules&4||s.completion.additionalTextEdits)return!0;const r=this.editor.getPosition(),a=s.editStart.column,c=r.column;return c-a!==s.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:a,endLineNumber:r.lineNumber,endColumn:c})!==s.completion.insertText};es.once(this.model.onDidTrigger)(s=>{const r=[];es.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Ds(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(Ds(r),a.items.length===0){i();return}const c=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),d=a.items[c];if(!n(d)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:c,item:d,model:a},7)},void 0,r)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){const i=this.widget.value.getFocusedItem();let n=0;e&&(n|=4),t&&(n|=8),this._insertSuggestion(i,n)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.value.forceRenderingAbove()}stopForceRenderingAbove(){this.widget.isInitialized&&this.widget.value.stopForceRenderingAbove()}registerSelector(e){return this._selectors.register(e)}},yC=vd,vd.ID="editor.contrib.suggestController",vd);tr=yC=Tj([Th(1,hw),Th(2,ls),Th(3,Ri),Th(4,qt),Th(5,oh),Th(6,Nr)],tr);class Nj{constructor(e){this.prioritySelector=e,this._items=new Array}register(e){if(this._items.indexOf(e)!==-1)throw new Error("Value is already registered");return this._items.push(e),this._items.sort((t,i)=>this.prioritySelector(i)-this.prioritySelector(t)),{dispose:()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}const Gv=class Gv extends Se{constructor(){super({id:Gv.id,label:w("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:le.and(M.writable,M.hasCompletionItemProvider,Rt.Visible.toNegated()),kbOpts:{kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=tr.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}};Gv.id="editor.action.triggerSuggest";let nv=Gv;oi(tr.ID,tr,2);ie(nv);const Co=190,Os=js.bindToContribution(tr.get);bt(new Os({id:"acceptSelectedSuggestion",precondition:le.and(Rt.Visible,Rt.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:le.and(Rt.Visible,M.textInputFocus),weight:Co},{primary:3,kbExpr:le.and(Rt.Visible,M.textInputFocus,Rt.AcceptSuggestionsOnEnter,Rt.MakesTextEdit),weight:Co}],menuOpts:[{menuId:Hl,title:w("accept.insert","Insert"),group:"left",order:1,when:Rt.HasInsertAndReplaceRange.toNegated()},{menuId:Hl,title:w("accept.insert","Insert"),group:"left",order:1,when:le.and(Rt.HasInsertAndReplaceRange,Rt.InsertMode.isEqualTo("insert"))},{menuId:Hl,title:w("accept.replace","Replace"),group:"left",order:1,when:le.and(Rt.HasInsertAndReplaceRange,Rt.InsertMode.isEqualTo("replace"))}]}));bt(new Os({id:"acceptAlternativeSelectedSuggestion",precondition:le.and(Rt.Visible,M.textInputFocus,Rt.HasFocusedSuggestion),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:Hl,group:"left",order:2,when:le.and(Rt.HasInsertAndReplaceRange,Rt.InsertMode.isEqualTo("insert")),title:w("accept.replace","Replace")},{menuId:Hl,group:"left",order:2,when:le.and(Rt.HasInsertAndReplaceRange,Rt.InsertMode.isEqualTo("replace")),title:w("accept.insert","Insert")}]}));dn.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");bt(new Os({id:"hideSuggestWidget",precondition:Rt.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:9,secondary:[1033]}}));bt(new Os({id:"selectNextSuggestion",precondition:le.and(Rt.Visible,le.or(Rt.MultipleSuggestions,Rt.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));bt(new Os({id:"selectNextPageSuggestion",precondition:le.and(Rt.Visible,le.or(Rt.MultipleSuggestions,Rt.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:12,secondary:[2060]}}));bt(new Os({id:"selectLastSuggestion",precondition:le.and(Rt.Visible,le.or(Rt.MultipleSuggestions,Rt.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()}));bt(new Os({id:"selectPrevSuggestion",precondition:le.and(Rt.Visible,le.or(Rt.MultipleSuggestions,Rt.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));bt(new Os({id:"selectPrevPageSuggestion",precondition:le.and(Rt.Visible,le.or(Rt.MultipleSuggestions,Rt.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:11,secondary:[2059]}}));bt(new Os({id:"selectFirstSuggestion",precondition:le.and(Rt.Visible,le.or(Rt.MultipleSuggestions,Rt.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()}));bt(new Os({id:"focusSuggestion",precondition:le.and(Rt.Visible,Rt.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));bt(new Os({id:"focusAndAcceptSuggestion",precondition:le.and(Rt.Visible,Rt.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}}));bt(new Os({id:"toggleSuggestionDetails",precondition:le.and(Rt.Visible,Rt.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:Hl,group:"right",order:1,when:le.and(Rt.DetailsVisible,Rt.CanResolve),title:w("detail.more","Show Less")},{menuId:Hl,group:"right",order:1,when:le.and(Rt.DetailsVisible.toNegated(),Rt.CanResolve),title:w("detail.less","Show More")}]}));bt(new Os({id:"toggleExplainMode",precondition:Rt.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));bt(new Os({id:"toggleSuggestionFocus",precondition:Rt.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:2570,mac:{primary:778}}}));bt(new Os({id:"insertBestCompletion",precondition:le.and(M.textInputFocus,le.equals("config.editor.tabCompletion","on"),Q_.AtEnd,Rt.Visible.toNegated(),ig.OtherSuggestions.toNegated(),Ns.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(fE(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:Co,primary:2}}));bt(new Os({id:"insertNextSuggestion",precondition:le.and(M.textInputFocus,le.equals("config.editor.tabCompletion","on"),ig.OtherSuggestions,Rt.Visible.toNegated(),Ns.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:2}}));bt(new Os({id:"insertPrevSuggestion",precondition:le.and(M.textInputFocus,le.equals("config.editor.tabCompletion","on"),ig.OtherSuggestions,Rt.Visible.toNegated(),Ns.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:Co,kbExpr:M.textInputFocus,primary:1026}}));ie(class extends Se{constructor(){super({id:"editor.action.resetSuggestSize",label:w("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(o,e){var t;(t=tr.get(e))==null||t.resetWidgetSize()}});class Rj extends Be{get selectedItem(){return this._currentSuggestItemInfo}constructor(e,t,i){super(),this.editor=e,this.suggestControllerPreselector=t,this.onWillAccept=i,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._onDidSelectedItemChange=this._register(new ti),this.onDidSelectedItemChange=this._onDidSelectedItemChange.event,this._register(e.onKeyDown(s=>{s.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(s=>{s.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));const n=tr.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(a,c,d)=>{const u=this.editor.getModel();if(!u)return-1;const f=this.suggestControllerPreselector(),m=f?Zc(f,u):void 0;if(!m)return-1;const v=ut.lift(c),_=d.map((S,D)=>{const E=uf.fromSuggestion(n,u,v,S,this.isShiftKeyPressed),N=Zc(E.toSingleTextEdit(),u),B=QM(m,N);return{index:D,valid:B,prefixLength:N.text.length,suggestItem:S}}).filter(S=>S&&S.valid&&S.prefixLength>0),y=g2(_,Dp(S=>S.prefixLength,Nb));return y?y.index:-1}}));let s=!1;const r=()=>{s||(s=!0,this._register(n.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(n.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(n.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(es.once(n.model.onDidTrigger)(a=>{r()})),this._register(n.onWillInsertSuggestItem(a=>{const c=this.editor.getPosition(),d=this.editor.getModel();if(!c||!d)return;const u=uf.fromSuggestion(n,d,c,a.item,this.isShiftKeyPressed);this.onWillAccept(u)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!Aj(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=tr.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;const t=e.widget.value.getFocusedItem(),i=this.editor.getPosition(),n=this.editor.getModel();if(!(!t||!i||!n))return uf.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=tr.get(this.editor);e==null||e.stopForceRenderingAbove()}forceRenderingAbove(){const e=tr.get(this.editor);e==null||e.forceRenderingAbove()}}class uf{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const d=new $d().parse(r);d.children.length<100&&J_.adjustWhitespace(t,i,!0,d),r=d.toString(),a=!0}const c=e.getOverwriteInfo(n,s);return new uf(H.fromPositions(i.delta(0,-c.overwriteBefore),i.delta(0,Math.max(c.overwriteAfter,0))),r,n.completion.kind,a)}constructor(e,t,i,n){this.range=e,this.insertText=t,this.completionItemKind=i,this.isSnippetText=n}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new f2(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new Xa(this.range,this.insertText)}}function Aj(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}var Oj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ka=function(o,e){return function(t,i){e(t,i,o)}},SC,bd;let Ho=(bd=class extends Be{static get(e){return e.getContribution(SC.ID)}constructor(e,t,i,n,s,r,a,c,d,u){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=n,this._commandService=s,this._debounceService=r,this._languageFeaturesService=a,this._accessibilitySignalService=c,this._keybindingService=d,this._accessibilityService=u,this._editorObs=ea(this.editor),this._positions=Zi(this,m=>{var v;return((v=this._editorObs.selections.read(m))==null?void 0:v.map(_=>_.getEndPosition()))??[new ut(1,1)]}),this._suggestWidgetAdaptor=this._register(new Rj(this.editor,()=>{var m,v;return this._editorObs.forceUpdate(),(v=(m=this.model.get())==null?void 0:m.selectedInlineCompletion.get())==null?void 0:v.toSingleTextEdit(void 0)},m=>this._editorObs.forceUpdate(v=>{var _;(_=this.model.get())==null||_.handleSuggestAccepted(m)}))),this._suggestWidgetSelectedItem=Ys(this,m=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(v=>m(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem),this._enabledInConfig=Ys(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=Ys(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=Ys(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=Zi(this,m=>this._enabledInConfig.read(m)&&(!this._isScreenReaderEnabled.read(m)||!this._editorDictationInProgress.read(m))),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model=nc(this,m=>{if(this._editorObs.isReadonly.read(m))return;const v=this._editorObs.model.read(m);return v?this._instantiationService.createInstance(uC,v,this._suggestWidgetSelectedItem,this._editorObs.versionId,this._positions,this._debounceValue,Ys(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).preview),Ys(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).previewMode),Ys(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).mode),this._enabled):void 0}).recomputeInitiallyAndOnChange(this._store),this._ghostTexts=Zi(this,m=>{const v=this.model.read(m);return(v==null?void 0:v.ghostTexts.read(m))??[]}),this._stablizedGhostTexts=Fj(this._ghostTexts,this._store),this._ghostTextWidgets=p2(this,this._stablizedGhostTexts,(m,v)=>v.add(this._instantiationService.createInstance(dC,this.editor,{ghostText:m,minReservedLineCount:Ha(0),targetTextModel:this.model.map(_=>_==null?void 0:_.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=y0(this),this._fontFamily=Ys(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._register(new so(this._contextKeyService,this.model)),this._register(zL(this._editorObs.onDidType,(m,v)=>{var _;this._enabled.get()&&((_=this.model.get())==null||_.trigger())})),this._register(this._commandService.onDidExecuteCommand(m=>{new Set([Bm.Tab.id,Bm.DeleteLeft.id,Bm.DeleteRight.id,lM,"acceptSelectedSuggestion"]).has(m.commandId)&&e.hasTextFocus()&&this._enabled.get()&&this._editorObs.forceUpdate(_=>{var y;(y=this.model.get())==null||y.trigger(_)})})),this._register(zL(this._editorObs.selections,(m,v)=>{var _;v.some(y=>y.reason===3||y.source==="api")&&((_=this.model.get())==null||_.stop())})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||Xu.dropDownVisible||sh(m=>{var v;(v=this.model.get())==null||v.stop(m)})})),this._register(Sn(m=>{var _;const v=(_=this.model.read(m))==null?void 0:_.state.read(m);v!=null&&v.suggestItem?v.primaryGhostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(gn(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const f=Tb(this,(m,v)=>{var S;const _=this.model.read(m),y=_==null?void 0:_.state.read(m);return this._suggestWidgetSelectedItem.get()?v:(S=y==null?void 0:y.inlineCompletion)==null?void 0:S.semanticId});this._register(m2(Zi(m=>(this._playAccessibilitySignal.read(m),f.read(m),{})),async(m,v,_)=>{const y=this.model.get(),S=y==null?void 0:y.state.get();if(!S||!y)return;const D=y.textModel.getLineContent(S.primaryGhostText.lineNumber);await Hb(50,By(_)),await _2(this._suggestWidgetSelectedItem,Wg,()=>!1,By(_)),await this._accessibilitySignalService.playSignal(mE.inlineSuggestion),this.editor.getOption(8)&&this._provideScreenReaderUpdate(S.primaryGhostText.renderForScreenReader(D))})),this._register(new ES(this.editor,this.model,this._instantiationService)),this._register(k4(Zi(m=>{const v=this._fontFamily.read(m);return v===""||v==="default"?"":`
|
|
43
|
-
.monaco-editor .ghost-text-decoration,
|
|
44
|
-
.monaco-editor .ghost-text-decoration-preview,
|
|
45
|
-
.monaco-editor .ghost-text {
|
|
46
|
-
font-family: ${v};
|
|
47
|
-
}`}))),this._register(this._configurationService.onDidChangeConfiguration(m=>{m.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let n;!t&&i&&this.editor.getOption(150)&&(n=w("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),or(n?e+", "+n:e)}shouldShowHoverAt(e){var i;const t=(i=this.model.get())==null?void 0:i.primaryGhostText.get();return t?t.parts.some(n=>e.containsPosition(new ut(t.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){var t;return((t=this._ghostTextWidgets.get()[0])==null?void 0:t.ownsViewZone(e))??!1}},SC=bd,bd.ID="editor.contrib.inlineCompletionsController",bd);Ho=SC=Oj([ka(1,qt),ka(2,Ri),ka(3,pn),ka(4,ls),ka(5,Wo),ka(6,gt),ka(7,pE),ka(8,Zn),ka(9,Mb)],Ho);function Fj(o,e){const t=wo("result",[]),i=[];return e.add(Sn(n=>{const s=o.read(n);sh(r=>{if(s.length!==i.length){i.length=s.length;for(let a=0;a<i.length;a++)i[a]||(i[a]=wo("item",s[a]));t.set([...i],r)}i.forEach((a,c)=>a.set(s[c],r))})})),t}const Zv=class Zv extends Se{constructor(){super({id:Zv.ID,label:w("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:le.and(M.writable,so.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=Ho.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};Zv.ID=dM;let CC=Zv;const Xv=class Xv extends Se{constructor(){super({id:Xv.ID,label:w("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:le.and(M.writable,so.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=Ho.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};Xv.ID=cM;let xC=Xv;class Hj extends Se{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:w("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:M.writable})}async run(e,t){const i=Ho.get(t);await HE(async n=>{var s;await((s=i==null?void 0:i.model.get())==null?void 0:s.triggerExplicitly(n)),i==null||i.playAccessibilitySignal(n)})}}class Wj extends Se{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:w("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:le.and(M.writable,so.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:le.and(M.writable,so.inlineSuggestionVisible)},menuOpts:[{menuId:Ye.InlineSuggestionToolbar,title:w("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var n;const i=Ho.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextWord(i.editor))}}class Bj extends Se{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:w("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:le.and(M.writable,so.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:Ye.InlineSuggestionToolbar,title:w("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var n;const i=Ho.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextLine(i.editor))}}class zj extends Se{constructor(){super({id:lM,label:w("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:so.inlineSuggestionVisible,menuOpts:[{menuId:Ye.InlineSuggestionToolbar,title:w("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:le.and(so.inlineSuggestionVisible,M.tabMovesFocus.toNegated(),so.inlineSuggestionHasIndentationLessThanTabSize,Rt.Visible.toNegated(),M.hoverFocused.toNegated())}})}async run(e,t){var n;const i=Ho.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const Yv=class Yv extends Se{constructor(){super({id:Yv.ID,label:w("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:so.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Ho.get(t);sh(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};Yv.ID="editor.action.inlineSuggest.hide";let LC=Yv;const Jv=class Jv extends Vs{constructor(){super({id:Jv.ID,title:w("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:Ye.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:le.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(pn),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}};Jv.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";let IC=Jv;var Vj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Rg=function(o,e){return function(t,i){e(t,i,o)}};class jj{constructor(e,t,i){this.owner=e,this.range=t,this.controller=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let kC=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageService=t,this._openerService=i,this.accessibilityService=n,this._instantiationService=s,this._telemetryService=r,this.hoverOrdinal=4}suggestHoverAnchor(e){const t=Ho.get(this._editor);if(!t)return null;const i=e.target;if(i.type===8){const n=i.detail;if(t.shouldShowHoverAtViewZone(n.viewZoneId))return new Zm(1e3,this,H.fromPositions(this._editor.getModel().validatePosition(n.positionBefore||n.position)),e.event.posx,e.event.posy,!1)}return i.type===7&&t.shouldShowHoverAt(i.range)?new Zm(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new Zm(1e3,this,i.range,e.event.posx,e.event.posy,!1):null}computeSync(e,t){if(this._editor.getOption(62).showToolbar!=="onHover")return[];const i=Ho.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new jj(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new Oe,n=t[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&i.add(this.renderScreenReaderText(e,n));const s=n.controller.model.get(),r=this._instantiationService.createInstance(Xu,this._editor,!1,Ha(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands),a=r.getDomNode();e.fragment.appendChild(a),s.triggerExplicitly(),i.add(r);const c={hoverPart:n,hoverElement:a,dispose(){i.dispose()}};return new Zd([c])}renderScreenReaderText(e,t){const i=new Oe,n=rt,s=n("div.hover-row.markdown-hover"),r=Qe(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new ug({editor:this._editor},this._languageService,this._openerService)),c=d=>{i.add(a.onDidRenderAsync(()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}));const u=w("inlineSuggestionFollows","Suggestion:"),f=i.add(a.render(new Is().appendText(u).appendCodeblock("text",d)));r.replaceChildren(f.element)};return i.add(Sn(d=>{var f;const u=(f=t.controller.model.read(d))==null?void 0:f.primaryGhostText.read(d);if(u){const m=this._editor.getModel().getLineContent(u.lineNumber);c(u.renderForScreenReader(m))}else h_(r)})),e.fragment.appendChild(s),i}};kC=Vj([Rg(1,Rr),Rg(2,Mr),Rg(3,Mb),Rg(4,qt),Rg(5,Nr)],kC);class Uj{}const uw=new class{constructor(){this._implementations=[]}register(e){return this._implementations.push(e),{dispose:()=>{const t=this._implementations.indexOf(e);t!==-1&&this._implementations.splice(t,1)}}}getImplementations(){return this._implementations}};oi(Ho.ID,Ho,3);ie(Hj);ie(CC);ie(xC);ie(Wj);ie(Bj);ie(zj);ie(LC);Yi(IC);ch.register(kC);uw.register(new Uj);var $j=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},py=function(o,e){return function(t,i){e(t,i,o)}},Kg,Zl;let Zf=(Zl=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new Oe,this.toUnhookForKeyboard=new Oe,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new sw(e);this.toUnhook.add(s),this.toUnhook.add(s.onMouseMoveOrRelevantKeyDown(([r,a])=>{this.startFindDefinitionFromMouse(r,a??void 0)})),this.toUnhook.add(s.onExecute(r=>{this.isEnabled(r)&&this.gotoDefinition(r.target.position,r.hasSideBySideModifier).catch(a=>{on(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(Kg.ID)}async startFindDefinitionFromCursor(e){await this.startFindDefinition(e),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(t=>{t&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(e,t){if(e.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(e,t)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}const i=e.target.position;this.startFindDefinition(i)}async startFindDefinition(e){var r;this.toUnhookForKeyboard.clear();const t=e?(r=this.editor.getModel())==null?void 0:r.getWordAtPosition(e):null;if(!t){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===t.startColumn&&this.currentWordAtPosition.endColumn===t.endColumn&&this.currentWordAtPosition.word===t.word)return;this.currentWordAtPosition=t;const i=new WE(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=us(a=>this.findDefinition(e,a));let n;try{n=await this.previousPromise}catch(a){on(a);return}if(!n||!n.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const s=n[0].originSelectionRange?H.lift(n[0].originSelectionRange):new H(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(n.length>1){let a=s;for(const{originSelectionRange:c}of n)c&&(a=H.plusRange(a,c));this.addDecoration(a,new Is().appendText(w("multipleResults","Click to show {0} definitions.",n.length)))}else{const a=n[0];if(!a.uri)return;this.textModelResolverService.createModelReference(a.uri).then(c=>{if(!c.object||!c.object.textEditorModel){c.dispose();return}const{object:{textEditorModel:d}}=c,{startLineNumber:u}=a.range;if(u<1||u>d.getLineCount()){c.dispose();return}const f=this.getPreviewValue(d,u,a),m=this.languageService.guessLanguageIdByFilepathOrFirstLine(d.uri);this.addDecoration(s,f?new Is().appendCodeblock(m||"",f):void 0),c.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=Kg.MAX_SOURCE_PREVIEW_LINES&&(n=this.getPreviewRangeBasedOnIndentation(e,t)),this.stripIndentationFromPreviewRange(e,t,n)}stripIndentationFromPreviewRange(e,t,i){let s=e.getLineFirstNonWhitespaceColumn(t);for(let a=t+1;a<i.endLineNumber;a++){const c=e.getLineFirstNonWhitespaceColumn(a);s=Math.min(s,c)}return e.getValueInRange(i).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(e,t){const i=e.getLineFirstNonWhitespaceColumn(t),n=Math.min(e.getLineCount(),t+Kg.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new H(t,1,s+1,1)}addDecoration(e,t){const i={range:e,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:t}};this.linkDecorations.set([i])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(e,t){var i;return this.editor.hasModel()&&e.isLeftClick&&e.isNoneOrSingleMouseDown&&e.target.type===6&&!(((i=e.target.detail.injectedText)==null?void 0:i.options)instanceof b0)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?Vp(this.languageFeaturesService.definitionProvider,i,e,!1,t):Promise.resolve(null)}gotoDefinition(e,t){return this.editor.setPosition(e),this.editor.invokeWithinContext(i=>{const n=!t&&this.editor.getOption(89)&&!this.isInPeekEditor(i);return new Up({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(Ri);return Bs.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}},Kg=Zl,Zl.ID="editor.contrib.gotodefinitionatposition",Zl.MAX_SOURCE_PREVIEW_LINES=8,Zl);Zf=Kg=$j([py(1,Ar),py(2,Rr),py(3,gt)],Zf);oi(Zf.ID,Zf,2);var tN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sv=function(o,e){return function(t,i){e(t,i,o)}};class Lk{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let DC=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new ti,this.onDidChange=this._onDidChange.event,this._dispoables=new Oe,this._markers=[],this._nextIdx=-1,nn.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const n=this._configService.getValue("problems.sortOrder"),s=(a,c)=>{let d=VL(a.resource.toString(),c.resource.toString());return d===0&&(n==="position"?d=H.compareRangesUsingStarts(a,c)||Es.compare(a.severity,c.severity):d=Es.compare(a.severity,c.severity)||H.compareRangesUsingStarts(a,c)),d},r=()=>{this._markers=this._markerService.read({resource:nn.isUri(e)?e:void 0,severities:Es.Error|Es.Warning|Es.Info}),typeof e=="function"&&(this._markers=this._markers.filter(a=>this._resourceFilter(a.resource))),this._markers.sort(s)};r(),this._dispoables.add(t.onMarkerChanged(a=>{(!this._resourceFilter||a.some(c=>this._resourceFilter(c)))&&(r(),this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(e){return!this._resourceFilter&&!e?!0:!this._resourceFilter||!e?!1:this._resourceFilter(e)}get selected(){const e=this._markers[this._nextIdx];return e&&new Lk(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,i){let n=!1,s=this._markers.findIndex(r=>r.resource.toString()===e.uri.toString());s<0&&(s=m_(this._markers,{resource:e.uri},(r,a)=>VL(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;r<this._markers.length;r++){let a=H.lift(this._markers[r]);if(a.isEmpty()){const c=e.getWordAtPosition(a.getStartPosition());c&&(a=new H(a.startLineNumber,c.startColumn,a.startLineNumber,c.endColumn))}if(t&&(a.containsPosition(t)||t.isBeforeOrEqual(a.getStartPosition()))){this._nextIdx=r,n=!0;break}if(this._markers[r].resource.toString()!==e.uri.toString())break}n||(this._nextIdx=i?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(e,t,i){if(this._markers.length===0)return!1;const n=this._nextIdx;return this._nextIdx===-1?this._initIdx(t,i,e):e?this._nextIdx=(this._nextIdx+1)%this._markers.length:e||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),n!==this._nextIdx}find(e,t){let i=this._markers.findIndex(n=>n.resource.toString()===e.toString());if(!(i<0)){for(;i<this._markers.length;i++)if(H.containsPosition(this._markers[i],t))return new Lk(this._markers[i],i+1,this._markers.length)}}};DC=tN([sv(1,h0),sv(2,pn)],DC);const iN=sl("IMarkerNavigationService");let EC=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new EE}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new DC(e,this._markerService,this._configService)}};EC=tN([sv(0,h0),sv(1,pn)],EC);ol(iN,EC,1);var PC;(function(o){function e(t){switch(t){case am.Ignore:return"severity-ignore "+Wi.asClassName(Ot.info);case am.Info:return Wi.asClassName(Ot.info);case am.Warning:return Wi.asClassName(Ot.warning);case am.Error:return Wi.asClassName(Ot.error);default:return""}}o.className=e})(PC||(PC={}));var qj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Mh=function(o,e){return function(t,i){e(t,i,o)}},TC;class Kj{constructor(e,t,i,n,s){this._openerService=n,this._labelService=s,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new Oe,this._editor=t;const r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(Za(this._relatedBlock,"click",a=>{a.preventDefault();const c=this._relatedDiagnostics.get(a.target);c&&i(c)})),this._scrollable=new x2(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),e.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(a=>{r.style.left=`-${a.scrollLeft}px`,r.style.top=`-${a.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){Ds(this._disposables)}update(e){const{source:t,message:i,relatedInformation:n,code:s}=e;let r=((t==null?void 0:t.length)||0)+2;s&&(typeof s=="string"?r+=s.length:r+=s.value.length);const a=Fb(i);this._lines=a.length,this._longestLineLength=0;for(const m of a)this._longestLineLength=Math.max(m.length+r,this._longestLineLength);la(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let c=this._messageBlock;for(const m of a)c=document.createElement("div"),c.innerText=m,m===""&&(c.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(c);if(t||s){const m=document.createElement("span");if(m.classList.add("details"),c.appendChild(m),t){const v=document.createElement("span");v.innerText=t,v.classList.add("source"),m.appendChild(v)}if(s)if(typeof s=="string"){const v=document.createElement("span");v.innerText=`(${s})`,v.classList.add("code"),m.appendChild(v)}else{this._codeLink=rt("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=_=>{this._openerService.open(s.target,{allowCommands:!0}),_.preventDefault(),_.stopPropagation()};const v=Qe(this._codeLink,rt("span"));v.innerText=s.value,m.appendChild(this._codeLink)}}if(la(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),bo(n)){const m=this._relatedBlock.appendChild(document.createElement("div"));m.style.paddingTop=`${Math.floor(this._editor.getOption(67)*.66)}px`,this._lines+=1;for(const v of n){const _=document.createElement("div"),y=document.createElement("a");y.classList.add("filename"),y.innerText=`${this._labelService.getUriBasenameLabel(v.resource)}(${v.startLineNumber}, ${v.startColumn}): `,y.title=this._labelService.getUriLabel(v.resource),this._relatedDiagnostics.set(y,v);const S=document.createElement("span");S.innerText=v.message,_.appendChild(y),_.appendChild(S),this._lines+=1,m.appendChild(_)}}const d=this._editor.getOption(50),u=Math.ceil(d.typicalFullwidthCharacterWidth*this._longestLineLength*.75),f=d.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:u,scrollHeight:f})}layout(e,t){this._scrollable.getDomNode().style.height=`${e}px`,this._scrollable.getDomNode().style.width=`${t}px`,this._scrollable.setScrollDimensions({width:t,height:e})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(e){let t="";switch(e.severity){case Es.Error:t=w("Error","Error");break;case Es.Warning:t=w("Warning","Warning");break;case Es.Info:t=w("Info","Info");break;case Es.Hint:t=w("Hint","Hint");break}let i=w("marker aria","{0} at {1}. ",t,e.startLineNumber+":"+e.startColumn);const n=this._editor.getModel();return n&&e.startLineNumber<=n.getLineCount()&&e.startLineNumber>=1&&(i=`${n.getLineContent(e.startLineNumber)}, ${i}`),i}}var wd;let Xf=(wd=class extends A_{constructor(e,t,i,n,s,r,a){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},s),this._themeService=t,this._openerService=i,this._menuService=n,this._contextKeyService=r,this._labelService=a,this._callOnDispose=new Oe,this._onDidSelectRelatedInformation=new ti,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=Es.Warning,this._backgroundColor=ui.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(Yj);let t=MC,i=Gj;this._severity===Es.Warning?(t=Qm,i=Zj):this._severity===Es.Info&&(t=NC,i=Xj);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(wM),secondaryHeadingColor:e.getColor(yM)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(n=>this.editor.focus()));const t=[],i=this._menuService.getMenuActions(TC.TitleMenu,this._contextKeyService);f0(i,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=Qe(e,rt(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new Kj(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());const n=H.lift(e),s=this.editor.getPosition(),r=s&&n.containsPosition(s)?s:n.getStartPosition();super.show(r,this.computeRequiredHeight());const a=this.editor.getModel();if(a){const c=i>1?w("problems","{0} of {1} problems",t,i):w("change","{0} of {1} problem",t,i);this.setTitle(fa(a.uri),c)}this._icon.className=`codicon ${PC.className(Es.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(r,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}},TC=wd,wd.TitleMenu=new Ye("gotoErrorTitleMenu"),wd);Xf=TC=qj([Mh(1,lr),Mh(2,Mr),Mh(3,nh),Mh(4,qt),Mh(5,Ri),Mh(6,Ef)],Xf);const Ik=C0(b2,v2),kk=C0(y2,w2),Dk=C0(Ry,S2),MC=at("editorMarkerNavigationError.background",{dark:Ik,light:Ik,hcDark:Ga,hcLight:Ga},w("editorMarkerNavigationError","Editor marker navigation widget error color.")),Gj=at("editorMarkerNavigationError.headerBackground",{dark:ca(MC,.1),light:ca(MC,.1),hcDark:null,hcLight:null},w("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),Qm=at("editorMarkerNavigationWarning.background",{dark:kk,light:kk,hcDark:Ga,hcLight:Ga},w("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),Zj=at("editorMarkerNavigationWarning.headerBackground",{dark:ca(Qm,.1),light:ca(Qm,.1),hcDark:"#0C141F",hcLight:ca(Qm,.2)},w("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),NC=at("editorMarkerNavigationInfo.background",{dark:Dk,light:Dk,hcDark:Ga,hcLight:Ga},w("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),Xj=at("editorMarkerNavigationInfo.headerBackground",{dark:ca(NC,.1),light:ca(NC,.1),hcDark:null,hcLight:null},w("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),Yj=at("editorMarkerNavigation.background",C2,w("editorMarkerNavigationBackground","Editor marker navigation widget background."));var Jj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Dm=function(o,e){return function(t,i){e(t,i,o)}},Gg,yd;let Jd=(yd=class{static get(e){return e.getContribution(Gg.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new Oe,this._editor=e,this._widgetVisible=nN.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(e){if(this._model&&this._model.matches(e))return this._model;let t=!1;return this._model&&(t=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(e),t&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(Xf,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(i=>{var n,s,r;(!((n=this._model)!=null&&n.selected)||!H.containsPosition((s=this._model)==null?void 0:s.selected.marker,i.position))&&((r=this._model)==null||r.resetIndex())})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;const i=this._model.find(this._editor.getModel().uri,this._widget.position);i?this._widget.updateMarker(i.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(i=>{this._editorService.openCodeEditor({resource:i.resource,options:{pinned:!0,revealIfOpened:!0,selection:H.lift(i).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(this._editor.hasModel()){const t=this._getOrCreateModel(this._editor.getModel().uri);t.resetIndex(),t.move(!0,this._editor.getModel(),new ut(e.startLineNumber,e.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}}async nagivate(e,t){var i,n;if(this._editor.hasModel()){const s=this._getOrCreateModel(t?void 0:this._editor.getModel().uri);if(s.move(e,this._editor.getModel(),this._editor.getPosition()),!s.selected)return;if(s.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=await this._editorService.openCodeEditor({resource:s.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:s.selected.marker}},this._editor);r&&((i=Gg.get(r))==null||i.close(),(n=Gg.get(r))==null||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}},Gg=yd,yd.ID="editor.contrib.markerController",yd);Jd=Gg=Jj([Dm(1,iN),Dm(2,Ri),Dm(3,Un),Dm(4,qt)],Jd);class gw extends Se{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=Jd.get(t))==null||i.nagivate(this._next,this._multiFile))}}const Ec=class Ec extends gw{constructor(){super(!0,!1,{id:Ec.ID,label:Ec.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:578,weight:100},menuOpts:{menuId:Xf.TitleMenu,title:Ec.LABEL,icon:Wn("marker-navigation-next",Ot.arrowDown,w("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}};Ec.ID="editor.action.marker.next",Ec.LABEL=w("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");let ov=Ec;const Pc=class Pc extends gw{constructor(){super(!1,!1,{id:Pc.ID,label:Pc.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:1602,weight:100},menuOpts:{menuId:Xf.TitleMenu,title:Pc.LABEL,icon:Wn("marker-navigation-previous",Ot.arrowUp,w("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}};Pc.ID="editor.action.marker.prev",Pc.LABEL=w("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");let RC=Pc;class Qj extends gw{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:w("markerAction.nextInFiles.label","Go to Next Problem in Files (Error, Warning, Info)"),alias:"Go to Next Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:66,weight:100},menuOpts:{menuId:Ye.MenubarGoMenu,title:w({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class eU extends gw{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:w("markerAction.previousInFiles.label","Go to Previous Problem in Files (Error, Warning, Info)"),alias:"Go to Previous Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:1090,weight:100},menuOpts:{menuId:Ye.MenubarGoMenu,title:w({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}oi(Jd.ID,Jd,4);ie(ov);ie(RC);ie(Qj);ie(eU);const nN=new yi("markersNavigationVisible",!1),tU=js.bindToContribution(Jd.get);bt(new tU({id:"closeMarkersNavigation",precondition:nN,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:M.focus,primary:9,secondary:[1033]}}));var mr;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(mr||(mr={}));class iU extends Se{constructor(){super({id:aM,label:w({key:"showOrFocusHover",comment:["Label for action that will trigger the showing/focusing of a hover in the editor.","If the hover is not visible, it will show the hover.","This allows for users to show the hover without using the mouse."]},"Show or Focus Hover"),metadata:{description:ht("showOrFocusHoverDescription","Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[mr.NoAutoFocus,mr.FocusIfVisible,mr.AutoFocusImmediately],enumDescriptions:[w("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),w("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),w("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:mr.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=Ls.get(t);if(!n)return;const s=i==null?void 0:i.focus;let r=mr.FocusIfVisible;Object.values(mr).includes(s)?r=s:typeof s=="boolean"&&s&&(r=mr.AutoFocusImmediately);const a=d=>{const u=t.getPosition(),f=new H(u.lineNumber,u.column,u.lineNumber,u.column);n.showContentHover(f,1,1,d)},c=t.getOption(2)===2;n.isHoverVisible?r!==mr.NoAutoFocus?n.focus():a(c):a(c||r===mr.AutoFocusImmediately)}}class nU extends Se{constructor(){super({id:wB,label:w({key:"showDefinitionPreviewHover",comment:["Label for action that will trigger the showing of definition preview hover in the editor.","This allows for users to show the definition preview hover without using the mouse."]},"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0,metadata:{description:ht("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=Ls.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new H(n.lineNumber,n.column,n.lineNumber,n.column),r=Zf.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class sU extends Se{constructor(){super({id:yB,label:w({key:"scrollUpHover",comment:["Action that allows to scroll up in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:16,weight:100},metadata:{description:ht("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=Ls.get(t);i&&i.scrollUp()}}class oU extends Se{constructor(){super({id:SB,label:w({key:"scrollDownHover",comment:["Action that allows to scroll down in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:18,weight:100},metadata:{description:ht("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=Ls.get(t);i&&i.scrollDown()}}class rU extends Se{constructor(){super({id:CB,label:w({key:"scrollLeftHover",comment:["Action that allows to scroll left in the hover widget with the left arrow when the hover widget is focused."]},"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:15,weight:100},metadata:{description:ht("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=Ls.get(t);i&&i.scrollLeft()}}class aU extends Se{constructor(){super({id:xB,label:w({key:"scrollRightHover",comment:["Action that allows to scroll right in the hover widget with the right arrow when the hover widget is focused."]},"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:17,weight:100},metadata:{description:ht("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=Ls.get(t);i&&i.scrollRight()}}class lU extends Se{constructor(){super({id:LB,label:w({key:"pageUpHover",comment:["Action that allows to page up in the hover widget with the page up command when the hover widget is focused."]},"Page Up Hover"),alias:"Page Up Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:ht("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=Ls.get(t);i&&i.pageUp()}}class cU extends Se{constructor(){super({id:IB,label:w({key:"pageDownHover",comment:["Action that allows to page down in the hover widget with the page down command when the hover widget is focused."]},"Page Down Hover"),alias:"Page Down Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:ht("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=Ls.get(t);i&&i.pageDown()}}class dU extends Se{constructor(){super({id:kB,label:w({key:"goToTopHover",comment:["Action that allows to go to the top of the hover widget with the home command when the hover widget is focused."]},"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:ht("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=Ls.get(t);i&&i.goToTop()}}class hU extends Se{constructor(){super({id:DB,label:w({key:"goToBottomHover",comment:["Action that allows to go to the bottom in the hover widget with the end command when the hover widget is focused."]},"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:ht("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=Ls.get(t);i&&i.goToBottom()}}class uU extends Se{constructor(){super({id:tw,label:EB,alias:"Increase Hover Verbosity Level",precondition:M.hoverVisible})}run(e,t,i){const n=Ls.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();n.updateHoverVerbosityLevel(Ao.Increase,s,i==null?void 0:i.focus)}}class gU extends Se{constructor(){super({id:iw,label:PB,alias:"Decrease Hover Verbosity Level",precondition:M.hoverVisible})}run(e,t,i){var r;const n=Ls.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();(r=Ls.get(t))==null||r.updateHoverVerbosityLevel(Ao.Decrease,s,i==null?void 0:i.focus)}}var fU=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},my=function(o,e){return function(t,i){e(t,i,o)}};const zo=rt;class pU{constructor(e,t,i){this.owner=e,this.range=t,this.marker=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}const Ek={type:1,filter:{include:ln.QuickFix},triggerAction:ro.QuickFixHover};let AC=class{constructor(e,t,i,n){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=n,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];for(const a of t){const c=a.range.startLineNumber===n?a.range.startColumn:1,d=a.range.endLineNumber===n?a.range.endColumn:s,u=this._markerDecorationsService.getMarker(i.uri,a);if(!u)continue;const f=new H(e.range.startLineNumber,c,e.range.startLineNumber,d);r.push(new pU(this,f,u))}return r}renderHoverParts(e,t){if(!t.length)return new Zd([]);const i=new Oe,n=[];t.forEach(r=>{const a=this._renderMarkerHover(r);e.fragment.appendChild(a.hoverElement),n.push(a)});const s=t.length===1?t[0]:t.sort((r,a)=>Es.compare(r.marker.severity,a.marker.severity))[0];return this.renderMarkerStatusbar(e,s,i),new Zd(n)}_renderMarkerHover(e){const t=new Oe,i=zo("div.hover-row"),n=Qe(i,zo("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:c}=e.marker;this._editor.applyFontInfo(n);const d=Qe(n,zo("span"));if(d.style.whiteSpace="pre-wrap",d.innerText=r,s||a)if(a&&typeof a!="string"){const f=zo("span");if(s){const y=Qe(f,zo("span"));y.innerText=s}const m=Qe(f,zo("a.code-link"));m.setAttribute("href",a.target.toString()),t.add(Ni(m,"click",y=>{this._openerService.open(a.target,{allowCommands:!0}),y.preventDefault(),y.stopPropagation()}));const v=Qe(m,zo("span"));v.innerText=a.value;const _=Qe(n,f);_.style.opacity="0.6",_.style.paddingLeft="6px"}else{const f=Qe(n,zo("span"));f.style.opacity="0.6",f.style.paddingLeft="6px",f.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(bo(c))for(const{message:f,resource:m,startLineNumber:v,startColumn:_}of c){const y=Qe(n,zo("div"));y.style.marginTop="8px";const S=Qe(y,zo("a"));S.innerText=`${fa(m)}(${v}, ${_}): `,S.style.cursor="pointer",t.add(Ni(S,"click",E=>{if(E.stopPropagation(),E.preventDefault(),this._openerService){const N={selection:{startLineNumber:v,startColumn:_}};this._openerService.open(m,{fromUserGesture:!0,editorOptions:N}).catch(on)}}));const D=Qe(y,zo("span"));D.innerText=f,this._editor.applyFontInfo(D)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}renderMarkerStatusbar(e,t,i){if(t.marker.severity===Es.Error||t.marker.severity===Es.Warning||t.marker.severity===Es.Info){const n=Jd.get(this._editor);n&&e.statusBar.addAction({label:w("view problem","View Problem"),commandId:ov.ID,run:()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(92)){const n=e.statusBar.append(zo("div"));this.recentMarkerCodeActionsInfo&&(jL.makeKey(this.recentMarkerCodeActionsInfo.marker)===jL.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=w("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Be.None:Cf(()=>n.textContent=w("checkingForQuickFixes","Checking for quick fixes..."),200,i);n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(gn(()=>r.cancel())),r.then(a=>{if(s.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:a.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){a.dispose(),n.textContent=w("noQuickFixes","No quick fixes available");return}n.style.display="none";let c=!1;i.add(gn(()=>{c||a.dispose()})),e.statusBar.addAction({label:w("quick fixes","Quick Fix..."),commandId:X0,run:d=>{c=!0;const u=Gu.get(this._editor),f=Ws(d);e.hide(),u==null||u.showCodeActions(Ek,a,{x:f.left,y:f.top,width:f.width,height:f.height})}})},on)}}getCodeActions(e){return us(t=>Zh(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new H(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),Ek,Fa.None,t))}};AC=fU([my(1,L2),my(2,Mr),my(3,gt)],AC);class mU{get lineNumber(){return this._lineNumber}set lineNumber(e){this._lineNumber=e}get lane(){return this._laneOrLine}set lane(e){this._laneOrLine=e}constructor(e){this._editor=e,this._lineNumber=-1,this._laneOrLine=c_.Center}computeSync(){var s;const e=r=>({value:r}),t=this._editor.getLineDecorations(this._lineNumber),i=[],n=this._laneOrLine==="lineNo";if(!t)return i;for(const r of t){const a=((s=r.options.glyphMargin)==null?void 0:s.position)??c_.Center;if(!n&&a!==this._laneOrLine)continue;const c=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!c||Df(c)||i.push(...XD(c).map(e))}return i}}var _U=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Pk=function(o,e){return function(t,i){e(t,i,o)}},OC;const Tk=rt;var Sd;let FC=(Sd=class extends Be{constructor(e,t,i){super(),this._renderDisposeables=this._register(new Oe),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new ZD),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new ug({editor:this._editor},t,i)),this._computer=new mU(this._editor),this._hoverOperation=this._register(new hM(this._editor,this._computer)),this._register(this._hoverOperation.onResult(n=>{this._withResult(n.value)})),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(50)&&this._updateFont()})),this._register(Za(this._hover.containerDomNode,"mouseleave",n=>{this._onMouseLeave(n)})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return OC.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}showsOrWillShow(e){const t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._computer.lineNumber===e&&this._computer.lane===t||(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=e,this._computer.lane=t,this._hoverOperation.start(0))}hide(){this._computer.lineNumber=-1,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e,this._messages.length>0?this._renderMessages(this._computer.lineNumber,this._messages):this.hide()}_renderMessages(e,t){this._renderDisposeables.clear();const i=document.createDocumentFragment();for(const n of t){const s=Tk("div.hover-row.markdown-hover"),r=Qe(s,Tk("div.hover-contents")),a=this._renderDisposeables.add(this._markdownRenderer.render(n.value));r.appendChild(a.element),i.appendChild(s)}this._updateContents(i),this._showAt(e)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const t=this._editor.getLayoutInfo(),i=this._editor.getTopForLineNumber(e),n=this._editor.getScrollTop(),s=this._editor.getOption(67),r=this._hover.containerDomNode.clientHeight,a=i-n-(r-s)/2,c=t.glyphMarginLeft+t.glyphMarginWidth+(this._computer.lane==="lineNo"?t.lineNumbersWidth:0);this._hover.containerDomNode.style.left=`${c}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(a),0)}px`}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!nw(t,e.x,e.y))&&this.hide()}},OC=Sd,Sd.ID="editor.contrib.modesGlyphHoverWidget",Sd);FC=OC=_U([Pk(1,Rr),Pk(2,Mr)],FC);var vU=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bU=function(o,e){return function(t,i){e(t,i,o)}},Lu;let rv=(Lu=class extends Be{constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Oe,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new ts(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnMarginHoverWidget(e)&&this._hideWidgets()}_isMouseOnMarginHoverWidget(e){var i;const t=(i=this._glyphWidget)==null?void 0:i.getDomNode();return t?nw(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._isMouseOnMarginHoverWidget(e))||this._hideWidgets()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=this._isMouseOnMarginHoverWidget(e);return t&&i}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){!e||this._tryShowHoverWidget(e)||this._hideWidgets()}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){this._editor.hasModel()&&(e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||this._hideWidgets())}_hideWidgets(){var e;(e=this._glyphWidget)==null||e.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(FC,this._editor)),this._glyphWidget}dispose(){var e;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._glyphWidget)==null||e.dispose()}},Lu.ID="editor.contrib.marginHover",Lu);rv=vU([bU(1,qt)],rv);class wU{}class yU{}class SU{}oi(Ls.ID,Ls,2);oi(rv.ID,rv,2);ie(iU);ie(nU);ie(sU);ie(oU);ie(rU);ie(aU);ie(lU);ie(cU);ie(dU);ie(hU);ie(uU);ie(gU);ch.register(Uf);ch.register(AC);Eb((o,e)=>{const t=o.getColor(I2);t&&(e.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${t.transparent(.5)}; }`))});uw.register(new wU);uw.register(new yU);uw.register(new SU);function Xs(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function gf(o,e,t){o=o<0?0:o;let i="";if(!t){const n=Math.floor(o/e);o=o%e;for(let s=0;s<n;s++)i+=" "}for(let n=0;n<o;n++)i+=" ";return i}function sN(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return[];const n=e.getLanguageConfiguration(o.getLanguageId()).indentRulesSupport;if(!n)return[];const s=new k2(o,n,e);for(i=Math.min(i,o.getLineCount());t<=i&&s.shouldIgnore(t);)t++;if(t>i-1)return[];const{tabSize:r,indentSize:a,insertSpaces:c}=o.getOptions(),d=(y,S)=>(S=S||1,Bu.shiftIndent(y,y.length+S,r,a,c)),u=(y,S)=>(S=S||1,Bu.unshiftIndent(y,y.length+S,r,a,c)),f=[],m=o.getLineContent(t);let v=vs(m),_=v;s.shouldIncrease(t)?(_=d(_),v=d(v)):s.shouldIndentNextLine(t)&&(_=d(_)),t++;for(let y=t;y<=i;y++){if(CU(o,y))continue;const S=o.getLineContent(y),D=vs(S),E=_;s.shouldDecrease(y,E)&&(_=u(_),v=u(v)),D!==_&&f.push(En.replaceMove(new Mt(y,1,y,D.length+1),D2(_,a,c))),!s.shouldIgnore(y)&&(s.shouldIncrease(y,E)?(v=d(v),_=v):s.shouldIndentNextLine(y,E)?_=d(_):_=v)}return f}function CU(o,e){return o.tokenization.isCheapToTokenize(e)?o.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var xU=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},LU=function(o,e){return function(t,i){e(t,i,o)}};const Qv=class Qv extends Se{constructor(){super({id:Qv.ID,label:w("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:M.writable,metadata:{description:ht("indentationToSpacesDescription","Convert the tab indentation to spaces.")}})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new PU(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}};Qv.ID="editor.action.indentationToSpaces";let HC=Qv;const eb=class eb extends Se{constructor(){super({id:eb.ID,label:w("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:M.writable,metadata:{description:ht("indentationToTabsDescription","Convert the spaces indentation to tabs.")}})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new TU(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}};eb.ID="editor.action.indentationToTabs";let WC=eb;class S1 extends Se{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(nl),n=e.get(As),s=t.getModel();if(!s)return;const r=n.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),a=s.getOptions(),c=[1,2,3,4,5,6,7,8].map(u=>({id:u.toString(),label:u.toString(),description:u===r.tabSize&&u===a.tabSize?w("configuredTabSize","Configured Tab Size"):u===r.tabSize?w("defaultTabSize","Default Tab Size"):u===a.tabSize?w("currentTabSize","Current Tab Size"):void 0})),d=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(c,{placeHolder:w({key:"selectTabWidth",comment:["Tab corresponds to the tab key"]},"Select Tab Size for Current File"),activeItem:c[d]}).then(u=>{if(u&&s&&!s.isDisposed()){const f=parseInt(u.label,10);this.displaySizeOnly?s.updateOptions({tabSize:f}):s.updateOptions({tabSize:f,indentSize:f,insertSpaces:this.insertSpaces})}})},50)}}const tb=class tb extends S1{constructor(){super(!1,!1,{id:tb.ID,label:w("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:ht("indentUsingTabsDescription","Use indentation with tabs.")}})}};tb.ID="editor.action.indentUsingTabs";let BC=tb;const ib=class ib extends S1{constructor(){super(!0,!1,{id:ib.ID,label:w("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:ht("indentUsingSpacesDescription","Use indentation with spaces.")}})}};ib.ID="editor.action.indentUsingSpaces";let zC=ib;const nb=class nb extends S1{constructor(){super(!0,!0,{id:nb.ID,label:w("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:ht("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}};nb.ID="editor.action.changeTabDisplaySize";let VC=nb;const sb=class sb extends Se{constructor(){super({id:sb.ID,label:w("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:ht("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(As),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}};sb.ID="editor.action.detectIndentation";let jC=sb;class IU extends Se{constructor(){super({id:"editor.action.reindentlines",label:w("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:M.writable,metadata:{description:ht("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(cs),n=t.getModel();if(!n)return;const s=sN(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class kU extends Se{constructor(){super({id:"editor.action.reindentselectedlines",label:w("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:M.writable,metadata:{description:ht("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(cs),n=t.getModel();if(!n)return;const s=t.getSelections();if(s===null)return;const r=[];for(const a of s){let c=a.startLineNumber,d=a.endLineNumber;if(c!==d&&a.endColumn===1&&d--,c===1){if(c===d)continue}else c--;const u=sN(n,i,c,d);r.push(...u)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class DU{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(const i of e)i.range&&typeof i.text=="string"&&this._edits.push(i)}getEditOperations(e,t){for(const n of this._edits)t.addEditOperation(H.lift(n.range),n.text);let i=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),i||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}var Iu;let av=(Iu=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new Oe,this.callOnModel=new Oe,this.callOnDispose.add(e.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(e.onDidChangeModel(()=>this.update())),this.callOnDispose.add(e.onDidChangeModelLanguage(()=>this.update()))}update(){this.callOnModel.clear(),!(this.editor.getOption(12)<4||this.editor.getOption(55))&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:e})=>{this.trigger(e)}))}trigger(e){const t=this.editor.getSelections();if(t===null||t.length>1)return;const i=this.editor.getModel();if(!i||this.rangeContainsOnlyWhitespaceCharacters(i,e)||EU(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:r,indentSize:a,insertSpaces:c}=i.getOptions(),d=[],u={shiftIndent:_=>Bu.shiftIndent(_,_.length+1,r,a,c),unshiftIndent:_=>Bu.unshiftIndent(_,_.length+1,r,a,c)};let f=e.startLineNumber;for(;f<=e.endLineNumber;){if(this.shouldIgnoreLine(i,f)){f++;continue}break}if(f>e.endLineNumber)return;let m=i.getLineContent(f);if(!/\S/.test(m.substring(0,e.startColumn-1))){const _=sf(s,i,i.getLanguageId(),f,u,this._languageConfigurationService);if(_!==null){const y=vs(m),S=Xs(_,r),D=Xs(y,r);if(S!==D){const E=gf(S,r,c);d.push({range:new H(f,1,f,y.length+1),text:E}),m=E+m.substring(y.length)}else{const E=BE(i,f,this._languageConfigurationService);if(E===0||E===8)return}}}const v=f;for(;f<e.endLineNumber;){if(!/\S/.test(i.getLineContent(f+1))){f++;continue}break}if(f!==e.endLineNumber){const y=sf(s,{tokenization:{getLineTokens:S=>i.tokenization.getLineTokens(S),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(S,D)=>i.getLanguageIdAtPosition(S,D)},getLineContent:S=>S===v?m:i.getLineContent(S)},i.getLanguageId(),f+1,u,this._languageConfigurationService);if(y!==null){const S=Xs(y,r),D=Xs(vs(i.getLineContent(f+1)),r);if(S!==D){const E=S-D;for(let N=f+1;N<=e.endLineNumber;N++){const B=i.getLineContent(N),F=vs(B),$=Xs(F,r)+E,fe=gf($,r,c);fe!==F&&d.push({range:new H(N,1,N,F.length+1),text:fe})}}}}if(d.length>0){this.editor.pushUndoStop();const _=new DU(d,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",_),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(e,t){const i=s=>s.trim().length===0;let n=!0;if(t.startLineNumber===t.endLineNumber){const r=e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1);n=i(r)}else for(let s=t.startLineNumber;s<=t.endLineNumber;s++){const r=e.getLineContent(s);if(s===t.startLineNumber){const a=r.substring(t.startColumn-1);n=i(a)}else if(s===t.endLineNumber){const a=r.substring(0,t.endColumn-1);n=i(a)}else n=e.getLineFirstNonWhitespaceColumn(s)===0;if(!n)break}return n}shouldIgnoreLine(e,t){e.tokenization.forceTokenization(t);const i=e.getLineFirstNonWhitespaceColumn(t);if(i===0)return!0;const n=e.tokenization.getLineTokens(t);if(n.getCount()>0){const s=n.findTokenIndexAtOffset(i);if(s>=0&&n.getStandardTokenType(s)===1)return!0}return!1}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}},Iu.ID="editor.contrib.autoIndentOnPaste",Iu);av=xU([LU(1,cs)],av);function EU(o,e){const t=i=>E2(o,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function oN(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n="";for(let r=0;r<t;r++)n+=" ";const s=new RegExp(n,"gi");for(let r=1,a=o.getLineCount();r<=a;r++){let c=o.getLineFirstNonWhitespaceColumn(r);if(c===0&&(c=o.getLineMaxColumn(r)),c===1)continue;const d=new H(r,1,r,c),u=o.getValueInRange(d),f=i?u.replace(/\t/ig,n):u.replace(s," ");e.addEditOperation(d,f)}}class PU{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),oN(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class TU{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),oN(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}oi(av.ID,av,2);ie(HC);ie(WC);ie(BC);ie(zC);ie(VC);ie(jC);ie(IU);ie(kU);oi(qf.ID,qf,1);ch.register(W_);class MU{constructor(e,t,i){this._editRange=e,this._originalSelection=t,this._text=i}getEditOperations(e,t){t.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new Mt(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new Mt(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}var NU=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},RU=function(o,e){return function(t,i){e(t,i,o)}},e_,Xl;let ng=(Xl=class{static get(e){return e.getContribution(e_.ID)}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){var c;(c=this.currentRequest)==null||c.cancel();const i=this.editor.getSelection(),n=this.editor.getModel();if(!n||!i)return;let s=i;if(s.startLineNumber!==s.endLineNumber)return;const r=new WE(this.editor,5),a=n.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=us(d=>this.editorWorkerService.navigateValueSet(a,s,t)),this.currentRequest.then(d=>{var _;if(!d||!d.range||!d.value||!r.validate(this.editor))return;const u=H.lift(d.range);let f=d.range;const m=d.value.length-(s.endColumn-s.startColumn);f={startLineNumber:f.startLineNumber,startColumn:f.startColumn,endLineNumber:f.endLineNumber,endColumn:f.startColumn+d.value.length},m>1&&(s=new Mt(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+m-1));const v=new MU(u,s,d.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,v),this.editor.pushUndoStop(),this.decorations.set([{range:f,options:e_.DECORATION}]),(_=this.decorationRemover)==null||_.cancel(),this.decorationRemover=Hb(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(on)}).catch(on)):Promise.resolve(void 0)}},e_=Xl,Xl.ID="editor.contrib.inPlaceReplaceController",Xl.DECORATION=pi.register({description:"in-place-replace",className:"valueSetReplacement"}),Xl);ng=e_=NU([RU(1,rl)],ng);class AU extends Se{constructor(){super({id:"editor.action.inPlaceReplace.up",label:w("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=ng.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class OU extends Se{constructor(){super({id:"editor.action.inPlaceReplace.down",label:w("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=ng.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}oi(ng.ID,ng,4);ie(AU);ie(OU);class FU extends Se{constructor(){super({id:"expandLineSelection",label:w("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:M.textInputFocus,primary:2090}})}run(e,t,i){if(i=i||{},!t.hasModel())return;const n=t._getViewModel();n.model.pushStackElement(),n.setCursorStates(i.source,3,x0.expandLineSelection(n,n.getCursorStates())),n.revealAllCursors(i.source,!0)}}ie(FU);class HU{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=WU(e,this._cursors,this._trimInRegexesAndStrings);for(let n=0,s=i.length;n<s;n++){const r=i[n];t.addEditOperation(r.range,r.text)}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}function WU(o,e,t){e.sort((a,c)=>a.lineNumber===c.lineNumber?a.column-c.column:a.lineNumber-c.lineNumber);for(let a=e.length-2;a>=0;a--)e[a].lineNumber===e[a+1].lineNumber&&e.splice(a,1);const i=[];let n=0,s=0;const r=e.length;for(let a=1,c=o.getLineCount();a<=c;a++){const d=o.getLineContent(a),u=d.length+1;let f=0;if(s<r&&e[s].lineNumber===a&&(f=e[s].column,s++,f===u)||d.length===0)continue;const m=zm(d);let v=0;if(m===-1)v=1;else if(m!==d.length-1)v=m+2;else continue;if(!t){if(!o.tokenization.hasAccurateTokensForLine(a))continue;const _=o.tokenization.getLineTokens(a),y=_.getStandardTokenType(_.findTokenIndexAtOffset(v));if(y===2||y===3)continue}v=Math.max(f,v),i[n++]=En.delete(new H(a,v,a,u))}return i}class rN{constructor(e,t,i){this._selection=e,this._isCopyingDown=t,this._noop=i||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(e,t){let i=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._endLineNumberDelta=1,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=[];for(let r=i.startLineNumber;r<=i.endLineNumber;r++)n.push(e.getLineContent(r));const s=n.join(`
|
|
48
|
-
`);s===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new H(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
|
|
49
|
-
`):this._isCopyingDown?t.addEditOperation(new H(i.startLineNumber,1,i.startLineNumber,1),s+`
|
|
50
|
-
`):t.addEditOperation(new H(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),`
|
|
51
|
-
`+s),this._selectionId=t.trackSelection(i),this._selectionDirection=this._selection.getDirection()}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let n=i.startLineNumber,s=i.startColumn,r=i.endLineNumber,a=i.endColumn;this._startLineNumberDelta!==0&&(n=n+this._startLineNumberDelta,s=1),this._endLineNumberDelta!==0&&(r=r+this._endLineNumberDelta,a=1),i=Mt.createWithDirection(n,s,r,a,this._selectionDirection)}return i}}var BU=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zU=function(o,e){return function(t,i){e(t,i,o)}};let UC=class{constructor(e,t,i,n){this._languageConfigurationService=n,this._selection=e,this._isMovingDown=t,this._autoIndent=i,this._selectionId=null,this._moveEndLineSelectionShrink=!1}getEditOperations(e,t){const i=()=>e.getLanguageId(),n=(f,m)=>e.getLanguageIdAtPosition(f,m),s=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===s){this._selectionId=t.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=t.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let r=this._selection;r.startLineNumber<r.endLineNumber&&r.endColumn===1&&(this._moveEndPositionDown=!0,r=r.setEndPosition(r.endLineNumber-1,e.getLineMaxColumn(r.endLineNumber-1)));const{tabSize:a,indentSize:c,insertSpaces:d}=e.getOptions(),u=this.buildIndentConverter(a,c,d);if(r.startLineNumber===r.endLineNumber&&e.getLineMaxColumn(r.startLineNumber)===1){const f=r.startLineNumber,m=this._isMovingDown?f+1:f-1;e.getLineMaxColumn(m)===1?t.addEditOperation(new H(1,1,1,1),null):(t.addEditOperation(new H(f,1,f,1),e.getLineContent(m)),t.addEditOperation(new H(m,1,m,e.getLineMaxColumn(m)),null)),r=new Mt(m,1,m,1)}else{let f,m;if(this._isMovingDown){f=r.endLineNumber+1,m=e.getLineContent(f),t.addEditOperation(new H(f-1,e.getLineMaxColumn(f-1),f,e.getLineMaxColumn(f)),null);let v=m;if(this.shouldAutoIndent(e,r)){const _=this.matchEnterRule(e,u,a,f,r.startLineNumber-1);if(_!==null){const S=vs(e.getLineContent(f)),D=_+Xs(S,a);v=gf(D,a,d)+this.trimStart(m)}else{const S={tokenization:{getLineTokens:E=>E===r.startLineNumber?e.tokenization.getLineTokens(f):e.tokenization.getLineTokens(E),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:E=>E===r.startLineNumber?e.getLineContent(f):e.getLineContent(E)},D=sf(this._autoIndent,S,e.getLanguageIdAtPosition(f,1),r.startLineNumber,u,this._languageConfigurationService);if(D!==null){const E=vs(e.getLineContent(f)),N=Xs(D,a),B=Xs(E,a);N!==B&&(v=gf(N,a,d)+this.trimStart(m))}}t.addEditOperation(new H(r.startLineNumber,1,r.startLineNumber,1),v+`
|
|
52
|
-
`);const y=this.matchEnterRuleMovingDown(e,u,a,r.startLineNumber,f,v);if(y!==null)y!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,d,y);else{const S={tokenization:{getLineTokens:E=>E===r.startLineNumber?e.tokenization.getLineTokens(f):E>=r.startLineNumber+1&&E<=r.endLineNumber+1?e.tokenization.getLineTokens(E-1):e.tokenization.getLineTokens(E),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:E=>E===r.startLineNumber?v:E>=r.startLineNumber+1&&E<=r.endLineNumber+1?e.getLineContent(E-1):e.getLineContent(E)},D=sf(this._autoIndent,S,e.getLanguageIdAtPosition(f,1),r.startLineNumber+1,u,this._languageConfigurationService);if(D!==null){const E=vs(e.getLineContent(r.startLineNumber)),N=Xs(D,a),B=Xs(E,a);if(N!==B){const F=N-B;this.getIndentEditsOfMovingBlock(e,t,r,a,d,F)}}}}else t.addEditOperation(new H(r.startLineNumber,1,r.startLineNumber,1),v+`
|
|
53
|
-
`)}else if(f=r.startLineNumber-1,m=e.getLineContent(f),t.addEditOperation(new H(f,1,f+1,1),null),t.addEditOperation(new H(r.endLineNumber,e.getLineMaxColumn(r.endLineNumber),r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),`
|
|
54
|
-
`+m),this.shouldAutoIndent(e,r)){const v={tokenization:{getLineTokens:y=>y===f?e.tokenization.getLineTokens(r.startLineNumber):e.tokenization.getLineTokens(y),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:y=>y===f?e.getLineContent(r.startLineNumber):e.getLineContent(y)},_=this.matchEnterRule(e,u,a,r.startLineNumber,r.startLineNumber-2);if(_!==null)_!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,d,_);else{const y=sf(this._autoIndent,v,e.getLanguageIdAtPosition(r.startLineNumber,1),f,u,this._languageConfigurationService);if(y!==null){const S=vs(e.getLineContent(r.startLineNumber)),D=Xs(y,a),E=Xs(S,a);if(D!==E){const N=D-E;this.getIndentEditsOfMovingBlock(e,t,r,a,d,N)}}}}}this._selectionId=t.trackSelection(r)}buildIndentConverter(e,t,i){return{shiftIndent:n=>Bu.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>Bu.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,s){if(s){let r=s.indentation;s.indentAction===lm.None||s.indentAction===lm.Indent?r=s.indentation+s.appendText:s.indentAction===lm.IndentOutdent?r=s.indentation:s.indentAction===lm.Outdent&&(r=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(n);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const c=vs(e.getLineContent(n));let d=vs(r);const u=BE(e,n,this._languageConfigurationService);u!==null&&u&2&&(d=t.unshiftIndent(d));const f=Xs(d,i),m=Xs(c,i);return f-m}}return null}matchEnterRuleMovingDown(e,t,i,n,s,r){if(zm(r)>=0){const a=e.getLineMaxColumn(s),c=Fw(this._autoIndent,e,new H(s,a,s,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,c)}else{let a=n-1;for(;a>=1;){const u=e.getLineContent(a);if(zm(u)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const c=e.getLineMaxColumn(a),d=Fw(this._autoIndent,e,new H(a,c,a,c),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,d)}}matchEnterRule(e,t,i,n,s,r){let a=s;for(;a>=1;){let u;if(a===s&&r!==void 0?u=r:u=e.getLineContent(a),zm(u)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const c=e.getLineMaxColumn(a),d=Fw(this._autoIndent,e,new H(a,c,a,c),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,d)}trimStart(e){return e.replace(/^\s+/,"")}shouldAutoIndent(e,t){if(this._autoIndent<4||!e.tokenization.isCheapToTokenize(t.startLineNumber))return!1;const i=e.getLanguageIdAtPosition(t.startLineNumber,1),n=e.getLanguageIdAtPosition(t.endLineNumber,1);return!(i!==n||this._languageConfigurationService.getLanguageConfiguration(i).indentRulesSupport===null)}getIndentEditsOfMovingBlock(e,t,i,n,s,r){for(let a=i.startLineNumber;a<=i.endLineNumber;a++){const c=e.getLineContent(a),d=vs(c),f=Xs(d,n)+r,m=gf(f,n,s);m!==d&&(t.addEditOperation(new H(a,1,a,d.length+1),m),a===i.endLineNumber&&i.endColumn<=d.length+1&&m===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber<i.endLineNumber&&(i=i.setEndPosition(i.endLineNumber,2)),i}};UC=BU([zU(3,cs)],UC);const ou=class ou{static getCollator(){return ou._COLLATOR||(ou._COLLATOR=new Intl.Collator),ou._COLLATOR}constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){const i=VU(e,this.selection,this.descending);i&&t.addEditOperation(i.range,i.text),this.selectionId=t.trackSelection(this.selection)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}static canRun(e,t,i){if(e===null)return!1;const n=aN(e,t,i);if(!n)return!1;for(let s=0,r=n.before.length;s<r;s++)if(n.before[s]!==n.after[s])return!0;return!1}};ou._COLLATOR=null;let Yf=ou;function aN(o,e,t){const i=e.startLineNumber;let n=e.endLineNumber;if(e.endColumn===1&&n--,i>=n)return null;const s=[];for(let a=i;a<=n;a++)s.push(o.getLineContent(a));let r=s.slice(0);return r.sort(Yf.getCollator().compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:n,before:s,after:r}}function VU(o,e,t){const i=aN(o,e,t);return i?En.replace(new H(i.startLineNumber,1,i.endLineNumber,o.getLineMaxColumn(i.endLineNumber)),i.after.join(`
|
|
55
|
-
`)):null}class lN extends Se{constructor(e,t){super(t),this.down=e}run(e,t){if(!t.hasModel())return;const i=t.getSelections().map((r,a)=>({selection:r,index:a,ignore:!1}));i.sort((r,a)=>H.compareRangesUsingStarts(r.selection,a.selection));let n=i[0];for(let r=1;r<i.length;r++){const a=i[r];n.selection.endLineNumber===a.selection.startLineNumber&&(n.index<a.index?a.ignore=!0:(n.ignore=!0,n=a))}const s=[];for(const r of i)s.push(new rN(r.selection,this.down,r.ignore));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class jU extends lN{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:w("lines.copyUp","Copy Line Up"),alias:"Copy Line Up",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"2_line",title:w({key:"miCopyLinesUp",comment:["&& denotes a mnemonic"]},"&&Copy Line Up"),order:1}})}}class UU extends lN{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:w("lines.copyDown","Copy Line Down"),alias:"Copy Line Down",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"2_line",title:w({key:"miCopyLinesDown",comment:["&& denotes a mnemonic"]},"Co&&py Line Down"),order:2}})}}class $U extends Se{constructor(){super({id:"editor.action.duplicateSelection",label:w("duplicateSelection","Duplicate Selection"),alias:"Duplicate Selection",precondition:M.writable,menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"2_line",title:w({key:"miDuplicateSelection",comment:["&& denotes a mnemonic"]},"&&Duplicate Selection"),order:5}})}run(e,t,i){if(!t.hasModel())return;const n=[],s=t.getSelections(),r=t.getModel();for(const a of s)if(a.isEmpty())n.push(new rN(a,!0));else{const c=new Mt(a.endLineNumber,a.endColumn,a.endLineNumber,a.endColumn);n.push(new P2(c,r.getValueInRange(a)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class cN extends Se{constructor(e,t){super(t),this.down=e}run(e,t){const i=e.get(cs),n=[],s=t.getSelections()||[],r=t.getOption(12);for(const a of s)n.push(new UC(a,this.down,r,i));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class qU extends cN{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:w("lines.moveUp","Move Line Up"),alias:"Move Line Up",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"2_line",title:w({key:"miMoveLinesUp",comment:["&& denotes a mnemonic"]},"Mo&&ve Line Up"),order:3}})}}class KU extends cN{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:w("lines.moveDown","Move Line Down"),alias:"Move Line Down",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"2_line",title:w({key:"miMoveLinesDown",comment:["&& denotes a mnemonic"]},"Move &&Line Down"),order:4}})}}class dN extends Se{constructor(e,t){super(t),this.descending=e}run(e,t){if(!t.hasModel())return;const i=t.getModel();let n=t.getSelections();n.length===1&&n[0].isEmpty()&&(n=[new Mt(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);for(const r of n)if(!Yf.canRun(t.getModel(),r,this.descending))return;const s=[];for(let r=0,a=n.length;r<a;r++)s[r]=new Yf(n[r],this.descending);t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class GU extends dN{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:w("lines.sortAscending","Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:M.writable})}}class ZU extends dN{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:w("lines.sortDescending","Sort Lines Descending"),alias:"Sort Lines Descending",precondition:M.writable})}}class XU extends Se{constructor(){super({id:"editor.action.removeDuplicateLines",label:w("lines.deleteDuplicates","Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:M.writable})}run(e,t){if(!t.hasModel())return;const i=t.getModel();if(i.getLineCount()===1&&i.getLineMaxColumn(1)===1)return;const n=[],s=[];let r=0,a=!0,c=t.getSelections();c.length===1&&c[0].isEmpty()&&(c=[new Mt(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))],a=!1);for(const d of c){const u=new Set,f=[];for(let y=d.startLineNumber;y<=d.endLineNumber;y++){const S=i.getLineContent(y);u.has(S)||(f.push(S),u.add(S))}const m=new Mt(d.startLineNumber,1,d.endLineNumber,i.getLineMaxColumn(d.endLineNumber)),v=d.startLineNumber-r,_=new Mt(v,1,v+f.length-1,f[f.length-1].length);n.push(En.replace(m,f.join(`
|
|
56
|
-
`))),s.push(_),r+=d.endLineNumber-d.startLineNumber+1-f.length}t.pushUndoStop(),t.executeEdits(this.id,n,a?s:void 0),t.pushUndoStop()}}const ob=class ob extends Se{constructor(){super({id:ob.ID,label:w("lines.trimTrailingWhitespace","Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:Gn(2089,2102),weight:100}})}run(e,t,i){let n=[];i.reason==="auto-save"&&(n=(t.getSelections()||[]).map(u=>new ut(u.positionLineNumber,u.positionColumn)));const s=t.getSelection();if(s===null)return;const r=e.get(pn),a=t.getModel(),c=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a==null?void 0:a.getLanguageId(),resource:a==null?void 0:a.uri}),d=new HU(s,n,c);t.pushUndoStop(),t.executeCommands(this.id,[d]),t.pushUndoStop()}};ob.ID="editor.action.trimTrailingWhitespace";let $C=ob;class YU extends Se{constructor(){super({id:"editor.action.deleteLines",label:w("lines.delete","Delete Line"),alias:"Delete Line",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:3113,weight:100}})}run(e,t){if(!t.hasModel())return;const i=this._getLinesToRemove(t),n=t.getModel();if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return;let s=0;const r=[],a=[];for(let c=0,d=i.length;c<d;c++){const u=i[c];let f=u.startLineNumber,m=u.endLineNumber,v=1,_=n.getLineMaxColumn(m);m<n.getLineCount()?(m+=1,_=1):f>1&&(f-=1,v=n.getLineMaxColumn(f)),r.push(En.replace(new Mt(f,v,m,_),"")),a.push(new Mt(f-s,u.positionColumn,f-s,u.positionColumn)),s+=u.endLineNumber-u.startLineNumber+1}t.pushUndoStop(),t.executeEdits(this.id,r,a),t.pushUndoStop()}_getLinesToRemove(e){const t=e.getSelections().map(s=>{let r=s.endLineNumber;return s.startLineNumber<s.endLineNumber&&s.endColumn===1&&(r-=1),{startLineNumber:s.startLineNumber,selectionStartColumn:s.selectionStartColumn,endLineNumber:r,positionColumn:s.positionColumn}});t.sort((s,r)=>s.startLineNumber===r.startLineNumber?s.endLineNumber-r.endLineNumber:s.startLineNumber-r.startLineNumber);const i=[];let n=t[0];for(let s=1;s<t.length;s++)n.endLineNumber+1>=t[s].startLineNumber?n.endLineNumber=t[s].endLineNumber:(i.push(n),n=t[s]);return i.push(n),i}}class JU extends Se{constructor(){super({id:"editor.action.indentLines",label:w("lines.indent","Indent Line"),alias:"Indent Line",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,T2.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class QU extends Se{constructor(){super({id:"editor.action.outdentLines",label:w("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:2140,weight:100}})}run(e,t){Bm.Outdent.runEditorCommand(e,t,null)}}class e$ extends Se{constructor(){super({id:"editor.action.insertLineBefore",label:w("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,zE.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class t$ extends Se{constructor(){super({id:"editor.action.insertLineAfter",label:w("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,zE.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class hN extends Se{run(e,t){if(!t.hasModel())return;const i=t.getSelection(),n=this._getRangesToDelete(t),s=[];for(let c=0,d=n.length-1;c<d;c++){const u=n[c],f=n[c+1];H.intersectRanges(u,f)===null?s.push(u):n[c+1]=H.plusRange(u,f)}s.push(n[n.length-1]);const r=this._getEndCursorState(i,s),a=s.map(c=>En.replace(c,""));t.pushUndoStop(),t.executeEdits(this.id,a,r),t.pushUndoStop()}}class i$ extends hN{constructor(){super({id:"deleteAllLeft",label:w("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:2049},weight:100}})}_getEndCursorState(e,t){let i=null;const n=[];let s=0;return t.forEach(r=>{let a;if(r.endColumn===1&&s>0){const c=r.startLineNumber-s;a=new Mt(c,r.startColumn,c,r.startColumn)}else a=new Mt(r.startLineNumber,r.startColumn,r.startLineNumber,r.startColumn);s+=r.endLineNumber-r.startLineNumber,r.intersectRanges(e)?i=a:n.push(a)}),i&&n.unshift(i),n}_getRangesToDelete(e){const t=e.getSelections();if(t===null)return[];let i=t;const n=e.getModel();return n===null?[]:(i.sort(H.compareRangesUsingStarts),i=i.map(s=>{if(s.isEmpty())if(s.startColumn===1){const r=Math.max(1,s.startLineNumber-1),a=s.startLineNumber===1?1:n.getLineLength(r)+1;return new H(r,a,s.startLineNumber,1)}else return new H(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new H(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class n$ extends hN{constructor(){super({id:"deleteAllRight",label:w("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100}})}_getEndCursorState(e,t){let i=null;const n=[];for(let s=0,r=t.length,a=0;s<r;s++){const c=t[s],d=new Mt(c.startLineNumber-a,c.startColumn,c.startLineNumber-a,c.startColumn);c.intersectRanges(e)?i=d:n.push(d)}return i&&n.unshift(i),n}_getRangesToDelete(e){const t=e.getModel();if(t===null)return[];const i=e.getSelections();if(i===null)return[];const n=i.map(s=>{if(s.isEmpty()){const r=t.getLineMaxColumn(s.startLineNumber);return s.startColumn===r?new H(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new H(s.startLineNumber,s.startColumn,s.startLineNumber,r)}return s});return n.sort(H.compareRangesUsingStarts),n}}class s$ extends Se{constructor(){super({id:"editor.action.joinLines",label:w("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(e,t){const i=t.getSelections();if(i===null)return;let n=t.getSelection();if(n===null)return;i.sort(H.compareRangesUsingStarts);const s=[],r=i.reduce((m,v)=>m.isEmpty()?m.endLineNumber===v.startLineNumber?(n.equalsSelection(m)&&(n=v),v):v.startLineNumber>m.endLineNumber+1?(s.push(m),v):new Mt(m.startLineNumber,m.startColumn,v.endLineNumber,v.endColumn):v.startLineNumber>m.endLineNumber?(s.push(m),v):new Mt(m.startLineNumber,m.startColumn,v.endLineNumber,v.endColumn));s.push(r);const a=t.getModel();if(a===null)return;const c=[],d=[];let u=n,f=0;for(let m=0,v=s.length;m<v;m++){const _=s[m],y=_.startLineNumber,S=1;let D=0,E,N;const B=a.getLineLength(_.endLineNumber)-_.endColumn;if(_.isEmpty()||_.startLineNumber===_.endLineNumber){const $=_.getStartPosition();$.lineNumber<a.getLineCount()?(E=y+1,N=a.getLineMaxColumn(E)):(E=$.lineNumber,N=a.getLineMaxColumn($.lineNumber))}else E=_.endLineNumber,N=a.getLineMaxColumn(E);let F=a.getLineContent(y);for(let $=y+1;$<=E;$++){const fe=a.getLineContent($),Pe=a.getLineFirstNonWhitespaceColumn($);if(Pe>=1){let ze=!0;F===""&&(ze=!1),ze&&(F.charAt(F.length-1)===" "||F.charAt(F.length-1)===" ")&&(ze=!1,F=F.replace(/[\s\uFEFF\xA0]+$/g," "));const me=fe.substr(Pe-1);F+=(ze?" ":"")+me,ze?D=me.length+1:D=me.length}else D=0}const Q=new H(y,S,E,N);if(!Q.isEmpty()){let $;_.isEmpty()?(c.push(En.replace(Q,F)),$=new Mt(Q.startLineNumber-f,F.length-D+1,y-f,F.length-D+1)):_.startLineNumber===_.endLineNumber?(c.push(En.replace(Q,F)),$=new Mt(_.startLineNumber-f,_.startColumn,_.endLineNumber-f,_.endColumn)):(c.push(En.replace(Q,F)),$=new Mt(_.startLineNumber-f,_.startColumn,_.startLineNumber-f,F.length-B)),H.intersectRanges(Q,n)!==null?u=$:d.push($)}f+=Q.endLineNumber-Q.startLineNumber}d.unshift(u),t.pushUndoStop(),t.executeEdits(this.id,c,d),t.pushUndoStop()}}class o$ extends Se{constructor(){super({id:"editor.action.transpose",label:w("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:M.writable})}run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=[];for(let r=0,a=i.length;r<a;r++){const c=i[r];if(!c.isEmpty())continue;const d=c.getStartPosition(),u=n.getLineMaxColumn(d.lineNumber);if(d.column>=u){if(d.lineNumber===n.getLineCount())continue;const f=new H(d.lineNumber,Math.max(1,d.column-1),d.lineNumber+1,1),m=n.getValueInRange(f).split("").reverse().join("");s.push(new vp(new Mt(d.lineNumber,Math.max(1,d.column-1),d.lineNumber+1,1),m))}else{const f=new H(d.lineNumber,Math.max(1,d.column-1),d.lineNumber,d.column+1),m=n.getValueInRange(f).split("").reverse().join("");s.push(new oE(f,m,new Mt(d.lineNumber,d.column+1,d.lineNumber,d.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class uh extends Se{run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=t.getOption(132),r=[];for(const a of i)if(a.isEmpty()){const c=a.getStartPosition(),d=t.getConfiguredWordAtPosition(c);if(!d)continue;const u=new H(c.lineNumber,d.startColumn,c.lineNumber,d.endColumn),f=n.getValueInRange(u);r.push(En.replace(u,this._modifyText(f,s)))}else{const c=n.getValueInRange(a);r.push(En.replace(a,this._modifyText(c,s)))}t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop()}}class r$ extends uh{constructor(){super({id:"editor.action.transformToUppercase",label:w("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:M.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class a$ extends uh{constructor(){super({id:"editor.action.transformToLowercase",label:w("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:M.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class qa{constructor(e,t){this._pattern=e,this._flags=t,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}}const rb=class rb extends uh{constructor(){super({id:"editor.action.transformToTitlecase",label:w("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:M.writable})}_modifyText(e,t){const i=rb.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,n=>n.toLocaleUpperCase()):e}};rb.titleBoundary=new qa("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");let lv=rb;const ru=class ru extends uh{constructor(){super({id:"editor.action.transformToSnakecase",label:w("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:M.writable})}_modifyText(e,t){const i=ru.caseBoundary.get(),n=ru.singleLetters.get();return!i||!n?e:e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase()}};ru.caseBoundary=new qa("(\\p{Ll})(\\p{Lu})","gmu"),ru.singleLetters=new qa("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");let ff=ru;const ab=class ab extends uh{constructor(){super({id:"editor.action.transformToCamelcase",label:w("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:M.writable})}_modifyText(e,t){const i=ab.wordBoundary.get();if(!i)return e;const n=e.split(i);return n.shift()+n.map(r=>r.substring(0,1).toLocaleUpperCase()+r.substring(1)).join("")}};ab.wordBoundary=new qa("[_\\s-]","gm");let cv=ab;const au=class au extends uh{constructor(){super({id:"editor.action.transformToPascalcase",label:w("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:M.writable})}_modifyText(e,t){const i=au.wordBoundary.get(),n=au.wordBoundaryToMaintain.get();return!i||!n?e:e.split(n).map(a=>a.split(i)).flat().map(a=>a.substring(0,1).toLocaleUpperCase()+a.substring(1)).join("")}};au.wordBoundary=new qa("[_\\s-]","gm"),au.wordBoundaryToMaintain=new qa("(?<=\\.)","gm");let dv=au;const wl=class wl extends uh{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(t=>t.isSupported())}constructor(){super({id:"editor.action.transformToKebabcase",label:w("editor.transformToKebabcase","Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:M.writable})}_modifyText(e,t){const i=wl.caseBoundary.get(),n=wl.singleLetters.get(),s=wl.underscoreBoundary.get();return!i||!n||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(n,"$1-$2").toLocaleLowerCase()}};wl.caseBoundary=new qa("(\\p{Ll})(\\p{Lu})","gmu"),wl.singleLetters=new qa("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),wl.underscoreBoundary=new qa("(\\S)(_)(\\S)","gm");let hv=wl;ie(jU);ie(UU);ie($U);ie(qU);ie(KU);ie(GU);ie(ZU);ie(XU);ie($C);ie(YU);ie(JU);ie(QU);ie(e$);ie(t$);ie(i$);ie(n$);ie(s$);ie(o$);ie(r$);ie(a$);ff.caseBoundary.isSupported()&&ff.singleLetters.isSupported()&&ie(ff);cv.wordBoundary.isSupported()&&ie(cv);dv.wordBoundary.isSupported()&&ie(dv);lv.titleBoundary.isSupported()&&ie(lv);hv.isSupported()&&ie(hv);var l$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Em=function(o,e){return function(t,i){e(t,i,o)}},t_;const uN=new yi("LinkedEditingInputVisible",!1),c$="linked-editing-decoration";var Yl;let sg=(Yl=class extends Be{static get(e){return e.getContribution(t_.ID)}constructor(e,t,i,n,s){super(),this.languageConfigurationService=n,this._syncRangesToken=0,this._localToDispose=this._register(new Oe),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=uN.bindTo(t),this._debounceInformation=s.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new Oe),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(r=>{(r.hasChanged(70)||r.hasChanged(94))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}reinitialize(e){const t=this._editor.getModel(),i=t!==null&&(this._editor.getOption(70)||this._editor.getOption(94))&&this._providers.has(t);if(i===this._enabled&&!e||(this._enabled=i,this.clearRanges(),this._localToDispose.clear(),!i||t===null))return;this._localToDispose.add(es.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const n=new ic(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},r=new ic(0),a=c=>{this._rangeSyncTriggerPromise=r.trigger(()=>this._syncRanges(c))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{s()})),this._localToDispose.add(this._editor.onDidChangeModelContent(c=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const d=this._currentDecorations.getRange(0);if(d&&c.changes.every(u=>d.intersectRanges(u.range))){a(this._syncRangesToken);return}}s()})),this._localToDispose.add({dispose:()=>{n.dispose(),r.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;const t=this._editor.getModel(),i=this._currentDecorations.getRange(0);if(!i||i.startLineNumber!==i.endLineNumber)return this.clearRanges();const n=t.getValueInRange(i);if(this._currentWordPattern){const r=n.match(this._currentWordPattern);if((r?r[0].length:0)!==n.length)return this.clearRanges()}const s=[];for(let r=1,a=this._currentDecorations.length;r<a;r++){const c=this._currentDecorations.getRange(r);if(c)if(c.startLineNumber!==c.endLineNumber)s.push({range:c,text:n});else{let d=t.getValueInRange(c),u=n,f=c.startColumn,m=c.endColumn;const v=Pp(d,u);f+=v,d=d.substr(v),u=u.substr(v);const _=M2(d,u);m-=_,d=d.substr(0,d.length-_),u=u.substr(0,u.length-_),(f!==m||u.length!==0)&&s.push({range:new H(c.startLineNumber,f,c.endLineNumber,m),text:u})}}if(s.length!==0)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;const r=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",s),this._editor._getViewModel().setPrevEditOperationType(r)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequestCts&&(this._currentRequestCts.cancel(),this._currentRequestCts=null,this._currentRequestPosition=null)}async updateRanges(e=!1){if(!this._editor.hasModel()){this.clearRanges();return}const t=this._editor.getPosition();if(!this._enabled&&!e||this._editor.getSelections().length>1){this.clearRanges();return}const i=this._editor.getModel(),n=i.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const r=this._currentDecorations.getRange(0);if(r&&r.containsPosition(t))return}}this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=n;const s=this._currentRequestCts=new gs;try{const r=new oo(!1),a=await gN(this._providers,i,t,s.token);if(this._debounceInformation.update(i,r.elapsed()),s!==this._currentRequestCts||(this._currentRequestCts=null,n!==i.getVersionId()))return;let c=[];a!=null&&a.ranges&&(c=a.ranges),this._currentWordPattern=(a==null?void 0:a.wordPattern)||this._languageWordPattern;let d=!1;for(let f=0,m=c.length;f<m;f++)if(H.containsPosition(c[f],t)){if(d=!0,f!==0){const v=c[f];c.splice(f,1),c.unshift(v)}break}if(!d){this.clearRanges();return}const u=c.map(f=>({range:f,options:t_.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(u),this._syncRangesToken++}catch(r){dc(r)||on(r),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}},t_=Yl,Yl.ID="editor.contrib.linkedEditing",Yl.DECORATION=pi.register({description:"linked-editing",stickiness:0,className:c$}),Yl);sg=t_=l$([Em(1,Ri),Em(2,gt),Em(3,cs),Em(4,Wo)],sg);class d$ extends Se{constructor(){super({id:"editor.action.linkedEditing",label:w("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:le.and(M.writable,M.hasRenameProvider),kbOpts:{kbExpr:M.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(Un),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return nn.isUri(n)&&ut.isIPosition(s)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(s),r.invokeWithinContext(a=>(this.reportTelemetry(a,r),this.run(a,r))))},on):super.runCommand(e,t)}run(e,t){const i=sg.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const h$=js.bindToContribution(sg.get);bt(new h$({id:"cancelLinkedEditingInput",precondition:uN,handler:o=>o.clearRanges(),kbOpts:{kbExpr:M.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function gN(o,e,t,i){const n=o.ordered(e);return L0(n.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(r){jn(r);return}}),s=>!!s&&bo(s==null?void 0:s.ranges))}at("editor.linkedEditingBackground",{dark:ui.fromHex("#f00").transparent(.3),light:ui.fromHex("#f00").transparent(.3),hcDark:ui.fromHex("#f00").transparent(.3),hcLight:ui.white},w("editorLinkedEditingBackground","Background color when the editor auto renames on type."));Us("_executeLinkedEditingProvider",(o,e,t)=>{const{linkedEditingRangeProvider:i}=o.get(gt);return gN(i,e,t,ii.None)});oi(sg.ID,sg,1);ie(d$);let u$=class{constructor(e,t){this._link=e,this._provider=t}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(e){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,e)).then(t=>(this._link=t||this._link,this._link.url?this.resolve(e):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}};class uv{constructor(e){this._disposables=new Oe;let t=[];for(const[i,n]of e){const s=i.links.map(r=>new u$(r,n));t=uv._union(t,s),IE(i)&&this._disposables.add(i)}this.links=t}dispose(){this._disposables.dispose(),this.links.length=0}static _union(e,t){const i=[];let n,s,r,a;for(n=0,r=0,s=e.length,a=t.length;n<s&&r<a;){const c=e[n],d=t[r];if(H.areIntersectingOrTouching(c.range,d.range)){n++;continue}H.compareRangesUsingStarts(c.range,d.range)<0?(i.push(c),n++):(i.push(d),r++)}for(;n<s;n++)i.push(e[n]);for(;r<a;r++)i.push(t[r]);return i}}function fN(o,e,t){const i=[],n=o.ordered(e).reverse().map((s,r)=>Promise.resolve(s.provideLinks(e,t)).then(a=>{a&&(i[r]=[a,s])},jn));return Promise.all(n).then(()=>{const s=new uv(Ka(i));return t.isCancellationRequested?(s.dispose(),new uv([])):s})}dn.registerCommand("_executeLinkProvider",async(o,...e)=>{let[t,i]=e;Oi(t instanceof nn),typeof i!="number"&&(i=0);const{linkProvider:n}=o.get(gt),s=o.get(As).getModel(t);if(!s)return[];const r=await fN(n,s,ii.None);if(!r)return[];for(let c=0;c<Math.min(i,r.links.length);c++)await r.links[c].resolve(ii.None);const a=r.links.slice(0);return r.dispose(),a});var g$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Pm=function(o,e){return function(t,i){e(t,i,o)}},qC,Cd;let Jf=(Cd=class extends Be{static get(e){return e.getContribution(qC.ID)}constructor(e,t,i,n,s){super(),this.editor=e,this.openerService=t,this.notificationService=i,this.languageFeaturesService=n,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=s.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new ts(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new sw(e));this._register(r.onMouseMoveOrRelevantKeyDown(([a,c])=>{this._onEditorMouseMove(a,c)})),this._register(r.onExecute(a=>{this.onEditorMouseUp(a)})),this._register(r.onCancel(a=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(a=>{a.hasChanged(71)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(a=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(a=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(a=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(a=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(71))return;const e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=us(t=>fN(this.providers,e,t));try{const t=new oo(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){on(t)}finally{this.computePromise=null}}}updateDecorations(e){const t=this.editor.getOption(78)==="altKey",i=[],n=Object.keys(this.currentOccurrences);for(const r of n){const a=this.currentOccurrences[r];i.push(a.decorationId)}const s=[];if(e)for(const r of e)s.push(hu.decoration(r,t));this.editor.changeDecorations(r=>{const a=r.deltaDecorations(i,s);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let c=0,d=a.length;c<d;c++){const u=new hu(e[c],a[c]);this.currentOccurrences[u.decorationId]=u}})}_onEditorMouseMove(e,t){const i=this.editor.getOption(78)==="altKey";if(this.isEnabled(e,t)){this.cleanUpActiveLinkDecoration();const n=this.getLinkOccurrence(e.target.position);n&&this.editor.changeDecorations(s=>{n.activate(s,i),this.activeLinkDecorationId=n.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const e=this.editor.getOption(78)==="altKey";if(this.activeLinkDecorationId){const t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(i=>{t.deactivate(i,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;const t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,i=!1){if(!this.openerService)return;const{link:n}=e;n.resolve(ii.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===Fs.file&&s.startsWith(`${Fs.file}:`)){const a=nn.parse(s);if(a.scheme===Fs.file){const c=N2(a);let d=null;c.startsWith("/./")||c.startsWith("\\.\\")?d=`.${c.substr(1)}`:(c.startsWith("//./")||c.startsWith("\\\\.\\"))&&(d=`.${c.substr(2)}`),d&&(s=R2(r,d))}}}return this.openerService.open(s,{openToSide:t,fromUserGesture:i,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},s=>{const r=s instanceof Error?s.message:s;r==="invalid"?this.notificationService.warn(w("invalid.url","Failed to open this link because it is not well-formed: {0}",n.url.toString())):r==="missing"?this.notificationService.warn(w("missing.url","Failed to open this link because its target is missing.")):on(s)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;const t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(const i of t){const n=this.currentOccurrences[i.id];if(n)return n}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey))}stop(){var e;this.computeLinks.cancel(),this.activeLinksList&&((e=this.activeLinksList)==null||e.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}},qC=Cd,Cd.ID="editor.linkDetector",Cd);Jf=qC=g$([Pm(1,Mr),Pm(2,Rs),Pm(3,gt),Pm(4,Wo)],Jf);const Mk={general:pi.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:pi.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class hu{static decoration(e,t){return{range:e.range,options:hu._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n={...i?Mk.active:Mk.general};return n.hoverMessage=f$(e,t),n}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,hu._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,hu._getOptions(this.link,t,!1))}}function f$(o,e){const t=o.url&&/^command:/i.test(o.url.toString()),i=o.tooltip?o.tooltip:t?w("links.navigate.executeCmd","Execute command"):w("links.navigate.follow","Follow link"),n=e?ga?w("links.navigate.kb.meta.mac","cmd + click"):w("links.navigate.kb.meta","ctrl + click"):ga?w("links.navigate.kb.alt.mac","option + click"):w("links.navigate.kb.alt","alt + click");if(o.url){let s="";if(/^command:/i.test(o.url.toString())){const a=o.url.toString().match(/^command:([^?#]+)/);if(a){const c=a[1];s=w("tooltip.explanation","Execute command {0}",c)}}return new Is("",!0).appendLink(o.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${n})`)}else return new Is().appendText(`${i} (${n})`)}class p$ extends Se{constructor(){super({id:"editor.action.openLink",label:w("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=Jf.get(t);if(!i||!t.hasModel())return;const n=t.getSelections();for(const s of n){const r=i.getLinkOccurrence(s.getEndPosition());r&&i.openLinkOccurrence(r,!1)}}}oi(Jf.ID,Jf,1);ie(p$);const K1=class K1 extends Be{constructor(e){super(),this._editor=e,this._register(this._editor.onMouseDown(t=>{const i=this._editor.getOption(118);i>=0&&t.target.type===6&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}};K1.ID="editor.contrib.longLinesHelper";let gv=K1;oi(gv.ID,gv,2);const m$=at("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},w("wordHighlight","Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0);at("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},w("wordHighlightStrong","Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0);at("editor.wordHighlightTextBackground",m$,w("wordHighlightText","Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);const _$=at("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Hd,hcLight:Hd},w("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));at("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Hd,hcLight:Hd},w("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));at("editor.wordHighlightTextBorder",_$,w("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const v$=at("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",w("overviewRulerWordHighlightForeground","Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),b$=at("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",w("overviewRulerWordHighlightStrongForeground","Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),w$=at("editorOverviewRuler.wordHighlightTextForeground",VE,w("overviewRulerWordHighlightTextForeground","Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0),y$=pi.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Yn(b$),position:aa.Center},minimap:{color:Yn(Wb),position:1}}),S$=pi.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Yn(w$),position:aa.Center},minimap:{color:Yn(Wb),position:1}}),C$=pi.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Yn(VE),position:aa.Center},minimap:{color:Yn(Wb),position:1}}),x$=pi.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),L$=pi.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Yn(v$),position:aa.Center},minimap:{color:Yn(Wb),position:1}});function I$(o){return o===v_.Write?y$:o===v_.Text?S$:L$}function k$(o){return o?x$:C$}Eb((o,e)=>{const t=o.getColor(A2);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var D$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},E$=function(o,e){return function(t,i){e(t,i,o)}},KC;function uc(o,e){const t=e.filter(i=>!o.find(n=>n.equals(i)));if(t.length>=1){const i=t.map(s=>`line ${s.viewState.position.lineNumber} column ${s.viewState.position.column}`).join(", "),n=t.length===1?w("cursorAdded","Cursor added: {0}",i):w("cursorsAdded","Cursors added: {0}",i);Ru(n)}}class P$ extends Se{constructor(){super({id:"editor.action.insertCursorAbove",label:w("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"3_multi",title:w({key:"miInsertCursorAbove",comment:["&& denotes a mnemonic"]},"&&Add Cursor Above"),order:2}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&i.logicalLine===!1&&(n=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const r=s.getCursorStates();s.setCursorStates(i.source,3,x0.addCursorUp(s,r,n)),s.revealTopMostCursor(i.source),uc(r,s.getCursorStates())}}class T$ extends Se{constructor(){super({id:"editor.action.insertCursorBelow",label:w("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"3_multi",title:w({key:"miInsertCursorBelow",comment:["&& denotes a mnemonic"]},"A&&dd Cursor Below"),order:3}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&i.logicalLine===!1&&(n=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const r=s.getCursorStates();s.setCursorStates(i.source,3,x0.addCursorDown(s,r,n)),s.revealBottomMostCursor(i.source),uc(r,s.getCursorStates())}}class M$ extends Se{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:w("mutlicursor.insertAtEndOfEachLineSelected","Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"3_multi",title:w({key:"miInsertCursorAtEndOfEachLineSelected",comment:["&& denotes a mnemonic"]},"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(e,t,i){if(!e.isEmpty()){for(let n=e.startLineNumber;n<e.endLineNumber;n++){const s=t.getLineMaxColumn(n);i.push(new Mt(n,s,n,s))}e.endColumn>1&&i.push(new Mt(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn))}}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=t.getSelections(),s=t._getViewModel(),r=s.getCursorStates(),a=[];n.forEach(c=>this.getCursorsForSelection(c,i,a)),a.length>0&&t.setSelections(a),uc(r,s.getCursorStates())}}class N$ extends Se{constructor(){super({id:"editor.action.addCursorsToBottom",label:w("mutlicursor.addCursorsToBottom","Add Cursors To Bottom"),alias:"Add Cursors To Bottom",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),n=t.getModel().getLineCount(),s=[];for(let c=i[0].startLineNumber;c<=n;c++)s.push(new Mt(c,i[0].startColumn,c,i[0].endColumn));const r=t._getViewModel(),a=r.getCursorStates();s.length>0&&t.setSelections(s),uc(a,r.getCursorStates())}}class R$ extends Se{constructor(){super({id:"editor.action.addCursorsToTop",label:w("mutlicursor.addCursorsToTop","Add Cursors To Top"),alias:"Add Cursors To Top",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),n=[];for(let a=i[0].startLineNumber;a>=1;a--)n.push(new Mt(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();n.length>0&&t.setSelections(n),uc(r,s.getCursorStates())}}class Tm{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class Qf{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new Qf(e,t,!1,i.searchString,i.wholeWord,i.matchCase,null);let n=!1,s,r;const a=e.getSelections();a.length===1&&a[0].isEmpty()?(n=!0,s=!0,r=!0):(s=i.wholeWord,r=i.matchCase);const c=e.getSelection();let d,u=null;if(c.isEmpty()){const f=e.getConfiguredWordAtPosition(c.getStartPosition());if(!f)return null;d=f.word,u=new Mt(c.startLineNumber,f.startColumn,c.startLineNumber,f.endColumn)}else d=e.getModel().getValueInRange(c).replace(/\r\n/g,`
|
|
57
|
-
`);return new Qf(e,t,n,d,s,r,u)}constructor(e,t,i,n,s,r,a){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=i,this.searchText=n,this.wholeWord=s,this.matchCase=r,this.currentMatch=a}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new Tm(t.concat(e),e,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new Tm(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1);return i?new Mt(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new Tm(t.concat(e),e,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new Tm(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1);return i?new Mt(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}selectAll(e){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();const t=this._editor.getModel();return e?t.findMatches(this.searchText,e,!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1,1073741824):t.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1,1073741824)}}const lb=class lb extends Be{static get(e){return e.getContribution(lb.ID)}constructor(e){super(),this._sessionDispose=this._register(new Oe),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=Qf.create(this._editor,e);if(!t)return;this._session=t;const i={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(i.wholeWordOverride=1,i.matchCaseOverride=1,i.isRegexOverride=2),e.getState().change(i,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(n=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(n=>{(n.matchCase||n.wholeWord)&&this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){const e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;const i=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return i?new Mt(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){const t=this._editor.getSelections();if(t.length>1){const n=e.getState().matchCase;if(!pN(this._editor.getModel(),t,n)){const r=this._editor.getModel(),a=[];for(let c=0,d=t.length;c<d;c++)a[c]=this._expandEmptyToWord(r,t[c]);this._editor.setSelections(a);return}}}this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(e){if(!this._editor.hasModel())return;let t=null;const i=e.getState();if(i.isRevealed&&i.searchString.length>0&&i.isRegex){const n=this._editor.getModel();i.searchScope?t=n.findMatches(i.searchString,i.searchScope,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(132):null,!1,1073741824):t=n.findMatches(i.searchString,!0,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(132):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(i.searchScope)}if(t.length>0){const n=this._editor.getSelection();for(let s=0,r=t.length;s<r;s++){const a=t[s];if(a.range.intersectRanges(n)){t[s]=t[0],t[0]=a;break}}this._setSelections(t.map(s=>new Mt(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}};lb.ID="editor.contrib.multiCursorController";let og=lb;class bg extends Se{run(e,t){const i=og.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=zs.get(t);if(r)this._run(i,r);else{const a=e.get(qt).createInstance(zs,t);this._run(i,a),a.dispose()}uc(s,n.getCursorStates())}}}class A$ extends bg{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:w("addSelectionToNextFindMatch","Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:2082,weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"3_multi",title:w({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class O$ extends bg{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:w("addSelectionToPreviousFindMatch","Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"3_multi",title:w({key:"miAddSelectionToPreviousFindMatch",comment:["&& denotes a mnemonic"]},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class F$ extends bg{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:w("moveSelectionToNextFindMatch","Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:Gn(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class H$ extends bg{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:w("moveSelectionToPreviousFindMatch","Move Last Selection To Previous Find Match"),alias:"Move Last Selection To Previous Find Match",precondition:void 0})}_run(e,t){e.moveSelectionToPreviousFindMatch(t)}}class W$ extends bg{constructor(){super({id:"editor.action.selectHighlights",label:w("selectAllOccurrencesOfFindMatch","Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:3114,weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"3_multi",title:w({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class B$ extends bg{constructor(){super({id:"editor.action.changeAll",label:w("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:le.and(M.writable,M.editorTextFocus),kbOpts:{kbExpr:M.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class z${constructor(e,t,i,n,s){this._model=e,this._searchText=t,this._matchCase=i,this._wordSeparators=n,this._modelVersionId=this._model.getVersionId(),this._cachedFindMatches=null,s&&this._model===s._model&&this._searchText===s._searchText&&this._matchCase===s._matchCase&&this._wordSeparators===s._wordSeparators&&this._modelVersionId===s._modelVersionId&&(this._cachedFindMatches=s._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(e=>e.range),this._cachedFindMatches.sort(H.compareRangesUsingStarts)),this._cachedFindMatches}}var xd;let fv=(xd=class extends Be{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(109),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new ts(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(n=>{this._isEnabled=e.getOption(109)})),this._register(e.onDidChangeCursorSelection(n=>{this._isEnabled&&(n.selection.isEmpty()?n.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(n=>{this._setState(null)})),this._register(e.onDidChangeModelContent(n=>{this._isEnabled&&this.updateSoon.schedule()}));const i=zs.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(KC._createState(this.state,this._isEnabled,this.editor))}static _createState(e,t,i){if(!t||!i.hasModel())return null;const n=i.getSelection();if(n.startLineNumber!==n.endLineNumber)return null;const s=og.get(i);if(!s)return null;const r=zs.get(i);if(!r)return null;let a=s.getSession(r);if(!a){const u=i.getSelections();if(u.length>1){const m=r.getState().matchCase;if(!pN(i.getModel(),u,m))return null}a=Qf.create(i,r)}if(!a||a.currentMatch||/^[ \t]+$/.test(a.searchText)||a.searchText.length>200)return null;const c=r.getState(),d=c.matchCase;if(c.isRevealed){let u=c.searchString;d||(u=u.toLowerCase());let f=a.searchText;if(d||(f=f.toLowerCase()),u===f&&a.matchCase===c.matchCase&&a.wholeWord===c.wholeWord&&!c.isRegex)return null}return new z$(i.getModel(),a.searchText,a.matchCase,a.wholeWord?i.getOption(132):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;const t=this.editor.getModel();if(t.isTooLargeForTokenization())return;const i=this.state.findMatches(),n=this.editor.getSelections();n.sort(H.compareRangesUsingStarts);const s=[];for(let d=0,u=0,f=i.length,m=n.length;d<f;){const v=i[d];if(u>=m)s.push(v),d++;else{const _=H.compareRangesUsingStarts(v,n[u]);_<0?((n[u].isEmpty()||!H.areIntersecting(v,n[u]))&&s.push(v),d++):(_>0||d++,u++)}}const r=this.editor.getOption(81)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,c=s.map(d=>({range:d,options:k$(a)}));this._decorations.set(c)}dispose(){this._setState(null),super.dispose()}},KC=xd,xd.ID="editor.contrib.selectionHighlighter",xd);fv=KC=D$([E$(1,gt)],fv);function pN(o,e,t){const i=Nk(o,e[0],!t);for(let n=1,s=e.length;n<s;n++){const r=e[n];if(r.isEmpty())return!1;const a=Nk(o,r,!t);if(i!==a)return!1}return!0}function Nk(o,e,t){const i=o.getValueInRange(e);return t?i.toLowerCase():i}class V$ extends Se{constructor(){super({id:"editor.action.focusNextCursor",label:w("mutlicursor.focusNextCursor","Focus Next Cursor"),metadata:{description:w("mutlicursor.focusNextCursor.description","Focuses the next cursor"),args:[]},alias:"Focus Next Cursor",precondition:void 0})}run(e,t,i){if(!t.hasModel())return;const n=t._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const s=Array.from(n.getCursorStates()),r=s.shift();r&&(s.push(r),n.setCursorStates(i.source,3,s),n.revealPrimaryCursor(i.source,!0),uc(s,n.getCursorStates()))}}class j$ extends Se{constructor(){super({id:"editor.action.focusPreviousCursor",label:w("mutlicursor.focusPreviousCursor","Focus Previous Cursor"),metadata:{description:w("mutlicursor.focusPreviousCursor.description","Focuses the previous cursor"),args:[]},alias:"Focus Previous Cursor",precondition:void 0})}run(e,t,i){if(!t.hasModel())return;const n=t._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const s=Array.from(n.getCursorStates()),r=s.pop();r&&(s.unshift(r),n.setCursorStates(i.source,3,s),n.revealPrimaryCursor(i.source,!0),uc(s,n.getCursorStates()))}}oi(og.ID,og,4);oi(fv.ID,fv,1);ie(P$);ie(T$);ie(M$);ie(A$);ie(O$);ie(F$);ie(H$);ie(W$);ie(B$);ie(N$);ie(R$);ie(V$);ie(j$);const U$="editor.action.inlineEdit.accept",$$="editor.action.inlineEdit.reject",q$="editor.action.inlineEdit.jumpTo",K$="editor.action.inlineEdit.jumpBack";var G$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Z$=function(o,e){return function(t,i){e(t,i,o)}};const _y="inline-edit";let GC=class extends Be{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=wo(this,!1),this.currentTextModel=Ys(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=Zi(this,n=>{var E;if(this.isDisposed.read(n))return;const s=this.currentTextModel.read(n);if(s!==this.model.targetTextModel.read(n))return;const r=this.model.ghostText.read(n);if(!r)return;let a=(E=this.model.range)==null?void 0:E.read(n);a&&a.startLineNumber===a.endLineNumber&&a.startColumn===a.endColumn&&(a=void 0);const c=(a?a.startLineNumber===a.endLineNumber:!0)&&r.parts.length===1&&r.parts[0].lines.length===1,d=r.parts.length===1&&r.parts[0].lines.every(N=>N.length===0),u=[],f=[];function m(N,B){if(f.length>0){const F=f[f.length-1];B&&F.decorations.push(new Nf(F.content.length+1,F.content.length+1+N[0].length,B,0)),F.content+=N[0],N=N.slice(1)}for(const F of N)f.push({content:F,decorations:B?[new Nf(1,F.length+1,B,0)]:[]})}const v=s.getLineContent(r.lineNumber);let _,y=0;if(!d&&(c||!a)){for(const N of r.parts){let B=N.lines;a&&!c&&(m(B,_y),B=[]),_===void 0?(u.push({column:N.column,text:B[0],preview:N.preview}),B=B.slice(1)):m([v.substring(y,N.column-1)],void 0),B.length>0&&(m(B,_y),_===void 0&&N.column<=v.length&&(_=N.column)),y=N.column-1}_!==void 0&&m([v.substring(y)],void 0)}const S=_!==void 0?new XM(_,v.length+1):void 0,D=c||!a?r.lineNumber:a.endLineNumber-1;return{inlineTexts:u,additionalLines:f,hiddenRange:S,lineNumber:D,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s,range:a,isSingleLine:c,isPureRemove:d}}),this.decorations=Zi(this,n=>{const s=this.uiState.read(n);if(!s)return[];const r=[];if(s.hiddenRange&&r.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"inline-edit-hidden",description:"inline-edit-hidden"}}),s.range){const a=[];if(s.isSingleLine)a.push(s.range);else if(!s.isPureRemove){const c=s.range.endLineNumber-s.range.startLineNumber;for(let d=0;d<c;d++){const u=s.range.startLineNumber+d,f=s.targetTextModel.getLineFirstNonWhitespaceColumn(u),m=s.targetTextModel.getLineLastNonWhitespaceColumn(u),v=new H(u,f,u,m);a.push(v)}}for(const c of a)r.push({range:c,options:I0})}if(s.range&&!s.isSingleLine&&s.isPureRemove){const a=new H(s.range.startLineNumber,1,s.range.endLineNumber-1,1);r.push({range:a,options:k0})}for(const a of s.inlineTexts)r.push({range:H.fromPositions(new ut(s.lineNumber,a.column)),options:{description:_y,after:{content:a.text,inlineClassName:a.preview?"inline-edit-decoration-preview":"inline-edit-decoration",cursorStops:qh.Left},showIfCollapsed:!0}});return r}),this._register(gn(()=>{this.isDisposed.set(!0,void 0)})),this._register(YM(this.editor,this.decorations))}};GC=G$([Z$(2,Rr)],GC);var C1=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Jr=function(o,e){return function(t,i){e(t,i,o)}},i_;let ZC=class extends Be{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Ys(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=Zi(this,n=>{var c,d;const s=(c=this.model.read(n))==null?void 0:c.model.ghostText.read(n);if(!this.alwaysShowToolbar.read(n)||!s||s.parts.length===0)return this.sessionPosition=void 0,null;const r=s.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==s.lineNumber&&(this.sessionPosition=void 0);const a=new ut(s.lineNumber,Math.min(r,((d=this.sessionPosition)==null?void 0:d.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Lp((n,s)=>{if(!this.model.read(n)||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(XC,this.editor,!0,this.position));e.addContentWidget(a),s.add(gn(()=>e.removeContentWidget(a)))}))}};ZC=C1([Jr(2,qt)],ZC);var Jl;let XC=(Jl=class extends Be{constructor(e,t,i,n,s,r){super(),this.editor=e,this.withBorder=t,this._position=i,this._contextKeyService=s,this._menuService=r,this.id=`InlineEditHintsContentWidget${i_.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Jo("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[Jo("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(Ye.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(n.createInstance(YC,this.nodes.toolBar,this.editor,Ye.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:a=>a.startsWith("primary")},actionViewItemProvider:(a,c)=>{if(a instanceof Hu)return n.createInstance(X$,a,void 0)},telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{i_._dropDownVisible=a})),this._register(Sn(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(Sn(a=>{const c=[];for(const[d,u]of this.inlineCompletionsActionsMenus.getActions())for(const f of u)f instanceof Hu&&c.push(f);c.length>0&&c.unshift(new kf),this.toolBar.setAdditionalSecondaryActions(c)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},i_=Jl,Jl._dropDownVisible=!1,Jl.id=0,Jl);XC=i_=C1([Jr(3,qt),Jr(4,Ri),Jr(5,nh)],XC);class X$ extends $D{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Jo("div.keybinding").root;this._register(new a0(t,l0,{disableTitle:!0,...qD})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let YC=class extends KD{constructor(e,t,i,n,s,r,a,c,d,u){super(e,{resetMenu:i,...n},s,r,a,c,d,u),this.editor=t,this.menuId=i,this.options2=n,this.menuService=s,this.contextKeyService=r,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this._store.add(this.editor.onDidChangeCursorPosition(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){var i,n,s,r,a,c,d;const e=[],t=[];f0(this.menu,(i=this.options2)==null?void 0:i.menuOptions,{primary:e,secondary:t},(s=(n=this.options2)==null?void 0:n.toolbarOptions)==null?void 0:s.primaryGroup,(a=(r=this.options2)==null?void 0:r.toolbarOptions)==null?void 0:a.shouldInlineSubmenu,(d=(c=this.options2)==null?void 0:c.toolbarOptions)==null?void 0:d.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setAdditionalSecondaryActions(e){ua(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};YC=C1([Jr(4,nh),Jr(5,Ri),Jr(6,lg),Jr(7,Zn),Jr(8,ls),Jr(9,Nr)],YC);var mN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},n_=function(o,e){return function(t,i){e(t,i,o)}},Zg,JC;function*Y$(o,e,t=1){e===void 0&&([e,o]=[o,0]);for(let i=o;i<e;i+=t)yield i}function vy(o){var i;const e=((i=o[0].match(/^\s*/))==null?void 0:i[0])??"",t=e.length;return{text:o.map(n=>n.replace(new RegExp("^"+e),"")),shift:t}}var Ld;let QC=(Ld=class extends Be{static _createUniqueUri(){return nn.from({scheme:"inline-edit-widget",path:new Date().toString()+String(Zg._modelId++)})}constructor(e,t,i,n,s){super(),this._editor=e,this._model=t,this._instantiationService=i,this._diffProviderFactoryService=n,this._modelService=s,this._position=Zi(this,r=>{const a=this._model.read(r);if(!a||a.text.length===0||a.range.startLineNumber===a.range.endLineNumber&&!(a.range.startColumn===a.range.endColumn&&a.range.startColumn===1))return null;const c=this._editor.getModel();if(!c)return null;const d=Array.from(Y$(a.range.startLineNumber,a.range.endLineNumber+1)),u=d.map(y=>c.getLineLastNonWhitespaceColumn(y)),f=Math.max(...u),m=d[u.indexOf(f)],v=new ut(m,f);return{top:a.range.startLineNumber,left:v}}),this._text=Zi(this,r=>{const a=this._model.read(r);if(!a)return{text:"",shift:0};const c=vy(a.text.split(`
|
|
58
|
-
`));return{text:c.text.join(`
|
|
59
|
-
`),shift:c.shift}}),this._originalModel=nc(()=>this._modelService.createModel("",null,Zg._createUniqueUri())).keepObserved(this._store),this._modifiedModel=nc(()=>this._modelService.createModel("",null,Zg._createUniqueUri())).keepObserved(this._store),this._diff=Zi(this,r=>{var a,c;return(c=(a=this._diffPromise.read(r))==null?void 0:a.promiseResult.read(r))==null?void 0:c.data}),this._diffPromise=Zi(this,r=>{const a=this._model.read(r);if(!a)return;const c=this._editor.getModel();if(!c)return;const d=vy(c.getValueInRange(a.range).split(`
|
|
60
|
-
`)).text.join(`
|
|
61
|
-
`),u=vy(a.text.split(`
|
|
62
|
-
`)).text.join(`
|
|
63
|
-
`);this._originalModel.get().setValue(d),this._modifiedModel.get().setValue(u);const f=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return jE.fromFn(async()=>{const m=await f.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},ii.None);if(!m.identical)return m.changes})}),this._register(Lp((r,a)=>{if(!this._model.read(r)||this._position.get()===null)return;const d=a.add(this._instantiationService.createInstance(ex,this._editor,this._position,this._text.map(u=>u.text),this._text.map(u=>u.shift),this._diff));e.addOverlayWidget(d),a.add(gn(()=>e.removeOverlayWidget(d)))}))}},Zg=Ld,Ld._modelId=0,Ld);QC=Zg=mN([n_(2,qt),n_(3,D0),n_(4,As)],QC);var Id;let ex=(Id=class extends Be{constructor(e,t,i,n,s,r){var a;super(),this._editor=e,this._position=t,this._text=i,this._shift=n,this._diff=s,this._instantiationService=r,this.id=`InlineEditSideBySideContentWidget${JC.id++}`,this.allowEditorOverflow=!1,this._nodes=rt("div.inlineEditSideBySide",void 0),this._scrollChanged=Vc("editor.onDidScrollChange",this._editor.onDidScrollChange),this._previewEditor=this._register(this._instantiationService.createInstance(ar,this._nodes,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1,handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off",wrappingIndent:"none",wrappingStrategy:void 0},{contributions:[],isSimpleWidget:!0},this._editor)),this._previewEditorObs=ea(this._previewEditor),this._editorObs=ea(this._editor),this._previewTextModel=this._register(this._instantiationService.createInstance(Il,"",((a=this._editor.getModel())==null?void 0:a.getLanguageId())??Tf,Il.DEFAULT_CREATION_OPTIONS,null)),this._setText=Zi(c=>{const d=this._text.read(c);d&&this._previewTextModel.setValue(d)}).recomputeInitiallyAndOnChange(this._store),this._decorations=Zi(this,c=>{this._setText.read(c);const d=this._position.read(c);if(!d)return{org:[],mod:[]};const u=this._diff.read(c);if(!u)return{org:[],mod:[]};const f=[],m=[];if(u.length===1&&u[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return{org:[],mod:[]};const v=this._shift.get(),_=y=>new H(y.startLineNumber+d.top-1,y.startColumn+v,y.endLineNumber+d.top-1,y.endColumn+v);for(const y of u)if(y.original.isEmpty||f.push({range:_(y.original.toInclusiveRange()),options:k0}),y.modified.isEmpty||m.push({range:y.modified.toInclusiveRange(),options:UE}),y.modified.isEmpty||y.original.isEmpty)y.original.isEmpty||f.push({range:_(y.original.toInclusiveRange()),options:$E}),y.modified.isEmpty||m.push({range:y.modified.toInclusiveRange(),options:qE});else for(const S of y.innerChanges||[])y.original.contains(S.originalRange.startLineNumber)&&f.push({range:_(S.originalRange),options:S.originalRange.isEmpty()?KE:I0}),y.modified.contains(S.modifiedRange.startLineNumber)&&m.push({range:S.modifiedRange,options:S.modifiedRange.isEmpty()?GE:ZE});return{org:f,mod:m}}),this._originalDecorations=Zi(this,c=>this._decorations.read(c).org),this._modifiedDecorations=Zi(this,c=>this._decorations.read(c).mod),this._previewEditor.setModel(this._previewTextModel),this._register(this._editorObs.setDecorations(this._originalDecorations)),this._register(this._previewEditorObs.setDecorations(this._modifiedDecorations)),this._register(Sn(c=>{const d=this._previewEditorObs.contentWidth.read(c),u=this._text.read(c).split(`
|
|
64
|
-
`).length-1,f=this._editor.getOption(67)*u;d<=0||this._previewEditor.layout({height:f,width:d})})),this._register(Sn(c=>{this._position.read(c),this._editor.layoutOverlayWidget(this)})),this._register(Sn(c=>{this._scrollChanged.read(c),this._position.read(c)&&this._editor.layoutOverlayWidget(this)}))}getId(){return this.id}getDomNode(){return this._nodes}getPosition(){const e=this._position.get();if(!e)return null;const t=this._editor.getLayoutInfo(),i=this._editor.getScrolledVisiblePosition(new ut(e.top,1));if(!i)return null;const n=i.top-1,s=this._editor.getOffsetForColumn(e.left.lineNumber,e.left.column);return{preference:{left:t.contentLeft+s+10,top:n}}}},JC=Id,Id.id=0,Id);ex=JC=mN([n_(5,qt)],ex);var J$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},yc=function(o,e){return function(t,i){e(t,i,o)}},Xg,Ro;let Ps=(Ro=class extends Be{static get(e){return e.getContribution(Xg.ID)}constructor(e,t,i,n,s,r,a,c){super(),this.editor=e,this.instantiationService=t,this.contextKeyService=i,this.languageFeaturesService=n,this._commandService=s,this._configurationService=r,this._diffProviderFactoryService=a,this._modelService=c,this._isVisibleContext=Xg.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=Xg.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=wo(this,void 0),this._currentWidget=nc(this._currentEdit,_=>{const y=this._currentEdit.read(_);if(!y)return;const S=y.range.endLineNumber,D=y.range.endColumn,E=y.text.endsWith(`
|
|
65
|
-
`)&&!(y.range.startLineNumber===y.range.endLineNumber&&y.range.startColumn===y.range.endColumn)?y.text.slice(0,-1):y.text,N=new Kf(S,[new K_(D,E,!1)]),B=y.range.startLineNumber===y.range.endLineNumber&&N.parts.length===1&&N.parts[0].lines.length===1,F=y.text==="";return!B&&!F?void 0:this.instantiationService.createInstance(GC,this.editor,{ghostText:Ha(N),minReservedLineCount:Ha(0),targetTextModel:Ha(this.editor.getModel()??void 0),range:Ha(y.range)})}),this._isAccepting=wo(this,!1),this._enabled=Ys(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=Ys(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily);const d=Vc("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(Sn(_=>{this._enabled.read(_)&&(d.read(_),!this._isAccepting.read(_)&&this.getInlineEdit(e,!0))}));const u=Ys(this,e.onDidChangeCursorPosition,()=>e.getPosition());this._register(Sn(_=>{if(!this._enabled.read(_))return;const y=u.read(_);y&&this.checkCursorPosition(y)})),this._register(Sn(_=>{const y=this._currentEdit.read(_);if(this._isCursorAtInlineEditContext.set(!1),!y){this._isVisibleContext.set(!1);return}this._isVisibleContext.set(!0);const S=e.getPosition();S&&this.checkCursorPosition(S)}));const f=Vc("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(Sn(async _=>{var y;this._enabled.read(_)&&(f.read(_),!(this._configurationService.getValue("editor.experimentalInlineEdit.keepOnBlur")||e.getOption(63).keepOnBlur)&&((y=this._currentRequestCts)==null||y.dispose(!0),this._currentRequestCts=void 0,await this.clear(!1)))}));const m=Vc("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(Sn(_=>{this._enabled.read(_)&&(m.read(_),this.getInlineEdit(e,!0))}));const v=this._register(vE());this._register(Sn(_=>{const y=this._fontFamily.read(_);v.setStyle(y===""||y==="default"?"":`
|
|
66
|
-
.monaco-editor .inline-edit-decoration,
|
|
67
|
-
.monaco-editor .inline-edit-decoration-preview,
|
|
68
|
-
.monaco-editor .inline-edit {
|
|
69
|
-
font-family: ${y};
|
|
70
|
-
}`)})),this._register(new ZC(this.editor,this._currentWidget,this.instantiationService)),this._register(new QC(this.editor,this._currentEdit,this.instantiationService,this._diffProviderFactoryService,this._modelService))}checkCursorPosition(e){if(!this._currentEdit){this._isCursorAtInlineEditContext.set(!1);return}const t=this._currentEdit.get();if(!t){this._isCursorAtInlineEditContext.set(!1);return}this._isCursorAtInlineEditContext.set(H.containsPosition(t.range,e))}validateInlineEdit(e,t){var i;if(t.text.includes(`
|
|
71
|
-
`)&&t.range.startLineNumber!==t.range.endLineNumber&&t.range.startColumn!==t.range.endColumn){if(t.range.startColumn!==1)return!1;const s=t.range.endLineNumber,r=t.range.endColumn,a=((i=e.getModel())==null?void 0:i.getLineLength(s))??0;if(r!==a+1)return!1}return!0}async fetchInlineEdit(e,t){this._currentRequestCts&&this._currentRequestCts.dispose(!0);const i=e.getModel();if(!i)return;const n=i.getVersionId(),s=this.languageFeaturesService.inlineEditProvider.all(i);if(s.length===0)return;const r=s[0];this._currentRequestCts=new gs;const a=this._currentRequestCts.token,c=t?UL.Automatic:UL.Invoke;if(t&&await Q$(50,a),a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)return;const u=await r.provideInlineEdit(i,{triggerKind:c},a);if(u&&!(a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)&&this.validateInlineEdit(e,u))return u}async getInlineEdit(e,t){this._isCursorAtInlineEditContext.set(!1),await this.clear();const i=await this.fetchInlineEdit(e,t);i&&this._currentEdit.set(i,void 0)}async trigger(){await this.getInlineEdit(this.editor,!1)}async jumpBack(){this._jumpBackPosition&&(this.editor.setPosition(this._jumpBackPosition),this.editor.revealPositionInCenterIfOutsideViewport(this._jumpBackPosition))}async accept(){this._isAccepting.set(!0,void 0);const e=this._currentEdit.get();if(!e)return;let t=e.text;e.text.startsWith(`
|
|
72
|
-
`)&&(t=e.text.substring(1)),this.editor.pushUndoStop(),this.editor.executeEdits("acceptCurrent",[En.replace(H.lift(e.range),t)]),e.accepted&&await this._commandService.executeCommand(e.accepted.id,...e.accepted.arguments||[]).then(void 0,jn),this.freeEdit(e),sh(i=>{this._currentEdit.set(void 0,i),this._isAccepting.set(!1,i)})}jumpToCurrent(){var i;this._jumpBackPosition=(i=this.editor.getSelection())==null?void 0:i.getStartPosition();const e=this._currentEdit.get();if(!e)return;const t=ut.lift({lineNumber:e.range.startLineNumber,column:e.range.startColumn});this.editor.setPosition(t),this.editor.revealPositionInCenterIfOutsideViewport(t)}async clear(e=!0){const t=this._currentEdit.get();t&&(t!=null&&t.rejected)&&e&&await this._commandService.executeCommand(t.rejected.id,...t.rejected.arguments||[]).then(void 0,jn),t&&this.freeEdit(t),this._currentEdit.set(void 0,void 0)}freeEdit(e){const t=this.editor.getModel();if(!t)return;const i=this.languageFeaturesService.inlineEditProvider.all(t);i.length!==0&&i[0].freeInlineEdit(e)}},Xg=Ro,Ro.ID="editor.contrib.inlineEditController",Ro.inlineEditVisibleKey="inlineEditVisible",Ro.inlineEditVisibleContext=new yi(Ro.inlineEditVisibleKey,!1),Ro.cursorAtInlineEditKey="cursorAtInlineEdit",Ro.cursorAtInlineEditContext=new yi(Ro.cursorAtInlineEditKey,!1),Ro);Ps=Xg=J$([yc(1,qt),yc(2,Ri),yc(3,gt),yc(4,ls),yc(5,pn),yc(6,D0),yc(7,As)],Ps);function Q$(o,e){return new Promise(t=>{let i;const n=setTimeout(()=>{i&&i.dispose(),t()},o);e&&(i=e.onCancellationRequested(()=>{clearTimeout(n),i&&i.dispose(),t()}))})}let e5=class extends Se{constructor(){super({id:U$,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:le.and(M.writable,Ps.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:le.and(M.writable,Ps.inlineEditVisibleContext,Ps.cursorAtInlineEditContext)}],menuOpts:[{menuId:Ye.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){const i=Ps.get(t);await(i==null?void 0:i.accept())}};class t5 extends Se{constructor(){const e=le.and(M.writable,le.not(Ps.inlineEditVisibleKey));super({id:"editor.action.inlineEdit.trigger",label:"Trigger Inline Edit",alias:"Trigger Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e}})}async run(e,t){const i=Ps.get(t);i==null||i.trigger()}}class i5 extends Se{constructor(){const e=le.and(M.writable,Ps.inlineEditVisibleContext,le.not(Ps.cursorAtInlineEditKey));super({id:q$,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:Ye.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){const i=Ps.get(t);i==null||i.jumpToCurrent()}}class n5 extends Se{constructor(){const e=le.and(M.writable,Ps.cursorAtInlineEditContext);super({id:K$,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:Ye.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){const i=Ps.get(t);i==null||i.jumpBack()}}class s5 extends Se{constructor(){const e=le.and(M.writable,Ps.inlineEditVisibleContext);super({id:$$,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:Ye.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){const i=Ps.get(t);await(i==null?void 0:i.clear())}}ie(e5);ie(s5);ie(i5);ie(n5);ie(t5);oi(Ps.ID,Ps,3);const o5="editor.action.inlineEdits.accept",r5="editor.action.inlineEdits.showPrevious",a5="editor.action.inlineEdits.showNext",rg=new yi("inlineEditsVisible",!1,w("inlineEditsVisible","Whether an inline edit is visible")),l5=new yi("inlineEditsIsPinned",!1,w("isPinned","Whether an inline edit is visible")),G1=class G1 extends Be{constructor(e){super(),this._editor=e,this._editorObs=ea(this._editor),this._placeholderText=this._editorObs.getOption(88),this._state=Oa({owner:this,equalsFn:XE},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=c5(this,t=>{var i;return((i=this._state.read(t))==null?void 0:i.placeholder)!==void 0}),this._view=GD((t,i)=>{if(!this._shouldViewBeAlive.read(t))return;const n=Jo("div.editorPlaceholder");i.add(Sn(s=>{const r=this._state.read(s),a=(r==null?void 0:r.placeholder)!==void 0;n.root.style.display=a?"block":"none",n.root.innerText=(r==null?void 0:r.placeholder)??""})),i.add(Sn(s=>{const r=this._editorObs.layoutInfo.read(s);n.root.style.left=`${r.contentLeft}px`,n.root.style.width=r.contentWidth-r.verticalScrollbarWidth+"px",n.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),i.add(Sn(s=>{n.root.style.fontFamily=this._editorObs.getOption(49).read(s),n.root.style.fontSize=this._editorObs.getOption(52).read(s)+"px",n.root.style.lineHeight=this._editorObs.getOption(67).read(s)+"px"})),i.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:Ha(0),position:Ha(null),domNode:n.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};G1.ID="editor.contrib.placeholderText";let ep=G1;function c5(o,e){return Tb(o,(t,i)=>i===!0?!0:e(t))}var d5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},h5=function(o,e){return function(t,i){e(t,i,o)}};class u5{constructor(e,t,i){this.range=e,this.newLines=t,this.changes=i}}let tx=class extends Be{constructor(e,t,i,n){super(),this._editor=e,this._edit=t,this._userPrompt=i,this._instantiationService=n,this._editorObs=ea(this._editor),this._elements=Jo("div.inline-edits-widget",{style:{position:"absolute",overflow:"visible",top:"0px",left:"0px"}},[Jo("div@editorContainer",{style:{position:"absolute",top:"0px",left:"0px",width:"500px",height:"500px"}},[Jo("div.toolbar@toolbar",{style:{position:"absolute",top:"-25px",left:"0px"}}),Jo("div.promptEditor@promptEditor",{style:{position:"absolute",top:"-25px",left:"80px",width:"300px",height:"22px"}}),Jo("div.preview@editor",{style:{position:"absolute",top:"0px",left:"0px"}})]),Sh("svg",{style:{overflow:"visible",pointerEvents:"none"}},[Sh("defs",[Sh("linearGradient",{id:"Gradient2",x1:"0",y1:"0",x2:"1",y2:"0"},[Sh("stop",{offset:"0%",class:"gradient-stop"}),Sh("stop",{offset:"100%",class:"gradient-stop"})])]),Sh("path@path",{d:"",fill:"url(#Gradient2)"})])]),this._previewTextModel=this._register(this._instantiationService.createInstance(Il,"",Tf,Il.DEFAULT_CREATION_OPTIONS,null)),this._setText=Zi(r=>{const a=this._edit.read(r);a&&this._previewTextModel.setValue(a.newLines.join(`
|
|
73
|
-
`))}).recomputeInitiallyAndOnChange(this._store),this._promptTextModel=this._register(this._instantiationService.createInstance(Il,"",Tf,Il.DEFAULT_CREATION_OPTIONS,null)),this._promptEditor=this._register(this._instantiationService.createInstance(ar,this._elements.promptEditor,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,placeholder:"Describe the change you want...",fontFamily:O2},{contributions:F2.getSomeEditorContributions([tr.ID,ep.ID,Ju.ID]),isSimpleWidget:!0},this._editor)),this._previewEditor=this._register(this._instantiationService.createInstance(ar,this._elements.editor,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0},{contributions:[]},this._editor)),this._previewEditorObs=ea(this._previewEditor),this._decorations=Zi(this,r=>{var u;this._setText.read(r);const a=(u=this._edit.read(r))==null?void 0:u.changes;if(!a)return[];const c=[],d=[];if(a.length===1&&a[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return[];for(const f of a)if(f.original.isEmpty||c.push({range:f.original.toInclusiveRange(),options:k0}),f.modified.isEmpty||d.push({range:f.modified.toInclusiveRange(),options:UE}),f.modified.isEmpty||f.original.isEmpty)f.original.isEmpty||c.push({range:f.original.toInclusiveRange(),options:$E}),f.modified.isEmpty||d.push({range:f.modified.toInclusiveRange(),options:qE});else for(const m of f.innerChanges||[])f.original.contains(m.originalRange.startLineNumber)&&c.push({range:m.originalRange,options:m.originalRange.isEmpty()?KE:I0}),f.modified.contains(m.modifiedRange.startLineNumber)&&d.push({range:m.modifiedRange,options:m.modifiedRange.isEmpty()?GE:ZE});return d}),this._layout1=Zi(this,r=>{const a=this._editor.getModel(),c=this._edit.read(r);if(!c)return null;const d=c.range;let u=0;for(let v=d.startLineNumber;v<d.endLineNumberExclusive;v++){const _=a.getLineMaxColumn(v),y=this._editor.getOffsetForColumn(v,_);u=Math.max(u,y)}return{left:this._editor.getLayoutInfo().contentLeft+u}}),this._layout=Zi(this,r=>{const a=this._edit.read(r);if(!a)return null;const c=a.range,d=this._editorObs.scrollLeft.read(r),u=this._layout1.read(r).left+20-d,f=this._editor.getTopForLineNumber(c.startLineNumber)-this._editorObs.scrollTop.read(r),m=this._editor.getTopForLineNumber(c.endLineNumberExclusive)-this._editorObs.scrollTop.read(r),v=new eu(u,f),_=new eu(u,m),y=m-f,S=50,D=this._editor.getOption(67)*a.newLines.length,E=y-D,N=new eu(u+S,f+E/2),B=new eu(u+S,m-E/2);return{topCode:v,bottomCode:_,codeHeight:y,topEdit:N,bottomEdit:B,editHeight:D}});const s=Zi(this,r=>this._edit.read(r)!==void 0||this._userPrompt.read(r)!==void 0);this._register(H2(this._elements.root,{display:Zi(this,r=>s.read(r)?"block":"none")})),this._register(W2(this._editor.getDomNode(),this._elements.root)),this._register(ea(e).createOverlayWidget({domNode:this._elements.root,position:Ha(null),allowEditorOverflow:!1,minContentWidthInPx:Zi(r=>{var d;const a=(d=this._layout1.read(r))==null?void 0:d.left;if(a===void 0)return 0;const c=this._previewEditorObs.contentWidth.read(r);return a+c})})),this._previewEditor.setModel(this._previewTextModel),this._register(this._previewEditorObs.setDecorations(this._decorations)),this._register(Sn(r=>{const a=this._layout.read(r);if(!a)return;const{topCode:c,bottomCode:d,topEdit:u,bottomEdit:f,editHeight:m}=a,v=10,_=0,y=40,S=new f5().moveTo(c).lineTo(c.deltaX(v)).curveTo(c.deltaX(v+y),u.deltaX(-y-_),u.deltaX(-_)).lineTo(u).lineTo(f).lineTo(f.deltaX(-_)).curveTo(f.deltaX(-y-_),d.deltaX(v+y),d.deltaX(v)).lineTo(d).build();this._elements.path.setAttribute("d",S),this._elements.editorContainer.style.top=`${u.y}px`,this._elements.editorContainer.style.left=`${u.x}px`,this._elements.editorContainer.style.height=`${m}px`;const D=this._previewEditorObs.contentWidth.read(r);this._previewEditor.layout({height:m,width:D})})),this._promptEditor.setModel(this._promptTextModel),this._promptEditor.layout(),this._register(p5(g5(this._userPrompt,r=>r??"",r=>r),ea(this._promptEditor).value)),this._register(Sn(r=>{const a=ea(this._promptEditor).isFocused.read(r);this._elements.root.classList.toggle("focused",a)}))}};tx=d5([h5(3,qt)],tx);function g5(o,e,t){return YE(void 0,i=>e(o.read(i)),(i,n)=>o.set(t(i),n))}class eu{constructor(e,t){this.x=e,this.y=t}deltaX(e){return new eu(this.x+e,this.y)}}class f5{constructor(){this._data=""}moveTo(e){return this._data+=`M ${e.x} ${e.y} `,this}lineTo(e){return this._data+=`L ${e.x} ${e.y} `,this}curveTo(e,t,i){return this._data+=`C ${e.x} ${e.y} ${t.x} ${t.y} ${i.x} ${i.y} `,this}build(){return this._data}}function p5(o,e){const t=new Oe;return t.add(Sn(i=>{const n=o.read(i);e.set(n,void 0)})),t.add(Sn(i=>{const n=e.read(i);o.set(n,void 0)})),t}var m5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},by=function(o,e){return function(t,i){e(t,i,o)}},Yg,kd;let ix=(kd=class extends Be{static _createUniqueUri(){return nn.from({scheme:"inline-edits",path:new Date().toString()+String(Yg._modelId++)})}constructor(e,t,i,n,s,r,a){super(),this.textModel=e,this._textModelVersionId=t,this._selection=i,this._debounceValue=n,this.languageFeaturesService=s,this._diffProviderFactoryService=r,this._modelService=a,this._forceUpdateExplicitlySignal=y0(this),this._selectedInlineCompletionId=wo(this,void 0),this._isActive=wo(this,!1),this._originalModel=nc(()=>this._modelService.createModel("",null,Yg._createUniqueUri())).keepObserved(this._store),this._modifiedModel=nc(()=>this._modelService.createModel("",null,Yg._createUniqueUri())).keepObserved(this._store),this._pinnedRange=new v5(this.textModel,this._textModelVersionId),this.isPinned=this._pinnedRange.range.map(c=>!!c),this.userPrompt=wo(this,void 0),this.inlineEdit=Zi(this,c=>{var d,u;return(u=(d=this._inlineEdit.read(c))==null?void 0:d.promiseResult.read(c))==null?void 0:u.data}),this._inlineEdit=Zi(this,c=>{const d=this.selectedInlineEdit.read(c);if(!d)return;const u=d.inlineCompletion.range;if(d.inlineCompletion.insertText.trim()==="")return;let f=d.inlineCompletion.insertText.split(/\r\n|\r|\n/);function m(S){var E;const D=((E=S[0].match(/^\s*/))==null?void 0:E[0])??"";return S.map(N=>N.replace(new RegExp("^"+D),""))}f=m(f);let _=this.textModel.getValueInRange(u).split(/\r\n|\r|\n/);_=m(_),this._originalModel.get().setValue(_.join(`
|
|
74
|
-
`)),this._modifiedModel.get().setValue(f.join(`
|
|
75
|
-
`));const y=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return jE.fromFn(async()=>{const S=await y.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},ii.None);if(!S.identical)return new u5(B2.fromRangeInclusive(u),m(f),S.changes)})}),this._fetchStore=this._register(new Oe),this._inlineEditsFetchResult=Hy(this,void 0),this._inlineEdits=Oa({owner:this,equalsFn:XE},c=>{var d;return((d=this._inlineEditsFetchResult.read(c))==null?void 0:d.completions.map(u=>new _5(u)))??[]}),this._fetchInlineEditsPromise=kE({owner:this,createEmptyChangeSummary:()=>({inlineCompletionTriggerKind:ja.Automatic}),handleChange:(c,d)=>(c.didChange(this._forceUpdateExplicitlySignal)&&(d.inlineCompletionTriggerKind=ja.Explicit),!0)},async(c,d)=>{this._fetchStore.clear(),this._forceUpdateExplicitlySignal.read(c),this._textModelVersionId.read(c);function u(y,S){return S(y)}const f=this._pinnedRange.range.read(c)??u(this._selection.read(c),y=>y.isEmpty()?void 0:y);if(!f){this._inlineEditsFetchResult.set(void 0,void 0),this.userPrompt.set(void 0,void 0);return}const m={triggerKind:d.inlineCompletionTriggerKind,selectedSuggestionInfo:void 0,userPrompt:this.userPrompt.read(c)},v=By(this._fetchStore);await Hb(200,v);const _=await JM(this.languageFeaturesService.inlineCompletionsProvider,f,this.textModel,m,v);v.isCancellationRequested||this._inlineEditsFetchResult.set(_,void 0)}),this._filteredInlineEditItems=Oa({owner:this,equalsFn:Wy()},c=>this._inlineEdits.read(c)),this.selectedInlineCompletionIndex=Zi(this,c=>{const d=this._selectedInlineCompletionId.read(c),u=this._filteredInlineEditItems.read(c),f=this._selectedInlineCompletionId===void 0?-1:u.findIndex(m=>m.semanticId===d);return f===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):f}),this.selectedInlineEdit=Zi(this,c=>{const d=this._filteredInlineEditItems.read(c),u=this.selectedInlineCompletionIndex.read(c);return d[u]}),this._register(DE(this._fetchInlineEditsPromise))}async triggerExplicitly(e){p_(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineEditsPromise.get()}stop(e){p_(e,t=>{this.userPrompt.set(void 0,t),this._isActive.set(!1,t),this._inlineEditsFetchResult.set(void 0,t),this._pinnedRange.setRange(void 0,t)})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineEditItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(e){if(e.getModel()!==this.textModel)throw new Wu;const t=this.selectedInlineEdit.get();t&&(e.pushUndoStop(),e.executeEdits("inlineSuggestion.accept",[t.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]),this.stop())}},Yg=kd,kd._modelId=0,kd);ix=Yg=m5([by(4,gt),by(5,D0),by(6,As)],ix);class _5{constructor(e){this.inlineCompletion=e,this.semanticId=this.inlineCompletion.hash()}}class v5 extends Be{constructor(e,t){super(),this._textModel=e,this._versionId=t,this._decorations=wo(this,[]),this.range=Zi(this,i=>{this._versionId.read(i);const n=this._decorations.read(i)[0];return n?this._textModel.getDecorationRange(n)??null:null}),this._register(gn(()=>{this._textModel.deltaDecorations(this._decorations.get(),[])}))}setRange(e,t){this._decorations.set(this._textModel.deltaDecorations(this._decorations.get(),e?[{range:e,options:{description:"trackedRange"}}]:[]),t)}}var b5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ag=function(o,e){return function(t,i){e(t,i,o)}},nx,Dd;let tl=(Dd=class extends Be{static get(e){return e.getContribution(nx.ID)}constructor(e,t,i,n,s,r){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._debounceService=n,this._languageFeaturesService=s,this._configurationService=r,this._enabled=z2("editor.inlineEdits.enabled",!1,this._configurationService),this._editorObs=ea(this.editor),this._selection=Zi(this,a=>this._editorObs.cursorSelection.read(a)??new Mt(1,1,1,1)),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineEditsDebounce",{min:50,max:50}),this.model=nc(this,a=>{if(!this._enabled.read(a)||this._editorObs.isReadonly.read(a))return;const c=this._editorObs.model.read(a);return c?this._instantiationService.createInstance(zy(ix,a),c,this._editorObs.versionId,this._selection,this._debounceValue):void 0}),this._hadInlineEdit=Tb(this,(a,c)=>{var d;return c||((d=this.model.read(a))==null?void 0:d.inlineEdit.read(a))!==void 0}),this._widget=nc(this,a=>{if(this._hadInlineEdit.read(a))return this._instantiationService.createInstance(zy(tx,a),this.editor,this.model.map((c,d)=>c==null?void 0:c.inlineEdit.read(d)),w5(c=>{var d;return((d=this.model.read(c))==null?void 0:d.userPrompt)??wo("empty","")}))}),this._register($L(rg,this._contextKeyService,a=>{var c;return!!((c=this.model.read(a))!=null&&c.inlineEdit.read(a))})),this._register($L(l5,this._contextKeyService,a=>{var c;return!!((c=this.model.read(a))!=null&&c.isPinned.read(a))})),this.model.recomputeInitiallyAndOnChange(this._store),this._widget.recomputeInitiallyAndOnChange(this._store)}},nx=Dd,Dd.ID="editor.contrib.inlineEditsController",Dd);tl=nx=b5([Ag(1,qt),Ag(2,Ri),Ag(3,Wo),Ag(4,gt),Ag(5,pn)],tl);function w5(o){return YE(void 0,e=>o(e).read(e),(e,t)=>{o(void 0).set(e,t)})}function qp(o){return{label:o.value,alias:o.original}}const cb=class cb extends Se{constructor(){super({id:cb.ID,...qp(ht("action.inlineEdits.showNext","Show Next Inline Edit")),precondition:le.and(M.writable,rg),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=tl.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};cb.ID=a5;let sx=cb;const db=class db extends Se{constructor(){super({id:db.ID,...qp(ht("action.inlineEdits.showPrevious","Show Previous Inline Edit")),precondition:le.and(M.writable,rg),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=tl.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};db.ID=r5;let ox=db;class y5 extends Se{constructor(){super({id:"editor.action.inlineEdits.trigger",...qp(ht("action.inlineEdits.trigger","Trigger Inline Edit")),precondition:M.writable})}async run(e,t){const i=tl.get(t);await HE(async n=>{var s;await((s=i==null?void 0:i.model.get())==null?void 0:s.triggerExplicitly(n))})}}class S5 extends Se{constructor(){super({id:o5,...qp(ht("action.inlineEdits.accept","Accept Inline Edit")),precondition:rg,menuOpts:{menuId:Ye.InlineEditsActions,title:w("inlineEditsActions","Accept Inline Edit"),group:"primary",order:1,icon:Ot.check},kbOpts:{primary:2058,weight:2e4,kbExpr:rg}})}async run(e,t){var n;t instanceof ar&&(t=t.getParentEditor());const i=tl.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const hb=class hb extends Se{constructor(){super({id:hb.ID,...qp(ht("action.inlineEdits.hide","Hide Inline Edit")),precondition:rg,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=tl.get(t);sh(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};hb.ID="editor.action.inlineEdits.hide";let rx=hb;oi(tl.ID,tl,3);ie(y5);ie(sx);ie(ox);ie(S5);ie(rx);const Qd={Visible:new yi("parameterHintsVisible",!1),MultipleSignatures:new yi("parameterHintsMultipleSignatures",!1)};async function _N(o,e,t,i,n){const s=o.ordered(e);for(const r of s)try{const a=await r.provideSignatureHelp(e,t,n,i);if(a)return a}catch(a){jn(a)}}dn.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;Oi(nn.isUri(t)),Oi(ut.isIPosition(i)),Oi(typeof n=="string"||!n);const s=o.get(gt),r=await o.get(Ar).createModelReference(t);try{const a=await _N(s.signatureHelpProvider,r.object.textEditorModel,ut.lift(i),{triggerKind:Al.Invoke,isRetrigger:!1,triggerCharacter:n},ii.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var _l;(function(o){o.Default={type:0};class e{constructor(n,s){this.request=n,this.previouslyActiveHints=s,this.type=2}}o.Pending=e;class t{constructor(n){this.hints=n,this.type=1}}o.Active=t})(_l||(_l={}));const ub=class ub extends Be{constructor(e,t,i=ub.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ti),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=_l.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new So),this.triggerChars=new g_,this.retriggerChars=new g_,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new ic(i),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(n=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(n=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(n=>this.onCursorChange(n))),this._register(this.editor.onDidChangeModelContent(n=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(n=>this.onDidType(n))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=_l.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){const i=this.editor.getModel();if(!i||!this.providers.has(i))return;const n=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(n),t).catch(on)}next(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t%e===e-1,n=this.editor.getOption(86).cycle;if((e<2||i)&&!n){this.cancel();return}this.updateActiveSignature(i&&n?0:t+1)}previous(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t===0,n=this.editor.getOption(86).cycle;if((e<2||i)&&!n){this.cancel();return}this.updateActiveSignature(i&&n?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new _l.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){const t=this.state.type===1||this.state.type===2,i=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;const n=this._pendingTriggers.reduce(C5);this._pendingTriggers=[];const s={triggerKind:n.triggerKind,triggerCharacter:n.triggerCharacter,isRetrigger:t,activeSignatureHelp:i};if(!this.editor.hasModel())return!1;const r=this.editor.getModel(),a=this.editor.getPosition();this.state=new _l.Pending(us(c=>_N(this.providers,r,a,s,c)),i);try{const c=await this.state.request;return e!==this.triggerId?(c==null||c.dispose(),!1):!c||!c.value.signatures||c.value.signatures.length===0?(c==null||c.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new _l.Active(c.value),this._lastSignatureHelpResult.value=c,this._onChangedHints.fire(this.state.hints),!0)}catch(c){return e===this.triggerId&&(this.state=_l.Default),on(c),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const e=this.editor.getModel();if(e)for(const t of this.providers.ordered(e)){for(const i of t.signatureHelpTriggerCharacters||[])if(i.length){const n=i.charCodeAt(0);this.triggerChars.add(n),this.retriggerChars.add(n)}for(const i of t.signatureHelpRetriggerCharacters||[])i.length&&this.retriggerChars.add(i.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;const t=e.length-1,i=e.charCodeAt(t);(this.triggerChars.has(i)||this.isTriggered&&this.retriggerChars.has(i))&&this.trigger({triggerKind:Al.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:Al.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Al.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(86).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};ub.DEFAULT_DELAY=120;let ax=ub;function C5(o,e){switch(e.triggerKind){case Al.Invoke:return e;case Al.ContentChange:return o;case Al.TriggerCharacter:default:return e}}var x5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Mm=function(o,e){return function(t,i){e(t,i,o)}},lx;const uo=rt,L5=Wn("parameter-hints-next",Ot.chevronDown,w("parameterHintsNextIcon","Icon for show next parameter hint.")),I5=Wn("parameter-hints-previous",Ot.chevronUp,w("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var Ed;let cx=(Ed=class extends Be{constructor(e,t,i,n,s,r){super(),this.editor=e,this.model=t,this.telemetryService=r,this.renderDisposeables=this._register(new Oe),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new ug({editor:e},s,n)),this.keyVisible=Qd.Visible.bindTo(i),this.keyMultipleSignatures=Qd.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=uo(".editor-widget.parameter-hints-widget"),t=Qe(e,uo(".phwrapper"));t.tabIndex=-1;const i=Qe(t,uo(".controls")),n=Qe(i,uo(".button"+Wi.asCSSSelector(I5))),s=Qe(i,uo(".overloads")),r=Qe(i,uo(".button"+Wi.asCSSSelector(L5)));this._register(Ni(n,"click",m=>{u_.stop(m),this.previous()})),this._register(Ni(r,"click",m=>{u_.stop(m),this.next()}));const a=uo(".body"),c=new ME(a,{alwaysConsumeMouseWheel:!0});this._register(c),t.appendChild(c.getDomNode());const d=Qe(a,uo(".signature")),u=Qe(a,uo(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:d,overloads:s,docs:u,scrollbar:c},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(m=>{this.visible&&this.editor.layoutContentWidget(this)}));const f=()=>{if(!this.domNodes)return;const m=this.editor.getOption(50),v=this.domNodes.element;v.style.fontSize=`${m.fontSize}px`,v.style.lineHeight=`${m.lineHeight/m.fontSize}`,v.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",m.fontFamily),v.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",g0.fontFamily)};f(),this._register(es.chain(this.editor.onDidChangeConfiguration.bind(this.editor),m=>m.filter(v=>v.hasChanged(50)))(f)),this._register(this.editor.onDidLayoutChange(m=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{var e;(e=this.domNodes)==null||e.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){var e;this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,(e=this.domNodes)==null||e.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;const t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const i=e.signatures[e.activeSignature];if(!i)return;const n=Qe(this.domNodes.signature,uo(".code")),s=i.parameters.length>0,r=i.activeParameter??e.activeParameter;if(s)this.renderParameters(n,i,r);else{const d=Qe(n,uo("span"));d.textContent=i.label}const a=i.parameters[r];if(a!=null&&a.documentation){const d=uo("span.documentation");if(typeof a.documentation=="string")d.textContent=a.documentation;else{const u=this.renderMarkdownDocs(a.documentation);d.appendChild(u.element)}Qe(this.domNodes.docs,uo("p",{},d))}if(i.documentation!==void 0)if(typeof i.documentation=="string")Qe(this.domNodes.docs,uo("p",{},i.documentation));else{const d=this.renderMarkdownDocs(i.documentation);Qe(this.domNodes.docs,d.element)}const c=this.hasDocs(i,a);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,a){let d="";const u=i.parameters[r];Array.isArray(u.label)?d=i.label.substring(u.label[0],u.label[1]):d=u.label,u.documentation&&(d+=typeof u.documentation=="string"?`, ${u.documentation}`:`, ${u.documentation.value}`),i.documentation&&(d+=typeof i.documentation=="string"?`, ${i.documentation}`:`, ${i.documentation.value}`),this.announcedLabel!==d&&(or(w("hint","{0}, hint",d)),this.announcedLabel=d)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new oo,i=this.renderDisposeables.add(this.markdownRenderer.render(e,{asyncRenderCallback:()=>{var s;(s=this.domNodes)==null||s.scrollbar.scanDomNode()}}));i.element.classList.add("markdown-docs");const n=t.elapsed();return n>300&&this.telemetryService.publicLog2("parameterHints.parseMarkdown",{renderDuration:n}),i}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Kh(t.documentation).length>0||t&&typeof t.documentation=="object"&&Kh(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Kh(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Kh(e.documentation.value).length>0)}renderParameters(e,t,i){const[n,s]=this.getParameterLabelOffsets(t,i),r=document.createElement("span");r.textContent=t.label.substring(0,n);const a=document.createElement("span");a.textContent=t.label.substring(n,s),a.className="parameter active";const c=document.createElement("span");c.textContent=t.label.substring(s),Qe(e,r,a,c)}getParameterLabelOffsets(e,t){const i=e.parameters[t];if(i){if(Array.isArray(i.label))return i.label;if(i.label.length){const n=new RegExp(`(\\W|^)${If(i.label)}(?=\\W|$)`,"g");n.test(e.label);const s=n.lastIndex-i.label.length;return s>=0?[s,n.lastIndex]:[0,0]}else return[0,0]}else return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return lx.ID}updateMaxHeight(){if(!this.domNodes)return;const t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;const i=this.domNodes.element.getElementsByClassName("phwrapper");i.length&&(i[0].style.maxHeight=t)}},lx=Ed,Ed.ID="editor.widget.parameterHintsWidget",Ed);cx=lx=x5([Mm(2,Ri),Mm(3,Mr),Mm(4,Rr),Mm(5,Nr)],cx);at("editorHoverWidget.highlightForeground",OE,w("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var k5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Rk=function(o,e){return function(t,i){e(t,i,o)}},dx,Pd;let ag=(Pd=class extends Be{static get(e){return e.getContribution(dx.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new ax(e,i.signatureHelpProvider)),this._register(this.model.onChangedHints(n=>{var s;n?(this.widget.value.show(),this.widget.value.render(n)):(s=this.widget.rawValue)==null||s.hide()})),this.widget=new o0(()=>this._register(t.createInstance(cx,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){var e;(e=this.widget.rawValue)==null||e.previous()}next(){var e;(e=this.widget.rawValue)==null||e.next()}trigger(e){this.model.trigger(e,0)}},dx=Pd,Pd.ID="editor.controller.parameterHints",Pd);ag=dx=k5([Rk(1,qt),Rk(2,gt)],ag);class D5 extends Se{constructor(){super({id:"editor.action.triggerParameterHints",label:w("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:M.hasSignatureHelpProvider,kbOpts:{kbExpr:M.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=ag.get(t);i==null||i.trigger({triggerKind:Al.Invoke})}}oi(ag.ID,ag,2);ie(D5);const x1=175,L1=js.bindToContribution(ag.get);bt(new L1({id:"closeParameterHints",precondition:Qd.Visible,handler:o=>o.cancel(),kbOpts:{weight:x1,kbExpr:M.focus,primary:9,secondary:[1033]}}));bt(new L1({id:"showPrevParameterHint",precondition:le.and(Qd.Visible,Qd.MultipleSignatures),handler:o=>o.previous(),kbOpts:{weight:x1,kbExpr:M.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));bt(new L1({id:"showNextParameterHint",precondition:le.and(Qd.Visible,Qd.MultipleSignatures),handler:o=>o.next(),kbOpts:{weight:x1,kbExpr:M.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var E5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},P5=function(o,e){return function(t,i){e(t,i,o)}};class T5{constructor(e){this.instantiationService=e}init(...e){}}function M5(o,e){return class extends e{constructor(){super(...arguments),this._autorun=void 0}init(...i){this._autorun=Lp((n,s)=>{const r=zy(o(),n);s.add(this.instantiationService.createInstance(r,...i))})}dispose(){var i;(i=this._autorun)==null||i.dispose()}}}function N5(o){return V2()?M5(o,hx):o()}let hx=class extends T5{constructor(e,t){super(t),this.init(e)}};hx=E5([P5(1,qt)],hx);oi(ep.ID,N5(()=>ep),0);at("editor.placeholder.foreground",j2,w("placeholderForeground","Foreground color of the placeholder text in the editor."));var R5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nm=function(o,e){return function(t,i){e(t,i,o)}};const wg=new yi("renameInputVisible",!1,w("renameInputVisible","Whether the rename input widget is visible"));new yi("renameInputFocused",!1,w("renameInputFocused","Whether the rename input widget is focused"));let ux=class{constructor(e,t,i,n,s,r){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=n,this._logService=r,this.allowEditorOverflow=!0,this._disposables=new Oe,this._visibleContextKey=wg.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new oo,this._inputWithButton=new A5,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{a.hasChanged(50)&&this._updateFont()})),this._disposables.add(i.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new I1(this._domNode,{fontInfo:this._editor.getOption(50),onFocusChange:e=>{this._inputWithButton.input.value=e,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{var e,t,i;((e=this._renameCandidateListView)==null?void 0:e.focusedCandidate)!==void 0&&(this._isEditingRenameCandidate=!0),this._timeBeforeFirstInputFieldEdit??(this._timeBeforeFirstInputFieldEdit=this._beforeFirstInputFieldEditSW.elapsed()),((t=this._renameCandidateProvidersCts)==null?void 0:t.token.isCancellationRequested)===!1&&this._renameCandidateProvidersCts.cancel(),(i=this._renameCandidateListView)==null||i.clearFocus()})),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(e){if(!this._domNode)return;const t=e.getColor(U2),i=e.getColor($2);this._domNode.style.backgroundColor=String(e.getColor(NE)??""),this._domNode.style.boxShadow=t?` 0 0 8px 2px ${t}`:"",this._domNode.style.border=i?`1px solid ${i}`:"",this._domNode.style.color=String(e.getColor(q2)??"");const n=e.getColor(K2);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(qL)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(qL)??""),this._inputWithButton.domNode.style.borderWidth=n?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=n?"solid":"none",this._inputWithButton.domNode.style.borderColor=(n==null?void 0:n.toString())??"none"}_updateFont(){if(this._domNode===void 0)return;Oi(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);const e=this._editor.getOption(50);this._label.style.fontSize=`${this._computeLabelFontSize(e.fontSize)}px`}_computeLabelFontSize(e){return e*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;const e=Ip(this.getDomNode().ownerDocument.body),t=Ws(this._editor.getDomNode()),i=this._getTopForPosition();this._nPxAvailableAbove=i+t.top,this._nPxAvailableBelow=e.height-this._nPxAvailableAbove;const n=this._editor.getOption(67),{totalHeight:s}=tp.getLayoutInfo({lineHeight:n}),r=this._nPxAvailableBelow>s*6?[2,1]:[1,2];return{position:this._position,preference:r}}beforeRender(){var i,n;const[e,t]=this._acceptKeybindings;return this._label.innerText=w({key:"label",comment:['placeholders are keybindings, e.g "F2 to Rename, Shift+F2 to Preview"']},"{0} to Rename, {1} to Preview",(i=this._keybindingService.lookupKeybinding(e))==null?void 0:i.getLabel(),(n=this._keybindingService.lookupKeybinding(t))==null?void 0:n.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(e){if(e===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;Oi(this._renameCandidateListView),Oi(this._nPxAvailableAbove!==void 0),Oi(this._nPxAvailableBelow!==void 0);const t=$h(this._inputWithButton.domNode),i=$h(this._label);let n;e===2?n=this._nPxAvailableBelow:n=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:n-i-t,width:$o(this._inputWithButton.domNode)})}acceptInput(e){var t;this._trace("invoking acceptInput"),(t=this._currentAcceptInput)==null||t.call(this,e)}cancelInput(e,t){var i;(i=this._currentCancelInput)==null||i.call(this,e)}focusNextRenameSuggestion(){var e;(e=this._renameCandidateListView)!=null&&e.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){var e;(e=this._renameCandidateListView)!=null&&e.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(e,t,i,n,s){const{start:r,end:a}=this._getSelection(e,t);this._renameCts=s;const c=new Oe;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,n===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=n,this._requestRenameCandidates(t,!1),c.add(Ni(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),c.add(Ni(this._inputWithButton.button,Cn.KEY_DOWN,u=>{const f=new E0(u);(f.equals(3)||f.equals(10))&&(f.stopPropagation(),f.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",i),this._position=new ut(e.startLineNumber,e.startColumn),this._currentName=t,this._inputWithButton.input.value=t,this._inputWithButton.input.setAttribute("selectionStart",r.toString()),this._inputWithButton.input.setAttribute("selectionEnd",a.toString()),this._inputWithButton.input.size=Math.max((e.endColumn-e.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),c.add(gn(()=>{this._renameCts=void 0,s.dispose(!0)})),c.add(gn(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),c.add(gn(()=>this._candidates.clear()));const d=new Ib;return d.p.finally(()=>{c.dispose(),this._hide()}),this._currentCancelInput=u=>{var f;return this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,(f=this._renameCandidateListView)==null||f.clearCandidates(),d.complete(u),!0},this._currentAcceptInput=u=>{this._trace("invoking _currentAcceptInput"),Oi(this._renameCandidateListView!==void 0);const f=this._renameCandidateListView.nCandidates;let m,v;const _=this._renameCandidateListView.focusedCandidate;if(_!==void 0?(this._trace("using new name from renameSuggestion"),m=_,v={k:"renameSuggestion"}):(this._trace("using new name from inputField"),m=this._inputWithButton.input.value,v=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),m===t||m.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),d.complete({newName:m,wantsPreview:i&&u,stats:{source:v,nRenameSuggestions:f,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},c.add(s.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),c.add(this._editor.onDidBlurEditorWidget(()=>{var u;return this.cancelInput(!((u=this._domNode)!=null&&u.ownerDocument.hasFocus()),"editor.onDidBlurEditorWidget")})),this._show(),d.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),Oi(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new gs;const i=t?Vy.Invoke:Vy.Automatic,n=this._requestRenameCandidatesOnce(i,this._renameCandidateProvidersCts.token);if(n.length===0){this._inputWithButton.setSparkleButton();return}t||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(n,e,this._renameCts.token)}}_getSelection(e,t){Oi(this._editor.hasModel());const i=this._editor.getSelection();let n=0,s=t.length;return!H.isEmpty(i)&&!H.spansMultipleLines(i)&&H.containsRange(e,i)&&(n=Math.max(0,i.startColumn-e.startColumn),s=Math.min(e.endColumn,i.endColumn)-e.startColumn),{start:n,end:s}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(e,t,i){const n=(...d)=>this._trace("_updateRenameCandidates",...d);n("start");const s=await bp(Promise.allSettled(e),i);if(this._inputWithButton.setSparkleButton(),s===void 0){n("returning early - received updateRenameCandidates results - undefined");return}const r=s.flatMap(d=>d.status==="fulfilled"&&Wm(d.value)?d.value:[]);n(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=HD(r,d=>d.newSymbolName);n(`distinct candidates - ${a.length} candidates.`);const c=a.filter(({newSymbolName:d})=>d.trim().length>0&&d!==this._inputWithButton.input.value&&d!==t&&!this._candidates.has(d));if(n(`valid distinct candidates - ${r.length} candidates.`),c.forEach(d=>this._candidates.add(d.newSymbolName)),c.length<1){n("returning early - no valid distinct candidates");return}n("setting candidates"),this._renameCandidateListView.setCandidates(c),n("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){const e=this._editor.getVisibleRanges();let t;return e.length>0?t=e[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),t=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(t)}_trace(...e){this._logService.trace("RenameWidget",...e)}};ux=R5([Nm(2,lr),Nm(3,Zn),Nm(4,Ri),Nm(5,oh)],ux);class I1{constructor(e,t){this._disposables=new Oe,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=t.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=t.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",e.appendChild(this._listContainer),this._listWidget=I1._createListWidget(this._listContainer,this._candidateViewHeight,t.fontInfo),this._listWidget.onDidChangeFocus(i=>{i.elements.length===1&&t.onFocusChange(i.elements[0].newSymbolName)},this._disposables),this._listWidget.onDidChangeSelection(i=>{i.elements.length===1&&t.onSelectionChange()},this._disposables),this._disposables.add(this._listWidget.onDidBlur(i=>{this._listWidget.setFocus([])})),this._listWidget.style(FE({listInactiveFocusForeground:RE,listInactiveFocusBackground:AE}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:e,width:t}){this._availableHeight=e,this._minimumWidth=t}setCandidates(e){this._listWidget.splice(0,0,e);const t=this._pickListHeight(this._listWidget.length),i=this._pickListWidth(e);this._listWidget.layout(t,i),this._listContainer.style.height=`${t}px`,this._listContainer.style.width=`${i}px`,Ru(w("renameSuggestionsReceivedAria","Received {0} rename suggestions",e.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;const e=this._listWidget.getSelectedElements()[0];if(e!==void 0)return e.newSymbolName;const t=this._listWidget.getFocusedElements()[0];if(t!==void 0)return t.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(e[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0){this._listWidget.focusLast();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}else{if(e[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){const{totalHeight:e}=tp.getLayoutInfo({lineHeight:this._lineHeight});return e}_pickListHeight(e){const t=this._candidateViewHeight*e;return Math.min(t,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(e){const t=Math.ceil(Math.max(...e.map(n=>n.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+t+10)}static _createListWidget(e,t,i){const n=new class{getTemplateId(r){return"candidate"}getHeight(r){return t}},s=new class{constructor(){this.templateId="candidate"}renderTemplate(r){return new tp(r,i)}renderElement(r,a,c){c.populate(r)}disposeTemplate(r){r.dispose()}};return new c0("NewSymbolNameCandidates",e,n,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class A5{constructor(){this._onDidInputChange=new ti,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new Oe}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",w("renameAriaLabel","Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=w("generateRenameSuggestionsButton","Generate new name suggestions"),this._buttonCancelHoverText=w("cancelRenameSuggestionsButton","Cancel"),this._buttonHover=G2().setupManagedHover(Ob("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(Ni(this.input,Cn.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(Ni(this.input,Cn.KEY_DOWN,e=>{const t=new E0(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(Ni(this.input,Cn.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(Ni(this.input,Cn.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add(Ni(this.input,Cn.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return Oi(this._inputNode),this._inputNode}get button(){return Oi(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){var e;this._buttonState="sparkle",this._sparkleIcon??(this._sparkleIcon=jy(Ot.sparkle)),la(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),(e=this._buttonHover)==null||e.update(this._buttonGenHoverText),this.input.focus()}setStopButton(){var e;this._buttonState="stop",this._stopIcon??(this._stopIcon=jy(Ot.primitiveSquare)),la(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),(e=this._buttonHover)==null||e.update(this._buttonCancelHoverText),this.input.focus()}dispose(){this._disposables.dispose()}}const Sf=class Sf{constructor(e,t){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${t.lineHeight}px`,this._domNode.style.padding=`${Sf._PADDING}px`;const i=document.createElement("div");i.style.display="flex",i.style.alignItems="center",i.style.width=i.style.height=`${t.lineHeight*.8}px`,this._domNode.appendChild(i),this._icon=jy(Ot.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),xE(this._label,t),this._domNode.appendChild(this._label),e.appendChild(this._domNode)}populate(e){this._updateIcon(e),this._updateLabel(e)}_updateIcon(e){var i;const t=!!((i=e.tags)!=null&&i.includes(Z2.AIGenerated));this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+Sf._PADDING*2}}dispose(){}};Sf._PADDING=2;let tp=Sf;var O5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fl=function(o,e){return function(t,i){e(t,i,o)}},gx;class k1{constructor(e,t,i){this.model=e,this.position=t,this._providerRenameIdx=0,this._providers=i.ordered(e)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(e){const t=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){const n=this._providers[this._providerRenameIdx];if(!n.resolveRenameLocation)break;const s=await n.resolveRenameLocation(this.model,this.position,e);if(s){if(s.rejectReason){t.push(s.rejectReason);continue}return s}}this._providerRenameIdx=0;const i=this.model.getWordAtPosition(this.position);return i?{range:new H(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join(`
|
|
76
|
-
`):void 0}:{range:H.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
|
|
77
|
-
`):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,i,n){const s=this._providers[t];if(!s)return{edits:[],rejectReason:i.join(`
|
|
78
|
-
`)};const r=await s.provideRenameEdits(this.model,this.position,e,n);if(r){if(r.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(r.rejectReason),n)}else return this._provideRenameEdits(e,t+1,i.concat(w("no result","No result.")),n);return r}}async function F5(o,e,t,i){const n=new k1(e,t,o),s=await n.resolveRenameLocation(ii.None);return s!=null&&s.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,ii.None)}var Td;let lc=(Td=class{static get(e){return e.getContribution(gx.ID)}constructor(e,t,i,n,s,r,a,c,d){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=s,this._logService=r,this._configService=a,this._languageFeaturesService=c,this._telemetryService=d,this._disposableStore=new Oe,this._cts=new gs,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(ux,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var _,y;const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new gs,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new k1(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const n=new Mu(this.editor,5,void 0,this._cts.token);let s;try{e("resolving rename location");const S=i.resolveRenameLocation(n.token);this._progressService.showWhile(S,250),s=await S,e("resolved rename location")}catch(S){S instanceof kb?e("resolve rename location cancelled",JSON.stringify(S,null," ")):(e("resolve rename location failed",S instanceof Error?S:JSON.stringify(S,null," ")),(typeof S=="string"||Fm(S))&&((_=io.get(this.editor))==null||_.showMessage(S||w("resolveRenameLocationFailed","An unknown error occurred while resolving rename location"),t)));return}finally{n.dispose()}if(!s){e("returning early - no loc");return}if(s.rejectReason){e(`returning early - rejected with reason: ${s.rejectReason}`,s.rejectReason),(y=io.get(this.editor))==null||y.showMessage(s.rejectReason,t);return}if(n.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const r=new Mu(this.editor,5,s.range,this._cts.token),a=this.editor.getModel(),c=this._languageFeaturesService.newSymbolNamesProvider.all(a),d=await Promise.all(c.map(async S=>[S,await S.supportsAutomaticNewSymbolNamesTriggerKind??!1])),u=(S,D)=>{let E=d.slice();return S===Vy.Automatic&&(E=E.filter(([N,B])=>B)),E.map(([N])=>N.provideNewSymbolNames(a,s.range,S,D))};e("creating rename input field and awaiting its result");const f=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),m=await this._renameWidget.getInput(s.range,s.text,f,c.length>0?u:void 0,r);if(e("received response from rename input field"),c.length>0&&this._reportTelemetry(c.length,a.getLanguageId(),m),typeof m=="boolean"){e(`returning early - rename input field response - ${m}`),m&&this.editor.focus(),r.dispose();return}this.editor.focus(),e("requesting rename edits");const v=bp(i.provideRenameEdits(m.newName,r.token),r.token).then(async S=>{if(!S){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(S.rejectReason){e(`returning early - rejected with reason: ${S.rejectReason}`),this._notificationService.info(S.rejectReason);return}this.editor.setSelection(H.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(S,{editor:this.editor,showPreview:m.wantsPreview,label:w("label","Renaming '{0}' to '{1}'",s==null?void 0:s.text,m.newName),code:"undoredo.rename",quotableLabel:w("quotableLabel","Renaming {0} to {1}",s==null?void 0:s.text,m.newName),respectAutoSaveConfig:!0}).then(D=>{e("edits applied"),D.ariaSummary&&or(w("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,m.newName,D.ariaSummary))}).catch(D=>{e(`error when applying edits ${JSON.stringify(D,null," ")}`),this._notificationService.error(w("rename.failedApply","Rename failed to apply edits")),this._logService.error(D)})},S=>{e("error when providing rename edits",JSON.stringify(S,null," ")),this._notificationService.error(w("rename.failed","Rename failed to compute edits")),this._logService.error(S)}).finally(()=>{r.dispose()});return e("returning rename operation"),this._progressService.showWhile(v,250),v}acceptRenameInput(e){this._renameWidget.acceptInput(e)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}_reportTelemetry(e,t,i){const n=typeof i=="boolean"?{kind:"cancelled",languageId:t,nRenameSuggestionProviders:e}:{kind:"accepted",languageId:t,nRenameSuggestionProviders:e,source:i.stats.source.k,nRenameSuggestions:i.stats.nRenameSuggestions,timeBeforeFirstInputFieldEdit:i.stats.timeBeforeFirstInputFieldEdit,wantsPreview:i.wantsPreview,nRenameSuggestionsInvocations:i.stats.nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:i.stats.hadAutomaticRenameSuggestionsInvocation};this._telemetryService.publicLog2("renameInvokedEvent",n)}},gx=Td,Td.ID="editor.contrib.renameController",Td);lc=gx=O5([fl(1,qt),fl(2,Rs),fl(3,xb),fl(4,yp),fl(5,oh),fl(6,X2),fl(7,gt),fl(8,Nr)],lc);class H5 extends Se{constructor(){super({id:"editor.action.rename",label:w("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:le.and(M.writable,M.hasRenameProvider),kbOpts:{kbExpr:M.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(Un),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return nn.isUri(n)&&ut.isIPosition(s)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(s),r.invokeWithinContext(a=>(this.reportTelemetry(a,r),this.run(a,r))))},on):super.runCommand(e,t)}run(e,t){const i=e.get(oh),n=lc.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}oi(lc.ID,lc,4);ie(H5);const D1=js.bindToContribution(lc.get);bt(new D1({id:"acceptRenameInput",precondition:wg,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:le.and(M.focus,le.not("isComposing")),primary:3}}));bt(new D1({id:"acceptRenameInputWithPreview",precondition:le.and(wg,le.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:le.and(M.focus,le.not("isComposing")),primary:2051}}));bt(new D1({id:"cancelRenameInput",precondition:wg,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:M.focus,primary:9,secondary:[1033]}}));Yi(class extends Vs{constructor(){super({id:"focusNextRenameSuggestion",title:{...ht("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:wg,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(Un).getFocusedCodeEditor();if(!t)return;const i=lc.get(t);i&&i.focusNextRenameSuggestion()}});Yi(class extends Vs{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...ht("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:wg,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(Un).getFocusedCodeEditor();if(!t)return;const i=lc.get(t);i&&i.focusPreviousRenameSuggestion()}});Us("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;Oi(typeof n=="string");const{renameProvider:s}=o.get(gt);return F5(s,e,t,n)});Us("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(gt),s=await new k1(e,t,i).resolveRenameLocation(ii.None);if(s!=null&&s.rejectReason)throw new Error(s.rejectReason);return s});Tr.as(Sp.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:w("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var W5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ak=function(o,e){return function(t,i){e(t,i,o)}},ku;let pv=(ku=class extends Be{constructor(e,t,i){super(),this.editor=e,this.languageConfigurationService=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(73)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(n=>{var r;const s=(r=this.editor.getModel())==null?void 0:r.getLanguageId();s&&n.affects(s)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(n=>{this.options&&!n.hasChanged(73)||(this.options=this.createOptions(e.getOption(73)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(n=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(n=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new ts(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}createOptions(e){if(!e||!this.editor.hasModel())return;const t=this.editor.getModel().getLanguageId();if(!t)return;const i=this.languageConfigurationService.getLanguageConfiguration(t).comments,n=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!i&&!(n!=null&&n.markers)))return{foldingRules:n,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){var i,n;if(!this.editor.hasModel()||!((i=this.options)!=null&&i.findMarkSectionHeaders)&&!((n=this.options)!=null&&n.findRegionSectionHeaders))return;const e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;const t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(s=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(s)})}updateDecorations(e){const t=this.editor.getModel();t&&(e=e.filter(s=>{if(!s.shouldBeInComments)return!0;const r=t.validateRange(s.range),a=t.tokenization.getLineTokens(r.startLineNumber),c=a.findTokenIndexAtOffset(r.startColumn-1),d=a.getStandardTokenType(c);return a.getLanguageId(c)===t.getLanguageId()&&d===1}));const i=Object.values(this.currentOccurrences).map(s=>s.decorationId),n=e.map(s=>B5(s));this.editor.changeDecorations(s=>{const r=s.deltaDecorations(i,n);this.currentOccurrences={};for(let a=0,c=r.length;a<c;a++){const d={sectionHeader:e[a],decorationId:r[a]};this.currentOccurrences[d.decorationId]=d}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}},ku.ID="editor.sectionHeaderDetector",ku);pv=W5([Ak(1,cs),Ak(2,rl)],pv);function B5(o){return{range:o.range,options:pi.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:o.hasSeparatorLine?2:1,sectionHeaderText:o.text}})}}oi(pv.ID,pv,1);function z5(o){for(let e=0,t=o.length;e<t;e+=4){const i=o[e+0],n=o[e+1],s=o[e+2],r=o[e+3];o[e+0]=r,o[e+1]=s,o[e+2]=n,o[e+3]=i}}function V5(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return Y2()||z5(e),J2.wrap(e)}function vN(o){const e=new Uint32Array(j5(o));let t=0;if(e[t++]=o.id,o.type==="full")e[t++]=1,e[t++]=o.data.length,e.set(o.data,t),t+=o.data.length;else{e[t++]=2,e[t++]=o.deltas.length;for(const i of o.deltas)e[t++]=i.start,e[t++]=i.deleteCount,i.data?(e[t++]=i.data.length,e.set(i.data,t),t+=i.data.length):e[t++]=0}return V5(e)}function j5(o){let e=0;if(e+=2,o.type==="full")e+=1+o.data.length;else{e+=1,e+=3*o.deltas.length;for(const t of o.deltas)t.data&&(e+=t.data.length)}return e}function fw(o){return o&&!!o.data}function bN(o){return o&&Array.isArray(o.edits)}class U5{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function wN(o,e){return o.has(e)}function $5(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function yN(o,e,t,i,n){const s=$5(o,e),r=await Promise.all(s.map(async a=>{let c,d=null;try{c=await a.provideDocumentSemanticTokens(e,a===t?i:null,n)}catch(u){d=u,c=null}return(!c||!fw(c)&&!bN(c))&&(c=null),new U5(a,c,d)}));for(const a of r){if(a.error)throw a.error;if(a.tokens)return a}return r.length>0?r[0]:null}function q5(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class K5{constructor(e,t){this.provider=e,this.tokens=t}}function G5(o,e){return o.has(e)}function SN(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function E1(o,e,t,i){const n=SN(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(c){jn(c),a=null}return(!a||!fw(a))&&(a=null),new K5(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}dn.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;Oi(t instanceof nn);const i=o.get(As).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(gt),s=q5(n,i);return s?s[0].getLegend():o.get(ls).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});dn.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;Oi(t instanceof nn);const i=o.get(As).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(gt);if(!wN(n,i))return o.get(ls).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await yN(n,i,null,null,ii.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!fw(a))return;const c=vN({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),c});dn.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;Oi(t instanceof nn);const n=o.get(As).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(gt),r=SN(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!H.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();const a=await E1(s,n,H.lift(i),ii.None);if(a)return a.provider.getLegend()});dn.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;Oi(t instanceof nn),Oi(H.isIRange(i));const n=o.get(As).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(gt),r=await E1(s,n,H.lift(i),ii.None);if(!(!r||!r.tokens))return vN({id:0,type:"full",data:r.tokens.data})});const P1="editor.semanticHighlighting";function s_(o,e,t){var n;const i=(n=t.getValue(P1,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))==null?void 0:n.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var CN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Qr=function(o,e){return function(t,i){e(t,i,o)}},ml;let fx=class extends Be{constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=u=>{this._watchers[u.uri.toString()]=new px(u,e,i,s,r)},c=(u,f)=>{f.dispose(),delete this._watchers[u.uri.toString()]},d=()=>{for(const u of t.getModels()){const f=this._watchers[u.uri.toString()];s_(u,i,n)?f||a(u):f&&c(u,f)}};t.getModels().forEach(u=>{s_(u,i,n)&&a(u)}),this._register(t.onModelAdded(u=>{s_(u,i,n)&&a(u)})),this._register(t.onModelRemoved(u=>{const f=this._watchers[u.uri.toString()];f&&c(u,f)})),this._register(n.onDidChangeConfiguration(u=>{u.affectsConfiguration(P1)&&d()})),this._register(i.onDidColorThemeChange(d))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};fx=CN([Qr(0,P0),Qr(1,As),Qr(2,lr),Qr(3,pn),Qr(4,Wo),Qr(5,gt)],fx);var Ql;let px=(Ql=class extends Be{constructor(e,t,i,n,s){super(),this._semanticTokensStylingService=t,this._isDisposed=!1,this._model=e,this._provider=s.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:ml.REQUEST_MIN_DELAY,max:ml.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new ts(()=>this._fetchDocumentSemanticTokensNow(),ml.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)}));const r=()=>{Ds(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const a of this._provider.all(e))typeof a.onDidChange=="function"&&this._documentProvidersChangeListeners.push(a.onDidChange(()=>{if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}))};r(),this._register(this._provider.onDidChange(()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(i.onDidColorThemeChange(a=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),Ds(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!wN(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new gs,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=yN(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],r=this._model.onDidChangeContent(c=>{s.push(c)}),a=new oo(!1);n.then(c=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),!c)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:d,tokens:u}=c,f=this._semanticTokensStylingService.getStyling(d);this._setDocumentSemanticTokens(d,u||null,f,s)}},c=>{c&&(dc(c)||typeof c.message=="string"&&c.message.indexOf("busy")!==-1)||on(c),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),(s.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,i,n,s){s=Math.min(s,i.length-n,e.length-t);for(let r=0;r<s;r++)i[n+r]=e[t+r]}_setDocumentSemanticTokens(e,t,i,n){const s=this._currentDocumentResponse,r=()=>{(n.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!i){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),r();return}if(bN(t)){if(!s){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:s.data};else{let a=0;for(const m of t.edits)a+=(m.data?m.data.length:0)-m.deleteCount;const c=s.data,d=new Uint32Array(c.length+a);let u=c.length,f=d.length;for(let m=t.edits.length-1;m>=0;m--){const v=t.edits[m];if(v.start>c.length){i.warnInvalidEditStart(s.resultId,t.resultId,m,v.start,c.length),this._model.tokenization.setSemanticTokens(null,!0);return}const _=u-(v.start+v.deleteCount);_>0&&(ml._copy(c,u-_,d,f-_,_),f-=_),v.data&&(ml._copy(v.data,0,d,f-v.data.length,v.data.length),f-=v.data.length),u=v.start}u>0&&ml._copy(c,0,d,0,u),t={resultId:t.resultId,data:d}}}if(fw(t)){this._currentDocumentResponse=new Z5(e,t.resultId,t.data);const a=JE(t,i,this._model.getLanguageId());if(n.length>0)for(const c of n)for(const d of a)for(const u of c.changes)d.applyEdit(u.range,u.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}},ml=Ql,Ql.REQUEST_MIN_DELAY=300,Ql.REQUEST_MAX_DELAY=2e3,Ql);px=ml=CN([Qr(1,P0),Qr(2,lr),Qr(3,Wo),Qr(4,gt)],px);class Z5{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}hg(fx);var X5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Og=function(o,e){return function(t,i){e(t,i,o)}},Du;let mv=(Du=class extends Be{constructor(e,t,i,n,s,r){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=n,this._editor=e,this._provider=r.documentRangeSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new ts(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const a=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange(()=>{a()})),this._register(this._editor.onDidChangeModel(()=>{this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelContent(c=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration(P1)&&(this._cancelAll(),a())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),a()})),a()}_cancelAll(){for(const e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,i=this._outstandingRequests.length;t<i;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;const e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!s_(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!G5(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}const t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(i=>this._requestRange(e,i)))}_requestRange(e,t){const i=e.getVersionId(),n=us(r=>Promise.resolve(E1(this._provider,e,t,r))),s=new oo(!1);return n.then(r=>{if(this._debounceInformation.update(e,s.elapsed()),!r||!r.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:a,tokens:c}=r,d=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,JE(c,d,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}},Du.ID="editor.contrib.viewportSemanticTokens",Du);mv=X5([Og(1,P0),Og(2,lr),Og(3,pn),Og(4,Wo),Og(5,gt)],mv);oi(mv.ID,mv,1);class Y5{constructor(e=!0){this.selectSubwords=e}provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s),this.selectSubwords&&this._addInWordRanges(s,e,n),this._addWordRanges(s,e,n),this._addWhitespaceLine(s,e,n),s.push({range:e.getFullModelRange()})}return i}_addInWordRanges(e,t,i){const n=t.getWordAtPosition(i);if(!n)return;const{word:s,startColumn:r}=n,a=i.column-r;let c=a,d=a,u=0;for(;c>=0;c--){const f=s.charCodeAt(c);if(c!==a&&(f===95||f===45))break;if(KL(f)&&GL(u))break;u=f}for(c+=1;d<s.length;d++){const f=s.charCodeAt(d);if(GL(f)&&KL(u))break;if(f===95||f===45)break;u=f}c<d&&e.push({range:new H(i.lineNumber,r+c,i.lineNumber,r+d)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new H(i.lineNumber,n.startColumn,i.lineNumber,n.endColumn)})}_addWhitespaceLine(e,t,i){t.getLineLength(i.lineNumber)>0&&t.getLineFirstNonWhitespaceColumn(i.lineNumber)===0&&t.getLineLastNonWhitespaceColumn(i.lineNumber)===0&&e.push({range:new H(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var J5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Q5=function(o,e){return function(t,i){e(t,i,o)}},mx;class T1{constructor(e,t){this.index=e,this.ranges=t}mov(e){const t=this.index+(e?1:-1);if(t<0||t>=this.ranges.length)return this;const i=new T1(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}var Md;let ip=(Md=class{static get(e){return e.getContribution(mx.ID)}constructor(e,t){this._editor=e,this._languageFeaturesService=t,this._ignoreSelection=!1}dispose(){var e;(e=this._selectionListener)==null||e.dispose()}async run(e){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||await LN(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),ii.None).then(s=>{var r;if(!(!bo(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!ua(this._editor.getSelections(),t,(a,c)=>a.equalsSelection(c)))){for(let a=0;a<s.length;a++)s[a]=s[a].filter(c=>c.containsPosition(t[a].getStartPosition())&&c.containsPosition(t[a].getEndPosition())),s[a].unshift(t[a]);this._state=s.map(a=>new T1(0,a)),(r=this._selectionListener)==null||r.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{var a;this._ignoreSelection||((a=this._selectionListener)==null||a.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(s=>s.mov(e));const n=this._state.map(s=>Mt.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}},mx=Md,Md.ID="editor.contrib.smartSelectController",Md);ip=mx=J5([Q5(1,gt)],ip);class xN extends Se{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=ip.get(t);i&&await i.run(this._forward)}}class e6 extends xN{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:w("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}dn.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class t6 extends xN{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:w("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:Ye.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}oi(ip.ID,ip,4);ie(e6);ie(t6);async function LN(o,e,t,i,n){const s=o.all(e).concat(new Y5(i.selectSubwords));s.length===1&&s.unshift(new ev);const r=[],a=[];for(const c of s)r.push(Promise.resolve(c.provideSelectionRanges(e,t,n)).then(d=>{if(bo(d)&&d.length===t.length)for(let u=0;u<t.length;u++){a[u]||(a[u]=[]);for(const f of d[u])H.isIRange(f.range)&&H.containsPosition(f.range,t[u])&&a[u].push(H.lift(f.range))}},jn));return await Promise.all(r),a.map(c=>{if(c.length===0)return[];c.sort((m,v)=>ut.isBefore(m.getStartPosition(),v.getStartPosition())?1:ut.isBefore(v.getStartPosition(),m.getStartPosition())||ut.isBefore(m.getEndPosition(),v.getEndPosition())?-1:ut.isBefore(v.getEndPosition(),m.getEndPosition())?1:0);const d=[];let u;for(const m of c)(!u||H.containsRange(m,u)&&!H.equalsRange(m,u))&&(d.push(m),u=m);if(!i.selectLeadingAndTrailingWhitespace)return d;const f=[d[0]];for(let m=1;m<d.length;m++){const v=d[m-1],_=d[m];if(_.startLineNumber!==v.startLineNumber||_.endLineNumber!==v.endLineNumber){const y=new H(v.startLineNumber,e.getLineFirstNonWhitespaceColumn(v.startLineNumber),v.endLineNumber,e.getLineLastNonWhitespaceColumn(v.endLineNumber));y.containsRange(v)&&!y.equalsRange(v)&&_.containsRange(y)&&!_.equalsRange(y)&&f.push(y);const S=new H(v.startLineNumber,1,v.endLineNumber,e.getLineMaxColumn(v.endLineNumber));S.containsRange(v)&&!S.equalsRange(y)&&_.containsRange(S)&&!_.equalsRange(S)&&f.push(S)}f.push(_)}return f})}dn.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;Oi(nn.isUri(t));const n=o.get(gt).selectionRangeProvider,s=await o.get(Ar).createModelReference(t);try{return LN(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},ii.None)}finally{s.dispose()}});const i6=Object.freeze({View:ht("view","View"),Help:ht("help","Help"),Test:ht("test","Test"),File:ht("file","File"),Preferences:ht("preferences","Preferences"),Developer:ht({key:"developer",comment:["A developer on Code itself or someone diagnosing issues in Code"]},"Developer")});class pf{constructor(e,t,i,n=null){this.startLineNumbers=e,this.endLineNumbers=t,this.lastLineRelativePosition=i,this.showEndForLine=n}equals(e){return!!e&&this.lastLineRelativePosition===e.lastLineRelativePosition&&this.showEndForLine===e.showEndForLine&&ua(this.startLineNumbers,e.startLineNumbers)&&ua(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new pf([],[],0)}}const Ok=wE("stickyScrollViewLayer",{createHTML:o=>o}),wy="data-sticky-line-index",Fk="data-sticky-is-line",n6="data-sticky-is-line-number",Hk="data-sticky-is-folding-icon";class s6 extends Be{constructor(e){super(),this._editor=e,this._foldingIconStore=new Oe,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(67),this._renderedStickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof ar),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const t=()=>{this._linesDomNode.style.left=this._editor.getOption(116).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(116)&&t(),i.hasChanged(67)&&(this._lineHeight=this._editor.getOption(67))})),this._register(this._editor.onDidScrollChange(i=>{i.scrollLeftChanged&&t(),i.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),this._register(this._foldingIconStore),t(),this._register(this._editor.onDidLayoutChange(i=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,i){if(i===void 0&&(!this._previousState&&!e||this._previousState&&this._previousState.equals(e)))return;const n=this._isWidgetHeightZero(e),s=n?void 0:e,r=n?0:this._findLineToRebuildWidgetFrom(e,i);this._renderRootNode(s,t,r),this._previousState=e}_isWidgetHeightZero(e){if(!e)return!0;const t=e.startLineNumbers.length*this._lineHeight+e.lastLineRelativePosition;if(t>0){this._lastLineRelativePosition=e.lastLineRelativePosition;const i=[...e.startLineNumbers];e.showEndForLine!==null&&(i[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]),this._lineNumbers=i}else this._lastLineRelativePosition=0,this._lineNumbers=[];return t===0}_findLineToRebuildWidgetFrom(e,t){if(!e||!this._previousState)return 0;if(t!==void 0)return t;const i=this._previousState,n=e.startLineNumbers.findIndex(s=>!i.startLineNumbers.includes(s));return n===-1?0:n}_updateWidgetWidth(){const e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_clearStickyLinesFromLine(e){this._foldingIconStore.clear();for(let t=e;t<this._renderedStickyLines.length;t++){const i=this._renderedStickyLines[t];i.lineNumberDomNode.remove(),i.lineDomNode.remove()}this._renderedStickyLines=this._renderedStickyLines.slice(0,e),this._rootDomNode.style.display="none"}_useFoldingOpacityTransition(e){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${e?.5:0}s`)}_setFoldingIconsVisibility(e){for(const t of this._renderedStickyLines){const i=t.foldingIcon;i&&i.setVisible(e?!0:i.isCollapsed)}}async _renderRootNode(e,t,i){if(this._clearStickyLinesFromLine(i),!e)return;for(const a of this._renderedStickyLines)this._updateTopAndZIndexOfStickyLine(a);const n=this._editor.getLayoutInfo(),s=this._lineNumbers.slice(i);for(const[a,c]of s.entries()){const d=this._renderChildNode(a+i,c,t,n);d&&(this._linesDomNode.appendChild(d.lineDomNode),this._lineNumbersDomNode.appendChild(d.lineNumberDomNode),this._renderedStickyLines.push(d))}t&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin));const r=this._lineNumbers.length*this._lineHeight+this._lastLineRelativePosition;this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${r}px`,this._linesDomNodeScrollable.style.height=`${r}px`,this._rootDomNode.style.height=`${r}px`,this._rootDomNode.style.marginLeft="0px",this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map(a=>a.scrollWidth))+n.verticalScrollbarWidth,this._editor.layoutOverlayWidget(this)}_setFoldingHoverListeners(){this._editor.getOption(111)==="mouseover"&&(this._foldingIconStore.add(Ni(this._lineNumbersDomNode,Cn.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Ni(this._lineNumbersDomNode,Cn.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,i,n){const s=this._editor._getViewModel();if(!s)return;const r=s.coordinatesConverter.convertModelPositionToViewPosition(new ut(t,1)).lineNumber,a=s.getViewLineRenderingData(r),c=this._editor.getOption(68);let d;try{d=Nf.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{d=[]}const u=new CE(!0,!0,a.content,a.continuesWithWrappedLine,a.isBasicASCII,a.containsRTL,0,a.tokens,d,a.tabSize,a.startVisibleColumn,1,1,1,500,"none",!0,!0,null),f=new yE(2e3),m=SE(u,f);let v;Ok?v=Ok.createHTML(f.build()):v=f.build();const _=document.createElement("span");_.setAttribute(wy,String(e)),_.setAttribute(Fk,""),_.setAttribute("role","listitem"),_.tabIndex=0,_.className="sticky-line-content",_.classList.add(`stickyLine${t}`),_.style.lineHeight=`${this._lineHeight}px`,_.innerHTML=v;const y=document.createElement("span");y.setAttribute(wy,String(e)),y.setAttribute(n6,""),y.className="sticky-line-number",y.style.lineHeight=`${this._lineHeight}px`;const S=n.contentLeft;y.style.width=`${S}px`;const D=document.createElement("span");c.renderType===1||c.renderType===3&&t%10===0?D.innerText=t.toString():c.renderType===2&&(D.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),D.className="sticky-line-number-inner",D.style.lineHeight=`${this._lineHeight}px`,D.style.width=`${n.lineNumbersWidth}px`,D.style.paddingLeft=`${n.lineNumbersLeft}px`,y.appendChild(D);const E=this._renderFoldingIconForLine(i,t);E&&y.appendChild(E.domNode),this._editor.applyFontInfo(_),this._editor.applyFontInfo(D),y.style.lineHeight=`${this._lineHeight}px`,_.style.lineHeight=`${this._lineHeight}px`,y.style.height=`${this._lineHeight}px`,_.style.height=`${this._lineHeight}px`;const N=new o6(e,t,_,y,E,m.characterMapping,_.scrollWidth);return this._updateTopAndZIndexOfStickyLine(N)}_updateTopAndZIndexOfStickyLine(e){var u;const t=e.index,i=e.lineDomNode,n=e.lineNumberDomNode,s=t===this._lineNumbers.length-1,r="0",a="1";i.style.zIndex=s?r:a,n.style.zIndex=s?r:a;const c=`${t*this._lineHeight+this._lastLineRelativePosition+((u=e.foldingIcon)!=null&&u.isCollapsed?1:0)}px`,d=`${t*this._lineHeight}px`;return i.style.top=s?c:d,n.style.top=s?c:d,e}_renderFoldingIconForLine(e,t){const i=this._editor.getOption(111);if(!e||i==="never")return;const n=e.regions,s=n.findRange(t),r=n.getStartLineNumber(s);if(!(t===r))return;const c=n.isCollapsed(s),d=new r6(c,r,n.getEndLineNumber(s),this._lineHeight);return d.setVisible(this._isOnGlyphMargin?!0:c||i==="always"),d.domNode.setAttribute(Hk,""),d}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOridinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e<this._renderedStickyLines.length&&this._renderedStickyLines[e].lineDomNode.focus()}getEditorPositionFromNode(e){if(!e||e.children.length>0)return null;const t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;const i=Q2(t.characterMapping,e,0);return new ut(t.lineNumber,i)}getLineNumberFromChildDomNode(e){var t;return((t=this._getRenderedStickyLineFromChildDomNode(e))==null?void 0:t.lineNumber)??null}_getRenderedStickyLineFromChildDomNode(e){const t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){const t=this._getAttributeValue(e,wy);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,Fk)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,Hk)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class o6{constructor(e,t,i,n,s,r,a){this.index=e,this.lineNumber=t,this.lineDomNode=i,this.lineNumberDomNode=n,this.foldingIcon=s,this.characterMapping=r,this.scrollWidth=a}}class r6{constructor(e,t,i,n){this.isCollapsed=e,this.foldingStartLine=t,this.foldingEndLine=i,this.dimension=n,this.domNode=document.createElement("div"),this.domNode.style.width=`${n}px`,this.domNode.style.height=`${n}px`,this.domNode.className=Wi.asClassName(e?j_:V_)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class mf{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class _v{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class IN{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var pw=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},np=function(o,e){return function(t,i){e(t,i,o)}},_f;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(_f||(_f={}));var Ml;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(Ml||(Ml={}));let _x=class extends Be{constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new ic(300)),this._updateOperation=this._register(new Oe),this._editor.getOption(116).defaultModel){case _f.OUTLINE_MODEL:this._modelProviders.push(new vx(this._editor,n));case _f.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new wx(this._editor,t,n));case _f.INDENTATION_MODEL:this._modelProviders.push(new bx(this._editor,i));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(const t of this._modelProviders){const{statusPromise:i,modelPromise:n}=t.computeStickyModel(e);this._modelPromise=n;const s=await i;if(this._modelPromise!==n)return null;switch(s){case Ml.CANCELED:return this._updateOperation.clear(),null;case Ml.VALID:return t.stickyModel}}return null}).catch(t=>(on(t),null))}};_x=pw([np(2,qt),np(3,gt)],_x);class kN extends Be{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,Ml.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=us(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?Ml.CANCELED:(this._stickyModel=this.createStickyModel(e,i),Ml.VALID):this._invalid()).then(void 0,i=>(on(i),Ml.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let vx=class extends kN{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return Ta.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){var r;const{stickyOutlineElement:i,providerID:n}=this._stickyModelFromOutlineModel(t,(r=this._stickyModel)==null?void 0:r.outlineProviderId),s=this._editor.getModel();return new IN(s.uri,s.getVersionId(),i,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(za.first(e.children.values())instanceof GM){const a=za.find(e.children.values(),c=>c.id===t);if(a)i=a.children;else{let c="",d=-1,u;for(const[f,m]of e.children.entries()){const v=this._findSumOfRangesOfGroup(m);v>d&&(u=m,d=v,c=m.id)}t=c,i=u.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((a,c)=>{const d=new mf(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),u=new mf(c.symbol.range.startLineNumber,c.symbol.range.endLineNumber);return this._comparator(d,u)});for(const a of s)n.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new _v(void 0,n,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){const i=[];for(const s of e.children.values())if(s.symbol.selectionRange.startLineNumber!==s.symbol.range.endLineNumber)if(s.symbol.selectionRange.startLineNumber!==t)i.push(this._stickyModelFromOutlineElement(s,s.symbol.selectionRange.startLineNumber));else for(const r of s.children.values())i.push(this._stickyModelFromOutlineElement(r,s.symbol.selectionRange.startLineNumber));i.sort((s,r)=>this._comparator(s.range,r.range));const n=new mf(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new _v(n,i,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(const i of e.children.values())t+=this._findSumOfRangesOfGroup(i);return e instanceof aC?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};vx=pw([np(1,gt)],vx);class DN extends kN{constructor(e){super(e),this._foldingLimitReporter=new $M(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new IN(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new _v(void 0,[],void 0);for(let s=0;s<t;s++){const r=e.getParentIndex(s);let a;r!==-1?a=i[r]:a=n;const c=new _v(new mf(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(c),i.push(c)}return n}}let bx=class extends DN{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new m1(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};bx=pw([np(1,cs)],bx);let wx=class extends DN{constructor(e,t,i){super(e),this._languageFeaturesService=i;const n=ac.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());n.length>0&&(this.provider=this._register(new _1(e.getModel(),n,t,this._foldingLimitReporter,void 0)))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){var t;return((t=this.provider)==null?void 0:t.compute(e))??null}};wx=pw([np(2,gt)],wx);var a6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Wk=function(o,e){return function(t,i){e(t,i,o)}};class l6{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let yx=class extends Be{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new ti),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new Oe),this._updateSoon=this._register(new ts(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(116)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(116).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this._sessionStore.add(gn(()=>{var t;(t=this._stickyModelProvider)==null||t.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){var e;return(e=this._model)==null?void 0:e.version}updateStickyModelProvider(){var t;(t=this._stickyModelProvider)==null||t.dispose(),this._stickyModelProvider=null;const e=this._editor;e.hasModel()&&(this._stickyModelProvider=new _x(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){var e;(e=this._cts)==null||e.dispose(!0),this._cts=new gs,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}const t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}updateIndex(e){return e===-1?e=0:e<0&&(e=-e-2),e}getCandidateStickyLinesIntersectingFromStickyModel(e,t,i,n,s){if(t.children.length===0)return;let r=s;const a=[];for(let u=0;u<t.children.length;u++){const f=t.children[u];f.range&&a.push(f.range.startLineNumber)}const c=this.updateIndex(m_(a,e.startLineNumber,(u,f)=>u-f)),d=this.updateIndex(m_(a,e.startLineNumber+n,(u,f)=>u-f));for(let u=c;u<=d;u++){const f=t.children[u];if(!f)return;if(f.range){const m=f.range.startLineNumber,v=f.range.endLineNumber;e.startLineNumber<=v+1&&m-1<=e.endLineNumber&&m!==r&&(r=m,i.push(new l6(m,v-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,f,i,n+1,m))}else this.getCandidateStickyLinesIntersectingFromStickyModel(e,f,i,n,s)}}getCandidateStickyLinesIntersecting(e){var n,s;if(!((n=this._model)!=null&&n.element))return[];let t=[];this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,-1);const i=(s=this._editor._getViewModel())==null?void 0:s.getHiddenAreas();if(i)for(const r of i)t=t.filter(a=>!(a.startLineNumber>=r.startLineNumber&&a.endLineNumber<=r.endLineNumber+1));return t}};yx=a6([Wk(1,gt),Wk(2,cs)],yx);var c6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nh=function(o,e){return function(t,i){e(t,i,o)}},Sx,Nd;let il=(Nd=class extends Be{constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=i,this._instaService=n,this._contextKeyService=a,this._sessionStore=new Oe,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._stickyScrollWidget=new s6(this._editor),this._stickyLineCandidateProvider=new yx(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=pf.Empty,this._onDidResize(),this._readConfiguration();const c=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(u=>{this._readConfigurationChange(u)})),this._register(Ni(c,Cn.CONTEXT_MENU,async u=>{this._onContextMenu(zc(c),u)})),this._stickyScrollFocusedContextKey=M.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=M.stickyScrollVisible.bindTo(this._contextKeyService);const d=this._register(Nu(c));this._register(d.onDidBlur(u=>{this._positionRevealed===!1&&c.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(d.onDidFocus(u=>{this.focus()})),this._registerMouseListeners(),this._register(Ni(c,Cn.MOUSE_DOWN,u=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(Sx.ID)}_disposeFocusStickyScrollStore(){var e;this._stickyScrollFocusedContextKey.set(!1),(e=this._focusDisposableStore)==null||e.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new Oe,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(H.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new Oe),t=this._register(new sw(this._editor,{extractLineNumberFromMouseEvent:s=>{const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return r?r.lineNumber:0}})),i=s=>{if(!this._editor.hasModel()||s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return null;const r=s.target.element;if(!r||r.innerText!==r.innerHTML)return null;const a=this._stickyScrollWidget.getEditorPositionFromNode(r);return a?{range:new H(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(Za(n,Cn.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const d=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(d===null)return;const u=new ut(this._endLineNumbers[d],1);this._revealLineInCenterIfOutsideViewport(u);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const d=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(d);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let c=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!c){const d=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(d===null)return;c=new ut(d,1)}this._revealPosition(c)})),this._register(Za(n,Cn.MOUSE_MOVE,s=>{if(s.shiftKey){const r=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(r===null||this._showEndForLine!==null&&this._showEndForLine===r)return;this._showEndForLine=r,this._renderStickyScroll();return}this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(Ni(n,Cn.MOUSE_LEAVE,s=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([s,r])=>{const a=i(s);if(!a||!s.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:c,textElement:d}=a;if(!c.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=c,e.clear();else if(d.style.textDecoration==="underline")return;const u=new gs;e.add(gn(()=>u.dispose(!0)));let f;Vp(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new ut(c.startLineNumber,c.startColumn+1),!1,u.token).then((m=>{if(!u.token.isCancellationRequested)if(m.length!==0){this._candidateDefinitionsLength=m.length;const v=d;f!==v?(e.clear(),f=v,f.style.textDecoration="underline",e.add(gn(()=>{f.style.textDecoration="none"}))):f||(f=v,f.style.textDecoration="underline",e.add(gn(()=>{f.style.textDecoration="none"})))}else e.clear()}))})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async s=>{if(s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return;const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);r&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:r.lineNumber,column:1})),this._instaService.invokeFunction(DM,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new eF(e,t);this._contextMenuService.showContextMenu({menuId:Ye.StickyScrollContext,getAnchor:()=>i})}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;const t=this._stickyScrollWidget.getRenderedStickyLine(e),i=t==null?void 0:t.foldingIcon;if(!i)return;g1(this._foldingModel,Number.MAX_VALUE,[e]),i.isCollapsed=!i.isCollapsed;const n=(i.isCollapsed?this._editor.getTopForLineNumber(i.foldingEndLine):this._editor.getTopForLineNumber(i.foldingStartLine))-this._editor.getOption(67)*t.index+1;this._editor.setScrollTop(n),this._renderStickyScroll(e)}_readConfiguration(){const e=this._editor.getOption(116);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(i=>{i.scrollTopChanged&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(i=>this._onTokensChange(i))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=void 0,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(68).renderType===2&&this._sessionStore.add(this._editor.onDidChangeCursorPosition(()=>{this._showEndForLine=void 0,this._renderStickyScroll(0)}))}_readConfigurationChange(e){(e.hasChanged(116)||e.hasChanged(73)||e.hasChanged(67)||e.hasChanged(111)||e.hasChanged(68))&&this._readConfiguration(),e.hasChanged(68)&&this._renderStickyScroll(0)}_needsUpdate(e){const t=this._stickyScrollWidget.getCurrentLines();for(const i of t)for(const n of e.ranges)if(i>=n.fromLineNumber&&i<=n.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(67);this._maxStickyLines=Math.round(t*.25)}async _renderStickyScroll(e){const t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}const i=this._updateAndGetMinRebuildFromLine(e),n=this._stickyLineCandidateProvider.getVersionId();if(n===void 0||n===t.getVersionId())if(!this._focused)await this._updateState(i);else if(this._focusedStickyElementIndex===-1)await this._updateState(i),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const r=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(i),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(r)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){const t=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){var i;this._minRebuildFromLine=void 0,this._foldingModel=await((i=ac.get(this._editor))==null?void 0:i.getFoldingModel())??void 0,this._widgetState=this.findScrollWidgetState();const t=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(t),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=pf.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){const e=this._editor.getOption(67),t=Math.min(this._maxStickyLines,this._editor.getOption(116).maxLineCount),i=this._editor.getScrollTop();let n=0;const s=[],r=[],a=this._editor.getVisibleRanges();if(a.length!==0){const c=new mf(a[0].startLineNumber,a[a.length-1].endLineNumber),d=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(c);for(const u of d){const f=u.startLineNumber,m=u.endLineNumber,v=u.nestingDepth;if(m-f>0){const _=(v-1)*e,y=v*e,S=this._editor.getBottomForLineNumber(f)-i,D=this._editor.getTopForLineNumber(m)-i,E=this._editor.getBottomForLineNumber(m)-i;if(_>D&&_<=E){s.push(f),r.push(m+1),n=E-y;break}else y>S&&y<=E&&(s.push(f),r.push(m+1));if(s.length===t)break}}}return this._endLineNumbers=r,new pf(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}},Sx=Nd,Nd.ID="store.contrib.stickyScrollController",Nd);il=Sx=c6([Nh(1,lg),Nh(2,gt),Nh(3,qt),Nh(4,cs),Nh(5,Wo),Nh(6,Ri)],il);class d6 extends Vs{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...ht("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:w({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:ht("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:i6.View,toggled:{condition:le.equals("config.editor.stickyScroll.enabled",!0),title:w("stickyScroll","Sticky Scroll"),mnemonicTitle:w({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:Ye.CommandPalette},{id:Ye.MenubarAppearanceMenu,group:"4_editor",order:3},{id:Ye.StickyScrollContext}]})}async run(e){const t=e.get(pn),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const mw=100;class h6 extends Pr{constructor(){super({id:"editor.action.focusStickyScroll",title:{...ht("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:w({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:le.and(le.has("config.editor.stickyScroll.enabled"),M.stickyScrollVisible),menu:[{id:Ye.CommandPalette}]})}runEditorCommand(e,t){var i;(i=il.get(t))==null||i.focus()}}class u6 extends Pr{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:ht("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:mw,primary:18}})}runEditorCommand(e,t){var i;(i=il.get(t))==null||i.focusNext()}}class g6 extends Pr{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:ht("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:mw,primary:16}})}runEditorCommand(e,t){var i;(i=il.get(t))==null||i.focusPrevious()}}class f6 extends Pr{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:ht("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:mw,primary:3}})}runEditorCommand(e,t){var i;(i=il.get(t))==null||i.goToFocused()}}class p6 extends Pr{constructor(){super({id:"editor.action.selectEditor",title:ht("selectEditor.title","Select Editor"),precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:mw,primary:9}})}runEditorCommand(e,t){var i;(i=il.get(t))==null||i.selectEditor()}}oi(il.ID,il,1);Yi(d6);Yi(h6);Yi(g6);Yi(u6);Yi(f6);Yi(p6);var EN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Jg=function(o,e){return function(t,i){e(t,i,o)}};class m6{constructor(e,t,i,n,s,r){this.range=e,this.insertText=t,this.filterText=i,this.additionalTextEdits=n,this.command=s,this.completion=r}}let Cx=class extends tF{constructor(e,t,i,n,s,r){super(s.disposable),this.model=e,this.line=t,this.word=i,this.completionModel=n,this._suggestMemoryService=r}canBeReused(e,t,i){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===i.startColumn&&this.word.endColumn<i.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){const e=[],{items:t}=this.completionModel,i=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},t),n=za.slice(t,i),s=za.slice(t,0,i);let r=5;for(const a of za.concat(n,s)){if(a.score===Pf.Default)continue;const c=new H(a.editStart.lineNumber,a.editStart.column,a.editInsertEnd.lineNumber,a.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),d=a.completion.insertTextRules&&a.completion.insertTextRules&4?{snippet:a.completion.insertText}:a.completion.insertText;e.push(new m6(c,d,a.filterTextLow??a.labelLow,a.completion.additionalTextEdits,a.completion.command,a)),r-->=0&&a.resolve(ii.None)}return e}};Cx=EN([Jg(5,hw)],Cx);let xx=class extends Be{constructor(e,t,i,n){super(),this._languageFeatureService=e,this._clipboardService=t,this._suggestMemoryService=i,this._editorService=n,this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,i,n){var v;if(i.selectedSuggestionInfo)return;let s;for(const _ of this._editorService.listCodeEditors())if(_.getModel()===e){s=_;break}if(!s)return;const r=s.getOption(90);if(Qh.isAllOff(r))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),c=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(Qh.valueFor(r,c)!=="inline")return;let d=e.getWordAtPosition(t),u;if(d!=null&&d.word||(u=this._getTriggerCharacterInfo(e,t)),!(d!=null&&d.word)&&!u||(d||(d=e.getWordUntilPosition(t)),d.endColumn!==t.column))return;let f;const m=e.getValueInRange(new H(t.lineNumber,1,t.lineNumber,t.column));if(!u&&((v=this._lastResult)!=null&&v.canBeReused(e,t.lineNumber,d))){const _=new xk(m,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=_,this._lastResult.acquire(),f=this._lastResult}else{const _=await v1(this._languageFeatureService.completionProvider,e,t,new Gf(void 0,iv.createSuggestFilter(s).itemKind,u==null?void 0:u.providers),u&&{triggerKind:1,triggerCharacter:u.ch},n);let y;_.needsClipboard&&(y=await this._clipboardService.readText());const S=new yl(_.items,t.column,new xk(m,0),tv.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},y);f=new Cx(e,t.lineNumber,d,S,_,this._suggestMemoryService)}return this._lastResult=f,f}handleItemDidShow(e,t){t.completion.resolve(ii.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var s;const i=e.getValueInRange(H.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),n=new Set;for(const r of this._languageFeatureService.completionProvider.all(e))(s=r.triggerCharacters)!=null&&s.includes(i)&&n.add(r);if(n.size!==0)return{providers:n,ch:i}}};xx=EN([Jg(0,gt),Jg(1,cg),Jg(2,hw),Jg(3,Un)],xx);hg(xx);class _6 extends Se{constructor(){super({id:"editor.action.forceRetokenize",label:w("forceRetokenize","Developer: Force Retokenize"),alias:"Developer: Force Retokenize",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getModel();i.tokenization.resetTokenization();const n=new oo;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}ie(_6);const gb=class gb extends Vs{constructor(){super({id:gb.ID,title:ht({key:"toggle.tabMovesFocus",comment:["Turn on/off use of tab key for moving focus around VS Code"]},"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:ht("tabMovesFocusDescriptions","Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){const t=!ZL.getTabFocusMode();ZL.setTabFocusMode(t),t?or(w("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element")):or(w("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}};gb.ID="editor.action.toggleTabFocusMode";let Lx=gb;Yi(Lx);var v6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Bk=function(o,e){return function(t,i){e(t,i,o)}};let Ix=class extends Be{get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}constructor(e,t,i={},n,s){super(),this._link=t,this._hoverService=n,this._enabled=!0,this.el=Qe(e,rt("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??Ob("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const r=this._register(new Hw(this.el,"click")),a=this._register(new Hw(this.el,"keypress")),c=es.chain(a.event,f=>f.map(m=>new E0(m)).filter(m=>m.keyCode===3)),d=this._register(new Hw(this.el,iF.Tap)).event;this._register(zD.addTarget(this.el));const u=es.any(r.event,c,d);this._register(u(f=>{this.enabled&&(u_.stop(f,!0),i!=null&&i.opener?i.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}setTooltip(e){this.hoverDelegate.showNativeHover?this.el.title=e??"":!this.hover&&e?this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};Ix=v6([Bk(3,kp),Bk(4,Mr)],Ix);var PN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},TN=function(o,e){return function(t,i){e(t,i,o)}};const b6=26;let kx=class extends Be{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(Dx))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{var t;this.hide(),(t=e.onClose)==null||t.call(e)}}),this._editor.setBanner(this.banner.element,b6)}};kx=PN([TN(1,qt)],kx);let Dx=class extends Be{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(ug,{}),this.element=rt("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){const t=rt("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){la(this.element)}show(e){la(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=Qe(this.element,rt("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(rt(`div${Wi.asCSSSelector(e.icon)}`));const n=Qe(this.element,rt("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=Qe(this.element,rt("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(Ix,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=Qe(this.element,rt("div.action-container"));this.actionBar=this._register(new xf(s)),this.actionBar.push(this._register(new Fu("banner.close","Close Banner",Wi.asClassName(cE),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};Dx=PN([TN(0,qt)],Dx);var M1=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},uu=function(o,e){return function(t,i){e(t,i,o)}};const w6=Wn("extensions-warning-message",Ot.warning,w("warningIcon","Icon shown with a warning message in the extensions editor."));var Eu;let sp=(Eu=class extends Be{constructor(e,t,i,n){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=i,this._highlighter=null,this._bannerClosed=!1,this._updateState=s=>{if(s&&s.hasMore){if(this._bannerClosed)return;const r=Math.max(s.ambiguousCharacterCount,s.nonBasicAsciiCharacterCount,s.invisibleCharacterCount);let a;if(s.nonBasicAsciiCharacterCount>=r)a={message:w("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new rp};else if(s.ambiguousCharacterCount>=r)a={message:w("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new eh};else if(s.invisibleCharacterCount>=r)a={message:w("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new op};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:w6,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(kx,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(126),this._register(i.onDidChangeTrust(s=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(s=>{s.hasChanged(126)&&(this._options=e.getOption(126),this._updateHighlighter())})),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const e=y6(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(i=>i===!1))return;const t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(i=>i.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(i=>i==="_os"?new Intl.NumberFormat().resolvedOptions().locale:i==="_vscode"?nF:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new Ex(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new S6(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}},Eu.ID="editor.contrib.unicodeHighlighter",Eu);sp=M1([uu(1,rl),uu(2,sF),uu(3,qt)],sp);function y6(o,e){return{nonBasicASCII:e.nonBasicASCII===Ww?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===Ww?!o:e.includeComments,includeStrings:e.includeStrings===Ww?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let Ex=class extends Be{constructor(e,t,i,n){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=n,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new ts(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const n of t.ranges)i.push({range:n,options:vv.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!QE(t,e))return null;const i=t.getValueInRange(e.range);return{reason:NN(i,this._options),inComment:tP(t,e),inString:eP(t,e)}}};Ex=M1([uu(3,rl)],Ex);class S6 extends Be{constructor(e,t,i){super(),this._editor=e,this._options=t,this._updateState=i,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new ts(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._editor.getVisibleRanges(),t=[],i={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const n of e){const s=iP.computeUnicodeHighlights(this._model,this._options,n);for(const r of s.ranges)i.ranges.push(r);i.ambiguousCharacterCount+=i.ambiguousCharacterCount,i.invisibleCharacterCount+=i.invisibleCharacterCount,i.nonBasicAsciiCharacterCount+=i.nonBasicAsciiCharacterCount,i.hasMore=i.hasMore||s.hasMore}if(!i.hasMore)for(const n of i.ranges)t.push({range:n,options:vv.instance.getDecorationFromOptions(this._options)});this._updateState(i),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel(),i=t.getValueInRange(e.range);return QE(t,e)?{reason:NN(i,this._options),inComment:tP(t,e),inString:eP(t,e)}:null}}const MN=w("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let Px=class{constructor(e,t,i){this._editor=e,this._languageService=t,this._openerService=i,this.hoverOrdinal=5}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=this._editor.getContribution(sp.ID);if(!n)return[];const s=[],r=new Set;let a=300;for(const c of t){const d=n.getDecorationInfo(c);if(!d)continue;const f=i.getValueInRange(c.range).codePointAt(0),m=yy(f);let v;switch(d.reason.kind){case 0:{LE(d.reason.confusableWith)?v=w("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",m,yy(d.reason.confusableWith.codePointAt(0))):v=w("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",m,yy(d.reason.confusableWith.codePointAt(0)));break}case 1:v=w("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",m);break;case 2:v=w("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",m);break}if(r.has(v))continue;r.add(v);const _={codePoint:f,reason:d.reason,inComment:d.inComment,inString:d.inString},y=w("unicodeHighlight.adjustSettings","Adjust settings"),S=`command:${bv.ID}?${encodeURIComponent(JSON.stringify(_))}`,D=new Is("",!0).appendMarkdown(v).appendText(" ").appendLink(S,y,MN);s.push(new er(this,c.range,[D],!1,a++))}return s}renderHoverParts(e,t){return YB(e,t,this._editor,this._languageService,this._openerService)}};Px=M1([uu(1,Rr),uu(2,Mr)],Px);function Tx(o){return`U+${o.toString(16).padStart(4,"0")}`}function yy(o){let e=`\`${Tx(o)}\``;return nP.isInvisibleCharacter(o)||(e+=` "${`${C6(o)}`}"`),e}function C6(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function NN(o,e){return iP.computeUnicodeHighlightReason(o,e)}const fb=class fb{constructor(){this.map=new Map}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){const i=`${e}${t}`;let n=this.map.get(i);return n||(n=pi.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(i,n)),n}};fb.instance=new fb;let vv=fb;class x6 extends Se{constructor(){super({id:eh.ID,label:w("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const n=e==null?void 0:e.get(pn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ya.includeComments,!1,2)}}class L6 extends Se{constructor(){super({id:eh.ID,label:w("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const n=e==null?void 0:e.get(pn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ya.includeStrings,!1,2)}}const pb=class pb extends Se{constructor(){super({id:pb.ID,label:w("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(pn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ya.ambiguousCharacters,!1,2)}};pb.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";let eh=pb;const mb=class mb extends Se{constructor(){super({id:mb.ID,label:w("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(pn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ya.invisibleCharacters,!1,2)}};mb.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";let op=mb;const _b=class _b extends Se{constructor(){super({id:_b.ID,label:w("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(pn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ya.nonBasicASCII,!1,2)}};_b.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";let rp=_b;const vb=class vb extends Se{constructor(){super({id:vb.ID,label:w("action.unicodeHighlight.showExcludeOptions","Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}async run(e,t,i){const{codePoint:n,reason:s,inString:r,inComment:a}=i,c=String.fromCodePoint(n),d=e.get(nl),u=e.get(pn);function f(_){return nP.isInvisibleCharacter(_)?w("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",Tx(_)):w("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${Tx(_)} "${c}"`)}const m=[];if(s.kind===0)for(const _ of s.notAmbiguousInLocales)m.push({label:w("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',_),run:async()=>{k6(u,[_])}});if(m.push({label:f(n),run:()=>I6(u,[n])}),a){const _=new x6;m.push({label:_.label,run:async()=>_.runAction(u)})}else if(r){const _=new L6;m.push({label:_.label,run:async()=>_.runAction(u)})}if(s.kind===0){const _=new eh;m.push({label:_.label,run:async()=>_.runAction(u)})}else if(s.kind===1){const _=new op;m.push({label:_.label,run:async()=>_.runAction(u)})}else if(s.kind===2){const _=new rp;m.push({label:_.label,run:async()=>_.runAction(u)})}else D6(s);const v=await d.pick(m,{title:MN});v&&await v.run()}};vb.ID="editor.action.unicodeHighlight.showExcludeOptions";let bv=vb;async function I6(o,e){const t=o.getValue(Ya.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(Ya.allowedCharacters,i,2)}async function k6(o,e){var n;const t=(n=o.inspect(Ya.allowedLocales).user)==null?void 0:n.value;let i;typeof t=="object"&&t?i=Object.assign({},t):i={};for(const s of e)i[s]=!0;await o.updateValue(Ya.allowedLocales,i,2)}function D6(o){throw new Error(`Unexpected value: ${o}`)}ie(eh);ie(op);ie(rp);ie(bv);oi(sp.ID,sp,1);ch.register(Px);var E6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zk=function(o,e){return function(t,i){e(t,i,o)}};const RN="ignoreUnusualLineTerminators";function P6(o,e,t){o.setModelProperty(e.uri,RN,t)}function T6(o,e){return o.getModelProperty(e.uri,RN)}var Pu;let wv=(Pu=class extends Be{constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._isPresentingDialog=!1,this._config=this._editor.getOption(127),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(127)&&(this._config=this._editor.getOption(127),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(n=>{n.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;const e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||T6(this._codeEditorService,e)===!0||this._editor.getOption(92))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let i;try{this._isPresentingDialog=!0,i=await this._dialogService.confirm({title:w("unusualLineTerminators.title","Unusual Line Terminators"),message:w("unusualLineTerminators.message","Detected unusual line terminators"),detail:w("unusualLineTerminators.detail","The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",fa(e.uri)),primaryButton:w({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:w("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){P6(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}},Pu.ID="editor.contrib.unusualLineTerminatorsDetector",Pu);wv=E6([zk(1,T0),zk(2,Un)],wv);oi(wv.ID,wv,1);var M6=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},N6=function(o,e){return function(t,i){e(t,i,o)}};class Vk{constructor(){this.selector={language:"*"}}provideDocumentHighlights(e,t,i){const n=[],s=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});return s?e.isDisposed()?void 0:e.findMatches(s.word,!0,!1,!0,XL,!1).map(a=>({range:a.range,kind:v_.Text})):Promise.resolve(n)}provideMultiDocumentHighlights(e,t,i,n){const s=new tc,r=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});if(!r)return Promise.resolve(s);for(const a of[e,...i]){if(a.isDisposed())continue;const d=a.findMatches(r.word,!0,!1,!0,XL,!1).map(u=>({range:u.range,kind:v_.Text}));d&&s.set(a.uri,d)}return s}}let Mx=class extends Be{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new Vk)),this._register(e.multiDocumentHighlightProvider.register("*",new Vk))}};Mx=M6([N6(0,gt)],Mx);var AN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},o_=function(o,e){return function(t,i){e(t,i,o)}},On,Nx;const N1=new yi("hasWordHighlights",!1);function ON(o,e,t,i){const n=o.ordered(e);return L0(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,jn)),s=>s!=null).then(s=>{if(s){const r=new tc;return r.set(e.uri,s),r}return new tc})}function R6(o,e,t,i,n,s){const r=o.ordered(e);return L0(r.map(a=>()=>{const c=s.filter(d=>rF(d)).filter(d=>aF(a.selector,d.uri,d.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,c,n)).then(void 0,jn)}),a=>a!=null)}class FN{constructor(e,t,i){this._model=e,this._selection=t,this._wordSeparators=i,this._wordRange=this._getCurrentWordRange(e,t),this._result=null}get result(){return this._result||(this._result=us(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new H(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}isValid(e,t,i){const n=t.startLineNumber,s=t.startColumn,r=t.endColumn,a=this._getCurrentWordRange(e,t);let c=!!(this._wordRange&&this._wordRange.equalsRange(a));for(let d=0,u=i.length;!c&&d<u;d++){const f=i.getRange(d);f&&f.startLineNumber===n&&f.startColumn<=s&&f.endColumn>=r&&(c=!0)}return c}cancel(){this.result.cancel()}}class A6 extends FN{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return ON(this._providers,e,t.getPosition(),n).then(s=>s||new tc)}}class O6 extends FN{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return R6(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new tc)}}function F6(o,e,t,i,n){return new A6(e,t,n,o)}function H6(o,e,t,i,n,s){return new O6(e,t,n,o,s)}Us("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(gt),n=await ON(i.documentHighlightProvider,e,t,ii.None);return n==null?void 0:n.get(e.uri)});var ec;let Rx=(ec=class{constructor(e,t,i,n,s){this.toUnhook=new Oe,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new tc,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new ic(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=N1.bindTo(n),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(81),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(r=>{this._ignorePositionChangeEvent||this.occurrencesHighlight!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(r)})})),this.toUnhook.add(e.onDidFocusEditorText(r=>{this.occurrencesHighlight!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}))})),this.toUnhook.add(e.onDidChangeModelContent(r=>{oF(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():On.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(r=>{var c,d;const a=this.editor.getOption(81);if(this.occurrencesHighlight!==a)switch(this.occurrencesHighlight=a,a){case"off":this._stopAll();break;case"singleFile":this._stopAll((d=(c=On.query)==null?void 0:c.modelInfo)==null?void 0:d.model);break;case"multiFile":On.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",a);break}})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,On.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort(H.compareRangesUsingStarts)}moveNext(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))+1)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);or(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))-1+e.length)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);or(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=On.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),On.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(e){const t=this.codeEditorService.listCodeEditors(),i=[];for(const n of t){if(!n.hasModel()||d_(n.getModel().uri,e==null?void 0:e.uri))continue;const s=On.storedDecorationIDs.get(n.getModel().uri);if(!s)continue;n.removeDecorations(s),i.push(n.getModel().uri);const r=cc.get(n);r!=null&&r.wordHighlighter&&r.wordHighlighter.decorations.length>0&&(r.wordHighlighter.decorations.clear(),r.wordHighlighter.workerRequest=null,r.wordHighlighter._hasWordHighlights.set(!1))}for(const n of i)On.storedDecorationIDs.delete(n)}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasTextFocus()&&(((e=this.editor.getModel())==null?void 0:e.uri.scheme)!==Fs.vscodeNotebookCell&&((i=(t=On.query)==null?void 0:t.modelInfo)==null?void 0:i.model.uri.scheme)!==Fs.vscodeNotebookCell?(On.query=null,this._run()):(n=On.query)!=null&&n.modelInfo&&(On.query.modelInfo=null)),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(e){this._removeAllDecorations(e),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(e){var t;if(this.occurrencesHighlight==="off"){this._stopAll();return}if(e.reason!==3&&((t=this.editor.getModel())==null?void 0:t.uri.scheme)!==Fs.vscodeNotebookCell){this._stopAll();return}this._run()}_getWord(){const e=this.editor.getSelection(),t=e.startLineNumber,i=e.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:t,column:i})}getOtherModelsToHighlight(e){if(!e)return[];if(e.uri.scheme===Fs.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const c=a.getModel();c&&c!==e&&c.uri.scheme===Fs.vscodeNotebookCell&&s.push(c)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!sP(s))continue;const r=s.getModel();r&&e===r.modified&&i.push(r.modified)}if(i.length)return i;if(this.occurrencesHighlight==="singleFile")return[];for(const s of n){const r=s.getModel();r&&r!==e&&i.push(r)}return i}_run(e){var n,s;let t;if(this.editor.hasTextFocus()){const r=this.editor.getSelection();if(!r||r.startLineNumber!==r.endLineNumber){On.query=null,this._stopAll();return}const a=r.startColumn,c=r.endColumn,d=this._getWord();if(!d||d.startColumn>a||d.endColumn<c){On.query=null,this._stopAll();return}t=this.workerRequest&&this.workerRequest.isValid(this.model,r,this.decorations),On.query={modelInfo:{model:this.model,selection:r},word:d}}else if(!On.query){this._stopAll();return}if(this.lastCursorPositionChangeTime=new Date().getTime(),t)this.workerRequestCompleted&&this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1,this._beginRenderDecorations());else if(d_(this.editor.getModel().uri,(n=On.query.modelInfo)==null?void 0:n.model.uri)){if(!e){const c=this.decorations.getRanges();for(const d of c)if(d.containsPosition(this.editor.getPosition()))return}this._stopAll(e?this.model:void 0);const r=++this.workerRequestTokenId;this.workerRequestCompleted=!1;const a=this.getOtherModelsToHighlight(this.editor.getModel());if(!On.query||!On.query.modelInfo||On.query.modelInfo.model.isDisposed())return;this.workerRequest=this.computeWithModel(On.query.modelInfo.model,On.query.modelInfo.selection,On.query.word,a),(s=this.workerRequest)==null||s.result.then(c=>{r===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=c||[],this._beginRenderDecorations())},on)}}computeWithModel(e,t,i,n){return n.length?H6(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),n):F6(this.providers,e,t,i,this.editor.getOption(132))}_beginRenderDecorations(){const e=new Date().getTime(),t=this.lastCursorPositionChangeTime+250;e>=t?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){var t,i,n;this.renderDecorationsTimer=-1;const e=this.codeEditorService.listCodeEditors();for(const s of e){const r=cc.get(s);if(!r)continue;const a=[],c=(t=s.getModel())==null?void 0:t.uri;if(c&&this.workerRequestValue.has(c)){const d=On.storedDecorationIDs.get(c),u=this.workerRequestValue.get(c);if(u)for(const m of u)m.range&&a.push({range:m.range,options:I$(m.kind)});let f=[];s.changeDecorations(m=>{f=m.deltaDecorations(d??[],a)}),On.storedDecorationIDs=On.storedDecorationIDs.set(c,f),a.length>0&&((i=r.wordHighlighter)==null||i.decorations.set(a),(n=r.wordHighlighter)==null||n._hasWordHighlights.set(!0))}}}dispose(){this._stopSingular(),this.toUnhook.dispose()}},On=ec,ec.storedDecorationIDs=new tc,ec.query=null,ec);Rx=On=AN([o_(4,Un)],Rx);var Rd;let cc=(Rd=class extends Be{static get(e){return e.getContribution(Nx.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new Rx(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,n))};this._register(e.onDidChangeModel(r=>{this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),s()})),s()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){var e;(e=this._wordHighlighter)==null||e.moveNext()}moveBack(){var e;(e=this._wordHighlighter)==null||e.moveBack()}restoreViewState(e){this._wordHighlighter&&e&&this._wordHighlighter.restore()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}},Nx=Rd,Rd.ID="editor.contrib.wordHighlighter",Rd);cc=Nx=AN([o_(1,Ri),o_(2,gt),o_(3,Un)],cc);class HN extends Se{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=cc.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class W6 extends HN{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:w("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:N1,kbOpts:{kbExpr:M.editorTextFocus,primary:65,weight:100}})}}class B6 extends HN{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:w("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:N1,kbOpts:{kbExpr:M.editorTextFocus,primary:1089,weight:100}})}}class z6 extends Se{constructor(){super({id:"editor.action.wordHighlight.trigger",label:w("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=cc.get(t);n&&n.restoreViewState(!0)}}oi(cc.ID,cc,0);ie(W6);ie(B6);ie(z6);hg(Mx);class _w extends js{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=rh(t.getOption(132),t.getOption(131)),s=t.getModel(),r=t.getSelections(),a=r.length>1,c=r.map(d=>{const u=new ut(d.positionLineNumber,d.positionColumn),f=this._move(n,s,u,this._wordNavigationType,a);return this._moveTo(d,f,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,c.map(d=>lF.fromModelSelection(d))),c.length===1){const d=new ut(c[0].positionLineNumber,c[0].positionColumn);t.revealPosition(d,0)}}_moveTo(e,t,i){return i?new Mt(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new Mt(t.lineNumber,t.column,t.lineNumber,t.column)}}class gc extends _w{_move(e,t,i,n,s){return Mp.moveWordLeft(e,t,i,n,s)}}class fc extends _w{_move(e,t,i,n,s){return Mp.moveWordRight(e,t,i,n)}}class V6 extends gc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class j6 extends gc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class U6 extends gc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:le.and(M.textInputFocus,(e=le.and(Bb,zb))==null?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class $6 extends gc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class q6 extends gc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class K6 extends gc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:le.and(M.textInputFocus,(e=le.and(Bb,zb))==null?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class G6 extends gc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n,s){return super._move(rh(Vb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Z6 extends gc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(rh(Vb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class X6 extends fc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class Y6 extends fc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:le.and(M.textInputFocus,(e=le.and(Bb,zb))==null?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class J6 extends fc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class Q6 extends fc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class e8 extends fc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:le.and(M.textInputFocus,(e=le.and(Bb,zb))==null?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class t8 extends fc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class i8 extends fc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n,s){return super._move(rh(Vb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class n8 extends fc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(rh(Vb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class vw extends js{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(cs);if(!t.hasModel())return;const s=rh(t.getOption(132),t.getOption(131)),r=t.getModel(),a=t.getSelections(),c=t.getOption(6),d=t.getOption(11),u=n.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),f=t._getViewModel(),m=a.map(v=>{const _=this._delete({wordSeparators:s,model:r,selection:v,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:c,autoClosingQuotes:d,autoClosingPairs:u,autoClosedCharacters:f.getCursorAutoClosedCharacters()},this._wordNavigationType);return new vp(_,"")});t.pushUndoStop(),t.executeCommands(this.id,m),t.pushUndoStop()}}class R1 extends vw{_delete(e,t){const i=Mp.deleteWordLeft(e,t);return i||new H(1,1,1,1)}}class A1 extends vw{_delete(e,t){const i=Mp.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new H(n,s,n,s)}}class s8 extends R1{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:M.writable})}}class o8 extends R1{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:M.writable})}}class r8 extends R1{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class a8 extends A1{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:M.writable})}}class l8 extends A1{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:M.writable})}}class c8 extends A1{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class d8 extends Se{constructor(){super({id:"deleteInsideWord",precondition:M.writable,label:w("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=rh(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections().map(c=>{const d=Mp.deleteInsideWord(n,s,c);return new vp(d,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}bt(new V6);bt(new j6);bt(new U6);bt(new $6);bt(new q6);bt(new K6);bt(new X6);bt(new Y6);bt(new J6);bt(new Q6);bt(new e8);bt(new t8);bt(new G6);bt(new Z6);bt(new i8);bt(new n8);bt(new s8);bt(new o8);bt(new r8);bt(new a8);bt(new l8);bt(new c8);ie(d8);class h8 extends vw{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=jb.deleteWordPartLeft(e);return i||new H(1,1,1,1)}}class u8 extends vw{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=jb.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new H(n,s,n,s)}}class WN extends _w{_move(e,t,i,n,s){return jb.moveWordPartLeft(e,t,i,s)}}class g8 extends WN{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}dn.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class f8 extends WN{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}dn.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class BN extends _w{_move(e,t,i,n,s){return jb.moveWordPartRight(e,t,i)}}class p8 extends BN{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class m8 extends BN{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}bt(new h8);bt(new u8);bt(new g8);bt(new f8);bt(new p8);bt(new m8);const Z1=class Z1 extends Be{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=io.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new Is(w("editor.simple.readonly","Cannot edit in read-only input")):t=new Is(w("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}};Z1.ID="editor.contrib.readOnlyMessageController";let yv=Z1;oi(yv.ID,yv,2);var _8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jk=function(o,e){return function(t,i){e(t,i,o)}};let Ax=class extends Be{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=wo(this,void 0);const n=Vc("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=Vc("_textModel.onDidChangeContent",es.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(Lp(async(r,a)=>{n.read(r),s.read(r);const c=a.add(new hF),d=await this._outlineModelService.getOrCreate(this._textModel,c.token);a.isDisposed||this._currentModel.set(d,void 0)}))}getBreadcrumbItems(e,t){const i=this._currentModel.read(t);if(!i)return[];const n=i.asListOfDocumentSymbols().filter(s=>e.contains(s.range.startLineNumber)&&!e.contains(s.range.endLineNumber));return n.sort(dF(Dp(s=>s.range.endLineNumber-s.range.startLineNumber,Nb))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};Ax=_8([jk(1,gt),jk(2,$p)],Ax);cF.setBreadcrumbsSourceFactory((o,e)=>e.createInstance(Ax,o));const X1=class X1 extends Be{constructor(e){super(),this.editor=e,this.widget=null,Oy&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new Ox(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}};X1.ID="editor.contrib.iPadShowKeyboard";let Sv=X1;const bb=class bb extends Be{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Ni(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(Ni(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return bb.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};bb.ID="editor.contrib.ShowKeyboardWidget";let Ox=bb;oi(Sv.ID,Sv,3);var v8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Uk=function(o,e){return function(t,i){e(t,i,o)}},Fx,Ad;let ap=(Ad=class extends Be{static get(e){return e.getContribution(Fx.ID)}constructor(e,t,i){super(),this._editor=e,this._languageService=i,this._widget=null,this._register(this._editor.onDidChangeModel(n=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(n=>this.stop())),this._register(Ab.onDidChange(n=>this.stop())),this._register(this._editor.onKeyUp(n=>n.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new Hx(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}},Fx=Ad,Ad.ID="editor.contrib.inspectTokens",Ad);ap=Fx=v8([Uk(1,oP),Uk(2,Rr)],ap);class b8 extends Se{constructor(){super({id:"editor.action.inspectTokens",label:pF.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=ap.get(t);i==null||i.launch()}}function w8(o){let e="";for(let t=0,i=o.length;t<i;t++){const n=o.charCodeAt(t);switch(n){case 9:e+="→";break;case 32:e+="·";break;default:e+=String.fromCharCode(n)}}return e}function y8(o,e){const t=Ab.get(e);if(t)return t;const i=o.encodeLanguageId(e);return{getInitialState:()=>uF,tokenize:(n,s,r)=>fF(e,r),tokenizeEncoded:(n,s,r)=>gF(i,r)}}const wb=class wb extends Be{constructor(e,t){super(),this.allowEditorOverflow=!0,this._editor=e,this._languageService=t,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=y8(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(i=>this._compute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return wb._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let c=t.tokens1.length-1;c>=0;c--){const d=t.tokens1[c];if(e.column-1>=d.offset){i=c;break}}let n=0;for(let c=t.tokens2.length>>>1;c>=0;c--)if(e.column-1>=t.tokens2[c<<1]){n=c;break}const s=this._model.getLineContent(e.lineNumber);let r="";if(i<t.tokens1.length){const c=t.tokens1[i].offset,d=i+1<t.tokens1.length?t.tokens1[i+1].offset:s.length;r=s.substring(c,d)}h_(this._domNode,rt("h2.tm-token",void 0,w8(r),rt("span.tm-token-length",void 0,`${r.length} ${r.length===1?"char":"chars"}`))),Qe(this._domNode,rt("hr.tokens-inspect-separator",{style:"clear:both"}));const a=(n<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(n<<1)+1]):null;Qe(this._domNode,rt("table.tm-metadata-table",void 0,rt("tbody",void 0,rt("tr",void 0,rt("td.tm-metadata-key",void 0,"language"),rt("td.tm-metadata-value",void 0,`${a?a.languageId:"-?-"}`)),rt("tr",void 0,rt("td.tm-metadata-key",void 0,"token type"),rt("td.tm-metadata-value",void 0,`${a?this._tokenTypeToString(a.tokenType):"-?-"}`)),rt("tr",void 0,rt("td.tm-metadata-key",void 0,"font style"),rt("td.tm-metadata-value",void 0,`${a?this._fontStyleToString(a.fontStyle):"-?-"}`)),rt("tr",void 0,rt("td.tm-metadata-key",void 0,"foreground"),rt("td.tm-metadata-value",void 0,`${a?ui.Format.CSS.formatHex(a.foreground):"-?-"}`)),rt("tr",void 0,rt("td.tm-metadata-key",void 0,"background"),rt("td.tm-metadata-value",void 0,`${a?ui.Format.CSS.formatHex(a.background):"-?-"}`))))),Qe(this._domNode,rt("hr.tokens-inspect-separator")),i<t.tokens1.length&&Qe(this._domNode,rt("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=Ab.getColorMap(),i=Eg.getLanguageId(e),n=Eg.getTokenType(e),s=Eg.getFontStyle(e),r=Eg.getForeground(e),a=Eg.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(i),tokenType:n,fontStyle:s,foreground:t[r],background:t[a]}}_tokenTypeToString(e){switch(e){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_fontStyleToString(e){let t="";return e&1&&(t+="italic "),e&2&&(t+="bold "),e&4&&(t+="underline "),e&8&&(t+="strikethrough "),t.length===0&&(t="---"),t}_getTokensAtLine(e){const t=this._getStateBeforeLine(e),i=this._tokenizationSupport.tokenize(this._model.getLineContent(e),!0,t),n=this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(e),!0,t);return{startState:t,tokens1:i.tokens,tokens2:n.tokens,endState:i.endState}}_getStateBeforeLine(e){let t=this._tokenizationSupport.getInitialState();for(let i=1;i<e;i++)t=this._tokenizationSupport.tokenize(this._model.getLineContent(i),!0,t).endState;return t}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}};wb._ID="editor.contrib.inspectTokensWidget";let Hx=wb;oi(ap.ID,ap,4);ie(b8);var S8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$k=function(o,e){return function(t,i){e(t,i,o)}},Qg,Od;let Wx=(Od=class{constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=Tr.as(Np.Quickaccess)}provide(e){const t=new Oe;return t.add(e.onDidAccept(()=>{const[i]=e.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})})),t.add(e.onDidChangeValue(i=>{const n=this.registry.getQuickAccessProvider(i.substr(Qg.PREFIX.length));n&&n.prefix&&n.prefix!==Qg.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==Qg.PREFIX),t}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort((t,i)=>t.prefix.localeCompare(i.prefix)).flatMap(t=>this.createPicks(t))}createPicks(e){return e.helpEntries.map(t=>{const i=t.prefix||e.prefix,n=i||"…";return{prefix:i,label:n,keybinding:t.commandId?this.keybindingService.lookupKeybinding(t.commandId):void 0,ariaLabel:w("helpPickAriaLabel","{0}, {1}",n,t.description),description:t.description}})}},Qg=Od,Od.PREFIX="?",Od);Wx=Qg=S8([$k(0,nl),$k(1,Zn)],Wx);Tr.as(Np.Quickaccess).registerQuickAccessProvider({ctor:Wx,prefix:"",helpEntries:[{description:mF.helpQuickAccessActionLabel}]});class zN{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){var r;const n=new Oe;e.canAcceptInBackground=!!((r=this.options)!=null&&r.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=n.add(new So);return s.value=this.doProvide(e,t,i),n.add(this.onDidActiveTextEditorControlChange(()=>{s.value=void 0,s.value=this.doProvide(e,t)})),n}doProvide(e,t,i){const n=new Oe,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const r={editor:s},a=rP(s);if(a){let c=s.saveViewState()??void 0;n.add(a.onDidChangeCursorPosition(()=>{c=s.saveViewState()??void 0})),r.restoreViewState=()=>{c&&s===this.activeTextEditorControl&&s.restoreViewState(c)},n.add(aP(t.onCancellationRequested)(()=>{var d;return(d=r.restoreViewState)==null?void 0:d.call(r)}))}n.add(gn(()=>this.clearDecorations(s))),n.add(this.provideWithTextEditor(r,e,t,i))}else n.add(this.provideWithoutTextEditor(e,t));return n}canProvideWithTextEditor(e){return!0}gotoLocation({editor:e},t){e.setSelection(t.range,"code.jump"),e.revealRangeInCenter(t.range,0),t.preserveFocus||e.focus();const i=e.getModel();i&&"getLineContent"in i&&Ru(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){var t;return sP(e)?(t=e.getModel())==null?void 0:t.modified:e.getModel()}addDecorations(e,t){e.changeDecorations(i=>{const n=[];this.rangeHighlightDecorationId&&(n.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),n.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const s=[{range:t,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:Yn(uE),position:aa.Full}}}],[r,a]=i.deltaDecorations(n,s);this.rangeHighlightDecorationId={rangeHighlightId:r,overviewRulerDecorationId:a}})}clearDecorations(e){const t=this.rangeHighlightDecorationId;t&&(e.changeDecorations(i=>{i.deltaDecorations([t.overviewRulerDecorationId,t.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}}const yb=class yb extends zN{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=w("cannotRunGotoLine","Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,Be.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new Oe;s.add(t.onDidAccept(c=>{const[d]=t.selectedItems;if(d){if(!this.isValidLineNumber(n,d.lineNumber))return;this.gotoLocation(e,{range:this.toRange(d.lineNumber,d.column),keyMods:t.keyMods,preserveFocus:c.inBackground}),c.inBackground||t.hide()}}));const r=()=>{const c=this.parsePosition(n,t.value.trim().substr(yb.PREFIX.length)),d=this.getPickLabel(n,c.lineNumber,c.column);if(t.items=[{lineNumber:c.lineNumber,column:c.column,label:d}],t.ariaLabel=d,!this.isValidLineNumber(n,c.lineNumber)){this.clearDecorations(n);return}const u=this.toRange(c.lineNumber,c.column);n.revealRangeInCenter(u,0),this.addDecorations(n,u)};r(),s.add(t.onDidChangeValue(()=>r()));const a=rP(n);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(gn(()=>a.updateOptions({lineNumbers:"relative"})))),s}toRange(e=1,t=1){return{startLineNumber:e,startColumn:t,endLineNumber:e,endColumn:t}}parsePosition(e,t){const i=t.split(/,|:|#/).map(s=>parseInt(s,10)).filter(s=>!isNaN(s)),n=this.lineCount(e)+1;return{lineNumber:i[0]>0?i[0]:n+i[0],column:i[1]}}getPickLabel(e,t,i){if(this.isValidLineNumber(e,t))return this.isValidColumn(e,t,i)?w("gotoLineColumnLabel","Go to line {0} and character {1}.",t,i):w("gotoLineLabel","Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?w("gotoLineLabelEmptyWithLimit","Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,s):w("gotoLineLabelEmpty","Current Line: {0}, Character: {1}. Type a line number to navigate to.",n.lineNumber,n.column)}isValidLineNumber(e,t){return!t||typeof t!="number"?!1:t>0&&t<=this.lineCount(e)}isValidColumn(e,t,i){if(!i||typeof i!="number")return!1;const n=this.getModel(e);if(!n)return!1;const s={lineNumber:t,column:i};return n.validatePosition(s).equals(s)}lineCount(e){var t;return((t=this.getModel(e))==null?void 0:t.getLineCount())??0}};yb.PREFIX=":";let Bx=yb;var C8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},x8=function(o,e){return function(t,i){e(t,i,o)}};let lp=class extends Bx{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=es.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};lp=C8([x8(0,Un)],lp);var Fd;let VN=(Fd=class extends Se{constructor(){super({id:Fd.ID,label:lP.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(nl).quickAccess.show(lp.PREFIX)}},Fd.ID="editor.action.gotoLine",Fd);ie(VN);Tr.as(Np.Quickaccess).registerQuickAccessProvider({ctor:lp,prefix:lp.PREFIX,helpEntries:[{description:lP.gotoLineActionLabel,commandId:VN.ID}]});const jN=[void 0,[]];function Sy(o,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?L8(o,n.values,t,i):UN(o,e,t,i)}function L8(o,e,t,i){let n=0;const s=[];for(const r of e){const[a,c]=UN(o,r,t,i);if(typeof a!="number")return jN;n+=a,s.push(...c)}return[n,I8(s)]}function UN(o,e,t,i){const n=TE(e.original,e.originalLowercase,t,o,o.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],Rb(n)]:jN}function I8(o){const e=o.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!k8(i,n)?(i=n,t.push(n)):(i.start=Math.min(i.start,n.start),i.end=Math.max(i.end,n.end));return t}function k8(o,e){return!(o.end<e.start||e.end<o.start)}function qk(o){return o.startsWith('"')&&o.endsWith('"')}const $N=" ";function zx(o){typeof o!="string"&&(o="");const e=o.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:n}=Kk(o),s=t.indexOf(Uy)>=0,r=qk(o);let a;const c=o.split($N);if(c.length>1)for(const d of c){const u=qk(d),{pathNormalized:f,normalized:m,normalizedLowercase:v}=Kk(d);m&&(a||(a=[]),a.push({original:d,originalLowercase:d.toLowerCase(),pathNormalized:f,normalized:m,normalizedLowercase:v,expectContiguousMatch:u}))}return{original:o,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:n,values:a,containsPathSeparator:s,expectContiguousMatch:r}}function Kk(o){let e;Lb?e=o.replace(/\//g,Uy):e=o.replace(/\\/g,Uy);const t=_F(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function Gk(o){return Array.isArray(o)?zx(o.map(e=>e.original).join($N)):zx(o.original)}var D8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Zk=function(o,e){return function(t,i){e(t,i,o)}},r_,xr;let Xc=(xr=class extends zN{constructor(e,t,i=Object.create(null)){super(i),this._languageFeaturesService=e,this._outlineModelService=t,this.options=i,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(e){return this.provideLabelPick(e,w("cannotRunGotoSymbolWithoutEditor","To go to a symbol, first open a text editor with symbol information.")),Be.None}provideWithTextEditor(e,t,i,n){const s=e.editor,r=this.getModel(s);return r?this._languageFeaturesService.documentSymbolProvider.has(r)?this.doProvideWithEditorSymbols(e,r,t,i,n):this.doProvideWithoutEditorSymbols(e,r,t,i):Be.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new Oe;return this.provideLabelPick(i,w("cannotRunGotoSymbolWithoutSymbolProvider","The active text editor does not provide symbol information.")),(async()=>!await this.waitForLanguageSymbolRegistry(t,s)||n.isCancellationRequested||s.add(this.doProvideWithEditorSymbols(e,t,i,n)))(),s}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}async waitForLanguageSymbolRegistry(e,t){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;const i=new Ib,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(gn(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){var f;const r=e.editor,a=new Oe;a.add(i.onDidAccept(m=>{var _;const[v]=i.selectedItems;v&&v.range&&(this.gotoLocation(e,{range:v.range.selection,keyMods:i.keyMods,preserveFocus:m.inBackground}),(_=s==null?void 0:s.handleAccept)==null||_.call(s,v),m.inBackground||i.hide())})),a.add(i.onDidTriggerItemButton(({item:m})=>{m&&m.range&&(this.gotoLocation(e,{range:m.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const c=this.getDocumentSymbols(t,n);let d;const u=async m=>{d==null||d.dispose(!0),i.busy=!1,d=new gs(n),i.busy=!0;try{const v=zx(i.value.substr(r_.PREFIX.length).trim()),_=await this.doGetSymbolPicks(c,v,void 0,d.token,t);if(n.isCancellationRequested)return;if(_.length>0){if(i.items=_,m&&v.original.length===0){const y=yF(_,S=>!!(S.type!=="separator"&&S.range&&H.containsPosition(S.range.decoration,m)));y&&(i.activeItems=[y])}}else v.original.length>0?this.provideLabelPick(i,w("noMatchingSymbolResults","No matching editor symbols")):this.provideLabelPick(i,w("noSymbolResults","No editor symbols"))}finally{n.isCancellationRequested||(i.busy=!1)}};return a.add(i.onDidChangeValue(()=>u(void 0))),u((f=r.getSelection())==null?void 0:f.getPosition()),a.add(i.onDidChangeActive(()=>{const[m]=i.activeItems;m&&m.range&&(r.revealRangeInCenter(m.range.selection,0),this.addDecorations(r,m.range.decoration))})),a}async doGetSymbolPicks(e,t,i,n,s){var S,D;const r=await e;if(n.isCancellationRequested)return[];const a=t.original.indexOf(r_.SCOPE_PREFIX)===0,c=a?1:0;let d,u;t.values&&t.values.length>1?(d=Gk(t.values[0]),u=Gk(t.values.slice(1))):d=t;let f;const m=(D=(S=this.options)==null?void 0:S.openSideBySideDirection)==null?void 0:D.call(S);m&&(f=[{iconClass:m==="right"?Wi.asClassName(Ot.splitHorizontal):Wi.asClassName(Ot.splitVertical),tooltip:m==="right"?w("openToSide","Open to the Side"):w("openToBottom","Open to the Bottom")}]);const v=[];for(let E=0;E<r.length;E++){const N=r[E],B=vF(N.name),F=`$(${bF.toIcon(N.kind).id}) ${B}`,Q=F.length-B.length;let $=N.containerName;i!=null&&i.extraContainerLabel&&($?$=`${i.extraContainerLabel} • ${$}`:$=i.extraContainerLabel);let fe,Pe,ze,me;if(t.original.length>c){let dt=!1;if(d!==t&&([fe,Pe]=Sy(F,{...t,values:void 0},c,Q),typeof fe=="number"&&(dt=!0)),typeof fe!="number"&&([fe,Pe]=Sy(F,d,c,Q),typeof fe!="number"))continue;if(!dt&&u){if($&&u.original.length>0&&([ze,me]=Sy($,u)),typeof ze!="number")continue;typeof fe=="number"&&(fe+=ze)}}const Ve=N.tags&&N.tags.indexOf(1)>=0;v.push({index:E,kind:N.kind,score:fe,label:F,ariaLabel:wF(N.name,N.kind),description:$,highlights:Ve?void 0:{label:Pe,description:me},range:{selection:H.collapseToStart(N.selectionRange),decoration:N.range},uri:s.uri,symbolName:B,strikethrough:Ve,buttons:f})}const _=v.sort((E,N)=>a?this.compareByKindAndScore(E,N):this.compareByScore(E,N));let y=[];if(a){let F=function(){N&&typeof E=="number"&&B>0&&(N.label=w0(xy[E]||Cy,B))},E,N,B=0;for(const Q of _)E!==Q.kind?(F(),E=Q.kind,B=1,N={type:"separator"},y.push(N)):B++,y.push(Q);F()}else _.length>0&&(y=[{label:w("symbols","symbols ({0})",v.length),type:"separator"},..._]);return y}compareByScore(e,t){if(typeof e.score!="number"&&typeof t.score=="number")return 1;if(typeof e.score=="number"&&typeof t.score!="number")return-1;if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.score<t.score)return 1}return e.index<t.index?-1:e.index>t.index?1:0}compareByKindAndScore(e,t){const i=xy[e.kind]||Cy,n=xy[t.kind]||Cy,s=i.localeCompare(n);return s===0?this.compareByScore(e,t):s}async getDocumentSymbols(e,t){const i=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:i.asListOfDocumentSymbols()}},r_=xr,xr.PREFIX="@",xr.SCOPE_PREFIX=":",xr.PREFIX_BY_CATEGORY=`${xr.PREFIX}${xr.SCOPE_PREFIX}`,xr);Xc=r_=D8([Zk(0,gt),Zk(1,$p)],Xc);const Cy=w("property","properties ({0})"),xy={5:w("method","methods ({0})"),11:w("function","functions ({0})"),8:w("_constructor","constructors ({0})"),12:w("variable","variables ({0})"),4:w("class","classes ({0})"),22:w("struct","structs ({0})"),23:w("event","events ({0})"),24:w("operator","operators ({0})"),10:w("interface","interfaces ({0})"),2:w("namespace","namespaces ({0})"),3:w("package","packages ({0})"),25:w("typeParameter","type parameters ({0})"),1:w("modules","modules ({0})"),6:w("property","properties ({0})"),9:w("enum","enumerations ({0})"),21:w("enumMember","enumeration members ({0})"),14:w("string","strings ({0})"),0:w("file","files ({0})"),17:w("array","arrays ({0})"),15:w("number","numbers ({0})"),16:w("boolean","booleans ({0})"),18:w("object","objects ({0})"),19:w("key","keys ({0})"),7:w("field","fields ({0})"),13:w("constant","constants ({0})")};var E8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ly=function(o,e){return function(t,i){e(t,i,o)}};let Vx=class extends Xc{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=es.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};Vx=E8([Ly(0,Un),Ly(1,gt),Ly(2,$p)],Vx);const Sb=class Sb extends Se{constructor(){super({id:Sb.ID,label:$y.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:M.hasDocumentSymbolProvider,kbOpts:{kbExpr:M.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(nl).quickAccess.show(Xc.PREFIX,{itemActivation:SF.NONE})}};Sb.ID="editor.action.quickOutline";let Cv=Sb;ie(Cv);Tr.as(Np.Quickaccess).registerQuickAccessProvider({ctor:Vx,prefix:Xc.PREFIX,helpEntries:[{description:$y.quickOutlineActionLabel,prefix:Xc.PREFIX,commandId:Cv.ID},{description:$y.quickOutlineByCategoryActionLabel,prefix:Xc.PREFIX_BY_CATEGORY}]});function P8(o){const e=new Map;for(const t of o)e.set(t,(e.get(t)??0)+1);return e}class vf{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(e,t){const i=this.computeEmbedding(e),n=new Map,s=[];for(const[r,a]of this.documents){if(t.isCancellationRequested)return[];for(const c of a.chunks){const d=this.computeSimilarityScore(c,i,n);d>0&&s.push({key:r,score:d})}}return s}static termFrequencies(e){return P8(vf.splitTerms(e))}static*splitTerms(e){const t=i=>i.toLowerCase();for(const[i]of e.matchAll(new RegExp("\\b\\p{Letter}[\\p{Letter}\\d]{2,}\\b","gu"))){yield t(i);const n=i.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(n.length>1)for(const s of n)s.length>2&&new RegExp("\\p{Letter}{3,}","gu").test(s)&&(yield t(s))}}updateDocuments(e){for(const{key:t}of e)this.deleteDocument(t);for(const t of e){const i=[];for(const n of t.textChunks){const s=vf.termFrequencies(n);for(const r of s.keys())this.chunkOccurrences.set(r,(this.chunkOccurrences.get(r)??0)+1);i.push({text:n,tf:s})}this.chunkCount+=i.length,this.documents.set(t.key,{chunks:i})}return this}deleteDocument(e){const t=this.documents.get(e);if(t){this.documents.delete(e),this.chunkCount-=t.chunks.length;for(const i of t.chunks)for(const n of i.tf.keys()){const s=this.chunkOccurrences.get(n);if(typeof s=="number"){const r=s-1;r<=0?this.chunkOccurrences.delete(n):this.chunkOccurrences.set(n,r)}}}}computeSimilarityScore(e,t,i){let n=0;for(const[s,r]of Object.entries(t)){const a=e.tf.get(s);if(!a)continue;let c=i.get(s);typeof c!="number"&&(c=this.computeIdf(s),i.set(s,c));const d=a*c;n+=d*r}return n}computeEmbedding(e){const t=vf.termFrequencies(e);return this.computeTfidf(t)}computeIdf(e){const t=this.chunkOccurrences.get(e)??0;return t>0?Math.log((this.chunkCount+1)/t):0}computeTfidf(e){const t=Object.create(null);for(const[i,n]of e){const s=this.computeIdf(i);s>0&&(t[i]=n*s)}return t}}function T8(o){var i;const e=o.slice(0);e.sort((n,s)=>s.score-n.score);const t=((i=e[0])==null?void 0:i.score)??0;if(t>0)for(const n of e)n.score/=t;return e}var tu;(function(o){o[o.NO_ACTION=0]="NO_ACTION",o[o.CLOSE_PICKER=1]="CLOSE_PICKER",o[o.REFRESH_PICKER=2]="REFRESH_PICKER",o[o.REMOVE_ITEM=3]="REMOVE_ITEM"})(tu||(tu={}));function Iy(o){return Array.isArray(o.items)}function Xk(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class M8 extends Be{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var d;const n=new Oe;e.canAcceptInBackground=!!((d=this.options)!=null&&d.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const r=n.add(new So),a=async()=>{var S;const u=r.value=new Oe;s==null||s.dispose(!0),e.busy=!1,s=new gs(t);const f=s.token;let m=e.value.substring(this.prefix.length);(S=this.options)!=null&&S.shouldSkipTrimPickFilter||(m=m.trim());const v=this._getPicks(m,u,f,i),_=(D,E)=>{var F;let N,B;if(Iy(D)?(N=D.items,B=D.active):N=D,N.length===0){if(E)return!1;(m.length>0||e.hideInput)&&((F=this.options)!=null&&F.noResultsPick)&&(CF(this.options.noResultsPick)?N=[this.options.noResultsPick(m)]:N=[this.options.noResultsPick])}return e.items=N,B&&(e.activeItems=[B]),!0},y=async D=>{let E=!1,N=!1;await Promise.all([(async()=>{typeof D.mergeDelay=="number"&&(await Hb(D.mergeDelay),f.isCancellationRequested)||N||(E=_(D.picks,!0))})(),(async()=>{e.busy=!0;try{const B=await D.additionalPicks;if(f.isCancellationRequested)return;let F,Q;Iy(D.picks)?(F=D.picks.items,Q=D.picks.active):F=D.picks;let $,fe;if(Iy(B)?($=B.items,fe=B.active):$=B,$.length>0||!E){let Pe;if(!Q&&!fe){const ze=e.activeItems[0];ze&&F.indexOf(ze)!==-1&&(Pe=ze)}_({items:[...F,...$],active:Q||fe||Pe})}}finally{f.isCancellationRequested||(e.busy=!1),N=!0}})()])};if(v!==null)if(Xk(v))await y(v);else if(!(v instanceof Promise))_(v);else{e.busy=!0;try{const D=await v;if(f.isCancellationRequested)return;Xk(D)?await y(D):_(D)}finally{f.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>a())),a(),n.add(e.onDidAccept(u=>{var m;if(i!=null&&i.handleAccept){u.inBackground||e.hide(),(m=i.handleAccept)==null||m.call(i,e.activeItems[0]);return}const[f]=e.selectedItems;typeof(f==null?void 0:f.accept)=="function"&&(u.inBackground||e.hide(),f.accept(e.keyMods,u))}));const c=async(u,f)=>{var v;if(typeof f.trigger!="function")return;const m=((v=f.buttons)==null?void 0:v.indexOf(u))??-1;if(m>=0){const _=f.trigger(m,e.keyMods),y=typeof _=="number"?_:await _;if(t.isCancellationRequested)return;switch(y){case tu.NO_ACTION:break;case tu.CLOSE_PICKER:e.hide();break;case tu.REFRESH_PICKER:a();break;case tu.REMOVE_ITEM:{const S=e.items.indexOf(f);if(S!==-1){const D=e.items.slice(),E=D.splice(S,1),N=e.activeItems.filter(F=>F!==E[0]),B=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=D,N&&(e.activeItems=N),e.keepScrollPosition=B}break}}}};return n.add(e.onDidTriggerItemButton(({button:u,item:f})=>c(u,f))),n.add(e.onDidTriggerSeparatorButton(({button:u,separator:f})=>c(u,f))),n}}var qN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Sl=function(o,e){return function(t,i){e(t,i,o)}},Lc,qn,na;let jx=(na=class extends M8{constructor(e,t,i,n,s,r){super(Lc.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(Ux)),this.options=e}async _getPicks(e,t,i,n){var v,_;const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const r=aP(()=>{const y=new vf;y.updateDocuments(s.map(D=>({key:D.commandId,textChunks:[this.getTfIdfChunk(D)]})));const S=y.calculateScores(e,i);return T8(S).filter(D=>D.score>Lc.TFIDF_THRESHOLD).slice(0,Lc.TFIDF_MAX_RESULTS)}),a=[];for(const y of s){const S=Lc.WORD_FILTER(e,y.label)??void 0,D=y.commandAlias?Lc.WORD_FILTER(e,y.commandAlias)??void 0:void 0;if(S||D)y.highlights={label:S,detail:this.options.showAlias?D:void 0},a.push(y);else if(e===y.commandId)a.push(y);else if(e.length>=3){const E=r();if(i.isCancellationRequested)return[];const N=E.find(B=>B.key===y.commandId);N&&(y.tfIdfScore=N.score,a.push(y))}}const c=new Map;for(const y of a){const S=c.get(y.label);S?(y.description=y.commandId,S.description=S.commandId):c.set(y.label,y)}a.sort((y,S)=>{if(y.tfIdfScore&&S.tfIdfScore)return y.tfIdfScore===S.tfIdfScore?y.label.localeCompare(S.label):S.tfIdfScore-y.tfIdfScore;if(y.tfIdfScore)return 1;if(S.tfIdfScore)return-1;const D=this.commandsHistory.peek(y.commandId),E=this.commandsHistory.peek(S.commandId);if(D&&E)return D>E?-1:1;if(D)return-1;if(E)return 1;if(this.options.suggestedCommandIds){const N=this.options.suggestedCommandIds.has(y.commandId),B=this.options.suggestedCommandIds.has(S.commandId);if(N&&B)return 0;if(N)return-1;if(B)return 1}return y.label.localeCompare(S.label)});const d=[];let u=!1,f=!0,m=!!this.options.suggestedCommandIds;for(let y=0;y<a.length;y++){const S=a[y];y===0&&this.commandsHistory.peek(S.commandId)&&(d.push({type:"separator",label:w("recentlyUsed","recently used")}),u=!0),f&&S.tfIdfScore!==void 0&&(d.push({type:"separator",label:w("suggested","similar commands")}),f=!1),m&&S.tfIdfScore===void 0&&!this.commandsHistory.peek(S.commandId)&&((v=this.options.suggestedCommandIds)!=null&&v.has(S.commandId))&&(d.push({type:"separator",label:w("commonlyUsed","commonly used")}),u=!0,m=!1),u&&S.tfIdfScore===void 0&&!this.commandsHistory.peek(S.commandId)&&!((_=this.options.suggestedCommandIds)!=null&&_.has(S.commandId))&&(d.push({type:"separator",label:w("morecCommands","other commands")}),u=!1),d.push(this.toCommandPick(S,n))}return this.hasAdditionalCommandPicks(e,i)?{picks:d,additionalPicks:(async()=>{var D;const y=await this.getAdditionalCommandPicks(s,a,e,i);if(i.isCancellationRequested)return[];const S=y.map(E=>this.toCommandPick(E,n));return f&&((D=S[0])==null?void 0:D.type)!=="separator"&&S.unshift({type:"separator",label:w("suggested","similar commands")}),S})()}:d}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?w("commandPickAriaLabelWithKeybinding","{0}, {1}",e.label,i.getAriaLabel()):e.label;return{...e,ariaLabel:n,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:i,accept:async()=>{var s;this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:(t==null?void 0:t.from)??"quick open"});try{(s=e.args)!=null&&s.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(r){dc(r)||this.dialogService.error(w("canNotRun","Command '{0}' resulted in an error",e.label),E_(r))}}}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:i}){let n=e;return t&&t!==e&&(n+=` - ${t}`),i&&i.value!==e&&(n+=` - ${i.value===i.original?i.value:`${i.value} (${i.original})`}`),n}},Lc=na,na.PREFIX=">",na.TFIDF_THRESHOLD=.5,na.TFIDF_MAX_RESULTS=5,na.WORD_FILTER=xF(kF,IF,LF),na);jx=Lc=qN([Sl(1,qt),Sl(2,Zn),Sl(3,ls),Sl(4,Nr),Sl(5,T0)],jx);var Lr;let Ux=(Lr=class extends Be{constructor(e,t,i){super(),this.storageService=e,this.configurationService=t,this.logService=i,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===u0.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=qn.getConfiguredCommandHistoryLength(this.configurationService),qn.cache&&qn.cache.limit!==this.configuredCommandsHistoryLength&&(qn.cache.limit=this.configuredCommandsHistoryLength,qn.hasChanges=!0))}load(){const e=this.storageService.get(qn.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=qn.cache=new Cp(this.configuredCommandsHistoryLength,1);if(t){let n;t.usesLRU?n=t.entries:n=t.entries.sort((s,r)=>s.value-r.value),n.forEach(s=>i.set(s.key,s.value))}qn.counter=this.storageService.getNumber(qn.PREF_KEY_COUNTER,0,qn.counter)}push(e){qn.cache&&(qn.cache.set(e,qn.counter++),qn.hasChanges=!0)}peek(e){var t;return(t=qn.cache)==null?void 0:t.peek(e)}saveState(){if(!qn.cache||!qn.hasChanges)return;const e={usesLRU:!0,entries:[]};qn.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(qn.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(qn.PREF_KEY_COUNTER,qn.counter,0,0),qn.hasChanges=!1}static getConfiguredCommandHistoryLength(e){var n,s;const i=(s=(n=e.getValue().workbench)==null?void 0:n.commandPalette)==null?void 0:s.history;return typeof i=="number"?i:qn.DEFAULT_COMMANDS_HISTORY_LENGTH}},qn=Lr,Lr.DEFAULT_COMMANDS_HISTORY_LENGTH=50,Lr.PREF_KEY_CACHE="commandPalette.mru.cache",Lr.PREF_KEY_COUNTER="commandPalette.mru.counter",Lr.counter=1,Lr.hasChanges=!1,Lr);Ux=qn=qN([Sl(0,hc),Sl(1,pn),Sl(2,oh)],Ux);class N8 extends jx{constructor(e,t,i,n,s,r){super(e,t,i,n,s,r)}getCodeEditorCommandPicks(){var i;const e=this.activeTextEditorControl;if(!e)return[];const t=[];for(const n of e.getSupportedActions()){let s;(i=n.metadata)!=null&&i.description&&(DF(n.metadata.description)?s=n.metadata.description:s={original:n.metadata.description,value:n.metadata.description}),t.push({commandId:n.id,commandAlias:n.alias,commandDescription:s,label:EF(n.label)||n.id})}return t}}var R8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Rh=function(o,e){return function(t,i){e(t,i,o)}};let cp=class extends N8{get activeTextEditorControl(){return this.codeEditorService.getFocusedCodeEditor()??void 0}constructor(e,t,i,n,s,r){super({showAlias:!1},e,i,n,s,r),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};cp=R8([Rh(0,qt),Rh(1,Un),Rh(2,Zn),Rh(3,ls),Rh(4,Nr),Rh(5,T0)],cp);const Cb=class Cb extends Se{constructor(){super({id:Cb.ID,label:cP.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(nl).quickAccess.show(cp.PREFIX)}};Cb.ID="editor.action.quickCommand";let xv=Cb;ie(xv);Tr.as(Np.Quickaccess).registerQuickAccessProvider({ctor:cp,prefix:cp.PREFIX,helpEntries:[{description:cP.quickCommandHelp,commandId:xv.ID}]});var A8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ah=function(o,e){return function(t,i){e(t,i,o)}};let $x=class extends Xd{constructor(e,t,i,n,s,r,a){super(!0,e,t,i,n,s,r,a)}};$x=A8([Ah(1,Ri),Ah(2,Un),Ah(3,Rs),Ah(4,qt),Ah(5,hc),Ah(6,pn)],$x);oi(Xd.ID,$x,4);class O8 extends Se{constructor(){super({id:"editor.action.toggleHighContrast",label:PF.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(oP),n=i.getColorTheme();Lf(n.type)?(i.setTheme(this._originalThemeName||(YL(n.type)?TF:MF)),this._originalThemeName=null):(i.setTheme(YL(n.type)?NF:RF),this._originalThemeName=n.themeName)}}ie(O8);let qx=null;function F8(o){qx=o}function H8(o={}){return{"Content-Type":"application/json",...o}}async function Bi(o,e,t){const i=await fetch(e,{method:o,headers:H8(),body:t!==void 0?JSON.stringify(t):void 0});if(i.status===401)throw qx&&qx(),new Error("Unauthorized");if(!i.ok){const n=await i.json().catch(()=>({error:i.statusText}));throw new Error(n.error??i.statusText)}return i.json()}async function W8(){return(await(await fetch("/she/auth/mode")).json()).mode}async function B8(o){const e=await fetch("/she/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:o})});if(!e.ok){const t=await e.json().catch(()=>({error:e.statusText}));throw new Error(t.error??"Login failed")}}async function z8(){await fetch("/she/auth/logout",{method:"POST"})}async function V8(o,e,t){const i=await fetch("/she/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:o,password:e,proxyHeader:t})});if(!i.ok){const n=await i.json().catch(()=>({error:i.statusText}));throw new Error(n.error??"Setup failed")}}function j8(){return Bi("GET","/she/scripts/tree")}function Yk(o){return Bi("GET",`/she/scripts/${o}`)}function Sc(o,e){return Bi("PUT",`/she/scripts/${o}`,{content:e})}function Rm(o){return Bi("DELETE",`/she/scripts/${o}`)}function Jk(o,e){return Bi("POST",`/she/scripts/${o}/rename`,{newPath:e})}function U8(o){return Bi("POST","/she/scripts/mkdir",{path:o})}function $8(){return Bi("GET","/she/git/status")}function Qk(){return Bi("GET","/she/status")}function q8(){return Bi("POST","/she/restart")}function K8(){return Bi("POST","/she/update")}function G8(o,e){return Bi("POST","/she/git/commit",{path:o,message:e})}function Z8(o){return Bi("POST","/she/git/push",{remote:o})}function KN(){return Bi("GET","/she/config")}function X8(o){return Bi("PUT","/she/config",o)}function GN(){return Bi("GET","/she/db/docs")}function Y8(o){return Bi("GET",`/she/db/docs/${o}`)}function eD(o,e){return Bi("PUT",`/she/db/docs/${o}`,e)}function J8(o){return Bi("DELETE",`/she/db/docs/${o}`)}function ZN(){return Bi("GET","/she/db/views")}function Q8(o){return Bi("GET",`/she/db/views/${o}`)}function tD(o,e){return Bi("PUT",`/she/db/views/${o}`,e)}function e7(o){return Bi("DELETE",`/she/db/views/${o}`)}function t7(){return Bi("GET","/she/deps")}function i7(o){return Bi("GET",`/she/deps/search?q=${encodeURIComponent(o)}`)}function n7(o,e){return Bi("POST","/she/deps/install",{name:o,version:null})}function s7(o){return Bi("POST","/she/deps/remove",{name:o})}function o7(o){return Bi("POST","/she/deps/update",{name:o})}function ky(o){return Bi("GET",`/she/db/views/${o}/result`)}function XN(){return Bi("GET","/she/matter/devices")}function a_(o){return Bi("GET",`/she/matter/devices/${o}`)}function r7(o){return Bi("POST","/she/matter/commission",o)}function a7(o){return Bi("DELETE",`/she/matter/devices/${o}`)}function l7(o,e,t,i,n){return Bi("POST",`/she/matter/devices/${o}/command`,{endpointId:e,clusterName:t,command:i,args:n})}function YN(){return Bi("GET","/she/mqtt/state")}function iD(o,e,t=!1,i=0){return Bi("POST","/she/mqtt/publish",{topic:o,payload:e,retain:t,qos:i})}function JN(){return Bi("GET","/she/ai/config")}function QN(){return Bi("GET","/she/ai/models")}function eR(o){return Bi("GET",`/she/ai/model-info?model=${encodeURIComponent(o)}`)}function tR(o){return Bi("POST","/she/ai/prompt",o)}async function iR(o,e,t,i){const s=await fetch("/she/ai/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),signal:t});if(!s.ok){const d=await s.json().catch(()=>({error:s.statusText}));throw new Error(d.error??s.statusText)}const r=s.body.getReader(),a=new TextDecoder;let c="";try{for(;;){const{done:d,value:u}=await r.read();if(d)break;c+=a.decode(u,{stream:!0});const f=c.split(`
|
|
79
|
-
`);c=f.pop()??"";for(const m of f){if(!m.startsWith("data: "))continue;const v=m.slice(6).trim();if(v==="[DONE]")return;try{const _=JSON.parse(v);if(_.error)throw new Error(_.error);if(_.type==="tool_call"||_.type==="tool_result"){i==null||i({type:_.type,name:_.name??"",args:_.args,content:_.content});continue}_.token&&e(_.token)}catch(_){if(_ instanceof SyntaxError)continue;throw _}}}}finally{r.releaseLock()}}const c7=2e3,l_=[];function d7(){return l_.slice()}let Nl=null;const Lv=new Set,iu=new Map;let Kx=null;function dp(){let o=Lv.size;for(const e of iu.values())o+=e.size;return o}function h7(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/she/ws`}function O1(){if(Nl)return;const o=h7(),e=new WebSocket(o);Nl=e,e.onmessage=t=>{try{const i=JSON.parse(t.data);if(i.type==="log"){const s={level:i.level,msg:i.msg,ts:i.ts};l_.length>=c7&&l_.shift(),l_.push(s),Lv.forEach(r=>r(s))}const n=iu.get(i.type);n&&n.forEach(s=>s(i))}catch{}},e.onclose=()=>{Nl===e&&(Nl=null),dp()>0&&(Kx=setTimeout(O1,3e3))},e.onerror=()=>{e.close()}}function nR(){Kx&&clearTimeout(Kx),Nl==null||Nl.close(),Nl=null}function sR(o){return Lv.add(o),dp()===1&&O1(),()=>{Lv.delete(o),dp()===0&&nR()}}function Rl(o,e){return iu.has(o)||iu.set(o,new Set),iu.get(o).add(e),dp()===1&&O1(),()=>{var t;(t=iu.get(o))==null||t.delete(e),dp()===0&&nR()}}var u7=A('<div class="backdrop svelte-1eh8v5n" role="presentation"></div> <div class="dialog svelte-1eh8v5n" role="dialog" aria-modal="true"><p class="svelte-1eh8v5n"> </p> <div class="actions svelte-1eh8v5n"><button class="cancel svelte-1eh8v5n">Cancel</button> <button> </button></div></div>',1);function g7(o,e){xo(e,!0);let t=U(!1),i=U(""),n=U("Confirm"),s=U(!1),r=null;function a(_,y){return k(i,_,!0),k(n,(y==null?void 0:y.confirm)??"Confirm",!0),k(s,(y==null?void 0:y.danger)??!1,!0),k(t,!0),new Promise(S=>r=S)}function c(_){k(t,!1),r==null||r(_),r=null}function d(_){g(t)&&(_.key==="Escape"&&c(!1),_.key==="Enter"&&c(!0))}var u={show:a},f=xs();Kn("keydown",$c,d);var m=xt(f);{var v=_=>{var y=u7(),S=xt(y),D=I(S,2),E=x(D),N=x(E),B=I(E,2),F=x(B),Q=I(F,2);let $;var fe=x(Q);Y(()=>{q(N,g(i)),$=Bt(Q,1,"svelte-1eh8v5n",null,$,{danger:g(s)}),q(fe,g(n))}),oe("click",S,()=>c(!1)),oe("click",F,()=>c(!1)),oe("click",Q,()=>c(!0)),T(_,y)};K(m,_=>{g(t)&&_(v)})}return T(o,f),Lo(u)}cr(["click"]);var f7=A('<div class="backdrop svelte-1vi95tb" role="presentation"></div> <div class="dialog svelte-1vi95tb" role="dialog" aria-modal="true"><p class="svelte-1vi95tb"> </p> <input class="svelte-1vi95tb"/> <div class="actions svelte-1vi95tb"><button class="cancel svelte-1vi95tb">Cancel</button> <button class="svelte-1vi95tb"> </button></div></div>',1);function p7(o,e){xo(e,!0);let t=U(!1),i=U(""),n=U(""),s=U("OK"),r=U(""),a=null,c=U(void 0);function d(D,E){return k(i,D,!0),k(n,(E==null?void 0:E.placeholder)??"",!0),k(s,(E==null?void 0:E.confirm)??"OK",!0),k(r,(E==null?void 0:E.initial)??"",!0),k(t,!0),setTimeout(()=>{var N;return(N=g(c))==null?void 0:N.select()},0),new Promise(N=>a=N)}function u(){const D=g(r).trim();D&&(k(t,!1),a==null||a(D),a=null,k(r,""))}function f(){k(t,!1),a==null||a(null),a=null,k(r,"")}function m(D){g(t)&&D.key==="Escape"&&(D.stopPropagation(),f())}var v={show:d},_=xs();Kn("keydown",$c,m);var y=xt(_);{var S=D=>{var E=f7(),N=xt(E),B=I(N,2),F=x(B),Q=x(F),$=I(F,2);Qs($,Ve=>k(c,Ve),()=>g(c));var fe=I($,2),Pe=x(fe),ze=I(Pe,2),me=x(ze);Y(Ve=>{q(Q,g(i)),Jn($,"placeholder",g(n)),ze.disabled=Ve,q(me,g(s))},[()=>!g(r).trim()]),oe("click",N,f),oe("keydown",$,Ve=>{Ve.key==="Enter"&&(Ve.preventDefault(),u())}),Ki($,()=>g(r),Ve=>k(r,Ve)),oe("click",Pe,f),oe("click",ze,u),T(D,E)};K(y,D=>{g(t)&&D(S)})}return T(o,_),Lo(v)}cr(["click","keydown"]);function oR(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Dy,nD;function m7(){if(nD)return Dy;nD=1;function o(O){return O instanceof Map?O.clear=O.delete=O.set=function(){throw new Error("map is read-only")}:O instanceof Set&&(O.add=O.clear=O.delete=function(){throw new Error("set is read-only")}),Object.freeze(O),Object.getOwnPropertyNames(O).forEach(X=>{const xe=O[X],Ze=typeof xe;(Ze==="object"||Ze==="function")&&!Object.isFrozen(xe)&&o(xe)}),O}class e{constructor(X){X.data===void 0&&(X.data={}),this.data=X.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(O){return O.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function i(O,...X){const xe=Object.create(null);for(const Ze in O)xe[Ze]=O[Ze];return X.forEach(function(Ze){for(const Dt in Ze)xe[Dt]=Ze[Dt]}),xe}const n="</span>",s=O=>!!O.scope,r=(O,{prefix:X})=>{if(O.startsWith("language:"))return O.replace("language:","language-");if(O.includes(".")){const xe=O.split(".");return[`${X}${xe.shift()}`,...xe.map((Ze,Dt)=>`${Ze}${"_".repeat(Dt+1)}`)].join(" ")}return`${X}${O}`};class a{constructor(X,xe){this.buffer="",this.classPrefix=xe.classPrefix,X.walk(this)}addText(X){this.buffer+=t(X)}openNode(X){if(!s(X))return;const xe=r(X.scope,{prefix:this.classPrefix});this.span(xe)}closeNode(X){s(X)&&(this.buffer+=n)}value(){return this.buffer}span(X){this.buffer+=`<span class="${X}">`}}const c=(O={})=>{const X={children:[]};return Object.assign(X,O),X};class d{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(X){this.top.children.push(X)}openNode(X){const xe=c({scope:X});this.add(xe),this.stack.push(xe)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(X){return this.constructor._walk(X,this.rootNode)}static _walk(X,xe){return typeof xe=="string"?X.addText(xe):xe.children&&(X.openNode(xe),xe.children.forEach(Ze=>this._walk(X,Ze)),X.closeNode(xe)),X}static _collapse(X){typeof X!="string"&&X.children&&(X.children.every(xe=>typeof xe=="string")?X.children=[X.children.join("")]:X.children.forEach(xe=>{d._collapse(xe)}))}}class u extends d{constructor(X){super(),this.options=X}addText(X){X!==""&&this.add(X)}startScope(X){this.openNode(X)}endScope(){this.closeNode()}__addSublanguage(X,xe){const Ze=X.root;xe&&(Ze.scope=`language:${xe}`),this.add(Ze)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(O){return O?typeof O=="string"?O:O.source:null}function m(O){return y("(?=",O,")")}function v(O){return y("(?:",O,")*")}function _(O){return y("(?:",O,")?")}function y(...O){return O.map(xe=>f(xe)).join("")}function S(O){const X=O[O.length-1];return typeof X=="object"&&X.constructor===Object?(O.splice(O.length-1,1),X):{}}function D(...O){return"("+(S(O).capture?"":"?:")+O.map(Ze=>f(Ze)).join("|")+")"}function E(O){return new RegExp(O.toString()+"|").exec("").length-1}function N(O,X){const xe=O&&O.exec(X);return xe&&xe.index===0}const B=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function F(O,{joinWith:X}){let xe=0;return O.map(Ze=>{xe+=1;const Dt=xe;let mt=f(Ze),Me="";for(;mt.length>0;){const De=B.exec(mt);if(!De){Me+=mt;break}Me+=mt.substring(0,De.index),mt=mt.substring(De.index+De[0].length),De[0][0]==="\\"&&De[1]?Me+="\\"+String(Number(De[1])+Dt):(Me+=De[0],De[0]==="("&&xe++)}return Me}).map(Ze=>`(${Ze})`).join(X)}const Q=/\b\B/,$="[a-zA-Z]\\w*",fe="[a-zA-Z_]\\w*",Pe="\\b\\d+(\\.\\d+)?",ze="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",me="\\b(0b[01]+)",Ve="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",dt=(O={})=>{const X=/^#![ ]*\//;return O.binary&&(O.begin=y(X,/.*\b/,O.binary,/\b.*/)),i({scope:"meta",begin:X,end:/$/,relevance:0,"on:begin":(xe,Ze)=>{xe.index!==0&&Ze.ignoreMatch()}},O)},Ke={begin:"\\\\[\\s\\S]",relevance:0},Ut={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ke]},lt={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ke]},Kt={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Ie=function(O,X,xe={}){const Ze=i({scope:"comment",begin:O,end:X,contains:[]},xe);Ze.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Dt=D("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Ze.contains.push({begin:y(/[ ]+/,"(",Dt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ze},Pt=Ie("//","$"),Fe=Ie("/\\*","\\*/"),ft=Ie("#","$"),zt={scope:"number",begin:Pe,relevance:0},Gt={scope:"number",begin:ze,relevance:0},ci={scope:"number",begin:me,relevance:0},Vt={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ke,{begin:/\[/,end:/\]/,relevance:0,contains:[Ke]}]},Ht={scope:"title",begin:$,relevance:0},Fi={scope:"title",begin:fe,relevance:0},zi={begin:"\\.\\s*"+fe,relevance:0};var Ct=Object.freeze({__proto__:null,APOS_STRING_MODE:Ut,BACKSLASH_ESCAPE:Ke,BINARY_NUMBER_MODE:ci,BINARY_NUMBER_RE:me,COMMENT:Ie,C_BLOCK_COMMENT_MODE:Fe,C_LINE_COMMENT_MODE:Pt,C_NUMBER_MODE:Gt,C_NUMBER_RE:ze,END_SAME_AS_BEGIN:function(O){return Object.assign(O,{"on:begin":(X,xe)=>{xe.data._beginMatch=X[1]},"on:end":(X,xe)=>{xe.data._beginMatch!==X[1]&&xe.ignoreMatch()}})},HASH_COMMENT_MODE:ft,IDENT_RE:$,MATCH_NOTHING_RE:Q,METHOD_GUARD:zi,NUMBER_MODE:zt,NUMBER_RE:Pe,PHRASAL_WORDS_MODE:Kt,QUOTE_STRING_MODE:lt,REGEXP_MODE:Vt,RE_STARTERS_RE:Ve,SHEBANG:dt,TITLE_MODE:Ht,UNDERSCORE_IDENT_RE:fe,UNDERSCORE_TITLE_MODE:Fi});function mi(O,X){O.input[O.index-1]==="."&&X.ignoreMatch()}function Ci(O,X){O.className!==void 0&&(O.scope=O.className,delete O.className)}function xi(O,X){X&&O.beginKeywords&&(O.begin="\\b("+O.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",O.__beforeBegin=mi,O.keywords=O.keywords||O.beginKeywords,delete O.beginKeywords,O.relevance===void 0&&(O.relevance=0))}function Di(O,X){Array.isArray(O.illegal)&&(O.illegal=D(...O.illegal))}function Ji(O,X){if(O.match){if(O.begin||O.end)throw new Error("begin & end are not supported with match");O.begin=O.match,delete O.match}}function Ui(O,X){O.relevance===void 0&&(O.relevance=1)}const bn=(O,X)=>{if(!O.beforeMatch)return;if(O.starts)throw new Error("beforeMatch cannot be used with starts");const xe=Object.assign({},O);Object.keys(O).forEach(Ze=>{delete O[Ze]}),O.keywords=xe.keywords,O.begin=y(xe.beforeMatch,m(xe.begin)),O.starts={relevance:0,contains:[Object.assign(xe,{endsParent:!0})]},O.relevance=0,delete xe.beforeMatch},mn=["of","and","for","in","not","or","if","then","parent","list","value"],Tn="keyword";function wn(O,X,xe=Tn){const Ze=Object.create(null);return typeof O=="string"?Dt(xe,O.split(" ")):Array.isArray(O)?Dt(xe,O):Object.keys(O).forEach(function(mt){Object.assign(Ze,wn(O[mt],X,mt))}),Ze;function Dt(mt,Me){X&&(Me=Me.map(De=>De.toLowerCase())),Me.forEach(function(De){const Ue=De.split("|");Ze[Ue[0]]=[mt,_n(Ue[0],Ue[1])]})}}function _n(O,X){return X?Number(X):Dn(O)?0:1}function Dn(O){return mn.includes(O.toLowerCase())}const Ei={},$i=O=>{console.error(O)},Fn=(O,...X)=>{console.log(`WARN: ${O}`,...X)},hn=(O,X)=>{Ei[`${O}/${X}`]||(console.log(`Deprecated as of ${O}. ${X}`),Ei[`${O}/${X}`]=!0)},Ai=new Error;function rn(O,X,{key:xe}){let Ze=0;const Dt=O[xe],mt={},Me={};for(let De=1;De<=X.length;De++)Me[De+Ze]=Dt[De],mt[De+Ze]=!0,Ze+=E(X[De-1]);O[xe]=Me,O[xe]._emit=mt,O[xe]._multi=!0}function xn(O){if(Array.isArray(O.begin)){if(O.skip||O.excludeBegin||O.returnBegin)throw $i("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ai;if(typeof O.beginScope!="object"||O.beginScope===null)throw $i("beginScope must be object"),Ai;rn(O,O.begin,{key:"beginScope"}),O.begin=F(O.begin,{joinWith:""})}}function Ln(O){if(Array.isArray(O.end)){if(O.skip||O.excludeEnd||O.returnEnd)throw $i("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ai;if(typeof O.endScope!="object"||O.endScope===null)throw $i("endScope must be object"),Ai;rn(O,O.end,{key:"endScope"}),O.end=F(O.end,{joinWith:""})}}function Bn(O){O.scope&&typeof O.scope=="object"&&O.scope!==null&&(O.beginScope=O.scope,delete O.scope)}function Hn(O){Bn(O),typeof O.beginScope=="string"&&(O.beginScope={_wrap:O.beginScope}),typeof O.endScope=="string"&&(O.endScope={_wrap:O.endScope}),xn(O),Ln(O)}function $e(O){function X(Me,De){return new RegExp(f(Me),"m"+(O.case_insensitive?"i":"")+(O.unicodeRegex?"u":"")+(De?"g":""))}class xe{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(De,Ue){Ue.position=this.position++,this.matchIndexes[this.matchAt]=Ue,this.regexes.push([Ue,De]),this.matchAt+=E(De)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const De=this.regexes.map(Ue=>Ue[1]);this.matcherRe=X(F(De,{joinWith:"|"}),!0),this.lastIndex=0}exec(De){this.matcherRe.lastIndex=this.lastIndex;const Ue=this.matcherRe.exec(De);if(!Ue)return null;const Ge=Ue.findIndex((Ce,Et)=>Et>0&&Ce!==void 0),Xe=this.matchIndexes[Ge];return Ue.splice(0,Ge),Object.assign(Ue,Xe)}}class Ze{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(De){if(this.multiRegexes[De])return this.multiRegexes[De];const Ue=new xe;return this.rules.slice(De).forEach(([Ge,Xe])=>Ue.addRule(Ge,Xe)),Ue.compile(),this.multiRegexes[De]=Ue,Ue}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(De,Ue){this.rules.push([De,Ue]),Ue.type==="begin"&&this.count++}exec(De){const Ue=this.getMatcher(this.regexIndex);Ue.lastIndex=this.lastIndex;let Ge=Ue.exec(De);if(this.resumingScanAtSamePosition()&&!(Ge&&Ge.index===this.lastIndex)){const Xe=this.getMatcher(0);Xe.lastIndex=this.lastIndex+1,Ge=Xe.exec(De)}return Ge&&(this.regexIndex+=Ge.position+1,this.regexIndex===this.count&&this.considerAll()),Ge}}function Dt(Me){const De=new Ze;return Me.contains.forEach(Ue=>De.addRule(Ue.begin,{rule:Ue,type:"begin"})),Me.terminatorEnd&&De.addRule(Me.terminatorEnd,{type:"end"}),Me.illegal&&De.addRule(Me.illegal,{type:"illegal"}),De}function mt(Me,De){const Ue=Me;if(Me.isCompiled)return Ue;[Ci,Ji,Hn,bn].forEach(Xe=>Xe(Me,De)),O.compilerExtensions.forEach(Xe=>Xe(Me,De)),Me.__beforeBegin=null,[xi,Di,Ui].forEach(Xe=>Xe(Me,De)),Me.isCompiled=!0;let Ge=null;return typeof Me.keywords=="object"&&Me.keywords.$pattern&&(Me.keywords=Object.assign({},Me.keywords),Ge=Me.keywords.$pattern,delete Me.keywords.$pattern),Ge=Ge||/\w+/,Me.keywords&&(Me.keywords=wn(Me.keywords,O.case_insensitive)),Ue.keywordPatternRe=X(Ge,!0),De&&(Me.begin||(Me.begin=/\B|\b/),Ue.beginRe=X(Ue.begin),!Me.end&&!Me.endsWithParent&&(Me.end=/\B|\b/),Me.end&&(Ue.endRe=X(Ue.end)),Ue.terminatorEnd=f(Ue.end)||"",Me.endsWithParent&&De.terminatorEnd&&(Ue.terminatorEnd+=(Me.end?"|":"")+De.terminatorEnd)),Me.illegal&&(Ue.illegalRe=X(Me.illegal)),Me.contains||(Me.contains=[]),Me.contains=[].concat(...Me.contains.map(function(Xe){return it(Xe==="self"?Me:Xe)})),Me.contains.forEach(function(Xe){mt(Xe,Ue)}),Me.starts&&mt(Me.starts,De),Ue.matcher=Dt(Ue),Ue}if(O.compilerExtensions||(O.compilerExtensions=[]),O.contains&&O.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return O.classNameAliases=i(O.classNameAliases||{}),mt(O)}function ne(O){return O?O.endsWithParent||ne(O.starts):!1}function it(O){return O.variants&&!O.cachedVariants&&(O.cachedVariants=O.variants.map(function(X){return i(O,{variants:null},X)})),O.cachedVariants?O.cachedVariants:ne(O)?i(O,{starts:O.starts?i(O.starts):null}):Object.isFrozen(O)?i(O):O}var Z="11.11.1";class Te extends Error{constructor(X,xe){super(X),this.name="HTMLInjectionError",this.html=xe}}const nt=t,wt=i,Qt=Symbol("nomatch"),Zt=7,Li=function(O){const X=Object.create(null),xe=Object.create(null),Ze=[];let Dt=!0;const mt="Could not find the language '{}', did you forget to load/include a language module?",Me={disableAutodetect:!0,name:"Plain text",contains:[]};let De={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function Ue(R){return De.noHighlightRe.test(R)}function Ge(R){let G=R.className+" ";G+=R.parentNode?R.parentNode.className:"";const pe=De.languageDetectRe.exec(G);if(pe){const se=yt(pe[1]);return se||(Fn(mt.replace("{}",pe[1])),Fn("Falling back to no-highlight mode for this block.",R)),se?pe[1]:"no-highlight"}return G.split(/\s+/).find(se=>Ue(se)||yt(se))}function Xe(R,G,pe){let se="",we="";typeof G=="object"?(se=R,pe=G.ignoreIllegals,we=G.language):(hn("10.7.0","highlight(lang, code, ...args) has been deprecated."),hn("10.7.0",`Please use highlight(code, options) instead.
|
|
80
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),we=R,se=G),pe===void 0&&(pe=!0);const ae={code:se,language:we};Le("before:highlight",ae);const ue=ae.result?ae.result:Ce(ae.language,ae.code,pe);return ue.code=ae.code,Le("after:highlight",ue),ue}function Ce(R,G,pe,se){const we=Object.create(null);function ae(Ne,ot){return Ne.keywords[ot]}function ue(){if(!St.keywords){ve.addText(ke);return}let Ne=0;St.keywordPatternRe.lastIndex=0;let ot=St.keywordPatternRe.exec(ke),Tt="";for(;ot;){Tt+=ke.substring(Ne,ot.index);const ni=Wt.case_insensitive?ot[0].toLowerCase():ot[0],vt=ae(St,ni);if(vt){const[fi,si]=vt;if(ve.addText(Tt),Tt="",we[ni]=(we[ni]||0)+1,we[ni]<=Zt&&(Nt+=si),fi.startsWith("_"))Tt+=ot[0];else{const ns=Wt.classNameAliases[fi]||fi;Ae(ot[0],ns)}}else Tt+=ot[0];Ne=St.keywordPatternRe.lastIndex,ot=St.keywordPatternRe.exec(ke)}Tt+=ke.substring(Ne),ve.addText(Tt)}function Re(){if(ke==="")return;let Ne=null;if(typeof St.subLanguage=="string"){if(!X[St.subLanguage]){ve.addText(ke);return}Ne=Ce(St.subLanguage,ke,!0,Xt[St.subLanguage]),Xt[St.subLanguage]=Ne._top}else Ne=Ft(ke,St.subLanguage.length?St.subLanguage:null);St.relevance>0&&(Nt+=Ne.relevance),ve.__addSublanguage(Ne._emitter,Ne.language)}function _e(){St.subLanguage!=null?Re():ue(),ke=""}function Ae(Ne,ot){Ne!==""&&(ve.startScope(ot),ve.addText(Ne),ve.endScope())}function Ee(Ne,ot){let Tt=1;const ni=ot.length-1;for(;Tt<=ni;){if(!Ne._emit[Tt]){Tt++;continue}const vt=Wt.classNameAliases[Ne[Tt]]||Ne[Tt],fi=ot[Tt];vt?Ae(fi,vt):(ke=fi,ue(),ke=""),Tt++}}function ge(Ne,ot){return Ne.scope&&typeof Ne.scope=="string"&&ve.openNode(Wt.classNameAliases[Ne.scope]||Ne.scope),Ne.beginScope&&(Ne.beginScope._wrap?(Ae(ke,Wt.classNameAliases[Ne.beginScope._wrap]||Ne.beginScope._wrap),ke=""):Ne.beginScope._multi&&(Ee(Ne.beginScope,ot),ke="")),St=Object.create(Ne,{parent:{value:St}}),St}function et(Ne,ot,Tt){let ni=N(Ne.endRe,Tt);if(ni){if(Ne["on:end"]){const vt=new e(Ne);Ne["on:end"](ot,vt),vt.isMatchIgnored&&(ni=!1)}if(ni){for(;Ne.endsParent&&Ne.parent;)Ne=Ne.parent;return Ne}}if(Ne.endsWithParent)return et(Ne.parent,ot,Tt)}function ei(Ne){return St.matcher.regexIndex===0?(ke+=Ne[0],1):(en=!0,0)}function vi(Ne){const ot=Ne[0],Tt=Ne.rule,ni=new e(Tt),vt=[Tt.__beforeBegin,Tt["on:begin"]];for(const fi of vt)if(fi&&(fi(Ne,ni),ni.isMatchIgnored))return ei(ot);return Tt.skip?ke+=ot:(Tt.excludeBegin&&(ke+=ot),_e(),!Tt.returnBegin&&!Tt.excludeBegin&&(ke=ot)),ge(Tt,Ne),Tt.returnBegin?0:ot.length}function Pi(Ne){const ot=Ne[0],Tt=G.substring(Ne.index),ni=et(St,Ne,Tt);if(!ni)return Qt;const vt=St;St.endScope&&St.endScope._wrap?(_e(),Ae(ot,St.endScope._wrap)):St.endScope&&St.endScope._multi?(_e(),Ee(St.endScope,Ne)):vt.skip?ke+=ot:(vt.returnEnd||vt.excludeEnd||(ke+=ot),_e(),vt.excludeEnd&&(ke=ot));do St.scope&&ve.closeNode(),!St.skip&&!St.subLanguage&&(Nt+=St.relevance),St=St.parent;while(St!==ni.parent);return ni.starts&&ge(ni.starts,Ne),vt.returnEnd?0:ot.length}function Mn(){const Ne=[];for(let ot=St;ot!==Wt;ot=ot.parent)ot.scope&&Ne.unshift(ot.scope);Ne.forEach(ot=>ve.openNode(ot))}let ri={};function ai(Ne,ot){const Tt=ot&&ot[0];if(ke+=Ne,Tt==null)return _e(),0;if(ri.type==="begin"&&ot.type==="end"&&ri.index===ot.index&&Tt===""){if(ke+=G.slice(ot.index,ot.index+1),!Dt){const ni=new Error(`0 width match regex (${R})`);throw ni.languageName=R,ni.badRule=ri.rule,ni}return 1}if(ri=ot,ot.type==="begin")return vi(ot);if(ot.type==="illegal"&&!pe){const ni=new Error('Illegal lexeme "'+Tt+'" for mode "'+(St.scope||"<unnamed>")+'"');throw ni.mode=St,ni}else if(ot.type==="end"){const ni=Pi(ot);if(ni!==Qt)return ni}if(ot.type==="illegal"&&Tt==="")return ke+=`
|
|
81
|
-
`,1;if(Vi>1e5&&Vi>ot.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ke+=Tt,Tt.length}const Wt=yt(R);if(!Wt)throw $i(mt.replace("{}",R)),new Error('Unknown language: "'+R+'"');const hi=$e(Wt);let ki="",St=se||hi;const Xt={},ve=new De.__emitter(De);Mn();let ke="",Nt=0,At=0,Vi=0,en=!1;try{if(Wt.__emitTokens)Wt.__emitTokens(G,ve);else{for(St.matcher.considerAll();;){Vi++,en?en=!1:St.matcher.considerAll(),St.matcher.lastIndex=At;const Ne=St.matcher.exec(G);if(!Ne)break;const ot=G.substring(At,Ne.index),Tt=ai(ot,Ne);At=Ne.index+Tt}ai(G.substring(At))}return ve.finalize(),ki=ve.toHTML(),{language:R,value:ki,relevance:Nt,illegal:!1,_emitter:ve,_top:St}}catch(Ne){if(Ne.message&&Ne.message.includes("Illegal"))return{language:R,value:nt(G),illegal:!0,relevance:0,_illegalBy:{message:Ne.message,index:At,context:G.slice(At-100,At+100),mode:Ne.mode,resultSoFar:ki},_emitter:ve};if(Dt)return{language:R,value:nt(G),illegal:!1,relevance:0,errorRaised:Ne,_emitter:ve,_top:St};throw Ne}}function Et(R){const G={value:nt(R),illegal:!1,relevance:0,_top:Me,_emitter:new De.__emitter(De)};return G._emitter.addText(R),G}function Ft(R,G){G=G||De.languages||Object.keys(X);const pe=Et(R),se=G.filter(yt).filter(st).map(_e=>Ce(_e,R,!1));se.unshift(pe);const we=se.sort((_e,Ae)=>{if(_e.relevance!==Ae.relevance)return Ae.relevance-_e.relevance;if(_e.language&&Ae.language){if(yt(_e.language).supersetOf===Ae.language)return 1;if(yt(Ae.language).supersetOf===_e.language)return-1}return 0}),[ae,ue]=we,Re=ae;return Re.secondBest=ue,Re}function gi(R,G,pe){const se=G&&xe[G]||pe;R.classList.add("hljs"),R.classList.add(`language-${se}`)}function Qi(R){let G=null;const pe=Ge(R);if(Ue(pe))return;if(Le("before:highlightElement",{el:R,language:pe}),R.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",R);return}if(R.children.length>0&&(De.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(R)),De.throwUnescapedHTML))throw new Te("One of your code blocks includes unescaped HTML.",R.innerHTML);G=R;const se=G.textContent,we=pe?Xe(se,{language:pe,ignoreIllegals:!0}):Ft(se);R.innerHTML=we.value,R.dataset.highlighted="yes",gi(R,pe,we.language),R.result={language:we.language,re:we.relevance,relevance:we.relevance},we.secondBest&&(R.secondBest={language:we.secondBest.language,relevance:we.secondBest.relevance}),Le("after:highlightElement",{el:R,result:we,text:se})}function Ii(R){De=wt(De,R)}const ee=()=>{pt(),hn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function be(){pt(),hn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let qe=!1;function pt(){function R(){pt()}if(document.readyState==="loading"){qe||window.addEventListener("DOMContentLoaded",R,!1),qe=!0;return}document.querySelectorAll(De.cssSelector).forEach(Qi)}function Lt(R,G){let pe=null;try{pe=G(O)}catch(se){if($i("Language definition for '{}' could not be registered.".replace("{}",R)),Dt)$i(se);else throw se;pe=Me}pe.name||(pe.name=R),X[R]=pe,pe.rawDefinition=G.bind(null,O),pe.aliases&&_t(pe.aliases,{languageName:R})}function ce(R){delete X[R];for(const G of Object.keys(xe))xe[G]===R&&delete xe[G]}function je(){return Object.keys(X)}function yt(R){return R=(R||"").toLowerCase(),X[R]||X[xe[R]]}function _t(R,{languageName:G}){typeof R=="string"&&(R=[R]),R.forEach(pe=>{xe[pe.toLowerCase()]=G})}function st(R){const G=yt(R);return G&&!G.disableAutodetect}function Je(R){R["before:highlightBlock"]&&!R["before:highlightElement"]&&(R["before:highlightElement"]=G=>{R["before:highlightBlock"](Object.assign({block:G.el},G))}),R["after:highlightBlock"]&&!R["after:highlightElement"]&&(R["after:highlightElement"]=G=>{R["after:highlightBlock"](Object.assign({block:G.el},G))})}function j(R){Je(R),Ze.push(R)}function re(R){const G=Ze.indexOf(R);G!==-1&&Ze.splice(G,1)}function Le(R,G){const pe=R;Ze.forEach(function(se){se[pe]&&se[pe](G)})}function W(R){return hn("10.7.0","highlightBlock will be removed entirely in v12.0"),hn("10.7.0","Please use highlightElement now."),Qi(R)}Object.assign(O,{highlight:Xe,highlightAuto:Ft,highlightAll:pt,highlightElement:Qi,highlightBlock:W,configure:Ii,initHighlighting:ee,initHighlightingOnLoad:be,registerLanguage:Lt,unregisterLanguage:ce,listLanguages:je,getLanguage:yt,registerAliases:_t,autoDetection:st,inherit:wt,addPlugin:j,removePlugin:re}),O.debugMode=function(){Dt=!1},O.safeMode=function(){Dt=!0},O.versionString=Z,O.regex={concat:y,lookahead:m,either:D,optional:_,anyNumberOfTimes:v};for(const R in Ct)typeof Ct[R]=="object"&&o(Ct[R]);return Object.assign(O,Ct),O},_i=Li({});return _i.newInstance=()=>Li({}),Dy=_i,_i.HighlightJS=_i,_i.default=_i,Dy}var _7=m7();const Iv=oR(_7),sD="[A-Za-z$_][0-9A-Za-z$_]*",v7=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],b7=["true","false","null","undefined","NaN","Infinity"],rR=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],aR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],lR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],w7=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],y7=[].concat(lR,rR,aR);function cR(o){const e=o.regex,t=(Ie,{after:Pt})=>{const Fe="</"+Ie[0].slice(1);return Ie.input.indexOf(Fe,Pt)!==-1},i=sD,n={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,r={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Ie,Pt)=>{const Fe=Ie[0].length+Ie.index,ft=Ie.input[Fe];if(ft==="<"||ft===","){Pt.ignoreMatch();return}ft===">"&&(t(Ie,{after:Fe})||Pt.ignoreMatch());let zt;const Gt=Ie.input.substring(Fe);if(zt=Gt.match(/^\s*=/)){Pt.ignoreMatch();return}if((zt=Gt.match(/^\s+extends\s+/))&&zt.index===0){Pt.ignoreMatch();return}}},a={$pattern:sD,keyword:v7,literal:b7,built_in:y7,"variable.language":w7},c="[0-9](_?[0-9])*",d=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},v={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},_={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,m],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[o.BACKSLASH_ESCAPE,m]},E={className:"comment",variants:[o.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),o.C_BLOCK_COMMENT_MODE,o.C_LINE_COMMENT_MODE]},N=[o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,v,_,y,S,{match:/\$\d+/},f];m.contains=N.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(N)});const B=[].concat(E,m.contains),F=B.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(B)}]),Q={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:F},$={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,e.concat(i,"(",e.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},fe={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...rR,...aR]}},Pe={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ze={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[Q],illegal:/%/},me={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Ve(Ie){return e.concat("(?!",Ie.join("|"),")")}const dt={match:e.concat(/\b/,Ve([...lR,"super","import"].map(Ie=>`${Ie}\\s*\\(`)),i,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Ke={begin:e.concat(/\./,e.lookahead(e.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Ut={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},Q]},lt="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",Kt={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(lt)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[Q]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:F,CLASS_REFERENCE:fe},illegal:/#(?![$_A-z])/,contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),Pe,o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,v,_,y,S,E,{match:/\$\d+/},f,fe,{scope:"attr",match:i+e.lookahead(":"),relevance:0},Kt,{begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,o.REGEXP_MODE,{className:"function",begin:lt,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:o.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:F}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:n.begin,end:n.end},{match:s},{begin:r.begin,"on:begin":r.isTrulyOpeningTag,end:r.end}],subLanguage:"xml",contains:[{begin:r.begin,end:r.end,skip:!0,contains:["self"]}]}]},ze,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[Q,o.inherit(o.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ke,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[Q]},dt,me,$,Ut,{match:/\$[(.]/}]}}function F1(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var gh=F1();function dR(o){gh=o}var Dc={exec:()=>null};function Oh(o){let e=[];return t=>{let i=Math.max(0,Math.min(3,t-1)),n=e[i];return n||(n=o(i),e[i]=n),n}}function cn(o,e=""){let t=typeof o=="string"?o:o.source,i={replace:(n,s)=>{let r=typeof s=="string"?s:s.source;return r=r.replace(Hs.caret,"$1"),t=t.replace(n,r),i},getRegex:()=>new RegExp(t,e)};return i}var S7=((o="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+o)}catch{return!1}})(),Hs={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:o=>new RegExp(`^( {0,3}${o})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Oh(o=>new RegExp(`^ {0,${o}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Oh(o=>new RegExp(`^ {0,${o}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Oh(o=>new RegExp(`^ {0,${o}}(?:\`\`\`|~~~)`)),headingBeginRegex:Oh(o=>new RegExp(`^ {0,${o}}#`)),htmlBeginRegex:Oh(o=>new RegExp(`^ {0,${o}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Oh(o=>new RegExp(`^ {0,${o}}>`))},C7=/^(?:[ \t]*(?:\n|$))+/,x7=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,L7=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Kp=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,I7=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,H1=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,hR=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,uR=cn(hR).replace(/bull/g,H1).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),k7=cn(hR).replace(/bull/g,H1).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),W1=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,D7=/^[^\n]+/,B1=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,E7=cn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",B1).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),P7=cn(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,H1).getRegex(),bw="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",z1=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,T7=cn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",z1).replace("tag",bw).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),gR=cn(W1).replace("hr",Kp).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",bw).getRegex(),M7=cn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",gR).getRegex(),V1={blockquote:M7,code:x7,def:E7,fences:L7,heading:I7,hr:Kp,html:T7,lheading:uR,list:P7,newline:C7,paragraph:gR,table:Dc,text:D7},oD=cn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Kp).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",bw).getRegex(),N7={...V1,lheading:k7,table:oD,paragraph:cn(W1).replace("hr",Kp).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",oD).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",bw).getRegex()},R7={...V1,html:cn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",z1).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Dc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:cn(W1).replace("hr",Kp).replace("heading",` *#{1,6} *[^
|
|
82
|
-
]`).replace("lheading",uR).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},A7=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,O7=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fR=/^( {2,}|\\)\n(?!\s*$)/,F7=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,yg=/[\p{P}\p{S}]/u,ww=/[\s\p{P}\p{S}]/u,j1=/[^\s\p{P}\p{S}]/u,H7=cn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ww).getRegex(),pR=/(?!~)[\p{P}\p{S}]/u,W7=/(?!~)[\s\p{P}\p{S}]/u,B7=/(?:[^\s\p{P}\p{S}]|~)/u,z7=cn(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",S7?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),mR=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,V7=cn(mR,"u").replace(/punct/g,yg).getRegex(),j7=cn(mR,"u").replace(/punct/g,pR).getRegex(),_R="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",U7=cn(_R,"gu").replace(/notPunctSpace/g,j1).replace(/punctSpace/g,ww).replace(/punct/g,yg).getRegex(),$7=cn(_R,"gu").replace(/notPunctSpace/g,B7).replace(/punctSpace/g,W7).replace(/punct/g,pR).getRegex(),q7=cn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,j1).replace(/punctSpace/g,ww).replace(/punct/g,yg).getRegex(),K7=cn(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,yg).getRegex(),G7="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Z7=cn(G7,"gu").replace(/notPunctSpace/g,j1).replace(/punctSpace/g,ww).replace(/punct/g,yg).getRegex(),X7=cn(/\\(punct)/,"gu").replace(/punct/g,yg).getRegex(),Y7=cn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),J7=cn(z1).replace("(?:-->|$)","-->").getRegex(),Q7=cn("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",J7).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),kv=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,eq=cn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",kv).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vR=cn(/^!?\[(label)\]\[(ref)\]/).replace("label",kv).replace("ref",B1).getRegex(),bR=cn(/^!?\[(ref)\](?:\[\])?/).replace("ref",B1).getRegex(),tq=cn("reflink|nolink(?!\\()","g").replace("reflink",vR).replace("nolink",bR).getRegex(),rD=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,U1={_backpedal:Dc,anyPunctuation:X7,autolink:Y7,blockSkip:z7,br:fR,code:O7,del:Dc,delLDelim:Dc,delRDelim:Dc,emStrongLDelim:V7,emStrongRDelimAst:U7,emStrongRDelimUnd:q7,escape:A7,link:eq,nolink:bR,punctuation:H7,reflink:vR,reflinkSearch:tq,tag:Q7,text:F7,url:Dc},iq={...U1,link:cn(/^!?\[(label)\]\((.*?)\)/).replace("label",kv).getRegex(),reflink:cn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",kv).getRegex()},Gx={...U1,emStrongRDelimAst:$7,emStrongLDelim:j7,delLDelim:K7,delRDelim:Z7,url:cn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",rD).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:cn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",rD).getRegex()},nq={...Gx,br:cn(fR).replace("{2,}","*").getRegex(),text:cn(Gx.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Am={normal:V1,gfm:N7,pedantic:R7},Fg={normal:U1,gfm:Gx,breaks:nq,pedantic:iq},sq={"&":"&","<":"<",">":">",'"':""","'":"'"},aD=o=>sq[o];function $r(o,e){if(e){if(Hs.escapeTest.test(o))return o.replace(Hs.escapeReplace,aD)}else if(Hs.escapeTestNoEncode.test(o))return o.replace(Hs.escapeReplaceNoEncode,aD);return o}function lD(o){try{o=encodeURI(o).replace(Hs.percentDecode,"%")}catch{return null}return o}function cD(o,e){var s;let t=o.replace(Hs.findPipe,(r,a,c)=>{let d=!1,u=a;for(;--u>=0&&c[u]==="\\";)d=!d;return d?"|":" |"}),i=t.split(Hs.splitPipe),n=0;if(i[0].trim()||i.shift(),i.length>0&&!((s=i.at(-1))!=null&&s.trim())&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(Hs.slashPipe,"|");return i}function pl(o,e,t){let i=o.length;if(i===0)return"";let n=0;for(;n<i&&o.charAt(i-n-1)===e;)n++;return o.slice(0,i-n)}function dD(o){let e=o.split(`
|
|
83
|
-
`),t=e.length-1;for(;t>=0&&Hs.blankLine.test(e[t]);)t--;return e.length-t<=2?o:e.slice(0,t+1).join(`
|
|
84
|
-
`)}function oq(o,e){if(o.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<o.length;i++)if(o[i]==="\\")i++;else if(o[i]===e[0])t++;else if(o[i]===e[1]&&(t--,t<0))return i;return t>0?-2:-1}function rq(o,e=0){let t=e,i="";for(let n of o)if(n===" "){let s=4-t%4;i+=" ".repeat(s),t+=s}else i+=n,t++;return i}function hD(o,e,t,i,n){let s=e.href,r=e.title||null,a=o[1].replace(n.other.outputLinkReplace,"$1");i.state.inLink=!0;let c={type:o[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:r,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,c}function aq(o,e,t){let i=o.match(t.other.indentCodeCompensation);if(i===null)return e;let n=i[1];return e.split(`
|
|
85
|
-
`).map(s=>{let r=s.match(t.other.beginningSpace);if(r===null)return s;let[a]=r;return a.length>=n.length?s.slice(n.length):s}).join(`
|
|
86
|
-
`)}var Dv=class{constructor(o){Mi(this,"options");Mi(this,"rules");Mi(this,"lexer");this.options=o||gh}space(o){let e=this.rules.block.newline.exec(o);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(o){let e=this.rules.block.code.exec(o);if(e){let t=this.options.pedantic?e[0]:dD(e[0]),i=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:i}}}fences(o){let e=this.rules.block.fences.exec(o);if(e){let t=e[0],i=aq(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(o){let e=this.rules.block.heading.exec(o);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let i=pl(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:pl(e[0],`
|
|
87
|
-
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(o){let e=this.rules.block.hr.exec(o);if(e)return{type:"hr",raw:pl(e[0],`
|
|
88
|
-
`)}}blockquote(o){let e=this.rules.block.blockquote.exec(o);if(e){let t=pl(e[0],`
|
|
89
|
-
`).split(`
|
|
90
|
-
`),i="",n="",s=[];for(;t.length>0;){let r=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),r=!0;else if(!r)a.push(t[c]);else break;t=t.slice(c);let d=a.join(`
|
|
91
|
-
`),u=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
92
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
93
|
-
${d}`:d,n=n?`${n}
|
|
94
|
-
${u}`:u;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,s,!0),this.lexer.state.top=f,t.length===0)break;let m=s.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let v=m,_=v.raw+`
|
|
95
|
-
`+t.join(`
|
|
96
|
-
`),y=this.blockquote(_);s[s.length-1]=y,i=i.substring(0,i.length-v.raw.length)+y.raw,n=n.substring(0,n.length-v.text.length)+y.text;break}else if((m==null?void 0:m.type)==="list"){let v=m,_=v.raw+`
|
|
97
|
-
`+t.join(`
|
|
98
|
-
`),y=this.list(_);s[s.length-1]=y,i=i.substring(0,i.length-m.raw.length)+y.raw,n=n.substring(0,n.length-v.raw.length)+y.raw,t=_.substring(s.at(-1).raw.length).split(`
|
|
99
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:s,text:n}}}list(o){let e=this.rules.block.list.exec(o);if(e){let t=e[1].trim(),i=t.length>1,n={type:"list",raw:"",ordered:i,start:i?+t.slice(0,-1):"",loose:!1,items:[]};t=i?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=i?t:"[*+-]");let s=this.rules.other.listItemRegex(t),r=!1;for(;o;){let c=!1,d="",u="";if(!(e=s.exec(o))||this.rules.block.hr.test(o))break;d=e[0],o=o.substring(d.length);let f=rq(e[2].split(`
|
|
100
|
-
`,1)[0],e[1].length),m=o.split(`
|
|
101
|
-
`,1)[0],v=!f.trim(),_=0;if(this.options.pedantic?(_=2,u=f.trimStart()):v?_=e[1].length+1:(_=f.search(this.rules.other.nonSpaceChar),_=_>4?1:_,u=f.slice(_),_+=e[1].length),v&&this.rules.other.blankLine.test(m)&&(d+=m+`
|
|
102
|
-
`,o=o.substring(m.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(_),S=this.rules.other.hrRegex(_),D=this.rules.other.fencesBeginRegex(_),E=this.rules.other.headingBeginRegex(_),N=this.rules.other.htmlBeginRegex(_),B=this.rules.other.blockquoteBeginRegex(_);for(;o;){let F=o.split(`
|
|
103
|
-
`,1)[0],Q;if(m=F,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),Q=m):Q=m.replace(this.rules.other.tabCharGlobal," "),D.test(m)||E.test(m)||N.test(m)||B.test(m)||y.test(m)||S.test(m))break;if(Q.search(this.rules.other.nonSpaceChar)>=_||!m.trim())u+=`
|
|
104
|
-
`+Q.slice(_);else{if(v||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||D.test(f)||E.test(f)||S.test(f))break;u+=`
|
|
105
|
-
`+m}v=!m.trim(),d+=F+`
|
|
106
|
-
`,o=o.substring(F.length+1),f=Q.slice(_)}}n.loose||(r?n.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(r=!0)),n.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),n.raw+=d}let a=n.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let c of n.items){this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]);let d=c.tokens[0];if(c.task&&((d==null?void 0:d.type)==="text"||(d==null?void 0:d.type)==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let f={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=f.checked,n.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}else c.task&&(c.task=!1);if(!n.loose){let u=c.tokens.filter(m=>m.type==="space"),f=u.length>0&&u.some(m=>this.rules.other.anyLine.test(m.raw));n.loose=f}}if(n.loose)for(let c of n.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return n}}html(o){let e=this.rules.block.html.exec(o);if(e){let t=dD(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(o){let e=this.rules.block.def.exec(o);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:pl(e[0],`
|
|
107
|
-
`),href:i,title:n}}}table(o){var r;let e=this.rules.block.table.exec(o);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=cD(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=(r=e[3])!=null&&r.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
108
|
-
`):[],s={type:"table",raw:pl(e[0],`
|
|
109
|
-
`),header:[],align:[],rows:[]};if(t.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of n)s.rows.push(cD(a,s.header.length).map((c,d)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[d]})));return s}}lheading(o){let e=this.rules.block.lheading.exec(o);if(e){let t=e[1].trim();return{type:"heading",raw:pl(e[0],`
|
|
110
|
-
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(o){let e=this.rules.block.paragraph.exec(o);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
111
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(o){let e=this.rules.block.text.exec(o);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(o){let e=this.rules.inline.escape.exec(o);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(o){let e=this.rules.inline.tag.exec(o);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(o){let e=this.rules.inline.link.exec(o);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=pl(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=oq(e[2],"()");if(s===-2)return;if(s>-1){let r=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,r).trim(),e[3]=""}}let i=e[2],n="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(i);s&&(i=s[1],n=s[3])}else n=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?i=i.slice(1):i=i.slice(1,-1)),hD(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(o,e){let t;if((t=this.rules.inline.reflink.exec(o))||(t=this.rules.inline.nolink.exec(o))){let i=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[i.toLowerCase()];if(!n){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return hD(t,n,t[0],this.lexer,this.rules)}}emStrong(o,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(o);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!t||this.rules.inline.punctuation.exec(t))){let n=[...i[0]].length-1,s,r,a=n,c=0,d=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*o.length+n);(i=d.exec(e))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(r=[...s].length,i[3]||i[4]){a+=r;continue}else if((i[5]||i[6])&&n%3&&!((n+r)%3)){c+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+c);let u=[...i[0]][0].length,f=o.slice(0,n+i.index+u+r);if(Math.min(n,r)%2){let v=f.slice(1,-1);return{type:"em",raw:f,text:v,tokens:this.lexer.inlineTokens(v)}}let m=f.slice(2,-2);return{type:"strong",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(o){let e=this.rules.inline.code.exec(o);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(o){let e=this.rules.inline.br.exec(o);if(e)return{type:"br",raw:e[0]}}del(o,e,t=""){let i=this.rules.inline.delLDelim.exec(o);if(i&&(!i[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...i[0]].length-1,s,r,a=n,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*o.length+n);(i=c.exec(e))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s||(r=[...s].length,r!==n))continue;if(i[3]||i[4]){a+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a);let d=[...i[0]][0].length,u=o.slice(0,n+i.index+d+r),f=u.slice(n,-n);return{type:"del",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(o){let e=this.rules.inline.autolink.exec(o);if(e){let t,i;return e[2]==="@"?(t=e[1],i="mailto:"+t):(t=e[1],i=t),{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}url(o){var t;let e;if(e=this.rules.inline.url.exec(o)){let i,n;if(e[2]==="@")i=e[0],n="mailto:"+i;else{let s;do s=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(s!==e[0]);i=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(o){let e=this.rules.inline.text.exec(o);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},yr=class Zx{constructor(e){Mi(this,"tokens");Mi(this,"options");Mi(this,"state");Mi(this,"inlineQueue");Mi(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||gh,this.options.tokenizer=this.options.tokenizer||new Dv,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Hs,block:Am.normal,inline:Fg.normal};this.options.pedantic?(t.block=Am.pedantic,t.inline=Fg.pedantic):this.options.gfm&&(t.block=Am.gfm,this.options.breaks?t.inline=Fg.breaks:t.inline=Fg.gfm),this.tokenizer.rules=t}static get rules(){return{block:Am,inline:Fg}}static lex(e,t){return new Zx(t).lex(e)}static lexInline(e,t){return new Zx(t).inlineTokens(e)}lex(e){e=e.replace(Hs.carriageReturn,`
|
|
112
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){var s,r,a;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Hs.tabCharGlobal," ").replace(Hs.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let c;if((r=(s=this.options.extensions)==null?void 0:s.block)!=null&&r.some(u=>(c=u.call({lexer:this},e,t))?(e=e.substring(c.raw.length),t.push(c),!0):!1))continue;if(c=this.tokenizer.space(e)){e=e.substring(c.raw.length);let u=t.at(-1);c.raw.length===1&&u!==void 0?u.raw+=`
|
|
113
|
-
`:t.push(c);continue}if(c=this.tokenizer.code(e)){e=e.substring(c.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
114
|
-
`)?"":`
|
|
115
|
-
`)+c.raw,u.text+=`
|
|
116
|
-
`+c.text,this.inlineQueue.at(-1).src=u.text):t.push(c);continue}if(c=this.tokenizer.fences(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.heading(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.hr(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.blockquote(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.list(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.html(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.def(e)){e=e.substring(c.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
117
|
-
`)?"":`
|
|
118
|
-
`)+c.raw,u.text+=`
|
|
119
|
-
`+c.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title},t.push(c));continue}if(c=this.tokenizer.table(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.lheading(e)){e=e.substring(c.raw.length),t.push(c);continue}let d=e;if((a=this.options.extensions)!=null&&a.startBlock){let u=1/0,f=e.slice(1),m;this.options.extensions.startBlock.forEach(v=>{m=v.call({lexer:this},f),typeof m=="number"&&m>=0&&(u=Math.min(u,m))}),u<1/0&&u>=0&&(d=e.substring(0,u+1))}if(this.state.top&&(c=this.tokenizer.paragraph(d))){let u=t.at(-1);i&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
|
|
120
|
-
`)?"":`
|
|
121
|
-
`)+c.raw,u.text+=`
|
|
122
|
-
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(c),i=d.length!==e.length,e=e.substring(c.raw.length);continue}if(c=this.tokenizer.text(e)){e=e.substring(c.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
|
|
123
|
-
`)?"":`
|
|
124
|
-
`)+c.raw,u.text+=`
|
|
125
|
-
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(c);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var d,u,f,m,v;this.tokenizer.lexer=this;let i=e,n=null;if(this.tokens.links){let _=Object.keys(this.tokens.links);if(_.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(i))!==null;)_.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(i))!==null;)i=i.slice(0,n.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(i))!==null;)s=n[2]?n[2].length:0,i=i.slice(0,n.index+s)+"["+"a".repeat(n[0].length-s-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=((u=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:u.call({lexer:this},i))??i;let r=!1,a="",c=1/0;for(;e;){if(e.length<c)c=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(a=""),r=!1;let _;if((m=(f=this.options.extensions)==null?void 0:f.inline)!=null&&m.some(S=>(_=S.call({lexer:this},e,t))?(e=e.substring(_.raw.length),t.push(_),!0):!1))continue;if(_=this.tokenizer.escape(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.tag(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.link(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(_.raw.length);let S=t.at(-1);_.type==="text"&&(S==null?void 0:S.type)==="text"?(S.raw+=_.raw,S.text+=_.text):t.push(_);continue}if(_=this.tokenizer.emStrong(e,i,a)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.codespan(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.br(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.del(e,i,a)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.autolink(e)){e=e.substring(_.raw.length),t.push(_);continue}if(!this.state.inLink&&(_=this.tokenizer.url(e))){e=e.substring(_.raw.length),t.push(_);continue}let y=e;if((v=this.options.extensions)!=null&&v.startInline){let S=1/0,D=e.slice(1),E;this.options.extensions.startInline.forEach(N=>{E=N.call({lexer:this},D),typeof E=="number"&&E>=0&&(S=Math.min(S,E))}),S<1/0&&S>=0&&(y=e.substring(0,S+1))}if(_=this.tokenizer.inlineText(y)){e=e.substring(_.raw.length),_.raw.slice(-1)!=="_"&&(a=_.raw.slice(-1)),r=!0;let S=t.at(-1);(S==null?void 0:S.type)==="text"?(S.raw+=_.raw,S.text+=_.text):t.push(_);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},Ev=class{constructor(o){Mi(this,"options");Mi(this,"parser");this.options=o||gh}space(o){return""}code({text:o,lang:e,escaped:t}){var s;let i=(s=(e||"").match(Hs.notSpaceStart))==null?void 0:s[0],n=o.replace(Hs.endingNewline,"")+`
|
|
126
|
-
`;return i?'<pre><code class="language-'+$r(i)+'">'+(t?n:$r(n,!0))+`</code></pre>
|
|
127
|
-
`:"<pre><code>"+(t?n:$r(n,!0))+`</code></pre>
|
|
128
|
-
`}blockquote({tokens:o}){return`<blockquote>
|
|
129
|
-
${this.parser.parse(o)}</blockquote>
|
|
130
|
-
`}html({text:o}){return o}def(o){return""}heading({tokens:o,depth:e}){return`<h${e}>${this.parser.parseInline(o)}</h${e}>
|
|
131
|
-
`}hr(o){return`<hr>
|
|
132
|
-
`}list(o){let e=o.ordered,t=o.start,i="";for(let r=0;r<o.items.length;r++){let a=o.items[r];i+=this.listitem(a)}let n=e?"ol":"ul",s=e&&t!==1?' start="'+t+'"':"";return"<"+n+s+`>
|
|
133
|
-
`+i+"</"+n+`>
|
|
134
|
-
`}listitem(o){return`<li>${this.parser.parse(o.tokens)}</li>
|
|
135
|
-
`}checkbox({checked:o}){return"<input "+(o?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:o}){return`<p>${this.parser.parseInline(o)}</p>
|
|
136
|
-
`}table(o){let e="",t="";for(let n=0;n<o.header.length;n++)t+=this.tablecell(o.header[n]);e+=this.tablerow({text:t});let i="";for(let n=0;n<o.rows.length;n++){let s=o.rows[n];t="";for(let r=0;r<s.length;r++)t+=this.tablecell(s[r]);i+=this.tablerow({text:t})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
137
|
-
<thead>
|
|
138
|
-
`+e+`</thead>
|
|
139
|
-
`+i+`</table>
|
|
140
|
-
`}tablerow({text:o}){return`<tr>
|
|
141
|
-
${o}</tr>
|
|
142
|
-
`}tablecell(o){let e=this.parser.parseInline(o.tokens),t=o.header?"th":"td";return(o.align?`<${t} align="${o.align}">`:`<${t}>`)+e+`</${t}>
|
|
143
|
-
`}strong({tokens:o}){return`<strong>${this.parser.parseInline(o)}</strong>`}em({tokens:o}){return`<em>${this.parser.parseInline(o)}</em>`}codespan({text:o}){return`<code>${$r(o,!0)}</code>`}br(o){return"<br>"}del({tokens:o}){return`<del>${this.parser.parseInline(o)}</del>`}link({href:o,title:e,tokens:t}){let i=this.parser.parseInline(t),n=lD(o);if(n===null)return i;o=n;let s='<a href="'+o+'"';return e&&(s+=' title="'+$r(e)+'"'),s+=">"+i+"</a>",s}image({href:o,title:e,text:t,tokens:i}){i&&(t=this.parser.parseInline(i,this.parser.textRenderer));let n=lD(o);if(n===null)return $r(t);o=n;let s=`<img src="${o}" alt="${$r(t)}"`;return e&&(s+=` title="${$r(e)}"`),s+=">",s}text(o){return"tokens"in o&&o.tokens?this.parser.parseInline(o.tokens):"escaped"in o&&o.escaped?o.text:$r(o.text)}},$1=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Sr=class Xx{constructor(e){Mi(this,"options");Mi(this,"renderer");Mi(this,"textRenderer");this.options=e||gh,this.options.renderer=this.options.renderer||new Ev,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $1}static parse(e,t){return new Xx(t).parse(e)}static parseInline(e,t){return new Xx(t).parseInline(e)}parse(e){var i,n;this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if((n=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&n[r.type]){let c=r,d=this.options.extensions.renderers[c.type].call({parser:this},c);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){t+=d||"";continue}}let a=r;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return t}parseInline(e,t=this.renderer){var n,s;this.renderer.parser=this;let i="";for(let r=0;r<e.length;r++){let a=e[r];if((s=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&s[a.type]){let d=this.options.extensions.renderers[a.type].call({parser:this},a);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=d||"";continue}}let c=a;switch(c.type){case"escape":{i+=t.text(c);break}case"html":{i+=t.html(c);break}case"link":{i+=t.link(c);break}case"image":{i+=t.image(c);break}case"checkbox":{i+=t.checkbox(c);break}case"strong":{i+=t.strong(c);break}case"em":{i+=t.em(c);break}case"codespan":{i+=t.codespan(c);break}case"br":{i+=t.br(c);break}case"del":{i+=t.del(c);break}case"text":{i+=t.text(c);break}default:{let d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}},Om,ef=(Om=class{constructor(o){Mi(this,"options");Mi(this,"block");this.options=o||gh}preprocess(o){return o}postprocess(o){return o}processAllTokens(o){return o}emStrongMask(o){return o}provideLexer(o=this.block){return o?yr.lex:yr.lexInline}provideParser(o=this.block){return o?Sr.parse:Sr.parseInline}},Mi(Om,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Mi(Om,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Om),lq=class{constructor(...o){Mi(this,"defaults",F1());Mi(this,"options",this.setOptions);Mi(this,"parse",this.parseMarkdown(!0));Mi(this,"parseInline",this.parseMarkdown(!1));Mi(this,"Parser",Sr);Mi(this,"Renderer",Ev);Mi(this,"TextRenderer",$1);Mi(this,"Lexer",yr);Mi(this,"Tokenizer",Dv);Mi(this,"Hooks",ef);this.use(...o)}walkTokens(o,e){var i,n;let t=[];for(let s of o)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let a of r.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of r.rows)for(let c of a)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;(n=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&n[r.type]?this.defaults.extensions.childTokens[r.type].forEach(a=>{let c=r[a].flat(1/0);t=t.concat(this.walkTokens(c,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...o){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return o.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let s=e.renderers[n.name];s?e.renderers[n.name]=function(...r){let a=n.renderer.apply(this,r);return a===!1&&(a=s.apply(this,r)),a}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[n.level];s?s.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),i.extensions=e),t.renderer){let n=this.defaults.renderer||new Ev(this.defaults);for(let s in t.renderer){if(!(s in n))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let r=s,a=t.renderer[r],c=n[r];n[r]=(...d)=>{let u=a.apply(n,d);return u===!1&&(u=c.apply(n,d)),u||""}}i.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new Dv(this.defaults);for(let s in t.tokenizer){if(!(s in n))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let r=s,a=t.tokenizer[r],c=n[r];n[r]=(...d)=>{let u=a.apply(n,d);return u===!1&&(u=c.apply(n,d)),u}}i.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new ef;for(let s in t.hooks){if(!(s in n))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let r=s,a=t.hooks[r],c=n[r];ef.passThroughHooks.has(s)?n[r]=d=>{if(this.defaults.async&&ef.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await a.call(n,d);return c.call(n,f)})();let u=a.call(n,d);return c.call(n,u)}:n[r]=(...d)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(n,d);return f===!1&&(f=await c.apply(n,d)),f})();let u=a.apply(n,d);return u===!1&&(u=c.apply(n,d)),u}}i.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,s=t.walkTokens;i.walkTokens=function(r){let a=[];return a.push(s.call(this,r)),n&&(a=a.concat(n.call(this,r))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(o){return this.defaults={...this.defaults,...o},this}lexer(o,e){return yr.lex(o,e??this.defaults)}parser(o,e){return Sr.parse(o,e??this.defaults)}parseMarkdown(o){return(e,t)=>{let i={...t},n={...this.defaults,...i},s=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=o),n.async)return(async()=>{let r=n.hooks?await n.hooks.preprocess(e):e,a=await(n.hooks?await n.hooks.provideLexer(o):o?yr.lex:yr.lexInline)(r,n),c=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(c,n.walkTokens));let d=await(n.hooks?await n.hooks.provideParser(o):o?Sr.parse:Sr.parseInline)(c,n);return n.hooks?await n.hooks.postprocess(d):d})().catch(s);try{n.hooks&&(e=n.hooks.preprocess(e));let r=(n.hooks?n.hooks.provideLexer(o):o?yr.lex:yr.lexInline)(e,n);n.hooks&&(r=n.hooks.processAllTokens(r)),n.walkTokens&&this.walkTokens(r,n.walkTokens);let a=(n.hooks?n.hooks.provideParser(o):o?Sr.parse:Sr.parseInline)(r,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(r){return s(r)}}}onError(o,e){return t=>{if(t.message+=`
|
|
144
|
-
Please report this to https://github.com/markedjs/marked.`,o){let i="<p>An error occurred:</p><pre>"+$r(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},th=new lq;function vn(o,e){return th.parse(o,e)}vn.options=vn.setOptions=function(o){return th.setOptions(o),vn.defaults=th.defaults,dR(vn.defaults),vn};vn.getDefaults=F1;vn.defaults=gh;vn.use=function(...o){return th.use(...o),vn.defaults=th.defaults,dR(vn.defaults),vn};vn.walkTokens=function(o,e){return th.walkTokens(o,e)};vn.parseInline=th.parseInline;vn.Parser=Sr;vn.parser=Sr.parse;vn.Renderer=Ev;vn.TextRenderer=$1;vn.Lexer=yr;vn.lexer=yr.lex;vn.Tokenizer=Dv;vn.Hooks=ef;vn.parse=vn;vn.options;vn.setOptions;vn.use;vn.walkTokens;vn.parseInline;Sr.parse;yr.lex;var cq=A('<span class="chat-model svelte-10ayso4"><!></span>'),dq=A('<button class="clear-btn svelte-10ayso4" title="Clear conversation">✕</button>'),hq=A('<div class="unconfigured svelte-10ayso4">Configure an AI provider in the <strong class="svelte-10ayso4">Config</strong> tab to use the AI assistant.</div>'),uq=A('Chatting in context of <code class="svelte-10ayso4"> </code>',1),gq=A('<button class="chip svelte-10ayso4"> </button>'),fq=A('<div class="suggestions svelte-10ayso4"><p class="suggestions-hint svelte-10ayso4"><!></p> <!></div>'),pq=A('<div class="msg-content user-text svelte-10ayso4"> </div>'),uD=A('<span class="tool-args svelte-10ayso4"> </span>'),gD=A('<div class="tool-event tool-call svelte-10ayso4"><span class="tool-icon svelte-10ayso4">🔧</span> <span class="tool-name svelte-10ayso4"> </span> <!></div>'),fD=A('<div class="tool-event tool-result svelte-10ayso4"><span class="tool-icon svelte-10ayso4">✓</span> <span class="tool-name svelte-10ayso4"> </span></div>'),pD=A('<div class="tool-events svelte-10ayso4"></div>'),mD=A('<div class="text-block svelte-10ayso4"></div>'),mq=A('<button class="create-btn svelte-10ayso4">Save as new file…</button>'),_q=A('<span class="auto-badge svelte-10ayso4" title="Auto-applying AI code to this script in this session">auto ✓</span>'),vq=A('<button class="apply-auto-btn svelte-10ayso4" title="Apply and always apply for this script in this session">always</button>'),bq=A('<button class="apply-btn svelte-10ayso4">Apply</button> <!>',1),wq=A('<button class="expand-btn svelte-10ayso4"> </button>'),yq=A('<div class="code-block svelte-10ayso4"><div class="code-header svelte-10ayso4"><span class="code-lang svelte-10ayso4"> </span> <div class="code-actions svelte-10ayso4"><button class="svelte-10ayso4">Copy</button> <!></div></div> <div><pre class="svelte-10ayso4"><code class="hljs svelte-10ayso4"></code></pre> <!></div></div>'),Sq=A('<!> <div class="msg-content svelte-10ayso4"></div>',1),Cq=A("<div><!></div>"),xq=A('<div class="message assistant svelte-10ayso4"><div class="msg-content svelte-10ayso4"><span class="status-shimmer svelte-10ayso4"> </span></div></div>'),Lq=A('<div class="code-block svelte-10ayso4"><div class="code-header svelte-10ayso4"><span class="code-lang svelte-10ayso4"> </span></div> <pre class="svelte-10ayso4"><code class="hljs svelte-10ayso4"></code></pre></div>'),Iq=A('<div class="message assistant streaming svelte-10ayso4"><div class="msg-content svelte-10ayso4"></div></div>'),kq=A('<div class="chat-error svelte-10ayso4"> </div>'),Dq=A('<span><span> </span> <span class="chip-name svelte-10ayso4"> </span> <button class="chip-remove svelte-10ayso4"> </button></span>'),Eq=A('<span class="file-chip svelte-10ayso4"><span> </span> <span class="chip-name svelte-10ayso4"> </span> <button class="chip-remove svelte-10ayso4" title="Remove from context">×</button></span>'),Pq=A('<button class="stop-btn svelte-10ayso4" title="Stop generation">■</button>'),Tq=A('<button class="send-btn svelte-10ayso4">↑</button>'),Mq=A('<option class="svelte-10ayso4"> </option>'),Nq=A('<select class="model-select svelte-10ayso4"></select>'),Rq=A('<span class="model-name svelte-10ayso4"> </span>'),Aq=A('<button class="info-btn svelte-10ayso4" title="Model info">ℹ</button>'),Oq=A('<div class="model-bar svelte-10ayso4"><span class="model-provider svelte-10ayso4"> </span> <!> <!></div>'),Fq=A('<p class="info-status svelte-10ayso4">Loading…</p>'),Hq=A('<p class="info-status info-err svelte-10ayso4"> </p>'),Wq=A('<dt class="svelte-10ayso4">Ollama version</dt><dd class="svelte-10ayso4"> </dd>',1),Bq=A('<dt class="svelte-10ayso4">Family</dt><dd class="svelte-10ayso4"> </dd>',1),zq=A('<dt class="svelte-10ayso4">Parameters</dt><dd class="svelte-10ayso4"> </dd>',1),Vq=A('<dt class="svelte-10ayso4">Quantization</dt><dd class="svelte-10ayso4"> </dd>',1),jq=A('<dt class="svelte-10ayso4">Format</dt><dd class="svelte-10ayso4"> </dd>',1),Uq=A('<div class="running-model svelte-10ayso4"> </div>'),$q=A('<dt class="svelte-10ayso4">Loaded</dt> <dd class="svelte-10ayso4"></dd>',1),qq=A('<dt class="svelte-10ayso4">Loaded</dt><dd class="dim svelte-10ayso4">Not in memory</dd>',1),Kq=A('<dl class="svelte-10ayso4"><!> <!> <!> <!> <!> <!></dl>'),Gq=A('<div class="info-overlay svelte-10ayso4"><div class="info-popup svelte-10ayso4"><div class="info-popup-header svelte-10ayso4"><span class="svelte-10ayso4"> </span> <button title="Close" class="svelte-10ayso4">✕</button></div> <div class="info-popup-body svelte-10ayso4"><!></div></div></div>'),Zq=A('<div class="chat-panel svelte-10ayso4"><div class="chat-header svelte-10ayso4"><span class="chat-title svelte-10ayso4">AI Assistant</span> <!> <!></div> <div class="messages svelte-10ayso4"><!> <!> <!> <!> <!></div> <!> <div class="context-row svelte-10ayso4"><label title="Include she API reference in context" class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/><span class="checkmark svelte-10ayso4"></span> she API</label> <label title="Let the AI query MQTT state, sheDB documents and Matter devices on demand. Disables real-time streaming." class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/><span class="checkmark svelte-10ayso4"></span> 😎 Agent</label> <span class="req-size svelte-10ayso4"> </span></div> <div class="files-row svelte-10ayso4"><!> <!> <button class="add-file-btn svelte-10ayso4" title="Attach file to context">+</button> <input type="file" multiple="" class="file-input-hidden svelte-10ayso4"/></div> <div><div><textarea rows="3" class="svelte-10ayso4"></textarea></div> <!></div> <!></div> <!>',1);function Xq(o,e){xo(e,!0),Iv.registerLanguage("javascript",cR),vn.use({breaks:!0,gfm:!0});let t=qu(e,"currentScript",3,null),i=qu(e,"extraFiles",31,()=>Si([])),n=U(Si([])),s=U(null),r=U(""),a=U(!1),c=U(""),d=U(null),u=U(Si([])),f=U(Si(localStorage.getItem("she:selectedModel")??"")),m=U(null);const v=ct(()=>{var j;return g(m)!==null&&((j=t())==null?void 0:j.path)===g(m)});let _=U(Si(new Set)),y=U(!1),S=U(null),D=U(!1),E=U(""),N=U(0),B=null,F=U(0);const Q=["[core] reticulating splines…","[io] calibrating the flux capacitor…","[net] pinging the oracle (no response)…","[gpu] overclocking the neurons…","[fs] loading sarcasm module v4.2…","[mem] defragmenting the embedding space…","[sched] running gradient descent into madness…","[net] synchronizing with the hive mind…","[model] tickling the transformer…","[io] consulting rubber duck debugger…","[core] solving P=NP as a warmup…","[gpu] burning GPU cycles for warmth…","[mem] compressing knowledge into tensors…","[net] asking my inner voice (busy)…","[fs] mining opinions from the void…","[core] summoning attention heads…","[io] tokenizing the vibes…","[sched] hallucinating thoughtfully…","[net] traversing the knowledge graph…","[model] manifesting an answer…"];let $=U(!0),fe=U(!0),Pe=U(!0),ze=U(!1),me,Ve=U(Si([])),dt,Ke;const Ut=ct(()=>({apiref:g($),tools:g(fe)})),lt=ct(()=>{var j;return((j=g(d))==null?void 0:j.configured)??!1}),Kt=ct(()=>g(N)+new TextEncoder().encode(g(r)).length),Ie=ct(()=>g(Pe)?t():null);kn(()=>{var re;const j=(re=t())==null?void 0:re.path;k(Pe,!0),g(m)!==null&&j!==g(m)&&k(m,null)}),kn(()=>{var W;if(!g(v))return;const j=g(n).at(-1);if(!j||j.role!=="assistant")return;const Le=Pt(j.content).find(R=>R.type==="code"&&zi(R.lang));if(Le){const R=tt(Le.text);(W=e.onApply)==null||W.call(e,R?R.code:Le.text)}}),kn(()=>{JN().then(j=>{k(d,j,!0),j.configured&&!g(f)&&k(f,j.model,!0)}).catch(()=>{})}),kn(()=>{g(f)&&localStorage.setItem("she:selectedModel",g(f))}),kn(()=>{var j;(j=g(d))!=null&&j.configured&&QN().then(re=>{k(u,re.models,!0)}).catch(()=>{})}),kn(()=>{g(f),k(S,null),k(E,"")}),kn(()=>{if(!g(a))return;k(F,Math.floor(Math.random()*Q.length),!0);const j=setInterval(()=>{k(F,(g(F)+1)%Q.length)},1e4);return()=>clearInterval(j)}),kn(()=>{var j;Ke&&(g(n).length+(((j=g(s))==null?void 0:j.length)??0),requestAnimationFrame(()=>{Ke&&(Ke.scrollTop=Ke.scrollHeight)}))}),kn(()=>{const j=g(Ut),re=g(Ie),Le=i();g(lt)&&tR({context:j,currentScript:re??null,extraFiles:Le.length>0?Le:void 0}).then(W=>{k(N,new TextEncoder().encode(W.prompt).length,!0)}).catch(()=>{})});function Pt(j){const re=j.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
|
|
145
|
-
$2
|
|
146
|
-
`),Le=[],W=/```(\w*)\n([\s\S]*?)```/g;let R=0,G;for(;(G=W.exec(re))!==null;)G.index>R&&Le.push({type:"text",text:re.slice(R,G.index)}),Le.push({type:"code",lang:G[1]||"text",text:G[2].trimEnd()}),R=G.index+G[0].length;return R<re.length&&Le.push({type:"text",text:re.slice(R)}),Le}const Fe=15;function ft(j){return j.split(`
|
|
147
|
-
`).length>Fe}function zt(j){const re=new Set(g(_));re.has(j)?re.delete(j):re.add(j),k(_,re,!0)}function Gt(j,re){if(zi(re))try{return Iv.highlight(j,{language:"javascript"}).value}catch{}return j.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ci(j){return vn.parse(j)}function Vt(j){const re=j.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
|
|
148
|
-
$2
|
|
149
|
-
`),Le=[],W=/```(\w*)\n([\s\S]*?)```/g;let R=0,G;for(;(G=W.exec(re))!==null;)G.index>R&&Le.push({type:"text",text:re.slice(R,G.index)}),Le.push({type:"code",lang:G[1]||"text",text:G[2].trimEnd()}),R=G.index+G[0].length;const pe=re.slice(R),se=pe.match(/```(\w*)\n([\s\S]*)$/);return se?(se.index>0&&Le.push({type:"text",text:pe.slice(0,se.index)}),Le.push({type:"code",lang:se[1]||"text",text:se[2]})):pe&&Le.push({type:"text",text:pe}),Le}function Ht(j){navigator.clipboard.writeText(j).catch(()=>{})}function Fi(j,re=!1){var Le;re&&t()&&k(m,t().path,!0),(Le=e.onApply)==null||Le.call(e,j)}function zi(j){return!j||j==="js"||j==="javascript"}function tt(j){const re=j.match(/^\/\/ @new-file:\s*(\S+\.js)[ \t]*\n/);return re?{filename:re[1],code:j.slice(re[0].length)}:null}function Ct(j){return j>=1e9?`${(j/1e9).toFixed(1)} GB`:j>=1e6?`${(j/1e6).toFixed(0)} MB`:j>=1024?`${(j/1024).toFixed(1)} kB`:`${j} B`}async function mi(){if(k(y,!0),!(g(S)||g(D))){k(D,!0),k(E,"");try{k(S,await eR(g(f)||g(d).model),!0)}catch(j){k(E,j.message,!0)}k(D,!1)}}function Ci(j){const re=j.match(/\.([^.]+)$/);return re?re[1].toUpperCase():"?"}function xi(j){switch(j){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return j}}function Di(j){i(i().filter((re,Le)=>Le!==j))}function Ji(){me.click()}async function Ui(j){if(!(!j||j.length===0))for(const re of Array.from(j)){const Le=await re.text();i([...i(),{name:re.name,content:Le}])}}function bn(j){const re=j.target;Ui(re.files),re.value=""}function mn(j){var re;j.preventDefault(),k(ze,!1),Ui(((re=j.dataTransfer)==null?void 0:re.files)??null)}function Tn(j){var re;(re=j.dataTransfer)!=null&&re.types.includes("Files")&&(j.preventDefault(),k(ze,!0))}function wn(){k(ze,!1)}async function _n(){const j=g(r).trim();if(!j||g(a))return;k(r,""),k(c,""),k(a,!0);const re={role:"user",content:j};k(n,[...g(n),re],!0),B=new AbortController,k(Ve,[],!0);try{await iR({messages:g(n),currentScript:g(Ie),context:g(Ut),modelOverride:g(f)||void 0,extraFiles:i().length>0?i():void 0},Le=>{k(s,(g(s)??"")+Le)},B.signal,Le=>{k(Ve,[...g(Ve),Le],!0)}),k(n,[...g(n),{role:"assistant",content:g(s)??"",toolEvents:g(Ve).length>0?[...g(Ve)]:void 0}],!0),k(Ve,[],!0)}catch(Le){if(Le.name==="AbortError"){const W=g(s);W&&W.trim()&&k(n,[...g(n),{role:"assistant",content:W+`
|
|
150
|
-
|
|
151
|
-
*[stopped]*`,toolEvents:g(Ve).length>0?[...g(Ve)]:void 0}],!0)}else k(c,Le.message,!0)}finally{B=null,k(s,null),k(Ve,[],!0),k(a,!1)}}function Dn(){B==null||B.abort()}function Ei(j){j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),_n())}function $i(){k(n,[],!0),k(c,"")}const Fn=["Explain what this script does","Add error handling","Add a 30-minute schedule before sunrise","Write a new script that forwards MQTT topic A to topic B","Write a new script that turns lights on at sunset"];function hn(j){k(r,j,!0),dt==null||dt.focus()}var Ai=Zq(),rn=xt(Ai),xn=x(rn),Ln=I(x(xn),2);{var Bn=j=>{var re=cq(),Le=x(re);{var W=G=>{var pe=ha();Y(()=>q(pe,`${g(d).provider??""} · ${(g(f)||g(d).model)??""}`)),T(G,pe)},R=G=>{var pe=ha("Not configured");T(G,pe)};K(Le,G=>{g(lt)?G(W):G(R,-1)})}Y(()=>Jn(re,"title",`Provider: ${g(d).provider??""}`)),T(j,re)};K(Ln,j=>{g(d)&&j(Bn)})}var Hn=I(Ln,2);{var $e=j=>{var re=dq();oe("click",re,$i),T(j,re)};K(Hn,j=>{g(n).length>0&&j($e)})}var ne=I(xn,2),it=x(ne);{var Z=j=>{var re=hq();T(j,re)},Te=j=>{var re=fq(),Le=x(re),W=x(Le);{var R=se=>{var we=uq(),ae=I(xt(we)),ue=x(ae);Y(Re=>q(ue,Re),[()=>t().path.split("/").pop()]),T(se,we)},G=se=>{var we=ha("No script open. Ask a general she scripting question.");T(se,we)};K(W,se=>{t()?se(R):se(G,-1)})}var pe=I(Le,2);di(pe,17,()=>Fn,In,(se,we)=>{var ae=gq(),ue=x(ae);Y(()=>q(ue,g(we))),oe("click",ae,()=>hn(g(we))),T(se,ae)}),T(j,re)};K(it,j=>{g(lt)?g(n).length===0&&g(s)===null&&j(Te,1):j(Z)})}var nt=I(it,2);di(nt,17,()=>g(n),In,(j,re,Le)=>{var W=Cq(),R=x(W);{var G=se=>{var we=pq(),ae=x(we);Y(()=>q(ae,g(re).content)),T(se,we)},pe=se=>{const we=ct(()=>Pt(g(re).content));var ae=Sq(),ue=xt(ae);{var Re=Ae=>{var Ee=pD();di(Ee,21,()=>g(re).toolEvents,In,(ge,et)=>{var ei=xs(),vi=xt(ei);{var Pi=ri=>{var ai=gD(),Wt=I(x(ai),2),hi=x(Wt),ki=I(Wt,2);{var St=ve=>{var ke=uD(),Nt=x(ke);Y(At=>q(Nt,At),[()=>Object.entries(g(et).args).map(([At,Vi])=>`${At}=${JSON.stringify(Vi)}`).join(", ")]),T(ve,ke)},Xt=ct(()=>g(et).args&&Object.keys(g(et).args).length>0);K(ki,ve=>{g(Xt)&&ve(St)})}Y(ve=>q(hi,ve),[()=>g(et).name.replace(/_/g," ")]),T(ri,ai)},Mn=ri=>{var ai=fD(),Wt=I(x(ai),2),hi=x(Wt);Y(ki=>q(hi,ki),[()=>g(et).name.replace(/_/g," ")]),T(ri,ai)};K(vi,ri=>{g(et).type==="tool_call"?ri(Pi):ri(Mn,-1)})}T(ge,ei)}),T(Ae,Ee)};K(ue,Ae=>{var Ee;(Ee=g(re).toolEvents)!=null&&Ee.length&&Ae(Re)})}var _e=I(ue,2);di(_e,21,()=>g(we),In,(Ae,Ee,ge)=>{var et=xs(),ei=xt(et);{var vi=Mn=>{var ri=mD();Dl(ri,()=>ci(g(Ee).text),!0),T(Mn,ri)},Pi=Mn=>{const ri=ct(()=>zi(g(Ee).lang)?tt(g(Ee).text):null),ai=ct(()=>g(ri)?g(ri).code:g(Ee).text),Wt=ct(()=>`${Le}:${ge}`),hi=ct(()=>ft(g(ai))),ki=ct(()=>g(_).has(g(Wt)));var St=yq(),Xt=x(St),ve=x(Xt),ke=x(ve),Nt=I(ve,2),At=x(Nt),Vi=I(At,2);{var en=ss=>{var Nn=mq();oe("click",Nn,()=>e.onCreateFile(g(ri).filename,g(ri).code)),T(ss,Nn)},Ne=ss=>{var Nn=bq(),os=xt(Nn),ds=I(os,2);{var ao=Rn=>{var $s=_q();T(Rn,$s)},lo=Rn=>{var $s=vq();oe("click",$s,()=>Fi(g(Ee).text,!0)),T(Rn,$s)};K(ds,Rn=>{g(v)?Rn(ao):Rn(lo,-1)})}oe("click",os,()=>Fi(g(Ee).text)),T(ss,Nn)},ot=ct(()=>zi(g(Ee).lang)&&t());K(Vi,ss=>{g(ri)&&e.onCreateFile?ss(en):g(ot)&&ss(Ne,1)})}var Tt=I(Xt,2);let ni;var vt=x(Tt),fi=x(vt);Dl(fi,()=>Gt(g(ai),g(Ee).lang??""),!0);var si=I(vt,2);{var ns=ss=>{var Nn=wq(),os=x(Nn);Y(()=>q(os,g(ki)?"▲ collapse":"▼ expand")),oe("click",Nn,()=>zt(g(Wt))),T(ss,Nn)};K(si,ss=>{g(hi)&&ss(ns)})}Y(()=>{q(ke,g(ri)?`new: ${g(ri).filename}`:g(Ee).lang),ni=Bt(Tt,1,"code-body svelte-10ayso4",null,ni,{collapsed:g(hi)&&!g(ki)})}),oe("click",At,()=>Ht(g(ai))),T(Mn,St)};K(ei,Mn=>{g(Ee).type==="text"?Mn(vi):Mn(Pi,-1)})}T(Ae,et)}),T(se,ae)};K(R,se=>{g(re).role==="user"?se(G):se(pe,-1)})}Y(()=>Bt(W,1,`message ${g(re).role??""}`,"svelte-10ayso4")),T(j,W)});var wt=I(nt,2);{var Qt=j=>{var re=pD();di(re,21,()=>g(Ve),In,(Le,W)=>{var R=xs(),G=xt(R);{var pe=we=>{var ae=gD(),ue=I(x(ae),2),Re=x(ue),_e=I(ue,2);{var Ae=ge=>{var et=uD(),ei=x(et);Y(vi=>q(ei,vi),[()=>Object.entries(g(W).args).map(([vi,Pi])=>`${vi}=${JSON.stringify(Pi)}`).join(", ")]),T(ge,et)},Ee=ct(()=>g(W).args&&Object.keys(g(W).args).length>0);K(_e,ge=>{g(Ee)&&ge(Ae)})}Y(ge=>q(Re,ge),[()=>g(W).name.replace(/_/g," ")]),T(we,ae)},se=we=>{var ae=fD(),ue=I(x(ae),2),Re=x(ue);Y(_e=>q(Re,_e),[()=>g(W).name.replace(/_/g," ")]),T(we,ae)};K(G,we=>{g(W).type==="tool_call"?we(pe):we(se,-1)})}T(Le,R)}),T(j,re)};K(wt,j=>{g(Ve).length>0&&j(Qt)})}var Zt=I(wt,2);{var Li=j=>{var re=xq(),Le=x(re),W=x(Le),R=x(W);Y(()=>q(R,Q[g(F)])),T(j,re)};K(Zt,j=>{g(a)&&g(s)===null&&g(Ve).length===0&&j(Li)})}var _i=I(Zt,2);{var O=j=>{var re=Iq(),Le=x(re);di(Le,21,()=>Vt(g(s)),In,(W,R)=>{var G=xs(),pe=xt(G);{var se=ae=>{var ue=mD();Dl(ue,()=>ci(g(R).text),!0),T(ae,ue)},we=ae=>{var ue=Lq(),Re=x(ue),_e=x(Re),Ae=x(_e),Ee=I(Re,2),ge=x(Ee);Dl(ge,()=>Gt(g(R).text,g(R).lang??""),!0),Y(()=>q(Ae,g(R).lang)),T(ae,ue)};K(pe,ae=>{g(R).type==="text"?ae(se):ae(we,-1)})}T(W,G)}),T(j,re)};K(_i,j=>{g(s)!==null&&j(O)})}Qs(ne,j=>Ke=j,()=>Ke);var X=I(ne,2);{var xe=j=>{var re=kq(),Le=x(re);Y(()=>q(Le,g(c))),T(j,re)};K(X,j=>{g(c)&&j(xe)})}var Ze=I(X,2),Dt=x(Ze),mt=x(Dt),Me=I(Dt,2),De=x(Me),Ue=I(Me,2),Ge=x(Ue),Xe=I(Ze,2),Ce=x(Xe);{var Et=j=>{const re=ct(()=>Ci(t().path.split("/").pop()??t().path));var Le=Dq();let W;var R=x(Le),G=x(R),pe=I(R,2),se=x(pe),we=I(pe,2),ae=x(we);Y((ue,Re,_e)=>{W=Bt(Le,1,"file-chip svelte-10ayso4",null,W,{inactive:!g(Pe)}),Bt(R,1,`badge badge-${ue??""}`,"svelte-10ayso4"),q(G,Re),q(se,_e),Jn(we,"title",g(Pe)?"Remove from context":"Re-add to context"),q(ae,g(Pe)?"×":"+")},[()=>g(re).toLowerCase(),()=>xi(g(re)),()=>t().path.split("/").pop()]),oe("click",we,()=>k(Pe,!g(Pe))),T(j,Le)};K(Ce,j=>{t()&&j(Et)})}var Ft=I(Ce,2);di(Ft,17,i,In,(j,re,Le)=>{const W=ct(()=>Ci(g(re).name));var R=Eq(),G=x(R),pe=x(G),se=I(G,2),we=x(se),ae=I(se,2);Y((ue,Re)=>{Bt(G,1,`badge badge-${ue??""}`,"svelte-10ayso4"),q(pe,Re),q(we,g(re).name)},[()=>g(W).toLowerCase(),()=>xi(g(W))]),oe("click",ae,()=>Di(Le)),T(j,R)});var gi=I(Ft,2),Qi=I(gi,2);Qs(Qi,j=>me=j,()=>me);var Ii=I(Xe,2);let ee;var be=x(Ii);let qe;var pt=x(be);Qs(pt,j=>dt=j,()=>dt);var Lt=I(be,2);{var ce=j=>{var re=Pq();oe("click",re,Dn),T(j,re)},je=j=>{var re=Tq();Y(Le=>re.disabled=Le,[()=>!g(r).trim()||!g(lt)]),oe("click",re,_n),T(j,re)};K(Lt,j=>{g(a)?j(ce):j(je,-1)})}var yt=I(Ii,2);{var _t=j=>{var re=Oq(),Le=x(re),W=x(Le),R=I(Le,2);{var G=ae=>{var ue=Nq();di(ue,21,()=>g(u),In,(Re,_e)=>{var Ae=Mq(),Ee=x(Ae),ge={};Y(()=>{q(Ee,g(_e)),ge!==(ge=g(_e))&&(Ae.value=(Ae.__value=g(_e))??"")}),T(Re,Ae)}),Y(()=>ue.disabled=g(a)),El(ue,()=>g(f),Re=>k(f,Re)),T(ae,ue)},pe=ae=>{var ue=Rq(),Re=x(ue);Y(()=>q(Re,g(f)||g(d).model)),T(ae,ue)};K(R,ae=>{g(u).length>0?ae(G):ae(pe,-1)})}var se=I(R,2);{var we=ae=>{var ue=Aq();oe("click",ue,mi),T(ae,ue)};K(se,ae=>{g(d).provider==="ollama"&&ae(we)})}Y(()=>q(W,g(d).provider)),T(j,re)};K(yt,j=>{g(lt)&&g(d)&&j(_t)})}var st=I(rn,2);{var Je=j=>{var re=Gq(),Le=x(re),W=x(Le),R=x(W),G=x(R),pe=I(R,2),se=I(W,2),we=x(se);{var ae=_e=>{var Ae=Fq();T(_e,Ae)},ue=_e=>{var Ae=Hq(),Ee=x(Ae);Y(()=>q(Ee,g(E))),T(_e,Ae)},Re=_e=>{var Ae=Kq(),Ee=x(Ae);{var ge=Xt=>{var ve=Wq(),ke=I(xt(ve)),Nt=x(ke);Y(()=>q(Nt,g(S).version)),T(Xt,ve)};K(Ee,Xt=>{g(S).version&&Xt(ge)})}var et=I(Ee,2);{var ei=Xt=>{var ve=Bq(),ke=I(xt(ve)),Nt=x(ke);Y(()=>q(Nt,g(S).details.family)),T(Xt,ve)};K(et,Xt=>{var ve;(ve=g(S).details)!=null&&ve.family&&Xt(ei)})}var vi=I(et,2);{var Pi=Xt=>{var ve=zq(),ke=I(xt(ve)),Nt=x(ke);Y(()=>q(Nt,g(S).details.parameter_size)),T(Xt,ve)};K(vi,Xt=>{var ve;(ve=g(S).details)!=null&&ve.parameter_size&&Xt(Pi)})}var Mn=I(vi,2);{var ri=Xt=>{var ve=Vq(),ke=I(xt(ve)),Nt=x(ke);Y(()=>q(Nt,g(S).details.quantization_level)),T(Xt,ve)};K(Mn,Xt=>{var ve;(ve=g(S).details)!=null&&ve.quantization_level&&Xt(ri)})}var ai=I(Mn,2);{var Wt=Xt=>{var ve=jq(),ke=I(xt(ve)),Nt=x(ke);Y(()=>q(Nt,g(S).details.format)),T(Xt,ve)};K(ai,Xt=>{var ve;(ve=g(S).details)!=null&&ve.format&&Xt(Wt)})}var hi=I(ai,2);{var ki=Xt=>{var ve=$q(),ke=I(xt(ve),2);di(ke,21,()=>g(S).running,In,(Nt,At)=>{var Vi=Uq(),en=x(Vi);Y(Ne=>q(en,`${g(At).name??""} · ${Ne??""} VRAM`),[()=>Ct(g(At).size_vram)]),T(Nt,Vi)}),T(Xt,ve)},St=Xt=>{var ve=qq();T(Xt,ve)};K(hi,Xt=>{g(S).running&&g(S).running.length>0?Xt(ki):g(S).running!==null&&Xt(St,1)})}T(_e,Ae)};K(we,_e=>{g(D)?_e(ae):g(E)?_e(ue,1):g(S)&&_e(Re,2)})}Y(()=>{var _e;return q(G,`Ollama · ${(g(f)||((_e=g(d))==null?void 0:_e.model))??""}`)}),oe("click",re,()=>k(y,!1)),oe("click",Le,_e=>_e.stopPropagation()),oe("click",pe,()=>k(y,!1)),T(j,re)};K(st,j=>{g(y)&&j(Je)})}Y(j=>{q(Ge,j),ee=Bt(Ii,1,"input-row svelte-10ayso4",null,ee,{"drag-over":g(ze)}),qe=Bt(be,1,"textarea-wrap svelte-10ayso4",null,qe,{loading:g(a)}),Jn(pt,"placeholder",g(lt)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),pt.disabled=g(a)||!g(lt)},[()=>Ct(g(Kt))]),eo(mt,()=>g($),j=>k($,j)),eo(De,()=>g(fe),j=>k(fe,j)),oe("click",gi,Ji),oe("change",Qi,bn),Kn("dragover",Ii,Tn),Kn("dragleave",Ii,wn),Kn("drop",Ii,mn),oe("keydown",pt,Ei),Ki(pt,()=>g(r),j=>k(r,j)),T(o,Ai),Lo()}cr(["click","change","keydown"]);const Yq={OnOff:["onOff","globalSceneControl","onTime","offWaitTime"],LevelControl:["currentLevel","remainingTime","minLevel","maxLevel","currentFrequency","onOffTransitionTime","onLevel"],ColorControl:["currentHue","currentSaturation","remainingTime","currentX","currentY","colorTemperatureMireds","colorMode","colorTempPhysicalMinMireds","colorTempPhysicalMaxMireds"],BasicInformation:["vendorName","vendorId","productName","productId","nodeLabel","location","softwareVersion","softwareVersionString","serialNumber"],Identify:["identifyTime","identifyType"],Groups:["nameSupport"],OccupancySensing:["occupancy","occupancySensorType"],IlluminanceMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue","tolerance","lightSensorType"],TemperatureMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue","tolerance"],RelativeHumidityMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue","tolerance"],PressureMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue"],Thermostat:["localTemperature","outdoorTemperature","occupiedCoolingSetpoint","occupiedHeatingSetpoint","unoccupiedCoolingSetpoint","unoccupiedHeatingSetpoint","minHeatSetpointLimit","maxHeatSetpointLimit","systemMode","thermostatRunningMode","occupancy"],DoorLock:["lockState","lockType","actuatorEnabled","doorState"],WindowCovering:["type","currentPositionLiftPercent100ths","currentPositionTiltPercent100ths","operationalStatus","targetPositionLiftPercent100ths","targetPositionTiltPercent100ths","endProductType","mode"],FanControl:["fanMode","fanModeSequence","percentSetting","percentCurrent","speedMax","speedSetting","speedCurrent"],Descriptor:["deviceTypeList","serverList","clientList","partsList"],PowerSource:["status","order","description","wiredCurrentType","wiredMaximumCurrent","batteryVoltage","batteryPercentRemaining","batChargeLevel"],Switch:["numberOfPositions","currentPosition","multiPressMax"],BooleanState:["stateValue"],FlowMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue"]},Jq={OnOff:["on","off","toggle"],LevelControl:["moveToLevel","move","step","stop","moveToLevelWithOnOff","moveWithOnOff","stepWithOnOff","stopWithOnOff"],ColorControl:["moveToHue","moveHue","stepHue","moveToSaturation","moveSaturation","stepSaturation","moveToHueAndSaturation","moveToColor","moveColor","stepColor","moveToColorTemperature","moveColorTemperature","stepColorTemperature"],Identify:["identify","triggerEffect"],Groups:["addGroup","viewGroup","getGroupMembership","removeGroup","removeAllGroups","addGroupIfIdentifying"],Thermostat:["setpointRaiseLower","setWeeklySchedule","getWeeklySchedule","clearWeeklySchedule"],DoorLock:["lockDoor","unlockDoor","unlockWithTimeout"],WindowCovering:["upOrOpen","downOrClose","stopMotion","goToLiftValue","goToLiftPercentage","goToTiltValue","goToTiltPercentage"],FanControl:[]};let Yx=[],Jx=[],Qx=[];const Pv=new Map;let wR=[];const e0=new Map,t0=new Map;async function _D(){try{Yx=(await YN()).map(e=>e.topic)}catch{}}async function vD(){try{const[o,e]=await Promise.all([GN(),ZN()]);Jx=o,Qx=e}catch{}}async function bD(){try{const o=await XN();wR=o.map(e=>e.nodeId),e0.clear(),t0.clear();for(const e of o)e.name&&(e0.set(e.nodeId,e.name),t0.set(e.name,e.nodeId));await Promise.all(o.map(async e=>{if(!Pv.has(e.nodeId))try{Pv.set(e.nodeId,await a_(e.nodeId))}catch{}}))}catch{}}function Qq(o){const e=/(?:she\.mqtt\.(?:sub|pub|get|set|link|age|getProp)|she\.(?:link|age|getValue|setValue|getProp|combineBool|combineMax|timer))\s*\([^)]*?['"]([^'"]*)\s*$/,t=o.match(e);if(t)return{type:"mqtt",prefix:t[1]};const i=/she\.db\.sub\s*\([^)]*?['"]([^'"]*)\s*$/,n=o.match(i);if(n)return{type:"db",prefix:n[1],includeViews:!0};const s=/she\.db\.(?:get|set|extend|delete|prop|query)\s*\([^)]*?['"]([^'"]*)\s*$/,r=o.match(s);if(r)return{type:"db",prefix:r[1],includeViews:!1};const a=/she\.matter\.(?:sub|get|send|on)\s*\(\s*(.*)\s*$/,c=o.match(a);if(c){const d=c[1],u=eK(d),f=tK(d);if(u===0)return{type:"matter-nodeId",prefix:f};if(u===1){const m=Fh(d,0);if(m)return{type:"matter-endpointId",nodeId:m}}if(u===2){const m=Fh(d,0),v=wD(d,1)??Fh(d,1);if(m&&v!==null)return{type:"matter-cluster",nodeId:m,endpointId:v}}if(u>=3){const m=Fh(d,0),v=wD(d,1)??Fh(d,1),_=Fh(d,2),y=/she\.matter\.send\s*\(/.test(o);if(m&&v!==null&&_)return{type:"matter-attr",nodeId:m,endpointId:v,cluster:_,isSend:y}}}return null}function eK(o){let e=0,t=0,i=!1,n="";for(const s of o){if(i){s===n&&(i=!1);continue}if(s==='"'||s==="'"){i=!0,n=s;continue}if(s==="("||s==="["||s==="{"){e++;continue}if(s===")"||s==="]"||s==="}"){e--;continue}s===","&&e===0&&t++}return t}function tK(o){const e=o.match(/['"]([^'"]*)\s*$/);return e?e[1]:""}function Fh(o,e){var s;const i=(s=yR(o)[e])==null?void 0:s.trim();if(!i)return null;const n=i.match(/^['"](.*)['"]$/);return n?n[1]:null}function wD(o,e){var s;const i=(s=yR(o)[e])==null?void 0:s.trim();if(!i)return null;const n=parseInt(i,10);return isNaN(n)?null:n}function yR(o){const e=[];let t="",i=0,n=!1,s="";for(const r of o){if(n){r===s&&(n=!1),t+=r;continue}if(r==='"'||r==="'"){n=!0,s=r,t+=r;continue}if(r==="("||r==="["||r==="{"){i++,t+=r;continue}if(r===")"||r==="]"||r==="}"){i--,t+=r;continue}if(r===","&&i===0){e.push(t),t="";continue}t+=r}return e.push(t),e}const ih=Ic.CompletionItemKind;function iK(o,e){return(e?Yx.filter(i=>i.startsWith(e)):Yx).map(i=>({label:i,kind:ih.Value,insertText:i,range:o,detail:"MQTT topic",sortText:"0"+i}))}function nK(o,e,t){const i=t?[...Jx,...Qx]:Jx;return(e?i.filter(s=>s.startsWith(e)):i).map(s=>({label:s,kind:ih.Value,insertText:s,range:o,detail:Qx.includes(s)?"sheDB view":"sheDB document",sortText:"0"+s}))}function sK(o,e){return wR.map(t=>{const i=e0.get(t)??t;return e&&!i.startsWith(e)&&!t.startsWith(e)?null:{label:i,kind:ih.Value,insertText:i,range:o,detail:i!==t?`Node ID: ${t}`:"Matter node",sortText:"0"+i}}).filter(Boolean)}function SR(o){return t0.get(o)??o}function oK(o,e){if(typeof e=="number")return o.endpoints.find(i=>i.endpointId===e);const t=parseInt(e,10);return isNaN(t)?o.endpoints.find(i=>i.name===e):o.endpoints.find(i=>i.endpointId===t)}function rK(o,e){const t=Pv.get(SR(e));return t?t.endpoints.map(i=>{const n=i.name??String(i.endpointId),s=i.clusters.map(r=>r.name).join(", ");return{label:n,kind:ih.Value,insertText:n,range:o,detail:i.name?`Endpoint ${i.endpointId} — ${s}`:`Clusters: ${s}`,sortText:"0"+String(i.endpointId).padStart(4,"0")}}):[]}function aK(o,e,t){const i=Pv.get(SR(e));if(!i)return[];const n=oK(i,t);return n?n.clusters.map(s=>({label:s.name,kind:ih.Value,insertText:s.name,range:o,detail:"Matter cluster",sortText:"0"+s.name})):[]}function lK(o,e,t){return(t?Jq[e]??[]:Yq[e]??[]).map(n=>({label:n,kind:t?ih.Function:ih.Property,insertText:n,range:o,detail:t?`${e} command`:`${e} attribute`,sortText:"0"+n}))}let yD=!1;function cK(){yD||(yD=!0,_D(),vD(),bD(),setInterval(_D,15e3),setInterval(vD,1e4),setInterval(bD,6e4),Ic.registerCompletionItemProvider("javascript",{triggerCharacters:["'",'"',"(",","," "],provideCompletionItems(o,e){const t=o.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),i=Qq(t);if(!i)return null;const n=o.getWordUntilPosition(e),s=Math.max(t.lastIndexOf("'"),t.lastIndexOf('"')),r=s>=0?s+2:n.startColumn,a={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:r,endColumn:e.column};switch(i.type){case"mqtt":return{suggestions:iK(a,i.prefix)};case"db":return{suggestions:nK(a,i.prefix,i.includeViews)};case"matter-nodeId":return{suggestions:sK(a,i.prefix)};case"matter-endpointId":return{suggestions:rK(a,i.nodeId)};case"matter-cluster":return{suggestions:aK(a,i.nodeId,i.endpointId)};case"matter-attr":return{suggestions:lK(a,i.cluster,i.isSend)};default:return null}}}))}var dK=A('<button class="svelte-1pyfjii">New file here</button> <button class="svelte-1pyfjii">New subfolder here</button> <hr class="svelte-1pyfjii"/> <button class="svelte-1pyfjii">Rename folder…</button> <button class="danger svelte-1pyfjii">Delete folder…</button>',1),hK=A('<button class="svelte-1pyfjii">Open</button> <button class="svelte-1pyfjii">Rename…</button> <button class="svelte-1pyfjii">Add to AI context</button> <hr class="svelte-1pyfjii"/> <button class="danger svelte-1pyfjii">Delete</button>',1),uK=A('<div class="ctx-backdrop svelte-1pyfjii" role="presentation"></div> <div class="ctx-menu svelte-1pyfjii"><!></div>',1),gK=A('<div class="lib-tip-float svelte-1pyfjii">Library directory — files here are not auto-loaded as scripts</div>'),fK=A('<ul class="tree-children svelte-1pyfjii"></ul>'),pK=A('<li class="tree-dir svelte-1pyfjii"><div role="treeitem" tabindex="-1" draggable="true"><button>›</button> <span role="button" tabindex="0"> </span> <label class="lib-label svelte-1pyfjii"><input type="checkbox" class="svelte-1pyfjii"/> <span class="lib-checkmark svelte-1pyfjii"></span> <span class="lib-tip svelte-1pyfjii">lib</span></label> <label class="dis-label svelte-1pyfjii" title="Disable — scripts in this folder will not be executed"><input type="checkbox" class="svelte-1pyfjii"/> <span class="dis-checkmark svelte-1pyfjii"></span> <span>dis</span></label></div> <!></li>'),mK=A('<span class="dirty-dot svelte-1pyfjii">●</span>'),_K=A('<span class="err-dot svelte-1pyfjii">●</span>'),vK=A('<label class="dis-label svelte-1pyfjii" title="Disable — this script will not be executed"><input type="checkbox" class="svelte-1pyfjii"/> <span class="dis-checkmark svelte-1pyfjii"></span> <span>dis</span></label>'),bK=A('<span class="dis-spacer svelte-1pyfjii"></span>'),wK=A('<li draggable="true"><div class="file-row svelte-1pyfjii"><button><span> </span> <span class="fname svelte-1pyfjii"> </span> <!> <!></button> <!></div></li>'),yK=A('<div class="err svelte-1pyfjii"> </div>'),SK=A('<span class="tab-dirty svelte-1pyfjii">●</span>'),CK=A('<div role="button" tabindex="0"><span class="tab-label svelte-1pyfjii"> </span> <!> <button class="tab-close svelte-1pyfjii" title="Close">×</button></div>'),xK=A('<div class="tab-bar svelte-1pyfjii"></div>'),LK=A('<span class="git-changes svelte-1pyfjii"> </span>'),IK=A('<span class="git-ahead svelte-1pyfjii"> </span>'),kK=A('<span class="git-behind svelte-1pyfjii"> </span>'),DK=A('<span class="git-status svelte-1pyfjii"><span class="git-branch svelte-1pyfjii"> </span> <!> <!> <!></span>'),EK=A('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><button class="svelte-1pyfjii">Save</button> <button class="svelte-1pyfjii">Save & Commit</button> <button class="svelte-1pyfjii">Push</button></div>',1),PK=A('<button class="danger svelte-1pyfjii">Delete</button>'),TK=A(`<div class="welcome svelte-1pyfjii"><div class="welcome-inner svelte-1pyfjii"><div class="welcome-logo svelte-1pyfjii">she</div> <p class="welcome-sub svelte-1pyfjii">Smart Home Engine — a scriptable smart home automation engine</p> <div class="welcome-hint svelte-1pyfjii"><strong>Quick start:</strong> click <kbd class="svelte-1pyfjii">+ File</kbd> in the sidebar to create your first script,
|
|
152
|
-
or click an existing file to open it. Scripts run in a sandboxed VM with access to the <code class="svelte-1pyfjii">she</code> object for MQTT, scheduling, and more.</div> <div class="welcome-links svelte-1pyfjii"><a href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" class="svelte-1pyfjii">GitHub</a> <span class="svelte-1pyfjii">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/doc/sandbox-api.md" target="_blank" rel="noopener" class="svelte-1pyfjii">API reference</a> <span class="svelte-1pyfjii">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/README.md" target="_blank" rel="noopener" class="svelte-1pyfjii">README</a></div></div></div>`),MK=A('<button class="svelte-1pyfjii">Always accept in this session</button>'),NK=A('<button class="svelte-1pyfjii">Disable auto-accept</button>'),RK=A('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><!></div>',1),AK=A('<div class="diff-overlay svelte-1pyfjii"><div class="diff-bar svelte-1pyfjii"><span class="diff-title svelte-1pyfjii">Proposed changes — <em class="svelte-1pyfjii"> </em></span> <div class="diff-actions svelte-1pyfjii"><div class="split-wrap svelte-1pyfjii"><div class="split-btn accept-split svelte-1pyfjii"><button class="split-main svelte-1pyfjii"> </button> <button class="split-arrow svelte-1pyfjii" aria-label="Accept options">▾</button></div> <!></div> <button class="discard-btn svelte-1pyfjii">Discard</button></div></div> <div class="diff-container svelte-1pyfjii"></div></div>'),OK=A('<div class="log-resize-handle svelte-1pyfjii" role="separator"></div>'),FK=A('<span class="log-file svelte-1pyfjii"> </span>'),HK=A('<button class="log-clear svelte-1pyfjii">Clear</button>'),WK=A('<div><span class="ts svelte-1pyfjii"> </span> <span class="lvl svelte-1pyfjii"> </span> <span class="msg svelte-1pyfjii"> </span></div>'),BK=A('<span class="log-empty svelte-1pyfjii">No log output for this script.</span>'),zK=A('<div class="log-body svelte-1pyfjii"><!> <!></div>'),VK=A('<div class="chat-resize-handle svelte-1pyfjii" role="separator"></div> <div class="chat-container svelte-1pyfjii"><!></div>',1),jK=A('<!> <!> <!> <!> <div class="layout svelte-1pyfjii"><aside class="svelte-1pyfjii"><div class="toolbar svelte-1pyfjii"><button title="New script" class="svelte-1pyfjii">+ File</button> <button title="New folder" class="svelte-1pyfjii">+ Folder</button> <button title="Refresh" class="refresh svelte-1pyfjii">↻</button></div> <!> <ul class="tree svelte-1pyfjii"><li role="presentation"></li> <!></ul></aside> <div class="sidebar-resize-handle svelte-1pyfjii" role="separator"></div> <div class="editor-area svelte-1pyfjii"><!> <div class="editor-toolbar svelte-1pyfjii"><span class="filename svelte-1pyfjii"> </span> <!> <div class="split-wrap svelte-1pyfjii"><div class="split-btn svelte-1pyfjii"><button class="split-main svelte-1pyfjii"> </button> <button class="split-arrow svelte-1pyfjii" aria-label="Save options">▾</button></div> <!></div> <!> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><line x1="5.5" y1="5" x2="4" y2="2.5"></line><line x1="10.5" y1="5" x2="12" y2="2.5"></line><path d="M3 11 V7 A5 3.5 0 0 0 13 7 V11 Z" stroke-linejoin="round"></path><circle cx="6" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle><circle cx="10" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle></svg> AI</button></div> <div class="editor-body svelte-1pyfjii"><div class="editor-left svelte-1pyfjii"><div class="editor-stack svelte-1pyfjii"><div class="editor-container svelte-1pyfjii"></div> <!> <!></div> <div><!> <div class="log-header svelte-1pyfjii"><button class="log-toggle svelte-1pyfjii"> <!></button> <!></div> <!></div></div> <!></div></div></div>',1);function UK(o,e){xo(e,!0);let t=U(Si([])),i=U(Si({})),n=U(null),s=U(null),r=U(null),a=U(null),c=U(Si([])),d=U(null),u=U(!1),f=U(""),m=U(!1),v=U(!0),_=U(null),y=U(void 0),S=U(Si(new Set));const D=new Set;let E=U(Si([])),N=U(null);function B(z){const de=z.currentTarget.getBoundingClientRect();k(N,{x:de.left,y:de.top},!0)}function F(){k(N,null)}let Q,$,fe,Pe=!1,ze=null,me=!1,Ve=!1,dt=U(!1),Ke=U(null),Ut=U(!1),lt=U(!1),Kt=U(void 0),Ie=null,Pt=null,Fe=null,ft=U(Si(parseInt(localStorage.getItem("she-scripts-sidebar-width")??"220",10))),zt=U(Si(parseInt(localStorage.getItem("she-scripts-log-height")??"130",10))),Gt=U(Si(parseInt(localStorage.getItem("she-scripts-chat-width")??"340",10))),ci=!1,Vt=0,Ht=0,Fi=!1,zi=0,tt=0,Ct=!1,mi=0,Ci=0;const xi=ct(()=>{var z;return g(d)&&g(Ui)?{path:g(d),content:((z=g(Ui).model)==null?void 0:z.getValue())??g(Ui).savedContent}:null});let Di,Ji,Ui=ct(()=>g(c).find(z=>z.path===g(d))??null);const bn="she-tabs",mn="she-active-tab",Tn="she-log-open",wn="she-chat-open";let _n=qu(e,"active",3,!0);kn(()=>{Ve&&(localStorage.setItem(bn,JSON.stringify(g(c).map(z=>z.path))),g(d)?localStorage.setItem(mn,g(d)):localStorage.removeItem(mn))}),kn(()=>{Ve&&localStorage.setItem(wn,String(g(dt)))}),kn(()=>{_n()&&$&&$.layout()});const Dn=`
|
|
153
|
-
declare const she: {
|
|
154
|
-
log(...args: any[]): void;
|
|
155
|
-
info(...args: any[]): void;
|
|
156
|
-
debug(...args: any[]): void;
|
|
157
|
-
warn(...args: any[]): void;
|
|
158
|
-
error(...args: any[]): void;
|
|
159
|
-
now(): number;
|
|
160
|
-
/** Schedule with a cron string, Date, node-schedule literal, array of any of those,
|
|
161
|
-
* or a suncalc event name ('sunrise', 'sunset', 'dawn', 'dusk', …) for solar scheduling.
|
|
162
|
-
* opts.shift (seconds) offsets solar events; opts.random adds a random delay. */
|
|
163
|
-
schedule(pattern: string | Date | object | (string | Date | object)[], opts?: { shift?: number; random?: number }, cb?: () => void): void;
|
|
164
|
-
combineBool(srcs: string[], target: string): void;
|
|
165
|
-
combineMax(srcs: string[], target: string): void;
|
|
166
|
-
timer(src: string | string[], target: string, time: number): void;
|
|
167
|
-
mqtt: {
|
|
168
|
-
sub(topic: string | string[], opts?: any, cb?: (topic: string, val: any, obj: any, prev: any, msg: any) => void): void;
|
|
169
|
-
pub(topic: string | string[], payload: any, opts?: { qos?: number; retain?: boolean }): void;
|
|
170
|
-
get(topic: string): any;
|
|
171
|
-
set(topic: string | string[], val: any): void;
|
|
172
|
-
getProp(topic: string, ...prop: string[]): any;
|
|
173
|
-
link(source: string | string[], target: string | string[], value?: any): void;
|
|
174
|
-
age(topic: string): number;
|
|
175
|
-
};
|
|
176
|
-
api: {
|
|
177
|
-
get(path: string, handler: (req: any) => any): void;
|
|
178
|
-
post(path: string, handler: (req: any, body: any) => any): void;
|
|
179
|
-
put(path: string, handler: (req: any, body: any) => any): void;
|
|
180
|
-
delete(path: string, handler: (req: any) => any): void;
|
|
181
|
-
};
|
|
182
|
-
db: {
|
|
183
|
-
get(id: string): any;
|
|
184
|
-
set(id: string, doc: object): void;
|
|
185
|
-
extend(id: string, partial: object): void;
|
|
186
|
-
delete(id: string): void;
|
|
187
|
-
prop(id: string, method: 'set' | 'create' | 'del', prop: string, val?: any): void;
|
|
188
|
-
sub(pattern: string, callback: (id: string, doc: any) => void): void;
|
|
189
|
-
query(filter: string | null, mapFn: Function, reduceFn?: Function): any[];
|
|
190
|
-
};
|
|
191
|
-
matter: {
|
|
192
|
-
sub(nodeId: string, endpointId: number, cluster: string, attr: string, cb: (val: any, old: any) => void): number;
|
|
193
|
-
unsub(listenerId: number): void;
|
|
194
|
-
get(nodeId: string, endpointId: number, cluster: string, attr: string): Promise<any>;
|
|
195
|
-
send(nodeId: string, endpointId: number, cluster: string, command: string, args?: object): Promise<any>;
|
|
196
|
-
on(nodeId: string, endpointId: number, cluster: string, event: string, cb: (val: any) => void): number;
|
|
197
|
-
};
|
|
198
|
-
influx: {
|
|
199
|
-
query(fluxQuery: string): Promise<any[]>;
|
|
200
|
-
write(measurement: string, fields: object, tags?: object, timestamp?: number | Date): Promise<void>;
|
|
201
|
-
getLast(topic: string, n: number): Promise<Array<{ ts: number; val: any }>>;
|
|
202
|
-
getRange(topic: string, from: number | string | Date, to: number | string | Date): Promise<Array<{ ts: number; val: any }>>;
|
|
203
|
-
};
|
|
204
|
-
elastic: {
|
|
205
|
-
search(index: string, query: object): Promise<{ hits: any[]; total: number }>;
|
|
206
|
-
get(index: string, id: string): Promise<object | null>;
|
|
207
|
-
index(index: string, doc: object, id?: string): Promise<{ id: string }>;
|
|
208
|
-
find(index: string, field: string, text: string, size?: number): Promise<any[]>;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
`;va(async()=>{var ye;k(v,localStorage.getItem(Tn)!=="false"),k(dt,localStorage.getItem(wn)==="true"),Ic.typescript.javascriptDefaults.addExtraLib(Dn,"she-api.d.ts"),Ic.typescript.javascriptDefaults.setCompilerOptions({target:Ic.typescript.ScriptTarget.ES2022,allowNonTsExtensions:!0,checkJs:!0}),Ic.typescript.javascriptDefaults.setDiagnosticsOptions({noSyntaxValidation:!1,noSemanticValidation:!0}),cK(),fe=Da.createModel("","javascript"),$=Da.create(Q,{model:fe,theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1}),$.onDidChangeModelContent(()=>{if(Pe)return;const kt=g(c).find(jt=>jt.path===g(d));kt&&(kt.dirty=$.getValue()!==kt.savedContent),Et&&clearTimeout(Et),Et=setTimeout(Ft,600)}),ze=sR(kt=>{const jt=kt.msg.match(/^user::([^:]+):/);if(!jt)return;const $t=jt[1];if(kt.level==="error")D.add($t),g(S).has($t)||k(S,new Set([...g(S),$t]),!0);else if(D.has($t)){D.delete($t);const Ti=new Set(g(S));Ti.delete($t),k(S,Ti,!0)}const yn=g(c).find(Ti=>Ti.path.split("/").pop()===$t);yn&&(yn.logEntries=[...yn.logEntries.slice(-199),kt],yn.path===g(d)&&g(v)&&g(y)&&iS().then(()=>{g(y)&&(g(y).scrollTop=g(y).scrollHeight)}))}),await Ei(),Hn();const z=JSON.parse(localStorage.getItem(bn)??"[]"),de=localStorage.getItem(mn);for(const kt of z)await rn(kt,!1);const He=de&&g(c).some(kt=>kt.path===de)?de:((ye=g(c)[0])==null?void 0:ye.path)??null;He&&await Ln(He),Ve=!0}),Xb(()=>{var z;Et&&clearTimeout(Et),ze==null||ze();for(const de of g(c))(z=de.model)==null||z.dispose();fe==null||fe.dispose(),$==null||$.dispose()});async function Ei(){try{if(k(t,await j8(),!0),!me){let de=function(He){for(const ye of He)ye.type==="dir"&&(z[ye.path]=!0,ye.children&&de(ye.children))};me=!0;const z={};de(g(t)),k(i,z,!0)}k(f,"")}catch(z){k(f,z.message,!0)}}function $i(z){g(i)[z]=!g(i)[z]}function Fn(z){switch(z){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return z}}async function hn(z,de){try{de?await Sc(`${z}/.shelib`,""):await Rm(`${z}/.shelib`),await Ei()}catch(He){k(f,He.message,!0)}}async function Ai(z,de){const He=z.split("/").pop(),ye=z.includes("/")?z.slice(0,z.lastIndexOf("/")):"",kt=ye?`${ye}/.shedisable-${He}`:`.shedisable-${He}`;try{de?await Sc(kt,""):await Rm(kt),await Ei()}catch(jt){k(f,jt.message,!0)}}async function rn(z,de=!0){var He;if(g(c).some(ye=>ye.path===z)){de&&await Ln(z);return}try{const{content:ye}=await Yk(z),kt=AF.parse(`file:///she-scripts/${encodeURIComponent(z)}`);(He=Da.getModel(kt))==null||He.dispose();const jt=Da.createModel(ye,Ce(z),kt);k(c,[...g(c),{path:z,dirty:!1,savedContent:ye,model:jt,logEntries:[]}],!0),de&&await Ln(z)}catch(ye){k(f,ye.message,!0)}}async function xn(z){await rn(z,!0)}async function Ln(z){const de=g(c).find(He=>He.path===z);de!=null&&de.model&&(k(d,z,!0),Pe=!0,$.setModel(de.model),Pe=!1,Ft())}async function Bn(z){var ye;const de=g(c).find(kt=>kt.path===z);if(!de||de.dirty&&!await Di.show(`Discard unsaved changes to ${z}?`,{confirm:"Discard"}))return;const He=g(c).findIndex(kt=>kt.path===z);if((ye=de.model)==null||ye.dispose(),k(c,g(c).filter(kt=>kt.path!==z),!0),g(d)===z){const kt=g(c)[He]??g(c)[He-1]??null;kt?await Ln(kt.path):(k(d,null),$.setModel(fe))}}async function Hn(){try{k(_,await $8(),!0)}catch{k(_,null)}}async function $e(){if(!g(d))return;const z=g(c).find(de=>de.path===g(d));if(z){k(u,!0);try{const de=$.getValue();await Sc(g(d),de),z.savedContent=de,z.dirty=!1,k(f,""),Hn()}catch(de){k(f,de.message,!0)}finally{k(u,!1)}}}async function ne(){if(!g(d)||(await $e(),g(f)))return;const z=await Ji.show("Commit message:",{placeholder:"Update script",confirm:"Commit"});if(z)try{await G8(g(d),z),Hn()}catch(de){k(f,"Git: "+de.message)}}async function it(){k(m,!1);try{await Z8(),await Hn(),k(f,"")}catch(z){k(f,"Git push: "+z.message)}}async function Z(){const z=g(n)?`${g(n)}/`:"",de=await Ji.show("New script name:",{placeholder:z?`${z}myscript.js`:"myscript.js",initial:z,confirm:"Create"});if(!de)return;const He=de.endsWith(".js")?`/* global she */
|
|
212
|
-
'use strict';
|
|
213
|
-
|
|
214
|
-
`:"";await Sc(de,He),await Ei(),await rn(de,!0)}async function Te(){const z=g(n)?`${g(n)}/`:"",de=await Ji.show("New folder name:",{placeholder:z?`${z}subfolder`:"myfolder",initial:z,confirm:"Create"});de&&(await U8(de),g(i)[de]=!0,await Ei())}function nt(z,de){z.preventDefault(),k(s,{x:z.clientX,y:z.clientY,entry:de},!0)}function wt(){k(s,null)}async function Qt(z){wt(),k(n,z,!0),g(i)[z]=!0,await Z()}async function Zt(z){wt(),k(n,z,!0),await Te()}async function Li(z){wt();const de=await Ji.show(z.type==="dir"?"Rename folder:":"Rename script:",{initial:z.path,placeholder:z.path,confirm:"Rename"});if(!de||de===z.path)return;const He=de;try{await Jk(z.path,He);const ye=g(c).find(kt=>kt.path===z.path);ye&&(ye.path=He,g(d)===z.path&&k(d,He,!0)),await Ei()}catch(ye){k(f,ye.message,!0)}}function _i(z){if(!z.children)return 0;let de=0;for(const He of z.children)de++,He.type==="dir"&&(de+=_i(He));return de}async function O(z){wt();let de=`Delete ${z.type==="dir"?"folder":"file"} "${z.path}"?`;if(z.type==="dir"){const He=_i(z);He>0&&(de+=` This will also delete ${He} item${He===1?"":"s"} inside.`)}if(await Di.show(de,{confirm:"Delete",danger:!0})){if(z.type==="dir")for(const He of[...g(c)])He.path.startsWith(z.path+"/")&&await Bn(He.path);else await Bn(z.path);await Rm(z.path),await Ei()}}async function X(z){wt();const{content:de}=await Yk(z.path);g(E).some(He=>He.name===z.name)||k(E,[...g(E),{name:z.name,content:de}],!0),k(dt,!0)}function xe(z,de){var He;k(r,de,!0),(He=z.dataTransfer)==null||He.setData("text/plain",de)}function Ze(z,de){if(z.preventDefault(),g(r)&&(g(r)===de||de.startsWith(g(r)+"/"))){z.dataTransfer&&(z.dataTransfer.dropEffect="none"),k(a,null);return}z.dataTransfer&&(z.dataTransfer.dropEffect="move"),k(a,de,!0)}function Dt(){k(a,null)}async function mt(z,de){var $t,yn,Ti;z.preventDefault(),k(a,null);const He=Array.from((($t=z.dataTransfer)==null?void 0:$t.items)??[]).filter(qi=>qi.kind==="file");if(He.length>0&&!g(r)){for(const qi of He){const Yt=(yn=qi.webkitGetAsEntry)==null?void 0:yn.call(qi);Yt&&await Me(Yt,de,!0)}await Ei();return}const ye=g(r)??((Ti=z.dataTransfer)==null?void 0:Ti.getData("text/plain"));if(k(r,null),!ye||ye===de||de.startsWith(ye+"/"))return;const kt=ye.split("/").pop(),jt=de?`${de}/${kt}`:kt;if(jt!==ye)try{await Jk(ye,jt);for(const qi of g(c))if(qi.path===ye)g(d)===ye&&k(d,jt,!0),qi.path=jt;else if(qi.path.startsWith(ye+"/")){const Yt=jt+qi.path.slice(ye.length);g(d)===qi.path&&k(d,Yt),qi.path=Yt}await Ei()}catch(qi){k(f,qi.message,!0)}}async function Me(z,de,He){if(z.isFile){const kt=await(await new Promise(($t,yn)=>z.file($t,yn))).text(),jt=de?`${de}/${z.name}`:z.name;await Sc(jt,kt),He&&z.name.endsWith(".js")&&await Ai(jt,!0)}else if(z.isDirectory){const ye=z.createReader();let kt=[],jt;do jt=await new Promise(($t,yn)=>ye.readEntries($t,yn)),kt=[...kt,...jt];while(jt.length>0);for(const $t of kt)await Me($t,de?`${de}/${z.name}`:z.name,!1);if(He){const $t=de?`${de}/${z.name}`:z.name;await Ai($t,!0)}}}async function De(){if(!g(d)||!await Di.show(`Delete ${g(d)}?`,{confirm:"Delete",danger:!0}))return;const z=g(d);await Bn(z),await Rm(z),await Ei()}function Ue(){g(Ui)&&(g(Ui).logEntries=[])}function Ge(){k(v,!g(v)),localStorage.setItem(Tn,String(g(v)))}function Xe(z){return new Date(z).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ce(z){var ye;const de=((ye=z.split(".").pop())==null?void 0:ye.toLowerCase())??"";return{js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"typescript",json:"json",jsonc:"json",md:"markdown",markdown:"markdown",yaml:"yaml",yml:"yaml",sh:"shell",bash:"shell",css:"css",html:"html",xml:"xml",ini:"ini",toml:"ini"}[de]??"plaintext"}let Et=null;async function Ft(){const z=g(c).find(He=>He.path===g(d));if(!(z!=null&&z.model))return;const de=z.model;try{const jt=(await(await(await Ic.typescript.getJavaScriptWorker())(de.uri)).getSyntacticDiagnostics(de.uri.toString())).map($t=>{const yn=de.getPositionAt($t.start??0),Ti=de.getPositionAt(($t.start??0)+($t.length??0));return{severity:OF.Error,startLineNumber:yn.lineNumber,startColumn:yn.column,endLineNumber:Ti.lineNumber,endColumn:Ti.column,message:typeof $t.messageText=="string"?$t.messageText:JSON.stringify($t.messageText),source:"she-syntax"}});Da.setModelMarkers(de,"she-syntax",jt)}catch{}}function gi(z){ci=!0,Vt=z.clientX,Ht=g(ft),z.preventDefault()}function Qi(z){Fi=!0,zi=z.clientY,tt=g(zt),z.preventDefault()}function Ii(z){Ct=!0,mi=z.clientX,Ci=g(Gt),z.preventDefault()}function ee(z){ci&&k(ft,Math.max(140,Math.min(500,Ht+z.clientX-Vt)),!0),Fi&&k(zt,Math.max(60,Math.min(500,tt-(z.clientY-zi))),!0),Ct&&k(Gt,Math.max(200,Math.min(700,Ci-(z.clientX-mi))),!0)}function be(){ci&&(ci=!1,localStorage.setItem("she-scripts-sidebar-width",String(g(ft)))),Fi&&(Fi=!1,localStorage.setItem("she-scripts-log-height",String(g(zt)))),Ct&&(Ct=!1,localStorage.setItem("she-scripts-chat-width",String(g(Gt))))}function qe(z){(z.ctrlKey||z.metaKey)&&z.key==="s"&&(z.preventDefault(),$e()),z.key==="Escape"&&(k(m,!1),k(s,null))}async function pt(z,de){const He=await Ji.show("Save new script as:",{placeholder:"myscript.js",initial:z,confirm:"Create"});if(He)try{await Sc(He,de),await Ei(),await rn(He,!0)}catch(ye){k(f,ye.message,!0)}}async function Lt(z){var He,ye;if(g(Ut)&&g(d)){k(Ke,z,!0),await ce();return}if(k(Ke,z,!0),await iS(),!g(Kt))return;Pt==null||Pt.dispose(),Fe==null||Fe.dispose(),Ie==null||Ie.dispose();const de=((ye=(He=g(Ui))==null?void 0:He.model)==null?void 0:ye.getValue())??"";Pt=Da.createModel(de,"javascript"),Fe=Da.createModel(z,"javascript"),Ie=Da.createDiffEditor(g(Kt),{theme:"vs-dark",readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),Ie.setModel({original:Pt,modified:Fe})}kn(()=>{g(d),k(Ut,!1),k(lt,!1)});async function ce(){if(g(Ke)===null||!g(d))return;const z=g(Ke);k(Ke,null);const de=g(c).find(He=>He.path===g(d));de!=null&&de.model&&(Pe=!0,de.model.setValue(z),Pe=!1,de.dirty=!1,de.savedContent=z);try{await Sc(g(d),z),k(f,""),Hn()}catch(He){k(f,He.message,!0)}yt()}function je(){k(Ke,null),yt()}function yt(){Ie==null||Ie.dispose(),Ie=null,Pt==null||Pt.dispose(),Pt=null,Fe==null||Fe.dispose(),Fe=null}var _t=jK();Kn("keydown",$c,qe),Kn("mousemove",$c,ee),Kn("mouseup",$c,be);var st=xt(_t);Qs(g7(st,{}),z=>Di=z,()=>Di);var Je=I(st,2);Qs(p7(Je,{}),z=>Ji=z,()=>Ji);var j=I(Je,2);{var re=z=>{var de=uK(),He=xt(de),ye=I(He,2);let kt;var jt=x(ye);{var $t=Ti=>{var qi=dK(),Yt=xt(qi),Hi=I(Yt,2),zn=I(Hi,4),$n=I(zn,2);oe("click",Yt,()=>Qt(g(s).entry.path)),oe("click",Hi,()=>Zt(g(s).entry.path)),oe("click",zn,()=>Li(g(s).entry)),oe("click",$n,()=>O(g(s).entry)),T(Ti,qi)},yn=Ti=>{var qi=hK(),Yt=xt(qi),Hi=I(Yt,2),zn=I(Hi,2),$n=I(zn,4);oe("click",Yt,()=>xn(g(s).entry.path)),oe("click",Hi,()=>Li(g(s).entry)),oe("click",zn,()=>X(g(s).entry)),oe("click",$n,()=>O(g(s).entry)),T(Ti,qi)};K(jt,Ti=>{g(s).entry.type==="dir"?Ti($t):Ti(yn,-1)})}Y(()=>kt=Fo(ye,"",kt,{left:`${g(s).x??""}px`,top:`${g(s).y??""}px`})),oe("click",He,wt),oe("contextmenu",He,Ti=>{Ti.preventDefault(),wt()}),T(z,de)};K(j,z=>{g(s)&&z(re)})}var Le=I(j,2);{var W=z=>{var de=gK();let He;Y(()=>He=Fo(de,"",He,{left:`${g(N).x??""}px`,top:`${g(N).y-4}px`})),T(z,de)};K(Le,z=>{g(N)&&z(W)})}var R=I(Le,2),G=x(R);let pe;{const z=(He,ye=$b)=>{var kt=xs(),jt=xt(kt);{var $t=Ti=>{var qi=pK(),Yt=x(qi);let Hi;var zn=x(Yt);let $n;var qs=I(zn,2);let dr;var hs=x(qs),Fr=I(qs,2),ko=x(Fr),Hr=I(ko,4),pc=I(Fr,2),wa=x(pc),ya=I(Yt,2);{var Do=Xn=>{var mc=fK();di(mc,21,()=>ye().children,Wr=>Wr.path,(Wr,hr)=>{z(Wr,()=>g(hr))}),T(Xn,mc)};K(ya,Xn=>{g(i)[ye().path]&&ye().children&&Xn(Do)})}Y(()=>{Hi=Bt(Yt,1,"dir-row svelte-1pyfjii",null,Hi,{"dir-selected":g(n)===ye().path,"drag-target":g(a)===ye().path}),Jn(Yt,"aria-selected",g(n)===ye().path),$n=Bt(zn,1,"chevron svelte-1pyfjii",null,$n,{open:g(i)[ye().path]}),dr=Bt(qs,1,"dir-name svelte-1pyfjii",null,dr,{lib:ye().lib}),q(hs,ye().name),$w(ko,ye().lib),$w(wa,ye().disabled)}),Kn("dragstart",Yt,Xn=>xe(Xn,ye().path)),Kn("dragover",Yt,Xn=>Ze(Xn,ye().path)),Kn("dragleave",Yt,Dt),Kn("drop",Yt,Xn=>mt(Xn,ye().path)),oe("contextmenu",Yt,Xn=>nt(Xn,ye())),oe("click",zn,()=>$i(ye().path)),oe("click",qs,()=>{k(n,ye().path,!0),g(i)[ye().path]=!0}),oe("keydown",qs,Xn=>Xn.key==="Enter"&&k(n,ye().path,!0)),oe("change",ko,()=>hn(ye().path,!ye().lib)),Kn("mouseenter",Hr,B),Kn("mouseleave",Hr,F),oe("change",wa,()=>Ai(ye().path,!ye().disabled)),T(Ti,qi)},yn=Ti=>{const qi=ct(()=>ye().name),Yt=ct(()=>g(S).has(g(qi))),Hi=ct(()=>(ye().name.split(".").pop()??"txt").toUpperCase()),zn=ct(()=>ye().name.endsWith(".js"));var $n=wK();let qs;var dr=x($n),hs=x(dr);let Fr;var ko=x(hs);let Hr;var pc=x(ko),wa=I(ko,2),ya=x(wa),Do=I(wa,2);{var Xn=An=>{var Ks=mK();T(An,Ks)},mc=ct(()=>{var An;return(An=g(c).find(Ks=>Ks.path===ye().path))==null?void 0:An.dirty});K(Do,An=>{g(mc)&&An(Xn)})}var Wr=I(Do,2);{var hr=An=>{var Ks=_K();T(An,Ks)};K(Wr,An=>{g(Yt)&&An(hr)})}var xw=I(hs,2);{var _c=An=>{var Ks=vK(),ph=x(Ks);Y(()=>$w(ph,ye().disabled)),oe("change",ph,()=>Ai(ye().path,!ye().disabled)),T(An,Ks)},co=An=>{var Ks=bK();T(An,Ks)};K(xw,An=>{g(zn)?An(_c):An(co,-1)})}Y((An,Ks,ph)=>{qs=Bt($n,1,"tree-file svelte-1pyfjii",null,qs,An),Fr=Bt(hs,1,"svelte-1pyfjii",null,Fr,{lib:ye().lib,dis:ye().disabled}),Hr=Bt(ko,1,`badge badge-${Ks??""}`,"svelte-1pyfjii",Hr,{"badge-shelib":ye().lib}),q(pc,ph),q(ya,ye().name)},[()=>({active:g(c).some(An=>An.path===ye().path),"active-tab":ye().path===g(d)}),()=>g(Hi).toLowerCase(),()=>Fn(g(Hi))]),Kn("dragstart",$n,An=>xe(An,ye().path)),oe("contextmenu",$n,An=>nt(An,ye())),oe("click",hs,()=>xn(ye().path)),T(Ti,$n)};K(jt,Ti=>{ye().type==="dir"?Ti($t):Ti(yn,-1)})}T(He,kt)};var se=x(G),we=x(se),ae=I(we,2),ue=I(ae,2),Re=I(se,2);{var _e=He=>{var ye=yK(),kt=x(ye);Y(()=>q(kt,g(f))),T(He,ye)};K(Re,He=>{g(f)&&He(_e)})}var Ae=I(Re,2),Ee=x(Ae);let de;var ge=I(Ee,2);di(ge,17,()=>g(t),He=>He.path,(He,ye)=>{z(He,()=>g(ye))}),Y(()=>de=Bt(Ee,1,"tree-root-drop svelte-1pyfjii",null,de,{"drag-target":g(a)===""})),oe("click",we,Z),oe("click",ae,Te),oe("click",ue,Ei),Kn("dragover",Ee,He=>Ze(He,"")),Kn("dragleave",Ee,Dt),Kn("drop",Ee,He=>mt(He,""))}var et=I(G,2),ei=I(et,2),vi=x(ei);{var Pi=z=>{var de=xK();di(de,21,()=>g(c),He=>He.path,(He,ye)=>{var kt=CK();let jt;var $t=x(kt),yn=x($t),Ti=I($t,2);{var qi=Hi=>{var zn=SK();T(Hi,zn)};K(Ti,Hi=>{g(ye).dirty&&Hi(qi)})}var Yt=I(Ti,2);Y(Hi=>{jt=Bt(kt,1,"tab svelte-1pyfjii",null,jt,{active:g(ye).path===g(d)}),q(yn,Hi)},[()=>g(ye).path.split("/").pop()]),oe("click",kt,()=>Ln(g(ye).path)),oe("keydown",kt,Hi=>Hi.key==="Enter"&&Ln(g(ye).path)),oe("click",Yt,Hi=>{Hi.stopPropagation(),Bn(g(ye).path)}),T(He,kt)}),T(z,de)};K(vi,z=>{g(c).length>0&&z(Pi)})}var Mn=I(vi,2),ri=x(Mn),ai=x(ri),Wt=I(ri,2);{var hi=z=>{var de=DK(),He=x(de),ye=x(He),kt=I(He,2);{var jt=Yt=>{var Hi=LK(),zn=x(Hi);Y(()=>{Jn(Hi,"title",`${g(_).changes.length??""} uncommitted change(s)`),q(zn,`✎${g(_).changes.length??""}`)}),T(Yt,Hi)};K(kt,Yt=>{g(_).changes.length>0&&Yt(jt)})}var $t=I(kt,2);{var yn=Yt=>{var Hi=IK(),zn=x(Hi);Y(()=>{Jn(Hi,"title",`${g(_).ahead??""} commit(s) ahead of upstream`),q(zn,`↑${g(_).ahead??""}`)}),T(Yt,Hi)};K($t,Yt=>{g(_).ahead>0&&Yt(yn)})}var Ti=I($t,2);{var qi=Yt=>{var Hi=kK(),zn=x(Hi);Y(()=>{Jn(Hi,"title",`${g(_).behind??""} commit(s) behind upstream`),q(zn,`↓${g(_).behind??""}`)}),T(Yt,Hi)};K(Ti,Yt=>{g(_).behind>0&&Yt(qi)})}Y(()=>{Jn(He,"title",`Branch: ${g(_).branch??""}`),q(ye,`⎇ ${g(_).branch??""}`)}),T(z,de)};K(Wt,z=>{g(_)&&z(hi)})}var ki=I(Wt,2),St=x(ki),Xt=x(St),ve=x(Xt),ke=I(Xt,2),Nt=I(St,2);{var At=z=>{var de=EK(),He=xt(de),ye=I(He,2),kt=x(ye),jt=I(kt,2),$t=I(jt,2);Y(()=>$t.disabled=!g(_)),oe("click",He,()=>k(m,!1)),oe("click",kt,()=>{k(m,!1),$e()}),oe("click",jt,()=>{k(m,!1),ne()}),oe("click",$t,it),T(z,de)};K(Nt,z=>{g(m)&&z(At)})}var Vi=I(ki,2);{var en=z=>{var de=PK();oe("click",de,De),T(z,de)};K(Vi,z=>{g(d)&&z(en)})}var Ne=I(Vi,2);let ot;var Tt=I(Mn,2),ni=x(Tt),vt=x(ni),fi=x(vt);Qs(fi,z=>Q=z,()=>Q);var si=I(fi,2);{var ns=z=>{var de=TK();T(z,de)};K(si,z=>{g(d)||z(ns)})}var ss=I(si,2);{var Nn=z=>{var de=AK(),He=x(de),ye=x(He),kt=I(x(ye)),jt=x(kt),$t=I(ye,2),yn=x($t),Ti=x(yn),qi=x(Ti),Yt=x(qi),Hi=I(qi,2),zn=I(Ti,2);{var $n=hs=>{var Fr=RK(),ko=xt(Fr),Hr=I(ko,2),pc=x(Hr);{var wa=Do=>{var Xn=MK();oe("click",Xn,()=>{k(lt,!1),k(Ut,!0),ce()}),T(Do,Xn)},ya=Do=>{var Xn=NK();oe("click",Xn,()=>{k(lt,!1),k(Ut,!1)}),T(Do,Xn)};K(pc,Do=>{g(Ut)?Do(ya,-1):Do(wa)})}oe("click",ko,()=>k(lt,!1)),T(hs,Fr)};K(zn,hs=>{g(lt)&&hs($n)})}var qs=I(yn,2),dr=I(He,2);Qs(dr,hs=>k(Kt,hs),()=>g(Kt)),Y(hs=>{q(jt,hs),q(Yt,g(Ut)?"Auto-accept ✓":"Accept")},[()=>{var hs;return(hs=g(d))==null?void 0:hs.split("/").pop()}]),oe("click",qi,ce),oe("click",Hi,()=>k(lt,!g(lt))),oe("click",qs,je),T(z,de)};K(ss,z=>{g(Ke)!==null&&z(Nn)})}var os=I(vt,2);let ds,ao;var lo=x(os);{var Rn=z=>{var de=OK();oe("mousedown",de,Qi),T(z,de)};K(lo,z=>{g(v)&&z(Rn)})}var $s=I(lo,2),fh=x($s),Sg=x(fh),yw=I(Sg);{var Gp=z=>{var de=FK(),He=x(de);Y(ye=>q(He,`— ${ye??""}`),[()=>g(d).split("/").pop()]),T(z,de)};K(yw,z=>{g(d)&&z(Gp)})}var Cg=I(fh,2);{var Sw=z=>{var de=HK();oe("click",de,Ue),T(z,de)};K(Cg,z=>{g(v)&&z(Sw)})}var Zp=I($s,2);{var tn=z=>{var de=zK(),He=x(de);di(He,17,()=>{var jt;return((jt=g(Ui))==null?void 0:jt.logEntries)??[]},jt=>jt.ts+jt.msg,(jt,$t)=>{var yn=WK(),Ti=x(yn),qi=x(Ti),Yt=I(Ti,2),Hi=x(Yt),zn=I(Yt,2),$n=x(zn);Y((qs,dr)=>{Bt(yn,1,`log-line ${g($t).level??""}`,"svelte-1pyfjii"),q(qi,qs),q(Hi,dr),q($n,g($t).msg)},[()=>Xe(g($t).ts),()=>g($t).level.toUpperCase()]),T(jt,yn)});var ye=I(He,2);{var kt=jt=>{var $t=BK();T(jt,$t)};K(ye,jt=>{var $t;((($t=g(Ui))==null?void 0:$t.logEntries.length)??0)===0&&jt(kt)})}Qs(de,jt=>k(y,jt),()=>g(y)),T(z,de)};K(Zp,z=>{g(v)&&z(tn)})}var Cw=I(ni,2);{var Io=z=>{var de=VK(),He=xt(de),ye=I(He,2);let kt;var jt=x(ye);Xq(jt,{get currentScript(){return g(xi)},onApply:Lt,onCreateFile:pt,get extraFiles(){return g(E)},set extraFiles($t){k(E,$t,!0)}}),Y(()=>kt=Fo(ye,"",kt,{width:`${g(Gt)??""}px`})),oe("mousedown",He,Ii),T(z,de)};K(Cw,z=>{g(dt)&&z(Io)})}Y(()=>{var z;pe=Fo(G,"",pe,{width:`${g(ft)??""}px`}),q(ai,g(d)??"No file selected"),Xt.disabled=!((z=g(Ui))!=null&&z.dirty)||g(u),q(ve,g(u)?"Saving…":"Save"),ke.disabled=!g(d),ot=Bt(Ne,1,"ai-toggle svelte-1pyfjii",null,ot,{"ai-open":g(dt)}),Jn(Ne,"title",g(dt)?"Close AI assistant":"Open AI assistant"),ds=Bt(os,1,"log-panel svelte-1pyfjii",null,ds,{collapsed:!g(v)}),ao=Fo(os,"",ao,{height:g(v)?`${g(zt)}px`:"26px"}),q(Sg,`${g(v)?"▾":"▸"} Script Log `)}),oe("mousedown",et,gi),oe("click",Xt,$e),oe("click",ke,()=>k(m,!g(m))),oe("click",Ne,()=>k(dt,!g(dt))),oe("click",fh,Ge),T(o,_t),Lo()}cr(["click","contextmenu","keydown","change","mousedown"]);const CR="she-theme";function $K(){return localStorage.getItem(CR)??"dark"}function qK(o){localStorage.setItem(CR,o);const e=document.documentElement;o==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",o)}var tf={exports:{}};/* @preserve
|
|
215
|
-
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
|
216
|
-
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
|
217
|
-
*/var KK=tf.exports,SD;function GK(){return SD||(SD=1,(function(o,e){(function(t,i){i(e)})(KK,(function(t){var i="1.9.4";function n(l){var h,p,b,C;for(p=1,b=arguments.length;p<b;p++){C=arguments[p];for(h in C)l[h]=C[h]}return l}var s=Object.create||(function(){function l(){}return function(h){return l.prototype=h,new l}})();function r(l,h){var p=Array.prototype.slice;if(l.bind)return l.bind.apply(l,p.call(arguments,1));var b=p.call(arguments,2);return function(){return l.apply(h,b.length?b.concat(p.call(arguments)):arguments)}}var a=0;function c(l){return"_leaflet_id"in l||(l._leaflet_id=++a),l._leaflet_id}function d(l,h,p){var b,C,P,V;return V=function(){b=!1,C&&(P.apply(p,C),C=!1)},P=function(){b?C=arguments:(l.apply(p,arguments),setTimeout(V,h),b=!0)},P}function u(l,h,p){var b=h[1],C=h[0],P=b-C;return l===b&&p?l:((l-C)%P+P)%P+C}function f(){return!1}function m(l,h){if(h===!1)return l;var p=Math.pow(10,h===void 0?6:h);return Math.round(l*p)/p}function v(l){return l.trim?l.trim():l.replace(/^\s+|\s+$/g,"")}function _(l){return v(l).split(/\s+/)}function y(l,h){Object.prototype.hasOwnProperty.call(l,"options")||(l.options=l.options?s(l.options):{});for(var p in h)l.options[p]=h[p];return l.options}function S(l,h,p){var b=[];for(var C in l)b.push(encodeURIComponent(p?C.toUpperCase():C)+"="+encodeURIComponent(l[C]));return(!h||h.indexOf("?")===-1?"?":"&")+b.join("&")}var D=/\{ *([\w_ -]+) *\}/g;function E(l,h){return l.replace(D,function(p,b){var C=h[b];if(C===void 0)throw new Error("No value provided for variable "+p);return typeof C=="function"&&(C=C(h)),C})}var N=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"};function B(l,h){for(var p=0;p<l.length;p++)if(l[p]===h)return p;return-1}var F="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function Q(l){return window["webkit"+l]||window["moz"+l]||window["ms"+l]}var $=0;function fe(l){var h=+new Date,p=Math.max(0,16-(h-$));return $=h+p,window.setTimeout(l,p)}var Pe=window.requestAnimationFrame||Q("RequestAnimationFrame")||fe,ze=window.cancelAnimationFrame||Q("CancelAnimationFrame")||Q("CancelRequestAnimationFrame")||function(l){window.clearTimeout(l)};function me(l,h,p){if(p&&Pe===fe)l.call(h);else return Pe.call(window,r(l,h))}function Ve(l){l&&ze.call(window,l)}var dt={__proto__:null,extend:n,create:s,bind:r,get lastId(){return a},stamp:c,throttle:d,wrapNum:u,falseFn:f,formatNum:m,trim:v,splitWords:_,setOptions:y,getParamString:S,template:E,isArray:N,indexOf:B,emptyImageUrl:F,requestFn:Pe,cancelFn:ze,requestAnimFrame:me,cancelAnimFrame:Ve};function Ke(){}Ke.extend=function(l){var h=function(){y(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},p=h.__super__=this.prototype,b=s(p);b.constructor=h,h.prototype=b;for(var C in this)Object.prototype.hasOwnProperty.call(this,C)&&C!=="prototype"&&C!=="__super__"&&(h[C]=this[C]);return l.statics&&n(h,l.statics),l.includes&&(Ut(l.includes),n.apply(null,[b].concat(l.includes))),n(b,l),delete b.statics,delete b.includes,b.options&&(b.options=p.options?s(p.options):{},n(b.options,l.options)),b._initHooks=[],b.callInitHooks=function(){if(!this._initHooksCalled){p.callInitHooks&&p.callInitHooks.call(this),this._initHooksCalled=!0;for(var P=0,V=b._initHooks.length;P<V;P++)b._initHooks[P].call(this)}},h},Ke.include=function(l){var h=this.prototype.options;return n(this.prototype,l),l.options&&(this.prototype.options=h,this.mergeOptions(l.options)),this},Ke.mergeOptions=function(l){return n(this.prototype.options,l),this},Ke.addInitHook=function(l){var h=Array.prototype.slice.call(arguments,1),p=typeof l=="function"?l:function(){this[l].apply(this,h)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(p),this};function Ut(l){if(!(typeof L>"u"||!L||!L.Mixin)){l=N(l)?l:[l];for(var h=0;h<l.length;h++)l[h]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var lt={on:function(l,h,p){if(typeof l=="object")for(var b in l)this._on(b,l[b],h);else{l=_(l);for(var C=0,P=l.length;C<P;C++)this._on(l[C],h,p)}return this},off:function(l,h,p){if(!arguments.length)delete this._events;else if(typeof l=="object")for(var b in l)this._off(b,l[b],h);else{l=_(l);for(var C=arguments.length===1,P=0,V=l.length;P<V;P++)C?this._off(l[P]):this._off(l[P],h,p)}return this},_on:function(l,h,p,b){if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}if(this._listens(l,h,p)===!1){p===this&&(p=void 0);var C={fn:h,ctx:p};b&&(C.once=!0),this._events=this._events||{},this._events[l]=this._events[l]||[],this._events[l].push(C)}},_off:function(l,h,p){var b,C,P;if(this._events&&(b=this._events[l],!!b)){if(arguments.length===1){if(this._firingCount)for(C=0,P=b.length;C<P;C++)b[C].fn=f;delete this._events[l];return}if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}var V=this._listens(l,h,p);if(V!==!1){var te=b[V];this._firingCount&&(te.fn=f,this._events[l]=b=b.slice()),b.splice(V,1)}}},fire:function(l,h,p){if(!this.listens(l,p))return this;var b=n({},h,{type:l,target:this,sourceTarget:h&&h.sourceTarget||this});if(this._events){var C=this._events[l];if(C){this._firingCount=this._firingCount+1||1;for(var P=0,V=C.length;P<V;P++){var te=C[P],he=te.fn;te.once&&this.off(l,he,te.ctx),he.call(te.ctx||this,b)}this._firingCount--}}return p&&this._propagateEvent(b),this},listens:function(l,h,p,b){typeof l!="string"&&console.warn('"string" type argument expected');var C=h;typeof h!="function"&&(b=!!h,C=void 0,p=void 0);var P=this._events&&this._events[l];if(P&&P.length&&this._listens(l,C,p)!==!1)return!0;if(b){for(var V in this._eventParents)if(this._eventParents[V].listens(l,h,p,b))return!0}return!1},_listens:function(l,h,p){if(!this._events)return!1;var b=this._events[l]||[];if(!h)return!!b.length;p===this&&(p=void 0);for(var C=0,P=b.length;C<P;C++)if(b[C].fn===h&&b[C].ctx===p)return C;return!1},once:function(l,h,p){if(typeof l=="object")for(var b in l)this._on(b,l[b],h,!0);else{l=_(l);for(var C=0,P=l.length;C<P;C++)this._on(l[C],h,p,!0)}return this},addEventParent:function(l){return this._eventParents=this._eventParents||{},this._eventParents[c(l)]=l,this},removeEventParent:function(l){return this._eventParents&&delete this._eventParents[c(l)],this},_propagateEvent:function(l){for(var h in this._eventParents)this._eventParents[h].fire(l.type,n({layer:l.target,propagatedFrom:l.target},l),!0)}};lt.addEventListener=lt.on,lt.removeEventListener=lt.clearAllEventListeners=lt.off,lt.addOneTimeEventListener=lt.once,lt.fireEvent=lt.fire,lt.hasEventListeners=lt.listens;var Kt=Ke.extend(lt);function Ie(l,h,p){this.x=p?Math.round(l):l,this.y=p?Math.round(h):h}var Pt=Math.trunc||function(l){return l>0?Math.floor(l):Math.ceil(l)};Ie.prototype={clone:function(){return new Ie(this.x,this.y)},add:function(l){return this.clone()._add(Fe(l))},_add:function(l){return this.x+=l.x,this.y+=l.y,this},subtract:function(l){return this.clone()._subtract(Fe(l))},_subtract:function(l){return this.x-=l.x,this.y-=l.y,this},divideBy:function(l){return this.clone()._divideBy(l)},_divideBy:function(l){return this.x/=l,this.y/=l,this},multiplyBy:function(l){return this.clone()._multiplyBy(l)},_multiplyBy:function(l){return this.x*=l,this.y*=l,this},scaleBy:function(l){return new Ie(this.x*l.x,this.y*l.y)},unscaleBy:function(l){return new Ie(this.x/l.x,this.y/l.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Pt(this.x),this.y=Pt(this.y),this},distanceTo:function(l){l=Fe(l);var h=l.x-this.x,p=l.y-this.y;return Math.sqrt(h*h+p*p)},equals:function(l){return l=Fe(l),l.x===this.x&&l.y===this.y},contains:function(l){return l=Fe(l),Math.abs(l.x)<=Math.abs(this.x)&&Math.abs(l.y)<=Math.abs(this.y)},toString:function(){return"Point("+m(this.x)+", "+m(this.y)+")"}};function Fe(l,h,p){return l instanceof Ie?l:N(l)?new Ie(l[0],l[1]):l==null?l:typeof l=="object"&&"x"in l&&"y"in l?new Ie(l.x,l.y):new Ie(l,h,p)}function ft(l,h){if(l)for(var p=h?[l,h]:l,b=0,C=p.length;b<C;b++)this.extend(p[b])}ft.prototype={extend:function(l){var h,p;if(!l)return this;if(l instanceof Ie||typeof l[0]=="number"||"x"in l)h=p=Fe(l);else if(l=zt(l),h=l.min,p=l.max,!h||!p)return this;return!this.min&&!this.max?(this.min=h.clone(),this.max=p.clone()):(this.min.x=Math.min(h.x,this.min.x),this.max.x=Math.max(p.x,this.max.x),this.min.y=Math.min(h.y,this.min.y),this.max.y=Math.max(p.y,this.max.y)),this},getCenter:function(l){return Fe((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,l)},getBottomLeft:function(){return Fe(this.min.x,this.max.y)},getTopRight:function(){return Fe(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(l){var h,p;return typeof l[0]=="number"||l instanceof Ie?l=Fe(l):l=zt(l),l instanceof ft?(h=l.min,p=l.max):h=p=l,h.x>=this.min.x&&p.x<=this.max.x&&h.y>=this.min.y&&p.y<=this.max.y},intersects:function(l){l=zt(l);var h=this.min,p=this.max,b=l.min,C=l.max,P=C.x>=h.x&&b.x<=p.x,V=C.y>=h.y&&b.y<=p.y;return P&&V},overlaps:function(l){l=zt(l);var h=this.min,p=this.max,b=l.min,C=l.max,P=C.x>h.x&&b.x<p.x,V=C.y>h.y&&b.y<p.y;return P&&V},isValid:function(){return!!(this.min&&this.max)},pad:function(l){var h=this.min,p=this.max,b=Math.abs(h.x-p.x)*l,C=Math.abs(h.y-p.y)*l;return zt(Fe(h.x-b,h.y-C),Fe(p.x+b,p.y+C))},equals:function(l){return l?(l=zt(l),this.min.equals(l.getTopLeft())&&this.max.equals(l.getBottomRight())):!1}};function zt(l,h){return!l||l instanceof ft?l:new ft(l,h)}function Gt(l,h){if(l)for(var p=h?[l,h]:l,b=0,C=p.length;b<C;b++)this.extend(p[b])}Gt.prototype={extend:function(l){var h=this._southWest,p=this._northEast,b,C;if(l instanceof Vt)b=l,C=l;else if(l instanceof Gt){if(b=l._southWest,C=l._northEast,!b||!C)return this}else return l?this.extend(Ht(l)||ci(l)):this;return!h&&!p?(this._southWest=new Vt(b.lat,b.lng),this._northEast=new Vt(C.lat,C.lng)):(h.lat=Math.min(b.lat,h.lat),h.lng=Math.min(b.lng,h.lng),p.lat=Math.max(C.lat,p.lat),p.lng=Math.max(C.lng,p.lng)),this},pad:function(l){var h=this._southWest,p=this._northEast,b=Math.abs(h.lat-p.lat)*l,C=Math.abs(h.lng-p.lng)*l;return new Gt(new Vt(h.lat-b,h.lng-C),new Vt(p.lat+b,p.lng+C))},getCenter:function(){return new Vt((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new Vt(this.getNorth(),this.getWest())},getSouthEast:function(){return new Vt(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(l){typeof l[0]=="number"||l instanceof Vt||"lat"in l?l=Ht(l):l=ci(l);var h=this._southWest,p=this._northEast,b,C;return l instanceof Gt?(b=l.getSouthWest(),C=l.getNorthEast()):b=C=l,b.lat>=h.lat&&C.lat<=p.lat&&b.lng>=h.lng&&C.lng<=p.lng},intersects:function(l){l=ci(l);var h=this._southWest,p=this._northEast,b=l.getSouthWest(),C=l.getNorthEast(),P=C.lat>=h.lat&&b.lat<=p.lat,V=C.lng>=h.lng&&b.lng<=p.lng;return P&&V},overlaps:function(l){l=ci(l);var h=this._southWest,p=this._northEast,b=l.getSouthWest(),C=l.getNorthEast(),P=C.lat>h.lat&&b.lat<p.lat,V=C.lng>h.lng&&b.lng<p.lng;return P&&V},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(l,h){return l?(l=ci(l),this._southWest.equals(l.getSouthWest(),h)&&this._northEast.equals(l.getNorthEast(),h)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function ci(l,h){return l instanceof Gt?l:new Gt(l,h)}function Vt(l,h,p){if(isNaN(l)||isNaN(h))throw new Error("Invalid LatLng object: ("+l+", "+h+")");this.lat=+l,this.lng=+h,p!==void 0&&(this.alt=+p)}Vt.prototype={equals:function(l,h){if(!l)return!1;l=Ht(l);var p=Math.max(Math.abs(this.lat-l.lat),Math.abs(this.lng-l.lng));return p<=(h===void 0?1e-9:h)},toString:function(l){return"LatLng("+m(this.lat,l)+", "+m(this.lng,l)+")"},distanceTo:function(l){return zi.distance(this,Ht(l))},wrap:function(){return zi.wrapLatLng(this)},toBounds:function(l){var h=180*l/40075017,p=h/Math.cos(Math.PI/180*this.lat);return ci([this.lat-h,this.lng-p],[this.lat+h,this.lng+p])},clone:function(){return new Vt(this.lat,this.lng,this.alt)}};function Ht(l,h,p){return l instanceof Vt?l:N(l)&&typeof l[0]!="object"?l.length===3?new Vt(l[0],l[1],l[2]):l.length===2?new Vt(l[0],l[1]):null:l==null?l:typeof l=="object"&&"lat"in l?new Vt(l.lat,"lng"in l?l.lng:l.lon,l.alt):h===void 0?null:new Vt(l,h,p)}var Fi={latLngToPoint:function(l,h){var p=this.projection.project(l),b=this.scale(h);return this.transformation._transform(p,b)},pointToLatLng:function(l,h){var p=this.scale(h),b=this.transformation.untransform(l,p);return this.projection.unproject(b)},project:function(l){return this.projection.project(l)},unproject:function(l){return this.projection.unproject(l)},scale:function(l){return 256*Math.pow(2,l)},zoom:function(l){return Math.log(l/256)/Math.LN2},getProjectedBounds:function(l){if(this.infinite)return null;var h=this.projection.bounds,p=this.scale(l),b=this.transformation.transform(h.min,p),C=this.transformation.transform(h.max,p);return new ft(b,C)},infinite:!1,wrapLatLng:function(l){var h=this.wrapLng?u(l.lng,this.wrapLng,!0):l.lng,p=this.wrapLat?u(l.lat,this.wrapLat,!0):l.lat,b=l.alt;return new Vt(p,h,b)},wrapLatLngBounds:function(l){var h=l.getCenter(),p=this.wrapLatLng(h),b=h.lat-p.lat,C=h.lng-p.lng;if(b===0&&C===0)return l;var P=l.getSouthWest(),V=l.getNorthEast(),te=new Vt(P.lat-b,P.lng-C),he=new Vt(V.lat-b,V.lng-C);return new Gt(te,he)}},zi=n({},Fi,{wrapLng:[-180,180],R:6371e3,distance:function(l,h){var p=Math.PI/180,b=l.lat*p,C=h.lat*p,P=Math.sin((h.lat-l.lat)*p/2),V=Math.sin((h.lng-l.lng)*p/2),te=P*P+Math.cos(b)*Math.cos(C)*V*V,he=2*Math.atan2(Math.sqrt(te),Math.sqrt(1-te));return this.R*he}}),tt=6378137,Ct={R:tt,MAX_LATITUDE:85.0511287798,project:function(l){var h=Math.PI/180,p=this.MAX_LATITUDE,b=Math.max(Math.min(p,l.lat),-p),C=Math.sin(b*h);return new Ie(this.R*l.lng*h,this.R*Math.log((1+C)/(1-C))/2)},unproject:function(l){var h=180/Math.PI;return new Vt((2*Math.atan(Math.exp(l.y/this.R))-Math.PI/2)*h,l.x*h/this.R)},bounds:(function(){var l=tt*Math.PI;return new ft([-l,-l],[l,l])})()};function mi(l,h,p,b){if(N(l)){this._a=l[0],this._b=l[1],this._c=l[2],this._d=l[3];return}this._a=l,this._b=h,this._c=p,this._d=b}mi.prototype={transform:function(l,h){return this._transform(l.clone(),h)},_transform:function(l,h){return h=h||1,l.x=h*(this._a*l.x+this._b),l.y=h*(this._c*l.y+this._d),l},untransform:function(l,h){return h=h||1,new Ie((l.x/h-this._b)/this._a,(l.y/h-this._d)/this._c)}};function Ci(l,h,p,b){return new mi(l,h,p,b)}var xi=n({},zi,{code:"EPSG:3857",projection:Ct,transformation:(function(){var l=.5/(Math.PI*Ct.R);return Ci(l,.5,-l,.5)})()}),Di=n({},xi,{code:"EPSG:900913"});function Ji(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function Ui(l,h){var p="",b,C,P,V,te,he;for(b=0,P=l.length;b<P;b++){for(te=l[b],C=0,V=te.length;C<V;C++)he=te[C],p+=(C?"L":"M")+he.x+" "+he.y;p+=h?Ce.svg?"z":"x":""}return p||"M0 0"}var bn=document.documentElement.style,mn="ActiveXObject"in window,Tn=mn&&!document.addEventListener,wn="msLaunchUri"in navigator&&!("documentMode"in document),_n=Xe("webkit"),Dn=Xe("android"),Ei=Xe("android 2")||Xe("android 3"),$i=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),Fn=Dn&&Xe("Google")&&$i<537&&!("AudioNode"in window),hn=!!window.opera,Ai=!wn&&Xe("chrome"),rn=Xe("gecko")&&!_n&&!hn&&!mn,xn=!Ai&&Xe("safari"),Ln=Xe("phantom"),Bn="OTransition"in bn,Hn=navigator.platform.indexOf("Win")===0,$e=mn&&"transition"in bn,ne="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Ei,it="MozPerspective"in bn,Z=!window.L_DISABLE_3D&&($e||ne||it)&&!Bn&&!Ln,Te=typeof orientation<"u"||Xe("mobile"),nt=Te&&_n,wt=Te&&ne,Qt=!window.PointerEvent&&window.MSPointerEvent,Zt=!!(window.PointerEvent||Qt),Li="ontouchstart"in window||!!window.TouchEvent,_i=!window.L_NO_TOUCH&&(Li||Zt),O=Te&&hn,X=Te&&rn,xe=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Ze=(function(){var l=!1;try{var h=Object.defineProperty({},"passive",{get:function(){l=!0}});window.addEventListener("testPassiveEventSupport",f,h),window.removeEventListener("testPassiveEventSupport",f,h)}catch{}return l})(),Dt=(function(){return!!document.createElement("canvas").getContext})(),mt=!!(document.createElementNS&&Ji("svg").createSVGRect),Me=!!mt&&(function(){var l=document.createElement("div");return l.innerHTML="<svg/>",(l.firstChild&&l.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),De=!mt&&(function(){try{var l=document.createElement("div");l.innerHTML='<v:shape adj="1"/>';var h=l.firstChild;return h.style.behavior="url(#default#VML)",h&&typeof h.adj=="object"}catch{return!1}})(),Ue=navigator.platform.indexOf("Mac")===0,Ge=navigator.platform.indexOf("Linux")===0;function Xe(l){return navigator.userAgent.toLowerCase().indexOf(l)>=0}var Ce={ie:mn,ielt9:Tn,edge:wn,webkit:_n,android:Dn,android23:Ei,androidStock:Fn,opera:hn,chrome:Ai,gecko:rn,safari:xn,phantom:Ln,opera12:Bn,win:Hn,ie3d:$e,webkit3d:ne,gecko3d:it,any3d:Z,mobile:Te,mobileWebkit:nt,mobileWebkit3d:wt,msPointer:Qt,pointer:Zt,touch:_i,touchNative:Li,mobileOpera:O,mobileGecko:X,retina:xe,passiveEvents:Ze,canvas:Dt,svg:mt,vml:De,inlineSvg:Me,mac:Ue,linux:Ge},Et=Ce.msPointer?"MSPointerDown":"pointerdown",Ft=Ce.msPointer?"MSPointerMove":"pointermove",gi=Ce.msPointer?"MSPointerUp":"pointerup",Qi=Ce.msPointer?"MSPointerCancel":"pointercancel",Ii={touchstart:Et,touchmove:Ft,touchend:gi,touchcancel:Qi},ee={touchstart:Je,touchmove:st,touchend:st,touchcancel:st},be={},qe=!1;function pt(l,h,p){return h==="touchstart"&&_t(),ee[h]?(p=ee[h].bind(this,p),l.addEventListener(Ii[h],p,!1),p):(console.warn("wrong event specified:",h),f)}function Lt(l,h,p){if(!Ii[h]){console.warn("wrong event specified:",h);return}l.removeEventListener(Ii[h],p,!1)}function ce(l){be[l.pointerId]=l}function je(l){be[l.pointerId]&&(be[l.pointerId]=l)}function yt(l){delete be[l.pointerId]}function _t(){qe||(document.addEventListener(Et,ce,!0),document.addEventListener(Ft,je,!0),document.addEventListener(gi,yt,!0),document.addEventListener(Qi,yt,!0),qe=!0)}function st(l,h){if(h.pointerType!==(h.MSPOINTER_TYPE_MOUSE||"mouse")){h.touches=[];for(var p in be)h.touches.push(be[p]);h.changedTouches=[h],l(h)}}function Je(l,h){h.MSPOINTER_TYPE_TOUCH&&h.pointerType===h.MSPOINTER_TYPE_TOUCH&&Rn(h),st(l,h)}function j(l){var h={},p,b;for(b in l)p=l[b],h[b]=p&&p.bind?p.bind(l):p;return l=h,h.type="dblclick",h.detail=2,h.isTrusted=!1,h._simulated=!0,h}var re=200;function Le(l,h){l.addEventListener("dblclick",h);var p=0,b;function C(P){if(P.detail!==1){b=P.detail;return}if(!(P.pointerType==="mouse"||P.sourceCapabilities&&!P.sourceCapabilities.firesTouchEvents)){var V=fh(P);if(!(V.some(function(he){return he instanceof HTMLLabelElement&&he.attributes.for})&&!V.some(function(he){return he instanceof HTMLInputElement||he instanceof HTMLSelectElement}))){var te=Date.now();te-p<=re?(b++,b===2&&h(j(P))):b=1,p=te}}}return l.addEventListener("click",C),{dblclick:h,simDblclick:C}}function W(l,h){l.removeEventListener("dblclick",h.dblclick),l.removeEventListener("click",h.simDblclick)}var R=ri(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),G=ri(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),pe=G==="webkitTransition"||G==="OTransition"?G+"End":"transitionend";function se(l){return typeof l=="string"?document.getElementById(l):l}function we(l,h){var p=l.style[h]||l.currentStyle&&l.currentStyle[h];if((!p||p==="auto")&&document.defaultView){var b=document.defaultView.getComputedStyle(l,null);p=b?b[h]:null}return p==="auto"?null:p}function ae(l,h,p){var b=document.createElement(l);return b.className=h||"",p&&p.appendChild(b),b}function ue(l){var h=l.parentNode;h&&h.removeChild(l)}function Re(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function _e(l){var h=l.parentNode;h&&h.lastChild!==l&&h.appendChild(l)}function Ae(l){var h=l.parentNode;h&&h.firstChild!==l&&h.insertBefore(l,h.firstChild)}function Ee(l,h){if(l.classList!==void 0)return l.classList.contains(h);var p=vi(l);return p.length>0&&new RegExp("(^|\\s)"+h+"(\\s|$)").test(p)}function ge(l,h){if(l.classList!==void 0)for(var p=_(h),b=0,C=p.length;b<C;b++)l.classList.add(p[b]);else if(!Ee(l,h)){var P=vi(l);ei(l,(P?P+" ":"")+h)}}function et(l,h){l.classList!==void 0?l.classList.remove(h):ei(l,v((" "+vi(l)+" ").replace(" "+h+" "," ")))}function ei(l,h){l.className.baseVal===void 0?l.className=h:l.className.baseVal=h}function vi(l){return l.correspondingElement&&(l=l.correspondingElement),l.className.baseVal===void 0?l.className:l.className.baseVal}function Pi(l,h){"opacity"in l.style?l.style.opacity=h:"filter"in l.style&&Mn(l,h)}function Mn(l,h){var p=!1,b="DXImageTransform.Microsoft.Alpha";try{p=l.filters.item(b)}catch{if(h===1)return}h=Math.round(h*100),p?(p.Enabled=h!==100,p.Opacity=h):l.style.filter+=" progid:"+b+"(opacity="+h+")"}function ri(l){for(var h=document.documentElement.style,p=0;p<l.length;p++)if(l[p]in h)return l[p];return!1}function ai(l,h,p){var b=h||new Ie(0,0);l.style[R]=(Ce.ie3d?"translate("+b.x+"px,"+b.y+"px)":"translate3d("+b.x+"px,"+b.y+"px,0)")+(p?" scale("+p+")":"")}function Wt(l,h){l._leaflet_pos=h,Ce.any3d?ai(l,h):(l.style.left=h.x+"px",l.style.top=h.y+"px")}function hi(l){return l._leaflet_pos||new Ie(0,0)}var ki,St,Xt;if("onselectstart"in document)ki=function(){vt(window,"selectstart",Rn)},St=function(){si(window,"selectstart",Rn)};else{var ve=ri(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ki=function(){if(ve){var l=document.documentElement.style;Xt=l[ve],l[ve]="none"}},St=function(){ve&&(document.documentElement.style[ve]=Xt,Xt=void 0)}}function ke(){vt(window,"dragstart",Rn)}function Nt(){si(window,"dragstart",Rn)}var At,Vi;function en(l){for(;l.tabIndex===-1;)l=l.parentNode;l.style&&(Ne(),At=l,Vi=l.style.outlineStyle,l.style.outlineStyle="none",vt(window,"keydown",Ne))}function Ne(){At&&(At.style.outlineStyle=Vi,At=void 0,Vi=void 0,si(window,"keydown",Ne))}function ot(l){do l=l.parentNode;while((!l.offsetWidth||!l.offsetHeight)&&l!==document.body);return l}function Tt(l){var h=l.getBoundingClientRect();return{x:h.width/l.offsetWidth||1,y:h.height/l.offsetHeight||1,boundingClientRect:h}}var ni={__proto__:null,TRANSFORM:R,TRANSITION:G,TRANSITION_END:pe,get:se,getStyle:we,create:ae,remove:ue,empty:Re,toFront:_e,toBack:Ae,hasClass:Ee,addClass:ge,removeClass:et,setClass:ei,getClass:vi,setOpacity:Pi,testProp:ri,setTransform:ai,setPosition:Wt,getPosition:hi,get disableTextSelection(){return ki},get enableTextSelection(){return St},disableImageDrag:ke,enableImageDrag:Nt,preventOutline:en,restoreOutline:Ne,getSizedParentNode:ot,getScale:Tt};function vt(l,h,p,b){if(h&&typeof h=="object")for(var C in h)Nn(l,C,h[C],p);else{h=_(h);for(var P=0,V=h.length;P<V;P++)Nn(l,h[P],p,b)}return this}var fi="_leaflet_events";function si(l,h,p,b){if(arguments.length===1)ns(l),delete l[fi];else if(h&&typeof h=="object")for(var C in h)os(l,C,h[C],p);else if(h=_(h),arguments.length===2)ns(l,function(te){return B(h,te)!==-1});else for(var P=0,V=h.length;P<V;P++)os(l,h[P],p,b);return this}function ns(l,h){for(var p in l[fi]){var b=p.split(/\d/)[0];(!h||h(b))&&os(l,b,null,null,p)}}var ss={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Nn(l,h,p,b){var C=h+c(p)+(b?"_"+c(b):"");if(l[fi]&&l[fi][C])return this;var P=function(te){return p.call(b||l,te||window.event)},V=P;!Ce.touchNative&&Ce.pointer&&h.indexOf("touch")===0?P=pt(l,h,P):Ce.touch&&h==="dblclick"?P=Le(l,P):"addEventListener"in l?h==="touchstart"||h==="touchmove"||h==="wheel"||h==="mousewheel"?l.addEventListener(ss[h]||h,P,Ce.passiveEvents?{passive:!1}:!1):h==="mouseenter"||h==="mouseleave"?(P=function(te){te=te||window.event,Cg(l,te)&&V(te)},l.addEventListener(ss[h],P,!1)):l.addEventListener(h,V,!1):l.attachEvent("on"+h,P),l[fi]=l[fi]||{},l[fi][C]=P}function os(l,h,p,b,C){C=C||h+c(p)+(b?"_"+c(b):"");var P=l[fi]&&l[fi][C];if(!P)return this;!Ce.touchNative&&Ce.pointer&&h.indexOf("touch")===0?Lt(l,h,P):Ce.touch&&h==="dblclick"?W(l,P):"removeEventListener"in l?l.removeEventListener(ss[h]||h,P,!1):l.detachEvent("on"+h,P),l[fi][C]=null}function ds(l){return l.stopPropagation?l.stopPropagation():l.originalEvent?l.originalEvent._stopped=!0:l.cancelBubble=!0,this}function ao(l){return Nn(l,"wheel",ds),this}function lo(l){return vt(l,"mousedown touchstart dblclick contextmenu",ds),l._leaflet_disable_click=!0,this}function Rn(l){return l.preventDefault?l.preventDefault():l.returnValue=!1,this}function $s(l){return Rn(l),ds(l),this}function fh(l){if(l.composedPath)return l.composedPath();for(var h=[],p=l.target;p;)h.push(p),p=p.parentNode;return h}function Sg(l,h){if(!h)return new Ie(l.clientX,l.clientY);var p=Tt(h),b=p.boundingClientRect;return new Ie((l.clientX-b.left)/p.x-h.clientLeft,(l.clientY-b.top)/p.y-h.clientTop)}var yw=Ce.linux&&Ce.chrome?window.devicePixelRatio:Ce.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Gp(l){return Ce.edge?l.wheelDeltaY/2:l.deltaY&&l.deltaMode===0?-l.deltaY/yw:l.deltaY&&l.deltaMode===1?-l.deltaY*20:l.deltaY&&l.deltaMode===2?-l.deltaY*60:l.deltaX||l.deltaZ?0:l.wheelDelta?(l.wheelDeltaY||l.wheelDelta)/2:l.detail&&Math.abs(l.detail)<32765?-l.detail*20:l.detail?l.detail/-32765*60:0}function Cg(l,h){var p=h.relatedTarget;if(!p)return!0;try{for(;p&&p!==l;)p=p.parentNode}catch{return!1}return p!==l}var Sw={__proto__:null,on:vt,off:si,stopPropagation:ds,disableScrollPropagation:ao,disableClickPropagation:lo,preventDefault:Rn,stop:$s,getPropagationPath:fh,getMousePosition:Sg,getWheelDelta:Gp,isExternalTarget:Cg,addListener:vt,removeListener:si},Zp=Kt.extend({run:function(l,h,p,b){this.stop(),this._el=l,this._inProgress=!0,this._duration=p||.25,this._easeOutPower=1/Math.max(b||.5,.2),this._startPos=hi(l),this._offset=h.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=me(this._animate,this),this._step()},_step:function(l){var h=+new Date-this._startTime,p=this._duration*1e3;h<p?this._runFrame(this._easeOut(h/p),l):(this._runFrame(1),this._complete())},_runFrame:function(l,h){var p=this._startPos.add(this._offset.multiplyBy(l));h&&p._round(),Wt(this._el,p),this.fire("step")},_complete:function(){Ve(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(l){return 1-Math.pow(1-l,this._easeOutPower)}}),tn=Kt.extend({options:{crs:xi,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(l,h){h=y(this,h),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(l),this._initLayout(),this._onResize=r(this._onResize,this),this._initEvents(),h.maxBounds&&this.setMaxBounds(h.maxBounds),h.zoom!==void 0&&(this._zoom=this._limitZoom(h.zoom)),h.center&&h.zoom!==void 0&&this.setView(Ht(h.center),h.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=G&&Ce.any3d&&!Ce.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),vt(this._proxy,pe,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(l,h,p){if(h=h===void 0?this._zoom:this._limitZoom(h),l=this._limitCenter(Ht(l),h,this.options.maxBounds),p=p||{},this._stop(),this._loaded&&!p.reset&&p!==!0){p.animate!==void 0&&(p.zoom=n({animate:p.animate},p.zoom),p.pan=n({animate:p.animate,duration:p.duration},p.pan));var b=this._zoom!==h?this._tryAnimatedZoom&&this._tryAnimatedZoom(l,h,p.zoom):this._tryAnimatedPan(l,p.pan);if(b)return clearTimeout(this._sizeTimer),this}return this._resetView(l,h,p.pan&&p.pan.noMoveStart),this},setZoom:function(l,h){return this._loaded?this.setView(this.getCenter(),l,{zoom:h}):(this._zoom=l,this)},zoomIn:function(l,h){return l=l||(Ce.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+l,h)},zoomOut:function(l,h){return l=l||(Ce.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-l,h)},setZoomAround:function(l,h,p){var b=this.getZoomScale(h),C=this.getSize().divideBy(2),P=l instanceof Ie?l:this.latLngToContainerPoint(l),V=P.subtract(C).multiplyBy(1-1/b),te=this.containerPointToLatLng(C.add(V));return this.setView(te,h,{zoom:p})},_getBoundsCenterZoom:function(l,h){h=h||{},l=l.getBounds?l.getBounds():ci(l);var p=Fe(h.paddingTopLeft||h.padding||[0,0]),b=Fe(h.paddingBottomRight||h.padding||[0,0]),C=this.getBoundsZoom(l,!1,p.add(b));if(C=typeof h.maxZoom=="number"?Math.min(h.maxZoom,C):C,C===1/0)return{center:l.getCenter(),zoom:C};var P=b.subtract(p).divideBy(2),V=this.project(l.getSouthWest(),C),te=this.project(l.getNorthEast(),C),he=this.unproject(V.add(te).divideBy(2).add(P),C);return{center:he,zoom:C}},fitBounds:function(l,h){if(l=ci(l),!l.isValid())throw new Error("Bounds are not valid.");var p=this._getBoundsCenterZoom(l,h);return this.setView(p.center,p.zoom,h)},fitWorld:function(l){return this.fitBounds([[-90,-180],[90,180]],l)},panTo:function(l,h){return this.setView(l,this._zoom,{pan:h})},panBy:function(l,h){if(l=Fe(l).round(),h=h||{},!l.x&&!l.y)return this.fire("moveend");if(h.animate!==!0&&!this.getSize().contains(l))return this._resetView(this.unproject(this.project(this.getCenter()).add(l)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new Zp,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),h.noMoveStart||this.fire("movestart"),h.animate!==!1){ge(this._mapPane,"leaflet-pan-anim");var p=this._getMapPanePos().subtract(l).round();this._panAnim.run(this._mapPane,p,h.duration||.25,h.easeLinearity)}else this._rawPanBy(l),this.fire("move").fire("moveend");return this},flyTo:function(l,h,p){if(p=p||{},p.animate===!1||!Ce.any3d)return this.setView(l,h,p);this._stop();var b=this.project(this.getCenter()),C=this.project(l),P=this.getSize(),V=this._zoom;l=Ht(l),h=h===void 0?V:h;var te=Math.max(P.x,P.y),he=te*this.getZoomScale(V,h),We=C.distanceTo(b)||1,It=1.42,li=It*It;function ji(fs){var rm=fs?-1:1,JR=fs?he:te,QR=he*he-te*te+rm*li*li*We*We,eA=2*JR*li*We,Tw=QR/eA,bL=Math.sqrt(Tw*Tw+1)-Tw,tA=bL<1e-9?-18:Math.log(bL);return tA}function Gs(fs){return(Math.exp(fs)-Math.exp(-fs))/2}function ys(fs){return(Math.exp(fs)+Math.exp(-fs))/2}function Bo(fs){return Gs(fs)/ys(fs)}var ho=ji(0);function yh(fs){return te*(ys(ho)/ys(ho+It*fs))}function GR(fs){return te*(ys(ho)*Bo(ho+It*fs)-Gs(ho))/li}function ZR(fs){return 1-Math.pow(1-fs,1.5)}var XR=Date.now(),_L=(ji(1)-ho)/It,YR=p.duration?1e3*p.duration:1e3*_L*.8;function vL(){var fs=(Date.now()-XR)/YR,rm=ZR(fs)*_L;fs<=1?(this._flyToFrame=me(vL,this),this._move(this.unproject(b.add(C.subtract(b).multiplyBy(GR(rm)/We)),V),this.getScaleZoom(te/yh(rm),V),{flyTo:!0})):this._move(l,h)._moveEnd(!0)}return this._moveStart(!0,p.noMoveStart),vL.call(this),this},flyToBounds:function(l,h){var p=this._getBoundsCenterZoom(l,h);return this.flyTo(p.center,p.zoom,h)},setMaxBounds:function(l){return l=ci(l),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),l.isValid()?(this.options.maxBounds=l,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(l){var h=this.options.minZoom;return this.options.minZoom=l,this._loaded&&h!==l&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(l):this},setMaxZoom:function(l){var h=this.options.maxZoom;return this.options.maxZoom=l,this._loaded&&h!==l&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(l):this},panInsideBounds:function(l,h){this._enforcingBounds=!0;var p=this.getCenter(),b=this._limitCenter(p,this._zoom,ci(l));return p.equals(b)||this.panTo(b,h),this._enforcingBounds=!1,this},panInside:function(l,h){h=h||{};var p=Fe(h.paddingTopLeft||h.padding||[0,0]),b=Fe(h.paddingBottomRight||h.padding||[0,0]),C=this.project(this.getCenter()),P=this.project(l),V=this.getPixelBounds(),te=zt([V.min.add(p),V.max.subtract(b)]),he=te.getSize();if(!te.contains(P)){this._enforcingBounds=!0;var We=P.subtract(te.getCenter()),It=te.extend(P).getSize().subtract(he);C.x+=We.x<0?-It.x:It.x,C.y+=We.y<0?-It.y:It.y,this.panTo(this.unproject(C),h),this._enforcingBounds=!1}return this},invalidateSize:function(l){if(!this._loaded)return this;l=n({animate:!1,pan:!0},l===!0?{animate:!0}:l);var h=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var p=this.getSize(),b=h.divideBy(2).round(),C=p.divideBy(2).round(),P=b.subtract(C);return!P.x&&!P.y?this:(l.animate&&l.pan?this.panBy(P):(l.pan&&this._rawPanBy(P),this.fire("move"),l.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:h,newSize:p}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(l){if(l=this._locateOptions=n({timeout:1e4,watch:!1},l),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var h=r(this._handleGeolocationResponse,this),p=r(this._handleGeolocationError,this);return l.watch?this._locationWatchId=navigator.geolocation.watchPosition(h,p,l):navigator.geolocation.getCurrentPosition(h,p,l),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(l){if(this._container._leaflet_id){var h=l.code,p=l.message||(h===1?"permission denied":h===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:h,message:"Geolocation error: "+p+"."})}},_handleGeolocationResponse:function(l){if(this._container._leaflet_id){var h=l.coords.latitude,p=l.coords.longitude,b=new Vt(h,p),C=b.toBounds(l.coords.accuracy*2),P=this._locateOptions;if(P.setView){var V=this.getBoundsZoom(C);this.setView(b,P.maxZoom?Math.min(V,P.maxZoom):V)}var te={latlng:b,bounds:C,timestamp:l.timestamp};for(var he in l.coords)typeof l.coords[he]=="number"&&(te[he]=l.coords[he]);this.fire("locationfound",te)}},addHandler:function(l,h){if(!h)return this;var p=this[l]=new h(this);return this._handlers.push(p),this.options[l]&&p.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),ue(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(Ve(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var l;for(l in this._layers)this._layers[l].remove();for(l in this._panes)ue(this._panes[l]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(l,h){var p="leaflet-pane"+(l?" leaflet-"+l.replace("Pane","")+"-pane":""),b=ae("div",p,h||this._mapPane);return l&&(this._panes[l]=b),b},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var l=this.getPixelBounds(),h=this.unproject(l.getBottomLeft()),p=this.unproject(l.getTopRight());return new Gt(h,p)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(l,h,p){l=ci(l),p=Fe(p||[0,0]);var b=this.getZoom()||0,C=this.getMinZoom(),P=this.getMaxZoom(),V=l.getNorthWest(),te=l.getSouthEast(),he=this.getSize().subtract(p),We=zt(this.project(te,b),this.project(V,b)).getSize(),It=Ce.any3d?this.options.zoomSnap:1,li=he.x/We.x,ji=he.y/We.y,Gs=h?Math.max(li,ji):Math.min(li,ji);return b=this.getScaleZoom(Gs,b),It&&(b=Math.round(b/(It/100))*(It/100),b=h?Math.ceil(b/It)*It:Math.floor(b/It)*It),Math.max(C,Math.min(P,b))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new Ie(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(l,h){var p=this._getTopLeftPoint(l,h);return new ft(p,p.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(l){return this.options.crs.getProjectedBounds(l===void 0?this.getZoom():l)},getPane:function(l){return typeof l=="string"?this._panes[l]:l},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(l,h){var p=this.options.crs;return h=h===void 0?this._zoom:h,p.scale(l)/p.scale(h)},getScaleZoom:function(l,h){var p=this.options.crs;h=h===void 0?this._zoom:h;var b=p.zoom(l*p.scale(h));return isNaN(b)?1/0:b},project:function(l,h){return h=h===void 0?this._zoom:h,this.options.crs.latLngToPoint(Ht(l),h)},unproject:function(l,h){return h=h===void 0?this._zoom:h,this.options.crs.pointToLatLng(Fe(l),h)},layerPointToLatLng:function(l){var h=Fe(l).add(this.getPixelOrigin());return this.unproject(h)},latLngToLayerPoint:function(l){var h=this.project(Ht(l))._round();return h._subtract(this.getPixelOrigin())},wrapLatLng:function(l){return this.options.crs.wrapLatLng(Ht(l))},wrapLatLngBounds:function(l){return this.options.crs.wrapLatLngBounds(ci(l))},distance:function(l,h){return this.options.crs.distance(Ht(l),Ht(h))},containerPointToLayerPoint:function(l){return Fe(l).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(l){return Fe(l).add(this._getMapPanePos())},containerPointToLatLng:function(l){var h=this.containerPointToLayerPoint(Fe(l));return this.layerPointToLatLng(h)},latLngToContainerPoint:function(l){return this.layerPointToContainerPoint(this.latLngToLayerPoint(Ht(l)))},mouseEventToContainerPoint:function(l){return Sg(l,this._container)},mouseEventToLayerPoint:function(l){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(l))},mouseEventToLatLng:function(l){return this.layerPointToLatLng(this.mouseEventToLayerPoint(l))},_initContainer:function(l){var h=this._container=se(l);if(h){if(h._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");vt(h,"scroll",this._onScroll,this),this._containerId=c(h)},_initLayout:function(){var l=this._container;this._fadeAnimated=this.options.fadeAnimation&&Ce.any3d,ge(l,"leaflet-container"+(Ce.touch?" leaflet-touch":"")+(Ce.retina?" leaflet-retina":"")+(Ce.ielt9?" leaflet-oldie":"")+(Ce.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var h=we(l,"position");h!=="absolute"&&h!=="relative"&&h!=="fixed"&&h!=="sticky"&&(l.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var l=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Wt(this._mapPane,new Ie(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ge(l.markerPane,"leaflet-zoom-hide"),ge(l.shadowPane,"leaflet-zoom-hide"))},_resetView:function(l,h,p){Wt(this._mapPane,new Ie(0,0));var b=!this._loaded;this._loaded=!0,h=this._limitZoom(h),this.fire("viewprereset");var C=this._zoom!==h;this._moveStart(C,p)._move(l,h)._moveEnd(C),this.fire("viewreset"),b&&this.fire("load")},_moveStart:function(l,h){return l&&this.fire("zoomstart"),h||this.fire("movestart"),this},_move:function(l,h,p,b){h===void 0&&(h=this._zoom);var C=this._zoom!==h;return this._zoom=h,this._lastCenter=l,this._pixelOrigin=this._getNewPixelOrigin(l),b?p&&p.pinch&&this.fire("zoom",p):((C||p&&p.pinch)&&this.fire("zoom",p),this.fire("move",p)),this},_moveEnd:function(l){return l&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return Ve(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(l){Wt(this._mapPane,this._getMapPanePos().subtract(l))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(l){this._targets={},this._targets[c(this._container)]=this;var h=l?si:vt;h(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&h(window,"resize",this._onResize,this),Ce.any3d&&this.options.transform3DLimit&&(l?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){Ve(this._resizeRequest),this._resizeRequest=me(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var l=this._getMapPanePos();Math.max(Math.abs(l.x),Math.abs(l.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(l,h){for(var p=[],b,C=h==="mouseout"||h==="mouseover",P=l.target||l.srcElement,V=!1;P;){if(b=this._targets[c(P)],b&&(h==="click"||h==="preclick")&&this._draggableMoved(b)){V=!0;break}if(b&&b.listens(h,!0)&&(C&&!Cg(P,l)||(p.push(b),C))||P===this._container)break;P=P.parentNode}return!p.length&&!V&&!C&&this.listens(h,!0)&&(p=[this]),p},_isClickDisabled:function(l){for(;l&&l!==this._container;){if(l._leaflet_disable_click)return!0;l=l.parentNode}},_handleDOMEvent:function(l){var h=l.target||l.srcElement;if(!(!this._loaded||h._leaflet_disable_events||l.type==="click"&&this._isClickDisabled(h))){var p=l.type;p==="mousedown"&&en(h),this._fireDOMEvent(l,p)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(l,h,p){if(l.type==="click"){var b=n({},l);b.type="preclick",this._fireDOMEvent(b,b.type,p)}var C=this._findEventTargets(l,h);if(p){for(var P=[],V=0;V<p.length;V++)p[V].listens(h,!0)&&P.push(p[V]);C=P.concat(C)}if(C.length){h==="contextmenu"&&Rn(l);var te=C[0],he={originalEvent:l};if(l.type!=="keypress"&&l.type!=="keydown"&&l.type!=="keyup"){var We=te.getLatLng&&(!te._radius||te._radius<=10);he.containerPoint=We?this.latLngToContainerPoint(te.getLatLng()):this.mouseEventToContainerPoint(l),he.layerPoint=this.containerPointToLayerPoint(he.containerPoint),he.latlng=We?te.getLatLng():this.layerPointToLatLng(he.layerPoint)}for(V=0;V<C.length;V++)if(C[V].fire(h,he,!0),he.originalEvent._stopped||C[V].options.bubblingMouseEvents===!1&&B(this._mouseEvents,h)!==-1)return}},_draggableMoved:function(l){return l=l.dragging&&l.dragging.enabled()?l:this,l.dragging&&l.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var l=0,h=this._handlers.length;l<h;l++)this._handlers[l].disable()},whenReady:function(l,h){return this._loaded?l.call(h||this,{target:this}):this.on("load",l,h),this},_getMapPanePos:function(){return hi(this._mapPane)||new Ie(0,0)},_moved:function(){var l=this._getMapPanePos();return l&&!l.equals([0,0])},_getTopLeftPoint:function(l,h){var p=l&&h!==void 0?this._getNewPixelOrigin(l,h):this.getPixelOrigin();return p.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(l,h){var p=this.getSize()._divideBy(2);return this.project(l,h)._subtract(p)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(l,h,p){var b=this._getNewPixelOrigin(p,h);return this.project(l,h)._subtract(b)},_latLngBoundsToNewLayerBounds:function(l,h,p){var b=this._getNewPixelOrigin(p,h);return zt([this.project(l.getSouthWest(),h)._subtract(b),this.project(l.getNorthWest(),h)._subtract(b),this.project(l.getSouthEast(),h)._subtract(b),this.project(l.getNorthEast(),h)._subtract(b)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(l){return this.latLngToLayerPoint(l).subtract(this._getCenterLayerPoint())},_limitCenter:function(l,h,p){if(!p)return l;var b=this.project(l,h),C=this.getSize().divideBy(2),P=new ft(b.subtract(C),b.add(C)),V=this._getBoundsOffset(P,p,h);return Math.abs(V.x)<=1&&Math.abs(V.y)<=1?l:this.unproject(b.add(V),h)},_limitOffset:function(l,h){if(!h)return l;var p=this.getPixelBounds(),b=new ft(p.min.add(l),p.max.add(l));return l.add(this._getBoundsOffset(b,h))},_getBoundsOffset:function(l,h,p){var b=zt(this.project(h.getNorthEast(),p),this.project(h.getSouthWest(),p)),C=b.min.subtract(l.min),P=b.max.subtract(l.max),V=this._rebound(C.x,-P.x),te=this._rebound(C.y,-P.y);return new Ie(V,te)},_rebound:function(l,h){return l+h>0?Math.round(l-h)/2:Math.max(0,Math.ceil(l))-Math.max(0,Math.floor(h))},_limitZoom:function(l){var h=this.getMinZoom(),p=this.getMaxZoom(),b=Ce.any3d?this.options.zoomSnap:1;return b&&(l=Math.round(l/b)*b),Math.max(h,Math.min(p,l))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){et(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(l,h){var p=this._getCenterOffset(l)._trunc();return(h&&h.animate)!==!0&&!this.getSize().contains(p)?!1:(this.panBy(p,h),!0)},_createAnimProxy:function(){var l=this._proxy=ae("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(l),this.on("zoomanim",function(h){var p=R,b=this._proxy.style[p];ai(this._proxy,this.project(h.center,h.zoom),this.getZoomScale(h.zoom,1)),b===this._proxy.style[p]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ue(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var l=this.getCenter(),h=this.getZoom();ai(this._proxy,this.project(l,h),this.getZoomScale(h,1))},_catchTransitionEnd:function(l){this._animatingZoom&&l.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(l,h,p){if(this._animatingZoom)return!0;if(p=p||{},!this._zoomAnimated||p.animate===!1||this._nothingToAnimate()||Math.abs(h-this._zoom)>this.options.zoomAnimationThreshold)return!1;var b=this.getZoomScale(h),C=this._getCenterOffset(l)._divideBy(1-1/b);return p.animate!==!0&&!this.getSize().contains(C)?!1:(me(function(){this._moveStart(!0,p.noMoveStart||!1)._animateZoom(l,h,!0)},this),!0)},_animateZoom:function(l,h,p,b){this._mapPane&&(p&&(this._animatingZoom=!0,this._animateToCenter=l,this._animateToZoom=h,ge(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:l,zoom:h,noUpdate:b}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&et(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Cw(l,h){return new tn(l,h)}var Io=Ke.extend({options:{position:"topright"},initialize:function(l){y(this,l)},getPosition:function(){return this.options.position},setPosition:function(l){var h=this._map;return h&&h.removeControl(this),this.options.position=l,h&&h.addControl(this),this},getContainer:function(){return this._container},addTo:function(l){this.remove(),this._map=l;var h=this._container=this.onAdd(l),p=this.getPosition(),b=l._controlCorners[p];return ge(h,"leaflet-control"),p.indexOf("bottom")!==-1?b.insertBefore(h,b.firstChild):b.appendChild(h),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ue(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(l){this._map&&l&&l.screenX>0&&l.screenY>0&&this._map.getContainer().focus()}}),z=function(l){return new Io(l)};tn.include({addControl:function(l){return l.addTo(this),this},removeControl:function(l){return l.remove(),this},_initControlPos:function(){var l=this._controlCorners={},h="leaflet-",p=this._controlContainer=ae("div",h+"control-container",this._container);function b(C,P){var V=h+C+" "+h+P;l[C+P]=ae("div",V,p)}b("top","left"),b("top","right"),b("bottom","left"),b("bottom","right")},_clearControlPos:function(){for(var l in this._controlCorners)ue(this._controlCorners[l]);ue(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var de=Io.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(l,h,p,b){return p<b?-1:b<p?1:0}},initialize:function(l,h,p){y(this,p),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var b in l)this._addLayer(l[b],b);for(b in h)this._addLayer(h[b],b,!0)},onAdd:function(l){this._initLayout(),this._update(),this._map=l,l.on("zoomend",this._checkDisabledLayers,this);for(var h=0;h<this._layers.length;h++)this._layers[h].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(l){return Io.prototype.addTo.call(this,l),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var l=0;l<this._layers.length;l++)this._layers[l].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(l,h){return this._addLayer(l,h),this._map?this._update():this},addOverlay:function(l,h){return this._addLayer(l,h,!0),this._map?this._update():this},removeLayer:function(l){l.off("add remove",this._onLayerChange,this);var h=this._getLayer(c(l));return h&&this._layers.splice(this._layers.indexOf(h),1),this._map?this._update():this},expand:function(){ge(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var l=this._map.getSize().y-(this._container.offsetTop+50);return l<this._section.clientHeight?(ge(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=l+"px"):et(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return et(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var l="leaflet-control-layers",h=this._container=ae("div",l),p=this.options.collapsed;h.setAttribute("aria-haspopup",!0),lo(h),ao(h);var b=this._section=ae("section",l+"-list");p&&(this._map.on("click",this.collapse,this),vt(h,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var C=this._layersLink=ae("a",l+"-toggle",h);C.href="#",C.title="Layers",C.setAttribute("role","button"),vt(C,{keydown:function(P){P.keyCode===13&&this._expandSafely()},click:function(P){Rn(P),this._expandSafely()}},this),p||this.expand(),this._baseLayersList=ae("div",l+"-base",b),this._separator=ae("div",l+"-separator",b),this._overlaysList=ae("div",l+"-overlays",b),h.appendChild(b)},_getLayer:function(l){for(var h=0;h<this._layers.length;h++)if(this._layers[h]&&c(this._layers[h].layer)===l)return this._layers[h]},_addLayer:function(l,h,p){this._map&&l.on("add remove",this._onLayerChange,this),this._layers.push({layer:l,name:h,overlay:p}),this.options.sortLayers&&this._layers.sort(r(function(b,C){return this.options.sortFunction(b.layer,C.layer,b.name,C.name)},this)),this.options.autoZIndex&&l.setZIndex&&(this._lastZIndex++,l.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Re(this._baseLayersList),Re(this._overlaysList),this._layerControlInputs=[];var l,h,p,b,C=0;for(p=0;p<this._layers.length;p++)b=this._layers[p],this._addItem(b),h=h||b.overlay,l=l||!b.overlay,C+=b.overlay?0:1;return this.options.hideSingleBase&&(l=l&&C>1,this._baseLayersList.style.display=l?"":"none"),this._separator.style.display=h&&l?"":"none",this},_onLayerChange:function(l){this._handlingClick||this._update();var h=this._getLayer(c(l.target)),p=h.overlay?l.type==="add"?"overlayadd":"overlayremove":l.type==="add"?"baselayerchange":null;p&&this._map.fire(p,h)},_createRadioElement:function(l,h){var p='<input type="radio" class="leaflet-control-layers-selector" name="'+l+'"'+(h?' checked="checked"':"")+"/>",b=document.createElement("div");return b.innerHTML=p,b.firstChild},_addItem:function(l){var h=document.createElement("label"),p=this._map.hasLayer(l.layer),b;l.overlay?(b=document.createElement("input"),b.type="checkbox",b.className="leaflet-control-layers-selector",b.defaultChecked=p):b=this._createRadioElement("leaflet-base-layers_"+c(this),p),this._layerControlInputs.push(b),b.layerId=c(l.layer),vt(b,"click",this._onInputClick,this);var C=document.createElement("span");C.innerHTML=" "+l.name;var P=document.createElement("span");h.appendChild(P),P.appendChild(b),P.appendChild(C);var V=l.overlay?this._overlaysList:this._baseLayersList;return V.appendChild(h),this._checkDisabledLayers(),h},_onInputClick:function(){if(!this._preventClick){var l=this._layerControlInputs,h,p,b=[],C=[];this._handlingClick=!0;for(var P=l.length-1;P>=0;P--)h=l[P],p=this._getLayer(h.layerId).layer,h.checked?b.push(p):h.checked||C.push(p);for(P=0;P<C.length;P++)this._map.hasLayer(C[P])&&this._map.removeLayer(C[P]);for(P=0;P<b.length;P++)this._map.hasLayer(b[P])||this._map.addLayer(b[P]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var l=this._layerControlInputs,h,p,b=this._map.getZoom(),C=l.length-1;C>=0;C--)h=l[C],p=this._getLayer(h.layerId).layer,h.disabled=p.options.minZoom!==void 0&&b<p.options.minZoom||p.options.maxZoom!==void 0&&b>p.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var l=this._section;this._preventClick=!0,vt(l,"click",Rn),this.expand();var h=this;setTimeout(function(){si(l,"click",Rn),h._preventClick=!1})}}),He=function(l,h,p){return new de(l,h,p)},ye=Io.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(l){var h="leaflet-control-zoom",p=ae("div",h+" leaflet-bar"),b=this.options;return this._zoomInButton=this._createButton(b.zoomInText,b.zoomInTitle,h+"-in",p,this._zoomIn),this._zoomOutButton=this._createButton(b.zoomOutText,b.zoomOutTitle,h+"-out",p,this._zoomOut),this._updateDisabled(),l.on("zoomend zoomlevelschange",this._updateDisabled,this),p},onRemove:function(l){l.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(l){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(l.shiftKey?3:1))},_zoomOut:function(l){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(l.shiftKey?3:1))},_createButton:function(l,h,p,b,C){var P=ae("a",p,b);return P.innerHTML=l,P.href="#",P.title=h,P.setAttribute("role","button"),P.setAttribute("aria-label",h),lo(P),vt(P,"click",$s),vt(P,"click",C,this),vt(P,"click",this._refocusOnMap,this),P},_updateDisabled:function(){var l=this._map,h="leaflet-disabled";et(this._zoomInButton,h),et(this._zoomOutButton,h),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||l._zoom===l.getMinZoom())&&(ge(this._zoomOutButton,h),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||l._zoom===l.getMaxZoom())&&(ge(this._zoomInButton,h),this._zoomInButton.setAttribute("aria-disabled","true"))}});tn.mergeOptions({zoomControl:!0}),tn.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new ye,this.addControl(this.zoomControl))});var kt=function(l){return new ye(l)},jt=Io.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(l){var h="leaflet-control-scale",p=ae("div",h),b=this.options;return this._addScales(b,h+"-line",p),l.on(b.updateWhenIdle?"moveend":"move",this._update,this),l.whenReady(this._update,this),p},onRemove:function(l){l.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(l,h,p){l.metric&&(this._mScale=ae("div",h,p)),l.imperial&&(this._iScale=ae("div",h,p))},_update:function(){var l=this._map,h=l.getSize().y/2,p=l.distance(l.containerPointToLatLng([0,h]),l.containerPointToLatLng([this.options.maxWidth,h]));this._updateScales(p)},_updateScales:function(l){this.options.metric&&l&&this._updateMetric(l),this.options.imperial&&l&&this._updateImperial(l)},_updateMetric:function(l){var h=this._getRoundNum(l),p=h<1e3?h+" m":h/1e3+" km";this._updateScale(this._mScale,p,h/l)},_updateImperial:function(l){var h=l*3.2808399,p,b,C;h>5280?(p=h/5280,b=this._getRoundNum(p),this._updateScale(this._iScale,b+" mi",b/p)):(C=this._getRoundNum(h),this._updateScale(this._iScale,C+" ft",C/h))},_updateScale:function(l,h,p){l.style.width=Math.round(this.options.maxWidth*p)+"px",l.innerHTML=h},_getRoundNum:function(l){var h=Math.pow(10,(Math.floor(l)+"").length-1),p=l/h;return p=p>=10?10:p>=5?5:p>=3?3:p>=2?2:1,h*p}}),$t=function(l){return new jt(l)},yn='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',Ti=Io.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(Ce.inlineSvg?yn+" ":"")+"Leaflet</a>"},initialize:function(l){y(this,l),this._attributions={}},onAdd:function(l){l.attributionControl=this,this._container=ae("div","leaflet-control-attribution"),lo(this._container);for(var h in l._layers)l._layers[h].getAttribution&&this.addAttribution(l._layers[h].getAttribution());return this._update(),l.on("layeradd",this._addAttribution,this),this._container},onRemove:function(l){l.off("layeradd",this._addAttribution,this)},_addAttribution:function(l){l.layer.getAttribution&&(this.addAttribution(l.layer.getAttribution()),l.layer.once("remove",function(){this.removeAttribution(l.layer.getAttribution())},this))},setPrefix:function(l){return this.options.prefix=l,this._update(),this},addAttribution:function(l){return l?(this._attributions[l]||(this._attributions[l]=0),this._attributions[l]++,this._update(),this):this},removeAttribution:function(l){return l?(this._attributions[l]&&(this._attributions[l]--,this._update()),this):this},_update:function(){if(this._map){var l=[];for(var h in this._attributions)this._attributions[h]&&l.push(h);var p=[];this.options.prefix&&p.push(this.options.prefix),l.length&&p.push(l.join(", ")),this._container.innerHTML=p.join(' <span aria-hidden="true">|</span> ')}}});tn.mergeOptions({attributionControl:!0}),tn.addInitHook(function(){this.options.attributionControl&&new Ti().addTo(this)});var qi=function(l){return new Ti(l)};Io.Layers=de,Io.Zoom=ye,Io.Scale=jt,Io.Attribution=Ti,z.layers=He,z.zoom=kt,z.scale=$t,z.attribution=qi;var Yt=Ke.extend({initialize:function(l){this._map=l},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Yt.addTo=function(l,h){return l.addHandler(h,this),this};var Hi={Events:lt},zn=Ce.touch?"touchstart mousedown":"mousedown",$n=Kt.extend({options:{clickTolerance:3},initialize:function(l,h,p,b){y(this,b),this._element=l,this._dragStartTarget=h||l,this._preventOutline=p},enable:function(){this._enabled||(vt(this._dragStartTarget,zn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&($n._dragging===this&&this.finishDrag(!0),si(this._dragStartTarget,zn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(l){if(this._enabled&&(this._moved=!1,!Ee(this._element,"leaflet-zoom-anim"))){if(l.touches&&l.touches.length!==1){$n._dragging===this&&this.finishDrag();return}if(!($n._dragging||l.shiftKey||l.which!==1&&l.button!==1&&!l.touches)&&($n._dragging=this,this._preventOutline&&en(this._element),ke(),ki(),!this._moving)){this.fire("down");var h=l.touches?l.touches[0]:l,p=ot(this._element);this._startPoint=new Ie(h.clientX,h.clientY),this._startPos=hi(this._element),this._parentScale=Tt(p);var b=l.type==="mousedown";vt(document,b?"mousemove":"touchmove",this._onMove,this),vt(document,b?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(l){if(this._enabled){if(l.touches&&l.touches.length>1){this._moved=!0;return}var h=l.touches&&l.touches.length===1?l.touches[0]:l,p=new Ie(h.clientX,h.clientY)._subtract(this._startPoint);!p.x&&!p.y||Math.abs(p.x)+Math.abs(p.y)<this.options.clickTolerance||(p.x/=this._parentScale.x,p.y/=this._parentScale.y,Rn(l),this._moved||(this.fire("dragstart"),this._moved=!0,ge(document.body,"leaflet-dragging"),this._lastTarget=l.target||l.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ge(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(p),this._moving=!0,this._lastEvent=l,this._updatePosition())}},_updatePosition:function(){var l={originalEvent:this._lastEvent};this.fire("predrag",l),Wt(this._element,this._newPos),this.fire("drag",l)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(l){et(document.body,"leaflet-dragging"),this._lastTarget&&(et(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),si(document,"mousemove touchmove",this._onMove,this),si(document,"mouseup touchend touchcancel",this._onUp,this),Nt(),St();var h=this._moved&&this._moving;this._moving=!1,$n._dragging=!1,h&&this.fire("dragend",{noInertia:l,distance:this._newPos.distanceTo(this._startPos)})}});function qs(l,h,p){var b,C=[1,4,2,8],P,V,te,he,We,It,li,ji;for(P=0,It=l.length;P<It;P++)l[P]._code=hr(l[P],h);for(te=0;te<4;te++){for(li=C[te],b=[],P=0,It=l.length,V=It-1;P<It;V=P++)he=l[P],We=l[V],he._code&li?We._code&li||(ji=Wr(We,he,li,h,p),ji._code=hr(ji,h),b.push(ji)):(We._code&li&&(ji=Wr(We,he,li,h,p),ji._code=hr(ji,h),b.push(ji)),b.push(he));l=b}return l}function dr(l,h){var p,b,C,P,V,te,he,We,It;if(!l||l.length===0)throw new Error("latlngs not passed");co(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var li=Ht([0,0]),ji=ci(l),Gs=ji.getNorthWest().distanceTo(ji.getSouthWest())*ji.getNorthEast().distanceTo(ji.getNorthWest());Gs<1700&&(li=hs(l));var ys=l.length,Bo=[];for(p=0;p<ys;p++){var ho=Ht(l[p]);Bo.push(h.project(Ht([ho.lat-li.lat,ho.lng-li.lng])))}for(te=he=We=0,p=0,b=ys-1;p<ys;b=p++)C=Bo[p],P=Bo[b],V=C.y*P.x-P.y*C.x,he+=(C.x+P.x)*V,We+=(C.y+P.y)*V,te+=V*3;te===0?It=Bo[0]:It=[he/te,We/te];var yh=h.unproject(Fe(It));return Ht([yh.lat+li.lat,yh.lng+li.lng])}function hs(l){for(var h=0,p=0,b=0,C=0;C<l.length;C++){var P=Ht(l[C]);h+=P.lat,p+=P.lng,b++}return Ht([h/b,p/b])}var Fr={__proto__:null,clipPolygon:qs,polygonCenter:dr,centroid:hs};function ko(l,h){if(!h||!l.length)return l.slice();var p=h*h;return l=Do(l,p),l=wa(l,p),l}function Hr(l,h,p){return Math.sqrt(_c(l,h,p,!0))}function pc(l,h,p){return _c(l,h,p)}function wa(l,h){var p=l.length,b=typeof Uint8Array<"u"?Uint8Array:Array,C=new b(p);C[0]=C[p-1]=1,ya(l,C,h,0,p-1);var P,V=[];for(P=0;P<p;P++)C[P]&&V.push(l[P]);return V}function ya(l,h,p,b,C){var P=0,V,te,he;for(te=b+1;te<=C-1;te++)he=_c(l[te],l[b],l[C],!0),he>P&&(V=te,P=he);P>p&&(h[V]=1,ya(l,h,p,b,V),ya(l,h,p,V,C))}function Do(l,h){for(var p=[l[0]],b=1,C=0,P=l.length;b<P;b++)xw(l[b],l[C])>h&&(p.push(l[b]),C=b);return C<P-1&&p.push(l[P-1]),p}var Xn;function mc(l,h,p,b,C){var P=b?Xn:hr(l,p),V=hr(h,p),te,he,We;for(Xn=V;;){if(!(P|V))return[l,h];if(P&V)return!1;te=P||V,he=Wr(l,h,te,p,C),We=hr(he,p),te===P?(l=he,P=We):(h=he,V=We)}}function Wr(l,h,p,b,C){var P=h.x-l.x,V=h.y-l.y,te=b.min,he=b.max,We,It;return p&8?(We=l.x+P*(he.y-l.y)/V,It=he.y):p&4?(We=l.x+P*(te.y-l.y)/V,It=te.y):p&2?(We=he.x,It=l.y+V*(he.x-l.x)/P):p&1&&(We=te.x,It=l.y+V*(te.x-l.x)/P),new Ie(We,It,C)}function hr(l,h){var p=0;return l.x<h.min.x?p|=1:l.x>h.max.x&&(p|=2),l.y<h.min.y?p|=4:l.y>h.max.y&&(p|=8),p}function xw(l,h){var p=h.x-l.x,b=h.y-l.y;return p*p+b*b}function _c(l,h,p,b){var C=h.x,P=h.y,V=p.x-C,te=p.y-P,he=V*V+te*te,We;return he>0&&(We=((l.x-C)*V+(l.y-P)*te)/he,We>1?(C=p.x,P=p.y):We>0&&(C+=V*We,P+=te*We)),V=l.x-C,te=l.y-P,b?V*V+te*te:new Ie(C,P)}function co(l){return!N(l[0])||typeof l[0][0]!="object"&&typeof l[0][0]<"u"}function An(l){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),co(l)}function Ks(l,h){var p,b,C,P,V,te,he,We;if(!l||l.length===0)throw new Error("latlngs not passed");co(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var It=Ht([0,0]),li=ci(l),ji=li.getNorthWest().distanceTo(li.getSouthWest())*li.getNorthEast().distanceTo(li.getNorthWest());ji<1700&&(It=hs(l));var Gs=l.length,ys=[];for(p=0;p<Gs;p++){var Bo=Ht(l[p]);ys.push(h.project(Ht([Bo.lat-It.lat,Bo.lng-It.lng])))}for(p=0,b=0;p<Gs-1;p++)b+=ys[p].distanceTo(ys[p+1])/2;if(b===0)We=ys[0];else for(p=0,P=0;p<Gs-1;p++)if(V=ys[p],te=ys[p+1],C=V.distanceTo(te),P+=C,P>b){he=(P-b)/C,We=[te.x-he*(te.x-V.x),te.y-he*(te.y-V.y)];break}var ho=h.unproject(Fe(We));return Ht([ho.lat+It.lat,ho.lng+It.lng])}var ph={__proto__:null,simplify:ko,pointToSegmentDistance:Hr,closestPointOnSegment:pc,clipSegment:mc,_getEdgeIntersection:Wr,_getBitCode:hr,_sqClosestPointOnSegment:_c,isFlat:co,_flat:An,polylineCenter:Ks},Lw={project:function(l){return new Ie(l.lng,l.lat)},unproject:function(l){return new Vt(l.y,l.x)},bounds:new ft([-180,-90],[180,90])},Iw={R:6378137,R_MINOR:6356752314245179e-9,bounds:new ft([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(l){var h=Math.PI/180,p=this.R,b=l.lat*h,C=this.R_MINOR/p,P=Math.sqrt(1-C*C),V=P*Math.sin(b),te=Math.tan(Math.PI/4-b/2)/Math.pow((1-V)/(1+V),P/2);return b=-p*Math.log(Math.max(te,1e-10)),new Ie(l.lng*h*p,b)},unproject:function(l){for(var h=180/Math.PI,p=this.R,b=this.R_MINOR/p,C=Math.sqrt(1-b*b),P=Math.exp(-l.y/p),V=Math.PI/2-2*Math.atan(P),te=0,he=.1,We;te<15&&Math.abs(he)>1e-7;te++)We=C*Math.sin(V),We=Math.pow((1-We)/(1+We),C/2),he=Math.PI/2-2*Math.atan(P*We)-V,V+=he;return new Vt(V*h,l.x*h/p)}},xR={__proto__:null,LonLat:Lw,Mercator:Iw,SphericalMercator:Ct},LR=n({},zi,{code:"EPSG:3395",projection:Iw,transformation:(function(){var l=.5/(Math.PI*Iw.R);return Ci(l,.5,-l,.5)})()}),Y1=n({},zi,{code:"EPSG:4326",projection:Lw,transformation:Ci(1/180,1,-1/180,.5)}),IR=n({},Fi,{projection:Lw,transformation:Ci(1,0,-1,0),scale:function(l){return Math.pow(2,l)},zoom:function(l){return Math.log(l)/Math.LN2},distance:function(l,h){var p=h.lng-l.lng,b=h.lat-l.lat;return Math.sqrt(p*p+b*b)},infinite:!0});Fi.Earth=zi,Fi.EPSG3395=LR,Fi.EPSG3857=xi,Fi.EPSG900913=Di,Fi.EPSG4326=Y1,Fi.Simple=IR;var ur=Kt.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(l){return l.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(l){return l&&l.removeLayer(this),this},getPane:function(l){return this._map.getPane(l?this.options[l]||l:this.options.pane)},addInteractiveTarget:function(l){return this._map._targets[c(l)]=this,this},removeInteractiveTarget:function(l){return delete this._map._targets[c(l)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(l){var h=l.target;if(h.hasLayer(this)){if(this._map=h,this._zoomAnimated=h._zoomAnimated,this.getEvents){var p=this.getEvents();h.on(p,this),this.once("remove",function(){h.off(p,this)},this)}this.onAdd(h),this.fire("add"),h.fire("layeradd",{layer:this})}}});tn.include({addLayer:function(l){if(!l._layerAdd)throw new Error("The provided object is not a Layer.");var h=c(l);return this._layers[h]?this:(this._layers[h]=l,l._mapToAdd=this,l.beforeAdd&&l.beforeAdd(this),this.whenReady(l._layerAdd,l),this)},removeLayer:function(l){var h=c(l);return this._layers[h]?(this._loaded&&l.onRemove(this),delete this._layers[h],this._loaded&&(this.fire("layerremove",{layer:l}),l.fire("remove")),l._map=l._mapToAdd=null,this):this},hasLayer:function(l){return c(l)in this._layers},eachLayer:function(l,h){for(var p in this._layers)l.call(h,this._layers[p]);return this},_addLayers:function(l){l=l?N(l)?l:[l]:[];for(var h=0,p=l.length;h<p;h++)this.addLayer(l[h])},_addZoomLimit:function(l){(!isNaN(l.options.maxZoom)||!isNaN(l.options.minZoom))&&(this._zoomBoundLayers[c(l)]=l,this._updateZoomLevels())},_removeZoomLimit:function(l){var h=c(l);this._zoomBoundLayers[h]&&(delete this._zoomBoundLayers[h],this._updateZoomLevels())},_updateZoomLevels:function(){var l=1/0,h=-1/0,p=this._getZoomSpan();for(var b in this._zoomBoundLayers){var C=this._zoomBoundLayers[b].options;l=C.minZoom===void 0?l:Math.min(l,C.minZoom),h=C.maxZoom===void 0?h:Math.max(h,C.maxZoom)}this._layersMaxZoom=h===-1/0?void 0:h,this._layersMinZoom=l===1/0?void 0:l,p!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var mh=ur.extend({initialize:function(l,h){y(this,h),this._layers={};var p,b;if(l)for(p=0,b=l.length;p<b;p++)this.addLayer(l[p])},addLayer:function(l){var h=this.getLayerId(l);return this._layers[h]=l,this._map&&this._map.addLayer(l),this},removeLayer:function(l){var h=l in this._layers?l:this.getLayerId(l);return this._map&&this._layers[h]&&this._map.removeLayer(this._layers[h]),delete this._layers[h],this},hasLayer:function(l){var h=typeof l=="number"?l:this.getLayerId(l);return h in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(l){var h=Array.prototype.slice.call(arguments,1),p,b;for(p in this._layers)b=this._layers[p],b[l]&&b[l].apply(b,h);return this},onAdd:function(l){this.eachLayer(l.addLayer,l)},onRemove:function(l){this.eachLayer(l.removeLayer,l)},eachLayer:function(l,h){for(var p in this._layers)l.call(h,this._layers[p]);return this},getLayer:function(l){return this._layers[l]},getLayers:function(){var l=[];return this.eachLayer(l.push,l),l},setZIndex:function(l){return this.invoke("setZIndex",l)},getLayerId:function(l){return c(l)}}),kR=function(l,h){return new mh(l,h)},Sa=mh.extend({addLayer:function(l){return this.hasLayer(l)?this:(l.addEventParent(this),mh.prototype.addLayer.call(this,l),this.fire("layeradd",{layer:l}))},removeLayer:function(l){return this.hasLayer(l)?(l in this._layers&&(l=this._layers[l]),l.removeEventParent(this),mh.prototype.removeLayer.call(this,l),this.fire("layerremove",{layer:l})):this},setStyle:function(l){return this.invoke("setStyle",l)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var l=new Gt;for(var h in this._layers){var p=this._layers[h];l.extend(p.getBounds?p.getBounds():p.getLatLng())}return l}}),DR=function(l,h){return new Sa(l,h)},_h=Ke.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(l){y(this,l)},createIcon:function(l){return this._createIcon("icon",l)},createShadow:function(l){return this._createIcon("shadow",l)},_createIcon:function(l,h){var p=this._getIconUrl(l);if(!p){if(l==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var b=this._createImg(p,h&&h.tagName==="IMG"?h:null);return this._setIconStyles(b,l),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),b},_setIconStyles:function(l,h){var p=this.options,b=p[h+"Size"];typeof b=="number"&&(b=[b,b]);var C=Fe(b),P=Fe(h==="shadow"&&p.shadowAnchor||p.iconAnchor||C&&C.divideBy(2,!0));l.className="leaflet-marker-"+h+" "+(p.className||""),P&&(l.style.marginLeft=-P.x+"px",l.style.marginTop=-P.y+"px"),C&&(l.style.width=C.x+"px",l.style.height=C.y+"px")},_createImg:function(l,h){return h=h||document.createElement("img"),h.src=l,h},_getIconUrl:function(l){return Ce.retina&&this.options[l+"RetinaUrl"]||this.options[l+"Url"]}});function ER(l){return new _h(l)}var xg=_h.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(l){return typeof xg.imagePath!="string"&&(xg.imagePath=this._detectIconPath()),(this.options.imagePath||xg.imagePath)+_h.prototype._getIconUrl.call(this,l)},_stripUrl:function(l){var h=function(p,b,C){var P=b.exec(p);return P&&P[C]};return l=h(l,/^url\((['"])?(.+)\1\)$/,2),l&&h(l,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var l=ae("div","leaflet-default-icon-path",document.body),h=we(l,"background-image")||we(l,"backgroundImage");if(document.body.removeChild(l),h=this._stripUrl(h),h)return h;var p=document.querySelector('link[href$="leaflet.css"]');return p?p.href.substring(0,p.href.length-11-1):""}}),J1=Yt.extend({initialize:function(l){this._marker=l},addHooks:function(){var l=this._marker._icon;this._draggable||(this._draggable=new $n(l,l,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ge(l,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&et(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(l){var h=this._marker,p=h._map,b=this._marker.options.autoPanSpeed,C=this._marker.options.autoPanPadding,P=hi(h._icon),V=p.getPixelBounds(),te=p.getPixelOrigin(),he=zt(V.min._subtract(te).add(C),V.max._subtract(te).subtract(C));if(!he.contains(P)){var We=Fe((Math.max(he.max.x,P.x)-he.max.x)/(V.max.x-he.max.x)-(Math.min(he.min.x,P.x)-he.min.x)/(V.min.x-he.min.x),(Math.max(he.max.y,P.y)-he.max.y)/(V.max.y-he.max.y)-(Math.min(he.min.y,P.y)-he.min.y)/(V.min.y-he.min.y)).multiplyBy(b);p.panBy(We,{animate:!1}),this._draggable._newPos._add(We),this._draggable._startPos._add(We),Wt(h._icon,this._draggable._newPos),this._onDrag(l),this._panRequest=me(this._adjustPan.bind(this,l))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(l){this._marker.options.autoPan&&(Ve(this._panRequest),this._panRequest=me(this._adjustPan.bind(this,l)))},_onDrag:function(l){var h=this._marker,p=h._shadow,b=hi(h._icon),C=h._map.layerPointToLatLng(b);p&&Wt(p,b),h._latlng=C,l.latlng=C,l.oldLatLng=this._oldLatLng,h.fire("move",l).fire("drag",l)},_onDragEnd:function(l){Ve(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",l)}}),Xp=ur.extend({options:{icon:new xg,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(l,h){y(this,h),this._latlng=Ht(l)},onAdd:function(l){this._zoomAnimated=this._zoomAnimated&&l.options.markerZoomAnimation,this._zoomAnimated&&l.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(l){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&l.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(l){var h=this._latlng;return this._latlng=Ht(l),this.update(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},setZIndexOffset:function(l){return this.options.zIndexOffset=l,this.update()},getIcon:function(){return this.options.icon},setIcon:function(l){return this.options.icon=l,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var l=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(l)}return this},_initIcon:function(){var l=this.options,h="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),p=l.icon.createIcon(this._icon),b=!1;p!==this._icon&&(this._icon&&this._removeIcon(),b=!0,l.title&&(p.title=l.title),p.tagName==="IMG"&&(p.alt=l.alt||"")),ge(p,h),l.keyboard&&(p.tabIndex="0",p.setAttribute("role","button")),this._icon=p,l.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&vt(p,"focus",this._panOnFocus,this);var C=l.icon.createShadow(this._shadow),P=!1;C!==this._shadow&&(this._removeShadow(),P=!0),C&&(ge(C,h),C.alt=""),this._shadow=C,l.opacity<1&&this._updateOpacity(),b&&this.getPane().appendChild(this._icon),this._initInteraction(),C&&P&&this.getPane(l.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&si(this._icon,"focus",this._panOnFocus,this),ue(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ue(this._shadow),this._shadow=null},_setPos:function(l){this._icon&&Wt(this._icon,l),this._shadow&&Wt(this._shadow,l),this._zIndex=l.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(l){this._icon&&(this._icon.style.zIndex=this._zIndex+l)},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center).round();this._setPos(h)},_initInteraction:function(){if(this.options.interactive&&(ge(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),J1)){var l=this.options.draggable;this.dragging&&(l=this.dragging.enabled(),this.dragging.disable()),this.dragging=new J1(this),l&&this.dragging.enable()}},setOpacity:function(l){return this.options.opacity=l,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var l=this.options.opacity;this._icon&&Pi(this._icon,l),this._shadow&&Pi(this._shadow,l)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var l=this._map;if(l){var h=this.options.icon.options,p=h.iconSize?Fe(h.iconSize):Fe(0,0),b=h.iconAnchor?Fe(h.iconAnchor):Fe(0,0);l.panInside(this._latlng,{paddingTopLeft:b,paddingBottomRight:p.subtract(b)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function PR(l,h){return new Xp(l,h)}var dl=ur.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(l){this._renderer=l.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(l){return y(this,l),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&l&&Object.prototype.hasOwnProperty.call(l,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),Yp=dl.extend({options:{fill:!0,radius:10},initialize:function(l,h){y(this,h),this._latlng=Ht(l),this._radius=this.options.radius},setLatLng:function(l){var h=this._latlng;return this._latlng=Ht(l),this.redraw(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(l){return this.options.radius=this._radius=l,this.redraw()},getRadius:function(){return this._radius},setStyle:function(l){var h=l&&l.radius||this._radius;return dl.prototype.setStyle.call(this,l),this.setRadius(h),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var l=this._radius,h=this._radiusY||l,p=this._clickTolerance(),b=[l+p,h+p];this._pxBounds=new ft(this._point.subtract(b),this._point.add(b))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(l){return l.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function TR(l,h){return new Yp(l,h)}var kw=Yp.extend({initialize:function(l,h,p){if(typeof h=="number"&&(h=n({},p,{radius:h})),y(this,h),this._latlng=Ht(l),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(l){return this._mRadius=l,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var l=[this._radius,this._radiusY||this._radius];return new Gt(this._map.layerPointToLatLng(this._point.subtract(l)),this._map.layerPointToLatLng(this._point.add(l)))},setStyle:dl.prototype.setStyle,_project:function(){var l=this._latlng.lng,h=this._latlng.lat,p=this._map,b=p.options.crs;if(b.distance===zi.distance){var C=Math.PI/180,P=this._mRadius/zi.R/C,V=p.project([h+P,l]),te=p.project([h-P,l]),he=V.add(te).divideBy(2),We=p.unproject(he).lat,It=Math.acos((Math.cos(P*C)-Math.sin(h*C)*Math.sin(We*C))/(Math.cos(h*C)*Math.cos(We*C)))/C;(isNaN(It)||It===0)&&(It=P/Math.cos(Math.PI/180*h)),this._point=he.subtract(p.getPixelOrigin()),this._radius=isNaN(It)?0:he.x-p.project([We,l-It]).x,this._radiusY=he.y-V.y}else{var li=b.unproject(b.project(this._latlng).subtract([this._mRadius,0]));this._point=p.latLngToLayerPoint(this._latlng),this._radius=this._point.x-p.latLngToLayerPoint(li).x}this._updateBounds()}});function MR(l,h,p){return new kw(l,h,p)}var Ca=dl.extend({options:{smoothFactor:1,noClip:!1},initialize:function(l,h){y(this,h),this._setLatLngs(l)},getLatLngs:function(){return this._latlngs},setLatLngs:function(l){return this._setLatLngs(l),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(l){for(var h=1/0,p=null,b=_c,C,P,V=0,te=this._parts.length;V<te;V++)for(var he=this._parts[V],We=1,It=he.length;We<It;We++){C=he[We-1],P=he[We];var li=b(l,C,P,!0);li<h&&(h=li,p=b(l,C,P))}return p&&(p.distance=Math.sqrt(h)),p},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Ks(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(l,h){return h=h||this._defaultShape(),l=Ht(l),h.push(l),this._bounds.extend(l),this.redraw()},_setLatLngs:function(l){this._bounds=new Gt,this._latlngs=this._convertLatLngs(l)},_defaultShape:function(){return co(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(l){for(var h=[],p=co(l),b=0,C=l.length;b<C;b++)p?(h[b]=Ht(l[b]),this._bounds.extend(h[b])):h[b]=this._convertLatLngs(l[b]);return h},_project:function(){var l=new ft;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,l),this._bounds.isValid()&&l.isValid()&&(this._rawPxBounds=l,this._updateBounds())},_updateBounds:function(){var l=this._clickTolerance(),h=new Ie(l,l);this._rawPxBounds&&(this._pxBounds=new ft([this._rawPxBounds.min.subtract(h),this._rawPxBounds.max.add(h)]))},_projectLatlngs:function(l,h,p){var b=l[0]instanceof Vt,C=l.length,P,V;if(b){for(V=[],P=0;P<C;P++)V[P]=this._map.latLngToLayerPoint(l[P]),p.extend(V[P]);h.push(V)}else for(P=0;P<C;P++)this._projectLatlngs(l[P],h,p)},_clipPoints:function(){var l=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(l))){if(this.options.noClip){this._parts=this._rings;return}var h=this._parts,p,b,C,P,V,te,he;for(p=0,C=0,P=this._rings.length;p<P;p++)for(he=this._rings[p],b=0,V=he.length;b<V-1;b++)te=mc(he[b],he[b+1],l,b,!0),te&&(h[C]=h[C]||[],h[C].push(te[0]),(te[1]!==he[b+1]||b===V-2)&&(h[C].push(te[1]),C++))}},_simplifyPoints:function(){for(var l=this._parts,h=this.options.smoothFactor,p=0,b=l.length;p<b;p++)l[p]=ko(l[p],h)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(l,h){var p,b,C,P,V,te,he=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(p=0,P=this._parts.length;p<P;p++)for(te=this._parts[p],b=0,V=te.length,C=V-1;b<V;C=b++)if(!(!h&&b===0)&&Hr(l,te[C],te[b])<=he)return!0;return!1}});function NR(l,h){return new Ca(l,h)}Ca._flat=An;var vh=Ca.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return dr(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(l){var h=Ca.prototype._convertLatLngs.call(this,l),p=h.length;return p>=2&&h[0]instanceof Vt&&h[0].equals(h[p-1])&&h.pop(),h},_setLatLngs:function(l){Ca.prototype._setLatLngs.call(this,l),co(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return co(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var l=this._renderer._bounds,h=this.options.weight,p=new Ie(h,h);if(l=new ft(l.min.subtract(p),l.max.add(p)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(l))){if(this.options.noClip){this._parts=this._rings;return}for(var b=0,C=this._rings.length,P;b<C;b++)P=qs(this._rings[b],l,!0),P.length&&this._parts.push(P)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(l){var h=!1,p,b,C,P,V,te,he,We;if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(P=0,he=this._parts.length;P<he;P++)for(p=this._parts[P],V=0,We=p.length,te=We-1;V<We;te=V++)b=p[V],C=p[te],b.y>l.y!=C.y>l.y&&l.x<(C.x-b.x)*(l.y-b.y)/(C.y-b.y)+b.x&&(h=!h);return h||Ca.prototype._containsPoint.call(this,l,!0)}});function RR(l,h){return new vh(l,h)}var xa=Sa.extend({initialize:function(l,h){y(this,h),this._layers={},l&&this.addData(l)},addData:function(l){var h=N(l)?l:l.features,p,b,C;if(h){for(p=0,b=h.length;p<b;p++)C=h[p],(C.geometries||C.geometry||C.features||C.coordinates)&&this.addData(C);return this}var P=this.options;if(P.filter&&!P.filter(l))return this;var V=Jp(l,P);return V?(V.feature=tm(l),V.defaultOptions=V.options,this.resetStyle(V),P.onEachFeature&&P.onEachFeature(l,V),this.addLayer(V)):this},resetStyle:function(l){return l===void 0?this.eachLayer(this.resetStyle,this):(l.options=n({},l.defaultOptions),this._setLayerStyle(l,this.options.style),this)},setStyle:function(l){return this.eachLayer(function(h){this._setLayerStyle(h,l)},this)},_setLayerStyle:function(l,h){l.setStyle&&(typeof h=="function"&&(h=h(l.feature)),l.setStyle(h))}});function Jp(l,h){var p=l.type==="Feature"?l.geometry:l,b=p?p.coordinates:null,C=[],P=h&&h.pointToLayer,V=h&&h.coordsToLatLng||Dw,te,he,We,It;if(!b&&!p)return null;switch(p.type){case"Point":return te=V(b),Q1(P,l,te,h);case"MultiPoint":for(We=0,It=b.length;We<It;We++)te=V(b[We]),C.push(Q1(P,l,te,h));return new Sa(C);case"LineString":case"MultiLineString":return he=Qp(b,p.type==="LineString"?0:1,V),new Ca(he,h);case"Polygon":case"MultiPolygon":return he=Qp(b,p.type==="Polygon"?1:2,V),new vh(he,h);case"GeometryCollection":for(We=0,It=p.geometries.length;We<It;We++){var li=Jp({geometry:p.geometries[We],type:"Feature",properties:l.properties},h);li&&C.push(li)}return new Sa(C);case"FeatureCollection":for(We=0,It=p.features.length;We<It;We++){var ji=Jp(p.features[We],h);ji&&C.push(ji)}return new Sa(C);default:throw new Error("Invalid GeoJSON object.")}}function Q1(l,h,p,b){return l?l(h,p):new Xp(p,b&&b.markersInheritOptions&&b)}function Dw(l){return new Vt(l[1],l[0],l[2])}function Qp(l,h,p){for(var b=[],C=0,P=l.length,V;C<P;C++)V=h?Qp(l[C],h-1,p):(p||Dw)(l[C]),b.push(V);return b}function Ew(l,h){return l=Ht(l),l.alt!==void 0?[m(l.lng,h),m(l.lat,h),m(l.alt,h)]:[m(l.lng,h),m(l.lat,h)]}function em(l,h,p,b){for(var C=[],P=0,V=l.length;P<V;P++)C.push(h?em(l[P],co(l[P])?0:h-1,p,b):Ew(l[P],b));return!h&&p&&C.length>0&&C.push(C[0].slice()),C}function bh(l,h){return l.feature?n({},l.feature,{geometry:h}):tm(h)}function tm(l){return l.type==="Feature"||l.type==="FeatureCollection"?l:{type:"Feature",properties:{},geometry:l}}var Pw={toGeoJSON:function(l){return bh(this,{type:"Point",coordinates:Ew(this.getLatLng(),l)})}};Xp.include(Pw),kw.include(Pw),Yp.include(Pw),Ca.include({toGeoJSON:function(l){var h=!co(this._latlngs),p=em(this._latlngs,h?1:0,!1,l);return bh(this,{type:(h?"Multi":"")+"LineString",coordinates:p})}}),vh.include({toGeoJSON:function(l){var h=!co(this._latlngs),p=h&&!co(this._latlngs[0]),b=em(this._latlngs,p?2:h?1:0,!0,l);return h||(b=[b]),bh(this,{type:(p?"Multi":"")+"Polygon",coordinates:b})}}),mh.include({toMultiPoint:function(l){var h=[];return this.eachLayer(function(p){h.push(p.toGeoJSON(l).geometry.coordinates)}),bh(this,{type:"MultiPoint",coordinates:h})},toGeoJSON:function(l){var h=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(h==="MultiPoint")return this.toMultiPoint(l);var p=h==="GeometryCollection",b=[];return this.eachLayer(function(C){if(C.toGeoJSON){var P=C.toGeoJSON(l);if(p)b.push(P.geometry);else{var V=tm(P);V.type==="FeatureCollection"?b.push.apply(b,V.features):b.push(V)}}}),p?bh(this,{geometries:b,type:"GeometryCollection"}):{type:"FeatureCollection",features:b}}});function eL(l,h){return new xa(l,h)}var AR=eL,im=ur.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(l,h,p){this._url=l,this._bounds=ci(h),y(this,p)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ge(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ue(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(l){return this.options.opacity=l,this._image&&this._updateOpacity(),this},setStyle:function(l){return l.opacity&&this.setOpacity(l.opacity),this},bringToFront:function(){return this._map&&_e(this._image),this},bringToBack:function(){return this._map&&Ae(this._image),this},setUrl:function(l){return this._url=l,this._image&&(this._image.src=l),this},setBounds:function(l){return this._bounds=ci(l),this._map&&this._reset(),this},getEvents:function(){var l={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(l.zoomanim=this._animateZoom),l},setZIndex:function(l){return this.options.zIndex=l,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var l=this._url.tagName==="IMG",h=this._image=l?this._url:ae("img");if(ge(h,"leaflet-image-layer"),this._zoomAnimated&&ge(h,"leaflet-zoom-animated"),this.options.className&&ge(h,this.options.className),h.onselectstart=f,h.onmousemove=f,h.onload=r(this.fire,this,"load"),h.onerror=r(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(h.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),l){this._url=h.src;return}h.src=this._url,h.alt=this.options.alt},_animateZoom:function(l){var h=this._map.getZoomScale(l.zoom),p=this._map._latLngBoundsToNewLayerBounds(this._bounds,l.zoom,l.center).min;ai(this._image,p,h)},_reset:function(){var l=this._image,h=new ft(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),p=h.getSize();Wt(l,h.min),l.style.width=p.x+"px",l.style.height=p.y+"px"},_updateOpacity:function(){Pi(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var l=this.options.errorOverlayUrl;l&&this._url!==l&&(this._url=l,this._image.src=l)},getCenter:function(){return this._bounds.getCenter()}}),OR=function(l,h,p){return new im(l,h,p)},tL=im.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var l=this._url.tagName==="VIDEO",h=this._image=l?this._url:ae("video");if(ge(h,"leaflet-image-layer"),this._zoomAnimated&&ge(h,"leaflet-zoom-animated"),this.options.className&&ge(h,this.options.className),h.onselectstart=f,h.onmousemove=f,h.onloadeddata=r(this.fire,this,"load"),l){for(var p=h.getElementsByTagName("source"),b=[],C=0;C<p.length;C++)b.push(p[C].src);this._url=p.length>0?b:[h.src];return}N(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(h.style,"objectFit")&&(h.style.objectFit="fill"),h.autoplay=!!this.options.autoplay,h.loop=!!this.options.loop,h.muted=!!this.options.muted,h.playsInline=!!this.options.playsInline;for(var P=0;P<this._url.length;P++){var V=ae("source");V.src=this._url[P],h.appendChild(V)}}});function FR(l,h,p){return new tL(l,h,p)}var iL=im.extend({_initImage:function(){var l=this._image=this._url;ge(l,"leaflet-image-layer"),this._zoomAnimated&&ge(l,"leaflet-zoom-animated"),this.options.className&&ge(l,this.options.className),l.onselectstart=f,l.onmousemove=f}});function HR(l,h,p){return new iL(l,h,p)}var Br=ur.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(l,h){l&&(l instanceof Vt||N(l))?(this._latlng=Ht(l),y(this,h)):(y(this,l),this._source=h),this.options.content&&(this._content=this.options.content)},openOn:function(l){return l=arguments.length?l:this._source._map,l.hasLayer(this)||l.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(l){return this._map?this.close():(arguments.length?this._source=l:l=this._source,this._prepareOpen(),this.openOn(l._map)),this},onAdd:function(l){this._zoomAnimated=l._zoomAnimated,this._container||this._initLayout(),l._fadeAnimated&&Pi(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),l._fadeAnimated&&Pi(this._container,1),this.bringToFront(),this.options.interactive&&(ge(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(l){l._fadeAnimated?(Pi(this._container,0),this._removeTimeout=setTimeout(r(ue,void 0,this._container),200)):ue(this._container),this.options.interactive&&(et(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(l){return this._latlng=Ht(l),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(l){return this._content=l,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var l={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(l.zoomanim=this._animateZoom),l},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&_e(this._container),this},bringToBack:function(){return this._map&&Ae(this._container),this},_prepareOpen:function(l){var h=this._source;if(!h._map)return!1;if(h instanceof Sa){h=null;var p=this._source._layers;for(var b in p)if(p[b]._map){h=p[b];break}if(!h)return!1;this._source=h}if(!l)if(h.getCenter)l=h.getCenter();else if(h.getLatLng)l=h.getLatLng();else if(h.getBounds)l=h.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(l),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var l=this._contentNode,h=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof h=="string")l.innerHTML=h;else{for(;l.hasChildNodes();)l.removeChild(l.firstChild);l.appendChild(h)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var l=this._map.latLngToLayerPoint(this._latlng),h=Fe(this.options.offset),p=this._getAnchor();this._zoomAnimated?Wt(this._container,l.add(p)):h=h.add(l).add(p);var b=this._containerBottom=-h.y,C=this._containerLeft=-Math.round(this._containerWidth/2)+h.x;this._container.style.bottom=b+"px",this._container.style.left=C+"px"}},_getAnchor:function(){return[0,0]}});tn.include({_initOverlay:function(l,h,p,b){var C=h;return C instanceof l||(C=new l(b).setContent(h)),p&&C.setLatLng(p),C}}),ur.include({_initOverlay:function(l,h,p,b){var C=p;return C instanceof l?(y(C,b),C._source=this):(C=h&&!b?h:new l(b,this),C.setContent(p)),C}});var nm=Br.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(l){return l=arguments.length?l:this._source._map,!l.hasLayer(this)&&l._popup&&l._popup.options.autoClose&&l.removeLayer(l._popup),l._popup=this,Br.prototype.openOn.call(this,l)},onAdd:function(l){Br.prototype.onAdd.call(this,l),l.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof dl||this._source.on("preclick",ds))},onRemove:function(l){Br.prototype.onRemove.call(this,l),l.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof dl||this._source.off("preclick",ds))},getEvents:function(){var l=Br.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(l.preclick=this.close),this.options.keepInView&&(l.moveend=this._adjustPan),l},_initLayout:function(){var l="leaflet-popup",h=this._container=ae("div",l+" "+(this.options.className||"")+" leaflet-zoom-animated"),p=this._wrapper=ae("div",l+"-content-wrapper",h);if(this._contentNode=ae("div",l+"-content",p),lo(h),ao(this._contentNode),vt(h,"contextmenu",ds),this._tipContainer=ae("div",l+"-tip-container",h),this._tip=ae("div",l+"-tip",this._tipContainer),this.options.closeButton){var b=this._closeButton=ae("a",l+"-close-button",h);b.setAttribute("role","button"),b.setAttribute("aria-label","Close popup"),b.href="#close",b.innerHTML='<span aria-hidden="true">×</span>',vt(b,"click",function(C){Rn(C),this.close()},this)}},_updateLayout:function(){var l=this._contentNode,h=l.style;h.width="",h.whiteSpace="nowrap";var p=l.offsetWidth;p=Math.min(p,this.options.maxWidth),p=Math.max(p,this.options.minWidth),h.width=p+1+"px",h.whiteSpace="",h.height="";var b=l.offsetHeight,C=this.options.maxHeight,P="leaflet-popup-scrolled";C&&b>C?(h.height=C+"px",ge(l,P)):et(l,P),this._containerWidth=this._container.offsetWidth},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center),p=this._getAnchor();Wt(this._container,h.add(p))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var l=this._map,h=parseInt(we(this._container,"marginBottom"),10)||0,p=this._container.offsetHeight+h,b=this._containerWidth,C=new Ie(this._containerLeft,-p-this._containerBottom);C._add(hi(this._container));var P=l.layerPointToContainerPoint(C),V=Fe(this.options.autoPanPadding),te=Fe(this.options.autoPanPaddingTopLeft||V),he=Fe(this.options.autoPanPaddingBottomRight||V),We=l.getSize(),It=0,li=0;P.x+b+he.x>We.x&&(It=P.x+b-We.x+he.x),P.x-It-te.x<0&&(It=P.x-te.x),P.y+p+he.y>We.y&&(li=P.y+p-We.y+he.y),P.y-li-te.y<0&&(li=P.y-te.y),(It||li)&&(this.options.keepInView&&(this._autopanning=!0),l.fire("autopanstart").panBy([It,li]))}},_getAnchor:function(){return Fe(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),WR=function(l,h){return new nm(l,h)};tn.mergeOptions({closePopupOnClick:!0}),tn.include({openPopup:function(l,h,p){return this._initOverlay(nm,l,h,p).openOn(this),this},closePopup:function(l){return l=arguments.length?l:this._popup,l&&l.close(),this}}),ur.include({bindPopup:function(l,h){return this._popup=this._initOverlay(nm,this._popup,l,h),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(l){return this._popup&&(this instanceof Sa||(this._popup._source=this),this._popup._prepareOpen(l||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(l){return this._popup&&this._popup.setContent(l),this},getPopup:function(){return this._popup},_openPopup:function(l){if(!(!this._popup||!this._map)){$s(l);var h=l.layer||l.target;if(this._popup._source===h&&!(h instanceof dl)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(l.latlng);return}this._popup._source=h,this.openPopup(l.latlng)}},_movePopup:function(l){this._popup.setLatLng(l.latlng)},_onKeyPress:function(l){l.originalEvent.keyCode===13&&this._openPopup(l)}});var sm=Br.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(l){Br.prototype.onAdd.call(this,l),this.setOpacity(this.options.opacity),l.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(l){Br.prototype.onRemove.call(this,l),l.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var l=Br.prototype.getEvents.call(this);return this.options.permanent||(l.preclick=this.close),l},_initLayout:function(){var l="leaflet-tooltip",h=l+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ae("div",h),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+c(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(l){var h,p,b=this._map,C=this._container,P=b.latLngToContainerPoint(b.getCenter()),V=b.layerPointToContainerPoint(l),te=this.options.direction,he=C.offsetWidth,We=C.offsetHeight,It=Fe(this.options.offset),li=this._getAnchor();te==="top"?(h=he/2,p=We):te==="bottom"?(h=he/2,p=0):te==="center"?(h=he/2,p=We/2):te==="right"?(h=0,p=We/2):te==="left"?(h=he,p=We/2):V.x<P.x?(te="right",h=0,p=We/2):(te="left",h=he+(It.x+li.x)*2,p=We/2),l=l.subtract(Fe(h,p,!0)).add(It).add(li),et(C,"leaflet-tooltip-right"),et(C,"leaflet-tooltip-left"),et(C,"leaflet-tooltip-top"),et(C,"leaflet-tooltip-bottom"),ge(C,"leaflet-tooltip-"+te),Wt(C,l)},_updatePosition:function(){var l=this._map.latLngToLayerPoint(this._latlng);this._setPosition(l)},setOpacity:function(l){this.options.opacity=l,this._container&&Pi(this._container,l)},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center);this._setPosition(h)},_getAnchor:function(){return Fe(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),BR=function(l,h){return new sm(l,h)};tn.include({openTooltip:function(l,h,p){return this._initOverlay(sm,l,h,p).openOn(this),this},closeTooltip:function(l){return l.close(),this}}),ur.include({bindTooltip:function(l,h){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(sm,this._tooltip,l,h),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(l){if(!(!l&&this._tooltipHandlersAdded)){var h=l?"off":"on",p={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?p.add=this._openTooltip:(p.mouseover=this._openTooltip,p.mouseout=this.closeTooltip,p.click=this._openTooltip,this._map?this._addFocusListeners():p.add=this._addFocusListeners),this._tooltip.options.sticky&&(p.mousemove=this._moveTooltip),this[h](p),this._tooltipHandlersAdded=!l}},openTooltip:function(l){return this._tooltip&&(this instanceof Sa||(this._tooltip._source=this),this._tooltip._prepareOpen(l)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(l){return this._tooltip&&this._tooltip.setContent(l),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(l){var h=typeof l.getElement=="function"&&l.getElement();h&&(vt(h,"focus",function(){this._tooltip._source=l,this.openTooltip()},this),vt(h,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(l){var h=typeof l.getElement=="function"&&l.getElement();h&&h.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(l){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var h=this;this._map.once("moveend",function(){h._openOnceFlag=!1,h._openTooltip(l)});return}this._tooltip._source=l.layer||l.target,this.openTooltip(this._tooltip.options.sticky?l.latlng:void 0)}},_moveTooltip:function(l){var h=l.latlng,p,b;this._tooltip.options.sticky&&l.originalEvent&&(p=this._map.mouseEventToContainerPoint(l.originalEvent),b=this._map.containerPointToLayerPoint(p),h=this._map.layerPointToLatLng(b)),this._tooltip.setLatLng(h)}});var nL=_h.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(l){var h=l&&l.tagName==="DIV"?l:document.createElement("div"),p=this.options;if(p.html instanceof Element?(Re(h),h.appendChild(p.html)):h.innerHTML=p.html!==!1?p.html:"",p.bgPos){var b=Fe(p.bgPos);h.style.backgroundPosition=-b.x+"px "+-b.y+"px"}return this._setIconStyles(h,"icon"),h},createShadow:function(){return null}});function zR(l){return new nL(l)}_h.Default=xg;var Lg=ur.extend({options:{tileSize:256,opacity:1,updateWhenIdle:Ce.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(l){y(this,l)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(l){l._addZoomLimit(this)},onRemove:function(l){this._removeAllTiles(),ue(this._container),l._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(_e(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Ae(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(l){return this.options.opacity=l,this._updateOpacity(),this},setZIndex:function(l){return this.options.zIndex=l,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var l=this._clampZoom(this._map.getZoom());l!==this._tileZoom&&(this._tileZoom=l,this._updateLevels()),this._update()}return this},getEvents:function(){var l={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=d(this._onMoveEnd,this.options.updateInterval,this)),l.move=this._onMove),this._zoomAnimated&&(l.zoomanim=this._animateZoom),l},createTile:function(){return document.createElement("div")},getTileSize:function(){var l=this.options.tileSize;return l instanceof Ie?l:new Ie(l,l)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(l){for(var h=this.getPane().children,p=-l(-1/0,1/0),b=0,C=h.length,P;b<C;b++)P=h[b].style.zIndex,h[b]!==this._container&&P&&(p=l(p,+P));isFinite(p)&&(this.options.zIndex=p+l(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Ce.ielt9){Pi(this._container,this.options.opacity);var l=+new Date,h=!1,p=!1;for(var b in this._tiles){var C=this._tiles[b];if(!(!C.current||!C.loaded)){var P=Math.min(1,(l-C.loaded)/200);Pi(C.el,P),P<1?h=!0:(C.active?p=!0:this._onOpaqueTile(C),C.active=!0)}}p&&!this._noPrune&&this._pruneTiles(),h&&(Ve(this._fadeFrame),this._fadeFrame=me(this._updateOpacity,this))}},_onOpaqueTile:f,_initContainer:function(){this._container||(this._container=ae("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var l=this._tileZoom,h=this.options.maxZoom;if(l!==void 0){for(var p in this._levels)p=Number(p),this._levels[p].el.children.length||p===l?(this._levels[p].el.style.zIndex=h-Math.abs(l-p),this._onUpdateLevel(p)):(ue(this._levels[p].el),this._removeTilesAtZoom(p),this._onRemoveLevel(p),delete this._levels[p]);var b=this._levels[l],C=this._map;return b||(b=this._levels[l]={},b.el=ae("div","leaflet-tile-container leaflet-zoom-animated",this._container),b.el.style.zIndex=h,b.origin=C.project(C.unproject(C.getPixelOrigin()),l).round(),b.zoom=l,this._setZoomTransform(b,C.getCenter(),C.getZoom()),f(b.el.offsetWidth),this._onCreateLevel(b)),this._level=b,b}},_onUpdateLevel:f,_onRemoveLevel:f,_onCreateLevel:f,_pruneTiles:function(){if(this._map){var l,h,p=this._map.getZoom();if(p>this.options.maxZoom||p<this.options.minZoom){this._removeAllTiles();return}for(l in this._tiles)h=this._tiles[l],h.retain=h.current;for(l in this._tiles)if(h=this._tiles[l],h.current&&!h.active){var b=h.coords;this._retainParent(b.x,b.y,b.z,b.z-5)||this._retainChildren(b.x,b.y,b.z,b.z+2)}for(l in this._tiles)this._tiles[l].retain||this._removeTile(l)}},_removeTilesAtZoom:function(l){for(var h in this._tiles)this._tiles[h].coords.z===l&&this._removeTile(h)},_removeAllTiles:function(){for(var l in this._tiles)this._removeTile(l)},_invalidateAll:function(){for(var l in this._levels)ue(this._levels[l].el),this._onRemoveLevel(Number(l)),delete this._levels[l];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(l,h,p,b){var C=Math.floor(l/2),P=Math.floor(h/2),V=p-1,te=new Ie(+C,+P);te.z=+V;var he=this._tileCoordsToKey(te),We=this._tiles[he];return We&&We.active?(We.retain=!0,!0):(We&&We.loaded&&(We.retain=!0),V>b?this._retainParent(C,P,V,b):!1)},_retainChildren:function(l,h,p,b){for(var C=2*l;C<2*l+2;C++)for(var P=2*h;P<2*h+2;P++){var V=new Ie(C,P);V.z=p+1;var te=this._tileCoordsToKey(V),he=this._tiles[te];if(he&&he.active){he.retain=!0;continue}else he&&he.loaded&&(he.retain=!0);p+1<b&&this._retainChildren(C,P,p+1,b)}},_resetView:function(l){var h=l&&(l.pinch||l.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),h,h)},_animateZoom:function(l){this._setView(l.center,l.zoom,!0,l.noUpdate)},_clampZoom:function(l){var h=this.options;return h.minNativeZoom!==void 0&&l<h.minNativeZoom?h.minNativeZoom:h.maxNativeZoom!==void 0&&h.maxNativeZoom<l?h.maxNativeZoom:l},_setView:function(l,h,p,b){var C=Math.round(h);this.options.maxZoom!==void 0&&C>this.options.maxZoom||this.options.minZoom!==void 0&&C<this.options.minZoom?C=void 0:C=this._clampZoom(C);var P=this.options.updateWhenZooming&&C!==this._tileZoom;(!b||P)&&(this._tileZoom=C,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),C!==void 0&&this._update(l),p||this._pruneTiles(),this._noPrune=!!p),this._setZoomTransforms(l,h)},_setZoomTransforms:function(l,h){for(var p in this._levels)this._setZoomTransform(this._levels[p],l,h)},_setZoomTransform:function(l,h,p){var b=this._map.getZoomScale(p,l.zoom),C=l.origin.multiplyBy(b).subtract(this._map._getNewPixelOrigin(h,p)).round();Ce.any3d?ai(l.el,C,b):Wt(l.el,C)},_resetGrid:function(){var l=this._map,h=l.options.crs,p=this._tileSize=this.getTileSize(),b=this._tileZoom,C=this._map.getPixelWorldBounds(this._tileZoom);C&&(this._globalTileRange=this._pxBoundsToTileRange(C)),this._wrapX=h.wrapLng&&!this.options.noWrap&&[Math.floor(l.project([0,h.wrapLng[0]],b).x/p.x),Math.ceil(l.project([0,h.wrapLng[1]],b).x/p.y)],this._wrapY=h.wrapLat&&!this.options.noWrap&&[Math.floor(l.project([h.wrapLat[0],0],b).y/p.x),Math.ceil(l.project([h.wrapLat[1],0],b).y/p.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(l){var h=this._map,p=h._animatingZoom?Math.max(h._animateToZoom,h.getZoom()):h.getZoom(),b=h.getZoomScale(p,this._tileZoom),C=h.project(l,this._tileZoom).floor(),P=h.getSize().divideBy(b*2);return new ft(C.subtract(P),C.add(P))},_update:function(l){var h=this._map;if(h){var p=this._clampZoom(h.getZoom());if(l===void 0&&(l=h.getCenter()),this._tileZoom!==void 0){var b=this._getTiledPixelBounds(l),C=this._pxBoundsToTileRange(b),P=C.getCenter(),V=[],te=this.options.keepBuffer,he=new ft(C.getBottomLeft().subtract([te,-te]),C.getTopRight().add([te,-te]));if(!(isFinite(C.min.x)&&isFinite(C.min.y)&&isFinite(C.max.x)&&isFinite(C.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var We in this._tiles){var It=this._tiles[We].coords;(It.z!==this._tileZoom||!he.contains(new Ie(It.x,It.y)))&&(this._tiles[We].current=!1)}if(Math.abs(p-this._tileZoom)>1){this._setView(l,p);return}for(var li=C.min.y;li<=C.max.y;li++)for(var ji=C.min.x;ji<=C.max.x;ji++){var Gs=new Ie(ji,li);if(Gs.z=this._tileZoom,!!this._isValidTile(Gs)){var ys=this._tiles[this._tileCoordsToKey(Gs)];ys?ys.current=!0:V.push(Gs)}}if(V.sort(function(ho,yh){return ho.distanceTo(P)-yh.distanceTo(P)}),V.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Bo=document.createDocumentFragment();for(ji=0;ji<V.length;ji++)this._addTile(V[ji],Bo);this._level.el.appendChild(Bo)}}}},_isValidTile:function(l){var h=this._map.options.crs;if(!h.infinite){var p=this._globalTileRange;if(!h.wrapLng&&(l.x<p.min.x||l.x>p.max.x)||!h.wrapLat&&(l.y<p.min.y||l.y>p.max.y))return!1}if(!this.options.bounds)return!0;var b=this._tileCoordsToBounds(l);return ci(this.options.bounds).overlaps(b)},_keyToBounds:function(l){return this._tileCoordsToBounds(this._keyToTileCoords(l))},_tileCoordsToNwSe:function(l){var h=this._map,p=this.getTileSize(),b=l.scaleBy(p),C=b.add(p),P=h.unproject(b,l.z),V=h.unproject(C,l.z);return[P,V]},_tileCoordsToBounds:function(l){var h=this._tileCoordsToNwSe(l),p=new Gt(h[0],h[1]);return this.options.noWrap||(p=this._map.wrapLatLngBounds(p)),p},_tileCoordsToKey:function(l){return l.x+":"+l.y+":"+l.z},_keyToTileCoords:function(l){var h=l.split(":"),p=new Ie(+h[0],+h[1]);return p.z=+h[2],p},_removeTile:function(l){var h=this._tiles[l];h&&(ue(h.el),delete this._tiles[l],this.fire("tileunload",{tile:h.el,coords:this._keyToTileCoords(l)}))},_initTile:function(l){ge(l,"leaflet-tile");var h=this.getTileSize();l.style.width=h.x+"px",l.style.height=h.y+"px",l.onselectstart=f,l.onmousemove=f,Ce.ielt9&&this.options.opacity<1&&Pi(l,this.options.opacity)},_addTile:function(l,h){var p=this._getTilePos(l),b=this._tileCoordsToKey(l),C=this.createTile(this._wrapCoords(l),r(this._tileReady,this,l));this._initTile(C),this.createTile.length<2&&me(r(this._tileReady,this,l,null,C)),Wt(C,p),this._tiles[b]={el:C,coords:l,current:!0},h.appendChild(C),this.fire("tileloadstart",{tile:C,coords:l})},_tileReady:function(l,h,p){h&&this.fire("tileerror",{error:h,tile:p,coords:l});var b=this._tileCoordsToKey(l);p=this._tiles[b],p&&(p.loaded=+new Date,this._map._fadeAnimated?(Pi(p.el,0),Ve(this._fadeFrame),this._fadeFrame=me(this._updateOpacity,this)):(p.active=!0,this._pruneTiles()),h||(ge(p.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:p.el,coords:l})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Ce.ielt9||!this._map._fadeAnimated?me(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(l){return l.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(l){var h=new Ie(this._wrapX?u(l.x,this._wrapX):l.x,this._wrapY?u(l.y,this._wrapY):l.y);return h.z=l.z,h},_pxBoundsToTileRange:function(l){var h=this.getTileSize();return new ft(l.min.unscaleBy(h).floor(),l.max.unscaleBy(h).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var l in this._tiles)if(!this._tiles[l].loaded)return!1;return!0}});function VR(l){return new Lg(l)}var wh=Lg.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(l,h){this._url=l,h=y(this,h),h.detectRetina&&Ce.retina&&h.maxZoom>0?(h.tileSize=Math.floor(h.tileSize/2),h.zoomReverse?(h.zoomOffset--,h.minZoom=Math.min(h.maxZoom,h.minZoom+1)):(h.zoomOffset++,h.maxZoom=Math.max(h.minZoom,h.maxZoom-1)),h.minZoom=Math.max(0,h.minZoom)):h.zoomReverse?h.minZoom=Math.min(h.maxZoom,h.minZoom):h.maxZoom=Math.max(h.minZoom,h.maxZoom),typeof h.subdomains=="string"&&(h.subdomains=h.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(l,h){return this._url===l&&h===void 0&&(h=!0),this._url=l,h||this.redraw(),this},createTile:function(l,h){var p=document.createElement("img");return vt(p,"load",r(this._tileOnLoad,this,h,p)),vt(p,"error",r(this._tileOnError,this,h,p)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(p.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(p.referrerPolicy=this.options.referrerPolicy),p.alt="",p.src=this.getTileUrl(l),p},getTileUrl:function(l){var h={r:Ce.retina?"@2x":"",s:this._getSubdomain(l),x:l.x,y:l.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var p=this._globalTileRange.max.y-l.y;this.options.tms&&(h.y=p),h["-y"]=p}return E(this._url,n(h,this.options))},_tileOnLoad:function(l,h){Ce.ielt9?setTimeout(r(l,this,null,h),0):l(null,h)},_tileOnError:function(l,h,p){var b=this.options.errorTileUrl;b&&h.getAttribute("src")!==b&&(h.src=b),l(p,h)},_onTileRemove:function(l){l.tile.onload=null},_getZoomForUrl:function(){var l=this._tileZoom,h=this.options.maxZoom,p=this.options.zoomReverse,b=this.options.zoomOffset;return p&&(l=h-l),l+b},_getSubdomain:function(l){var h=Math.abs(l.x+l.y)%this.options.subdomains.length;return this.options.subdomains[h]},_abortLoading:function(){var l,h;for(l in this._tiles)if(this._tiles[l].coords.z!==this._tileZoom&&(h=this._tiles[l].el,h.onload=f,h.onerror=f,!h.complete)){h.src=F;var p=this._tiles[l].coords;ue(h),delete this._tiles[l],this.fire("tileabort",{tile:h,coords:p})}},_removeTile:function(l){var h=this._tiles[l];if(h)return h.el.setAttribute("src",F),Lg.prototype._removeTile.call(this,l)},_tileReady:function(l,h,p){if(!(!this._map||p&&p.getAttribute("src")===F))return Lg.prototype._tileReady.call(this,l,h,p)}});function sL(l,h){return new wh(l,h)}var oL=wh.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(l,h){this._url=l;var p=n({},this.defaultWmsParams);for(var b in h)b in this.options||(p[b]=h[b]);h=y(this,h);var C=h.detectRetina&&Ce.retina?2:1,P=this.getTileSize();p.width=P.x*C,p.height=P.y*C,this.wmsParams=p},onAdd:function(l){this._crs=this.options.crs||l.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var h=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[h]=this._crs.code,wh.prototype.onAdd.call(this,l)},getTileUrl:function(l){var h=this._tileCoordsToNwSe(l),p=this._crs,b=zt(p.project(h[0]),p.project(h[1])),C=b.min,P=b.max,V=(this._wmsVersion>=1.3&&this._crs===Y1?[C.y,C.x,P.y,P.x]:[C.x,C.y,P.x,P.y]).join(","),te=wh.prototype.getTileUrl.call(this,l);return te+S(this.wmsParams,te,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+V},setParams:function(l,h){return n(this.wmsParams,l),h||this.redraw(),this}});function jR(l,h){return new oL(l,h)}wh.WMS=oL,sL.wms=jR;var La=ur.extend({options:{padding:.1},initialize:function(l){y(this,l),c(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),ge(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var l={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(l.zoomanim=this._onAnimZoom),l},_onAnimZoom:function(l){this._updateTransform(l.center,l.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(l,h){var p=this._map.getZoomScale(h,this._zoom),b=this._map.getSize().multiplyBy(.5+this.options.padding),C=this._map.project(this._center,h),P=b.multiplyBy(-p).add(C).subtract(this._map._getNewPixelOrigin(l,h));Ce.any3d?ai(this._container,P,p):Wt(this._container,P)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var l in this._layers)this._layers[l]._reset()},_onZoomEnd:function(){for(var l in this._layers)this._layers[l]._project()},_updatePaths:function(){for(var l in this._layers)this._layers[l]._update()},_update:function(){var l=this.options.padding,h=this._map.getSize(),p=this._map.containerPointToLayerPoint(h.multiplyBy(-l)).round();this._bounds=new ft(p,p.add(h.multiplyBy(1+l*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),rL=La.extend({options:{tolerance:0},getEvents:function(){var l=La.prototype.getEvents.call(this);return l.viewprereset=this._onViewPreReset,l},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){La.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var l=this._container=document.createElement("canvas");vt(l,"mousemove",this._onMouseMove,this),vt(l,"click dblclick mousedown mouseup contextmenu",this._onClick,this),vt(l,"mouseout",this._handleMouseOut,this),l._leaflet_disable_events=!0,this._ctx=l.getContext("2d")},_destroyContainer:function(){Ve(this._redrawRequest),delete this._ctx,ue(this._container),si(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var l;this._redrawBounds=null;for(var h in this._layers)l=this._layers[h],l._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){La.prototype._update.call(this);var l=this._bounds,h=this._container,p=l.getSize(),b=Ce.retina?2:1;Wt(h,l.min),h.width=b*p.x,h.height=b*p.y,h.style.width=p.x+"px",h.style.height=p.y+"px",Ce.retina&&this._ctx.scale(2,2),this._ctx.translate(-l.min.x,-l.min.y),this.fire("update")}},_reset:function(){La.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(l){this._updateDashArray(l),this._layers[c(l)]=l;var h=l._order={layer:l,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=h),this._drawLast=h,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(l){this._requestRedraw(l)},_removePath:function(l){var h=l._order,p=h.next,b=h.prev;p?p.prev=b:this._drawLast=b,b?b.next=p:this._drawFirst=p,delete l._order,delete this._layers[c(l)],this._requestRedraw(l)},_updatePath:function(l){this._extendRedrawBounds(l),l._project(),l._update(),this._requestRedraw(l)},_updateStyle:function(l){this._updateDashArray(l),this._requestRedraw(l)},_updateDashArray:function(l){if(typeof l.options.dashArray=="string"){var h=l.options.dashArray.split(/[, ]+/),p=[],b,C;for(C=0;C<h.length;C++){if(b=Number(h[C]),isNaN(b))return;p.push(b)}l.options._dashArray=p}else l.options._dashArray=l.options.dashArray},_requestRedraw:function(l){this._map&&(this._extendRedrawBounds(l),this._redrawRequest=this._redrawRequest||me(this._redraw,this))},_extendRedrawBounds:function(l){if(l._pxBounds){var h=(l.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new ft,this._redrawBounds.extend(l._pxBounds.min.subtract([h,h])),this._redrawBounds.extend(l._pxBounds.max.add([h,h]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var l=this._redrawBounds;if(l){var h=l.getSize();this._ctx.clearRect(l.min.x,l.min.y,h.x,h.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var l,h=this._redrawBounds;if(this._ctx.save(),h){var p=h.getSize();this._ctx.beginPath(),this._ctx.rect(h.min.x,h.min.y,p.x,p.y),this._ctx.clip()}this._drawing=!0;for(var b=this._drawFirst;b;b=b.next)l=b.layer,(!h||l._pxBounds&&l._pxBounds.intersects(h))&&l._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(l,h){if(this._drawing){var p,b,C,P,V=l._parts,te=V.length,he=this._ctx;if(te){for(he.beginPath(),p=0;p<te;p++){for(b=0,C=V[p].length;b<C;b++)P=V[p][b],he[b?"lineTo":"moveTo"](P.x,P.y);h&&he.closePath()}this._fillStroke(he,l)}}},_updateCircle:function(l){if(!(!this._drawing||l._empty())){var h=l._point,p=this._ctx,b=Math.max(Math.round(l._radius),1),C=(Math.max(Math.round(l._radiusY),1)||b)/b;C!==1&&(p.save(),p.scale(1,C)),p.beginPath(),p.arc(h.x,h.y/C,b,0,Math.PI*2,!1),C!==1&&p.restore(),this._fillStroke(p,l)}},_fillStroke:function(l,h){var p=h.options;p.fill&&(l.globalAlpha=p.fillOpacity,l.fillStyle=p.fillColor||p.color,l.fill(p.fillRule||"evenodd")),p.stroke&&p.weight!==0&&(l.setLineDash&&l.setLineDash(h.options&&h.options._dashArray||[]),l.globalAlpha=p.opacity,l.lineWidth=p.weight,l.strokeStyle=p.color,l.lineCap=p.lineCap,l.lineJoin=p.lineJoin,l.stroke())},_onClick:function(l){for(var h=this._map.mouseEventToLayerPoint(l),p,b,C=this._drawFirst;C;C=C.next)p=C.layer,p.options.interactive&&p._containsPoint(h)&&(!(l.type==="click"||l.type==="preclick")||!this._map._draggableMoved(p))&&(b=p);this._fireEvent(b?[b]:!1,l)},_onMouseMove:function(l){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var h=this._map.mouseEventToLayerPoint(l);this._handleMouseHover(l,h)}},_handleMouseOut:function(l){var h=this._hoveredLayer;h&&(et(this._container,"leaflet-interactive"),this._fireEvent([h],l,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(l,h){if(!this._mouseHoverThrottled){for(var p,b,C=this._drawFirst;C;C=C.next)p=C.layer,p.options.interactive&&p._containsPoint(h)&&(b=p);b!==this._hoveredLayer&&(this._handleMouseOut(l),b&&(ge(this._container,"leaflet-interactive"),this._fireEvent([b],l,"mouseover"),this._hoveredLayer=b)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,l),this._mouseHoverThrottled=!0,setTimeout(r(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(l,h,p){this._map._fireDOMEvent(h,p||h.type,l)},_bringToFront:function(l){var h=l._order;if(h){var p=h.next,b=h.prev;if(p)p.prev=b;else return;b?b.next=p:p&&(this._drawFirst=p),h.prev=this._drawLast,this._drawLast.next=h,h.next=null,this._drawLast=h,this._requestRedraw(l)}},_bringToBack:function(l){var h=l._order;if(h){var p=h.next,b=h.prev;if(b)b.next=p;else return;p?p.prev=b:b&&(this._drawLast=b),h.prev=null,h.next=this._drawFirst,this._drawFirst.prev=h,this._drawFirst=h,this._requestRedraw(l)}}});function aL(l){return Ce.canvas?new rL(l):null}var Ig=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(l){return document.createElement("<lvml:"+l+' class="lvml">')}}catch{}return function(l){return document.createElement("<"+l+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),UR={_initContainer:function(){this._container=ae("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(La.prototype._update.call(this),this.fire("update"))},_initPath:function(l){var h=l._container=Ig("shape");ge(h,"leaflet-vml-shape "+(this.options.className||"")),h.coordsize="1 1",l._path=Ig("path"),h.appendChild(l._path),this._updateStyle(l),this._layers[c(l)]=l},_addPath:function(l){var h=l._container;this._container.appendChild(h),l.options.interactive&&l.addInteractiveTarget(h)},_removePath:function(l){var h=l._container;ue(h),l.removeInteractiveTarget(h),delete this._layers[c(l)]},_updateStyle:function(l){var h=l._stroke,p=l._fill,b=l.options,C=l._container;C.stroked=!!b.stroke,C.filled=!!b.fill,b.stroke?(h||(h=l._stroke=Ig("stroke")),C.appendChild(h),h.weight=b.weight+"px",h.color=b.color,h.opacity=b.opacity,b.dashArray?h.dashStyle=N(b.dashArray)?b.dashArray.join(" "):b.dashArray.replace(/( *, *)/g," "):h.dashStyle="",h.endcap=b.lineCap.replace("butt","flat"),h.joinstyle=b.lineJoin):h&&(C.removeChild(h),l._stroke=null),b.fill?(p||(p=l._fill=Ig("fill")),C.appendChild(p),p.color=b.fillColor||b.color,p.opacity=b.fillOpacity):p&&(C.removeChild(p),l._fill=null)},_updateCircle:function(l){var h=l._point.round(),p=Math.round(l._radius),b=Math.round(l._radiusY||p);this._setPath(l,l._empty()?"M0 0":"AL "+h.x+","+h.y+" "+p+","+b+" 0,"+65535*360)},_setPath:function(l,h){l._path.v=h},_bringToFront:function(l){_e(l._container)},_bringToBack:function(l){Ae(l._container)}},om=Ce.vml?Ig:Ji,kg=La.extend({_initContainer:function(){this._container=om("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=om("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ue(this._container),si(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){La.prototype._update.call(this);var l=this._bounds,h=l.getSize(),p=this._container;(!this._svgSize||!this._svgSize.equals(h))&&(this._svgSize=h,p.setAttribute("width",h.x),p.setAttribute("height",h.y)),Wt(p,l.min),p.setAttribute("viewBox",[l.min.x,l.min.y,h.x,h.y].join(" ")),this.fire("update")}},_initPath:function(l){var h=l._path=om("path");l.options.className&&ge(h,l.options.className),l.options.interactive&&ge(h,"leaflet-interactive"),this._updateStyle(l),this._layers[c(l)]=l},_addPath:function(l){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(l._path),l.addInteractiveTarget(l._path)},_removePath:function(l){ue(l._path),l.removeInteractiveTarget(l._path),delete this._layers[c(l)]},_updatePath:function(l){l._project(),l._update()},_updateStyle:function(l){var h=l._path,p=l.options;h&&(p.stroke?(h.setAttribute("stroke",p.color),h.setAttribute("stroke-opacity",p.opacity),h.setAttribute("stroke-width",p.weight),h.setAttribute("stroke-linecap",p.lineCap),h.setAttribute("stroke-linejoin",p.lineJoin),p.dashArray?h.setAttribute("stroke-dasharray",p.dashArray):h.removeAttribute("stroke-dasharray"),p.dashOffset?h.setAttribute("stroke-dashoffset",p.dashOffset):h.removeAttribute("stroke-dashoffset")):h.setAttribute("stroke","none"),p.fill?(h.setAttribute("fill",p.fillColor||p.color),h.setAttribute("fill-opacity",p.fillOpacity),h.setAttribute("fill-rule",p.fillRule||"evenodd")):h.setAttribute("fill","none"))},_updatePoly:function(l,h){this._setPath(l,Ui(l._parts,h))},_updateCircle:function(l){var h=l._point,p=Math.max(Math.round(l._radius),1),b=Math.max(Math.round(l._radiusY),1)||p,C="a"+p+","+b+" 0 1,0 ",P=l._empty()?"M0 0":"M"+(h.x-p)+","+h.y+C+p*2+",0 "+C+-p*2+",0 ";this._setPath(l,P)},_setPath:function(l,h){l._path.setAttribute("d",h)},_bringToFront:function(l){_e(l._path)},_bringToBack:function(l){Ae(l._path)}});Ce.vml&&kg.include(UR);function lL(l){return Ce.svg||Ce.vml?new kg(l):null}tn.include({getRenderer:function(l){var h=l.options.renderer||this._getPaneRenderer(l.options.pane)||this.options.renderer||this._renderer;return h||(h=this._renderer=this._createRenderer()),this.hasLayer(h)||this.addLayer(h),h},_getPaneRenderer:function(l){if(l==="overlayPane"||l===void 0)return!1;var h=this._paneRenderers[l];return h===void 0&&(h=this._createRenderer({pane:l}),this._paneRenderers[l]=h),h},_createRenderer:function(l){return this.options.preferCanvas&&aL(l)||lL(l)}});var cL=vh.extend({initialize:function(l,h){vh.prototype.initialize.call(this,this._boundsToLatLngs(l),h)},setBounds:function(l){return this.setLatLngs(this._boundsToLatLngs(l))},_boundsToLatLngs:function(l){return l=ci(l),[l.getSouthWest(),l.getNorthWest(),l.getNorthEast(),l.getSouthEast()]}});function $R(l,h){return new cL(l,h)}kg.create=om,kg.pointsToPath=Ui,xa.geometryToLayer=Jp,xa.coordsToLatLng=Dw,xa.coordsToLatLngs=Qp,xa.latLngToCoords=Ew,xa.latLngsToCoords=em,xa.getFeature=bh,xa.asFeature=tm,tn.mergeOptions({boxZoom:!0});var dL=Yt.extend({initialize:function(l){this._map=l,this._container=l._container,this._pane=l._panes.overlayPane,this._resetStateTimeout=0,l.on("unload",this._destroy,this)},addHooks:function(){vt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){si(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ue(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(l){if(!l.shiftKey||l.which!==1&&l.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),ki(),ke(),this._startPoint=this._map.mouseEventToContainerPoint(l),vt(document,{contextmenu:$s,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(l){this._moved||(this._moved=!0,this._box=ae("div","leaflet-zoom-box",this._container),ge(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(l);var h=new ft(this._point,this._startPoint),p=h.getSize();Wt(this._box,h.min),this._box.style.width=p.x+"px",this._box.style.height=p.y+"px"},_finish:function(){this._moved&&(ue(this._box),et(this._container,"leaflet-crosshair")),St(),Nt(),si(document,{contextmenu:$s,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(l){if(!(l.which!==1&&l.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0);var h=new Gt(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(h).fire("boxzoomend",{boxZoomBounds:h})}},_onKeyDown:function(l){l.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});tn.addInitHook("addHandler","boxZoom",dL),tn.mergeOptions({doubleClickZoom:!0});var hL=Yt.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(l){var h=this._map,p=h.getZoom(),b=h.options.zoomDelta,C=l.originalEvent.shiftKey?p-b:p+b;h.options.doubleClickZoom==="center"?h.setZoom(C):h.setZoomAround(l.containerPoint,C)}});tn.addInitHook("addHandler","doubleClickZoom",hL),tn.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var uL=Yt.extend({addHooks:function(){if(!this._draggable){var l=this._map;this._draggable=new $n(l._mapPane,l._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),l.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),l.on("zoomend",this._onZoomEnd,this),l.whenReady(this._onZoomEnd,this))}ge(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){et(this._map._container,"leaflet-grab"),et(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var l=this._map;if(l._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var h=ci(this._map.options.maxBounds);this._offsetLimit=zt(this._map.latLngToContainerPoint(h.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(h.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;l.fire("movestart").fire("dragstart"),l.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(l){if(this._map.options.inertia){var h=this._lastTime=+new Date,p=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(p),this._times.push(h),this._prunePositions(h)}this._map.fire("move",l).fire("drag",l)},_prunePositions:function(l){for(;this._positions.length>1&&l-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var l=this._map.getSize().divideBy(2),h=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=h.subtract(l).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(l,h){return l-(l-h)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var l=this._draggable._newPos.subtract(this._draggable._startPos),h=this._offsetLimit;l.x<h.min.x&&(l.x=this._viscousLimit(l.x,h.min.x)),l.y<h.min.y&&(l.y=this._viscousLimit(l.y,h.min.y)),l.x>h.max.x&&(l.x=this._viscousLimit(l.x,h.max.x)),l.y>h.max.y&&(l.y=this._viscousLimit(l.y,h.max.y)),this._draggable._newPos=this._draggable._startPos.add(l)}},_onPreDragWrap:function(){var l=this._worldWidth,h=Math.round(l/2),p=this._initialWorldOffset,b=this._draggable._newPos.x,C=(b-h+p)%l+h-p,P=(b+h+p)%l-h-p,V=Math.abs(C+p)<Math.abs(P+p)?C:P;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=V},_onDragEnd:function(l){var h=this._map,p=h.options,b=!p.inertia||l.noInertia||this._times.length<2;if(h.fire("dragend",l),b)h.fire("moveend");else{this._prunePositions(+new Date);var C=this._lastPos.subtract(this._positions[0]),P=(this._lastTime-this._times[0])/1e3,V=p.easeLinearity,te=C.multiplyBy(V/P),he=te.distanceTo([0,0]),We=Math.min(p.inertiaMaxSpeed,he),It=te.multiplyBy(We/he),li=We/(p.inertiaDeceleration*V),ji=It.multiplyBy(-li/2).round();!ji.x&&!ji.y?h.fire("moveend"):(ji=h._limitOffset(ji,h.options.maxBounds),me(function(){h.panBy(ji,{duration:li,easeLinearity:V,noMoveStart:!0,animate:!0})}))}}});tn.addInitHook("addHandler","dragging",uL),tn.mergeOptions({keyboard:!0,keyboardPanDelta:80});var gL=Yt.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(l){this._map=l,this._setPanDelta(l.options.keyboardPanDelta),this._setZoomDelta(l.options.zoomDelta)},addHooks:function(){var l=this._map._container;l.tabIndex<=0&&(l.tabIndex="0"),vt(l,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),si(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var l=document.body,h=document.documentElement,p=l.scrollTop||h.scrollTop,b=l.scrollLeft||h.scrollLeft;this._map._container.focus(),window.scrollTo(b,p)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(l){var h=this._panKeys={},p=this.keyCodes,b,C;for(b=0,C=p.left.length;b<C;b++)h[p.left[b]]=[-1*l,0];for(b=0,C=p.right.length;b<C;b++)h[p.right[b]]=[l,0];for(b=0,C=p.down.length;b<C;b++)h[p.down[b]]=[0,l];for(b=0,C=p.up.length;b<C;b++)h[p.up[b]]=[0,-1*l]},_setZoomDelta:function(l){var h=this._zoomKeys={},p=this.keyCodes,b,C;for(b=0,C=p.zoomIn.length;b<C;b++)h[p.zoomIn[b]]=l;for(b=0,C=p.zoomOut.length;b<C;b++)h[p.zoomOut[b]]=-l},_addHooks:function(){vt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){si(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(l){if(!(l.altKey||l.ctrlKey||l.metaKey)){var h=l.keyCode,p=this._map,b;if(h in this._panKeys){if(!p._panAnim||!p._panAnim._inProgress)if(b=this._panKeys[h],l.shiftKey&&(b=Fe(b).multiplyBy(3)),p.options.maxBounds&&(b=p._limitOffset(Fe(b),p.options.maxBounds)),p.options.worldCopyJump){var C=p.wrapLatLng(p.unproject(p.project(p.getCenter()).add(b)));p.panTo(C)}else p.panBy(b)}else if(h in this._zoomKeys)p.setZoom(p.getZoom()+(l.shiftKey?3:1)*this._zoomKeys[h]);else if(h===27&&p._popup&&p._popup.options.closeOnEscapeKey)p.closePopup();else return;$s(l)}}});tn.addInitHook("addHandler","keyboard",gL),tn.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var fL=Yt.extend({addHooks:function(){vt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){si(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(l){var h=Gp(l),p=this._map.options.wheelDebounceTime;this._delta+=h,this._lastMousePos=this._map.mouseEventToContainerPoint(l),this._startTime||(this._startTime=+new Date);var b=Math.max(p-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),b),$s(l)},_performZoom:function(){var l=this._map,h=l.getZoom(),p=this._map.options.zoomSnap||0;l._stop();var b=this._delta/(this._map.options.wheelPxPerZoomLevel*4),C=4*Math.log(2/(1+Math.exp(-Math.abs(b))))/Math.LN2,P=p?Math.ceil(C/p)*p:C,V=l._limitZoom(h+(this._delta>0?P:-P))-h;this._delta=0,this._startTime=null,V&&(l.options.scrollWheelZoom==="center"?l.setZoom(h+V):l.setZoomAround(this._lastMousePos,h+V))}});tn.addInitHook("addHandler","scrollWheelZoom",fL);var qR=600;tn.mergeOptions({tapHold:Ce.touchNative&&Ce.safari&&Ce.mobile,tapTolerance:15});var pL=Yt.extend({addHooks:function(){vt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){si(this._map._container,"touchstart",this._onDown,this)},_onDown:function(l){if(clearTimeout(this._holdTimeout),l.touches.length===1){var h=l.touches[0];this._startPos=this._newPos=new Ie(h.clientX,h.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(vt(document,"touchend",Rn),vt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",h))},this),qR),vt(document,"touchend touchcancel contextmenu",this._cancel,this),vt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function l(){si(document,"touchend",Rn),si(document,"touchend touchcancel",l)},_cancel:function(){clearTimeout(this._holdTimeout),si(document,"touchend touchcancel contextmenu",this._cancel,this),si(document,"touchmove",this._onMove,this)},_onMove:function(l){var h=l.touches[0];this._newPos=new Ie(h.clientX,h.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(l,h){var p=new MouseEvent(l,{bubbles:!0,cancelable:!0,view:window,screenX:h.screenX,screenY:h.screenY,clientX:h.clientX,clientY:h.clientY});p._simulated=!0,h.target.dispatchEvent(p)}});tn.addInitHook("addHandler","tapHold",pL),tn.mergeOptions({touchZoom:Ce.touch,bounceAtZoomLimits:!0});var mL=Yt.extend({addHooks:function(){ge(this._map._container,"leaflet-touch-zoom"),vt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){et(this._map._container,"leaflet-touch-zoom"),si(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(l){var h=this._map;if(!(!l.touches||l.touches.length!==2||h._animatingZoom||this._zooming)){var p=h.mouseEventToContainerPoint(l.touches[0]),b=h.mouseEventToContainerPoint(l.touches[1]);this._centerPoint=h.getSize()._divideBy(2),this._startLatLng=h.containerPointToLatLng(this._centerPoint),h.options.touchZoom!=="center"&&(this._pinchStartLatLng=h.containerPointToLatLng(p.add(b)._divideBy(2))),this._startDist=p.distanceTo(b),this._startZoom=h.getZoom(),this._moved=!1,this._zooming=!0,h._stop(),vt(document,"touchmove",this._onTouchMove,this),vt(document,"touchend touchcancel",this._onTouchEnd,this),Rn(l)}},_onTouchMove:function(l){if(!(!l.touches||l.touches.length!==2||!this._zooming)){var h=this._map,p=h.mouseEventToContainerPoint(l.touches[0]),b=h.mouseEventToContainerPoint(l.touches[1]),C=p.distanceTo(b)/this._startDist;if(this._zoom=h.getScaleZoom(C,this._startZoom),!h.options.bounceAtZoomLimits&&(this._zoom<h.getMinZoom()&&C<1||this._zoom>h.getMaxZoom()&&C>1)&&(this._zoom=h._limitZoom(this._zoom)),h.options.touchZoom==="center"){if(this._center=this._startLatLng,C===1)return}else{var P=p._add(b)._divideBy(2)._subtract(this._centerPoint);if(C===1&&P.x===0&&P.y===0)return;this._center=h.unproject(h.project(this._pinchStartLatLng,this._zoom).subtract(P),this._zoom)}this._moved||(h._moveStart(!0,!1),this._moved=!0),Ve(this._animRequest);var V=r(h._move,h,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=me(V,this,!0),Rn(l)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,Ve(this._animRequest),si(document,"touchmove",this._onTouchMove,this),si(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});tn.addInitHook("addHandler","touchZoom",mL),tn.BoxZoom=dL,tn.DoubleClickZoom=hL,tn.Drag=uL,tn.Keyboard=gL,tn.ScrollWheelZoom=fL,tn.TapHold=pL,tn.TouchZoom=mL,t.Bounds=ft,t.Browser=Ce,t.CRS=Fi,t.Canvas=rL,t.Circle=kw,t.CircleMarker=Yp,t.Class=Ke,t.Control=Io,t.DivIcon=nL,t.DivOverlay=Br,t.DomEvent=Sw,t.DomUtil=ni,t.Draggable=$n,t.Evented=Kt,t.FeatureGroup=Sa,t.GeoJSON=xa,t.GridLayer=Lg,t.Handler=Yt,t.Icon=_h,t.ImageOverlay=im,t.LatLng=Vt,t.LatLngBounds=Gt,t.Layer=ur,t.LayerGroup=mh,t.LineUtil=ph,t.Map=tn,t.Marker=Xp,t.Mixin=Hi,t.Path=dl,t.Point=Ie,t.PolyUtil=Fr,t.Polygon=vh,t.Polyline=Ca,t.Popup=nm,t.PosAnimation=Zp,t.Projection=xR,t.Rectangle=cL,t.Renderer=La,t.SVG=kg,t.SVGOverlay=iL,t.TileLayer=wh,t.Tooltip=sm,t.Transformation=mi,t.Util=dt,t.VideoOverlay=tL,t.bind=r,t.bounds=zt,t.canvas=aL,t.circle=MR,t.circleMarker=TR,t.control=z,t.divIcon=zR,t.extend=n,t.featureGroup=DR,t.geoJSON=eL,t.geoJson=AR,t.gridLayer=VR,t.icon=ER,t.imageOverlay=OR,t.latLng=Ht,t.latLngBounds=ci,t.layerGroup=kR,t.map=Cw,t.marker=PR,t.point=Fe,t.polygon=RR,t.polyline=NR,t.popup=WR,t.rectangle=$R,t.setOptions=y,t.stamp=c,t.svg=lL,t.svgOverlay=HR,t.tileLayer=sL,t.tooltip=BR,t.transformation=Ci,t.version=i,t.videoOverlay=FR;var KR=window.L;t.noConflict=function(){return window.L=KR,this},window.L=t}))})(tf,tf.exports)),tf.exports}var ZK=GK();const Hg=oR(ZK),XK="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",YK="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",JK="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",Qn=(o,e=$b)=>{var t=QK(),i=I(x(t),2),n=x(i);Y(()=>q(n,e())),T(o,t)};var QK=A('<span class="tip svelte-767znw"><span class="tip-icon svelte-767znw">ℹ</span> <span class="tip-box svelte-767znw"> </span></span>'),eG=A("<button> </button>"),tG=A('<span class="err svelte-767znw"> </span>'),iG=A('<span class="ok svelte-767znw"> </span>'),nG=A('<div class="loading svelte-767znw">Loading…</div>'),sG=A('<section id="sec-appearance" class="svelte-767znw"><h3 class="svelte-767znw">Appearance</h3> <div class="field svelte-767znw"><label for="theme-select" class="svelte-767znw">Color theme</label> <select id="theme-select" class="svelte-767znw"><option>Dark</option><option>Light</option><option>System (OS preference)</option></select></div></section>'),oG=A('<section id="sec-mqtt" class="svelte-767znw"><h3 class="svelte-767znw">MQTT</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Broker URL <!></label> <input type="text" placeholder="mqtt://localhost:1883" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client name <!></label> <input type="text" placeholder="logic" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Variable prefix <!></label> <input type="text" placeholder="var" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Disable variable system <!></label></div></section>'),rG=A('<div class="field svelte-767znw"><label class="svelte-767znw"> <!></label> <input type="password" placeholder="Enter new password" autocomplete="new-password" class="svelte-767znw"/></div>'),aG=A('<div class="field svelte-767znw"><label class="svelte-767znw">Proxy user header <!></label> <input type="text" placeholder="X-Remote-User" class="svelte-767znw"/></div>'),lG=A('<div class="field-error svelte-767znw"> </div>'),cG=A('<div class="field-ok svelte-767znw"> </div>'),dG=A('<section id="sec-auth" class="svelte-767znw"><h3 class="svelte-767znw">Authentication</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Mode <!></label> <select class="svelte-767znw"><option>None (open)</option><option>Password</option><option>Proxy header (nginx / authentik)</option></select></div> <!> <!> <!> <!> <div class="field svelte-767znw"><span></span> <button class="save-auth-btn svelte-767znw"> </button></div></section>'),hG=A('<section id="sec-webserver" class="svelte-767znw"><h3 class="svelte-767znw">Web server</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Port <!></label> <input type="number" min="0" max="65535" placeholder="8080" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Bind address <!></label> <input type="text" placeholder="0.0.0.0 (default)" class="svelte-767znw"/></div></section>'),uG=A('<section id="sec-scripts" class="svelte-767znw"><h3 class="svelte-767znw">Scripts</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Scripts directory <!></label> <input type="text" placeholder="~/.she/scripts (default)" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Disable file watching <!></label></div></section>'),gG=A('<div class="field svelte-767znw"><div class="map-label svelte-767znw">Map <span class="map-note svelte-767znw">(click or drag marker to set location — requires internet for tiles)</span></div> <div class="map-container svelte-767znw"></div></div>'),fG=A('<section id="sec-solar" class="svelte-767znw"><h3 class="svelte-767znw">Solar events</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Latitude <!></label> <input type="number" step="0.0001" placeholder="48.7408" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Longitude <!></label> <input type="number" step="0.0001" placeholder="9.1778" class="svelte-767znw"/></div> <div class="field geo-actions svelte-767znw"><span></span> <div class="geo-btns svelte-767znw"><button class="geo-btn svelte-767znw"><!></button> <button class="geo-btn svelte-767znw"> </button></div></div> <!></section>'),pG=A('<section id="sec-logging" class="svelte-767znw"><h3 class="svelte-767znw">Logging</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Verbosity <!></label> <select class="svelte-767znw"><option>debug</option><option>info</option><option>warn</option><option>error</option></select></div></section>'),mG=A('<div class="field field--check svelte-767znw"><span></span> <label><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Retain document messages <!></label></div>'),_G=A('<section id="sec-shedb" class="svelte-767znw"><h3 class="svelte-767znw">sheDB</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Database path <!></label> <input type="text" placeholder="defaults to ~/.she/db" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">MQTT topic prefix <!></label> <input type="text" placeholder="she/db/ (default)" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Publish documents to MQTT <!></label></div> <!></section>'),vG=A('<section id="sec-redis" class="svelte-767znw"><h3 class="svelte-767znw">Redis</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Redis URL <!></label> <input type="text" placeholder="leave empty to disable" class="svelte-767znw"/></div></section>'),bG=A("<option> </option>"),wG=A('<span class="free-badge svelte-767znw">FREE</span> ',1),yG=A(' — <a target="_blank" rel="noreferrer" class="svelte-767znw">Get API key ↗</a>',1),SG=A("<div><!> <!></div>"),CG=A('<div class="field svelte-767znw"><label class="svelte-767znw">Base URL <!></label> <input type="text" class="svelte-767znw"/></div>'),xG=A('<div class="field svelte-767znw"><label class="svelte-767znw">API key <!></label> <input type="password" placeholder="sk-…" autocomplete="off" class="svelte-767znw"/></div>'),LG=A('<section id="sec-ai" class="svelte-767znw"><h3 class="svelte-767znw">AI Assistant</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Provider <!></label> <select class="svelte-767znw"></select></div> <!> <!> <div class="field svelte-767znw"><label class="svelte-767znw">Model <!></label> <input type="text" class="svelte-767znw"/></div> <!></section>'),IG=A('<div class="config-form svelte-767znw"><!> <!> <!> <!> <!> <!> <!> <!> <!> <!></div>'),kG=A('<div class="config-root svelte-767znw"><aside class="config-sidebar svelte-767znw"><div class="sidebar-search svelte-767znw"><svg class="search-icon svelte-767znw" width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="6.5" cy="6.5" r="4.5"></circle><line x1="10" y1="10" x2="14" y2="14"></line></svg> <input class="search-input svelte-767znw" type="search" placeholder="Filter settings…" autocomplete="off" spellcheck="false"/></div> <nav class="section-nav svelte-767znw"></nav></aside> <div class="config-main svelte-767znw"><div class="config-topbar svelte-767znw"><span class="topbar-title svelte-767znw">Settings</span> <!> <!> <button class="save-btn svelte-767znw"> </button></div> <!></div></div>');function DG(o,e){xo(e,!0),delete Hg.Icon.Default.prototype._getIconUrl,Hg.Icon.Default.mergeOptions({iconUrl:XK,iconRetinaUrl:YK,shadowUrl:JK});let t=U(Si($K())),i=U(""),n=U("logic"),s=U("var"),r=U(!1),a=U(8080),c=U(""),d=U("none"),u=U(""),f=U("X-Remote-User"),m=U(!1),v=U(""),_=U(""),y=U(""),S=U(!1),D=U(48.7408),E=U(9.1778),N=U(!1),B=U(void 0),F=U(!1),Q=U(null),$=U("info"),fe=U(""),Pe=U(""),ze=U(!1),me=U(!1),Ve=U("");const dt=[{id:"ollama",label:"Ollama (local)",provider:"ollama",baseUrl:"",defaultModel:"",freeNote:"",apiKeyUrl:""},{id:"lmstudio",label:"LM Studio (local)",provider:"openai",baseUrl:"http://localhost:1234",defaultModel:"",freeNote:"",apiKeyUrl:""},{id:"groq",label:"Groq — Qwen 2.5 Coder 32B (free)",provider:"openai",baseUrl:"https://api.groq.com/openai/v1",defaultModel:"qwen-2.5-coder-32b",freeNote:"14 400 req/day · no credit card needed",apiKeyUrl:"https://console.groq.com/keys"},{id:"gemini",label:"Google Gemini 2.0 Flash (free)",provider:"openai",baseUrl:"https://generativelanguage.googleapis.com/v1beta/openai",defaultModel:"gemini-2.0-flash",freeNote:"15 RPM · 1 000 000 tokens/day · no credit card",apiKeyUrl:"https://aistudio.google.com/apikey"},{id:"openai",label:"OpenAI (paid)",provider:"openai",baseUrl:"",defaultModel:"gpt-4o-mini",freeNote:"",apiKeyUrl:"https://platform.openai.com/api-keys"},{id:"anthropic",label:"Anthropic (paid)",provider:"anthropic",baseUrl:"",defaultModel:"claude-3-5-haiku-20241022",freeNote:"",apiKeyUrl:"https://console.anthropic.com/settings/keys"}];let Ke=U("ollama"),Ut=U("ollama"),lt=U(""),Kt=U(""),Ie=U("");const Pt={};let Fe="ollama";function ft(ne,it){return ne==="anthropic"?"anthropic":ne==="ollama"?"ollama":it?it.includes("localhost:1234")?"lmstudio":it.includes("groq.com")?"groq":it.includes("googleapis.com")?"gemini":"openai":"openai"}function zt(){Pt[Fe]={baseUrl:g(lt),model:g(Kt),apiKey:g(Ie)};const ne=dt.find(Z=>Z.id===g(Ke));if(!ne)return;k(Ut,ne.provider,!0);const it=Pt[g(Ke)];k(lt,(it==null?void 0:it.baseUrl)??ne.baseUrl,!0),k(Kt,(it==null?void 0:it.model)??ne.defaultModel,!0),k(Ie,(it==null?void 0:it.apiKey)??"",!0),Fe=g(Ke)}const Gt=ct(()=>dt.find(ne=>ne.id===g(Ke)));let ci=U(Si({}));const Vt=new Set(["url","name","variablePrefix","disableVariables","port","bindAddress","auth","password","proxyHeader","dir","disableWatch","latitude","longitude","verbosity","dbPath","dbPrefix","dbPublish","dbRetain","redis","ai"]);kn(()=>{if(!g(B))return;const ne=typeof g(D)=="number"?g(D):48.7408,it=typeof g(E)=="number"?g(E):9.1778,Z=Hg.map(g(B)).setView([ne,it],10);Hg.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(Z);const Te=Hg.marker([ne,it],{draggable:!0}).addTo(Z);k(Q,Te,!0);const nt=wt=>{k(D,+wt.lat.toFixed(6)),k(E,+wt.lng.toFixed(6))};return Te.on("dragend",()=>nt(Te.getLatLng())),Z.on("click",wt=>{Te.setLatLng(wt.latlng),nt(wt.latlng)}),()=>{k(Q,null),Z.remove()}}),kn(()=>{!g(Q)||g(D)===""||g(E)===""||g(Q).setLatLng([Number(g(D)),Number(g(E))])});function Ht(){if(!navigator.geolocation){alert("Geolocation is not supported by this browser.");return}k(F,!0),navigator.geolocation.getCurrentPosition(ne=>{k(D,+ne.coords.latitude.toFixed(6)),k(E,+ne.coords.longitude.toFixed(6)),k(F,!1)},()=>{k(F,!1)})}let Fi=U(!0),zi=U(!1),tt=U(""),Ct=U(""),mi=U(""),Ci=U("appearance");const xi=[{id:"appearance",label:"Appearance",terms:["theme","color","dark","light"]},{id:"auth",label:"Authentication",terms:["auth","password","login","proxy","header","nginx","authentik","secure"]},{id:"mqtt",label:"MQTT",terms:["broker","url","client","name","variable","prefix"]},{id:"webserver",label:"Web server",terms:["port","http","server","bind","address"]},{id:"scripts",label:"Scripts",terms:["directory","watch","hot reload","dir"]},{id:"solar",label:"Solar events",terms:["latitude","longitude","sunrise","sunset","geo"]},{id:"logging",label:"Logging",terms:["verbosity","debug","info","warn","error"]},{id:"shedb",label:"sheDB",terms:["database","db","path","retain"]},{id:"redis",label:"Redis",terms:["redis","cache"]},{id:"ai",label:"AI Assistant",terms:["llm","ollama","openai","anthropic","model","provider","base url"]}];let Di=ct(()=>xi.filter(ne=>{const it=g(mi).trim().toLowerCase();return!it||ne.label.toLowerCase().includes(it)||ne.terms.some(Z=>Z.includes(it))}));function Ji(ne){var it;k(Ci,ne,!0),(it=document.getElementById("sec-"+ne))==null||it.scrollIntoView({behavior:"smooth",block:"start"})}va(async()=>{try{const ne=await KN();typeof ne.url=="string"&&k(i,ne.url,!0),typeof ne.name=="string"&&k(n,ne.name,!0),typeof ne.variablePrefix=="string"&&k(s,ne.variablePrefix,!0),typeof ne.disableVariables=="boolean"&&k(r,ne.disableVariables,!0),typeof ne.port=="number"&&k(a,ne.port,!0),typeof ne.bindAddress=="string"&&k(c,ne.bindAddress,!0),typeof ne.auth=="string"&&k(d,ne.auth,!0),typeof ne.proxyHeader=="string"&&k(f,ne.proxyHeader,!0),typeof ne.dir=="string"&&k(y,ne.dir,!0),typeof ne.disableWatch=="boolean"&&k(S,ne.disableWatch,!0),typeof ne.latitude=="number"&&k(D,ne.latitude,!0),typeof ne.longitude=="number"&&k(E,ne.longitude,!0),typeof ne.verbosity=="string"&&k($,ne.verbosity,!0),typeof ne.dbPath=="string"&&k(fe,ne.dbPath,!0),typeof ne.dbPrefix=="string"&&k(Pe,ne.dbPrefix,!0),typeof ne.dbPublish=="boolean"&&k(ze,ne.dbPublish,!0),typeof ne.dbRetain=="boolean"&&k(me,ne.dbRetain,!0);const it=ne.redis;it!=null&&it.url&&k(Ve,it.url,!0);const Z=ne.ai;Z!=null&&Z.provider&&k(Ut,Z.provider,!0),Z!=null&&Z.baseUrl&&k(lt,Z.baseUrl,!0),Z!=null&&Z.model&&k(Kt,Z.model,!0),Z!=null&&Z.apiKey&&k(Ie,Z.apiKey,!0),k(Ke,ft(g(Ut),g(lt)),!0),Fe=g(Ke),k(ci,Object.fromEntries(Object.entries(ne).filter(([Te])=>!Vt.has(Te))),!0)}catch(ne){k(Ct,ne.message,!0)}finally{k(Fi,!1)}});async function Ui(){if(k(_,""),k(v,""),g(d)==="password"&&!g(u)){k(_,"A password is required to enable password authentication.");return}k(m,!0);try{await V8(g(d),g(d)==="password"?g(u):void 0,g(d)==="proxy"?g(f):void 0),k(u,""),k(v,"Authentication settings saved.")}catch(ne){k(_,ne.message,!0)}finally{k(m,!1)}}async function bn(){k(Ct,""),k(tt,"");const ne={...g(ci)};g(i)&&(ne.url=g(i)),ne.name=g(n),ne.variablePrefix=g(s),g(r)&&(ne.disableVariables=!0),g(a)!==""&&(ne.port=Number(g(a))),g(c)&&(ne.bindAddress=g(c)),g(y)&&(ne.dir=g(y)),g(S)&&(ne.disableWatch=!0),g(D)!==""&&(ne.latitude=Number(g(D))),g(E)!==""&&(ne.longitude=Number(g(E))),ne.verbosity=g($),g(fe)&&(ne.dbPath=g(fe),g(Pe)&&(ne.dbPrefix=g(Pe)),g(ze)&&(ne.dbPublish=!0,g(me)&&(ne.dbRetain=!0))),g(Ve)&&(ne.redis={url:g(Ve)}),g(Ut)&&g(Kt)&&(ne.ai={provider:g(Ut),...g(lt)?{baseUrl:g(lt)}:{},model:g(Kt),...g(Ie)?{apiKey:g(Ie)}:{}}),k(zi,!0);try{const it=await X8(ne);k(tt,it.restartRequired?"Saved — restart required to apply changes.":"Saved.",!0)}catch(it){k(Ct,it.message,!0)}finally{k(zi,!1)}}var mn=kG(),Tn=x(mn),wn=x(Tn),_n=I(x(wn),2),Dn=I(wn,2);di(Dn,21,()=>xi,ne=>ne.id,(ne,it)=>{var Z=xs(),Te=xt(Z);{var nt=Qt=>{var Zt=eG();let Li;var _i=x(Zt);Y(()=>{Li=Bt(Zt,1,"section-link svelte-767znw",null,Li,{active:g(Ci)===g(it).id}),q(_i,g(it).label)}),oe("click",Zt,()=>Ji(g(it).id)),T(Qt,Zt)},wt=ct(()=>g(Di).some(Qt=>Qt.id===g(it).id));K(Te,Qt=>{g(wt)&&Qt(nt)})}T(ne,Z)});var Ei=I(Tn,2),$i=x(Ei),Fn=I(x($i),2);{var hn=ne=>{var it=tG(),Z=x(it);Y(()=>q(Z,g(Ct))),T(ne,it)};K(Fn,ne=>{g(Ct)&&ne(hn)})}var Ai=I(Fn,2);{var rn=ne=>{var it=iG(),Z=x(it);Y(()=>q(Z,g(tt))),T(ne,it)};K(Ai,ne=>{g(tt)&&ne(rn)})}var xn=I(Ai,2),Ln=x(xn),Bn=I($i,2);{var Hn=ne=>{var it=nG();T(ne,it)},$e=ne=>{var it=IG(),Z=x(it);{var Te=ce=>{var je=sG(),yt=I(x(je),2),_t=I(x(yt),2),st=x(_t);st.value=st.__value="dark";var Je=I(st);Je.value=Je.__value="light";var j=I(Je);j.value=j.__value="system",oe("change",_t,()=>qK(g(t))),El(_t,()=>g(t),re=>k(t,re)),T(ce,je)},nt=ct(()=>g(Di).some(ce=>ce.id==="appearance"));K(Z,ce=>{g(nt)&&ce(Te)})}var wt=I(Z,2);{var Qt=ce=>{var je=oG(),yt=I(x(je),2),_t=x(yt),st=I(x(_t));Qn(st,()=>"mqtt:// or mqtts:// URL of the broker. Leave empty to run without MQTT.");var Je=I(_t,2),j=I(yt,2),re=x(j),Le=I(x(re));Qn(Le,()=>'MQTT client ID and topic prefix used for the "connected" status message. Default: logic');var W=I(re,2),R=I(j,2),G=x(R),pe=I(x(G));Qn(pe,()=>"Topic prefix for the variable system (var/set/name → var/status/name). Default: var");var se=I(G,2),we=I(R,2),ae=I(x(we),2),ue=x(ae),Re=I(ue,4);Qn(Re,()=>"When enabled, var/set/… messages are not processed and no var/status/… retained messages are published."),Ki(Je,()=>g(i),_e=>k(i,_e)),Ki(W,()=>g(n),_e=>k(n,_e)),Ki(se,()=>g(s),_e=>k(s,_e)),eo(ue,()=>g(r),_e=>k(r,_e)),T(ce,je)},Zt=ct(()=>g(Di).some(ce=>ce.id==="mqtt"));K(wt,ce=>{g(Zt)&&ce(Qt)})}var Li=I(wt,2);{var _i=ce=>{var je=dG(),yt=I(x(je),2),_t=x(yt),st=I(x(_t));Qn(st,()=>"none: no authentication required. password: single-user password login. proxy: trust a header set by nginx/authentik.");var Je=I(_t,2),j=x(Je);j.value=j.__value="none";var re=I(j);re.value=re.__value="password";var Le=I(re);Le.value=Le.__value="proxy";var W=I(yt,2);{var R=Ee=>{var ge=rG(),et=x(ge),ei=x(et),vi=I(ei);Qn(vi,()=>"Set a new password. Leave empty to keep the current password (if already set).");var Pi=I(et,2);Y(()=>q(ei,`${g(u)?"New password":"Password"} `)),Ki(Pi,()=>g(u),Mn=>k(u,Mn)),T(Ee,ge)};K(W,Ee=>{g(d)==="password"&&Ee(R)})}var G=I(W,2);{var pe=Ee=>{var ge=aG(),et=x(ge),ei=I(x(et));Qn(ei,()=>"The HTTP header that nginx/authentik sets after successful authentication. Default: X-Remote-User");var vi=I(et,2);Ki(vi,()=>g(f),Pi=>k(f,Pi)),T(Ee,ge)};K(G,Ee=>{g(d)==="proxy"&&Ee(pe)})}var se=I(G,2);{var we=Ee=>{var ge=lG(),et=x(ge);Y(()=>q(et,g(_))),T(Ee,ge)};K(se,Ee=>{g(_)&&Ee(we)})}var ae=I(se,2);{var ue=Ee=>{var ge=cG(),et=x(ge);Y(()=>q(et,g(v))),T(Ee,ge)};K(ae,Ee=>{g(v)&&Ee(ue)})}var Re=I(ae,2),_e=I(x(Re),2),Ae=x(_e);Y(()=>{_e.disabled=g(m)||g(d)==="password"&&!g(u),q(Ae,g(m)?"Saving…":"Apply authentication settings")}),El(Je,()=>g(d),Ee=>k(d,Ee)),oe("click",_e,Ui),T(ce,je)},O=ct(()=>g(Di).some(ce=>ce.id==="auth"));K(Li,ce=>{g(O)&&ce(_i)})}var X=I(Li,2);{var xe=ce=>{var je=hG(),yt=I(x(je),2),_t=x(yt),st=I(x(_t));Qn(st,()=>"HTTP server port. Use 0 to let the OS pick a free port. Default: 8080");var Je=I(_t,2),j=I(yt,2),re=x(j),Le=I(x(re));Qn(Le,()=>"Interface she listens on. Use 127.0.0.1 when running behind nginx (recommended with proxy auth). Default: 0.0.0.0");var W=I(re,2);Ki(Je,()=>g(a),R=>k(a,R)),Ki(W,()=>g(c),R=>k(c,R)),T(ce,je)},Ze=ct(()=>g(Di).some(ce=>ce.id==="webserver"));K(X,ce=>{g(Ze)&&ce(xe)})}var Dt=I(X,2);{var mt=ce=>{var je=uG(),yt=I(x(je),2),_t=x(yt),st=I(x(_t));Qn(st,()=>"Directory that is watched for .js script files. Defaults to ~/.she/scripts");var Je=I(_t,2),j=I(yt,2),re=I(x(j),2),Le=x(re),W=I(Le,4);Qn(W,()=>"When enabled the daemon will not watch for file changes and will not hot-reload scripts."),Ki(Je,()=>g(y),R=>k(y,R)),eo(Le,()=>g(S),R=>k(S,R)),T(ce,je)},Me=ct(()=>g(Di).some(ce=>ce.id==="scripts"));K(Dt,ce=>{g(Me)&&ce(mt)})}var De=I(Dt,2);{var Ue=ce=>{var je=fG(),yt=I(x(je),2),_t=x(yt),st=I(x(_t));Qn(st,()=>"Geographic latitude used for sunrise/sunset calculations. Default: 48.7408 (Stuttgart)");var Je=I(_t,2),j=I(yt,2),re=x(j),Le=I(x(re));Qn(Le,()=>"Geographic longitude used for sunrise/sunset calculations. Default: 9.1778 (Stuttgart)");var W=I(re,2),R=I(j,2),G=I(x(R),2),pe=x(G),se=x(pe);{var we=Ee=>{var ge=ha("…");T(Ee,ge)},ae=Ee=>{var ge=ha("📍 Use my location");T(Ee,ge)};K(se,Ee=>{g(F)?Ee(we):Ee(ae,-1)})}var ue=I(pe,2),Re=x(ue),_e=I(R,2);{var Ae=Ee=>{var ge=gG(),et=I(x(ge),2);Qs(et,ei=>k(B,ei),()=>g(B)),T(Ee,ge)};K(_e,Ee=>{g(N)&&Ee(Ae)})}Y(()=>{pe.disabled=g(F),q(Re,g(N)?"Hide map":"Pick on map")}),Ki(Je,()=>g(D),Ee=>k(D,Ee)),Ki(W,()=>g(E),Ee=>k(E,Ee)),oe("click",pe,Ht),oe("click",ue,()=>k(N,!g(N))),T(ce,je)},Ge=ct(()=>g(Di).some(ce=>ce.id==="solar"));K(De,ce=>{g(Ge)&&ce(Ue)})}var Xe=I(De,2);{var Ce=ce=>{var je=pG(),yt=I(x(je),2),_t=x(yt),st=I(x(_t));Qn(st,()=>"Minimum log level. debug shows all messages including MQTT traffic details.");var Je=I(_t,2),j=x(Je);j.value=j.__value="debug";var re=I(j);re.value=re.__value="info";var Le=I(re);Le.value=Le.__value="warn";var W=I(Le);W.value=W.__value="error",El(Je,()=>g($),R=>k($,R)),T(ce,je)},Et=ct(()=>g(Di).some(ce=>ce.id==="logging"));K(Xe,ce=>{g(Et)&&ce(Ce)})}var Ft=I(Xe,2);{var gi=ce=>{var je=_G(),yt=I(x(je),2),_t=x(yt),st=I(x(_t));Qn(st,()=>"Path to the sheDB data directory. Defaults to ~/.she/db. Leave empty to disable sheDB.");var Je=I(_t,2),j=I(yt,2),re=x(j),Le=I(x(re));Qn(Le,()=>"Prefix for all sheDB MQTT topics. Defaults to she/db/ — documents publish to {prefix}doc/{id}, views to {prefix}view/{id}, commands use {prefix}set/{id} etc.");var W=I(re,2),R=I(j,2),G=I(x(R),2);let pe;var se=x(G),we=I(se,4);Qn(we,()=>'When enabled, every document change is published to {dbPrefix}doc/{id}. Individual views can publish independently via their own "mqttpub" setting.');var ae=I(R,2);{var ue=Re=>{var _e=mG(),Ae=I(x(_e),2);let Ee;var ge=x(Ae),et=I(ge,4);Qn(et,()=>"When enabled, MQTT messages for document changes are published as retained messages."),Y(()=>{Ee=Bt(Ae,1,"check-label svelte-767znw",null,Ee,{muted:!g(fe)}),ge.disabled=!g(fe)}),eo(ge,()=>g(me),ei=>k(me,ei)),T(Re,_e)};K(ae,Re=>{g(ze)&&Re(ue)})}Y(()=>{W.disabled=!g(fe),pe=Bt(G,1,"check-label svelte-767znw",null,pe,{muted:!g(fe)}),se.disabled=!g(fe)}),Ki(Je,()=>g(fe),Re=>k(fe,Re)),Ki(W,()=>g(Pe),Re=>k(Pe,Re)),eo(se,()=>g(ze),Re=>k(ze,Re)),T(ce,je)},Qi=ct(()=>g(Di).some(ce=>ce.id==="shedb"));K(Ft,ce=>{g(Qi)&&ce(gi)})}var Ii=I(Ft,2);{var ee=ce=>{var je=vG(),yt=I(x(je),2),_t=x(yt),st=I(x(_t));Qn(st,()=>"redis:// URL for the optional Redis write-through cache. All state store changes are written to the she:state hash. Leave empty to disable.");var Je=I(_t,2);Ki(Je,()=>g(Ve),j=>k(Ve,j)),T(ce,je)},be=ct(()=>g(Di).some(ce=>ce.id==="redis"));K(Ii,ce=>{g(be)&&ce(ee)})}var qe=I(Ii,2);{var pt=ce=>{var je=LG(),yt=I(x(je),2),_t=x(yt),st=I(x(_t));Qn(st,()=>"Choose a provider. Free options need a free API key from the provider's website — no credit card required.");var Je=I(_t,2);di(Je,21,()=>dt,In,(ue,Re)=>{var _e=bG(),Ae=x(_e),Ee={};Y(()=>{q(Ae,g(Re).label),Ee!==(Ee=g(Re).id)&&(_e.value=(_e.__value=g(Re).id)??"")}),T(ue,_e)});var j=I(yt,2);{var re=ue=>{var Re=SG();let _e;var Ae=x(Re);{var Ee=ei=>{var vi=wG(),Pi=I(xt(vi));Y(()=>q(Pi,` ${g(Gt).freeNote??""}`)),T(ei,vi)};K(Ae,ei=>{g(Gt).freeNote&&ei(Ee)})}var ge=I(Ae,2);{var et=ei=>{var vi=yG(),Pi=I(xt(vi));Y(()=>Jn(Pi,"href",g(Gt).apiKeyUrl)),T(ei,vi)};K(ge,ei=>{g(Gt).apiKeyUrl&&ei(et)})}Y(()=>_e=Bt(Re,1,"preset-note svelte-767znw",null,_e,{free:!!g(Gt).freeNote})),T(ue,Re)};K(j,ue=>{var Re,_e;((Re=g(Gt))!=null&&Re.freeNote||(_e=g(Gt))!=null&&_e.apiKeyUrl)&&ue(re)})}var Le=I(j,2);{var W=ue=>{var Re=CG(),_e=x(Re),Ae=I(x(_e));Qn(Ae,()=>"Base URL of the LLM API. Auto-filled for cloud presets. For Ollama: http://localhost:11434.");var Ee=I(_e,2);Y(()=>{var ge;return Jn(Ee,"placeholder",g(Ke)==="ollama"?"http://localhost:11434":g(Ke)==="lmstudio"?"http://localhost:1234":((ge=g(Gt))==null?void 0:ge.baseUrl)??"")}),Ki(Ee,()=>g(lt),ge=>k(lt,ge)),T(ue,Re)};K(Le,ue=>{g(Ke)!=="anthropic"&&ue(W)})}var R=I(Le,2),G=x(R),pe=I(x(G));Qn(pe,()=>"Model identifier. Suggested default is filled in when you choose a preset.");var se=I(G,2),we=I(R,2);{var ae=ue=>{var Re=xG(),_e=x(Re),Ae=I(x(_e));Qn(Ae,()=>"Stored in config.json. Not needed for local providers.");var Ee=I(_e,2);Ki(Ee,()=>g(Ie),ge=>k(Ie,ge)),T(ue,Re)};K(we,ue=>{g(Ke)!=="ollama"&&g(Ke)!=="lmstudio"&&ue(ae)})}Y(()=>{var ue;return Jn(se,"placeholder",((ue=g(Gt))==null?void 0:ue.defaultModel)||"e.g. llama3.2")}),oe("change",Je,zt),El(Je,()=>g(Ke),ue=>k(Ke,ue)),Ki(se,()=>g(Kt),ue=>k(Kt,ue)),T(ce,je)},Lt=ct(()=>g(Di).some(ce=>ce.id==="ai"));K(qe,ce=>{g(Lt)&&ce(pt)})}T(ne,it)};K(Bn,ne=>{g(Fi)?ne(Hn):ne($e,-1)})}Y(()=>{xn.disabled=g(zi),q(Ln,g(zi)?"Saving…":"Save")}),Ki(_n,()=>g(mi),ne=>k(mi,ne)),oe("click",xn,bn),T(o,mn),Lo()}cr(["click","change"]);var EG=A("<option> </option>"),PG=A('<div><span class="ts svelte-18loop9"> </span> <span class="lvl svelte-18loop9"> </span> <span class="msg svelte-18loop9"> </span></div>'),TG=A('<div class="page svelte-18loop9"><div class="toolbar svelte-18loop9"><h2 class="svelte-18loop9">Logs</h2> <select class="svelte-18loop9"></select> <input class="filter-in svelte-18loop9" type="search" placeholder="Filter messages…"/> <label class="check-label svelte-18loop9" title="Interpret filter as a regular expression"><input type="checkbox" class="svelte-18loop9"/> <span class="checkmark svelte-18loop9"></span> Regex</label> <label class="check-label svelte-18loop9"><input type="checkbox" class="svelte-18loop9"/> <span class="checkmark svelte-18loop9"></span> Auto-scroll</label> <button class="svelte-18loop9">Clear</button></div> <div class="log svelte-18loop9"></div></div>');function MG(o,e){xo(e,!0);let t=U(Si(d7())),i,n=U(!0),s=U("all"),r=U(""),a=U(!1);const c=["all","debug","info","warn","error"],d={debug:0,info:1,warn:2,error:3};sR($=>{k(t,[...g(t).slice(-1999),$],!0)}),va(()=>{i&&(i.scrollTop=i.scrollHeight)}),kn(()=>{g(t).length,g(n)&&i&&(i.scrollTop=i.scrollHeight)});function u(){k(t,[],!0)}function f($){if(g(s)!=="all"&&d[$.level]<d[g(s)])return!1;if(!g(r))return!0;if(g(a))try{return new RegExp(g(r),"i").test($.msg)}catch{}return $.msg.toLowerCase().includes(g(r).toLowerCase())}function m($){return new Date($).toLocaleTimeString()}var v=TG(),_=x(v),y=I(x(_),2);di(y,21,()=>c,In,($,fe)=>{var Pe=EG(),ze=x(Pe),me={};Y(()=>{q(ze,g(fe)),me!==(me=g(fe))&&(Pe.value=(Pe.__value=g(fe))??"")}),T($,Pe)});var S=I(y,2),D=I(S,2),E=x(D),N=I(D,2),B=x(N),F=I(N,2),Q=I(_,2);di(Q,21,()=>g(t).filter(f),$=>$.ts+$.msg,($,fe)=>{var Pe=PG(),ze=x(Pe),me=x(ze),Ve=I(ze,2),dt=x(Ve),Ke=I(Ve,2),Ut=x(Ke);Y((lt,Kt)=>{Bt(Pe,1,`line ${g(fe).level??""}`,"svelte-18loop9"),q(me,lt),q(dt,Kt),q(Ut,g(fe).msg)},[()=>m(g(fe).ts),()=>g(fe).level.toUpperCase()]),T($,Pe)}),Qs(Q,$=>i=$,()=>i),El(y,()=>g(s),$=>k(s,$)),Ki(S,()=>g(r),$=>k(r,$)),eo(E,()=>g(a),$=>k(a,$)),eo(B,()=>g(n),$=>k(n,$)),oe("click",F,u),T(o,v),Lo()}cr(["click"]);var NG=A('<span class="chat-model svelte-1twuiul"><!></span>'),RG=A('<button class="clear-btn svelte-1twuiul" title="Clear conversation">✕</button>'),AG=A('<div class="unconfigured svelte-1twuiul">Configure an AI provider in the <strong class="svelte-1twuiul">Config</strong> tab to use the AI assistant.</div>'),OG=A('Working on view <code class="svelte-1twuiul"> </code>',1),FG=A('<button class="chip svelte-1twuiul"> </button>'),HG=A('<div class="suggestions svelte-1twuiul"><p class="suggestions-hint svelte-1twuiul"><!></p> <!></div>'),WG=A('<div class="msg-content user-text svelte-1twuiul"> </div>'),CD=A('<div class="tool-event tool-call svelte-1twuiul"><span class="tool-icon svelte-1twuiul">🔧</span><span class="tool-name svelte-1twuiul"> </span></div>'),xD=A('<div class="tool-event tool-result svelte-1twuiul"><span class="tool-icon svelte-1twuiul">✓</span><span class="tool-name svelte-1twuiul"> </span></div>'),LD=A('<div class="tool-events svelte-1twuiul"></div>'),ID=A('<div class="text-block svelte-1twuiul"></div>'),BG=A('<button class="expand-btn svelte-1twuiul"> </button>'),zG=A('<div class="code-block svelte-1twuiul"><div class="code-header svelte-1twuiul"><span class="code-lang svelte-1twuiul"> </span> <div class="code-actions svelte-1twuiul"><button class="svelte-1twuiul">Copy</button></div></div> <div><pre class="svelte-1twuiul"><code class="hljs svelte-1twuiul"></code></pre> <!></div></div>'),VG=A('<div class="apply-view-row svelte-1twuiul"><button class="apply-view-btn svelte-1twuiul"> </button></div>'),jG=A('<!> <div class="msg-content svelte-1twuiul"><!> <!></div>',1),UG=A("<div><!></div>"),$G=A('<div class="message assistant svelte-1twuiul"><div class="msg-content svelte-1twuiul"><span class="status-shimmer svelte-1twuiul"> </span></div></div>'),qG=A('<div class="code-block svelte-1twuiul"><div class="code-header svelte-1twuiul"><span class="code-lang svelte-1twuiul"> </span></div> <pre class="svelte-1twuiul"><code class="hljs svelte-1twuiul"></code></pre></div>'),KG=A('<div class="message assistant streaming svelte-1twuiul"><div class="msg-content svelte-1twuiul"></div></div>'),GG=A('<div class="chat-error svelte-1twuiul"> </div>'),ZG=A('<span><span class="badge badge-db svelte-1twuiul">db</span> <span class="chip-name svelte-1twuiul"> </span> <button class="chip-remove svelte-1twuiul"> </button></span>'),XG=A('<span class="file-chip svelte-1twuiul"><span> </span> <span class="chip-name svelte-1twuiul"> </span> <button class="chip-remove svelte-1twuiul" title="Remove from context">×</button></span>'),YG=A('<button class="stop-btn svelte-1twuiul" title="Stop generation">■</button>'),JG=A('<button class="send-btn svelte-1twuiul">↑</button>'),QG=A('<option class="svelte-1twuiul"> </option>'),eZ=A('<select class="model-select svelte-1twuiul"></select>'),tZ=A('<span class="model-name svelte-1twuiul"> </span>'),iZ=A('<button class="info-btn svelte-1twuiul" title="Model info">ℹ</button>'),nZ=A('<div class="model-bar svelte-1twuiul"><span class="model-provider svelte-1twuiul"> </span> <!> <!></div>'),sZ=A('<p class="info-status svelte-1twuiul">Loading…</p>'),oZ=A('<p class="info-status info-err svelte-1twuiul"> </p>'),rZ=A('<dt class="svelte-1twuiul">Ollama version</dt><dd class="svelte-1twuiul"> </dd>',1),aZ=A('<dt class="svelte-1twuiul">Family</dt><dd class="svelte-1twuiul"> </dd>',1),lZ=A('<dt class="svelte-1twuiul">Parameters</dt><dd class="svelte-1twuiul"> </dd>',1),cZ=A('<dt class="svelte-1twuiul">Quantization</dt><dd class="svelte-1twuiul"> </dd>',1),dZ=A('<div class="running-model svelte-1twuiul"> </div>'),hZ=A('<dt class="svelte-1twuiul">Loaded</dt> <dd class="svelte-1twuiul"></dd>',1),uZ=A('<dt class="svelte-1twuiul">Loaded</dt><dd class="dim svelte-1twuiul">Not in memory</dd>',1),gZ=A('<dl class="svelte-1twuiul"><!> <!> <!> <!> <!></dl>'),fZ=A('<div class="info-overlay svelte-1twuiul"><div class="info-popup svelte-1twuiul"><div class="info-popup-header svelte-1twuiul"><span class="svelte-1twuiul"> </span> <button title="Close" class="svelte-1twuiul">✕</button></div> <div class="info-popup-body svelte-1twuiul"><!></div></div></div>'),pZ=A('<div class="chat-panel svelte-1twuiul"><div class="chat-header svelte-1twuiul"><span class="chat-title svelte-1twuiul">AI — View assistant</span> <!> <!></div> <div class="messages svelte-1twuiul"><!> <!> <!> <!> <!></div> <!> <div class="context-row svelte-1twuiul"><label title="Include sheDB document IDs in context" class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/><span class="checkmark svelte-1twuiul"></span> Doc IDs</label> <label title="Include sample document content in context (first 10 docs)" class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/><span class="checkmark svelte-1twuiul"></span> Sample docs</label> <label title="Let the AI query sheDB documents on demand. Disables real-time streaming." class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/><span class="checkmark svelte-1twuiul"></span> 😎 Agent</label> <span class="req-size svelte-1twuiul"> </span></div> <div class="files-row svelte-1twuiul"><!> <!> <button class="add-file-btn svelte-1twuiul" title="Attach file to context">+</button> <input type="file" multiple="" class="file-input-hidden svelte-1twuiul"/></div> <div><div><textarea rows="3" class="svelte-1twuiul"></textarea></div> <!></div> <!></div> <!>',1);function mZ(o,e){xo(e,!0),Iv.registerLanguage("javascript",cR),vn.use({breaks:!0,gfm:!0});let t=qu(e,"currentView",3,null);const i="she:viewchat:messages";let n=U(Si(JSON.parse(localStorage.getItem(i)??"[]"))),s=U(null),r=U(""),a=U(!1),c=U(""),d=U(null),u=U(Si([])),f=U(Si(localStorage.getItem("she:selectedModel")??""));kn(()=>{localStorage.setItem(i,JSON.stringify(g(n)))});let m=U(Si(new Set)),v=U(!1),_=U(null),y=U(!1),S=U(""),D=null,E=U(0);const N=["[core] reticulating splines…","[io] calibrating the flux capacitor…","[net] pinging the oracle (no response)…","[gpu] overclocking the neurons…","[fs] loading sarcasm module v4.2…","[mem] defragmenting the embedding space…","[sched] running gradient descent into madness…","[net] synchronizing with the hive mind…","[model] tickling the transformer…","[io] consulting rubber duck debugger…"];let B=U(!0),F=U(!0),Q=U(!0),$=U(Si([])),fe=U(!0),Pe=U(!1),ze,me=U(Si([])),Ve=U(0),dt,Ke;const Ut=ct(()=>({apiref:!1,shedb:g(B),sampleDocs:g(F),tools:g(Q)})),lt=ct(()=>{var W;return((W=g(d))==null?void 0:W.configured)??!1}),Kt=ct(()=>g(Ve)+new TextEncoder().encode(g(r)).length),Ie=ct(()=>g(fe)?t():null);kn(()=>{JN().then(W=>{k(d,W,!0),W.configured&&!g(f)&&k(f,W.model,!0)}).catch(()=>{})}),kn(()=>{g(f)&&localStorage.setItem("she:selectedModel",g(f))}),kn(()=>{var W;(W=g(d))!=null&&W.configured&&QN().then(R=>{k(u,R.models,!0)}).catch(()=>{})}),kn(()=>{g(f),k(_,null),k(S,"")}),kn(()=>{const W=g(Ut),R=g(Ie),G=g($);g(lt)&&tR({context:W,currentView:R??null,extraFiles:G.length>0?G:void 0}).then(pe=>{k(Ve,new TextEncoder().encode(pe.prompt).length,!0)}).catch(()=>{})}),kn(()=>{if(!g(a))return;k(E,Math.floor(Math.random()*N.length),!0);const W=setInterval(()=>{k(E,(g(E)+1)%N.length)},1e4);return()=>clearInterval(W)}),kn(()=>{var W;Ke&&(g(n).length+(((W=g(s))==null?void 0:W.length)??0),requestAnimationFrame(()=>{Ke&&(Ke.scrollTop=Ke.scrollHeight)}))});function Pt(W){const R=[],G=/```(\w*)\n([\s\S]*?)```/g;let pe=0,se;for(;(se=G.exec(W))!==null;)se.index>pe&&R.push({type:"text",text:W.slice(pe,se.index)}),R.push({type:"code",lang:se[1]||"text",text:se[2].trimEnd()}),pe=se.index+se[0].length;return pe<W.length&&R.push({type:"text",text:W.slice(pe)}),R}function Fe(W){const R=[],G=/```(\w*)\n([\s\S]*?)```/g;let pe=0,se;for(;(se=G.exec(W))!==null;)se.index>pe&&R.push({type:"text",text:W.slice(pe,se.index)}),R.push({type:"code",lang:se[1]||"text",text:se[2].trimEnd()}),pe=se.index+se[0].length;const we=W.slice(pe),ae=we.match(/```(\w*)\n([\s\S]*)$/);return ae?(ae.index>0&&R.push({type:"text",text:we.slice(0,ae.index)}),R.push({type:"code",lang:ae[1]||"text",text:ae[2]})):we&&R.push({type:"text",text:we}),R}function ft(W){const R={};for(const G of W)if(G.type==="code"){if(G.lang==="filter")R.filter=G.text.trim();else if(tt(G.lang)){const pe=G.text.split(`
|
|
218
|
-
`)[0].trim();pe==="// @view-map"?R.map=G.text.split(`
|
|
219
|
-
`).slice(1).join(`
|
|
220
|
-
`).trim():pe==="// @view-reduce"&&(R.reduce=G.text.split(`
|
|
221
|
-
`).slice(1).join(`
|
|
222
|
-
`).trim())}}return R}function zt(W){return W.filter!==void 0||W.map!==void 0||W.reduce!==void 0}function Gt(W){const R=[];return W.filter!==void 0&&R.push("filter"),W.map!==void 0&&R.push("map"),W.reduce!==void 0&&R.push("reduce"),`Apply ${R.join(" + ")}`}const ci=15;function Vt(W){return W.split(`
|
|
223
|
-
`).length>ci}function Ht(W){const R=new Set(g(m));R.has(W)?R.delete(W):R.add(W),k(m,R,!0)}function Fi(W,R){if(tt(R))try{return Iv.highlight(W,{language:"javascript"}).value}catch{}return W.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function zi(W){return vn.parse(W)}function tt(W){return!W||W==="js"||W==="javascript"}function Ct(W){navigator.clipboard.writeText(W).catch(()=>{})}async function mi(){if(k(v,!0),!(g(_)||g(y))){k(y,!0),k(S,"");try{k(_,await eR(g(f)||g(d).model),!0)}catch(W){k(S,W.message,!0)}k(y,!1)}}function Ci(W){return W>=1e9?`${(W/1e9).toFixed(1)} GB`:W>=1e6?`${(W/1e6).toFixed(0)} MB`:`${W} B`}function xi(W){const R=W.match(/\.([^.]+)$/);return R?R[1].toUpperCase():"?"}function Di(W){switch(W){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"↓";case"JSON":case"JSONC":return"{}";default:return W}}function Ji(W){k($,g($).filter((R,G)=>G!==W),!0)}function Ui(){ze.click()}async function bn(W){if(!(!W||W.length===0))for(const R of Array.from(W)){const G=await R.text();k($,[...g($),{name:R.name,content:G}],!0)}}function mn(W){const R=W.target;bn(R.files),R.value=""}function Tn(W){var R;W.preventDefault(),k(Pe,!1),bn(((R=W.dataTransfer)==null?void 0:R.files)??null)}function wn(W){var R;(R=W.dataTransfer)!=null&&R.types.includes("Files")&&(W.preventDefault(),k(Pe,!0))}function _n(){k(Pe,!1)}async function Dn(){const W=g(r).trim();if(!(!W||g(a))){k(r,""),k(c,""),k(a,!0),k(n,[...g(n),{role:"user",content:W}],!0),D=new AbortController,k(me,[],!0);try{await iR({messages:g(n),currentView:g(Ie),context:g(Ut),modelOverride:g(f)||void 0,extraFiles:g($).length>0?g($):void 0},R=>{k(s,(g(s)??"")+R)},D.signal,R=>{k(me,[...g(me),R],!0)}),k(n,[...g(n),{role:"assistant",content:g(s)??"",toolEvents:g(me).length>0?[...g(me)]:void 0}],!0),k(me,[],!0)}catch(R){if(R.name==="AbortError"){const G=g(s);G!=null&&G.trim()&&k(n,[...g(n),{role:"assistant",content:G+`
|
|
224
|
-
|
|
225
|
-
*[stopped]*`,toolEvents:g(me).length>0?[...g(me)]:void 0}],!0)}else k(c,R.message,!0)}finally{D=null,k(s,null),k(me,[],!0),k(a,!1)}}}function Ei(){D==null||D.abort()}function $i(W){W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),Dn())}function Fn(){k(n,[],!0),k(c,"")}const hn=["Write a view to list all document IDs","Write a view to sum a numeric property across all documents","Write a view that filters to a specific prefix and emits a field","Write a reduce that returns the maximum value","Explain how the current view works"];function Ai(W){k(r,W,!0),dt==null||dt.focus()}var rn=pZ(),xn=xt(rn),Ln=x(xn),Bn=I(x(Ln),2);{var Hn=W=>{var R=NG(),G=x(R);{var pe=we=>{var ae=ha();Y(()=>q(ae,`${g(d).provider??""} · ${(g(f)||g(d).model)??""}`)),T(we,ae)},se=we=>{var ae=ha("Not configured");T(we,ae)};K(G,we=>{g(lt)?we(pe):we(se,-1)})}Y(()=>Jn(R,"title",`Provider: ${g(d).provider??""}`)),T(W,R)};K(Bn,W=>{g(d)&&W(Hn)})}var $e=I(Bn,2);{var ne=W=>{var R=RG();oe("click",R,Fn),T(W,R)};K($e,W=>{g(n).length>0&&W(ne)})}var it=I(Ln,2),Z=x(it);{var Te=W=>{var R=AG();T(W,R)},nt=W=>{var R=HG(),G=x(R),pe=x(G);{var se=ue=>{var Re=OG(),_e=I(xt(Re)),Ae=x(_e);Y(()=>q(Ae,t().id)),T(ue,Re)},we=ue=>{var Re=ha("No view selected. Ask a general sheDB view question.");T(ue,Re)};K(pe,ue=>{t()?ue(se):ue(we,-1)})}var ae=I(G,2);di(ae,17,()=>hn,In,(ue,Re)=>{var _e=FG(),Ae=x(_e);Y(()=>q(Ae,g(Re))),oe("click",_e,()=>Ai(g(Re))),T(ue,_e)}),T(W,R)};K(Z,W=>{g(lt)?g(n).length===0&&g(s)===null&&W(nt,1):W(Te)})}var wt=I(Z,2);di(wt,17,()=>g(n),In,(W,R,G)=>{var pe=UG(),se=x(pe);{var we=ue=>{var Re=WG(),_e=x(Re);Y(()=>q(_e,g(R).content)),T(ue,Re)},ae=ue=>{const Re=ct(()=>Pt(g(R).content)),_e=ct(()=>ft(g(Re)));var Ae=jG(),Ee=xt(Ae);{var ge=ri=>{var ai=LD();di(ai,21,()=>g(R).toolEvents,In,(Wt,hi)=>{var ki=xs(),St=xt(ki);{var Xt=ke=>{var Nt=CD(),At=I(x(Nt)),Vi=x(At);Y(en=>q(Vi,en),[()=>g(hi).name.replace(/_/g," ")]),T(ke,Nt)},ve=ke=>{var Nt=xD(),At=I(x(Nt)),Vi=x(At);Y(en=>q(Vi,en),[()=>g(hi).name.replace(/_/g," ")]),T(ke,Nt)};K(St,ke=>{g(hi).type==="tool_call"?ke(Xt):ke(ve,-1)})}T(Wt,ki)}),T(ri,ai)};K(Ee,ri=>{var ai;(ai=g(R).toolEvents)!=null&&ai.length&&ri(ge)})}var et=I(Ee,2),ei=x(et);di(ei,17,()=>g(Re),In,(ri,ai,Wt)=>{var hi=xs(),ki=xt(hi);{var St=ve=>{var ke=ID();Dl(ke,()=>zi(g(ai).text),!0),T(ve,ke)},Xt=ve=>{const ke=ct(()=>`${G}:${Wt}`),Nt=ct(()=>Vt(g(ai).text)),At=ct(()=>g(m).has(g(ke))),Vi=ct(()=>g(ai).lang==="filter");var en=zG(),Ne=x(en),ot=x(Ne),Tt=x(ot),ni=I(ot,2),vt=x(ni),fi=I(Ne,2);let si;var ns=x(fi),ss=x(ns);Dl(ss,()=>Fi(g(ai).text,g(ai).lang??""),!0);var Nn=I(ns,2);{var os=ds=>{var ao=BG(),lo=x(ao);Y(()=>q(lo,g(At)?"▲ collapse":"▼ expand")),oe("click",ao,()=>Ht(g(ke))),T(ds,ao)};K(Nn,ds=>{g(Nt)&&ds(os)})}Y(()=>{q(Tt,g(Vi)?"filter":g(ai).lang),si=Bt(fi,1,"code-body svelte-1twuiul",null,si,{collapsed:g(Nt)&&!g(At)})}),oe("click",vt,()=>Ct(g(ai).text)),T(ve,en)};K(ki,ve=>{g(ai).type==="text"?ve(St):ve(Xt,-1)})}T(ri,hi)});var vi=I(ei,2);{var Pi=ri=>{var ai=VG(),Wt=x(ai),hi=x(Wt);Y(ki=>q(hi,ki),[()=>Gt(g(_e))]),oe("click",Wt,()=>e.onApplyView(g(_e))),T(ri,ai)},Mn=ct(()=>zt(g(_e))&&e.onApplyView);K(vi,ri=>{g(Mn)&&ri(Pi)})}T(ue,Ae)};K(se,ue=>{g(R).role==="user"?ue(we):ue(ae,-1)})}Y(()=>Bt(pe,1,`message ${g(R).role??""}`,"svelte-1twuiul")),T(W,pe)});var Qt=I(wt,2);{var Zt=W=>{var R=LD();di(R,21,()=>g(me),In,(G,pe)=>{var se=xs(),we=xt(se);{var ae=Re=>{var _e=CD(),Ae=I(x(_e)),Ee=x(Ae);Y(ge=>q(Ee,ge),[()=>g(pe).name.replace(/_/g," ")]),T(Re,_e)},ue=Re=>{var _e=xD(),Ae=I(x(_e)),Ee=x(Ae);Y(ge=>q(Ee,ge),[()=>g(pe).name.replace(/_/g," ")]),T(Re,_e)};K(we,Re=>{g(pe).type==="tool_call"?Re(ae):Re(ue,-1)})}T(G,se)}),T(W,R)};K(Qt,W=>{g(me).length>0&&W(Zt)})}var Li=I(Qt,2);{var _i=W=>{var R=$G(),G=x(R),pe=x(G),se=x(pe);Y(()=>q(se,N[g(E)])),T(W,R)};K(Li,W=>{g(a)&&g(s)===null&&g(me).length===0&&W(_i)})}var O=I(Li,2);{var X=W=>{var R=KG(),G=x(R);di(G,21,()=>Fe(g(s)),In,(pe,se)=>{var we=xs(),ae=xt(we);{var ue=_e=>{var Ae=ID();Dl(Ae,()=>zi(g(se).text),!0),T(_e,Ae)},Re=_e=>{var Ae=qG(),Ee=x(Ae),ge=x(Ee),et=x(ge),ei=I(Ee,2),vi=x(ei);Dl(vi,()=>Fi(g(se).text,g(se).lang??""),!0),Y(()=>q(et,g(se).lang)),T(_e,Ae)};K(ae,_e=>{g(se).type==="text"?_e(ue):_e(Re,-1)})}T(pe,we)}),T(W,R)};K(O,W=>{g(s)!==null&&W(X)})}Qs(it,W=>Ke=W,()=>Ke);var xe=I(it,2);{var Ze=W=>{var R=GG(),G=x(R);Y(()=>q(G,g(c))),T(W,R)};K(xe,W=>{g(c)&&W(Ze)})}var Dt=I(xe,2),mt=x(Dt),Me=x(mt),De=I(mt,2),Ue=x(De),Ge=I(De,2),Xe=x(Ge),Ce=I(Ge,2),Et=x(Ce),Ft=I(Dt,2),gi=x(Ft);{var Qi=W=>{var R=ZG();let G;var pe=I(x(R),2),se=x(pe),we=I(pe,2),ae=x(we);Y(()=>{G=Bt(R,1,"file-chip svelte-1twuiul",null,G,{inactive:!g(fe)}),q(se,t().id),Jn(we,"title",g(fe)?"Remove from context":"Re-add to context"),q(ae,g(fe)?"×":"+")}),oe("click",we,()=>k(fe,!g(fe))),T(W,R)};K(gi,W=>{t()&&W(Qi)})}var Ii=I(gi,2);di(Ii,17,()=>g($),In,(W,R,G)=>{const pe=ct(()=>xi(g(R).name));var se=XG(),we=x(se),ae=x(we),ue=I(we,2),Re=x(ue),_e=I(ue,2);Y((Ae,Ee)=>{Bt(we,1,`badge badge-${Ae??""}`,"svelte-1twuiul"),q(ae,Ee),q(Re,g(R).name)},[()=>g(pe).toLowerCase(),()=>Di(g(pe))]),oe("click",_e,()=>Ji(G)),T(W,se)});var ee=I(Ii,2),be=I(ee,2);Qs(be,W=>ze=W,()=>ze);var qe=I(Ft,2);let pt;var Lt=x(qe);let ce;var je=x(Lt);Qs(je,W=>dt=W,()=>dt);var yt=I(Lt,2);{var _t=W=>{var R=YG();oe("click",R,Ei),T(W,R)},st=W=>{var R=JG();Y(G=>R.disabled=G,[()=>!g(r).trim()||!g(lt)]),oe("click",R,Dn),T(W,R)};K(yt,W=>{g(a)?W(_t):W(st,-1)})}var Je=I(qe,2);{var j=W=>{var R=nZ(),G=x(R),pe=x(G),se=I(G,2);{var we=_e=>{var Ae=eZ();di(Ae,21,()=>g(u),In,(Ee,ge)=>{var et=QG(),ei=x(et),vi={};Y(()=>{q(ei,g(ge)),vi!==(vi=g(ge))&&(et.value=(et.__value=g(ge))??"")}),T(Ee,et)}),Y(()=>Ae.disabled=g(a)),El(Ae,()=>g(f),Ee=>k(f,Ee)),T(_e,Ae)},ae=_e=>{var Ae=tZ(),Ee=x(Ae);Y(()=>q(Ee,g(f)||g(d).model)),T(_e,Ae)};K(se,_e=>{g(u).length>0?_e(we):_e(ae,-1)})}var ue=I(se,2);{var Re=_e=>{var Ae=iZ();oe("click",Ae,mi),T(_e,Ae)};K(ue,_e=>{g(d).provider==="ollama"&&_e(Re)})}Y(()=>q(pe,g(d).provider)),T(W,R)};K(Je,W=>{g(lt)&&g(d)&&W(j)})}var re=I(xn,2);{var Le=W=>{var R=fZ(),G=x(R),pe=x(G),se=x(pe),we=x(se),ae=I(se,2),ue=I(pe,2),Re=x(ue);{var _e=ge=>{var et=sZ();T(ge,et)},Ae=ge=>{var et=oZ(),ei=x(et);Y(()=>q(ei,g(S))),T(ge,et)},Ee=ge=>{var et=gZ(),ei=x(et);{var vi=ve=>{var ke=rZ(),Nt=I(xt(ke)),At=x(Nt);Y(()=>q(At,g(_).version)),T(ve,ke)};K(ei,ve=>{g(_).version&&ve(vi)})}var Pi=I(ei,2);{var Mn=ve=>{var ke=aZ(),Nt=I(xt(ke)),At=x(Nt);Y(()=>q(At,g(_).details.family)),T(ve,ke)};K(Pi,ve=>{var ke;(ke=g(_).details)!=null&&ke.family&&ve(Mn)})}var ri=I(Pi,2);{var ai=ve=>{var ke=lZ(),Nt=I(xt(ke)),At=x(Nt);Y(()=>q(At,g(_).details.parameter_size)),T(ve,ke)};K(ri,ve=>{var ke;(ke=g(_).details)!=null&&ke.parameter_size&&ve(ai)})}var Wt=I(ri,2);{var hi=ve=>{var ke=cZ(),Nt=I(xt(ke)),At=x(Nt);Y(()=>q(At,g(_).details.quantization_level)),T(ve,ke)};K(Wt,ve=>{var ke;(ke=g(_).details)!=null&&ke.quantization_level&&ve(hi)})}var ki=I(Wt,2);{var St=ve=>{var ke=hZ(),Nt=I(xt(ke),2);di(Nt,21,()=>g(_).running,In,(At,Vi)=>{var en=dZ(),Ne=x(en);Y(ot=>q(Ne,`${g(Vi).name??""} · ${ot??""} VRAM`),[()=>Ci(g(Vi).size_vram)]),T(At,en)}),T(ve,ke)},Xt=ve=>{var ke=uZ();T(ve,ke)};K(ki,ve=>{g(_).running&&g(_).running.length>0?ve(St):g(_).running!==null&&ve(Xt,1)})}T(ge,et)};K(Re,ge=>{g(y)?ge(_e):g(S)?ge(Ae,1):g(_)&&ge(Ee,2)})}Y(()=>{var ge;return q(we,`Ollama · ${(g(f)||((ge=g(d))==null?void 0:ge.model))??""}`)}),oe("click",R,()=>k(v,!1)),oe("click",G,ge=>ge.stopPropagation()),oe("click",ae,()=>k(v,!1)),T(W,R)};K(re,W=>{g(v)&&W(Le)})}Y(W=>{q(Et,W),pt=Bt(qe,1,"input-row svelte-1twuiul",null,pt,{"drag-over":g(Pe)}),ce=Bt(Lt,1,"textarea-wrap svelte-1twuiul",null,ce,{loading:g(a)}),Jn(je,"placeholder",g(lt)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),je.disabled=g(a)||!g(lt)},[()=>Ci(g(Kt))]),eo(Me,()=>g(B),W=>k(B,W)),eo(Ue,()=>g(F),W=>k(F,W)),eo(Xe,()=>g(Q),W=>k(Q,W)),oe("click",ee,Ui),oe("change",be,mn),Kn("dragover",qe,wn),Kn("dragleave",qe,_n),Kn("drop",qe,Tn),oe("keydown",je,$i),Ki(je,()=>g(r),W=>k(r,W)),T(o,rn),Lo()}cr(["click","change","keydown"]);var _Z=A('<div class="me svelte-1pxdb1"></div>');function Ey(o,e){xo(e,!0);let t=qu(e,"value",15,""),i=qu(e,"language",3,"javascript"),n,s,r=!1;va(()=>{const c=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=Da.create(n,{value:t(),language:i(),theme:"vs-dark",minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,fontFamily:"'Cascadia Code', 'Fira Code', monospace",automaticLayout:!0,wordWrap:"on",lineNumbers:"on",renderLineHighlight:"none",overviewRulerLanes:0,scrollbar:{verticalScrollbarSize:6,horizontalScrollbarSize:6},...c}),s.onDidChangeModelContent(()=>{r||t(s.getValue())})}),Xb(()=>s==null?void 0:s.dispose()),kn(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var a=_Z();Qs(a,c=>n=c,()=>n),T(o,a),Lo()}const kD=o=>{var e=vZ();T(o,e)};var vZ=A('<div class="welcome svelte-rrt0o"><div class="welcome-inner svelte-rrt0o"><div class="welcome-logo svelte-rrt0o">db</div> <p class="welcome-sub svelte-rrt0o">sheDB — embedded JSON document store with MapReduce views</p> <div class="welcome-hint svelte-rrt0o"><strong>In scripts:</strong> use <code class="svelte-rrt0o">she.db.get(id)</code>, <code class="svelte-rrt0o">she.db.set(id, doc)</code>, <code class="svelte-rrt0o">she.db.extend(id, partial)</code>, <code class="svelte-rrt0o">she.db.sub(pattern, cb)</code>.<br/> <strong>Views:</strong> <code class="svelte-rrt0o">this</code> = current document — call <code class="svelte-rrt0o">emit(value)</code> to add to result.</div> <div class="welcome-links svelte-rrt0o"><a href="https://github.com/hobbyquaker/she/blob/main/doc/db/README.md" target="_blank" rel="noopener" class="svelte-rrt0o">sheDB docs</a> <span class="svelte-rrt0o">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/doc/db/view-examples.md" target="_blank" rel="noopener" class="svelte-rrt0o">View examples</a> <span class="svelte-rrt0o">·</span> <a href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" class="svelte-rrt0o">GitHub</a></div></div></div>'),DD=A('<div class="form-error svelte-rrt0o"> </div>'),bZ=A('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),ED=A("<li> </li>"),PD=A('<div class="error-bar svelte-rrt0o"> </div>'),TD=A('<div class="loading svelte-rrt0o">Loading…</div>'),wZ=A('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),yZ=A('<div class="editor-toolbar svelte-rrt0o"><span class="editor-title svelte-rrt0o"> </span> <button class="svelte-rrt0o">Save</button> <button class="btn-danger svelte-rrt0o">Delete</button></div> <!> <!>',1),SZ=A('<div class="panel svelte-rrt0o"><aside class="sidebar svelte-rrt0o"><div class="toolbar svelte-rrt0o"><button class="svelte-rrt0o">+ Doc</button></div> <!> <div class="sidebar-search svelte-rrt0o"><input type="search" placeholder="Filter…" class="svelte-rrt0o"/></div> <ul class="flat-list svelte-rrt0o"></ul></aside> <div class="resize-handle svelte-rrt0o" role="separator"></div> <main class="editor-area svelte-rrt0o"><!></main></div>'),CZ=A('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),xZ=A('<label class="opt-check svelte-rrt0o"><input type="checkbox" class="svelte-rrt0o"/> <span class="checkmark svelte-rrt0o"></span> Retain <span class="section-hint svelte-rrt0o">— send as retained MQTT message</span></label>'),LZ=A('<span class="badge-error svelte-rrt0o">error</span>'),IZ=A('<span class="badge-ok svelte-rrt0o"> </span>'),kZ=A('<pre class="result-error svelte-rrt0o"> </pre>'),DZ=A('<pre class="result-json svelte-rrt0o"> </pre>'),EZ=A('<div class="view-result svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),PZ=A('<div class="view-sections svelte-rrt0o"><div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Filter <span class="section-hint svelte-rrt0o">— MQTT wildcard, optional</span></div> <div class="section-body svelte-rrt0o"><input class="filter-input svelte-rrt0o" placeholder="#"/></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Map <span class="section-hint svelte-rrt0o">— <code>this</code> = document · call <code>emit(this)</code> to include in result</span></div> <div class="monaco-view-wrap monaco-view-wrap--map svelte-rrt0o"><!></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Reduce <span class="section-hint svelte-rrt0o">— receives <code>result</code> array, must <code>return</code> new value (optional)</span></div> <div class="monaco-view-wrap monaco-view-wrap--reduce svelte-rrt0o"><!></div></div> <div class="view-section view-section--options svelte-rrt0o"><label class="opt-check svelte-rrt0o"><input type="checkbox" class="svelte-rrt0o"/> <span class="checkmark svelte-rrt0o"></span> Publish to MQTT <span class="section-hint svelte-rrt0o">— publish view to MQTT topic <code> </code></span></label> <!></div> <!></div>'),TZ=A('<div class="editor-toolbar svelte-rrt0o"><span class="editor-title svelte-rrt0o"> </span> <button class="svelte-rrt0o">Save</button> <button title="Re-run view" class="svelte-rrt0o">Refresh</button> <button class="btn-danger svelte-rrt0o">Delete</button></div> <!> <!>',1),MZ=A('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),NZ=A('<div class="panel svelte-rrt0o"><aside class="sidebar svelte-rrt0o"><div class="toolbar svelte-rrt0o"><button class="svelte-rrt0o">+ View</button> <button title="AI assistant">AI</button></div> <!> <div class="sidebar-search svelte-rrt0o"><input type="search" placeholder="Filter…" class="svelte-rrt0o"/></div> <ul class="flat-list svelte-rrt0o"></ul></aside> <div class="resize-handle svelte-rrt0o" role="separator"></div> <main class="editor-area svelte-rrt0o"><!></main> <!></div>'),RZ=A('<div class="db-root svelte-rrt0o" role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button></div> <!></div>');function AZ(o,e){xo(e,!0);let t=U(Si([])),i=U(null),n=U("{}"),s=U(!1),r=U(null);const a="she-db-selected-view";let c=U(Si([])),d=U(Si(localStorage.getItem(a))),u=U("#"),f=U("// emit(this.someProperty)"),m=U(""),v=U(!1),_=U(!1),y=U(null),S=U(!1),D=U(null),E=U("she/db/view/");const N="she-db-panel";let B=U(Si(localStorage.getItem(N)??"docs")),F=U(""),Q=U(!1),$=U(null),fe=U(""),Pe=U(!1),ze=U(null);const me="she-db-sidebar-width";let Ve=U(Si(parseInt(localStorage.getItem(me)??"220",10))),dt=!1,Ke=0,Ut=0;const lt="she-db-chat-width",Kt="she-db-chat-open";let Ie=U(localStorage.getItem(Kt)==="true"),Pt=U(Si(parseInt(localStorage.getItem(lt)??"320",10))),Fe=!1,ft=0,zt=0;const Gt=ct(()=>g(d)?{id:g(d),filter:g(u),map:g(f),reduce:g(m)}:null);function ci($e){$e.filter!==void 0&&k(u,$e.filter,!0),$e.map!==void 0&&k(f,$e.map,!0),$e.reduce!==void 0&&k(m,$e.reduce,!0)}kn(()=>{localStorage.setItem(Kt,String(g(Ie)))}),kn(()=>{localStorage.setItem(N,g(B))}),kn(()=>{g(d)?localStorage.setItem(a,g(d)):localStorage.removeItem(a)});function Vt($e){dt=!0,Ke=$e.clientX,Ut=g(Ve),$e.preventDefault()}function Ht($e){dt&&k(Ve,Math.max(140,Math.min(500,Ut+$e.clientX-Ke)),!0),Fe&&k(Pt,Math.max(240,Math.min(600,zt-($e.clientX-ft))),!0)}function Fi(){dt&&(dt=!1,localStorage.setItem(me,String(g(Ve)))),Fe&&(Fe=!1,localStorage.setItem(lt,String(g(Pt))))}function zi($e){Fe=!0,ft=$e.clientX,zt=g(Pt),$e.preventDefault()}async function tt(){try{k(t,await GN(),!0)}catch{}}async function Ct(){try{k(c,await ZN(),!0)}catch{}}async function mi($e){k(i,$e,!0),k(r,null),k(s,!0);try{const ne=await Y8($e);k(n,JSON.stringify(ne,null,2),!0)}catch(ne){k(r,ne instanceof Error?ne.message:String(ne),!0)}finally{k(s,!1)}}async function Ci(){if(g(i)){k(r,null);try{const $e=JSON.parse(g(n));await eD(g(i),$e)}catch($e){k(r,$e instanceof Error?$e.message:String($e),!0)}}}async function xi(){if(g(i)&&confirm(`Delete document "${g(i)}"?`))try{await J8(g(i)),k(i,null),k(n,"{}")}catch($e){k(r,$e instanceof Error?$e.message:String($e),!0)}}async function Di(){const $e=g(F).trim();if($e){k($,null);try{await eD($e,{}),k(Q,!1),k(F,""),await mi($e)}catch(ne){k($,ne instanceof Error?ne.message:String(ne),!0)}}}async function Ji($e){k(d,$e,!0),k(D,null),k(S,!0),k(y,null);try{const ne=await Q8($e);k(u,ne.filter??"",!0),k(f,ne.map,!0),k(m,ne.reduce??"",!0),k(v,ne.mqttpub??!1,!0),k(_,ne.retain??!1,!0),k(y,await ky($e).catch(()=>null),!0)}catch(ne){k(D,ne instanceof Error?ne.message:String(ne),!0)}finally{k(S,!1)}}async function Ui(){if(g(d)){k(D,null);try{const $e={map:g(f)};g(u).trim()&&($e.filter=g(u).trim()),g(m).trim()&&($e.reduce=g(m).trim()),g(v)&&($e.mqttpub=!0),g(_)&&($e.retain=!0),await tD(g(d),$e)}catch($e){k(D,$e instanceof Error?$e.message:String($e),!0)}}}async function bn(){if(g(d))try{k(y,await ky(g(d)),!0)}catch($e){k(D,$e instanceof Error?$e.message:String($e),!0)}}async function mn(){if(g(d)&&confirm(`Delete view "${g(d)}"?`))try{await e7(g(d)),k(d,null),k(u,""),k(f,"// emit(this.someProperty)"),k(m,""),k(v,!1),k(_,!1),k(y,null)}catch($e){k(D,$e instanceof Error?$e.message:String($e),!0)}}async function Tn(){if(!g(fe).trim())return;const $e=g(fe).trim();k(ze,null);try{await tD($e,{map:"// emit(this.someProperty)"}),k(Pe,!1),k(fe,""),await Ct(),await Ji($e)}catch(ne){k(ze,ne instanceof Error?ne.message:String(ne),!0)}}let wn=U(""),_n=U(""),Dn=ct(()=>[...g(t)].filter($e=>!g(wn)||$e.toLowerCase().includes(g(wn).toLowerCase())).sort()),Ei=ct(()=>[...g(c)].filter($e=>!g(_n)||$e.toLowerCase().includes(g(_n).toLowerCase())).sort());va(()=>{tt(),Ct(),g(d)&&Ji(g(d)),KN().then(Te=>{const nt=Te.dbPrefix||"she/db/",wt=nt.endsWith("/")?nt:nt+"/";k(E,wt+"view/")}).catch(()=>{});const $e=Rl("db:ids",Te=>{k(t,Te.ids??[],!0)}),ne=Rl("db:viewIds",Te=>{k(c,Te.ids??[],!0)}),it=Rl("db:change",async Te=>{const nt=Te.id;g(i)===nt&&(Te.doc===null?(k(i,null),k(n,"{}")):k(n,JSON.stringify(Te.doc,null,2),!0))}),Z=Rl("db:viewUpdate",async Te=>{const nt=Te.id;g(d)===nt&&k(y,await ky(nt).catch(()=>null),!0)});return()=>{$e(),ne(),it(),Z()}});var $i=RZ(),Fn=x($i),hn=x(Fn);let Ai;var rn=I(hn,2);let xn;var Ln=I(Fn,2);{var Bn=$e=>{var ne=SZ(),it=x(ne);let Z;var Te=x(it),nt=x(Te),wt=I(Te,2);{var Qt=mt=>{var Me=bZ(),De=xt(Me),Ue=x(De),Ge=I(Ue,2),Xe=I(De,2);{var Ce=Et=>{var Ft=DD(),gi=x(Ft);Y(()=>q(gi,g($))),T(Et,Ft)};K(Xe,Et=>{g($)&&Et(Ce)})}oe("keydown",Ue,Et=>Et.key==="Enter"&&Di()),Ki(Ue,()=>g(F),Et=>k(F,Et)),oe("click",Ge,Di),T(mt,Me)};K(wt,mt=>{g(Q)&&mt(Qt)})}var Zt=I(wt,2),Li=x(Zt),_i=I(Zt,2);di(_i,20,()=>g(Dn),mt=>mt,(mt,Me)=>{var De=ED();let Ue;var Ge=x(De);Y(()=>{Ue=Bt(De,1,"flat-item svelte-rrt0o",null,Ue,{"active-item":g(i)===Me}),q(Ge,Me)}),oe("click",De,()=>mi(Me)),T(mt,De)});var O=I(it,2),X=I(O,2),xe=x(X);{var Ze=mt=>{var Me=yZ(),De=xt(Me),Ue=x(De),Ge=x(Ue),Xe=I(Ue,2),Ce=I(Xe,2),Et=I(De,2);{var Ft=ee=>{var be=PD(),qe=x(be);Y(()=>q(qe,g(r))),T(ee,be)};K(Et,ee=>{g(r)&&ee(Ft)})}var gi=I(Et,2);{var Qi=ee=>{var be=TD();T(ee,be)},Ii=ee=>{var be=wZ(),qe=x(be);Ey(qe,{language:"json",get value(){return g(n)},set value(pt){k(n,pt,!0)}}),T(ee,be)};K(gi,ee=>{g(s)?ee(Qi):ee(Ii,-1)})}Y(()=>q(Ge,g(i))),oe("click",Xe,Ci),oe("click",Ce,xi),T(mt,Me)},Dt=mt=>{kD(mt)};K(xe,mt=>{g(i)?mt(Ze):mt(Dt,-1)})}Y(()=>Z=Fo(it,"",Z,{width:`${g(Ve)??""}px`})),oe("click",nt,()=>{k(Q,!g(Q)),k($,null)}),Ki(Li,()=>g(wn),mt=>k(wn,mt)),oe("mousedown",O,Vt),T($e,ne)},Hn=$e=>{var ne=NZ(),it=x(ne);let Z;var Te=x(it),nt=x(Te),wt=I(nt,2);let Qt;var Zt=I(Te,2);{var Li=Ge=>{var Xe=CZ(),Ce=xt(Xe),Et=x(Ce),Ft=I(Et,2),gi=I(Ce,2);{var Qi=Ii=>{var ee=DD(),be=x(ee);Y(()=>q(be,g(ze))),T(Ii,ee)};K(gi,Ii=>{g(ze)&&Ii(Qi)})}oe("keydown",Et,Ii=>Ii.key==="Enter"&&Tn()),Ki(Et,()=>g(fe),Ii=>k(fe,Ii)),oe("click",Ft,Tn),T(Ge,Xe)};K(Zt,Ge=>{g(Pe)&&Ge(Li)})}var _i=I(Zt,2),O=x(_i),X=I(_i,2);di(X,20,()=>g(Ei),Ge=>Ge,(Ge,Xe)=>{var Ce=ED();let Et;var Ft=x(Ce);Y(()=>{Et=Bt(Ce,1,"flat-item svelte-rrt0o",null,Et,{"active-item":g(d)===Xe}),q(Ft,Xe)}),oe("click",Ce,()=>Ji(Xe)),T(Ge,Ce)});var xe=I(it,2),Ze=I(xe,2),Dt=x(Ze);{var mt=Ge=>{var Xe=TZ(),Ce=xt(Xe),Et=x(Ce),Ft=x(Et),gi=I(Et,2),Qi=I(gi,2),Ii=I(Qi,2),ee=I(Ce,2);{var be=ce=>{var je=PD(),yt=x(je);Y(()=>q(yt,g(D))),T(ce,je)};K(ee,ce=>{g(D)&&ce(be)})}var qe=I(ee,2);{var pt=ce=>{var je=TD();T(ce,je)},Lt=ce=>{var je=PZ(),yt=x(je),_t=I(x(yt),2),st=x(_t),Je=I(yt,2),j=I(x(Je),2),re=x(j);Ey(re,{language:"javascript",get value(){return g(f)},set value(ge){k(f,ge,!0)}});var Le=I(Je,2),W=I(x(Le),2),R=x(W);Ey(R,{language:"javascript",get value(){return g(m)},set value(ge){k(m,ge,!0)}});var G=I(Le,2),pe=x(G),se=x(pe),we=I(se,4),ae=I(x(we)),ue=x(ae),Re=I(pe,2);{var _e=ge=>{var et=xZ(),ei=x(et);eo(ei,()=>g(_),vi=>k(_,vi)),T(ge,et)};K(Re,ge=>{g(v)&&ge(_e)})}var Ae=I(G,2);{var Ee=ge=>{var et=EZ(),ei=x(et),vi=I(x(ei));{var Pi=hi=>{var ki=LZ();T(hi,ki)},Mn=hi=>{var ki=IZ(),St=x(ki);Y(()=>q(St,`${g(y).length??0??""} items · rev ${g(y)._rev??""}`)),T(hi,ki)};K(vi,hi=>{g(y).error?hi(Pi):hi(Mn,-1)})}var ri=I(ei,2);{var ai=hi=>{var ki=kZ(),St=x(ki);Y(()=>q(St,g(y).error)),T(hi,ki)},Wt=hi=>{var ki=DZ(),St=x(ki);Y(Xt=>q(St,Xt),[()=>JSON.stringify(g(y).result,null,2)]),T(hi,ki)};K(ri,hi=>{g(y).error?hi(ai):hi(Wt,-1)})}T(ge,et)};K(Ae,ge=>{g(y)&&ge(Ee)})}Y(()=>q(ue,`${g(E)??""}${g(d)??""} on every update`)),Ki(st,()=>g(u),ge=>k(u,ge)),eo(se,()=>g(v),ge=>k(v,ge)),T(ce,je)};K(qe,ce=>{g(S)?ce(pt):ce(Lt,-1)})}Y(()=>q(Ft,g(d))),oe("click",gi,Ui),oe("click",Qi,bn),oe("click",Ii,mn),T(Ge,Xe)},Me=Ge=>{kD(Ge)};K(Dt,Ge=>{g(d)?Ge(mt):Ge(Me,-1)})}var De=I(Ze,2);{var Ue=Ge=>{var Xe=MZ(),Ce=xt(Xe),Et=I(Ce,2);let Ft;var gi=x(Et);mZ(gi,{get currentView(){return g(Gt)},onApplyView:ci}),Y(()=>Ft=Fo(Et,"",Ft,{width:`${g(Pt)??""}px`})),oe("mousedown",Ce,zi),T(Ge,Xe)};K(De,Ge=>{g(Ie)&&Ge(Ue)})}Y(()=>{Z=Fo(it,"",Z,{width:`${g(Ve)??""}px`}),Qt=Bt(wt,1,"chat-toggle svelte-rrt0o",null,Qt,{active:g(Ie)})}),oe("click",nt,()=>{k(Pe,!g(Pe)),k(ze,null)}),oe("click",wt,()=>k(Ie,!g(Ie))),Ki(O,()=>g(_n),Ge=>k(_n,Ge)),oe("mousedown",xe,Vt),T($e,ne)};K(Ln,$e=>{g(B)==="docs"?$e(Bn):$e(Hn,-1)})}Y(()=>{Ai=Bt(hn,1,"svelte-rrt0o",null,Ai,{active:g(B)==="docs"}),xn=Bt(rn,1,"svelte-rrt0o",null,xn,{active:g(B)==="views"})}),oe("mousemove",$i,Ht),oe("mouseup",$i,Fi),Kn("mouseleave",$i,Fi),oe("click",hn,()=>k(B,"docs")),oe("click",rn,()=>k(B,"views")),T(o,$i),Lo()}cr(["mousemove","mouseup","click","keydown","mousedown"]);var OZ=A('<label class="svelte-1ua3isv">Passcode <input type="number" placeholder="20202021" class="svelte-1ua3isv"/></label> <label class="svelte-1ua3isv">Discriminator (optional) <input type="number" placeholder="3840" class="svelte-1ua3isv"/></label>',1),FZ=A('<label class="svelte-1ua3isv">Pairing Code / QR <input type="text" placeholder="MT:..." class="svelte-1ua3isv"/></label>'),MD=A('<p class="err svelte-1ua3isv"> </p>'),HZ=A('<div class="wizard svelte-1ua3isv"><div class="wizard-tabs svelte-1ua3isv"><button>Passcode</button> <button>QR / Code</button></div> <!> <label class="svelte-1ua3isv">IP Address (optional, bypasses mDNS) <input type="text" placeholder="192.168.1.100 or 192.168.1.100:5540" class="svelte-1ua3isv"/></label> <!> <button class="commission-btn svelte-1ua3isv"> </button></div>'),WZ=A('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),BZ=A('<span class="device-name svelte-1ua3isv"> </span>'),zZ=A('<li><button class="device-select-btn svelte-1ua3isv"><span></span> <span class="device-label svelte-1ua3isv"><!></span></button> <button class="unpair-btn svelte-1ua3isv" title="Unpair">✕</button></li>'),VZ=A('<li class="empty svelte-1ua3isv">No paired devices</li>'),jZ=A('<p class="info svelte-1ua3isv">Loading…</p>'),UZ=A('<p class="device-subtitle svelte-1ua3isv"> </p>'),$Z=A('<span class="ep-chip svelte-1ua3isv"> </span>'),qZ=A('<span class="attr-id svelte-1ua3isv"> </span>'),KZ=A('<button class="attr-action-btn svelte-1ua3isv"> </button>'),GZ=A('<div class="attr-actions svelte-1ua3isv"></div>'),ZZ=A('<span class="cmd-sep svelte-1ua3isv">,</span>'),XZ=A('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),YZ=A('<span class="cmd-id svelte-1ua3isv"> </span>'),JZ=A("<!> <!>",1),QZ=A('<span class="cmd-list svelte-1ua3isv"></span>'),e9=A(' <span class="cmd-id svelte-1ua3isv"> </span>',1),t9=A('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),i9=A('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"><th class="svelte-1ua3isv">deviceType</th><th class="svelte-1ua3isv">revision</th></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),n9=A('<th class="svelte-1ua3isv"> </th>'),s9=A('<td class="svelte-1ua3isv"> </td>'),o9=A('<tr class="svelte-1ua3isv"></tr>'),r9=A('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),a9=A('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),l9=A('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),c9=A('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),d9=A('<span class="attr-val svelte-1ua3isv"> </span>'),h9=A('<tr class="svelte-1ua3isv"><td class="attr-name-cell svelte-1ua3isv"><span class="attr-key svelte-1ua3isv"> </span><!></td><td class="attr-actions-cell svelte-1ua3isv"><!></td><td class="attr-val-cell svelte-1ua3isv"><!></td></tr>'),u9=A('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),g9=A('<table class="cluster-table svelte-1ua3isv"><colgroup><col class="col-attr-name svelte-1ua3isv"/><col class="col-attr-actions svelte-1ua3isv"/><col class="col-attr-val"/></colgroup><tbody class="svelte-1ua3isv"></tbody></table>'),f9=A('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),p9=A('<details class="svelte-1ua3isv"><summary class="svelte-1ua3isv"> <span class="ep-id svelte-1ua3isv"> </span> <span class="ep-chips svelte-1ua3isv"></span></summary> <!></details>'),m9=A('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),_9=A('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),v9=A('<span class="stream-badge svelte-1ua3isv"> </span>'),b9=A('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),Py=A(' <span class="e-sub svelte-1ua3isv"> </span>',1),w9=A('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),y9=A('<span class="e-badge e-badge-attr svelte-1ua3isv">attr</span> <span class="e-node svelte-1ua3isv"> <!></span> <span class="e-ep svelte-1ua3isv"> <!></span> <span class="e-cluster svelte-1ua3isv"> </span> <span class="e-attr svelte-1ua3isv"> </span> <span class="e-val svelte-1ua3isv"> </span>',1),S9=A('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),C9=A('<div class="stream-body svelte-1ua3isv"><!></div>'),x9=A('<div class="matter-page svelte-1ua3isv"><div class="matter-main svelte-1ua3isv"><div class="sidebar svelte-1ua3isv"><div class="sidebar-header svelte-1ua3isv"><span class="sidebar-title svelte-1ua3isv">Matter Devices</span> <button class="add-btn svelte-1ua3isv" title="Commission new device">+</button></div> <!> <ul class="device-list svelte-1ua3isv"><!> <!></ul></div> <div class="detail svelte-1ua3isv"><!></div></div> <div class="stream-panel svelte-1ua3isv"><div class="stream-resize svelte-1ua3isv"></div> <div class="stream-hdr-row svelte-1ua3isv"><span class="stream-title svelte-1ua3isv">Matter Events</span> <!> <button class="stream-toggle svelte-1ua3isv" title="Toggle event feed"> </button></div> <!></div></div>');function L9(o,e){xo(e,!0);const t={onOff:{onOff:[{label:"On",command:"on"},{label:"Off",command:"off"},{label:"Toggle",command:"toggle"}]},levelControl:{currentLevel:[{label:"Step ▲",command:"stepWithOnOff",args:{stepMode:0,stepSize:25,transitionTime:5}},{label:"Step ▼",command:"stepWithOnOff",args:{stepMode:1,stepSize:25,transitionTime:5}}]},windowCovering:{currentPositionLiftPercent100ths:[{label:"Open",command:"upOrOpen"},{label:"Close",command:"downOrClose"},{label:"Stop",command:"stopMotion"}],currentPositionTiltPercent100ths:[{label:"Open",command:"upOrOpen"},{label:"Close",command:"downOrClose"},{label:"Stop",command:"stopMotion"}]}};async function i(Z,Te,nt,wt,Qt){try{await l7(Z,Te,nt,wt,Qt)}catch(Zt){console.error("matter command failed",Zt)}}const n={identify:{0:"identify",1:"triggerEffect"},groups:{0:"addGroup",1:"viewGroup",2:"getGroupMembership",3:"removeGroup",4:"removeAllGroups",5:"addGroupIfIdentifying"},scenes:{0:"addScene",1:"viewScene",2:"removeScene",3:"removeAllScenes",4:"storeScene",5:"recallScene",6:"getSceneMembership",64:"enhancedAddScene",65:"enhancedViewScene",66:"copyScene"},onOff:{0:"off",1:"on",2:"toggle",64:"offWithEffect",65:"onWithRecallGlobalScene",66:"onWithTimedOff"},levelControl:{0:"moveToLevel",1:"move",2:"step",3:"stop",4:"moveToLevelWithOnOff",5:"moveWithOnOff",6:"stepWithOnOff",7:"stopWithOnOff",8:"moveToClosestFrequency"},colorControl:{0:"moveToHue",1:"moveHue",2:"stepHue",3:"moveToSaturation",4:"moveSaturation",5:"stepSaturation",6:"moveToHueAndSaturation",7:"moveToColor",8:"moveColor",9:"stepColor",10:"moveToColorTemperature",64:"enhancedMoveToHue",65:"enhancedMoveHue",66:"enhancedStepHue",67:"enhancedMoveToHueAndSaturation",68:"colorLoopSet",71:"stopMoveStep",75:"moveColorTemperature",76:"stepColorTemperature"},thermostat:{0:"setpointRaiseLower",1:"setWeeklySchedule",2:"getWeeklySchedule",3:"clearWeeklySchedule"},doorLock:{0:"lockDoor",1:"unlockDoor",3:"unlockWithTimeout",11:"setWeekDaySchedule",12:"getWeekDaySchedule",13:"clearWeekDaySchedule",14:"setYearDaySchedule",15:"getYearDaySchedule",16:"clearYearDaySchedule",17:"setHolidaySchedule",18:"getHolidaySchedule",19:"clearHolidaySchedule",26:"setUser",27:"getUser",28:"clearUser",34:"setCredential",36:"getCredential",38:"clearCredential"},windowCovering:{0:"upOrOpen",1:"downOrClose",2:"stopMotion",4:"goToLiftValue",5:"goToLiftPercentage",7:"goToTiltValue",8:"goToTiltPercentage"},fanControl:{0:"step"}};function s(Z,Te){const nt=n[Z];return Te.map(wt=>{const Qt=typeof wt=="number"?wt:Number(wt);return{id:Qt,name:(nt==null?void 0:nt[Qt])??null}})}const r={10:"Door Lock",11:"Door Lock Controller",14:"Aggregator",15:"Generic Switch",17:"On/Off Plug-In Unit",18:"Dimmable Plug-In Unit",19:"Pump",20:"On/Off Light Switch",21:"Dimmer Switch",22:"Color Dimmer Switch",23:"Control Bridge",24:"Pump Controller",256:"On/Off Light",257:"Dimmable Light",268:"Extended Color Light",269:"Color Temperature Light",262:"Light Sensor",263:"Occupancy Sensor",514:"Window Covering",515:"Window Covering Controller",768:"Heating/Cooling Unit",769:"Thermostat",770:"Temperature Sensor",771:"Pressure Sensor",772:"Flow Sensor",773:"Humidity Sensor",774:"On/Off Sensor",2112:"Air Quality Sensor"},a={generatedCommandList:65528,acceptedCommandList:65529,eventList:65530,attributeList:65531,featureMap:65532,clusterRevision:65533},c={descriptor:{deviceTypeList:0,serverList:1,clientList:2,partsList:3,tagList:4},basicInformation:{dataModelRevision:0,vendorName:1,vendorID:2,vendorId:2,productName:3,productID:4,productId:4,nodeLabel:5,location:6,hardwareVersion:7,hardwareVersionString:8,softwareVersion:9,softwareVersionString:10,manufacturingDate:11,partNumber:12,productURL:13,productUrl:13,productLabel:14,serialNumber:15,localConfigDisabled:16,reachable:17,uniqueID:18,uniqueId:18,capabilityMinima:19,productAppearance:20,specificationVersion:21,maxPathsPerInvoke:22},bridgedDeviceBasicInformation:{vendorName:1,vendorID:2,vendorId:2,productName:3,productId:4,nodeLabel:5,hardwareVersion:7,hardwareVersionString:8,softwareVersion:9,softwareVersionString:10,manufacturingDate:11,partNumber:12,productURL:13,productUrl:13,productLabel:14,serialNumber:15,reachable:17,uniqueID:18,uniqueId:18,productAppearance:20},identify:{identifyTime:0,identifyType:1},groups:{nameSupport:0},onOff:{onOff:0,globalSceneControl:16384,onTime:16385,offWaitTime:16386,startUpOnOff:16387},levelControl:{currentLevel:0,remainingTime:1,minLevel:2,maxLevel:3,currentFrequency:4,minFrequency:5,maxFrequency:6,options:15,onOffTransitionTime:16,onLevel:17,onTransitionTime:18,offTransitionTime:19,defaultMoveRate:20,startUpCurrentLevel:16384},colorControl:{currentHue:0,currentSaturation:1,remainingTime:2,currentX:3,currentY:4,colorTemperatureMireds:7,colorMode:8,options:15,enhancedCurrentHue:16384,enhancedColorMode:16385,colorLoopActive:16386,colorLoopDirection:16387,colorLoopTime:16388,colorCapabilities:16394,colorTempPhysicalMinMireds:16395,colorTempPhysicalMaxMireds:16396,coupleColorTempToLevelMinMireds:16397,startUpColorTemperatureMireds:16400},thermostat:{localTemperature:0,outdoorTemperature:1,occupancy:2,absMinHeatSetpointLimit:3,absMaxHeatSetpointLimit:4,absMinCoolSetpointLimit:5,absMaxCoolSetpointLimit:6,piCoolingDemand:7,piHeatingDemand:8,localTemperatureCalibration:16,occupiedCoolingSetpoint:17,occupiedHeatingSetpoint:18,unoccupiedCoolingSetpoint:19,unoccupiedHeatingSetpoint:20,minHeatSetpointLimit:21,maxHeatSetpointLimit:22,minCoolSetpointLimit:23,maxCoolSetpointLimit:24,minSetpointDeadBand:25,remoteSensing:26,controlSequenceOfOperation:27,systemMode:28,thermostatRunningMode:30,startOfWeek:32,numberOfWeeklyTransitions:33,numberOfDailyTransitions:34,temperatureSetpointHold:35,temperatureSetpointHoldDuration:36,thermostatProgrammingOperationMode:37,thermostatRunningState:41,setpointChangeSource:48,setpointChangeAmount:49,setpointChangeSourceTimestamp:50,occupiedSetback:52,unoccupiedSetback:55,emergencyHeatDelta:58},windowCovering:{type:0,physicalClosedLimitLift:1,physicalClosedLimitTilt:2,currentPositionLift:3,currentPositionTilt:4,numberOfActuationsLift:5,numberOfActuationsTilt:6,configStatus:7,currentPositionLiftPercentage:8,currentPositionTiltPercentage:9,operationalStatus:10,targetPositionLiftPercent100ths:11,targetPositionTiltPercent100ths:12,endProductType:13,currentPositionLiftPercent100ths:14,currentPositionTiltPercent100ths:15,installedOpenLimitLift:16,installedClosedLimitLift:17,installedOpenLimitTilt:18,installedClosedLimitTilt:19,mode:23,safetyStatus:26},doorLock:{lockState:0,lockType:1,actuatorEnabled:2,doorState:3,numberOfTotalUsersSupported:17,numberOfPINUsersSupported:18,maxPINCodeLength:23,minPINCodeLength:24,language:33,autoRelockTime:35,soundVolume:36,operatingMode:37,supportedOperatingModes:38,wrongCodeEntryLimit:48},fanControl:{fanMode:0,fanModeSequence:1,percentSetting:2,percentCurrent:3,speedMax:4,speedSetting:5,speedCurrent:6,rockSupport:7,rockSetting:8,windSupport:9,windSetting:10,airflowDirectionSupport:11,airflowDirection:12},occupancySensing:{occupancy:0,occupancySensorType:1,occupancySensorTypeBitmap:2,holdTime:3,pirOccupiedToUnoccupiedDelay:16,pirUnoccupiedToOccupiedDelay:17},illuminanceMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3,lightSensorType:4},temperatureMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},pressureMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3,scaledValue:16,minScaledValue:17,maxScaledValue:18,scale:20},flowMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},relativeHumidityMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},powerSource:{status:0,order:1,description:2,batVoltage:11,batPercentRemaining:12,batTimeRemaining:13,batChargeLevel:14,batReplacementNeeded:15,batReplaceability:16,batPresent:17,activeBatFaults:18,batChargeState:26}};function d(Z){return"0x"+Z.toString(16).toUpperCase().padStart(4,"0")}let u=U(Si([])),f=Si(new Map);function m(Z){if(Z==null)return"—";if(typeof Z=="boolean"||typeof Z=="number")return String(Z);if(typeof Z=="string")return Z.length>50?Z.slice(0,47)+"…":Z;const Te=JSON.stringify(Z);return Te.length>60?Te.slice(0,57)+"…":Te}function v(Z){return Z==null?"—":typeof Z=="boolean"||typeof Z=="number"?String(Z):typeof Z=="string"?Z:JSON.stringify(Z)}function _(Z){return Z!==null&&typeof Z=="object"&&!Array.isArray(Z)}function y(Z){return Array.isArray(Z)&&Z.length>0&&Z.every(_)}function S(Z,Te){return!!(Te==="attributeList"||Array.isArray(Z)&&Z.length===0||_(Z)&&Object.keys(Z).length===0)}function D(Z){return new Date(Z).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}const E=500,N=20,B=32;let F=0,Q=U(Si([])),$=U(!0),fe=U(180),Pe=ct(()=>{const Z=Math.max(1,Math.floor((g(fe)-B)/N)+1);return g(Q).slice(0,Z)});function ze(Z){Z.preventDefault();const Te=Z.clientY,nt=g(fe);function wt(Zt){k(fe,Math.max(60,Math.min(600,nt+Te-Zt.clientY)),!0)}function Qt(){document.removeEventListener("mousemove",wt),document.removeEventListener("mouseup",Qt)}document.addEventListener("mousemove",wt),document.addEventListener("mouseup",Qt)}let me=U(null),Ve=U(!1),dt=U(null),Ke=U(!1),Ut=U("passcode"),lt=U(""),Kt=U(""),Ie=U(""),Pt=U(!1),Fe=U(null),ft=U("");const zt="she:matter:selectedNodeId";async function Gt(){try{k(u,await XN(),!0);for(const Z of g(u))a_(Z.nodeId).then(Te=>{f.set(Z.nodeId,Te)}).catch(()=>{});if(g(u).length>0&&!g(me)){const Z=localStorage.getItem(zt),Te=Z&&g(u).find(nt=>nt.nodeId===Z)?Z:g(u)[0].nodeId;ci(Te)}}catch{k(u,[],!0)}}async function ci(Z){k(Ve,!0),k(dt,null);try{k(me,await a_(Z),!0),f.set(Z,g(me)),localStorage.setItem(zt,Z)}catch(Te){k(dt,Te instanceof Error?Te.message:String(Te),!0)}finally{k(Ve,!1)}}async function Vt(Z){var Te;if(confirm(`Unpair device ${Z}?`))try{await a7(Z),((Te=g(me))==null?void 0:Te.nodeId)===Z&&k(me,null),await Gt()}catch(nt){k(dt,nt instanceof Error?nt.message:String(nt),!0)}}async function Ht(){k(Pt,!0),k(Fe,null);try{let Z;g(Ut)==="passcode"?(Z={passcode:Number(g(lt))},g(Kt)&&(Z={...Z,discriminator:Number(g(Kt))})):Z={pairingCode:g(Ie).trim()},g(ft).trim()&&(Z={...Z,discoveryAddress:g(ft).trim()}),await r7(Z),k(Ke,!1),k(lt,""),k(Kt,""),k(Ie,""),k(ft,""),await Gt()}catch(Z){k(Fe,Z instanceof Error?Z.message:String(Z),!0)}finally{k(Pt,!1)}}va(()=>{Gt()});const Fi=Rl("matter:deviceList",Z=>{if(!Array.isArray(Z.devices))return;const Te=Z.devices;for(const nt of Te)f.has(nt.nodeId)||a_(nt.nodeId).then(wt=>{f.set(nt.nodeId,wt)}).catch(()=>{});k(u,Te,!0)}),zi=Rl("matter:deviceStatus",Z=>{if(Z.nodeId===void 0)return;const Te=String(Z.nodeId),nt=!!Z.online;k(u,g(u).map(wt=>wt.nodeId===Te?{...wt,online:nt}:wt),!0),k(Q,[{id:F++,kind:"status",nodeId:Te,online:nt,ts:Date.now()},...g(Q).slice(0,E-1)],!0)}),tt=Rl("matter:attr",Z=>{const Te=String(Z.nodeId),nt=Z.endpointId,wt=String(Z.clusterName),Qt=String(Z.attrName),Zt=Z.value;if(g(me)&&g(me).nodeId===Te){const _i=g(me).endpoints.find(X=>X.endpointId===nt),O=_i==null?void 0:_i.clusters.find(X=>X.name===wt);O&&(O.attrs[Qt]=Zt)}const Li=f.get(Te);if(Li){const _i=Li.endpoints.find(X=>X.endpointId===nt),O=_i==null?void 0:_i.clusters.find(X=>X.name===wt);O&&(O.attrs[Qt]=Zt)}k(Q,[{id:F++,kind:"attr",nodeId:Te,endpointId:nt,clusterName:wt,attrName:Qt,value:Zt,ts:Z.ts??Date.now()},...g(Q).slice(0,E-1)],!0)});Xb(()=>{Fi(),zi(),tt()});var Ct=x9(),mi=x(Ct),Ci=x(mi),xi=x(Ci),Di=I(x(xi),2),Ji=I(xi,2);{var Ui=Z=>{var Te=HZ(),nt=x(Te),wt=x(nt);let Qt;var Zt=I(wt,2);let Li;var _i=I(nt,2);{var O=Ue=>{var Ge=OZ(),Xe=xt(Ge),Ce=I(x(Xe)),Et=I(Xe,2),Ft=I(x(Et));Ki(Ce,()=>g(lt),gi=>k(lt,gi)),Ki(Ft,()=>g(Kt),gi=>k(Kt,gi)),T(Ue,Ge)},X=Ue=>{var Ge=FZ(),Xe=I(x(Ge));Ki(Xe,()=>g(Ie),Ce=>k(Ie,Ce)),T(Ue,Ge)};K(_i,Ue=>{g(Ut)==="passcode"?Ue(O):Ue(X,-1)})}var xe=I(_i,2),Ze=I(x(xe)),Dt=I(xe,2);{var mt=Ue=>{var Ge=MD(),Xe=x(Ge);Y(()=>q(Xe,g(Fe))),T(Ue,Ge)};K(Dt,Ue=>{g(Fe)&&Ue(mt)})}var Me=I(Dt,2),De=x(Me);Y(()=>{Qt=Bt(wt,1,"svelte-1ua3isv",null,Qt,{active:g(Ut)==="passcode"}),Li=Bt(Zt,1,"svelte-1ua3isv",null,Li,{active:g(Ut)==="pairingCode"}),Me.disabled=g(Pt),q(De,g(Pt)?"Commissioning…":"Commission")}),oe("click",wt,()=>k(Ut,"passcode")),oe("click",Zt,()=>k(Ut,"pairingCode")),Ki(Ze,()=>g(ft),Ue=>k(ft,Ue)),oe("click",Me,Ht),T(Z,Te)};K(Ji,Z=>{g(Ke)&&Z(Ui)})}var bn=I(Ji,2),mn=x(bn);di(mn,17,()=>g(u),Z=>Z.nodeId,(Z,Te)=>{var nt=zZ();let wt;var Qt=x(nt),Zt=x(Qt);let Li;var _i=I(Zt,2),O=x(_i);{var X=Dt=>{var mt=WZ(),Me=xt(mt),De=x(Me),Ue=I(Me,2),Ge=x(Ue);Y(()=>{q(De,g(Te).name),q(Ge,`#${g(Te).nodeId??""}`)}),T(Dt,mt)},xe=Dt=>{var mt=BZ(),Me=x(mt);Y(()=>q(Me,`Node ${g(Te).nodeId??""}`)),T(Dt,mt)};K(O,Dt=>{g(Te).name?Dt(X):Dt(xe,-1)})}var Ze=I(Qt,2);Y(()=>{var Dt;wt=Bt(nt,1,"svelte-1ua3isv",null,wt,{selected:((Dt=g(me))==null?void 0:Dt.nodeId)===g(Te).nodeId}),Li=Bt(Zt,1,"status-dot svelte-1ua3isv",null,Li,{online:g(Te).online})}),oe("click",Qt,()=>ci(g(Te).nodeId)),oe("click",Ze,()=>Vt(g(Te).nodeId)),T(Z,nt)});var Tn=I(mn,2);{var wn=Z=>{var Te=VZ();T(Z,Te)};K(Tn,Z=>{g(u).length===0&&Z(wn)})}var _n=I(Ci,2),Dn=x(_n);{var Ei=Z=>{var Te=jZ();T(Z,Te)},$i=Z=>{var Te=MD(),nt=x(Te);Y(()=>q(nt,g(dt))),T(Z,Te)},Fn=Z=>{var Te=m9(),nt=xt(Te),wt=x(nt),Qt=x(wt),Zt=I(wt,2);{var Li=xe=>{var Ze=UZ(),Dt=x(Ze);Y(()=>q(Dt,g(me).subtitle)),T(xe,Ze)};K(Zt,xe=>{g(me).subtitle&&xe(Li)})}var _i=I(Zt,2),O=x(_i),X=I(nt,2);di(X,17,()=>g(me).endpoints,xe=>xe.endpointId,(xe,Ze)=>{var Dt=p9(),mt=x(Dt),Me=x(mt),De=I(Me),Ue=x(De),Ge=I(De,2);di(Ge,21,()=>g(Ze).clusters,In,(Ft,gi)=>{var Qi=$Z(),Ii=x(Qi);Y(()=>q(Ii,g(gi).name)),T(Ft,Qi)});var Xe=I(mt,2);{var Ce=Ft=>{var gi=g9(),Qi=I(x(gi));di(Qi,21,()=>g(Ze).clusters,In,(Ii,ee)=>{var be=u9(),qe=xt(be),pt=x(qe),Lt=x(pt),ce=I(qe,2);di(ce,17,()=>Object.entries(g(ee).attrs),In,(je,yt)=>{var _t=ct(()=>QL(g(yt),2));let st=()=>g(_t)[0],Je=()=>g(_t)[1];var j=xs(),re=xt(j);{var Le=R=>{const G=ct(()=>{var ve;return(ve=t[g(ee).name])==null?void 0:ve[st()]}),pe=ct(()=>(st()==="acceptedCommandList"||st()==="generatedCommandList")&&Array.isArray(Je())),se=ct(()=>{var ve;return((ve=c[g(ee).name])==null?void 0:ve[st()])??a[st()]});var we=h9(),ae=x(we),ue=x(ae),Re=x(ue),_e=I(ue);{var Ae=ve=>{var ke=qZ(),Nt=x(ke);Y(At=>q(Nt,`(${At??""})`),[()=>d(g(se))]),T(ve,ke)};K(_e,ve=>{g(se)!==void 0&&ve(Ae)})}var Ee=I(ae),ge=x(Ee);{var et=ve=>{var ke=GZ();di(ke,21,()=>g(G),In,(Nt,At)=>{var Vi=KZ(),en=x(Vi);Y(()=>q(en,g(At).label)),oe("click",Vi,()=>i(g(me).nodeId,g(Ze).endpointId,g(ee).name,g(At).command,g(At).args)),T(Nt,Vi)}),T(ve,ke)};K(ge,ve=>{g(G)&&ve(et)})}var ei=I(Ee),vi=x(ei);{var Pi=ve=>{var ke=QZ();di(ke,21,()=>s(g(ee).name,Je()),In,(Nt,At,Vi)=>{var en=JZ(),Ne=xt(en);{var ot=fi=>{var si=ZZ();T(fi,si)};K(Ne,fi=>{Vi>0&&fi(ot)})}var Tt=I(Ne,2);{var ni=fi=>{var si=XZ(),ns=xt(si),ss=x(ns),Nn=I(ns),os=x(Nn);Y(()=>{q(ss,g(At).name),q(os,`(${g(At).id??""})`)}),T(fi,si)},vt=fi=>{var si=YZ(),ns=x(si);Y(()=>q(ns,g(At).id)),T(fi,si)};K(Tt,fi=>{g(At).name?fi(ni):fi(vt,-1)})}T(Nt,en)}),T(ve,ke)},Mn=ve=>{var ke=i9(),Nt=I(x(ke));di(Nt,21,Je,In,(At,Vi)=>{const en=ct(()=>g(Vi)),Ne=ct(()=>g(en).deviceType),ot=ct(()=>r[g(Ne)]);var Tt=t9(),ni=x(Tt),vt=x(ni);{var fi=Nn=>{var os=e9(),ds=xt(os),ao=I(ds),lo=x(ao);Y(Rn=>{q(ds,`${g(ot)??""} `),q(lo,`(${Rn??""})`)},[()=>d(g(Ne))]),T(Nn,os)},si=Nn=>{var os=ha();Y(ds=>q(os,ds),[()=>d(g(Ne))]),T(Nn,os)};K(vt,Nn=>{g(ot)?Nn(fi):Nn(si,-1)})}var ns=I(ni),ss=x(ns);Y(Nn=>q(ss,Nn),[()=>v(g(en).revision)]),T(At,Tt)}),T(ve,ke)},ri=ct(()=>st()==="deviceTypeList"&&Array.isArray(Je())),ai=ve=>{const ke=ct(()=>[...new Set(Je().flatMap(Ne=>Object.keys(Ne)))]);var Nt=r9(),At=x(Nt),Vi=x(At);di(Vi,21,()=>g(ke),In,(Ne,ot)=>{var Tt=n9(),ni=x(Tt);Y(()=>q(ni,g(ot))),T(Ne,Tt)});var en=I(At);di(en,21,Je,In,(Ne,ot)=>{var Tt=o9();di(Tt,21,()=>g(ke),In,(ni,vt)=>{var fi=s9(),si=x(fi);Y(ns=>q(si,ns),[()=>v(g(ot)[g(vt)])]),T(ni,fi)}),T(Ne,Tt)}),T(ve,Nt)},Wt=ct(()=>y(Je())),hi=ve=>{var ke=l9(),Nt=x(ke);di(Nt,21,()=>Object.entries(Je()),In,(At,Vi)=>{var en=ct(()=>QL(g(Vi),2));let Ne=()=>g(en)[0],ot=()=>g(en)[1];var Tt=a9(),ni=x(Tt),vt=x(ni),fi=I(ni),si=x(fi);Y(ns=>{q(vt,Ne()),q(si,ns)},[()=>v(ot())]),T(At,Tt)}),T(ve,ke)},ki=ct(()=>_(Je())),St=ve=>{var ke=c9(),Nt=x(ke);Y(()=>{Jn(ke,"href",Je()),q(Nt,Je())}),T(ve,ke)},Xt=ve=>{var ke=d9(),Nt=x(ke);Y(At=>q(Nt,At),[()=>v(Je())]),T(ve,ke)};K(vi,ve=>{g(pe)?ve(Pi):g(ri)?ve(Mn,1):g(Wt)?ve(ai,2):g(ki)?ve(hi,3):(st()==="productUrl"||st()==="productURL")&&typeof Je()=="string"?ve(St,4):ve(Xt,-1)})}Y(()=>{Jn(ae,"title",st()),q(Re,st())}),T(R,we)},W=ct(()=>!S(Je(),st()));K(re,R=>{g(W)&&R(Le)})}T(je,j)}),Y(()=>q(Lt,g(ee).name)),T(Ii,be)}),T(Ft,gi)},Et=Ft=>{var gi=f9();T(Ft,gi)};K(Xe,Ft=>{g(Ze).clusters.length>0?Ft(Ce):Ft(Et,-1)})}Y(()=>{q(Me,`${g(Ze).name??`Endpoint ${g(Ze).endpointId}`??""} `),q(Ue,`ep${g(Ze).endpointId??""}`)}),T(xe,Dt)}),Y(()=>{q(Qt,g(me).name??`Node ${g(me).nodeId}`),q(O,`Node ID: ${g(me).nodeId??""}`)}),T(Z,Te)},hn=Z=>{var Te=_9();T(Z,Te)};K(Dn,Z=>{g(Ve)?Z(Ei):g(dt)?Z($i,1):g(me)?Z(Fn,2):Z(hn,-1)})}var Ai=I(mi,2),rn=x(Ai),xn=I(rn,2),Ln=I(x(xn),2);{var Bn=Z=>{var Te=v9(),nt=x(Te);Y(()=>q(nt,g(Q).length)),T(Z,Te)};K(Ln,Z=>{!g($)&&g(Q).length>0&&Z(Bn)})}var Hn=I(Ln,2),$e=x(Hn),ne=I(xn,2);{var it=Z=>{var Te=C9(),nt=x(Te);{var wt=Zt=>{var Li=b9();T(Zt,Li)},Qt=Zt=>{var Li=xs(),_i=xt(Li);di(_i,17,()=>g(Pe),O=>O.id,(O,X)=>{const xe=ct(()=>{var Ce,Et;return((Ce=f.get(g(X).nodeId))==null?void 0:Ce.name)??((Et=g(u).find(Ft=>Ft.nodeId===g(X).nodeId))==null?void 0:Et.name)??null}),Ze=ct(()=>{var Ce,Et;return g(X).endpointId!==void 0?((Et=(Ce=f.get(g(X).nodeId))==null?void 0:Ce.endpoints.find(Ft=>Ft.endpointId===g(X).endpointId))==null?void 0:Et.name)??null:null}),Dt=ct(()=>g(X).attrName??g(X).clusterName);var mt=S9(),Me=x(mt),De=x(Me),Ue=I(Me,2);{var Ge=Ce=>{var Et=w9(),Ft=I(xt(Et),2),gi=x(Ft),Qi=I(gi);{var Ii=pt=>{var Lt=Py(),ce=I(xt(Lt)),je=x(ce);Y(()=>q(je,`(#${g(X).nodeId??""})`)),T(pt,Lt)};K(Qi,pt=>{g(xe)&&pt(Ii)})}var ee=I(Ft,2);let be;var qe=x(ee);Y(()=>{q(gi,g(xe)??`#${g(X).nodeId}`),be=Bt(ee,1,"e-val svelte-1ua3isv",null,be,{"e-online":g(X).online,"e-offline":!g(X).online}),q(qe,g(X).online?"online":"offline")}),T(Ce,Et)},Xe=Ce=>{var Et=y9(),Ft=I(xt(Et),2),gi=x(Ft),Qi=I(gi);{var Ii=Je=>{var j=Py(),re=I(xt(j)),Le=x(re);Y(()=>q(Le,`(#${g(X).nodeId??""})`)),T(Je,j)};K(Qi,Je=>{g(xe)&&Je(Ii)})}var ee=I(Ft,2),be=x(ee),qe=I(be);{var pt=Je=>{var j=Py(),re=I(xt(j)),Le=x(re);Y(()=>q(Le,`(ep ${g(X).endpointId??""})`)),T(Je,j)};K(qe,Je=>{g(Ze)&&Je(pt)})}var Lt=I(ee,2),ce=x(Lt),je=I(Lt,2),yt=x(je),_t=I(je,2),st=x(_t);Y(Je=>{q(gi,g(xe)??`#${g(X).nodeId}`),q(be,g(Ze)??`ep${g(X).endpointId}`),q(ce,g(X).clusterName),q(yt,g(Dt)),q(st,Je)},[()=>m(g(X).value)]),T(Ce,Et)};K(Ue,Ce=>{g(X).kind==="status"?Ce(Ge):Ce(Xe,-1)})}Y(Ce=>q(De,Ce),[()=>D(g(X).ts)]),T(O,mt)}),T(Zt,Li)};K(nt,Zt=>{g(Pe).length===0?Zt(wt):Zt(Qt,-1)})}T(Z,Te)};K(ne,Z=>{g($)&&Z(it)})}Y(()=>{Fo(Ai,g($)?`height: ${g(fe)}px;`:""),q($e,g($)?"▾":"▸")}),oe("click",Di,()=>k(Ke,!g(Ke))),oe("mousedown",rn,ze),oe("click",Hn,()=>{k($,!g($))}),T(o,Ct),Lo()}cr(["click","mousedown"]);var I9=A("<button>›</button>"),k9=A('<span class="chev-ph svelte-1vejtrc"></span>'),D9=A('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),E9=A('<div class="tc svelte-1vejtrc"></div>'),P9=A('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!></div> <!></div>'),T9=A("<option></option>"),M9=A('<span class="pub-ok svelte-1vejtrc">✓</span>'),N9=A('<span class="pub-err svelte-1vejtrc"> </span>'),R9=A('<div class="info svelte-1vejtrc">Loading…</div>'),A9=A('<div class="info err svelte-1vejtrc"> </div>'),O9=A('<div class="info svelte-1vejtrc">No topics match.</div>'),F9=A('<div class="vr svelte-1vejtrc"><span class="v-topic svelte-1vejtrc"> </span> <span class="v-val svelte-1vejtrc"> </span> <span class="v-ts svelte-1vejtrc"> </span></div>'),H9=A('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),W9=A('<div class="info svelte-1vejtrc">No topics yet.</div>'),B9=A('<div class="tree-wrap svelte-1vejtrc"><!></div>'),z9=A('<span class="stream-badge"> </span>'),V9=A('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),j9=A('<span class="s-ret svelte-1vejtrc" title="retained snapshot">⊛</span>'),U9=A('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),$9=A('<div class="stream-body svelte-1vejtrc"><!></div>'),q9=A('<div class="ctx-bd svelte-1vejtrc"></div> <div class="ctx-menu svelte-1vejtrc"><button class="svelte-1vejtrc">Copy topic</button> <button class="svelte-1vejtrc">Clear retained</button></div>',1),K9=A('<label class="modal-check svelte-1vejtrc"><input type="checkbox" class="svelte-1vejtrc"/> <span class="checkmark svelte-1vejtrc"></span> Recursive — also clear all child topics</label>'),G9=A('<div class="modal-bd svelte-1vejtrc"></div> <div class="modal svelte-1vejtrc"><div class="modal-title svelte-1vejtrc">Clear retained</div> <div class="modal-body svelte-1vejtrc"><p class="svelte-1vejtrc">Clear retained value for <code class="svelte-1vejtrc"> </code>?</p> <!></div> <div class="modal-footer svelte-1vejtrc"><button class="btn-cancel svelte-1vejtrc">Cancel</button> <button class="btn-confirm svelte-1vejtrc">Clear</button></div></div>',1),Z9=A('<div class="page svelte-1vejtrc"><div class="toolbar svelte-1vejtrc"><h2 class="svelte-1vejtrc">MQTT</h2></div> <div class="main-group svelte-1vejtrc"><div class="pub-bar svelte-1vejtrc"><input class="pt svelte-1vejtrc" type="text" placeholder="topic" list="pub-topic-list" autocomplete="off"/> <datalist id="pub-topic-list"></datalist> <input class="pp svelte-1vejtrc" type="text" placeholder="payload"/> <label class="rl svelte-1vejtrc"><input type="checkbox" class="svelte-1vejtrc"/> <span class="checkmark svelte-1vejtrc"></span> retain</label> <select class="svelte-1vejtrc"><option>QoS 0</option><option>QoS 1</option><option>QoS 2</option></select> <button class="svelte-1vejtrc">Publish</button> <!> <!></div> <div class="tree-filter-bar svelte-1vejtrc"><input class="filter-in svelte-1vejtrc" type="search" placeholder="Filter topics…"/> <span class="count svelte-1vejtrc"><!> </span></div> <!></div> <div class="stream-panel svelte-1vejtrc"><div class="stream-resize svelte-1vejtrc"></div> <div class="stream-hdr-row svelte-1vejtrc"><input class="filter-in stream-filter-in svelte-1vejtrc" type="search" placeholder="Live stream filter (MQTT wildcard, default: #)"/> <!> <button class="stream-toggle svelte-1vejtrc" title="Toggle live stream"> </button></div> <!></div> <!> <!></div>');function X9(o,e){xo(e,!0);const t=(ee,be=$b)=>{const qe=ct(()=>g(f).has(be().path)),pt=ct(()=>g(a)>=0&&be().children.size>0),Lt=ct(()=>g(a)>=0&&be().isLeaf&&!n.has(be().path));var ce=P9(),je=x(ce);let yt;var _t=x(je);{var st=se=>{var we=I9();let ae;Y(()=>{ae=Bt(we,1,"chev svelte-1vejtrc",null,ae,{open:g(qe)}),Jn(we,"aria-label",g(qe)?"Collapse":"Expand")}),oe("click",we,()=>m(be().path)),T(se,we)},Je=se=>{var we=k9();T(se,we)};K(_t,se=>{g(pt)?se(st):se(Je,-1)})}var j=I(_t,2),re=x(j),Le=I(j,2);{var W=se=>{var we=D9(),ae=xt(we),ue=x(ae),Re=I(ae,2),_e=x(Re);Y((Ae,Ee,ge)=>{Jn(ae,"title",Ae),q(ue,Ee),q(_e,ge)},[()=>{var Ae;return xi((Ae=Ui(be().path))==null?void 0:Ae.val)},()=>{var Ae;return xi((Ae=Ui(be().path))==null?void 0:Ae.val)},()=>{var Ae;return((Ae=Ui(be().path))==null?void 0:Ae.ts)!=null?Di(Ui(be().path).ts):""}]),T(se,we)},R=ct(()=>be().isLeaf&&i.has(be().path));K(Le,se=>{g(R)&&se(W)})}var G=I(je,2);{var pe=se=>{var we=E9();di(we,21,()=>[...be().children.values()].sort((ae,ue)=>ae.seg.localeCompare(ue.seg)),ae=>ae.path,(ae,ue)=>{t(ae,()=>g(ue))}),T(se,we)};K(G,se=>{g(pt)&&g(qe)&&se(pe)})}Y(()=>{yt=Bt(je,1,"tr svelte-1vejtrc",null,yt,{stale:g(Lt)}),q(re,be().seg)}),oe("click",je,()=>{k(Ve,be().path+"/#")}),oe("contextmenu",je,se=>{se.preventDefault(),k(ft,{x:se.clientX,y:se.clientY,topic:be().path},!0)}),T(ee,ce)},i=new Map,n=new Set,s=new Set;let r=null,a=U(0);function c(){r===null&&(r=requestAnimationFrame(()=>{r=null;for(const ee of s)u(ee);s.clear(),iI(a)}))}const d=new Map;function u(ee){const be=ee.split("/");let qe=d,pt="";for(let Lt=0;Lt<be.length;Lt++){const ce=be[Lt];pt=Lt===0?ce:`${pt}/${ce}`,qe.has(ce)||qe.set(ce,{seg:ce,path:pt,children:new Map,isLeaf:!1});const je=qe.get(ce);Lt===be.length-1&&(je.isLeaf=!0),qe=je.children}}let f=U(Si(new Set));function m(ee){const be=new Set(g(f));be.has(ee)?be.delete(ee):be.add(ee),k(f,be,!0)}let v=U("");const _=24,y=5;let S=U(0),D=U(300),E=ct(()=>{if(g(a),!g(v))return[];const ee=g(v).toLowerCase().split(/\s+/).filter(Boolean),be=[];for(const[qe,pt]of i){const Lt=qe.toLowerCase();ee.every(ce=>Lt.includes(ce))&&be.push({topic:qe,...pt})}return be.sort((qe,pt)=>qe.topic.localeCompare(pt.topic))}),N=ct(()=>{const ee=g(E).length,be=Math.max(0,Math.floor(g(S)/_)-y),qe=Math.min(ee,Math.ceil((g(S)+g(D))/_)+y);return{start:be,end:qe,totalH:ee*_,top:be*_}});const B=1e3,F=200,Q=20,$=36;let fe=0,Pe=U(Si([])),ze=U(Si([])),me=U(!0),Ve=U("#"),dt=U(200);kn(()=>{const ee=g(Ve).trim(),be=ll(()=>g(Pe)),qe=!ee||ee==="#"?be.slice(0,F):be.filter(pt=>Ke(ee,pt.topic)).slice(0,F);if(ee&&ee!=="#"){const pt=new Set(qe.map(ce=>ce.topic)),Lt=[];for(const[ce,je]of i)pt.has(ce)||Ke(ee,ce)&&Lt.push({id:-(Lt.length+1),topic:ce,val:je.val,ts:je.ts,retained:!0});Lt.sort((ce,je)=>ce.topic.localeCompare(je.topic)),k(ze,[...qe,...Lt],!0)}else k(ze,qe,!0)});function Ke(ee,be){if(ee==="#")return!0;const qe=ee.split("/"),pt=be.split("/");for(let Lt=0;Lt<qe.length;Lt++){if(qe[Lt]==="#")return!0;if(Lt>=pt.length||qe[Lt]!=="+"&&qe[Lt]!==pt[Lt])return!1}return qe.length===pt.length}function Ut(ee){ee.preventDefault();const be=ee.clientY,qe=g(dt);function pt(ce){k(dt,Math.max(60,Math.min(800,qe+be-ce.clientY)),!0)}function Lt(){document.removeEventListener("mousemove",pt),document.removeEventListener("mouseup",Lt)}document.addEventListener("mousemove",pt),document.addEventListener("mouseup",Lt)}let lt=ct(()=>{const ee=Math.max(1,Math.floor((g(dt)-$)/Q)+1);return g(ze).slice(0,ee)}),Kt=U(!0),Ie=U(null);async function Pt(){k(Kt,!0),k(Ie,null);try{const ee=await YN();for(const be of ee)i.set(be.topic,{val:be.val,ts:be.ts}),u(be.topic)}catch(ee){k(Ie,ee instanceof Error?ee.message:String(ee),!0)}finally{k(Kt,!1),iI(a)}}const Fe=Rl("mqtt",ee=>{const{topic:be,val:qe,ts:pt}=ee;i.set(be,{val:qe,ts:pt}),n.add(be),s.add(be),c();const Lt={id:fe++,topic:be,val:qe,ts:pt};k(Pe,[Lt,...g(Pe).slice(0,B-1)],!0);const ce=g(Ve).trim();(!ce||ce==="#"||Ke(ce,be))&&k(ze,[Lt,...g(ze).filter(je=>!(je.retained&&je.topic===be)).slice(0,F-1)],!0)});let ft=U(null),zt=U(null);async function Gt(ee,be){const qe=[ee];if(be){const pt=ee+"/";for(const Lt of i.keys())Lt.startsWith(pt)&&qe.push(Lt)}for(const pt of qe)await iD(pt,"",!0,0)}let ci=ct(()=>(g(a),[...i.keys()].sort())),Vt=U(""),Ht=U(""),Fi=U(!1),zi=U(0),tt=U(!1),Ct=U(null),mi=U(!1);async function Ci(){if(g(Vt)){k(tt,!0),k(Ct,null),k(mi,!1);try{await iD(g(Vt),g(Ht),g(Fi),g(zi)),k(mi,!0),setTimeout(()=>{k(mi,!1)},2e3)}catch(ee){k(Ct,ee instanceof Error?ee.message:String(ee),!0)}finally{k(tt,!1)}}}function xi(ee){return ee==null?"":typeof ee=="object"?JSON.stringify(ee):String(ee)}function Di(ee){return new Date(ee).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ji(ee){return new Date(ee).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ui(ee){return g(a),i.get(ee)}let bn=ct(()=>(g(a),[...d.values()].sort((ee,be)=>ee.seg.localeCompare(be.seg)))),mn=ct(()=>(g(a),i.size));va(Pt),Xb(()=>{Fe(),r!==null&&cancelAnimationFrame(r)});var Tn=Z9(),wn=I(x(Tn),2),_n=x(wn),Dn=x(_n),Ei=I(Dn,2);di(Ei,20,()=>g(ci),ee=>ee,(ee,be)=>{var qe=T9(),pt={};Y(()=>{pt!==(pt=be)&&(qe.value=(qe.__value=be)??"")}),T(ee,qe)});var $i=I(Ei,2),Fn=I($i,2),hn=x(Fn),Ai=I(Fn,2),rn=x(Ai);rn.value=rn.__value=0;var xn=I(rn);xn.value=xn.__value=1;var Ln=I(xn);Ln.value=Ln.__value=2;var Bn=I(Ai,2),Hn=I(Bn,2);{var $e=ee=>{var be=M9();T(ee,be)};K(Hn,ee=>{g(mi)&&ee($e)})}var ne=I(Hn,2);{var it=ee=>{var be=N9(),qe=x(be);Y(()=>q(qe,g(Ct))),T(ee,be)};K(ne,ee=>{g(Ct)&&ee(it)})}var Z=I(_n,2),Te=x(Z),nt=I(Te,2),wt=x(nt);{var Qt=ee=>{var be=ha();Y(()=>q(be,`${g(E).length??""} /`)),T(ee,be)};K(wt,ee=>{g(v)&&ee(Qt)})}var Zt=I(wt),Li=I(Z,2);{var _i=ee=>{var be=R9();T(ee,be)},O=ee=>{var be=A9(),qe=x(be);Y(()=>q(qe,g(Ie))),T(ee,be)},X=ee=>{var be=xs(),qe=xt(be);{var pt=ce=>{var je=O9();T(ce,je)},Lt=ce=>{var je=H9(),yt=x(je),_t=x(yt);di(_t,21,()=>g(E).slice(g(N).start,g(N).end),st=>st.topic,(st,Je)=>{var j=F9(),re=x(j),Le=x(re),W=I(re,2),R=x(W),G=I(W,2),pe=x(G);Y((se,we,ae)=>{q(Le,g(Je).topic),Jn(W,"title",se),q(R,we),q(pe,ae)},[()=>xi(g(Je).val),()=>xi(g(Je).val),()=>Di(g(Je).ts)]),T(st,j)}),Y(()=>{Fo(yt,`height: ${g(N).totalH??""}px; position: relative;`),Fo(_t,`top: ${g(N).top??""}px;`)}),Kn("scroll",je,st=>{k(S,st.currentTarget.scrollTop,!0)}),vW(je,"clientHeight",st=>k(D,st)),T(ce,je)};K(qe,ce=>{g(E).length===0?ce(pt):ce(Lt,-1)})}T(ee,be)},xe=ee=>{var be=B9(),qe=x(be);{var pt=ce=>{var je=W9();T(ce,je)},Lt=ce=>{var je=xs(),yt=xt(je);di(yt,17,()=>g(bn),_t=>_t.path,(_t,st)=>{t(_t,()=>g(st))}),T(ce,je)};K(qe,ce=>{g(bn).length===0?ce(pt):ce(Lt,-1)})}T(ee,be)};K(Li,ee=>{g(Kt)?ee(_i):g(Ie)?ee(O,1):g(v)?ee(X,2):ee(xe,-1)})}var Ze=I(wn,2),Dt=x(Ze),mt=I(Dt,2),Me=x(mt),De=I(Me,2);{var Ue=ee=>{var be=z9(),qe=x(be);Y(()=>q(qe,g(ze).length)),T(ee,be)};K(De,ee=>{!g(me)&&g(ze).length>0&&ee(Ue)})}var Ge=I(De,2),Xe=x(Ge),Ce=I(mt,2);{var Et=ee=>{var be=$9(),qe=x(be);{var pt=ce=>{var je=V9();T(ce,je)},Lt=ce=>{var je=xs(),yt=xt(je);di(yt,17,()=>g(lt),_t=>_t.id,(_t,st)=>{var Je=U9();let j;var re=x(Je),Le=x(re),W=I(re,2);{var R=ae=>{var ue=j9();T(ae,ue)};K(W,ae=>{g(st).retained&&ae(R)})}var G=I(W,2),pe=x(G),se=I(G,2),we=x(se);Y((ae,ue,Re)=>{j=Bt(Je,1,"sr svelte-1vejtrc",null,j,{retained:g(st).retained}),q(Le,ae),q(pe,g(st).topic),Jn(se,"title",ue),q(we,Re)},[()=>Ji(g(st).ts),()=>xi(g(st).val),()=>xi(g(st).val)]),T(_t,Je)}),T(ce,je)};K(qe,ce=>{g(lt).length===0?ce(pt):ce(Lt,-1)})}T(ee,be)};K(Ce,ee=>{g(me)&&ee(Et)})}var Ft=I(Ze,2);{var gi=ee=>{var be=q9(),qe=xt(be),pt=I(qe,2);let Lt;var ce=x(pt),je=I(ce,2);Y(()=>Lt=Fo(pt,"",Lt,{left:`${g(ft).x??""}px`,top:`${g(ft).y??""}px`})),oe("click",qe,()=>k(ft,null)),oe("contextmenu",qe,yt=>{yt.preventDefault(),k(ft,null)}),oe("click",ce,()=>{navigator.clipboard.writeText(g(ft).topic),k(ft,null)}),oe("click",je,()=>{const yt=g(ft).topic,_t=yt+"/",st=[...i.keys()].some(Je=>Je.startsWith(_t));k(zt,{topic:yt,hasChildren:st,recursive:!1},!0),k(ft,null)}),T(ee,be)};K(Ft,ee=>{g(ft)&&ee(gi)})}var Qi=I(Ft,2);{var Ii=ee=>{var be=G9(),qe=xt(be),pt=I(qe,2),Lt=I(x(pt),2),ce=x(Lt),je=I(x(ce)),yt=x(je),_t=I(ce,2);{var st=Le=>{var W=K9(),R=x(W);eo(R,()=>g(zt).recursive,G=>g(zt).recursive=G),T(Le,W)};K(_t,Le=>{g(zt).hasChildren&&Le(st)})}var Je=I(Lt,2),j=x(Je),re=I(j,2);Y(()=>q(yt,g(zt).topic)),oe("click",qe,()=>k(zt,null)),oe("click",j,()=>k(zt,null)),oe("click",re,()=>{const{topic:Le,recursive:W}=g(zt);k(zt,null),Gt(Le,W)}),T(ee,be)};K(Qi,ee=>{g(zt)&&ee(Ii)})}Y(()=>{Bn.disabled=g(tt)||!g(Vt),q(Zt,` ${g(mn)??""}`),Fo(Ze,g(me)?`height: ${g(dt)}px;`:""),q(Xe,g(me)?"▾":"▸")}),Ki(Dn,()=>g(Vt),ee=>k(Vt,ee)),Ki($i,()=>g(Ht),ee=>k(Ht,ee)),eo(hn,()=>g(Fi),ee=>k(Fi,ee)),El(Ai,()=>g(zi),ee=>k(zi,ee)),oe("click",Bn,Ci),Ki(Te,()=>g(v),ee=>k(v,ee)),oe("mousedown",Dt,Ut),Ki(Me,()=>g(Ve),ee=>k(Ve,ee)),oe("click",Ge,()=>{k(me,!g(me))}),T(o,Tn),Lo()}cr(["click","contextmenu","mousedown"]);var Y9=A('<div class="restart-banner svelte-twakcj">⚠ Package changes require a daemon restart to take effect. Use the ↺ button in the topbar.</div>'),J9=A('<div class="err svelte-twakcj"> </div>'),Q9=A('<p class="empty svelte-twakcj">No packages installed.</p>'),eX=A('<p class="empty svelte-twakcj">No match.</p>'),tX=iT('<svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="8" cy="8" r="6" stroke-dasharray="18" stroke-dashoffset="4"></circle></svg>'),iX=iT('<svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M13 8A5 5 0 1 1 10.5 3.67"></path><polyline points="10.5,1.5 10.5,4 13,4"></polyline></svg>'),nX=A('<div><div class="dep-info svelte-twakcj"><a class="dep-name svelte-twakcj" target="_blank" rel="noopener noreferrer"> </a> <span class="dep-ver svelte-twakcj"> </span></div> <div class="dep-btns svelte-twakcj"><button class="icon-btn svelte-twakcj" title="Update to latest"><!></button> <button class="icon-btn icon-btn--danger svelte-twakcj" title="Uninstall"><svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><line x1="2" y1="2" x2="14" y2="14"></line><line x1="14" y1="2" x2="2" y2="14"></line></svg></button></div></div>'),sX=A('<span class="result-desc svelte-twakcj"> </span>'),oX=A('<div class="result-row svelte-twakcj"><div class="result-info svelte-twakcj"><a class="result-name svelte-twakcj" target="_blank" rel="noopener noreferrer"> </a> <span class="result-ver svelte-twakcj"> </span> <!></div> <button class="install-btn svelte-twakcj"> </button></div>'),rX=A('<div class="results-list svelte-twakcj"></div>'),aX=A('<pre class="npm-output svelte-twakcj"> </pre>'),lX=A(`<p class="hint svelte-twakcj">Install npm packages into <code class="svelte-twakcj">~/.she/</code>. Scripts can then <code class="svelte-twakcj">require('package-name')</code> directly.</p>`),cX=A('<div class="pkg-shell svelte-twakcj"><!> <!> <div class="pkg-body svelte-twakcj"><div class="pkg-left svelte-twakcj"><div class="pane-hdr svelte-twakcj"><span class="pane-title svelte-twakcj">Installed</span> <span class="pane-count svelte-twakcj"> </span></div> <div class="filter-row svelte-twakcj"><input class="filter-in svelte-twakcj" type="search" placeholder="Filter…"/></div> <div class="installed-list svelte-twakcj"><!></div></div> <div class="pkg-right svelte-twakcj"><div class="pane-hdr svelte-twakcj"><span class="pane-title svelte-twakcj">Search npm</span></div> <div class="search-row svelte-twakcj"><input class="search-in svelte-twakcj" type="text" placeholder="Package name, e.g. axios, lodash…"/> <button class="search-btn svelte-twakcj"> </button></div> <!> <!> <!></div></div></div>');function dX(o,e){xo(e,!0);let t=U(Si([])),i=U(""),n=U(""),s=U(Si([])),r=U(!1),a=U(!1),c=U(""),d=U(""),u=Si({});const f=ct(()=>g(i).trim()?g(t).filter(tt=>tt.name.toLowerCase().includes(g(i).toLowerCase())):g(t));va(async()=>{await m()});async function m(){try{k(t,await t7(),!0),k(c,"")}catch(tt){k(c,tt.message,!0)}}async function v(){const tt=g(n).trim();if(!tt){k(s,[],!0);return}k(a,!0),k(c,"");try{k(s,await i7(tt),!0)}catch(Ct){k(c,Ct.message,!0)}finally{k(a,!1)}}async function _(tt,Ct){u[tt]=!0,k(c,""),k(d,"");try{const mi=await n7(tt,Ct);k(d,mi.stdout||mi.stderr||"Done.",!0),k(r,!0),await m()}catch(mi){k(c,mi.message,!0)}finally{u[tt]=!1}}async function y(tt){u[tt]=!0,k(c,""),k(d,"");try{const Ct=await s7(tt);k(d,Ct.stdout||Ct.stderr||"Done.",!0),k(r,!0),await m()}catch(Ct){k(c,Ct.message,!0)}finally{u[tt]=!1}}async function S(tt){u[tt]=!0,k(c,""),k(d,"");try{const Ct=await o7(tt);k(d,Ct.stdout||Ct.stderr||"Done.",!0),k(r,!0),await m()}catch(Ct){k(c,Ct.message,!0)}finally{u[tt]=!1}}var D=cX(),E=x(D);{var N=tt=>{var Ct=Y9();T(tt,Ct)};K(E,tt=>{g(r)&&tt(N)})}var B=I(E,2);{var F=tt=>{var Ct=J9(),mi=x(Ct);Y(()=>q(mi,g(c))),T(tt,Ct)};K(B,tt=>{g(c)&&tt(F)})}var Q=I(B,2),$=x(Q),fe=x($),Pe=I(x(fe),2),ze=x(Pe),me=I(fe,2),Ve=x(me),dt=I(me,2),Ke=x(dt);{var Ut=tt=>{var Ct=Q9();T(tt,Ct)},lt=tt=>{var Ct=eX();T(tt,Ct)},Kt=tt=>{var Ct=xs(),mi=xt(Ct);di(mi,17,()=>g(f),Ci=>Ci.name,(Ci,xi)=>{var Di=nX();let Ji;var Ui=x(Di),bn=x(Ui),mn=x(bn),Tn=I(bn,2),wn=x(Tn),_n=I(Ui,2),Dn=x(_n),Ei=x(Dn);{var $i=Ai=>{var rn=tX();T(Ai,rn)},Fn=Ai=>{var rn=iX();T(Ai,rn)};K(Ei,Ai=>{u[g(xi).name]?Ai($i):Ai(Fn,-1)})}var hn=I(Dn,2);Y(()=>{Ji=Bt(Di,1,"dep-row svelte-twakcj",null,Ji,{"dep-busy":!!u[g(xi).name]}),Jn(bn,"href",g(xi).url??`https://www.npmjs.com/package/${g(xi).name}`),q(mn,g(xi).name),q(wn,g(xi).version),Dn.disabled=!!u[g(xi).name],hn.disabled=!!u[g(xi).name]}),oe("click",Dn,()=>S(g(xi).name)),oe("click",hn,()=>y(g(xi).name)),T(Ci,Di)}),T(tt,Ct)};K(Ke,tt=>{g(t).length===0?tt(Ut):g(f).length===0?tt(lt,1):tt(Kt,-1)})}var Ie=I($,2),Pt=I(x(Ie),2),Fe=x(Pt),ft=I(Fe,2),zt=x(ft),Gt=I(Pt,2);{var ci=tt=>{var Ct=rX();di(Ct,21,()=>g(s),mi=>mi.name,(mi,Ci)=>{var xi=oX(),Di=x(xi),Ji=x(Di),Ui=x(Ji),bn=I(Ji,2),mn=x(bn),Tn=I(bn,2);{var wn=Ei=>{var $i=sX(),Fn=x($i);Y(()=>q(Fn,g(Ci).description)),T(Ei,$i)};K(Tn,Ei=>{g(Ci).description&&Ei(wn)})}var _n=I(Di,2),Dn=x(_n);Y(()=>{Jn(Ji,"href",g(Ci).url??`https://www.npmjs.com/package/${g(Ci).name}`),q(Ui,g(Ci).name),q(mn,g(Ci).version),_n.disabled=!!u[g(Ci).name],q(Dn,u[g(Ci).name]?"Installing…":"Install")}),oe("click",_n,()=>_(g(Ci).name)),T(mi,xi)}),T(tt,Ct)};K(Gt,tt=>{g(s).length>0&&tt(ci)})}var Vt=I(Gt,2);{var Ht=tt=>{var Ct=aX(),mi=x(Ct);Y(()=>q(mi,g(d))),T(tt,Ct)};K(Vt,tt=>{g(d)&&tt(Ht)})}var Fi=I(Vt,2);{var zi=tt=>{var Ct=lX();T(tt,Ct)};K(Fi,tt=>{!g(s).length&&!g(d)&&tt(zi)})}Y(()=>{q(ze,g(t).length),ft.disabled=g(a),q(zt,g(a)?"Searching…":"Search")}),Ki(Ve,()=>g(i),tt=>k(i,tt)),oe("keydown",Fe,tt=>tt.key==="Enter"&&v()),Ki(Fe,()=>g(n),tt=>k(n,tt)),oe("click",ft,v),T(o,D),Lo()}cr(["click","keydown"]);var hX=A('<dt class="svelte-1n46o8q">Matter nodes</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">Matter endpoints</dt><dd class="svelte-1n46o8q"> </dd>',1),uX=A('<dt class="svelte-1n46o8q">DB docs</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">DB views</dt><dd class="svelte-1n46o8q"> </dd>',1),gX=A('<dl class="svelte-1n46o8q"><dt class="svelte-1n46o8q">Scripts</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT topics</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT msg/s</dt><dd class="svelte-1n46o8q"> </dd> <!> <!> <dt class="svelte-1n46o8q">Handlers</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">Memory</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">CPU</dt><dd class="svelte-1n46o8q"> </dd></dl>'),fX=A('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),pX=A('<div class="stats-popup svelte-1n46o8q"><!> <div class="stats-actions svelte-1n46o8q"><button class="svelte-1n46o8q"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg> Restart daemon</button></div></div>'),mX=A('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),_X=A('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),vX=A('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),bX=A('<div class="version-actions svelte-1n46o8q"><button class="svelte-1n46o8q"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 4 4 10 10 10"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> </button></div>'),wX=A('<div class="version-popup svelte-1n46o8q"><dl class="svelte-1n46o8q"><dt class="svelte-1n46o8q">Installed</dt><dd class="svelte-1n46o8q"></dd> <!></dl> <!></div>'),yX=A('<button class="nav-logout svelte-1n46o8q" title="Logout"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg></button>'),SX=A('<div class="shell svelte-1n46o8q"><nav class="svelte-1n46o8q"><span class="brand svelte-1n46o8q">she</span> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="5,3 1,8 5,13"></polyline><polyline points="11,3 15,8 11,13"></polyline></svg> Scripts</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" stroke-linejoin="miter"><rect x="0.75" y="0.75" width="14.5" height="14.5" rx="1"></rect><path d="M2,11 V5 H5 V11"></path><path d="M6,12 V5 H9 V8 H6"></path><path d="M10,11 V5 H15 V11"></path><line x1="12.5" y1="5" x2="12.5" y2="11"></line></svg> Packages</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" stroke="none" style="vertical-align: middle"><path fill-rule="evenodd" d="M2,0 H14 A2,2 0 0,1 16,2 V14 A2,2 0 0,1 14,16 H0 V2 A2,2 0 0,1 2,0 Z M0,16 L0,12 A4,4 0 0,1 4,16 Z M0,10.5 A5.5,5.5 0 0,1 5.5,16 L9,16 A9,9 0 0,0 0,7 Z M0,5.5 A10.5,10.5 0 0,1 10.5,16 L13.5,16 A13.5,13.5 0 0,0 0,2.5 Z"></path></svg> MQTT</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M8,2 L8,7"></path><path d="M6,5 L8,7.5 L10,5"></path><path d="M2.5,14 L6,10"></path><path d="M6.2,12.8 L6,10 L3.2,10.2"></path><path d="M13.5,14 L10,10"></path><path d="M9.8,12.8 L10,10 L12.8,10.2"></path></svg> Matter</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="8" cy="4.5" rx="5" ry="1.8"></ellipse><path d="M3,4.5 v7 a5,1.8 0,0,0 10,0 v-7"></path><path d="M3,8 a5,1.8 0,0,0 10,0"></path></svg> DB</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="5" x2="14" y2="5"></line><line x1="2" y1="8" x2="14" y2="8"></line><line x1="2" y1="11" x2="9" y2="11"></line></svg> Logs</button> <div class="nav-spacer svelte-1n46o8q"></div> <div class="stats-wrap svelte-1n46o8q"><button class="nav-icon svelte-1n46o8q" title="Daemon status"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="20" x2="18" y2="10"></line><line x1="12" y1="20" x2="12" y2="4"></line><line x1="6" y1="20" x2="6" y2="14"></line></svg></button> <!></div> <div class="nav-right svelte-1n46o8q"><div class="version-wrap svelte-1n46o8q"><button class="version svelte-1n46o8q"> <!></button> <!></div> <a class="nav-icon svelte-1n46o8q" href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" title="GitHub"><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg></a> <button title="Settings"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg></button> <!></div></nav> <main class="svelte-1n46o8q"><div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div></main></div>'),CX=A('<div class="login-error svelte-1n46o8q"> </div>'),xX=A('<div class="login-overlay svelte-1n46o8q"><form class="login-box svelte-1n46o8q"><div class="login-brand svelte-1n46o8q">she</div> <h2 class="svelte-1n46o8q">Sign in</h2> <div class="login-field svelte-1n46o8q"><label for="she-password" class="svelte-1n46o8q">Password</label> <input id="she-password" type="password" placeholder="Enter password" autocomplete="current-password" class="svelte-1n46o8q"/></div> <!> <button type="submit" class="login-btn svelte-1n46o8q"> </button></form></div>'),LX=A('<div class="updating-overlay svelte-1n46o8q"><div class="updating-box svelte-1n46o8q"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><polyline points="4 4 4 10 10 10"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> Updating smart-home-engine…</div></div>'),IX=A("<!> <!> <!>",1);function kX(o,e){xo(e,!0);const t=["scripts","mqtt","matter","db","logs","config","packages"];function i(){const me=location.hash.slice(1);return t.includes(me)?me:"scripts"}let n=U(Si(i())),s=U(null),r=U(!1),a=U(!1),c=U(!1),d=U("none"),u=U(!1),f=U(""),m=U(""),v=U(!1),_=U(!1);F8(()=>{k(u,!0)});async function y(){k(m,""),k(v,!0);try{await B8(g(f)),k(f,""),k(u,!1)}catch(me){k(m,me.message??"Login failed",!0)}finally{k(v,!1)}}async function S(){await z8(),k(u,!0)}async function D(){if(confirm("Restart the she daemon? The page will reload after a moment."))try{await q8(),setTimeout(()=>location.reload(),2500)}catch{}}async function E(){var Ve;if(!confirm(`Update to v${(Ve=g(s))==null?void 0:Ve.latestVersion}? The daemon will restart after the update completes.`))return;k(a,!1),k(c,!0);try{await K8()}catch{}await new Promise(dt=>setTimeout(dt,8e3));const me=Date.now()+12e4;for(;Date.now()<me;){try{await Qk(),location.reload();return}catch{}await new Promise(dt=>setTimeout(dt,2e3))}location.reload()}function N(me){k(n,me,!0),location.hash=me}va(async()=>{location.hash||(location.hash=g(n));const me=()=>{k(n,i(),!0)};window.addEventListener("hashchange",me);try{k(d,await W8(),!0),g(d)==="password"&&(await fetch("/she/scripts")).status===401&&k(u,!0)}catch{}k(_,!0);async function Ve(){try{k(s,await Qk(),!0)}catch{}}Ve();const dt=setInterval(Ve,5e3);return()=>{window.removeEventListener("hashchange",me),clearInterval(dt)}});var B=IX();Kn("click",AP,()=>{g(r)&&k(r,!1),g(a)&&k(a,!1)});var F=xt(B);{var Q=me=>{var Ve=SX(),dt=x(Ve),Ke=I(x(dt),2);let Ut;var lt=I(Ke,2);let Kt;var Ie=I(lt,2);let Pt;var Fe=I(Ie,2);let ft;var zt=I(Fe,2);let Gt;var ci=I(zt,2);let Vt;var Ht=I(ci,4),Fi=x(Ht),zi=I(Fi,2);{var tt=O=>{var X=pX(),xe=x(X);{var Ze=De=>{var Ue=gX(),Ge=I(x(Ue)),Xe=x(Ge),Ce=I(Ge,3),Et=x(Ce),Ft=I(Ce,3),gi=x(Ft),Qi=I(Ft,2);{var Ii=_t=>{var st=hX(),Je=I(xt(st)),j=x(Je),re=I(Je,3),Le=x(re);Y(()=>{q(j,g(s).matterNodes??0),q(Le,g(s).matterEndpoints??0)}),T(_t,st)};K(Qi,_t=>{g(s).matterEnabled&&_t(Ii)})}var ee=I(Qi,2);{var be=_t=>{var st=uX(),Je=I(xt(st)),j=x(Je),re=I(Je,3),Le=x(re);Y(()=>{q(j,g(s).dbDocs??"—"),q(Le,g(s).dbViews??"—")}),T(_t,st)};K(ee,_t=>{g(s).dbEnabled&&_t(be)})}var qe=I(ee,3),pt=x(qe),Lt=I(qe,3),ce=x(Lt),je=I(Lt,3),yt=x(je);Y(()=>{q(Xe,g(s).scripts),q(Et,g(s).topics),q(gi,g(s).mqttMsgPerSec??"—"),q(pt,g(s).handlers??"—"),q(ce,g(s).memMb!=null?g(s).memMb+" MB":"—"),q(yt,g(s).cpuPercent!=null?g(s).cpuPercent+" %":"—")}),T(De,Ue)},Dt=De=>{var Ue=fX();T(De,Ue)};K(xe,De=>{g(s)?De(Ze):De(Dt,-1)})}var mt=I(xe,2),Me=x(mt);oe("click",X,De=>De.stopPropagation()),oe("click",Me,()=>{k(r,!1),D()}),T(O,X)};K(zi,O=>{g(r)&&O(tt)})}var Ct=I(Ht,2),mi=x(Ct),Ci=x(mi),xi=x(Ci);xi.nodeValue="v0.19.9 ";var Di=I(xi);{var Ji=O=>{var X=mX();T(O,X)};K(Di,O=>{var X;(X=g(s))!=null&&X.latestVersion&&O(Ji)})}var Ui=I(Ci,2);{var bn=O=>{var X=wX(),xe=x(X),Ze=I(x(xe));Ze.textContent="v0.19.9";var Dt=I(Ze,2);{var mt=Ge=>{var Xe=_X(),Ce=I(xt(Xe)),Et=x(Ce);Y(()=>q(Et,`v${g(s).latestVersion??""}`)),T(Ge,Xe)},Me=Ge=>{var Xe=vX();T(Ge,Xe)};K(Dt,Ge=>{var Xe;(Xe=g(s))!=null&&Xe.latestVersion?Ge(mt):Ge(Me,-1)})}var De=I(xe,2);{var Ue=Ge=>{var Xe=bX(),Ce=x(Xe),Et=I(x(Ce));Y(()=>q(Et,` Update to v${g(s).latestVersion??""}`)),oe("click",Ce,E),T(Ge,Xe)};K(De,Ge=>{var Xe;(Xe=g(s))!=null&&Xe.latestVersion&&Ge(Ue)})}oe("click",X,Ge=>Ge.stopPropagation()),T(O,X)};K(Ui,O=>{g(a)&&O(bn)})}var mn=I(mi,4);let Tn;var wn=I(mn,2);{var _n=O=>{var X=yX();oe("click",X,S),T(O,X)};K(wn,O=>{g(d)==="password"&&O(_n)})}var Dn=I(dt,2),Ei=x(Dn);let $i;var Fn=x(Ei);{let O=ct(()=>g(n)==="scripts");UK(Fn,{get active(){return g(O)}})}var hn=I(Ei,2);let Ai;var rn=x(hn);dX(rn,{});var xn=I(hn,2);let Ln;var Bn=x(xn);X9(Bn,{});var Hn=I(xn,2);let $e;var ne=x(Hn);L9(ne,{});var it=I(Hn,2);let Z;var Te=x(it);AZ(Te,{});var nt=I(it,2);let wt;var Qt=x(nt);DG(Qt,{});var Zt=I(nt,2);let Li;var _i=x(Zt);MG(_i,{}),Y(()=>{Ut=Bt(Ke,1,"svelte-1n46o8q",null,Ut,{active:g(n)==="scripts"}),Kt=Bt(lt,1,"svelte-1n46o8q",null,Kt,{active:g(n)==="packages"}),Pt=Bt(Ie,1,"svelte-1n46o8q",null,Pt,{active:g(n)==="mqtt"}),ft=Bt(Fe,1,"svelte-1n46o8q",null,ft,{active:g(n)==="matter"}),Gt=Bt(zt,1,"svelte-1n46o8q",null,Gt,{active:g(n)==="db"}),Vt=Bt(ci,1,"svelte-1n46o8q",null,Vt,{active:g(n)==="logs"}),Tn=Bt(mn,1,"nav-settings svelte-1n46o8q",null,Tn,{active:g(n)==="config"}),$i=Bt(Ei,1,"page-wrap svelte-1n46o8q",null,$i,{hidden:g(n)!=="scripts"}),Ai=Bt(hn,1,"page-wrap svelte-1n46o8q",null,Ai,{hidden:g(n)!=="packages"}),Ln=Bt(xn,1,"page-wrap svelte-1n46o8q",null,Ln,{hidden:g(n)!=="mqtt"}),$e=Bt(Hn,1,"page-wrap svelte-1n46o8q",null,$e,{hidden:g(n)!=="matter"}),Z=Bt(it,1,"page-wrap svelte-1n46o8q",null,Z,{hidden:g(n)!=="db"}),wt=Bt(nt,1,"page-wrap svelte-1n46o8q",null,wt,{hidden:g(n)!=="config"}),Li=Bt(Zt,1,"page-wrap svelte-1n46o8q",null,Li,{hidden:g(n)!=="logs"})}),oe("click",Ke,()=>N("scripts")),oe("click",lt,()=>N("packages")),oe("click",Ie,()=>N("mqtt")),oe("click",Fe,()=>N("matter")),oe("click",zt,()=>N("db")),oe("click",ci,()=>N("logs")),oe("click",Fi,O=>{O.stopPropagation(),k(r,!g(r))}),oe("click",Ci,O=>{O.stopPropagation(),k(a,!g(a)),k(r,!1)}),oe("click",mn,()=>N("config")),T(me,Ve)};K(F,me=>{g(_)&&!g(u)&&me(Q)})}var $=I(F,2);{var fe=me=>{var Ve=xX(),dt=x(Ve),Ke=I(x(dt),4),Ut=I(x(Ke),2),lt=I(Ke,2);{var Kt=Fe=>{var ft=CX(),zt=x(ft);Y(()=>q(zt,g(m))),T(Fe,ft)};K(lt,Fe=>{g(m)&&Fe(Kt)})}var Ie=I(lt,2),Pt=x(Ie);Y(()=>{Ut.disabled=g(v),Ie.disabled=g(v)||!g(f),q(Pt,g(v)?"Signing in…":"Sign in")}),Kn("submit",dt,Fe=>{Fe.preventDefault(),y()}),Ki(Ut,()=>g(f),Fe=>k(f,Fe)),T(me,Ve)};K($,me=>{g(u)&&me(fe)})}var Pe=I($,2);{var ze=me=>{var Ve=LX();T(me,Ve)};K(Pe,me=>{g(c)&&me(ze)})}T(o,B),Lo()}cr(["click"]);sW(kX,{target:document.getElementById("app")});export{pT as t};
|