smart-home-engine 1.8.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,230 @@
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-CKR1khFZ.js"])))=>i.map(i=>d[i]);
2
+ var WF=Object.defineProperty;var fS=o=>{throw TypeError(o)};var zF=(o,e,t)=>e in o?WF(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var bn=(o,e,t)=>zF(o,typeof e!="symbol"?e+"":e,t),Sb=(o,e,t)=>e.has(o)||fS("Cannot "+t);var Ce=(o,e,t)=>(Sb(o,e,"read from private field"),t?t.call(o):e.get(o)),gn=(o,e,t)=>e.has(o)?fS("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),pn=(o,e,t,i)=>(Sb(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t),Kn=(o,e,t)=>(Sb(o,e,"access private method"),t);import{_ as WA,m as zA,l as ui,A as yo,C as $e,I as Yn,D as ap,a as fs,g as VA,M as Yt,b as Ui,E as ha,c as U,r as Tn,d as Wr,e as S,f as VF,h as Un,R as xn,S as Hi,i as oo,j as zr,k as En,n as on,o as Ae,p as gt,K as xs,q as ci,s as Pt,t as As,u as ee,v as fn,O as qa,w as bs,P as pi,x as Db,y as lp,z as jA,B as Cl,F as fa,G as AC,H as js,U as Rn,J as h0,L as xi,N as Al,Q as jF,T as mo,V as kC,W as $F,X as $A,$ as li,Y as Dn,Z as Cn,a0 as is,a1 as Qi,a2 as Qo,a3 as hg,a4 as Bt,a5 as Dx,a6 as UF,a7 as qF,a8 as Ds,a9 as GF,aa as ga,ab as wo,ac as yi,ad as UA,ae as Zn,af as KF,ag as ZF,ah as bo,ai as V0,aj as ms,ak as pv,al as go,am as $c,an as tw,ao as xv,ap as Ws,aq as f0,ar as zs,as as mv,at as _v,au as XF,av as cp,aw as j0,ax as Ol,ay as YF,az as $0,aA as QF,aB as iw,aC as JF,aD as e3,aE as gS,aF as hs,aG as El,aH as po,aI as sn,aJ as ml,aK as t3,aL as Xa,aM as Zo,aN as Rs,aO as pa,aP as nw,aQ as ks,aR as ds,aS as Jx,aT as nn,aU as qA,aV as i3,aW as sw,aX as vv,aY as ow,aZ as rw,a_ as Cd,a$ as n3,b0 as aw,b1 as s3,b2 as lw,b3 as Hl,b4 as Wl,b5 as g0,b6 as fg,b7 as Ro,b8 as dp,b9 as em,ba as Ab,bb as On,bc as cw,bd as up,be as bv,bf as o3,bg as GA,bh as gg,bi as p0,bj as pg,bk as hp,bl as Cv,bm as wn,bn as Uc,bo as fp,bp as r3,bq as a3,br as dw,bs as l3,bt as tm,bu as fr,bv as uw,bw as x0,bx as zl,by as U0,bz as dn,bA as m0,bB as KA,bC as gp,bD as c3,bE as Ed,bF as ti,bG as pS,bH as Ax,bI as ZA,bJ as $r,bK as aa,bL as Vn,bM as _0,bN as Tr,bO as v0,bP as ts,bQ as xg,bR as Hu,bS as BC,bT as XA,bU as YA,bV as QA,bW as hw,bX as Fo,bY as In,bZ as pp,b_ as JA,b$ as yl,c0 as Ev,c1 as d3,c2 as Sh,c3 as xS,c4 as xp,c5 as e2,c6 as Dh,c7 as u3,c8 as Ar,c9 as yv,ca as h3,cb as So,cc as xa,cd as mp,ce as mg,cf as t2,cg as cr,ch as _p,ci as wv,cj as f3,ck as g3,cl as p3,cm as q0,cn as Ya,co as Ns,cp as x3,cq as fw,cr as m3,cs as _3,ct as mS,cu as v3,cv as vp,cw as kl,cx as FC,cy as vu,cz as Bl,cA as b3,cB as Ga,cC as Mr,cD as Uo,cE as _S,cF as ao,cG as bp,cH as Mc,cI as Qa,cJ as C3,cK as ma,cL as _g,cM as Sv,cN as i2,cO as E3,cP as y3,cQ as gw,cR as w3,cS as vg,cT as S3,cU as lc,cV as bg,cW as vS,cX as D3,cY as A3,cZ as tl,c_ as k3,c$ as pw,d0 as n2,d1 as s2,d2 as o2,d3 as r2,d4 as B3,d5 as F3,d6 as a2,d7 as l2,d8 as L3,d9 as xw,da as I3,db as P3,dc as ns,dd as T3,de as mw,df as M3,dg as Ah,dh as bS,di as R3,dj as N3,dk as O3,dl as H3,dm as W3,dn as z3,dp as b0,dq as Dv,dr as LC,ds as V3,dt as j3,du as CS,dv as IC,dw as $3,dx as ES,dy as kb,dz as U3,dA as c2,dB as q3,dC as d2,dD as PC,dE as G3,dF as K3,dG as Z3,dH as u2,dI as h2,dJ as X3,dK as im,dL as f2,dM as Av,dN as Y3,dO as Q3,dP as Rc,dQ as _w,dR as J3,dS as yS,dT as wS,dU as eL,dV as kh,dW as g2,dX as tL,dY as iL,dZ as nL,d_ as sL,d$ as p2,e0 as x2,e1 as m2,e2 as _2,e3 as oL,e4 as Ka,e5 as SS,e6 as rL,e7 as Cp,e8 as aL,e9 as Af,ea as v2,eb as DS,ec as Cg,ed as b2,ee as nm,ef as lL,eg as C2,eh as cL,ei as E2,ej as dL,ek as uL,el as y2,em as w2,en as Fl,eo as kv,ep as hL,eq as S2,er as Xo,es as yd,et as D2,eu as fL,ev as gL,ew as A2,ex as k2,ey as pL,ez as B2,eA as F2,eB as Eg,eC as xL,eD as mL,eE as _L,eF as vL,eG as xf,eH as AS,eI as bL,eJ as CL,eK as EL,eL as sm,eM as Ys,eN as yL,eO as TC,eP as Wu,eQ as wL,eR as xl,eS as SL,eT as DL,eU as L2,eV as AL,eW as Uf,eX as kL,eY as BL,eZ as FL,e_ as LL,e$ as kS,f0 as BS,f1 as FS,f2 as zu,f3 as vw,f4 as I2,f5 as MC,f6 as kx,f7 as P2,f8 as om,f9 as IL,fa as PL,fb as TL,fc as ML,fd as bw,fe as T2,ff as RL,fg as rm,fh as M2,fi as R2,fj as NL,fk as OL,fl as HL,fm as WL,fn as zL,fo as VL,fp as jL,fq as $L,fr as N2,fs as UL,ft as am,fu as O2,fv as qL,fw as H2,fx as GL,fy as W2,fz as z2,fA as KL,fB as LS,fC as V2,fD as IS,fE as ZL,fF as Bb,fG as PS,fH as XL,fI as YL,fJ as QL,fK as Ha,fL as Nc,fM as JL,fN as TS,fO as Bx,fP as e4,fQ as _l,fR as Bv,fS as RC,fT as t4,fU as j2,fV as $2,fW as lo,fX as MS,fY as Gp,fZ as Cw,f_ as i4,f$ as n4,g0 as s4,g1 as o4,g2 as r4,g3 as a4,g4 as l4,g5 as c4,g6 as RS,g7 as d4,g8 as u4,g9 as h4,ga as C0,gb as qf,gc as U2,gd as f4,ge as Ew,gf as Fx,gg as Kp,gh as Fb,gi as g4,gj as p4,gk as q2,gl as x4,gm as yw,gn as m4,go as _4,gp as G2,gq as Fv,gr as v4,gs as lm,gt as ww,gu as Sw,gv as Dw,gw as K2,gx as Z2,gy as X2,gz as Y2,gA as Q2,gB as J2,gC as ek,gD as NS,gE as tk,gF as ih,gG as b4,gH as C4,gI as E4,gJ as y4,gK as ik,gL as w4,gM as S4,gN as OS,gO as NC,gP as pc,gQ as D4,gR as A4,gS as k4,gT as B4,gU as F4,gV as L4,gW as HS,gX as Aw,gY as OC,gZ as I4,g_ as HC,g$ as P4,h0 as T4,h1 as M4,h2 as R4,h3 as kw,h4 as nk,h5 as WS,h6 as zS,h7 as N4,h8 as O4,h9 as H4,ha as VS,hb as Lb,hc as W4,hd as z4,he as V4,hf as Ib,hg as sk,hh as ok,hi as rk,hj as ak,hk as Ll,hl as lk,hm as Bw,hn as jS,ho as j4,hp as ck,hq as $4,hr as U4,hs as Lv,ht as Iv,hu as Vu,hv as Pv,hw as Ep,hx as q4,hy as Tv,hz as G4,hA as K4,hB as Z4,hC as dk,hD as mf,hE as X4,hF as Y4,hG as Q4,hH as J4,hI as yp,hJ as e7,hK as uk,hL as hk,hM as fk,hN as WC,hO as t7,hP as i7,hQ as n7,hR as s7,hS as o7,hT as zC,hU as r7,hV as a7,hW as l7,hX as c7,hY as d7,hZ as u7,h_ as h7,h$ as f7,i0 as gk,i1 as g7,i2 as p7,i3 as x7,i4 as $S,i5 as m7,i6 as _7,i7 as rd,i8 as yr,i9 as v7,ia as b7}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 pk=!1;var Fw=Array.isArray,C7=Array.prototype.indexOf,cm=Array.prototype.includes,Mv=Array.from,E7=Object.defineProperty,jh=Object.getOwnPropertyDescriptor,y7=Object.getOwnPropertyDescriptors,w7=Object.prototype,S7=Array.prototype,xk=Object.getPrototypeOf,US=Object.isExtensible;const Rv=()=>{};function D7(o){for(var e=0;e<o.length;e++)o[e]()}function mk(){var o,e,t=new Promise((i,n)=>{o=i,e=n});return{promise:t,resolve:o,reject:e}}function A7(o,e,t=!1){return o===void 0?t?e():e:o}function qS(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 ho=2,E0=4,Nv=8,_k=1<<24,la=16,ua=32,Oc=64,VC=128,Or=512,Qs=1024,io=2048,Ja=4096,Io=8192,Hr=16384,G0=32768,jC=1<<25,y0=65536,dm=1<<17,k7=1<<18,K0=1<<19,B7=1<<20,ja=1<<25,bu=65536,um=1<<21,$h=1<<22,xc=1<<23,wd=Symbol("$state"),F7=Symbol("legacy props"),L7=Symbol(""),Lx=Symbol("attributes"),$C=Symbol("class"),UC=Symbol("style"),kf=Symbol("text"),Ix=Symbol("form reset"),Ov=new class extends Error{constructor(){super(...arguments);bn(this,"name","StaleReactionError");bn(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var NA;const I7=!!((NA=globalThis.document)!=null&&NA.contentType)&&globalThis.document.contentType.includes("xml");function vk(o){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function P7(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function T7(o,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function M7(o){throw new Error("https://svelte.dev/e/effect_in_teardown")}function R7(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function N7(o){throw new Error("https://svelte.dev/e/effect_orphan")}function O7(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function H7(o){throw new Error("https://svelte.dev/e/props_invalid_value")}function W7(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function z7(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function V7(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function j7(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const $7=1,U7=2,bk=4,q7=8,G7=16,K7=1,Z7=4,X7=8,Y7=16,Q7=1,J7=2,Xs=Symbol("uninitialized"),Ck="http://www.w3.org/1999/xhtml",eI="http://www.w3.org/2000/svg",tI="http://www.w3.org/1998/Math/MathML";function iI(){console.warn("https://svelte.dev/e/derived_inert")}function nI(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function sI(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Ek(o){return o===this.v}function oI(o,e){return o!=o?e==e:o!==e||o!==null&&typeof o=="object"||typeof o=="function"}function yk(o){return!oI(o,this.v)}let rI=!1,uo=null;function w0(o){uo=o}function Os(o,e=!1,t){uo={p:uo,i:!1,c:null,e:null,s:o,x:null,r:Pn,l:null}}function Hs(o){var e=uo,t=e.e;if(t!==null){e.e=null;for(var i of t)Uk(i)}return o!==void 0&&(e.x=o),e.i=!0,uo=e.p,o??{}}function wk(){return!0}let ud=[];function Sk(){var o=ud;ud=[],D7(o)}function mc(o){if(ud.length===0&&!Kf){var e=ud;queueMicrotask(()=>{e===ud&&Sk()})}ud.push(o)}function aI(){for(;ud.length>0;)Sk()}function Dk(o){var e=Pn;if(e===null)return Ln.f|=xc,o;if((e.f&G0)===0&&(e.f&E0)===0)throw o;cc(o,e)}function cc(o,e){for(;e!==null;){if((e.f&VC)!==0){if((e.f&G0)===0)throw o;try{e.b.error(o);return}catch(t){o=t}}e=e.parent}throw o}const lI=-7169;function Ps(o,e){o.f=o.f&lI|e}function Lw(o){(o.f&Or)!==0||o.deps===null?Ps(o,Qs):Ps(o,Ja)}function Ak(o){if(o!==null)for(const e of o)(e.f&ho)===0||(e.f&bu)===0||(e.f^=bu,Ak(e.deps))}function kk(o,e,t){(o.f&io)!==0?e.add(o):(o.f&Ja)!==0&&t.add(o),Ak(o.deps),Ps(o,Qs)}let Zp=!1;function cI(o){var e=Zp;try{return Zp=!1,[o(),Zp]}finally{Zp=e}}let Pb=null,nh=null,tn=null,Gf=null,ro=null,qC=null,Kf=!1,Tb=!1,Bh=null,Px=null;var GS=0;let dI=1;var Kh,oc,xd,Zh,Xh,Yh,hl,Qh,Vo,tp,fl,Qr,Ma,Jh,md,ss,GC,Bf,KC,Bk,Fk,vh,uI,Ff;const E_=class E_{constructor(){gn(this,ss);bn(this,"id",dI++);gn(this,Kh,!1);bn(this,"linked",!0);gn(this,oc,null);gn(this,xd,null);bn(this,"async_deriveds",new Map);bn(this,"current",new Map);bn(this,"previous",new Map);gn(this,Zh,new Set);gn(this,Xh,new Set);gn(this,Yh,0);gn(this,hl,new Map);gn(this,Qh,null);gn(this,Vo,[]);gn(this,tp,[]);gn(this,fl,new Set);gn(this,Qr,new Set);gn(this,Ma,new Map);gn(this,Jh,new Set);bn(this,"is_fork",!1);gn(this,md,!1);nh===null?Pb=nh=this:(pn(nh,xd,this),pn(this,oc,nh)),nh=this}skip_effect(e){Ce(this,Ma).has(e)||Ce(this,Ma).set(e,{d:[],m:[]}),Ce(this,Jh).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=Ce(this,Ma).get(e);if(i){Ce(this,Ma).delete(e);for(var n of i.d)Ps(n,io),t(n);for(n of i.m)Ps(n,Ja),t(n)}Ce(this,Jh).add(e)}capture(e,t,i=!1){e.v!==Xs&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&xc)===0&&(this.current.set(e,[t,i]),ro==null||ro.set(e,t)),this.is_fork||(e.v=t)}activate(){tn=this}deactivate(){tn=null,ro=null}flush(){try{Tb=!0,tn=this,Kn(this,ss,Bf).call(this)}finally{GS=0,qC=null,Bh=null,Px=null,Tb=!1,tn=null,ro=null,Sd.clear()}}discard(){var e;for(const t of Ce(this,Xh))t(this);Ce(this,Xh).clear(),Kn(this,ss,Ff).call(this),(e=Ce(this,Qh))==null||e.resolve()}register_created_effect(e){Ce(this,tp).push(e)}increment(e,t){if(pn(this,Yh,Ce(this,Yh)+1),e){let i=Ce(this,hl).get(t)??0;Ce(this,hl).set(t,i+1)}}decrement(e,t){if(pn(this,Yh,Ce(this,Yh)-1),e){let i=Ce(this,hl).get(t)??0;i===1?Ce(this,hl).delete(t):Ce(this,hl).set(t,i-1)}Ce(this,md)||(pn(this,md,!0),mc(()=>{pn(this,md,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)Ce(this,fl).add(i);for(const i of t)Ce(this,Qr).add(i);e.clear(),t.clear()}oncommit(e){Ce(this,Zh).add(e)}ondiscard(e){Ce(this,Xh).add(e)}settled(){return(Ce(this,Qh)??pn(this,Qh,mk())).promise}static ensure(){if(tn===null){const e=tn=new E_;!Tb&&!Kf&&mc(()=>{Ce(e,Kh)||e.flush()})}return tn}apply(){{ro=null;return}}schedule(e){var n;if(qC=e,(n=e.b)!=null&&n.is_pending&&(e.f&(E0|Nv|_k))!==0&&(e.f&G0)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(Bh!==null&&t===Pn&&(Ln===null||(Ln.f&ho)===0))return;if((i&(Oc|ua))!==0){if((i&Qs)===0)return;t.f^=Qs}}Ce(this,Vo).push(t)}};Kh=new WeakMap,oc=new WeakMap,xd=new WeakMap,Zh=new WeakMap,Xh=new WeakMap,Yh=new WeakMap,hl=new WeakMap,Qh=new WeakMap,Vo=new WeakMap,tp=new WeakMap,fl=new WeakMap,Qr=new WeakMap,Ma=new WeakMap,Jh=new WeakMap,md=new WeakMap,ss=new WeakSet,GC=function(){if(this.is_fork)return!0;for(const i of Ce(this,hl).keys()){for(var e=i,t=!1;e.parent!==null;){if(Ce(this,Ma).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},Bf=function(){var d,u,f,g;pn(this,Kh,!0),GS++>1e3&&(Kn(this,ss,Ff).call(this),fI());for(const p of Ce(this,fl))Ce(this,Qr).delete(p),Ps(p,io),this.schedule(p);for(const p of Ce(this,Qr))Ps(p,Ja),this.schedule(p);const e=Ce(this,Vo);pn(this,Vo,[]),this.apply();var t=Bh=[],i=[],n=Px=[];for(const p of e)try{Kn(this,ss,KC).call(this,p,t,i)}catch(C){throw Pk(p),Kn(this,ss,GC).call(this)||this.discard(),C}if(tn=null,n.length>0){var s=E_.ensure();for(const p of n)s.schedule(p)}if(Bh=null,Px=null,Kn(this,ss,GC).call(this)){Kn(this,ss,vh).call(this,i),Kn(this,ss,vh).call(this,t);for(const[p,C]of Ce(this,Ma))Ik(p,C);n.length>0&&Kn(d=tn,ss,Bf).call(d);return}const r=Kn(this,ss,Bk).call(this);if(r){Kn(this,ss,vh).call(this,i),Kn(this,ss,vh).call(this,t),Kn(u=r,ss,Fk).call(u,this);return}Ce(this,fl).clear(),Ce(this,Qr).clear();for(const p of Ce(this,Zh))p(this);Ce(this,Zh).clear(),Gf=this,KS(i),KS(t),Gf=null,(f=Ce(this,Qh))==null||f.resolve();var a=tn;if(Ce(this,Yh)===0&&(Ce(this,Vo).length===0||a!==null)&&Kn(this,ss,Ff).call(this),Ce(this,Vo).length>0)if(a!==null){const p=a;Ce(p,Vo).push(...Ce(this,Vo).filter(C=>!Ce(p,Vo).includes(C)))}else a=this;a!==null&&Kn(g=a,ss,Bf).call(g)},KC=function(e,t,i){e.f^=Qs;for(var n=e.first;n!==null;){var s=n.f,r=(s&(ua|Oc))!==0,a=r&&(s&Qs)!==0,d=a||(s&Io)!==0||Ce(this,Ma).has(n);if(!d&&n.fn!==null){r?n.f^=Qs:(s&E0)!==0?t.push(n):Sp(n)&&((s&la)!==0&&Ce(this,Qr).add(n),D0(n));var u=n.first;if(u!==null){n=u;continue}}for(;n!==null;){var f=n.next;if(f!==null){n=f;break}n=n.parent}}},Bk=function(){for(var e=Ce(this,oc);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=Ce(e,oc)}return null},Fk=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(Ce(e,fl),Ce(e,Qr));const t=n=>{var s=n.reactions;if(s!==null)for(const d of s){var r=d.f;if((r&ho)!==0)t(d);else{var a=d;r&($h|la)&&!this.async_deriveds.has(a)&&(Ce(this,Qr).delete(a),Ps(a,io),this.schedule(a))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),Kn(i=e,ss,Ff).call(i),tn=this,Kn(this,ss,Bf).call(this)},vh=function(e){for(var t=0;t<e.length;t+=1)kk(e[t],Ce(this,fl),Ce(this,Qr))},uI=function(){var f;for(let g=Pb;g!==null;g=Ce(g,xd)){var e=g.id<this.id,t=[];for(const[p,[C,b]]of this.current){if(g.current.has(p)){var i=g.current.get(p)[0];if(e&&C!==i)g.current.set(p,[C,b]);else continue}t.push(p)}if(e)for(const[p,C]of this.async_deriveds){const b=g.async_deriveds.get(p);b&&C.promise.then(b.resolve).catch(b.reject)}if(Ce(g,Kh)){var n=[...g.current.keys()].filter(p=>!g.current.get(p)[1]&&!this.current.has(p));if(n.length===0)e&&g.discard();else if(t.length>0){if(e)for(const p of Ce(this,Jh))g.unskip_effect(p,C=>{var b;(C.f&(la|$h))!==0?g.schedule(C):Kn(b=g,ss,vh).call(b,[C])});g.activate();var s=new Set,r=new Map;for(var a of t)Lk(a,n,s,r);r=new Map;var d=[...g.current].filter(([p,C])=>{const b=this.current.get(p);return b?b[0]!==C[0]||b[1]!==C[1]:!0}).map(([p])=>p);if(d.length>0)for(const p of Ce(this,tp))(p.f&(Hr|Io|dm))===0&&Iw(p,d,r)&&((p.f&($h|la))!==0?(Ps(p,io),g.schedule(p)):Ce(g,fl).add(p));if(Ce(g,Vo).length>0&&!Ce(g,md)){g.apply();for(var u of Ce(g,Vo))Kn(f=g,ss,KC).call(f,u,[],[]);pn(g,Vo,[])}g.deactivate()}}}},Ff=function(){if(this.linked){var e=Ce(this,oc),t=Ce(this,xd);e===null?Pb=t:pn(e,xd,t),t===null?nh=e:pn(t,oc,e),this.linked=!1}};let Cu=E_;function hI(o){var e=Kf;Kf=!0;try{for(var t;;){if(aI(),tn===null)return t;tn.flush()}}finally{Kf=e}}function fI(){try{O7()}catch(o){cc(o,qC)}}let Zr=null;function KS(o){var e=o.length;if(e!==0){for(var t=0;t<e;){var i=o[t++];if((i.f&(Hr|Io))===0&&Sp(i)&&(Zr=new Set,D0(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&Kk(i),(Zr==null?void 0:Zr.size)>0)){Sd.clear();for(const n of Zr){if((n.f&(Hr|Io))!==0)continue;const s=[n];let r=n.parent;for(;r!==null;)Zr.has(r)&&(Zr.delete(r),s.push(r)),r=r.parent;for(let a=s.length-1;a>=0;a--){const d=s[a];(d.f&(Hr|Io))===0&&D0(d)}}Zr.clear()}}Zr=null}}function Lk(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&ho)!==0?Lk(n,e,t,i):(s&($h|la))!==0&&(s&io)===0&&Iw(n,e,i)&&(Ps(n,io),Pw(n))}}function Iw(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(cm.call(e,n))return!0;if((n.f&ho)!==0&&Iw(n,e,t))return t.set(n,!0),!0}return t.set(o,!1),!1}function Pw(o){tn.schedule(o)}function Ik(o,e){if(!((o.f&ua)!==0&&(o.f&Qs)!==0)){(o.f&io)!==0?e.d.push(o):(o.f&Ja)!==0&&e.m.push(o),Ps(o,Qs);for(var t=o.first;t!==null;)Ik(t,e),t=t.next}}function Pk(o){Ps(o,Qs);for(var e=o.first;e!==null;)Pk(e),e=e.next}function gI(o){let e=0,t=Eu(0),i;return()=>{Nw()&&(c(t),Wv(()=>(e===0&&(i=jl(()=>o(()=>Zf(t)))),e+=1,()=>{mc(()=>{e-=1,e===0&&(i==null||i(),i=void 0,Zf(t))})})))}}var pI=y0|K0;function xI(o,e,t,i){new mI(o,e,t,i)}var Br,ew,Fr,_d,jo,Lr,ko,or,gl,vd,rc,e0,ip,np,pl,y_,Ms,_I,vI,bI,ZC,Tx,Mx,XC,YC;class mI{constructor(e,t,i,n){gn(this,Ms);bn(this,"parent");bn(this,"is_pending",!1);bn(this,"transform_error");gn(this,Br);gn(this,ew,null);gn(this,Fr);gn(this,_d);gn(this,jo);gn(this,Lr,null);gn(this,ko,null);gn(this,or,null);gn(this,gl,null);gn(this,vd,0);gn(this,rc,0);gn(this,e0,!1);gn(this,ip,new Set);gn(this,np,new Set);gn(this,pl,null);gn(this,y_,gI(()=>(pn(this,pl,Eu(Ce(this,vd))),()=>{pn(this,pl,null)})));var s;pn(this,Br,e),pn(this,Fr,t),pn(this,_d,r=>{var a=Pn;a.b=this,a.f|=VC,i(r)}),this.parent=Pn.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(r=>r),pn(this,jo,Ww(()=>{Kn(this,Ms,ZC).call(this)},pI))}defer_effect(e){kk(e,Ce(this,ip),Ce(this,np))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!Ce(this,Fr).pending}update_pending_count(e,t){Kn(this,Ms,XC).call(this,e,t),pn(this,vd,Ce(this,vd)+e),!(!Ce(this,pl)||Ce(this,e0))&&(pn(this,e0,!0),mc(()=>{pn(this,e0,!1),Ce(this,pl)&&S0(Ce(this,pl),Ce(this,vd))}))}get_effect_pending(){return Ce(this,y_).call(this),c(Ce(this,pl))}error(e){if(!Ce(this,Fr).onerror&&!Ce(this,Fr).failed)throw e;tn!=null&&tn.is_fork?(Ce(this,Lr)&&tn.skip_effect(Ce(this,Lr)),Ce(this,ko)&&tn.skip_effect(Ce(this,ko)),Ce(this,or)&&tn.skip_effect(Ce(this,or)),tn.oncommit(()=>{Kn(this,Ms,YC).call(this,e)})):Kn(this,Ms,YC).call(this,e)}}Br=new WeakMap,ew=new WeakMap,Fr=new WeakMap,_d=new WeakMap,jo=new WeakMap,Lr=new WeakMap,ko=new WeakMap,or=new WeakMap,gl=new WeakMap,vd=new WeakMap,rc=new WeakMap,e0=new WeakMap,ip=new WeakMap,np=new WeakMap,pl=new WeakMap,y_=new WeakMap,Ms=new WeakSet,_I=function(){try{pn(this,Lr,Ir(()=>Ce(this,_d).call(this,Ce(this,Br))))}catch(e){this.error(e)}},vI=function(e){const t=Ce(this,Fr).failed;t&&pn(this,or,Ir(()=>{t(Ce(this,Br),()=>e,()=>()=>{})}))},bI=function(){const e=Ce(this,Fr).pending;e&&(this.is_pending=!0,pn(this,ko,Ir(()=>e(Ce(this,Br)))),mc(()=>{var t=pn(this,gl,document.createDocumentFragment()),i=wl();t.append(i),pn(this,Lr,Kn(this,Ms,Mx).call(this,()=>Ir(()=>Ce(this,_d).call(this,i)))),Ce(this,rc)===0&&(Ce(this,Br).before(t),pn(this,gl,null),Ad(Ce(this,ko),()=>{pn(this,ko,null)}),Kn(this,Ms,Tx).call(this,tn))}))},ZC=function(){try{if(this.is_pending=this.has_pending_snippet(),pn(this,rc,0),pn(this,vd,0),pn(this,Lr,Ir(()=>{Ce(this,_d).call(this,Ce(this,Br))})),Ce(this,rc)>0){var e=pn(this,gl,document.createDocumentFragment());Vw(Ce(this,Lr),e);const t=Ce(this,Fr).pending;pn(this,ko,Ir(()=>t(Ce(this,Br))))}else Kn(this,Ms,Tx).call(this,tn)}catch(t){this.error(t)}},Tx=function(e){this.is_pending=!1,e.transfer_effects(Ce(this,ip),Ce(this,np))},Mx=function(e){var t=Pn,i=Ln,n=uo;el(Ce(this,jo)),Vr(Ce(this,jo)),w0(Ce(this,jo).ctx);try{return Cu.ensure(),e()}catch(s){return Dk(s),null}finally{el(t),Vr(i),w0(n)}},XC=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&Kn(i=this.parent,Ms,XC).call(i,e,t);return}pn(this,rc,Ce(this,rc)+e),Ce(this,rc)===0&&(Kn(this,Ms,Tx).call(this,t),Ce(this,ko)&&Ad(Ce(this,ko),()=>{pn(this,ko,null)}),Ce(this,gl)&&(Ce(this,Br).before(Ce(this,gl)),pn(this,gl,null)))},YC=function(e){Ce(this,Lr)&&(Yo(Ce(this,Lr)),pn(this,Lr,null)),Ce(this,ko)&&(Yo(Ce(this,ko)),pn(this,ko,null)),Ce(this,or)&&(Yo(Ce(this,or)),pn(this,or,null));var t=Ce(this,Fr).onerror;let i=Ce(this,Fr).failed;var n=!1,s=!1;const r=()=>{if(n){sI();return}n=!0,s&&j7(),Ce(this,or)!==null&&Ad(Ce(this,or),()=>{pn(this,or,null)}),Kn(this,Ms,Mx).call(this,()=>{Kn(this,Ms,ZC).call(this)})},a=d=>{try{s=!0,t==null||t(d,r),s=!1}catch(u){cc(u,Ce(this,jo)&&Ce(this,jo).parent)}i&&pn(this,or,Kn(this,Ms,Mx).call(this,()=>{try{return Ir(()=>{var u=Pn;u.b=this,u.f|=VC,i(Ce(this,Br),()=>d,()=>r)})}catch(u){return cc(u,Ce(this,jo).parent),null}}))};mc(()=>{var d;try{d=this.transform_error(e)}catch(u){cc(u,Ce(this,jo)&&Ce(this,jo).parent);return}d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(a,u=>cc(u,Ce(this,jo)&&Ce(this,jo).parent)):a(d)})};function CI(o,e,t,i){const n=yg;var s=o.filter(p=>!p.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var r=Pn,a=EI(),d=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((r.f&Hr)===0){a();try{i(p)}catch(C){cc(C,r)}hm()}}var f=Tk();if(t.length===0){d.then(()=>u(e.map(n))).finally(f);return}function g(){Promise.all(t.map(p=>yI(p))).then(p=>u([...e.map(n),...p])).catch(p=>cc(p,r)).finally(f)}d?d.then(()=>{a(),g(),hm()}):g()}function EI(){var o=Pn,e=Ln,t=uo,i=tn;return function(s=!0){el(o),Vr(e),w0(t),s&&(o.f&Hr)===0&&(i==null||i.activate(),i==null||i.apply())}}function hm(o=!0){el(null),Vr(null),w0(null),o&&(tn==null||tn.deactivate())}function Tk(){var o=Pn,e=o.b,t=tn,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 yg(o){var e=ho|io;return Pn!==null&&(Pn.f|=K0),{ctx:uo,deps:null,effects:null,equals:Ek,f:e,fn:o,reactions:null,rv:0,v:Xs,wv:0,parent:Pn,ac:null}}const Xp=Symbol("obsolete");function yI(o,e,t){let i=Pn;i===null&&P7();var n=void 0,s=Eu(Xs),r=!Ln,a=new Set;return MI(()=>{var C,b;var d=Pn,u=mk();n=u.promise;try{Promise.resolve(o()).then(u.resolve,E=>{E!==Ov&&u.reject(E)}).finally(hm)}catch(E){u.reject(E),hm()}var f=tn;if(r){if((d.f&G0)!==0)var g=Tk();if((C=i.b)!=null&&C.is_rendered())(b=f.async_deriveds.get(d))==null||b.reject(Xp);else for(const E of a.values())E.reject(Xp);a.add(u),f.async_deriveds.set(d,u)}const p=(E,y=void 0)=>{g==null||g(),a.delete(u),y!==Xp&&(f.activate(),y?(s.f|=xc,S0(s,y)):((s.f&xc)!==0&&(s.f^=xc),S0(s,E)),f.deactivate())};u.promise.then(p,E=>p(null,E||"unknown"))}),Ow(()=>{for(const d of a)d.reject(Xp)}),new Promise(d=>{function u(f){function g(){f===n?d(s):u(n)}f.then(g,g)}u(n)})}function It(o){const e=yg(o);return Yk(e),e}function Tw(o){const e=yg(o);return e.equals=yk,e}function wI(o){var e=o.effects;if(e!==null){o.effects=null;for(var t=0;t<e.length;t+=1)Yo(e[t])}}function Mw(o){var e,t=Pn,i=o.parent;if(!Il&&i!==null&&o.v!==Xs&&(i.f&(Hr|Io))!==0)return iI(),o.v;el(i);try{o.f&=~bu,wI(o),e=t6(o)}finally{el(t)}return e}function Mk(o){var e=Mw(o);if(!o.equals(e)&&(o.wv=Jk(),(!(tn!=null&&tn.is_fork)||o.deps===null)&&(tn!==null?(tn.capture(o,e,!0),Gf==null||Gf.capture(o,e,!0)):o.v=e,o.deps===null))){Ps(o,Qs);return}Il||(ro!==null?(Nw()||tn!=null&&tn.is_fork)&&ro.set(o,e):Lw(o))}function SI(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(Ov),i.fn!==null&&(i.teardown=Rv),i.ac=null,wg(i,0),zw(i))}function Rk(o){if(o.effects!==null)for(const e of o.effects)e.teardown&&e.fn!==null&&D0(e)}let fm=new Set;const Sd=new Map;let Nk=!1;function Eu(o,e){var t={f:0,v:o,reactions:null,equals:Ek,rv:0,wv:0};return t}function P(o,e){const t=Eu(o);return Yk(t),t}function DI(o,e=!1,t=!0){const i=Eu(o);return e||(i.equals=yk),i}function m(o,e,t=!1){Ln!==null&&(!ca||(Ln.f&dm)!==0)&&wk()&&(Ln.f&(ho|la|$h|dm))!==0&&(Za===null||!Za.has(o))&&V7();let i=t?Di(e):e;return S0(o,i,Px)}function S0(o,e,t=null){if(!o.equals(e)){Sd.set(o,Il?e:o.v);var i=Cu.ensure();if(i.capture(o,e),(o.f&ho)!==0){const n=o;(o.f&io)!==0&&Mw(n),ro===null&&Lw(n)}o.wv=Jk(),Ok(o,io,t),Pn!==null&&(Pn.f&Qs)!==0&&(Pn.f&(ua|Oc))===0&&(kr===null?NI([o]):kr.push(o)),!i.is_fork&&fm.size>0&&!Nk&&AI()}return e}function AI(){Nk=!1;for(const o of fm){(o.f&Qs)!==0&&Ps(o,Ja);let e;try{e=Sp(o)}catch{e=!0}e&&D0(o)}fm.clear()}function ZS(o,e=1){var t=c(o),i=e===1?t++:t--;return m(o,t),i}function Zf(o){m(o,o.v+1)}function Ok(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,d=(a&io)===0;if(d&&Ps(r,e),(a&dm)!==0)fm.add(r);else if((a&ho)!==0){var u=r;ro==null||ro.delete(u),(a&bu)===0&&(a&Or&&(Pn===null||(Pn.f&um)===0)&&(r.f|=bu),Ok(u,Ja,t))}else if(d){var f=r;(a&la)!==0&&Zr!==null&&Zr.add(f),t!==null?t.push(f):Pw(f)}}}function Di(o){if(typeof o!="object"||o===null||wd in o)return o;const e=xk(o);if(e!==w7&&e!==S7)return o;var t=new Map,i=Fw(o),n=P(0),s=kd,r=a=>{if(kd===s)return a();var d=Ln,u=kd;Vr(null),JS(s);var f=a();return Vr(d),JS(u),f};return i&&t.set("length",P(o.length)),new Proxy(o,{defineProperty(a,d,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&W7();var f=t.get(d);return f===void 0?r(()=>{var g=P(u.value);return t.set(d,g),g}):m(f,u.value,!0),!0},deleteProperty(a,d){var u=t.get(d);if(u===void 0){if(d in a){const f=r(()=>P(Xs));t.set(d,f),Zf(n)}}else m(u,Xs),Zf(n);return!0},get(a,d,u){var C;if(d===wd)return o;var f=t.get(d),g=d in a;if(f===void 0&&(!g||(C=jh(a,d))!=null&&C.writable)&&(f=r(()=>{var b=Di(g?a[d]:Xs),E=P(b);return E}),t.set(d,f)),f!==void 0){var p=c(f);return p===Xs?void 0:p}return Reflect.get(a,d,u)},getOwnPropertyDescriptor(a,d){var u=Reflect.getOwnPropertyDescriptor(a,d);if(u&&"value"in u){var f=t.get(d);f&&(u.value=c(f))}else if(u===void 0){var g=t.get(d),p=g==null?void 0:g.v;if(g!==void 0&&p!==Xs)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(a,d){var p;if(d===wd)return!0;var u=t.get(d),f=u!==void 0&&u.v!==Xs||Reflect.has(a,d);if(u!==void 0||Pn!==null&&(!f||(p=jh(a,d))!=null&&p.writable)){u===void 0&&(u=r(()=>{var C=f?Di(a[d]):Xs,b=P(C);return b}),t.set(d,u));var g=c(u);if(g===Xs)return!1}return f},set(a,d,u,f){var M;var g=t.get(d),p=d in a;if(i&&d==="length")for(var C=u;C<g.v;C+=1){var b=t.get(C+"");b!==void 0?m(b,Xs):C in a&&(b=r(()=>P(Xs)),t.set(C+"",b))}if(g===void 0)(!p||(M=jh(a,d))!=null&&M.writable)&&(g=r(()=>P(void 0)),m(g,Di(u)),t.set(d,g));else{p=g.v!==Xs;var E=r(()=>Di(u));m(g,E)}var y=Reflect.getOwnPropertyDescriptor(a,d);if(y!=null&&y.set&&y.set.call(f,u),!p){if(i&&typeof d=="string"){var D=t.get("length"),I=Number(d);Number.isInteger(I)&&I>=D.v&&m(D,I+1)}Zf(n)}return!0},ownKeys(a){c(n);var d=Reflect.ownKeys(a).filter(g=>{var p=t.get(g);return p===void 0||p.v!==Xs});for(var[u,f]of t)f.v!==Xs&&!(u in a)&&d.push(u);return d},setPrototypeOf(){z7()}})}function XS(o){try{if(o!==null&&typeof o=="object"&&wd in o)return o[wd]}catch{}return o}function kI(o,e){return Object.is(XS(o),XS(e))}var Dd,Hk,Wk,zk,Vk;function BI(){if(Dd===void 0){Dd=window,Hk=document,Wk=/Firefox/.test(navigator.userAgent);var o=Element.prototype,e=Node.prototype,t=Text.prototype;zk=jh(e,"firstChild").get,Vk=jh(e,"nextSibling").get,US(o)&&(o[$C]=void 0,o[Lx]=null,o[UC]=void 0,o.__e=void 0),US(t)&&(t[kf]=void 0)}}function wl(o=""){return document.createTextNode(o)}function $a(o){return zk.call(o)}function wp(o){return Vk.call(o)}function v(o,e){return $a(o)}function wt(o,e=!1){{var t=$a(o);return t instanceof Comment&&t.data===""?wp(t):t}}function _(o,e=1,t=!1){let i=o;for(;e--;)i=wp(i);return i}function FI(o){o.textContent=""}function jk(){return!1}function $k(o,e,t){return e==null||e===Ck?t?document.createElement(o,{is:t}):document.createElement(o):t?document.createElementNS(e,o,{is:t}):document.createElementNS(e,o)}let YS=!1;function LI(){YS||(YS=!0,document.addEventListener("reset",o=>{Promise.resolve().then(()=>{var e;if(!o.defaultPrevented)for(const t of o.target.elements)(e=t[Ix])==null||e.call(t)})},{capture:!0}))}function Hv(o){var e=Ln,t=Pn;Vr(null),el(null);try{return o()}finally{Vr(e),el(t)}}function Rw(o,e,t,i=t){o.addEventListener(e,()=>Hv(t));const n=o[Ix];n?o[Ix]=()=>{n(),i(!0)}:o[Ix]=()=>i(!0),LI()}function II(o){Pn===null&&(Ln===null&&N7(),R7()),Il&&M7()}function PI(o,e){var t=e.last;t===null?e.last=e.first=o:(t.next=o,o.prev=t,e.last=o)}function Vl(o,e){var t=Pn;t!==null&&(t.f&Io)!==0&&(o|=Io);var i={ctx:uo,deps:null,nodes:null,f:o|io|Or,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};tn==null||tn.register_created_effect(i);var n=i;if((o&E0)!==0)Bh!==null?Bh.push(i):Cu.ensure().schedule(i);else if(e!==null){try{D0(i)}catch(r){throw Yo(i),r}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&K0)===0&&(n=n.first,(o&la)!==0&&(o&y0)!==0&&n!==null&&(n.f|=y0))}if(n!==null&&(n.parent=t,t!==null&&PI(n,t),Ln!==null&&(Ln.f&ho)!==0&&(o&Oc)===0)){var s=Ln;(s.effects??(s.effects=[])).push(n)}return i}function Nw(){return Ln!==null&&!ca}function Ow(o){const e=Vl(Nv,null);return Ps(e,Qs),e.teardown=o,e}function zn(o){II();var e=Pn.f,t=!Ln&&(e&ua)!==0&&uo!==null&&!uo.i;if(t){var i=uo;(i.e??(i.e=[])).push(o)}else return Uk(o)}function Uk(o){return Vl(E0|B7,o)}function TI(o){Cu.ensure();const e=Vl(Oc|K0,o);return(t={})=>new Promise(i=>{t.outro?Ad(e,()=>{Yo(e),i(void 0)}):(Yo(e),i(void 0))})}function Hw(o){return Vl(E0,o)}function MI(o){return Vl($h|K0,o)}function Wv(o,e=0){return Vl(Nv|e,o)}function j(o,e=[],t=[],i=[]){CI(i,e,t,n=>{Vl(Nv,()=>o(...n.map(c)))})}function Ww(o,e=0){var t=Vl(la|e,o);return t}function Ir(o){return Vl(ua|K0,o)}function qk(o){var e=o.teardown;if(e!==null){const t=Il,i=Ln;QS(!0),Vr(null);try{e.call(null)}finally{QS(t),Vr(i)}}}function zw(o,e=!1){var t=o.first;for(o.first=o.last=null;t!==null;){const n=t.ac;n!==null&&Hv(()=>{n.abort(Ov)});var i=t.next;(t.f&Oc)!==0?t.parent=null:Yo(t,e),t=i}}function RI(o){for(var e=o.first;e!==null;){var t=e.next;(e.f&ua)===0&&Yo(e),e=t}}function Yo(o,e=!0){var t=!1;(e||(o.f&k7)!==0)&&o.nodes!==null&&o.nodes.end!==null&&(Gk(o.nodes.start,o.nodes.end),t=!0),Ps(o,jC),zw(o,e&&!t),wg(o,0);var i=o.nodes&&o.nodes.t;if(i!==null)for(const s of i)s.stop();qk(o),o.f^=jC,o.f|=Hr;var n=o.parent;n!==null&&n.first!==null&&Kk(o),o.next=o.prev=o.teardown=o.ctx=o.deps=o.fn=o.nodes=o.ac=o.b=null}function Gk(o,e){for(;o!==null;){var t=o===e?null:wp(o);o.remove(),o=t}}function Kk(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 Ad(o,e,t=!0){var i=[];Zk(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 Zk(o,e,t){if((o.f&Io)===0){o.f^=Io;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&Oc)===0){var r=(n.f&y0)!==0||(n.f&ua)!==0&&(o.f&la)!==0;Zk(n,e,r?t:!1)}n=s}}}function gm(o){Xk(o,!0)}function Xk(o,e){if((o.f&Io)!==0){o.f^=Io,(o.f&Qs)===0&&(Ps(o,io),Cu.ensure().schedule(o));for(var t=o.first;t!==null;){var i=t.next,n=(t.f&y0)!==0||(t.f&ua)!==0;Xk(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 Vw(o,e){if(o.nodes)for(var t=o.nodes.start,i=o.nodes.end;t!==null;){var n=t===i?null:wp(t);e.append(t),t=n}}let Rx=!1,Il=!1;function QS(o){Il=o}let Ln=null,ca=!1;function Vr(o){Ln=o}let Pn=null;function el(o){Pn=o}let Za=null;function Yk(o){Ln!==null&&(Za??(Za=new Set)).add(o)}let $o=null,nr=0,kr=null;function NI(o){kr=o}let Qk=1,hd=0,kd=hd;function JS(o){kd=o}function Jk(){return++Qk}function Sp(o){var e=o.f;if((e&io)!==0)return!0;if(e&ho&&(o.f&=~bu),(e&Ja)!==0){for(var t=o.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(Sp(s)&&Mk(s),s.wv>o.wv)return!0}(e&Or)!==0&&ro===null&&Ps(o,Qs)}return!1}function e6(o,e,t=!0){var i=o.reactions;if(i!==null&&!(Za!==null&&Za.has(o)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&ho)!==0?e6(s,e,!1):e===s&&(t?Ps(s,io):(s.f&Qs)!==0&&Ps(s,Ja),Pw(s))}}function t6(o){var E;var e=$o,t=nr,i=kr,n=Ln,s=Za,r=uo,a=ca,d=kd,u=o.f;$o=null,nr=0,kr=null,Ln=(u&(ua|Oc))===0?o:null,Za=null,w0(o.ctx),ca=!1,kd=++hd,o.ac!==null&&(Hv(()=>{o.ac.abort(Ov)}),o.ac=null);try{o.f|=um;var f=o.fn,g=f();o.f|=G0;var p=o.deps,C=tn==null?void 0:tn.is_fork;if($o!==null){var b;if(C||wg(o,nr),p!==null&&nr>0)for(p.length=nr+$o.length,b=0;b<$o.length;b++)p[nr+b]=$o[b];else o.deps=p=$o;if(Nw()&&(o.f&Or)!==0)for(b=nr;b<p.length;b++)((E=p[b]).reactions??(E.reactions=[])).push(o)}else!C&&p!==null&&nr<p.length&&(wg(o,nr),p.length=nr);if(wk()&&kr!==null&&!ca&&p!==null&&(o.f&(ho|Ja|io))===0)for(b=0;b<kr.length;b++)e6(kr[b],o);if(n!==null&&n!==o){if(hd++,n.deps!==null)for(let y=0;y<t;y+=1)n.deps[y].rv=hd;if(e!==null)for(const y of e)y.rv=hd;kr!==null&&(i===null?i=kr:i.push(...kr))}return(o.f&xc)!==0&&(o.f^=xc),g}catch(y){return Dk(y)}finally{o.f^=um,$o=e,nr=t,kr=i,Ln=n,Za=s,w0(r),ca=a,kd=d}}function OI(o,e){let t=e.reactions;if(t!==null){var i=C7.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&ho)!==0&&($o===null||!cm.call($o,e))){var s=e;(s.f&Or)!==0&&(s.f^=Or,s.f&=~bu),s.v!==Xs&&Lw(s),SI(s),wg(s,0)}}function wg(o,e){var t=o.deps;if(t!==null)for(var i=e;i<t.length;i++)OI(o,t[i])}function D0(o){var e=o.f;if((e&Hr)===0){Ps(o,Qs);var t=Pn,i=Rx;Pn=o,Rx=!0;try{(e&(la|_k))!==0?RI(o):zw(o),qk(o);var n=t6(o);o.teardown=typeof n=="function"?n:null,o.wv=Qk;var s;pk&&rI&&(o.f&io)!==0&&o.deps}finally{Rx=i,Pn=t}}}async function fd(){await Promise.resolve(),hI()}function c(o){var e=o.f,t=(e&ho)!==0;if(Ln!==null&&!ca){var i=Pn!==null&&(Pn.f&Hr)!==0;if(!i&&(Za===null||!Za.has(o))){var n=Ln.deps;if((Ln.f&um)!==0)o.rv<hd&&(o.rv=hd,$o===null&&n!==null&&n[nr]===o?nr++:$o===null?$o=[o]:$o.push(o));else{Ln.deps??(Ln.deps=[]),cm.call(Ln.deps,o)||Ln.deps.push(o);var s=o.reactions;s===null?o.reactions=[Ln]:cm.call(s,Ln)||s.push(Ln)}}}if(Il&&Sd.has(o))return Sd.get(o);if(t){var r=o;if(Il){var a=r.v;return((r.f&Qs)===0&&r.reactions!==null||n6(r))&&(a=Mw(r)),Sd.set(r,a),a}var d=(r.f&Or)===0&&!ca&&Ln!==null&&(Rx||(Ln.f&Or)!==0),u=(r.f&G0)===0;Sp(r)&&(d&&(r.f|=Or),Mk(r)),d&&!u&&(Rk(r),i6(r))}if(ro!=null&&ro.has(o))return ro.get(o);if((o.f&xc)!==0)throw o.v;return o.v}function i6(o){if(o.f|=Or,o.deps!==null)for(const e of o.deps)(e.reactions??(e.reactions=[])).push(o),(e.f&ho)!==0&&(e.f&Or)===0&&(Rk(e),i6(e))}function n6(o){if(o.v===Xs)return!0;if(o.deps===null)return!1;for(const e of o.deps)if(Sd.has(e)||(e.f&ho)!==0&&n6(e))return!0;return!1}function jl(o){var e=ca;try{return ca=!0,o()}finally{ca=e}}const HI=["touchstart","touchmove"];function WI(o){return HI.includes(o)}const gd=Symbol("events"),s6=new Set,QC=new Set;function zI(o,e,t,i={}){function n(s){if(i.capture||JC.call(e,s),!s.cancelBubble)return Hv(()=>t==null?void 0:t.call(this,s))}return o.startsWith("pointer")||o.startsWith("touch")||o==="wheel"?mc(()=>{e.addEventListener(o,n,i)}):e.addEventListener(o,n,i),n}function ls(o,e,t,i,n){var s={capture:i,passive:n},r=zI(o,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Ow(()=>{e.removeEventListener(o,r,s)})}function $(o,e,t){(e[gd]??(e[gd]={}))[o]=t}function Us(o){for(var e=0;e<o.length;e++)s6.add(o[e]);for(var t of QC)t(o)}let e8=null;function JC(o){var E,y;var e=this,t=e.ownerDocument,i=o.type,n=((E=o.composedPath)==null?void 0:E.call(o))||[],s=n[0]||o.target;e8=o;var r=0,a=e8===o&&o[gd];if(a){var d=n.indexOf(a);if(d!==-1&&(e===document||e===window)){o[gd]=e;return}var u=n.indexOf(e);if(u===-1)return;d<=u&&(r=d)}if(s=n[r]||o.target,s!==e){E7(o,"currentTarget",{configurable:!0,get(){return s||t}});var f=Ln,g=Pn;Vr(null),el(null);try{for(var p,C=[];s!==null&&s!==e;){try{var b=(y=s[gd])==null?void 0:y[i];b!=null&&(!s.disabled||o.target===s)&&b.call(s,o)}catch(D){p?C.push(D):p=D}if(o.cancelBubble)break;r++,s=r<n.length?n[r]:null}if(p){for(let D of C)queueMicrotask(()=>{throw D});throw p}}finally{o[gd]=e,delete o.currentTarget,Vr(f),el(g)}}}var OA;const Mb=((OA=globalThis==null?void 0:globalThis.window)==null?void 0:OA.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:o=>o});function VI(o){return(Mb==null?void 0:Mb.createHTML(o))??o}function o6(o){var e=$k("template");return e.innerHTML=VI(o.replaceAll("<!>","<!---->")),e.content}function yu(o,e){var t=Pn;t.nodes===null&&(t.nodes={start:o,end:e,a:null,t:null})}function F(o,e){var t=(e&Q7)!==0,i=(e&J7)!==0,n,s=!o.startsWith("<!>");return()=>{n===void 0&&(n=o6(s?o:"<!>"+o),t||(n=$a(n)));var r=i||Wk?document.importNode(n,!0):n.cloneNode(!0);if(t){var a=$a(r),d=r.lastChild;yu(a,d)}else yu(r,r);return r}}function jI(o,e,t="svg"){var i=!o.startsWith("<!>"),n=`<${t}>${i?o:"<!>"+o}</${t}>`,s;return()=>{if(!s){var r=o6(n),a=$a(r);s=$a(a)}var d=s.cloneNode(!0);return yu(d,d),d}}function r6(o,e){return jI(o,e,"svg")}function _o(o=""){{var e=wl(o+"");return yu(e,e),e}}function Ts(){var o=document.createDocumentFragment(),e=document.createComment(""),t=wl();return o.append(e,t),yu(e,t),o}function A(o,e){o!==null&&o.before(e)}function W(o,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(o[kf]??(o[kf]=o.nodeValue))&&(o[kf]=t,o.nodeValue=`${t}`)}function $I(o,e){return UI(o,e)}const Yp=new Map;function UI(o,{target:e,anchor:t,props:i={},events:n,context:s,intro:r=!0,transformError:a}){BI();var d=void 0,u=TI(()=>{var f=t??e.appendChild(wl());xI(f,{pending:()=>{}},C=>{Os({});var b=uo;s&&(b.c=s),n&&(i.$$events=n),d=o(C,i)||{},Hs()},a);var g=new Set,p=C=>{for(var b=0;b<C.length;b++){var E=C[b];if(!g.has(E)){g.add(E);var y=WI(E);for(const M of[e,document]){var D=Yp.get(M);D===void 0&&(D=new Map,Yp.set(M,D));var I=D.get(E);I===void 0?(M.addEventListener(E,JC,{passive:y}),D.set(E,1)):D.set(E,I+1)}}}};return p(Mv(s6)),QC.add(p),()=>{var y;for(var C of g)for(const D of[e,document]){var b=Yp.get(D),E=b.get(C);--E==0?(D.removeEventListener(C,JC),b.delete(C),b.size===0&&Yp.delete(D)):b.set(C,E)}QC.delete(p),f!==t&&((y=f.parentNode)==null||y.removeChild(f))}});return qI.set(d,u),d}let qI=new WeakMap;var Jr,Ra,rr,bd,sp,op,w_;class GI{constructor(e,t=!0){bn(this,"anchor");gn(this,Jr,new Map);gn(this,Ra,new Map);gn(this,rr,new Map);gn(this,bd,new Set);gn(this,sp,!0);gn(this,op,e=>{if(Ce(this,Jr).has(e)){var t=Ce(this,Jr).get(e),i=Ce(this,Ra).get(t);if(i)gm(i),Ce(this,bd).delete(t);else{var n=Ce(this,rr).get(t);n&&(gm(n.effect),Ce(this,Ra).set(t,n.effect),Ce(this,rr).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,r]of Ce(this,Jr)){if(Ce(this,Jr).delete(s),s===e)break;const a=Ce(this,rr).get(r);a&&(Yo(a.effect),Ce(this,rr).delete(r))}for(const[s,r]of Ce(this,Ra)){if(s===t||Ce(this,bd).has(s))continue;const a=()=>{if(Array.from(Ce(this,Jr).values()).includes(s)){var u=document.createDocumentFragment();Vw(r,u),u.append(wl()),Ce(this,rr).set(s,{effect:r,fragment:u})}else Yo(r);Ce(this,bd).delete(s),Ce(this,Ra).delete(s)};Ce(this,sp)||!i?(Ce(this,bd).add(s),Ad(r,a,!1)):a()}}});gn(this,w_,e=>{Ce(this,Jr).delete(e);const t=Array.from(Ce(this,Jr).values());for(const[i,n]of Ce(this,rr))t.includes(i)||(Yo(n.effect),Ce(this,rr).delete(i))});this.anchor=e,pn(this,sp,t)}ensure(e,t){var i=tn,n=jk();if(t&&!Ce(this,Ra).has(e)&&!Ce(this,rr).has(e))if(n){var s=document.createDocumentFragment(),r=wl();s.append(r),Ce(this,rr).set(e,{effect:Ir(()=>t(r)),fragment:s})}else Ce(this,Ra).set(e,Ir(()=>t(this.anchor)));if(Ce(this,Jr).set(i,e),n){for(const[a,d]of Ce(this,Ra))a===e?i.unskip_effect(d):i.skip_effect(d);for(const[a,d]of Ce(this,rr))a===e?i.unskip_effect(d.effect):i.skip_effect(d.effect);i.oncommit(Ce(this,op)),i.ondiscard(Ce(this,w_))}else Ce(this,op).call(this,i)}}Jr=new WeakMap,Ra=new WeakMap,rr=new WeakMap,bd=new WeakMap,sp=new WeakMap,op=new WeakMap,w_=new WeakMap;function z(o,e,t=!1){var i=new GI(o),n=t?y0:0;function s(r,a){i.ensure(r,a)}Ww(()=>{var r=!1;e((a,d=0)=>{r=!0,s(d,a)}),r||s(-1,null)},n)}function Vi(o,e){return e}function KI(o,e,t){for(var i=[],n=e.length,s,r=e.length,a=0;a<n;a++){let g=e[a];Ad(g,()=>{if(s){if(s.pending.delete(g),s.done.add(g),s.pending.size===0){var p=o.outrogroups;e1(o,Mv(s.done)),p.delete(s),p.size===0&&(o.outrogroups=null)}}else r-=1},!1)}if(r===0){var d=i.length===0&&t!==null;if(d){var u=t,f=u.parentNode;FI(f),f.append(u),o.items.clear()}e1(o,e,!d)}else s={pending:new Set(e),done:new Set},(o.outrogroups??(o.outrogroups=new Set)).add(s)}function e1(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|=ja;const r=document.createDocumentFragment();Vw(s,r)}else Yo(e[n],t)}}var t8;function si(o,e,t,i,n,s=null){var r=o,a=new Map,d=(e&bk)!==0;if(d){var u=o;r=u.appendChild(wl())}var f=null,g=Tw(()=>{var M=t();return Fw(M)?M:M==null?[]:Mv(M)}),p,C=new Map,b=!0;function E(M){(I.effect.f&Hr)===0&&(I.pending.delete(M),I.fallback=f,ZI(I,p,r,e,i),f!==null&&(p.length===0?(f.f&ja)===0?gm(f):(f.f^=ja,Lf(f,null,r)):Ad(f,()=>{f=null})))}function y(M){I.pending.delete(M)}var D=Ww(()=>{p=c(g);for(var M=p.length,R=new Set,T=tn,V=jk(),O=0;O<M;O+=1){var Q=p[O],ie=i(Q,O),de=b?null:a.get(ie);de?(de.v&&S0(de.v,Q),de.i&&S0(de.i,O),V&&T.unskip_effect(de.e)):(de=XI(a,b?r:t8??(t8=wl()),Q,ie,O,n,e,t),b||(de.e.f|=ja),a.set(ie,de)),R.add(ie)}if(M===0&&s&&!f&&(b?f=Ir(()=>s(r)):(f=Ir(()=>s(t8??(t8=wl()))),f.f|=ja)),M>R.size&&T7(),!b)if(C.set(T,R),V){for(const[te,le]of a)R.has(te)||T.skip_effect(le.e);T.oncommit(E),T.ondiscard(y)}else E(T);c(g)}),I={effect:D,items:a,pending:C,outrogroups:null,fallback:f};b=!1}function _f(o){for(;o!==null&&(o.f&ua)===0;)o=o.next;return o}function ZI(o,e,t,i,n){var de,te,le,we,oe,ye,Re,ke,_e;var s=(i&q7)!==0,r=e.length,a=o.items,d=_f(o.effect.first),u,f=null,g,p=[],C=[],b,E,y,D;if(s)for(D=0;D<r;D+=1)b=e[D],E=n(b,D),y=a.get(E).e,(y.f&ja)===0&&((te=(de=y.nodes)==null?void 0:de.a)==null||te.measure(),(g??(g=new Set)).add(y));for(D=0;D<r;D+=1){if(b=e[D],E=n(b,D),y=a.get(E).e,o.outrogroups!==null)for(const lt of o.outrogroups)lt.pending.delete(y),lt.done.delete(y);if((y.f&Io)!==0&&(gm(y),s&&((we=(le=y.nodes)==null?void 0:le.a)==null||we.unfix(),(g??(g=new Set)).delete(y))),(y.f&ja)!==0)if(y.f^=ja,y===d)Lf(y,null,t);else{var I=f?f.next:d;y===o.effect.last&&(o.effect.last=y.prev),y.prev&&(y.prev.next=y.next),y.next&&(y.next.prev=y.prev),Gl(o,f,y),Gl(o,y,I),Lf(y,I,t),f=y,p=[],C=[],d=_f(f.next);continue}if(y!==d){if(u!==void 0&&u.has(y)){if(p.length<C.length){var M=C[0],R;f=M.prev;var T=p[0],V=p[p.length-1];for(R=0;R<p.length;R+=1)Lf(p[R],M,t);for(R=0;R<C.length;R+=1)u.delete(C[R]);Gl(o,T.prev,V.next),Gl(o,f,T),Gl(o,V,M),d=M,f=V,D-=1,p=[],C=[]}else u.delete(y),Lf(y,d,t),Gl(o,y.prev,y.next),Gl(o,y,f===null?o.effect.first:f.next),Gl(o,f,y),f=y;continue}for(p=[],C=[];d!==null&&d!==y;)(u??(u=new Set)).add(d),C.push(d),d=_f(d.next);if(d===null)continue}(y.f&ja)===0&&p.push(y),f=y,d=_f(y.next)}if(o.outrogroups!==null){for(const lt of o.outrogroups)lt.pending.size===0&&(e1(o,Mv(lt.done)),(oe=o.outrogroups)==null||oe.delete(lt));o.outrogroups.size===0&&(o.outrogroups=null)}if(d!==null||u!==void 0){var O=[];if(u!==void 0)for(y of u)(y.f&Io)===0&&O.push(y);for(;d!==null;)(d.f&Io)===0&&d!==o.fallback&&O.push(d),d=_f(d.next);var Q=O.length;if(Q>0){var ie=(i&bk)!==0&&r===0?t:null;if(s){for(D=0;D<Q;D+=1)(Re=(ye=O[D].nodes)==null?void 0:ye.a)==null||Re.measure();for(D=0;D<Q;D+=1)(_e=(ke=O[D].nodes)==null?void 0:ke.a)==null||_e.fix()}KI(o,O,ie)}}s&&mc(()=>{var lt,Te;if(g!==void 0)for(y of g)(Te=(lt=y.nodes)==null?void 0:lt.a)==null||Te.apply()})}function XI(o,e,t,i,n,s,r,a){var d=(r&$7)!==0?(r&G7)===0?DI(t,!1,!1):Eu(t):null,u=(r&U7)!==0?Eu(n):null;return{v:d,i:u,e:Ir(()=>(s(e,d??t,u??n,a),()=>{o.delete(i)}))}}function Lf(o,e,t){if(o.nodes)for(var i=o.nodes.start,n=o.nodes.end,s=e&&(e.f&ja)===0?e.nodes.start:t;i!==null;){var r=wp(i);if(s.before(i),i===n)return;i=r}}function Gl(o,e,t){e===null?o.effect.first=t:e.next=t,t===null?o.effect.last=e:t.prev=e}function dc(o,e,t=!1,i=!1,n=!1,s=!1){var r=o,a="";if(t)var d=o;j(()=>{var u=Pn;if(a!==(a=e()??"")){if(t){u.nodes=null,d.innerHTML=a,a!==""&&yu($a(d),d.lastChild);return}if(u.nodes!==null&&(Gk(u.nodes.start,u.nodes.end),u.nodes=null),a!==""){var f=i?eI:n?tI:void 0,g=$k(i?"svg":n?"math":"template",f);g.innerHTML=a;var p=i||n?g:g.content;if(yu($a(p),p.lastChild),i||n)for(;$a(p);)r.before($a(p));else r.before(p)}}})}function a6(o){var e,t,i="";if(typeof o=="string"||typeof o=="number")i+=o;else if(typeof o=="object")if(Array.isArray(o)){var n=o.length;for(e=0;e<n;e++)o[e]&&(t=a6(o[e]))&&(i&&(i+=" "),i+=t)}else for(t in o)o[t]&&(i&&(i+=" "),i+=t);return i}function YI(){for(var o,e,t=0,i="",n=arguments.length;t<n;t++)(o=arguments[t])&&(e=a6(o))&&(i&&(i+=" "),i+=e);return i}function Xf(o){return typeof o=="object"?YI(o):o??""}const i8=[...`
3
+ \r\f \v\uFEFF`];function QI(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||i8.includes(i[r-1]))&&(a===i.length||i8.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function n8(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 Rb(o){return o[0]!=="-"||o[1]!=="-"?o.toLowerCase():o}function JI(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,d=[];i&&d.push(...Object.keys(i).map(Rb)),n&&d.push(...Object.keys(n).map(Rb));var u=0,f=-1;const E=o.length;for(var g=0;g<E;g++){var p=o[g];if(a?p==="/"&&o[g-1]==="*"&&(a=!1):s?s===p&&(s=!1):p==="/"&&o[g+1]==="*"?a=!0:p==='"'||p==="'"?s=p:p==="("?r++:p===")"&&r--,!a&&s===!1&&r===0){if(p===":"&&f===-1)f=g;else if(p===";"||g===E-1){if(f!==-1){var C=Rb(o.substring(u,f).trim());if(!d.includes(C)){p!==";"&&g++;var b=o.substring(u,g).trim();t+=" "+b+";"}}u=g+1,f=-1}}}}return i&&(t+=n8(i)),n&&(t+=n8(n,!0)),t=t.trim(),t===""?null:t}return o==null?null:String(o)}function kt(o,e,t,i,n,s){var r=o[$C];if(r!==t||r===void 0){var a=QI(t,i,s);a==null?o.removeAttribute("class"):e?o.className=a:o.setAttribute("class",a),o[$C]=t}else if(s&&n!==s)for(var d in s){var u=!!s[d];(n==null||u!==!!n[d])&&o.classList.toggle(d,u)}return s}function Nb(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 qo(o,e,t,i){var n=o[UC];if(n!==e){var s=JI(e,i);s==null?o.removeAttribute("style"):o.style.cssText=s,o[UC]=e}else i&&(Array.isArray(i)?(Nb(o,t==null?void 0:t[0],i[0]),Nb(o,t==null?void 0:t[1],i[1],"important")):Nb(o,t,i));return i}function pm(o,e,t=!1){if(o.multiple){if(e==null)return;if(!Fw(e))return nI();for(var i of o.options)i.selected=e.includes(Yf(i));return}for(i of o.options){var n=Yf(i);if(kI(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(o.selectedIndex=-1)}function t1(o){var e=new MutationObserver(()=>{pm(o,o.__value)});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Ow(()=>{e.disconnect()})}function Ss(o,e,t=e){var i=new WeakSet,n=!0;Rw(o,"change",s=>{var r=s?"[selected]":":checked",a;if(o.multiple)a=[].map.call(o.querySelectorAll(r),Yf);else{var d=o.querySelector(r)??o.querySelector("option:not([disabled])");a=d&&Yf(d)}t(a),o.__value=a,tn!==null&&i.add(tn)}),Hw(()=>{var s=e();if(o===document.activeElement){var r=tn;if(i.has(r))return}if(pm(o,s,n),n&&s===void 0){var a=o.querySelector(":checked");a!==null&&(s=Yf(a),t(s))}o.__value=s,n=!1}),t1(o)}function Yf(o){return"__value"in o?o.__value:o.value}const eP=Symbol("is custom element"),tP=Symbol("is html"),iP=I7?"progress":"PROGRESS";function i1(o,e){var t=jw(o);t.value===(t.value=e??void 0)||o.value===e&&(e!==0||o.nodeName!==iP)||(o.value=e??"")}function da(o,e){var t=jw(o);t.checked!==(t.checked=e??void 0)&&(o.checked=e)}function ln(o,e,t,i){var n=jw(o);n[e]!==(n[e]=t)&&(e==="loading"&&(o[L7]=t),t==null?o.removeAttribute(e):typeof t!="string"&&nP(o).includes(e)?o[e]=t:o.setAttribute(e,t))}function jw(o){return o[Lx]??(o[Lx]={[eP]:o.nodeName.includes("-"),[tP]:o.namespaceURI===Ck})}var s8=new Map;function nP(o){var e=o.getAttribute("is")||o.nodeName,t=s8.get(e);if(t)return t;s8.set(e,t=[]);for(var i,n=o,s=Element.prototype;s!==n;){i=y7(n);for(var r in i)i[r].set&&r!=="innerHTML"&&r!=="textContent"&&r!=="innerText"&&t.push(r);n=xk(n)}return t}function jt(o,e,t=e){var i=new WeakSet;Rw(o,"input",async n=>{var s=n?o.defaultValue:o.value;if(s=Ob(o)?Hb(s):s,t(s),tn!==null&&i.add(tn),await fd(),s!==(s=e())){var r=o.selectionStart,a=o.selectionEnd,d=o.value.length;if(o.value=s??"",a!==null){var u=o.value.length;r===a&&a===d&&u>d?(o.selectionStart=u,o.selectionEnd=u):(o.selectionStart=r,o.selectionEnd=Math.min(a,u))}}}),jl(e)==null&&o.value&&(t(Ob(o)?Hb(o.value):o.value),tn!==null&&i.add(tn)),Wv(()=>{var n=e();if(o===document.activeElement){var s=tn;if(i.has(s))return}Ob(o)&&n===Hb(o.value)||o.type==="date"&&!n&&!o.value||n!==o.value&&(o.value=n??"")})}function Cs(o,e,t=e){Rw(o,"change",i=>{var n=i?o.defaultChecked:o.checked;t(n)}),jl(e)==null&&t(o.checked),Wv(()=>{var i=e();o.checked=!!i})}function Ob(o){var e=o.type;return e==="number"||e==="range"}function Hb(o){return o===""?null:+o}var ac,t0,rp,S_,l6;const D_=class D_{constructor(e){gn(this,S_);gn(this,ac,new WeakMap);gn(this,t0);gn(this,rp);pn(this,rp,e)}observe(e,t){var i=Ce(this,ac).get(e)||new Set;return i.add(t),Ce(this,ac).set(e,i),Kn(this,S_,l6).call(this).observe(e,Ce(this,rp)),()=>{var n=Ce(this,ac).get(e);n.delete(t),n.size===0&&(Ce(this,ac).delete(e),Ce(this,t0).unobserve(e))}}};ac=new WeakMap,t0=new WeakMap,rp=new WeakMap,S_=new WeakSet,l6=function(){return Ce(this,t0)??pn(this,t0,new ResizeObserver(e=>{for(var t of e){D_.entries.set(t.target,t);for(var i of Ce(this,ac).get(t.target)||[])i(t)}}))},bn(D_,"entries",new WeakMap);let n1=D_;var sP=new n1({box:"border-box"});function oP(o,e,t){var i=sP.observe(o,()=>t(o[e]));Hw(()=>(jl(()=>t(o[e])),i))}function Wb(o,e){return o===e||(o==null?void 0:o[wd])===e}function cs(o={},e,t,i){var n=uo.r,s=Pn;return Hw(()=>{var r,a;return Wv(()=>{r=a,a=[],jl(()=>{Wb(t(...a),o)||(e(o,...a),r&&Wb(t(...r),o)&&e(null,...r))})}),()=>{let d=s;for(;d!==n&&d.parent!==null&&d.parent.f&jC;)d=d.parent;const u=()=>{a&&Wb(t(...a),o)&&e(null,...a)},f=d.teardown;d.teardown=()=>{u(),f==null||f()}}}),o}function wu(o,e,t,i){var R;var n=!0,s=(t&X7)!==0,r=(t&Y7)!==0,a=i,d=!0,u=void 0,f=()=>r&&n?(u??(u=yg(i)),c(u)):(d&&(d=!1,a=r?jl(i):i),a);let g;if(s){var p=wd in o||F7 in o;g=((R=jh(o,e))==null?void 0:R.set)??(p&&e in o?T=>o[e]=T:void 0)}var C,b=!1;s?[C,b]=cI(()=>o[e]):C=o[e],C===void 0&&i!==void 0&&(C=f(),g&&(H7(),g(C)));var E;if(E=()=>{var T=o[e];return T===void 0?f():(d=!0,T)},(t&Z7)===0)return E;if(g){var y=o.$$legacy;return(function(T,V){return arguments.length>0?((!V||y||b)&&g(V?E():T),T):E()})}var D=!1,I=((t&K7)!==0?yg:Tw)(()=>(D=!1,E()));s&&c(I);var M=Pn;return(function(T,V){if(arguments.length>0){const O=V?c(I):s?Di(T):T;return m(I,O),D=!0,a!==void 0&&(a=O),T}return Il&&D||(M.f&Hr)!==0?I.v:c(I)})}function $s(o){uo===null&&vk(),zn(()=>{const e=jl(o);if(typeof e=="function")return e})}function Dp(o){uo===null&&vk(),$s(()=>()=>jl(o))}const rP="5";var HA;typeof window<"u"&&((HA=window.__svelte??(window.__svelte={})).v??(HA.v=new Set)).add(rP);/*!-----------------------------------------------------------------------------
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 aP=Object.defineProperty,lP=Object.getOwnPropertyDescriptor,cP=Object.getOwnPropertyNames,dP=Object.prototype.hasOwnProperty,uP=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of cP(e))!dP.call(o,n)&&n!==t&&aP(o,n,{get:()=>e[n],enumerable:!(i=lP(e,n))||i.enumerable});return o},hP=(o,e,t)=>(uP(o,e,"default"),t),Ap={};hP(Ap,zA);var fP=class{constructor(e,t,i){this._onDidChange=new Ap.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)}},gP={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},pP={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},c6=new fP("json",gP,pP),xP=()=>d6().then(o=>o.getWorker());Ap.languages.json={jsonDefaults:c6,getWorker:xP};function d6(){return WA(()=>import("./jsonMode-CXWNuhmR.js"),__vite__mapDeps([0,1,2]))}Ap.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});Ap.languages.onLanguage("json",()=>{d6().then(o=>o.setupMode(c6))});/*!-----------------------------------------------------------------------------
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 mP=Object.defineProperty,_P=Object.getOwnPropertyDescriptor,vP=Object.getOwnPropertyNames,bP=Object.prototype.hasOwnProperty,CP=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of vP(e))!bP.call(o,n)&&n!==t&&mP(o,n,{get:()=>e[n],enumerable:!(i=_P(e,n))||i.enumerable});return o},EP=(o,e,t)=>(CP(o,e,"default"),t),yP="5.4.5",A0={};EP(A0,zA);var u6=(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))(u6||{}),h6=(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))(h6||{}),f6=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(f6||{}),g6=(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))(g6||{}),p6=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(p6||{}),x6=class{constructor(o,e,t,i,n){this._onDidChange=new A0.Emitter,this._onDidExtraLibsChange=new A0.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)}},wP=yP,m6={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},_6=new x6({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},m6),v6=new x6({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},m6),SP=()=>zv().then(o=>o.getTypeScriptWorker()),DP=()=>zv().then(o=>o.getJavaScriptWorker());A0.languages.typescript={ModuleKind:u6,JsxEmit:h6,NewLineKind:f6,ScriptTarget:g6,ModuleResolutionKind:p6,typescriptVersion:wP,typescriptDefaults:_6,javascriptDefaults:v6,getTypeScriptWorker:SP,getJavaScriptWorker:DP};function zv(){return WA(()=>import("./tsMode-CKR1khFZ.js"),__vite__mapDeps([3,1,2]))}A0.languages.onLanguage("typescript",()=>zv().then(o=>o.setupTypeScript(_6)));A0.languages.onLanguage("javascript",()=>zv().then(o=>o.setupJavaScript(v6)));class AP extends yo{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:ui("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Ui.map,toggled:$e.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:$e.has("isInDiffEditor"),menu:{when:$e.has("isInDiffEditor"),id:Yt.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(Yn),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class b6 extends yo{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:ui("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:$e.has("isInDiffEditor")})}run(e,...t){const i=e.get(Yn),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class C6 extends yo{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:ui("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:$e.has("isInDiffEditor")})}run(e,...t){const i=e.get(Yn),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const kp=ui("diffEditor","Diff Editor");class kP extends ha{constructor(){super({id:"diffEditor.switchSide",title:ui("switchSide","Switch Side"),icon:Ui.arrowSwap,precondition:$e.has("isInDiffEditor"),f1:!0,category:kp})}runEditorCommand(e,t,i){const n=Z0(e);if(n instanceof ap){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class BP extends ha{constructor(){super({id:"diffEditor.exitCompareMove",title:ui("exitCompareMove","Exit Compare Move"),icon:Ui.close,precondition:U.comparingMovedCode,f1:!1,category:kp,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=Z0(e);n instanceof ap&&n.exitCompareMove()}}class FP extends ha{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:ui("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Ui.fold,precondition:$e.has("isInDiffEditor"),f1:!0,category:kp})}runEditorCommand(e,t,...i){const n=Z0(e);n instanceof ap&&n.collapseAllUnchangedRegions()}}class LP extends ha{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:ui("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Ui.unfold,precondition:$e.has("isInDiffEditor"),f1:!0,category:kp})}runEditorCommand(e,t,...i){const n=Z0(e);n instanceof ap&&n.showAllUnchangedRegions()}}class s1 extends yo{constructor(){super({id:"diffEditor.revert",title:ui("revert","Revert"),f1:!1,category:kp})}run(e,t){const i=IP(e,t.originalUri,t.modifiedUri);i instanceof ap&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const E6=ui("accessibleDiffViewer","Accessible Diff Viewer"),A_=class A_ extends yo{constructor(){super({id:A_.id,title:ui("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:E6,precondition:$e.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=Z0(e);t==null||t.accessibleDiffViewerNext()}};A_.id="editor.action.accessibleDiffViewer.next";let Sg=A_;const k_=class k_ extends yo{constructor(){super({id:k_.id,title:ui("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:E6,precondition:$e.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=Z0(e);t==null||t.accessibleDiffViewerPrev()}};k_.id="editor.action.accessibleDiffViewer.prev";let xm=k_;function IP(o,e,t){return o.get(fs).listDiffEditors().find(s=>{var d,u;const r=s.getModifiedEditor(),a=s.getOriginalEditor();return r&&((d=r.getModel())==null?void 0:d.uri.toString())===t.toString()&&a&&((u=a.getModel())==null?void 0:u.uri.toString())===e.toString()})||null}function Z0(o){const t=o.get(fs).listDiffEditors(),i=VA();if(i)for(const n of t){const s=n.getContainerDomNode();if(PP(s,i))return n}return null}function PP(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}Tn(AP);Tn(b6);Tn(C6);Wr.appendMenuItem(Yt.EditorTitle,{command:{id:new C6().desc.id,title:S("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:$e.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:$e.has("isInDiffEditor")},order:11,group:"1_diff",when:$e.and(U.diffEditorRenderSideBySideInlineBreakpointReached,$e.has("isInDiffEditor"))});Wr.appendMenuItem(Yt.EditorTitle,{command:{id:new b6().desc.id,title:S("showMoves","Show Moved Code Blocks"),icon:Ui.move,toggled:VF.create("config.diffEditor.experimental.showMoves",!0),precondition:$e.has("isInDiffEditor")},order:10,group:"1_diff",when:$e.has("isInDiffEditor")});Tn(s1);for(const o of[{icon:Ui.arrowRight,key:U.diffEditorInlineMode.toNegated()},{icon:Ui.discard,key:U.diffEditorInlineMode}])Wr.appendMenuItem(Yt.DiffEditorHunkToolbar,{command:{id:new s1().desc.id,title:S("revertHunk","Revert Block"),icon:o.icon},when:$e.and(U.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),Wr.appendMenuItem(Yt.DiffEditorSelectionToolbar,{command:{id:new s1().desc.id,title:S("revertSelection","Revert Selection"),icon:o.icon},when:$e.and(U.diffEditorModifiedWritable,o.key),order:5,group:"primary"});Tn(kP);Tn(BP);Tn(FP);Tn(LP);Wr.appendMenuItem(Yt.EditorTitle,{command:{id:Sg.id,title:S("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:$e.has("isInDiffEditor")},order:10,group:"2_diff",when:$e.and(U.accessibleDiffViewerVisible.negate(),$e.has("isInDiffEditor"))});Un.registerCommandAlias("editor.action.diffReview.next",Sg.id);Tn(Sg);Un.registerCommandAlias("editor.action.diffReview.prev",xm.id);Tn(xm);var TP=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},MP=function(o,e){return function(t,i){e(t,i,o)}},o1;const Vv=new xn("selectionAnchorSet",!1);var Id;let Hc=(Id=class{static get(e){return e.getContribution(o1.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=Vv.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(Hi.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new oo().appendText(S("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),zr(S("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(Hi.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()}},o1=Id,Id.ID="editor.contrib.selectionAnchorController",Id);Hc=o1=TP([MP(1,En)],Hc);class RP extends gt{constructor(){super({id:"editor.action.setSelectionAnchor",label:S("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2080),weight:100}})}async run(e,t){var i;(i=Hc.get(t))==null||i.setSelectionAnchor()}}class NP extends gt{constructor(){super({id:"editor.action.goToSelectionAnchor",label:S("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:Vv})}async run(e,t){var i;(i=Hc.get(t))==null||i.goToSelectionAnchor()}}class OP extends gt{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:S("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:Vv,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2089),weight:100}})}async run(e,t){var i;(i=Hc.get(t))==null||i.selectFromAnchorToCursor()}}class HP extends gt{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:S("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:Vv,kbOpts:{kbExpr:U.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=Hc.get(t))==null||i.cancelSelectionAnchor()}}on(Hc.ID,Hc,4);Ae(RP);Ae(NP);Ae(OP);Ae(HP);const WP=ci("editorOverviewRuler.bracketMatchForeground","#A0A0A0",S("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class zP extends gt{constructor(){super({id:"editor.action.jumpToBracket",label:S("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=Su.get(t))==null||i.jumpToBracket()}}class VP extends gt{constructor(){super({id:"editor.action.selectToBracket",label:S("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:ui("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=Su.get(t))==null||s.selectToBracket(n)}}class jP extends gt{constructor(){super({id:"editor.action.removeBrackets",label:S("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=Su.get(t))==null||i.removeBrackets(this.id)}}class $P{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const ec=class ec extends Pt{static get(e){return e.getContribution(ec.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new As(()=>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 d=e.bracketPairs.findNextBracket(n);d&&d.range&&(r=d.range.getStartPosition())}}return r?new Hi(r.lineNumber,r.column,r.lineNumber,r.column):new Hi(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 u=t.bracketPairs.findNextBracket(s);u&&u.range&&(r=t.bracketPairs.matchBracket(u.range.getStartPosition()))}let a=null,d=null;if(r){r.sort(ee.compareRangesUsingStarts);const[u,f]=r;if(a=e?u.getStartPosition():u.getEndPosition(),d=e?f.getEndPosition():f.getStartPosition(),f.containsPosition(s)){const g=a;a=d,d=g}}a&&d&&i.push(new Hi(a.lineNumber,a.column,d.lineNumber,d.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 g=0,p=e.length;g<p;g++){const C=e[g];C.isEmpty()&&(s[r++]=C.getStartPosition())}s.length>1&&s.sort(pi.compare);const a=[];let d=0,u=0;const f=n.length;for(let g=0,p=s.length;g<p;g++){const C=s[g];for(;u<f&&n[u].position.isBefore(C);)u++;if(u<f&&n[u].position.equals(C))a[d++]=n[u];else{let b=t.bracketPairs.matchBracket(C,20),E=ec._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!b&&this._matchBrackets==="always"&&(b=t.bracketPairs.findEnclosingBrackets(C,20),E=ec._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[d++]=new $P(C,b,E)}}this._lastBracketsData=a,this._lastVersionId=i}};ec.ID="editor.contrib.bracketMatchingController",ec._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=fn.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:bs(WP),position:qa.Center}}),ec._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=fn.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let Su=ec;on(Su.ID,Su,1);Ae(VP);Ae(zP);Ae(jP);Wr.appendMenuItem(Yt.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:S({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class UP{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 ee(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new ee(i,s,i,s),a)}else{const r=new ee(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new ee(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new Hi(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new Hi(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class y6 extends gt{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 UP(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class qP extends y6{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:S("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:U.writable})}}class GP extends y6{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:S("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:U.writable})}}Ae(qP);Ae(GP);class KP extends gt{constructor(){super({id:"editor.action.transposeLetters",label:S("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:U.writable,kbOpts:{kbExpr:U.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,d=r.startColumn,u=i.getLineMaxColumn(a);if(a===1&&(d===1||d===2&&u===2))continue;const f=d===u?r.getPosition():Db.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),g=Db.leftPosition(i,f),p=Db.leftPosition(i,g),C=i.getValueInRange(ee.fromPositions(p,g)),b=i.getValueInRange(ee.fromPositions(g,f)),E=ee.fromPositions(p,f);n.push(new lp(E,b+C))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}Ae(KP);const jv=(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 $w(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function ZP(o,e,t){const i={id:jv(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class w6{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 Cl.some(this,([i,n])=>n.asFile())&&t.push("files"),D6(mm(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 mm(e)}}function mm(o){return o.toLowerCase()}function S6(o,e){return D6(mm(o),e.map(mm))}function D6(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 $v=Object.freeze({create:o=>jA(o.map(e=>e.toString())).join(`\r
14
+ `),split:o=>o.split(`\r
15
+ `),parse:o=>$v.split(o).filter(e=>!e.startsWith("#"))}),La=class La{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+La.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new La((this.value?[this.value,...e]:e).join(La.sep))}};La.sep=".",La.None=new La("@@none@@"),La.Empty=new La("");let Xn=La;const o8={EDITORS:"CodeEditors",FILES:"CodeFiles"};class XP{}const YP={DragAndDropContribution:"workbench.contributions.dragAndDrop"};fa.add(YP.DragAndDropContribution,new XP);const lg=class lg{constructor(){}static getInstance(){return lg.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};lg.INSTANCE=new lg;let r1=lg;function A6(o){const e=new w6;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,$w(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,QP(n))}}return e}function QP(o){const e=o.path?Rn.parse(o.path):void 0;return ZP(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const JP=Object.freeze([o8.EDITORS,o8.FILES,AC.RESOURCES,AC.INTERNAL_URI_LIST]);function k6(o,e=!1){const t=A6(o),i=t.get(AC.INTERNAL_URI_LIST);if(i)t.replace(js.uriList,i);else if(e||!t.has(js.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(Rn.file(a).toString()):n.push(Rn.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(js.uriList,$w($v.create(n)))}for(const n of JP)t.delete(n);return t}var Uw=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},Dg=function(o,e){return function(t,i){e(t,i,o)}};class qw{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 cg=class cg extends qw{constructor(){super(...arguments),this.kind=cg.kind,this.dropMimeTypes=[js.text],this.pasteMimeTypes=[js.text]}async getEdit(e,t){const i=e.get(js.text);if(!i||e.has(js.uriList))return;const n=await i.asString();return{handledMimeType:js.text,title:S("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};cg.id="text",cg.kind=new Xn("text.plain");let Du=cg;class B6 extends qw{constructor(){super(...arguments),this.kind=new Xn("uri.absolute"),this.dropMimeTypes=[js.uriList],this.pasteMimeTypes=[js.uriList]}async getEdit(e,t){const i=await F6(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:d})=>a.scheme===mo.file?a.fsPath:(n++,d)).join(" ");let r;return n>0?r=i.length>1?S("defaultDropProvider.uriList.uris","Insert Uris"):S("defaultDropProvider.uriList.uri","Insert Uri"):r=i.length>1?S("defaultDropProvider.uriList.paths","Insert Paths"):S("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:js.uriList,insertText:s,title:r,kind:this.kind}}}let _m=class extends qw{constructor(e){super(),this._workspaceContextService=e,this.kind=new Xn("uri.relative"),this.dropMimeTypes=[js.uriList],this.pasteMimeTypes=[js.uriList]}async getEdit(e,t){const i=await F6(e);if(!i.length||t.isCancellationRequested)return;const n=Al(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?jF(r.uri,s):void 0}));if(n.length)return{handledMimeType:js.uriList,insertText:n.join(" "),title:i.length>1?S("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):S("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};_m=Uw([Dg(0,h0)],_m);class eT{constructor(){this.kind=new Xn("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:js.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var d;if(n.triggerKind!==kC.PasteAs&&!((d=n.only)!=null&&d.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:S("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function F6(o){const e=o.get(js.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of $v.parse(t))try{i.push({uri:Rn.parse(n),originalText:n})}catch{}return i}let a1=class extends Pt{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new Du)),this._register(e.documentDropEditProvider.register("*",new B6)),this._register(e.documentDropEditProvider.register("*",new _m(t)))}};a1=Uw([Dg(0,xi),Dg(1,h0)],a1);let l1=class extends Pt{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new Du)),this._register(e.documentPasteEditProvider.register("*",new B6)),this._register(e.documentPasteEditProvider.register("*",new _m(t))),this._register(e.documentPasteEditProvider.register("*",new eT))}};l1=Uw([Dg(0,xi),Dg(1,h0)],l1);const wr=class wr{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=wr._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(wr.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(wr.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(wr.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(wr.isVariableCharacter(i)||wr.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 wr._table[i]>"u"&&!wr.isDigitCharacter(i)&&!wr.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};wr._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let c1=wr;class X0{constructor(){this._children=[]}appendChild(e){return e instanceof Lo&&this._children[this._children.length-1]instanceof Lo?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,d){for(const u of a)u.parent=d,r(u.children,u)})(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 Bp)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let Lo=class L6 extends X0{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new L6(this.value)}};class I6 extends X0{}class dr extends I6{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 Y0?this._children[0]:void 0}clone(){const e=new dr(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class Y0 extends X0{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof Lo&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new Y0;return this.options.forEach(e.appendChild,e),e}}class Gw extends X0{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 ea&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof ea){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new Gw;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 ea extends X0{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 ea(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class Ag extends I6{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 Lo(t)],!0):!1}clone(){const e=new Ag(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function r8(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class Bp extends X0{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof dr&&(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 r8([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof dr&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof Ag&&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 Bp;return this._children=this.children.map(t=>t.clone()),e}walk(e){r8(this.children,e)}}class Au{constructor(){this._scanner=new c1,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 Bp;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(d=>(d instanceof dr&&(d.isFinalTabstop?n.set(0,void 0):!n.has(d.index)&&d.children.length>0?n.set(d.index,d.children):s.push(d)),!0));const r=(d,u)=>{const f=n.get(d.index);if(!f)return;const g=new dr(d.index);g.transform=d.transform;for(const p of f){const C=p.clone();g.appendChild(C),C instanceof dr&&n.has(C.index)&&!u.has(C.index)&&(u.add(C.index),r(C,u),u.delete(C.index))}t.replace(d,[g])},a=new Set;for(const d of s)r(d,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 dr(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 Lo(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 dr(Number(t)):new Ag(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 dr(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Lo("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new Y0;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 Lo(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 Ag(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Lo("${"+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 Gw;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 Lo(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 ea(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new ea(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 ea(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new ea(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new ea(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 ea(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new ea(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new Lo(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function P6(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 $F(o,{range:s,text:typeof t.insertText=="string"?Au.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function T6(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 d of o)if(d!==r&&e(a,d)){let u=t.get(r);u||(u=[],t.set(r,u)),u.push(d)}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 d=[];const u=t.get(a);return u&&(n.push(a),d=s(u),n.pop()),i.add(a),[...d,a,...s(r.slice(1))]}return s(Array.from(o))}var tT=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},iT=function(o,e){return function(t,i){e(t,i,o)}};const nT=fn.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:$A,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),B_=class B_ extends Pt{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=li(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=li("span.icon");this.domNode.append(t),t.classList.add(...Dn.asClassNameArray(Ui.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(Cn(this.domNode,is.CLICK,n=>{this.delegate.cancel()}))}getId(){return B_.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)}};B_.baseId="editor.widget.inlineProgressWidget";let d1=B_,vm=class extends Pt{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new Qo),this._currentWidget=this._register(new Qo),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=hg(()=>{const a=ee.fromPositions(e);this._currentDecorations.set([{range:a,options:nT}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(d1,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()}};vm=tT([iT(2,Qi)],vm);var sT=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},a8=function(o,e){return function(t,i){e(t,i,o)}},Nx,vc;let Po=(vc=class{static get(e){return e.getContribution(Nx.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new Qo,this._messageListeners=new Bt,this._mouseOverMessage=!1,this._editor=e,this._visible=Nx.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){zr(Dx(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=Dx(e)?UF(e,{actionHandler:{callback:n=>{this.closeMessage(),qF(this._openerService,n,Dx(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new l8(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(Ds.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&GF(VA(),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(Cn(this._messageWidget.value.getDomNode(),is.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Cn(this._messageWidget.value.getDomNode(),is.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 ee(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(l8.fadeOut(this._messageWidget.value))}},Nx=vc,vc.ID="editor.contrib.messageController",vc.MESSAGE_VISIBLE=new xn("messageVisible",!1,S("messageVisible","Whether the editor is currently showing an inline message")),vc);Po=Nx=sT([a8(1,En),a8(2,ga)],Po);const oT=wo.bindToContribution(Po.get);yi(new oT({id:"leaveEditorMessage",precondition:Po.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let l8=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)}};on(Po.ID,Po,4);function zb(o,e){return e&&(o.stack||o.stacktrace)?S("stackTrace.format","{0}: {1}",d8(o),c8(o.stack)||c8(o.stacktrace)):d8(o)}function c8(o){return Array.isArray(o)?o.join(`
16
+ `):o}function d8(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"?S("nodeExceptionMessage","A system error occurred ({0})",o.message):o.message||S("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function bm(o=null,e=!1){if(!o)return S("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(o)){const t=Al(o),i=bm(t[0],e);return t.length>1?S("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(UA(o))return o;if(o.detail){const t=o.detail;if(t.error)return zb(t.error,e);if(t.exception)return zb(t.exception,e)}return o.stack?zb(o,e):o.message?o.message:S("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}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},Uh=function(o,e){return function(t,i){e(t,i,o)}},u1,Pd;let h1=(Pd=class extends Pt{constructor(e,t,i,n,s,r,a,d,u,f){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=s,this.edits=r,this.onSelectNewEdit=a,this._contextMenuService=d,this._keybindingService=f,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(u),this.visibleContext.set(!0),this._register(Zn(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Zn((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(g=>{s.containsPosition(g.position)||this.dispose()})),this._register(Ds.runAndSubscribe(f.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=li(".post-edit-widget"),this.button=this._register(new KF(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Cn(this.domNode,is.CLICK,()=>this.showSelector()))}getId(){return u1.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=bo(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>ZF({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},u1=Pd,Pd.baseId="editor.widget.postEditWidget",Pd);h1=u1=M6([Uh(7,V0),Uh(8,En),Uh(9,ms)],h1);let Cm=class extends Pt{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 Qo),this._register(Ds.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 d=async y=>{const D=this._editor.getModel();D&&(await D.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:y,allEdits:t.allEdits},i,n,s))},u=(y,D)=>{$c(y)||(this._notificationService.error(D),i&&this.show(e[0],t,d))};let f;try{f=await n(a,s)}catch(y){return u(y,S("resolveError",`Error resolving edit '{0}':
17
+ {1}`,a.title,bm(y)))}if(s.isCancellationRequested)return;const g=P6(r.uri,e,f),p=e[0],C=r.deltaDecorations([],[{range:p,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let b,E;try{b=await this._bulkEditService.apply(g,{editor:this._editor,token:s}),E=r.getDecorationRange(C[0])}catch(y){return u(y,S("applyError",`Error applying edit '{0}':
18
+ {1}`,a.title,bm(y)))}finally{r.deltaDecorations(C,[])}s.isCancellationRequested||i&&b.isApplied&&t.allEdits.length>1&&this.show(E??p,t,d)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(h1,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()}};Cm=M6([Uh(4,Qi),Uh(5,pv),Uh(6,go)],Cm);var rT=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},sh=function(o,e){return function(t,i){e(t,i,o)}},nd;const R6="editor.changePasteType",Kw=new xn("pasteWidgetVisible",!1,S("pasteWidgetVisible","Whether the paste widget is showing")),Vb="application/vnd.code.copyMetadata";var Td;let Pl=(Td=class extends Pt{static get(e){return e.getContribution(nd.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 d=e.getContainerDomNode();this._register(Cn(d,"copy",u=>this.handleCopy(u))),this._register(Cn(d,"cut",u=>this.handleCopy(u))),this._register(Cn(d,"paste",u=>this.handlePaste(u),!0)),this._pasteProgressManager=this._register(new vm("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(Cm,"pasteIntoEditor",e,Kw,{id:R6,label:S("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},tw().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 E,y,D,I;if(!this._editor.hasTextFocus()||((y=(E=this._clipboardService).clearInternalState)==null||y.call(E),!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 ee(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,xv),u={multicursorText:Array.isArray(a)?a:null,pasteOnNewLine:r,mode:null},f=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(M=>!!M.prepareDocumentPaste);if(!f.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:u});return}const g=A6(e.clipboardData),p=f.flatMap(M=>M.copyMimeTypes??[]),C=jv();this.setCopyMetadata(e.clipboardData,{id:C,providerCopyMimeTypes:p,defaultPastePayload:u});const b=Ws(async M=>{const R=Al(await Promise.all(f.map(async T=>{try{return await T.prepareDocumentPaste(t,s,g,M)}catch(V){console.error(V);return}})));R.reverse();for(const T of R)for(const[V,O]of T)g.replace(V,O);return g});(I=nd._currentCopyOperation)==null||I.dataTransferPromise.cancel(),nd._currentCopyOperation={handle:C,dataTransferPromise:b}}async handlePaste(e){var d,u,f;if(!e.clipboardData||!this._editor.hasTextFocus())return;(d=Po.get(this._editor))==null||d.closeMessage(),(u=this._currentPasteOperation)==null||u.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=k6(e.clipboardData);s.delete(Vb);const r=[...e.clipboardData.types,...(n==null?void 0:n.providerCopyMimeTypes)??[],js.uriList],a=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(g=>{var C,b;const p=(C=this._pasteAsActionContext)==null?void 0:C.preferred;return p&&g.providedPasteEditKinds&&!this.providerMatchesPreference(g,p)?!1:(b=g.pasteMimeTypes)==null?void 0:b.some(E=>S6(E,r))});if(!a.length){(f=this._pasteAsActionContext)!=null&&f.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=Po.get(this._editor))==null||i.showMessage(S("pasteAsError","No paste edits for '{0}' found",t instanceof Xn?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,n,s){const r=this._editor;if(!r.hasModel())return;const a=new f0(r,3,void 0),d=Ws(async u=>{const f=this._editor;if(!f.hasModel())return;const g=f.getModel(),p=new Bt,C=p.add(new zs(u));p.add(a.token.onCancellationRequested(()=>C.cancel()));const b=C.token;try{if(await this.mergeInDataFromCopy(i,n,b),b.isCancellationRequested)return;const E=e.filter(I=>this.isSupportedPasteProvider(I,i));if(!E.length||E.length===1&&E[0]instanceof Du)return this.applyDefaultPasteHandler(i,n,b,s);const y={triggerKind:kC.Automatic},D=await this.getPasteEdits(E,i,g,t,y,b);if(p.add(D),b.isCancellationRequested)return;if(D.edits.length===1&&D.edits[0].provider instanceof Du)return this.applyDefaultPasteHandler(i,n,b,s);if(D.edits.length){const I=f.getOption(85).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:D.edits},I,(M,R)=>new Promise((T,V)=>{(async()=>{var O,Q;try{const ie=(Q=(O=M.provider).resolveDocumentPasteEdit)==null?void 0:Q.call(O,M,R),de=new mv,te=ie&&await this._pasteProgressManager.showWhile(t[0].getEndPosition(),S("resolveProcess","Resolving paste edit. Click to cancel"),Promise.race([de.p,ie]),{cancel:()=>(de.cancel(),V(new _v))},0);return te&&(M.additionalEdit=te.additionalEdit),T(M)}catch(ie){return V(ie)}})()}),b)}await this.applyDefaultPasteHandler(i,n,b,s)}finally{p.dispose(),this._currentPasteOperation===d&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),S("pasteIntoEditorProgress","Running paste handlers. Click to cancel and do basic paste"),d,{cancel:async()=>{try{if(d.cancel(),a.token.isCancellationRequested)return;await this.applyDefaultPasteHandler(i,n,a.token,s)}finally{a.dispose()}}}).then(()=>{a.dispose()}),this._currentPasteOperation=d}showPasteAsPick(e,t,i,n,s){const r=Ws(async a=>{const d=this._editor;if(!d.hasModel())return;const u=d.getModel(),f=new Bt,g=f.add(new f0(d,3,void 0,a));try{if(await this.mergeInDataFromCopy(n,s,g.token),g.token.isCancellationRequested)return;let p=t.filter(D=>this.isSupportedPasteProvider(D,n,e));e&&(p=p.filter(D=>this.providerMatchesPreference(D,e)));const C={triggerKind:kC.PasteAs,only:e&&e instanceof Xn?e:void 0};let b=f.add(await this.getPasteEdits(p,n,u,i,C,g.token));if(g.token.isCancellationRequested)return;if(e&&(b={edits:b.edits.filter(D=>e instanceof Xn?e.contains(D.kind):e.providerId===D.provider.id),dispose:b.dispose}),!b.edits.length){C.only&&this.showPasteAsNoEditMessage(i,C.only);return}let E;if(e)E=b.edits.at(0);else{const D=await this._quickInputService.pick(b.edits.map(I=>{var M;return{label:I.title,description:(M=I.kind)==null?void 0:M.value,edit:I}}),{placeHolder:S("pasteAsPickerPlaceholder","Select Paste Action")});E=D==null?void 0:D.edit}if(!E)return;const y=P6(u.uri,i,E);await this._bulkEditService.apply(y,{editor:this._editor})}finally{f.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:S("pasteAsProgress","Running paste handlers")},()=>r)}setCopyMetadata(e,t){e.setData(Vb,JSON.stringify(t))}fetchCopyMetadata(e){if(!e.clipboardData)return;const t=e.clipboardData.getData(Vb);if(t)try{return JSON.parse(t)}catch{return}const[i,n]=XF.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=nd._currentCopyOperation)==null?void 0:n.handle)===t.id){const s=await nd._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[r,a]of s)e.replace(r,a)}if(!e.has(js.uriList)){const s=await this._clipboardService.readResources();if(i.isCancellationRequested)return;s.length&&e.append(js.uriList,$w($v.create(s)))}}async getPasteEdits(e,t,i,n,s,r){const a=new Bt,d=await cp(Promise.all(e.map(async f=>{var g,p;try{const C=await((g=f.provideDocumentPasteEdits)==null?void 0:g.call(f,i,n,t,s,r));return C&&a.add(C),(p=C==null?void 0:C.edits)==null?void 0:p.map(b=>({...b,provider:f}))}catch(C){$c(C)||console.error(C);return}})),r),u=Al(d??[]).flat().filter(f=>!s.only||s.only.contains(f.kind));return{edits:T6(u),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,n){const s=e.get(js.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 Xn?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}},nd=Td,Td.ID="editor.contrib.copyPasteActionController",Td);Pl=nd=rT([sh(1,Qi),sh(2,pv),sh(3,j0),sh(4,xi),sh(5,Ol),sh(6,YF)],Pl);const ku="9_cutcopypaste",aT=$0||document.queryCommandSupported("cut"),N6=$0||document.queryCommandSupported("copy"),lT=typeof navigator.clipboard>"u"||QF?document.queryCommandSupported("paste"):!0;function Zw(o){return o.register(),o}const cT=aT?Zw(new iw({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:$0?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:Yt.MenubarEditMenu,group:"2_ccp",title:S({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:Yt.EditorContext,group:ku,title:S("actions.clipboard.cutLabel","Cut"),when:U.writable,order:1},{menuId:Yt.CommandPalette,group:"",title:S("actions.clipboard.cutLabel","Cut"),order:1},{menuId:Yt.SimpleEditorContext,group:ku,title:S("actions.clipboard.cutLabel","Cut"),when:U.writable,order:1}]})):void 0,dT=N6?Zw(new iw({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:$0?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:Yt.MenubarEditMenu,group:"2_ccp",title:S({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:Yt.EditorContext,group:ku,title:S("actions.clipboard.copyLabel","Copy"),order:2},{menuId:Yt.CommandPalette,group:"",title:S("actions.clipboard.copyLabel","Copy"),order:1},{menuId:Yt.SimpleEditorContext,group:ku,title:S("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;Wr.appendMenuItem(Yt.MenubarEditMenu,{submenu:Yt.MenubarCopy,title:ui("copy as","Copy As"),group:"2_ccp",order:3});Wr.appendMenuItem(Yt.EditorContext,{submenu:Yt.EditorContextCopy,title:ui("copy as","Copy As"),group:ku,order:3});Wr.appendMenuItem(Yt.EditorContext,{submenu:Yt.EditorContextShare,title:ui("share","Share"),group:"11_share",order:-1,when:$e.and($e.notEquals("resourceScheme","output"),U.editorTextFocus)});Wr.appendMenuItem(Yt.ExplorerContext,{submenu:Yt.ExplorerContextShare,title:ui("share","Share"),group:"11_share",order:-1});const jb=lT?Zw(new iw({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:$0?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:Yt.MenubarEditMenu,group:"2_ccp",title:S({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:Yt.EditorContext,group:ku,title:S("actions.clipboard.pasteLabel","Paste"),when:U.writable,order:4},{menuId:Yt.CommandPalette,group:"",title:S("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:Yt.SimpleEditorContext,group:ku,title:S("actions.clipboard.pasteLabel","Paste"),when:U.writable,order:4}]})):void 0;class uT extends gt{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:S("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:U.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(gS.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),gS.forceCopyWithSyntaxHighlighting=!1)}}function O6(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(fs).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)=>(tw().execCommand(e),!0)))}O6(cT,"cut");O6(dT,"copy");jb&&(jb.addImplementation(1e4,"code-editor",(o,e)=>{var s;const t=o.get(fs),i=o.get(j0),n=t.getFocusedCodeEditor();return n&&n.hasTextFocus()?n.getContainerDomNode().ownerDocument.execCommand("paste")?((s=Pl.get(n))==null?void 0:s.finishedPaste())??Promise.resolve():JF?(async()=>{const a=await i.readText();if(a!==""){const d=e3.INSTANCE.get(a);let u=!1,f=null,g=null;d&&(u=n.getOption(37)&&!!d.isFromEmptySelection,f=typeof d.multicursorText<"u"?d.multicursorText:null,g=d.mode),n.trigger("keyboard","paste",{text:a,pasteOnNewLine:u,multicursorText:f,mode:g})}})():!0:!1}),jb.addImplementation(0,"generic-dom",(o,e)=>(tw().execCommand("paste"),!0)));N6&&Ae(uT);const jn=new class{constructor(){this.QuickFix=new Xn("quickfix"),this.Refactor=new Xn("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 Xn("notebook"),this.Source=new Xn("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var No;(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"})(No||(No={}));function hT(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>H6(e,t,o.include))||!o.includeSourceActions&&jn.Source.contains(e))}function fT(o,e){const t=e.kind?new Xn(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>H6(t,i,o.include))||!o.includeSourceActions&&t&&jn.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function H6(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class Wa{static fromUser(e,t){return!e||typeof e!="object"?new Wa(t.kind,t.apply,!1):new Wa(Wa.getKindFromUser(e,t.kind),Wa.getApplyFromUser(e,t.apply),Wa.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 Xn(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 gT{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){hs(n)}i&&(this.action.edit=i.edit)}return this}}const W6="editor.action.codeAction",Xw="editor.action.quickFix",z6="editor.action.autoFix",V6="editor.action.refactor",j6="editor.action.sourceAction",f1="editor.action.organizeImports",g1="editor.action.fixAll";class Qf extends Pt{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:Zo(e.diagnostics)?Zo(t.diagnostics)?Qf.codeActionsPreferredComparator(e,t):-1:Zo(t.diagnostics)?1:Qf.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(Qf.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&jn.QuickFix.contains(new Xn(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 u8={actions:[],documentation:void 0};async function Fh(o,e,t,i,n,s){var E;const r=i.filter||{},a={...r,excludes:[...r.excludes||[],jn.Notebook]},d={only:(E=r.include)==null?void 0:E.value,trigger:i.type},u=new t3(e,s),f=i.type===2,g=pT(o,e,f?a:r),p=new Bt,C=g.map(async y=>{try{n.report(y);const D=await y.provideCodeActions(e,t,d,u.token);if(D&&p.add(D),u.token.isCancellationRequested)return u8;const I=((D==null?void 0:D.actions)||[]).filter(R=>R&&fT(r,R)),M=mT(y,I,r.include);return{actions:I.map(R=>new gT(R,y)),documentation:M}}catch(D){if($c(D))throw D;return hs(D),u8}}),b=o.onDidChange(()=>{const y=o.all(e);Xa(y,g)||u.cancel()});try{const y=await Promise.all(C),D=y.map(M=>M.actions).flat(),I=[...Al(y.map(M=>M.documentation)),...xT(o,e,i,D)];return new Qf(D,I,p)}finally{b.dispose(),u.dispose()}}function pT(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>hT(t,new Xn(n))):!0)}function*xT(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(d=>d.action)))}function mT(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new Xn(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 Xn(n.kind)))return s.command}}var pd;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions",o.FromAILightbulb="fromAILightbulb"})(pd||(pd={}));async function _T(o,e,t,i,n=sn.None){var u;const s=o.get(pv),r=o.get(Rs),a=o.get(pa),d=o.get(go);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&&!((u=e.action.edit)!=null&&u.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!==pd.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(f){const g=vT(f);d.error(typeof g=="string"?g:S("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function vT(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}Un.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof Rn))throw El();const{codeActionProvider:s}=o.get(xi),r=o.get(po).getModel(e);if(!r)throw El();const a=Hi.isISelection(t)?Hi.liftSelection(t):ee.isIRange(t)?r.validateRange(t):void 0;if(!a)throw El();const d=typeof i=="string"?new Xn(i):void 0,u=await Fh(s,r,a,{type:1,triggerAction:No.Default,filter:{includeSourceActions:!0,include:d}},ml.None,sn.None),f=[],g=Math.min(u.validActions.length,typeof n=="number"?n:0);for(let p=0;p<g;p++)f.push(u.validActions[p].resolve(sn.None));try{return await Promise.all(f),u.validActions.map(p=>p.action)}finally{setTimeout(()=>u.dispose(),100)}});var bT=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},CT=function(o,e){return function(t,i){e(t,i,o)}},p1,Md;let x1=(Md=class{constructor(e){this.keybindingService=e}getResolver(){const e=new nw(()=>this.keybindingService.getKeybindings().filter(t=>p1.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===f1?i={kind:jn.SourceOrganizeImports.value}:t.command===g1&&(i={kind:jn.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...Wa.fromUser(i,{kind:Xn.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 Xn(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)}},p1=Md,Md.codeActionCommands=[V6,W6,j6,f1,g1],Md);x1=p1=bT([CT(0,ms)],x1);ci("symbolIcon.arrayForeground",ks,S("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.booleanForeground",ks,S("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},S("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.colorForeground",ks,S("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.constantForeground",ks,S("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},S("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},S("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},S("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},S("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},S("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.fileForeground",ks,S("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.folderForeground",ks,S("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},S("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},S("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.keyForeground",ks,S("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.keywordForeground",ks,S("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},S("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.moduleForeground",ks,S("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.namespaceForeground",ks,S("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.nullForeground",ks,S("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.numberForeground",ks,S("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.objectForeground",ks,S("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.operatorForeground",ks,S("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.packageForeground",ks,S("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.propertyForeground",ks,S("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.referenceForeground",ks,S("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.snippetForeground",ks,S("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.stringForeground",ks,S("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.structForeground",ks,S("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.textForeground",ks,S("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.typeParameterForeground",ks,S("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.unitForeground",ks,S("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));ci("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},S("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const $6=Object.freeze({kind:Xn.Empty,title:S("codeAction.widget.id.more","More Actions...")}),ET=Object.freeze([{kind:jn.QuickFix,title:S("codeAction.widget.id.quickfix","Quick Fix")},{kind:jn.RefactorExtract,title:S("codeAction.widget.id.extract","Extract"),icon:Ui.wrench},{kind:jn.RefactorInline,title:S("codeAction.widget.id.inline","Inline"),icon:Ui.wrench},{kind:jn.RefactorRewrite,title:S("codeAction.widget.id.convert","Rewrite"),icon:Ui.wrench},{kind:jn.RefactorMove,title:S("codeAction.widget.id.move","Move"),icon:Ui.wrench},{kind:jn.SurroundWith,title:S("codeAction.widget.id.surround","Surround With"),icon:Ui.surroundWith},{kind:jn.Source,title:S("codeAction.widget.id.source","Source Action"),icon:Ui.symbolFile},$6]);function yT(o,e,t){if(!e)return o.map(s=>{var r;return{kind:"action",item:s,group:$6,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!((r=s.action.edit)!=null&&r.edits.length)}});const i=ET.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new Xn(s.action.kind):Xn.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:Ui.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}var wT=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},ST=function(o,e){return function(t,i){e(t,i,o)}},bh;const h8=ds("gutter-lightbulb",Ui.lightBulb,S("gutterLightbulbWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor.")),f8=ds("gutter-lightbulb-auto-fix",Ui.lightbulbAutofix,S("gutterLightbulbAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),g8=ds("gutter-lightbulb-sparkle",Ui.lightbulbSparkle,S("gutterLightbulbAIFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),p8=ds("gutter-lightbulb-aifix-auto-fix",Ui.lightbulbSparkleAutofix,S("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.")),x8=ds("gutter-lightbulb-sparkle-filled",Ui.sparkleFilled,S("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 Xr;(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})(Xr||(Xr={}));var vl;let kg=(vl=class extends Pt{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new nn),this.onClick=this._onClick.event,this._state=Xr.Hidden,this._gutterState=Xr.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+h8.id,"codicon-"+p8.id,"codicon-"+f8.id,"codicon-"+g8.id,"codicon-"+x8.id],this.gutterDecoration=bh.GUTTER_DECORATION,this._domNode=li("div.lightBulbWidget"),this._domNode.role="listbox",this._register(qA.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(i3(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:n,height:s}=bo(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(Cn(this._domNode,"mouseenter",i=>{(i.buttons&1)===1&&this.hide()})),this._register(Ds.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var i,n;this._preferredKbLabel=((i=this._keybindingService.lookupKeybinding(z6))==null?void 0:i.getLabel())??void 0,this._quickFixKbLabel=((n=this._keybindingService.lookupKeybinding(Xw))==null?void 0:n.getLabel())??void 0,this._updateLightBulbTitleAndIcon()})),this._register(this._editor.onMouseDown(async i=>{if(!i.target.element||!this.lightbulbClasses.some(d=>i.target.element&&i.target.element.classList.contains(d))||this.gutterState.type!==1)return;this._editor.focus();const{top:n,height:s}=bo(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:d}=r.validatePosition(i),u=r.getOptions().tabSize,f=this._editor.getOptions().get(50),g=r.getLineContent(a),p=sw(g,u),C=f.spaceWidth*p>22,b=T=>T>2&&this._editor.getTopForLineNumber(T)===this._editor.getTopForLineNumber(T-1),E=this._editor.getLineDecorations(a);let y=!1;if(E)for(const T of E){const V=T.options.glyphMarginClassName;if(V&&!this.lightbulbClasses.some(O=>V.includes(O))){y=!0;break}}let D=a,I=1;if(!C){const T=V=>{const O=r.getLineContent(V);return/^\s*$|^\s+/.test(O)||O.length<=I};if(a>1&&!b(a-1)){const V=r.getLineCount(),O=a===V,Q=a>1&&T(a-1),ie=!O&&T(a+1),de=T(a),te=!ie&&!Q;if(!ie&&!Q&&!y)return this.gutterState=new Xr.Showing(e,t,i,{position:{lineNumber:D,column:I},preference:bh._posPref}),this.renderGutterLightbub(),this.hide();Q||O||Q&&!de?D-=1:(ie||te&&de)&&(D+=1)}else if(a===1&&(a===r.getLineCount()||!T(a+1)&&!T(a)))if(this.gutterState=new Xr.Showing(e,t,i,{position:{lineNumber:D,column:I},preference:bh._posPref}),y)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(a<r.getLineCount()&&!b(a+1))D+=1;else if(d*f.spaceWidth<22)return this.hide();I=/^\S\s*$/.test(r.getLineContent(D))?2:1}this.state=new Xr.Showing(e,t,i,{position:{lineNumber:D,column:I},preference:bh._posPref}),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());const M=e.validActions,R=e.validActions[0].action.kind;if(M.length!==1||!R){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this.state!==Xr.Hidden&&(this.state=Xr.Hidden,this._editor.layoutContentWidget(this))}gutterHide(){this.gutterState!==Xr.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this.gutterState=Xr.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=Ui.sparkleFilled,this.state.actions.validActions.length===1&&(t=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?e=Ui.lightbulbSparkleAutofix:e=Ui.lightbulbAutofix:this.state.actions.hasAIFix?e=Ui.lightbulbSparkle:e=Ui.lightBulb,this._updateLightbulbTitle(this.state.actions.hasAutoFix,t),this._iconClasses=Dn.asClassNameArray(e),this._domNode.classList.add(...this._iconClasses)}_updateGutterLightBulbTitleAndIcon(){if(this.gutterState.type!==1)return;let e,t=!1;this.gutterState.actions.allAIFixes?(e=x8,this.gutterState.actions.validActions.length===1&&(t=!0)):this.gutterState.actions.hasAutoFix?this.gutterState.actions.hasAIFix?e=p8:e=f8:this.gutterState.actions.hasAIFix?e=g8:e=h8,this._updateLightbulbTitle(this.gutterState.actions.hasAutoFix,t);const i=fn.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Dn.asClassName(e),glyphMargin:{position:Jx.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 ee(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 ee(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}_updateLightbulbTitle(e,t){this.state.type===1&&(t?this.title=S("codeActionAutoRun","Run: {0}",this.state.actions.validActions[0].action.title):e&&this._preferredKbLabel?this.title=S("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):!e&&this._quickFixKbLabel?this.title=S("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):e||(this.title=S("codeAction","Show Code Actions")))}set title(e){this._domNode.title=e}},bh=vl,vl.GUTTER_DECORATION=fn.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Dn.asClassName(Ui.lightBulb),glyphMargin:{position:Jx.Left},stickiness:1}),vl.ID="editor.contrib.lightbulbWidget",vl._posPref=[0],vl);kg=bh=wT([ST(1,ms)],kg);var U6=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},m1=function(o,e){return function(t,i){e(t,i,o)}};const q6="acceptSelectedCodeAction",G6="previewSelectedCodeAction";class DT{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 _1=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 ow(e,rw);return{container:e,icon:t,text:i,keybinding:n}}renderElement(e,t,i){var r,a,d;if((r=e.group)!=null&&r.icon?(i.icon.className=Dn.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=Cd(e.group.icon.color.id))):(i.icon.className=Dn.asClassName(Ui.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=K6(e.label),i.keybinding.set(e.keybinding),n3(!!e.keybinding,i.keybinding.element);const n=(a=this._keybindingService.lookupKeybinding(q6))==null?void 0:a.getLabel(),s=(d=this._keybindingService.lookupKeybinding(G6))==null?void 0:d.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=S({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=S({key:"label",comment:['placeholder is a keybinding, e.g "F2 to Apply"']},"{0} to Apply",n):i.container.title=""}disposeTemplate(e){e.keybinding.dispose()}};_1=U6([m1(1,ms)],_1);class AT extends UIEvent{constructor(){super("acceptSelectedAction")}}class m8 extends UIEvent{constructor(){super("previewSelectedAction")}}function kT(o){if(o.kind==="action")return o.label}let v1=class extends Pt{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 zs),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:d=>d.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:d=>d.kind};this._list=this._register(new aw(e,this.domNode,a,[new _1(t,this._keybindingService),new DT],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:kT},accessibilityProvider:{getAriaLabel:d=>{if(d.kind==="action"){let u=d.label?K6(d==null?void 0:d.label):"";return d.disabled&&(u=S({key:"customQuickFixWidget.labels",comment:["Action widget labels for accessibility."]},"{0}, Disabled Reason: {1}",u,d.disabled)),u}return null},getWidgetAriaLabel:()=>S({key:"customQuickFixWidget",comment:["An action widget option"]},"Action Widget"),getRole:d=>d.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(s3),this._register(this._list.onMouseClick(d=>this.onListClick(d))),this._register(this._list.onMouseOver(d=>this.onListHover(d))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(d=>this.onListSelection(d))),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(d=>d.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 d=this._allMenuItems.map((u,f)=>{const g=this.domNode.ownerDocument.getElementById(this._list.getElementID(f));if(g){g.style.width="auto";const p=g.getBoundingClientRect().width;return g.style.width="",p}return 0});s=Math.max(...d,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 m8:new AT;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 m8):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([])}};v1=U6([m1(4,vv),m1(5,ms)],v1);function K6(o){return o.replace(/\r\n|\r|\n/g," ")}var BT=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},$b=function(o,e){return function(t,i){e(t,i,o)}};ci("actionBar.toggledBackground",lw,S("actionBar.toggledBackground","Background color for toggled action items in action bar."));const Bu={Visible:new xn("codeActionMenuVisible",!1,S("codeActionMenuVisible","Whether the action widget list is visible"))},ju=Hl("actionWidgetService");let Fu=class extends Pt{get isVisible(){return Bu.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new Qo)}show(e,t,i,n,s,r,a){const d=Bu.Visible.bindTo(this._contextKeyService),u=this._instantiationService.createInstance(v1,e,t,i,n);this._contextViewService.showContextView({getAnchor:()=>s,render:f=>(d.set(!0),this._renderWidget(f,u,a??[])),onHide:f=>{d.reset(),this._onWidgetClosed(f)}},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 C;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 Bt,r=document.createElement("div"),a=e.appendChild(r);a.classList.add("context-view-block"),s.add(Cn(a,is.MOUSE_DOWN,b=>b.stopPropagation()));const d=document.createElement("div"),u=e.appendChild(d);u.classList.add("context-view-pointerBlock"),s.add(Cn(u,is.POINTER_MOVE,()=>u.remove())),s.add(Cn(u,is.MOUSE_DOWN,()=>u.remove()));let f=0;if(i.length){const b=this._createActionBar(".action-widget-action-bar",i);b&&(n.appendChild(b.getContainer().parentElement),s.add(b),f=b.getContainer().offsetWidth)}const g=(C=this._list.value)==null?void 0:C.layout(f);n.style.width=`${g}px`;const p=s.add(g0(e));return s.add(p.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=li(e),n=new fg(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)==null||t.hide(e)}};Fu=BT([$b(0,vv),$b(1,En),$b(2,Qi)],Fu);Wl(ju,Fu,1);const Fp=1100;Tn(class extends yo{constructor(){super({id:"hideCodeActionWidget",title:ui("hideCodeActionWidget.title","Hide action widget"),precondition:Bu.Visible,keybinding:{weight:Fp,primary:9,secondary:[1033]}})}run(o){o.get(ju).hide(!0)}});Tn(class extends yo{constructor(){super({id:"selectPrevCodeAction",title:ui("selectPrevCodeAction.title","Select previous action"),precondition:Bu.Visible,keybinding:{weight:Fp,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(ju);e instanceof Fu&&e.focusPrevious()}});Tn(class extends yo{constructor(){super({id:"selectNextCodeAction",title:ui("selectNextCodeAction.title","Select next action"),precondition:Bu.Visible,keybinding:{weight:Fp,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(ju);e instanceof Fu&&e.focusNext()}});Tn(class extends yo{constructor(){super({id:q6,title:ui("acceptSelected.title","Accept selected action"),precondition:Bu.Visible,keybinding:{weight:Fp,primary:3,secondary:[2137]}})}run(o){const e=o.get(ju);e instanceof Fu&&e.acceptSelected()}});Tn(class extends yo{constructor(){super({id:G6,title:ui("previewSelected.title","Preview selected action"),precondition:Bu.Visible,keybinding:{weight:Fp,primary:2051}})}run(o){const e=o.get(ju);e instanceof Fu&&e.acceptSelected(!0)}});const Z6=new xn("supportedCodeAction",""),_8="_typescript.applyFixAllCodeAction";class FT extends Pt{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new dp),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=>em(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:No.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!==Ab.Off){{if(i===Ab.On)return t;if(i===Ab.OnCode){if(!t.isEmpty())return t;const s=this._editor.getModel(),{lineNumber:r,column:a}=t.getPosition(),d=s.getLineContent(r);if(d.length===0)return;if(a===1){if(/\s/.test(d[0]))return}else if(a===s.getLineMaxColumn(r)){if(/\s/.test(d[d.length-1]))return}else if(/\s/.test(d[a-2])&&/\s/.test(d[a-1]))return}}return t}}}var ad;(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($c(r))return X6;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(ad||(ad={}));const X6=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class LT extends Pt{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 Qo),this._state=ad.Empty,this._onDidChangeState=this._register(new nn),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=Z6.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(d=>{d.hasChanged(65)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(ad.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(ad.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 FT(this._editor,this._markerService,i=>{var d;if(!i){this.setState(ad.Empty);return}const n=i.selection.getStartPosition(),s=Ws(async u=>{var f,g,p,C,b,E,y,D,I,M;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===No.QuickFix||(g=(f=i.trigger.filter)==null?void 0:f.include)!=null&&g.contains(jn.QuickFix))){const R=await Fh(this._registry,e,i.selection,i.trigger,ml.None,u),T=[...R.allActions];if(u.isCancellationRequested)return X6;const V=(p=R.validActions)==null?void 0:p.some(Q=>Q.action.kind?jn.QuickFix.contains(new Xn(Q.action.kind)):!1),O=this._markerService.read({resource:e.uri});if(V){for(const Q of R.validActions)(b=(C=Q.action.command)==null?void 0:C.arguments)!=null&&b.some(ie=>typeof ie=="string"&&ie.includes(_8))&&(Q.action.diagnostics=[...O.filter(ie=>ie.relatedInformation)]);return{validActions:R.validActions,allActions:T,documentation:R.documentation,hasAutoFix:R.hasAutoFix,hasAIFix:R.hasAIFix,allAIFixes:R.allAIFixes,dispose:()=>{R.dispose()}}}else if(!V&&O.length>0){const Q=i.selection.getPosition();let ie=Q,de=Number.MAX_VALUE;const te=[...R.validActions];for(const we of O){const oe=we.endColumn,ye=we.endLineNumber,Re=we.startLineNumber;if(ye===Q.lineNumber||Re===Q.lineNumber){ie=new pi(ye,oe);const ke={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(E=i.trigger.filter)!=null&&E.include?(y=i.trigger.filter)==null?void 0:y.include:jn.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((D=i.trigger.context)==null?void 0:D.notAvailableMessage)||"",position:ie}},_e=new Hi(ie.lineNumber,ie.column,ie.lineNumber,ie.column),lt=await Fh(this._registry,e,_e,ke,ml.None,u);if(lt.validActions.length!==0){for(const Te of lt.validActions)(M=(I=Te.action.command)==null?void 0:I.arguments)!=null&&M.some(pe=>typeof pe=="string"&&pe.includes(_8))&&(Te.action.diagnostics=[...O.filter(pe=>pe.relatedInformation)]);R.allActions.length===0&&T.push(...lt.allActions),Math.abs(Q.column-oe)<de?te.unshift(...lt.validActions):te.push(...lt.validActions)}de=Math.abs(Q.column-oe)}}const le=te.filter((we,oe,ye)=>ye.findIndex(Re=>Re.action.title===we.action.title)===oe);return le.sort((we,oe)=>we.action.isPreferred&&!oe.action.isPreferred?-1:!we.action.isPreferred&&oe.action.isPreferred||we.action.isAI&&!oe.action.isAI?1:!we.action.isAI&&oe.action.isAI?-1:0),{validActions:le,allActions:T,documentation:R.documentation,hasAutoFix:R.hasAutoFix,hasAIFix:R.hasAIFix,allAIFixes:R.allAIFixes,dispose:()=>{R.dispose()}}}}if(i.trigger.type===1){const R=new Ro,T=await Fh(this._registry,e,i.selection,i.trigger,ml.None,u);return this._telemetryService&&this._telemetryService.publicLog2("codeAction.invokedDurations",{codeActions:T.validActions.length,duration:R.elapsed()}),T}return Fh(this._registry,e,i.selection,i.trigger,ml.None,u)});i.trigger.type===1&&((d=this._progressService)==null||d.showWhile(s,250));const r=new ad.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:No.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 IT=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},Sa=function(o,e){return function(t,i){e(t,i,o)}},Ch;const PT="quickfix-edit-highlight";var bc;let k0=(bc=class extends Pt{static get(e){return e.getContribution(Ch.ID)}constructor(e,t,i,n,s,r,a,d,u,f,g){super(),this._commandService=a,this._configurationService=d,this._actionWidgetService=u,this._instantiationService=f,this._telemetryService=g,this._activeCodeActions=this._register(new Qo),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new LT(this._editor,s.codeActionProvider,t,i,r,d,this._telemetryService)),this._register(this._model.onDidChangeState(p=>this.update(p))),this._lightBulbWidget=new nw(()=>{const p=this._editor.getContribution(kg.ID);return p&&this._register(p.onClick(C=>this.showCodeActionsFromLightbulb(C.actions,C))),p}),this._resolver=n.createInstance(x1),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,pd.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=Po.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(_T,e,n,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:No.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,d;if(e.type!==1){this.hideLightBulbWidget();return}let t;try{t=await e.actions}catch(u){On(u);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 f=this.tryGetValidActionToApply(e.trigger,t);if(f){try{this.hideLightBulbWidget(),await this._applyCodeAction(f,!1,!1,pd.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const g=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(g&&g.action.disabled){(r=Po.get(this._editor))==null||r.showMessage(g.action.disabled,e.trigger.context.position),t.dispose();return}}}const u=!!((a=e.trigger.filter)!=null&&a.include);if(e.trigger.context&&(!t.allActions.length||!u&&!t.validActions.length)){(d=Po.get(this._editor))==null||d.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:u,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=pi.isIPosition(t)?this.toCoords(t):t,d={onSelect:async(u,f)=>{this._applyCodeAction(u,!0,!!f,i.fromLightbulb?pd.FromAILightbulb:pd.FromCodeActions),this._actionWidgetService.hide(!1),n.clear()},onHide:u=>{var f;(f=this._editor)==null||f.focus(),n.clear()},onHover:async(u,f)=>{var C;if(f.isCancellationRequested)return;let g=!1;const p=u.action.kind;if(p){const b=new Xn(p);g=[jn.RefactorExtract,jn.RefactorInline,jn.RefactorRewrite,jn.RefactorMove,jn.Source].some(y=>y.contains(b))}return{canPreview:g||!!((C=u.action.edit)!=null&&C.edits.length)}},onFocus:u=>{var f,g;if(u&&u.action){const p=u.action.ranges,C=u.action.diagnostics;if(n.clear(),p&&p.length>0){const b=C&&(C==null?void 0:C.length)>1?C.map(E=>({range:E,options:Ch.DECORATION})):p.map(E=>({range:E,options:Ch.DECORATION}));n.set(b)}else if(C&&C.length>0){const b=C.map(y=>({range:y,options:Ch.DECORATION}));n.set(b);const E=C[0];if(E.startLineNumber&&E.startColumn){const y=(g=(f=this._editor.getModel())==null?void 0:f.getWordAtPosition({lineNumber:E.startLineNumber,column:E.startColumn}))==null?void 0:g.word;p0(S("editingNewSelection","Context: {0} at line {1} and column {2}.",y,E.startLineNumber,E.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,yT(r,this._shouldShowHeaders(),this._resolver.getResolver()),d,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=bo(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:S("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:S("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),n}},Ch=bc,bc.ID="editor.contrib.codeActionController",bc.DECORATION=fn.register({description:"quickfix-highlight",className:PT}),bc);k0=Ch=IT([Sa(1,cw),Sa(2,En),Sa(3,Qi),Sa(4,xi),Sa(5,up),Sa(6,Rs),Sa(7,Yn),Sa(8,ju),Sa(9,Qi),Sa(10,pa)],k0);bv((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(o3));const i=o.getColor(GA);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${gg(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function Lp(o){return $e.regex(Z6.keys()[0],new RegExp("(\\s|^)"+pg(o.value)+"\\b"))}const Yw={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:S("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:S("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[S("args.schema.apply.first","Always apply the first returned code action."),S("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),S("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:S("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function $u(o,e,t,i,n=No.Default){if(o.hasModel()){const s=k0.get(o);s==null||s.manualTriggerAtCurrentPosition(e,n,t,i)}}class TT extends gt{constructor(){super({id:Xw,label:S("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:$e.and(U.writable,U.hasCodeActionsProvider),kbOpts:{kbExpr:U.textInputFocus,primary:2137,weight:100}})}run(e,t){return $u(t,S("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,No.QuickFix)}}class MT extends wo{constructor(){super({id:W6,precondition:$e.and(U.writable,U.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:Yw}]}})}runEditorCommand(e,t,i){const n=Wa.fromUser(i,{kind:Xn.Empty,apply:"ifSingle"});return $u(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?S("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):S("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):n.preferred?S("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):S("editor.action.codeAction.noneMessage","No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}class RT extends gt{constructor(){super({id:V6,label:S("refactor.label","Refactor..."),alias:"Refactor...",precondition:$e.and(U.writable,U.hasCodeActionsProvider),kbOpts:{kbExpr:U.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:$e.and(U.writable,Lp(jn.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:Yw}]}})}run(e,t,i){const n=Wa.fromUser(i,{kind:jn.Refactor,apply:"never"});return $u(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?S("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):S("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):n.preferred?S("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):S("editor.action.refactor.noneMessage","No refactorings available"),{include:jn.Refactor.contains(n.kind)?n.kind:Xn.None,onlyIncludePreferredActions:n.preferred},n.apply,No.Refactor)}}class NT extends gt{constructor(){super({id:j6,label:S("source.label","Source Action..."),alias:"Source Action...",precondition:$e.and(U.writable,U.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:$e.and(U.writable,Lp(jn.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:Yw}]}})}run(e,t,i){const n=Wa.fromUser(i,{kind:jn.Source,apply:"never"});return $u(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?S("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):S("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):n.preferred?S("editor.action.source.noneMessage.preferred","No preferred source actions available"):S("editor.action.source.noneMessage","No source actions available"),{include:jn.Source.contains(n.kind)?n.kind:Xn.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,No.SourceAction)}}class OT extends gt{constructor(){super({id:f1,label:S("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:$e.and(U.writable,Lp(jn.SourceOrganizeImports)),kbOpts:{kbExpr:U.textInputFocus,primary:1581,weight:100}})}run(e,t){return $u(t,S("editor.action.organize.noneMessage","No organize imports action available"),{include:jn.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",No.OrganizeImports)}}class HT extends gt{constructor(){super({id:g1,label:S("fixAll.label","Fix All"),alias:"Fix All",precondition:$e.and(U.writable,Lp(jn.SourceFixAll))})}run(e,t){return $u(t,S("fixAll.noneMessage","No fix all action available"),{include:jn.SourceFixAll,includeSourceActions:!0},"ifSingle",No.FixAll)}}class WT extends gt{constructor(){super({id:z6,label:S("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:$e.and(U.writable,Lp(jn.QuickFix)),kbOpts:{kbExpr:U.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return $u(t,S("editor.action.autoFix.noneMessage","No auto fixes available"),{include:jn.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",No.AutoFix)}}on(k0.ID,k0,3);on(kg.ID,kg,4);Ae(TT);Ae(RT);Ae(NT);Ae(OT);Ae(WT);Ae(HT);yi(new MT);fa.as(hp.Configuration).registerConfiguration({...Cv,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:S("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});fa.as(hp.Configuration).registerConfiguration({...Cv,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:S("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});fa.as(hp.Configuration).registerConfiguration({...Cv,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:5,markdownDescription:S("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 b1{constructor(){this.lenses=[],this._disposables=new Bt}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 Y6(o,e,t){const i=o.ordered(e),n=new Map,s=new b1,r=i.map(async(a,d)=>{n.set(a,d);try{const u=await Promise.resolve(a.provideCodeLenses(e,t));u&&s.add(u,a)}catch(u){hs(u)}});return await Promise.all(r),s.lenses=s.lenses.sort((a,d)=>a.symbol.range.startLineNumber<d.symbol.range.startLineNumber?-1:a.symbol.range.startLineNumber>d.symbol.range.startLineNumber?1:n.get(a.provider)<n.get(d.provider)?-1:n.get(a.provider)>n.get(d.provider)?1:a.symbol.range.startColumn<d.symbol.range.startColumn?-1:a.symbol.range.startColumn>d.symbol.range.startColumn?1:0),s}Un.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;wn(Rn.isUri(t)),wn(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(xi),s=o.get(po).getModel(t);if(!s)throw El();const r=[],a=new Bt;return Y6(n,s,sn.None).then(d=>{a.add(d);const u=[];for(const f of d.lenses)i==null||f.symbol.command?r.push(f.symbol):i-- >0&&f.provider.resolveCodeLens&&u.push(Promise.resolve(f.provider.resolveCodeLens(s,f.symbol,sn.None)).then(g=>r.push(g||f.symbol)));return Promise.all(u)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var zT=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},VT=function(o,e){return function(t,i){e(t,i,o)}};const Q6=Hl("ICodeLensCache");class v8{constructor(e,t){this.lineCount=e,this.data=t}}let C1=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new fp(20,.75);const t="codelens/cache";r3(a3,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n);const s=Ds.filter(e.onWillSaveState,r=>r.reason===dw.SHUTDOWN);Ds.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 b1;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new v8(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 ee(a,1,a,11)});const r=new b1;r.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new v8(n.lineCount,r))}}catch{}}};C1=zT([VT(0,Uc)],C1);Wl(Q6,C1,1);class jT{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 dg=class dg{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${dg._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=l3(r.command.title.trim());if(r.command.id){const d=`c${dg._idPool++}`;i.push(li("a",{id:d,title:r.command.tooltip,role:"button"},...a)),this._commands.set(d,r.command)}else i.push(li("span",{title:r.command.tooltip},...a));s+1<e.length&&i.push(li("span",void 0," | "))}}n?(tm(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):tm(this._domNode,li("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}};dg._idPool=0;let E1=dg;class Ub{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 b8=fn.register({collapseOnReplaceEdit:!0,description:"codelens"});class C8{constructor(e,t,i,n,s,r){this._isDisposed=!1,this._editor=t,this._data=e,this._decorationIds=[];let a;const d=[];this._data.forEach((u,f)=>{u.symbol.command&&d.push(u.symbol),i.addDecoration({range:u.symbol.range,options:b8},g=>this._decorationIds[f]=g),a?a=ee.plusRange(a,u.symbol.range):a=ee.lift(u.symbol.range)}),this._viewZone=new jT(a.startLineNumber-1,s,r),this._viewZoneId=n.addZone(this._viewZone),d.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(d,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new E1(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&&ee.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:b8},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 $T=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},vf=function(o,e){return function(t,i){e(t,i,o)}},i0;let Bg=(i0=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 Bt,this._localToDispose=new Bt,this._lenses=[],this._oldCodeLensModels=new Bt,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new As(()=>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",uw.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&&hg(()=>{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 As(()=>{var s;const n=Date.now();(s=this._getCodeLensModelPromise)==null||s.cancel(),this._getCodeLensModelPromise=Ws(r=>Y6(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(Zn(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{var n;this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{const a=[];let d=-1;this._lenses.forEach(f=>{!f.isValid()||d===f.getLineNumber()?a.push(f):(f.update(r),d=f.getLineNumber())});const u=new Ub;a.forEach(f=>{f.dispose(u,r),this._lenses.splice(this._lenses.indexOf(f),1)}),u.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(Zn(()=>{if(this._editor.getModel()){const n=x0.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(d=>this._notificationService.error(d));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new Ub;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 d=a.symbol.range.startLineNumber;d<1||d>t||(n&&n[n.length-1].symbol.range.startLineNumber===d?n.push(a):(n=[a],i.push(n)))}if(!i.length&&!this._lenses.length)return;const s=x0.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(d=>{const u=new Ub;let f=0,g=0;for(;g<i.length&&f<this._lenses.length;){const p=i[g][0].symbol.range.startLineNumber,C=this._lenses[f].getLineNumber();C<p?(this._lenses[f].dispose(u,d),this._lenses.splice(f,1)):C===p?(this._lenses[f].updateCodeLensSymbols(i[g],u),g++,f++):(this._lenses.splice(f,0,new C8(i[g],this._editor,u,d,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),f++,g++)}for(;f<this._lenses.length;)this._lenses[f].dispose(u,d),this._lenses.splice(f,1);for(;g<i.length;)this._lenses.push(new C8(i[g],this._editor,u,d,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),g++;u.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 d=a.computeIfNecessary(e);d&&(t.push(d),i.push(a))}),t.length===0)return;const n=Date.now(),s=Ws(a=>{const d=t.map((u,f)=>{const g=new Array(u.length),p=u.map((C,b)=>!C.symbol.command&&typeof C.provider.resolveCodeLens=="function"?Promise.resolve(C.provider.resolveCodeLens(e,C.symbol,a)).then(E=>{g[b]=E},hs):(g[b]=C.symbol,Promise.resolve(void 0)));return Promise.all(p).then(()=>{!a.isCancellationRequested&&!i[f].isDisposed()&&i[f].updateCommands(g)})});return Promise.all(d)});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}},i0.ID="css.editor.codeLens",i0);Bg=$T([vf(1,xi),vf(2,fr),vf(3,Rs),vf(4,go),vf(5,Q6)],Bg);on(Bg.ID,Bg,1);Ae(class extends gt{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:U.hasCodeLensProvider,label:S("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(Ol),n=e.get(Rs),s=e.get(go),r=t.getSelection().positionLineNumber,a=t.getContribution(Bg.ID);if(!a)return;const d=await a.getModel();if(!d)return;const u=[];for(const p of d.lenses)p.symbol.command&&p.symbol.range.startLineNumber===r&&u.push({label:p.symbol.command.title,command:p.symbol.command});if(u.length===0)return;const f=await i.pick(u,{canPickMany:!1,placeHolder:S("placeHolder","Select a command")});if(!f)return;let g=f.command;if(d.isDisposed){const p=await a.getModel(),C=p==null?void 0:p.lenses.find(b=>{var E;return b.symbol.range.startLineNumber===r&&((E=b.symbol.command)==null?void 0:E.title)===g.title});if(!C||!C.symbol.command)return;g=C.symbol.command}try{await n.executeCommand(g.id,...g.arguments||[])}catch(p){s.error(p)}}});var J6=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},y1=function(o,e){return function(t,i){e(t,i,o)}};let Fg=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 dn(new m0(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),d=r?dn.Format.CSS.formatRGB(a):dn.Format.CSS.formatRGBA(a),u=r?dn.Format.CSS.formatHSL(a):dn.Format.CSS.formatHSLA(a),f=r?dn.Format.CSS.formatHex(a):dn.Format.CSS.formatHexA(a),g=[];return g.push({label:d,textEdit:{range:n,text:d}}),g.push({label:u,textEdit:{range:n,text:u}}),g.push({label:f,textEdit:{range:n,text:f}}),g}};Fg=J6([y1(0,zl)],Fg);let w1=class extends Pt{constructor(e,t){super(),this._register(e.colorProvider.register("*",new Fg(t)))}};w1=J6([y1(0,xi),y1(1,zl)],w1);U0(w1);async function e5(o,e,t,i=!0){return Qw(new UT,o,e,t,i)}function t5(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class UT{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 qT{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 GT{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,sn.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function Qw(o,e,t,i,n){let s=!1,r;const a=[],d=e.ordered(t);for(let u=d.length-1;u>=0;u--){const f=d[u];if(f instanceof Fg)r=f;else try{await o.compute(f,t,i,a)&&(s=!0)}catch(g){hs(g)}}return s?a:r&&n?(await o.compute(r,t,i,a),a):[]}function i5(o,e){const{colorProvider:t}=o.get(xi),i=o.get(po).getModel(e);if(!i)throw El();const n=o.get(Yn).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}Un.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof Rn))throw El();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:s}=i5(o,t);return Qw(new qT,n,i,sn.None,s)});Un.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof Rn)||!Array.isArray(t)||t.length!==4||!ee.isIRange(s))throw El();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:d}=i5(o,n),[u,f,g,p]=t;return Qw(new GT({range:s,color:{red:u,green:f,blue:g,alpha:p}}),a,r,sn.None,d)});var KT=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},qb=function(o,e){return function(t,i){e(t,i,o)}},S1;const n5=Object.create({});var Cc;let B0=(Cc=class extends Pt{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new Bt),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new KA(this._editor),this._decoratorLimitReporter=new ZT,this._colorDecorationClassRefs=this._register(new Bt),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:S1.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),d=s.hasChanged(148);(a||d)&&(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 dp,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=Ws(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Ro(!1),n=await e5(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:fn.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:d,alpha:u}=e[s].colorInfo.color,f=new m0(Math.round(r*255),Math.round(a*255),Math.round(d*255),u),g=`rgba(${f.r}, ${f.g}, ${f.b}, ${f.a})`,p=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:g}));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:$A,inlineClassName:`${p.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:n5}}})}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(ee.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)}},S1=Cc,Cc.ID="editor.contrib.colorDetector",Cc.RECOMPUTE_TIME=1e3,Cc);B0=S1=KT([qb(1,Yn),qb(2,xi),qb(3,fr)],B0);class ZT{constructor(){this._onDidChange=new nn,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}on(B0.ID,B0,1);class XT{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 nn,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new nn,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new nn,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 Ko=li;class YT extends Pt{constructor(e,t,i,n=!1){super(),this.model=t,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=Ko(".colorpicker-header"),ti(e,this._domNode),this._pickedColorNode=ti(this._domNode,Ko(".picked-color")),ti(this._pickedColorNode,Ko("span.codicon.codicon-color-mode")),this._pickedColorPresentation=ti(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const s=S("clickToToggleColorOptions","Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",s),this._originalColorNode=ti(this._domNode,Ko(".original-color")),this._originalColorNode.style.backgroundColor=dn.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(pS)||dn.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor(pS)||dn.white})),this._register(Cn(this._pickedColorNode,is.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Cn(this._originalColorNode,is.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=dn.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 QT(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=dn.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 QT extends Pt{constructor(e){super(),this._onClicked=this._register(new nn),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),ti(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),ti(this._button,t),ti(t,Ko(".button"+Dn.asCSSSelector(ds("color-picker-close",Ui.close,S("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(Cn(this._button,is.CLICK,()=>{this._onClicked.fire()}))}}class JT extends Pt{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=Ko(".colorpicker-body"),ti(e,this._domNode),this._saturationBox=new eM(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 tM(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 iM(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 nM(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 dn(new Ax(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new dn(new Ax(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new dn(new Ax(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 eM extends Pt{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new nn,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new nn,this.onColorFlushed=this._onColorFlushed.event,this._domNode=Ko(".saturation-wrap"),ti(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",ti(this._domNode,this._canvas),this.selection=Ko(".saturation-selection"),ti(this._domNode,this.selection),this.layout(),this._register(Cn(this._domNode,is.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 ZA);const t=bo(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=Cn(e.target.ownerDocument,is.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 dn(new Ax(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=dn.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 s5 extends Pt{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new nn,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new nn,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=ti(e,Ko(".standalone-strip")),this.overlay=ti(this.domNode,Ko(".standalone-overlay"))):(this.domNode=ti(e,Ko(".strip")),this.overlay=ti(this.domNode,Ko(".overlay"))),this.slider=ti(this.domNode,Ko(".slider")),this.slider.style.top="0px",this._register(Cn(this.domNode,is.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 ZA),i=bo(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=Cn(e.target.ownerDocument,is.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 tM extends s5{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 dn(new m0(t,i,n,1)),r=new dn(new m0(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class iM extends s5{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class nM extends Pt{constructor(e){super(),this._onClicked=this._register(new nn),this.onClicked=this._onClicked.event,this._button=ti(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(Cn(this._button,is.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class sM extends gp{constructor(e,t,i,n,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(c3.getInstance(Ed(e)).onDidChange(()=>this.layout())),this._domNode=Ko(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new YT(this._domNode,this.model,n,s)),this.body=this._register(new JT(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class Gb{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 Ox{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 Lu{constructor(e){this.renderedHoverParts=e}dispose(){for(const e of this.renderedHoverParts)e.dispose()}}const Uu=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};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},r5=function(o,e){return function(t,i){e(t,i,o)}};class oM{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 Lg=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return aa.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=B0.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 a5(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){const i=l5(this,this._editor,this._themeService,t,e);if(!i)return new Lu([]);this._colorPicker=i.colorPicker;const n={hoverPart:i.hoverPart,hoverElement:this._colorPicker.domNode,dispose(){i.disposables.dispose()}};return new Lu([n])}handleResize(){var e;(e=this._colorPicker)==null||e.layout()}isColorPickerVisible(){return!!this._colorPicker}};Lg=o5([r5(1,$r)],Lg);class rM{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let Ig=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!B0.get(this._editor))return null;const s=await e5(i,this._editor.getModel(),sn.None);let r=null,a=null;for(const g of s){const p=g.colorInfo;ee.containsRange(p.range,e.range)&&(r=p,a=g.provider)}const d=r??e,u=a??t,f=!!r;return{colorHover:await a5(this,this._editor.getModel(),d,u),foundInEditor:f}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new ee(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await Hx(this._editor.getModel(),t,this._color,i,e),i=c5(this._editor,i,t))}renderHoverParts(e,t){return l5(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};Ig=o5([r5(1,$r)],Ig);async function a5(o,e,t,i){const n=e.getValueInRange(t.range),{red:s,green:r,blue:a,alpha:d}=t.color,u=new m0(Math.round(s*255),Math.round(r*255),Math.round(a*255),d),f=new dn(u),g=await t5(e,t,i,sn.None),p=new XT(f,[],0);return p.colorPresentations=g||[],p.guessColorPresentation(f,n),o instanceof Lg?new oM(o,ee.lift(t.range),p,i):new rM(o,ee.lift(t.range),p,i)}function l5(o,e,t,i,n){if(i.length===0||!e.hasModel())return;if(n.setMinimumDimensions){const p=e.getOption(67)+8;n.setMinimumDimensions(new Vn(302,p))}const s=new Bt,r=i[0],a=e.getModel(),d=r.model,u=s.add(new sM(n.fragment,d,e.getOption(144),t,o instanceof Ig));let f=!1,g=new ee(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(o instanceof Ig){const p=r.model.color;o.color=p,Hx(a,d,p,g,r),s.add(d.onColorFlushed(C=>{o.color=C}))}else s.add(d.onColorFlushed(async p=>{await Hx(a,d,p,g,r),f=!0,g=c5(e,g,d)}));return s.add(d.onDidChangeColor(p=>{Hx(a,d,p,g,r)})),s.add(e.onDidChangeModelContent(p=>{f?f=!1:(n.hide(),e.focus())})),{hoverPart:r,colorPicker:u,disposables:s}}function c5(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=ee.lift(n.range),r=o.getModel()._setTrackedRange(null,s,3);return o.executeEdits("colorpicker",i),o.pushUndoStop(),o.getModel()._getTrackedRange(r)??s}async function Hx(o,e,t,i,n){const s=await t5(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,sn.None);e.colorPresentations=s||[]}const d5="editor.action.showHover",aM="editor.action.showDefinitionPreviewHover",lM="editor.action.scrollUpHover",cM="editor.action.scrollDownHover",dM="editor.action.scrollLeftHover",uM="editor.action.scrollRightHover",hM="editor.action.pageUpHover",fM="editor.action.pageDownHover",gM="editor.action.goToTopHover",pM="editor.action.goToBottomHover",Uv="editor.action.increaseHoverVerbosityLevel",xM=S({key:"increaseHoverVerbosityLevel",comment:["Label for action that will increase the hover verbosity level."]},"Increase Hover Verbosity Level"),qv="editor.action.decreaseHoverVerbosityLevel",mM=S({key:"decreaseHoverVerbosityLevel",comment:["Label for action that will decrease the hover verbosity level."]},"Decrease Hover Verbosity Level"),u5="editor.action.inlineSuggest.commit",h5="editor.action.inlineSuggest.showPrevious",f5="editor.action.inlineSuggest.showNext";var Jw=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},Pr=function(o,e){return function(t,i){e(t,i,o)}},Wx;let D1=class extends Pt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Fo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=In(this,n=>{var d,u;const s=(d=this.model.read(n))==null?void 0:d.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 pi(s.lineNumber,Math.min(r,((u=this.sessionPosition)==null?void 0:u.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(pp((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=JA((u,f)=>{const g=f.add(this.instantiationService.createInstance(F0,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands));return e.addContentWidget(g),f.add(Zn(()=>e.removeContentWidget(g))),f.add(ts(p=>{this.position.read(p)&&r.lastTriggerKind.read(p)!==yl.Explicit&&r.triggerExplicitly()})),g}),d=Ev(this,(u,f)=>!!this.position.read(u)||!!f);s.add(ts(u=>{d.read(u)&&a.read(u)}))}))}};D1=Jw([Pr(2,Qi)],D1);const _M=ds("inline-suggestion-hints-next",Ui.chevronRight,S("parameterHintsNextIcon","Icon for show next parameter hint.")),vM=ds("inline-suggestion-hints-previous",Ui.chevronLeft,S("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var Ec;let F0=(Ec=class extends Pt{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new _0(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let r=t;return s&&(r=S({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",t,s.getLabel())),n.tooltip=r,n}constructor(e,t,i,n,s,r,a,d,u,f,g){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=n,this._suggestionCount=s,this._extraCommands=r,this._commandService=a,this.keybindingService=u,this._contextKeyService=f,this._menuService=g,this.id=`InlineSuggestionHintsContentWidget${Wx.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Tr("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Tr("div@toolBar")]),this.previousAction=this.createCommandAction(h5,S("previous","Previous"),Dn.asClassName(vM)),this.availableSuggestionCountAction=new _0("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(f5,S("next","Next"),Dn.asClassName(_M)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(Yt.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new As(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new As(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(d.createInstance(A1,this.nodes.toolBar,Yt.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:p=>p.startsWith("primary")},actionViewItemProvider:(p,C)=>{if(p instanceof v0)return d.createInstance(CM,p,void 0);if(p===this.availableSuggestionCountAction){const b=new bM(void 0,p,{label:!0,icon:!1});return b.setClass("availableSuggestionCount"),b}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(p=>{Wx._dropDownVisible=p})),this._register(ts(p=>{this._position.read(p),this.editor.layoutContentWidget(this)})),this._register(ts(p=>{const C=this._suggestionCount.read(p),b=this._currentSuggestionIdx.read(p);C!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${b+1}/${C}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),C!==void 0&&C>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(ts(p=>{const b=this._extraCommands.read(p).map(E=>({class:void 0,id:E.id,enabled:!0,tooltip:E.tooltip||"",label:E.title,run:y=>this._commandService.executeCommand(E.id)}));for(const[E,y]of this.inlineCompletionsActionsMenus.getActions())for(const D of y)D instanceof v0&&b.push(D);b.length>0&&b.unshift(new xg),this.toolBar.setAdditionalSecondaryActions(b)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},Wx=Ec,Ec._dropDownVisible=!1,Ec.id=0,Ec);F0=Wx=Jw([Pr(6,Rs),Pr(7,Qi),Pr(8,ms),Pr(9,En),Pr(10,Hu)],F0);class bM extends BC{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 CM=class extends XA{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Tr("div.keybinding").root;this._register(new ow(t,rw,{disableTitle:!0,...YA})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},A1=class extends QA{constructor(e,t,i,n,s,r,a,d,u){super(e,{resetMenu:t,...i},n,s,r,a,d,u),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,d,u;const e=[],t=[];hw(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,(u=(d=this.options2)==null?void 0:d.toolbarOptions)==null?void 0:u.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){Xa(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){Xa(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};A1=Jw([Pr(3,Hu),Pr(4,En),Pr(5,V0),Pr(6,ms),Pr(7,Rs),Pr(8,pa)],A1);function Gv(o,e,t){const i=bo(o);return!(e<i.left||e>i.left+i.width||t<i.top||t>i.top+i.height)}let EM=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class g5 extends Pt{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new nn),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new As(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new As(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new As(()=>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=d3(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 EM(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 e9{constructor(){this._onDidWillResize=new nn,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new nn,this.onDidResize=this._onDidResize.event,this._sashListener=new Bt,this._size=new Vn(0,0),this._minSize=new Vn(0,0),this._maxSize=new Vn(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new Sh(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new Sh(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new Sh(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:xS.North}),this._southSash=new Sh(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:xS.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(Ds.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(Ds.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(Ds.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(Ds.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 Vn(t,e);Vn.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 yM=30,wM=24;class SM extends Pt{constructor(e,t=new Vn(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new e9),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=Vn.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 Vn(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?pi.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:bo(t).top+i.top-yM}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=bo(t),s=xp(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-wM}_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 DM=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},Qp=function(o,e){return function(t,i){e(t,i,o)}},Ba;const E8=30,AM=6;var yc;let k1=(yc=class extends SM{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,d=new Vn(a,r);super(e,d),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new e2),this._onDidResize=this._register(new nn),this.onDidResize=this._onDidResize.event,this._minimumSize=d,this._hoverVisibleKey=U.hoverVisible.bindTo(t),this._hoverFocusedKey=U.hoverFocused.bindTo(t),ti(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(f=>{f.hasChanged(50)&&this._updateFont()}));const u=this._register(g0(this._resizableNode.domNode));this._register(u.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(u.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 Ba.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 Ba._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return Ba._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){Ba._applyMaxDimensions(this._hover.contentsDomNode,e,t),Ba._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 Vn(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){Ba._lastDimensions=new Vn(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=AM;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?xp(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=bo(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=y8(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,i.left,i.top,i.width,i.height));const n=y8(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,Ba._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,Ba._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=Dh(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&&u3(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 Vn(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 Vn(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 Vn(e,this._minimumSize.height)}onContentsChanged(){var n;this._removeConstraintsRenderNormally();const e=this._hover.containerDomNode;let t=Dh(e),i=Ar(e);if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=Dh(e),i=Ar(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),(n=this._renderedHover)!=null&&n.showAtPosition){const s=Dh(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-E8})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+E8})}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})}},Ba=yc,yc.ID="editor.contrib.resizableContentHoverWidget",yc._lastDimensions=new Vn(0,0),yc);k1=Ba=DM([Qp(1,En),Qp(2,Yn),Qp(3,yv),Qp(4,ms)],k1);function y8(o,e,t,i,n,s){const r=t+n/2,a=i+s/2,d=Math.max(Math.abs(o-r)-n/2,0),u=Math.max(Math.abs(e-a)-s/2,0);return Math.sqrt(d*d+u*u)}class Em{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,d=r.range.endLineNumber===n?r.range.endColumn:s;if(r.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>d)return!1}else if(a>t.range.startColumn||t.range.endColumn>d)return!1;return!0})}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return aa.EMPTY;const i=Em._getLineDecorations(this._editor,t);return aa.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):aa.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=Em._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return Al(t)}}class p5{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 kM(this,this.anchor,t,this.isComplete)}}class kM extends p5{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}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},FM=function(o,e){return function(t,i){e(t,i,o)}};const w8=li;let ym=class extends Pt{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this.actions=[],this._hasContent=!1,this.hoverElement=w8("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=ti(this.hoverElement,w8("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const n=this._register(h3.render(this.actionsElement,e,i));return this.actions.push(n),n}append(e){const t=ti(this.actionsElement,e);return this._hasContent=!0,t}};ym=BM([FM(0,ms)],ym);class LM{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function IM(o,e,t,i,n){const s=await Promise.resolve(o.provideHover(t,i,n)).catch(hs);if(!(!s||!PM(s)))return new LM(o,s,e)}function t9(o,e,t,i,n=!1){const r=o.ordered(e,n).map((a,d)=>IM(a,d,e,t,i));return aa.fromPromises(r).coalesce()}function x5(o,e,t,i,n=!1){return t9(o,e,t,i,n).map(s=>s.hover).toPromise()}So("_executeHoverProvider",(o,e,t)=>{const i=o.get(xi);return x5(i.hoverProvider,e,t,sn.None)});So("_executeHoverProvider_recursive",(o,e,t)=>{const i=o.get(xi);return x5(i.hoverProvider,e,t,sn.None,!0)});function PM(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}var TM=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},Qc=function(o,e){return function(t,i){e(t,i,o)}};const Lh=li,MM=ds("hover-increase-verbosity",Ui.add,S("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),RM=ds("hover-decrease-verbosity",Ui.remove,S("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class Rr{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 m5{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case cr.Increase:return this.hover.canIncreaseVerbosity??!1;case cr.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let Pg=class{constructor(e,t,i,n,s,r,a,d){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=n,this._languageFeaturesService=s,this._keybindingService=r,this._hoverService=a,this._commandService=d,this.hoverOrdinal=3}createLoadingMessage(e){return new Rr(this,e.range,[new oo().appendText(S("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 d=i.getLineLength(n),u=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),f=this._editor.getOption(118),g=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:u});let p=!1;f>=0&&d>f&&e.range.startColumn>=f&&(p=!0,r.push(new Rr(this,e.range,[{value:S("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!p&&typeof g=="number"&&d>=g&&r.push(new Rr(this,e.range,[{value:S("too many characters","Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let C=!1;for(const b of t){const E=b.range.startLineNumber===n?b.range.startColumn:1,y=b.range.endLineNumber===n?b.range.endColumn:s,D=b.options.hoverMessage;if(!D||mg(D))continue;b.options.beforeContentClassName&&(C=!0);const I=new ee(e.range.startLineNumber,E,e.range.startLineNumber,y);r.push(new Rr(this,I,t2(D),C,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return aa.EMPTY;const n=this._editor.getModel(),s=this._languageFeaturesService.hoverProvider;return s.has(n)?this._getMarkdownHovers(s,n,e,i):aa.EMPTY}_getMarkdownHovers(e,t,i,n){const s=i.range.getStartPosition();return t9(e,t,s,n).filter(d=>!mg(d.hover.contents)).map(d=>{const u=d.hover.range?ee.lift(d.hover.range):i.range,f=new m5(d.hover,d.provider,s);return new Rr(this,u,d.hover.contents,!1,d.ordinal,f)})}renderHoverParts(e,t){return this._renderedHoverParts=new NM(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))}};Pg=TM([Qc(1,xa),Qc(2,ga),Qc(3,Yn),Qc(4,xi),Qc(5,ms),Qc(6,mp),Qc(7,Rs)],Pg);class Jp{constructor(e,t,i){this.hoverPart=e,this.hoverElement=t,this.disposables=i}dispose(){this.disposables.dispose()}}class NM{constructor(e,t,i,n,s,r,a,d,u,f,g){this._hoverParticipant=i,this._editor=n,this._languageService=s,this._openerService=r,this._commandService=a,this._keybindingService=d,this._hoverService=u,this._configurationService=f,this._onFinishedRendering=g,this._ongoingHoverOperations=new Map,this._disposables=new Bt,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(Zn(()=>{this.renderedHoverParts.forEach(p=>{p.dispose()}),this._ongoingHoverOperations.forEach(p=>{p.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort(_p(n=>n.ordinal,wv)),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 Bt;if(r.add(i),!s)return new Jp(e,n,r);const a=s.supportsVerbosityAction(cr.Increase),d=s.supportsVerbosityAction(cr.Decrease);if(!a&&!d)return new Jp(e,n,r);const u=Lh("div.verbosity-actions");return n.prepend(u),r.add(this._renderHoverExpansionAction(u,cr.Increase,a)),r.add(this._renderHoverExpansionAction(u,cr.Decrease,d)),new Jp(e,n,r)}_renderMarkdownHover(e,t){return _5(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const n=new Bt,s=t===cr.Increase,r=ti(e,Lh(Dn.asCSSSelector(s?MM:RM)));r.tabIndex=0;const a=new f3("mouse",!1,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(n.add(this._hoverService.setupManagedHover(a,r,HM(this._keybindingService,t))),!i)return r.classList.add("disabled"),n;r.classList.add("enabled");const d=()=>this._commandService.executeCommand(t===cr.Increase?Uv:qv);return n.add(new g3(r,d)),n.add(new p3(r,d,[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 d=new m5(a,r.hoverProvider,r.hoverPosition),u=s.hoverPart,f=new Rr(this._hoverParticipant,u.range,a.contents,u.isBeforeContent,u.ordinal,d),g=this._renderHoverPart(f,this._onFinishedRendering);return this._replaceRenderedHoverPartAtIndex(t,g,f),i&&this._focusOnHoverPartWithIndex(t),{hoverPart:f,hoverElement:g.hoverElement}}async _fetchHover(e,t,i){let n=i===cr.Increase?1:-1;const s=e.hoverProvider,r=this._ongoingHoverOperations.get(s);r&&(r.tokenSource.cancel(),n+=r.verbosityDelta);const a=new zs;this._ongoingHoverOperations.set(s,{verbosityDelta:n,tokenSource:a});const d={verbosityRequest:{verbosityDelta:n,previousHover:e.hover}};let u;try{u=await Promise.resolve(s.provideHover(t,e.hoverPosition,a.token,d))}catch(f){hs(f)}return a.dispose(),this._ongoingHoverOperations.delete(s),u}_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 d=new Jp(i,s,t.disposables);s.focus(),n.dispose(),this.renderedHoverParts[e]=d}_focusOnHoverPartWithIndex(e){this.renderedHoverParts[e].hoverElement.focus()}_getRenderedHoverPartAtIndex(e){return this.renderedHoverParts[e]}dispose(){this._disposables.dispose()}}function OM(o,e,t,i,n){e.sort(_p(r=>r.ordinal,wv));const s=[];for(const r of e)s.push(_5(t,r,i,n,o.onContentsChanged));return new Lu(s)}function _5(o,e,t,i,n){const s=new Bt,r=Lh("div.hover-row"),a=Lh("div.hover-row-contents");r.appendChild(a);const d=e.contents;for(const f of d){if(mg(f))continue;const g=Lh("div.markdown-hover"),p=ti(g,Lh("div.hover-contents")),C=s.add(new q0({editor:o},t,i));s.add(C.onDidRenderAsync(()=>{p.className="hover-contents code-hover-contents",n()}));const b=s.add(C.render(f));p.appendChild(b.element),a.appendChild(g)}return{hoverPart:e,hoverElement:r,dispose(){s.dispose()}}}function HM(o,e){switch(e){case cr.Increase:{const t=o.lookupKeybinding(Uv);return t?S("increaseVerbosityWithKb","Increase Hover Verbosity ({0})",t.getLabel()):S("increaseVerbosity","Increase Hover Verbosity")}case cr.Decrease:{const t=o.lookupKeybinding(qv);return t?S("decreaseVerbosityWithKb","Decrease Hover Verbosity ({0})",t.getLabel()):S("decreaseVerbosity","Decrease Hover Verbosity")}}}function B1(o,e){return!!o[e]}class Kb{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=B1(e.event,t.triggerModifier),this.hasSideBySideModifier=B1(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class S8{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=B1(e,t.triggerModifier)}}class ex{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 D8(o){return o==="altKey"?Ya?new ex(57,"metaKey",6,"altKey"):new ex(5,"ctrlKey",6,"altKey"):Ya?new ex(6,"altKey",57,"metaKey"):new ex(6,"altKey",5,"ctrlKey")}class Kv extends Pt{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new nn),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new nn),this.onExecute=this._onExecute.event,this._onCancel=this._register(new nn),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=D8(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=D8(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 Kb(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new Kb(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new Kb(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new S8(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new S8(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 v5{constructor(e,t){this.range=e,this.direction=t}}class i9{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new i9(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){hs(t),this._isResolved=!1}}}const Oh=class Oh{static async create(e,t,i,n){const s=[],r=e.ordered(t).reverse().map(a=>i.map(async d=>{try{const u=await a.provideInlayHints(t,d,n);(u!=null&&u.hints.length||a.onDidChangeInlayHints)&&s.push([u??Oh._emptyInlayHintList,a])}catch(u){hs(u)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new _v;return new Oh(i,s,t)}constructor(e,t,i){this._disposables=new Bt,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 d=i.validatePosition(a.position);let u="before";const f=Oh._getRangeAtPosition(i,d);let g;f.getStartPosition().isBefore(d)?(g=ee.fromPositions(f.getStartPosition(),d),u="after"):(g=ee.fromPositions(d,f.getEndPosition()),u="before"),n.push(new i9(a,new v5(g,u),r))}}this.items=n.sort((s,r)=>pi.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 ee(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 d=s.getStartOffset(a),u=s.getEndOffset(a);return u-d===1&&(d===r&&a>1?(d=s.getStartOffset(a-1),u=s.getEndOffset(a-1)):u===r&&a<s.getCount()-1&&(d=s.getStartOffset(a+1),u=s.getEndOffset(a+1))),new ee(i,d+1,i,u+1)}};Oh._emptyInlayHintList=Object.freeze({dispose(){},hints:[]});let wm=Oh;function WM(o){return Rn.from({scheme:mo.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()}var zM=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},rl=function(o,e){return function(t,i){e(t,i,o)}};let jr=class extends x3{constructor(e,t,i,n,s,r,a,d,u,f,g,p,C){super(e,{...n.getRawOptions(),overflowWidgetsDomNode:n.getOverflowWidgetsDomNode()},i,s,r,a,d,u,f,g,p,C),this._parentEditor=n,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(n.onDidChangeConfiguration(b=>this._onParentConfigurationChanged(b)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){fw(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};jr=zM([rl(4,Qi),rl(5,fs),rl(6,Rs),rl(7,En),rl(8,$r),rl(9,go),rl(10,yv),rl(11,Ns),rl(12,xi)],jr);const A8=new dn(new m0(0,122,204)),VM={showArrow:!0,showFrame:!0,className:"",frameColor:A8,arrowColor:A8,keepEditorSelection:!1},jM="vs.editor.contrib.zoneWidget";class $M{constructor(e,t,i,n,s,r,a,d){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=n,this.showInHiddenAreas=a,this.ordinal=d,this._onDomNodeTop=s,this._onComputedHeight=r}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class UM{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}const F_=class F_{constructor(e){this._editor=e,this._ruleName=F_._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),mS(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(){mS(this._ruleName),v3(`.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:ee.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};F_._IdGenerator=new _3(".arrow-decoration-");let F1=F_;class qM{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Bt,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=m3(t),fw(this.options,VM,!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 F1(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=ee.isIRange(e)?ee.lift(e):ee.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:fn.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 p=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,p)}let d=0,u=0;if(this._arrow&&this.options.showArrow&&(d=Math.round(a/3),this._arrow.height=d,this._arrow.show(i)),this.options.showFrame&&(u=Math.round(a/9)),this.editor.changeViewZones(p=>{this._viewZone&&p.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new $M(r,i.lineNumber,i.column,t,C=>this._onViewZoneTop(C),C=>this._onViewZoneHeight(C),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=p.addZone(this._viewZone),this._overlayWidget=new UM(jM+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const p=this.options.frameWidth?this.options.frameWidth:u;this.container.style.borderTopWidth=p+"px",this.container.style.borderBottomWidth=p+"px"}const f=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=d+"px",this.container.style.height=f+"px",this.container.style.overflow="hidden"),this._doLayout(f,s),this.options.keepEditorSelection||this.editor.setSelection(e);const g=this.editor.getModel();if(g){const p=g.validateRange(new ee(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(p,p.startLineNumber===g.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 Sh(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 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},C5=function(o,e){return function(t,i){e(t,i,o)}};const E5=Hl("IPeekViewService");Wl(E5,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 Co;(function(o){o.inPeekEditor=new xn("inReferenceSearchEditor",!0,S("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(Co||(Co={}));var n0;let Sm=(n0=class{constructor(e,t){e instanceof jr&&Co.inPeekEditor.bindTo(t)}dispose(){}},n0.ID="editor.contrib.referenceController",n0);Sm=b5([C5(1,En)],Sm);on(Sm.ID,Sm,0);function GM(o){const e=o.get(fs).getFocusedCodeEditor();return e instanceof jr?e.getParentEditor():e}const KM={headerBackgroundColor:dn.white,primaryHeadingColor:dn.fromHex("#333333"),secondaryHeadingColor:dn.fromHex("#6c6c6cb3")};let Dm=class extends qM{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new nn,this.onDidClose=this._onDidClose.event,fw(this.options,KM,!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=li(".head"),this._bodyElement=li(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=li(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Bl(this._titleElement,"click",s=>this._onTitleClick(s))),ti(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=li("span.filename"),this._secondaryHeading=li("span.dirname"),this._metaHeading=li("span.meta"),ti(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=li(".peekview-actions");ti(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new fg(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new _0("peekview.close",S("label.close","Close"),Dn.asClassName(Ui.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:b3.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:Ga(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Mr(this._metaHeading)):Uo(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`)}};Dm=b5([C5(2,Qi)],Dm);const ZM=ci("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:dn.black,hcLight:dn.white},S("peekViewTitleBackground","Background color of the peek view title area.")),y5=ci("peekViewTitleLabel.foreground",{dark:dn.white,light:dn.black,hcDark:dn.white,hcLight:vp},S("peekViewTitleForeground","Color of the peek view title.")),w5=ci("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},S("peekViewTitleInfoForeground","Color of the peek view title info.")),XM=ci("peekView.border",{dark:FC,light:FC,hcDark:kl,hcLight:kl},S("peekViewBorder","Color of the peek view borders and arrow.")),YM=ci("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:dn.black,hcLight:dn.white},S("peekViewResultsBackground","Background color of the peek view result list."));ci("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:dn.white,hcLight:vp},S("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));ci("peekViewResult.fileForeground",{dark:dn.white,light:"#1E1E1E",hcDark:dn.white,hcLight:vp},S("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));ci("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},S("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));ci("peekViewResult.selectionForeground",{dark:dn.white,light:"#6C6C6C",hcDark:dn.white,hcLight:vp},S("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const S5=ci("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:dn.black,hcLight:dn.white},S("peekViewEditorBackground","Background color of the peek view editor."));ci("peekViewEditorGutter.background",S5,S("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));ci("peekViewEditorStickyScroll.background",S5,S("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));ci("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},S("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));ci("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},S("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));ci("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:vu,hcLight:vu},S("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class Wc{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=C3.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?S({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,Qa(this.uri),this.range.startLineNumber,this.range.startColumn):S("aria.oneReference","in {0} on line {1} at column {2}",Qa(this.uri),this.range.startLineNumber,this.range.startColumn)}}class QM{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,d=i.getWordUntilPosition({lineNumber:n,column:s-t}),u=new ee(n,d.startColumn,n,s),f=new ee(r,a,r,1073741824),g=i.getValueInRange(u).replace(/^\s+/,""),p=i.getValueInRange(e),C=i.getValueInRange(f).replace(/\s+$/,"");return{value:g+p+C,highlight:{start:g.length,end:g.length+p.length}}}}class Tg{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new Mc}dispose(){ao(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?S("aria.fileReferences.1","1 symbol in {0}, full path {1}",Qa(this.uri),this.uri.fsPath):S("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,Qa(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 QM(i))}catch(i){On(i)}return this}}class To{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new nn,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(To._compareReferences);let n;for(const s of e)if((!n||!_S.isEqual(n.uri,s.uri,!0))&&(n=new Tg(this,s.uri),this.groups.push(n)),n.children.length===0||To._compareReferences(s,n.children[n.children.length-1])!==0){const r=new Wc(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){ao(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new To(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?S("aria.result.0","No results found"):this.references.length===1?S("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?S("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):S("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:bp(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()&&ee.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 _S.compare(e.uri,t.uri)||ee.compareRangesUsingStarts(e.range,t.range)}}var Zv=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},Xv=function(o,e){return function(t,i){e(t,i,o)}},L1;let I1=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof To||e instanceof Tg}getChildren(e){if(e instanceof To)return e.groups;if(e instanceof Tg)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};I1=Zv([Xv(0,ma)],I1);class JM{getHeight(){return 23}getTemplateId(e){return e instanceof Tg?Am.id:km.id}}let P1=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof Wc){const i=(t=e.parent.getPreview(e))==null?void 0:t.preview(e.range);if(i)return i.value}return Qa(e.uri)}};P1=Zv([Xv(0,ms)],P1);class eR{getId(e){return e instanceof Wc?e.id:e.uri}}let T1=class extends Pt{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new i2(i,{supportHighlights:!0})),this.badge=new E3(ti(i,li(".count")),{},y3),e.appendChild(i)}set(e,t){const i=gw(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(S("referencesCount","{0} references",n)):this.badge.setTitleFormat(S("referenceCount","{0} reference",n))}};T1=Zv([Xv(1,_g)],T1);var Rd;let Am=(Rd=class{constructor(e){this._instantiationService=e,this.templateId=L1.id}renderTemplate(e){return this._instantiationService.createInstance(T1,e)}renderElement(e,t,i){i.set(e.element,Sv(e.filterData))}disposeTemplate(e){e.dispose()}},L1=Rd,Rd.id="FileReferencesRenderer",Rd);Am=L1=Zv([Xv(0,Qi)],Am);class tR extends Pt{constructor(e){super(),this.label=this._register(new w3(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(`${Qa(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:s,highlight:r}=i;t&&!vg.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(s,Sv(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(s,[r]))}}}const L_=class L_{constructor(){this.templateId=L_.id}renderTemplate(e){return new tR(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}};L_.id="OneReferenceRenderer";let km=L_;class iR{getWidgetAriaLabel(){return S("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var nR=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},oh=function(o,e){return function(t,i){e(t,i,o)}};const I_=class I_{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Bt,this._callOnModelChange=new Bt,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:I_.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(!ee.equalsRange(s,n.range)){if(ee.spansMultipleLines(s))r=!0;else{const a=n.range.endColumn-n.range.startColumn,d=s.endColumn-s.startColumn;a!==d&&(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()}};I_.DecorationOptions=fn.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});let M1=I_;class sR{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 oR extends A3{}let R1=class extends Dm{constructor(e,t,i,n,s,r,a,d,u){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=d,this._keybindingService=u,this._disposeOnNewModel=new Bt,this._callOnDispose=new Bt,this._onDidSelectReference=new nn,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new Vn(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(),ao(this._preview),ao(this._previewNotAvailableMessage),ao(this._tree),ao(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(XM)||dn.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(ZM)||dn.transparent,primaryHeadingColor:e.getColor(y5),secondaryHeadingColor:e.getColor(w5)})}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=ti(e,li("div.messages")),Uo(this._messageContainer),this._splitView=new S3(e,{orientation:1}),this._previewContainer=ti(e,li("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(jr,this._previewContainer,t,{},this.editor),Uo(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(lc,S("missingPreviewMessage","no preview available"),bg,lc.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=ti(e,li("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new iR,keyboardNavigationLabelProvider:this._instantiationService.createInstance(P1),identityProvider:new eR,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:YM}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Bl(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(oR,"ReferencesWidget",this._treeContainer,new JM,[this._instantiationService.createInstance(Am),this._instantiationService.createInstance(km)],this._instantiationService.createInstance(I1),i),this._splitView.addView({onDidChange:Ds.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},vS.Distribute),this._splitView.addView({onDidChange:Ds.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)}},vS.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 Wc&&(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")})),Uo(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new Vn(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=S("noResults","No results"),Mr(this._messageContainer),Promise.resolve(void 0)):(Uo(this._messageContainer),this._decorationsManager=new M1(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"),Mr(this._treeContainer),Mr(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 Wc)return e;if(e instanceof Tg&&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!==mo.inMemory?this.setTitle(D3(e.uri),this._uriLabel.getUriLabel(gw(e.uri))):this.setTitle(S("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}ao(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=ee.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()}};R1=nR([oh(3,$r),oh(4,ma),oh(5,Qi),oh(6,E5),oh(7,_g),oh(8,ms)],R1);var rR=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)}},zx;const qu=new xn("referenceSearchVisible",!1,S("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));var Nd;let Iu=(Nd=class{static get(e){return e.getContribution(zx.ID)}constructor(e,t,i,n,s,r,a,d){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=n,this._notificationService=s,this._instantiationService=r,this._storageService=a,this._configurationService=d,this._disposables=new Bt,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=qu.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=sR.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(R1,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(S("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(d=>{const{element:u,kind:f}=d;if(u)switch(f){case"open":(d.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(u,!1,!1);break;case"side":this.openReference(u,!0,!1);break;case"goto":i?this._gotoReference(u,!0):this.openReference(u,!1,!0);break}}));const a=++this._requestIdPool;t.then(d=>{var u;if(a!==this._requestIdPool||!this._widget){d.dispose();return}return(u=this._model)==null||u.dispose(),this._model=d,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(S("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const f=this._editor.getModel().uri,g=new pi(e.startLineNumber,e.startColumn),p=this._model.nearestReference(f,g);if(p)return this._widget.setSelection(p).then(()=>{this._widget&&this._editor.getOption(87)==="editor"&&this._widget.focusOnPreviewEditor()})}})},d=>{this._notificationService.error(d)})}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=ee.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=zx.get(s),a=this._model.clone();this.closeWidget(),s.focus(),r==null||r.toggleWidget(i,Ws(d=>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)}},zx=Nd,Nd.ID="editor.contrib.referencesController",Nd);Iu=zx=rR([rh(2,En),rh(3,fs),rh(4,go),rh(5,Qi),rh(6,Uc),rh(7,Yn)],Iu);function Gu(o,e){const t=GM(o);if(!t)return;const i=Iu.get(t);i&&e(i)}tl.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:xs(2089,60),when:$e.or(qu,Co.inPeekEditor),handler(o){Gu(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}});tl.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:$e.or(qu,Co.inPeekEditor),handler(o){Gu(o,e=>{e.goToNextOrPreviousReference(!0)})}});tl.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:$e.or(qu,Co.inPeekEditor),handler(o){Gu(o,e=>{e.goToNextOrPreviousReference(!1)})}});Un.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");Un.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");Un.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");Un.registerCommand("closeReferenceSearch",o=>Gu(o,e=>e.closeWidget()));tl.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:$e.and(Co.inPeekEditor,$e.not("config.editor.stablePeek"))});tl.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:$e.and(qu,$e.not("config.editor.stablePeek"),$e.or(U.editorTextFocus,k3.negate()))});tl.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:$e.and(qu,n2,s2.negate(),o2.negate()),handler(o){var i;const t=(i=o.get(pw).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Wc&&Gu(o,n=>n.revealReference(t[0]))}});tl.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:$e.and(qu,n2,s2.negate(),o2.negate()),handler(o){var i;const t=(i=o.get(pw).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Wc&&Gu(o,n=>n.openReference(t[0],!0,!0))}});Un.registerCommand("openReference",o=>{var i;const t=(i=o.get(pw).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Wc&&Gu(o,n=>n.openReference(t[0],!1,!0))});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},If=function(o,e){return function(t,i){e(t,i,o)}};const n9=new xn("hasSymbols",!1,S("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),Yv=Hl("ISymbolNavigationService");let N1=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=n9.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 O1(this._editorService),n=i.onDidChange(s=>{if(this._ignoreEditorChange)return;const r=this._editorService.getActiveCodeEditor();if(!r)return;const a=r.getModel(),d=r.getPosition();if(!a||!d)return;let u=!1,f=!1;for(const g of t.references)if(em(g.uri,a.uri))u=!0,f=f||ee.containsPosition(g.range,d);else if(u)break;(!u||!f)&&this.reset()});this._currentState=r2(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:ee.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?S("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):S("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};N1=D5([If(0,En),If(1,fs),If(2,go),If(3,ms)],N1);Wl(Yv,N1,1);yi(new class extends wo{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:n9,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(Yv).revealNext(e)}});tl.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:n9,primary:9,handler(o){o.get(Yv).reset()}});let O1=class{constructor(e){this._listener=new Map,this._disposables=new Bt,this._onDidChange=new nn,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(),ao(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,r2(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)}};O1=D5([If(0,fs)],O1);function H1(o,e){return e.uri.scheme===o.uri.scheme?!0:!B3(e.uri,mo.walkThroughSnippet,mo.vscodeChatCodeBlock,mo.vscodeChatCodeCompareBlock)}async function Ip(o,e,t,i,n){const r=t.ordered(o,i).map(d=>Promise.resolve(n(d,o,e)).then(void 0,u=>{hs(u)})),a=await Promise.all(r);return Al(a.flat()).filter(d=>H1(o,d))}function Pp(o,e,t,i,n){return Ip(e,t,o,i,(s,r,a)=>s.provideDefinition(r,a,n))}function s9(o,e,t,i,n){return Ip(e,t,o,i,(s,r,a)=>s.provideDeclaration(r,a,n))}function o9(o,e,t,i,n){return Ip(e,t,o,i,(s,r,a)=>s.provideImplementation(r,a,n))}function r9(o,e,t,i,n){return Ip(e,t,o,i,(s,r,a)=>s.provideTypeDefinition(r,a,n))}function Tp(o,e,t,i,n,s){return Ip(e,t,o,n,async(r,a,d)=>{var g,p;const u=(g=await r.provideReferences(a,d,{includeDeclaration:!0},s))==null?void 0:g.filter(C=>H1(a,C));if(!i||!u||u.length!==2)return u;const f=(p=await r.provideReferences(a,d,{includeDeclaration:!1},s))==null?void 0:p.filter(C=>H1(a,C));return f&&f.length===1?f:u})}async function il(o){const e=await o(),t=new To(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}So("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(xi),n=Pp(i.definitionProvider,e,t,!1,sn.None);return il(()=>n)});So("_executeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(xi),n=Pp(i.definitionProvider,e,t,!0,sn.None);return il(()=>n)});So("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(xi),n=r9(i.typeDefinitionProvider,e,t,!1,sn.None);return il(()=>n)});So("_executeTypeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(xi),n=r9(i.typeDefinitionProvider,e,t,!0,sn.None);return il(()=>n)});So("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(xi),n=s9(i.declarationProvider,e,t,!1,sn.None);return il(()=>n)});So("_executeDeclarationProvider_recursive",(o,e,t)=>{const i=o.get(xi),n=s9(i.declarationProvider,e,t,!0,sn.None);return il(()=>n)});So("_executeReferenceProvider",(o,e,t)=>{const i=o.get(xi),n=Tp(i.referenceProvider,e,t,!1,!1,sn.None);return il(()=>n)});So("_executeReferenceProvider_recursive",(o,e,t)=>{const i=o.get(xi),n=Tp(i.referenceProvider,e,t,!1,!0,sn.None);return il(()=>n)});So("_executeImplementationProvider",(o,e,t)=>{const i=o.get(xi),n=o9(i.implementationProvider,e,t,!1,sn.None);return il(()=>n)});So("_executeImplementationProvider_recursive",(o,e,t)=>{const i=o.get(xi),n=o9(i.implementationProvider,e,t,!0,sn.None);return il(()=>n)});Wr.appendMenuItem(Yt.EditorContext,{submenu:Yt.EditorContextPeek,title:S("peek.submenu","Peek"),group:"navigation",order:100});class L0{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof L0||pi.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}const Sr=class Sr extends ha{static all(){return Sr._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of Cl.wrap(t.menu))(i.id===Yt.EditorContext||i.id===Yt.EditorContextPeek)&&(i.when=$e.and(e.precondition,i.when));return t}constructor(e,t){super(Sr._patchConfig(t)),this.configuration=e,Sr._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(go),r=e.get(fs),a=e.get(up),d=e.get(Yv),u=e.get(xi),f=e.get(Qi),g=t.getModel(),p=t.getPosition(),C=L0.is(i)?i:new L0(g,p),b=new f0(t,5),E=cp(this._getLocationModel(u,C.model,C.position,b.token),b.token).then(async y=>{var M;if(!y||b.token.isCancellationRequested)return;zr(y.ariaMessage);let D;if(y.referenceAt(g.uri,p)){const R=this._getAlternativeCommand(t);!Sr._activeAlternativeCommands.has(R)&&Sr._allSymbolNavigationCommands.has(R)&&(D=Sr._allSymbolNavigationCommands.get(R))}const I=y.references.length;if(I===0){if(!this.configuration.muteMessage){const R=g.getWordAtPosition(p);(M=Po.get(t))==null||M.showMessage(this._getNoResultFoundMessage(R),p)}}else if(I===1&&D)Sr._activeAlternativeCommands.add(this.desc.id),f.invokeFunction(R=>D.runEditorCommand(R,t,i,n).finally(()=>{Sr._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,d,t,y,n)},y=>{s.error(y)}).finally(()=>{b.dispose()});return a.showWhile(E,250),E}async _onResult(e,t,i,n,s){const r=this._getGoToPreference(i);if(!(i instanceof jr)&&(this.configuration.openInPeek||r==="peek"&&n.references.length>1))this._openInPeek(i,n,s);else{const a=n.firstReference(),d=n.references.length>1&&r==="gotoAndPeek",u=await this._openReference(i,e,a,this.configuration.openToSide,!d);d&&u?this._openInPeek(u,n,s):n.dispose(),r==="goto"&&t.put(a)}}async _openReference(e,t,i,n,s){let r;if(F3(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:ee.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(a){if(s){const d=a.getModel(),u=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===d&&u.clear()},350)}return a}}_openInPeek(e,t,i){const n=Iu.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),Ws(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}};Sr._allSymbolNavigationCommands=new Map,Sr._activeAlternativeCommands=new Set;let Tl=Sr;class Mp extends Tl{async _getLocationModel(e,t,i,n){return new To(await Pp(e.definitionProvider,t,i,!1,n),S("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?S("noResultWord","No definition found for '{0}'",e.word):S("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}var wc;Tn((wc=class extends Mp{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:wc.id,title:{...ui("actions.goToDecl.label","Go to Definition"),mnemonicTitle:S({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:U.hasDefinitionProvider,keybinding:[{when:U.editorTextFocus,primary:70,weight:100},{when:$e.and(U.editorTextFocus,a2),primary:2118,weight:100}],menu:[{id:Yt.EditorContext,group:"navigation",order:1.1},{id:Yt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Un.registerCommandAlias("editor.action.goToDeclaration",wc.id)}},wc.id="editor.action.revealDefinition",wc));var Sc;Tn((Sc=class extends Mp{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Sc.id,title:ui("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:$e.and(U.hasDefinitionProvider,U.isInEmbeddedEditor.toNegated()),keybinding:[{when:U.editorTextFocus,primary:xs(2089,70),weight:100},{when:$e.and(U.editorTextFocus,a2),primary:xs(2089,2118),weight:100}]}),Un.registerCommandAlias("editor.action.openDeclarationToTheSide",Sc.id)}},Sc.id="editor.action.revealDefinitionAside",Sc));var Dc;Tn((Dc=class extends Mp{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Dc.id,title:ui("actions.previewDecl.label","Peek Definition"),precondition:$e.and(U.hasDefinitionProvider,Co.notInPeekEditor,U.isInEmbeddedEditor.toNegated()),keybinding:{when:U.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:Yt.EditorContextPeek,group:"peek",order:2}}),Un.registerCommandAlias("editor.action.previewDeclaration",Dc.id)}},Dc.id="editor.action.peekDefinition",Dc));class A5 extends Tl{async _getLocationModel(e,t,i,n){return new To(await s9(e.declarationProvider,t,i,!1,n),S("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?S("decl.noResultWord","No declaration found for '{0}'",e.word):S("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}var Od;Tn((Od=class extends A5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Od.id,title:{...ui("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:S({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:$e.and(U.hasDeclarationProvider,U.isInEmbeddedEditor.toNegated()),menu:[{id:Yt.EditorContext,group:"navigation",order:1.3},{id:Yt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?S("decl.noResultWord","No declaration found for '{0}'",e.word):S("decl.generic.noResults","No declaration found")}},Od.id="editor.action.revealDeclaration",Od));Tn(class extends A5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:ui("actions.peekDecl.label","Peek Declaration"),precondition:$e.and(U.hasDeclarationProvider,Co.notInPeekEditor,U.isInEmbeddedEditor.toNegated()),menu:{id:Yt.EditorContextPeek,group:"peek",order:3}})}});class k5 extends Tl{async _getLocationModel(e,t,i,n){return new To(await r9(e.typeDefinitionProvider,t,i,!1,n),S("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?S("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):S("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}var Hd;Tn((Hd=class extends k5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Hd.ID,title:{...ui("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:S({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:U.hasTypeDefinitionProvider,keybinding:{when:U.editorTextFocus,primary:0,weight:100},menu:[{id:Yt.EditorContext,group:"navigation",order:1.4},{id:Yt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},Hd.ID="editor.action.goToTypeDefinition",Hd));var Wd;Tn((Wd=class extends k5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Wd.ID,title:ui("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:$e.and(U.hasTypeDefinitionProvider,Co.notInPeekEditor,U.isInEmbeddedEditor.toNegated()),menu:{id:Yt.EditorContextPeek,group:"peek",order:4}})}},Wd.ID="editor.action.peekTypeDefinition",Wd));class B5 extends Tl{async _getLocationModel(e,t,i,n){return new To(await o9(e.implementationProvider,t,i,!1,n),S("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?S("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):S("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}var zd;Tn((zd=class extends B5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:zd.ID,title:{...ui("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:S({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:U.hasImplementationProvider,keybinding:{when:U.editorTextFocus,primary:2118,weight:100},menu:[{id:Yt.EditorContext,group:"navigation",order:1.45},{id:Yt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},zd.ID="editor.action.goToImplementation",zd));var Vd;Tn((Vd=class extends B5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Vd.ID,title:ui("actions.peekImplementation.label","Peek Implementations"),precondition:$e.and(U.hasImplementationProvider,Co.notInPeekEditor,U.isInEmbeddedEditor.toNegated()),keybinding:{when:U.editorTextFocus,primary:3142,weight:100},menu:{id:Yt.EditorContextPeek,group:"peek",order:5}})}},Vd.ID="editor.action.peekImplementation",Vd));class F5 extends Tl{_getNoResultFoundMessage(e){return e?S("references.no","No references found for '{0}'",e.word):S("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}Tn(class extends F5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...ui("goToReferences.label","Go to References"),mnemonicTitle:S({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:$e.and(U.hasReferenceProvider,Co.notInPeekEditor,U.isInEmbeddedEditor.toNegated()),keybinding:{when:U.editorTextFocus,primary:1094,weight:100},menu:[{id:Yt.EditorContext,group:"navigation",order:1.45},{id:Yt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new To(await Tp(e.referenceProvider,t,i,!0,!1,n),S("ref.title","References"))}});Tn(class extends F5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:ui("references.action.label","Peek References"),precondition:$e.and(U.hasReferenceProvider,Co.notInPeekEditor,U.isInEmbeddedEditor.toNegated()),menu:{id:Yt.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new To(await Tp(e.referenceProvider,t,i,!1,!1,n),S("ref.title","References"))}});class aR extends Tl{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:ui("label.generic","Go to Any Symbol"),precondition:$e.and(Co.notInPeekEditor,U.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new To(this._references,S("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&S("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}Un.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:Rn},{name:"position",description:"The position at which to start",constraint:pi.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)=>{wn(Rn.isUri(e)),wn(pi.isIPosition(t)),wn(Array.isArray(i)),wn(typeof n>"u"||typeof n=="string"),wn(typeof r>"u"||typeof r=="boolean");const a=o.get(fs),d=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(l2(d))return d.setPosition(t),d.revealPositionInCenterIfOutsideViewport(t,0),d.invokeWithinContext(u=>{const f=new class extends aR{_getNoResultFoundMessage(g){return s||super._getNoResultFoundMessage(g)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);u.get(Qi).invokeFunction(f.run.bind(f),d)})}});Un.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:Rn},{name:"position",description:"The position at which to start",constraint:pi.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(Rs).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});Un.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{wn(Rn.isUri(e)),wn(pi.isIPosition(t));const i=o.get(xi),n=o.get(fs);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!l2(s)||!s.hasModel())return;const r=Iu.get(s);if(!r)return;const a=Ws(u=>Tp(i.referenceProvider,s.getModel(),pi.lift(t),!1,!1,u).then(f=>new To(f,S("ref.title","References")))),d=new ee(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(d,a,!1))})}});Un.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function lR(o,e,t,i){const n=o.get(ma),s=o.get(V0),r=o.get(Rs),a=o.get(Qi),d=o.get(go);if(await i.item.resolve(sn.None),!i.part.location)return;const u=i.part.location,f=[],g=new Set(Wr.getMenuItems(Yt.EditorContext).map(C=>L3(C)?C.command.id:jv()));for(const C of Tl.all())g.has(C.desc.id)&&f.push(new _0(C.desc.id,v0.label(C.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const b=await n.createModelReference(u.uri);try{const E=new L0(b.object.textEditorModel,ee.getStartPosition(u.range)),y=i.item.anchor.range;await a.invokeFunction(C.runEditorCommand.bind(C),e,E,y)}finally{b.dispose()}}));if(i.part.command){const{command:C}=i.part;f.push(new xg),f.push(new _0(C.id,C.title,void 0,!0,async()=>{try{await r.executeCommand(C.id,...C.arguments??[])}catch(b){d.notify({severity:xw.Error,source:i.item.provider.displayName,message:b})}}))}const p=e.getOption(128);s.showContextMenu({domForShadowRoot:p?e.getDomNode()??void 0:void 0,getAnchor:()=>{const C=bo(t);return{x:C.left,y:C.top+C.height+8}},getActions:()=>f,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function L5(o,e,t,i){const s=await o.get(ma).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,d=r.get(En),u=Co.inPeekEditor.getValue(d),f=!a&&t.getOption(89)&&!u;return new Mp({openToSide:a,openInPeek:f,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new L0(s.object.textEditorModel,ee.getStartPosition(i.range)),ee.lift(i.range))}),s.dispose()}var cR=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)}},Eh;class Bm{constructor(){this._entries=new fp(50)}get(e){const t=Bm._key(e);return this._entries.get(t)}set(e,t){const i=Bm._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const I5=Hl("IInlayHintsCache");Wl(I5,Bm,1);class W1{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 dR{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}var bl;let Mg=(bl=class{static get(e){return e.getContribution(Eh.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 Bt,this._sessionDisposables=new Bt,this._decorationsMetadata=new Map,this._ruleFactory=new KA(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(d=>{d.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,d;e.enabled==="onUnlessPressed"?(a=0,d=1):(a=1,d=0),this._activeRenderMode=a,this._sessionDisposables.add(I3.getInstance().event(u=>{if(!this._editor.hasModel())return;const f=u.altKey&&u.ctrlKey&&!(u.shiftKey||u.metaKey)?d:a;if(f!==this._activeRenderMode){this._activeRenderMode=f;const g=this._editor.getModel(),p=this._copyInlayHintsWithCurrentAnchor(g);this._updateHintsDecorators([g.getFullModelRange()],p),r.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(Zn(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new As(async()=>{const a=Date.now();n==null||n.dispose(!0),n=new zs;const d=t.onWillDispose(()=>n==null?void 0:n.cancel());try{const u=n.token,f=await wm.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),u);if(r.delay=this._debounceInfo.update(t,Date.now()-a),u.isCancellationRequested){f.dispose();return}for(const g of f.provider)typeof g.onDidChangeInlayHints=="function"&&!s.has(g)&&(s.add(g),this._sessionDisposables.add(g.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));this._sessionDisposables.add(f),this._updateHintsDecorators(f.ranges,f.items),this._cacheHintsForFastRestore(t)}catch(u){On(u)}finally{n.dispose(),d.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(r),this._sessionDisposables.add(Zn(()=>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 d=Math.max(r.delay,1250);r.schedule(d)})),this._sessionDisposables.add(this._installDblClickGesture(()=>r.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new Bt,t=e.add(new Kv(this._editor)),i=new Bt;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 d=new zs;i.add(Zn(()=>d.dispose(!0))),r.item.resolve(d.token),this._activeInlayHintPart=r.part.command||r.part.location?new dR(r,s.hasTriggerModifier):void 0;const u=a.validatePosition(r.item.hint.position).lineNumber,f=new ee(u,1,u,a.getLineMaxColumn(u)),g=this._getInlineHintsForRange(f);this._updateHintsDecorators([f],g),i.add(Zn(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([f],g)}))})),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(L5,n,this._editor,r.location):P3.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(sn.None),Zo(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>ns.replace(ee.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!T3(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(lR,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 mw&&(t==null?void 0:t.attachedData)instanceof W1)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:xw.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 v5(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(ee.compareRangesUsingStarts)){const r=t.validateRange(new ee(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!ee.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=ee.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var b,E;const i=[],n=(y,D,I,M,R)=>{const T={content:I,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:D.className,cursorStops:M,attachedData:R};i.push({item:y,classNameRef:D,decoration:{range:y.anchor.range,options:{description:"InlayHint",showIfCollapsed:y.anchor.range.isEmpty(),collapseOnReplaceEdit:!y.anchor.range.isEmpty(),stickiness:0,[y.anchor.direction]:this._activeRenderMode===0?T:void 0}}})},s=(y,D)=>{const I=this._ruleFactory.createClassNameRef({width:`${r/3|0}px`,display:"inline-block"});n(y,I," ",D?Ah.Right:Ah.None)},{fontSize:r,fontFamily:a,padding:d,isUniform:u}=this._getLayoutInfo(),f="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(f,a);let g={line:0,totalLen:0};for(const y of t){if(g.line!==y.anchor.range.startLineNumber&&(g={line:y.anchor.range.startLineNumber,totalLen:0}),g.totalLen>Eh._MAX_LABEL_LEN)continue;y.hint.paddingLeft&&s(y,!1);const D=typeof y.hint.label=="string"?[{label:y.hint.label}]:y.hint.label;for(let I=0;I<D.length;I++){const M=D[I],R=I===0,T=I===D.length-1,V={fontSize:`${r}px`,fontFamily:`var(${f}), ${uw.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};Zo(y.hint.textEdits)&&(V.cursor="default"),this._fillInColors(V,y.hint),(M.command||M.location)&&((b=this._activeInlayHintPart)==null?void 0:b.part.item)===y&&this._activeInlayHintPart.part.index===I&&(V.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(V.color=bs(M3),V.cursor="pointer")),d&&(R&&T?(V.padding=`1px ${Math.max(1,r/4)|0}px`,V.borderRadius=`${r/4|0}px`):R?(V.padding=`1px 0 1px ${Math.max(1,r/4)|0}px`,V.borderRadius=`${r/4|0}px 0 0 ${r/4|0}px`):T?(V.padding=`1px ${Math.max(1,r/4)|0}px 1px 0`,V.borderRadius=`0 ${r/4|0}px ${r/4|0}px 0`):V.padding="1px 0 1px 0");let O=M.label;g.totalLen+=O.length;let Q=!1;const ie=g.totalLen-Eh._MAX_LABEL_LEN;if(ie>0&&(O=O.slice(0,-ie)+"…",Q=!0),n(y,this._ruleFactory.createClassNameRef(V),uR(O),T&&!y.hint.paddingRight?Ah.Right:Ah.None,new W1(y,I)),Q)break}if(y.hint.paddingRight&&s(y,!0),i.length>Eh._MAX_DECORATORS)break}const p=[];for(const[y,D]of this._decorationsMetadata){const I=(E=this._editor.getModel())==null?void 0:E.getDecorationRange(y);I&&e.some(M=>M.containsRange(I))&&(p.push(y),D.classNameRef.dispose(),this._decorationsMetadata.delete(y))}const C=x0.capture(this._editor);this._editor.changeDecorations(y=>{const D=y.deltaDecorations(p,i.map(I=>I.decoration));for(let I=0;I<D.length;I++){const M=i[I];this._decorationsMetadata.set(D[I],M)}}),C.restore(this._editor)}_fillInColors(e,t){t.kind===bS.Parameter?(e.backgroundColor=bs(R3),e.color=bs(N3)):t.kind===bS.Type?(e.backgroundColor=bs(O3),e.color=bs(H3)):(e.backgroundColor=bs(W3),e.color=bs(z3))}_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()}},Eh=bl,bl.ID="editor.contrib.InlayHints",bl._MAX_DECORATORS=1500,bl._MAX_LABEL_LEN=43,bl);Mg=Eh=cR([ah(1,xi),ah(2,fr),ah(3,I5),ah(4,Rs),ah(5,go),ah(6,Qi)],Mg);function uR(o){return o.replace(/[ \t]/g," ")}Un.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;wn(Rn.isUri(t)),wn(ee.isIRange(i));const{inlayHintsProvider:n}=o.get(xi),s=await o.get(ma).createModelReference(t);try{const r=await wm.create(n,s.object.textEditorModel,[ee.lift(i)],sn.None),a=r.items.map(d=>d.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});var hR=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},Kl=function(o,e){return function(t,i){e(t,i,o)}};class k8 extends Ox{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let Fm=class extends Pg{constructor(e,t,i,n,s,r,a,d,u){super(e,t,i,r,d,n,s,u),this._resolverService=a,this.hoverOrdinal=6}suggestHoverAnchor(e){var n;if(!Mg.get(this._editor)||e.target.type!==6)return null;const i=(n=e.target.detail.injectedText)==null?void 0:n.options;return i instanceof mw&&i.attachedData instanceof W1?new k8(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof k8?new aa(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 oo().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&n.emitOne(new Rr(this,e.range,[r],!1,0)),Zo(s.item.hint.textEdits)&&n.emitOne(new Rr(this,e.range,[new oo().appendText(S("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new oo().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&n.emitOne(new Rr(this,e.range,[a],!1,1)),s.part.location||s.part.command){let u;const g=this._editor.getOption(78)==="altKey"?Ya?S("links.navigate.kb.meta.mac","cmd + click"):S("links.navigate.kb.meta","ctrl + click"):Ya?S("links.navigate.kb.alt.mac","option + click"):S("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?u=new oo().appendText(S("hint.defAndCommand","Go to Definition ({0}), right click for more",g)):s.part.location?u=new oo().appendText(S("hint.def","Go to Definition ({0})",g)):s.part.command&&(u=new oo(`[${S("hint.cmd","Execute Command")}](${WM(s.part.command)} "${s.part.command.title}") (${g})`,{isTrusted:!0})),u&&n.emitOne(new Rr(this,e.range,[u],!1,1e4))}const d=await this._resolveInlayHintLabelPartHover(s,i);for await(const u of d)n.emitOne(u)}):aa.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return aa.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)?t9(this._languageFeaturesService.hoverProvider,r,new pi(n.startLineNumber,n.startColumn),t).filter(a=>!mg(a.hover.contents)).map(a=>new Rr(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):aa.EMPTY}finally{s.dispose()}}};Fm=hR([Kl(1,xa),Kl(2,ga),Kl(3,ms),Kl(4,mp),Kl(5,Yn),Kl(6,ma),Kl(7,xi),Kl(8,Rs)],Fm);class a9 extends Pt{constructor(e,t,i,n,s,r){super();const a=t.anchor,d=t.hoverParts;this._renderedHoverParts=this._register(new z1(e,i,d,r,s));const{showAtPosition:u,showAtSecondaryPosition:f}=a9.computeHoverPositions(e,a.range,d);this.shouldAppearBeforeContent=d.some(g=>g.isBeforeContent),this.showAtPosition=u,this.showAtSecondaryPosition=f,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 f=e._getViewModel(),g=f.coordinatesConverter,p=g.convertModelRangeToViewRange(t),C=f.getLineMinColumn(p.startLineNumber),b=new pi(p.startLineNumber,C);n=g.convertViewPositionToModelPosition(b).column}const s=t.startLineNumber;let r=t.startColumn,a;for(const f of i){const g=f.range,p=g.startLineNumber===s,C=g.endLineNumber===s;if(p&&C){const E=g.startColumn,y=Math.min(r,E);r=Math.max(y,n)}f.forceShowAtRange&&(a=g)}let d,u;if(a){const f=a.getStartPosition();d=f,u=f}else d=t.getStartPosition(),u=new pi(s,r);return{showAtPosition:d,showAtSecondaryPosition:u}}}class fR{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 P_=class P_ extends Pt{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 Pt.None;let i=t[0].range;for(const s of t){const r=s.range;i=ee.plusRange(i,r)}const n=e.createDecorationsCollection();return n.set([{range:i,options:P_._DECORATION_OPTIONS}]),Zn(()=>{n.clear()})}_renderParts(e,t,i,n){const s=new ym(n),r={fragment:this._fragment,statusBar:s,...i},a=new Bt;for(const u of e){const f=this._renderHoverPartsForParticipant(t,u,r);a.add(f);for(const g of f.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:u,hoverPart:g.hoverPart,hoverElement:g.hoverElement})}const d=this._renderStatusBar(this._fragment,s);return d&&(a.add(d),this._renderedParts.push({type:"statusBar",hoverElement:d.hoverElement,actions:d.actions})),Zn(()=>{a.dispose()})}_renderHoverPartsForParticipant(e,t,i){const n=e.filter(r=>r.owner===t);return n.length>0?t.renderHoverParts(i,n):new Lu([])}_renderStatusBar(e,t){if(t.hasContent)return new fR(e,t)}_registerListenersOnRenderedParts(){const e=new Bt;return this._renderedParts.forEach((t,i)=>{const n=t.hoverElement;n.tabIndex=0,e.add(Cn(n,is.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(Cn(n,is.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof Pg&&!(i instanceof Fm));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof Lg)}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 b0;return t-s}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}};P_._DECORATION_OPTIONS=fn.register({description:"content-hover-highlight",className:"hoverHighlight"});let z1=P_;var gR=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},B8=function(o,e){return function(t,i){e(t,i,o)}};let V1=class extends Pt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._onContentsChanged=this._register(new nn),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(k1,this._editor)),this._participants=this._initializeHoverParticipants(),this._computer=new Em(this._editor,this._participants),this._hoverOperation=this._register(new g5(this._editor,this._computer)),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of Uu.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 p5(this._computer.anchor,i,t.isComplete))}));const e=this._contentHoverWidget.getDomNode();this._register(Bl(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Bl(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(Dv.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,d=s&&this._contentHoverWidget.isMouseGettingCloser(s.event.posx,s.event.posy);return a&&d?(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 a9(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 Gb(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 Gb(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||!Gv(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new Gb(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}};V1=gR([B8(1,Qi),B8(2,ms)],V1);var pR=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},F8=function(o,e){return function(t,i){e(t,i,o)}},j1,jd;let no=(jd=class extends Pt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._onHoverContentsChanged=this._register(new nn),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Bt,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new As(()=>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(j1.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?Gv(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 d=this._isMouseOnContentHoverWidget(r);return a&&d},n=r=>{var u;const a=this._isMouseOnContentHoverWidget(r),d=((u=this._contentWidget)==null?void 0:u.isColorPickerVisible)??!1;return a&&d},s=(r,a)=>{var d,u,f,g;return(a&&((u=this._contentWidget)==null?void 0:u.containsNode((d=r.event.browserEvent.view)==null?void 0:d.document.activeElement))&&!((g=(f=r.event.browserEvent.view)==null?void 0:f.getSelection())!=null&&g.isCollapsed))??!1};return i(e,t)||n(e)||s(e,t)}_onEditorMouseMove(e){var a,d,u,f;if(this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._mouseMoveEvent=e,(a=this._contentWidget)!=null&&a.isFocused||(d=this._contentWidget)!=null&&d.isResizing))return;const t=this._hoverSettings.sticky;if(t&&((u=this._contentWidget)!=null&&u.isVisibleFromKeyboard))return;if(this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}const n=this._hoverSettings.hidingDelay;if(((f=this._contentWidget)==null?void 0:f.isVisible)&&t&&n>0){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(n);return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){var d;if(!e)return;const i=(d=e.target.element)==null?void 0:d.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===d5||t.commandId===Uv||t.commandId===qv)&&((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)||F0.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,(t=this._contentWidget)==null||t.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(V1,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()}},j1=jd,jd.ID="editor.contrib.contentHover",jd);no=j1=pR([F8(1,Qi),F8(2,ms)],no);const X9=class X9 extends Pt{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!==n5||!i.range)return;const n=this._editor.getContribution(no.ID);if(n&&!n.isColorPickerVisible){const s=new ee(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(s,1,0,!1,!0)}}};X9.ID="editor.contrib.colorContribution";let Lm=X9;on(Lm.ID,Lm,2);Uu.register(Lg);var P5=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)}},$1,U1,$d;let Pu=($d=class extends Pt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=U.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=U.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(q1,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($1.ID)}},$1=$d,$d.ID="editor.contrib.standaloneColorPickerController",$d);Pu=$1=P5([Ih(1,En),Ih(2,Qi)],Pu);on(Pu.ID,Pu,1);const L8=8,xR=22;var Ud;let q1=(Ud=class extends Pt{constructor(e,t,i,n,s,r,a){var g;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 nn),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(Ig,this._editor),this._position=(g=this._editor._getViewModel())==null?void 0:g.getPrimaryCursorState().modelState.position;const d=this._editor.getSelection(),u=d?{startLineNumber:d.startLineNumber,startColumn:d.startColumn,endLineNumber:d.endLineNumber,endColumn:d.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},f=this._register(g0(this._body));this._register(f.onDidBlur(p=>{this.hide()})),this._register(f.onDidFocus(p=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(p=>{var b;const C=(b=p.target.element)==null?void 0:b.classList;C&&C.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(p=>{this._render(p.value,p.foundInEditor)})),this._start(u),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return U1.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 mR(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 Fg(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 ym(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 d=a.body,u=d.saturationBox.domNode.clientWidth,f=d.domNode.clientWidth-u-xR-L8,g=a.body.enterButton;g==null||g.onClicked(()=>{this.updateEditor(),this.hide()});const p=a.header,C=p.pickedColorNode;C.style.width=u+L8+"px";const b=p.originalColorNode;b.style.width=f+"px";const E=a.header.closeButton;E==null||E.onClicked(()=>{this.hide()}),t&&(g&&(g.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}},U1=Ud,Ud.ID="editor.contrib.standaloneColorPickerWidget",Ud);q1=U1=P5([Ih(3,Qi),Ih(4,ms),Ih(5,xi),Ih(6,zl)],q1);class mR{constructor(e,t){this.value=e,this.foundInEditor=t}}class _R extends ha{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...ui("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:S({key:"mishowOrFocusStandaloneColorPicker",comment:["&& denotes a mnemonic"]},"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:Yt.CommandPalette}],metadata:{description:ui("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=Pu.get(t))==null||i.showOrFocus()}}class vR extends gt{constructor(){super({id:"editor.action.hideColorPicker",label:S({key:"hideColorPicker",comment:["Action that hides the color picker"]},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:U.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:ui("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){var i;(i=Pu.get(t))==null||i.hide()}}class bR extends gt{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:S({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:U.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:ui("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){var i;(i=Pu.get(t))==null||i.insertColor()}}Ae(vR);Ae(bR);Tn(_R);class uc{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),d=t.charCodeAt(r);if(a!==d&&!(a>=65&&a<=90&&a+32===d)&&!(d>=65&&d<=90&&d+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,n,s,r){const a=e.startLineNumber,d=e.startColumn,u=e.endLineNumber,f=e.endColumn,g=s.getLineContent(a),p=s.getLineContent(u);let C=g.lastIndexOf(t,d-1+t.length),b=p.indexOf(i,f-1-i.length);if(C!==-1&&b!==-1)if(a===u)g.substring(C+t.length,b).indexOf(i)>=0&&(C=-1,b=-1);else{const y=g.substring(C+t.length),D=p.substring(0,b);(y.indexOf(i)>=0||D.indexOf(i)>=0)&&(C=-1,b=-1)}let E;C!==-1&&b!==-1?(n&&C+t.length<g.length&&g.charCodeAt(C+t.length)===32&&(t=t+" "),n&&b>0&&p.charCodeAt(b-1)===32&&(i=" "+i,b-=1),E=uc._createRemoveBlockCommentOperations(new ee(a,C+t.length+1,u,b+1),t,i)):(E=uc._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=E.length===1?i:null);for(const y of E)r.addTrackedEditOperation(y.range,y.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return ee.isEmpty(e)?n.push(ns.delete(new ee(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(ns.delete(new ee(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(ns.delete(new ee(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return ee.isEmpty(e)?s.push(ns.replace(new ee(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(ns.insert(new pi(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(ns.insert(new pi(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 Hi(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 Hi(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class cl{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 d=[];for(let u=0,f=i-t+1;u<f;u++)d[u]={ignore:!1,commentStr:a,commentStrOffset:0,commentStrLength:a.length};return d}static _analyzeLines(e,t,i,n,s,r,a,d){let u=!0,f;e===0?f=!0:e===1?f=!1:f=!0;for(let g=0,p=n.length;g<p;g++){const C=n[g],b=s+g;if(b===s&&a){C.ignore=!0;continue}const E=i.getLineContent(b),y=LC(E);if(y===-1){C.ignore=r,C.commentStrOffset=E.length;continue}if(u=!1,C.ignore=!1,C.commentStrOffset=y,f&&!uc._haystackHasNeedleAtOffset(E,C.commentStr,y)&&(e===0?f=!1:e===1||(C.ignore=!0)),f&&t){const D=y+C.commentStrLength;D<E.length&&E.charCodeAt(D)===32&&(C.commentStrLength+=1)}}if(e===0&&u){f=!1;for(let g=0,p=n.length;g<p;g++)n[g].ignore=!1}return{supported:!0,shouldRemoveComments:f,lines:n}}static _gatherPreflightData(e,t,i,n,s,r,a,d){const u=cl._gatherPreflightCommentStrings(i,n,s,d);return u===null?{supported:!1}:cl._analyzeLines(e,t,i,u,n,r,a,d)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=cl._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(cl._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._indentSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new pi(n.positionLineNumber,n.positionColumn);for(let a=0,d=s.length;a<d;a++)t.addEditOperation(s[a].range,s[a].text),ee.isEmpty(s[a].range)&&ee.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 d=e.getLineContent(s).lastIndexOf(i,a-1),u=e.getLineContent(r).indexOf(n,t.endColumn-1-i.length);return d!==-1&&u===-1&&(u=e.getLineContent(s).indexOf(n,d+i.length),r=s),d===-1&&u!==-1&&(d=e.getLineContent(r).lastIndexOf(i,u),s=r),t.isEmpty()&&(d===-1||u===-1)&&(d=e.getLineContent(s).indexOf(i),d!==-1&&(u=e.getLineContent(s).indexOf(n,d+i.length))),d!==-1&&e.getLineContent(s).charCodeAt(d+i.length)===32&&(i+=" "),u!==-1&&e.getLineContent(r).charCodeAt(u-1)===32&&(n=" "+n,u-=1),d!==-1&&u!==-1?uc._createRemoveBlockCommentOperations(new ee(s,d+i.length+1,r,u+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 d=this._attemptRemoveBlockComment(e,i,r,a);if(!d){if(i.isEmpty()){const u=e.getLineContent(i.startLineNumber);let f=LC(u);f===-1&&(f=u.length),d=uc._createAddBlockCommentOperations(new ee(i.startLineNumber,f+1,i.startLineNumber,u.length+1),r,a,this._insertSpace)}else d=uc._createAddBlockCommentOperations(new ee(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),r,a,this._insertSpace);d.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=t.trackSelection(i);for(const u of d)t.addEditOperation(u.range,u.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine){t.addEditOperation(new ee(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=cl._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 Hi(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(ns.delete(new ee(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(ns.insert(new pi(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 d=0,u=t.length;d<u;d++){if(t[d].ignore)continue;const f=e.getLineContent(i+d);let g=0;for(let p=0,C=t[d].commentStrOffset;g<s&&p<C;p++)g=cl.nextVisibleColumn(g,n,f.charCodeAt(p)===9,1);g<s&&(s=g)}s=Math.floor(s/n)*n;for(let d=0,u=t.length;d<u;d++){if(t[d].ignore)continue;const f=e.getLineContent(i+d);let g=0;for(r=0,a=t[d].commentStrOffset;g<s&&r<a;r++)g=cl.nextVisibleColumn(g,n,f.charCodeAt(r)===9,1);g>s?t[d].commentStrOffset=r-1:t[d].commentStrOffset=r}}}class l9 extends gt{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(Ns);if(!t.hasModel())return;const n=t.getModel(),s=[],r=n.getOptions(),a=t.getOption(23),d=t.getSelections().map((f,g)=>({selection:f,index:g,ignoreFirstLine:!1}));d.sort((f,g)=>ee.compareRangesUsingStarts(f.selection,g.selection));let u=d[0];for(let f=1;f<d.length;f++){const g=d[f];u.selection.endLineNumber===g.selection.startLineNumber&&(u.index<g.index?g.ignoreFirstLine=!0:(u.ignoreFirstLine=!0,u=g))}for(const f of d)s.push(new cl(i,f.selection,r.indentSize,this._type,a.insertSpace,a.ignoreEmptyLines,f.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class CR extends l9{constructor(){super(0,{id:"editor.action.commentLine",label:S("comment.line","Toggle Line Comment"),alias:"Toggle Line Comment",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:Yt.MenubarEditMenu,group:"5_insert",title:S({key:"miToggleLineComment",comment:["&& denotes a mnemonic"]},"&&Toggle Line Comment"),order:1}})}}class ER extends l9{constructor(){super(1,{id:"editor.action.addCommentLine",label:S("comment.line.add","Add Line Comment"),alias:"Add Line Comment",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2081),weight:100}})}}class yR extends l9{constructor(){super(2,{id:"editor.action.removeCommentLine",label:S("comment.line.remove","Remove Line Comment"),alias:"Remove Line Comment",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2099),weight:100}})}}class wR extends gt{constructor(){super({id:"editor.action.blockComment",label:S("comment.block","Toggle Block Comment"),alias:"Toggle Block Comment",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:Yt.MenubarEditMenu,group:"5_insert",title:S({key:"miToggleBlockComment",comment:["&& denotes a mnemonic"]},"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(Ns);if(!t.hasModel())return;const n=t.getOption(23),s=[],r=t.getSelections();for(const a of r)s.push(new uc(a,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}Ae(CR);Ae(ER);Ae(yR);Ae(wR);var SR=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},Jc=function(o,e){return function(t,i){e(t,i,o)}},G1,qd;let I0=(qd=class{static get(e){return e.getContribution(G1.ID)}constructor(e,t,i,n,s,r,a,d){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=n,this._keybindingService=s,this._menuService=r,this._configurationService=a,this._workspaceContextService=d,this._toDispose=new Bt,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(u=>this._onContextMenu(u))),this._toDispose.add(this._editor.onMouseWheel(u=>{if(this._contextMenuIsBeingShownCount>0){const f=this._contextViewService.getContextViewElement(),g=u.srcElement;g.shadowRoot&&V3(f)===g.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(u=>{this._editor.getOption(24)&&u.keyCode===58&&(u.preventDefault(),u.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 d of r)if(d instanceof j3){const u=this._getMenuActions(e,d.item.submenu);u.length>0&&(i.push(new CS(d.id,d.label,u)),a++)}else i.push(d),a++;a&&i.push(new xg)}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=bo(this._editor.getDomNode()),d=a.left+r.left,u=a.top+r.top+r.height;n={x:d,y:u}}const s=this._editor.getOption(128)&&!IC;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 BC(r,r,{label:!0,keybinding:a.getLabel(),isMenu:!0});const d=r;return typeof d.getActionViewItem=="function"?d.getActionViewItem():new BC(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()||$3(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(73);let i=0;const n=u=>({id:`menu-action-${++i}`,label:u.label,tooltip:"",class:void 0,enabled:typeof u.enabled>"u"?!0:u.enabled,checked:u.checked,run:u.run}),s=(u,f)=>new CS(`menu-action-${++i}`,u,f,void 0),r=(u,f,g,p,C)=>{if(!f)return n({label:u,enabled:f,run:()=>{}});const b=y=>()=>{this._configurationService.updateValue(g,y)},E=[];for(const y of C)E.push(n({label:y.label,checked:p===y.value,run:b(y.value)}));return s(u,E)},a=[];a.push(n({label:S("context.minimap.minimap","Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new xg),a.push(n({label:S("context.minimap.renderCharacters","Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(r(S("context.minimap.size","Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:S("context.minimap.size.proportional","Proportional"),value:"proportional"},{label:S("context.minimap.size.fill","Fill"),value:"fill"},{label:S("context.minimap.size.fit","Fit"),value:"fit"}])),a.push(r(S("context.minimap.slider","Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:S("context.minimap.slider.mouseover","Mouse Over"),value:"mouseover"},{label:S("context.minimap.slider.always","Always"),value:"always"}]));const d=this._editor.getOption(128)&&!IC;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:d?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>a,onHide:u=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}},G1=qd,qd.ID="editor.contrib.contextmenu",qd);I0=G1=SR([Jc(1,V0),Jc(2,vv),Jc(3,En),Jc(4,ms),Jc(5,Hu),Jc(6,Yn),Jc(7,h0)],I0);class DR extends gt{constructor(){super({id:"editor.action.showContextMenu",label:S("action.showContextMenu.label","Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:U.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;(i=I0.get(t))==null||i.showContextMenu()}}on(I0.ID,I0,2);Ae(DR);class Zb{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 Xb{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}const T_=class T_ extends Pt{static get(e){return e.getContribution(T_.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 Zb(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new Xb(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 Xb(new Zb(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 Xb(new Zb(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}};T_.ID="editor.contrib.cursorUndoRedoController";let P0=T_;class AR extends gt{constructor(){super({id:"cursorUndo",label:S("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:U.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;(n=P0.get(t))==null||n.cursorUndo()}}class kR extends gt{constructor(){super({id:"cursorRedo",label:S("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;(n=P0.get(t))==null||n.cursorRedo()}}on(P0.ID,P0,0);Ae(AR);Ae(kR);class BR{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 ee(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 Hi(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 Hi(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 Hi(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 Hi(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 Hi(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 lh(o){return Ya?o.altKey:o.ctrlKey}const tc=class tc extends Pt{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)||(lh(e)&&(this._modifierPressed=!0),this._mouseDown&&lh(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(lh(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===tc.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}lh(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 pi(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 Hi(s,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new Hi(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(lh(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(tc.ID,new BR(this._dragSelection,t,lh(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 ee(e.lineNumber,e.column,e.lineNumber,e.column),options:tc._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()}};tc.ID="editor.contrib.dragAndDrop",tc.TRIGGER_KEY_VALUE=Ya?6:5,tc._DECORATION_OPTIONS=fn.register({description:"dnd-target",className:"dnd-target"});let Im=tc;on(Im.ID,Im,2);on(Pl.ID,Pl,0);U0(l1);yi(new class extends wo{constructor(){super({id:R6,precondition:Kw,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e){var t;return(t=Pl.get(e))==null?void 0:t.changePasteType()}});yi(new class extends wo{constructor(){super({id:"editor.hidePasteWidget",precondition:Kw,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e){var t;(t=Pl.get(e))==null||t.clearWidgets()}});var Gd;Ae((Gd=class extends gt{constructor(){super({id:"editor.action.pasteAs",label:S("pasteAs","Paste As..."),alias:"Paste As...",precondition:U.writable,metadata:{description:"Paste as",args:[{name:"args",schema:Gd.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=Pl.get(t))==null?void 0:s.pasteAs(n?new Xn(n):void 0)}},Gd.argsSchema={type:"object",properties:{kind:{type:"string",description:S("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.")}}},Gd));Ae(class extends gt{constructor(){super({id:"editor.action.pasteAsText",label:S("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:U.writable})}run(o,e){var t;return(t=Pl.get(e))==null?void 0:t.pasteAs({providerId:Du.id})}});class FR{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 I8{constructor(e){this.identifier=e}}const T5=Hl("treeViewsDndService");Wl(T5,FR,1);var LR=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},tx=function(o,e){return function(t,i){e(t,i,o)}},K1;const M5="editor.experimental.dropIntoEditor.defaultProvider",R5="editor.changeDropType",c9=new xn("dropWidgetVisible",!1,S("dropWidgetVisible","Whether the drop widget is showing"));var Kd;let T0=(Kd=class extends Pt{static get(e){return e.getContribution(K1.ID)}constructor(e,t,i,n,s){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=r1.getInstance(),this._dropProgressManager=this._register(t.createInstance(vm,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(Cm,"dropIntoEditor",e,c9,{id:R5,label:S("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=Ws(async r=>{const a=new Bt,d=a.add(new f0(e,1,void 0,r));try{const u=await this.extractDataTransferData(i);if(u.size===0||d.token.isCancellationRequested)return;const f=e.getModel();if(!f)return;const g=this._languageFeaturesService.documentDropEditProvider.ordered(f).filter(C=>C.dropMimeTypes?C.dropMimeTypes.some(b=>u.matches(b)):!0),p=a.add(await this.getDropEdits(g,f,t,u,d));if(d.token.isCancellationRequested)return;if(p.edits.length){const C=this.getInitialActiveEditIndex(f,p.edits),b=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([ee.fromPositions(t)],{activeEditIndex:C,allEdits:p.edits},b,async E=>E,r)}}finally{a.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,S("dropIntoEditorProgress","Running drop handlers. Click to cancel"),n,{cancel:()=>n.cancel()}),this._currentOperation=n}async getDropEdits(e,t,i,n,s){const r=new Bt,a=await cp(Promise.all(e.map(async u=>{try{const f=await u.provideDocumentDropEdits(t,i,n,s.token);return f&&r.add(f),f==null?void 0:f.edits.map(g=>({...g,providerId:u.id}))}catch(f){console.error(f)}})),s.token),d=Al(a??[]).flat();return{edits:T6(d),dispose:()=>r.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(M5,{resource:e.uri});for(const[n,s]of Object.entries(i)){const r=new Xn(s),a=t.findIndex(d=>r.value===d.providerId&&d.handledMimeType&&S6(n,[d.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new w6;const t=k6(e.dataTransfer);if(this.treeItemsTransfer.hasData(I8.prototype)){const i=this.treeItemsTransfer.getData(I8.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}},K1=Kd,Kd.ID="editor.contrib.dropIntoEditorController",Kd);T0=K1=LR([tx(1,Qi),tx(2,Yn),tx(3,xi),tx(4,T5)],T0);on(T0.ID,T0,2);U0(a1);yi(new class extends wo{constructor(){super({id:R5,precondition:c9,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){var i;(i=T0.get(e))==null||i.changeDropType()}});yi(new class extends wo{constructor(){super({id:"editor.hideDropWidget",precondition:c9,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e,t){var i;(i=T0.get(e))==null||i.clearWidgets()}});fa.as(hp.Configuration).registerConfiguration({...Cv,properties:{[M5]:{type:"object",scope:5,description:S("defaultProviderDescription","Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});const to=class to{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===to._FIND_MATCH_DECORATION||n===to._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,to._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,to._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 ee(s.startLineNumber,s.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(s,to._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=to._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){n=to._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),u=this._editor.getLayoutInfo().height/a,f=Math.max(2,Math.ceil(3/u));let g=e[0].range.startLineNumber,p=e[0].range.endLineNumber;for(let C=1,b=e.length;C<b;C++){const E=e[C].range;p+f>=E.startLineNumber?E.endLineNumber>p&&(p=E.endLineNumber):(s.push({range:new ee(g,1,p,1),options:to._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),g=E.startLineNumber,p=E.endLineNumber)}s.push({range:new ee(g,1,p,1),options:to._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(e.length);for(let a=0,d=e.length;a<d;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,to._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}};to._CURRENT_FIND_MATCH_DECORATION=fn.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:bs(kb),position:qa.Center},minimap:{color:bs(ES),position:1}}),to._FIND_MATCH_DECORATION=fn.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:bs(kb),position:qa.Center},minimap:{color:bs(ES),position:1}}),to._FIND_MATCH_NO_OVERVIEW_DECORATION=fn.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),to._FIND_MATCH_ONLY_OVERVIEW_DECORATION=fn.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:bs(kb),position:qa.Center}}),to._RANGE_HIGHLIGHT_DECORATION=fn.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),to._FIND_SCOPE_DECORATION=fn.register({description:"find-scope",className:"findScope",isWholeLine:!0});let Z1=to;class IR{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)=>ee.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 N5(o,e){if(o&&o[0]!==""){const t=P8(o,e,"-"),i=P8(o,e,"_");return t&&!i?T8(o,e,"-"):!t&&i?T8(o,e,"_"):o[0].toUpperCase()===o[0]?e.toUpperCase():o[0].toLowerCase()===o[0]?e.toLowerCase():U3(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 P8(o,e,t){return o[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&o[0].split(t).length===e.split(t).length}function T8(o,e,t){const i=e.split(t),n=o[0].split(t);let s="";return i.forEach((r,a)=>{s+=N5([n[a]],r)+t}),s.slice(0,-1)}class M8{constructor(e){this.staticValue=e,this.kind=0}}class PR{constructor(e){this.pieces=e,this.kind=1}}class M0{static fromStaticValue(e){return new M0([Bd.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new M8(""):e.length===1&&e[0].staticValue!==null?this._state=new M8(e[0].staticValue):this._state=new PR(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?N5(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=M0._substitute(r.matchIndex,e);if(r.caseOps!==null&&r.caseOps.length>0){const d=[],u=r.caseOps.length;let f=0;for(let g=0,p=a.length;g<p;g++){if(f>=u){d.push(a.slice(g));break}switch(r.caseOps[f]){case"U":d.push(a[g].toUpperCase());break;case"u":d.push(a[g].toUpperCase()),f++;break;case"L":d.push(a[g].toLowerCase());break;case"l":d.push(a[g].toLowerCase()),f++;break;default:d.push(a[g])}}a=d.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 Bd{static staticValue(e){return new Bd(e,-1,null)}static caseOps(e,t){return new Bd(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 TR{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++]=Bd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Bd.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Bd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new M0(this._result)}}function MR(o){if(!o||o.length===0)return new M0(null);const e=[],t=new TR(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 d=o.charCodeAt(i+1);if(48<=d&&d<=57){i++,a=a*10+(d-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 $l=new xn("findWidgetVisible",!1);$l.toNegated();const Qv=new xn("findInputFocussed",!1),d9=new xn("replaceInputFocussed",!1),ix={primary:545,mac:{primary:2593}},nx={primary:565,mac:{primary:2613}},sx={primary:560,mac:{primary:2608}},ox={primary:554,mac:{primary:2602}},rx={primary:558,mac:{primary:2606}},Nn={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"},hc=19999,RR=240;class Jf{constructor(e,t){this._toDispose=new Bt,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new dp,this._decorations=new Z1(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new As(()=>{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,ao(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)},RR)):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 d=a.endLineNumber;return a.endColumn===1&&(d=d-1),new ee(a.startLineNumber,1,d,this._editor.getModel().getLineMaxColumn(d))}return a}));const n=this._findMatches(i,!1,hc);this._decorations.set(n,i);const s=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(s);if(r===0&&n.length>0){const a=c2(n.map(d=>d.range),d=>ee.compareRangesUsingStarts(d,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 pi(i,n)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const f=this._decorations.matchAfterPosition(e);f&&this._setCurrentFindMatch(f);return}if(this._decorations.getCount()<hc){let f=this._decorations.matchBeforePosition(e);f&&f.isEmpty()&&f.getStartPosition().equals(e)&&(e=this._prevSearchPosition(e),f=this._decorations.matchBeforePosition(e)),f&&this._setCurrentFindMatch(f);return}if(this._cannotFind())return;const i=this._decorations.getFindScope(),n=Jf._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 d=new pi(s,r),u=a.findPreviousMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,!1);if(u&&u.range.isEmpty()&&u.range.getStartPosition().equals(d)&&(d=this._prevSearchPosition(d),u=a.findPreviousMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,!1)),!!u){if(!t&&!n.containsRange(u.range))return this._moveToPrevMatch(u.range.getStartPosition(),!0);this._setCurrentFindMatch(u.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 pi(i,n)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()<hc){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=Jf._getSearchRange(this._editor.getModel(),s);r.getEndPosition().isBefore(e)&&(e=r.getStartPosition()),e.isBefore(r.getStartPosition())&&(e=r.getStartPosition());const{lineNumber:a,column:d}=e,u=this._editor.getModel();let f=new pi(a,d),g=u.findNextMatch(this._state.searchString,f,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t);return i&&g&&g.range.isEmpty()&&g.range.getStartPosition().equals(f)&&(f=this._nextSearchPosition(f),g=u.findNextMatch(this._state.searchString,f,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t)),g?!n&&!r.containsRange(g.range)?this._getNextMatch(g.range.getEndPosition(),t,i,!0):g: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?MR(this._state.replaceString):M0.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 lp(t,n);this._executeEditorCommand("replace",s),this._decorations.setStartPosition(new pi(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=>Jf._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>=hc?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new q3(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 g="mu";i.ignoreCase&&(g+="i"),i.global&&(g+="g"),i=new RegExp(i.source,g)}const n=this._editor.getModel(),s=n.getValue(1),r=n.getFullModelRange(),a=this._getReplacePattern();let d;const u=this._state.preserveCase;a.hasReplacementPatterns||u?d=s.replace(i,function(){return a.buildReplaceString(arguments,u)}):d=s.replace(i,a.buildReplaceString(null,u));const f=new d2(r,d,this._editor.getSelection());this._executeEditorCommand("replaceAll",f)}_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 IR(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 Hi(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 M_=class M_ extends gp{constructor(e,t,i){super(),this._hideSoon=this._register(new As(()=>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:Cd(h2),inputActiveOptionForeground:Cd(u2),inputActiveOptionBackground:Cd(lw)},s=this._register(PC());this.caseSensitive=this._register(new G3({appendTitle:this._keybindingLabelFor(Nn.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 K3({appendTitle:this._keybindingLabelFor(Nn.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 Z3({appendTitle:this._keybindingLabelFor(Nn.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(Cn(this._domNode,is.MOUSE_LEAVE,r=>this._onMouseLeave())),this._register(Cn(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 M_.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")}};M_.ID="editor.contrib.findOptionsWidget";let X1=M_;function ax(o,e){return o===1?!0:o===2?!1:e}class NR extends Pt{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return ax(this._isRegexOverride,this._isRegex)}get wholeWord(){return ax(this._wholeWordOverride,this._wholeWord)}get matchCase(){return ax(this._matchCaseOverride,this._matchCase)}get preserveCase(){return ax(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 nn),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"&&(ee.equalsRange(this._currentMatch,i)||(this._currentMatch=i,n.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(n)}change(e,t,i=!0){var f;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,d=this.matchCase,u=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"&&((f=e.searchScope)!=null&&f.every(g=>{var p;return(p=this._searchScope)==null?void 0:p.some(C=>!ee.equalsRange(C,g))})||(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),d!==this.matchCase&&(s=!0,n.matchCase=!0),u!==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>=hc}}const OR=S("defaultLabel","input"),HR=S("label.preserveCaseToggle","Preserve Case");class WR extends f2{constructor(e){super({icon:Ui.preserveCase,title:HR+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Av("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class zR extends gp{constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new nn),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new nn),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new nn),this._onInput=this._register(new nn),this._onKeyUp=this._register(new nn),this._onPreserveCaseKeyDown=this._register(new nn),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||OR;const s=n.appendPreserveCaseLabel||"",r=n.history||[],a=!!n.flexibleHeight,d=!!n.flexibleWidth,u=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new X3(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:r,showHistoryHint:n.showHistoryHint,flexibleHeight:a,flexibleWidth:d,flexibleMaxHeight:u,inputBoxStyles:n.inputBoxStyles})),this.preserveCase=this._register(new WR({appendTitle:s,isChecked:!1,...n.toggleStyles})),this._register(this.preserveCase.onChange(p=>{this._onDidOptionChange.fire(p),!p&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(p=>{this._onPreserveCaseKeyDown.fire(p)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;const f=[this.preserveCase.domNode];this.onkeydown(this.domNode,p=>{if(p.equals(15)||p.equals(17)||p.equals(9)){const C=f.indexOf(this.domNode.ownerDocument.activeElement);if(C>=0){let b=-1;p.equals(17)?b=(C+1)%f.length:p.equals(15)&&(C===0?b=f.length-1:b=C-1),p.equals(9)?(f[C].blur(),this.inputBox.focus()):b>=0&&f[b].focus(),im.stop(p,!0)}}});const g=document.createElement("div");g.className="controls",g.style.display=this._showOptionButtons?"block":"none",g.appendChild(this.preserveCase.domNode),this.domNode.appendChild(g),e==null||e.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,p=>this._onKeyDown.fire(p)),this.onkeyup(this.inputBox.inputElement,p=>this._onKeyUp.fire(p)),this.oninput(this.inputBox.inputElement,p=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,p=>this._onMouseDown.fire(p))}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 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},H5=function(o,e){return function(t,i){e(t,i,o)}};const u9=new xn("suggestWidgetVisible",!1,S("suggestWidgetVisible","Whether suggestion are visible")),h9="historyNavigationWidgetFocus",W5="historyNavigationForwardsEnabled",z5="historyNavigationBackwardsEnabled";let Sl;const lx=[];function V5(o,e){if(lx.includes(e))throw new Error("Cannot register the same widget multiple times");lx.push(e);const t=new Bt,i=new xn(h9,!1).bindTo(o),n=new xn(W5,!0).bindTo(o),s=new xn(z5,!0).bindTo(o),r=()=>{i.set(!0),Sl=e},a=()=>{i.set(!1),Sl===e&&(Sl=void 0)};return Q3(e.element)&&r(),t.add(e.onDidFocus(()=>r())),t.add(e.onDidBlur(()=>a())),t.add(Zn(()=>{lx.splice(lx.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let Y1=class extends Y3{constructor(e,t,i,n){super(e,t,i);const s=this._register(n.createScoped(this.inputBox.element));this._register(V5(s,this.inputBox))}};Y1=O5([H5(3,En)],Y1);let Q1=class extends zR{constructor(e,t,i,n,s=!1){super(e,t,s,i);const r=this._register(n.createScoped(this.inputBox.element));this._register(V5(r,this.inputBox))}};Q1=O5([H5(3,En)],Q1);tl.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:$e.and($e.has(h9),$e.equals(z5,!0),$e.not("isComposing"),u9.isEqualTo(!1)),primary:16,secondary:[528],handler:o=>{Sl==null||Sl.showPreviousValue()}});tl.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:$e.and($e.has(h9),$e.equals(W5,!0),$e.not("isComposing"),u9.isEqualTo(!1)),primary:18,secondary:[530],handler:o=>{Sl==null||Sl.showNextValue()}});function R8(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 N8=ds("find-collapsed",Ui.chevronRight,S("findCollapsedIcon","Icon to indicate that the editor find widget is collapsed.")),O8=ds("find-expanded",Ui.chevronDown,S("findExpandedIcon","Icon to indicate that the editor find widget is expanded.")),VR=ds("find-selection",Ui.selection,S("findSelectionIcon","Icon for 'Find in Selection' in the editor find widget.")),jR=ds("find-replace",Ui.replace,S("findReplaceIcon","Icon for 'Replace' in the editor find widget.")),$R=ds("find-replace-all",Ui.replaceAll,S("findReplaceAllIcon","Icon for 'Replace All' in the editor find widget.")),UR=ds("find-previous-match",Ui.arrowUp,S("findPreviousMatchIcon","Icon for 'Find Previous' in the editor find widget.")),qR=ds("find-next-match",Ui.arrowDown,S("findNextMatchIcon","Icon for 'Find Next' in the editor find widget.")),GR=S("label.findDialog","Find / Replace"),KR=S("label.find","Find"),ZR=S("placeholder.find","Find"),XR=S("label.previousMatchButton","Previous Match"),YR=S("label.nextMatchButton","Next Match"),QR=S("label.toggleSelectionFind","Find in Selection"),JR=S("label.closeButton","Close"),eN=S("label.replace","Replace"),tN=S("placeholder.replace","Replace"),iN=S("label.replaceButton","Replace"),nN=S("label.replaceAllButton","Replace All"),sN=S("label.toggleReplaceButton","Toggle Replace"),oN=S("title.matchesCountLimit","Only the first {0} results are highlighted, but all find operations work on the entire text.",hc),rN=S("label.matchesLocation","{0} of {1}"),H8=S("label.noResults","No results"),Da=419,aN=275,lN=aN-54;let bf=69;const cN=33,W8="ctrlEnterReplaceAll.windows.donotask",z8=Ya?256:2048;class Yb{constructor(e){this.afterLineNumber=e,this.heightInPx=cN,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function V8(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){o.stopPropagation();return}}function j8(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEnd<t.value.length){o.stopPropagation();return}}const R_=class R_ extends gp{constructor(e,t,i,n,s,r,a,d,u,f){super(),this._hoverService=f,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=d,this._notificationService=u,this._ctrlEnterReplaceAllWarningPrompted=!!d.getBoolean(W8,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new Rc(500),this._register(Zn(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(g=>this._onStateChanged(g))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(g=>{if(g.hasChanged(92)&&(this._codeEditor.getOption(92)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),g.hasChanged(146)&&this._tryUpdateWidgetWidth(),g.hasChanged(2)&&this.updateAccessibilitySupport(),g.hasChanged(41)){const p=this._codeEditor.getOption(41).loop;this._state.change({loop:p},!1);const C=this._codeEditor.getOption(41).addExtraSpaceOnTop;C&&!this._viewZone&&(this._viewZone=new Yb(0),this._showViewZone()),!C&&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 g=await this._controller.getGlobalBufferTerm();g&&g!==this._state.searchString&&(this._state.change({searchString:g},!1),this._findInput.select())}})),this._findInputFocused=Qv.bindTo(r),this._findFocusTracker=this._register(g0(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=d9.bindTo(r),this._replaceFocusTracker=this._register(g0(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 Yb(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(g=>{if(g.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return R_.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=Ar(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=bf+"px",this._state.matchesCount>=hc?this._matchesCount.title=oN: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>=hc&&(i+="+");let n=String(this._state.matchesPosition);n==="0"&&(n="?"),e=_w(rN,n,i)}else e=H8;this._matchesCount.appendChild(document.createTextNode(e)),zr(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),bf=Math.max(bf,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===H8)return i===""?S("ariaSearchNoResultEmpty","{0} found",e):S("ariaSearchNoResult","{0} found for '{1}'",e,i);if(t){const n=S("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 S("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=bo(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 d=J3(this._domNode).left;r>d&&(t=!1);const u=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());n.left+(u?u.left:0)>d&&(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 Yb(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&&Ar(this._domNode)>Da){this._domNode.style.maxWidth=`${i-28-n-15}px`,this._replaceInput.width=Ar(this._findInput.domNode);return}if(Da+28+n>=i&&(r=!0),Da+28+n-bf>=i&&(a=!0),Da+28+n-bf>=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 d=this._findInput.inputBox.element.clientWidth;d>0&&(this._replaceInput.width=d)}else this._isReplaceVisible&&(this._replaceInput.width=Ar(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&&!ee.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(z8|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 V8(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return j8(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(z8|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{xv&&$0&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(S("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(W8,!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 V8(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return j8(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 Y1(null,this._contextViewProvider,{width:lN,label:KR,placeholder:ZR,appendCaseSensitiveLabel:this._keybindingLabelFor(Nn.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(Nn.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(Nn.ToggleRegexCommand),validation:f=>{if(f.length===0||!this._findInput.getRegex())return null;try{return new RegExp(f,"gu"),null}catch(g){return{content:g.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>R8(this._keybindingService),inputBoxStyles:wS,toggleStyles:yS},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(f=>this._onFindInputKeyDown(f))),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(f=>{f.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),f.preventDefault())})),this._register(this._findInput.onRegexKeyDown(f=>{f.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),f.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(f=>{this._tryUpdateHeight()&&this._showViewZone()})),eL&&this._register(this._findInput.onMouseDown(f=>this._onFindInputMouseDown(f))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(PC());this._prevBtn=this._register(new ch({label:XR+this._keybindingLabelFor(Nn.PreviousMatchFindAction),icon:UR,hoverDelegate:i,onTrigger:()=>{kh(this._codeEditor.getAction(Nn.PreviousMatchFindAction)).run().then(void 0,On)}},this._hoverService)),this._nextBtn=this._register(new ch({label:YR+this._keybindingLabelFor(Nn.NextMatchFindAction),icon:qR,hoverDelegate:i,onTrigger:()=>{kh(this._codeEditor.getAction(Nn.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 f2({icon:VR,title:QR+this._keybindingLabelFor(Nn.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:Cd(lw),inputActiveOptionBorder:Cd(h2),inputActiveOptionForeground:Cd(u2)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let f=this._codeEditor.getSelections();f=f.map(g=>(g.endColumn===1&&g.endLineNumber>g.startLineNumber&&(g=g.setEndPosition(g.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(g.endLineNumber-1))),g.isEmpty()?null:g)).filter(g=>!!g),f.length&&this._state.change({searchScope:f},!0)}}else this._state.change({searchScope:null},!0)})),s.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new ch({label:JR+this._keybindingLabelFor(Nn.CloseFindWidgetCommand),icon:g2,hoverDelegate:i,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:f=>{f.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),f.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new Q1(null,void 0,{label:eN,placeholder:tN,appendPreserveCaseLabel:this._keybindingLabelFor(Nn.TogglePreserveCaseCommand),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>R8(this._keybindingService),inputBoxStyles:wS,toggleStyles:yS},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(f=>this._onReplaceInputKeyDown(f))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(f=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(f=>{f.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(),f.preventDefault())}));const r=this._register(PC());this._replaceBtn=this._register(new ch({label:iN+this._keybindingLabelFor(Nn.ReplaceOneAction),icon:jR,hoverDelegate:r,onTrigger:()=>{this._controller.replace()},onKeyDown:f=>{f.equals(1026)&&(this._closeBtn.focus(),f.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new ch({label:nN+this._keybindingLabelFor(Nn.ReplaceAllAction),icon:$R,hoverDelegate:r,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));const a=document.createElement("div");a.className="replace-part",a.appendChild(this._replaceInput.domNode);const d=document.createElement("div");d.className="replace-actions",a.appendChild(d),d.appendChild(this._replaceBtn.domNode),d.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new ch({label:sN,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=Ar(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=GR,this._domNode.role="dialog",this._domNode.style.width=`${Da}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 Sh(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let u=Da;this._register(this._resizeSash.onDidStart(()=>{u=Ar(this._domNode)})),this._register(this._resizeSash.onDidChange(f=>{this._resized=!0;const g=u+f.startX-f.currentX;if(g<Da)return;const p=parseFloat(tL(this._domNode).maxWidth)||0;g>p||(this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=Ar(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const f=Ar(this._domNode);if(f<Da)return;let g=Da;if(!this._resized||f===Da){const p=this._codeEditor.getLayoutInfo();g=p.width-28-p.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=Ar(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2)}};R_.ID="editor.contrib.findWidget";let J1=R_;class ch extends gp{constructor(e,t){super(),this._opts=e;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+Dn.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??Av("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(...Dn.asClassNameArray(N8)),this._domNode.classList.add(...Dn.asClassNameArray(O8))):(this._domNode.classList.remove(...Dn.asClassNameArray(O8)),this._domNode.classList.add(...Dn.asClassNameArray(N8)))}}bv((o,e)=>{const t=o.getColor(GA);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${gg(o.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=o.getColor(iL);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${gg(o.type)?"dashed":"solid"} ${i}; }`);const n=o.getColor(kl);n&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${n}; }`);const s=o.getColor(nL);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const r=o.getColor(sL);r&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});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},ar=function(o,e){return function(t,i){e(t,i,o)}},eE;const dN=524288;function tE(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)<dN)return o.getModel().getValueInRange(i)}return null}var Zd;let Eo=(Zd=class extends Pt{get editor(){return this._editor}static get(e){return e.getContribution(eE.ID)}constructor(e,t,i,n,s,r){super(),this._editor=e,this._findWidgetVisible=$l.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._notificationService=s,this._hoverService=r,this._updateHistoryDelayer=new Rc(500),this._state=this._register(new NR),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!!Qv.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=pg(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=tE(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);n&&(this._state.isRegex?i.searchString=pg(n):i.searchString=n)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const n=tE(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 Jf(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(S("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)}},eE=Zd,Zd.ID="editor.contrib.findController",Zd);Eo=eE=j5([ar(1,En),ar(2,Uc),ar(3,j0),ar(4,go),ar(5,mp)],Eo);let iE=class extends Eo{constructor(e,t,i,n,s,r,a,d,u){super(e,i,a,d,r,u),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 J1(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService,this._hoverService)),this._findOptionsWidget=this._register(new X1(this._editor,this._state,this._keybindingService))}};iE=j5([ar(1,vv),ar(2,En),ar(3,ms),ar(4,$r),ar(5,go),ar(6,Uc),ar(7,j0),ar(8,mp)],iE);const uN=p2(new x2({id:Nn.StartFindAction,label:S("startFindAction","Find"),alias:"Find",precondition:$e.or(U.focus,$e.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:Yt.MenubarEditMenu,group:"3_find",title:S({key:"miFind",comment:["&& denotes a mnemonic"]},"&&Find"),order:1}}));uN.addImplementation(0,(o,e,t)=>{const i=Eo.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 hN={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 fN extends gt{constructor(){super({id:Nn.StartFindWithArgs,label:S("startFindWithArgsAction","Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:hN})}async run(e,t,i){const n=Eo.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 gN extends gt{constructor(){super({id:Nn.StartFindWithSelection,label:S("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=Eo.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 $5 extends gt{async run(e,t){const i=Eo.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 pN extends $5{constructor(){super({id:Nn.NextMatchFindAction,label:S("findNextMatchAction","Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:U.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:$e.and(U.focus,Qv),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class xN extends $5{constructor(){super({id:Nn.PreviousMatchFindAction,label:S("findPreviousMatchAction","Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:U.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:$e.and(U.focus,Qv),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class mN extends gt{constructor(){super({id:Nn.GoToMatchFindAction,label:S("findMatchAction.goToMatch","Go to Match..."),alias:"Go to Match...",precondition:$l}),this._highlightDecorations=[]}run(e,t,i){const n=Eo.get(t);if(!n)return;const s=n.getState().matchesCount;if(s<1){e.get(go).notify({severity:xw.Warning,message:S("findMatchAction.noResults","No matches. Try searching for something else.")});return}const r=e.get(Ol),a=new Bt,d=a.add(r.createInputBox());d.placeholder=S("findMatchAction.inputPlaceHolder","Type a number to go to a specific match (between 1 and {0})",s);const u=g=>{const p=parseInt(g);if(isNaN(p))return;const C=n.getState().matchesCount;if(p>0&&p<=C)return p-1;if(p<0&&p>=-C)return C+p},f=g=>{const p=u(g);if(typeof p=="number"){d.validationMessage=void 0,n.goToMatch(p);const C=n.getState().currentMatch;C&&this.addDecorations(t,C)}else d.validationMessage=S("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",n.getState().matchesCount),this.clearDecorations(t)};a.add(d.onDidChangeValue(g=>{f(g)})),a.add(d.onDidAccept(()=>{const g=u(d.value);typeof g=="number"?(n.goToMatch(g),d.hide()):d.validationMessage=S("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",n.getState().matchesCount)})),a.add(d.onDidHide(()=>{this.clearDecorations(t),a.dispose()})),d.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:bs(m2),position:qa.Full}}}])})}}class U5 extends gt{async run(e,t){const i=Eo.get(t);if(!i)return;const n=tE(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 _N extends U5{constructor(){super({id:Nn.NextSelectionMatchFindAction,label:S("nextSelectionMatchFindAction","Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:U.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class vN extends U5{constructor(){super({id:Nn.PreviousSelectionMatchFindAction,label:S("previousSelectionMatchFindAction","Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:U.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}const bN=p2(new x2({id:Nn.StartFindReplaceAction,label:S("startReplace","Replace"),alias:"Replace",precondition:$e.or(U.focus,$e.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:Yt.MenubarEditMenu,group:"3_find",title:S({key:"miReplace",comment:["&& denotes a mnemonic"]},"&&Replace"),order:2}}));bN.addImplementation(0,(o,e,t)=>{if(!e.hasModel()||e.getOption(92))return!1;const i=Eo.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})});on(Eo.ID,iE,0);Ae(fN);Ae(gN);Ae(pN);Ae(xN);Ae(mN);Ae(_N);Ae(vN);const _a=wo.bindToContribution(Eo.get);yi(new _a({id:Nn.CloseFindWidgetCommand,precondition:$l,handler:o=>o.closeFindWidget(),kbOpts:{weight:105,kbExpr:$e.and(U.focus,$e.not("isComposing")),primary:9,secondary:[1033]}}));yi(new _a({id:Nn.ToggleCaseSensitiveCommand,precondition:void 0,handler:o=>o.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:U.focus,primary:ix.primary,mac:ix.mac,win:ix.win,linux:ix.linux}}));yi(new _a({id:Nn.ToggleWholeWordCommand,precondition:void 0,handler:o=>o.toggleWholeWords(),kbOpts:{weight:105,kbExpr:U.focus,primary:nx.primary,mac:nx.mac,win:nx.win,linux:nx.linux}}));yi(new _a({id:Nn.ToggleRegexCommand,precondition:void 0,handler:o=>o.toggleRegex(),kbOpts:{weight:105,kbExpr:U.focus,primary:sx.primary,mac:sx.mac,win:sx.win,linux:sx.linux}}));yi(new _a({id:Nn.ToggleSearchScopeCommand,precondition:void 0,handler:o=>o.toggleSearchScope(),kbOpts:{weight:105,kbExpr:U.focus,primary:ox.primary,mac:ox.mac,win:ox.win,linux:ox.linux}}));yi(new _a({id:Nn.TogglePreserveCaseCommand,precondition:void 0,handler:o=>o.togglePreserveCase(),kbOpts:{weight:105,kbExpr:U.focus,primary:rx.primary,mac:rx.mac,win:rx.win,linux:rx.linux}}));yi(new _a({id:Nn.ReplaceOneAction,precondition:$l,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:U.focus,primary:3094}}));yi(new _a({id:Nn.ReplaceOneAction,precondition:$l,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:$e.and(U.focus,d9),primary:3}}));yi(new _a({id:Nn.ReplaceAllAction,precondition:$l,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:U.focus,primary:2563}}));yi(new _a({id:Nn.ReplaceAllAction,precondition:$l,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:$e.and(U.focus,d9),primary:void 0,mac:{primary:2051}}}));yi(new _a({id:Nn.SelectAllMatchesAction,precondition:$l,handler:o=>o.selectAllMatches(),kbOpts:{weight:105,kbExpr:U.focus,primary:515}}));const CN={0:" ",1:"u",2:"r"},$8=65535,ta=16777215,U8=4278190080;class Qb{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 Go{constructor(e,t,i){if(e.length!==t.length||e.length>$8)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new Qb(e.length),this._userDefinedStates=new Qb(e.length),this._recoveredStates=new Qb(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>ta||r>ta)throw new Error("startLineNumber or endLineNumber must not exceed "+ta);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]&ta}getEndLineNumber(e){return this._endIndexes[e]&ta}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 EN(this,e)}getParentIndex(e){this.ensureParentIndices();const t=((this._startIndexes[e]&U8)>>>24)+((this._endIndexes[e]&U8)>>>16);return t===$8?-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]=`[${CN[this.getSource(t)]}${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&ta,endLineNumber:this._endIndexes[e]&ta,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 d=0;d<t;d++){const u=e[d];i[d]=u.startLineNumber,n[d]=u.endLineNumber,s.push(u.type),u.type&&(r=!0)}r||(s=void 0);const a=new Go(i,n,s);for(let d=0;d<t;d++)e[d].isCollapsed&&a.setCollapsed(d,!0),a.setSource(d,e[d].source);return a}static sanitizeAndMerge(e,t,i,n){i=i??Number.MAX_VALUE;const s=(y,D)=>Array.isArray(y)?(I=>I<D?y[I]:void 0):(I=>I<D?y.toFoldRange(I):void 0),r=s(e,e.length),a=s(t,t.length);let d=0,u=0,f=r(0),g=a(0);const p=[];let C,b=0;const E=[];for(;f||g;){let y;if(g&&(!f||f.startLineNumber>=g.startLineNumber))f&&f.startLineNumber===g.startLineNumber?(g.source===1?y=g:(y=f,y.isCollapsed=g.isCollapsed&&(f.endLineNumber===g.endLineNumber||!(n!=null&&n.startsInside(f.startLineNumber+1,f.endLineNumber+1))),y.source=0),f=r(++d)):(y=g,g.isCollapsed&&g.source===0&&(y.source=2)),g=a(++u);else{let D=u,I=g;for(;;){if(!I||I.startLineNumber>f.endLineNumber){y=f;break}if(I.source===1&&I.endLineNumber>f.endLineNumber)break;I=a(++D)}f=r(++d)}if(y){for(;C&&C.endLineNumber<y.startLineNumber;)C=p.pop();y.endLineNumber>y.startLineNumber&&y.startLineNumber>b&&y.endLineNumber<=i&&(!C||C.endLineNumber>=y.endLineNumber)&&(E.push(y),b=y.startLineNumber,C&&p.push(C),C=y)}}return E}}class EN{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 yN{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new nn,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new Go(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=d=>{for(;n<d;){const u=this._regions.getEndLineNumber(n),f=this._regions.isCollapsed(n);if(u<=s){const g=this.regions.getSource(n)!==0;i.changeDecorationOptions(this._editorDecorationIds[n],this._decorationProvider.getDecorationOption(f,u<=r,g))}f&&u>r&&(r=u),n++}};for(const d of e){const u=d.regionIndex,f=this._editorDecorationIds[u];if(f&&!t[f]){t[f]=!0,a(u);const g=!this._regions.isCollapsed(u);this._regions.setCollapsed(u,g),s=Math.max(s,this._regions.getEndLineNumber(u))}}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(Go.fromFoldRanges(t))}update(e,t){const i=this._currentFoldedOrManualRanges(t),n=Go.sanitizeAndMerge(e,i,this._textModel.getLineCount(),t);this.updatePost(Go.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),d=e.isCollapsed(n),u=e.getSource(n)!==0,f={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:a,endColumn:this._textModel.getLineMaxColumn(a)+1};t.push({range:f,options:this._decorationProvider.getDecorationOption(d,a<=i,u)}),d&&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),d=this._textModel.getDecorationRange(this._editorDecorationIds[i]);d&&(s&&(e!=null&&e.startsInside(d.startLineNumber+1,d.endLineNumber))&&(s=!1),t.push({startLineNumber:d.startLineNumber,endLineNumber:d.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=Go.sanitizeAndMerge(this._regions,t,i);this.updatePost(Go.fromFoldRanges(n))}_getLinesChecksum(e,t){return _2(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,d=this._regions.length;a<d;a++){const u=this._regions.toRegion(a);if(this._regions.getStartLineNumber(a)<s){for(;r.length>0&&!u.containedBy(r[r.length-1]);)r.pop();r.push(u),t(u,r.length)&&i.push(u)}else break}}else for(let r=n,a=this._regions.length;r<a;r++){const d=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<s)(!t||t(d))&&i.push(d);else break}return i}}function f9(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,(d,u)=>d.isCollapsed!==r&&u<e);i.push(...a)}}}o.toggleCollapseState(i)}function Q0(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,(d,u)=>d.isCollapsed!==e&&u<t);n.push(...a)}}else{const s=o.getRegionsInside(null,(r,a)=>r.isCollapsed!==e&&a<t);n.push(...s)}o.toggleCollapseState(n)}function q5(o,e,t,i){const n=[];for(const s of i){const r=o.getAllRegionsAtLine(s,(a,d)=>a.isCollapsed!==e&&d<=t);n.push(...r)}o.toggleCollapseState(n)}function wN(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 SN(o,e,t,i){const n=(r,a)=>a===e&&r.isCollapsed!==t&&!i.some(d=>r.containsLine(d)),s=o.getRegionsInside(null,n);o.toggleCollapseState(s)}function G5(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 g9(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 p9(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 DN(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 AN(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 kN(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 BN{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(e){this._updateEventEmitter=new nn,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||oL(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 d=a.getStartLineNumber(i)+1,u=a.getEndLineNumber(i);s<=d&&u<=r||(!e&&n<this._hiddenRanges.length&&this._hiddenRanges[n].startLineNumber===d&&this._hiddenRanges[n].endLineNumber===u?(t.push(this._hiddenRanges[n]),n++):(e=!0,t.push(new ee(d,1,u,1))),s=d,r=u)}(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 q8(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let n=null;const s=r=>((!n||!FN(r,n))&&(n=q8(this._hiddenRanges,r)),n?n.startLineNumber-1:null);for(let r=0,a=e.length;r<a;r++){let d=e[r];const u=s(d.startLineNumber);u&&(d=d.setStartPosition(u,i.getLineMaxColumn(u)),t=!0);const f=s(d.endLineNumber);f&&(d=d.setEndPosition(f,i.getLineMaxColumn(f)),t=!0),e[r]=d}return t}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function FN(o,e){return o>=e.startLineNumber&&o<=e.endLineNumber}function q8(o,e){const t=c2(o,i=>e<i.startLineNumber)-1;return t>=0&&o[t].endLineNumber>=e?o[t]:null}const LN=5e3,IN="indent";class x9{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=IN}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,n=t&&t.markers;return Promise.resolve(MN(this.editorModel,i,n,this.foldingRangesLimit))}}let PN=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>ta||t>ta)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 Go(i,n)}else{this._foldingRangesLimit.update(this._length,t);let i=0,n=this._indentOccurrences.length;for(let d=0;d<this._indentOccurrences.length;d++){const u=this._indentOccurrences[d];if(u){if(u+i>t){n=d;break}i+=u}}const s=e.getOptions().tabSize,r=new Uint32Array(t),a=new Uint32Array(t);for(let d=this._length-1,u=0;d>=0;d--){const f=this._startIndexes[d],g=e.getLineContent(f),p=sw(g,s);(p<n||p===n&&i++<t)&&(r[u]=f,a[u]=this._endIndexes[d],u++)}return new Go(r,a)}}};const TN={limit:LN,update:()=>{}};function MN(o,e,t,i=TN){const n=o.getOptions().tabSize,s=new PN(i);let r;t&&(r=new RegExp(`(${t.start.source})|(?:${t.end.source})`));const a=[],d=o.getLineCount()+1;a.push({indent:-1,endAbove:d,line:d});for(let u=o.getLineCount();u>0;u--){const f=o.getLineContent(u),g=sw(f,n);let p=a[a.length-1];if(g===-1){e&&(p.endAbove=u);continue}let C;if(r&&(C=f.match(r)))if(C[1]){let b=a.length-1;for(;b>0&&a[b].indent!==-2;)b--;if(b>0){a.length=b+1,p=a[b],s.insertFirst(u,p.line,g),p.line=u,p.indent=g,p.endAbove=u;continue}}else{a.push({indent:-2,endAbove:u,line:u});continue}if(p.indent>g){do a.pop(),p=a[a.length-1];while(p.indent>g);const b=p.endAbove-1;b-u>=1&&s.insertFirst(u,b,g)}p.indent===g?p.endAbove=u:a.push({indent:g,endAbove:u,line:u})}return s.toIndentRanges(o)}const RN=ci("editor.foldBackground",{light:Ka(SS,.3),dark:Ka(SS,.3),hcDark:null,hcLight:null},S("foldBackgroundBackground","Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);ci("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},S("collapsedTextColor","Color of the collapsed text after the first line of a folded range."));ci("editorGutter.foldingControlForeground",rL,S("editorGutter.foldingControlForeground","Color of the folding control in the editor gutter."));const Pm=ds("folding-expanded",Ui.chevronDown,S("foldingExpandedIcon","Icon for expanded ranges in the editor glyph margin.")),Tm=ds("folding-collapsed",Ui.chevronRight,S("foldingCollapsedIcon","Icon for collapsed ranges in the editor glyph margin.")),G8=ds("folding-manual-collapsed",Tm,S("foldingManualCollapedIcon","Icon for manually collapsed ranges in the editor glyph margin.")),K8=ds("folding-manual-expanded",Pm,S("foldingManualExpandedIcon","Icon for manually expanded ranges in the editor glyph margin.")),Jb={color:bs(RN),position:1},dh=S("linesCollapsed","Click to expand the range."),cx=S("linesExpanded","Click to collapse the range."),us=class us{constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?us.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?us.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:us.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:us.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?us.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:us.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?us.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:us.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?us.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:us.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?us.MANUALLY_EXPANDED_VISUAL_DECORATION:us.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}};us.COLLAPSED_VISUAL_DECORATION=fn.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:dh,firstLineDecorationClassName:Dn.asClassName(Tm)}),us.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=fn.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Jb,isWholeLine:!0,linesDecorationsTooltip:dh,firstLineDecorationClassName:Dn.asClassName(Tm)}),us.MANUALLY_COLLAPSED_VISUAL_DECORATION=fn.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:dh,firstLineDecorationClassName:Dn.asClassName(G8)}),us.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=fn.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Jb,isWholeLine:!0,linesDecorationsTooltip:dh,firstLineDecorationClassName:Dn.asClassName(G8)}),us.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=fn.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:dh}),us.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=fn.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Jb,isWholeLine:!0,linesDecorationsTooltip:dh}),us.EXPANDED_VISUAL_DECORATION=fn.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Dn.asClassName(Pm),linesDecorationsTooltip:cx}),us.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=fn.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:Dn.asClassName(Pm),linesDecorationsTooltip:cx}),us.MANUALLY_EXPANDED_VISUAL_DECORATION=fn.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Dn.asClassName(K8),linesDecorationsTooltip:cx}),us.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=fn.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:Dn.asClassName(K8),linesDecorationsTooltip:cx}),us.NO_CONTROLS_EXPANDED_RANGE_DECORATION=fn.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),us.HIDDEN_RANGE_DECORATION=fn.register({description:"folding-hidden-range-decoration",stickiness:1});let nE=us;const NN={},ON="syntax";class m9{constructor(e,t,i,n,s){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=i,this.foldingRangesLimit=n,this.fallbackRangeProvider=s,this.id=ON,this.disposables=new Bt,s&&this.disposables.add(s);for(const r of t)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(i))}compute(e){return HN(this.providers,this.editorModel,e).then(t=>{var i;return t?zN(t,this.foldingRangesLimit):((i=this.fallbackRangeProvider)==null?void 0:i.compute(e))??null})}dispose(){this.disposables.dispose()}}function HN(o,e,t){let i=null;const n=o.map((s,r)=>Promise.resolve(s.provideFoldingRanges(e,NN,t)).then(a=>{if(!t.isCancellationRequested&&Array.isArray(a)){Array.isArray(i)||(i=[]);const d=e.getLineCount();for(const u of a)u.start>0&&u.end>u.start&&u.end<=d&&i.push({start:u.start,end:u.end,rank:r,kind:u.kind})}},hs));return Promise.all(n).then(s=>i)}class WN{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>ta||t>ta)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 Go(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 d=this._nestingLevelCounts[a];if(d){if(d+t>e){i=a;break}t+=d}}const n=new Uint32Array(e),s=new Uint32Array(e),r=[];for(let a=0,d=0;a<this._length;a++){const u=this._nestingLevels[a];(u<i||u===i&&t++<e)&&(n[d]=this._startIndexes[a],s[d]=this._endIndexes[a],r[d]=this._types[a],d++)}return new Go(n,s,r)}}}function zN(o,e){const t=o.sort((r,a)=>{let d=r.start-a.start;return d===0&&(d=r.rank-a.rank),d}),i=new WN(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 VN=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},Cf=function(o,e){return function(t,i){e(t,i,o)}},sd;const qs=new xn("foldingEnabled",!1);var Xd;let zc=(Xd=class extends Pt{static get(e){return e.getContribution(sd.ID)}static getFoldingRangeProviders(e,t){var n;const i=e.foldingRangeProvider.ordered(t);return((n=sd._foldingRangeSelector)==null?void 0:n.call(sd,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 Bt),this.editor=e,this._foldingLimitReporter=new K5(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 nE(e),this.foldingDecorationProvider.showFoldingControls=a.get(111),this.foldingDecorationProvider.showFoldingHighlights=a.get(45),this.foldingEnabled=qs.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(d=>{if(d.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),d.hasChanged(47)&&this.onModelChanged(),d.hasChanged(111)||d.hasChanged(45)){const u=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=u.get(111),this.foldingDecorationProvider.showFoldingHighlights=u.get(45),this.triggerFoldingModelChanged()}d.hasChanged(44)&&(this._useFoldingProviders=this.editor.getOptions().get(44)!=="indentation",this.onFoldingStrategyChanged()),d.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),d.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 yN(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new BN(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new Rc(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new As(()=>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 x9(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=sd.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new m9(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 Ro,i=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=Ws(s=>i.compute(s));return n.then(s=>{if(s&&n===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const u=s.setCollapsedAllOfType(Cp.Imports.value,!0);u&&(r=x0.capture(this.editor),this._currentModelHasFoldedImports=u)}const a=this.editor.getSelections();e.update(s,jN(a)),r==null||r.restore(this.editor);const d=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=d)}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 d=e.event.altKey;let u=[];if(d){const f=p=>!p.containedBy(r)&&!r.containedBy(p),g=t.getRegionsInside(null,f);for(const p of g)p.isCollapsed&&u.push(p);u.length===0&&(u=g)}else{const f=e.event.middleButton||e.event.shiftKey;if(f)for(const g of t.getRegionsInside(r))g.isCollapsed===a&&u.push(g);(a||!f||u.length===0)&&u.push(r)}t.toggleCollapseState(u),this.reveal({lineNumber:i,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}},sd=Xd,Xd.ID="editor.contrib.folding",Xd);zc=sd=VN([Cf(1,En),Cf(2,Ns),Cf(3,go),Cf(4,fr),Cf(5,xi)],zc);class K5{constructor(e){this.editor=e,this._onDidChange=new nn,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 Js extends gt{runEditorCommand(e,t,i){const n=e.get(Ns),s=zc.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 d=t.getSelection();d&&s.reveal(d.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 jN(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 Z5(o){if(!Af(o)){if(!v2(o))return!1;const e=o;if(!Af(e.levels)&&!DS(e.levels)||!Af(e.direction)&&!UA(e.direction)||!Af(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(DS)))return!1}return!0}class $N extends Js{constructor(){super({id:"editor.unfold",label:S("unfoldAction.label","Unfold"),alias:"Unfold",precondition:qs,kbOpts:{kbExpr:U.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:Z5,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"?q5(t,!1,s,r):Q0(t,!1,s,r)}}class UN extends Js{constructor(){super({id:"editor.unfoldRecursively",label:S("unFoldRecursivelyAction.label","Unfold Recursively"),alias:"Unfold Recursively",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2142),weight:100}})}invoke(e,t,i,n){Q0(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}class qN extends Js{constructor(){super({id:"editor.fold",label:S("foldAction.label","Fold"),alias:"Fold",precondition:qs,kbOpts:{kbExpr:U.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:Z5,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"?wN(t,!0,s):a==="up"?q5(t,!0,r||1,s):Q0(t,!0,r||1,s)}}class GN extends Js{constructor(){super({id:"editor.toggleFold",label:S("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2090),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);f9(t,1,n)}}class KN extends Js{constructor(){super({id:"editor.foldRecursively",label:S("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2140),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);Q0(t,!0,Number.MAX_VALUE,n)}}class ZN extends Js{constructor(){super({id:"editor.toggleFoldRecursively",label:S("toggleFoldRecursivelyAction.label","Toggle Fold Recursively"),alias:"Toggle Fold Recursively",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,3114),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);f9(t,Number.MAX_VALUE,n)}}class XN extends Js{constructor(){super({id:"editor.foldAllBlockComments",label:S("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2138),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())p9(t,Cp.Comment.value,!0);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).comments;if(a&&a.blockCommentStartToken){const d=new RegExp("^\\s*"+pg(a.blockCommentStartToken));g9(t,d,!0)}}}}class YN extends Js{constructor(){super({id:"editor.foldAllMarkerRegions",label:S("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2077),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())p9(t,Cp.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 d=new RegExp(a.markers.start);g9(t,d,!0)}}}}class QN extends Js{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:S("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2078),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())p9(t,Cp.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 d=new RegExp(a.markers.start);g9(t,d,!1)}}}}class JN extends Js{constructor(){super({id:"editor.foldAllExcept",label:S("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2136),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);G5(t,!0,n)}}class eO extends Js{constructor(){super({id:"editor.unfoldAllExcept",label:S("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2134),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);G5(t,!1,n)}}class tO extends Js{constructor(){super({id:"editor.foldAll",label:S("foldAllAction.label","Fold All"),alias:"Fold All",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2069),weight:100}})}invoke(e,t,i){Q0(t,!0)}}class iO extends Js{constructor(){super({id:"editor.unfoldAll",label:S("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2088),weight:100}})}invoke(e,t,i){Q0(t,!1)}}const Hh=class Hh extends Js{getFoldingLevel(){return parseInt(this.id.substr(Hh.ID_PREFIX.length))}invoke(e,t,i){SN(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}};Hh.ID_PREFIX="editor.foldLevel",Hh.ID=e=>Hh.ID_PREFIX+e;let Mm=Hh;class nO extends Js{constructor(){super({id:"editor.gotoParentFold",label:S("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=DN(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class sO extends Js{constructor(){super({id:"editor.gotoPreviousFold",label:S("gotoPreviousFold.label","Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=AN(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class oO extends Js{constructor(){super({id:"editor.gotoNextFold",label:S("gotoNextFold.label","Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=kN(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class rO extends Js{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:S("createManualFoldRange.label","Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2135),weight:100}})}invoke(e,t,i){var r;const n=[],s=i.getSelections();if(s){for(const a of s){let d=a.endLineNumber;a.endColumn===1&&--d,d>a.startLineNumber&&(n.push({startLineNumber:a.startLineNumber,endLineNumber:d,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((d,u)=>d.startLineNumber-u.startLineNumber);const a=Go.sanitizeAndMerge(t.regions,n,(r=i.getModel())==null?void 0:r.getLineCount());t.updatePost(Go.fromFoldRanges(a))}}}}class aO extends Js{constructor(){super({id:"editor.removeManualFoldingRanges",label:S("removeManualFoldingRanges.label","Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(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:d}=r;s.push(d>=a?{startLineNumber:a,endLineNumber:d}:{endLineNumber:d,startLineNumber:a})}t.removeManualRanges(s),e.triggerFoldingModelChanged()}}}on(zc.ID,zc,0);Ae($N);Ae(UN);Ae(qN);Ae(KN);Ae(ZN);Ae(tO);Ae(iO);Ae(XN);Ae(YN);Ae(QN);Ae(JN);Ae(eO);Ae(GN);Ae(nO);Ae(sO);Ae(oO);Ae(rO);Ae(aO);for(let o=1;o<=7;o++)aL(new Mm({id:Mm.ID(o),label:S("foldLevelAction.label","Fold Level {0}",o),alias:`Fold Level ${o}`,precondition:qs,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2048|21+o),weight:100}}));Un.registerCommand("_executeFoldingRangeProvider",async function(o,...e){const[t]=e;if(!(t instanceof Rn))throw El();const i=o.get(xi),n=o.get(po).getModel(t);if(!n)throw El();const s=o.get(Yn);if(!s.getValue("editor.folding",{resource:t}))return[];const r=o.get(Ns),a=s.getValue("editor.foldingStrategy",{resource:t}),d={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(C,b)=>{}},u=new x9(n,r,d);let f=u;if(a!=="indentation"){const C=zc.getFoldingRangeProviders(i,n);C.length&&(f=new m9(n,C,()=>{},d,u))}const g=await f.compute(sn.None),p=[];try{if(g)for(let C=0;C<g.length;C++){const b=g.getType(C);p.push({start:g.getStartLineNumber(C),end:g.getEndLineNumber(C),kind:b?Cp.fromValue(b):void 0})}return p}finally{f.dispose()}});class lO extends gt{constructor(){super({id:"editor.action.fontZoomIn",label:S("EditorFontZoomIn.label","Increase Editor Font Size"),alias:"Increase Editor Font Size",precondition:void 0})}run(e,t){Cg.setZoomLevel(Cg.getZoomLevel()+1)}}class cO extends gt{constructor(){super({id:"editor.action.fontZoomOut",label:S("EditorFontZoomOut.label","Decrease Editor Font Size"),alias:"Decrease Editor Font Size",precondition:void 0})}run(e,t){Cg.setZoomLevel(Cg.getZoomLevel()-1)}}class dO extends gt{constructor(){super({id:"editor.action.fontZoomReset",label:S("EditorFontZoomReset.label","Reset Editor Font Size"),alias:"Reset Editor Font Size",precondition:void 0})}run(e,t){Cg.setZoomLevel(0)}}Ae(lO);Ae(cO);Ae(dO);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},eg=function(o,e){return function(t,i){e(t,i,o)}},s0;let Rm=(s0=class{constructor(e,t,i,n){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=n,this._disposables=new Bt,this._sessionDisposables=new Bt,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 nm;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 zs,s=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){n.cancel(),s.dispose();return}for(let a=0,d=r.changes.length;a<d;a++)if(r.changes[a].range.endLineNumber<=i.lineNumber){n.cancel(),s.dispose();return}});lL(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then(r=>{n.token.isCancellationRequested||Zo(r)&&(this._accessibilitySignalService.playSignal(C2.format,{userGesture:!1}),cL.execute(this._editor,r,!0))}).finally(()=>{s.dispose()})}},s0.ID="editor.contrib.autoFormat",s0);Rm=X5([eg(1,xi),eg(2,zl),eg(3,b2)],Rm);var o0;let Nm=(o0=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new Bt,this._callOnModel=new Bt,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(E2,this.editor,e,2,ml.None,sn.None,!1).catch(On))}},o0.ID="editor.contrib.formatOnPaste",o0);Nm=X5([eg(1,xi),eg(2,Qi)],Nm);class uO extends gt{constructor(){super({id:"editor.action.formatDocument",label:S("formatDocument.label","Format Document"),alias:"Format Document",precondition:$e.and(U.notInCompositeEditor,U.writable,U.hasDocumentFormattingProvider),kbOpts:{kbExpr:U.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(Qi);await e.get(up).showWhile(i.invokeFunction(dL,t,1,ml.None,sn.None,!0),250)}}}class hO extends gt{constructor(){super({id:"editor.action.formatSelection",label:S("formatSelection.label","Format Selection"),alias:"Format Selection",precondition:$e.and(U.writable,U.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2084),weight:100},contextMenuOpts:{when:U.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(Qi),n=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new ee(a.startLineNumber,1,a.startLineNumber,n.getLineMaxColumn(a.startLineNumber)):a);await e.get(up).showWhile(i.invokeFunction(E2,t,s,1,ml.None,sn.None,!0),250)}}on(Rm.ID,Rm,2);on(Nm.ID,Nm,2);Ae(uO);Ae(hO);Un.registerCommand("editor.action.format",async o=>{const e=o.get(fs).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=o.get(Rs);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var fO=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},eC=function(o,e){return function(t,i){e(t,i,o)}};class Ph{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 sE extends Ph{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class Y5 extends Ph{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class ul extends Ph{static create(e,t,i){const n=new zs(i),s=new ul(t.uri),r=e.ordered(t),a=r.map((u,f)=>{const g=Ph.findId(`provider_${f}`,s),p=new Y5(g,s,u.displayName??"Unknown Outline Provider",f);return Promise.resolve(u.provideDocumentSymbols(t,n.token)).then(C=>{for(const b of C||[])ul._makeOutlineElement(b,p);return p},C=>(hs(C),p)).then(C=>{Ph.empty(C)?C.remove():s._groups.set(g,C)})}),d=e.onDidChange(()=>{const u=e.ordered(t);Xa(u,r)||n.cancel()});return Promise.all(a).then(()=>n.token.isCancellationRequested&&!i.isCancellationRequested?ul.create(e,t,i):s._compact()).finally(()=>{n.dispose(),d.dispose(),n.dispose()})}static _makeOutlineElement(e,t){const i=Ph.findId(e,t),n=new sE(i,t,e);if(e.children)for(const s of e.children)ul._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=Cl.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 sE?e.push(t.symbol):e.push(...Cl.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>ee.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return ul._flattenDocumentSymbols(t,e,""),t.sort((i,n)=>pi.compare(ee.getStartPosition(i.range),ee.getStartPosition(n.range))||pi.compare(ee.getEndPosition(n.range),ee.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&&ul._flattenDocumentSymbols(e,n.children,n.name)}}const Rp=Hl("IOutlineModelService");let oE=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new Bt,this._cache=new fp(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()||!Xa(s.provider,n)){const a=new zs;s={versionId:e.getVersionId(),provider:n,promiseCnt:0,source:a,promise:ul.create(i,e,a.token),model:void 0},this._cache.set(e.id,s);const d=Date.now();s.promise.then(u=>{s.model=u,this._debounceInformation.update(e,Date.now()-d)}).catch(u=>{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()}}};oE=fO([eC(0,xi),eC(1,fr),eC(2,po)],oE);Wl(Rp,oE,1);Un.registerCommand("_executeDocumentSymbolProvider",async function(o,...e){const[t]=e;wn(Rn.isUri(t));const i=o.get(Rp),s=await o.get(ma).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,sn.None)).getTopLevelSymbols()}finally{s.dispose()}});const Ia=class Ia extends Pt{constructor(e,t){super(),this.contextKeyService=e,this.model=t,this.inlineCompletionVisible=Ia.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=Ia.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=Ia.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=Ia.suppressSuggestions.bindTo(this.contextKeyService),this._register(ts(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(ts(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:d,lines:u}=a.parts[0],f=u[0],g=n.textModel.getLineIndentColumn(a.lineNumber);if(d<=g){let C=LC(f);C===-1&&(C=f.length-1),s=C>0;const b=n.textModel.getOptions().tabSize;r=uL.visibleColumnFromColumn(f,C+1,b)<b}}this.inlineCompletionSuggestsIndentation.set(s),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(r)}))}};Ia.inlineSuggestionVisible=new xn("inlineSuggestionVisible",!1,S("inlineSuggestionVisible","Whether an inline suggestion is visible")),Ia.inlineSuggestionHasIndentation=new xn("inlineSuggestionHasIndentation",!1,S("inlineSuggestionHasIndentation","Whether the inline suggestion starts with whitespace")),Ia.inlineSuggestionHasIndentationLessThanTabSize=new xn("inlineSuggestionHasIndentationLessThanTabSize",!0,S("inlineSuggestionHasIndentationLessThanTabSize","Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),Ia.suppressSuggestions=new xn("inlineSuggestionSuppressSuggestions",void 0,S("suppressSuggestions","Whether suggestions should be suppressed for the current suggestion"));let Mo=Ia;function gO(o){const e=new Bt,t=e.add(y2());return e.add(ts(i=>{t.setStyle(o.read(i))})),e}class Rg{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 w2([...this.parts.map(s=>new Fl(ee.fromPositions(new pi(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 Om{constructor(e,t,i){this.column=e,this.text=t,this.preview=i,this.lines=kv(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 rE{constructor(e,t,i,n=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=n,this.parts=[new Om(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=kv(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 Z8(o,e){return Xa(o,e,Q5)}function Q5(o,e){return o===e?!0:!o||!e?!1:o instanceof Rg&&e instanceof Rg||o instanceof rE&&e instanceof rE?o.equals(e):!1}const pO=[];function xO(){return pO}class J5{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new b0(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new ee(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function eB(o,e){const t=new Bt,i=o.createDecorationsCollection();return t.add(hL({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function mO(o,e){return new pi(o.lineNumber+e.lineNumber-1,e.lineNumber===1?o.column+e.column-1:e.column)}function X8(o,e){return new pi(o.lineNumber-e.lineNumber+1,o.lineNumber-e.lineNumber===0?o.column-e.column+1:o.column)}var _O=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},vO=function(o,e){return function(t,i){e(t,i,o)}};const Y8="ghost-text";let aE=class extends Pt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Xo(this,!1),this.currentTextModel=Fo(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=In(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 rE?r.columnRange:void 0,d=[],u=[];function f(E,y){if(u.length>0){const D=u[u.length-1];y&&D.decorations.push(new Eg(D.content.length+1,D.content.length+1+E[0].length,y,0)),D.content+=E[0],E=E.slice(1)}for(const D of E)u.push({content:D,decorations:y?[new Eg(1,D.length+1,y,0)]:[]})}const g=s.getLineContent(r.lineNumber);let p,C=0;for(const E of r.parts){let y=E.lines;p===void 0?(d.push({column:E.column,text:y[0],preview:E.preview}),y=y.slice(1)):f([g.substring(C,E.column-1)],void 0),y.length>0&&(f(y,Y8),p===void 0&&E.column<=g.length&&(p=E.column)),C=E.column-1}p!==void 0&&f([g.substring(C)],void 0);const b=p!==void 0?new J5(p,g.length+1):void 0;return{replacedRange:a,inlineTexts:d,additionalLines:u,hiddenRange:b,lineNumber:r.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s}}),this.decorations=In(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:ee.fromPositions(new pi(s.lineNumber,a.column)),options:{description:Y8,after:{content:a.text,inlineClassName:a.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:Ah.Left},showIfCollapsed:!0}});return r}),this.additionalLinesWidget=this._register(new bO(this.editor,this.languageService.languageIdCodec,In(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(Zn(()=>{this.isDisposed.set(!0,void 0)})),this._register(eB(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};aE=_O([vO(2,xa)],aE);class bO extends Pt{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=yd("editorOptionChanged",Ds.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(ts(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 d=document.createElement("div");CO(d,s,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=r.addZone({afterLineNumber:e,heightInLines:a,domNode:d,afterColumnAffinity:1})}})}}function CO(o,e,t,i,n){const s=i.get(33),r=i.get(118),a="none",d=i.get(95),u=i.get(51),f=i.get(50),g=i.get(67),p=new D2(1e4);p.appendString('<div class="suggest-preview-text">');for(let E=0,y=t.length;E<y;E++){const D=t[E],I=D.content;p.appendString('<div class="view-line'),p.appendString('" style="top:'),p.appendString(String(E*g)),p.appendString('px;width:1000000px;">');const M=F2(I),R=fL(I),T=gL.createEmpty(I,n);A2(new k2(f.isMonospace&&!s,f.canUseHalfwidthRightwardsArrow,I,!1,M,R,0,T,D.decorations,e,0,f.spaceWidth,f.middotWidth,f.wsmiddotWidth,r,a,d,u!==pL.OFF,null),p),p.appendString("</div>")}p.appendString("</div>"),B2(o,f);const C=p.build(),b=Q8?Q8.createHTML(C):C;o.innerHTML=b}const Q8=S2("editorGhostText",{createHTML:o=>o});function EO(o,e){const t=new vL,i=new mL(t,u=>e.getLanguageConfiguration(u)),n=new xL(new yO([o]),i),s=_L(n,[],void 0,!0);let r="";const a=o.getLineContent();function d(u,f){if(u.kind===2)if(d(u.openingBracket,f),f=xf(f,u.openingBracket.length),u.child&&(d(u.child,f),f=xf(f,u.child.length)),u.closingBracket)d(u.closingBracket,f),f=xf(f,u.closingBracket.length);else{const p=i.getSingleLanguageBracketTokens(u.openingBracket.languageId).findClosingTokenText(u.openingBracket.bracketIds);r+=p}else if(u.kind!==3){if(u.kind===0||u.kind===1)r+=a.substring(AS(f),AS(xf(f,u.length)));else if(u.kind===4)for(const g of u.children)d(g,f),f=xf(f,g.length)}}return d(s,bL),r}class yO{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 tB(o,e,t,i,n=sn.None,s){const r=e instanceof pi?DO(e,t):e,a=o.all(t),d=new CL;for(const D of a)D.groupId&&d.add(D.groupId,D);function u(D){if(!D.yieldsToGroupIds)return[];const I=[];for(const M of D.yieldsToGroupIds||[]){const R=d.get(M);for(const T of R)I.push(T)}return I}const f=new Map,g=new Set;function p(D,I){if(I=[...I,D],g.has(D))return I;g.add(D);try{const M=u(D);for(const R of M){const T=p(R,I);if(T)return T}}finally{g.delete(D)}}function C(D){const I=f.get(D);if(I)return I;const M=p(D,[]);M&&hs(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${M.map(T=>T.toString?T.toString():""+T).join(" -> ")}`));const R=new mv;return f.set(D,R.p),(async()=>{var T;if(!M){const V=u(D);for(const O of V){const Q=await C(O);if(Q&&Q.items.length>0)return}}try{return e instanceof pi?await D.provideInlineCompletions(t,e,i,n):await((T=D.provideInlineEdits)==null?void 0:T.call(D,t,e,i,n))}catch(V){hs(V);return}})().then(T=>R.complete(T),T=>R.error(T)),R.p}const b=await Promise.all(a.map(async D=>({provider:D,completions:await C(D)}))),E=new Map,y=[];for(const D of b){const I=D.completions;if(!I)continue;const M=new SO(I,D.provider);y.push(M);for(const R of I.items){const T=Hm.from(R,M,r,t,s);E.set(T.hash(),T)}}return new wO(Array.from(E.values()),new Set(E.keys()),y)}class wO{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 SO{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 Hm{static from(e,t,i,n,s){let r,a,d=e.range?ee.lift(e.range):i;if(typeof e.insertText=="string"){if(r=e.insertText,s&&e.completeBracketPairs){r=J8(r,d.getStartPosition(),n,s);const u=r.length-e.insertText.length;u!==0&&(d=new ee(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn+u))}a=void 0}else if("snippet"in e.insertText){const u=e.insertText.snippet.length;if(s&&e.completeBracketPairs){e.insertText.snippet=J8(e.insertText.snippet,d.getStartPosition(),n,s);const g=e.insertText.snippet.length-u;g!==0&&(d=new ee(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn+g))}const f=new Au().parse(e.insertText.snippet);f.children.length===1&&f.children[0]instanceof Lo?(r=f.children[0].value,a=void 0):(r=f.toString(),a={snippet:e.insertText.snippet,range:d})}else EL(e.insertText);return new Hm(r,e.command,d,r,a,e.additionalTextEdits||xO(),e,t)}constructor(e,t,i,n,s,r,a,d){this.filterText=e,this.command=t,this.range=i,this.insertText=n,this.snippetInfo=s,this.additionalTextEdits=r,this.sourceInlineCompletion=a,this.source=d,e=e.replace(/\r\n|\r/g,`
34
+ `),n=e.replace(/\r\n|\r/g,`
35
+ `)}withRange(e){return new Hm(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 Fl(this.range,this.insertText)}}function DO(o,e){const t=e.getWordAtPosition(o),i=e.getLineMaxColumn(o.lineNumber);return t?new ee(o.lineNumber,t.startColumn,o.lineNumber,i):ee.fromPositions(o,o.with(void 0,i))}function J8(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?EO(a,i):o}function Fd(o,e,t){const i=t?o.range.intersectRanges(t):o.range;if(!i)return o;const n=e.getValueInRange(i,1),s=bp(n,o.text),r=sm.ofText(n.substring(0,s)).addToPosition(o.range.getStartPosition()),a=o.text.substring(s),d=ee.fromPositions(r,o.range.getEndPosition());return new Fl(d,a)}function iB(o,e){return o.text.startsWith(e.text)&&AO(o.range,e.range)}function eD(o,e,t,i,n=0){let s=Fd(o,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const r=e.getLineContent(s.range.startLineNumber),a=Ys(r).length;if(s.range.startColumn-1<=a){const b=Ys(s.text).length,E=r.substring(s.range.startColumn-1,a),[y,D]=[s.range.getStartPosition(),s.range.getEndPosition()],I=y.column+E.length<=D.column?y.delta(0,E.length):D,M=ee.fromPositions(I,D),R=s.text.startsWith(E)?s.text.substring(E.length):s.text.substring(b);s=new Fl(M,R)}const u=e.getValueInRange(s.range),f=kO(u,s.text);if(!f)return;const g=s.range.startLineNumber,p=new Array;if(t==="prefix"){const b=f.filter(E=>E.originalLength===0);if(b.length>1||b.length===1&&b[0].originalStart!==u.length)return}const C=s.text.length-n;for(const b of f){const E=s.range.startColumn+b.originalStart+b.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===s.range.startLineNumber&&E<i.column||b.originalLength>0)return;if(b.modifiedLength===0)continue;const y=b.modifiedStart+b.modifiedLength,D=Math.max(b.modifiedStart,Math.min(y,C)),I=s.text.substring(b.modifiedStart,D),M=s.text.substring(D,Math.max(b.modifiedStart,y));I.length>0&&p.push(new Om(E,I,!1)),M.length>0&&p.push(new Om(E,M,!0))}return new Rg(g,p)}function AO(o,e){return e.getStartPosition().equals(o.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(o.getEndPosition())}let Aa;function kO(o,e){if((Aa==null?void 0:Aa.originalValue)===o&&(Aa==null?void 0:Aa.newValue)===e)return Aa==null?void 0:Aa.changes;{let t=iD(o,e,!0);if(t){const i=tD(t);if(i>0){const n=iD(o,e,!1);n&&tD(n)<i&&(t=n)}}return Aa={originalValue:o,newValue:e,changes:t},t}}function tD(o){let e=0;for(const t of o)e+=t.originalLength;return e}function iD(o,e,t){if(o.length>5e3||e.length>5e3)return;function i(u){let f=0;for(let g=0,p=u.length;g<p;g++){const C=u.charCodeAt(g);C>f&&(f=C)}return f}const n=Math.max(i(o),i(e));function s(u){if(u<0)throw new Error("unexpected");return n+u+1}function r(u){let f=0,g=0;const p=new Int32Array(u.length);for(let C=0,b=u.length;C<b;C++)if(t&&u[C]==="("){const E=g*100+f;p[C]=s(2*E),f++}else if(t&&u[C]===")"){f=Math.max(f-1,0);const E=g*100+f;p[C]=s(2*E+1),f===0&&g++}else p[C]=u.charCodeAt(C);return p}const a=r(o),d=r(e);return new yL({getElements:()=>a},{getElements:()=>d}).ComputeDiff(!1).changes}var BO=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},nD=function(o,e){return function(t,i){e(t,i,o)}};let lE=class extends Pt{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 Qo),this.inlineCompletions=TC("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=TC("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){var f,g;const n=new LO(e,t,this.textModel.getVersionId()),s=t.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if((f=this._updateOperation.value)!=null&&f.request.satisfies(n))return this._updateOperation.value.promise;if((g=s.get())!=null&&g.request.satisfies(n))return Promise.resolve(!0);const r=!!this._updateOperation.value;this._updateOperation.clear();const a=new zs,d=(async()=>{if((r||t.triggerKind===yl.Automatic)&&await FO(this._debounceValue.get(this.textModel),a.token),a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==n.versionId)return!1;const C=new Date,b=await tB(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 E=new Date;this._debounceValue.update(this.textModel,E.getTime()-C.getTime());const y=new PO(b,n,this.textModel,this.versionId);if(i){const D=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!b.has(D)&&y.prepend(i.inlineCompletion,D.range,!0)}return this._updateOperation.clear(),Wu(D=>{s.set(y,D)}),!0})(),u=new IO(n,a,d);return this._updateOperation.value=u,d}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()}};lE=BO([nD(3,xi),nD(4,Ns)],lE);function FO(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 LO{constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&wL(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,DL())&&(e.context.triggerKind===yl.Automatic||this.context.triggerKind===yl.Explicit)&&this.versionId===e.versionId}}class IO{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class PO{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 sD(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 sD(e,n,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class sD{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=xl({owner:this,equalsFn:ee.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){return this.inlineCompletion.withRange(this._updatedRange.read(e)??tC)}toSingleTextEdit(e){return new Fl(this._updatedRange.read(e)??tC,this.inlineCompletion.insertText)}isVisible(e,t,i){const n=Fd(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,d=Math.max(0,t.column-n.range.startColumn);let u=a.substring(0,d),f=a.substring(d),g=r.substring(0,d),p=r.substring(d);const C=e.getLineIndentColumn(n.range.startLineNumber);return n.range.startColumn<=C&&(g=g.trimStart(),g.length===0&&(p=p.trimStart()),u=u.trimStart(),u.length===0&&(f=f.trimStart())),u.startsWith(g)&&!!SL(p,f)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&sm.ofRange(i).isGreaterThanOrEqualTo(sm.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){return new Fl(this._updatedRange.read(e)??tC,this.inlineCompletion.filterText)}}const tC=new ee(1,1,1,1),ji={Visible:u9,HasFocusedSuggestion:new xn("suggestWidgetHasFocusedSuggestion",!1,S("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new xn("suggestWidgetDetailsVisible",!1,S("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new xn("suggestWidgetMultipleSuggestions",!1,S("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new xn("suggestionMakesTextEdit",!0,S("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new xn("acceptSuggestionOnEnter",!0,S("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new xn("suggestionHasInsertAndReplaceRange",!1,S("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new xn("suggestionInsertMode",void 0,{type:"string",description:S("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new xn("suggestionCanResolve",!1,S("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},_c=new Yt("suggestWidgetStatusBar");class TO{constructor(e,t,i,n){var s;this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=vg.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,ee.isIRange(t.range)?(this.editStart=new pi(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new pi(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new pi(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||ee.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new pi(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new pi(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new pi(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||ee.spansMultipleLines(t.range.insert)||ee.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 Ro(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(n=>{Object.assign(this.completion,n),this._resolveDuration=i.elapsed()},n=>{$c(n)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}}const N_=class N_{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}};N_.default=new N_;let Ng=N_;class MO{constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}async function _9(o,e,t,i=Ng.default,n={triggerKind:0},s=sn.None){const r=new Ro;t=t.clone();const a=e.getWordAtPosition(t),d=a?new ee(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):ee.fromPositions(t),u={replace:d,insert:d.setEndPosition(t.lineNumber,t.column)},f=[],g=new Bt,p=[];let C=!1;const b=(y,D,I)=>{var R;let M=!1;if(!D)return M;for(const T of D.suggestions)if(!i.kindFilter.has(T.kind)){if(!i.showDeprecated&&((R=T==null?void 0:T.tags)!=null&&R.includes(1)))continue;T.range||(T.range=u),T.sortText||(T.sortText=typeof T.label=="string"?T.label:T.label.label),!C&&T.insertTextRules&&T.insertTextRules&4&&(C=Au.guessNeedsClipboard(T.insertText)),f.push(new TO(t,T,D,y)),M=!0}return L2(D)&&g.add(D),p.push({providerName:y._debugDisplayName??"unknown_provider",elapsedProvider:D.duration??-1,elapsedOverall:I.elapsed()}),M},E=(async()=>{})();for(const y of o.orderedGroups(e)){let D=!1;if(await Promise.all(y.map(async I=>{if(i.providerItemsToReuse.has(I)){const M=i.providerItemsToReuse.get(I);M.forEach(R=>f.push(R)),D=D||M.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(I)))try{const M=new Ro,R=await I.provideCompletionItems(e,t,n,s);D=b(I,R,M)||D}catch(M){hs(M)}})),D||s.isCancellationRequested)break}return await E,s.isCancellationRequested?(g.dispose(),Promise.reject(new _v)):new MO(f.sort(OO(i.snippetSortOrder)),C,{entries:p,elapsed:r.elapsed()},g)}function v9(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 RO(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return-1;if(e.completion.kind===27)return 1}return v9(o,e)}function NO(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return 1;if(e.completion.kind===27)return-1}return v9(o,e)}const Jv=new Map;Jv.set(0,RO);Jv.set(2,NO);Jv.set(1,v9);function OO(o){return Jv.get(o)}Un.registerCommand("_executeCompletionItemProvider",async(o,...e)=>{const[t,i,n,s]=e;wn(Rn.isUri(t)),wn(pi.isIPosition(i)),wn(typeof n=="string"||!n),wn(typeof s=="number"||!s);const{completionProvider:r}=o.get(xi),a=await o.get(ma).createModelReference(t);try{const d={incomplete:!1,suggestions:[]},u=[],f=a.object.textEditorModel.validatePosition(i),g=await _9(r,a.object.textEditorModel,f,void 0,{triggerCharacter:n??void 0,triggerKind:n?1:0});for(const p of g.items)u.length<(s??0)&&u.push(p.resolve(sn.None)),d.incomplete=d.incomplete||p.container.incomplete,d.suggestions.push(p.completion);try{return await Promise.all(u),d}finally{setTimeout(()=>g.disposable.dispose(),100)}}finally{a.dispose()}});function HO(o,e){var t;(t=o.getContribution("editor.contrib.suggestController"))==null||t.triggerSuggest(new Set().add(e),void 0,!0)}class Th{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 oD(o,e=xv){return AL(o,e)?o.charAt(0).toUpperCase()+o.slice(1):o}var WO=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},zO=function(o,e){return function(t,i){e(t,i,o)}};class rD{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 aD{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=Ys(s,0,this._selection.startColumn-1);let a=r;e.snippet.walk(u=>u===e?!1:(u instanceof Lo&&(a=Ys(kv(u.value).pop())),!0));const d=bp(a,r);i=i.replace(/(\r\n|\r|\n)(.*)/g,(u,f,g)=>`${f}${a.substr(d)}${g}`)}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 lD{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return Uf(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=Uf(this._model.uri.fsPath),n=i.lastIndexOf(".");return n<=0?i:i.slice(0,n)}else{if(t==="TM_DIRECTORY")return kL(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(gw(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 cD{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=>!BL(n));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let Wm=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}}};Wm=WO([zO(2,Ns)],Wm);const Pa=class Pa{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 Pa.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return Pa.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return Pa.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return Pa.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,d=a<10?"0"+a:a;return n+r+":"+d}}};Pa.dayNames=[S("Sunday","Sunday"),S("Monday","Monday"),S("Tuesday","Tuesday"),S("Wednesday","Wednesday"),S("Thursday","Thursday"),S("Friday","Friday"),S("Saturday","Saturday")],Pa.dayNamesShort=[S("SundayShort","Sun"),S("MondayShort","Mon"),S("TuesdayShort","Tue"),S("WednesdayShort","Wed"),S("ThursdayShort","Thu"),S("FridayShort","Fri"),S("SaturdayShort","Sat")],Pa.monthNames=[S("January","January"),S("February","February"),S("March","March"),S("April","April"),S("May","May"),S("June","June"),S("July","July"),S("August","August"),S("September","September"),S("October","October"),S("November","November"),S("December","December")],Pa.monthNamesShort=[S("JanuaryShort","Jan"),S("FebruaryShort","Feb"),S("MarchShort","Mar"),S("AprilShort","Apr"),S("MayShort","May"),S("JuneShort","Jun"),S("JulyShort","Jul"),S("AugustShort","Aug"),S("SeptemberShort","Sep"),S("OctoberShort","Oct"),S("NovemberShort","Nov"),S("DecemberShort","Dec")];let zm=Pa;class dD{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=FL(this._workspaceService.getWorkspace());if(!LL(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(kS(e))return Uf(e.uri.path);let t=Uf(e.configPath.path);return t.endsWith(BS)&&(t=t.substr(0,t.length-BS.length-1)),t}_resoveWorkspacePath(e){if(kS(e))return oD(e.uri.fsPath);const t=Uf(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?oD(i):"/"}}class uD{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 jv()}}var VO=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},jO=function(o,e){return function(t,i){e(t,i,o)}},Kr;const Dr=class Dr{constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=FS(t.placeholders,dr.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=ee.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+s)),a=i.isFinalTabstop?Dr._decor.inactiveFinal:Dr._decor.inactive,d=t.addDecoration(r,a);this._placeholderDecorations.set(i,d)}})}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),d=this._editor.getModel().getValueInRange(a),u=s.transform.resolve(d).split(/\r\n|\r|\n/);for(let f=1;f<u.length;f++)u[f]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+u[f]);n.push(ns.replace(a,u.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 d=this._placeholderDecorations.get(a),u=this._editor.getModel().getDecorationRange(d);r.push(new Hi(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),n.changeDecorationOptions(d,a.isFinalTabstop?Dr._decor.activeFinal:Dr._decor.active),s.add(a);for(const f of this._snippet.enclosingPlaceholders(a)){const g=this._placeholderDecorations.get(f);n.changeDecorationOptions(g,f.isFinalTabstop?Dr._decor.activeFinal:Dr._decor.active),s.add(f)}}for(const[a,d]of this._placeholderDecorations)s.has(a)||n.changeDecorationOptions(d,a.isFinalTabstop?Dr._decor.inactiveFinal:Dr._decor.inactive);return r});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof dr){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 Y0,!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 d of s._snippet.placeholderInfo.all)d.isFinalTabstop?d.index=n.index+(r+1)/this._nestingLevel:d.index=n.index+d.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 d of s._snippet.placeholders){const u=s._snippet.offset(d),f=s._snippet.fullLen(d),g=ee.fromPositions(t.getPositionAt(s._offset+u),t.getPositionAt(s._offset+u+f)),p=i.addDecoration(g,Dr._decor.inactive);this._placeholderDecorations.set(d,p)}}this._placeholderGroups=FS(this._snippet.placeholders,dr.compareByIndex)})}};Dr._decor={active:fn.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:fn.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:fn.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:fn.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};let Vm=Dr;const hD={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let jm=Kr=class{static adjustWhitespace(e,t,i,n,s){const r=e.getLineContent(t.lineNumber),a=Ys(r,0,t.column-1);let d;return n.walk(u=>{if(!(u instanceof Lo)||u.parent instanceof Y0||s&&!s.has(u))return!0;const f=u.value.split(/\r\n|\r|\n/);if(i){const p=n.offset(u);if(p===0)f[0]=e.normalizeIndentation(f[0]);else{d=d??n.toString();const C=d.charCodeAt(p-1);(C===10||C===13)&&(f[0]=e.normalizeIndentation(a+f[0]))}for(let C=1;C<f.length;C++)f[C]=e.normalizeIndentation(a+f[C])}const g=f.join(e.getEOL());return g!==u.value&&(u.parent.replace(u,[new Lo(g)]),d=void 0),!0}),a}static adjustSelection(e,t,i,n){if(i!==0||n!==0){const{positionLineNumber:s,positionColumn:r}=t,a=r-i,d=r+n,u=e.validateRange({startLineNumber:s,startColumn:a,endLineNumber:s,endColumn:d});t=Hi.createWithDirection(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn,t.getDirection())}return t}static createEditsAndSnippetsFromSelections(e,t,i,n,s,r,a,d,u){const f=[],g=[];if(!e.hasModel())return{edits:f,snippets:g};const p=e.getModel(),C=e.invokeWithinContext(R=>R.get(h0)),b=e.invokeWithinContext(R=>new lD(R.get(_g),p)),E=()=>a,y=p.getValueInRange(Kr.adjustSelection(p,e.getSelection(),i,0)),D=p.getValueInRange(Kr.adjustSelection(p,e.getSelection(),0,n)),I=p.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),M=e.getSelections().map((R,T)=>({selection:R,idx:T})).sort((R,T)=>ee.compareRangesUsingStarts(R.selection,T.selection));for(const{selection:R,idx:T}of M){let V=Kr.adjustSelection(p,R,i,0),O=Kr.adjustSelection(p,R,0,n);y!==p.getValueInRange(V)&&(V=R),D!==p.getValueInRange(O)&&(O=R);const Q=R.setStartPosition(V.startLineNumber,V.startColumn).setEndPosition(O.endLineNumber,O.endColumn),ie=new Au().parse(t,!0,s),de=Q.getStartPosition(),te=Kr.adjustWhitespace(p,de,r||T>0&&I!==p.getLineFirstNonWhitespaceColumn(R.positionLineNumber),ie);ie.resolveVariables(new rD([b,new cD(E,T,M.length,e.getOption(79)==="spread"),new aD(p,R,T,d),new Wm(p,R,u),new zm,new dD(C),new uD])),f[T]=ns.replace(Q,ie.toString()),f[T].identifier={major:T,minor:0},f[T]._isTracked=!0,g[T]=new Vm(e,ie,te)}return{edits:f,snippets:g}}static createEditsAndSnippetsFromEdits(e,t,i,n,s,r,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const d=[],u=e.getModel(),f=new Au,g=new Bp,p=new rD([e.invokeWithinContext(b=>new lD(b.get(_g),u)),new cD(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new aD(u,e.getSelection(),0,r),new Wm(u,e.getSelection(),a),new zm,new dD(e.invokeWithinContext(b=>b.get(h0))),new uD]);t=t.sort((b,E)=>ee.compareRangesUsingStarts(b.range,E.range));let C=0;for(let b=0;b<t.length;b++){const{range:E,template:y}=t[b];if(b>0){const T=t[b-1].range,V=ee.fromPositions(T.getEndPosition(),E.getStartPosition()),O=new Lo(u.getValueInRange(V));g.appendChild(O),C+=O.value.length}const D=f.parseFragment(y,g);Kr.adjustWhitespace(u,E.getStartPosition(),!0,g,new Set(D)),g.resolveVariables(p);const I=g.toString(),M=I.slice(C);C=I.length;const R=ns.replace(E,M);R.identifier={major:b,minor:0},R._isTracked=!0,d.push(R)}return f.ensureFinalTabstop(g,i,!0),{edits:d,snippets:[new Vm(e,g,"")]}}constructor(e,t,i=hD,n){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=n,this._templateMerges=[],this._snippets=[]}dispose(){ao(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"?Kr.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):Kr.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=>Hi.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=hD){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=Kr.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(d=>!!d.identifier);for(let d=0;d<n.length;d++)n[d].initialize(r[d].textChange);const a=n[0].isTrivialSnippet;if(!a){for(const d of this._snippets)d.merge(n);console.assert(n.length===0)}return this._snippets[0].hasPlaceholder&&!a?this._move(void 0):r.map(d=>Hi.fromPositions(d.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(ee.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(ee.compareRangesUsingStarts);for(const[i,n]of t){if(n.length!==e.length){t.delete(i);continue}n.sort(ee.compareRangesUsingStarts);for(let s=0;s<n.length;s++)if(!n[s].containsRange(e[s])){t.delete(i);continue}}return t.size>0}};jm=Kr=VO([jO(3,Ns)],jm);var $O=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},dx=function(o,e){return function(t,i){e(t,i,o)}},yh;const fD={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};var za;let fo=(za=class{static get(e){return e.getContribution(yh.ID)}constructor(e,t,i,n,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new Bt,this._modelVersionId=-1,this._inSnippet=yh.InSnippetMode.bindTo(n),this._hasNextTabstop=yh.HasNextTabstop.bindTo(n),this._hasPrevTabstop=yh.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"?fD:{...fD,...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?(wn(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new jm(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:(f,g)=>{if(!this._session||f!==this._editor.getModel()||!pi.equals(this._editor.getPosition(),g))return;const{activeChoice:p}=this._session;if(!p||p.choice.options.length===0)return;const C=f.getValueInRange(p.range),b=!!p.choice.options.find(y=>y.value===C),E=[];for(let y=0;y<p.choice.options.length;y++){const D=p.choice.options[y];E.push({kind:13,label:D.value,insertText:D.value,sortText:"a".repeat(y+1),range:p.range,filterText:b?`${C}_${D.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:S("next","Go to next placeholder...")}})}return{suggestions:E}}},s=this._editor.getModel();let r,a=!1;const d=()=>{r==null||r.dispose(),a=!1},u=()=>{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:u,disable:d}}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(()=>{HO(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()}},yh=za,za.ID="snippetController2",za.InSnippetMode=new xn("inSnippetMode",!1,S("inSnippetMode","Whether the editor in current in snippet mode")),za.HasNextTabstop=new xn("hasNextTabstop",!1,S("hasNextTabstop","Whether there is a next tab stop when in snippet mode")),za.HasPrevTabstop=new xn("hasPrevTabstop",!1,S("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode")),za);fo=yh=$O([dx(1,zu),dx(2,xi),dx(3,En),dx(4,Ns)],fo);on(fo.ID,fo,4);const eb=wo.bindToContribution(fo.get);yi(new eb({id:"jumpToNextSnippetPlaceholder",precondition:$e.and(fo.InSnippetMode,fo.HasNextTabstop),handler:o=>o.next(),kbOpts:{weight:130,kbExpr:U.textInputFocus,primary:2}}));yi(new eb({id:"jumpToPrevSnippetPlaceholder",precondition:$e.and(fo.InSnippetMode,fo.HasPrevTabstop),handler:o=>o.prev(),kbOpts:{weight:130,kbExpr:U.textInputFocus,primary:1026}}));yi(new eb({id:"leaveSnippet",precondition:fo.InSnippetMode,handler:o=>o.cancel(!0),kbOpts:{weight:130,kbExpr:U.textInputFocus,primary:9,secondary:[1033]}}));yi(new eb({id:"acceptSnippet",precondition:fo.InSnippetMode,handler:o=>o.finish()}));var UO=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},iC=function(o,e){return function(t,i){e(t,i,o)}};let cE=class extends Pt{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(e,t,i,n,s,r,a,d,u,f,g,p){super(),this.textModel=e,this.selectedSuggestItem=t,this._textModelVersionId=i,this._positions=n,this._debounceValue=s,this._suggestPreviewEnabled=r,this._suggestPreviewMode=a,this._inlineSuggestMode=d,this._enabled=u,this._instantiationService=f,this._commandService=g,this._languageConfigurationService=p,this._source=this._register(this._instantiationService.createInstance(lE,this.textModel,this._textModelVersionId,this._debounceValue)),this._isActive=Xo(this,!1),this._forceUpdateExplicitlySignal=vw(this),this._selectedInlineCompletionId=Xo(this,void 0),this._primaryPosition=In(this,b=>this._positions.read(b)[0]??new pi(1,1)),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([dl.Redo,dl.Undo,dl.AcceptWord]),this._fetchInlineCompletionsPromise=I2({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:yl.Automatic}),handleChange:(b,E)=>(b.didChange(this._textModelVersionId)&&this._preserveCurrentCompletionReasons.has(this._getReason(b.change))?E.preserveCurrentCompletion=!0:b.didChange(this._forceUpdateExplicitlySignal)&&(E.inlineCompletionTriggerKind=yl.Explicit),!0)},(b,E)=>{if(this._forceUpdateExplicitlySignal.read(b),!(this._enabled.read(b)&&this.selectedSuggestItem.read(b)||this._isActive.read(b))){this._source.cancelUpdate();return}this._textModelVersionId.read(b);const D=this._source.suggestWidgetInlineCompletions.get(),I=this.selectedSuggestItem.read(b);if(D&&!I){const O=this._source.inlineCompletions.get();Wu(Q=>{(!O||D.request.versionId>O.request.versionId)&&this._source.inlineCompletions.set(D.clone(),Q),this._source.clearSuggestWidgetInlineCompletions(Q)})}const M=this._primaryPosition.read(b),R={triggerKind:E.inlineCompletionTriggerKind,selectedSuggestionInfo:I==null?void 0:I.toSelectedSuggestionInfo()},T=this.selectedInlineCompletion.get(),V=E.preserveCurrentCompletion||T!=null&&T.forwardStable?T:void 0;return this._source.fetch(M,R,V)}),this._filteredInlineCompletionItems=xl({owner:this,equalsFn:MC()},b=>{const E=this._source.inlineCompletions.read(b);if(!E)return[];const y=this._primaryPosition.read(b);return E.inlineCompletions.filter(I=>I.isVisible(this.textModel,y,b))}),this.selectedInlineCompletionIndex=In(this,b=>{const E=this._selectedInlineCompletionId.read(b),y=this._filteredInlineCompletionItems.read(b),D=this._selectedInlineCompletionId===void 0?-1:y.findIndex(I=>I.semanticId===E);return D===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):D}),this.selectedInlineCompletion=In(this,b=>{const E=this._filteredInlineCompletionItems.read(b),y=this.selectedInlineCompletionIndex.read(b);return E[y]}),this.activeCommands=xl({owner:this,equalsFn:MC()},b=>{var E;return((E=this.selectedInlineCompletion.read(b))==null?void 0:E.inlineCompletion.source.inlineCompletions.commands)??[]}),this.lastTriggerKind=this._source.inlineCompletions.map(this,b=>b==null?void 0:b.request.context.triggerKind),this.inlineCompletionsCount=In(this,b=>{if(this.lastTriggerKind.read(b)===yl.Explicit)return this._filteredInlineCompletionItems.read(b).length}),this.state=xl({owner:this,equalsFn:(b,E)=>!b||!E?b===E:Z8(b.ghostTexts,E.ghostTexts)&&b.inlineCompletion===E.inlineCompletion&&b.suggestItem===E.suggestItem},b=>{const E=this.textModel,y=this.selectedSuggestItem.read(b);if(y){const D=Fd(y.toSingleTextEdit(),E),I=this._computeAugmentation(D,b);if(!this._suggestPreviewEnabled.read(b)&&!I)return;const R=(I==null?void 0:I.edit)??D,T=I?I.edit.text.length-D.text.length:0,V=this._suggestPreviewMode.read(b),O=this._positions.read(b),Q=[R,...nC(this.textModel,O,R)],ie=Q.map((te,le)=>eD(te,E,V,O[le],T)).filter(kx),de=ie[0]??new Rg(R.range.endLineNumber,[]);return{edits:Q,primaryGhostText:de,ghostTexts:ie,inlineCompletion:I==null?void 0:I.completion,suggestItem:y}}else{if(!this._isActive.read(b))return;const D=this.selectedInlineCompletion.read(b);if(!D)return;const I=D.toSingleTextEdit(b),M=this._inlineSuggestMode.read(b),R=this._positions.read(b),T=[I,...nC(this.textModel,R,I)],V=T.map((O,Q)=>eD(O,E,M,R[Q],0)).filter(kx);return V[0]?{edits:T,primaryGhostText:V[0],ghostTexts:V,inlineCompletion:D,suggestItem:void 0}:void 0}}),this.ghostTexts=xl({owner:this,equalsFn:Z8},b=>{const E=this.state.read(b);if(E)return E.ghostTexts}),this.primaryGhostText=xl({owner:this,equalsFn:Q5},b=>{const E=this.state.read(b);if(E)return E==null?void 0:E.primaryGhostText}),this._register(P2(this._fetchInlineCompletionsPromise));let C;this._register(ts(b=>{var D,I;const E=this.state.read(b),y=E==null?void 0:E.inlineCompletion;if((y==null?void 0:y.semanticId)!==(C==null?void 0:C.semanticId)&&(C=y,y)){const M=y.inlineCompletion,R=M.source;(I=(D=R.provider).handleItemDidShow)==null||I.call(D,R.inlineCompletions,M.sourceInlineCompletion,M.insertText)}}))}_getReason(e){return e!=null&&e.isUndoing?dl.Undo:e!=null&&e.isRedoing?dl.Redo:this.isAcceptingPartially?dl.AcceptWord:dl.Other}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){om(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){om(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(kx);return IL(s,a=>{let d=a.toSingleTextEdit(t);return d=Fd(d,i,ee.fromPositions(d.range.getStartPosition(),e.range.getEndPosition())),iB(d,e)?{completion:a,edit:d}: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 b0;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",[ns.replace(i.range,""),...i.additionalTextEdits]),e.setPosition(i.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),(n=fo.get(e))==null||n.insert(i.snippetInfo.snippet,{undoStopBefore:!1});else{const s=t.edits,r=gD(s).map(a=>Hi.fromPositions(a));e.executeEdits("inlineSuggestion.accept",[...s.map(a=>ns.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,hs),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 d=0;a&&a.index!==void 0?a.index===0?d=a[0].length:d=a.index:d=i.length;const f=/\s+/g.exec(i);return f&&f.index!==void 0&&f.index+f[0].length<d&&(d=f.index+f[0].length),d},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 b0;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],d=new pi(s.lineNumber,a.column),u=a.text,f=t(d,u);if(f===u.length&&s.parts.length===1){this.accept(e);return}const g=u.substring(0,f),p=this._positions.get(),C=p[0];r.source.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const b=ee.fromPositions(C,d),E=e.getModel().getValueInRange(b)+g,y=new Fl(b,E),D=[y,...nC(this.textModel,p,y)],I=gD(D).map(M=>Hi.fromPositions(M));e.executeEdits("inlineSuggestion.accept",D.map(M=>ns.replace(M.range,M.text))),e.setSelections(I,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}if(r.source.provider.handlePartialAccept){const b=ee.fromPositions(r.range.getStartPosition(),sm.ofText(g).addToPosition(d)),E=e.getModel().getValueInRange(b,1);r.source.provider.handlePartialAccept(r.source.inlineCompletions,r.sourceInlineCompletion,E.length,{kind:i})}}finally{r.source.removeRef()}}handleSuggestAccepted(e){var s,r;const t=Fd(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})}};cE=UO([iC(9,Qi),iC(10,Rs),iC(11,Ns)],cE);var dl;(function(o){o[o.Undo=0]="Undo",o[o.Redo=1]="Redo",o[o.AcceptWord=2]="AcceptWord",o[o.Other=3]="Other"})(dl||(dl={}));function nC(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(ee.fromPositions(i,r)),d=X8(i,s);if(d.lineNumber<1)return On(new b0(`positionWithinTextEdit line number should be bigger than 0.
36
+ Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const u=qO(t.text,d);return n.map(f=>{const g=mO(X8(f,s),r),p=o.getValueInRange(ee.fromPositions(f,g)),C=bp(a,p),b=ee.fromPositions(f,f.delta(0,C));return new Fl(b,u)})}function qO(o,e){let t="";const i=TL(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 gD(o){const e=PL.createSortPermutation(o,_p(s=>s.range,ee.compareRangesUsingStarts)),i=new w2(e.apply(o)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}var GO=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},pD=function(o,e){return function(t,i){e(t,i,o)}},Pf;class b9{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 xD extends b9{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}class KO extends b9{constructor(){super("recentlyUsed"),this._cache=new fp(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,d=-1;for(let u=0;u<i.length&&i[u].score[0]===s;u++){const f=`${e.getLanguageId()}/${i[u].textLabel}`,g=this._cache.peek(f);if(g&&g.touch>d&&g.type===i[u].completion.kind&&g.insertText===i[u].completion.insertText&&(d=g.touch,a=u),i[u].completion.preselect&&r===-1)return r=u}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:bw.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class ZO extends b9{constructor(){super("recentlyUsedByPrefix"),this._trie=ML.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:d,insertText:u}=i[a].completion;if(d===r.type&&u===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:bw.fromString(i.type),this._trie.set(t,i)}}}var Ac;let dE=(Ac=class{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new Bt,this._persistSoon=new As(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===dw.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=Pf._strategyCtors.get(i)||xD;this._strategy=new s;try{const a=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,d=this._storageService.get(`${Pf._storagePrefix}/${i}`,a);d&&this._strategy.fromJSON(JSON.parse(d))}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(`${Pf._storagePrefix}/${this._strategy.name}`,i,t,1)}}},Pf=Ac,Ac._strategyCtors=new Map([["recentlyUsedByPrefix",ZO],["recentlyUsed",KO],["first",xD]]),Ac._storagePrefix="suggest/memories",Ac);dE=Pf=GO([pD(0,Uc),pD(1,Yn)],dE);const tb=Hl("ISuggestMemories");Wl(tb,dE,1);var XO=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)}},uE,Yd;let $m=(Yd=class{constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=uE.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)}},uE=Yd,Yd.AtEnd=new xn("atEndOfWord",!1),Yd);$m=uE=XO([YO(1,En)],$m);var QO=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},JO=function(o,e){return function(t,i){e(t,i,o)}},Tf,Qd;let R0=(Qd=class{constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=Tf.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(Tf._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=Tf._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}},Tf=Qd,Qd.OtherSuggestions=new xn("hasOtherSuggestions",!1),Qd);R0=Tf=QO([JO(1,En)],R0);class eH{constructor(e,t,i,n){this._disposables=new Bt,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||!Zo(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new nm;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 sr=class sr{async provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s);const r=new Map;await new Promise(a=>sr._bracketsRightYield(a,0,e,n,r)),await new Promise(a=>sr._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>=sr._maxRounds){e();break}if(!n){e();break}const d=i.bracketPairs.findNextBracket(n);if(!d){e();break}if(Date.now()-a>sr._maxDuration){setTimeout(()=>sr._bracketsRightYield(e,t+1,i,n,s));break}if(d.bracketInfo.isOpeningBracket){const f=d.bracketInfo.bracketText,g=r.has(f)?r.get(f):0;r.set(f,g+1)}else{const f=d.bracketInfo.getOpeningBrackets()[0].bracketText;let g=r.has(f)?r.get(f):0;if(g-=1,r.set(f,Math.max(0,g)),g<0){let p=s.get(f);p||(p=new T2,s.set(f,p)),p.push(d.range)}}n=d.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,n,s,r){const a=new Map,d=Date.now();for(;;){if(t>=sr._maxRounds&&s.size===0){e();break}if(!n){e();break}const u=i.bracketPairs.findPrevBracket(n);if(!u){e();break}if(Date.now()-d>sr._maxDuration){setTimeout(()=>sr._bracketsLeftYield(e,t+1,i,n,s,r));break}if(u.bracketInfo.isOpeningBracket){const g=u.bracketInfo.bracketText;let p=a.has(g)?a.get(g):0;if(p-=1,a.set(g,Math.max(0,p)),p<0){const C=s.get(g);if(C){const b=C.shift();C.size===0&&s.delete(g);const E=ee.fromPositions(u.range.getEndPosition(),b.getStartPosition()),y=ee.fromPositions(u.range.getStartPosition(),b.getEndPosition());r.push({range:E}),r.push({range:y}),sr._addBracketLeading(i,y,r)}}}else{const g=u.bracketInfo.getOpeningBrackets()[0].bracketText,p=a.has(g)?a.get(g):0;a.set(g,p+1)}n=u.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:ee.fromPositions(new pi(n,s),t.getEndPosition())}),i.push({range:ee.fromPositions(new pi(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:ee.fromPositions(new pi(r,a),t.getEndPosition())}),i.push({range:ee.fromPositions(new pi(r,1),t.getEndPosition())}))}}};sr._maxDuration=30,sr._maxRounds=2;let Um=sr;const Ta=class Ta{static async create(e,t){if(!t.getOption(119).localityBonus||!t.hasModel())return Ta.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return Ta.None;const[s]=await new Um().provideSelectionRanges(i,[n]);if(s.length===0)return Ta.None;const r=await e.computeWordRanges(i.uri,s[0].range);if(!r)return Ta.None;const a=i.getWordUntilPosition(n);return delete r[a.word],new class extends Ta{distance(d,u){if(!n.equals(t.getPosition()))return 0;if(u.kind===17)return 2<<20;const f=typeof u.label=="string"?u.label:u.label.label,g=r[f];if(RL(g))return 2<<20;const p=rm(g,ee.fromPositions(d),ee.compareRangesUsingStarts),C=p>=0?g[p]:g[Math.max(0,~p-1)];let b=s.length;for(const E of s){if(!ee.containsRange(E.range,C))break;b-=1}return b}}}};Ta.None=new class extends Ta{distance(){return 0}};let qm=Ta,mD=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class nc{constructor(e,t,i,n,s,r,a=M2.default,d=void 0){this.clipboardText=d,this._snippetCompareFn=nc._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=nc._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=nc._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=[],d=!this._options.filterGraceful||r.length>2e3?R2:NL;for(let u=0;u<r.length;u++){const f=r[u];if(f.isInvalid)continue;const g=this._itemsByProvider.get(f.provider);g?g.push(f):this._itemsByProvider.set(f.provider,[f]);const p=f.position.column-f.editStart.column,C=p+i-(f.position.column-this._column);if(n.length!==C&&(n=C===0?"":t.slice(-C),s=n.toLowerCase()),f.word=n,C===0)f.score=vg.Default;else{let b=0;for(;b<p;){const E=n.charCodeAt(b);if(E===32||E===9)b+=1;else break}if(b>=C)f.score=vg.Default;else if(typeof f.completion.filterText=="string"){const E=d(n,s,b,f.completion.filterText,f.filterTextLow,0,this._fuzzyScoreOptions);if(!E)continue;OL(f.completion.filterText,f.textLabel)===0?f.score=E:(f.score=HL(n,s,b,f.textLabel,f.labelLow,0),f.score[0]=E[0])}else{const E=d(n,s,b,f.textLabel,f.labelLow,0,this._fuzzyScoreOptions);if(!E)continue;f.score=E}}f.idx=u,f.distance=this._wordDistance.distance(f.position,f.completion),a.push(f),e.push(f.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?WL(e.length-.85,e,(u,f)=>u-f):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 nc._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 nc._compareCompletionItems(e,t)}}var tH=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},Zl=function(o,e){return function(t,i){e(t,i,o)}},hE;class ed{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 iH(o,e,t){if(!e.getContextKeyValue(Mo.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(Mo.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}function nH(o,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(Mo.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}let Gm=hE=class{constructor(e,t,i,n,s,r,a,d,u){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=n,this._logService=s,this._contextKeyService=r,this._configurationService=a,this._languageFeaturesService=d,this._envService=u,this._toDispose=new Bt,this._triggerCharacterListener=new Bt,this._triggerQuickSuggest=new dp,this._triggerState=void 0,this._completionDisposables=new Bt,this._onDidCancel=new nn,this._onDidTrigger=new nn,this._onDidSuggest=new nn,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new Hi(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 f=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{f=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{f=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(g=>{f||this._onCursorChange(g)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!f&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){ao(this._triggerCharacterListener),ao([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(!nH(this._editor,this._contextKeyService,this._configurationService)||ed.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="";VL(i.charCodeAt(i.length-1))?jL(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[d,u]of this._completionModel.getItemsByProvider())s.has(d)||a.set(d,u);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;Th.isAllOff(this._editor.getOption(90))||this._editor.getOption(119).snippetsPreventQuickSuggestions&&((e=fo.get(this._editor))!=null&&e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!ed.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(!Th.isAllOff(n)){if(!Th.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(Th.valueFor(n,r)!=="on")return}iH(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}},this._editor.getOption(91)))}_refilterCompletionItems(){wn(this._editor.hasModel()),wn(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new ed(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){var p,C,b;if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=new ed(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 zs;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:d}=hE.createSuggestFilter(this._editor),u=new Ng(r,((p=e.completionOptions)==null?void 0:p.kindFilter)??a,(C=e.completionOptions)==null?void 0:C.providerFilter,(b=e.completionOptions)==null?void 0:b.providerItemsToReuse,d),f=qm.create(this._editorWorkerService,this._editor),g=_9(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),u,n,this._requestToken.token);Promise.all([g,f]).then(async([E,y])=>{var T;if((T=this._requestToken)==null||T.dispose(),!this._editor.hasModel())return;let D=e==null?void 0:e.clipboardText;if(!D&&E.needsClipboard&&(D=await this._clipboardService.readText()),this._triggerState===void 0)return;const I=this._editor.getModel(),M=new ed(I,this._editor.getPosition(),e),R={...M2.default,firstMatchCanBeWeak:!this._editor.getOption(119).matchOnWordStartOnly};if(this._completionModel=new nc(E.items,this._context.column,{leadingLineContent:M.leadingLineContent,characterCountDelta:M.column-this._context.column},y,this._editor.getOption(119),this._editor.getOption(113),R,D),this._completionDisposables.add(E.disposable),this._onNewContext(M),this._reportDurationsTelemetry(E.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const V of E.items)V.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${V.provider._debugDisplayName}`,V.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(Ys(e.leadingLineContent)!==Ys(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(ed.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=ed.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})}}}}};Gm=hE=tH([Zl(1,zl),Zl(2,j0),Zl(3,pa),Zl(4,zu),Zl(5,En),Zl(6,Yn),Zl(7,xi),Zl(8,zL)],Gm);const O_=class O_{constructor(e,t){this._disposables=new Bt,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 d=i[a];if(r.getValueLengthInRange(d)>O_._maxSelectionLength)return;this._lastOvertyped[a]={value:r.getValueInRange(d),multiline:d.startLineNumber!==d.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()}};O_._maxSelectionLength=51200;let fE=O_;var sH=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},sC=function(o,e){return function(t,i){e(t,i,o)}};let gE=class{constructor(e,t,i,n,s){this._menuId=t,this._menuService=n,this._contextKeyService=s,this._menuDisposables=new Bt,this.element=ti(e,li(".suggest-status-bar"));const r=(a=>a instanceof v0?i.createInstance($L,a,{useComma:!0}):void 0);this._leftActions=new fg(this.element,{actionViewItemProvider:r}),this._rightActions=new fg(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()}};gE=sH([sC(2,Qi),sC(3,Hu),sC(4,En)],gE);var oH=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)}};function C9(o){return!!o&&!!(o.completion.documentation||o.completion.detail&&o.completion.detail!==o.completion.label)}let pE=class{constructor(e,t){this._editor=e,this._onDidClose=new nn,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new nn,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Bt,this._renderDisposeable=new Bt,this._borderWidth=1,this._size=new Vn(330,0),this.domNode=li(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(q0,{editor:e}),this._body=li(".body"),this._scrollbar=new N2(this._body,{alwaysConsumeMouseWheel:!0}),ti(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=ti(this._body,li(".header")),this._close=ti(this._header,li("span"+Dn.asCSSSelector(Ui.close))),this._close.title=S("details.close","Close"),this._type=ti(this._header,li("p.type")),this._docs=ti(this._body,li("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`,d=`${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=d,this._close.style.width=d}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=S("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 oo().appendCodeblock("empty",r),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!C9(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,Mr(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(r))}else Ga(this._type),this._type.title="",Uo(this._type),this.domNode.classList.add("no-type");if(Ga(this._docs),typeof n=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=n;else if(n){this._docs.classList.add("markdown-docs"),Ga(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 Vn(e,t);Vn.equals(i,this._size)||(this._size=i,UL(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}};pE=oH([rH(1,Qi)],pE);class aH{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new Bt,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new e9,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 d=!1;a.west&&(r=n.width-a.dimension.width,d=!0),a.north&&(s=n.height-a.dimension.height,d=!0),d&&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=xp(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),r=new Vn(220,2*s.lineHeight),a=e.top,d=(function(){const T=n.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),V=-s.borderWidth+e.left+e.width,O=new Vn(T,n.height-e.top-s.borderHeight-s.verticalPadding),Q=O.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:V,fit:T-t.width,maxSizeTop:O,maxSizeBottom:Q,minSize:r.with(Math.min(T,r.width))}})(),u=(function(){const T=e.left-s.borderWidth-s.horizontalPadding,V=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),O=new Vn(T,n.height-e.top-s.borderHeight-s.verticalPadding),Q=O.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:V,fit:T-t.width,maxSizeTop:O,maxSizeBottom:Q,minSize:r.with(Math.min(T,r.width))}})(),f=(function(){const T=e.left,V=-s.borderWidth+e.top+e.height,O=new Vn(e.width-s.borderHeight,n.height-e.top-e.height-s.verticalPadding);return{top:V,left:T,fit:O.height-t.height,maxSizeBottom:O,maxSizeTop:O,minSize:r.with(O.width)}})(),g=[d,u,f],p=g.find(T=>T.fit>=0)??g.sort((T,V)=>V.fit-T.fit)[0],C=e.top+e.height-s.borderHeight;let b,E=t.height;const y=Math.max(p.maxSizeTop.height,p.maxSizeBottom.height);E>y&&(E=y);let D;i?E<=p.maxSizeTop.height?(b=!0,D=p.maxSizeTop):(b=!1,D=p.maxSizeBottom):E<=p.maxSizeBottom.height?(b=!1,D=p.maxSizeBottom):(b=!0,D=p.maxSizeTop);let{top:I,left:M}=p;!b&&E>e.height&&(I=C-E);const R=this._editor.getDomNode();if(R){const T=R.getBoundingClientRect();I-=T.top,M-=T.left}this._applyTopLeft({left:M,top:I}),this._resizable.enableSashes(!b,p===d,b,p!==d),this._resizable.minSize=p.minSize,this._resizable.maxSize=D,this._resizable.layout(E,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 Ua;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(Ua||(Ua={}));const lH=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function ux(o,e,t,i,n){if(Dn.isThemeIcon(n))return[`codicon-${n.id}`,"predefined-file-icon"];if(Rn.isUri(n))return[];const s=i===Ua.ROOT_FOLDER?["rootfolder-icon"]:i===Ua.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===mo.data)r=am.parseMetaData(t).get(am.META_DATA_LABEL);else{const a=t.path.match(lH);a?(r=hx(a[2].toLowerCase()),a[1]&&s.push(`${hx(a[1].toLowerCase())}-name-dir-icon`)):r=hx(t.authority.toLowerCase())}if(i===Ua.ROOT_FOLDER)s.push(`${r}-root-name-folder-icon`);else if(i===Ua.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 d=r.split(".");for(let u=1;u<d.length;u++)s.push(`${d.slice(u).join(".")}-ext-file-icon`)}s.push("ext-file-icon")}const a=cH(o,e,t);a&&s.push(`${hx(a)}-lang-file-icon`)}}return s}function cH(o,e,t){if(!t)return null;let i=null;if(t.scheme===mo.data){const s=am.parseMetaData(t).get(am.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==bg?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function hx(o){return o.replace(/[\s]/g,"/")}var dH=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},oC=function(o,e){return function(t,i){e(t,i,o)}};function nB(o){return`suggest-aria-id:${o}`}const uH=ds("suggest-more-info",Ui.chevronRight,S("suggestMoreInfoIcon","Icon for more information in the suggest widget."));var sa;const hH=new(sa=class{extract(e,t){if(e.textLabel.match(sa._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(sa._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=sa._regexRelaxed.exec(i);if(n&&(n.index===0||n.index+n[0].length===i.length))return t[0]=n[0],!0}return!1}},sa._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*\))/,sa._regexStrict=new RegExp(`^${sa._regexRelaxed.source}$`,"i"),sa);let xE=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new nn,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new Bt,i=e;i.classList.add("show-file-icons");const n=ti(e,li(".icon")),s=ti(n,li("span.colorspan")),r=ti(e,li(".contents")),a=ti(r,li(".main")),d=ti(a,li(".icon-label.codicon")),u=ti(a,li("span.left")),f=ti(a,li("span.right")),g=new i2(u,{supportHighlights:!0,supportIcons:!0});t.add(g);const p=ti(u,li("span.signature-label")),C=ti(u,li("span.qualifier-label")),b=ti(f,li("span.details-label")),E=ti(f,li("span.readMore"+Dn.asCSSSelector(uH)));return E.title=S("readMore","Read More"),{root:i,left:u,right:f,icon:n,colorspan:s,iconLabel:g,iconContainer:d,parametersLabel:p,qualifierLabel:C,detailsLabel:b,readMore:E,disposables:t,configureFont:()=>{const D=this._editor.getOptions(),I=D.get(50),M=I.getMassagedFontFamily(),R=I.fontFeatureSettings,T=D.get(120)||I.fontSize,V=D.get(121)||I.lineHeight,O=I.fontWeight,Q=I.letterSpacing,ie=`${T}px`,de=`${V}px`,te=`${Q}px`;i.style.fontSize=ie,i.style.fontWeight=O,i.style.letterSpacing=te,a.style.fontFamily=M,a.style.fontFeatureSettings=R,a.style.lineHeight=de,n.style.height=de,n.style.width=de,E.style.height=de,E.style.width=de}}}renderElement(e,t,i){i.configureFont();const{completion:n}=e;i.root.id=nB(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:Sv(e.score)},r=[];if(n.kind===19&&hH.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=ux(this._modelService,this._languageService,Rn.from({scheme:"fake",path:e.textLabel}),Ua.FILE),d=ux(this._modelService,this._languageService,Rn.from({scheme:"fake",path:n.detail}),Ua.FILE);s.extraClasses=a.length>d.length?a:d}else n.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",s.extraClasses=[ux(this._modelService,this._languageService,Rn.from({scheme:"fake",path:e.textLabel}),Ua.FOLDER),ux(this._modelService,this._languageService,Rn.from({scheme:"fake",path:n.detail}),Ua.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Dn.asClassNameArray(bw.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=rC(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=rC(n.label.detail||""),i.detailsLabel.textContent=rC(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(119).showInlineDetails?Mr(i.detailsLabel):Uo(i.detailsLabel),C9(e)?(i.right.classList.add("can-expand-details"),Mr(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"),Uo(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};xE=dH([oC(1,po),oC(2,xa),oC(3,$r)],xE);function rC(o){return o.replace(/\r\n|\r|\n/g,"")}var fH=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},fx=function(o,e){return function(t,i){e(t,i,o)}},wh;ci("editorSuggestWidget.background",O2,S("editorSuggestWidgetBackground","Background color of the suggest widget."));ci("editorSuggestWidget.border",qL,S("editorSuggestWidgetBorder","Border color of the suggest widget."));const gH=ci("editorSuggestWidget.foreground",vp,S("editorSuggestWidgetForeground","Foreground color of the suggest widget."));ci("editorSuggestWidget.selectedForeground",H2,S("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));ci("editorSuggestWidget.selectedIconForeground",GL,S("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const pH=ci("editorSuggestWidget.selectedBackground",W2,S("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));ci("editorSuggestWidget.highlightForeground",z2,S("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));ci("editorSuggestWidget.focusHighlightForeground",KL,S("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));ci("editorSuggestWidgetStatus.foreground",Ka(gH,.5),S("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class xH{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof jr}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if(Vn.is(t))return Vn.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}var kc;let mE=(kc=class{constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new Qo,this._pendingShowDetails=new Qo,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new dp,this._disposables=new Bt,this._onDidSelect=new LS,this._onDidFocus=new LS,this._onDidHide=new nn,this._onDidShow=new nn,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new nn,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new e9,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new mH(this,e),this._persistedSize=new xH(t,e);class r{constructor(C,b,E=!1,y=!1){this.persistedSize=C,this.currentSize=b,this.persistHeight=E,this.persistWidth=y}}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(p=>{var C,b;if(this._resize(p.dimension.width,p.dimension.height),a&&(a.persistHeight=a.persistHeight||!!p.north||!!p.south,a.persistWidth=a.persistWidth||!!p.east||!!p.west),!!p.done){if(a){const{itemHeight:E,defaultSize:y}=this.getLayoutInfo(),D=Math.round(E/2);let{width:I,height:M}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-M)<=D)&&(M=((C=a.persistedSize)==null?void 0:C.height)??y.height),(!a.persistWidth||Math.abs(a.currentSize.width-I)<=D)&&(I=((b=a.persistedSize)==null?void 0:b.width)??y.width),this._persistedSize.store(new Vn(I,M))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=ti(this.element.domNode,li(".message")),this._listElement=ti(this.element.domNode,li(".tree"));const d=this._disposables.add(s.createInstance(pE,this.editor));d.onDidClose(this.toggleDetails,this,this._disposables),this._details=new aH(d,this.editor);const u=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(119).showIcons);u();const f=s.createInstance(xE,this.editor);this._disposables.add(f),this._disposables.add(f.onDidToggleDetails(()=>this.toggleDetails())),this._list=new aw("SuggestWidget",this._listElement,{getHeight:p=>this.getLayoutInfo().itemHeight,getTemplateId:p=>"suggestion"},[f],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>S("suggest","Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:p=>{let C=p.textLabel;if(typeof p.completion.label!="string"){const{detail:D,description:I}=p.completion.label;D&&I?C=S("label.full","{0} {1}, {2}",C,D,I):D?C=S("label.detail","{0} {1}",C,D):I&&(C=S("label.desc","{0}, {1}",C,I))}if(!p.isResolved||!this._isDetailsVisible())return C;const{documentation:b,detail:E}=p.completion,y=_w("{0}{1}",E||"",b?typeof b=="string"?b:b.value:"");return S("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",C,y)}}}),this._list.style(V2({listInactiveFocusBackground:pH,listInactiveFocusOutline:vu})),this._status=s.createInstance(gE,this.element.domNode,_c);const g=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(119).showStatusBar);g(),this._disposables.add(n.onDidColorThemeChange(p=>this._onThemeChange(p))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown(p=>this._onListMouseDownOrTap(p))),this._disposables.add(this._list.onTap(p=>this._onListMouseDownOrTap(p))),this._disposables.add(this._list.onDidChangeSelection(p=>this._onListSelection(p))),this._disposables.add(this._list.onDidChangeFocus(p=>this._onListFocus(p))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(p=>{p.hasChanged(119)&&(g(),u()),this._completionModel&&(p.hasChanged(50)||p.hasChanged(120)||p.hasChanged(121))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=ji.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=ji.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=ji.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=ji.HasFocusedSuggestion.bindTo(i),this._disposables.add(Bl(this._details.widget.domNode,"keydown",p=>{this._onDetailsKeydown.fire(p)})),this._disposables.add(this.editor.onMouseDown(p=>this._onEditorMouseDown(p)))}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=gg(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=Ws(async s=>{const r=hg(()=>{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:nB(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:Uo(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=wh.LOADING_MESSAGE,Uo(this._listElement,this._status.element),Mr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,p0(wh.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=wh.NO_SUGGESTIONS_MESSAGE,Uo(this._listElement,this._status.element),Mr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,p0(wh.NO_SUGGESTIONS_MESSAGE);break;case 3:Uo(this._messageElement),Mr(this._listElement,this._status.element),this._show();break;case 4:Uo(this._messageElement),Mr(this._listElement,this._status.element),this._show();break;case 5:Uo(this._messageElement),Mr(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=hg(()=>this._setState(1),t)))}showSuggestions(e,t,i,n,s){var d,u;if(this._contentWidget.setPosition(this.editor.getPosition()),(d=this._loadingTimeout)==null||d.dispose(),(u=this._currentSuggestionDetails)==null||u.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=IS(Ed(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")):(C9(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=IS(Ed(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=xp(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 Vn(s,n),this._contentWidget.setPreference(2);else{const d=t.width-i.borderHeight-2*i.horizontalPadding;s>d&&(s=d);const u=this._completionModel?this._completionModel.stats.pLabelLen*i.typicalHalfwidthCharacterWidth:s,f=i.statusBarHeight+this._list.contentHeight+i.borderHeight,g=i.itemHeight+i.statusBarHeight,p=bo(this.editor.getDomNode()),C=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),b=p.top+C.top+C.height,E=Math.min(t.height-b-i.verticalPadding,f),y=p.top+C.top-i.verticalPadding,D=Math.min(y,f);let I=Math.min(Math.max(D,E)+i.borderHeight,f);n===((r=this._cappedHeight)==null?void 0:r.capped)&&(n=this._cappedHeight.wanted),n<g&&(n=g),n>I&&(n=I),n>E||this._forceRenderingAbove&&y>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),I=D):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),I=E),this.element.preferredSize=new Vn(u,i.defaultSize.height),this.element.maxSize=new Vn(d,I),this.element.minSize=new Vn(220,g),this._cappedHeight=n===f?{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=ZL(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 Vn(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}},wh=kc,kc.LOADING_MESSAGE=S("suggestWidget.loading","Loading..."),kc.NO_SUGGESTIONS_MESSAGE=S("suggestWidget.noSuggestions","No suggestions."),kc);mE=wh=fH([fx(1,Uc),fx(2,En),fx(3,$r),fx(4,Qi)],mE);class mH{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 Vn(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 _H=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},uh=function(o,e){return function(t,i){e(t,i,o)}},_E;class vH{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=fn.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(ee.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 Jd;let Nr=(Jd=class{static get(e){return e.getContribution(_E.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 Qo,this._toDispose=new Bt,this._selectors=new bH(g=>g.priority),this._onWillInsertSuggestItem=new nn,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(Gm,this.editor),this._selectors.register({priority:0,select:(g,p,C)=>this._memoryService.select(g,p,C)});const d=ji.InsertMode.bindTo(n);d.set(e.getOption(119).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>d.set(e.getOption(119).insertMode))),this.widget=this._toDispose.add(new Bb(Ed(e.getDomNode()),()=>{const g=this._instantiationService.createInstance(mE,this.editor);this._toDispose.add(g),this._toDispose.add(g.onDidSelect(y=>this._insertSuggestion(y,0),this));const p=new eH(this.editor,g,this.model,y=>this._insertSuggestion(y,2));this._toDispose.add(p);const C=ji.MakesTextEdit.bindTo(this._contextKeyService),b=ji.HasInsertAndReplaceRange.bindTo(this._contextKeyService),E=ji.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Zn(()=>{C.reset(),b.reset(),E.reset()})),this._toDispose.add(g.onDidFocus(({item:y})=>{const D=this.editor.getPosition(),I=y.editStart.column,M=D.column;let R=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!y.completion.additionalTextEdits&&!(y.completion.insertTextRules&4)&&M-I===y.completion.insertText.length&&(R=this.editor.getModel().getValueInRange({startLineNumber:D.lineNumber,startColumn:I,endLineNumber:D.lineNumber,endColumn:M})!==y.completion.insertText),C.set(R),b.set(!pi.equals(y.editInsertEnd,y.editReplaceEnd)),E.set(!!y.provider.resolveCompletionItem||!!y.completion.documentation||y.completion.detail!==y.completion.label)})),this._toDispose.add(g.onDetailsKeyDown(y=>{if(y.toKeyCodeChord().equals(new PS(!0,!1,!1,!1,33))||Ya&&y.toKeyCodeChord().equals(new PS(!1,!1,!1,!0,33))){y.stopPropagation();return}y.toKeyCodeChord().isModifierKey()||this.editor.focus()})),g})),this._overtypingCapturer=this._toDispose.add(new Bb(Ed(e.getDomNode()),()=>this._toDispose.add(new fE(this.editor,this.model)))),this._alternatives=this._toDispose.add(new Bb(Ed(e.getDomNode()),()=>this._toDispose.add(new R0(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance($m,e)),this._toDispose.add(this.model.onDidTrigger(g=>{this.widget.value.showTriggered(g.auto,g.shy?250:50),this._lineSuffix.value=new vH(this.editor.getModel(),g.position)})),this._toDispose.add(this.model.onDidSuggest(g=>{if(g.triggerOptions.shy)return;let p=-1;for(const b of this._selectors.itemsOrderedByPriorityDesc)if(p=b.select(this.editor.getModel(),this.editor.getPosition(),g.completionModel.items),p!==-1)break;if(p===-1&&(p=0),this.model.state===0)return;let C=!1;if(g.triggerOptions.auto){const b=this.editor.getOption(119);b.selectionMode==="never"||b.selectionMode==="always"?C=b.selectionMode==="never":b.selectionMode==="whenTriggerCharacter"?C=g.triggerOptions.triggerKind!==1:b.selectionMode==="whenQuickSuggestion"&&(C=g.triggerOptions.triggerKind===1&&!g.triggerOptions.refilter)}this.widget.value.showSuggestions(g.completionModel,p,g.isFrozen,g.triggerOptions.auto,C)})),this._toDispose.add(this.model.onDidCancel(g=>{g.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const u=ji.AcceptSuggestionsOnEnter.bindTo(n),f=()=>{const g=this.editor.getOption(1);u.set(g==="on"||g==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>f())),f()}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=fo.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const n=this.editor.getModel(),s=n.getAlternativeVersionId(),{item:r}=e,a=[],d=new zs;t&1||this.editor.pushUndoStop();const u=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const f=r.isResolved;let g=-1,p=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const b=x0.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(E=>{let y=ee.lift(E.range);if(y.startLineNumber===r.position.lineNumber&&y.startColumn>r.position.column){const D=this.editor.getPosition().column-r.position.column,I=D,M=ee.spansMultipleLines(y)?0:D;y=new ee(y.startLineNumber,y.startColumn+I,y.endLineNumber,y.endColumn+M)}return ns.replaceMove(y,E.text)})),b.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!f){const b=new Ro;let E;const y=n.onDidChangeContent(R=>{if(R.isFlush){d.cancel(),y.dispose();return}for(const T of R.changes){const V=ee.getEndPosition(T.range);(!E||pi.isBefore(V,E))&&(E=V)}}),D=t;t|=2;let I=!1;const M=this.editor.onWillType(()=>{M.dispose(),I=!0,D&2||this.editor.pushUndoStop()});a.push(r.resolve(d.token).then(()=>{if(!r.completion.additionalTextEdits||d.token.isCancellationRequested)return;if(E&&r.completion.additionalTextEdits.some(T=>pi.isBefore(E,ee.getStartPosition(T.range))))return!1;I&&this.editor.pushUndoStop();const R=x0.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(T=>ns.replaceMove(ee.lift(T.range),T.text))),R.restoreRelativeVerticalPositionOfCursor(this.editor),(I||!(D&2))&&this.editor.pushUndoStop(),!0}).then(R=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",b.elapsed(),R),p=R===!0?1:R===!1?0:-2}).finally(()=>{y.dispose(),M.dispose()}))}let{insertText:C}=r.completion;if(r.completion.insertTextRules&4||(C=Au.escape(C)),this.model.cancel(),i.insert(C,{overwriteBefore:u.overwriteBefore,overwriteAfter:u.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===Km.id)this.model.trigger({auto:!0,retrigger:!0});else{const b=new Ro;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(E=>{r.completion.extensionId?hs(E):On(E)}).finally(()=>{g=b.elapsed()}))}t&4&&this._alternatives.value.set(e,b=>{for(d.cancel();n.canUndo();){s!==n.getAlternativeVersionId()&&n.undo(),this._insertSuggestion(b,3|(t&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,n,f,g,p,e.index,e.model.items),this.model.clear(),d.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,n,s,r,a){var p;if(Math.floor(Math.random()*100)===0)return;const d=new Map;for(let C=0;C<Math.min(30,a.length);C++){const b=a[C].textLabel;d.has(b)?d.get(b).push(C):d.set(b,[C])}const u=d.get(e.textLabel),g=u&&u.length>1?u[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:((p=e.extensionId)==null?void 0:p.value)??"unknown",providerId:e.provider._debugDisplayName??"unknown",kind:e.completion.kind,basenameHash:_2(Qa(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:XL(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s,index:r,firstIndex:g})}getOverwriteInfo(e,t){wn(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(Zo(e.completion.additionalTextEdits)){const t=S("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);zr(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,d=r.column;return d-a!==s.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:a,endLineNumber:r.lineNumber,endColumn:d})!==s.completion.insertText};Ds.once(this.model.onDidTrigger)(s=>{const r=[];Ds.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{ao(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(ao(r),a.items.length===0){i();return}const d=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),u=a.items[d];if(!n(u)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:d,item:u,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)}},_E=Jd,Jd.ID="editor.contrib.suggestController",Jd);Nr=_E=_H([uh(1,tb),uh(2,Rs),uh(3,En),uh(4,Qi),uh(5,zu),uh(6,pa)],Nr);class bH{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 H_=class H_ extends gt{constructor(){super({id:H_.id,label:S("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:$e.and(U.writable,U.hasCompletionItemProvider,ji.Visible.toNegated()),kbOpts:{kbExpr:U.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Nr.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}};H_.id="editor.action.triggerSuggest";let Km=H_;on(Nr.ID,Nr,2);Ae(Km);const Jo=190,xo=wo.bindToContribution(Nr.get);yi(new xo({id:"acceptSelectedSuggestion",precondition:$e.and(ji.Visible,ji.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:$e.and(ji.Visible,U.textInputFocus),weight:Jo},{primary:3,kbExpr:$e.and(ji.Visible,U.textInputFocus,ji.AcceptSuggestionsOnEnter,ji.MakesTextEdit),weight:Jo}],menuOpts:[{menuId:_c,title:S("accept.insert","Insert"),group:"left",order:1,when:ji.HasInsertAndReplaceRange.toNegated()},{menuId:_c,title:S("accept.insert","Insert"),group:"left",order:1,when:$e.and(ji.HasInsertAndReplaceRange,ji.InsertMode.isEqualTo("insert"))},{menuId:_c,title:S("accept.replace","Replace"),group:"left",order:1,when:$e.and(ji.HasInsertAndReplaceRange,ji.InsertMode.isEqualTo("replace"))}]}));yi(new xo({id:"acceptAlternativeSelectedSuggestion",precondition:$e.and(ji.Visible,U.textInputFocus,ji.HasFocusedSuggestion),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:_c,group:"left",order:2,when:$e.and(ji.HasInsertAndReplaceRange,ji.InsertMode.isEqualTo("insert")),title:S("accept.replace","Replace")},{menuId:_c,group:"left",order:2,when:$e.and(ji.HasInsertAndReplaceRange,ji.InsertMode.isEqualTo("replace")),title:S("accept.insert","Insert")}]}));Un.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");yi(new xo({id:"hideSuggestWidget",precondition:ji.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:9,secondary:[1033]}}));yi(new xo({id:"selectNextSuggestion",precondition:$e.and(ji.Visible,$e.or(ji.MultipleSuggestions,ji.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));yi(new xo({id:"selectNextPageSuggestion",precondition:$e.and(ji.Visible,$e.or(ji.MultipleSuggestions,ji.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:12,secondary:[2060]}}));yi(new xo({id:"selectLastSuggestion",precondition:$e.and(ji.Visible,$e.or(ji.MultipleSuggestions,ji.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()}));yi(new xo({id:"selectPrevSuggestion",precondition:$e.and(ji.Visible,$e.or(ji.MultipleSuggestions,ji.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));yi(new xo({id:"selectPrevPageSuggestion",precondition:$e.and(ji.Visible,$e.or(ji.MultipleSuggestions,ji.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:11,secondary:[2059]}}));yi(new xo({id:"selectFirstSuggestion",precondition:$e.and(ji.Visible,$e.or(ji.MultipleSuggestions,ji.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()}));yi(new xo({id:"focusSuggestion",precondition:$e.and(ji.Visible,ji.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));yi(new xo({id:"focusAndAcceptSuggestion",precondition:$e.and(ji.Visible,ji.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}}));yi(new xo({id:"toggleSuggestionDetails",precondition:$e.and(ji.Visible,ji.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:_c,group:"right",order:1,when:$e.and(ji.DetailsVisible,ji.CanResolve),title:S("detail.more","Show Less")},{menuId:_c,group:"right",order:1,when:$e.and(ji.DetailsVisible.toNegated(),ji.CanResolve),title:S("detail.less","Show More")}]}));yi(new xo({id:"toggleExplainMode",precondition:ji.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));yi(new xo({id:"toggleSuggestionFocus",precondition:ji.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:2570,mac:{primary:778}}}));yi(new xo({id:"insertBestCompletion",precondition:$e.and(U.textInputFocus,$e.equals("config.editor.tabCompletion","on"),$m.AtEnd,ji.Visible.toNegated(),R0.OtherSuggestions.toNegated(),fo.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(v2(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:Jo,primary:2}}));yi(new xo({id:"insertNextSuggestion",precondition:$e.and(U.textInputFocus,$e.equals("config.editor.tabCompletion","on"),R0.OtherSuggestions,ji.Visible.toNegated(),fo.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:2}}));yi(new xo({id:"insertPrevSuggestion",precondition:$e.and(U.textInputFocus,$e.equals("config.editor.tabCompletion","on"),R0.OtherSuggestions,ji.Visible.toNegated(),fo.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:Jo,kbExpr:U.textInputFocus,primary:1026}}));Ae(class extends gt{constructor(){super({id:"editor.action.resetSuggestSize",label:S("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(o,e){var t;(t=Nr.get(e))==null||t.resetWidgetSize()}});class CH extends Pt{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 nn),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=Nr.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(a,d,u)=>{const f=this.editor.getModel();if(!f)return-1;const g=this.suggestControllerPreselector(),p=g?Fd(g,f):void 0;if(!p)return-1;const C=pi.lift(d),b=u.map((y,D)=>{const I=tg.fromSuggestion(n,f,C,y,this.isShiftKeyPressed),M=Fd(I.toSingleTextEdit(),f),R=iB(p,M);return{index:D,valid:R,prefixLength:M.text.length,suggestItem:y}}).filter(y=>y&&y.valid&&y.prefixLength>0),E=YL(b,_p(y=>y.prefixLength,wv));return E?E.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(Ds.once(n.model.onDidTrigger)(a=>{r()})),this._register(n.onWillInsertSuggestItem(a=>{const d=this.editor.getPosition(),u=this.editor.getModel();if(!d||!u)return;const f=tg.fromSuggestion(n,u,d,a.item,this.isShiftKeyPressed);this.onWillAccept(f)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!EH(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=Nr.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 tg.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=Nr.get(this.editor);e==null||e.stopForceRenderingAbove()}forceRenderingAbove(){const e=Nr.get(this.editor);e==null||e.forceRenderingAbove()}}class tg{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const u=new Au().parse(r);u.children.length<100&&jm.adjustWhitespace(t,i,!0,u),r=u.toString(),a=!0}const d=e.getOverwriteInfo(n,s);return new tg(ee.fromPositions(i.delta(0,-d.overwriteBefore),i.delta(0,Math.max(d.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 QL(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new Fl(this.range,this.insertText)}}function EH(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}var yH=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},al=function(o,e){return function(t,i){e(t,i,o)}},vE,eu;let hr=(eu=class extends Pt{static get(e){return e.getContribution(vE.ID)}constructor(e,t,i,n,s,r,a,d,u,f){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=n,this._commandService=s,this._debounceService=r,this._languageFeaturesService=a,this._accessibilitySignalService=d,this._keybindingService=u,this._accessibilityService=f,this._editorObs=Ha(this.editor),this._positions=In(this,p=>{var C;return((C=this._editorObs.selections.read(p))==null?void 0:C.map(b=>b.getEndPosition()))??[new pi(1,1)]}),this._suggestWidgetAdaptor=this._register(new CH(this.editor,()=>{var p,C;return this._editorObs.forceUpdate(),(C=(p=this.model.get())==null?void 0:p.selectedInlineCompletion.get())==null?void 0:C.toSingleTextEdit(void 0)},p=>this._editorObs.forceUpdate(C=>{var b;(b=this.model.get())==null||b.handleSuggestAccepted(p)}))),this._suggestWidgetSelectedItem=Fo(this,p=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(C=>p(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem),this._enabledInConfig=Fo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=Fo(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=Fo(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=In(this,p=>this._enabledInConfig.read(p)&&(!this._isScreenReaderEnabled.read(p)||!this._editorDictationInProgress.read(p))),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model=Nc(this,p=>{if(this._editorObs.isReadonly.read(p))return;const C=this._editorObs.model.read(p);return C?this._instantiationService.createInstance(cE,C,this._suggestWidgetSelectedItem,this._editorObs.versionId,this._positions,this._debounceValue,Fo(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).preview),Fo(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).previewMode),Fo(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).mode),this._enabled):void 0}).recomputeInitiallyAndOnChange(this._store),this._ghostTexts=In(this,p=>{const C=this.model.read(p);return(C==null?void 0:C.ghostTexts.read(p))??[]}),this._stablizedGhostTexts=wH(this._ghostTexts,this._store),this._ghostTextWidgets=JL(this,this._stablizedGhostTexts,(p,C)=>C.add(this._instantiationService.createInstance(aE,this.editor,{ghostText:p,minReservedLineCount:_l(0),targetTextModel:this.model.map(b=>b==null?void 0:b.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=vw(this),this._fontFamily=Fo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._register(new Mo(this._contextKeyService,this.model)),this._register(TS(this._editorObs.onDidType,(p,C)=>{var b;this._enabled.get()&&((b=this.model.get())==null||b.trigger())})),this._register(this._commandService.onDidExecuteCommand(p=>{new Set([Bx.Tab.id,Bx.DeleteLeft.id,Bx.DeleteRight.id,u5,"acceptSelectedSuggestion"]).has(p.commandId)&&e.hasTextFocus()&&this._enabled.get()&&this._editorObs.forceUpdate(b=>{var E;(E=this.model.get())==null||E.trigger(b)})})),this._register(TS(this._editorObs.selections,(p,C)=>{var b;C.some(E=>E.reason===3||E.source==="api")&&((b=this.model.get())==null||b.stop())})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||F0.dropDownVisible||Wu(p=>{var C;(C=this.model.get())==null||C.stop(p)})})),this._register(ts(p=>{var b;const C=(b=this.model.read(p))==null?void 0:b.state.read(p);C!=null&&C.suggestItem?C.primaryGhostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(Zn(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const g=Ev(this,(p,C)=>{var y;const b=this.model.read(p),E=b==null?void 0:b.state.read(p);return this._suggestWidgetSelectedItem.get()?C:(y=E==null?void 0:E.inlineCompletion)==null?void 0:y.semanticId});this._register(e4(In(p=>(this._playAccessibilitySignal.read(p),g.read(p),{})),async(p,C,b)=>{const E=this.model.get(),y=E==null?void 0:E.state.get();if(!y||!E)return;const D=E.textModel.getLineContent(y.primaryGhostText.lineNumber);await Bv(50,RC(b)),await t4(this._suggestWidgetSelectedItem,Af,()=>!1,RC(b)),await this._accessibilitySignalService.playSignal(C2.inlineSuggestion),this.editor.getOption(8)&&this._provideScreenReaderUpdate(y.primaryGhostText.renderForScreenReader(D))})),this._register(new D1(this.editor,this.model,this._instantiationService)),this._register(gO(In(p=>{const C=this._fontFamily.read(p);return C===""||C==="default"?"":`
43
+ .monaco-editor .ghost-text-decoration,
44
+ .monaco-editor .ghost-text-decoration-preview,
45
+ .monaco-editor .ghost-text {
46
+ font-family: ${C};
47
+ }`}))),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.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=S("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),zr(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 pi(t.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){var t;return((t=this._ghostTextWidgets.get()[0])==null?void 0:t.ownsViewZone(e))??!1}},vE=eu,eu.ID="editor.contrib.inlineCompletionsController",eu);hr=vE=yH([al(1,Qi),al(2,En),al(3,Yn),al(4,Rs),al(5,fr),al(6,xi),al(7,b2),al(8,ms),al(9,yv)],hr);function wH(o,e){const t=Xo("result",[]),i=[];return e.add(ts(n=>{const s=o.read(n);Wu(r=>{if(s.length!==i.length){i.length=s.length;for(let a=0;a<i.length;a++)i[a]||(i[a]=Xo("item",s[a]));t.set([...i],r)}i.forEach((a,d)=>a.set(s[d],r))})})),t}const W_=class W_ extends gt{constructor(){super({id:W_.ID,label:S("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:$e.and(U.writable,Mo.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=hr.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};W_.ID=f5;let bE=W_;const z_=class z_ extends gt{constructor(){super({id:z_.ID,label:S("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:$e.and(U.writable,Mo.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=hr.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};z_.ID=h5;let CE=z_;class SH extends gt{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:S("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:U.writable})}async run(e,t){const i=hr.get(t);await j2(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 DH extends gt{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:S("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:$e.and(U.writable,Mo.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:$e.and(U.writable,Mo.inlineSuggestionVisible)},menuOpts:[{menuId:Yt.InlineSuggestionToolbar,title:S("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var n;const i=hr.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextWord(i.editor))}}class AH extends gt{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:S("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:$e.and(U.writable,Mo.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:Yt.InlineSuggestionToolbar,title:S("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var n;const i=hr.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextLine(i.editor))}}class kH extends gt{constructor(){super({id:u5,label:S("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:Mo.inlineSuggestionVisible,menuOpts:[{menuId:Yt.InlineSuggestionToolbar,title:S("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:$e.and(Mo.inlineSuggestionVisible,U.tabMovesFocus.toNegated(),Mo.inlineSuggestionHasIndentationLessThanTabSize,ji.Visible.toNegated(),U.hoverFocused.toNegated())}})}async run(e,t){var n;const i=hr.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const V_=class V_ extends gt{constructor(){super({id:V_.ID,label:S("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:Mo.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=hr.get(t);Wu(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};V_.ID="editor.action.inlineSuggest.hide";let EE=V_;const j_=class j_ extends yo{constructor(){super({id:j_.ID,title:S("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:Yt.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:$e.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(Yn),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}};j_.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";let yE=j_;var BH=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},Ef=function(o,e){return function(t,i){e(t,i,o)}};class FH{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 wE=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=hr.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 Ox(1e3,this,ee.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 Ox(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new Ox(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=hr.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new FH(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new Bt,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(F0,this._editor,!1,_l(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands),a=r.getDomNode();e.fragment.appendChild(a),s.triggerExplicitly(),i.add(r);const d={hoverPart:n,hoverElement:a,dispose(){i.dispose()}};return new Lu([d])}renderScreenReaderText(e,t){const i=new Bt,n=li,s=n("div.hover-row.markdown-hover"),r=ti(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new q0({editor:this._editor},this._languageService,this._openerService)),d=u=>{i.add(a.onDidRenderAsync(()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}));const f=S("inlineSuggestionFollows","Suggestion:"),g=i.add(a.render(new oo().appendText(f).appendCodeblock("text",u)));r.replaceChildren(g.element)};return i.add(ts(u=>{var g;const f=(g=t.controller.model.read(u))==null?void 0:g.primaryGhostText.read(u);if(f){const p=this._editor.getModel().getLineContent(f.lineNumber);d(f.renderForScreenReader(p))}else tm(r)})),e.fragment.appendChild(s),i}};wE=BH([Ef(1,xa),Ef(2,ga),Ef(3,yv),Ef(4,Qi),Ef(5,pa)],wE);class LH{}const ib=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}};on(hr.ID,hr,3);Ae(SH);Ae(bE);Ae(CE);Ae(DH);Ae(AH);Ae(kH);Ae(EE);Tn(yE);Uu.register(wE);ib.register(new LH);var IH=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},aC=function(o,e){return function(t,i){e(t,i,o)}},Mf,Bc;let Og=(Bc=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new Bt,this.toUnhookForKeyboard=new Bt,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new Kv(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(Mf.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 $2(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Ws(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?ee.lift(n[0].originSelectionRange):new ee(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(n.length>1){let a=s;for(const{originSelectionRange:d}of n)d&&(a=ee.plusRange(a,d));this.addDecoration(a,new oo().appendText(S("multipleResults","Click to show {0} definitions.",n.length)))}else{const a=n[0];if(!a.uri)return;this.textModelResolverService.createModelReference(a.uri).then(d=>{if(!d.object||!d.object.textEditorModel){d.dispose();return}const{object:{textEditorModel:u}}=d,{startLineNumber:f}=a.range;if(f<1||f>u.getLineCount()){d.dispose();return}const g=this.getPreviewValue(u,f,a),p=this.languageService.guessLanguageIdByFilepathOrFirstLine(u.uri);this.addDecoration(s,g?new oo().appendCodeblock(p||"",g):void 0),d.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=Mf.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 d=e.getLineFirstNonWhitespaceColumn(a);s=Math.min(s,d)}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+Mf.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new ee(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 mw)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?Pp(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 Mp({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(En);return Co.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}},Mf=Bc,Bc.ID="editor.contrib.gotodefinitionatposition",Bc.MAX_SOURCE_PREVIEW_LINES=8,Bc);Og=Mf=IH([aC(1,ma),aC(2,xa),aC(3,xi)],Og);on(Og.ID,Og,2);var sB=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},Zm=function(o,e){return function(t,i){e(t,i,o)}};class _D{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let SE=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new nn,this.onDidChange=this._onDidChange.event,this._dispoables=new Bt,this._markers=[],this._nextIdx=-1,Rn.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const n=this._configService.getValue("problems.sortOrder"),s=(a,d)=>{let u=MS(a.resource.toString(),d.resource.toString());return u===0&&(n==="position"?u=ee.compareRangesUsingStarts(a,d)||lo.compare(a.severity,d.severity):u=lo.compare(a.severity,d.severity)||ee.compareRangesUsingStarts(a,d)),u},r=()=>{this._markers=this._markerService.read({resource:Rn.isUri(e)?e:void 0,severities:lo.Error|lo.Warning|lo.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(d=>this._resourceFilter(d)))&&(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 _D(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=rm(this._markers,{resource:e.uri},(r,a)=>MS(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;r<this._markers.length;r++){let a=ee.lift(this._markers[r]);if(a.isEmpty()){const d=e.getWordAtPosition(a.getStartPosition());d&&(a=new ee(a.startLineNumber,d.startColumn,a.startLineNumber,d.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(ee.containsPosition(this._markers[i],t))return new _D(this._markers[i],i+1,this._markers.length)}}};SE=sB([Zm(1,cw),Zm(2,Yn)],SE);const oB=Hl("IMarkerNavigationService");let DE=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new T2}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new SE(e,this._markerService,this._configService)}};DE=sB([Zm(0,cw),Zm(1,Yn)],DE);Wl(oB,DE,1);var AE;(function(o){function e(t){switch(t){case Gp.Ignore:return"severity-ignore "+Dn.asClassName(Ui.info);case Gp.Info:return Dn.asClassName(Ui.info);case Gp.Warning:return Dn.asClassName(Ui.warning);case Gp.Error:return Dn.asClassName(Ui.error);default:return""}}o.className=e})(AE||(AE={}));var PH=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},hh=function(o,e){return function(t,i){e(t,i,o)}},kE;class TH{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 Bt,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(Bl(this._relatedBlock,"click",a=>{a.preventDefault();const d=this._relatedDiagnostics.get(a.target);d&&i(d)})),this._scrollable=new l4(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(){ao(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=kv(i);this._lines=a.length,this._longestLineLength=0;for(const p of a)this._longestLineLength=Math.max(p.length+r,this._longestLineLength);Ga(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let d=this._messageBlock;for(const p of a)d=document.createElement("div"),d.innerText=p,p===""&&(d.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(d);if(t||s){const p=document.createElement("span");if(p.classList.add("details"),d.appendChild(p),t){const C=document.createElement("span");C.innerText=t,C.classList.add("source"),p.appendChild(C)}if(s)if(typeof s=="string"){const C=document.createElement("span");C.innerText=`(${s})`,C.classList.add("code"),p.appendChild(C)}else{this._codeLink=li("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=b=>{this._openerService.open(s.target,{allowCommands:!0}),b.preventDefault(),b.stopPropagation()};const C=ti(this._codeLink,li("span"));C.innerText=s.value,p.appendChild(this._codeLink)}}if(Ga(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Zo(n)){const p=this._relatedBlock.appendChild(document.createElement("div"));p.style.paddingTop=`${Math.floor(this._editor.getOption(67)*.66)}px`,this._lines+=1;for(const C of n){const b=document.createElement("div"),E=document.createElement("a");E.classList.add("filename"),E.innerText=`${this._labelService.getUriBasenameLabel(C.resource)}(${C.startLineNumber}, ${C.startColumn}): `,E.title=this._labelService.getUriLabel(C.resource),this._relatedDiagnostics.set(E,C);const y=document.createElement("span");y.innerText=C.message,b.appendChild(E),b.appendChild(y),this._lines+=1,p.appendChild(b)}}const u=this._editor.getOption(50),f=Math.ceil(u.typicalFullwidthCharacterWidth*this._longestLineLength*.75),g=u.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:f,scrollHeight:g})}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 lo.Error:t=S("Error","Error");break;case lo.Warning:t=S("Warning","Warning");break;case lo.Info:t=S("Info","Info");break;case lo.Hint:t=S("Hint","Hint");break}let i=S("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 tu;let Hg=(tu=class extends Dm{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 Bt,this._onDidSelectRelatedInformation=new nn,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=lo.Warning,this._backgroundColor=dn.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(OH);let t=BE,i=MH;this._severity===lo.Warning?(t=Vx,i=RH):this._severity===lo.Info&&(t=FE,i=NH);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(y5),secondaryHeadingColor:e.getColor(w5)})}_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(kE.TitleMenu,this._contextKeyService);hw(i,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=ti(e,li(""))}_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 TH(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=ee.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 d=i>1?S("problems","{0} of {1} problems",t,i):S("change","{0} of {1} problem",t,i);this.setTitle(Qa(a.uri),d)}this._icon.className=`codicon ${AE.className(lo.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()}},kE=tu,tu.TitleMenu=new Yt("gotoErrorTitleMenu"),tu);Hg=kE=PH([hh(1,$r),hh(2,ga),hh(3,Hu),hh(4,Qi),hh(5,En),hh(6,_g)],Hg);const vD=Cw(n4,i4),bD=Cw(o4,s4),CD=Cw(FC,r4),BE=ci("editorMarkerNavigationError.background",{dark:vD,light:vD,hcDark:kl,hcLight:kl},S("editorMarkerNavigationError","Editor marker navigation widget error color.")),MH=ci("editorMarkerNavigationError.headerBackground",{dark:Ka(BE,.1),light:Ka(BE,.1),hcDark:null,hcLight:null},S("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),Vx=ci("editorMarkerNavigationWarning.background",{dark:bD,light:bD,hcDark:kl,hcLight:kl},S("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),RH=ci("editorMarkerNavigationWarning.headerBackground",{dark:Ka(Vx,.1),light:Ka(Vx,.1),hcDark:"#0C141F",hcLight:Ka(Vx,.2)},S("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),FE=ci("editorMarkerNavigationInfo.background",{dark:CD,light:CD,hcDark:kl,hcLight:kl},S("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),NH=ci("editorMarkerNavigationInfo.headerBackground",{dark:Ka(FE,.1),light:Ka(FE,.1),hcDark:null,hcLight:null},S("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),OH=ci("editorMarkerNavigation.background",a4,S("editorMarkerNavigationBackground","Editor marker navigation widget background."));var HH=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},gx=function(o,e){return function(t,i){e(t,i,o)}},Rf,iu;let Tu=(iu=class{static get(e){return e.getContribution(Rf.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new Bt,this._editor=e,this._widgetVisible=rB.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(Hg,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)||!ee.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:ee.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 pi(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=Rf.get(r))==null||i.close(),(n=Rf.get(r))==null||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}},Rf=iu,iu.ID="editor.contrib.markerController",iu);Tu=Rf=HH([gx(1,oB),gx(2,En),gx(3,fs),gx(4,Qi)],Tu);class nb extends gt{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=Tu.get(t))==null||i.nagivate(this._next,this._multiFile))}}const cd=class cd extends nb{constructor(){super(!0,!1,{id:cd.ID,label:cd.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:U.focus,primary:578,weight:100},menuOpts:{menuId:Hg.TitleMenu,title:cd.LABEL,icon:ds("marker-navigation-next",Ui.arrowDown,S("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}};cd.ID="editor.action.marker.next",cd.LABEL=S("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");let Xm=cd;const dd=class dd extends nb{constructor(){super(!1,!1,{id:dd.ID,label:dd.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:U.focus,primary:1602,weight:100},menuOpts:{menuId:Hg.TitleMenu,title:dd.LABEL,icon:ds("marker-navigation-previous",Ui.arrowUp,S("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}};dd.ID="editor.action.marker.prev",dd.LABEL=S("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");let LE=dd;class WH extends nb{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:S("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:U.focus,primary:66,weight:100},menuOpts:{menuId:Yt.MenubarGoMenu,title:S({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class zH extends nb{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:S("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:U.focus,primary:1090,weight:100},menuOpts:{menuId:Yt.MenubarGoMenu,title:S({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}on(Tu.ID,Tu,4);Ae(Xm);Ae(LE);Ae(WH);Ae(zH);const rB=new xn("markersNavigationVisible",!1),VH=wo.bindToContribution(Tu.get);yi(new VH({id:"closeMarkersNavigation",precondition:rB,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:U.focus,primary:9,secondary:[1033]}}));var Yr;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(Yr||(Yr={}));class jH extends gt{constructor(){super({id:d5,label:S({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:ui("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:[Yr.NoAutoFocus,Yr.FocusIfVisible,Yr.AutoFocusImmediately],enumDescriptions:[S("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),S("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),S("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:Yr.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=no.get(t);if(!n)return;const s=i==null?void 0:i.focus;let r=Yr.FocusIfVisible;Object.values(Yr).includes(s)?r=s:typeof s=="boolean"&&s&&(r=Yr.AutoFocusImmediately);const a=u=>{const f=t.getPosition(),g=new ee(f.lineNumber,f.column,f.lineNumber,f.column);n.showContentHover(g,1,1,u)},d=t.getOption(2)===2;n.isHoverVisible?r!==Yr.NoAutoFocus?n.focus():a(d):a(d||r===Yr.AutoFocusImmediately)}}class $H extends gt{constructor(){super({id:aM,label:S({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:ui("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=no.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new ee(n.lineNumber,n.column,n.lineNumber,n.column),r=Og.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class UH extends gt{constructor(){super({id:lM,label:S({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:U.hoverFocused,kbOpts:{kbExpr:U.hoverFocused,primary:16,weight:100},metadata:{description:ui("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=no.get(t);i&&i.scrollUp()}}class qH extends gt{constructor(){super({id:cM,label:S({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:U.hoverFocused,kbOpts:{kbExpr:U.hoverFocused,primary:18,weight:100},metadata:{description:ui("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=no.get(t);i&&i.scrollDown()}}class GH extends gt{constructor(){super({id:dM,label:S({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:U.hoverFocused,kbOpts:{kbExpr:U.hoverFocused,primary:15,weight:100},metadata:{description:ui("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=no.get(t);i&&i.scrollLeft()}}class KH extends gt{constructor(){super({id:uM,label:S({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:U.hoverFocused,kbOpts:{kbExpr:U.hoverFocused,primary:17,weight:100},metadata:{description:ui("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=no.get(t);i&&i.scrollRight()}}class ZH extends gt{constructor(){super({id:hM,label:S({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:U.hoverFocused,kbOpts:{kbExpr:U.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:ui("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=no.get(t);i&&i.pageUp()}}class XH extends gt{constructor(){super({id:fM,label:S({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:U.hoverFocused,kbOpts:{kbExpr:U.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:ui("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=no.get(t);i&&i.pageDown()}}class YH extends gt{constructor(){super({id:gM,label:S({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:U.hoverFocused,kbOpts:{kbExpr:U.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:ui("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=no.get(t);i&&i.goToTop()}}class QH extends gt{constructor(){super({id:pM,label:S({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:U.hoverFocused,kbOpts:{kbExpr:U.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:ui("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=no.get(t);i&&i.goToBottom()}}class JH extends gt{constructor(){super({id:Uv,label:xM,alias:"Increase Hover Verbosity Level",precondition:U.hoverVisible})}run(e,t,i){const n=no.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();n.updateHoverVerbosityLevel(cr.Increase,s,i==null?void 0:i.focus)}}class eW extends gt{constructor(){super({id:qv,label:mM,alias:"Decrease Hover Verbosity Level",precondition:U.hoverVisible})}run(e,t,i){var r;const n=no.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();(r=no.get(t))==null||r.updateHoverVerbosityLevel(cr.Decrease,s,i==null?void 0:i.focus)}}var tW=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},lC=function(o,e){return function(t,i){e(t,i,o)}};const Er=li;class iW{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 ED={type:1,filter:{include:jn.QuickFix},triggerAction:No.QuickFixHover};let IE=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 d=a.range.startLineNumber===n?a.range.startColumn:1,u=a.range.endLineNumber===n?a.range.endColumn:s,f=this._markerDecorationsService.getMarker(i.uri,a);if(!f)continue;const g=new ee(e.range.startLineNumber,d,e.range.startLineNumber,u);r.push(new iW(this,g,f))}return r}renderHoverParts(e,t){if(!t.length)return new Lu([]);const i=new Bt,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)=>lo.compare(r.marker.severity,a.marker.severity))[0];return this.renderMarkerStatusbar(e,s,i),new Lu(n)}_renderMarkerHover(e){const t=new Bt,i=Er("div.hover-row"),n=ti(i,Er("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:d}=e.marker;this._editor.applyFontInfo(n);const u=ti(n,Er("span"));if(u.style.whiteSpace="pre-wrap",u.innerText=r,s||a)if(a&&typeof a!="string"){const g=Er("span");if(s){const E=ti(g,Er("span"));E.innerText=s}const p=ti(g,Er("a.code-link"));p.setAttribute("href",a.target.toString()),t.add(Cn(p,"click",E=>{this._openerService.open(a.target,{allowCommands:!0}),E.preventDefault(),E.stopPropagation()}));const C=ti(p,Er("span"));C.innerText=a.value;const b=ti(n,g);b.style.opacity="0.6",b.style.paddingLeft="6px"}else{const g=ti(n,Er("span"));g.style.opacity="0.6",g.style.paddingLeft="6px",g.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(Zo(d))for(const{message:g,resource:p,startLineNumber:C,startColumn:b}of d){const E=ti(n,Er("div"));E.style.marginTop="8px";const y=ti(E,Er("a"));y.innerText=`${Qa(p)}(${C}, ${b}): `,y.style.cursor="pointer",t.add(Cn(y,"click",I=>{if(I.stopPropagation(),I.preventDefault(),this._openerService){const M={selection:{startLineNumber:C,startColumn:b}};this._openerService.open(p,{fromUserGesture:!0,editorOptions:M}).catch(On)}}));const D=ti(E,Er("span"));D.innerText=g,this._editor.applyFontInfo(D)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}renderMarkerStatusbar(e,t,i){if(t.marker.severity===lo.Error||t.marker.severity===lo.Warning||t.marker.severity===lo.Info){const n=Tu.get(this._editor);n&&e.statusBar.addAction({label:S("view problem","View Problem"),commandId:Xm.ID,run:()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(92)){const n=e.statusBar.append(Er("div"));this.recentMarkerCodeActionsInfo&&(RS.makeKey(this.recentMarkerCodeActionsInfo.marker)===RS.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=S("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Pt.None:hg(()=>n.textContent=S("checkingForQuickFixes","Checking for quick fixes..."),200,i);n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(Zn(()=>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=S("noQuickFixes","No quick fixes available");return}n.style.display="none";let d=!1;i.add(Zn(()=>{d||a.dispose()})),e.statusBar.addAction({label:S("quick fixes","Quick Fix..."),commandId:Xw,run:u=>{d=!0;const f=k0.get(this._editor),g=bo(u);e.hide(),f==null||f.showCodeActions(ED,a,{x:g.left,y:g.top,width:g.width,height:g.height})}})},On)}}getCodeActions(e){return Ws(t=>Fh(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new ee(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),ED,ml.None,t))}};IE=tW([lC(1,c4),lC(2,ga),lC(3,xi)],IE);class nW{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=Jx.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)??Jx.Center;if(!n&&a!==this._laneOrLine)continue;const d=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!d||mg(d)||i.push(...t2(d).map(e))}return i}}var sW=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},yD=function(o,e){return function(t,i){e(t,i,o)}},PE;const wD=li;var nu;let TE=(nu=class extends Pt{constructor(e,t,i){super(),this._renderDisposeables=this._register(new Bt),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new e2),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new q0({editor:this._editor},t,i)),this._computer=new nW(this._editor),this._hoverOperation=this._register(new g5(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(Bl(this._hover.containerDomNode,"mouseleave",n=>{this._onMouseLeave(n)})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return PE.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=wD("div.hover-row.markdown-hover"),r=ti(s,wD("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,d=t.glyphMarginLeft+t.glyphMarginWidth+(this._computer.lane==="lineNo"?t.lineNumbersWidth:0);this._hover.containerDomNode.style.left=`${d}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(a),0)}px`}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!Gv(t,e.x,e.y))&&this.hide()}},PE=nu,nu.ID="editor.contrib.modesGlyphHoverWidget",nu);TE=PE=sW([yD(1,xa),yD(2,ga)],TE);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)}},r0;let Ym=(r0=class extends Pt{constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Bt,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new As(()=>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?Gv(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(TE,this._editor)),this._glyphWidget}dispose(){var e;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._glyphWidget)==null||e.dispose()}},r0.ID="editor.contrib.marginHover",r0);Ym=oW([rW(1,Qi)],Ym);class aW{}class lW{}class cW{}on(no.ID,no,2);on(Ym.ID,Ym,2);Ae(jH);Ae($H);Ae(UH);Ae(qH);Ae(GH);Ae(KH);Ae(ZH);Ae(XH);Ae(YH);Ae(QH);Ae(JH);Ae(eW);Uu.register(Pg);Uu.register(IE);bv((o,e)=>{const t=o.getColor(d4);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)}; }`))});ib.register(new aW);ib.register(new lW);ib.register(new cW);function Bo(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function ig(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 aB(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 u4(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:d}=o.getOptions(),u=(E,y)=>(y=y||1,C0.shiftIndent(E,E.length+y,r,a,d)),f=(E,y)=>(y=y||1,C0.unshiftIndent(E,E.length+y,r,a,d)),g=[],p=o.getLineContent(t);let C=Ys(p),b=C;s.shouldIncrease(t)?(b=u(b),C=u(C)):s.shouldIndentNextLine(t)&&(b=u(b)),t++;for(let E=t;E<=i;E++){if(dW(o,E))continue;const y=o.getLineContent(E),D=Ys(y),I=b;s.shouldDecrease(E,I)&&(b=f(b),C=f(C)),D!==b&&g.push(ns.replaceMove(new Hi(E,1,E,D.length+1),h4(b,a,d))),!s.shouldIgnore(E)&&(s.shouldIncrease(E,I)?(C=u(C),b=C):s.shouldIndentNextLine(E,I)?b=u(b):b=C)}return g}function dW(o,e){return o.tokenization.isCheapToTokenize(e)?o.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var uW=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},hW=function(o,e){return function(t,i){e(t,i,o)}};const $_=class $_ extends gt{constructor(){super({id:$_.ID,label:S("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:U.writable,metadata:{description:ui("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 mW(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}};$_.ID="editor.action.indentationToSpaces";let ME=$_;const U_=class U_ extends gt{constructor(){super({id:U_.ID,label:S("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:U.writable,metadata:{description:ui("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 _W(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}};U_.ID="editor.action.indentationToTabs";let RE=U_;class E9 extends gt{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(Ol),n=e.get(po),s=t.getModel();if(!s)return;const r=n.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),a=s.getOptions(),d=[1,2,3,4,5,6,7,8].map(f=>({id:f.toString(),label:f.toString(),description:f===r.tabSize&&f===a.tabSize?S("configuredTabSize","Configured Tab Size"):f===r.tabSize?S("defaultTabSize","Default Tab Size"):f===a.tabSize?S("currentTabSize","Current Tab Size"):void 0})),u=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(d,{placeHolder:S({key:"selectTabWidth",comment:["Tab corresponds to the tab key"]},"Select Tab Size for Current File"),activeItem:d[u]}).then(f=>{if(f&&s&&!s.isDisposed()){const g=parseInt(f.label,10);this.displaySizeOnly?s.updateOptions({tabSize:g}):s.updateOptions({tabSize:g,indentSize:g,insertSpaces:this.insertSpaces})}})},50)}}const q_=class q_ extends E9{constructor(){super(!1,!1,{id:q_.ID,label:S("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:ui("indentUsingTabsDescription","Use indentation with tabs.")}})}};q_.ID="editor.action.indentUsingTabs";let NE=q_;const G_=class G_ extends E9{constructor(){super(!0,!1,{id:G_.ID,label:S("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:ui("indentUsingSpacesDescription","Use indentation with spaces.")}})}};G_.ID="editor.action.indentUsingSpaces";let OE=G_;const K_=class K_ extends E9{constructor(){super(!0,!0,{id:K_.ID,label:S("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:ui("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}};K_.ID="editor.action.changeTabDisplaySize";let HE=K_;const Z_=class Z_ extends gt{constructor(){super({id:Z_.ID,label:S("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:ui("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(po),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}};Z_.ID="editor.action.detectIndentation";let WE=Z_;class fW extends gt{constructor(){super({id:"editor.action.reindentlines",label:S("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:U.writable,metadata:{description:ui("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(Ns),n=t.getModel();if(!n)return;const s=aB(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class gW extends gt{constructor(){super({id:"editor.action.reindentselectedlines",label:S("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:U.writable,metadata:{description:ui("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(Ns),n=t.getModel();if(!n)return;const s=t.getSelections();if(s===null)return;const r=[];for(const a of s){let d=a.startLineNumber,u=a.endLineNumber;if(d!==u&&a.endColumn===1&&u--,d===1){if(d===u)continue}else d--;const f=aB(n,i,d,u);r.push(...f)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class pW{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(ee.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 a0;let Qm=(a0=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new Bt,this.callOnModel=new Bt,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)||xW(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:r,indentSize:a,insertSpaces:d}=i.getOptions(),u=[],f={shiftIndent:b=>C0.shiftIndent(b,b.length+1,r,a,d),unshiftIndent:b=>C0.unshiftIndent(b,b.length+1,r,a,d)};let g=e.startLineNumber;for(;g<=e.endLineNumber;){if(this.shouldIgnoreLine(i,g)){g++;continue}break}if(g>e.endLineNumber)return;let p=i.getLineContent(g);if(!/\S/.test(p.substring(0,e.startColumn-1))){const b=qf(s,i,i.getLanguageId(),g,f,this._languageConfigurationService);if(b!==null){const E=Ys(p),y=Bo(b,r),D=Bo(E,r);if(y!==D){const I=ig(y,r,d);u.push({range:new ee(g,1,g,E.length+1),text:I}),p=I+p.substring(E.length)}else{const I=U2(i,g,this._languageConfigurationService);if(I===0||I===8)return}}}const C=g;for(;g<e.endLineNumber;){if(!/\S/.test(i.getLineContent(g+1))){g++;continue}break}if(g!==e.endLineNumber){const E=qf(s,{tokenization:{getLineTokens:y=>i.tokenization.getLineTokens(y),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(y,D)=>i.getLanguageIdAtPosition(y,D)},getLineContent:y=>y===C?p:i.getLineContent(y)},i.getLanguageId(),g+1,f,this._languageConfigurationService);if(E!==null){const y=Bo(E,r),D=Bo(Ys(i.getLineContent(g+1)),r);if(y!==D){const I=y-D;for(let M=g+1;M<=e.endLineNumber;M++){const R=i.getLineContent(M),T=Ys(R),O=Bo(T,r)+I,Q=ig(O,r,d);Q!==T&&u.push({range:new ee(M,1,M,T.length+1),text:Q})}}}}if(u.length>0){this.editor.pushUndoStop();const b=new pW(u,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",b),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()}},a0.ID="editor.contrib.autoIndentOnPaste",a0);Qm=uW([hW(1,Ns)],Qm);function xW(o,e){const t=i=>f4(o,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function lB(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 d=o.getLineFirstNonWhitespaceColumn(r);if(d===0&&(d=o.getLineMaxColumn(r)),d===1)continue;const u=new ee(r,1,r,d),f=o.getValueInRange(u),g=i?f.replace(/\t/ig,n):f.replace(s," ");e.addEditOperation(u,g)}}class mW{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),lB(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class _W{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),lB(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}on(Qm.ID,Qm,2);Ae(ME);Ae(RE);Ae(NE);Ae(OE);Ae(HE);Ae(WE);Ae(fW);Ae(gW);on(Mg.ID,Mg,1);Uu.register(Fm);class vW{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 Hi(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new Hi(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}var bW=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},CW=function(o,e){return function(t,i){e(t,i,o)}},jx,Fc;let N0=(Fc=class{static get(e){return e.getContribution(jx.ID)}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){var d;(d=this.currentRequest)==null||d.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 $2(this.editor,5),a=n.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=Ws(u=>this.editorWorkerService.navigateValueSet(a,s,t)),this.currentRequest.then(u=>{var b;if(!u||!u.range||!u.value||!r.validate(this.editor))return;const f=ee.lift(u.range);let g=u.range;const p=u.value.length-(s.endColumn-s.startColumn);g={startLineNumber:g.startLineNumber,startColumn:g.startColumn,endLineNumber:g.endLineNumber,endColumn:g.startColumn+u.value.length},p>1&&(s=new Hi(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+p-1));const C=new vW(f,s,u.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,C),this.editor.pushUndoStop(),this.decorations.set([{range:g,options:jx.DECORATION}]),(b=this.decorationRemover)==null||b.cancel(),this.decorationRemover=Bv(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(On)}).catch(On)):Promise.resolve(void 0)}},jx=Fc,Fc.ID="editor.contrib.inPlaceReplaceController",Fc.DECORATION=fn.register({description:"in-place-replace",className:"valueSetReplacement"}),Fc);N0=jx=bW([CW(1,zl)],N0);class EW extends gt{constructor(){super({id:"editor.action.inPlaceReplace.up",label:S("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=N0.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class yW extends gt{constructor(){super({id:"editor.action.inPlaceReplace.down",label:S("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=N0.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}on(N0.ID,N0,4);Ae(EW);Ae(yW);class wW extends gt{constructor(){super({id:"expandLineSelection",label:S("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:U.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,Ew.expandLineSelection(n,n.getCursorStates())),n.revealAllCursors(i.source,!0)}}Ae(wW);class SW{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=DW(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 DW(o,e,t){e.sort((a,d)=>a.lineNumber===d.lineNumber?a.column-d.column:a.lineNumber-d.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,d=o.getLineCount();a<=d;a++){const u=o.getLineContent(a),f=u.length+1;let g=0;if(s<r&&e[s].lineNumber===a&&(g=e[s].column,s++,g===f)||u.length===0)continue;const p=Fx(u);let C=0;if(p===-1)C=1;else if(p!==u.length-1)C=p+2;else continue;if(!t){if(!o.tokenization.hasAccurateTokensForLine(a))continue;const b=o.tokenization.getLineTokens(a),E=b.getStandardTokenType(b.findTokenIndexAtOffset(C));if(E===2||E===3)continue}C=Math.max(g,C),i[n++]=ns.delete(new ee(a,C,a,f))}return i}class cB{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 ee(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
49
+ `):this._isCopyingDown?t.addEditOperation(new ee(i.startLineNumber,1,i.startLineNumber,1),s+`
50
+ `):t.addEditOperation(new ee(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=Hi.createWithDirection(n,s,r,a,this._selectionDirection)}return i}}var AW=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},kW=function(o,e){return function(t,i){e(t,i,o)}};let zE=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=(g,p)=>e.getLanguageIdAtPosition(g,p),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:d,insertSpaces:u}=e.getOptions(),f=this.buildIndentConverter(a,d,u);if(r.startLineNumber===r.endLineNumber&&e.getLineMaxColumn(r.startLineNumber)===1){const g=r.startLineNumber,p=this._isMovingDown?g+1:g-1;e.getLineMaxColumn(p)===1?t.addEditOperation(new ee(1,1,1,1),null):(t.addEditOperation(new ee(g,1,g,1),e.getLineContent(p)),t.addEditOperation(new ee(p,1,p,e.getLineMaxColumn(p)),null)),r=new Hi(p,1,p,1)}else{let g,p;if(this._isMovingDown){g=r.endLineNumber+1,p=e.getLineContent(g),t.addEditOperation(new ee(g-1,e.getLineMaxColumn(g-1),g,e.getLineMaxColumn(g)),null);let C=p;if(this.shouldAutoIndent(e,r)){const b=this.matchEnterRule(e,f,a,g,r.startLineNumber-1);if(b!==null){const y=Ys(e.getLineContent(g)),D=b+Bo(y,a);C=ig(D,a,u)+this.trimStart(p)}else{const y={tokenization:{getLineTokens:I=>I===r.startLineNumber?e.tokenization.getLineTokens(g):e.tokenization.getLineTokens(I),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:I=>I===r.startLineNumber?e.getLineContent(g):e.getLineContent(I)},D=qf(this._autoIndent,y,e.getLanguageIdAtPosition(g,1),r.startLineNumber,f,this._languageConfigurationService);if(D!==null){const I=Ys(e.getLineContent(g)),M=Bo(D,a),R=Bo(I,a);M!==R&&(C=ig(M,a,u)+this.trimStart(p))}}t.addEditOperation(new ee(r.startLineNumber,1,r.startLineNumber,1),C+`
52
+ `);const E=this.matchEnterRuleMovingDown(e,f,a,r.startLineNumber,g,C);if(E!==null)E!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,u,E);else{const y={tokenization:{getLineTokens:I=>I===r.startLineNumber?e.tokenization.getLineTokens(g):I>=r.startLineNumber+1&&I<=r.endLineNumber+1?e.tokenization.getLineTokens(I-1):e.tokenization.getLineTokens(I),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:I=>I===r.startLineNumber?C:I>=r.startLineNumber+1&&I<=r.endLineNumber+1?e.getLineContent(I-1):e.getLineContent(I)},D=qf(this._autoIndent,y,e.getLanguageIdAtPosition(g,1),r.startLineNumber+1,f,this._languageConfigurationService);if(D!==null){const I=Ys(e.getLineContent(r.startLineNumber)),M=Bo(D,a),R=Bo(I,a);if(M!==R){const T=M-R;this.getIndentEditsOfMovingBlock(e,t,r,a,u,T)}}}}else t.addEditOperation(new ee(r.startLineNumber,1,r.startLineNumber,1),C+`
53
+ `)}else if(g=r.startLineNumber-1,p=e.getLineContent(g),t.addEditOperation(new ee(g,1,g+1,1),null),t.addEditOperation(new ee(r.endLineNumber,e.getLineMaxColumn(r.endLineNumber),r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),`
54
+ `+p),this.shouldAutoIndent(e,r)){const C={tokenization:{getLineTokens:E=>E===g?e.tokenization.getLineTokens(r.startLineNumber):e.tokenization.getLineTokens(E),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:E=>E===g?e.getLineContent(r.startLineNumber):e.getLineContent(E)},b=this.matchEnterRule(e,f,a,r.startLineNumber,r.startLineNumber-2);if(b!==null)b!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,u,b);else{const E=qf(this._autoIndent,C,e.getLanguageIdAtPosition(r.startLineNumber,1),g,f,this._languageConfigurationService);if(E!==null){const y=Ys(e.getLineContent(r.startLineNumber)),D=Bo(E,a),I=Bo(y,a);if(D!==I){const M=D-I;this.getIndentEditsOfMovingBlock(e,t,r,a,u,M)}}}}}this._selectionId=t.trackSelection(r)}buildIndentConverter(e,t,i){return{shiftIndent:n=>C0.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>C0.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,s){if(s){let r=s.indentation;s.indentAction===Kp.None||s.indentAction===Kp.Indent?r=s.indentation+s.appendText:s.indentAction===Kp.IndentOutdent?r=s.indentation:s.indentAction===Kp.Outdent&&(r=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(n);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const d=Ys(e.getLineContent(n));let u=Ys(r);const f=U2(e,n,this._languageConfigurationService);f!==null&&f&2&&(u=t.unshiftIndent(u));const g=Bo(u,i),p=Bo(d,i);return g-p}}return null}matchEnterRuleMovingDown(e,t,i,n,s,r){if(Fx(r)>=0){const a=e.getLineMaxColumn(s),d=Fb(this._autoIndent,e,new ee(s,a,s,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,d)}else{let a=n-1;for(;a>=1;){const f=e.getLineContent(a);if(Fx(f)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const d=e.getLineMaxColumn(a),u=Fb(this._autoIndent,e,new ee(a,d,a,d),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,u)}}matchEnterRule(e,t,i,n,s,r){let a=s;for(;a>=1;){let f;if(a===s&&r!==void 0?f=r:f=e.getLineContent(a),Fx(f)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const d=e.getLineMaxColumn(a),u=Fb(this._autoIndent,e,new ee(a,d,a,d),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,u)}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 d=e.getLineContent(a),u=Ys(d),g=Bo(u,n)+r,p=ig(g,n,s);p!==u&&(t.addEditOperation(new ee(a,1,a,u.length+1),p),a===i.endLineNumber&&i.endColumn<=u.length+1&&p===""&&(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}};zE=AW([kW(3,Ns)],zE);const Wh=class Wh{static getCollator(){return Wh._COLLATOR||(Wh._COLLATOR=new Intl.Collator),Wh._COLLATOR}constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){const i=BW(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=dB(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}};Wh._COLLATOR=null;let Wg=Wh;function dB(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(Wg.getCollator().compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:n,before:s,after:r}}function BW(o,e,t){const i=dB(o,e,t);return i?ns.replace(new ee(i.startLineNumber,1,i.endLineNumber,o.getLineMaxColumn(i.endLineNumber)),i.after.join(`
55
+ `)):null}class uB extends gt{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)=>ee.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 cB(r.selection,this.down,r.ignore));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class FW extends uB{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:S("lines.copyUp","Copy Line Up"),alias:"Copy Line Up",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"2_line",title:S({key:"miCopyLinesUp",comment:["&& denotes a mnemonic"]},"&&Copy Line Up"),order:1}})}}class LW extends uB{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:S("lines.copyDown","Copy Line Down"),alias:"Copy Line Down",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"2_line",title:S({key:"miCopyLinesDown",comment:["&& denotes a mnemonic"]},"Co&&py Line Down"),order:2}})}}class IW extends gt{constructor(){super({id:"editor.action.duplicateSelection",label:S("duplicateSelection","Duplicate Selection"),alias:"Duplicate Selection",precondition:U.writable,menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"2_line",title:S({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 cB(a,!0));else{const d=new Hi(a.endLineNumber,a.endColumn,a.endLineNumber,a.endColumn);n.push(new g4(d,r.getValueInRange(a)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class hB extends gt{constructor(e,t){super(t),this.down=e}run(e,t){const i=e.get(Ns),n=[],s=t.getSelections()||[],r=t.getOption(12);for(const a of s)n.push(new zE(a,this.down,r,i));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class PW extends hB{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:S("lines.moveUp","Move Line Up"),alias:"Move Line Up",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"2_line",title:S({key:"miMoveLinesUp",comment:["&& denotes a mnemonic"]},"Mo&&ve Line Up"),order:3}})}}class TW extends hB{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:S("lines.moveDown","Move Line Down"),alias:"Move Line Down",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"2_line",title:S({key:"miMoveLinesDown",comment:["&& denotes a mnemonic"]},"Move &&Line Down"),order:4}})}}class fB extends gt{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 Hi(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);for(const r of n)if(!Wg.canRun(t.getModel(),r,this.descending))return;const s=[];for(let r=0,a=n.length;r<a;r++)s[r]=new Wg(n[r],this.descending);t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class MW extends fB{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:S("lines.sortAscending","Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:U.writable})}}class RW extends fB{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:S("lines.sortDescending","Sort Lines Descending"),alias:"Sort Lines Descending",precondition:U.writable})}}class NW extends gt{constructor(){super({id:"editor.action.removeDuplicateLines",label:S("lines.deleteDuplicates","Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:U.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,d=t.getSelections();d.length===1&&d[0].isEmpty()&&(d=[new Hi(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))],a=!1);for(const u of d){const f=new Set,g=[];for(let E=u.startLineNumber;E<=u.endLineNumber;E++){const y=i.getLineContent(E);f.has(y)||(g.push(y),f.add(y))}const p=new Hi(u.startLineNumber,1,u.endLineNumber,i.getLineMaxColumn(u.endLineNumber)),C=u.startLineNumber-r,b=new Hi(C,1,C+g.length-1,g[g.length-1].length);n.push(ns.replace(p,g.join(`
56
+ `))),s.push(b),r+=u.endLineNumber-u.startLineNumber+1-g.length}t.pushUndoStop(),t.executeEdits(this.id,n,a?s:void 0),t.pushUndoStop()}}const X_=class X_ extends gt{constructor(){super({id:X_.ID,label:S("lines.trimTrailingWhitespace","Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:xs(2089,2102),weight:100}})}run(e,t,i){let n=[];i.reason==="auto-save"&&(n=(t.getSelections()||[]).map(f=>new pi(f.positionLineNumber,f.positionColumn)));const s=t.getSelection();if(s===null)return;const r=e.get(Yn),a=t.getModel(),d=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a==null?void 0:a.getLanguageId(),resource:a==null?void 0:a.uri}),u=new SW(s,n,d);t.pushUndoStop(),t.executeCommands(this.id,[u]),t.pushUndoStop()}};X_.ID="editor.action.trimTrailingWhitespace";let VE=X_;class OW extends gt{constructor(){super({id:"editor.action.deleteLines",label:S("lines.delete","Delete Line"),alias:"Delete Line",precondition:U.writable,kbOpts:{kbExpr:U.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 d=0,u=i.length;d<u;d++){const f=i[d];let g=f.startLineNumber,p=f.endLineNumber,C=1,b=n.getLineMaxColumn(p);p<n.getLineCount()?(p+=1,b=1):g>1&&(g-=1,C=n.getLineMaxColumn(g)),r.push(ns.replace(new Hi(g,C,p,b),"")),a.push(new Hi(g-s,f.positionColumn,g-s,f.positionColumn)),s+=f.endLineNumber-f.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 HW extends gt{constructor(){super({id:"editor.action.indentLines",label:S("lines.indent","Indent Line"),alias:"Indent Line",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,p4.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class WW extends gt{constructor(){super({id:"editor.action.outdentLines",label:S("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:2140,weight:100}})}run(e,t){Bx.Outdent.runEditorCommand(e,t,null)}}class zW extends gt{constructor(){super({id:"editor.action.insertLineBefore",label:S("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,q2.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class VW extends gt{constructor(){super({id:"editor.action.insertLineAfter",label:S("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:U.writable,kbOpts:{kbExpr:U.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,q2.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class gB extends gt{run(e,t){if(!t.hasModel())return;const i=t.getSelection(),n=this._getRangesToDelete(t),s=[];for(let d=0,u=n.length-1;d<u;d++){const f=n[d],g=n[d+1];ee.intersectRanges(f,g)===null?s.push(f):n[d+1]=ee.plusRange(f,g)}s.push(n[n.length-1]);const r=this._getEndCursorState(i,s),a=s.map(d=>ns.replace(d,""));t.pushUndoStop(),t.executeEdits(this.id,a,r),t.pushUndoStop()}}class jW extends gB{constructor(){super({id:"deleteAllLeft",label:S("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:U.writable,kbOpts:{kbExpr:U.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 d=r.startLineNumber-s;a=new Hi(d,r.startColumn,d,r.startColumn)}else a=new Hi(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(ee.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 ee(r,a,s.startLineNumber,1)}else return new ee(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new ee(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class $W extends gB{constructor(){super({id:"deleteAllRight",label:S("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:U.writable,kbOpts:{kbExpr:U.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 d=t[s],u=new Hi(d.startLineNumber-a,d.startColumn,d.startLineNumber-a,d.startColumn);d.intersectRanges(e)?i=u:n.push(u)}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 ee(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new ee(s.startLineNumber,s.startColumn,s.startLineNumber,r)}return s});return n.sort(ee.compareRangesUsingStarts),n}}class UW extends gt{constructor(){super({id:"editor.action.joinLines",label:S("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:U.writable,kbOpts:{kbExpr:U.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(ee.compareRangesUsingStarts);const s=[],r=i.reduce((p,C)=>p.isEmpty()?p.endLineNumber===C.startLineNumber?(n.equalsSelection(p)&&(n=C),C):C.startLineNumber>p.endLineNumber+1?(s.push(p),C):new Hi(p.startLineNumber,p.startColumn,C.endLineNumber,C.endColumn):C.startLineNumber>p.endLineNumber?(s.push(p),C):new Hi(p.startLineNumber,p.startColumn,C.endLineNumber,C.endColumn));s.push(r);const a=t.getModel();if(a===null)return;const d=[],u=[];let f=n,g=0;for(let p=0,C=s.length;p<C;p++){const b=s[p],E=b.startLineNumber,y=1;let D=0,I,M;const R=a.getLineLength(b.endLineNumber)-b.endColumn;if(b.isEmpty()||b.startLineNumber===b.endLineNumber){const O=b.getStartPosition();O.lineNumber<a.getLineCount()?(I=E+1,M=a.getLineMaxColumn(I)):(I=O.lineNumber,M=a.getLineMaxColumn(O.lineNumber))}else I=b.endLineNumber,M=a.getLineMaxColumn(I);let T=a.getLineContent(E);for(let O=E+1;O<=I;O++){const Q=a.getLineContent(O),ie=a.getLineFirstNonWhitespaceColumn(O);if(ie>=1){let de=!0;T===""&&(de=!1),de&&(T.charAt(T.length-1)===" "||T.charAt(T.length-1)===" ")&&(de=!1,T=T.replace(/[\s\uFEFF\xA0]+$/g," "));const te=Q.substr(ie-1);T+=(de?" ":"")+te,de?D=te.length+1:D=te.length}else D=0}const V=new ee(E,y,I,M);if(!V.isEmpty()){let O;b.isEmpty()?(d.push(ns.replace(V,T)),O=new Hi(V.startLineNumber-g,T.length-D+1,E-g,T.length-D+1)):b.startLineNumber===b.endLineNumber?(d.push(ns.replace(V,T)),O=new Hi(b.startLineNumber-g,b.startColumn,b.endLineNumber-g,b.endColumn)):(d.push(ns.replace(V,T)),O=new Hi(b.startLineNumber-g,b.startColumn,b.startLineNumber-g,T.length-R)),ee.intersectRanges(V,n)!==null?f=O:u.push(O)}g+=V.endLineNumber-V.startLineNumber}u.unshift(f),t.pushUndoStop(),t.executeEdits(this.id,d,u),t.pushUndoStop()}}class qW extends gt{constructor(){super({id:"editor.action.transpose",label:S("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:U.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 d=i[r];if(!d.isEmpty())continue;const u=d.getStartPosition(),f=n.getLineMaxColumn(u.lineNumber);if(u.column>=f){if(u.lineNumber===n.getLineCount())continue;const g=new ee(u.lineNumber,Math.max(1,u.column-1),u.lineNumber+1,1),p=n.getValueInRange(g).split("").reverse().join("");s.push(new lp(new Hi(u.lineNumber,Math.max(1,u.column-1),u.lineNumber+1,1),p))}else{const g=new ee(u.lineNumber,Math.max(1,u.column-1),u.lineNumber,u.column+1),p=n.getValueInRange(g).split("").reverse().join("");s.push(new d2(g,p,new Hi(u.lineNumber,u.column+1,u.lineNumber,u.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class Ku extends gt{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 d=a.getStartPosition(),u=t.getConfiguredWordAtPosition(d);if(!u)continue;const f=new ee(d.lineNumber,u.startColumn,d.lineNumber,u.endColumn),g=n.getValueInRange(f);r.push(ns.replace(f,this._modifyText(g,s)))}else{const d=n.getValueInRange(a);r.push(ns.replace(a,this._modifyText(d,s)))}t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop()}}class GW extends Ku{constructor(){super({id:"editor.action.transformToUppercase",label:S("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:U.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class KW extends Ku{constructor(){super({id:"editor.action.transformToLowercase",label:S("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:U.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class Dl{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 Y_=class Y_ extends Ku{constructor(){super({id:"editor.action.transformToTitlecase",label:S("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:U.writable})}_modifyText(e,t){const i=Y_.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,n=>n.toLocaleUpperCase()):e}};Y_.titleBoundary=new Dl("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");let Jm=Y_;const zh=class zh extends Ku{constructor(){super({id:"editor.action.transformToSnakecase",label:S("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:U.writable})}_modifyText(e,t){const i=zh.caseBoundary.get(),n=zh.singleLetters.get();return!i||!n?e:e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase()}};zh.caseBoundary=new Dl("(\\p{Ll})(\\p{Lu})","gmu"),zh.singleLetters=new Dl("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");let ng=zh;const Q_=class Q_ extends Ku{constructor(){super({id:"editor.action.transformToCamelcase",label:S("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:U.writable})}_modifyText(e,t){const i=Q_.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("")}};Q_.wordBoundary=new Dl("[_\\s-]","gm");let e_=Q_;const Vh=class Vh extends Ku{constructor(){super({id:"editor.action.transformToPascalcase",label:S("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:U.writable})}_modifyText(e,t){const i=Vh.wordBoundary.get(),n=Vh.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("")}};Vh.wordBoundary=new Dl("[_\\s-]","gm"),Vh.wordBoundaryToMaintain=new Dl("(?<=\\.)","gm");let t_=Vh;const ic=class ic extends Ku{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(t=>t.isSupported())}constructor(){super({id:"editor.action.transformToKebabcase",label:S("editor.transformToKebabcase","Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:U.writable})}_modifyText(e,t){const i=ic.caseBoundary.get(),n=ic.singleLetters.get(),s=ic.underscoreBoundary.get();return!i||!n||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(n,"$1-$2").toLocaleLowerCase()}};ic.caseBoundary=new Dl("(\\p{Ll})(\\p{Lu})","gmu"),ic.singleLetters=new Dl("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),ic.underscoreBoundary=new Dl("(\\S)(_)(\\S)","gm");let i_=ic;Ae(FW);Ae(LW);Ae(IW);Ae(PW);Ae(TW);Ae(MW);Ae(RW);Ae(NW);Ae(VE);Ae(OW);Ae(HW);Ae(WW);Ae(zW);Ae(VW);Ae(jW);Ae($W);Ae(UW);Ae(qW);Ae(GW);Ae(KW);ng.caseBoundary.isSupported()&&ng.singleLetters.isSupported()&&Ae(ng);e_.wordBoundary.isSupported()&&Ae(e_);t_.wordBoundary.isSupported()&&Ae(t_);Jm.titleBoundary.isSupported()&&Ae(Jm);i_.isSupported()&&Ae(i_);var ZW=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},px=function(o,e){return function(t,i){e(t,i,o)}},$x;const pB=new xn("LinkedEditingInputVisible",!1),XW="linked-editing-decoration";var Lc;let O0=(Lc=class extends Pt{static get(e){return e.getContribution($x.ID)}constructor(e,t,i,n,s){super(),this.languageConfigurationService=n,this._syncRangesToken=0,this._localToDispose=this._register(new Bt),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=pB.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 Bt),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(Ds.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const n=new Rc(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},r=new Rc(0),a=d=>{this._rangeSyncTriggerPromise=r.trigger(()=>this._syncRanges(d))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{s()})),this._localToDispose.add(this._editor.onDidChangeModelContent(d=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const u=this._currentDecorations.getRange(0);if(u&&d.changes.every(f=>u.intersectRanges(f.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 d=this._currentDecorations.getRange(r);if(d)if(d.startLineNumber!==d.endLineNumber)s.push({range:d,text:n});else{let u=t.getValueInRange(d),f=n,g=d.startColumn,p=d.endColumn;const C=bp(u,f);g+=C,u=u.substr(C),f=f.substr(C);const b=x4(u,f);p-=b,u=u.substr(0,u.length-b),f=f.substr(0,f.length-b),(g!==p||f.length!==0)&&s.push({range:new ee(d.startLineNumber,g,d.endLineNumber,p),text:f})}}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 zs;try{const r=new Ro(!1),a=await xB(this._providers,i,t,s.token);if(this._debounceInformation.update(i,r.elapsed()),s!==this._currentRequestCts||(this._currentRequestCts=null,n!==i.getVersionId()))return;let d=[];a!=null&&a.ranges&&(d=a.ranges),this._currentWordPattern=(a==null?void 0:a.wordPattern)||this._languageWordPattern;let u=!1;for(let g=0,p=d.length;g<p;g++)if(ee.containsPosition(d[g],t)){if(u=!0,g!==0){const C=d[g];d.splice(g,1),d.unshift(C)}break}if(!u){this.clearRanges();return}const f=d.map(g=>({range:g,options:$x.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(f),this._syncRangesToken++}catch(r){$c(r)||On(r),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}},$x=Lc,Lc.ID="editor.contrib.linkedEditing",Lc.DECORATION=fn.register({description:"linked-editing",stickiness:0,className:XW}),Lc);O0=$x=ZW([px(1,En),px(2,xi),px(3,Ns),px(4,fr)],O0);class YW extends gt{constructor(){super({id:"editor.action.linkedEditing",label:S("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:$e.and(U.writable,U.hasRenameProvider),kbOpts:{kbExpr:U.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(fs),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return Rn.isUri(n)&&pi.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=O0.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const QW=wo.bindToContribution(O0.get);yi(new QW({id:"cancelLinkedEditingInput",precondition:pB,handler:o=>o.clearRanges(),kbOpts:{kbExpr:U.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function xB(o,e,t,i){const n=o.ordered(e);return yw(n.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(r){hs(r);return}}),s=>!!s&&Zo(s==null?void 0:s.ranges))}ci("editor.linkedEditingBackground",{dark:dn.fromHex("#f00").transparent(.3),light:dn.fromHex("#f00").transparent(.3),hcDark:dn.fromHex("#f00").transparent(.3),hcLight:dn.white},S("editorLinkedEditingBackground","Background color when the editor auto renames on type."));So("_executeLinkedEditingProvider",(o,e,t)=>{const{linkedEditingRangeProvider:i}=o.get(xi);return xB(i,e,t,sn.None)});on(O0.ID,O0,1);Ae(YW);let JW=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 n_{constructor(e){this._disposables=new Bt;let t=[];for(const[i,n]of e){const s=i.links.map(r=>new JW(r,n));t=n_._union(t,s),L2(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 d=e[n],u=t[r];if(ee.areIntersectingOrTouching(d.range,u.range)){n++;continue}ee.compareRangesUsingStarts(d.range,u.range)<0?(i.push(d),n++):(i.push(u),r++)}for(;n<s;n++)i.push(e[n]);for(;r<a;r++)i.push(t[r]);return i}}function mB(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])},hs));return Promise.all(n).then(()=>{const s=new n_(Al(i));return t.isCancellationRequested?(s.dispose(),new n_([])):s})}Un.registerCommand("_executeLinkProvider",async(o,...e)=>{let[t,i]=e;wn(t instanceof Rn),typeof i!="number"&&(i=0);const{linkProvider:n}=o.get(xi),s=o.get(po).getModel(t);if(!s)return[];const r=await mB(n,s,sn.None);if(!r)return[];for(let d=0;d<Math.min(i,r.links.length);d++)await r.links[d].resolve(sn.None);const a=r.links.slice(0);return r.dispose(),a});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},xx=function(o,e){return function(t,i){e(t,i,o)}},jE,su;let zg=(su=class extends Pt{static get(e){return e.getContribution(jE.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 As(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new Kv(e));this._register(r.onMouseMoveOrRelevantKeyDown(([a,d])=>{this._onEditorMouseMove(a,d)})),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=Ws(t=>mB(this.providers,e,t));try{const t=new Ro(!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(qh.decoration(r,t));this.editor.changeDecorations(r=>{const a=r.deltaDecorations(i,s);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let d=0,u=a.length;d<u;d++){const f=new qh(e[d],a[d]);this.currentOccurrences[f.decorationId]=f}})}_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(sn.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===mo.file&&s.startsWith(`${mo.file}:`)){const a=Rn.parse(s);if(a.scheme===mo.file){const d=m4(a);let u=null;d.startsWith("/./")||d.startsWith("\\.\\")?u=`.${d.substr(1)}`:(d.startsWith("//./")||d.startsWith("\\\\.\\"))&&(u=`.${d.substr(2)}`),u&&(s=_4(r,u))}}}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(S("invalid.url","Failed to open this link because it is not well-formed: {0}",n.url.toString())):r==="missing"?this.notificationService.warn(S("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()}},jE=su,su.ID="editor.linkDetector",su);zg=jE=ez([xx(1,ga),xx(2,go),xx(3,xi),xx(4,fr)],zg);const SD={general:fn.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:fn.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class qh{static decoration(e,t){return{range:e.range,options:qh._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n={...i?SD.active:SD.general};return n.hoverMessage=tz(e,t),n}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,qh._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,qh._getOptions(this.link,t,!1))}}function tz(o,e){const t=o.url&&/^command:/i.test(o.url.toString()),i=o.tooltip?o.tooltip:t?S("links.navigate.executeCmd","Execute command"):S("links.navigate.follow","Follow link"),n=e?Ya?S("links.navigate.kb.meta.mac","cmd + click"):S("links.navigate.kb.meta","ctrl + click"):Ya?S("links.navigate.kb.alt.mac","option + click"):S("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 d=a[1];s=S("tooltip.explanation","Execute command {0}",d)}}return new oo("",!0).appendLink(o.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${n})`)}else return new oo().appendText(`${i} (${n})`)}class iz extends gt{constructor(){super({id:"editor.action.openLink",label:S("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=zg.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)}}}on(zg.ID,zg,1);Ae(iz);const Y9=class Y9 extends Pt{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})}))}};Y9.ID="editor.contrib.longLinesHelper";let s_=Y9;on(s_.ID,s_,2);const nz=ci("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},S("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);ci("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},S("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);ci("editor.wordHighlightTextBackground",nz,S("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 sz=ci("editor.wordHighlightBorder",{light:null,dark:null,hcDark:vu,hcLight:vu},S("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));ci("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:vu,hcLight:vu},S("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));ci("editor.wordHighlightTextBorder",sz,S("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const oz=ci("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",S("overviewRulerWordHighlightForeground","Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),rz=ci("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",S("overviewRulerWordHighlightStrongForeground","Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),az=ci("editorOverviewRuler.wordHighlightTextForeground",G2,S("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),lz=fn.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:bs(rz),position:qa.Center},minimap:{color:bs(Fv),position:1}}),cz=fn.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:bs(az),position:qa.Center},minimap:{color:bs(Fv),position:1}}),dz=fn.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:bs(G2),position:qa.Center},minimap:{color:bs(Fv),position:1}}),uz=fn.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),hz=fn.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:bs(oz),position:qa.Center},minimap:{color:bs(Fv),position:1}});function fz(o){return o===lm.Write?lz:o===lm.Text?cz:hz}function gz(o){return o?uz:dz}bv((o,e)=>{const t=o.getColor(v4);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var pz=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},xz=function(o,e){return function(t,i){e(t,i,o)}},$E;function qc(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?S("cursorAdded","Cursor added: {0}",i):S("cursorsAdded","Cursors added: {0}",i);p0(n)}}class mz extends gt{constructor(){super({id:"editor.action.insertCursorAbove",label:S("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"3_multi",title:S({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,Ew.addCursorUp(s,r,n)),s.revealTopMostCursor(i.source),qc(r,s.getCursorStates())}}class _z extends gt{constructor(){super({id:"editor.action.insertCursorBelow",label:S("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"3_multi",title:S({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,Ew.addCursorDown(s,r,n)),s.revealBottomMostCursor(i.source),qc(r,s.getCursorStates())}}class vz extends gt{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:S("mutlicursor.insertAtEndOfEachLineSelected","Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"3_multi",title:S({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 Hi(n,s,n,s))}e.endColumn>1&&i.push(new Hi(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(d=>this.getCursorsForSelection(d,i,a)),a.length>0&&t.setSelections(a),qc(r,s.getCursorStates())}}class bz extends gt{constructor(){super({id:"editor.action.addCursorsToBottom",label:S("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 d=i[0].startLineNumber;d<=n;d++)s.push(new Hi(d,i[0].startColumn,d,i[0].endColumn));const r=t._getViewModel(),a=r.getCursorStates();s.length>0&&t.setSelections(s),qc(a,r.getCursorStates())}}class Cz extends gt{constructor(){super({id:"editor.action.addCursorsToTop",label:S("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 Hi(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();n.length>0&&t.setSelections(n),qc(r,s.getCursorStates())}}class mx{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class Vg{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new Vg(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 d=e.getSelection();let u,f=null;if(d.isEmpty()){const g=e.getConfiguredWordAtPosition(d.getStartPosition());if(!g)return null;u=g.word,f=new Hi(d.startLineNumber,g.startColumn,d.startLineNumber,g.endColumn)}else u=e.getModel().getValueInRange(d).replace(/\r\n/g,`
57
+ `);return new Vg(e,t,n,u,s,r,f)}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 mx(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 mx(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 Hi(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 mx(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 mx(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 Hi(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 J_=class J_ extends Pt{static get(e){return e.getContribution(J_.ID)}constructor(e){super(),this._sessionDispose=this._register(new Bt),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=Vg.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 Hi(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(!_B(this._editor.getModel(),t,n)){const r=this._editor.getModel(),a=[];for(let d=0,u=t.length;d<u;d++)a[d]=this._expandEmptyToWord(r,t[d]);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 Hi(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}};J_.ID="editor.contrib.multiCursorController";let H0=J_;class J0 extends gt{run(e,t){const i=H0.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=Eo.get(t);if(r)this._run(i,r);else{const a=e.get(Qi).createInstance(Eo,t);this._run(i,a),a.dispose()}qc(s,n.getCursorStates())}}}class Ez extends J0{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:S("addSelectionToNextFindMatch","Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:U.focus,primary:2082,weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"3_multi",title:S({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class yz extends J0{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:S("addSelectionToPreviousFindMatch","Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"3_multi",title:S({key:"miAddSelectionToPreviousFindMatch",comment:["&& denotes a mnemonic"]},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class wz extends J0{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:S("moveSelectionToNextFindMatch","Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:U.focus,primary:xs(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class Sz extends J0{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:S("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 Dz extends J0{constructor(){super({id:"editor.action.selectHighlights",label:S("selectAllOccurrencesOfFindMatch","Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:U.focus,primary:3114,weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"3_multi",title:S({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class Az extends J0{constructor(){super({id:"editor.action.changeAll",label:S("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:$e.and(U.writable,U.editorTextFocus),kbOpts:{kbExpr:U.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class kz{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(ee.compareRangesUsingStarts)),this._cachedFindMatches}}var ou;let o_=(ou=class extends Pt{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(109),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new As(()=>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=Eo.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState($E._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=H0.get(i);if(!s)return null;const r=Eo.get(i);if(!r)return null;let a=s.getSession(r);if(!a){const f=i.getSelections();if(f.length>1){const p=r.getState().matchCase;if(!_B(i.getModel(),f,p))return null}a=Vg.create(i,r)}if(!a||a.currentMatch||/^[ \t]+$/.test(a.searchText)||a.searchText.length>200)return null;const d=r.getState(),u=d.matchCase;if(d.isRevealed){let f=d.searchString;u||(f=f.toLowerCase());let g=a.searchText;if(u||(g=g.toLowerCase()),f===g&&a.matchCase===d.matchCase&&a.wholeWord===d.wholeWord&&!d.isRegex)return null}return new kz(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(ee.compareRangesUsingStarts);const s=[];for(let u=0,f=0,g=i.length,p=n.length;u<g;){const C=i[u];if(f>=p)s.push(C),u++;else{const b=ee.compareRangesUsingStarts(C,n[f]);b<0?((n[f].isEmpty()||!ee.areIntersecting(C,n[f]))&&s.push(C),u++):(b>0||u++,f++)}}const r=this.editor.getOption(81)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,d=s.map(u=>({range:u,options:gz(a)}));this._decorations.set(d)}dispose(){this._setState(null),super.dispose()}},$E=ou,ou.ID="editor.contrib.selectionHighlighter",ou);o_=$E=pz([xz(1,xi)],o_);function _B(o,e,t){const i=DD(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=DD(o,r,!t);if(i!==a)return!1}return!0}function DD(o,e,t){const i=o.getValueInRange(e);return t?i.toLowerCase():i}class Bz extends gt{constructor(){super({id:"editor.action.focusNextCursor",label:S("mutlicursor.focusNextCursor","Focus Next Cursor"),metadata:{description:S("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),qc(s,n.getCursorStates()))}}class Fz extends gt{constructor(){super({id:"editor.action.focusPreviousCursor",label:S("mutlicursor.focusPreviousCursor","Focus Previous Cursor"),metadata:{description:S("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),qc(s,n.getCursorStates()))}}on(H0.ID,H0,4);on(o_.ID,o_,1);Ae(mz);Ae(_z);Ae(vz);Ae(Ez);Ae(yz);Ae(wz);Ae(Sz);Ae(Dz);Ae(Az);Ae(bz);Ae(Cz);Ae(Bz);Ae(Fz);const Lz="editor.action.inlineEdit.accept",Iz="editor.action.inlineEdit.reject",Pz="editor.action.inlineEdit.jumpTo",Tz="editor.action.inlineEdit.jumpBack";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},Rz=function(o,e){return function(t,i){e(t,i,o)}};const cC="inline-edit";let UE=class extends Pt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Xo(this,!1),this.currentTextModel=Fo(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=In(this,n=>{var I;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=(I=this.model.range)==null?void 0:I.read(n);a&&a.startLineNumber===a.endLineNumber&&a.startColumn===a.endColumn&&(a=void 0);const d=(a?a.startLineNumber===a.endLineNumber:!0)&&r.parts.length===1&&r.parts[0].lines.length===1,u=r.parts.length===1&&r.parts[0].lines.every(M=>M.length===0),f=[],g=[];function p(M,R){if(g.length>0){const T=g[g.length-1];R&&T.decorations.push(new Eg(T.content.length+1,T.content.length+1+M[0].length,R,0)),T.content+=M[0],M=M.slice(1)}for(const T of M)g.push({content:T,decorations:R?[new Eg(1,T.length+1,R,0)]:[]})}const C=s.getLineContent(r.lineNumber);let b,E=0;if(!u&&(d||!a)){for(const M of r.parts){let R=M.lines;a&&!d&&(p(R,cC),R=[]),b===void 0?(f.push({column:M.column,text:R[0],preview:M.preview}),R=R.slice(1)):p([C.substring(E,M.column-1)],void 0),R.length>0&&(p(R,cC),b===void 0&&M.column<=C.length&&(b=M.column)),E=M.column-1}b!==void 0&&p([C.substring(E)],void 0)}const y=b!==void 0?new J5(b,C.length+1):void 0,D=d||!a?r.lineNumber:a.endLineNumber-1;return{inlineTexts:f,additionalLines:g,hiddenRange:y,lineNumber:D,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s,range:a,isSingleLine:d,isPureRemove:u}}),this.decorations=In(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 d=s.range.endLineNumber-s.range.startLineNumber;for(let u=0;u<d;u++){const f=s.range.startLineNumber+u,g=s.targetTextModel.getLineFirstNonWhitespaceColumn(f),p=s.targetTextModel.getLineLastNonWhitespaceColumn(f),C=new ee(f,g,f,p);a.push(C)}}for(const d of a)r.push({range:d,options:ww})}if(s.range&&!s.isSingleLine&&s.isPureRemove){const a=new ee(s.range.startLineNumber,1,s.range.endLineNumber-1,1);r.push({range:a,options:Sw})}for(const a of s.inlineTexts)r.push({range:ee.fromPositions(new pi(s.lineNumber,a.column)),options:{description:cC,after:{content:a.text,inlineClassName:a.preview?"inline-edit-decoration-preview":"inline-edit-decoration",cursorStops:Ah.Left},showIfCollapsed:!0}});return r}),this._register(Zn(()=>{this.isDisposed.set(!0,void 0)})),this._register(eB(this.editor,this.decorations))}};UE=Mz([Rz(2,xa)],UE);var y9=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},Na=function(o,e){return function(t,i){e(t,i,o)}},Ux;let qE=class extends Pt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Fo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=In(this,n=>{var d,u;const s=(d=this.model.read(n))==null?void 0:d.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 pi(s.lineNumber,Math.min(r,((u=this.sessionPosition)==null?void 0:u.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(pp((n,s)=>{if(!this.model.read(n)||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(GE,this.editor,!0,this.position));e.addContentWidget(a),s.add(Zn(()=>e.removeContentWidget(a)))}))}};qE=y9([Na(2,Qi)],qE);var Ic;let GE=(Ic=class extends Pt{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${Ux.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Tr("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[Tr("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(Yt.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(n.createInstance(KE,this.nodes.toolBar,this.editor,Yt.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:a=>a.startsWith("primary")},actionViewItemProvider:(a,d)=>{if(a instanceof v0)return n.createInstance(Nz,a,void 0)},telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{Ux._dropDownVisible=a})),this._register(ts(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(ts(a=>{const d=[];for(const[u,f]of this.inlineCompletionsActionsMenus.getActions())for(const g of f)g instanceof v0&&d.push(g);d.length>0&&d.unshift(new xg),this.toolBar.setAdditionalSecondaryActions(d)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},Ux=Ic,Ic._dropDownVisible=!1,Ic.id=0,Ic);GE=Ux=y9([Na(3,Qi),Na(4,En),Na(5,Hu)],GE);class Nz extends XA{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Tr("div.keybinding").root;this._register(new ow(t,rw,{disableTitle:!0,...YA})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let KE=class extends QA{constructor(e,t,i,n,s,r,a,d,u,f){super(e,{resetMenu:i,...n},s,r,a,d,u,f),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,d,u;const e=[],t=[];hw(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,(u=(d=this.options2)==null?void 0:d.toolbarOptions)==null?void 0:u.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setAdditionalSecondaryActions(e){Xa(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};KE=y9([Na(4,Hu),Na(5,En),Na(6,V0),Na(7,ms),Na(8,Rs),Na(9,pa)],KE);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},qx=function(o,e){return function(t,i){e(t,i,o)}},Nf,ZE;function*Oz(o,e,t=1){e===void 0&&([e,o]=[o,0]);for(let i=o;i<e;i+=t)yield i}function dC(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 ru;let XE=(ru=class extends Pt{static _createUniqueUri(){return Rn.from({scheme:"inline-edit-widget",path:new Date().toString()+String(Nf._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=In(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 d=this._editor.getModel();if(!d)return null;const u=Array.from(Oz(a.range.startLineNumber,a.range.endLineNumber+1)),f=u.map(E=>d.getLineLastNonWhitespaceColumn(E)),g=Math.max(...f),p=u[f.indexOf(g)],C=new pi(p,g);return{top:a.range.startLineNumber,left:C}}),this._text=In(this,r=>{const a=this._model.read(r);if(!a)return{text:"",shift:0};const d=dC(a.text.split(`
58
+ `));return{text:d.text.join(`
59
+ `),shift:d.shift}}),this._originalModel=Nc(()=>this._modelService.createModel("",null,Nf._createUniqueUri())).keepObserved(this._store),this._modifiedModel=Nc(()=>this._modelService.createModel("",null,Nf._createUniqueUri())).keepObserved(this._store),this._diff=In(this,r=>{var a,d;return(d=(a=this._diffPromise.read(r))==null?void 0:a.promiseResult.read(r))==null?void 0:d.data}),this._diffPromise=In(this,r=>{const a=this._model.read(r);if(!a)return;const d=this._editor.getModel();if(!d)return;const u=dC(d.getValueInRange(a.range).split(`
60
+ `)).text.join(`
61
+ `),f=dC(a.text.split(`
62
+ `)).text.join(`
63
+ `);this._originalModel.get().setValue(u),this._modifiedModel.get().setValue(f);const g=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return K2.fromFn(async()=>{const p=await g.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},sn.None);if(!p.identical)return p.changes})}),this._register(pp((r,a)=>{if(!this._model.read(r)||this._position.get()===null)return;const u=a.add(this._instantiationService.createInstance(YE,this._editor,this._position,this._text.map(f=>f.text),this._text.map(f=>f.shift),this._diff));e.addOverlayWidget(u),a.add(Zn(()=>e.removeOverlayWidget(u)))}))}},Nf=ru,ru._modelId=0,ru);XE=Nf=vB([qx(2,Qi),qx(3,Dw),qx(4,po)],XE);var au;let YE=(au=class extends Pt{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${ZE.id++}`,this.allowEditorOverflow=!1,this._nodes=li("div.inlineEditSideBySide",void 0),this._scrollChanged=yd("editor.onDidScrollChange",this._editor.onDidScrollChange),this._previewEditor=this._register(this._instantiationService.createInstance(jr,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=Ha(this._previewEditor),this._editorObs=Ha(this._editor),this._previewTextModel=this._register(this._instantiationService.createInstance(lc,"",((a=this._editor.getModel())==null?void 0:a.getLanguageId())??bg,lc.DEFAULT_CREATION_OPTIONS,null)),this._setText=In(d=>{const u=this._text.read(d);u&&this._previewTextModel.setValue(u)}).recomputeInitiallyAndOnChange(this._store),this._decorations=In(this,d=>{this._setText.read(d);const u=this._position.read(d);if(!u)return{org:[],mod:[]};const f=this._diff.read(d);if(!f)return{org:[],mod:[]};const g=[],p=[];if(f.length===1&&f[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return{org:[],mod:[]};const C=this._shift.get(),b=E=>new ee(E.startLineNumber+u.top-1,E.startColumn+C,E.endLineNumber+u.top-1,E.endColumn+C);for(const E of f)if(E.original.isEmpty||g.push({range:b(E.original.toInclusiveRange()),options:Sw}),E.modified.isEmpty||p.push({range:E.modified.toInclusiveRange(),options:Z2}),E.modified.isEmpty||E.original.isEmpty)E.original.isEmpty||g.push({range:b(E.original.toInclusiveRange()),options:X2}),E.modified.isEmpty||p.push({range:E.modified.toInclusiveRange(),options:Y2});else for(const y of E.innerChanges||[])E.original.contains(y.originalRange.startLineNumber)&&g.push({range:b(y.originalRange),options:y.originalRange.isEmpty()?Q2:ww}),E.modified.contains(y.modifiedRange.startLineNumber)&&p.push({range:y.modifiedRange,options:y.modifiedRange.isEmpty()?J2:ek});return{org:g,mod:p}}),this._originalDecorations=In(this,d=>this._decorations.read(d).org),this._modifiedDecorations=In(this,d=>this._decorations.read(d).mod),this._previewEditor.setModel(this._previewTextModel),this._register(this._editorObs.setDecorations(this._originalDecorations)),this._register(this._previewEditorObs.setDecorations(this._modifiedDecorations)),this._register(ts(d=>{const u=this._previewEditorObs.contentWidth.read(d),f=this._text.read(d).split(`
64
+ `).length-1,g=this._editor.getOption(67)*f;u<=0||this._previewEditor.layout({height:g,width:u})})),this._register(ts(d=>{this._position.read(d),this._editor.layoutOverlayWidget(this)})),this._register(ts(d=>{this._scrollChanged.read(d),this._position.read(d)&&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 pi(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}}}},ZE=au,au.id=0,au);YE=ZE=vB([qx(5,Qi)],YE);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},td=function(o,e){return function(t,i){e(t,i,o)}},Of,lr;let co=(lr=class extends Pt{static get(e){return e.getContribution(Of.ID)}constructor(e,t,i,n,s,r,a,d){super(),this.editor=e,this.instantiationService=t,this.contextKeyService=i,this.languageFeaturesService=n,this._commandService=s,this._configurationService=r,this._diffProviderFactoryService=a,this._modelService=d,this._isVisibleContext=Of.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=Of.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=Xo(this,void 0),this._currentWidget=Nc(this._currentEdit,b=>{const E=this._currentEdit.read(b);if(!E)return;const y=E.range.endLineNumber,D=E.range.endColumn,I=E.text.endsWith(`
65
+ `)&&!(E.range.startLineNumber===E.range.endLineNumber&&E.range.startColumn===E.range.endColumn)?E.text.slice(0,-1):E.text,M=new Rg(y,[new Om(D,I,!1)]),R=E.range.startLineNumber===E.range.endLineNumber&&M.parts.length===1&&M.parts[0].lines.length===1,T=E.text==="";return!R&&!T?void 0:this.instantiationService.createInstance(UE,this.editor,{ghostText:_l(M),minReservedLineCount:_l(0),targetTextModel:_l(this.editor.getModel()??void 0),range:_l(E.range)})}),this._isAccepting=Xo(this,!1),this._enabled=Fo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=Fo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily);const u=yd("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(ts(b=>{this._enabled.read(b)&&(u.read(b),!this._isAccepting.read(b)&&this.getInlineEdit(e,!0))}));const f=Fo(this,e.onDidChangeCursorPosition,()=>e.getPosition());this._register(ts(b=>{if(!this._enabled.read(b))return;const E=f.read(b);E&&this.checkCursorPosition(E)})),this._register(ts(b=>{const E=this._currentEdit.read(b);if(this._isCursorAtInlineEditContext.set(!1),!E){this._isVisibleContext.set(!1);return}this._isVisibleContext.set(!0);const y=e.getPosition();y&&this.checkCursorPosition(y)}));const g=yd("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(ts(async b=>{var E;this._enabled.read(b)&&(g.read(b),!(this._configurationService.getValue("editor.experimentalInlineEdit.keepOnBlur")||e.getOption(63).keepOnBlur)&&((E=this._currentRequestCts)==null||E.dispose(!0),this._currentRequestCts=void 0,await this.clear(!1)))}));const p=yd("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(ts(b=>{this._enabled.read(b)&&(p.read(b),this.getInlineEdit(e,!0))}));const C=this._register(y2());this._register(ts(b=>{const E=this._fontFamily.read(b);C.setStyle(E===""||E==="default"?"":`
66
+ .monaco-editor .inline-edit-decoration,
67
+ .monaco-editor .inline-edit-decoration-preview,
68
+ .monaco-editor .inline-edit {
69
+ font-family: ${E};
70
+ }`)})),this._register(new qE(this.editor,this._currentWidget,this.instantiationService)),this._register(new XE(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(ee.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 zs;const a=this._currentRequestCts.token,d=t?NS.Automatic:NS.Invoke;if(t&&await Wz(50,a),a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)return;const f=await r.provideInlineEdit(i,{triggerKind:d},a);if(f&&!(a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)&&this.validateInlineEdit(e,f))return f}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",[ns.replace(ee.lift(e.range),t)]),e.accepted&&await this._commandService.executeCommand(e.accepted.id,...e.accepted.arguments||[]).then(void 0,hs),this.freeEdit(e),Wu(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=pi.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,hs),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)}},Of=lr,lr.ID="editor.contrib.inlineEditController",lr.inlineEditVisibleKey="inlineEditVisible",lr.inlineEditVisibleContext=new xn(lr.inlineEditVisibleKey,!1),lr.cursorAtInlineEditKey="cursorAtInlineEdit",lr.cursorAtInlineEditContext=new xn(lr.cursorAtInlineEditKey,!1),lr);co=Of=Hz([td(1,Qi),td(2,En),td(3,xi),td(4,Rs),td(5,Yn),td(6,Dw),td(7,po)],co);function Wz(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 zz=class extends gt{constructor(){super({id:Lz,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:$e.and(U.writable,co.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:$e.and(U.writable,co.inlineEditVisibleContext,co.cursorAtInlineEditContext)}],menuOpts:[{menuId:Yt.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){const i=co.get(t);await(i==null?void 0:i.accept())}};class Vz extends gt{constructor(){const e=$e.and(U.writable,$e.not(co.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=co.get(t);i==null||i.trigger()}}class jz extends gt{constructor(){const e=$e.and(U.writable,co.inlineEditVisibleContext,$e.not(co.cursorAtInlineEditKey));super({id:Pz,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:Yt.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){const i=co.get(t);i==null||i.jumpToCurrent()}}class $z extends gt{constructor(){const e=$e.and(U.writable,co.cursorAtInlineEditContext);super({id:Tz,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:Yt.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){const i=co.get(t);i==null||i.jumpBack()}}class Uz extends gt{constructor(){const e=$e.and(U.writable,co.inlineEditVisibleContext);super({id:Iz,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:Yt.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){const i=co.get(t);await(i==null?void 0:i.clear())}}Ae(zz);Ae(Uz);Ae(jz);Ae($z);Ae(Vz);on(co.ID,co,3);const qz="editor.action.inlineEdits.accept",Gz="editor.action.inlineEdits.showPrevious",Kz="editor.action.inlineEdits.showNext",W0=new xn("inlineEditsVisible",!1,S("inlineEditsVisible","Whether an inline edit is visible")),Zz=new xn("inlineEditsIsPinned",!1,S("isPinned","Whether an inline edit is visible")),Q9=class Q9 extends Pt{constructor(e){super(),this._editor=e,this._editorObs=Ha(this._editor),this._placeholderText=this._editorObs.getOption(88),this._state=xl({owner:this,equalsFn:tk},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=Xz(this,t=>{var i;return((i=this._state.read(t))==null?void 0:i.placeholder)!==void 0}),this._view=JA((t,i)=>{if(!this._shouldViewBeAlive.read(t))return;const n=Tr("div.editorPlaceholder");i.add(ts(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(ts(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(ts(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:_l(0),position:_l(null),domNode:n.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};Q9.ID="editor.contrib.placeholderText";let jg=Q9;function Xz(o,e){return Ev(o,(t,i)=>i===!0?!0:e(t))}var Yz=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},Qz=function(o,e){return function(t,i){e(t,i,o)}};class Jz{constructor(e,t,i){this.range=e,this.newLines=t,this.changes=i}}let QE=class extends Pt{constructor(e,t,i,n){super(),this._editor=e,this._edit=t,this._userPrompt=i,this._instantiationService=n,this._editorObs=Ha(this._editor),this._elements=Tr("div.inline-edits-widget",{style:{position:"absolute",overflow:"visible",top:"0px",left:"0px"}},[Tr("div@editorContainer",{style:{position:"absolute",top:"0px",left:"0px",width:"500px",height:"500px"}},[Tr("div.toolbar@toolbar",{style:{position:"absolute",top:"-25px",left:"0px"}}),Tr("div.promptEditor@promptEditor",{style:{position:"absolute",top:"-25px",left:"80px",width:"300px",height:"22px"}}),Tr("div.preview@editor",{style:{position:"absolute",top:"0px",left:"0px"}})]),ih("svg",{style:{overflow:"visible",pointerEvents:"none"}},[ih("defs",[ih("linearGradient",{id:"Gradient2",x1:"0",y1:"0",x2:"1",y2:"0"},[ih("stop",{offset:"0%",class:"gradient-stop"}),ih("stop",{offset:"100%",class:"gradient-stop"})])]),ih("path@path",{d:"",fill:"url(#Gradient2)"})])]),this._previewTextModel=this._register(this._instantiationService.createInstance(lc,"",bg,lc.DEFAULT_CREATION_OPTIONS,null)),this._setText=In(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(lc,"",bg,lc.DEFAULT_CREATION_OPTIONS,null)),this._promptEditor=this._register(this._instantiationService.createInstance(jr,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:b4},{contributions:C4.getSomeEditorContributions([Nr.ID,jg.ID,I0.ID]),isSimpleWidget:!0},this._editor)),this._previewEditor=this._register(this._instantiationService.createInstance(jr,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=Ha(this._previewEditor),this._decorations=In(this,r=>{var f;this._setText.read(r);const a=(f=this._edit.read(r))==null?void 0:f.changes;if(!a)return[];const d=[],u=[];if(a.length===1&&a[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return[];for(const g of a)if(g.original.isEmpty||d.push({range:g.original.toInclusiveRange(),options:Sw}),g.modified.isEmpty||u.push({range:g.modified.toInclusiveRange(),options:Z2}),g.modified.isEmpty||g.original.isEmpty)g.original.isEmpty||d.push({range:g.original.toInclusiveRange(),options:X2}),g.modified.isEmpty||u.push({range:g.modified.toInclusiveRange(),options:Y2});else for(const p of g.innerChanges||[])g.original.contains(p.originalRange.startLineNumber)&&d.push({range:p.originalRange,options:p.originalRange.isEmpty()?Q2:ww}),g.modified.contains(p.modifiedRange.startLineNumber)&&u.push({range:p.modifiedRange,options:p.modifiedRange.isEmpty()?J2:ek});return u}),this._layout1=In(this,r=>{const a=this._editor.getModel(),d=this._edit.read(r);if(!d)return null;const u=d.range;let f=0;for(let C=u.startLineNumber;C<u.endLineNumberExclusive;C++){const b=a.getLineMaxColumn(C),E=this._editor.getOffsetForColumn(C,b);f=Math.max(f,E)}return{left:this._editor.getLayoutInfo().contentLeft+f}}),this._layout=In(this,r=>{const a=this._edit.read(r);if(!a)return null;const d=a.range,u=this._editorObs.scrollLeft.read(r),f=this._layout1.read(r).left+20-u,g=this._editor.getTopForLineNumber(d.startLineNumber)-this._editorObs.scrollTop.read(r),p=this._editor.getTopForLineNumber(d.endLineNumberExclusive)-this._editorObs.scrollTop.read(r),C=new Mh(f,g),b=new Mh(f,p),E=p-g,y=50,D=this._editor.getOption(67)*a.newLines.length,I=E-D,M=new Mh(f+y,g+I/2),R=new Mh(f+y,p-I/2);return{topCode:C,bottomCode:b,codeHeight:E,topEdit:M,bottomEdit:R,editHeight:D}});const s=In(this,r=>this._edit.read(r)!==void 0||this._userPrompt.read(r)!==void 0);this._register(E4(this._elements.root,{display:In(this,r=>s.read(r)?"block":"none")})),this._register(y4(this._editor.getDomNode(),this._elements.root)),this._register(Ha(e).createOverlayWidget({domNode:this._elements.root,position:_l(null),allowEditorOverflow:!1,minContentWidthInPx:In(r=>{var u;const a=(u=this._layout1.read(r))==null?void 0:u.left;if(a===void 0)return 0;const d=this._previewEditorObs.contentWidth.read(r);return a+d})})),this._previewEditor.setModel(this._previewTextModel),this._register(this._previewEditorObs.setDecorations(this._decorations)),this._register(ts(r=>{const a=this._layout.read(r);if(!a)return;const{topCode:d,bottomCode:u,topEdit:f,bottomEdit:g,editHeight:p}=a,C=10,b=0,E=40,y=new tV().moveTo(d).lineTo(d.deltaX(C)).curveTo(d.deltaX(C+E),f.deltaX(-E-b),f.deltaX(-b)).lineTo(f).lineTo(g).lineTo(g.deltaX(-b)).curveTo(g.deltaX(-E-b),u.deltaX(C+E),u.deltaX(C)).lineTo(u).build();this._elements.path.setAttribute("d",y),this._elements.editorContainer.style.top=`${f.y}px`,this._elements.editorContainer.style.left=`${f.x}px`,this._elements.editorContainer.style.height=`${p}px`;const D=this._previewEditorObs.contentWidth.read(r);this._previewEditor.layout({height:p,width:D})})),this._promptEditor.setModel(this._promptTextModel),this._promptEditor.layout(),this._register(iV(eV(this._userPrompt,r=>r??"",r=>r),Ha(this._promptEditor).value)),this._register(ts(r=>{const a=Ha(this._promptEditor).isFocused.read(r);this._elements.root.classList.toggle("focused",a)}))}};QE=Yz([Qz(3,Qi)],QE);function eV(o,e,t){return ik(void 0,i=>e(o.read(i)),(i,n)=>o.set(t(i),n))}class Mh{constructor(e,t){this.x=e,this.y=t}deltaX(e){return new Mh(this.x+e,this.y)}}class tV{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 iV(o,e){const t=new Bt;return t.add(ts(i=>{const n=o.read(i);e.set(n,void 0)})),t.add(ts(i=>{const n=e.read(i);o.set(n,void 0)})),t}var nV=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},uC=function(o,e){return function(t,i){e(t,i,o)}},Hf,lu;let JE=(lu=class extends Pt{static _createUniqueUri(){return Rn.from({scheme:"inline-edits",path:new Date().toString()+String(Hf._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=vw(this),this._selectedInlineCompletionId=Xo(this,void 0),this._isActive=Xo(this,!1),this._originalModel=Nc(()=>this._modelService.createModel("",null,Hf._createUniqueUri())).keepObserved(this._store),this._modifiedModel=Nc(()=>this._modelService.createModel("",null,Hf._createUniqueUri())).keepObserved(this._store),this._pinnedRange=new oV(this.textModel,this._textModelVersionId),this.isPinned=this._pinnedRange.range.map(d=>!!d),this.userPrompt=Xo(this,void 0),this.inlineEdit=In(this,d=>{var u,f;return(f=(u=this._inlineEdit.read(d))==null?void 0:u.promiseResult.read(d))==null?void 0:f.data}),this._inlineEdit=In(this,d=>{const u=this.selectedInlineEdit.read(d);if(!u)return;const f=u.inlineCompletion.range;if(u.inlineCompletion.insertText.trim()==="")return;let g=u.inlineCompletion.insertText.split(/\r\n|\r|\n/);function p(y){var I;const D=((I=y[0].match(/^\s*/))==null?void 0:I[0])??"";return y.map(M=>M.replace(new RegExp("^"+D),""))}g=p(g);let b=this.textModel.getValueInRange(f).split(/\r\n|\r|\n/);b=p(b),this._originalModel.get().setValue(b.join(`
74
+ `)),this._modifiedModel.get().setValue(g.join(`
75
+ `));const E=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return K2.fromFn(async()=>{const y=await E.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},sn.None);if(!y.identical)return new Jz(w4.fromRangeInclusive(f),p(g),y.changes)})}),this._fetchStore=this._register(new Bt),this._inlineEditsFetchResult=TC(this,void 0),this._inlineEdits=xl({owner:this,equalsFn:tk},d=>{var u;return((u=this._inlineEditsFetchResult.read(d))==null?void 0:u.completions.map(f=>new sV(f)))??[]}),this._fetchInlineEditsPromise=I2({owner:this,createEmptyChangeSummary:()=>({inlineCompletionTriggerKind:yl.Automatic}),handleChange:(d,u)=>(d.didChange(this._forceUpdateExplicitlySignal)&&(u.inlineCompletionTriggerKind=yl.Explicit),!0)},async(d,u)=>{this._fetchStore.clear(),this._forceUpdateExplicitlySignal.read(d),this._textModelVersionId.read(d);function f(E,y){return y(E)}const g=this._pinnedRange.range.read(d)??f(this._selection.read(d),E=>E.isEmpty()?void 0:E);if(!g){this._inlineEditsFetchResult.set(void 0,void 0),this.userPrompt.set(void 0,void 0);return}const p={triggerKind:u.inlineCompletionTriggerKind,selectedSuggestionInfo:void 0,userPrompt:this.userPrompt.read(d)},C=RC(this._fetchStore);await Bv(200,C);const b=await tB(this.languageFeaturesService.inlineCompletionsProvider,g,this.textModel,p,C);C.isCancellationRequested||this._inlineEditsFetchResult.set(b,void 0)}),this._filteredInlineEditItems=xl({owner:this,equalsFn:MC()},d=>this._inlineEdits.read(d)),this.selectedInlineCompletionIndex=In(this,d=>{const u=this._selectedInlineCompletionId.read(d),f=this._filteredInlineEditItems.read(d),g=this._selectedInlineCompletionId===void 0?-1:f.findIndex(p=>p.semanticId===u);return g===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):g}),this.selectedInlineEdit=In(this,d=>{const u=this._filteredInlineEditItems.read(d),f=this.selectedInlineCompletionIndex.read(d);return u[f]}),this._register(P2(this._fetchInlineEditsPromise))}async triggerExplicitly(e){om(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineEditsPromise.get()}stop(e){om(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 b0;const t=this.selectedInlineEdit.get();t&&(e.pushUndoStop(),e.executeEdits("inlineSuggestion.accept",[t.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]),this.stop())}},Hf=lu,lu._modelId=0,lu);JE=Hf=nV([uC(4,xi),uC(5,Dw),uC(6,po)],JE);class sV{constructor(e){this.inlineCompletion=e,this.semanticId=this.inlineCompletion.hash()}}class oV extends Pt{constructor(e,t){super(),this._textModel=e,this._versionId=t,this._decorations=Xo(this,[]),this.range=In(this,i=>{this._versionId.read(i);const n=this._decorations.read(i)[0];return n?this._textModel.getDecorationRange(n)??null:null}),this._register(Zn(()=>{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 rV=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},yf=function(o,e){return function(t,i){e(t,i,o)}},ey,cu;let Ml=(cu=class extends Pt{static get(e){return e.getContribution(ey.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=S4("editor.inlineEdits.enabled",!1,this._configurationService),this._editorObs=Ha(this.editor),this._selection=In(this,a=>this._editorObs.cursorSelection.read(a)??new Hi(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 d=this._editorObs.model.read(a);return d?this._instantiationService.createInstance(NC(JE,a),d,this._editorObs.versionId,this._selection,this._debounceValue):void 0}),this._hadInlineEdit=Ev(this,(a,d)=>{var u;return d||((u=this.model.read(a))==null?void 0:u.inlineEdit.read(a))!==void 0}),this._widget=Nc(this,a=>{if(this._hadInlineEdit.read(a))return this._instantiationService.createInstance(NC(QE,a),this.editor,this.model.map((d,u)=>d==null?void 0:d.inlineEdit.read(u)),aV(d=>{var u;return((u=this.model.read(d))==null?void 0:u.userPrompt)??Xo("empty","")}))}),this._register(OS(W0,this._contextKeyService,a=>{var d;return!!((d=this.model.read(a))!=null&&d.inlineEdit.read(a))})),this._register(OS(Zz,this._contextKeyService,a=>{var d;return!!((d=this.model.read(a))!=null&&d.isPinned.read(a))})),this.model.recomputeInitiallyAndOnChange(this._store),this._widget.recomputeInitiallyAndOnChange(this._store)}},ey=cu,cu.ID="editor.contrib.inlineEditsController",cu);Ml=ey=rV([yf(1,Qi),yf(2,En),yf(3,fr),yf(4,xi),yf(5,Yn)],Ml);function aV(o){return ik(void 0,e=>o(e).read(e),(e,t)=>{o(void 0).set(e,t)})}function Np(o){return{label:o.value,alias:o.original}}const ev=class ev extends gt{constructor(){super({id:ev.ID,...Np(ui("action.inlineEdits.showNext","Show Next Inline Edit")),precondition:$e.and(U.writable,W0),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=Ml.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};ev.ID=Kz;let ty=ev;const tv=class tv extends gt{constructor(){super({id:tv.ID,...Np(ui("action.inlineEdits.showPrevious","Show Previous Inline Edit")),precondition:$e.and(U.writable,W0),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=Ml.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};tv.ID=Gz;let iy=tv;class lV extends gt{constructor(){super({id:"editor.action.inlineEdits.trigger",...Np(ui("action.inlineEdits.trigger","Trigger Inline Edit")),precondition:U.writable})}async run(e,t){const i=Ml.get(t);await j2(async n=>{var s;await((s=i==null?void 0:i.model.get())==null?void 0:s.triggerExplicitly(n))})}}class cV extends gt{constructor(){super({id:qz,...Np(ui("action.inlineEdits.accept","Accept Inline Edit")),precondition:W0,menuOpts:{menuId:Yt.InlineEditsActions,title:S("inlineEditsActions","Accept Inline Edit"),group:"primary",order:1,icon:Ui.check},kbOpts:{primary:2058,weight:2e4,kbExpr:W0}})}async run(e,t){var n;t instanceof jr&&(t=t.getParentEditor());const i=Ml.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const iv=class iv extends gt{constructor(){super({id:iv.ID,...Np(ui("action.inlineEdits.hide","Hide Inline Edit")),precondition:W0,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Ml.get(t);Wu(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};iv.ID="editor.action.inlineEdits.hide";let ny=iv;on(Ml.ID,Ml,3);Ae(lV);Ae(ty);Ae(iy);Ae(cV);Ae(ny);const Mu={Visible:new xn("parameterHintsVisible",!1),MultipleSignatures:new xn("parameterHintsMultipleSignatures",!1)};async function bB(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){hs(a)}}Un.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;wn(Rn.isUri(t)),wn(pi.isIPosition(i)),wn(typeof n=="string"||!n);const s=o.get(xi),r=await o.get(ma).createModelReference(t);try{const a=await bB(s.signatureHelpProvider,r.object.textEditorModel,pi.lift(i),{triggerKind:pc.Invoke,isRetrigger:!1,triggerCharacter:n},sn.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var Jl;(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})(Jl||(Jl={}));const nv=class nv extends Pt{constructor(e,t,i=nv.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new nn),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=Jl.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new Qo),this.triggerChars=new nm,this.retriggerChars=new nm,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new Rc(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=Jl.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 Jl.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(dV);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 Jl.Pending(Ws(d=>bB(this.providers,r,a,s,d)),i);try{const d=await this.state.request;return e!==this.triggerId?(d==null||d.dispose(),!1):!d||!d.value.signatures||d.value.signatures.length===0?(d==null||d.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new Jl.Active(d.value),this._lastSignatureHelpResult.value=d,this._onChangedHints.fire(this.state.hints),!0)}catch(d){return e===this.triggerId&&(this.state=Jl.Default),On(d),!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:pc.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:pc.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:pc.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(86).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};nv.DEFAULT_DELAY=120;let sy=nv;function dV(o,e){switch(e.triggerKind){case pc.Invoke:return e;case pc.ContentChange:return o;case pc.TriggerCharacter:default:return e}}var uV=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},_x=function(o,e){return function(t,i){e(t,i,o)}},oy;const zo=li,hV=ds("parameter-hints-next",Ui.chevronDown,S("parameterHintsNextIcon","Icon for show next parameter hint.")),fV=ds("parameter-hints-previous",Ui.chevronUp,S("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var du;let ry=(du=class extends Pt{constructor(e,t,i,n,s,r){super(),this.editor=e,this.model=t,this.telemetryService=r,this.renderDisposeables=this._register(new Bt),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new q0({editor:e},s,n)),this.keyVisible=Mu.Visible.bindTo(i),this.keyMultipleSignatures=Mu.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=zo(".editor-widget.parameter-hints-widget"),t=ti(e,zo(".phwrapper"));t.tabIndex=-1;const i=ti(t,zo(".controls")),n=ti(i,zo(".button"+Dn.asCSSSelector(fV))),s=ti(i,zo(".overloads")),r=ti(i,zo(".button"+Dn.asCSSSelector(hV)));this._register(Cn(n,"click",p=>{im.stop(p),this.previous()})),this._register(Cn(r,"click",p=>{im.stop(p),this.next()}));const a=zo(".body"),d=new N2(a,{alwaysConsumeMouseWheel:!0});this._register(d),t.appendChild(d.getDomNode());const u=ti(a,zo(".signature")),f=ti(a,zo(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:u,overloads:s,docs:f,scrollbar:d},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(p=>{this.visible&&this.editor.layoutContentWidget(this)}));const g=()=>{if(!this.domNodes)return;const p=this.editor.getOption(50),C=this.domNodes.element;C.style.fontSize=`${p.fontSize}px`,C.style.lineHeight=`${p.lineHeight/p.fontSize}`,C.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",p.fontFamily),C.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",uw.fontFamily)};g(),this._register(Ds.chain(this.editor.onDidChangeConfiguration.bind(this.editor),p=>p.filter(C=>C.hasChanged(50)))(g)),this._register(this.editor.onDidLayoutChange(p=>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=ti(this.domNodes.signature,zo(".code")),s=i.parameters.length>0,r=i.activeParameter??e.activeParameter;if(s)this.renderParameters(n,i,r);else{const u=ti(n,zo("span"));u.textContent=i.label}const a=i.parameters[r];if(a!=null&&a.documentation){const u=zo("span.documentation");if(typeof a.documentation=="string")u.textContent=a.documentation;else{const f=this.renderMarkdownDocs(a.documentation);u.appendChild(f.element)}ti(this.domNodes.docs,zo("p",{},u))}if(i.documentation!==void 0)if(typeof i.documentation=="string")ti(this.domNodes.docs,zo("p",{},i.documentation));else{const u=this.renderMarkdownDocs(i.documentation);ti(this.domNodes.docs,u.element)}const d=this.hasDocs(i,a);if(this.domNodes.signature.classList.toggle("has-docs",d),this.domNodes.docs.classList.toggle("empty",!d),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,a){let u="";const f=i.parameters[r];Array.isArray(f.label)?u=i.label.substring(f.label[0],f.label[1]):u=f.label,f.documentation&&(u+=typeof f.documentation=="string"?`, ${f.documentation}`:`, ${f.documentation.value}`),i.documentation&&(u+=typeof i.documentation=="string"?`, ${i.documentation}`:`, ${i.documentation.value}`),this.announcedLabel!==u&&(zr(S("hint","{0}, hint",u)),this.announcedLabel=u)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new Ro,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 d=document.createElement("span");d.textContent=t.label.substring(s),ti(e,r,a,d)}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|^)${pg(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 oy.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)}},oy=du,du.ID="editor.widget.parameterHintsWidget",du);ry=oy=uV([_x(2,En),_x(3,ga),_x(4,xa),_x(5,pa)],ry);ci("editorHoverWidget.highlightForeground",z2,S("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var gV=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},AD=function(o,e){return function(t,i){e(t,i,o)}},ay,uu;let z0=(uu=class extends Pt{static get(e){return e.getContribution(ay.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new sy(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 nw(()=>this._register(t.createInstance(ry,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)}},ay=uu,uu.ID="editor.controller.parameterHints",uu);z0=ay=gV([AD(1,Qi),AD(2,xi)],z0);class pV extends gt{constructor(){super({id:"editor.action.triggerParameterHints",label:S("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:U.hasSignatureHelpProvider,kbOpts:{kbExpr:U.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=z0.get(t);i==null||i.trigger({triggerKind:pc.Invoke})}}on(z0.ID,z0,2);Ae(pV);const w9=175,S9=wo.bindToContribution(z0.get);yi(new S9({id:"closeParameterHints",precondition:Mu.Visible,handler:o=>o.cancel(),kbOpts:{weight:w9,kbExpr:U.focus,primary:9,secondary:[1033]}}));yi(new S9({id:"showPrevParameterHint",precondition:$e.and(Mu.Visible,Mu.MultipleSignatures),handler:o=>o.previous(),kbOpts:{weight:w9,kbExpr:U.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));yi(new S9({id:"showNextParameterHint",precondition:$e.and(Mu.Visible,Mu.MultipleSignatures),handler:o=>o.next(),kbOpts:{weight:w9,kbExpr:U.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var xV=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},mV=function(o,e){return function(t,i){e(t,i,o)}};class _V{constructor(e){this.instantiationService=e}init(...e){}}function vV(o,e){return class extends e{constructor(){super(...arguments),this._autorun=void 0}init(...i){this._autorun=pp((n,s)=>{const r=NC(o(),n);s.add(this.instantiationService.createInstance(r,...i))})}dispose(){var i;(i=this._autorun)==null||i.dispose()}}}function bV(o){return D4()?vV(o,ly):o()}let ly=class extends _V{constructor(e,t){super(t),this.init(e)}};ly=xV([mV(1,Qi)],ly);on(jg.ID,bV(()=>jg),0);ci("editor.placeholder.foreground",A4,S("placeholderForeground","Foreground color of the placeholder text in the editor."));var CV=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},vx=function(o,e){return function(t,i){e(t,i,o)}};const ef=new xn("renameInputVisible",!1,S("renameInputVisible","Whether the rename input widget is visible"));new xn("renameInputFocused",!1,S("renameInputFocused","Whether the rename input widget is focused"));let cy=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 Bt,this._visibleContextKey=ef.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new Ro,this._inputWithButton=new EV,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 D9(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(k4),i=e.getColor(B4);this._domNode.style.backgroundColor=String(e.getColor(O2)??""),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(F4)??"");const n=e.getColor(L4);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(HS)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(HS)??""),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;wn(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=xp(this.getDomNode().ownerDocument.body),t=bo(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}=$g.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=S({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;wn(this._renameCandidateListView),wn(this._nPxAvailableAbove!==void 0),wn(this._nPxAvailableBelow!==void 0);const t=Dh(this._inputWithButton.domNode),i=Dh(this._label);let n;e===2?n=this._nPxAvailableBelow:n=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:n-i-t,width:Ar(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 d=new Bt;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),d.add(Cn(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),d.add(Cn(this._inputWithButton.button,is.KEY_DOWN,f=>{const g=new Aw(f);(g.equals(3)||g.equals(10))&&(g.stopPropagation(),g.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",i),this._position=new pi(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(),d.add(Zn(()=>{this._renameCts=void 0,s.dispose(!0)})),d.add(Zn(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),d.add(Zn(()=>this._candidates.clear()));const u=new mv;return u.p.finally(()=>{d.dispose(),this._hide()}),this._currentCancelInput=f=>{var g;return this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,(g=this._renameCandidateListView)==null||g.clearCandidates(),u.complete(f),!0},this._currentAcceptInput=f=>{this._trace("invoking _currentAcceptInput"),wn(this._renameCandidateListView!==void 0);const g=this._renameCandidateListView.nCandidates;let p,C;const b=this._renameCandidateListView.focusedCandidate;if(b!==void 0?(this._trace("using new name from renameSuggestion"),p=b,C={k:"renameSuggestion"}):(this._trace("using new name from inputField"),p=this._inputWithButton.input.value,C=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),p===t||p.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(),u.complete({newName:p,wantsPreview:i&&f,stats:{source:C,nRenameSuggestions:g,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},d.add(s.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),d.add(this._editor.onDidBlurEditorWidget(()=>{var f;return this.cancelInput(!((f=this._domNode)!=null&&f.ownerDocument.hasFocus()),"editor.onDidBlurEditorWidget")})),this._show(),u.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),wn(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new zs;const i=t?OC.Invoke:OC.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){wn(this._editor.hasModel());const i=this._editor.getSelection();let n=0,s=t.length;return!ee.isEmpty(i)&&!ee.spansMultipleLines(i)&&ee.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=(...u)=>this._trace("_updateRenameCandidates",...u);n("start");const s=await cp(Promise.allSettled(e),i);if(this._inputWithButton.setSparkleButton(),s===void 0){n("returning early - received updateRenameCandidates results - undefined");return}const r=s.flatMap(u=>u.status==="fulfilled"&&kx(u.value)?u.value:[]);n(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=jA(r,u=>u.newSymbolName);n(`distinct candidates - ${a.length} candidates.`);const d=a.filter(({newSymbolName:u})=>u.trim().length>0&&u!==this._inputWithButton.input.value&&u!==t&&!this._candidates.has(u));if(n(`valid distinct candidates - ${r.length} candidates.`),d.forEach(u=>this._candidates.add(u.newSymbolName)),d.length<1){n("returning early - no valid distinct candidates");return}n("setting candidates"),this._renameCandidateListView.setCandidates(d),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)}};cy=CV([vx(2,$r),vx(3,ms),vx(4,En),vx(5,zu)],cy);class D9{constructor(e,t){this._disposables=new Bt,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=D9._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(V2({listInactiveFocusForeground:H2,listInactiveFocusBackground:W2}))}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`,p0(S("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}=$g.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 $g(r,i)}renderElement(r,a,d){d.populate(r)}disposeTemplate(r){r.dispose()}};return new aw("NewSymbolNameCandidates",e,n,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class EV{constructor(){this._onDidInputChange=new nn,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new Bt}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",S("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=S("generateRenameSuggestionsButton","Generate new name suggestions"),this._buttonCancelHoverText=S("cancelRenameSuggestionsButton","Cancel"),this._buttonHover=I4().setupManagedHover(Av("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(Cn(this.input,is.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(Cn(this.input,is.KEY_DOWN,e=>{const t=new Aw(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(Cn(this.input,is.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(Cn(this.input,is.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(Cn(this.input,is.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return wn(this._inputNode),this._inputNode}get button(){return wn(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){var e;this._buttonState="sparkle",this._sparkleIcon??(this._sparkleIcon=HC(Ui.sparkle)),Ga(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=HC(Ui.primitiveSquare)),Ga(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 ug=class ug{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=`${ug._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=HC(Ui.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),B2(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(P4.AIGenerated));this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+ug._PADDING*2}}dispose(){}};ug._PADDING=2;let $g=ug;var yV=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},Xl=function(o,e){return function(t,i){e(t,i,o)}},dy;class A9{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 ee(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join(`
76
+ `):void 0}:{range:ee.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(S("no result","No result.")),n);return r}}async function wV(o,e,t,i){const n=new A9(e,t,o),s=await n.resolveRenameLocation(sn.None);return s!=null&&s.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,sn.None)}var hu;let Vc=(hu=class{static get(e){return e.getContribution(dy.ID)}constructor(e,t,i,n,s,r,a,d,u){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=s,this._logService=r,this._configService=a,this._languageFeaturesService=d,this._telemetryService=u,this._disposableStore=new Bt,this._cts=new zs,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(cy,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var b,E;const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new zs,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new A9(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const n=new f0(this.editor,5,void 0,this._cts.token);let s;try{e("resolving rename location");const y=i.resolveRenameLocation(n.token);this._progressService.showWhile(y,250),s=await y,e("resolved rename location")}catch(y){y instanceof _v?e("resolve rename location cancelled",JSON.stringify(y,null," ")):(e("resolve rename location failed",y instanceof Error?y:JSON.stringify(y,null," ")),(typeof y=="string"||Dx(y))&&((b=Po.get(this.editor))==null||b.showMessage(y||S("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),(E=Po.get(this.editor))==null||E.showMessage(s.rejectReason,t);return}if(n.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const r=new f0(this.editor,5,s.range,this._cts.token),a=this.editor.getModel(),d=this._languageFeaturesService.newSymbolNamesProvider.all(a),u=await Promise.all(d.map(async y=>[y,await y.supportsAutomaticNewSymbolNamesTriggerKind??!1])),f=(y,D)=>{let I=u.slice();return y===OC.Automatic&&(I=I.filter(([M,R])=>R)),I.map(([M])=>M.provideNewSymbolNames(a,s.range,y,D))};e("creating rename input field and awaiting its result");const g=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),p=await this._renameWidget.getInput(s.range,s.text,g,d.length>0?f:void 0,r);if(e("received response from rename input field"),d.length>0&&this._reportTelemetry(d.length,a.getLanguageId(),p),typeof p=="boolean"){e(`returning early - rename input field response - ${p}`),p&&this.editor.focus(),r.dispose();return}this.editor.focus(),e("requesting rename edits");const C=cp(i.provideRenameEdits(p.newName,r.token),r.token).then(async y=>{if(!y){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(y.rejectReason){e(`returning early - rejected with reason: ${y.rejectReason}`),this._notificationService.info(y.rejectReason);return}this.editor.setSelection(ee.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(y,{editor:this.editor,showPreview:p.wantsPreview,label:S("label","Renaming '{0}' to '{1}'",s==null?void 0:s.text,p.newName),code:"undoredo.rename",quotableLabel:S("quotableLabel","Renaming {0} to {1}",s==null?void 0:s.text,p.newName),respectAutoSaveConfig:!0}).then(D=>{e("edits applied"),D.ariaSummary&&zr(S("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,p.newName,D.ariaSummary))}).catch(D=>{e(`error when applying edits ${JSON.stringify(D,null," ")}`),this._notificationService.error(S("rename.failedApply","Rename failed to apply edits")),this._logService.error(D)})},y=>{e("error when providing rename edits",JSON.stringify(y,null," ")),this._notificationService.error(S("rename.failed","Rename failed to compute edits")),this._logService.error(y)}).finally(()=>{r.dispose()});return e("returning rename operation"),this._progressService.showWhile(C,250),C}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)}},dy=hu,hu.ID="editor.contrib.renameController",hu);Vc=dy=yV([Xl(1,Qi),Xl(2,go),Xl(3,pv),Xl(4,up),Xl(5,zu),Xl(6,T4),Xl(7,xi),Xl(8,pa)],Vc);class SV extends gt{constructor(){super({id:"editor.action.rename",label:S("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:$e.and(U.writable,U.hasRenameProvider),kbOpts:{kbExpr:U.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(fs),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return Rn.isUri(n)&&pi.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(zu),n=Vc.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}on(Vc.ID,Vc,4);Ae(SV);const k9=wo.bindToContribution(Vc.get);yi(new k9({id:"acceptRenameInput",precondition:ef,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:$e.and(U.focus,$e.not("isComposing")),primary:3}}));yi(new k9({id:"acceptRenameInputWithPreview",precondition:$e.and(ef,$e.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:$e.and(U.focus,$e.not("isComposing")),primary:2051}}));yi(new k9({id:"cancelRenameInput",precondition:ef,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:U.focus,primary:9,secondary:[1033]}}));Tn(class extends yo{constructor(){super({id:"focusNextRenameSuggestion",title:{...ui("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:ef,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(fs).getFocusedCodeEditor();if(!t)return;const i=Vc.get(t);i&&i.focusNextRenameSuggestion()}});Tn(class extends yo{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...ui("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:ef,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(fs).getFocusedCodeEditor();if(!t)return;const i=Vc.get(t);i&&i.focusPreviousRenameSuggestion()}});So("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;wn(typeof n=="string");const{renameProvider:s}=o.get(xi);return wV(s,e,t,n)});So("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(xi),s=await new A9(e,t,i).resolveRenameLocation(sn.None);if(s!=null&&s.rejectReason)throw new Error(s.rejectReason);return s});fa.as(hp.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:S("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var DV=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},kD=function(o,e){return function(t,i){e(t,i,o)}},l0;let r_=(l0=class extends Pt{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 As(()=>{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),d=a.findTokenIndexAtOffset(r.startColumn-1),u=a.getStandardTokenType(d);return a.getLanguageId(d)===t.getLanguageId()&&u===1}));const i=Object.values(this.currentOccurrences).map(s=>s.decorationId),n=e.map(s=>AV(s));this.editor.changeDecorations(s=>{const r=s.deltaDecorations(i,n);this.currentOccurrences={};for(let a=0,d=r.length;a<d;a++){const u={sectionHeader:e[a],decorationId:r[a]};this.currentOccurrences[u.decorationId]=u}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}},l0.ID="editor.sectionHeaderDetector",l0);r_=DV([kD(1,Ns),kD(2,zl)],r_);function AV(o){return{range:o.range,options:fn.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:o.hasSeparatorLine?2:1,sectionHeaderText:o.text}})}}on(r_.ID,r_,1);function kV(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 BV(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return M4()||kV(e),R4.wrap(e)}function CB(o){const e=new Uint32Array(FV(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 BV(e)}function FV(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 sb(o){return o&&!!o.data}function EB(o){return o&&Array.isArray(o.edits)}class LV{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function yB(o,e){return o.has(e)}function IV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function wB(o,e,t,i,n){const s=IV(o,e),r=await Promise.all(s.map(async a=>{let d,u=null;try{d=await a.provideDocumentSemanticTokens(e,a===t?i:null,n)}catch(f){u=f,d=null}return(!d||!sb(d)&&!EB(d))&&(d=null),new LV(a,d,u)}));for(const a of r){if(a.error)throw a.error;if(a.tokens)return a}return r.length>0?r[0]:null}function PV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class TV{constructor(e,t){this.provider=e,this.tokens=t}}function MV(o,e){return o.has(e)}function SB(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function B9(o,e,t,i){const n=SB(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(d){hs(d),a=null}return(!a||!sb(a))&&(a=null),new TV(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}Un.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;wn(t instanceof Rn);const i=o.get(po).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(xi),s=PV(n,i);return s?s[0].getLegend():o.get(Rs).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});Un.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;wn(t instanceof Rn);const i=o.get(po).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(xi);if(!yB(n,i))return o.get(Rs).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await wB(n,i,null,null,sn.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!sb(a))return;const d=CB({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),d});Un.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;wn(t instanceof Rn);const n=o.get(po).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(xi),r=SB(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!ee.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 B9(s,n,ee.lift(i),sn.None);if(a)return a.provider.getLegend()});Un.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;wn(t instanceof Rn),wn(ee.isIRange(i));const n=o.get(po).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(xi),r=await B9(s,n,ee.lift(i),sn.None);if(!(!r||!r.tokens))return CB({id:0,type:"full",data:r.tokens.data})});const F9="editor.semanticHighlighting";function Gx(o,e,t){var n;const i=(n=t.getValue(F9,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))==null?void 0:n.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var DB=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},Oa=function(o,e){return function(t,i){e(t,i,o)}},Ql;let uy=class extends Pt{constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=f=>{this._watchers[f.uri.toString()]=new hy(f,e,i,s,r)},d=(f,g)=>{g.dispose(),delete this._watchers[f.uri.toString()]},u=()=>{for(const f of t.getModels()){const g=this._watchers[f.uri.toString()];Gx(f,i,n)?g||a(f):g&&d(f,g)}};t.getModels().forEach(f=>{Gx(f,i,n)&&a(f)}),this._register(t.onModelAdded(f=>{Gx(f,i,n)&&a(f)})),this._register(t.onModelRemoved(f=>{const g=this._watchers[f.uri.toString()];g&&d(f,g)})),this._register(n.onDidChangeConfiguration(f=>{f.affectsConfiguration(F9)&&u()})),this._register(i.onDidColorThemeChange(u))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};uy=DB([Oa(0,kw),Oa(1,po),Oa(2,$r),Oa(3,Yn),Oa(4,fr),Oa(5,xi)],uy);var Pc;let hy=(Pc=class extends Pt{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:Ql.REQUEST_MIN_DELAY,max:Ql.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new As(()=>this._fetchDocumentSemanticTokensNow(),Ql.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=()=>{ao(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),ao(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!yB(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new zs,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=wB(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],r=this._model.onDidChangeContent(d=>{s.push(d)}),a=new Ro(!1);n.then(d=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),!d)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:u,tokens:f}=d,g=this._semanticTokensStylingService.getStyling(u);this._setDocumentSemanticTokens(u,f||null,g,s)}},d=>{d&&($c(d)||typeof d.message=="string"&&d.message.indexOf("busy")!==-1)||On(d),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(EB(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 p of t.edits)a+=(p.data?p.data.length:0)-p.deleteCount;const d=s.data,u=new Uint32Array(d.length+a);let f=d.length,g=u.length;for(let p=t.edits.length-1;p>=0;p--){const C=t.edits[p];if(C.start>d.length){i.warnInvalidEditStart(s.resultId,t.resultId,p,C.start,d.length),this._model.tokenization.setSemanticTokens(null,!0);return}const b=f-(C.start+C.deleteCount);b>0&&(Ql._copy(d,f-b,u,g-b,b),g-=b),C.data&&(Ql._copy(C.data,0,u,g-C.data.length,C.data.length),g-=C.data.length),f=C.start}f>0&&Ql._copy(d,0,u,0,f),t={resultId:t.resultId,data:u}}}if(sb(t)){this._currentDocumentResponse=new RV(e,t.resultId,t.data);const a=nk(t,i,this._model.getLanguageId());if(n.length>0)for(const d of n)for(const u of a)for(const f of d.changes)u.applyEdit(f.range,f.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}},Ql=Pc,Pc.REQUEST_MIN_DELAY=300,Pc.REQUEST_MAX_DELAY=2e3,Pc);hy=Ql=DB([Oa(1,kw),Oa(2,$r),Oa(3,fr),Oa(4,xi)],hy);class RV{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}U0(uy);var NV=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},wf=function(o,e){return function(t,i){e(t,i,o)}},c0;let a_=(c0=class extends Pt{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 As(()=>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(d=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(d=>{d.affectsConfiguration(F9)&&(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(!Gx(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!MV(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=Ws(r=>Promise.resolve(B9(this._provider,e,t,r))),s=new Ro(!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:d}=r,u=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,nk(d,u,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}},c0.ID="editor.contrib.viewportSemanticTokens",c0);a_=NV([wf(1,kw),wf(2,$r),wf(3,Yn),wf(4,fr),wf(5,xi)],a_);on(a_.ID,a_,1);class OV{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 d=a,u=a,f=0;for(;d>=0;d--){const g=s.charCodeAt(d);if(d!==a&&(g===95||g===45))break;if(WS(g)&&zS(f))break;f=g}for(d+=1;u<s.length;u++){const g=s.charCodeAt(u);if(zS(g)&&WS(f))break;if(g===95||g===45)break;f=g}d<u&&e.push({range:new ee(i.lineNumber,r+d,i.lineNumber,r+u)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new ee(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 ee(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var HV=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},WV=function(o,e){return function(t,i){e(t,i,o)}},fy;class L9{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 L9(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}var fu;let Ug=(fu=class{static get(e){return e.getContribution(fy.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 kB(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),sn.None).then(s=>{var r;if(!(!Zo(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!Xa(this._editor.getSelections(),t,(a,d)=>a.equalsSelection(d)))){for(let a=0;a<s.length;a++)s[a]=s[a].filter(d=>d.containsPosition(t[a].getStartPosition())&&d.containsPosition(t[a].getEndPosition())),s[a].unshift(t[a]);this._state=s.map(a=>new L9(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=>Hi.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}},fy=fu,fu.ID="editor.contrib.smartSelectController",fu);Ug=fy=HV([WV(1,xi)],Ug);class AB extends gt{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=Ug.get(t);i&&await i.run(this._forward)}}class zV extends AB{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:S("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"1_basic",title:S({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}Un.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class VV extends AB{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:S("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:Yt.MenubarSelectionMenu,group:"1_basic",title:S({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}on(Ug.ID,Ug,4);Ae(zV);Ae(VV);async function kB(o,e,t,i,n){const s=o.all(e).concat(new OV(i.selectSubwords));s.length===1&&s.unshift(new Um);const r=[],a=[];for(const d of s)r.push(Promise.resolve(d.provideSelectionRanges(e,t,n)).then(u=>{if(Zo(u)&&u.length===t.length)for(let f=0;f<t.length;f++){a[f]||(a[f]=[]);for(const g of u[f])ee.isIRange(g.range)&&ee.containsPosition(g.range,t[f])&&a[f].push(ee.lift(g.range))}},hs));return await Promise.all(r),a.map(d=>{if(d.length===0)return[];d.sort((p,C)=>pi.isBefore(p.getStartPosition(),C.getStartPosition())?1:pi.isBefore(C.getStartPosition(),p.getStartPosition())||pi.isBefore(p.getEndPosition(),C.getEndPosition())?-1:pi.isBefore(C.getEndPosition(),p.getEndPosition())?1:0);const u=[];let f;for(const p of d)(!f||ee.containsRange(p,f)&&!ee.equalsRange(p,f))&&(u.push(p),f=p);if(!i.selectLeadingAndTrailingWhitespace)return u;const g=[u[0]];for(let p=1;p<u.length;p++){const C=u[p-1],b=u[p];if(b.startLineNumber!==C.startLineNumber||b.endLineNumber!==C.endLineNumber){const E=new ee(C.startLineNumber,e.getLineFirstNonWhitespaceColumn(C.startLineNumber),C.endLineNumber,e.getLineLastNonWhitespaceColumn(C.endLineNumber));E.containsRange(C)&&!E.equalsRange(C)&&b.containsRange(E)&&!b.equalsRange(E)&&g.push(E);const y=new ee(C.startLineNumber,1,C.endLineNumber,e.getLineMaxColumn(C.endLineNumber));y.containsRange(C)&&!y.equalsRange(E)&&b.containsRange(y)&&!b.equalsRange(y)&&g.push(y)}g.push(b)}return g})}Un.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;wn(Rn.isUri(t));const n=o.get(xi).selectionRangeProvider,s=await o.get(ma).createModelReference(t);try{return kB(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},sn.None)}finally{s.dispose()}});const jV=Object.freeze({View:ui("view","View"),Help:ui("help","Help"),Test:ui("test","Test"),File:ui("file","File"),Preferences:ui("preferences","Preferences"),Developer:ui({key:"developer",comment:["A developer on Code itself or someone diagnosing issues in Code"]},"Developer")});class sg{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&&Xa(this.startLineNumbers,e.startLineNumbers)&&Xa(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new sg([],[],0)}}const BD=S2("stickyScrollViewLayer",{createHTML:o=>o}),hC="data-sticky-line-index",FD="data-sticky-is-line",$V="data-sticky-is-line-number",LD="data-sticky-is-folding-icon";class UV extends Pt{constructor(e){super(),this._editor=e,this._foldingIconStore=new Bt,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 jr),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,d]of s.entries()){const u=this._renderChildNode(a+i,d,t,n);u&&(this._linesDomNode.appendChild(u.lineDomNode),this._lineNumbersDomNode.appendChild(u.lineNumberDomNode),this._renderedStickyLines.push(u))}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(Cn(this._lineNumbersDomNode,is.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Cn(this._lineNumbersDomNode,is.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 pi(t,1)).lineNumber,a=s.getViewLineRenderingData(r),d=this._editor.getOption(68);let u;try{u=Eg.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{u=[]}const f=new k2(!0,!0,a.content,a.continuesWithWrappedLine,a.isBasicASCII,a.containsRTL,0,a.tokens,u,a.tabSize,a.startVisibleColumn,1,1,1,500,"none",!0,!0,null),g=new D2(2e3),p=A2(f,g);let C;BD?C=BD.createHTML(g.build()):C=g.build();const b=document.createElement("span");b.setAttribute(hC,String(e)),b.setAttribute(FD,""),b.setAttribute("role","listitem"),b.tabIndex=0,b.className="sticky-line-content",b.classList.add(`stickyLine${t}`),b.style.lineHeight=`${this._lineHeight}px`,b.innerHTML=C;const E=document.createElement("span");E.setAttribute(hC,String(e)),E.setAttribute($V,""),E.className="sticky-line-number",E.style.lineHeight=`${this._lineHeight}px`;const y=n.contentLeft;E.style.width=`${y}px`;const D=document.createElement("span");d.renderType===1||d.renderType===3&&t%10===0?D.innerText=t.toString():d.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`,E.appendChild(D);const I=this._renderFoldingIconForLine(i,t);I&&E.appendChild(I.domNode),this._editor.applyFontInfo(b),this._editor.applyFontInfo(D),E.style.lineHeight=`${this._lineHeight}px`,b.style.lineHeight=`${this._lineHeight}px`,E.style.height=`${this._lineHeight}px`,b.style.height=`${this._lineHeight}px`;const M=new qV(e,t,b,E,I,p.characterMapping,b.scrollWidth);return this._updateTopAndZIndexOfStickyLine(M)}_updateTopAndZIndexOfStickyLine(e){var f;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 d=`${t*this._lineHeight+this._lastLineRelativePosition+((f=e.foldingIcon)!=null&&f.isCollapsed?1:0)}px`,u=`${t*this._lineHeight}px`;return i.style.top=s?d:u,n.style.top=s?d:u,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 d=n.isCollapsed(s),u=new GV(d,r,n.getEndLineNumber(s),this._lineHeight);return u.setVisible(this._isOnGlyphMargin?!0:d||i==="always"),u.domNode.setAttribute(LD,""),u}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=N4(t.characterMapping,e,0);return new pi(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,hC);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,FD)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,LD)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class qV{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 GV{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=Dn.asClassName(e?Tm:Pm)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class og{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class l_{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class BB{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var ob=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},qg=function(o,e){return function(t,i){e(t,i,o)}},rg;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(rg||(rg={}));var fc;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(fc||(fc={}));let gy=class extends Pt{constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new Rc(300)),this._updateOperation=this._register(new Bt),this._editor.getOption(116).defaultModel){case rg.OUTLINE_MODEL:this._modelProviders.push(new py(this._editor,n));case rg.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new my(this._editor,t,n));case rg.INDENTATION_MODEL:this._modelProviders.push(new xy(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 fc.CANCELED:return this._updateOperation.clear(),null;case fc.VALID:return t.stickyModel}}return null}).catch(t=>(On(t),null))}};gy=ob([qg(2,Qi),qg(3,xi)],gy);class FB extends Pt{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,fc.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=Ws(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?fc.CANCELED:(this._stickyModel=this.createStickyModel(e,i),fc.VALID):this._invalid()).then(void 0,i=>(On(i),fc.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let py=class extends FB{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return ul.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 BB(s.uri,s.getVersionId(),i,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(Cl.first(e.children.values())instanceof Y5){const a=Cl.find(e.children.values(),d=>d.id===t);if(a)i=a.children;else{let d="",u=-1,f;for(const[g,p]of e.children.entries()){const C=this._findSumOfRangesOfGroup(p);C>u&&(f=p,u=C,d=p.id)}t=d,i=f.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((a,d)=>{const u=new og(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),f=new og(d.symbol.range.startLineNumber,d.symbol.range.endLineNumber);return this._comparator(u,f)});for(const a of s)n.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new l_(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 og(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new l_(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 sE?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};py=ob([qg(1,xi)],py);class LB extends FB{constructor(e){super(e),this._foldingLimitReporter=new K5(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new BB(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new l_(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 d=new l_(new og(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(d),i.push(d)}return n}}let xy=class extends LB{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new x9(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};xy=ob([qg(1,Ns)],xy);let my=class extends LB{constructor(e,t,i){super(e),this._languageFeaturesService=i;const n=zc.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());n.length>0&&(this.provider=this._register(new m9(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}};my=ob([qg(2,xi)],my);var KV=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},ID=function(o,e){return function(t,i){e(t,i,o)}};class ZV{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let _y=class extends Pt{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new nn),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new Bt),this._updateSoon=this._register(new As(()=>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(Zn(()=>{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 gy(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){var e;(e=this._cts)==null||e.dispose(!0),this._cts=new zs,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 f=0;f<t.children.length;f++){const g=t.children[f];g.range&&a.push(g.range.startLineNumber)}const d=this.updateIndex(rm(a,e.startLineNumber,(f,g)=>f-g)),u=this.updateIndex(rm(a,e.startLineNumber+n,(f,g)=>f-g));for(let f=d;f<=u;f++){const g=t.children[f];if(!g)return;if(g.range){const p=g.range.startLineNumber,C=g.range.endLineNumber;e.startLineNumber<=C+1&&p-1<=e.endLineNumber&&p!==r&&(r=p,i.push(new ZV(p,C-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,g,i,n+1,p))}else this.getCandidateStickyLinesIntersectingFromStickyModel(e,g,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}};_y=KV([ID(1,xi),ID(2,Ns)],_y);var XV=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},fh=function(o,e){return function(t,i){e(t,i,o)}},vy,gu;let Rl=(gu=class extends Pt{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 Bt,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 UV(this._editor),this._stickyLineCandidateProvider=new _y(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=sg.Empty,this._onDidResize(),this._readConfiguration();const d=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(f=>{this._readConfigurationChange(f)})),this._register(Cn(d,is.CONTEXT_MENU,async f=>{this._onContextMenu(Ed(d),f)})),this._stickyScrollFocusedContextKey=U.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=U.stickyScrollVisible.bindTo(this._contextKeyService);const u=this._register(g0(d));this._register(u.onDidBlur(f=>{this._positionRevealed===!1&&d.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(u.onDidFocus(f=>{this.focus()})),this._registerMouseListeners(),this._register(Cn(d,is.MOUSE_DOWN,f=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(vy.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 Bt,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(ee.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new Bt),t=this._register(new Kv(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 ee(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(Bl(n,is.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const u=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(u===null)return;const f=new pi(this._endLineNumbers[u],1);this._revealLineInCenterIfOutsideViewport(f);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const u=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(u);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let d=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!d){const u=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(u===null)return;d=new pi(u,1)}this._revealPosition(d)})),this._register(Bl(n,is.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(Cn(n,is.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:d,textElement:u}=a;if(!d.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=d,e.clear();else if(u.style.textDecoration==="underline")return;const f=new zs;e.add(Zn(()=>f.dispose(!0)));let g;Pp(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new pi(d.startLineNumber,d.startColumn+1),!1,f.token).then((p=>{if(!f.token.isCancellationRequested)if(p.length!==0){this._candidateDefinitionsLength=p.length;const C=u;g!==C?(e.clear(),g=C,g.style.textDecoration="underline",e.add(Zn(()=>{g.style.textDecoration="none"}))):g||(g=C,g.style.textDecoration="underline",e.add(Zn(()=>{g.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(L5,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new O4(e,t);this._contextMenuService.showContextMenu({menuId:Yt.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;f9(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=zc.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=sg.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 d=new og(a[0].startLineNumber,a[a.length-1].endLineNumber),u=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(d);for(const f of u){const g=f.startLineNumber,p=f.endLineNumber,C=f.nestingDepth;if(p-g>0){const b=(C-1)*e,E=C*e,y=this._editor.getBottomForLineNumber(g)-i,D=this._editor.getTopForLineNumber(p)-i,I=this._editor.getBottomForLineNumber(p)-i;if(b>D&&b<=I){s.push(g),r.push(p+1),n=I-E;break}else E>y&&E<=I&&(s.push(g),r.push(p+1));if(s.length===t)break}}}return this._endLineNumbers=r,new sg(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}},vy=gu,gu.ID="store.contrib.stickyScrollController",gu);Rl=vy=XV([fh(1,V0),fh(2,xi),fh(3,Qi),fh(4,Ns),fh(5,fr),fh(6,En)],Rl);class YV extends yo{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...ui("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:S({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:ui("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:jV.View,toggled:{condition:$e.equals("config.editor.stickyScroll.enabled",!0),title:S("stickyScroll","Sticky Scroll"),mnemonicTitle:S({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:Yt.CommandPalette},{id:Yt.MenubarAppearanceMenu,group:"4_editor",order:3},{id:Yt.StickyScrollContext}]})}async run(e){const t=e.get(Yn),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const rb=100;class QV extends ha{constructor(){super({id:"editor.action.focusStickyScroll",title:{...ui("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:S({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:$e.and($e.has("config.editor.stickyScroll.enabled"),U.stickyScrollVisible),menu:[{id:Yt.CommandPalette}]})}runEditorCommand(e,t){var i;(i=Rl.get(t))==null||i.focus()}}class JV extends ha{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:ui("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:U.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:rb,primary:18}})}runEditorCommand(e,t){var i;(i=Rl.get(t))==null||i.focusNext()}}class ej extends ha{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:ui("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:U.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:rb,primary:16}})}runEditorCommand(e,t){var i;(i=Rl.get(t))==null||i.focusPrevious()}}class tj extends ha{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:ui("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:U.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:rb,primary:3}})}runEditorCommand(e,t){var i;(i=Rl.get(t))==null||i.goToFocused()}}class ij extends ha{constructor(){super({id:"editor.action.selectEditor",title:ui("selectEditor.title","Select Editor"),precondition:U.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:rb,primary:9}})}runEditorCommand(e,t){var i;(i=Rl.get(t))==null||i.selectEditor()}}on(Rl.ID,Rl,1);Tn(YV);Tn(QV);Tn(ej);Tn(JV);Tn(tj);Tn(ij);var IB=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},Wf=function(o,e){return function(t,i){e(t,i,o)}};class nj{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 by=class extends H4{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=Cl.slice(t,i),s=Cl.slice(t,0,i);let r=5;for(const a of Cl.concat(n,s)){if(a.score===vg.Default)continue;const d=new ee(a.editStart.lineNumber,a.editStart.column,a.editInsertEnd.lineNumber,a.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),u=a.completion.insertTextRules&&a.completion.insertTextRules&4?{snippet:a.completion.insertText}:a.completion.insertText;e.push(new nj(d,u,a.filterTextLow??a.labelLow,a.completion.additionalTextEdits,a.completion.command,a)),r-->=0&&a.resolve(sn.None)}return e}};by=IB([Wf(5,tb)],by);let Cy=class extends Pt{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 C;if(i.selectedSuggestionInfo)return;let s;for(const b of this._editorService.listCodeEditors())if(b.getModel()===e){s=b;break}if(!s)return;const r=s.getOption(90);if(Th.isAllOff(r))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),d=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(Th.valueFor(r,d)!=="inline")return;let u=e.getWordAtPosition(t),f;if(u!=null&&u.word||(f=this._getTriggerCharacterInfo(e,t)),!(u!=null&&u.word)&&!f||(u||(u=e.getWordUntilPosition(t)),u.endColumn!==t.column))return;let g;const p=e.getValueInRange(new ee(t.lineNumber,1,t.lineNumber,t.column));if(!f&&((C=this._lastResult)!=null&&C.canBeReused(e,t.lineNumber,u))){const b=new mD(p,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=b,this._lastResult.acquire(),g=this._lastResult}else{const b=await _9(this._languageFeatureService.completionProvider,e,t,new Ng(void 0,Gm.createSuggestFilter(s).itemKind,f==null?void 0:f.providers),f&&{triggerKind:1,triggerCharacter:f.ch},n);let E;b.needsClipboard&&(E=await this._clipboardService.readText());const y=new nc(b.items,t.column,new mD(p,0),qm.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},E);g=new by(e,t.lineNumber,u,y,b,this._suggestMemoryService)}return this._lastResult=g,g}handleItemDidShow(e,t){t.completion.resolve(sn.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var s;const i=e.getValueInRange(ee.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}}};Cy=IB([Wf(0,xi),Wf(1,j0),Wf(2,tb),Wf(3,fs)],Cy);U0(Cy);class sj extends gt{constructor(){super({id:"editor.action.forceRetokenize",label:S("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 Ro;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}Ae(sj);const sv=class sv extends yo{constructor(){super({id:sv.ID,title:ui({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:ui("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=!VS.getTabFocusMode();VS.setTabFocusMode(t),t?zr(S("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element")):zr(S("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}};sv.ID="editor.action.toggleTabFocusMode";let Ey=sv;Tn(Ey);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},PD=function(o,e){return function(t,i){e(t,i,o)}};let yy=class extends Pt{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=ti(e,li("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??Av("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const r=this._register(new Lb(this.el,"click")),a=this._register(new Lb(this.el,"keypress")),d=Ds.chain(a.event,g=>g.map(p=>new Aw(p)).filter(p=>p.keyCode===3)),u=this._register(new Lb(this.el,W4.Tap)).event;this._register(qA.addTarget(this.el));const f=Ds.any(r.event,d,u);this._register(f(g=>{this.enabled&&(im.stop(g,!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)}};yy=oj([PD(3,mp),PD(4,ga)],yy);var PB=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 rj=26;let wy=class extends Pt{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(Sy))}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,rj)}};wy=PB([TB(1,Qi)],wy);let Sy=class extends Pt{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(q0,{}),this.element=li("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=li("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){Ga(this.element)}show(e){Ga(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=ti(this.element,li("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(li(`div${Dn.asCSSSelector(e.icon)}`));const n=ti(this.element,li("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=ti(this.element,li("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(yy,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=ti(this.element,li("div.action-container"));this.actionBar=this._register(new fg(s)),this.actionBar.push(this._register(new _0("banner.close","Close Banner",Dn.asClassName(g2),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};Sy=PB([TB(0,Qi)],Sy);var I9=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},Gh=function(o,e){return function(t,i){e(t,i,o)}};const aj=ds("extensions-warning-message",Ui.warning,S("warningIcon","Icon shown with a warning message in the extensions editor."));var d0;let Gg=(d0=class extends Pt{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:S("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new Zg};else if(s.ambiguousCharacterCount>=r)a={message:S("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new Ru};else if(s.invisibleCharacterCount>=r)a={message:S("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new Kg};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:aj,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(wy,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=lj(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"?z4:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new Dy(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new cj(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}},d0.ID="editor.contrib.unicodeHighlighter",d0);Gg=I9([Gh(1,zl),Gh(2,V4),Gh(3,Qi)],Gg);function lj(o,e){return{nonBasicASCII:e.nonBasicASCII===Ib?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===Ib?!o:e.includeComments,includeStrings:e.includeStrings===Ib?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let Dy=class extends Pt{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 As(()=>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:c_.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!sk(t,e))return null;const i=t.getValueInRange(e.range);return{reason:RB(i,this._options),inComment:rk(t,e),inString:ok(t,e)}}};Dy=I9([Gh(3,zl)],Dy);class cj extends Pt{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 As(()=>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=ak.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:c_.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 sk(t,e)?{reason:RB(i,this._options),inComment:rk(t,e),inString:ok(t,e)}:null}}const MB=S("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let Ay=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(Gg.ID);if(!n)return[];const s=[],r=new Set;let a=300;for(const d of t){const u=n.getDecorationInfo(d);if(!u)continue;const g=i.getValueInRange(d.range).codePointAt(0),p=fC(g);let C;switch(u.reason.kind){case 0:{F2(u.reason.confusableWith)?C=S("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",p,fC(u.reason.confusableWith.codePointAt(0))):C=S("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",p,fC(u.reason.confusableWith.codePointAt(0)));break}case 1:C=S("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",p);break;case 2:C=S("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",p);break}if(r.has(C))continue;r.add(C);const b={codePoint:g,reason:u.reason,inComment:u.inComment,inString:u.inString},E=S("unicodeHighlight.adjustSettings","Adjust settings"),y=`command:${d_.ID}?${encodeURIComponent(JSON.stringify(b))}`,D=new oo("",!0).appendMarkdown(C).appendText(" ").appendLink(y,E,MB);s.push(new Rr(this,d.range,[D],!1,a++))}return s}renderHoverParts(e,t){return OM(e,t,this._editor,this._languageService,this._openerService)}};Ay=I9([Gh(1,xa),Gh(2,ga)],Ay);function ky(o){return`U+${o.toString(16).padStart(4,"0")}`}function fC(o){let e=`\`${ky(o)}\``;return lk.isInvisibleCharacter(o)||(e+=` "${`${dj(o)}`}"`),e}function dj(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function RB(o,e){return ak.computeUnicodeHighlightReason(o,e)}const ov=class ov{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=fn.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}};ov.instance=new ov;let c_=ov;class uj extends gt{constructor(){super({id:Ru.ID,label:S("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const n=e==null?void 0:e.get(Yn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ll.includeComments,!1,2)}}class hj extends gt{constructor(){super({id:Ru.ID,label:S("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const n=e==null?void 0:e.get(Yn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ll.includeStrings,!1,2)}}const rv=class rv extends gt{constructor(){super({id:rv.ID,label:S("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(Yn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ll.ambiguousCharacters,!1,2)}};rv.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";let Ru=rv;const av=class av extends gt{constructor(){super({id:av.ID,label:S("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(Yn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ll.invisibleCharacters,!1,2)}};av.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";let Kg=av;const lv=class lv extends gt{constructor(){super({id:lv.ID,label:S("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(Yn);n&&this.runAction(n)}async runAction(e){await e.updateValue(Ll.nonBasicASCII,!1,2)}};lv.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";let Zg=lv;const cv=class cv extends gt{constructor(){super({id:cv.ID,label:S("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,d=String.fromCodePoint(n),u=e.get(Ol),f=e.get(Yn);function g(b){return lk.isInvisibleCharacter(b)?S("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",ky(b)):S("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${ky(b)} "${d}"`)}const p=[];if(s.kind===0)for(const b of s.notAmbiguousInLocales)p.push({label:S("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',b),run:async()=>{gj(f,[b])}});if(p.push({label:g(n),run:()=>fj(f,[n])}),a){const b=new uj;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(r){const b=new hj;p.push({label:b.label,run:async()=>b.runAction(f)})}if(s.kind===0){const b=new Ru;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(s.kind===1){const b=new Kg;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(s.kind===2){const b=new Zg;p.push({label:b.label,run:async()=>b.runAction(f)})}else pj(s);const C=await u.pick(p,{title:MB});C&&await C.run()}};cv.ID="editor.action.unicodeHighlight.showExcludeOptions";let d_=cv;async function fj(o,e){const t=o.getValue(Ll.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(Ll.allowedCharacters,i,2)}async function gj(o,e){var n;const t=(n=o.inspect(Ll.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(Ll.allowedLocales,i,2)}function pj(o){throw new Error(`Unexpected value: ${o}`)}Ae(Ru);Ae(Kg);Ae(Zg);Ae(d_);on(Gg.ID,Gg,1);Uu.register(Ay);var xj=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},TD=function(o,e){return function(t,i){e(t,i,o)}};const NB="ignoreUnusualLineTerminators";function mj(o,e,t){o.setModelProperty(e.uri,NB,t)}function _j(o,e){return o.getModelProperty(e.uri,NB)}var u0;let u_=(u0=class extends Pt{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()||_j(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:S("unusualLineTerminators.title","Unusual Line Terminators"),message:S("unusualLineTerminators.message","Detected unusual line terminators"),detail:S("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`.",Qa(e.uri)),primaryButton:S({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:S("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){mj(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}},u0.ID="editor.contrib.unusualLineTerminatorsDetector",u0);u_=xj([TD(1,Bw),TD(2,fs)],u_);on(u_.ID,u_,1);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)}};class MD{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,jS,!1).map(a=>({range:a.range,kind:lm.Text})):Promise.resolve(n)}provideMultiDocumentHighlights(e,t,i,n){const s=new Mc,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 u=a.findMatches(r.word,!0,!1,!0,jS,!1).map(f=>({range:f.range,kind:lm.Text}));u&&s.set(a.uri,u)}return s}}let By=class extends Pt{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new MD)),this._register(e.multiDocumentHighlightProvider.register("*",new MD))}};By=vj([bj(0,xi)],By);var OB=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},Kx=function(o,e){return function(t,i){e(t,i,o)}},rs,Fy;const P9=new xn("hasWordHighlights",!1);function HB(o,e,t,i){const n=o.ordered(e);return yw(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,hs)),s=>s!=null).then(s=>{if(s){const r=new Mc;return r.set(e.uri,s),r}return new Mc})}function Cj(o,e,t,i,n,s){const r=o.ordered(e);return yw(r.map(a=>()=>{const d=s.filter(u=>$4(u)).filter(u=>U4(a.selector,u.uri,u.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,d,n)).then(void 0,hs)}),a=>a!=null)}class WB{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=Ws(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new ee(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 d=!!(this._wordRange&&this._wordRange.equalsRange(a));for(let u=0,f=i.length;!d&&u<f;u++){const g=i.getRange(u);g&&g.startLineNumber===n&&g.startColumn<=s&&g.endColumn>=r&&(d=!0)}return d}cancel(){this.result.cancel()}}class Ej extends WB{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return HB(this._providers,e,t.getPosition(),n).then(s=>s||new Mc)}}class yj extends WB{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return Cj(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new Mc)}}function wj(o,e,t,i,n){return new Ej(e,t,n,o)}function Sj(o,e,t,i,n,s){return new yj(e,t,n,o,s)}So("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(xi),n=await HB(i.documentHighlightProvider,e,t,sn.None);return n==null?void 0:n.get(e.uri)});var Tc;let Ly=(Tc=class{constructor(e,t,i,n,s){this.toUnhook=new Bt,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new Mc,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new Rc(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=P9.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=>{j4(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():rs.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(r=>{var d,u;const a=this.editor.getOption(81);if(this.occurrencesHighlight!==a)switch(this.occurrencesHighlight=a,a){case"off":this._stopAll();break;case"singleFile":this._stopAll((u=(d=rs.query)==null?void 0:d.modelInfo)==null?void 0:u.model);break;case"multiFile":rs.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,rs.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort(ee.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);zr(`${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);zr(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=rs.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),rs.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()||em(n.getModel().uri,e==null?void 0:e.uri))continue;const s=rs.storedDecorationIDs.get(n.getModel().uri);if(!s)continue;n.removeDecorations(s),i.push(n.getModel().uri);const r=jc.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)rs.storedDecorationIDs.delete(n)}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasTextFocus()&&(((e=this.editor.getModel())==null?void 0:e.uri.scheme)!==mo.vscodeNotebookCell&&((i=(t=rs.query)==null?void 0:t.modelInfo)==null?void 0:i.model.uri.scheme)!==mo.vscodeNotebookCell?(rs.query=null,this._run()):(n=rs.query)!=null&&n.modelInfo&&(rs.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)!==mo.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===mo.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const d=a.getModel();d&&d!==e&&d.uri.scheme===mo.vscodeNotebookCell&&s.push(d)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!ck(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){rs.query=null,this._stopAll();return}const a=r.startColumn,d=r.endColumn,u=this._getWord();if(!u||u.startColumn>a||u.endColumn<d){rs.query=null,this._stopAll();return}t=this.workerRequest&&this.workerRequest.isValid(this.model,r,this.decorations),rs.query={modelInfo:{model:this.model,selection:r},word:u}}else if(!rs.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(em(this.editor.getModel().uri,(n=rs.query.modelInfo)==null?void 0:n.model.uri)){if(!e){const d=this.decorations.getRanges();for(const u of d)if(u.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(!rs.query||!rs.query.modelInfo||rs.query.modelInfo.model.isDisposed())return;this.workerRequest=this.computeWithModel(rs.query.modelInfo.model,rs.query.modelInfo.selection,rs.query.word,a),(s=this.workerRequest)==null||s.result.then(d=>{r===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=d||[],this._beginRenderDecorations())},On)}}computeWithModel(e,t,i,n){return n.length?Sj(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),n):wj(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=jc.get(s);if(!r)continue;const a=[],d=(t=s.getModel())==null?void 0:t.uri;if(d&&this.workerRequestValue.has(d)){const u=rs.storedDecorationIDs.get(d),f=this.workerRequestValue.get(d);if(f)for(const p of f)p.range&&a.push({range:p.range,options:fz(p.kind)});let g=[];s.changeDecorations(p=>{g=p.deltaDecorations(u??[],a)}),rs.storedDecorationIDs=rs.storedDecorationIDs.set(d,g),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()}},rs=Tc,Tc.storedDecorationIDs=new Mc,Tc.query=null,Tc);Ly=rs=OB([Kx(4,fs)],Ly);var pu;let jc=(pu=class extends Pt{static get(e){return e.getContribution(Fy.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new Ly(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()}},Fy=pu,pu.ID="editor.contrib.wordHighlighter",pu);jc=Fy=OB([Kx(1,En),Kx(2,xi),Kx(3,fs)],jc);class zB extends gt{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=jc.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class Dj extends zB{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:S("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:P9,kbOpts:{kbExpr:U.editorTextFocus,primary:65,weight:100}})}}class Aj extends zB{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:S("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:P9,kbOpts:{kbExpr:U.editorTextFocus,primary:1089,weight:100}})}}class kj extends gt{constructor(){super({id:"editor.action.wordHighlight.trigger",label:S("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=jc.get(t);n&&n.restoreViewState(!0)}}on(jc.ID,jc,0);Ae(Dj);Ae(Aj);Ae(kj);U0(By);class ab extends wo{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=Vu(t.getOption(132),t.getOption(131)),s=t.getModel(),r=t.getSelections(),a=r.length>1,d=r.map(u=>{const f=new pi(u.positionLineNumber,u.positionColumn),g=this._move(n,s,f,this._wordNavigationType,a);return this._moveTo(u,g,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,d.map(u=>q4.fromModelSelection(u))),d.length===1){const u=new pi(d[0].positionLineNumber,d[0].positionColumn);t.revealPosition(u,0)}}_moveTo(e,t,i){return i?new Hi(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new Hi(t.lineNumber,t.column,t.lineNumber,t.column)}}class Gc extends ab{_move(e,t,i,n,s){return Ep.moveWordLeft(e,t,i,n,s)}}class Kc extends ab{_move(e,t,i,n,s){return Ep.moveWordRight(e,t,i,n)}}class Bj extends Gc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class Fj extends Gc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class Lj extends Gc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:$e.and(U.textInputFocus,(e=$e.and(Lv,Iv))==null?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class Ij extends Gc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class Pj extends Gc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class Tj extends Gc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:$e.and(U.textInputFocus,(e=$e.and(Lv,Iv))==null?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class Mj extends Gc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n,s){return super._move(Vu(Pv.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Rj extends Gc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Vu(Pv.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Nj extends Kc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class Oj extends Kc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:$e.and(U.textInputFocus,(e=$e.and(Lv,Iv))==null?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class Hj extends Kc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class Wj extends Kc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class zj extends Kc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:$e.and(U.textInputFocus,(e=$e.and(Lv,Iv))==null?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class Vj extends Kc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class jj extends Kc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n,s){return super._move(Vu(Pv.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class $j extends Kc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Vu(Pv.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class lb extends wo{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(Ns);if(!t.hasModel())return;const s=Vu(t.getOption(132),t.getOption(131)),r=t.getModel(),a=t.getSelections(),d=t.getOption(6),u=t.getOption(11),f=n.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),g=t._getViewModel(),p=a.map(C=>{const b=this._delete({wordSeparators:s,model:r,selection:C,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:d,autoClosingQuotes:u,autoClosingPairs:f,autoClosedCharacters:g.getCursorAutoClosedCharacters()},this._wordNavigationType);return new lp(b,"")});t.pushUndoStop(),t.executeCommands(this.id,p),t.pushUndoStop()}}class T9 extends lb{_delete(e,t){const i=Ep.deleteWordLeft(e,t);return i||new ee(1,1,1,1)}}class M9 extends lb{_delete(e,t){const i=Ep.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new ee(n,s,n,s)}}class Uj extends T9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:U.writable})}}class qj extends T9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:U.writable})}}class Gj extends T9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:U.writable,kbOpts:{kbExpr:U.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class Kj extends M9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:U.writable})}}class Zj extends M9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:U.writable})}}class Xj extends M9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:U.writable,kbOpts:{kbExpr:U.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class Yj extends gt{constructor(){super({id:"deleteInsideWord",precondition:U.writable,label:S("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=Vu(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections().map(d=>{const u=Ep.deleteInsideWord(n,s,d);return new lp(u,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}yi(new Bj);yi(new Fj);yi(new Lj);yi(new Ij);yi(new Pj);yi(new Tj);yi(new Nj);yi(new Oj);yi(new Hj);yi(new Wj);yi(new zj);yi(new Vj);yi(new Mj);yi(new Rj);yi(new jj);yi(new $j);yi(new Uj);yi(new qj);yi(new Gj);yi(new Kj);yi(new Zj);yi(new Xj);Ae(Yj);class Qj extends lb{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:U.writable,kbOpts:{kbExpr:U.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=Tv.deleteWordPartLeft(e);return i||new ee(1,1,1,1)}}class Jj extends lb{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:U.writable,kbOpts:{kbExpr:U.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=Tv.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new ee(n,s,n,s)}}class VB extends ab{_move(e,t,i,n,s){return Tv.moveWordPartLeft(e,t,i,s)}}class e$ extends VB{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:U.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}Un.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class t$ extends VB{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:U.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}Un.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class jB extends ab{_move(e,t,i,n,s){return Tv.moveWordPartRight(e,t,i)}}class i$ extends jB{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:U.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class n$ extends jB{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:U.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}yi(new Qj);yi(new Jj);yi(new e$);yi(new t$);yi(new i$);yi(new n$);const J9=class J9 extends Pt{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=Po.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new oo(S("editor.simple.readonly","Cannot edit in read-only input")):t=new oo(S("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}};J9.ID="editor.contrib.readOnlyMessageController";let h_=J9;on(h_.ID,h_,2);var s$=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},RD=function(o,e){return function(t,i){e(t,i,o)}};let Iy=class extends Pt{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=Xo(this,void 0);const n=yd("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=yd("_textModel.onDidChangeContent",Ds.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(pp(async(r,a)=>{n.read(r),s.read(r);const d=a.add(new Z4),u=await this._outlineModelService.getOrCreate(this._textModel,d.token);a.isDisposed||this._currentModel.set(u,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(K4(_p(s=>s.range.endLineNumber-s.range.startLineNumber,wv))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};Iy=s$([RD(1,xi),RD(2,Rp)],Iy);G4.setBreadcrumbsSourceFactory((o,e)=>e.createInstance(Iy,o));const eS=class eS extends Pt{constructor(e){super(),this.editor=e,this.widget=null,IC&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new Py(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}};eS.ID="editor.contrib.iPadShowKeyboard";let f_=eS;const dv=class dv extends Pt{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Cn(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(Cn(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return dv.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};dv.ID="editor.contrib.ShowKeyboardWidget";let Py=dv;on(f_.ID,f_,3);var o$=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},ND=function(o,e){return function(t,i){e(t,i,o)}},Ty,xu;let Xg=(xu=class extends Pt{static get(e){return e.getContribution(Ty.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(Dv.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 My(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}},Ty=xu,xu.ID="editor.contrib.inspectTokens",xu);Xg=Ty=o$([ND(1,dk),ND(2,xa)],Xg);class r$ extends gt{constructor(){super({id:"editor.action.inspectTokens",label:J4.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=Xg.get(t);i==null||i.launch()}}function a$(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 l$(o,e){const t=Dv.get(e);if(t)return t;const i=o.encodeLanguageId(e);return{getInitialState:()=>X4,tokenize:(n,s,r)=>Q4(e,r),tokenizeEncoded:(n,s,r)=>Y4(i,r)}}const uv=class uv extends Pt{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=l$(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 uv._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let d=t.tokens1.length-1;d>=0;d--){const u=t.tokens1[d];if(e.column-1>=u.offset){i=d;break}}let n=0;for(let d=t.tokens2.length>>>1;d>=0;d--)if(e.column-1>=t.tokens2[d<<1]){n=d;break}const s=this._model.getLineContent(e.lineNumber);let r="";if(i<t.tokens1.length){const d=t.tokens1[i].offset,u=i+1<t.tokens1.length?t.tokens1[i+1].offset:s.length;r=s.substring(d,u)}tm(this._domNode,li("h2.tm-token",void 0,a$(r),li("span.tm-token-length",void 0,`${r.length} ${r.length===1?"char":"chars"}`))),ti(this._domNode,li("hr.tokens-inspect-separator",{style:"clear:both"}));const a=(n<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(n<<1)+1]):null;ti(this._domNode,li("table.tm-metadata-table",void 0,li("tbody",void 0,li("tr",void 0,li("td.tm-metadata-key",void 0,"language"),li("td.tm-metadata-value",void 0,`${a?a.languageId:"-?-"}`)),li("tr",void 0,li("td.tm-metadata-key",void 0,"token type"),li("td.tm-metadata-value",void 0,`${a?this._tokenTypeToString(a.tokenType):"-?-"}`)),li("tr",void 0,li("td.tm-metadata-key",void 0,"font style"),li("td.tm-metadata-value",void 0,`${a?this._fontStyleToString(a.fontStyle):"-?-"}`)),li("tr",void 0,li("td.tm-metadata-key",void 0,"foreground"),li("td.tm-metadata-value",void 0,`${a?dn.Format.CSS.formatHex(a.foreground):"-?-"}`)),li("tr",void 0,li("td.tm-metadata-key",void 0,"background"),li("td.tm-metadata-value",void 0,`${a?dn.Format.CSS.formatHex(a.background):"-?-"}`))))),ti(this._domNode,li("hr.tokens-inspect-separator")),i<t.tokens1.length&&ti(this._domNode,li("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=Dv.getColorMap(),i=mf.getLanguageId(e),n=mf.getTokenType(e),s=mf.getFontStyle(e),r=mf.getForeground(e),a=mf.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]}}};uv._ID="editor.contrib.inspectTokensWidget";let My=uv;on(Xg.ID,Xg,4);Ae(r$);var c$=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},OD=function(o,e){return function(t,i){e(t,i,o)}},zf,mu;let Ry=(mu=class{constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=fa.as(yp.Quickaccess)}provide(e){const t=new Bt;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(zf.PREFIX.length));n&&n.prefix&&n.prefix!==zf.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==zf.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:S("helpPickAriaLabel","{0}, {1}",n,t.description),description:t.description}})}},zf=mu,mu.PREFIX="?",mu);Ry=zf=c$([OD(0,Ol),OD(1,ms)],Ry);fa.as(yp.Quickaccess).registerQuickAccessProvider({ctor:Ry,prefix:"",helpEntries:[{description:e7.helpQuickAccessActionLabel}]});class $B{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){var r;const n=new Bt;e.canAcceptInBackground=!!((r=this.options)!=null&&r.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=n.add(new Qo);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 Bt,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const r={editor:s},a=uk(s);if(a){let d=s.saveViewState()??void 0;n.add(a.onDidChangeCursorPosition(()=>{d=s.saveViewState()??void 0})),r.restoreViewState=()=>{d&&s===this.activeTextEditorControl&&s.restoreViewState(d)},n.add(hk(t.onCancellationRequested)(()=>{var u;return(u=r.restoreViewState)==null?void 0:u.call(r)}))}n.add(Zn(()=>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&&p0(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){var t;return ck(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:bs(m2),position:qa.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 hv=class hv extends $B{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=S("cannotRunGotoLine","Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,Pt.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new Bt;s.add(t.onDidAccept(d=>{const[u]=t.selectedItems;if(u){if(!this.isValidLineNumber(n,u.lineNumber))return;this.gotoLocation(e,{range:this.toRange(u.lineNumber,u.column),keyMods:t.keyMods,preserveFocus:d.inBackground}),d.inBackground||t.hide()}}));const r=()=>{const d=this.parsePosition(n,t.value.trim().substr(hv.PREFIX.length)),u=this.getPickLabel(n,d.lineNumber,d.column);if(t.items=[{lineNumber:d.lineNumber,column:d.column,label:u}],t.ariaLabel=u,!this.isValidLineNumber(n,d.lineNumber)){this.clearDecorations(n);return}const f=this.toRange(d.lineNumber,d.column);n.revealRangeInCenter(f,0),this.addDecorations(n,f)};r(),s.add(t.onDidChangeValue(()=>r()));const a=uk(n);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(Zn(()=>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)?S("gotoLineColumnLabel","Go to line {0} and character {1}.",t,i):S("gotoLineLabel","Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?S("gotoLineLabelEmptyWithLimit","Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,s):S("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}};hv.PREFIX=":";let Ny=hv;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},u$=function(o,e){return function(t,i){e(t,i,o)}};let Yg=class extends Ny{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=Ds.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};Yg=d$([u$(0,fs)],Yg);var _u;let UB=(_u=class extends gt{constructor(){super({id:_u.ID,label:fk.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:U.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(Ol).quickAccess.show(Yg.PREFIX)}},_u.ID="editor.action.gotoLine",_u);Ae(UB);fa.as(yp.Quickaccess).registerQuickAccessProvider({ctor:Yg,prefix:Yg.PREFIX,helpEntries:[{description:fk.gotoLineActionLabel,commandId:UB.ID}]});const qB=[void 0,[]];function gC(o,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?h$(o,n.values,t,i):GB(o,e,t,i)}function h$(o,e,t,i){let n=0;const s=[];for(const r of e){const[a,d]=GB(o,r,t,i);if(typeof a!="number")return qB;n+=a,s.push(...d)}return[n,f$(s)]}function GB(o,e,t,i){const n=R2(e.original,e.originalLowercase,t,o,o.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],Sv(n)]:qB}function f$(o){const e=o.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!g$(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 g$(o,e){return!(o.end<e.start||e.end<o.start)}function HD(o){return o.startsWith('"')&&o.endsWith('"')}const KB=" ";function Oy(o){typeof o!="string"&&(o="");const e=o.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:n}=WD(o),s=t.indexOf(WC)>=0,r=HD(o);let a;const d=o.split(KB);if(d.length>1)for(const u of d){const f=HD(u),{pathNormalized:g,normalized:p,normalizedLowercase:C}=WD(u);p&&(a||(a=[]),a.push({original:u,originalLowercase:u.toLowerCase(),pathNormalized:g,normalized:p,normalizedLowercase:C,expectContiguousMatch:f}))}return{original:o,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:n,values:a,containsPathSeparator:s,expectContiguousMatch:r}}function WD(o){let e;xv?e=o.replace(/\//g,WC):e=o.replace(/\\/g,WC);const t=t7(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function zD(o){return Array.isArray(o)?Oy(o.map(e=>e.original).join(KB)):Oy(o.original)}var p$=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},VD=function(o,e){return function(t,i){e(t,i,o)}},Zx,oa;let Ld=(oa=class extends $B{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,S("cannotRunGotoSymbolWithoutEditor","To go to a symbol, first open a text editor with symbol information.")),Pt.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):Pt.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new Bt;return this.provideLabelPick(i,S("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 mv,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(Zn(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){var g;const r=e.editor,a=new Bt;a.add(i.onDidAccept(p=>{var b;const[C]=i.selectedItems;C&&C.range&&(this.gotoLocation(e,{range:C.range.selection,keyMods:i.keyMods,preserveFocus:p.inBackground}),(b=s==null?void 0:s.handleAccept)==null||b.call(s,C),p.inBackground||i.hide())})),a.add(i.onDidTriggerItemButton(({item:p})=>{p&&p.range&&(this.gotoLocation(e,{range:p.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const d=this.getDocumentSymbols(t,n);let u;const f=async p=>{u==null||u.dispose(!0),i.busy=!1,u=new zs(n),i.busy=!0;try{const C=Oy(i.value.substr(Zx.PREFIX.length).trim()),b=await this.doGetSymbolPicks(d,C,void 0,u.token,t);if(n.isCancellationRequested)return;if(b.length>0){if(i.items=b,p&&C.original.length===0){const E=o7(b,y=>!!(y.type!=="separator"&&y.range&&ee.containsPosition(y.range.decoration,p)));E&&(i.activeItems=[E])}}else C.original.length>0?this.provideLabelPick(i,S("noMatchingSymbolResults","No matching editor symbols")):this.provideLabelPick(i,S("noSymbolResults","No editor symbols"))}finally{n.isCancellationRequested||(i.busy=!1)}};return a.add(i.onDidChangeValue(()=>f(void 0))),f((g=r.getSelection())==null?void 0:g.getPosition()),a.add(i.onDidChangeActive(()=>{const[p]=i.activeItems;p&&p.range&&(r.revealRangeInCenter(p.range.selection,0),this.addDecorations(r,p.range.decoration))})),a}async doGetSymbolPicks(e,t,i,n,s){var y,D;const r=await e;if(n.isCancellationRequested)return[];const a=t.original.indexOf(Zx.SCOPE_PREFIX)===0,d=a?1:0;let u,f;t.values&&t.values.length>1?(u=zD(t.values[0]),f=zD(t.values.slice(1))):u=t;let g;const p=(D=(y=this.options)==null?void 0:y.openSideBySideDirection)==null?void 0:D.call(y);p&&(g=[{iconClass:p==="right"?Dn.asClassName(Ui.splitHorizontal):Dn.asClassName(Ui.splitVertical),tooltip:p==="right"?S("openToSide","Open to the Side"):S("openToBottom","Open to the Bottom")}]);const C=[];for(let I=0;I<r.length;I++){const M=r[I],R=i7(M.name),T=`$(${n7.toIcon(M.kind).id}) ${R}`,V=T.length-R.length;let O=M.containerName;i!=null&&i.extraContainerLabel&&(O?O=`${i.extraContainerLabel} • ${O}`:O=i.extraContainerLabel);let Q,ie,de,te;if(t.original.length>d){let we=!1;if(u!==t&&([Q,ie]=gC(T,{...t,values:void 0},d,V),typeof Q=="number"&&(we=!0)),typeof Q!="number"&&([Q,ie]=gC(T,u,d,V),typeof Q!="number"))continue;if(!we&&f){if(O&&f.original.length>0&&([de,te]=gC(O,f)),typeof de!="number")continue;typeof Q=="number"&&(Q+=de)}}const le=M.tags&&M.tags.indexOf(1)>=0;C.push({index:I,kind:M.kind,score:Q,label:T,ariaLabel:s7(M.name,M.kind),description:O,highlights:le?void 0:{label:ie,description:te},range:{selection:ee.collapseToStart(M.selectionRange),decoration:M.range},uri:s.uri,symbolName:R,strikethrough:le,buttons:g})}const b=C.sort((I,M)=>a?this.compareByKindAndScore(I,M):this.compareByScore(I,M));let E=[];if(a){let T=function(){M&&typeof I=="number"&&R>0&&(M.label=_w(xC[I]||pC,R))},I,M,R=0;for(const V of b)I!==V.kind?(T(),I=V.kind,R=1,M={type:"separator"},E.push(M)):R++,E.push(V);T()}else b.length>0&&(E=[{label:S("symbols","symbols ({0})",C.length),type:"separator"},...b]);return E}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=xC[e.kind]||pC,n=xC[t.kind]||pC,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()}},Zx=oa,oa.PREFIX="@",oa.SCOPE_PREFIX=":",oa.PREFIX_BY_CATEGORY=`${oa.PREFIX}${oa.SCOPE_PREFIX}`,oa);Ld=Zx=p$([VD(0,xi),VD(1,Rp)],Ld);const pC=S("property","properties ({0})"),xC={5:S("method","methods ({0})"),11:S("function","functions ({0})"),8:S("_constructor","constructors ({0})"),12:S("variable","variables ({0})"),4:S("class","classes ({0})"),22:S("struct","structs ({0})"),23:S("event","events ({0})"),24:S("operator","operators ({0})"),10:S("interface","interfaces ({0})"),2:S("namespace","namespaces ({0})"),3:S("package","packages ({0})"),25:S("typeParameter","type parameters ({0})"),1:S("modules","modules ({0})"),6:S("property","properties ({0})"),9:S("enum","enumerations ({0})"),21:S("enumMember","enumeration members ({0})"),14:S("string","strings ({0})"),0:S("file","files ({0})"),17:S("array","arrays ({0})"),15:S("number","numbers ({0})"),16:S("boolean","booleans ({0})"),18:S("object","objects ({0})"),19:S("key","keys ({0})"),7:S("field","fields ({0})"),13:S("constant","constants ({0})")};var x$=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},mC=function(o,e){return function(t,i){e(t,i,o)}};let Hy=class extends Ld{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=Ds.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};Hy=x$([mC(0,fs),mC(1,xi),mC(2,Rp)],Hy);const fv=class fv extends gt{constructor(){super({id:fv.ID,label:zC.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:U.hasDocumentSymbolProvider,kbOpts:{kbExpr:U.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(Ol).quickAccess.show(Ld.PREFIX,{itemActivation:r7.NONE})}};fv.ID="editor.action.quickOutline";let g_=fv;Ae(g_);fa.as(yp.Quickaccess).registerQuickAccessProvider({ctor:Hy,prefix:Ld.PREFIX,helpEntries:[{description:zC.quickOutlineActionLabel,prefix:Ld.PREFIX,commandId:g_.ID},{description:zC.quickOutlineByCategoryActionLabel,prefix:Ld.PREFIX_BY_CATEGORY}]});function m$(o){const e=new Map;for(const t of o)e.set(t,(e.get(t)??0)+1);return e}class ag{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 d of a.chunks){const u=this.computeSimilarityScore(d,i,n);u>0&&s.push({key:r,score:u})}}return s}static termFrequencies(e){return m$(ag.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=ag.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 d=i.get(s);typeof d!="number"&&(d=this.computeIdf(s),i.set(s,d));const u=a*d;n+=u*r}return n}computeEmbedding(e){const t=ag.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 _$(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 Rh;(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"})(Rh||(Rh={}));function _C(o){return Array.isArray(o.items)}function jD(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class v$ extends Pt{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var u;const n=new Bt;e.canAcceptInBackground=!!((u=this.options)!=null&&u.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const r=n.add(new Qo),a=async()=>{var y;const f=r.value=new Bt;s==null||s.dispose(!0),e.busy=!1,s=new zs(t);const g=s.token;let p=e.value.substring(this.prefix.length);(y=this.options)!=null&&y.shouldSkipTrimPickFilter||(p=p.trim());const C=this._getPicks(p,f,g,i),b=(D,I)=>{var T;let M,R;if(_C(D)?(M=D.items,R=D.active):M=D,M.length===0){if(I)return!1;(p.length>0||e.hideInput)&&((T=this.options)!=null&&T.noResultsPick)&&(a7(this.options.noResultsPick)?M=[this.options.noResultsPick(p)]:M=[this.options.noResultsPick])}return e.items=M,R&&(e.activeItems=[R]),!0},E=async D=>{let I=!1,M=!1;await Promise.all([(async()=>{typeof D.mergeDelay=="number"&&(await Bv(D.mergeDelay),g.isCancellationRequested)||M||(I=b(D.picks,!0))})(),(async()=>{e.busy=!0;try{const R=await D.additionalPicks;if(g.isCancellationRequested)return;let T,V;_C(D.picks)?(T=D.picks.items,V=D.picks.active):T=D.picks;let O,Q;if(_C(R)?(O=R.items,Q=R.active):O=R,O.length>0||!I){let ie;if(!V&&!Q){const de=e.activeItems[0];de&&T.indexOf(de)!==-1&&(ie=de)}b({items:[...T,...O],active:V||Q||ie})}}finally{g.isCancellationRequested||(e.busy=!1),M=!0}})()])};if(C!==null)if(jD(C))await E(C);else if(!(C instanceof Promise))b(C);else{e.busy=!0;try{const D=await C;if(g.isCancellationRequested)return;jD(D)?await E(D):b(D)}finally{g.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>a())),a(),n.add(e.onDidAccept(f=>{var p;if(i!=null&&i.handleAccept){f.inBackground||e.hide(),(p=i.handleAccept)==null||p.call(i,e.activeItems[0]);return}const[g]=e.selectedItems;typeof(g==null?void 0:g.accept)=="function"&&(f.inBackground||e.hide(),g.accept(e.keyMods,f))}));const d=async(f,g)=>{var C;if(typeof g.trigger!="function")return;const p=((C=g.buttons)==null?void 0:C.indexOf(f))??-1;if(p>=0){const b=g.trigger(p,e.keyMods),E=typeof b=="number"?b:await b;if(t.isCancellationRequested)return;switch(E){case Rh.NO_ACTION:break;case Rh.CLOSE_PICKER:e.hide();break;case Rh.REFRESH_PICKER:a();break;case Rh.REMOVE_ITEM:{const y=e.items.indexOf(g);if(y!==-1){const D=e.items.slice(),I=D.splice(y,1),M=e.activeItems.filter(T=>T!==I[0]),R=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=D,M&&(e.activeItems=M),e.keepScrollPosition=R}break}}}};return n.add(e.onDidTriggerItemButton(({button:f,item:g})=>d(f,g))),n.add(e.onDidTriggerSeparatorButton(({button:f,separator:g})=>d(f,g))),n}}var ZB=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},sc=function(o,e){return function(t,i){e(t,i,o)}},od,ps,Va;let Wy=(Va=class extends v${constructor(e,t,i,n,s,r){super(od.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(zy)),this.options=e}async _getPicks(e,t,i,n){var C,b;const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const r=hk(()=>{const E=new ag;E.updateDocuments(s.map(D=>({key:D.commandId,textChunks:[this.getTfIdfChunk(D)]})));const y=E.calculateScores(e,i);return _$(y).filter(D=>D.score>od.TFIDF_THRESHOLD).slice(0,od.TFIDF_MAX_RESULTS)}),a=[];for(const E of s){const y=od.WORD_FILTER(e,E.label)??void 0,D=E.commandAlias?od.WORD_FILTER(e,E.commandAlias)??void 0:void 0;if(y||D)E.highlights={label:y,detail:this.options.showAlias?D:void 0},a.push(E);else if(e===E.commandId)a.push(E);else if(e.length>=3){const I=r();if(i.isCancellationRequested)return[];const M=I.find(R=>R.key===E.commandId);M&&(E.tfIdfScore=M.score,a.push(E))}}const d=new Map;for(const E of a){const y=d.get(E.label);y?(E.description=E.commandId,y.description=y.commandId):d.set(E.label,E)}a.sort((E,y)=>{if(E.tfIdfScore&&y.tfIdfScore)return E.tfIdfScore===y.tfIdfScore?E.label.localeCompare(y.label):y.tfIdfScore-E.tfIdfScore;if(E.tfIdfScore)return 1;if(y.tfIdfScore)return-1;const D=this.commandsHistory.peek(E.commandId),I=this.commandsHistory.peek(y.commandId);if(D&&I)return D>I?-1:1;if(D)return-1;if(I)return 1;if(this.options.suggestedCommandIds){const M=this.options.suggestedCommandIds.has(E.commandId),R=this.options.suggestedCommandIds.has(y.commandId);if(M&&R)return 0;if(M)return-1;if(R)return 1}return E.label.localeCompare(y.label)});const u=[];let f=!1,g=!0,p=!!this.options.suggestedCommandIds;for(let E=0;E<a.length;E++){const y=a[E];E===0&&this.commandsHistory.peek(y.commandId)&&(u.push({type:"separator",label:S("recentlyUsed","recently used")}),f=!0),g&&y.tfIdfScore!==void 0&&(u.push({type:"separator",label:S("suggested","similar commands")}),g=!1),p&&y.tfIdfScore===void 0&&!this.commandsHistory.peek(y.commandId)&&((C=this.options.suggestedCommandIds)!=null&&C.has(y.commandId))&&(u.push({type:"separator",label:S("commonlyUsed","commonly used")}),f=!0,p=!1),f&&y.tfIdfScore===void 0&&!this.commandsHistory.peek(y.commandId)&&!((b=this.options.suggestedCommandIds)!=null&&b.has(y.commandId))&&(u.push({type:"separator",label:S("morecCommands","other commands")}),f=!1),u.push(this.toCommandPick(y,n))}return this.hasAdditionalCommandPicks(e,i)?{picks:u,additionalPicks:(async()=>{var D;const E=await this.getAdditionalCommandPicks(s,a,e,i);if(i.isCancellationRequested)return[];const y=E.map(I=>this.toCommandPick(I,n));return g&&((D=y[0])==null?void 0:D.type)!=="separator"&&y.unshift({type:"separator",label:S("suggested","similar commands")}),y})()}:u}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?S("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){$c(r)||this.dialogService.error(S("canNotRun","Command '{0}' resulted in an error",e.label),bm(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}},od=Va,Va.PREFIX=">",Va.TFIDF_THRESHOLD=.5,Va.TFIDF_MAX_RESULTS=5,Va.WORD_FILTER=l7(u7,d7,c7),Va);Wy=od=ZB([sc(1,Qi),sc(2,ms),sc(3,Rs),sc(4,pa),sc(5,Bw)],Wy);var ra;let zy=(ra=class extends Pt{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===dw.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=ps.getConfiguredCommandHistoryLength(this.configurationService),ps.cache&&ps.cache.limit!==this.configuredCommandsHistoryLength&&(ps.cache.limit=this.configuredCommandsHistoryLength,ps.hasChanges=!0))}load(){const e=this.storageService.get(ps.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=ps.cache=new fp(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))}ps.counter=this.storageService.getNumber(ps.PREF_KEY_COUNTER,0,ps.counter)}push(e){ps.cache&&(ps.cache.set(e,ps.counter++),ps.hasChanges=!0)}peek(e){var t;return(t=ps.cache)==null?void 0:t.peek(e)}saveState(){if(!ps.cache||!ps.hasChanges)return;const e={usesLRU:!0,entries:[]};ps.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(ps.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(ps.PREF_KEY_COUNTER,ps.counter,0,0),ps.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:ps.DEFAULT_COMMANDS_HISTORY_LENGTH}},ps=ra,ra.DEFAULT_COMMANDS_HISTORY_LENGTH=50,ra.PREF_KEY_CACHE="commandPalette.mru.cache",ra.PREF_KEY_COUNTER="commandPalette.mru.counter",ra.counter=1,ra.hasChanges=!1,ra);zy=ps=ZB([sc(0,Uc),sc(1,Yn),sc(2,zu)],zy);class b$ extends Wy{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&&(h7(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:f7(n.label)||n.id})}return t}}var C$=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},gh=function(o,e){return function(t,i){e(t,i,o)}};let Qg=class extends b${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[]}};Qg=C$([gh(0,Qi),gh(1,fs),gh(2,ms),gh(3,Rs),gh(4,pa),gh(5,Bw)],Qg);const gv=class gv extends gt{constructor(){super({id:gv.ID,label:gk.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:U.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(Ol).quickAccess.show(Qg.PREFIX)}};gv.ID="editor.action.quickCommand";let p_=gv;Ae(p_);fa.as(yp.Quickaccess).registerQuickAccessProvider({ctor:Qg,prefix:Qg.PREFIX,helpEntries:[{description:gk.quickCommandHelp,commandId:p_.ID}]});var E$=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},ph=function(o,e){return function(t,i){e(t,i,o)}};let Vy=class extends Iu{constructor(e,t,i,n,s,r,a){super(!0,e,t,i,n,s,r,a)}};Vy=E$([ph(1,En),ph(2,fs),ph(3,go),ph(4,Qi),ph(5,Uc),ph(6,Yn)],Vy);on(Iu.ID,Vy,4);class y$ extends gt{constructor(){super({id:"editor.action.toggleHighContrast",label:g7.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(dk),n=i.getColorTheme();gg(n.type)?(i.setTheme(this._originalThemeName||($S(n.type)?p7:x7)),this._originalThemeName=null):(i.setTheme($S(n.type)?m7:_7),this._originalThemeName=n.themeName)}}Ae(y$);let jy=null;function w$(o){jy=o}function S$(o={}){return{"Content-Type":"application/json",...o}}async function $t(o,e,t){const i=await fetch(e,{method:o,headers:S$(),body:t!==void 0?JSON.stringify(t):void 0});if(i.status===401)throw jy&&jy(),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 D$(){return await(await fetch("/she/auth/mode")).json()}async function A$(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 k$(){await fetch("/she/auth/logout",{method:"POST"})}async function B$(o,e,t,i){const n=await fetch("/she/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:o,password:e,proxyHeader:t,proxyLogoutUrl:i})});if(!n.ok){const s=await n.json().catch(()=>({error:n.statusText}));throw new Error(s.error??"Setup failed")}}function F$(){return $t("GET","/she/scripts/tree")}function vC(o){return $t("GET",`/she/scripts/${o}`)}function id(o,e){return $t("PUT",`/she/scripts/${o}`,{content:e})}function bx(o){return $t("DELETE",`/she/scripts/${o}`)}function $D(o,e){return $t("POST",`/she/scripts/${o}/rename`,{newPath:e})}function L$(o){return $t("POST","/she/scripts/mkdir",{path:o})}function I$(){return $t("GET","/she/git/status")}function Vf(){return $t("GET","/she/status")}function XB(){return $t("POST","/she/restart")}function P$(){return $t("POST","/she/update")}function T$(){return $t("POST","/she/check-update")}function M$(o,e){return $t("POST","/she/git/commit",{path:o,message:e})}function UD(o,e){return $t("POST","/she/git/commit",{files:o,message:e})}function qD(o){return $t("POST","/she/git/commit",{message:o})}function Cx(o){return $t("POST","/she/git/push",{remote:o})}function R$(o,e){return $t("GET",`/she/git/log?path=${encodeURIComponent(o)}&limit=${e}`)}function N$(o,e){return $t("GET",`/she/git/show?hash=${encodeURIComponent(o)}&path=${encodeURIComponent(e)}`)}function Nl(){return $t("GET","/she/config")}function Jg(o){return $t("PUT","/she/config",o)}function YB(){return $t("GET","/she/db/docs")}function O$(o){return $t("GET",`/she/db/docs/${o}`)}function GD(o,e){return $t("PUT",`/she/db/docs/${o}`,e)}function H$(o){return $t("DELETE",`/she/db/docs/${o}`)}function QB(){return $t("GET","/she/db/views")}function W$(o){return $t("GET",`/she/db/views/${o}`)}function KD(o,e){return $t("PUT",`/she/db/views/${o}`,e)}function z$(o){return $t("DELETE",`/she/db/views/${o}`)}function V$(){return $t("GET","/she/deps")}function j$(o){return $t("GET",`/she/deps/search?q=${encodeURIComponent(o)}`)}function $$(o,e){return $t("POST","/she/deps/install",{name:o,version:null})}function U$(o){return $t("POST","/she/deps/remove",{name:o})}function q$(o){return $t("POST","/she/deps/update",{name:o})}function JB(){return $t("GET","/she/deps/outdated")}function G$(){return $t("POST","/she/deps/check-outdated")}function K$(){return $t("GET","/she/ai/conversations")}function ZD(o){return $t("GET",`/she/ai/conversations/${encodeURIComponent(o)}`)}function Z$(o,e,t){return $t("PUT",`/she/ai/conversations/${encodeURIComponent(o)}`,{title:e,messages:t})}function X$(o){return $t("DELETE",`/she/ai/conversations/${encodeURIComponent(o)}`)}function bC(o){return $t("GET",`/she/db/views/${o}/result`)}function eF(){return $t("GET","/she/matter/devices")}function Xx(o){return $t("GET",`/she/matter/devices/${o}`)}function Y$(o){return $t("POST","/she/matter/commission",o)}function Q$(o){return $t("DELETE",`/she/matter/devices/${o}`)}function J$(o,e,t,i,n){return $t("POST",`/she/matter/devices/${o}/command`,{endpointId:e,clusterName:t,command:i,args:n})}function tF(){return $t("GET","/she/mqtt/state")}function XD(o,e,t=!1,i=0){return $t("POST","/she/mqtt/publish",{topic:o,payload:e,retain:t,qos:i})}function iF(){return $t("GET","/she/ai/config")}function nF(){return $t("GET","/she/ai/models")}function $y(o){return $t("GET",`/she/ai/model-info?model=${encodeURIComponent(o)}`)}function sF(o){return $t("POST","/she/ai/prompt",o)}async function oF(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 u=await s.json().catch(()=>({error:s.statusText}));throw new Error(u.error??s.statusText)}const r=s.body.getReader(),a=new TextDecoder;let d="";try{for(;;){const{done:u,value:f}=await r.read();if(u)break;d+=a.decode(f,{stream:!0});const g=d.split(`
79
+ `);d=g.pop()??"";for(const p of g){if(!p.startsWith("data: "))continue;const C=p.slice(6).trim();if(C==="[DONE]")return;try{const b=JSON.parse(C);if(b.error)throw new Error(b.error);if(b.type==="tool_call"||b.type==="tool_result"){i==null||i({type:b.type,name:b.name??"",args:b.args,content:b.content});continue}b.token&&e(b.token)}catch(b){if(b instanceof SyntaxError)continue;throw b}}}}finally{r.releaseLock()}}function R9(){return $t("GET","/she/broker/status")}function eU(){return $t("GET","/she/broker/local/check")}function tU(){return $t("GET","/she/broker/ip-addresses")}function N9(){return $t("GET","/she/broker/config")}function rF(o){return $t("PUT","/she/broker/config",o)}function aF(){return $t("POST","/she/broker/reload")}function iU(){return $t("POST","/she/broker/restart")}function nU(){return $t("POST","/she/broker/wizard/deactivate")}function sU(){return $t("POST","/she/broker/wizard/reinit")}function oU(){return $t("GET","/she/broker/wizard/diagnose")}function rU(){return $t("GET","/she/broker/users")}function aU(o,e){return $t("POST","/she/broker/users",{username:o,password:e})}function lU(o){return $t("DELETE",`/she/broker/users/${encodeURIComponent(o)}`)}function cU(o,e){return $t("PUT",`/she/broker/users/${encodeURIComponent(o)}/password`,{password:e})}function dU(o,e){return $t("POST",`/she/broker/users/${encodeURIComponent(o)}/roles`,{rolename:e})}function uU(o,e){return $t("DELETE",`/she/broker/users/${encodeURIComponent(o)}/roles/${encodeURIComponent(e)}`)}function lF(){return $t("GET","/she/broker/roles")}function hU(o){return $t("POST","/she/broker/roles",{rolename:o})}function fU(o){return $t("DELETE",`/she/broker/roles/${encodeURIComponent(o)}`)}function gU(o,e){return $t("POST",`/she/broker/roles/${encodeURIComponent(o)}/acls`,e)}function pU(o,e,t){return $t("DELETE",`/she/broker/roles/${encodeURIComponent(o)}/acls`,{acltype:e,topic:t})}function xU(){return $t("GET","/she/broker/groups")}function mU(o){return $t("POST","/she/broker/groups",{groupname:o})}function _U(o){return $t("DELETE",`/she/broker/groups/${encodeURIComponent(o)}`)}function YD(o,e){return $t("POST",`/she/broker/groups/${encodeURIComponent(o)}/clients`,{username:e})}function QD(o,e){return $t("DELETE",`/she/broker/groups/${encodeURIComponent(o)}/clients/${encodeURIComponent(e)}`)}function vU(o,e){return $t("POST",`/she/broker/groups/${encodeURIComponent(o)}/roles`,{rolename:e})}function bU(o,e){return $t("DELETE",`/she/broker/groups/${encodeURIComponent(o)}/roles/${encodeURIComponent(e)}`)}function CU(){return $t("GET","/she/broker/acl-defaults")}function EU(o){return $t("PUT","/she/broker/acl-defaults",{acls:o})}function yU(o){return $t("GET",`/she/broker/acl-check?${new URLSearchParams({topic:o})}`)}function wU(){return $t("GET","/she/broker/anonymous-group")}function SU(o){return $t("PUT","/she/broker/anonymous-group",{groupname:o})}function DU(){return $t("GET","/she/broker/ca/server")}function AU(o){return $t("POST","/she/broker/ca/server/generate",o)}function kU(o){return $t("POST","/she/broker/ca/server/csr",o)}function CC(o){return $t("POST","/she/broker/ca/server/import",o)}function BU(){return $t("GET","/she/broker/ca/trusted")}function FU(o){return $t("POST","/she/broker/ca/trusted",{pem:o})}function LU(o){return $t("DELETE",`/she/broker/ca/trusted/${encodeURIComponent(o)}`)}function IU(o){return $t("GET",`/she/broker/fs/complete?path=${encodeURIComponent(o)}`)}function PU(o){return $t("POST","/she/broker/ca/server/pathlink",o)}function TU(o){return $t("POST","/she/broker/ca/trusted/addpath",{path:o})}const MU=2e3,Yx=[];function cF(){return Yx.slice()}let gc=null;const x_=new Set,Nh=new Map;let Uy=null;function ep(){let o=x_.size;for(const e of Nh.values())o+=e.size;return o}function RU(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/she/ws`}function O9(){if(gc)return;const o=RU(),e=new WebSocket(o);gc=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};Yx.length>=MU&&Yx.shift(),Yx.push(s),x_.forEach(r=>r(s))}const n=Nh.get(i.type);n&&n.forEach(s=>s(i))}catch{}},e.onclose=()=>{gc===e&&(gc=null),ep()>0&&(Uy=setTimeout(O9,3e3))},e.onerror=()=>{e.close()}}function dF(){Uy&&clearTimeout(Uy),gc==null||gc.close(),gc=null}function H9(o){return x_.add(o),ep()===1&&O9(),()=>{x_.delete(o),ep()===0&&dF()}}function ur(o,e){return Nh.has(o)||Nh.set(o,new Set),Nh.get(o).add(e),ep()===1&&O9(),()=>{var t;(t=Nh.get(o))==null||t.delete(e),ep()===0&&dF()}}var NU=F('<button class="cancel svelte-1eh8v5n">Cancel</button>'),OU=F('<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> </button></div></div>',1);function Zc(o,e){Os(e,!0);let t=P(!1),i=P(""),n=P("Confirm"),s=P(!1),r=P(!1),a=null;function d(E,y){return m(i,E,!0),m(n,(y==null?void 0:y.confirm)??(y!=null&&y.alert?"OK":"Confirm"),!0),m(s,(y==null?void 0:y.danger)??!1,!0),m(r,(y==null?void 0:y.alert)??!1,!0),m(t,!0),new Promise(D=>a=D)}function u(E){m(t,!1),a==null||a(E),a=null}function f(E){c(t)&&(E.key==="Escape"&&u(!1),E.key==="Enter"&&u(!0))}var g={show:d},p=Ts();ls("keydown",Dd,f);var C=wt(p);{var b=E=>{var y=OU(),D=wt(y),I=_(D,2),M=v(I),R=v(M),T=_(M,2),V=v(T);{var O=te=>{var le=NU();$("click",le,()=>u(!1)),A(te,le)};z(V,te=>{c(r)||te(O)})}var Q=_(V,2);let ie;var de=v(Q);j(()=>{W(R,c(i)),ie=kt(Q,1,"svelte-1eh8v5n",null,ie,{danger:c(s)}),W(de,c(n))}),$("click",D,()=>u(!1)),$("click",Q,()=>u(!0)),A(E,y)};z(C,E=>{c(t)&&E(b)})}return A(o,p),Hs(g)}Us(["click"]);var HU=F('<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 WU(o,e){Os(e,!0);let t=P(!1),i=P(""),n=P(""),s=P("OK"),r=P(""),a=null,d=P(void 0);function u(D,I){return m(i,D,!0),m(n,(I==null?void 0:I.placeholder)??"",!0),m(s,(I==null?void 0:I.confirm)??"OK",!0),m(r,(I==null?void 0:I.initial)??"",!0),m(t,!0),setTimeout(()=>{if(c(d)){c(d).focus();const M=c(d).value.length;c(d).setSelectionRange(M,M)}},0),new Promise(M=>a=M)}function f(){const D=c(r).trim();D&&(m(t,!1),a==null||a(D),a=null,m(r,""))}function g(){m(t,!1),a==null||a(null),a=null,m(r,"")}function p(D){c(t)&&D.key==="Escape"&&(D.stopPropagation(),g())}var C={show:u},b=Ts();ls("keydown",Dd,p);var E=wt(b);{var y=D=>{var I=HU(),M=wt(I),R=_(M,2),T=v(R),V=v(T),O=_(T,2);cs(O,le=>m(d,le),()=>c(d));var Q=_(O,2),ie=v(Q),de=_(ie,2),te=v(de);j(le=>{W(V,c(i)),ln(O,"placeholder",c(n)),de.disabled=le,W(te,c(s))},[()=>!c(r).trim()]),$("click",M,g),$("keydown",O,le=>{le.key==="Enter"&&(le.preventDefault(),f())}),jt(O,()=>c(r),le=>m(r,le)),$("click",ie,g),$("click",de,f),A(D,I)};z(E,D=>{c(t)&&D(y)})}return A(o,b),Hs(C)}Us(["click","keydown"]);function W9(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var EC,JD;function zU(){if(JD)return EC;JD=1;function o(Z){return Z instanceof Map?Z.clear=Z.delete=Z.set=function(){throw new Error("map is read-only")}:Z instanceof Set&&(Z.add=Z.clear=Z.delete=function(){throw new Error("set is read-only")}),Object.freeze(Z),Object.getOwnPropertyNames(Z).forEach(Se=>{const Ye=Z[Se],rt=typeof Ye;(rt==="object"||rt==="function")&&!Object.isFrozen(Ye)&&o(Ye)}),Z}class e{constructor(Se){Se.data===void 0&&(Se.data={}),this.data=Se.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i(Z,...Se){const Ye=Object.create(null);for(const rt in Z)Ye[rt]=Z[rt];return Se.forEach(function(rt){for(const Ut in rt)Ye[Ut]=rt[Ut]}),Ye}const n="</span>",s=Z=>!!Z.scope,r=(Z,{prefix:Se})=>{if(Z.startsWith("language:"))return Z.replace("language:","language-");if(Z.includes(".")){const Ye=Z.split(".");return[`${Se}${Ye.shift()}`,...Ye.map((rt,Ut)=>`${rt}${"_".repeat(Ut+1)}`)].join(" ")}return`${Se}${Z}`};class a{constructor(Se,Ye){this.buffer="",this.classPrefix=Ye.classPrefix,Se.walk(this)}addText(Se){this.buffer+=t(Se)}openNode(Se){if(!s(Se))return;const Ye=r(Se.scope,{prefix:this.classPrefix});this.span(Ye)}closeNode(Se){s(Se)&&(this.buffer+=n)}value(){return this.buffer}span(Se){this.buffer+=`<span class="${Se}">`}}const d=(Z={})=>{const Se={children:[]};return Object.assign(Se,Z),Se};class u{constructor(){this.rootNode=d(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(Se){this.top.children.push(Se)}openNode(Se){const Ye=d({scope:Se});this.add(Ye),this.stack.push(Ye)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(Se){return this.constructor._walk(Se,this.rootNode)}static _walk(Se,Ye){return typeof Ye=="string"?Se.addText(Ye):Ye.children&&(Se.openNode(Ye),Ye.children.forEach(rt=>this._walk(Se,rt)),Se.closeNode(Ye)),Se}static _collapse(Se){typeof Se!="string"&&Se.children&&(Se.children.every(Ye=>typeof Ye=="string")?Se.children=[Se.children.join("")]:Se.children.forEach(Ye=>{u._collapse(Ye)}))}}class f extends u{constructor(Se){super(),this.options=Se}addText(Se){Se!==""&&this.add(Se)}startScope(Se){this.openNode(Se)}endScope(){this.closeNode()}__addSublanguage(Se,Ye){const rt=Se.root;Ye&&(rt.scope=`language:${Ye}`),this.add(rt)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(Z){return Z?typeof Z=="string"?Z:Z.source:null}function p(Z){return E("(?=",Z,")")}function C(Z){return E("(?:",Z,")*")}function b(Z){return E("(?:",Z,")?")}function E(...Z){return Z.map(Ye=>g(Ye)).join("")}function y(Z){const Se=Z[Z.length-1];return typeof Se=="object"&&Se.constructor===Object?(Z.splice(Z.length-1,1),Se):{}}function D(...Z){return"("+(y(Z).capture?"":"?:")+Z.map(rt=>g(rt)).join("|")+")"}function I(Z){return new RegExp(Z.toString()+"|").exec("").length-1}function M(Z,Se){const Ye=Z&&Z.exec(Se);return Ye&&Ye.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function T(Z,{joinWith:Se}){let Ye=0;return Z.map(rt=>{Ye+=1;const Ut=Ye;let se=g(rt),me="";for(;se.length>0;){const Ne=R.exec(se);if(!Ne){me+=se;break}me+=se.substring(0,Ne.index),se=se.substring(Ne.index+Ne[0].length),Ne[0][0]==="\\"&&Ne[1]?me+="\\"+String(Number(Ne[1])+Ut):(me+=Ne[0],Ne[0]==="("&&Ye++)}return me}).map(rt=>`(${rt})`).join(Se)}const V=/\b\B/,O="[a-zA-Z]\\w*",Q="[a-zA-Z_]\\w*",ie="\\b\\d+(\\.\\d+)?",de="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",te="\\b(0b[01]+)",le="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",we=(Z={})=>{const Se=/^#![ ]*\//;return Z.binary&&(Z.begin=E(Se,/.*\b/,Z.binary,/\b.*/)),i({scope:"meta",begin:Se,end:/$/,relevance:0,"on:begin":(Ye,rt)=>{Ye.index!==0&&rt.ignoreMatch()}},Z)},oe={begin:"\\\\[\\s\\S]",relevance:0},ye={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[oe]},Re={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[oe]},ke={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/},_e=function(Z,Se,Ye={}){const rt=i({scope:"comment",begin:Z,end:Se,contains:[]},Ye);rt.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 Ut=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 rt.contains.push({begin:E(/[ ]+/,"(",Ut,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),rt},lt=_e("//","$"),Te=_e("/\\*","\\*/"),pe=_e("#","$"),ut={scope:"number",begin:ie,relevance:0},Rt={scope:"number",begin:de,relevance:0},st={scope:"number",begin:te,relevance:0},St={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[oe,{begin:/\[/,end:/\]/,relevance:0,contains:[oe]}]},be={scope:"title",begin:O,relevance:0},Tt={scope:"title",begin:Q,relevance:0},xt={begin:"\\.\\s*"+Q,relevance:0};var et=Object.freeze({__proto__:null,APOS_STRING_MODE:ye,BACKSLASH_ESCAPE:oe,BINARY_NUMBER_MODE:st,BINARY_NUMBER_RE:te,COMMENT:_e,C_BLOCK_COMMENT_MODE:Te,C_LINE_COMMENT_MODE:lt,C_NUMBER_MODE:Rt,C_NUMBER_RE:de,END_SAME_AS_BEGIN:function(Z){return Object.assign(Z,{"on:begin":(Se,Ye)=>{Ye.data._beginMatch=Se[1]},"on:end":(Se,Ye)=>{Ye.data._beginMatch!==Se[1]&&Ye.ignoreMatch()}})},HASH_COMMENT_MODE:pe,IDENT_RE:O,MATCH_NOTHING_RE:V,METHOD_GUARD:xt,NUMBER_MODE:ut,NUMBER_RE:ie,PHRASAL_WORDS_MODE:ke,QUOTE_STRING_MODE:Re,REGEXP_MODE:St,RE_STARTERS_RE:le,SHEBANG:we,TITLE_MODE:be,UNDERSCORE_IDENT_RE:Q,UNDERSCORE_TITLE_MODE:Tt});function Ot(Z,Se){Z.input[Z.index-1]==="."&&Se.ignoreMatch()}function di(Z,Se){Z.className!==void 0&&(Z.scope=Z.className,delete Z.className)}function dt(Z,Se){Se&&Z.beginKeywords&&(Z.begin="\\b("+Z.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",Z.__beforeBegin=Ot,Z.keywords=Z.keywords||Z.beginKeywords,delete Z.beginKeywords,Z.relevance===void 0&&(Z.relevance=0))}function Ft(Z,Se){Array.isArray(Z.illegal)&&(Z.illegal=D(...Z.illegal))}function Vt(Z,Se){if(Z.match){if(Z.begin||Z.end)throw new Error("begin & end are not supported with match");Z.begin=Z.match,delete Z.match}}function zt(Z,Se){Z.relevance===void 0&&(Z.relevance=1)}const Qt=(Z,Se)=>{if(!Z.beforeMatch)return;if(Z.starts)throw new Error("beforeMatch cannot be used with starts");const Ye=Object.assign({},Z);Object.keys(Z).forEach(rt=>{delete Z[rt]}),Z.keywords=Ye.keywords,Z.begin=E(Ye.beforeMatch,p(Ye.begin)),Z.starts={relevance:0,contains:[Object.assign(Ye,{endsParent:!0})]},Z.relevance=0,delete Ye.beforeMatch},vt=["of","and","for","in","not","or","if","then","parent","list","value"],Pi="keyword";function Ai(Z,Se,Ye=Pi){const rt=Object.create(null);return typeof Z=="string"?Ut(Ye,Z.split(" ")):Array.isArray(Z)?Ut(Ye,Z):Object.keys(Z).forEach(function(se){Object.assign(rt,Ai(Z[se],Se,se))}),rt;function Ut(se,me){Se&&(me=me.map(Ne=>Ne.toLowerCase())),me.forEach(function(Ne){const Y=Ne.split("|");rt[Y[0]]=[se,hi(Y[0],Y[1])]})}}function hi(Z,Se){return Se?Number(Se):$i(Z)?0:1}function $i(Z){return vt.includes(Z.toLowerCase())}const Mi={},Ci=Z=>{console.error(Z)},Ji=(Z,...Se)=>{console.log(`WARN: ${Z}`,...Se)},Ki=(Z,Se)=>{Mi[`${Z}/${Se}`]||(console.log(`Deprecated as of ${Z}. ${Se}`),Mi[`${Z}/${Se}`]=!0)},Ri=new Error;function cn(Z,Se,{key:Ye}){let rt=0;const Ut=Z[Ye],se={},me={};for(let Ne=1;Ne<=Se.length;Ne++)me[Ne+rt]=Ut[Ne],se[Ne+rt]=!0,rt+=I(Se[Ne-1]);Z[Ye]=me,Z[Ye]._emit=se,Z[Ye]._multi=!0}function ft(Z){if(Array.isArray(Z.begin)){if(Z.skip||Z.excludeBegin||Z.returnBegin)throw Ci("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ri;if(typeof Z.beginScope!="object"||Z.beginScope===null)throw Ci("beginScope must be object"),Ri;cn(Z,Z.begin,{key:"beginScope"}),Z.begin=T(Z.begin,{joinWith:""})}}function Zt(Z){if(Array.isArray(Z.end)){if(Z.skip||Z.excludeEnd||Z.returnEnd)throw Ci("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ri;if(typeof Z.endScope!="object"||Z.endScope===null)throw Ci("endScope must be object"),Ri;cn(Z,Z.end,{key:"endScope"}),Z.end=T(Z.end,{joinWith:""})}}function fi(Z){Z.scope&&typeof Z.scope=="object"&&Z.scope!==null&&(Z.beginScope=Z.scope,delete Z.scope)}function Ni(Z){fi(Z),typeof Z.beginScope=="string"&&(Z.beginScope={_wrap:Z.beginScope}),typeof Z.endScope=="string"&&(Z.endScope={_wrap:Z.endScope}),ft(Z),Zt(Z)}function Ii(Z){function Se(me,Ne){return new RegExp(g(me),"m"+(Z.case_insensitive?"i":"")+(Z.unicodeRegex?"u":"")+(Ne?"g":""))}class Ye{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ne,Y){Y.position=this.position++,this.matchIndexes[this.matchAt]=Y,this.regexes.push([Y,Ne]),this.matchAt+=I(Ne)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ne=this.regexes.map(Y=>Y[1]);this.matcherRe=Se(T(Ne,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ne){this.matcherRe.lastIndex=this.lastIndex;const Y=this.matcherRe.exec(Ne);if(!Y)return null;const ze=Y.findIndex((xe,bt)=>bt>0&&xe!==void 0),He=this.matchIndexes[ze];return Y.splice(0,ze),Object.assign(Y,He)}}class rt{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ne){if(this.multiRegexes[Ne])return this.multiRegexes[Ne];const Y=new Ye;return this.rules.slice(Ne).forEach(([ze,He])=>Y.addRule(ze,He)),Y.compile(),this.multiRegexes[Ne]=Y,Y}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ne,Y){this.rules.push([Ne,Y]),Y.type==="begin"&&this.count++}exec(Ne){const Y=this.getMatcher(this.regexIndex);Y.lastIndex=this.lastIndex;let ze=Y.exec(Ne);if(this.resumingScanAtSamePosition()&&!(ze&&ze.index===this.lastIndex)){const He=this.getMatcher(0);He.lastIndex=this.lastIndex+1,ze=He.exec(Ne)}return ze&&(this.regexIndex+=ze.position+1,this.regexIndex===this.count&&this.considerAll()),ze}}function Ut(me){const Ne=new rt;return me.contains.forEach(Y=>Ne.addRule(Y.begin,{rule:Y,type:"begin"})),me.terminatorEnd&&Ne.addRule(me.terminatorEnd,{type:"end"}),me.illegal&&Ne.addRule(me.illegal,{type:"illegal"}),Ne}function se(me,Ne){const Y=me;if(me.isCompiled)return Y;[di,Vt,Ni,Qt].forEach(He=>He(me,Ne)),Z.compilerExtensions.forEach(He=>He(me,Ne)),me.__beforeBegin=null,[dt,Ft,zt].forEach(He=>He(me,Ne)),me.isCompiled=!0;let ze=null;return typeof me.keywords=="object"&&me.keywords.$pattern&&(me.keywords=Object.assign({},me.keywords),ze=me.keywords.$pattern,delete me.keywords.$pattern),ze=ze||/\w+/,me.keywords&&(me.keywords=Ai(me.keywords,Z.case_insensitive)),Y.keywordPatternRe=Se(ze,!0),Ne&&(me.begin||(me.begin=/\B|\b/),Y.beginRe=Se(Y.begin),!me.end&&!me.endsWithParent&&(me.end=/\B|\b/),me.end&&(Y.endRe=Se(Y.end)),Y.terminatorEnd=g(Y.end)||"",me.endsWithParent&&Ne.terminatorEnd&&(Y.terminatorEnd+=(me.end?"|":"")+Ne.terminatorEnd)),me.illegal&&(Y.illegalRe=Se(me.illegal)),me.contains||(me.contains=[]),me.contains=[].concat(...me.contains.map(function(He){return Wi(He==="self"?me:He)})),me.contains.forEach(function(He){se(He,Y)}),me.starts&&se(me.starts,Ne),Y.matcher=Ut(Y),Y}if(Z.compilerExtensions||(Z.compilerExtensions=[]),Z.contains&&Z.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return Z.classNameAliases=i(Z.classNameAliases||{}),se(Z)}function Bi(Z){return Z?Z.endsWithParent||Bi(Z.starts):!1}function Wi(Z){return Z.variants&&!Z.cachedVariants&&(Z.cachedVariants=Z.variants.map(function(Se){return i(Z,{variants:null},Se)})),Z.cachedVariants?Z.cachedVariants:Bi(Z)?i(Z,{starts:Z.starts?i(Z.starts):null}):Object.isFrozen(Z)?i(Z):Z}var Zi="11.11.1";class mi extends Error{constructor(Se,Ye){super(Se),this.name="HTMLInjectionError",this.html=Ye}}const Ke=t,Nt=i,Fi=Symbol("nomatch"),ki=7,_i=function(Z){const Se=Object.create(null),Ye=Object.create(null),rt=[];let Ut=!0;const se="Could not find the language '{}', did you forget to load/include a language module?",me={disableAutodetect:!0,name:"Plain text",contains:[]};let Ne={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:f};function Y(B){return Ne.noHighlightRe.test(B)}function ze(B){let H=B.className+" ";H+=B.parentNode?B.parentNode.className:"";const K=Ne.languageDetectRe.exec(H);if(K){const ce=Kt(K[1]);return ce||(Ji(se.replace("{}",K[1])),Ji("Falling back to no-highlight mode for this block.",B)),ce?K[1]:"no-highlight"}return H.split(/\s+/).find(ce=>Y(ce)||Kt(ce))}function He(B,H,K){let ce="",X="";typeof H=="object"?(ce=B,K=H.ignoreIllegals,X=H.language):(Ki("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ki("10.7.0",`Please use highlight(code, options) instead.
80
+ https://github.com/highlightjs/highlight.js/issues/2277`),X=B,ce=H),K===void 0&&(K=!0);const J={code:ce,language:X};pt("before:highlight",J);const he=J.result?J.result:xe(J.language,J.code,K);return he.code=J.code,pt("after:highlight",he),he}function xe(B,H,K,ce){const X=Object.create(null);function J(Pe,nt){return Pe.keywords[nt]}function he(){if(!Ie.keywords){Je.addText(Ve);return}let Pe=0;Ie.keywordPatternRe.lastIndex=0;let nt=Ie.keywordPatternRe.exec(Ve),At="";for(;nt;){At+=Ve.substring(Pe,nt.index);const Mt=Be.case_insensitive?nt[0].toLowerCase():nt[0],_t=J(Ie,Mt);if(_t){const[bi,wi]=_t;if(Je.addText(At),At="",X[Mt]=(X[Mt]||0)+1,X[Mt]<=ki&&(Xe+=wi),bi.startsWith("_"))At+=nt[0];else{const qi=Be.classNameAliases[bi]||bi;fe(nt[0],qi)}}else At+=nt[0];Pe=Ie.keywordPatternRe.lastIndex,nt=Ie.keywordPatternRe.exec(Ve)}At+=Ve.substring(Pe),Je.addText(At)}function Qe(){if(Ve==="")return;let Pe=null;if(typeof Ie.subLanguage=="string"){if(!Se[Ie.subLanguage]){Je.addText(Ve);return}Pe=xe(Ie.subLanguage,Ve,!0,Dt[Ie.subLanguage]),Dt[Ie.subLanguage]=Pe._top}else Pe=Ht(Ve,Ie.subLanguage.length?Ie.subLanguage:null);Ie.relevance>0&&(Xe+=Pe.relevance),Je.__addSublanguage(Pe._emitter,Pe.language)}function ae(){Ie.subLanguage!=null?Qe():he(),Ve=""}function fe(Pe,nt){Pe!==""&&(Je.startScope(nt),Je.addText(Pe),Je.endScope())}function Fe(Pe,nt){let At=1;const Mt=nt.length-1;for(;At<=Mt;){if(!Pe._emit[At]){At++;continue}const _t=Be.classNameAliases[Pe[At]]||Pe[At],bi=nt[At];_t?fe(bi,_t):(Ve=bi,he(),Ve=""),At++}}function ge(Pe,nt){return Pe.scope&&typeof Pe.scope=="string"&&Je.openNode(Be.classNameAliases[Pe.scope]||Pe.scope),Pe.beginScope&&(Pe.beginScope._wrap?(fe(Ve,Be.classNameAliases[Pe.beginScope._wrap]||Pe.beginScope._wrap),Ve=""):Pe.beginScope._multi&&(Fe(Pe.beginScope,nt),Ve="")),Ie=Object.create(Pe,{parent:{value:Ie}}),Ie}function Ee(Pe,nt,At){let Mt=M(Pe.endRe,At);if(Mt){if(Pe["on:end"]){const _t=new e(Pe);Pe["on:end"](nt,_t),_t.isMatchIgnored&&(Mt=!1)}if(Mt){for(;Pe.endsParent&&Pe.parent;)Pe=Pe.parent;return Pe}}if(Pe.endsWithParent)return Ee(Pe.parent,nt,At)}function ct(Pe){return Ie.matcher.regexIndex===0?(Ve+=Pe[0],1):(yt=!0,0)}function q(Pe){const nt=Pe[0],At=Pe.rule,Mt=new e(At),_t=[At.__beforeBegin,At["on:begin"]];for(const bi of _t)if(bi&&(bi(Pe,Mt),Mt.isMatchIgnored))return ct(nt);return At.skip?Ve+=nt:(At.excludeBegin&&(Ve+=nt),ae(),!At.returnBegin&&!At.excludeBegin&&(Ve=nt)),ge(At,Pe),At.returnBegin?0:nt.length}function re(Pe){const nt=Pe[0],At=H.substring(Pe.index),Mt=Ee(Ie,Pe,At);if(!Mt)return Fi;const _t=Ie;Ie.endScope&&Ie.endScope._wrap?(ae(),fe(nt,Ie.endScope._wrap)):Ie.endScope&&Ie.endScope._multi?(ae(),Fe(Ie.endScope,Pe)):_t.skip?Ve+=nt:(_t.returnEnd||_t.excludeEnd||(Ve+=nt),ae(),_t.excludeEnd&&(Ve=nt));do Ie.scope&&Je.closeNode(),!Ie.skip&&!Ie.subLanguage&&(Xe+=Ie.relevance),Ie=Ie.parent;while(Ie!==Mt.parent);return Mt.starts&&ge(Mt.starts,Pe),_t.returnEnd?0:nt.length}function Le(){const Pe=[];for(let nt=Ie;nt!==Be;nt=nt.parent)nt.scope&&Pe.unshift(nt.scope);Pe.forEach(nt=>Je.openNode(nt))}let tt={};function Me(Pe,nt){const At=nt&&nt[0];if(Ve+=Pe,At==null)return ae(),0;if(tt.type==="begin"&&nt.type==="end"&&tt.index===nt.index&&At===""){if(Ve+=H.slice(nt.index,nt.index+1),!Ut){const Mt=new Error(`0 width match regex (${B})`);throw Mt.languageName=B,Mt.badRule=tt.rule,Mt}return 1}if(tt=nt,nt.type==="begin")return q(nt);if(nt.type==="illegal"&&!K){const Mt=new Error('Illegal lexeme "'+At+'" for mode "'+(Ie.scope||"<unnamed>")+'"');throw Mt.mode=Ie,Mt}else if(nt.type==="end"){const Mt=re(nt);if(Mt!==Fi)return Mt}if(nt.type==="illegal"&&At==="")return Ve+=`
81
+ `,1;if(je>1e5&&je>nt.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ve+=At,At.length}const Be=Kt(B);if(!Be)throw Ci(se.replace("{}",B)),new Error('Unknown language: "'+B+'"');const Et=Ii(Be);let Ct="",Ie=ce||Et;const Dt={},Je=new Ne.__emitter(Ne);Le();let Ve="",Xe=0,mt=0,je=0,yt=!1;try{if(Be.__emitTokens)Be.__emitTokens(H,Je);else{for(Ie.matcher.considerAll();;){je++,yt?yt=!1:Ie.matcher.considerAll(),Ie.matcher.lastIndex=mt;const Pe=Ie.matcher.exec(H);if(!Pe)break;const nt=H.substring(mt,Pe.index),At=Me(nt,Pe);mt=Pe.index+At}Me(H.substring(mt))}return Je.finalize(),Ct=Je.toHTML(),{language:B,value:Ct,relevance:Xe,illegal:!1,_emitter:Je,_top:Ie}}catch(Pe){if(Pe.message&&Pe.message.includes("Illegal"))return{language:B,value:Ke(H),illegal:!0,relevance:0,_illegalBy:{message:Pe.message,index:mt,context:H.slice(mt-100,mt+100),mode:Pe.mode,resultSoFar:Ct},_emitter:Je};if(Ut)return{language:B,value:Ke(H),illegal:!1,relevance:0,errorRaised:Pe,_emitter:Je,_top:Ie};throw Pe}}function bt(B){const H={value:Ke(B),illegal:!1,relevance:0,_top:me,_emitter:new Ne.__emitter(Ne)};return H._emitter.addText(B),H}function Ht(B,H){H=H||Ne.languages||Object.keys(Se);const K=bt(B),ce=H.filter(Kt).filter(qe).map(ae=>xe(ae,B,!1));ce.unshift(K);const X=ce.sort((ae,fe)=>{if(ae.relevance!==fe.relevance)return fe.relevance-ae.relevance;if(ae.language&&fe.language){if(Kt(ae.language).supersetOf===fe.language)return 1;if(Kt(fe.language).supersetOf===ae.language)return-1}return 0}),[J,he]=X,Qe=J;return Qe.secondBest=he,Qe}function ri(B,H,K){const ce=H&&Ye[H]||K;B.classList.add("hljs"),B.classList.add(`language-${ce}`)}function ii(B){let H=null;const K=ze(B);if(Y(K))return;if(pt("before:highlightElement",{el:B,language:K}),B.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",B);return}if(B.children.length>0&&(Ne.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(B)),Ne.throwUnescapedHTML))throw new mi("One of your code blocks includes unescaped HTML.",B.innerHTML);H=B;const ce=H.textContent,X=K?He(ce,{language:K,ignoreIllegals:!0}):Ht(ce);B.innerHTML=X.value,B.dataset.highlighted="yes",ri(B,K,X.language),B.result={language:X.language,re:X.relevance,relevance:X.relevance},X.secondBest&&(B.secondBest={language:X.secondBest.language,relevance:X.secondBest.relevance}),pt("after:highlightElement",{el:B,result:X,text:ce})}function gi(B){Ne=Nt(Ne,B)}const qt=()=>{Ue(),Ki("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function vi(){Ue(),Ki("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Oe=!1;function Ue(){function B(){Ue()}if(document.readyState==="loading"){Oe||window.addEventListener("DOMContentLoaded",B,!1),Oe=!0;return}document.querySelectorAll(Ne.cssSelector).forEach(ii)}function Xt(B,H){let K=null;try{K=H(Z)}catch(ce){if(Ci("Language definition for '{}' could not be registered.".replace("{}",B)),Ut)Ci(ce);else throw ce;K=me}K.name||(K.name=B),Se[B]=K,K.rawDefinition=H.bind(null,Z),K.aliases&&ue(K.aliases,{languageName:B})}function Gt(B){delete Se[B];for(const H of Object.keys(Ye))Ye[H]===B&&delete Ye[H]}function Ei(){return Object.keys(Se)}function Kt(B){return B=(B||"").toLowerCase(),Se[B]||Se[Ye[B]]}function ue(B,{languageName:H}){typeof B=="string"&&(B=[B]),B.forEach(K=>{Ye[K.toLowerCase()]=H})}function qe(B){const H=Kt(B);return H&&!H.disableAutodetect}function it(B){B["before:highlightBlock"]&&!B["before:highlightElement"]&&(B["before:highlightElement"]=H=>{B["before:highlightBlock"](Object.assign({block:H.el},H))}),B["after:highlightBlock"]&&!B["after:highlightElement"]&&(B["after:highlightElement"]=H=>{B["after:highlightBlock"](Object.assign({block:H.el},H))})}function ot(B){it(B),rt.push(B)}function ht(B){const H=rt.indexOf(B);H!==-1&&rt.splice(H,1)}function pt(B,H){const K=B;rt.forEach(function(ce){ce[K]&&ce[K](H)})}function Jt(B){return Ki("10.7.0","highlightBlock will be removed entirely in v12.0"),Ki("10.7.0","Please use highlightElement now."),ii(B)}Object.assign(Z,{highlight:He,highlightAuto:Ht,highlightAll:Ue,highlightElement:ii,highlightBlock:Jt,configure:gi,initHighlighting:qt,initHighlightingOnLoad:vi,registerLanguage:Xt,unregisterLanguage:Gt,listLanguages:Ei,getLanguage:Kt,registerAliases:ue,autoDetection:qe,inherit:Nt,addPlugin:ot,removePlugin:ht}),Z.debugMode=function(){Ut=!1},Z.safeMode=function(){Ut=!0},Z.versionString=Zi,Z.regex={concat:E,lookahead:p,either:D,optional:b,anyNumberOfTimes:C};for(const B in et)typeof et[B]=="object"&&o(et[B]);return Object.assign(Z,et),Z},Ti=_i({});return Ti.newInstance=()=>_i({}),EC=Ti,Ti.HighlightJS=Ti,Ti.default=Ti,EC}var VU=zU();const m_=W9(VU),eA="[A-Za-z$_][0-9A-Za-z$_]*",jU=["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"],$U=["true","false","null","undefined","NaN","Infinity"],uF=["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"],hF=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],fF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],UU=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],qU=[].concat(fF,uF,hF);function gF(o){const e=o.regex,t=(_e,{after:lt})=>{const Te="</"+_e[0].slice(1);return _e.input.indexOf(Te,lt)!==-1},i=eA,n={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,r={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(_e,lt)=>{const Te=_e[0].length+_e.index,pe=_e.input[Te];if(pe==="<"||pe===","){lt.ignoreMatch();return}pe===">"&&(t(_e,{after:Te})||lt.ignoreMatch());let ut;const Rt=_e.input.substring(Te);if(ut=Rt.match(/^\s*=/)){lt.ignoreMatch();return}if((ut=Rt.match(/^\s+extends\s+/))&&ut.index===0){lt.ignoreMatch();return}}},a={$pattern:eA,keyword:jU,literal:$U,built_in:qU,"variable.language":UU},d="[0-9](_?[0-9])*",u=`\\.(${d})`,f="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${f})((${u})|\\.)?|(${u}))[eE][+-]?(${d})\\b`},{begin:`\\b(${f})\\b((${u})\\b|\\.)?|(${u})\\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},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,p],subLanguage:"css"}},E={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[o.BACKSLASH_ESCAPE,p]},I={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]},M=[o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,C,b,E,y,{match:/\$\d+/},g];p.contains=M.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(M)});const R=[].concat(I,p.contains),T=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(R)}]),V={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:T},O={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"}}]},Q={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:{_:[...uF,...hF]}},ie={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},de={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[V],illegal:/%/},te={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function le(_e){return e.concat("(?!",_e.join("|"),")")}const we={match:e.concat(/\b/,le([...fF,"super","import"].map(_e=>`${_e}\\s*\\(`)),i,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},oe={begin:e.concat(/\./,e.lookahead(e.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ye={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},V]},Re="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",ke={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Re)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[V]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:Q},illegal:/#(?![$_A-z])/,contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),ie,o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,C,b,E,y,I,{match:/\$\d+/},g,Q,{scope:"attr",match:i+e.lookahead(":"),relevance:0},ke,{begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[I,o.REGEXP_MODE,{className:"function",begin:Re,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:T}]}]},{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"]}]}]},de,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[V,o.inherit(o.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},oe,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[V]},we,te,O,ye,{match:/\$[(.]/}]}}function z9(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Zu=z9();function pF(o){Zu=o}var ld={exec:()=>null};function xh(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 $n(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(vo.caret,"$1"),t=t.replace(n,r),i},getRegex:()=>new RegExp(t,e)};return i}var GU=((o="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+o)}catch{return!1}})(),vo={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:xh(o=>new RegExp(`^ {0,${o}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:xh(o=>new RegExp(`^ {0,${o}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:xh(o=>new RegExp(`^ {0,${o}}(?:\`\`\`|~~~)`)),headingBeginRegex:xh(o=>new RegExp(`^ {0,${o}}#`)),htmlBeginRegex:xh(o=>new RegExp(`^ {0,${o}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:xh(o=>new RegExp(`^ {0,${o}}>`))},KU=/^(?:[ \t]*(?:\n|$))+/,ZU=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,XU=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Op=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,YU=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,V9=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,xF=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,mF=$n(xF).replace(/bull/g,V9).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(),QU=$n(xF).replace(/bull/g,V9).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(),j9=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,JU=/^[^\n]+/,$9=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,eq=$n(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",$9).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),tq=$n(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,V9).getRegex(),cb="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",U9=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,iq=$n("^ {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",U9).replace("tag",cb).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_F=$n(j9).replace("hr",Op).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",cb).getRegex(),nq=$n(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_F).getRegex(),q9={blockquote:nq,code:ZU,def:eq,fences:XU,heading:YU,hr:Op,html:iq,lheading:mF,list:tq,newline:KU,paragraph:_F,table:ld,text:JU},tA=$n("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Op).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",cb).getRegex(),sq={...q9,lheading:QU,table:tA,paragraph:$n(j9).replace("hr",Op).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",tA).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",cb).getRegex()},oq={...q9,html:$n(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",U9).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:ld,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$n(j9).replace("hr",Op).replace("heading",` *#{1,6} *[^
82
+ ]`).replace("lheading",mF).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},rq=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,aq=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,vF=/^( {2,}|\\)\n(?!\s*$)/,lq=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,tf=/[\p{P}\p{S}]/u,db=/[\s\p{P}\p{S}]/u,G9=/[^\s\p{P}\p{S}]/u,cq=$n(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,db).getRegex(),bF=/(?!~)[\p{P}\p{S}]/u,dq=/(?!~)[\s\p{P}\p{S}]/u,uq=/(?:[^\s\p{P}\p{S}]|~)/u,hq=$n(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",GU?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),CF=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,fq=$n(CF,"u").replace(/punct/g,tf).getRegex(),gq=$n(CF,"u").replace(/punct/g,bF).getRegex(),EF="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",pq=$n(EF,"gu").replace(/notPunctSpace/g,G9).replace(/punctSpace/g,db).replace(/punct/g,tf).getRegex(),xq=$n(EF,"gu").replace(/notPunctSpace/g,uq).replace(/punctSpace/g,dq).replace(/punct/g,bF).getRegex(),mq=$n("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,G9).replace(/punctSpace/g,db).replace(/punct/g,tf).getRegex(),_q=$n(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,tf).getRegex(),vq="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",bq=$n(vq,"gu").replace(/notPunctSpace/g,G9).replace(/punctSpace/g,db).replace(/punct/g,tf).getRegex(),Cq=$n(/\\(punct)/,"gu").replace(/punct/g,tf).getRegex(),Eq=$n(/^<(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(),yq=$n(U9).replace("(?:-->|$)","-->").getRegex(),wq=$n("^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",yq).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),__=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Sq=$n(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",__).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),yF=$n(/^!?\[(label)\]\[(ref)\]/).replace("label",__).replace("ref",$9).getRegex(),wF=$n(/^!?\[(ref)\](?:\[\])?/).replace("ref",$9).getRegex(),Dq=$n("reflink|nolink(?!\\()","g").replace("reflink",yF).replace("nolink",wF).getRegex(),iA=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,K9={_backpedal:ld,anyPunctuation:Cq,autolink:Eq,blockSkip:hq,br:vF,code:aq,del:ld,delLDelim:ld,delRDelim:ld,emStrongLDelim:fq,emStrongRDelimAst:pq,emStrongRDelimUnd:mq,escape:rq,link:Sq,nolink:wF,punctuation:cq,reflink:yF,reflinkSearch:Dq,tag:wq,text:lq,url:ld},Aq={...K9,link:$n(/^!?\[(label)\]\((.*?)\)/).replace("label",__).getRegex(),reflink:$n(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",__).getRegex()},qy={...K9,emStrongRDelimAst:xq,emStrongLDelim:gq,delLDelim:_q,delRDelim:bq,url:$n(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",iA).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:$n(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",iA).getRegex()},kq={...qy,br:$n(vF).replace("{2,}","*").getRegex(),text:$n(qy.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ex={normal:q9,gfm:sq,pedantic:oq},Sf={normal:K9,gfm:qy,breaks:kq,pedantic:Aq},Bq={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},nA=o=>Bq[o];function Fa(o,e){if(e){if(vo.escapeTest.test(o))return o.replace(vo.escapeReplace,nA)}else if(vo.escapeTestNoEncode.test(o))return o.replace(vo.escapeReplaceNoEncode,nA);return o}function sA(o){try{o=encodeURI(o).replace(vo.percentDecode,"%")}catch{return null}return o}function oA(o,e){var s;let t=o.replace(vo.findPipe,(r,a,d)=>{let u=!1,f=a;for(;--f>=0&&d[f]==="\\";)u=!u;return u?"|":" |"}),i=t.split(vo.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(vo.slashPipe,"|");return i}function Yl(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 rA(o){let e=o.split(`
83
+ `),t=e.length-1;for(;t>=0&&vo.blankLine.test(e[t]);)t--;return e.length-t<=2?o:e.slice(0,t+1).join(`
84
+ `)}function Fq(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 Lq(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 aA(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 d={type:o[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:r,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,d}function Iq(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 v_=class{constructor(o){bn(this,"options");bn(this,"rules");bn(this,"lexer");this.options=o||Zu}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]:rA(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=Iq(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=Yl(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:Yl(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:Yl(e[0],`
88
+ `)}}blockquote(o){let e=this.rules.block.blockquote.exec(o);if(e){let t=Yl(e[0],`
89
+ `).split(`
90
+ `),i="",n="",s=[];for(;t.length>0;){let r=!1,a=[],d;for(d=0;d<t.length;d++)if(this.rules.other.blockquoteStart.test(t[d]))a.push(t[d]),r=!0;else if(!r)a.push(t[d]);else break;t=t.slice(d);let u=a.join(`
91
+ `),f=u.replace(this.rules.other.blockquoteSetextReplace,`
92
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
93
+ ${u}`:u,n=n?`${n}
94
+ ${f}`:f;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,s,!0),this.lexer.state.top=g,t.length===0)break;let p=s.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){let C=p,b=C.raw+`
95
+ `+t.join(`
96
+ `),E=this.blockquote(b);s[s.length-1]=E,i=i.substring(0,i.length-C.raw.length)+E.raw,n=n.substring(0,n.length-C.text.length)+E.text;break}else if((p==null?void 0:p.type)==="list"){let C=p,b=C.raw+`
97
+ `+t.join(`
98
+ `),E=this.list(b);s[s.length-1]=E,i=i.substring(0,i.length-p.raw.length)+E.raw,n=n.substring(0,n.length-C.raw.length)+E.raw,t=b.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 d=!1,u="",f="";if(!(e=s.exec(o))||this.rules.block.hr.test(o))break;u=e[0],o=o.substring(u.length);let g=Lq(e[2].split(`
100
+ `,1)[0],e[1].length),p=o.split(`
101
+ `,1)[0],C=!g.trim(),b=0;if(this.options.pedantic?(b=2,f=g.trimStart()):C?b=e[1].length+1:(b=g.search(this.rules.other.nonSpaceChar),b=b>4?1:b,f=g.slice(b),b+=e[1].length),C&&this.rules.other.blankLine.test(p)&&(u+=p+`
102
+ `,o=o.substring(p.length+1),d=!0),!d){let E=this.rules.other.nextBulletRegex(b),y=this.rules.other.hrRegex(b),D=this.rules.other.fencesBeginRegex(b),I=this.rules.other.headingBeginRegex(b),M=this.rules.other.htmlBeginRegex(b),R=this.rules.other.blockquoteBeginRegex(b);for(;o;){let T=o.split(`
103
+ `,1)[0],V;if(p=T,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),V=p):V=p.replace(this.rules.other.tabCharGlobal," "),D.test(p)||I.test(p)||M.test(p)||R.test(p)||E.test(p)||y.test(p))break;if(V.search(this.rules.other.nonSpaceChar)>=b||!p.trim())f+=`
104
+ `+V.slice(b);else{if(C||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||D.test(g)||I.test(g)||y.test(g))break;f+=`
105
+ `+p}C=!p.trim(),u+=T+`
106
+ `,o=o.substring(T.length+1),g=V.slice(b)}}n.loose||(r?n.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(r=!0)),n.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),n.raw+=u}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 d of n.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let u=d.tokens[0];if(d.task&&((u==null?void 0:u.type)==="text"||(u==null?void 0:u.type)==="paragraph")){d.text=d.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let f=this.rules.other.listTaskCheckbox.exec(d.raw);if(f){let g={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};d.checked=g.checked,n.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=g.raw+d.tokens[0].raw,d.tokens[0].text=g.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(g)):d.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):d.tokens.unshift(g)}}else d.task&&(d.task=!1);if(!n.loose){let f=d.tokens.filter(p=>p.type==="space"),g=f.length>0&&f.some(p=>this.rules.other.anyLine.test(p.raw));n.loose=g}}if(n.loose)for(let d of n.items){d.loose=!0;for(let u of d.tokens)u.type==="text"&&(u.type="paragraph")}return n}}html(o){let e=this.rules.block.html.exec(o);if(e){let t=rA(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:Yl(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=oA(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:Yl(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(oA(a,s.header.length).map((d,u)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:s.align[u]})));return s}}lheading(o){let e=this.rules.block.lheading.exec(o);if(e){let t=e[1].trim();return{type:"heading",raw:Yl(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=Yl(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=Fq(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)),aA(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 aA(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,d=0,u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*o.length+n);(i=u.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)){d+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+d);let f=[...i[0]][0].length,g=o.slice(0,n+i.index+f+r);if(Math.min(n,r)%2){let C=g.slice(1,-1);return{type:"em",raw:g,text:C,tokens:this.lexer.inlineTokens(C)}}let p=g.slice(2,-2);return{type:"strong",raw:g,text:p,tokens:this.lexer.inlineTokens(p)}}}}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,d=this.rules.inline.delRDelim;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||(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 u=[...i[0]][0].length,f=o.slice(0,n+i.index+u+r),g=f.slice(n,-n);return{type:"del",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}}}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}}}},ia=class Gy{constructor(e){bn(this,"tokens");bn(this,"options");bn(this,"state");bn(this,"inlineQueue");bn(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Zu,this.options.tokenizer=this.options.tokenizer||new v_,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:vo,block:Ex.normal,inline:Sf.normal};this.options.pedantic?(t.block=Ex.pedantic,t.inline=Sf.pedantic):this.options.gfm&&(t.block=Ex.gfm,this.options.breaks?t.inline=Sf.breaks:t.inline=Sf.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ex,inline:Sf}}static lex(e,t){return new Gy(t).lex(e)}static lexInline(e,t){return new Gy(t).inlineTokens(e)}lex(e){e=e.replace(vo.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(vo.tabCharGlobal," ").replace(vo.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let d;if((r=(s=this.options.extensions)==null?void 0:s.block)!=null&&r.some(f=>(d=f.call({lexer:this},e,t))?(e=e.substring(d.raw.length),t.push(d),!0):!1))continue;if(d=this.tokenizer.space(e)){e=e.substring(d.raw.length);let f=t.at(-1);d.raw.length===1&&f!==void 0?f.raw+=`
113
+ `:t.push(d);continue}if(d=this.tokenizer.code(e)){e=e.substring(d.raw.length);let f=t.at(-1);(f==null?void 0:f.type)==="paragraph"||(f==null?void 0:f.type)==="text"?(f.raw+=(f.raw.endsWith(`
114
+ `)?"":`
115
+ `)+d.raw,f.text+=`
116
+ `+d.text,this.inlineQueue.at(-1).src=f.text):t.push(d);continue}if(d=this.tokenizer.fences(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.heading(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.hr(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.blockquote(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.list(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.html(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.def(e)){e=e.substring(d.raw.length);let f=t.at(-1);(f==null?void 0:f.type)==="paragraph"||(f==null?void 0:f.type)==="text"?(f.raw+=(f.raw.endsWith(`
117
+ `)?"":`
118
+ `)+d.raw,f.text+=`
119
+ `+d.raw,this.inlineQueue.at(-1).src=f.text):this.tokens.links[d.tag]||(this.tokens.links[d.tag]={href:d.href,title:d.title},t.push(d));continue}if(d=this.tokenizer.table(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.lheading(e)){e=e.substring(d.raw.length),t.push(d);continue}let u=e;if((a=this.options.extensions)!=null&&a.startBlock){let f=1/0,g=e.slice(1),p;this.options.extensions.startBlock.forEach(C=>{p=C.call({lexer:this},g),typeof p=="number"&&p>=0&&(f=Math.min(f,p))}),f<1/0&&f>=0&&(u=e.substring(0,f+1))}if(this.state.top&&(d=this.tokenizer.paragraph(u))){let f=t.at(-1);i&&(f==null?void 0:f.type)==="paragraph"?(f.raw+=(f.raw.endsWith(`
120
+ `)?"":`
121
+ `)+d.raw,f.text+=`
122
+ `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=f.text):t.push(d),i=u.length!==e.length,e=e.substring(d.raw.length);continue}if(d=this.tokenizer.text(e)){e=e.substring(d.raw.length);let f=t.at(-1);(f==null?void 0:f.type)==="text"?(f.raw+=(f.raw.endsWith(`
123
+ `)?"":`
124
+ `)+d.raw,f.text+=`
125
+ `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=f.text):t.push(d);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 u,f,g,p,C;this.tokenizer.lexer=this;let i=e,n=null;if(this.tokens.links){let b=Object.keys(this.tokens.links);if(b.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(i))!==null;)b.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=((f=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:f.call({lexer:this},i))??i;let r=!1,a="",d=1/0;for(;e;){if(e.length<d)d=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(a=""),r=!1;let b;if((p=(g=this.options.extensions)==null?void 0:g.inline)!=null&&p.some(y=>(b=y.call({lexer:this},e,t))?(e=e.substring(b.raw.length),t.push(b),!0):!1))continue;if(b=this.tokenizer.escape(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.tag(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.link(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(b.raw.length);let y=t.at(-1);b.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=b.raw,y.text+=b.text):t.push(b);continue}if(b=this.tokenizer.emStrong(e,i,a)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.codespan(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.br(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.del(e,i,a)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.autolink(e)){e=e.substring(b.raw.length),t.push(b);continue}if(!this.state.inLink&&(b=this.tokenizer.url(e))){e=e.substring(b.raw.length),t.push(b);continue}let E=e;if((C=this.options.extensions)!=null&&C.startInline){let y=1/0,D=e.slice(1),I;this.options.extensions.startInline.forEach(M=>{I=M.call({lexer:this},D),typeof I=="number"&&I>=0&&(y=Math.min(y,I))}),y<1/0&&y>=0&&(E=e.substring(0,y+1))}if(b=this.tokenizer.inlineText(E)){e=e.substring(b.raw.length),b.raw.slice(-1)!=="_"&&(a=b.raw.slice(-1)),r=!0;let y=t.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=b.raw,y.text+=b.text):t.push(b);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)}},b_=class{constructor(o){bn(this,"options");bn(this,"parser");this.options=o||Zu}space(o){return""}code({text:o,lang:e,escaped:t}){var s;let i=(s=(e||"").match(vo.notSpaceStart))==null?void 0:s[0],n=o.replace(vo.endingNewline,"")+`
126
+ `;return i?'<pre><code class="language-'+Fa(i)+'">'+(t?n:Fa(n,!0))+`</code></pre>
127
+ `:"<pre><code>"+(t?n:Fa(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>${Fa(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=sA(o);if(n===null)return i;o=n;let s='<a href="'+o+'"';return e&&(s+=' title="'+Fa(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=sA(o);if(n===null)return Fa(t);o=n;let s=`<img src="${o}" alt="${Fa(t)}"`;return e&&(s+=` title="${Fa(e)}"`),s+=">",s}text(o){return"tokens"in o&&o.tokens?this.parser.parseInline(o.tokens):"escaped"in o&&o.escaped?o.text:Fa(o.text)}},Z9=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}},na=class Ky{constructor(e){bn(this,"options");bn(this,"renderer");bn(this,"textRenderer");this.options=e||Zu,this.options.renderer=this.options.renderer||new b_,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Z9}static parse(e,t){return new Ky(t).parse(e)}static parseInline(e,t){return new Ky(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 d=r,u=this.options.extensions.renderers[d.type].call({parser:this},d);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){t+=u||"";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 d='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}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 u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=u||"";continue}}let d=a;switch(d.type){case"escape":{i+=t.text(d);break}case"html":{i+=t.html(d);break}case"link":{i+=t.link(d);break}case"image":{i+=t.image(d);break}case"checkbox":{i+=t.checkbox(d);break}case"strong":{i+=t.strong(d);break}case"em":{i+=t.em(d);break}case"codespan":{i+=t.codespan(d);break}case"br":{i+=t.br(d);break}case"del":{i+=t.del(d);break}case"text":{i+=t.text(d);break}default:{let u='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return i}},Sx,jf=(Sx=class{constructor(o){bn(this,"options");bn(this,"block");this.options=o||Zu}preprocess(o){return o}postprocess(o){return o}processAllTokens(o){return o}emStrongMask(o){return o}provideLexer(o=this.block){return o?ia.lex:ia.lexInline}provideParser(o=this.block){return o?na.parse:na.parseInline}},bn(Sx,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),bn(Sx,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Sx),Pq=class{constructor(...o){bn(this,"defaults",z9());bn(this,"options",this.setOptions);bn(this,"parse",this.parseMarkdown(!0));bn(this,"parseInline",this.parseMarkdown(!1));bn(this,"Parser",na);bn(this,"Renderer",b_);bn(this,"TextRenderer",Z9);bn(this,"Lexer",ia);bn(this,"Tokenizer",v_);bn(this,"Hooks",jf);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 d of a)t=t.concat(this.walkTokens(d.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 d=r[a].flat(1/0);t=t.concat(this.walkTokens(d,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 b_(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],d=n[r];n[r]=(...u)=>{let f=a.apply(n,u);return f===!1&&(f=d.apply(n,u)),f||""}}i.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new v_(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],d=n[r];n[r]=(...u)=>{let f=a.apply(n,u);return f===!1&&(f=d.apply(n,u)),f}}i.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new jf;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],d=n[r];jf.passThroughHooks.has(s)?n[r]=u=>{if(this.defaults.async&&jf.passThroughHooksRespectAsync.has(s))return(async()=>{let g=await a.call(n,u);return d.call(n,g)})();let f=a.call(n,u);return d.call(n,f)}:n[r]=(...u)=>{if(this.defaults.async)return(async()=>{let g=await a.apply(n,u);return g===!1&&(g=await d.apply(n,u)),g})();let f=a.apply(n,u);return f===!1&&(f=d.apply(n,u)),f}}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 ia.lex(o,e??this.defaults)}parser(o,e){return na.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?ia.lex:ia.lexInline)(r,n),d=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(d,n.walkTokens));let u=await(n.hooks?await n.hooks.provideParser(o):o?na.parse:na.parseInline)(d,n);return n.hooks?await n.hooks.postprocess(u):u})().catch(s);try{n.hooks&&(e=n.hooks.preprocess(e));let r=(n.hooks?n.hooks.provideLexer(o):o?ia.lex:ia.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?na.parse:na.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>"+Fa(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},Nu=new Pq;function Jn(o,e){return Nu.parse(o,e)}Jn.options=Jn.setOptions=function(o){return Nu.setOptions(o),Jn.defaults=Nu.defaults,pF(Jn.defaults),Jn};Jn.getDefaults=z9;Jn.defaults=Zu;Jn.use=function(...o){return Nu.use(...o),Jn.defaults=Nu.defaults,pF(Jn.defaults),Jn};Jn.walkTokens=function(o,e){return Nu.walkTokens(o,e)};Jn.parseInline=Nu.parseInline;Jn.Parser=na;Jn.parser=na.parse;Jn.Renderer=b_;Jn.TextRenderer=Z9;Jn.Lexer=ia;Jn.lexer=ia.lex;Jn.Tokenizer=v_;Jn.Hooks=jf;Jn.parse=Jn;Jn.options;Jn.setOptions;Jn.use;Jn.walkTokens;Jn.parseInline;na.parse;ia.lex;var Tq=F('<span class="chat-model svelte-10ayso4"><!></span>'),Mq=F('<button class="clear-btn svelte-10ayso4" title="New conversation">+</button>'),Rq=F('<p class="history-empty svelte-10ayso4">No saved conversations.</p>'),Nq=F('<li><button class="history-load svelte-10ayso4"> </button> <button class="history-del svelte-10ayso4" title="Delete">✕</button></li>'),Oq=F('<ul class="history-list svelte-10ayso4"></ul>'),Hq=F('<div class="history-panel svelte-10ayso4"><div class="history-hdr svelte-10ayso4"><span class="svelte-10ayso4">Conversations</span> <button class="new-conv-btn svelte-10ayso4">+ New</button></div> <!></div>'),Wq=F('<div class="unconfigured svelte-10ayso4">Configure an AI provider in the <strong class="svelte-10ayso4">Config</strong> tab to use the AI assistant.</div>'),zq=F('Chatting in context of <code class="svelte-10ayso4"> </code>',1),Vq=F('<button class="chip svelte-10ayso4"> </button>'),jq=F('<div class="suggestions svelte-10ayso4"><p class="suggestions-hint svelte-10ayso4"><!></p> <!></div>'),$q=F('<div class="msg-content user-text svelte-10ayso4"> </div>'),lA=F('<span class="tool-args svelte-10ayso4"> </span>'),cA=F('<div class="tool-event tool-call svelte-10ayso4"><span class="tool-icon svelte-10ayso4">🔧</span> <span class="tool-name svelte-10ayso4"> </span> <!></div>'),dA=F('<div class="tool-event tool-result svelte-10ayso4"><span class="tool-icon svelte-10ayso4">✓</span> <span class="tool-name svelte-10ayso4"> </span></div>'),uA=F('<div class="tool-events svelte-10ayso4"></div>'),hA=F('<div class="text-block svelte-10ayso4"></div>'),Uq=F('<button class="create-btn svelte-10ayso4">Save as new file…</button>'),qq=F('<span class="auto-badge svelte-10ayso4" title="Auto-applying AI code to this script in this session">auto ✓</span>'),Gq=F('<button class="apply-auto-btn svelte-10ayso4" title="Apply and always apply for this script in this session">always</button>'),Kq=F('<button class="apply-btn svelte-10ayso4">Apply</button> <!>',1),Zq=F('<button class="expand-btn svelte-10ayso4"> </button>'),Xq=F('<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>'),Yq=F('<!> <div class="msg-content svelte-10ayso4"></div>',1),Qq=F("<div><!></div>"),Jq=F('<div class="message assistant svelte-10ayso4"><div class="msg-content svelte-10ayso4"><span class="status-shimmer svelte-10ayso4"> </span></div></div>'),eG=F('<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>'),tG=F('<div class="message assistant streaming svelte-10ayso4"><div class="msg-content svelte-10ayso4"></div></div>'),iG=F('<div class="chat-error svelte-10ayso4"> </div>'),nG=F('<span class="ctx-indicator svelte-10ayso4"><svg width="12" height="12" viewBox="0 0 12 12" class="svelte-10ayso4"><circle cx="6" cy="6" r="5" fill="none" stroke="var(--border-sub)" stroke-width="2" class="svelte-10ayso4"></circle><circle cx="6" cy="6" r="5" fill="none" stroke-width="2" stroke-dashoffset="7.85" stroke-linecap="round" class="svelte-10ayso4"></circle></svg></span>'),sG=F('<span><span> </span> <span class="chip-name svelte-10ayso4"> </span> <button class="chip-remove svelte-10ayso4"> </button></span>'),oG=F('<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>'),rG=F('<button class="stop-btn svelte-10ayso4" title="Stop generation">■</button>'),aG=F('<button class="send-btn svelte-10ayso4">↑</button>'),lG=F('<option class="svelte-10ayso4"> </option>'),cG=F('<select class="model-select svelte-10ayso4"></select>'),dG=F('<span class="model-name svelte-10ayso4"> </span>'),uG=F('<button class="info-btn svelte-10ayso4" title="Model info">ℹ</button>'),hG=F('<div class="model-bar svelte-10ayso4"><span class="model-provider svelte-10ayso4"> </span> <!> <!></div>'),fG=F('<p class="info-status svelte-10ayso4">Loading…</p>'),gG=F('<p class="info-status info-err svelte-10ayso4"> </p>'),pG=F('<dt class="svelte-10ayso4">Ollama version</dt><dd class="svelte-10ayso4"> </dd>',1),xG=F('<dt class="svelte-10ayso4">Family</dt><dd class="svelte-10ayso4"> </dd>',1),mG=F('<dt class="svelte-10ayso4">Parameters</dt><dd class="svelte-10ayso4"> </dd>',1),_G=F('<dt class="svelte-10ayso4">Quantization</dt><dd class="svelte-10ayso4"> </dd>',1),vG=F('<dt class="svelte-10ayso4">Format</dt><dd class="svelte-10ayso4"> </dd>',1),bG=F('<div class="running-model svelte-10ayso4"> </div>'),CG=F('<dt class="svelte-10ayso4">Loaded</dt> <dd class="svelte-10ayso4"></dd>',1),EG=F('<dt class="svelte-10ayso4">Loaded</dt><dd class="dim svelte-10ayso4">Not in memory</dd>',1),yG=F('<dl class="svelte-10ayso4"><!> <!> <!> <!> <!> <!></dl>'),wG=F('<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>'),SG=F('<div class="chat-panel svelte-10ayso4"><div class="chat-header svelte-10ayso4"><span class="chat-title svelte-10ayso4">AI Assistant</span> <!> <button title="Conversation history"><svg width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" class="svelte-10ayso4"><circle cx="8" cy="8" r="6" class="svelte-10ayso4"></circle><polyline points="8,5 8,8 10,10" class="svelte-10ayso4"></polyline></svg></button> <!></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 DG(o,e){Os(e,!0),m_.registerLanguage("javascript",gF),Jn.use({breaks:!0,gfm:!0});let t=wu(e,"currentScript",3,null),i=wu(e,"extraFiles",31,()=>Di([])),n=P(Di([])),s=P(null),r=P(""),a=P(!1),d=P(""),u=P(null);const f="she:conversationId";function g(){return crypto.randomUUID().replace(/-/g,"").slice(0,16)}let p=P(Di(localStorage.getItem(f)??g())),C=P(Di([])),b=P(!1);zn(()=>{localStorage.setItem(f,c(p))});let E=P(Di([])),y=P(Di(localStorage.getItem("she:selectedModel")??"")),D=P(null);const I=It(()=>{var q;return c(D)!==null&&((q=t())==null?void 0:q.path)===c(D)});let M=P(Di(new Set)),R=P(!1),T=P(null),V=P(!1),O=P(""),Q=P(0),ie=null,de=P(0);const te=["[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 le=P(!0),we=P(!0),oe=P(!0),ye=P(!1),Re,ke=P(Di([])),_e,lt;const Te=It(()=>({apiref:c(le),tools:c(we)})),pe=It(()=>{var q;return((q=c(u))==null?void 0:q.configured)??!1}),ut=It(()=>{var q;return c(pe)||!!((q=c(u))!=null&&q.provider)&&!!c(y)}),Rt=It(()=>c(Q)+new TextEncoder().encode(c(r)).length),st=It(()=>c(oe)?t():null);zn(()=>{var re;const q=(re=t())==null?void 0:re.path;m(oe,!0),c(D)!==null&&q!==c(D)&&m(D,null)}),zn(()=>{var tt;if(!c(I))return;const q=c(n).at(-1);if(!q||q.role!=="assistant")return;const Le=be(q.content).find(Me=>Me.type==="code"&&Vt(Me.lang));if(Le){const Me=zt(Le.text);(tt=e.onApply)==null||tt.call(e,Me?Me.code:Le.text)}});async function St(){try{const q=await iF();m(u,q,!0),q.configured&&!c(y)&&m(y,q.model,!0)}catch{}}zn(()=>(window.addEventListener("she:config-changed",St),()=>window.removeEventListener("she:config-changed",St))),zn(()=>{c(y)&&localStorage.setItem("she:selectedModel",c(y))}),zn(()=>{var q;(q=c(u))!=null&&q.provider&&nF().then(re=>{m(E,re.models,!0),!c(y)&&re.models.length>0&&m(y,re.models[0],!0)}).catch(()=>{})}),zn(()=>{c(y),m(T,null),m(O,"")}),zn(()=>{var re,Le;if(((re=c(u))==null?void 0:re.provider)!=="ollama")return;const q=c(y)||((Le=c(u))==null?void 0:Le.model);!q||c(T)||$y(q).then(tt=>{m(T,tt,!0)}).catch(()=>{})}),zn(()=>{if(!c(a))return;m(de,Math.floor(Math.random()*te.length),!0);const q=setInterval(()=>{m(de,(c(de)+1)%te.length)},1e4);return()=>clearInterval(q)}),zn(()=>{var q;lt&&(c(n).length+(((q=c(s))==null?void 0:q.length)??0),requestAnimationFrame(()=>{lt&&(lt.scrollTop=lt.scrollHeight)}))}),zn(()=>{const q=c(Te),re=c(st),Le=i();c(ut)&&sF({context:q,currentScript:re??null,extraFiles:Le.length>0?Le:void 0}).then(tt=>{m(Q,new TextEncoder().encode(tt.prompt).length,!0)}).catch(()=>{})});function be(q){const re=q.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
145
+ $2
146
+ `),Le=[],tt=/```(\w*)\n([\s\S]*?)```/g;let Me=0,Be;for(;(Be=tt.exec(re))!==null;)Be.index>Me&&Le.push({type:"text",text:re.slice(Me,Be.index)}),Le.push({type:"code",lang:Be[1]||"text",text:Be[2].trimEnd()}),Me=Be.index+Be[0].length;return Me<re.length&&Le.push({type:"text",text:re.slice(Me)}),Le}const Tt=15;function xt(q){return q.split(`
147
+ `).length>Tt}function at(q){const re=new Set(c(M));re.has(q)?re.delete(q):re.add(q),m(M,re,!0)}function et(q,re){if(Vt(re))try{return m_.highlight(q,{language:"javascript"}).value}catch{}return q.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ot(q){return Jn.parse(q)}function di(q){const re=q.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
148
+ $2
149
+ `),Le=[],tt=/```(\w*)\n([\s\S]*?)```/g;let Me=0,Be;for(;(Be=tt.exec(re))!==null;)Be.index>Me&&Le.push({type:"text",text:re.slice(Me,Be.index)}),Le.push({type:"code",lang:Be[1]||"text",text:Be[2].trimEnd()}),Me=Be.index+Be[0].length;const Et=re.slice(Me),Ct=Et.match(/```(\w*)\n([\s\S]*)$/);return Ct?(Ct.index>0&&Le.push({type:"text",text:Et.slice(0,Ct.index)}),Le.push({type:"code",lang:Ct[1]||"text",text:Ct[2]})):Et&&Le.push({type:"text",text:Et}),Le}function dt(q){navigator.clipboard.writeText(q).catch(()=>{})}function Ft(q,re=!1){var Le;re&&t()&&m(D,t().path,!0),(Le=e.onApply)==null||Le.call(e,q)}function Vt(q){return!q||q==="js"||q==="javascript"}function zt(q){const re=q.match(/^\/\/ @new-file:\s*(\S+\.js)[ \t]*\n/);return re?{filename:re[1],code:q.slice(re[0].length)}:null}function Qt(q){return q>=1e9?`${(q/1e9).toFixed(1)} GB`:q>=1e6?`${(q/1e6).toFixed(0)} MB`:q>=1024?`${(q/1024).toFixed(1)} kB`:`${q} B`}async function vt(){if(m(R,!0),!(c(T)||c(V))){m(V,!0),m(O,"");try{m(T,await $y(c(y)||c(u).model),!0)}catch(q){m(O,q.message,!0)}m(V,!1)}}function Pi(q){const re=q.match(/\.([^.]+)$/);return re?re[1].toUpperCase():"?"}function Ai(q){switch(q){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return q}}function hi(q){i(i().filter((re,Le)=>Le!==q))}function $i(){Re.click()}async function Mi(q){if(!(!q||q.length===0))for(const re of Array.from(q)){const Le=await re.text();i([...i(),{name:re.name,content:Le}])}}function Ci(q){const re=q.target;Mi(re.files),re.value=""}function Ji(q){var re;q.preventDefault(),m(ye,!1),Mi(((re=q.dataTransfer)==null?void 0:re.files)??null)}function Ki(q){var re;(re=q.dataTransfer)!=null&&re.types.includes("Files")&&(q.preventDefault(),m(ye,!0))}function Ri(){m(ye,!1)}async function cn(){try{m(C,await K$(),!0)}catch{}}async function ft(){var re;if(c(n).length===0)return;const q=((re=c(n).find(Le=>Le.role==="user"))==null?void 0:re.content.slice(0,80))??c(p);try{await Z$(c(p),q,c(n)),await cn()}catch{}}async function Zt(q){try{const re=await ZD(q);m(n,re.messages,!0),m(p,q,!0),m(b,!1),m(d,"")}catch{}}async function fi(q){try{await X$(q),await cn(),q===c(p)&&Ni()}catch{}}function Ni(){m(n,[],!0),m(d,""),m(p,g(),!0),m(b,!1)}$s(async()=>{St();try{const q=await ZD(c(p));m(n,q.messages,!0)}catch{}await cn()});async function Ii(){const q=c(r).trim();if(!q||c(a))return;m(r,""),m(d,""),m(a,!0);const re={role:"user",content:q};m(n,[...c(n),re],!0),ie=new AbortController,m(ke,[],!0);try{await oF({messages:c(n),currentScript:c(st),context:c(Te),modelOverride:c(y)||void 0,extraFiles:i().length>0?i():void 0},Le=>{m(s,(c(s)??"")+Le)},ie.signal,Le=>{m(ke,[...c(ke),Le],!0)}),m(n,[...c(n),{role:"assistant",content:c(s)??"",toolEvents:c(ke).length>0?[...c(ke)]:void 0}],!0),m(ke,[],!0)}catch(Le){if(Le.name==="AbortError"){const tt=c(s);tt&&tt.trim()&&m(n,[...c(n),{role:"assistant",content:tt+`
150
+
151
+ *[stopped]*`,toolEvents:c(ke).length>0?[...c(ke)]:void 0}],!0)}else m(d,Le.message,!0)}finally{ie=null,m(s,null),m(ke,[],!0),m(a,!1),ft()}}function Bi(){ie==null||ie.abort()}function Wi(q){q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),Ii())}function Zi(){Ni()}const mi=["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 Ke(q){m(r,q,!0),_e==null||_e.focus()}var Nt=SG(),Fi=wt(Nt),ki=v(Fi),_i=_(v(ki),2);{var Ti=q=>{var re=Tq(),Le=v(re);{var tt=Et=>{var Ct=_o();j(()=>W(Ct,`${c(u).provider??""} · ${(c(y)||c(u).model)??""}`)),A(Et,Ct)},Me=Et=>{var Ct=_o();j(()=>W(Ct,`${c(u).provider??""} · pick a model below`)),A(Et,Ct)},Be=Et=>{var Ct=_o("Not configured");A(Et,Ct)};z(Le,Et=>{c(ut)?Et(tt):c(u).provider?Et(Me,1):Et(Be,-1)})}j(()=>ln(re,"title",`Provider: ${c(u).provider??""}`)),A(q,re)};z(_i,q=>{c(u)&&q(Ti)})}var Z=_(_i,2);let Se;var Ye=_(Z,2);{var rt=q=>{var re=Mq();$("click",re,Zi),A(q,re)};z(Ye,q=>{c(n).length>0&&q(rt)})}var Ut=_(ki,2);{var se=q=>{var re=Hq(),Le=v(re),tt=_(v(Le),2),Me=_(Le,2);{var Be=Ct=>{var Ie=Rq();A(Ct,Ie)},Et=Ct=>{var Ie=Oq();si(Ie,21,()=>c(C),Dt=>Dt.id,(Dt,Je)=>{var Ve=Nq();let Xe;var mt=v(Ve),je=v(mt),yt=_(mt,2);j(()=>{Xe=kt(Ve,1,"history-item svelte-10ayso4",null,Xe,{"history-active":c(Je).id===c(p)}),ln(mt,"title",c(Je).id),W(je,c(Je).title||c(Je).id)}),$("click",mt,()=>Zt(c(Je).id)),$("click",yt,()=>fi(c(Je).id)),A(Dt,Ve)}),A(Ct,Ie)};z(Me,Ct=>{c(C).length===0?Ct(Be):Ct(Et,-1)})}$("click",tt,Ni),A(q,re)};z(Ut,q=>{c(b)&&q(se)})}var me=_(Ut,2),Ne=v(me);{var Y=q=>{var re=Wq();A(q,re)},ze=q=>{var re=jq(),Le=v(re),tt=v(Le);{var Me=Ct=>{var Ie=zq(),Dt=_(wt(Ie)),Je=v(Dt);j(Ve=>W(Je,Ve),[()=>t().path.split("/").pop()]),A(Ct,Ie)},Be=Ct=>{var Ie=_o("No script open. Ask a general she scripting question.");A(Ct,Ie)};z(tt,Ct=>{t()?Ct(Me):Ct(Be,-1)})}var Et=_(Le,2);si(Et,17,()=>mi,Vi,(Ct,Ie)=>{var Dt=Vq(),Je=v(Dt);j(()=>W(Je,c(Ie))),$("click",Dt,()=>Ke(c(Ie))),A(Ct,Dt)}),A(q,re)};z(Ne,q=>{c(pe)?c(n).length===0&&c(s)===null&&q(ze,1):q(Y)})}var He=_(Ne,2);si(He,17,()=>c(n),Vi,(q,re,Le)=>{var tt=Qq(),Me=v(tt);{var Be=Ct=>{var Ie=$q(),Dt=v(Ie);j(()=>W(Dt,c(re).content)),A(Ct,Ie)},Et=Ct=>{const Ie=It(()=>be(c(re).content));var Dt=Yq(),Je=wt(Dt);{var Ve=mt=>{var je=uA();si(je,21,()=>c(re).toolEvents,Vi,(yt,Pe)=>{var nt=Ts(),At=wt(nt);{var Mt=bi=>{var wi=cA(),qi=_(v(wi),2),Oi=v(qi),Gi=_(qi,2);{var Si=ei=>{var Xi=lA(),Yi=v(Xi);j(An=>W(Yi,An),[()=>Object.entries(c(Pe).args).map(([An,Qn])=>`${An}=${JSON.stringify(Qn)}`).join(", ")]),A(ei,Xi)},ni=It(()=>c(Pe).args&&Object.keys(c(Pe).args).length>0);z(Gi,ei=>{c(ni)&&ei(Si)})}j(ei=>W(Oi,ei),[()=>c(Pe).name.replace(/_/g," ")]),A(bi,wi)},_t=bi=>{var wi=dA(),qi=_(v(wi),2),Oi=v(qi);j(Gi=>W(Oi,Gi),[()=>c(Pe).name.replace(/_/g," ")]),A(bi,wi)};z(At,bi=>{c(Pe).type==="tool_call"?bi(Mt):bi(_t,-1)})}A(yt,nt)}),A(mt,je)};z(Je,mt=>{var je;(je=c(re).toolEvents)!=null&&je.length&&mt(Ve)})}var Xe=_(Je,2);si(Xe,21,()=>c(Ie),Vi,(mt,je,yt)=>{var Pe=Ts(),nt=wt(Pe);{var At=_t=>{var bi=hA();dc(bi,()=>Ot(c(je).text),!0),A(_t,bi)},Mt=_t=>{const bi=It(()=>Vt(c(je).lang)?zt(c(je).text):null),wi=It(()=>c(bi)?c(bi).code:c(je).text),qi=It(()=>`${Le}:${yt}`),Oi=It(()=>xt(c(wi))),Gi=It(()=>c(M).has(c(qi)));var Si=Xq(),ni=v(Si),ei=v(ni),Xi=v(ei),Yi=_(ei,2),An=v(Yi),Qn=_(An,2);{var Es=qn=>{var ys=Uq();$("click",ys,()=>e.onCreateFile(c(bi).filename,c(bi).code)),A(qn,ys)},os=qn=>{var ys=Kq(),gr=wt(ys),pr=_(gr,2);{var er=xr=>{var va=qq();A(xr,va)},nl=xr=>{var va=Gq();$("click",va,()=>Ft(c(je).text,!0)),A(xr,va)};z(pr,xr=>{c(I)?xr(er):xr(nl,-1)})}$("click",gr,()=>Ft(c(je).text)),A(qn,ys)},Bs=It(()=>Vt(c(je).lang)&&t());z(Qn,qn=>{c(bi)&&e.onCreateFile?qn(Es):c(Bs)&&qn(os,1)})}var Sn=_(ni,2);let es;var as=v(Sn),zi=v(as);dc(zi,()=>et(c(wi),c(je).lang??""),!0);var Gs=_(as,2);{var Hn=qn=>{var ys=Zq(),gr=v(ys);j(()=>W(gr,c(Gi)?"▲ collapse":"▼ expand")),$("click",ys,()=>at(c(qi))),A(qn,ys)};z(Gs,qn=>{c(Oi)&&qn(Hn)})}j(()=>{W(Xi,c(bi)?`new: ${c(bi).filename}`:c(je).lang),es=kt(Sn,1,"code-body svelte-10ayso4",null,es,{collapsed:c(Oi)&&!c(Gi)})}),$("click",An,()=>dt(c(wi))),A(_t,Si)};z(nt,_t=>{c(je).type==="text"?_t(At):_t(Mt,-1)})}A(mt,Pe)}),A(Ct,Dt)};z(Me,Ct=>{c(re).role==="user"?Ct(Be):Ct(Et,-1)})}j(()=>kt(tt,1,`message ${c(re).role??""}`,"svelte-10ayso4")),A(q,tt)});var xe=_(He,2);{var bt=q=>{var re=uA();si(re,21,()=>c(ke),Vi,(Le,tt)=>{var Me=Ts(),Be=wt(Me);{var Et=Ie=>{var Dt=cA(),Je=_(v(Dt),2),Ve=v(Je),Xe=_(Je,2);{var mt=yt=>{var Pe=lA(),nt=v(Pe);j(At=>W(nt,At),[()=>Object.entries(c(tt).args).map(([At,Mt])=>`${At}=${JSON.stringify(Mt)}`).join(", ")]),A(yt,Pe)},je=It(()=>c(tt).args&&Object.keys(c(tt).args).length>0);z(Xe,yt=>{c(je)&&yt(mt)})}j(yt=>W(Ve,yt),[()=>c(tt).name.replace(/_/g," ")]),A(Ie,Dt)},Ct=Ie=>{var Dt=dA(),Je=_(v(Dt),2),Ve=v(Je);j(Xe=>W(Ve,Xe),[()=>c(tt).name.replace(/_/g," ")]),A(Ie,Dt)};z(Be,Ie=>{c(tt).type==="tool_call"?Ie(Et):Ie(Ct,-1)})}A(Le,Me)}),A(q,re)};z(xe,q=>{c(ke).length>0&&q(bt)})}var Ht=_(xe,2);{var ri=q=>{var re=Jq(),Le=v(re),tt=v(Le),Me=v(tt);j(()=>W(Me,te[c(de)])),A(q,re)};z(Ht,q=>{c(a)&&c(s)===null&&c(ke).length===0&&q(ri)})}var ii=_(Ht,2);{var gi=q=>{var re=tG(),Le=v(re);si(Le,21,()=>di(c(s)),Vi,(tt,Me)=>{var Be=Ts(),Et=wt(Be);{var Ct=Dt=>{var Je=hA();dc(Je,()=>Ot(c(Me).text),!0),A(Dt,Je)},Ie=Dt=>{var Je=eG(),Ve=v(Je),Xe=v(Ve),mt=v(Xe),je=_(Ve,2),yt=v(je);dc(yt,()=>et(c(Me).text,c(Me).lang??""),!0),j(()=>W(mt,c(Me).lang)),A(Dt,Je)};z(Et,Dt=>{c(Me).type==="text"?Dt(Ct):Dt(Ie,-1)})}A(tt,Be)}),A(q,re)};z(ii,q=>{c(s)!==null&&q(gi)})}cs(me,q=>lt=q,()=>lt);var qt=_(me,2);{var vi=q=>{var re=iG(),Le=v(re);j(()=>W(Le,c(d))),A(q,re)};z(qt,q=>{c(d)&&q(vi)})}var Oe=_(qt,2),Ue=v(Oe),Xt=v(Ue),Gt=_(Ue,2),Ei=v(Gt),Kt=_(Gt,2),ue=v(Kt),qe=_(ue);{var it=q=>{const re=It(()=>Math.min(100,Math.round(c(Rt)/4/c(T).contextLength*100)));var Le=nG(),tt=v(Le),Me=_(v(tt));j((Be,Et)=>{ln(Le,"title",`~${c(re)??""}% of ${Be??""} token context window used`),ln(Me,"stroke",c(re)>80?"var(--fg-err)":c(re)>50?"var(--fg-warn)":"var(--fg-ok)"),ln(Me,"stroke-dasharray",`${Et??""} 31.4`)},[()=>c(T).contextLength.toLocaleString(),()=>(c(re)/100*31.4).toFixed(1)]),A(q,Le)};z(qe,q=>{var re;(re=c(T))!=null&&re.contextLength&&q(it)})}var ot=_(Oe,2),ht=v(ot);{var pt=q=>{const re=It(()=>Pi(t().path.split("/").pop()??t().path));var Le=sG();let tt;var Me=v(Le),Be=v(Me),Et=_(Me,2),Ct=v(Et),Ie=_(Et,2),Dt=v(Ie);j((Je,Ve)=>{tt=kt(Le,1,"file-chip svelte-10ayso4",null,tt,{inactive:!c(oe)}),kt(Me,1,`badge badge-${Je??""}`,"svelte-10ayso4"),W(Be,Ve),W(Ct,t().path),ln(Ie,"title",c(oe)?"Remove from context":"Re-add to context"),W(Dt,c(oe)?"×":"+")},[()=>c(re).toLowerCase(),()=>Ai(c(re))]),$("click",Ie,()=>m(oe,!c(oe))),A(q,Le)};z(ht,q=>{t()&&q(pt)})}var Jt=_(ht,2);si(Jt,17,i,Vi,(q,re,Le)=>{const tt=It(()=>Pi(c(re).name));var Me=oG(),Be=v(Me),Et=v(Be),Ct=_(Be,2),Ie=v(Ct),Dt=_(Ct,2);j((Je,Ve)=>{kt(Be,1,`badge badge-${Je??""}`,"svelte-10ayso4"),W(Et,Ve),W(Ie,c(re).name)},[()=>c(tt).toLowerCase(),()=>Ai(c(tt))]),$("click",Dt,()=>hi(Le)),A(q,Me)});var B=_(Jt,2),H=_(B,2);cs(H,q=>Re=q,()=>Re);var K=_(ot,2);let ce;var X=v(K);let J;var he=v(X);cs(he,q=>_e=q,()=>_e);var Qe=_(X,2);{var ae=q=>{var re=rG();$("click",re,Bi),A(q,re)},fe=q=>{var re=aG();j(Le=>re.disabled=Le,[()=>!c(r).trim()||!c(ut)]),$("click",re,Ii),A(q,re)};z(Qe,q=>{c(a)?q(ae):q(fe,-1)})}var Fe=_(K,2);{var ge=q=>{var re=hG(),Le=v(re),tt=v(Le),Me=_(Le,2);{var Be=Dt=>{var Je=cG();si(Je,21,()=>c(E),Vi,(Ve,Xe)=>{var mt=lG(),je=v(mt),yt={};j(()=>{W(je,c(Xe)),yt!==(yt=c(Xe))&&(mt.value=(mt.__value=c(Xe))??"")}),A(Ve,mt)}),j(()=>Je.disabled=c(a)),Ss(Je,()=>c(y),Ve=>m(y,Ve)),A(Dt,Je)},Et=Dt=>{var Je=dG(),Ve=v(Je);j(()=>W(Ve,c(y)||c(u).model)),A(Dt,Je)};z(Me,Dt=>{c(E).length>0?Dt(Be):Dt(Et,-1)})}var Ct=_(Me,2);{var Ie=Dt=>{var Je=uG();$("click",Je,vt),A(Dt,Je)};z(Ct,Dt=>{c(u).provider==="ollama"&&Dt(Ie)})}j(()=>W(tt,c(u).provider)),A(q,re)};z(Fe,q=>{var re;(re=c(u))!=null&&re.provider&&(c(pe)||c(E).length>0)&&q(ge)})}var Ee=_(Fi,2);{var ct=q=>{var re=wG(),Le=v(re),tt=v(Le),Me=v(tt),Be=v(Me),Et=_(Me,2),Ct=_(tt,2),Ie=v(Ct);{var Dt=Xe=>{var mt=fG();A(Xe,mt)},Je=Xe=>{var mt=gG(),je=v(mt);j(()=>W(je,c(O))),A(Xe,mt)},Ve=Xe=>{var mt=yG(),je=v(mt);{var yt=ni=>{var ei=pG(),Xi=_(wt(ei)),Yi=v(Xi);j(()=>W(Yi,c(T).version)),A(ni,ei)};z(je,ni=>{c(T).version&&ni(yt)})}var Pe=_(je,2);{var nt=ni=>{var ei=xG(),Xi=_(wt(ei)),Yi=v(Xi);j(()=>W(Yi,c(T).details.family)),A(ni,ei)};z(Pe,ni=>{var ei;(ei=c(T).details)!=null&&ei.family&&ni(nt)})}var At=_(Pe,2);{var Mt=ni=>{var ei=mG(),Xi=_(wt(ei)),Yi=v(Xi);j(()=>W(Yi,c(T).details.parameter_size)),A(ni,ei)};z(At,ni=>{var ei;(ei=c(T).details)!=null&&ei.parameter_size&&ni(Mt)})}var _t=_(At,2);{var bi=ni=>{var ei=_G(),Xi=_(wt(ei)),Yi=v(Xi);j(()=>W(Yi,c(T).details.quantization_level)),A(ni,ei)};z(_t,ni=>{var ei;(ei=c(T).details)!=null&&ei.quantization_level&&ni(bi)})}var wi=_(_t,2);{var qi=ni=>{var ei=vG(),Xi=_(wt(ei)),Yi=v(Xi);j(()=>W(Yi,c(T).details.format)),A(ni,ei)};z(wi,ni=>{var ei;(ei=c(T).details)!=null&&ei.format&&ni(qi)})}var Oi=_(wi,2);{var Gi=ni=>{var ei=CG(),Xi=_(wt(ei),2);si(Xi,21,()=>c(T).running,Vi,(Yi,An)=>{var Qn=bG(),Es=v(Qn);j(os=>W(Es,`${c(An).name??""} · ${os??""} VRAM`),[()=>Qt(c(An).size_vram)]),A(Yi,Qn)}),A(ni,ei)},Si=ni=>{var ei=EG();A(ni,ei)};z(Oi,ni=>{c(T).running&&c(T).running.length>0?ni(Gi):c(T).running!==null&&ni(Si,1)})}A(Xe,mt)};z(Ie,Xe=>{c(V)?Xe(Dt):c(O)?Xe(Je,1):c(T)&&Xe(Ve,2)})}j(()=>{var Xe;return W(Be,`Ollama · ${(c(y)||((Xe=c(u))==null?void 0:Xe.model))??""}`)}),$("click",re,()=>m(R,!1)),$("click",Le,Xe=>Xe.stopPropagation()),$("click",Et,()=>m(R,!1)),A(q,re)};z(Ee,q=>{c(R)&&q(ct)})}j(q=>{Se=kt(Z,1,"icon-hdr-btn svelte-10ayso4",null,Se,{active:c(b)}),W(ue,q),ce=kt(K,1,"input-row svelte-10ayso4",null,ce,{"drag-over":c(ye)}),J=kt(X,1,"textarea-wrap svelte-10ayso4",null,J,{loading:c(a)}),ln(he,"placeholder",c(ut)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":c(pe)?"Select a model above to start chatting":"AI not configured"),he.disabled=c(a)||!c(ut)},[()=>Qt(c(Rt))]),$("click",Z,()=>m(b,!c(b))),Cs(Xt,()=>c(le),q=>m(le,q)),Cs(Ei,()=>c(we),q=>m(we,q)),$("click",B,$i),$("change",H,Ci),ls("dragover",K,Ki),ls("dragleave",K,Ri),ls("drop",K,Ji),$("keydown",he,Wi),jt(he,()=>c(r),q=>m(r,q)),A(o,Nt),Hs()}Us(["click","change","keydown"]);const AG={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"]},kG={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 Zy=[],Xy=[],Yy=[];const C_=new Map;let SF=[];const Qy=new Map,Jy=new Map;async function fA(){try{Zy=(await tF()).map(e=>e.topic)}catch{}}async function gA(){try{const[o,e]=await Promise.all([YB(),QB()]);Xy=o,Yy=e}catch{}}async function pA(){try{const o=await eF();SF=o.map(e=>e.nodeId),Qy.clear(),Jy.clear();for(const e of o)e.name&&(Qy.set(e.nodeId,e.name),Jy.set(e.name,e.nodeId));await Promise.all(o.map(async e=>{if(!C_.has(e.nodeId))try{C_.set(e.nodeId,await Xx(e.nodeId))}catch{}}))}catch{}}function BG(o){const e=/(?:she\.mqtt\.(?:sub|pub|get|set|link|age|getProp|or|and|max|min|timer)|she\.(?:getValue|setValue|getProp))\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*$/,d=o.match(a);if(d){const u=d[1],f=FG(u),g=LG(u);if(f===0)return{type:"matter-nodeId",prefix:g};if(f===1){const p=mh(u,0);if(p)return{type:"matter-endpointId",nodeId:p}}if(f===2){const p=mh(u,0),C=xA(u,1)??mh(u,1);if(p&&C!==null)return{type:"matter-cluster",nodeId:p,endpointId:C}}if(f>=3){const p=mh(u,0),C=xA(u,1)??mh(u,1),b=mh(u,2),E=/she\.matter\.send\s*\(/.test(o);if(p&&C!==null&&b)return{type:"matter-attr",nodeId:p,endpointId:C,cluster:b,isSend:E}}}return null}function FG(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 LG(o){const e=o.match(/['"]([^'"]*)\s*$/);return e?e[1]:""}function mh(o,e){var s;const i=(s=DF(o)[e])==null?void 0:s.trim();if(!i)return null;const n=i.match(/^['"](.*)['"]$/);return n?n[1]:null}function xA(o,e){var s;const i=(s=DF(o)[e])==null?void 0:s.trim();if(!i)return null;const n=parseInt(i,10);return isNaN(n)?null:n}function DF(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 Ou=rd.CompletionItemKind;function IG(o,e){return(e?Zy.filter(i=>i.startsWith(e)):Zy).map(i=>({label:i,kind:Ou.Value,insertText:i,range:o,detail:"MQTT topic",sortText:"0"+i}))}function PG(o,e,t){const i=t?[...Xy,...Yy]:Xy;return(e?i.filter(s=>s.startsWith(e)):i).map(s=>({label:s,kind:Ou.Value,insertText:s,range:o,detail:Yy.includes(s)?"sheDB view":"sheDB document",sortText:"0"+s}))}function TG(o,e){return SF.map(t=>{const i=Qy.get(t)??t;return e&&!i.startsWith(e)&&!t.startsWith(e)?null:{label:i,kind:Ou.Value,insertText:i,range:o,detail:i!==t?`Node ID: ${t}`:"Matter node",sortText:"0"+i}}).filter(Boolean)}function AF(o){return Jy.get(o)??o}function MG(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 RG(o,e){const t=C_.get(AF(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:Ou.Value,insertText:n,range:o,detail:i.name?`Endpoint ${i.endpointId} — ${s}`:`Clusters: ${s}`,sortText:"0"+String(i.endpointId).padStart(4,"0")}}):[]}function NG(o,e,t){const i=C_.get(AF(e));if(!i)return[];const n=MG(i,t);return n?n.clusters.map(s=>({label:s.name,kind:Ou.Value,insertText:s.name,range:o,detail:"Matter cluster",sortText:"0"+s.name})):[]}function OG(o,e,t){return(t?kG[e]??[]:AG[e]??[]).map(n=>({label:n,kind:t?Ou.Function:Ou.Property,insertText:n,range:o,detail:t?`${e} command`:`${e} attribute`,sortText:"0"+n}))}let mA=!1;function HG(){mA||(mA=!0,fA(),gA(),pA(),setInterval(fA,15e3),setInterval(gA,1e4),setInterval(pA,6e4),rd.registerCompletionItemProvider("javascript",{triggerCharacters:["'",'"',"(",","," "],provideCompletionItems(o,e){const t=o.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),i=BG(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:IG(a,i.prefix)};case"db":return{suggestions:PG(a,i.prefix,i.includeViews)};case"matter-nodeId":return{suggestions:TG(a,i.prefix)};case"matter-endpointId":return{suggestions:RG(a,i.nodeId)};case"matter-cluster":return{suggestions:NG(a,i.nodeId,i.endpointId)};case"matter-attr":return{suggestions:OG(a,i.cluster,i.isSend)};default:return null}}}))}var WG=F('<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),zG=F('<button class="svelte-1pyfjii">Show git history</button>'),VG=F('<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),jG=F('<div class="ctx-backdrop svelte-1pyfjii" role="presentation"></div> <div class="ctx-menu svelte-1pyfjii"><!></div>',1),$G=F('<div class="lib-tip-float svelte-1pyfjii">Library directory — files here are not auto-loaded as scripts</div>'),_A=F('<span class="git-mod svelte-1pyfjii" title="Uncommitted changes">M</span>'),UG=F('<ul class="tree-children svelte-1pyfjii"></ul>'),qG=F('<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" title="Library directory — files here are not auto-loaded as scripts"><input type="checkbox" class="svelte-1pyfjii"/> <span class="lib-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3h8a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H3V3z"></path><line x1="3" y1="12" x2="13" y2="12"></line><line x1="6" y1="3" x2="6" y2="12"></line></svg></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> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="6"></circle><line x1="3.8" y1="12.2" x2="12.2" y2="3.8"></line></svg></label></div> <!></li>'),GG=F('<span class="dirty-dot svelte-1pyfjii">●</span>'),KG=F('<span class="run-dot svelte-1pyfjii" title="Running">●</span>'),ZG=F('<span class="err-dot svelte-1pyfjii">●</span>'),XG=F('<label><input type="checkbox" class="svelte-1pyfjii"/> <span class="dis-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="6"></circle><line x1="3.8" y1="12.2" x2="12.2" y2="3.8"></line></svg></label>'),YG=F('<span class="dis-spacer svelte-1pyfjii"></span>'),QG=F('<li draggable="true"><div class="file-row svelte-1pyfjii"><button><span> </span> <span class="fname svelte-1pyfjii"> </span> <!><!> <!> <!></button> <!></div></li>'),JG=F('<div class="err svelte-1pyfjii"> </div>'),eK=F('<div class="history-empty svelte-1pyfjii">Loading…</div>'),tK=F('<div class="history-empty svelte-1pyfjii">No commits found.</div>'),iK=F('<button class="history-row svelte-1pyfjii"><span class="history-subject svelte-1pyfjii"> </span> <span class="history-meta svelte-1pyfjii"> </span></button>'),nK=F('<button class="history-load-more svelte-1pyfjii"> </button>'),sK=F("<!> <!>",1),oK=F('<div class="history-panel svelte-1pyfjii"><div class="history-resize-handle svelte-1pyfjii" role="separator"></div> <div class="history-hdr svelte-1pyfjii"><span class="history-title svelte-1pyfjii"> </span> <button class="history-close svelte-1pyfjii">✕</button></div> <div class="history-body svelte-1pyfjii"><!></div></div>'),rK=F('<span class="tab-dirty svelte-1pyfjii">●</span>'),aK=F('<div role="tab" tabindex="0"><span class="tab-label svelte-1pyfjii"> </span> <!> <button class="tab-close svelte-1pyfjii" title="Close">×</button></div>'),lK=F('<div class="tab-bar-wrap svelte-1pyfjii"><button class="tab-scroll-btn svelte-1pyfjii" aria-label="Scroll tabs left">‹</button> <div class="tab-bar svelte-1pyfjii" role="tablist"></div> <button class="tab-scroll-btn svelte-1pyfjii" aria-label="Scroll tabs right">›</button></div>'),cK=F('<li class="changes-item svelte-1pyfjii"><input type="checkbox" class="changes-check svelte-1pyfjii"/> <span class="changes-status svelte-1pyfjii"> </span> <span class="changes-file svelte-1pyfjii"> </span></li>'),dK=F('<div class="changes-err svelte-1pyfjii"> </div>'),uK=F('<div class="changes-backdrop svelte-1pyfjii" role="presentation"></div> <div class="changes-popup svelte-1pyfjii"><div class="changes-popup-hdr svelte-1pyfjii">Uncommitted changes</div> <ul class="changes-list svelte-1pyfjii"></ul> <div class="changes-commit-row svelte-1pyfjii"><input class="changes-msg-input svelte-1pyfjii" type="text" placeholder="Commit message…"/> <button class="changes-commit-btn svelte-1pyfjii"> </button></div> <!></div>',1),hK=F('<div class="changes-wrap svelte-1pyfjii"><button class="git-changes svelte-1pyfjii"> </button> <!></div>'),fK=F('<div class="changes-backdrop svelte-1pyfjii" role="presentation"></div> <div class="changes-popup svelte-1pyfjii"><div class="changes-popup-hdr svelte-1pyfjii"> </div> <div class="changes-commit-row svelte-1pyfjii"><button class="changes-commit-btn svelte-1pyfjii">Push</button></div></div>',1),gK=F('<div class="changes-wrap svelte-1pyfjii"><button class="git-ahead svelte-1pyfjii"> </button> <!></div>'),pK=F('<span class="git-behind svelte-1pyfjii"> </span>'),xK=F('<span class="git-status svelte-1pyfjii"><span class="git-branch svelte-1pyfjii"> </span> <!> <!> <!></span>'),mK=F('<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 &amp; Commit</button></div>',1),_K=F('<button class="danger svelte-1pyfjii">Delete</button>'),vK=F(`<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 class="welcome-shortcuts svelte-1pyfjii"><div class="welcome-shortcuts-title svelte-1pyfjii">Keyboard shortcuts</div> <div class="welcome-shortcuts-grid svelte-1pyfjii"><span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">S</kbd></span><span class="svelte-1pyfjii">Save</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">F</kbd></span><span class="svelte-1pyfjii">Find</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">H</kbd></span><span class="svelte-1pyfjii">Find &amp; Replace</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">G</kbd></span><span class="svelte-1pyfjii">Go to line</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">Z</kbd></span><span class="svelte-1pyfjii">Undo</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">Shift</kbd><kbd class="svelte-1pyfjii">Z</kbd></span><span class="svelte-1pyfjii">Redo</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">/</kbd></span><span class="svelte-1pyfjii">Toggle comment</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Alt</kbd><kbd class="svelte-1pyfjii">↑ / ↓</kbd></span><span class="svelte-1pyfjii">Move line up / down</span></div></div></div></div>`),bK=F('<button class="svelte-1pyfjii">Always accept in this session</button>'),CK=F('<button class="svelte-1pyfjii">Disable auto-accept</button>'),EK=F('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><!></div>',1),yK=F('<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>'),wK=F('<div class="history-diff-notice svelte-1pyfjii">Binary file — diff not available.</div>'),SK=F('<div class="diff-container svelte-1pyfjii"></div>'),DK=F('<div class="diff-overlay svelte-1pyfjii"><div class="diff-bar svelte-1pyfjii"><span class="diff-title svelte-1pyfjii">Commit <code> </code> → current — <em class="svelte-1pyfjii"> </em></span> <div class="diff-actions svelte-1pyfjii"><button class="discard-btn svelte-1pyfjii">Close</button></div></div> <!></div>'),AK=F('<div class="log-resize-handle svelte-1pyfjii" role="separator"></div>'),kK=F('<span class="log-file svelte-1pyfjii"> </span>'),BK=F("<option> </option>"),FK=F('<select class="log-filter-level svelte-1pyfjii"></select> <input class="log-filter-text svelte-1pyfjii" type="search" placeholder="Filter…"/> <label class="log-filter-regex svelte-1pyfjii" title="Interpret filter as a regular expression"><input type="checkbox" class="svelte-1pyfjii"/> <span class="log-filter-checkmark svelte-1pyfjii"></span> Regex</label> <button class="log-clear svelte-1pyfjii">Clear</button>',1),LK=F('<div><span class="ts svelte-1pyfjii"> </span> <span class="lvl svelte-1pyfjii"> </span> <span class="msg svelte-1pyfjii"> </span></div>'),IK=F('<span class="log-empty svelte-1pyfjii">No log output for this script.</span>'),PK=F('<div class="log-body svelte-1pyfjii"><!> <!></div>'),TK=F('<div class="chat-resize-handle svelte-1pyfjii" role="separator"></div> <div class="chat-container svelte-1pyfjii"><!></div>',1),MK=F('<!> <!> <!> <!> <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 RK(o,e){Os(e,!0);let t=P(Di([])),i=P(Di({})),n=P(null),s=P(null),r=P(null),a=P(null),d=P(Di([])),u=P(null),f=P(!1),g=P(""),p=P(!1),C=P(!0),b=P(null),E=P(!1),y=P(!1),D=P(null),I=P(Di([])),M=P(!1),R=P(30),T=P(void 0),V=null,O=null,Q=null,ie=P(!1),de=P(""),te=P(!1),le=P(void 0),we=P(Di(new Set));const oe=new Set;let ye=P(Di(new Set)),Re=P(Di([])),ke=P(void 0),_e=P(!1),lt=P(!1),Te=null;function pe(){c(ke)&&(m(_e,c(ke).scrollLeft>0),m(lt,c(ke).scrollLeft+c(ke).clientWidth<c(ke).scrollWidth-1))}function ut(G){var ve;(ve=c(ke))==null||ve.scrollBy({left:G*200,behavior:"smooth"})}zn(()=>{c(ke)&&(Te==null||Te.disconnect(),Te=new ResizeObserver(pe),Te.observe(c(ke)),pe())});let Rt=P("all"),st=P(""),St=P(!1);const be=["all","debug","info","warn","error"],Tt={debug:0,info:1,warn:2,error:3};function xt(G){if(c(Rt)!=="all"&&Tt[G.level]<Tt[c(Rt)])return!1;if(!c(st))return!0;if(c(St))try{return new RegExp(c(st),"i").test(G.msg)}catch{}return G.msg.toLowerCase().includes(c(st).toLowerCase())}let at=P(null);function et(G){const ve=G.currentTarget.getBoundingClientRect();m(at,{x:ve.left,y:ve.top},!0)}function Ot(){m(at,null)}let di,dt,Ft,Vt=!1,zt=null,Qt=null,vt=!1,Pi=!1,Ai=P(!1),hi=P(null),$i=P(!1),Mi=P(!1),Ci=P(void 0),Ji=null,Ki=null,Ri=null,cn=P(Di(parseInt(localStorage.getItem("she-scripts-sidebar-width")??"220",10))),ft=P(Di(parseInt(localStorage.getItem("she-scripts-log-height")??"130",10))),Zt=P(Di(parseInt(localStorage.getItem("she-scripts-chat-width")??"340",10))),fi=P(Di(parseInt(localStorage.getItem("she-scripts-history-height")??"220",10))),Ni=!1,Ii=0,Bi=0,Wi=!1,Zi=0,mi=0,Ke=!1,Nt=0,Fi=0,ki=!1,_i=0,Ti=0;const Z=It(()=>{var G;return c(u)&&c(bt)?{path:c(u),content:((G=c(bt).model)==null?void 0:G.getValue())??c(bt).savedContent}:null}),Se=It(()=>{var G;return new Set(((G=c(b))==null?void 0:G.changes.map(ve=>ve.file))??[])}),Ye=It(()=>{const G=new Set;for(const ve of c(Se)){const Ze=ve.split("/");for(let We=1;We<Ze.length;We++)G.add(Ze.slice(0,We).join("/"))}return G});let rt=P(!1),Ut=P(!1),se=P(""),me=P(!1),Ne=P(""),Y=P(Di(new Set));async function ze(){var G;if(!(!c(se).trim()||c(Y).size===0)){m(me,!0),m(Ne,"");try{const ve=c(b).changes.filter(Ze=>c(Y).has(Ze.file)).map(Ze=>Ze.file);if(ve.length===c(b).changes.length?await qD(c(se).trim()):await UD(ve,c(se).trim()),c(y))try{await Cx()}catch{}m(se,""),await ht(),(G=c(b))!=null&&G.changes.length?m(Y,new Set(c(b).changes.map(Ze=>Ze.file)),!0):m(rt,!1)}catch(ve){m(Ne,ve.message,!0)}finally{m(me,!1)}}}let He,xe,bt=It(()=>c(d).find(G=>G.path===c(u))??null);const Ht="she-tabs",ri="she-active-tab",ii="she-log-open",gi="she-chat-open";let qt=wu(e,"active",3,!0);zn(()=>{Pi&&(localStorage.setItem(Ht,JSON.stringify(c(d).map(G=>G.path))),c(u)?localStorage.setItem(ri,c(u)):localStorage.removeItem(ri))}),zn(()=>{Pi&&localStorage.setItem(gi,String(c(Ai)))}),zn(()=>{qt()&&dt&&dt.layout()});const vi=`
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
+ mqtt: {
165
+ sub(topic: string | string[], opts?: any, cb?: (topic: string, val: any, obj: any, prev: any, msg: any) => void): void;
166
+ pub(topic: string | string[], payload: any, opts?: { qos?: number; retain?: boolean }): void;
167
+ get(topic: string): any;
168
+ getProp(topic: string, ...prop: string[]): any;
169
+ link(source: string | string[], target: string | string[], value?: any): void;
170
+ age(topic: string): number;
171
+ or(srcs: string[], target: string | ((topic: string | null, val: 0 | 1) => void)): void;
172
+ and(srcs: string[], target: string | ((topic: string | null, val: 0 | 1) => void)): void;
173
+ max(srcs: string[], target: string | ((topic: string | null, val: number) => void)): void;
174
+ min(srcs: string[], target: string | ((topic: string | null, val: number) => void)): void;
175
+ timer(src: string | string[], ms: number, target: string | ((topic: string | null, val: 0 | 1) => void)): void;
176
+ };
177
+ http: {
178
+ fetch(url: string, opts?: RequestInit): Promise<any>;
179
+ sub(path: string, callback: (body: any, req: { params: any; query: any; headers: any }) => any): void;
180
+ };
181
+ api: {
182
+ get(path: string, handler: (req: any) => any): void;
183
+ post(path: string, handler: (req: any, body: any) => any): void;
184
+ put(path: string, handler: (req: any, body: any) => any): void;
185
+ delete(path: string, handler: (req: any) => any): void;
186
+ };
187
+ db: {
188
+ get(id: string): any;
189
+ set(id: string, doc: object): void;
190
+ extend(id: string, partial: object): void;
191
+ delete(id: string): void;
192
+ prop(id: string, method: 'set' | 'create' | 'del', prop: string, val?: any): void;
193
+ sub(pattern: string, callback: (id: string, doc: any) => void): void;
194
+ query(filter: string | null, mapFn: Function, reduceFn?: Function): any[];
195
+ };
196
+ matter: {
197
+ sub(nodeId: string, endpointId: number, cluster: string, attr: string, cb: (val: any, old: any) => void): number;
198
+ unsub(listenerId: number): void;
199
+ get(nodeId: string, endpointId: number, cluster: string, attr: string): Promise<any>;
200
+ send(nodeId: string, endpointId: number, cluster: string, command: string, args?: object): Promise<any>;
201
+ on(nodeId: string, endpointId: number, cluster: string, event: string, cb: (val: any) => void): number;
202
+ };
203
+ influx: {
204
+ query(fluxQuery: string): Promise<any[]>;
205
+ write(measurement: string, fields: object, tags?: object, timestamp?: number | Date): Promise<void>;
206
+ getLast(topic: string, n: number): Promise<Array<{ ts: number; val: any }>>;
207
+ getRange(topic: string, from: number | string | Date, to: number | string | Date): Promise<Array<{ ts: number; val: any }>>;
208
+ };
209
+ elastic: {
210
+ search(index: string, query: object): Promise<{ hits: any[]; total: number }>;
211
+ get(index: string, id: string): Promise<object | null>;
212
+ index(index: string, doc: object, id?: string): Promise<{ id: string }>;
213
+ find(index: string, field: string, text: string, size?: number): Promise<any[]>;
214
+ };
215
+ };
216
+ `;function Oe(G){c(d).some(ve=>ve.dirty)&&G.preventDefault()}$s(async()=>{var We;window.addEventListener("beforeunload",Oe),m(C,localStorage.getItem(ii)!=="false"),m(Ai,localStorage.getItem(gi)==="true"),rd.typescript.javascriptDefaults.addExtraLib(vi,"she-api.d.ts"),rd.typescript.javascriptDefaults.setCompilerOptions({target:rd.typescript.ScriptTarget.ES2022,allowNonTsExtensions:!0,checkJs:!0}),rd.typescript.javascriptDefaults.setDiagnosticsOptions({noSyntaxValidation:!1,noSemanticValidation:!0}),HG(),Ft=yr.createModel("","javascript"),dt=yr.create(di,{model:Ft,theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1}),dt.onDidChangeModelContent(()=>{if(Vt)return;const Wt=c(d).find(oi=>oi.path===c(u));Wt&&(Wt.dirty=dt.getValue()!==Wt.savedContent),yt&&clearTimeout(yt),yt=setTimeout(Pe,600)}),zt=H9(Wt=>{const oi=Wt.msg.match(/^([^:\n]+\.js):\s/);if(!oi)return;const ai=oi[1];if(Wt.level==="error")oe.add(ai),c(we).has(ai)||m(we,new Set([...c(we),ai]),!0);else if(oe.has(ai)){oe.delete(ai);const _n=new Set(c(we));_n.delete(ai),m(we,_n,!0)}const en=c(d).find(_n=>_n.path===ai);en&&(en.logEntries=[...en.logEntries.slice(-199),Wt],en.path===c(u)&&c(C)&&c(le)&&fd().then(()=>{c(le)&&(c(le).scrollTop=c(le).scrollHeight)}))}),Qt=ur("script:running",Wt=>{const oi=Wt.path;if(Wt.running)m(ye,new Set([...c(ye),oi]),!0);else{const ai=new Set(c(ye));ai.delete(oi),m(ye,ai,!0)}}),await Ue(),ht();try{const Wt=await Nl();typeof Wt.gitAutoCommit=="boolean"&&m(E,Wt.gitAutoCommit,!0),typeof Wt.gitAutoPush=="boolean"&&m(y,Wt.gitAutoPush,!0)}catch{}try{const Wt=await getDaemonStatus();m(ye,new Set(Wt.runningScripts??[]),!0)}catch{}const G=JSON.parse(localStorage.getItem(Ht)??"[]"),ve=localStorage.getItem(ri);for(const Wt of G)await ue(Wt,!1);const Ze=ve&&c(d).some(Wt=>Wt.path===ve)?ve:((We=c(d)[0])==null?void 0:We.path)??null;Ze&&await it(Ze),Pi=!0}),Dp(()=>{var G;window.removeEventListener("beforeunload",Oe),Te==null||Te.disconnect(),yt&&clearTimeout(yt),zt==null||zt(),Qt==null||Qt();for(const ve of c(d))(G=ve.model)==null||G.dispose();Ft==null||Ft.dispose(),dt==null||dt.dispose()});async function Ue(){try{if(m(t,await F$(),!0),!vt){let ve=function(Ze){for(const We of Ze)We.type==="dir"&&(G[We.path]=!0,We.children&&ve(We.children))};vt=!0;const G={};ve(c(t)),m(i,G,!0)}m(g,"")}catch(G){m(g,G.message,!0)}}function Xt(G){c(i)[G]=!c(i)[G]}function Gt(G){switch(G){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return G}}async function Ei(G,ve){try{ve?await id(`${G}/.shelib`,""):await bx(`${G}/.shelib`),await Ue(),await pt("all",ve?`lib ${G}`:`unlib ${G}`)}catch(Ze){m(g,Ze.message,!0)}}async function Kt(G,ve){const Ze=G.split("/").pop(),We=G.includes("/")?G.slice(0,G.lastIndexOf("/")):"",Wt=We?`${We}/.shedisable-${Ze}`:`.shedisable-${Ze}`;try{ve?await id(Wt,""):await bx(Wt),await Ue(),await pt("all",ve?`disable ${G}`:`enable ${G}`)}catch(oi){m(g,oi.message,!0)}}async function ue(G,ve=!0){var Ze;if(c(d).some(We=>We.path===G)){ve&&await it(G);return}try{const{content:We}=await vC(G),Wt=v7.parse(`file:///she-scripts/${encodeURIComponent(G)}`);(Ze=yr.getModel(Wt))==null||Ze.dispose();const oi=yr.createModel(We,je(G),Wt);m(d,[...c(d),{path:G,dirty:!1,savedContent:We,model:oi,logEntries:[]}],!0),ve&&await it(G)}catch(We){m(g,We.message,!0)}}async function qe(G){await ue(G,!0)}async function it(G){var Ze,We;const ve=c(d).find(Wt=>Wt.path===G);ve!=null&&ve.model&&(ae(),m(hi,null),m(u,G,!0),Vt=!0,dt.setModel(ve.model),Vt=!1,Pe(),await fd(),(We=(Ze=c(ke))==null?void 0:Ze.querySelector(`[data-tab-path="${CSS.escape(G)}"]`))==null||We.scrollIntoView({inline:"nearest",block:"nearest"}),pe())}async function ot(G){var We;const ve=c(d).find(Wt=>Wt.path===G);if(!ve||ve.dirty&&!await He.show(`Discard unsaved changes to ${G}?`,{confirm:"Discard"}))return;const Ze=c(d).findIndex(Wt=>Wt.path===G);if((We=ve.model)==null||We.dispose(),m(d,c(d).filter(Wt=>Wt.path!==G),!0),c(u)===G){const Wt=c(d)[Ze]??c(d)[Ze-1]??null;Wt?await it(Wt.path):(m(u,null),dt.setModel(Ft))}}async function ht(){try{m(b,await I$(),!0)}catch{m(b,null)}}async function pt(G,ve){if(c(b))try{if(G==="all"?await qD(ve):await UD(G,ve),c(y))try{await Cx()}catch{}await ht()}catch{}}async function Jt(){if(!c(u))return;const G=c(d).find(ve=>ve.path===c(u));if(G){m(f,!0);try{const ve=dt.getValue();await id(c(u),ve),G.savedContent=ve,G.dirty=!1,m(g,""),c(E)?await pt([c(u)],`update ${c(u)}`):ht()}catch(ve){m(g,ve.message,!0)}finally{m(f,!1)}}}async function B(){if(!c(u)||(await Jt(),c(g)))return;const G=await xe.show("Commit message:",{initial:`update ${c(u)}`,placeholder:"Update script",confirm:"Commit"});if(G)try{if(await M$(c(u),G),c(y))try{await Cx()}catch{}ht()}catch(ve){m(g,"Git: "+ve.message)}}async function H(){m(p,!1);try{await Cx(),await ht(),m(g,"")}catch(G){m(g,"Git push: "+G.message)}}function K(G){const ve=Date.now()-new Date(G).getTime(),Ze=Math.floor(ve/1e3);if(Ze<60)return"just now";const We=Math.floor(Ze/60);if(We<60)return`${We}m ago`;const Wt=Math.floor(We/60);if(Wt<24)return`${Wt}h ago`;const oi=Math.floor(Wt/24);if(oi<30)return`${oi}d ago`;const ai=Math.floor(oi/30);return ai<12?`${ai}mo ago`:`${Math.floor(ai/12)}y ago`}async function ce(G){Ee(),m(D,G,!0),m(I,[],!0),m(R,30),await X()}async function X(){if(c(D)){m(M,!0);try{m(I,await R$(c(D).path,c(R)),!0)}catch{}finally{m(M,!1)}}}async function J(){m(R,c(R)+30),await X()}function he(){m(D,null),m(I,[],!0),ae()}async function Qe(G){if(!c(D))return;ae(),await qe(c(D).path);let ve;try{ve=await N$(G.hash,c(D).path)}catch{return}if(m(de,G.hash,!0),m(te,ve.binary,!0),m(ie,!0),ve.binary||ve.content===null)return;let Ze="";const We=c(d).find(oi=>oi.path===c(D).path);if(We!=null&&We.model)Ze=We.model.getValue();else try{Ze=(await vC(c(D).path)).content}catch{}if(await fd(),!c(T))return;const Wt=je(c(D).path);O=yr.createModel(ve.content,Wt),Q=yr.createModel(Ze,Wt),V=yr.createDiffEditor(c(T),{theme:"vs-dark",readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),V.setModel({original:O,modified:Q})}function ae(){m(ie,!1),m(te,!1),V==null||V.dispose(),V=null,O==null||O.dispose(),O=null,Q==null||Q.dispose(),Q=null}async function fe(){const G=c(n)?`${c(n)}/`:"",ve=await xe.show("New script name:",{placeholder:G?`${G}myscript.js`:"myscript.js",initial:G,confirm:"Create"});if(!ve)return;const Ze=ve.endsWith(".js")?`/* global she */
217
+ 'use strict';
218
+
219
+ `:"";await id(ve,Ze),await Ue(),await ue(ve,!0)}async function Fe(){const G=c(n)?`${c(n)}/`:"",ve=await xe.show("New folder name:",{placeholder:G?`${G}subfolder`:"myfolder",initial:G,confirm:"Create"});ve&&(await L$(ve),c(i)[ve]=!0,await Ue())}function ge(G,ve){G.preventDefault(),m(s,{x:G.clientX,y:G.clientY,entry:ve},!0)}function Ee(){m(s,null)}async function ct(G){Ee(),m(n,G,!0),c(i)[G]=!0,await fe()}async function q(G){Ee(),m(n,G,!0),await Fe()}async function re(G){Ee();const ve=G.path.includes("/")?G.path.slice(0,G.path.lastIndexOf("/")+1):"",Ze=await xe.show(G.type==="dir"?"Rename folder:":"Rename script:",{initial:G.name,placeholder:G.name,confirm:"Rename"});if(!Ze||Ze===G.name)return;const We=ve+Ze;try{await $D(G.path,We);const Wt=c(d).find(oi=>oi.path===G.path);Wt&&(Wt.path=We,c(u)===G.path&&m(u,We)),await Ue(),await pt("all",`rename ${G.path} → ${We}`)}catch(Wt){m(g,Wt.message,!0)}}function Le(G){if(!G.children)return 0;let ve=0;for(const Ze of G.children)ve++,Ze.type==="dir"&&(ve+=Le(Ze));return ve}async function tt(G){Ee();let ve=`Delete ${G.type==="dir"?"folder":"file"} "${G.path}"?`;if(G.type==="dir"){const Ze=Le(G);Ze>0&&(ve+=` This will also delete ${Ze} item${Ze===1?"":"s"} inside.`)}if(await He.show(ve,{confirm:"Delete",danger:!0})){if(G.type==="dir")for(const Ze of[...c(d)])Ze.path.startsWith(G.path+"/")&&await ot(Ze.path);else await ot(G.path);await bx(G.path),await Ue(),await pt("all",`delete ${G.path}`)}}async function Me(G){Ee();const{content:ve}=await vC(G.path);c(Re).some(Ze=>Ze.name===G.path)||m(Re,[...c(Re),{name:G.path,content:ve}],!0),m(Ai,!0)}function Be(G,ve){var Ze;m(r,ve,!0),(Ze=G.dataTransfer)==null||Ze.setData("text/plain",ve)}function Et(G,ve){if(G.preventDefault(),c(r)&&(c(r)===ve||ve.startsWith(c(r)+"/"))){G.dataTransfer&&(G.dataTransfer.dropEffect="none"),m(a,null);return}G.dataTransfer&&(G.dataTransfer.dropEffect="move"),m(a,ve,!0)}function Ct(){m(a,null)}async function Ie(G,ve){var ai,en,_n;G.preventDefault(),m(a,null);const Ze=Array.from(((ai=G.dataTransfer)==null?void 0:ai.items)??[]).filter(un=>un.kind==="file");if(Ze.length>0&&!c(r)){for(const un of Ze){const an=(en=un.webkitGetAsEntry)==null?void 0:en.call(un);an&&await Dt(an,ve,!0)}await Ue();return}const We=c(r)??((_n=G.dataTransfer)==null?void 0:_n.getData("text/plain"));if(m(r,null),!We||We===ve||ve.startsWith(We+"/"))return;const Wt=We.split("/").pop(),oi=ve?`${ve}/${Wt}`:Wt;if(oi!==We)try{await $D(We,oi);for(const un of c(d))if(un.path===We)c(u)===We&&m(u,oi,!0),un.path=oi;else if(un.path.startsWith(We+"/")){const an=oi+un.path.slice(We.length);c(u)===un.path&&m(u,an),un.path=an}await Ue(),await pt("all",`rename ${We} → ${oi}`)}catch(un){m(g,un.message,!0)}}async function Dt(G,ve,Ze){if(G.isFile){const Wt=await(await new Promise((ai,en)=>G.file(ai,en))).text(),oi=ve?`${ve}/${G.name}`:G.name;await id(oi,Wt),Ze&&G.name.endsWith(".js")&&await Kt(oi,!0)}else if(G.isDirectory){const We=G.createReader();let Wt=[],oi;do oi=await new Promise((ai,en)=>We.readEntries(ai,en)),Wt=[...Wt,...oi];while(oi.length>0);for(const ai of Wt)await Dt(ai,ve?`${ve}/${G.name}`:G.name,!1);if(Ze){const ai=ve?`${ve}/${G.name}`:G.name;await Kt(ai,!0)}}}async function Je(){if(!c(u)||!await He.show(`Delete ${c(u)}?`,{confirm:"Delete",danger:!0}))return;const G=c(u);await ot(G),await bx(G),await Ue(),await pt("all",`delete ${G}`)}function Ve(){c(bt)&&(c(bt).logEntries=[])}function Xe(){m(C,!c(C)),localStorage.setItem(ii,String(c(C)))}function mt(G){return new Date(G).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function je(G){var We;const ve=((We=G.split(".").pop())==null?void 0:We.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"}[ve]??"plaintext"}let yt=null;async function Pe(){const G=c(d).find(Ze=>Ze.path===c(u));if(!(G!=null&&G.model))return;const ve=G.model;try{const oi=(await(await(await rd.typescript.getJavaScriptWorker())(ve.uri)).getSyntacticDiagnostics(ve.uri.toString())).map(ai=>{const en=ve.getPositionAt(ai.start??0),_n=ve.getPositionAt((ai.start??0)+(ai.length??0));return{severity:b7.Error,startLineNumber:en.lineNumber,startColumn:en.column,endLineNumber:_n.lineNumber,endColumn:_n.column,message:typeof ai.messageText=="string"?ai.messageText:JSON.stringify(ai.messageText),source:"she-syntax"}});if(yr.setModelMarkers(ve,"she-syntax",oi),c(u)){if(oi.length>0)oe.add(c(u)),c(we).has(c(u))||m(we,new Set([...c(we),c(u)]),!0);else if(oe.has(c(u))){oe.delete(c(u));const ai=new Set(c(we));ai.delete(c(u)),m(we,ai,!0)}}}catch{}}function nt(G){Ni=!0,Ii=G.clientX,Bi=c(cn),G.preventDefault()}function At(G){Wi=!0,Zi=G.clientY,mi=c(ft),G.preventDefault()}function Mt(G){Ke=!0,Nt=G.clientX,Fi=c(Zt),G.preventDefault()}function _t(G){ki=!0,_i=G.clientY,Ti=c(fi),G.preventDefault()}function bi(G){Ni&&m(cn,Math.max(140,Math.min(500,Bi+G.clientX-Ii)),!0),Wi&&m(ft,Math.max(60,Math.min(500,mi-(G.clientY-Zi))),!0),Ke&&m(Zt,Math.max(200,Math.min(700,Fi-(G.clientX-Nt))),!0),ki&&m(fi,Math.max(80,Math.min(600,Ti-(G.clientY-_i))),!0)}function wi(){Ni&&(Ni=!1,localStorage.setItem("she-scripts-sidebar-width",String(c(cn)))),Wi&&(Wi=!1,localStorage.setItem("she-scripts-log-height",String(c(ft)))),Ke&&(Ke=!1,localStorage.setItem("she-scripts-chat-width",String(c(Zt)))),ki&&(ki=!1,localStorage.setItem("she-scripts-history-height",String(c(fi))))}function qi(G){(G.ctrlKey||G.metaKey)&&G.key==="s"&&(G.preventDefault(),Jt()),G.key==="Escape"&&(m(p,!1),m(s,null),m(Ut,!1))}async function Oi(G,ve){const Ze=await xe.show("Save new script as:",{placeholder:"myscript.js",initial:G,confirm:"Create"});if(Ze)try{await id(Ze,ve),await Ue(),await ue(Ze,!0)}catch(We){m(g,We.message,!0)}}async function Gi(G){var Ze,We;if(c($i)&&c(u)){m(hi,G,!0),await Si();return}if(m(hi,G,!0),await fd(),!c(Ci))return;Ki==null||Ki.dispose(),Ri==null||Ri.dispose(),Ji==null||Ji.dispose();const ve=((We=(Ze=c(bt))==null?void 0:Ze.model)==null?void 0:We.getValue())??"";Ki=yr.createModel(ve,"javascript"),Ri=yr.createModel(G,"javascript"),Ji=yr.createDiffEditor(c(Ci),{theme:"vs-dark",readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),Ji.setModel({original:Ki,modified:Ri})}zn(()=>{c(u),m($i,!1),m(Mi,!1)});async function Si(){if(c(hi)===null||!c(u))return;const G=c(hi);m(hi,null);const ve=c(d).find(Ze=>Ze.path===c(u));ve!=null&&ve.model&&(Vt=!0,ve.model.setValue(G),Vt=!1,ve.dirty=!1,ve.savedContent=G);try{await id(c(u),G),m(g,""),c(E)?await pt([c(u)],`update ${c(u)}`):ht()}catch(Ze){m(g,Ze.message,!0)}ei()}function ni(){m(hi,null),ei()}function ei(){Ji==null||Ji.dispose(),Ji=null,Ki==null||Ki.dispose(),Ki=null,Ri==null||Ri.dispose(),Ri=null}var Xi=MK();ls("keydown",Dd,qi),ls("mousemove",Dd,bi),ls("mouseup",Dd,wi);var Yi=wt(Xi);cs(Zc(Yi,{}),G=>He=G,()=>He);var An=_(Yi,2);cs(WU(An,{}),G=>xe=G,()=>xe);var Qn=_(An,2);{var Es=G=>{var ve=jG(),Ze=wt(ve),We=_(Ze,2);let Wt;var oi=v(We);{var ai=_n=>{var un=WG(),an=wt(un),yn=_(an,2),mn=_(yn,4),Bn=_(mn,2);$("click",an,()=>ct(c(s).entry.path)),$("click",yn,()=>q(c(s).entry.path)),$("click",mn,()=>re(c(s).entry)),$("click",Bn,()=>tt(c(s).entry)),A(_n,un)},en=_n=>{var un=VG(),an=wt(un),yn=_(an,2),mn=_(yn,2),Bn=_(mn,2);{var vn=hn=>{var Fs=zG();$("click",Fs,()=>ce(c(s).entry)),A(hn,Fs)};z(Bn,hn=>{c(b)&&hn(vn)})}var Gn=_(Bn,4);$("click",an,()=>qe(c(s).entry.path)),$("click",yn,()=>re(c(s).entry)),$("click",mn,()=>Me(c(s).entry)),$("click",Gn,()=>tt(c(s).entry)),A(_n,un)};z(oi,_n=>{c(s).entry.type==="dir"?_n(ai):_n(en,-1)})}j(()=>Wt=qo(We,"",Wt,{left:`${c(s).x??""}px`,top:`${c(s).y??""}px`})),$("click",Ze,Ee),$("contextmenu",Ze,_n=>{_n.preventDefault(),Ee()}),A(G,ve)};z(Qn,G=>{c(s)&&G(Es)})}var os=_(Qn,2);{var Bs=G=>{var ve=$G();let Ze;j(()=>Ze=qo(ve,"",Ze,{left:`${c(at).x??""}px`,top:`${c(at).y-4}px`})),A(G,ve)};z(os,G=>{c(at)&&G(Bs)})}var Sn=_(os,2),es=v(Sn);let as;{const G=(Ze,We=Rv,Wt)=>{let oi=Tw(()=>A7(Wt==null?void 0:Wt(),!1));var ai=Ts(),en=wt(ai);{var _n=an=>{var yn=qG(),mn=v(yn);let Bn;var vn=v(mn);let Gn;var hn=_(vn,2);let Fs;var Ks=v(hn),so=_(hn,2);{var ws=Fn=>{var Ho=_A();A(Fn,Ho)},_s=It(()=>c(Se).has(We().path)||c(Ye).has(We().path));z(so,Fn=>{c(_s)&&Fn(ws)})}var vs=_(so,2),Ls=v(vs),gs=_(vs,2),ir=v(gs),Ea=_(mn,2);{var Is=Fn=>{var Ho=UG();si(Ho,21,()=>We().children,vr=>vr.path,(vr,br)=>{G(vr,()=>c(br),()=>We().disabled||c(oi))}),A(Fn,Ho)};z(Ea,Fn=>{c(i)[We().path]&&We().children&&Fn(Is)})}j(()=>{Bn=kt(mn,1,"dir-row svelte-1pyfjii",null,Bn,{"dir-selected":c(n)===We().path,"drag-target":c(a)===We().path}),ln(mn,"aria-selected",c(n)===We().path),Gn=kt(vn,1,"chevron svelte-1pyfjii",null,Gn,{open:c(i)[We().path]}),Fs=kt(hn,1,"dir-name svelte-1pyfjii",null,Fs,{lib:We().lib}),W(Ks,We().name),da(Ls,We().lib),da(ir,We().disabled)}),ls("dragstart",mn,Fn=>Be(Fn,We().path)),ls("dragover",mn,Fn=>Et(Fn,We().path)),ls("dragleave",mn,Ct),ls("drop",mn,Fn=>Ie(Fn,We().path)),$("contextmenu",mn,Fn=>ge(Fn,We())),$("click",vn,()=>Xt(We().path)),$("click",hn,()=>{m(n,We().path,!0),c(i)[We().path]=!0}),$("keydown",hn,Fn=>Fn.key==="Enter"&&m(n,We().path,!0)),ls("mouseenter",vs,et),ls("mouseleave",vs,Ot),$("change",Ls,()=>Ei(We().path,!We().lib)),$("change",ir,()=>Kt(We().path,!We().disabled)),A(an,yn)},un=an=>{const yn=It(()=>c(we).has(We().path)),mn=It(()=>c(Se).has(We().path)),Bn=It(()=>c(d).some(Mn=>Mn.path===We().path&&Mn.dirty)),vn=It(()=>(We().name.split(".").pop()??"txt").toUpperCase()),Gn=It(()=>We().name.endsWith(".js"));var hn=QG();let Fs;var Ks=v(hn),so=v(Ks);let ws;var _s=v(so);let vs;var Ls=v(_s),gs=_(_s,2),ir=v(gs),Ea=_(gs,2);{var Is=Mn=>{var Zs=_A();A(Mn,Zs)};z(Ea,Mn=>{c(mn)&&Mn(Is)})}var Fn=_(Ea);{var Ho=Mn=>{var Zs=GG();A(Mn,Zs)};z(Fn,Mn=>{c(Bn)&&Mn(Ho)})}var vr=_(Fn,2);{var br=Mn=>{var Zs=KG();A(Mn,Zs)},ff=It(()=>c(Gn)&&c(ye).has(We().path)&&!c(yn));z(vr,Mn=>{c(ff)&&Mn(br)})}var ya=_(vr,2);{var eh=Mn=>{var Zs=ZG();A(Mn,Zs)};z(ya,Mn=>{c(yn)&&Mn(eh)})}var qr=_(so,2);{var yb=Mn=>{var Zs=XG();let wa;var gf=v(Zs);j(()=>{wa=kt(Zs,1,"dis-label svelte-1pyfjii",null,wa,{"dis-locked":c(oi)}),ln(Zs,"title",c(oi)?"Disabled by parent directory":"Disable — this script will not be executed"),da(gf,We().disabled),gf.disabled=c(oi)}),$("change",gf,()=>Kt(We().path,!We().disabled)),A(Mn,Zs)},Gr=Mn=>{var Zs=YG();A(Mn,Zs)};z(qr,Mn=>{c(Gn)?Mn(yb):Mn(Gr,-1)})}j((Mn,Zs,wa)=>{Fs=kt(hn,1,"tree-file svelte-1pyfjii",null,Fs,Mn),ws=kt(so,1,"svelte-1pyfjii",null,ws,{lib:We().lib,dis:We().disabled,err:c(yn)}),vs=kt(_s,1,`badge badge-${Zs??""}`,"svelte-1pyfjii",vs,{"badge-shelib":We().lib}),W(Ls,wa),W(ir,We().name)},[()=>({active:c(d).some(Mn=>Mn.path===We().path),"active-tab":We().path===c(u)}),()=>c(vn).toLowerCase(),()=>Gt(c(vn))]),ls("dragstart",hn,Mn=>Be(Mn,We().path)),$("contextmenu",hn,Mn=>ge(Mn,We())),$("click",so,()=>qe(We().path)),A(an,hn)};z(en,an=>{We().type==="dir"?an(_n):an(un,-1)})}A(Ze,ai)};var zi=v(es),Gs=v(zi),Hn=_(Gs,2),qn=_(Hn,2),ys=_(zi,2);{var gr=Ze=>{var We=JG(),Wt=v(We);j(()=>W(Wt,c(g))),A(Ze,We)};z(ys,Ze=>{c(g)&&Ze(gr)})}var pr=_(ys,2),er=v(pr);let ve;var nl=_(er,2);si(nl,17,()=>c(t),Ze=>Ze.path,(Ze,We)=>{G(Ze,()=>c(We))});var xr=_(pr,2);{var va=Ze=>{var We=oK();let Wt;var oi=v(We),ai=_(oi,2),en=v(ai),_n=v(en),un=_(en,2),an=_(ai,2),yn=v(an);{var mn=Gn=>{var hn=eK();A(Gn,hn)},Bn=Gn=>{var hn=tK();A(Gn,hn)},vn=Gn=>{var hn=sK(),Fs=wt(hn);si(Fs,17,()=>c(I),ws=>ws.hash,(ws,_s)=>{var vs=iK(),Ls=v(vs),gs=v(Ls),ir=_(Ls,2),Ea=v(ir);j((Is,Fn)=>{W(gs,c(_s).subject),W(Ea,`${Is??""} · ${Fn??""}`)},[()=>c(_s).hash.slice(0,7),()=>K(c(_s).date)]),$("click",vs,()=>Qe(c(_s))),A(ws,vs)});var Ks=_(Fs,2);{var so=ws=>{var _s=nK(),vs=v(_s);j(()=>{_s.disabled=c(M),W(vs,c(M)?"Loading…":"Load more")}),$("click",_s,J),A(ws,_s)};z(Ks,ws=>{c(I).length>=c(R)&&ws(so)})}A(Gn,hn)};z(yn,Gn=>{c(M)&&c(I).length===0?Gn(mn):c(I).length===0?Gn(Bn,1):Gn(vn,-1)})}j(()=>{Wt=qo(We,"",Wt,{height:`${c(fi)??""}px`}),ln(en,"title",c(D).path),W(_n,`History: ${c(D).name??""}`)}),$("mousedown",oi,_t),$("click",un,he),A(Ze,We)};z(xr,Ze=>{c(D)&&Ze(va)})}j(()=>ve=kt(er,1,"tree-root-drop svelte-1pyfjii",null,ve,{"drag-target":c(a)===""})),$("click",Gs,fe),$("click",Hn,Fe),$("click",qn,Ue),ls("dragover",er,Ze=>Et(Ze,"")),ls("dragleave",er,Ct),ls("drop",er,Ze=>Ie(Ze,""))}var mr=_(es,2),ub=_(mr,2),tr=v(ub);{var hb=G=>{var ve=lK(),Ze=v(ve),We=_(Ze,2);si(We,21,()=>c(d),oi=>oi.path,(oi,ai)=>{var en=aK();let _n;var un=v(en),an=v(un),yn=_(un,2);{var mn=vn=>{var Gn=rK();A(vn,Gn)};z(yn,vn=>{c(ai).dirty&&vn(mn)})}var Bn=_(yn,2);j(vn=>{_n=kt(en,1,"tab svelte-1pyfjii",null,_n,{active:c(ai).path===c(u)}),ln(en,"data-tab-path",c(ai).path),W(an,vn)},[()=>c(ai).path.split("/").pop()]),$("click",en,()=>it(c(ai).path)),$("keydown",en,vn=>vn.key==="Enter"&&it(c(ai).path)),$("click",Bn,vn=>{vn.stopPropagation(),ot(c(ai).path)}),A(oi,en)}),cs(We,oi=>m(ke,oi),()=>c(ke));var Wt=_(We,2);j(()=>{Ze.disabled=!c(_e),Wt.disabled=!c(lt)}),$("click",Ze,()=>ut(-1)),ls("scroll",We,pe),ls("wheel",We,oi=>{oi.preventDefault(),c(ke).scrollLeft+=oi.deltaY,pe()}),$("click",Wt,()=>ut(1)),A(G,ve)};z(tr,G=>{c(d).length>0&&G(hb)})}var nf=_(tr,2),Ur=v(nf),Hp=v(Ur),sf=_(Ur,2);{var of=G=>{var ve=xK(),Ze=v(ve),We=v(Ze),Wt=_(Ze,2);{var oi=an=>{var yn=hK(),mn=v(yn),Bn=v(mn),vn=_(mn,2);{var Gn=hn=>{var Fs=uK(),Ks=wt(Fs),so=_(Ks,2),ws=_(v(so),2);si(ws,21,()=>c(b).changes,Vi,(Is,Fn)=>{var Ho=cK(),vr=v(Ho),br=_(vr,2),ff=v(br),ya=_(br,2),eh=v(ya);j(qr=>{da(vr,qr),W(ff,c(Fn).status),W(eh,c(Fn).file)},[()=>c(Y).has(c(Fn).file)]),$("change",vr,()=>{const qr=new Set(c(Y));qr.has(c(Fn).file)?qr.delete(c(Fn).file):qr.add(c(Fn).file),m(Y,qr,!0)}),A(Is,Ho)});var _s=_(ws,2),vs=v(_s),Ls=_(vs,2),gs=v(Ls),ir=_(_s,2);{var Ea=Is=>{var Fn=dK(),Ho=v(Fn);j(()=>W(Ho,c(Ne))),A(Is,Fn)};z(ir,Is=>{c(Ne)&&Is(Ea)})}j(Is=>{var Fn;Ls.disabled=Is,W(gs,c(me)?"…":c(Y).size===((Fn=c(b))==null?void 0:Fn.changes.length)?"Commit all":`Commit ${c(Y).size}`)},[()=>!c(se).trim()||c(me)||c(Y).size===0]),$("click",Ks,()=>m(rt,!1)),$("keydown",vs,Is=>Is.key==="Enter"&&ze()),jt(vs,()=>c(se),Is=>m(se,Is)),$("click",Ls,ze),A(hn,Fs)};z(vn,hn=>{c(rt)&&hn(Gn)})}j(()=>{ln(mn,"title",`${c(b).changes.length??""} uncommitted change(s) — click to view`),W(Bn,`✎${c(b).changes.length??""}`)}),$("click",mn,()=>{c(rt)||m(Y,new Set(c(b).changes.map(hn=>hn.file)),!0),m(rt,!c(rt)),m(Ne,"")}),A(an,yn)};z(Wt,an=>{c(b).changes.length>0&&an(oi)})}var ai=_(Wt,2);{var en=an=>{var yn=gK(),mn=v(yn),Bn=v(mn),vn=_(mn,2);{var Gn=hn=>{var Fs=fK(),Ks=wt(Fs),so=_(Ks,2),ws=v(so),_s=v(ws),vs=_(ws,2),Ls=v(vs);j(()=>W(_s,`${c(b).ahead??""} unpushed commit(s)`)),$("click",Ks,()=>m(Ut,!1)),$("click",Ls,()=>{m(Ut,!1),H()}),A(hn,Fs)};z(vn,hn=>{c(Ut)&&hn(Gn)})}j(()=>{ln(mn,"title",`${c(b).ahead??""} commit(s) ahead of upstream — click to push`),W(Bn,`↑${c(b).ahead??""}`)}),$("click",mn,()=>m(Ut,!c(Ut))),A(an,yn)};z(ai,an=>{c(b).ahead>0&&an(en)})}var _n=_(ai,2);{var un=an=>{var yn=pK(),mn=v(yn);j(()=>{ln(yn,"title",`${c(b).behind??""} commit(s) behind upstream`),W(mn,`↓${c(b).behind??""}`)}),A(an,yn)};z(_n,an=>{c(b).behind>0&&an(un)})}j(()=>{ln(Ze,"title",`Branch: ${c(b).branch??""}`),W(We,`⎇ ${c(b).branch??""}`)}),A(G,ve)};z(sf,G=>{c(b)&&G(of)})}var Wp=_(sf,2),rf=v(Wp),Xc=v(rf),fb=v(Xc),zp=_(Xc,2),af=_(rf,2);{var gb=G=>{var ve=mK(),Ze=wt(ve),We=_(Ze,2),Wt=v(We),oi=_(Wt,2);$("click",Ze,()=>m(p,!1)),$("click",Wt,()=>{m(p,!1),Jt()}),$("click",oi,()=>{m(p,!1),B()}),A(G,ve)};z(af,G=>{c(p)&&G(gb)})}var lf=_(Wp,2);{var Vp=G=>{var ve=_K();$("click",ve,Je),A(G,ve)};z(lf,G=>{c(u)&&G(Vp)})}var Ul=_(lf,2);let ba;var pb=_(nf,2),ql=v(pb),Do=v(ql),cf=v(Do);cs(cf,G=>di=G,()=>di);var df=_(cf,2);{var xb=G=>{var ve=vK();A(G,ve)};z(df,G=>{c(u)||G(xb)})}var Xu=_(df,2);{var uf=G=>{var ve=yK(),Ze=v(ve),We=v(Ze),Wt=_(v(We)),oi=v(Wt),ai=_(We,2),en=v(ai),_n=v(en),un=v(_n),an=v(un),yn=_(un,2),mn=_(_n,2);{var Bn=hn=>{var Fs=EK(),Ks=wt(Fs),so=_(Ks,2),ws=v(so);{var _s=Ls=>{var gs=bK();$("click",gs,()=>{m(Mi,!1),m($i,!0),Si()}),A(Ls,gs)},vs=Ls=>{var gs=CK();$("click",gs,()=>{m(Mi,!1),m($i,!1)}),A(Ls,gs)};z(ws,Ls=>{c($i)?Ls(vs,-1):Ls(_s)})}$("click",Ks,()=>m(Mi,!1)),A(hn,Fs)};z(mn,hn=>{c(Mi)&&hn(Bn)})}var vn=_(en,2),Gn=_(Ze,2);cs(Gn,hn=>m(Ci,hn),()=>c(Ci)),j(hn=>{W(oi,hn),W(an,c($i)?"Auto-accept ✓":"Accept")},[()=>{var hn;return(hn=c(u))==null?void 0:hn.split("/").pop()}]),$("click",un,Si),$("click",yn,()=>m(Mi,!c(Mi))),$("click",vn,ni),A(G,ve)};z(Xu,G=>{c(hi)!==null&&G(uf)})}var mb=_(Xu,2);{var _b=G=>{var ve=DK(),Ze=v(ve),We=v(Ze),Wt=_(v(We)),oi=v(Wt),ai=_(Wt,2),en=v(ai),_n=_(We,2),un=v(_n),an=_(Ze,2);{var yn=Bn=>{var vn=wK();A(Bn,vn)},mn=Bn=>{var vn=SK();cs(vn,Gn=>m(T,Gn),()=>c(T)),A(Bn,vn)};z(an,Bn=>{c(te)?Bn(yn):Bn(mn,-1)})}j(Bn=>{var vn;W(oi,Bn),W(en,(vn=c(D))==null?void 0:vn.name)},[()=>c(de).slice(0,7)]),$("click",un,ae),A(G,ve)};z(mb,G=>{c(ie)&&G(_b)})}var Yu=_(Do,2);let jp,Oo;var sl=v(Yu);{var vb=G=>{var ve=AK();$("mousedown",ve,At),A(G,ve)};z(sl,G=>{c(C)&&G(vb)})}var _r=_(sl,2),hf=v(_r),ol=v(hf),bb=_(ol);{var Yc=G=>{var ve=kK(),Ze=v(ve);j(We=>W(Ze,`— ${We??""}`),[()=>c(u).split("/").pop()]),A(G,ve)};z(bb,G=>{c(u)&&G(Yc)})}var $p=_(hf,2);{var Qu=G=>{var ve=FK(),Ze=wt(ve);si(Ze,21,()=>be,Vi,(en,_n)=>{var un=BK(),an=v(un),yn={};j(()=>{W(an,c(_n)),yn!==(yn=c(_n))&&(un.value=(un.__value=c(_n))??"")}),A(en,un)});var We=_(Ze,2),Wt=_(We,2),oi=v(Wt),ai=_(Wt,2);Ss(Ze,()=>c(Rt),en=>m(Rt,en)),jt(We,()=>c(st),en=>m(st,en)),Cs(oi,()=>c(St),en=>m(St,en)),$("click",ai,Ve),A(G,ve)};z($p,G=>{c(C)&&G(Qu)})}var Cb=_(_r,2);{var Ca=G=>{var ve=PK(),Ze=v(ve);si(Ze,17,()=>{var oi;return(((oi=c(bt))==null?void 0:oi.logEntries)??[]).filter(xt)},oi=>oi.ts+oi.msg,(oi,ai)=>{var en=LK(),_n=v(en),un=v(_n),an=_(_n,2),yn=v(an),mn=_(an,2),Bn=v(mn);j((vn,Gn)=>{kt(en,1,`log-line ${c(ai).level??""}`,"svelte-1pyfjii"),W(un,vn),W(yn,Gn),W(Bn,c(ai).msg)},[()=>mt(c(ai).ts),()=>c(ai).level.toUpperCase()]),A(oi,en)});var We=_(Ze,2);{var Wt=oi=>{var ai=IK();A(oi,ai)};z(We,oi=>{var ai;(((ai=c(bt))==null?void 0:ai.logEntries.length)??0)===0&&oi(Wt)})}cs(ve,oi=>m(le,oi),()=>c(le)),A(G,ve)};z(Cb,G=>{c(C)&&G(Ca)})}var Ju=_(ql,2);{var Eb=G=>{var ve=TK(),Ze=wt(ve),We=_(Ze,2);let Wt;var oi=v(We);DG(oi,{get currentScript(){return c(Z)},onApply:Gi,onCreateFile:Oi,get extraFiles(){return c(Re)},set extraFiles(ai){m(Re,ai,!0)}}),j(()=>Wt=qo(We,"",Wt,{width:`${c(Zt)??""}px`})),$("mousedown",Ze,Mt),A(G,ve)};z(Ju,G=>{c(Ai)&&G(Eb)})}j(()=>{var G;as=qo(es,"",as,{width:`${c(cn)??""}px`}),W(Hp,c(u)??"No file selected"),Xc.disabled=!((G=c(bt))!=null&&G.dirty)||c(f),W(fb,c(f)?"Saving…":"Save"),zp.disabled=!c(u),ba=kt(Ul,1,"ai-toggle svelte-1pyfjii",null,ba,{"ai-open":c(Ai)}),ln(Ul,"title",c(Ai)?"Close AI assistant":"Open AI assistant"),jp=kt(Yu,1,"log-panel svelte-1pyfjii",null,jp,{collapsed:!c(C)}),Oo=qo(Yu,"",Oo,{height:c(C)?`${c(ft)}px`:"26px"}),W(ol,`${c(C)?"▾":"▸"} Script Log `)}),$("mousedown",mr,nt),$("click",Xc,Jt),$("click",zp,()=>m(p,!c(p))),$("click",Ul,()=>m(Ai,!c(Ai))),$("click",hf,Xe),A(o,Xi),Hs()}Us(["click","contextmenu","keydown","change","mousedown"]);const kF="she-theme";function NK(){return localStorage.getItem(kF)??"dark"}function OK(o){localStorage.setItem(kF,o);const e=document.documentElement;o==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",o)}var $f={exports:{}};/* @preserve
220
+ * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
221
+ * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
222
+ */var HK=$f.exports,vA;function WK(){return vA||(vA=1,(function(o,e){(function(t,i){i(e)})(HK,(function(t){var i="1.9.4";function n(l){var h,x,w,k;for(x=1,w=arguments.length;x<w;x++){k=arguments[x];for(h in k)l[h]=k[h]}return l}var s=Object.create||(function(){function l(){}return function(h){return l.prototype=h,new l}})();function r(l,h){var x=Array.prototype.slice;if(l.bind)return l.bind.apply(l,x.call(arguments,1));var w=x.call(arguments,2);return function(){return l.apply(h,w.length?w.concat(x.call(arguments)):arguments)}}var a=0;function d(l){return"_leaflet_id"in l||(l._leaflet_id=++a),l._leaflet_id}function u(l,h,x){var w,k,N,ne;return ne=function(){w=!1,k&&(N.apply(x,k),k=!1)},N=function(){w?k=arguments:(l.apply(x,arguments),setTimeout(ne,h),w=!0)},N}function f(l,h,x){var w=h[1],k=h[0],N=w-k;return l===w&&x?l:((l-k)%N+N)%N+k}function g(){return!1}function p(l,h){if(h===!1)return l;var x=Math.pow(10,h===void 0?6:h);return Math.round(l*x)/x}function C(l){return l.trim?l.trim():l.replace(/^\s+|\s+$/g,"")}function b(l){return C(l).split(/\s+/)}function E(l,h){Object.prototype.hasOwnProperty.call(l,"options")||(l.options=l.options?s(l.options):{});for(var x in h)l.options[x]=h[x];return l.options}function y(l,h,x){var w=[];for(var k in l)w.push(encodeURIComponent(x?k.toUpperCase():k)+"="+encodeURIComponent(l[k]));return(!h||h.indexOf("?")===-1?"?":"&")+w.join("&")}var D=/\{ *([\w_ -]+) *\}/g;function I(l,h){return l.replace(D,function(x,w){var k=h[w];if(k===void 0)throw new Error("No value provided for variable "+x);return typeof k=="function"&&(k=k(h)),k})}var M=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"};function R(l,h){for(var x=0;x<l.length;x++)if(l[x]===h)return x;return-1}var T="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function V(l){return window["webkit"+l]||window["moz"+l]||window["ms"+l]}var O=0;function Q(l){var h=+new Date,x=Math.max(0,16-(h-O));return O=h+x,window.setTimeout(l,x)}var ie=window.requestAnimationFrame||V("RequestAnimationFrame")||Q,de=window.cancelAnimationFrame||V("CancelAnimationFrame")||V("CancelRequestAnimationFrame")||function(l){window.clearTimeout(l)};function te(l,h,x){if(x&&ie===Q)l.call(h);else return ie.call(window,r(l,h))}function le(l){l&&de.call(window,l)}var we={__proto__:null,extend:n,create:s,bind:r,get lastId(){return a},stamp:d,throttle:u,wrapNum:f,falseFn:g,formatNum:p,trim:C,splitWords:b,setOptions:E,getParamString:y,template:I,isArray:M,indexOf:R,emptyImageUrl:T,requestFn:ie,cancelFn:de,requestAnimFrame:te,cancelAnimFrame:le};function oe(){}oe.extend=function(l){var h=function(){E(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},x=h.__super__=this.prototype,w=s(x);w.constructor=h,h.prototype=w;for(var k in this)Object.prototype.hasOwnProperty.call(this,k)&&k!=="prototype"&&k!=="__super__"&&(h[k]=this[k]);return l.statics&&n(h,l.statics),l.includes&&(ye(l.includes),n.apply(null,[w].concat(l.includes))),n(w,l),delete w.statics,delete w.includes,w.options&&(w.options=x.options?s(x.options):{},n(w.options,l.options)),w._initHooks=[],w.callInitHooks=function(){if(!this._initHooksCalled){x.callInitHooks&&x.callInitHooks.call(this),this._initHooksCalled=!0;for(var N=0,ne=w._initHooks.length;N<ne;N++)w._initHooks[N].call(this)}},h},oe.include=function(l){var h=this.prototype.options;return n(this.prototype,l),l.options&&(this.prototype.options=h,this.mergeOptions(l.options)),this},oe.mergeOptions=function(l){return n(this.prototype.options,l),this},oe.addInitHook=function(l){var h=Array.prototype.slice.call(arguments,1),x=typeof l=="function"?l:function(){this[l].apply(this,h)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(x),this};function ye(l){if(!(typeof L>"u"||!L||!L.Mixin)){l=M(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 Re={on:function(l,h,x){if(typeof l=="object")for(var w in l)this._on(w,l[w],h);else{l=b(l);for(var k=0,N=l.length;k<N;k++)this._on(l[k],h,x)}return this},off:function(l,h,x){if(!arguments.length)delete this._events;else if(typeof l=="object")for(var w in l)this._off(w,l[w],h);else{l=b(l);for(var k=arguments.length===1,N=0,ne=l.length;N<ne;N++)k?this._off(l[N]):this._off(l[N],h,x)}return this},_on:function(l,h,x,w){if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}if(this._listens(l,h,x)===!1){x===this&&(x=void 0);var k={fn:h,ctx:x};w&&(k.once=!0),this._events=this._events||{},this._events[l]=this._events[l]||[],this._events[l].push(k)}},_off:function(l,h,x){var w,k,N;if(this._events&&(w=this._events[l],!!w)){if(arguments.length===1){if(this._firingCount)for(k=0,N=w.length;k<N;k++)w[k].fn=g;delete this._events[l];return}if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}var ne=this._listens(l,h,x);if(ne!==!1){var De=w[ne];this._firingCount&&(De.fn=g,this._events[l]=w=w.slice()),w.splice(ne,1)}}},fire:function(l,h,x){if(!this.listens(l,x))return this;var w=n({},h,{type:l,target:this,sourceTarget:h&&h.sourceTarget||this});if(this._events){var k=this._events[l];if(k){this._firingCount=this._firingCount+1||1;for(var N=0,ne=k.length;N<ne;N++){var De=k[N],Ge=De.fn;De.once&&this.off(l,Ge,De.ctx),Ge.call(De.ctx||this,w)}this._firingCount--}}return x&&this._propagateEvent(w),this},listens:function(l,h,x,w){typeof l!="string"&&console.warn('"string" type argument expected');var k=h;typeof h!="function"&&(w=!!h,k=void 0,x=void 0);var N=this._events&&this._events[l];if(N&&N.length&&this._listens(l,k,x)!==!1)return!0;if(w){for(var ne in this._eventParents)if(this._eventParents[ne].listens(l,h,x,w))return!0}return!1},_listens:function(l,h,x){if(!this._events)return!1;var w=this._events[l]||[];if(!h)return!!w.length;x===this&&(x=void 0);for(var k=0,N=w.length;k<N;k++)if(w[k].fn===h&&w[k].ctx===x)return k;return!1},once:function(l,h,x){if(typeof l=="object")for(var w in l)this._on(w,l[w],h,!0);else{l=b(l);for(var k=0,N=l.length;k<N;k++)this._on(l[k],h,x,!0)}return this},addEventParent:function(l){return this._eventParents=this._eventParents||{},this._eventParents[d(l)]=l,this},removeEventParent:function(l){return this._eventParents&&delete this._eventParents[d(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)}};Re.addEventListener=Re.on,Re.removeEventListener=Re.clearAllEventListeners=Re.off,Re.addOneTimeEventListener=Re.once,Re.fireEvent=Re.fire,Re.hasEventListeners=Re.listens;var ke=oe.extend(Re);function _e(l,h,x){this.x=x?Math.round(l):l,this.y=x?Math.round(h):h}var lt=Math.trunc||function(l){return l>0?Math.floor(l):Math.ceil(l)};_e.prototype={clone:function(){return new _e(this.x,this.y)},add:function(l){return this.clone()._add(Te(l))},_add:function(l){return this.x+=l.x,this.y+=l.y,this},subtract:function(l){return this.clone()._subtract(Te(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 _e(this.x*l.x,this.y*l.y)},unscaleBy:function(l){return new _e(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=lt(this.x),this.y=lt(this.y),this},distanceTo:function(l){l=Te(l);var h=l.x-this.x,x=l.y-this.y;return Math.sqrt(h*h+x*x)},equals:function(l){return l=Te(l),l.x===this.x&&l.y===this.y},contains:function(l){return l=Te(l),Math.abs(l.x)<=Math.abs(this.x)&&Math.abs(l.y)<=Math.abs(this.y)},toString:function(){return"Point("+p(this.x)+", "+p(this.y)+")"}};function Te(l,h,x){return l instanceof _e?l:M(l)?new _e(l[0],l[1]):l==null?l:typeof l=="object"&&"x"in l&&"y"in l?new _e(l.x,l.y):new _e(l,h,x)}function pe(l,h){if(l)for(var x=h?[l,h]:l,w=0,k=x.length;w<k;w++)this.extend(x[w])}pe.prototype={extend:function(l){var h,x;if(!l)return this;if(l instanceof _e||typeof l[0]=="number"||"x"in l)h=x=Te(l);else if(l=ut(l),h=l.min,x=l.max,!h||!x)return this;return!this.min&&!this.max?(this.min=h.clone(),this.max=x.clone()):(this.min.x=Math.min(h.x,this.min.x),this.max.x=Math.max(x.x,this.max.x),this.min.y=Math.min(h.y,this.min.y),this.max.y=Math.max(x.y,this.max.y)),this},getCenter:function(l){return Te((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,l)},getBottomLeft:function(){return Te(this.min.x,this.max.y)},getTopRight:function(){return Te(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,x;return typeof l[0]=="number"||l instanceof _e?l=Te(l):l=ut(l),l instanceof pe?(h=l.min,x=l.max):h=x=l,h.x>=this.min.x&&x.x<=this.max.x&&h.y>=this.min.y&&x.y<=this.max.y},intersects:function(l){l=ut(l);var h=this.min,x=this.max,w=l.min,k=l.max,N=k.x>=h.x&&w.x<=x.x,ne=k.y>=h.y&&w.y<=x.y;return N&&ne},overlaps:function(l){l=ut(l);var h=this.min,x=this.max,w=l.min,k=l.max,N=k.x>h.x&&w.x<x.x,ne=k.y>h.y&&w.y<x.y;return N&&ne},isValid:function(){return!!(this.min&&this.max)},pad:function(l){var h=this.min,x=this.max,w=Math.abs(h.x-x.x)*l,k=Math.abs(h.y-x.y)*l;return ut(Te(h.x-w,h.y-k),Te(x.x+w,x.y+k))},equals:function(l){return l?(l=ut(l),this.min.equals(l.getTopLeft())&&this.max.equals(l.getBottomRight())):!1}};function ut(l,h){return!l||l instanceof pe?l:new pe(l,h)}function Rt(l,h){if(l)for(var x=h?[l,h]:l,w=0,k=x.length;w<k;w++)this.extend(x[w])}Rt.prototype={extend:function(l){var h=this._southWest,x=this._northEast,w,k;if(l instanceof St)w=l,k=l;else if(l instanceof Rt){if(w=l._southWest,k=l._northEast,!w||!k)return this}else return l?this.extend(be(l)||st(l)):this;return!h&&!x?(this._southWest=new St(w.lat,w.lng),this._northEast=new St(k.lat,k.lng)):(h.lat=Math.min(w.lat,h.lat),h.lng=Math.min(w.lng,h.lng),x.lat=Math.max(k.lat,x.lat),x.lng=Math.max(k.lng,x.lng)),this},pad:function(l){var h=this._southWest,x=this._northEast,w=Math.abs(h.lat-x.lat)*l,k=Math.abs(h.lng-x.lng)*l;return new Rt(new St(h.lat-w,h.lng-k),new St(x.lat+w,x.lng+k))},getCenter:function(){return new St((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 St(this.getNorth(),this.getWest())},getSouthEast:function(){return new St(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 St||"lat"in l?l=be(l):l=st(l);var h=this._southWest,x=this._northEast,w,k;return l instanceof Rt?(w=l.getSouthWest(),k=l.getNorthEast()):w=k=l,w.lat>=h.lat&&k.lat<=x.lat&&w.lng>=h.lng&&k.lng<=x.lng},intersects:function(l){l=st(l);var h=this._southWest,x=this._northEast,w=l.getSouthWest(),k=l.getNorthEast(),N=k.lat>=h.lat&&w.lat<=x.lat,ne=k.lng>=h.lng&&w.lng<=x.lng;return N&&ne},overlaps:function(l){l=st(l);var h=this._southWest,x=this._northEast,w=l.getSouthWest(),k=l.getNorthEast(),N=k.lat>h.lat&&w.lat<x.lat,ne=k.lng>h.lng&&w.lng<x.lng;return N&&ne},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(l,h){return l?(l=st(l),this._southWest.equals(l.getSouthWest(),h)&&this._northEast.equals(l.getNorthEast(),h)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function st(l,h){return l instanceof Rt?l:new Rt(l,h)}function St(l,h,x){if(isNaN(l)||isNaN(h))throw new Error("Invalid LatLng object: ("+l+", "+h+")");this.lat=+l,this.lng=+h,x!==void 0&&(this.alt=+x)}St.prototype={equals:function(l,h){if(!l)return!1;l=be(l);var x=Math.max(Math.abs(this.lat-l.lat),Math.abs(this.lng-l.lng));return x<=(h===void 0?1e-9:h)},toString:function(l){return"LatLng("+p(this.lat,l)+", "+p(this.lng,l)+")"},distanceTo:function(l){return xt.distance(this,be(l))},wrap:function(){return xt.wrapLatLng(this)},toBounds:function(l){var h=180*l/40075017,x=h/Math.cos(Math.PI/180*this.lat);return st([this.lat-h,this.lng-x],[this.lat+h,this.lng+x])},clone:function(){return new St(this.lat,this.lng,this.alt)}};function be(l,h,x){return l instanceof St?l:M(l)&&typeof l[0]!="object"?l.length===3?new St(l[0],l[1],l[2]):l.length===2?new St(l[0],l[1]):null:l==null?l:typeof l=="object"&&"lat"in l?new St(l.lat,"lng"in l?l.lng:l.lon,l.alt):h===void 0?null:new St(l,h,x)}var Tt={latLngToPoint:function(l,h){var x=this.projection.project(l),w=this.scale(h);return this.transformation._transform(x,w)},pointToLatLng:function(l,h){var x=this.scale(h),w=this.transformation.untransform(l,x);return this.projection.unproject(w)},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,x=this.scale(l),w=this.transformation.transform(h.min,x),k=this.transformation.transform(h.max,x);return new pe(w,k)},infinite:!1,wrapLatLng:function(l){var h=this.wrapLng?f(l.lng,this.wrapLng,!0):l.lng,x=this.wrapLat?f(l.lat,this.wrapLat,!0):l.lat,w=l.alt;return new St(x,h,w)},wrapLatLngBounds:function(l){var h=l.getCenter(),x=this.wrapLatLng(h),w=h.lat-x.lat,k=h.lng-x.lng;if(w===0&&k===0)return l;var N=l.getSouthWest(),ne=l.getNorthEast(),De=new St(N.lat-w,N.lng-k),Ge=new St(ne.lat-w,ne.lng-k);return new Rt(De,Ge)}},xt=n({},Tt,{wrapLng:[-180,180],R:6371e3,distance:function(l,h){var x=Math.PI/180,w=l.lat*x,k=h.lat*x,N=Math.sin((h.lat-l.lat)*x/2),ne=Math.sin((h.lng-l.lng)*x/2),De=N*N+Math.cos(w)*Math.cos(k)*ne*ne,Ge=2*Math.atan2(Math.sqrt(De),Math.sqrt(1-De));return this.R*Ge}}),at=6378137,et={R:at,MAX_LATITUDE:85.0511287798,project:function(l){var h=Math.PI/180,x=this.MAX_LATITUDE,w=Math.max(Math.min(x,l.lat),-x),k=Math.sin(w*h);return new _e(this.R*l.lng*h,this.R*Math.log((1+k)/(1-k))/2)},unproject:function(l){var h=180/Math.PI;return new St((2*Math.atan(Math.exp(l.y/this.R))-Math.PI/2)*h,l.x*h/this.R)},bounds:(function(){var l=at*Math.PI;return new pe([-l,-l],[l,l])})()};function Ot(l,h,x,w){if(M(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=x,this._d=w}Ot.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 _e((l.x/h-this._b)/this._a,(l.y/h-this._d)/this._c)}};function di(l,h,x,w){return new Ot(l,h,x,w)}var dt=n({},xt,{code:"EPSG:3857",projection:et,transformation:(function(){var l=.5/(Math.PI*et.R);return di(l,.5,-l,.5)})()}),Ft=n({},dt,{code:"EPSG:900913"});function Vt(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function zt(l,h){var x="",w,k,N,ne,De,Ge;for(w=0,N=l.length;w<N;w++){for(De=l[w],k=0,ne=De.length;k<ne;k++)Ge=De[k],x+=(k?"L":"M")+Ge.x+" "+Ge.y;x+=h?xe.svg?"z":"x":""}return x||"M0 0"}var Qt=document.documentElement.style,vt="ActiveXObject"in window,Pi=vt&&!document.addEventListener,Ai="msLaunchUri"in navigator&&!("documentMode"in document),hi=He("webkit"),$i=He("android"),Mi=He("android 2")||He("android 3"),Ci=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),Ji=$i&&He("Google")&&Ci<537&&!("AudioNode"in window),Ki=!!window.opera,Ri=!Ai&&He("chrome"),cn=He("gecko")&&!hi&&!Ki&&!vt,ft=!Ri&&He("safari"),Zt=He("phantom"),fi="OTransition"in Qt,Ni=navigator.platform.indexOf("Win")===0,Ii=vt&&"transition"in Qt,Bi="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Mi,Wi="MozPerspective"in Qt,Zi=!window.L_DISABLE_3D&&(Ii||Bi||Wi)&&!fi&&!Zt,mi=typeof orientation<"u"||He("mobile"),Ke=mi&&hi,Nt=mi&&Bi,Fi=!window.PointerEvent&&window.MSPointerEvent,ki=!!(window.PointerEvent||Fi),_i="ontouchstart"in window||!!window.TouchEvent,Ti=!window.L_NO_TOUCH&&(_i||ki),Z=mi&&Ki,Se=mi&&cn,Ye=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,rt=(function(){var l=!1;try{var h=Object.defineProperty({},"passive",{get:function(){l=!0}});window.addEventListener("testPassiveEventSupport",g,h),window.removeEventListener("testPassiveEventSupport",g,h)}catch{}return l})(),Ut=(function(){return!!document.createElement("canvas").getContext})(),se=!!(document.createElementNS&&Vt("svg").createSVGRect),me=!!se&&(function(){var l=document.createElement("div");return l.innerHTML="<svg/>",(l.firstChild&&l.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),Ne=!se&&(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}})(),Y=navigator.platform.indexOf("Mac")===0,ze=navigator.platform.indexOf("Linux")===0;function He(l){return navigator.userAgent.toLowerCase().indexOf(l)>=0}var xe={ie:vt,ielt9:Pi,edge:Ai,webkit:hi,android:$i,android23:Mi,androidStock:Ji,opera:Ki,chrome:Ri,gecko:cn,safari:ft,phantom:Zt,opera12:fi,win:Ni,ie3d:Ii,webkit3d:Bi,gecko3d:Wi,any3d:Zi,mobile:mi,mobileWebkit:Ke,mobileWebkit3d:Nt,msPointer:Fi,pointer:ki,touch:Ti,touchNative:_i,mobileOpera:Z,mobileGecko:Se,retina:Ye,passiveEvents:rt,canvas:Ut,svg:se,vml:Ne,inlineSvg:me,mac:Y,linux:ze},bt=xe.msPointer?"MSPointerDown":"pointerdown",Ht=xe.msPointer?"MSPointerMove":"pointermove",ri=xe.msPointer?"MSPointerUp":"pointerup",ii=xe.msPointer?"MSPointerCancel":"pointercancel",gi={touchstart:bt,touchmove:Ht,touchend:ri,touchcancel:ii},qt={touchstart:it,touchmove:qe,touchend:qe,touchcancel:qe},vi={},Oe=!1;function Ue(l,h,x){return h==="touchstart"&&ue(),qt[h]?(x=qt[h].bind(this,x),l.addEventListener(gi[h],x,!1),x):(console.warn("wrong event specified:",h),g)}function Xt(l,h,x){if(!gi[h]){console.warn("wrong event specified:",h);return}l.removeEventListener(gi[h],x,!1)}function Gt(l){vi[l.pointerId]=l}function Ei(l){vi[l.pointerId]&&(vi[l.pointerId]=l)}function Kt(l){delete vi[l.pointerId]}function ue(){Oe||(document.addEventListener(bt,Gt,!0),document.addEventListener(Ht,Ei,!0),document.addEventListener(ri,Kt,!0),document.addEventListener(ii,Kt,!0),Oe=!0)}function qe(l,h){if(h.pointerType!==(h.MSPOINTER_TYPE_MOUSE||"mouse")){h.touches=[];for(var x in vi)h.touches.push(vi[x]);h.changedTouches=[h],l(h)}}function it(l,h){h.MSPOINTER_TYPE_TOUCH&&h.pointerType===h.MSPOINTER_TYPE_TOUCH&&Yi(h),qe(l,h)}function ot(l){var h={},x,w;for(w in l)x=l[w],h[w]=x&&x.bind?x.bind(l):x;return l=h,h.type="dblclick",h.detail=2,h.isTrusted=!1,h._simulated=!0,h}var ht=200;function pt(l,h){l.addEventListener("dblclick",h);var x=0,w;function k(N){if(N.detail!==1){w=N.detail;return}if(!(N.pointerType==="mouse"||N.sourceCapabilities&&!N.sourceCapabilities.firesTouchEvents)){var ne=Qn(N);if(!(ne.some(function(Ge){return Ge instanceof HTMLLabelElement&&Ge.attributes.for})&&!ne.some(function(Ge){return Ge instanceof HTMLInputElement||Ge instanceof HTMLSelectElement}))){var De=Date.now();De-x<=ht?(w++,w===2&&h(ot(N))):w=1,x=De}}}return l.addEventListener("click",k),{dblclick:h,simDblclick:k}}function Jt(l,h){l.removeEventListener("dblclick",h.dblclick),l.removeEventListener("click",h.simDblclick)}var B=tt(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),H=tt(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),K=H==="webkitTransition"||H==="OTransition"?H+"End":"transitionend";function ce(l){return typeof l=="string"?document.getElementById(l):l}function X(l,h){var x=l.style[h]||l.currentStyle&&l.currentStyle[h];if((!x||x==="auto")&&document.defaultView){var w=document.defaultView.getComputedStyle(l,null);x=w?w[h]:null}return x==="auto"?null:x}function J(l,h,x){var w=document.createElement(l);return w.className=h||"",x&&x.appendChild(w),w}function he(l){var h=l.parentNode;h&&h.removeChild(l)}function Qe(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function ae(l){var h=l.parentNode;h&&h.lastChild!==l&&h.appendChild(l)}function fe(l){var h=l.parentNode;h&&h.firstChild!==l&&h.insertBefore(l,h.firstChild)}function Fe(l,h){if(l.classList!==void 0)return l.classList.contains(h);var x=q(l);return x.length>0&&new RegExp("(^|\\s)"+h+"(\\s|$)").test(x)}function ge(l,h){if(l.classList!==void 0)for(var x=b(h),w=0,k=x.length;w<k;w++)l.classList.add(x[w]);else if(!Fe(l,h)){var N=q(l);ct(l,(N?N+" ":"")+h)}}function Ee(l,h){l.classList!==void 0?l.classList.remove(h):ct(l,C((" "+q(l)+" ").replace(" "+h+" "," ")))}function ct(l,h){l.className.baseVal===void 0?l.className=h:l.className.baseVal=h}function q(l){return l.correspondingElement&&(l=l.correspondingElement),l.className.baseVal===void 0?l.className:l.className.baseVal}function re(l,h){"opacity"in l.style?l.style.opacity=h:"filter"in l.style&&Le(l,h)}function Le(l,h){var x=!1,w="DXImageTransform.Microsoft.Alpha";try{x=l.filters.item(w)}catch{if(h===1)return}h=Math.round(h*100),x?(x.Enabled=h!==100,x.Opacity=h):l.style.filter+=" progid:"+w+"(opacity="+h+")"}function tt(l){for(var h=document.documentElement.style,x=0;x<l.length;x++)if(l[x]in h)return l[x];return!1}function Me(l,h,x){var w=h||new _e(0,0);l.style[B]=(xe.ie3d?"translate("+w.x+"px,"+w.y+"px)":"translate3d("+w.x+"px,"+w.y+"px,0)")+(x?" scale("+x+")":"")}function Be(l,h){l._leaflet_pos=h,xe.any3d?Me(l,h):(l.style.left=h.x+"px",l.style.top=h.y+"px")}function Et(l){return l._leaflet_pos||new _e(0,0)}var Ct,Ie,Dt;if("onselectstart"in document)Ct=function(){_t(window,"selectstart",Yi)},Ie=function(){wi(window,"selectstart",Yi)};else{var Je=tt(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Ct=function(){if(Je){var l=document.documentElement.style;Dt=l[Je],l[Je]="none"}},Ie=function(){Je&&(document.documentElement.style[Je]=Dt,Dt=void 0)}}function Ve(){_t(window,"dragstart",Yi)}function Xe(){wi(window,"dragstart",Yi)}var mt,je;function yt(l){for(;l.tabIndex===-1;)l=l.parentNode;l.style&&(Pe(),mt=l,je=l.style.outlineStyle,l.style.outlineStyle="none",_t(window,"keydown",Pe))}function Pe(){mt&&(mt.style.outlineStyle=je,mt=void 0,je=void 0,wi(window,"keydown",Pe))}function nt(l){do l=l.parentNode;while((!l.offsetWidth||!l.offsetHeight)&&l!==document.body);return l}function At(l){var h=l.getBoundingClientRect();return{x:h.width/l.offsetWidth||1,y:h.height/l.offsetHeight||1,boundingClientRect:h}}var Mt={__proto__:null,TRANSFORM:B,TRANSITION:H,TRANSITION_END:K,get:ce,getStyle:X,create:J,remove:he,empty:Qe,toFront:ae,toBack:fe,hasClass:Fe,addClass:ge,removeClass:Ee,setClass:ct,getClass:q,setOpacity:re,testProp:tt,setTransform:Me,setPosition:Be,getPosition:Et,get disableTextSelection(){return Ct},get enableTextSelection(){return Ie},disableImageDrag:Ve,enableImageDrag:Xe,preventOutline:yt,restoreOutline:Pe,getSizedParentNode:nt,getScale:At};function _t(l,h,x,w){if(h&&typeof h=="object")for(var k in h)Gi(l,k,h[k],x);else{h=b(h);for(var N=0,ne=h.length;N<ne;N++)Gi(l,h[N],x,w)}return this}var bi="_leaflet_events";function wi(l,h,x,w){if(arguments.length===1)qi(l),delete l[bi];else if(h&&typeof h=="object")for(var k in h)Si(l,k,h[k],x);else if(h=b(h),arguments.length===2)qi(l,function(De){return R(h,De)!==-1});else for(var N=0,ne=h.length;N<ne;N++)Si(l,h[N],x,w);return this}function qi(l,h){for(var x in l[bi]){var w=x.split(/\d/)[0];(!h||h(w))&&Si(l,w,null,null,x)}}var Oi={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Gi(l,h,x,w){var k=h+d(x)+(w?"_"+d(w):"");if(l[bi]&&l[bi][k])return this;var N=function(De){return x.call(w||l,De||window.event)},ne=N;!xe.touchNative&&xe.pointer&&h.indexOf("touch")===0?N=Ue(l,h,N):xe.touch&&h==="dblclick"?N=pt(l,N):"addEventListener"in l?h==="touchstart"||h==="touchmove"||h==="wheel"||h==="mousewheel"?l.addEventListener(Oi[h]||h,N,xe.passiveEvents?{passive:!1}:!1):h==="mouseenter"||h==="mouseleave"?(N=function(De){De=De||window.event,Sn(l,De)&&ne(De)},l.addEventListener(Oi[h],N,!1)):l.addEventListener(h,ne,!1):l.attachEvent("on"+h,N),l[bi]=l[bi]||{},l[bi][k]=N}function Si(l,h,x,w,k){k=k||h+d(x)+(w?"_"+d(w):"");var N=l[bi]&&l[bi][k];if(!N)return this;!xe.touchNative&&xe.pointer&&h.indexOf("touch")===0?Xt(l,h,N):xe.touch&&h==="dblclick"?Jt(l,N):"removeEventListener"in l?l.removeEventListener(Oi[h]||h,N,!1):l.detachEvent("on"+h,N),l[bi][k]=null}function ni(l){return l.stopPropagation?l.stopPropagation():l.originalEvent?l.originalEvent._stopped=!0:l.cancelBubble=!0,this}function ei(l){return Gi(l,"wheel",ni),this}function Xi(l){return _t(l,"mousedown touchstart dblclick contextmenu",ni),l._leaflet_disable_click=!0,this}function Yi(l){return l.preventDefault?l.preventDefault():l.returnValue=!1,this}function An(l){return Yi(l),ni(l),this}function Qn(l){if(l.composedPath)return l.composedPath();for(var h=[],x=l.target;x;)h.push(x),x=x.parentNode;return h}function Es(l,h){if(!h)return new _e(l.clientX,l.clientY);var x=At(h),w=x.boundingClientRect;return new _e((l.clientX-w.left)/x.x-h.clientLeft,(l.clientY-w.top)/x.y-h.clientTop)}var os=xe.linux&&xe.chrome?window.devicePixelRatio:xe.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Bs(l){return xe.edge?l.wheelDeltaY/2:l.deltaY&&l.deltaMode===0?-l.deltaY/os: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 Sn(l,h){var x=h.relatedTarget;if(!x)return!0;try{for(;x&&x!==l;)x=x.parentNode}catch{return!1}return x!==l}var es={__proto__:null,on:_t,off:wi,stopPropagation:ni,disableScrollPropagation:ei,disableClickPropagation:Xi,preventDefault:Yi,stop:An,getPropagationPath:Qn,getMousePosition:Es,getWheelDelta:Bs,isExternalTarget:Sn,addListener:_t,removeListener:wi},as=ke.extend({run:function(l,h,x,w){this.stop(),this._el=l,this._inProgress=!0,this._duration=x||.25,this._easeOutPower=1/Math.max(w||.5,.2),this._startPos=Et(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=te(this._animate,this),this._step()},_step:function(l){var h=+new Date-this._startTime,x=this._duration*1e3;h<x?this._runFrame(this._easeOut(h/x),l):(this._runFrame(1),this._complete())},_runFrame:function(l,h){var x=this._startPos.add(this._offset.multiplyBy(l));h&&x._round(),Be(this._el,x),this.fire("step")},_complete:function(){le(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(l){return 1-Math.pow(1-l,this._easeOutPower)}}),zi=ke.extend({options:{crs:dt,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=E(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(be(h.center),h.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=H&&xe.any3d&&!xe.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),_t(this._proxy,K,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(l,h,x){if(h=h===void 0?this._zoom:this._limitZoom(h),l=this._limitCenter(be(l),h,this.options.maxBounds),x=x||{},this._stop(),this._loaded&&!x.reset&&x!==!0){x.animate!==void 0&&(x.zoom=n({animate:x.animate},x.zoom),x.pan=n({animate:x.animate,duration:x.duration},x.pan));var w=this._zoom!==h?this._tryAnimatedZoom&&this._tryAnimatedZoom(l,h,x.zoom):this._tryAnimatedPan(l,x.pan);if(w)return clearTimeout(this._sizeTimer),this}return this._resetView(l,h,x.pan&&x.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||(xe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+l,h)},zoomOut:function(l,h){return l=l||(xe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-l,h)},setZoomAround:function(l,h,x){var w=this.getZoomScale(h),k=this.getSize().divideBy(2),N=l instanceof _e?l:this.latLngToContainerPoint(l),ne=N.subtract(k).multiplyBy(1-1/w),De=this.containerPointToLatLng(k.add(ne));return this.setView(De,h,{zoom:x})},_getBoundsCenterZoom:function(l,h){h=h||{},l=l.getBounds?l.getBounds():st(l);var x=Te(h.paddingTopLeft||h.padding||[0,0]),w=Te(h.paddingBottomRight||h.padding||[0,0]),k=this.getBoundsZoom(l,!1,x.add(w));if(k=typeof h.maxZoom=="number"?Math.min(h.maxZoom,k):k,k===1/0)return{center:l.getCenter(),zoom:k};var N=w.subtract(x).divideBy(2),ne=this.project(l.getSouthWest(),k),De=this.project(l.getNorthEast(),k),Ge=this.unproject(ne.add(De).divideBy(2).add(N),k);return{center:Ge,zoom:k}},fitBounds:function(l,h){if(l=st(l),!l.isValid())throw new Error("Bounds are not valid.");var x=this._getBoundsCenterZoom(l,h);return this.setView(x.center,x.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=Te(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 as,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 x=this._getMapPanePos().subtract(l).round();this._panAnim.run(this._mapPane,x,h.duration||.25,h.easeLinearity)}else this._rawPanBy(l),this.fire("move").fire("moveend");return this},flyTo:function(l,h,x){if(x=x||{},x.animate===!1||!xe.any3d)return this.setView(l,h,x);this._stop();var w=this.project(this.getCenter()),k=this.project(l),N=this.getSize(),ne=this._zoom;l=be(l),h=h===void 0?ne:h;var De=Math.max(N.x,N.y),Ge=De*this.getZoomScale(ne,h),Lt=k.distanceTo(w)||1,Li=1.42,rn=Li*Li;function kn(Vs){var qp=Vs?-1:1,RF=Vs?Ge:De,NF=Ge*Ge-De*De+qp*rn*rn*Lt*Lt,OF=2*RF*rn*Lt,wb=NF/OF,hS=Math.sqrt(wb*wb+1)-wb,HF=hS<1e-9?-18:Math.log(hS);return HF}function Ao(Vs){return(Math.exp(Vs)-Math.exp(-Vs))/2}function eo(Vs){return(Math.exp(Vs)+Math.exp(-Vs))/2}function Cr(Vs){return Ao(Vs)/eo(Vs)}var Wo=kn(0);function th(Vs){return De*(eo(Wo)/eo(Wo+Li*Vs))}function IF(Vs){return De*(eo(Wo)*Cr(Wo+Li*Vs)-Ao(Wo))/rn}function PF(Vs){return 1-Math.pow(1-Vs,1.5)}var TF=Date.now(),dS=(kn(1)-Wo)/Li,MF=x.duration?1e3*x.duration:1e3*dS*.8;function uS(){var Vs=(Date.now()-TF)/MF,qp=PF(Vs)*dS;Vs<=1?(this._flyToFrame=te(uS,this),this._move(this.unproject(w.add(k.subtract(w).multiplyBy(IF(qp)/Lt)),ne),this.getScaleZoom(De/th(qp),ne),{flyTo:!0})):this._move(l,h)._moveEnd(!0)}return this._moveStart(!0,x.noMoveStart),uS.call(this),this},flyToBounds:function(l,h){var x=this._getBoundsCenterZoom(l,h);return this.flyTo(x.center,x.zoom,h)},setMaxBounds:function(l){return l=st(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 x=this.getCenter(),w=this._limitCenter(x,this._zoom,st(l));return x.equals(w)||this.panTo(w,h),this._enforcingBounds=!1,this},panInside:function(l,h){h=h||{};var x=Te(h.paddingTopLeft||h.padding||[0,0]),w=Te(h.paddingBottomRight||h.padding||[0,0]),k=this.project(this.getCenter()),N=this.project(l),ne=this.getPixelBounds(),De=ut([ne.min.add(x),ne.max.subtract(w)]),Ge=De.getSize();if(!De.contains(N)){this._enforcingBounds=!0;var Lt=N.subtract(De.getCenter()),Li=De.extend(N).getSize().subtract(Ge);k.x+=Lt.x<0?-Li.x:Li.x,k.y+=Lt.y<0?-Li.y:Li.y,this.panTo(this.unproject(k),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 x=this.getSize(),w=h.divideBy(2).round(),k=x.divideBy(2).round(),N=w.subtract(k);return!N.x&&!N.y?this:(l.animate&&l.pan?this.panBy(N):(l.pan&&this._rawPanBy(N),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:x}))},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),x=r(this._handleGeolocationError,this);return l.watch?this._locationWatchId=navigator.geolocation.watchPosition(h,x,l):navigator.geolocation.getCurrentPosition(h,x,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,x=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: "+x+"."})}},_handleGeolocationResponse:function(l){if(this._container._leaflet_id){var h=l.coords.latitude,x=l.coords.longitude,w=new St(h,x),k=w.toBounds(l.coords.accuracy*2),N=this._locateOptions;if(N.setView){var ne=this.getBoundsZoom(k);this.setView(w,N.maxZoom?Math.min(ne,N.maxZoom):ne)}var De={latlng:w,bounds:k,timestamp:l.timestamp};for(var Ge in l.coords)typeof l.coords[Ge]=="number"&&(De[Ge]=l.coords[Ge]);this.fire("locationfound",De)}},addHandler:function(l,h){if(!h)return this;var x=this[l]=new h(this);return this._handlers.push(x),this.options[l]&&x.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(),he(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(le(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)he(this._panes[l]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(l,h){var x="leaflet-pane"+(l?" leaflet-"+l.replace("Pane","")+"-pane":""),w=J("div",x,h||this._mapPane);return l&&(this._panes[l]=w),w},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()),x=this.unproject(l.getTopRight());return new Rt(h,x)},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,x){l=st(l),x=Te(x||[0,0]);var w=this.getZoom()||0,k=this.getMinZoom(),N=this.getMaxZoom(),ne=l.getNorthWest(),De=l.getSouthEast(),Ge=this.getSize().subtract(x),Lt=ut(this.project(De,w),this.project(ne,w)).getSize(),Li=xe.any3d?this.options.zoomSnap:1,rn=Ge.x/Lt.x,kn=Ge.y/Lt.y,Ao=h?Math.max(rn,kn):Math.min(rn,kn);return w=this.getScaleZoom(Ao,w),Li&&(w=Math.round(w/(Li/100))*(Li/100),w=h?Math.ceil(w/Li)*Li:Math.floor(w/Li)*Li),Math.max(k,Math.min(N,w))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new _e(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(l,h){var x=this._getTopLeftPoint(l,h);return new pe(x,x.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 x=this.options.crs;return h=h===void 0?this._zoom:h,x.scale(l)/x.scale(h)},getScaleZoom:function(l,h){var x=this.options.crs;h=h===void 0?this._zoom:h;var w=x.zoom(l*x.scale(h));return isNaN(w)?1/0:w},project:function(l,h){return h=h===void 0?this._zoom:h,this.options.crs.latLngToPoint(be(l),h)},unproject:function(l,h){return h=h===void 0?this._zoom:h,this.options.crs.pointToLatLng(Te(l),h)},layerPointToLatLng:function(l){var h=Te(l).add(this.getPixelOrigin());return this.unproject(h)},latLngToLayerPoint:function(l){var h=this.project(be(l))._round();return h._subtract(this.getPixelOrigin())},wrapLatLng:function(l){return this.options.crs.wrapLatLng(be(l))},wrapLatLngBounds:function(l){return this.options.crs.wrapLatLngBounds(st(l))},distance:function(l,h){return this.options.crs.distance(be(l),be(h))},containerPointToLayerPoint:function(l){return Te(l).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(l){return Te(l).add(this._getMapPanePos())},containerPointToLatLng:function(l){var h=this.containerPointToLayerPoint(Te(l));return this.layerPointToLatLng(h)},latLngToContainerPoint:function(l){return this.layerPointToContainerPoint(this.latLngToLayerPoint(be(l)))},mouseEventToContainerPoint:function(l){return Es(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=ce(l);if(h){if(h._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");_t(h,"scroll",this._onScroll,this),this._containerId=d(h)},_initLayout:function(){var l=this._container;this._fadeAnimated=this.options.fadeAnimation&&xe.any3d,ge(l,"leaflet-container"+(xe.touch?" leaflet-touch":"")+(xe.retina?" leaflet-retina":"")+(xe.ielt9?" leaflet-oldie":"")+(xe.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var h=X(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),Be(this._mapPane,new _e(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,x){Be(this._mapPane,new _e(0,0));var w=!this._loaded;this._loaded=!0,h=this._limitZoom(h),this.fire("viewprereset");var k=this._zoom!==h;this._moveStart(k,x)._move(l,h)._moveEnd(k),this.fire("viewreset"),w&&this.fire("load")},_moveStart:function(l,h){return l&&this.fire("zoomstart"),h||this.fire("movestart"),this},_move:function(l,h,x,w){h===void 0&&(h=this._zoom);var k=this._zoom!==h;return this._zoom=h,this._lastCenter=l,this._pixelOrigin=this._getNewPixelOrigin(l),w?x&&x.pinch&&this.fire("zoom",x):((k||x&&x.pinch)&&this.fire("zoom",x),this.fire("move",x)),this},_moveEnd:function(l){return l&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return le(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(l){Be(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[d(this._container)]=this;var h=l?wi:_t;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),xe.any3d&&this.options.transform3DLimit&&(l?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){le(this._resizeRequest),this._resizeRequest=te(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 x=[],w,k=h==="mouseout"||h==="mouseover",N=l.target||l.srcElement,ne=!1;N;){if(w=this._targets[d(N)],w&&(h==="click"||h==="preclick")&&this._draggableMoved(w)){ne=!0;break}if(w&&w.listens(h,!0)&&(k&&!Sn(N,l)||(x.push(w),k))||N===this._container)break;N=N.parentNode}return!x.length&&!ne&&!k&&this.listens(h,!0)&&(x=[this]),x},_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 x=l.type;x==="mousedown"&&yt(h),this._fireDOMEvent(l,x)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(l,h,x){if(l.type==="click"){var w=n({},l);w.type="preclick",this._fireDOMEvent(w,w.type,x)}var k=this._findEventTargets(l,h);if(x){for(var N=[],ne=0;ne<x.length;ne++)x[ne].listens(h,!0)&&N.push(x[ne]);k=N.concat(k)}if(k.length){h==="contextmenu"&&Yi(l);var De=k[0],Ge={originalEvent:l};if(l.type!=="keypress"&&l.type!=="keydown"&&l.type!=="keyup"){var Lt=De.getLatLng&&(!De._radius||De._radius<=10);Ge.containerPoint=Lt?this.latLngToContainerPoint(De.getLatLng()):this.mouseEventToContainerPoint(l),Ge.layerPoint=this.containerPointToLayerPoint(Ge.containerPoint),Ge.latlng=Lt?De.getLatLng():this.layerPointToLatLng(Ge.layerPoint)}for(ne=0;ne<k.length;ne++)if(k[ne].fire(h,Ge,!0),Ge.originalEvent._stopped||k[ne].options.bubblingMouseEvents===!1&&R(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 Et(this._mapPane)||new _e(0,0)},_moved:function(){var l=this._getMapPanePos();return l&&!l.equals([0,0])},_getTopLeftPoint:function(l,h){var x=l&&h!==void 0?this._getNewPixelOrigin(l,h):this.getPixelOrigin();return x.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(l,h){var x=this.getSize()._divideBy(2);return this.project(l,h)._subtract(x)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(l,h,x){var w=this._getNewPixelOrigin(x,h);return this.project(l,h)._subtract(w)},_latLngBoundsToNewLayerBounds:function(l,h,x){var w=this._getNewPixelOrigin(x,h);return ut([this.project(l.getSouthWest(),h)._subtract(w),this.project(l.getNorthWest(),h)._subtract(w),this.project(l.getSouthEast(),h)._subtract(w),this.project(l.getNorthEast(),h)._subtract(w)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(l){return this.latLngToLayerPoint(l).subtract(this._getCenterLayerPoint())},_limitCenter:function(l,h,x){if(!x)return l;var w=this.project(l,h),k=this.getSize().divideBy(2),N=new pe(w.subtract(k),w.add(k)),ne=this._getBoundsOffset(N,x,h);return Math.abs(ne.x)<=1&&Math.abs(ne.y)<=1?l:this.unproject(w.add(ne),h)},_limitOffset:function(l,h){if(!h)return l;var x=this.getPixelBounds(),w=new pe(x.min.add(l),x.max.add(l));return l.add(this._getBoundsOffset(w,h))},_getBoundsOffset:function(l,h,x){var w=ut(this.project(h.getNorthEast(),x),this.project(h.getSouthWest(),x)),k=w.min.subtract(l.min),N=w.max.subtract(l.max),ne=this._rebound(k.x,-N.x),De=this._rebound(k.y,-N.y);return new _e(ne,De)},_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(),x=this.getMaxZoom(),w=xe.any3d?this.options.zoomSnap:1;return w&&(l=Math.round(l/w)*w),Math.max(h,Math.min(x,l))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Ee(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(l,h){var x=this._getCenterOffset(l)._trunc();return(h&&h.animate)!==!0&&!this.getSize().contains(x)?!1:(this.panBy(x,h),!0)},_createAnimProxy:function(){var l=this._proxy=J("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(l),this.on("zoomanim",function(h){var x=B,w=this._proxy.style[x];Me(this._proxy,this.project(h.center,h.zoom),this.getZoomScale(h.zoom,1)),w===this._proxy.style[x]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){he(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var l=this.getCenter(),h=this.getZoom();Me(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,x){if(this._animatingZoom)return!0;if(x=x||{},!this._zoomAnimated||x.animate===!1||this._nothingToAnimate()||Math.abs(h-this._zoom)>this.options.zoomAnimationThreshold)return!1;var w=this.getZoomScale(h),k=this._getCenterOffset(l)._divideBy(1-1/w);return x.animate!==!0&&!this.getSize().contains(k)?!1:(te(function(){this._moveStart(!0,x.noMoveStart||!1)._animateZoom(l,h,!0)},this),!0)},_animateZoom:function(l,h,x,w){this._mapPane&&(x&&(this._animatingZoom=!0,this._animateToCenter=l,this._animateToZoom=h,ge(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:l,zoom:h,noUpdate:w}),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&&Ee(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 Gs(l,h){return new zi(l,h)}var Hn=oe.extend({options:{position:"topright"},initialize:function(l){E(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),x=this.getPosition(),w=l._controlCorners[x];return ge(h,"leaflet-control"),x.indexOf("bottom")!==-1?w.insertBefore(h,w.firstChild):w.appendChild(h),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(he(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()}}),qn=function(l){return new Hn(l)};zi.include({addControl:function(l){return l.addTo(this),this},removeControl:function(l){return l.remove(),this},_initControlPos:function(){var l=this._controlCorners={},h="leaflet-",x=this._controlContainer=J("div",h+"control-container",this._container);function w(k,N){var ne=h+k+" "+h+N;l[k+N]=J("div",ne,x)}w("top","left"),w("top","right"),w("bottom","left"),w("bottom","right")},_clearControlPos:function(){for(var l in this._controlCorners)he(this._controlCorners[l]);he(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ys=Hn.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(l,h,x,w){return x<w?-1:w<x?1:0}},initialize:function(l,h,x){E(this,x),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var w in l)this._addLayer(l[w],w);for(w in h)this._addLayer(h[w],w,!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 Hn.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(d(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"):Ee(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Ee(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var l="leaflet-control-layers",h=this._container=J("div",l),x=this.options.collapsed;h.setAttribute("aria-haspopup",!0),Xi(h),ei(h);var w=this._section=J("section",l+"-list");x&&(this._map.on("click",this.collapse,this),_t(h,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var k=this._layersLink=J("a",l+"-toggle",h);k.href="#",k.title="Layers",k.setAttribute("role","button"),_t(k,{keydown:function(N){N.keyCode===13&&this._expandSafely()},click:function(N){Yi(N),this._expandSafely()}},this),x||this.expand(),this._baseLayersList=J("div",l+"-base",w),this._separator=J("div",l+"-separator",w),this._overlaysList=J("div",l+"-overlays",w),h.appendChild(w)},_getLayer:function(l){for(var h=0;h<this._layers.length;h++)if(this._layers[h]&&d(this._layers[h].layer)===l)return this._layers[h]},_addLayer:function(l,h,x){this._map&&l.on("add remove",this._onLayerChange,this),this._layers.push({layer:l,name:h,overlay:x}),this.options.sortLayers&&this._layers.sort(r(function(w,k){return this.options.sortFunction(w.layer,k.layer,w.name,k.name)},this)),this.options.autoZIndex&&l.setZIndex&&(this._lastZIndex++,l.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Qe(this._baseLayersList),Qe(this._overlaysList),this._layerControlInputs=[];var l,h,x,w,k=0;for(x=0;x<this._layers.length;x++)w=this._layers[x],this._addItem(w),h=h||w.overlay,l=l||!w.overlay,k+=w.overlay?0:1;return this.options.hideSingleBase&&(l=l&&k>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(d(l.target)),x=h.overlay?l.type==="add"?"overlayadd":"overlayremove":l.type==="add"?"baselayerchange":null;x&&this._map.fire(x,h)},_createRadioElement:function(l,h){var x='<input type="radio" class="leaflet-control-layers-selector" name="'+l+'"'+(h?' checked="checked"':"")+"/>",w=document.createElement("div");return w.innerHTML=x,w.firstChild},_addItem:function(l){var h=document.createElement("label"),x=this._map.hasLayer(l.layer),w;l.overlay?(w=document.createElement("input"),w.type="checkbox",w.className="leaflet-control-layers-selector",w.defaultChecked=x):w=this._createRadioElement("leaflet-base-layers_"+d(this),x),this._layerControlInputs.push(w),w.layerId=d(l.layer),_t(w,"click",this._onInputClick,this);var k=document.createElement("span");k.innerHTML=" "+l.name;var N=document.createElement("span");h.appendChild(N),N.appendChild(w),N.appendChild(k);var ne=l.overlay?this._overlaysList:this._baseLayersList;return ne.appendChild(h),this._checkDisabledLayers(),h},_onInputClick:function(){if(!this._preventClick){var l=this._layerControlInputs,h,x,w=[],k=[];this._handlingClick=!0;for(var N=l.length-1;N>=0;N--)h=l[N],x=this._getLayer(h.layerId).layer,h.checked?w.push(x):h.checked||k.push(x);for(N=0;N<k.length;N++)this._map.hasLayer(k[N])&&this._map.removeLayer(k[N]);for(N=0;N<w.length;N++)this._map.hasLayer(w[N])||this._map.addLayer(w[N]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var l=this._layerControlInputs,h,x,w=this._map.getZoom(),k=l.length-1;k>=0;k--)h=l[k],x=this._getLayer(h.layerId).layer,h.disabled=x.options.minZoom!==void 0&&w<x.options.minZoom||x.options.maxZoom!==void 0&&w>x.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var l=this._section;this._preventClick=!0,_t(l,"click",Yi),this.expand();var h=this;setTimeout(function(){wi(l,"click",Yi),h._preventClick=!1})}}),gr=function(l,h,x){return new ys(l,h,x)},pr=Hn.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(l){var h="leaflet-control-zoom",x=J("div",h+" leaflet-bar"),w=this.options;return this._zoomInButton=this._createButton(w.zoomInText,w.zoomInTitle,h+"-in",x,this._zoomIn),this._zoomOutButton=this._createButton(w.zoomOutText,w.zoomOutTitle,h+"-out",x,this._zoomOut),this._updateDisabled(),l.on("zoomend zoomlevelschange",this._updateDisabled,this),x},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,x,w,k){var N=J("a",x,w);return N.innerHTML=l,N.href="#",N.title=h,N.setAttribute("role","button"),N.setAttribute("aria-label",h),Xi(N),_t(N,"click",An),_t(N,"click",k,this),_t(N,"click",this._refocusOnMap,this),N},_updateDisabled:function(){var l=this._map,h="leaflet-disabled";Ee(this._zoomInButton,h),Ee(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"))}});zi.mergeOptions({zoomControl:!0}),zi.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new pr,this.addControl(this.zoomControl))});var er=function(l){return new pr(l)},nl=Hn.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(l){var h="leaflet-control-scale",x=J("div",h),w=this.options;return this._addScales(w,h+"-line",x),l.on(w.updateWhenIdle?"moveend":"move",this._update,this),l.whenReady(this._update,this),x},onRemove:function(l){l.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(l,h,x){l.metric&&(this._mScale=J("div",h,x)),l.imperial&&(this._iScale=J("div",h,x))},_update:function(){var l=this._map,h=l.getSize().y/2,x=l.distance(l.containerPointToLatLng([0,h]),l.containerPointToLatLng([this.options.maxWidth,h]));this._updateScales(x)},_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),x=h<1e3?h+" m":h/1e3+" km";this._updateScale(this._mScale,x,h/l)},_updateImperial:function(l){var h=l*3.2808399,x,w,k;h>5280?(x=h/5280,w=this._getRoundNum(x),this._updateScale(this._iScale,w+" mi",w/x)):(k=this._getRoundNum(h),this._updateScale(this._iScale,k+" ft",k/h))},_updateScale:function(l,h,x){l.style.width=Math.round(this.options.maxWidth*x)+"px",l.innerHTML=h},_getRoundNum:function(l){var h=Math.pow(10,(Math.floor(l)+"").length-1),x=l/h;return x=x>=10?10:x>=5?5:x>=3?3:x>=2?2:1,h*x}}),xr=function(l){return new nl(l)},va='<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>',mr=Hn.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(xe.inlineSvg?va+" ":"")+"Leaflet</a>"},initialize:function(l){E(this,l),this._attributions={}},onAdd:function(l){l.attributionControl=this,this._container=J("div","leaflet-control-attribution"),Xi(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 x=[];this.options.prefix&&x.push(this.options.prefix),l.length&&x.push(l.join(", ")),this._container.innerHTML=x.join(' <span aria-hidden="true">|</span> ')}}});zi.mergeOptions({attributionControl:!0}),zi.addInitHook(function(){this.options.attributionControl&&new mr().addTo(this)});var ub=function(l){return new mr(l)};Hn.Layers=ys,Hn.Zoom=pr,Hn.Scale=nl,Hn.Attribution=mr,qn.layers=gr,qn.zoom=er,qn.scale=xr,qn.attribution=ub;var tr=oe.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}});tr.addTo=function(l,h){return l.addHandler(h,this),this};var hb={Events:Re},nf=xe.touch?"touchstart mousedown":"mousedown",Ur=ke.extend({options:{clickTolerance:3},initialize:function(l,h,x,w){E(this,w),this._element=l,this._dragStartTarget=h||l,this._preventOutline=x},enable:function(){this._enabled||(_t(this._dragStartTarget,nf,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ur._dragging===this&&this.finishDrag(!0),wi(this._dragStartTarget,nf,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(l){if(this._enabled&&(this._moved=!1,!Fe(this._element,"leaflet-zoom-anim"))){if(l.touches&&l.touches.length!==1){Ur._dragging===this&&this.finishDrag();return}if(!(Ur._dragging||l.shiftKey||l.which!==1&&l.button!==1&&!l.touches)&&(Ur._dragging=this,this._preventOutline&&yt(this._element),Ve(),Ct(),!this._moving)){this.fire("down");var h=l.touches?l.touches[0]:l,x=nt(this._element);this._startPoint=new _e(h.clientX,h.clientY),this._startPos=Et(this._element),this._parentScale=At(x);var w=l.type==="mousedown";_t(document,w?"mousemove":"touchmove",this._onMove,this),_t(document,w?"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,x=new _e(h.clientX,h.clientY)._subtract(this._startPoint);!x.x&&!x.y||Math.abs(x.x)+Math.abs(x.y)<this.options.clickTolerance||(x.x/=this._parentScale.x,x.y/=this._parentScale.y,Yi(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(x),this._moving=!0,this._lastEvent=l,this._updatePosition())}},_updatePosition:function(){var l={originalEvent:this._lastEvent};this.fire("predrag",l),Be(this._element,this._newPos),this.fire("drag",l)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(l){Ee(document.body,"leaflet-dragging"),this._lastTarget&&(Ee(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),wi(document,"mousemove touchmove",this._onMove,this),wi(document,"mouseup touchend touchcancel",this._onUp,this),Xe(),Ie();var h=this._moved&&this._moving;this._moving=!1,Ur._dragging=!1,h&&this.fire("dragend",{noInertia:l,distance:this._newPos.distanceTo(this._startPos)})}});function Hp(l,h,x){var w,k=[1,4,2,8],N,ne,De,Ge,Lt,Li,rn,kn;for(N=0,Li=l.length;N<Li;N++)l[N]._code=ba(l[N],h);for(De=0;De<4;De++){for(rn=k[De],w=[],N=0,Li=l.length,ne=Li-1;N<Li;ne=N++)Ge=l[N],Lt=l[ne],Ge._code&rn?Lt._code&rn||(kn=Ul(Lt,Ge,rn,h,x),kn._code=ba(kn,h),w.push(kn)):(Lt._code&rn&&(kn=Ul(Lt,Ge,rn,h,x),kn._code=ba(kn,h),w.push(kn)),w.push(Ge));l=w}return l}function sf(l,h){var x,w,k,N,ne,De,Ge,Lt,Li;if(!l||l.length===0)throw new Error("latlngs not passed");Do(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var rn=be([0,0]),kn=st(l),Ao=kn.getNorthWest().distanceTo(kn.getSouthWest())*kn.getNorthEast().distanceTo(kn.getNorthWest());Ao<1700&&(rn=of(l));var eo=l.length,Cr=[];for(x=0;x<eo;x++){var Wo=be(l[x]);Cr.push(h.project(be([Wo.lat-rn.lat,Wo.lng-rn.lng])))}for(De=Ge=Lt=0,x=0,w=eo-1;x<eo;w=x++)k=Cr[x],N=Cr[w],ne=k.y*N.x-N.y*k.x,Ge+=(k.x+N.x)*ne,Lt+=(k.y+N.y)*ne,De+=ne*3;De===0?Li=Cr[0]:Li=[Ge/De,Lt/De];var th=h.unproject(Te(Li));return be([th.lat+rn.lat,th.lng+rn.lng])}function of(l){for(var h=0,x=0,w=0,k=0;k<l.length;k++){var N=be(l[k]);h+=N.lat,x+=N.lng,w++}return be([h/w,x/w])}var Wp={__proto__:null,clipPolygon:Hp,polygonCenter:sf,centroid:of};function rf(l,h){if(!h||!l.length)return l.slice();var x=h*h;return l=gb(l,x),l=zp(l,x),l}function Xc(l,h,x){return Math.sqrt(ql(l,h,x,!0))}function fb(l,h,x){return ql(l,h,x)}function zp(l,h){var x=l.length,w=typeof Uint8Array<"u"?Uint8Array:Array,k=new w(x);k[0]=k[x-1]=1,af(l,k,h,0,x-1);var N,ne=[];for(N=0;N<x;N++)k[N]&&ne.push(l[N]);return ne}function af(l,h,x,w,k){var N=0,ne,De,Ge;for(De=w+1;De<=k-1;De++)Ge=ql(l[De],l[w],l[k],!0),Ge>N&&(ne=De,N=Ge);N>x&&(h[ne]=1,af(l,h,x,w,ne),af(l,h,x,ne,k))}function gb(l,h){for(var x=[l[0]],w=1,k=0,N=l.length;w<N;w++)pb(l[w],l[k])>h&&(x.push(l[w]),k=w);return k<N-1&&x.push(l[N-1]),x}var lf;function Vp(l,h,x,w,k){var N=w?lf:ba(l,x),ne=ba(h,x),De,Ge,Lt;for(lf=ne;;){if(!(N|ne))return[l,h];if(N&ne)return!1;De=N||ne,Ge=Ul(l,h,De,x,k),Lt=ba(Ge,x),De===N?(l=Ge,N=Lt):(h=Ge,ne=Lt)}}function Ul(l,h,x,w,k){var N=h.x-l.x,ne=h.y-l.y,De=w.min,Ge=w.max,Lt,Li;return x&8?(Lt=l.x+N*(Ge.y-l.y)/ne,Li=Ge.y):x&4?(Lt=l.x+N*(De.y-l.y)/ne,Li=De.y):x&2?(Lt=Ge.x,Li=l.y+ne*(Ge.x-l.x)/N):x&1&&(Lt=De.x,Li=l.y+ne*(De.x-l.x)/N),new _e(Lt,Li,k)}function ba(l,h){var x=0;return l.x<h.min.x?x|=1:l.x>h.max.x&&(x|=2),l.y<h.min.y?x|=4:l.y>h.max.y&&(x|=8),x}function pb(l,h){var x=h.x-l.x,w=h.y-l.y;return x*x+w*w}function ql(l,h,x,w){var k=h.x,N=h.y,ne=x.x-k,De=x.y-N,Ge=ne*ne+De*De,Lt;return Ge>0&&(Lt=((l.x-k)*ne+(l.y-N)*De)/Ge,Lt>1?(k=x.x,N=x.y):Lt>0&&(k+=ne*Lt,N+=De*Lt)),ne=l.x-k,De=l.y-N,w?ne*ne+De*De:new _e(k,N)}function Do(l){return!M(l[0])||typeof l[0][0]!="object"&&typeof l[0][0]<"u"}function cf(l){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Do(l)}function df(l,h){var x,w,k,N,ne,De,Ge,Lt;if(!l||l.length===0)throw new Error("latlngs not passed");Do(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var Li=be([0,0]),rn=st(l),kn=rn.getNorthWest().distanceTo(rn.getSouthWest())*rn.getNorthEast().distanceTo(rn.getNorthWest());kn<1700&&(Li=of(l));var Ao=l.length,eo=[];for(x=0;x<Ao;x++){var Cr=be(l[x]);eo.push(h.project(be([Cr.lat-Li.lat,Cr.lng-Li.lng])))}for(x=0,w=0;x<Ao-1;x++)w+=eo[x].distanceTo(eo[x+1])/2;if(w===0)Lt=eo[0];else for(x=0,N=0;x<Ao-1;x++)if(ne=eo[x],De=eo[x+1],k=ne.distanceTo(De),N+=k,N>w){Ge=(N-w)/k,Lt=[De.x-Ge*(De.x-ne.x),De.y-Ge*(De.y-ne.y)];break}var Wo=h.unproject(Te(Lt));return be([Wo.lat+Li.lat,Wo.lng+Li.lng])}var xb={__proto__:null,simplify:rf,pointToSegmentDistance:Xc,closestPointOnSegment:fb,clipSegment:Vp,_getEdgeIntersection:Ul,_getBitCode:ba,_sqClosestPointOnSegment:ql,isFlat:Do,_flat:cf,polylineCenter:df},Xu={project:function(l){return new _e(l.lng,l.lat)},unproject:function(l){return new St(l.y,l.x)},bounds:new pe([-180,-90],[180,90])},uf={R:6378137,R_MINOR:6356752314245179e-9,bounds:new pe([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(l){var h=Math.PI/180,x=this.R,w=l.lat*h,k=this.R_MINOR/x,N=Math.sqrt(1-k*k),ne=N*Math.sin(w),De=Math.tan(Math.PI/4-w/2)/Math.pow((1-ne)/(1+ne),N/2);return w=-x*Math.log(Math.max(De,1e-10)),new _e(l.lng*h*x,w)},unproject:function(l){for(var h=180/Math.PI,x=this.R,w=this.R_MINOR/x,k=Math.sqrt(1-w*w),N=Math.exp(-l.y/x),ne=Math.PI/2-2*Math.atan(N),De=0,Ge=.1,Lt;De<15&&Math.abs(Ge)>1e-7;De++)Lt=k*Math.sin(ne),Lt=Math.pow((1-Lt)/(1+Lt),k/2),Ge=Math.PI/2-2*Math.atan(N*Lt)-ne,ne+=Ge;return new St(ne*h,l.x*h/x)}},mb={__proto__:null,LonLat:Xu,Mercator:uf,SphericalMercator:et},_b=n({},xt,{code:"EPSG:3395",projection:uf,transformation:(function(){var l=.5/(Math.PI*uf.R);return di(l,.5,-l,.5)})()}),Yu=n({},xt,{code:"EPSG:4326",projection:Xu,transformation:di(1/180,1,-1/180,.5)}),jp=n({},Tt,{projection:Xu,transformation:di(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 x=h.lng-l.lng,w=h.lat-l.lat;return Math.sqrt(x*x+w*w)},infinite:!0});Tt.Earth=xt,Tt.EPSG3395=_b,Tt.EPSG3857=dt,Tt.EPSG900913=Ft,Tt.EPSG4326=Yu,Tt.Simple=jp;var Oo=ke.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[d(l)]=this,this},removeInteractiveTarget:function(l){return delete this._map._targets[d(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 x=this.getEvents();h.on(x,this),this.once("remove",function(){h.off(x,this)},this)}this.onAdd(h),this.fire("add"),h.fire("layeradd",{layer:this})}}});zi.include({addLayer:function(l){if(!l._layerAdd)throw new Error("The provided object is not a Layer.");var h=d(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=d(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 d(l)in this._layers},eachLayer:function(l,h){for(var x in this._layers)l.call(h,this._layers[x]);return this},_addLayers:function(l){l=l?M(l)?l:[l]:[];for(var h=0,x=l.length;h<x;h++)this.addLayer(l[h])},_addZoomLimit:function(l){(!isNaN(l.options.maxZoom)||!isNaN(l.options.minZoom))&&(this._zoomBoundLayers[d(l)]=l,this._updateZoomLevels())},_removeZoomLimit:function(l){var h=d(l);this._zoomBoundLayers[h]&&(delete this._zoomBoundLayers[h],this._updateZoomLevels())},_updateZoomLevels:function(){var l=1/0,h=-1/0,x=this._getZoomSpan();for(var w in this._zoomBoundLayers){var k=this._zoomBoundLayers[w].options;l=k.minZoom===void 0?l:Math.min(l,k.minZoom),h=k.maxZoom===void 0?h:Math.max(h,k.maxZoom)}this._layersMaxZoom=h===-1/0?void 0:h,this._layersMinZoom=l===1/0?void 0:l,x!==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 sl=Oo.extend({initialize:function(l,h){E(this,h),this._layers={};var x,w;if(l)for(x=0,w=l.length;x<w;x++)this.addLayer(l[x])},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),x,w;for(x in this._layers)w=this._layers[x],w[l]&&w[l].apply(w,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 x in this._layers)l.call(h,this._layers[x]);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 d(l)}}),vb=function(l,h){return new sl(l,h)},_r=sl.extend({addLayer:function(l){return this.hasLayer(l)?this:(l.addEventParent(this),sl.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),sl.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 Rt;for(var h in this._layers){var x=this._layers[h];l.extend(x.getBounds?x.getBounds():x.getLatLng())}return l}}),hf=function(l,h){return new _r(l,h)},ol=oe.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(l){E(this,l)},createIcon:function(l){return this._createIcon("icon",l)},createShadow:function(l){return this._createIcon("shadow",l)},_createIcon:function(l,h){var x=this._getIconUrl(l);if(!x){if(l==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var w=this._createImg(x,h&&h.tagName==="IMG"?h:null);return this._setIconStyles(w,l),(this.options.crossOrigin||this.options.crossOrigin==="")&&(w.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),w},_setIconStyles:function(l,h){var x=this.options,w=x[h+"Size"];typeof w=="number"&&(w=[w,w]);var k=Te(w),N=Te(h==="shadow"&&x.shadowAnchor||x.iconAnchor||k&&k.divideBy(2,!0));l.className="leaflet-marker-"+h+" "+(x.className||""),N&&(l.style.marginLeft=-N.x+"px",l.style.marginTop=-N.y+"px"),k&&(l.style.width=k.x+"px",l.style.height=k.y+"px")},_createImg:function(l,h){return h=h||document.createElement("img"),h.src=l,h},_getIconUrl:function(l){return xe.retina&&this.options[l+"RetinaUrl"]||this.options[l+"Url"]}});function bb(l){return new ol(l)}var Yc=ol.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 Yc.imagePath!="string"&&(Yc.imagePath=this._detectIconPath()),(this.options.imagePath||Yc.imagePath)+ol.prototype._getIconUrl.call(this,l)},_stripUrl:function(l){var h=function(x,w,k){var N=w.exec(x);return N&&N[k]};return l=h(l,/^url\((['"])?(.+)\1\)$/,2),l&&h(l,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var l=J("div","leaflet-default-icon-path",document.body),h=X(l,"background-image")||X(l,"backgroundImage");if(document.body.removeChild(l),h=this._stripUrl(h),h)return h;var x=document.querySelector('link[href$="leaflet.css"]');return x?x.href.substring(0,x.href.length-11-1):""}}),$p=tr.extend({initialize:function(l){this._marker=l},addHooks:function(){var l=this._marker._icon;this._draggable||(this._draggable=new Ur(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&&Ee(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(l){var h=this._marker,x=h._map,w=this._marker.options.autoPanSpeed,k=this._marker.options.autoPanPadding,N=Et(h._icon),ne=x.getPixelBounds(),De=x.getPixelOrigin(),Ge=ut(ne.min._subtract(De).add(k),ne.max._subtract(De).subtract(k));if(!Ge.contains(N)){var Lt=Te((Math.max(Ge.max.x,N.x)-Ge.max.x)/(ne.max.x-Ge.max.x)-(Math.min(Ge.min.x,N.x)-Ge.min.x)/(ne.min.x-Ge.min.x),(Math.max(Ge.max.y,N.y)-Ge.max.y)/(ne.max.y-Ge.max.y)-(Math.min(Ge.min.y,N.y)-Ge.min.y)/(ne.min.y-Ge.min.y)).multiplyBy(w);x.panBy(Lt,{animate:!1}),this._draggable._newPos._add(Lt),this._draggable._startPos._add(Lt),Be(h._icon,this._draggable._newPos),this._onDrag(l),this._panRequest=te(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&&(le(this._panRequest),this._panRequest=te(this._adjustPan.bind(this,l)))},_onDrag:function(l){var h=this._marker,x=h._shadow,w=Et(h._icon),k=h._map.layerPointToLatLng(w);x&&Be(x,w),h._latlng=k,l.latlng=k,l.oldLatLng=this._oldLatLng,h.fire("move",l).fire("drag",l)},_onDragEnd:function(l){le(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",l)}}),Qu=Oo.extend({options:{icon:new Yc,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){E(this,h),this._latlng=be(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=be(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"),x=l.icon.createIcon(this._icon),w=!1;x!==this._icon&&(this._icon&&this._removeIcon(),w=!0,l.title&&(x.title=l.title),x.tagName==="IMG"&&(x.alt=l.alt||"")),ge(x,h),l.keyboard&&(x.tabIndex="0",x.setAttribute("role","button")),this._icon=x,l.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&_t(x,"focus",this._panOnFocus,this);var k=l.icon.createShadow(this._shadow),N=!1;k!==this._shadow&&(this._removeShadow(),N=!0),k&&(ge(k,h),k.alt=""),this._shadow=k,l.opacity<1&&this._updateOpacity(),w&&this.getPane().appendChild(this._icon),this._initInteraction(),k&&N&&this.getPane(l.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&wi(this._icon,"focus",this._panOnFocus,this),he(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&he(this._shadow),this._shadow=null},_setPos:function(l){this._icon&&Be(this._icon,l),this._shadow&&Be(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),$p)){var l=this.options.draggable;this.dragging&&(l=this.dragging.enabled(),this.dragging.disable()),this.dragging=new $p(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&&re(this._icon,l),this._shadow&&re(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,x=h.iconSize?Te(h.iconSize):Te(0,0),w=h.iconAnchor?Te(h.iconAnchor):Te(0,0);l.panInside(this._latlng,{paddingTopLeft:w,paddingBottomRight:x.subtract(w)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Cb(l,h){return new Qu(l,h)}var Ca=Oo.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 E(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)}}),Ju=Ca.extend({options:{fill:!0,radius:10},initialize:function(l,h){E(this,h),this._latlng=be(l),this._radius=this.options.radius},setLatLng:function(l){var h=this._latlng;return this._latlng=be(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 Ca.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,x=this._clickTolerance(),w=[l+x,h+x];this._pxBounds=new pe(this._point.subtract(w),this._point.add(w))},_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 Eb(l,h){return new Ju(l,h)}var G=Ju.extend({initialize:function(l,h,x){if(typeof h=="number"&&(h=n({},x,{radius:h})),E(this,h),this._latlng=be(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 Rt(this._map.layerPointToLatLng(this._point.subtract(l)),this._map.layerPointToLatLng(this._point.add(l)))},setStyle:Ca.prototype.setStyle,_project:function(){var l=this._latlng.lng,h=this._latlng.lat,x=this._map,w=x.options.crs;if(w.distance===xt.distance){var k=Math.PI/180,N=this._mRadius/xt.R/k,ne=x.project([h+N,l]),De=x.project([h-N,l]),Ge=ne.add(De).divideBy(2),Lt=x.unproject(Ge).lat,Li=Math.acos((Math.cos(N*k)-Math.sin(h*k)*Math.sin(Lt*k))/(Math.cos(h*k)*Math.cos(Lt*k)))/k;(isNaN(Li)||Li===0)&&(Li=N/Math.cos(Math.PI/180*h)),this._point=Ge.subtract(x.getPixelOrigin()),this._radius=isNaN(Li)?0:Ge.x-x.project([Lt,l-Li]).x,this._radiusY=Ge.y-ne.y}else{var rn=w.unproject(w.project(this._latlng).subtract([this._mRadius,0]));this._point=x.latLngToLayerPoint(this._latlng),this._radius=this._point.x-x.latLngToLayerPoint(rn).x}this._updateBounds()}});function ve(l,h,x){return new G(l,h,x)}var Ze=Ca.extend({options:{smoothFactor:1,noClip:!1},initialize:function(l,h){E(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,x=null,w=ql,k,N,ne=0,De=this._parts.length;ne<De;ne++)for(var Ge=this._parts[ne],Lt=1,Li=Ge.length;Lt<Li;Lt++){k=Ge[Lt-1],N=Ge[Lt];var rn=w(l,k,N,!0);rn<h&&(h=rn,x=w(l,k,N))}return x&&(x.distance=Math.sqrt(h)),x},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return df(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(l,h){return h=h||this._defaultShape(),l=be(l),h.push(l),this._bounds.extend(l),this.redraw()},_setLatLngs:function(l){this._bounds=new Rt,this._latlngs=this._convertLatLngs(l)},_defaultShape:function(){return Do(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(l){for(var h=[],x=Do(l),w=0,k=l.length;w<k;w++)x?(h[w]=be(l[w]),this._bounds.extend(h[w])):h[w]=this._convertLatLngs(l[w]);return h},_project:function(){var l=new pe;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 _e(l,l);this._rawPxBounds&&(this._pxBounds=new pe([this._rawPxBounds.min.subtract(h),this._rawPxBounds.max.add(h)]))},_projectLatlngs:function(l,h,x){var w=l[0]instanceof St,k=l.length,N,ne;if(w){for(ne=[],N=0;N<k;N++)ne[N]=this._map.latLngToLayerPoint(l[N]),x.extend(ne[N]);h.push(ne)}else for(N=0;N<k;N++)this._projectLatlngs(l[N],h,x)},_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,x,w,k,N,ne,De,Ge;for(x=0,k=0,N=this._rings.length;x<N;x++)for(Ge=this._rings[x],w=0,ne=Ge.length;w<ne-1;w++)De=Vp(Ge[w],Ge[w+1],l,w,!0),De&&(h[k]=h[k]||[],h[k].push(De[0]),(De[1]!==Ge[w+1]||w===ne-2)&&(h[k].push(De[1]),k++))}},_simplifyPoints:function(){for(var l=this._parts,h=this.options.smoothFactor,x=0,w=l.length;x<w;x++)l[x]=rf(l[x],h)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(l,h){var x,w,k,N,ne,De,Ge=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(x=0,N=this._parts.length;x<N;x++)for(De=this._parts[x],w=0,ne=De.length,k=ne-1;w<ne;k=w++)if(!(!h&&w===0)&&Xc(l,De[k],De[w])<=Ge)return!0;return!1}});function We(l,h){return new Ze(l,h)}Ze._flat=cf;var Wt=Ze.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 sf(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(l){var h=Ze.prototype._convertLatLngs.call(this,l),x=h.length;return x>=2&&h[0]instanceof St&&h[0].equals(h[x-1])&&h.pop(),h},_setLatLngs:function(l){Ze.prototype._setLatLngs.call(this,l),Do(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Do(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var l=this._renderer._bounds,h=this.options.weight,x=new _e(h,h);if(l=new pe(l.min.subtract(x),l.max.add(x)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(l))){if(this.options.noClip){this._parts=this._rings;return}for(var w=0,k=this._rings.length,N;w<k;w++)N=Hp(this._rings[w],l,!0),N.length&&this._parts.push(N)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(l){var h=!1,x,w,k,N,ne,De,Ge,Lt;if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(N=0,Ge=this._parts.length;N<Ge;N++)for(x=this._parts[N],ne=0,Lt=x.length,De=Lt-1;ne<Lt;De=ne++)w=x[ne],k=x[De],w.y>l.y!=k.y>l.y&&l.x<(k.x-w.x)*(l.y-w.y)/(k.y-w.y)+w.x&&(h=!h);return h||Ze.prototype._containsPoint.call(this,l,!0)}});function oi(l,h){return new Wt(l,h)}var ai=_r.extend({initialize:function(l,h){E(this,h),this._layers={},l&&this.addData(l)},addData:function(l){var h=M(l)?l:l.features,x,w,k;if(h){for(x=0,w=h.length;x<w;x++)k=h[x],(k.geometries||k.geometry||k.features||k.coordinates)&&this.addData(k);return this}var N=this.options;if(N.filter&&!N.filter(l))return this;var ne=en(l,N);return ne?(ne.feature=vn(l),ne.defaultOptions=ne.options,this.resetStyle(ne),N.onEachFeature&&N.onEachFeature(l,ne),this.addLayer(ne)):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 en(l,h){var x=l.type==="Feature"?l.geometry:l,w=x?x.coordinates:null,k=[],N=h&&h.pointToLayer,ne=h&&h.coordsToLatLng||un,De,Ge,Lt,Li;if(!w&&!x)return null;switch(x.type){case"Point":return De=ne(w),_n(N,l,De,h);case"MultiPoint":for(Lt=0,Li=w.length;Lt<Li;Lt++)De=ne(w[Lt]),k.push(_n(N,l,De,h));return new _r(k);case"LineString":case"MultiLineString":return Ge=an(w,x.type==="LineString"?0:1,ne),new Ze(Ge,h);case"Polygon":case"MultiPolygon":return Ge=an(w,x.type==="Polygon"?1:2,ne),new Wt(Ge,h);case"GeometryCollection":for(Lt=0,Li=x.geometries.length;Lt<Li;Lt++){var rn=en({geometry:x.geometries[Lt],type:"Feature",properties:l.properties},h);rn&&k.push(rn)}return new _r(k);case"FeatureCollection":for(Lt=0,Li=x.features.length;Lt<Li;Lt++){var kn=en(x.features[Lt],h);kn&&k.push(kn)}return new _r(k);default:throw new Error("Invalid GeoJSON object.")}}function _n(l,h,x,w){return l?l(h,x):new Qu(x,w&&w.markersInheritOptions&&w)}function un(l){return new St(l[1],l[0],l[2])}function an(l,h,x){for(var w=[],k=0,N=l.length,ne;k<N;k++)ne=h?an(l[k],h-1,x):(x||un)(l[k]),w.push(ne);return w}function yn(l,h){return l=be(l),l.alt!==void 0?[p(l.lng,h),p(l.lat,h),p(l.alt,h)]:[p(l.lng,h),p(l.lat,h)]}function mn(l,h,x,w){for(var k=[],N=0,ne=l.length;N<ne;N++)k.push(h?mn(l[N],Do(l[N])?0:h-1,x,w):yn(l[N],w));return!h&&x&&k.length>0&&k.push(k[0].slice()),k}function Bn(l,h){return l.feature?n({},l.feature,{geometry:h}):vn(h)}function vn(l){return l.type==="Feature"||l.type==="FeatureCollection"?l:{type:"Feature",properties:{},geometry:l}}var Gn={toGeoJSON:function(l){return Bn(this,{type:"Point",coordinates:yn(this.getLatLng(),l)})}};Qu.include(Gn),G.include(Gn),Ju.include(Gn),Ze.include({toGeoJSON:function(l){var h=!Do(this._latlngs),x=mn(this._latlngs,h?1:0,!1,l);return Bn(this,{type:(h?"Multi":"")+"LineString",coordinates:x})}}),Wt.include({toGeoJSON:function(l){var h=!Do(this._latlngs),x=h&&!Do(this._latlngs[0]),w=mn(this._latlngs,x?2:h?1:0,!0,l);return h||(w=[w]),Bn(this,{type:(x?"Multi":"")+"Polygon",coordinates:w})}}),sl.include({toMultiPoint:function(l){var h=[];return this.eachLayer(function(x){h.push(x.toGeoJSON(l).geometry.coordinates)}),Bn(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 x=h==="GeometryCollection",w=[];return this.eachLayer(function(k){if(k.toGeoJSON){var N=k.toGeoJSON(l);if(x)w.push(N.geometry);else{var ne=vn(N);ne.type==="FeatureCollection"?w.push.apply(w,ne.features):w.push(ne)}}}),x?Bn(this,{geometries:w,type:"GeometryCollection"}):{type:"FeatureCollection",features:w}}});function hn(l,h){return new ai(l,h)}var Fs=hn,Ks=Oo.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(l,h,x){this._url=l,this._bounds=st(h),E(this,x)},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(){he(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&&ae(this._image),this},bringToBack:function(){return this._map&&fe(this._image),this},setUrl:function(l){return this._url=l,this._image&&(this._image.src=l),this},setBounds:function(l){return this._bounds=st(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:J("img");if(ge(h,"leaflet-image-layer"),this._zoomAnimated&&ge(h,"leaflet-zoom-animated"),this.options.className&&ge(h,this.options.className),h.onselectstart=g,h.onmousemove=g,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),x=this._map._latLngBoundsToNewLayerBounds(this._bounds,l.zoom,l.center).min;Me(this._image,x,h)},_reset:function(){var l=this._image,h=new pe(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),x=h.getSize();Be(l,h.min),l.style.width=x.x+"px",l.style.height=x.y+"px"},_updateOpacity:function(){re(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()}}),so=function(l,h,x){return new Ks(l,h,x)},ws=Ks.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:J("video");if(ge(h,"leaflet-image-layer"),this._zoomAnimated&&ge(h,"leaflet-zoom-animated"),this.options.className&&ge(h,this.options.className),h.onselectstart=g,h.onmousemove=g,h.onloadeddata=r(this.fire,this,"load"),l){for(var x=h.getElementsByTagName("source"),w=[],k=0;k<x.length;k++)w.push(x[k].src);this._url=x.length>0?w:[h.src];return}M(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 N=0;N<this._url.length;N++){var ne=J("source");ne.src=this._url[N],h.appendChild(ne)}}});function _s(l,h,x){return new ws(l,h,x)}var vs=Ks.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=g,l.onmousemove=g}});function Ls(l,h,x){return new vs(l,h,x)}var gs=Oo.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(l,h){l&&(l instanceof St||M(l))?(this._latlng=be(l),E(this,h)):(E(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&&re(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),l._fadeAnimated&&re(this._container,1),this.bringToFront(),this.options.interactive&&(ge(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(l){l._fadeAnimated?(re(this._container,0),this._removeTimeout=setTimeout(r(he,void 0,this._container),200)):he(this._container),this.options.interactive&&(Ee(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(l){return this._latlng=be(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&&ae(this._container),this},bringToBack:function(){return this._map&&fe(this._container),this},_prepareOpen:function(l){var h=this._source;if(!h._map)return!1;if(h instanceof _r){h=null;var x=this._source._layers;for(var w in x)if(x[w]._map){h=x[w];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=Te(this.options.offset),x=this._getAnchor();this._zoomAnimated?Be(this._container,l.add(x)):h=h.add(l).add(x);var w=this._containerBottom=-h.y,k=this._containerLeft=-Math.round(this._containerWidth/2)+h.x;this._container.style.bottom=w+"px",this._container.style.left=k+"px"}},_getAnchor:function(){return[0,0]}});zi.include({_initOverlay:function(l,h,x,w){var k=h;return k instanceof l||(k=new l(w).setContent(h)),x&&k.setLatLng(x),k}}),Oo.include({_initOverlay:function(l,h,x,w){var k=x;return k instanceof l?(E(k,w),k._source=this):(k=h&&!w?h:new l(w,this),k.setContent(x)),k}});var ir=gs.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,gs.prototype.openOn.call(this,l)},onAdd:function(l){gs.prototype.onAdd.call(this,l),l.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Ca||this._source.on("preclick",ni))},onRemove:function(l){gs.prototype.onRemove.call(this,l),l.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Ca||this._source.off("preclick",ni))},getEvents:function(){var l=gs.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=J("div",l+" "+(this.options.className||"")+" leaflet-zoom-animated"),x=this._wrapper=J("div",l+"-content-wrapper",h);if(this._contentNode=J("div",l+"-content",x),Xi(h),ei(this._contentNode),_t(h,"contextmenu",ni),this._tipContainer=J("div",l+"-tip-container",h),this._tip=J("div",l+"-tip",this._tipContainer),this.options.closeButton){var w=this._closeButton=J("a",l+"-close-button",h);w.setAttribute("role","button"),w.setAttribute("aria-label","Close popup"),w.href="#close",w.innerHTML='<span aria-hidden="true">&#215;</span>',_t(w,"click",function(k){Yi(k),this.close()},this)}},_updateLayout:function(){var l=this._contentNode,h=l.style;h.width="",h.whiteSpace="nowrap";var x=l.offsetWidth;x=Math.min(x,this.options.maxWidth),x=Math.max(x,this.options.minWidth),h.width=x+1+"px",h.whiteSpace="",h.height="";var w=l.offsetHeight,k=this.options.maxHeight,N="leaflet-popup-scrolled";k&&w>k?(h.height=k+"px",ge(l,N)):Ee(l,N),this._containerWidth=this._container.offsetWidth},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center),x=this._getAnchor();Be(this._container,h.add(x))},_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(X(this._container,"marginBottom"),10)||0,x=this._container.offsetHeight+h,w=this._containerWidth,k=new _e(this._containerLeft,-x-this._containerBottom);k._add(Et(this._container));var N=l.layerPointToContainerPoint(k),ne=Te(this.options.autoPanPadding),De=Te(this.options.autoPanPaddingTopLeft||ne),Ge=Te(this.options.autoPanPaddingBottomRight||ne),Lt=l.getSize(),Li=0,rn=0;N.x+w+Ge.x>Lt.x&&(Li=N.x+w-Lt.x+Ge.x),N.x-Li-De.x<0&&(Li=N.x-De.x),N.y+x+Ge.y>Lt.y&&(rn=N.y+x-Lt.y+Ge.y),N.y-rn-De.y<0&&(rn=N.y-De.y),(Li||rn)&&(this.options.keepInView&&(this._autopanning=!0),l.fire("autopanstart").panBy([Li,rn]))}},_getAnchor:function(){return Te(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Ea=function(l,h){return new ir(l,h)};zi.mergeOptions({closePopupOnClick:!0}),zi.include({openPopup:function(l,h,x){return this._initOverlay(ir,l,h,x).openOn(this),this},closePopup:function(l){return l=arguments.length?l:this._popup,l&&l.close(),this}}),Oo.include({bindPopup:function(l,h){return this._popup=this._initOverlay(ir,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 _r||(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)){An(l);var h=l.layer||l.target;if(this._popup._source===h&&!(h instanceof Ca)){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 Is=gs.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(l){gs.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){gs.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=gs.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=J("div",h),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+d(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(l){var h,x,w=this._map,k=this._container,N=w.latLngToContainerPoint(w.getCenter()),ne=w.layerPointToContainerPoint(l),De=this.options.direction,Ge=k.offsetWidth,Lt=k.offsetHeight,Li=Te(this.options.offset),rn=this._getAnchor();De==="top"?(h=Ge/2,x=Lt):De==="bottom"?(h=Ge/2,x=0):De==="center"?(h=Ge/2,x=Lt/2):De==="right"?(h=0,x=Lt/2):De==="left"?(h=Ge,x=Lt/2):ne.x<N.x?(De="right",h=0,x=Lt/2):(De="left",h=Ge+(Li.x+rn.x)*2,x=Lt/2),l=l.subtract(Te(h,x,!0)).add(Li).add(rn),Ee(k,"leaflet-tooltip-right"),Ee(k,"leaflet-tooltip-left"),Ee(k,"leaflet-tooltip-top"),Ee(k,"leaflet-tooltip-bottom"),ge(k,"leaflet-tooltip-"+De),Be(k,l)},_updatePosition:function(){var l=this._map.latLngToLayerPoint(this._latlng);this._setPosition(l)},setOpacity:function(l){this.options.opacity=l,this._container&&re(this._container,l)},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center);this._setPosition(h)},_getAnchor:function(){return Te(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Fn=function(l,h){return new Is(l,h)};zi.include({openTooltip:function(l,h,x){return this._initOverlay(Is,l,h,x).openOn(this),this},closeTooltip:function(l){return l.close(),this}}),Oo.include({bindTooltip:function(l,h){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Is,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",x={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?x.add=this._openTooltip:(x.mouseover=this._openTooltip,x.mouseout=this.closeTooltip,x.click=this._openTooltip,this._map?this._addFocusListeners():x.add=this._addFocusListeners),this._tooltip.options.sticky&&(x.mousemove=this._moveTooltip),this[h](x),this._tooltipHandlersAdded=!l}},openTooltip:function(l){return this._tooltip&&(this instanceof _r||(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&&(_t(h,"focus",function(){this._tooltip._source=l,this.openTooltip()},this),_t(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,x,w;this._tooltip.options.sticky&&l.originalEvent&&(x=this._map.mouseEventToContainerPoint(l.originalEvent),w=this._map.containerPointToLayerPoint(x),h=this._map.layerPointToLatLng(w)),this._tooltip.setLatLng(h)}});var Ho=ol.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"),x=this.options;if(x.html instanceof Element?(Qe(h),h.appendChild(x.html)):h.innerHTML=x.html!==!1?x.html:"",x.bgPos){var w=Te(x.bgPos);h.style.backgroundPosition=-w.x+"px "+-w.y+"px"}return this._setIconStyles(h,"icon"),h},createShadow:function(){return null}});function vr(l){return new Ho(l)}ol.Default=Yc;var br=Oo.extend({options:{tileSize:256,opacity:1,updateWhenIdle:xe.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){E(this,l)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(l){l._addZoomLimit(this)},onRemove:function(l){this._removeAllTiles(),he(this._container),l._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(ae(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(fe(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=u(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 _e?l:new _e(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,x=-l(-1/0,1/0),w=0,k=h.length,N;w<k;w++)N=h[w].style.zIndex,h[w]!==this._container&&N&&(x=l(x,+N));isFinite(x)&&(this.options.zIndex=x+l(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!xe.ielt9){re(this._container,this.options.opacity);var l=+new Date,h=!1,x=!1;for(var w in this._tiles){var k=this._tiles[w];if(!(!k.current||!k.loaded)){var N=Math.min(1,(l-k.loaded)/200);re(k.el,N),N<1?h=!0:(k.active?x=!0:this._onOpaqueTile(k),k.active=!0)}}x&&!this._noPrune&&this._pruneTiles(),h&&(le(this._fadeFrame),this._fadeFrame=te(this._updateOpacity,this))}},_onOpaqueTile:g,_initContainer:function(){this._container||(this._container=J("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 x in this._levels)x=Number(x),this._levels[x].el.children.length||x===l?(this._levels[x].el.style.zIndex=h-Math.abs(l-x),this._onUpdateLevel(x)):(he(this._levels[x].el),this._removeTilesAtZoom(x),this._onRemoveLevel(x),delete this._levels[x]);var w=this._levels[l],k=this._map;return w||(w=this._levels[l]={},w.el=J("div","leaflet-tile-container leaflet-zoom-animated",this._container),w.el.style.zIndex=h,w.origin=k.project(k.unproject(k.getPixelOrigin()),l).round(),w.zoom=l,this._setZoomTransform(w,k.getCenter(),k.getZoom()),g(w.el.offsetWidth),this._onCreateLevel(w)),this._level=w,w}},_onUpdateLevel:g,_onRemoveLevel:g,_onCreateLevel:g,_pruneTiles:function(){if(this._map){var l,h,x=this._map.getZoom();if(x>this.options.maxZoom||x<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 w=h.coords;this._retainParent(w.x,w.y,w.z,w.z-5)||this._retainChildren(w.x,w.y,w.z,w.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)he(this._levels[l].el),this._onRemoveLevel(Number(l)),delete this._levels[l];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(l,h,x,w){var k=Math.floor(l/2),N=Math.floor(h/2),ne=x-1,De=new _e(+k,+N);De.z=+ne;var Ge=this._tileCoordsToKey(De),Lt=this._tiles[Ge];return Lt&&Lt.active?(Lt.retain=!0,!0):(Lt&&Lt.loaded&&(Lt.retain=!0),ne>w?this._retainParent(k,N,ne,w):!1)},_retainChildren:function(l,h,x,w){for(var k=2*l;k<2*l+2;k++)for(var N=2*h;N<2*h+2;N++){var ne=new _e(k,N);ne.z=x+1;var De=this._tileCoordsToKey(ne),Ge=this._tiles[De];if(Ge&&Ge.active){Ge.retain=!0;continue}else Ge&&Ge.loaded&&(Ge.retain=!0);x+1<w&&this._retainChildren(k,N,x+1,w)}},_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,x,w){var k=Math.round(h);this.options.maxZoom!==void 0&&k>this.options.maxZoom||this.options.minZoom!==void 0&&k<this.options.minZoom?k=void 0:k=this._clampZoom(k);var N=this.options.updateWhenZooming&&k!==this._tileZoom;(!w||N)&&(this._tileZoom=k,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),k!==void 0&&this._update(l),x||this._pruneTiles(),this._noPrune=!!x),this._setZoomTransforms(l,h)},_setZoomTransforms:function(l,h){for(var x in this._levels)this._setZoomTransform(this._levels[x],l,h)},_setZoomTransform:function(l,h,x){var w=this._map.getZoomScale(x,l.zoom),k=l.origin.multiplyBy(w).subtract(this._map._getNewPixelOrigin(h,x)).round();xe.any3d?Me(l.el,k,w):Be(l.el,k)},_resetGrid:function(){var l=this._map,h=l.options.crs,x=this._tileSize=this.getTileSize(),w=this._tileZoom,k=this._map.getPixelWorldBounds(this._tileZoom);k&&(this._globalTileRange=this._pxBoundsToTileRange(k)),this._wrapX=h.wrapLng&&!this.options.noWrap&&[Math.floor(l.project([0,h.wrapLng[0]],w).x/x.x),Math.ceil(l.project([0,h.wrapLng[1]],w).x/x.y)],this._wrapY=h.wrapLat&&!this.options.noWrap&&[Math.floor(l.project([h.wrapLat[0],0],w).y/x.x),Math.ceil(l.project([h.wrapLat[1],0],w).y/x.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(l){var h=this._map,x=h._animatingZoom?Math.max(h._animateToZoom,h.getZoom()):h.getZoom(),w=h.getZoomScale(x,this._tileZoom),k=h.project(l,this._tileZoom).floor(),N=h.getSize().divideBy(w*2);return new pe(k.subtract(N),k.add(N))},_update:function(l){var h=this._map;if(h){var x=this._clampZoom(h.getZoom());if(l===void 0&&(l=h.getCenter()),this._tileZoom!==void 0){var w=this._getTiledPixelBounds(l),k=this._pxBoundsToTileRange(w),N=k.getCenter(),ne=[],De=this.options.keepBuffer,Ge=new pe(k.getBottomLeft().subtract([De,-De]),k.getTopRight().add([De,-De]));if(!(isFinite(k.min.x)&&isFinite(k.min.y)&&isFinite(k.max.x)&&isFinite(k.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var Lt in this._tiles){var Li=this._tiles[Lt].coords;(Li.z!==this._tileZoom||!Ge.contains(new _e(Li.x,Li.y)))&&(this._tiles[Lt].current=!1)}if(Math.abs(x-this._tileZoom)>1){this._setView(l,x);return}for(var rn=k.min.y;rn<=k.max.y;rn++)for(var kn=k.min.x;kn<=k.max.x;kn++){var Ao=new _e(kn,rn);if(Ao.z=this._tileZoom,!!this._isValidTile(Ao)){var eo=this._tiles[this._tileCoordsToKey(Ao)];eo?eo.current=!0:ne.push(Ao)}}if(ne.sort(function(Wo,th){return Wo.distanceTo(N)-th.distanceTo(N)}),ne.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Cr=document.createDocumentFragment();for(kn=0;kn<ne.length;kn++)this._addTile(ne[kn],Cr);this._level.el.appendChild(Cr)}}}},_isValidTile:function(l){var h=this._map.options.crs;if(!h.infinite){var x=this._globalTileRange;if(!h.wrapLng&&(l.x<x.min.x||l.x>x.max.x)||!h.wrapLat&&(l.y<x.min.y||l.y>x.max.y))return!1}if(!this.options.bounds)return!0;var w=this._tileCoordsToBounds(l);return st(this.options.bounds).overlaps(w)},_keyToBounds:function(l){return this._tileCoordsToBounds(this._keyToTileCoords(l))},_tileCoordsToNwSe:function(l){var h=this._map,x=this.getTileSize(),w=l.scaleBy(x),k=w.add(x),N=h.unproject(w,l.z),ne=h.unproject(k,l.z);return[N,ne]},_tileCoordsToBounds:function(l){var h=this._tileCoordsToNwSe(l),x=new Rt(h[0],h[1]);return this.options.noWrap||(x=this._map.wrapLatLngBounds(x)),x},_tileCoordsToKey:function(l){return l.x+":"+l.y+":"+l.z},_keyToTileCoords:function(l){var h=l.split(":"),x=new _e(+h[0],+h[1]);return x.z=+h[2],x},_removeTile:function(l){var h=this._tiles[l];h&&(he(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=g,l.onmousemove=g,xe.ielt9&&this.options.opacity<1&&re(l,this.options.opacity)},_addTile:function(l,h){var x=this._getTilePos(l),w=this._tileCoordsToKey(l),k=this.createTile(this._wrapCoords(l),r(this._tileReady,this,l));this._initTile(k),this.createTile.length<2&&te(r(this._tileReady,this,l,null,k)),Be(k,x),this._tiles[w]={el:k,coords:l,current:!0},h.appendChild(k),this.fire("tileloadstart",{tile:k,coords:l})},_tileReady:function(l,h,x){h&&this.fire("tileerror",{error:h,tile:x,coords:l});var w=this._tileCoordsToKey(l);x=this._tiles[w],x&&(x.loaded=+new Date,this._map._fadeAnimated?(re(x.el,0),le(this._fadeFrame),this._fadeFrame=te(this._updateOpacity,this)):(x.active=!0,this._pruneTiles()),h||(ge(x.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:x.el,coords:l})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),xe.ielt9||!this._map._fadeAnimated?te(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 _e(this._wrapX?f(l.x,this._wrapX):l.x,this._wrapY?f(l.y,this._wrapY):l.y);return h.z=l.z,h},_pxBoundsToTileRange:function(l){var h=this.getTileSize();return new pe(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 ff(l){return new br(l)}var ya=br.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=E(this,h),h.detectRetina&&xe.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 x=document.createElement("img");return _t(x,"load",r(this._tileOnLoad,this,h,x)),_t(x,"error",r(this._tileOnError,this,h,x)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(x.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(x.referrerPolicy=this.options.referrerPolicy),x.alt="",x.src=this.getTileUrl(l),x},getTileUrl:function(l){var h={r:xe.retina?"@2x":"",s:this._getSubdomain(l),x:l.x,y:l.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var x=this._globalTileRange.max.y-l.y;this.options.tms&&(h.y=x),h["-y"]=x}return I(this._url,n(h,this.options))},_tileOnLoad:function(l,h){xe.ielt9?setTimeout(r(l,this,null,h),0):l(null,h)},_tileOnError:function(l,h,x){var w=this.options.errorTileUrl;w&&h.getAttribute("src")!==w&&(h.src=w),l(x,h)},_onTileRemove:function(l){l.tile.onload=null},_getZoomForUrl:function(){var l=this._tileZoom,h=this.options.maxZoom,x=this.options.zoomReverse,w=this.options.zoomOffset;return x&&(l=h-l),l+w},_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=g,h.onerror=g,!h.complete)){h.src=T;var x=this._tiles[l].coords;he(h),delete this._tiles[l],this.fire("tileabort",{tile:h,coords:x})}},_removeTile:function(l){var h=this._tiles[l];if(h)return h.el.setAttribute("src",T),br.prototype._removeTile.call(this,l)},_tileReady:function(l,h,x){if(!(!this._map||x&&x.getAttribute("src")===T))return br.prototype._tileReady.call(this,l,h,x)}});function eh(l,h){return new ya(l,h)}var qr=ya.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 x=n({},this.defaultWmsParams);for(var w in h)w in this.options||(x[w]=h[w]);h=E(this,h);var k=h.detectRetina&&xe.retina?2:1,N=this.getTileSize();x.width=N.x*k,x.height=N.y*k,this.wmsParams=x},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,ya.prototype.onAdd.call(this,l)},getTileUrl:function(l){var h=this._tileCoordsToNwSe(l),x=this._crs,w=ut(x.project(h[0]),x.project(h[1])),k=w.min,N=w.max,ne=(this._wmsVersion>=1.3&&this._crs===Yu?[k.y,k.x,N.y,N.x]:[k.x,k.y,N.x,N.y]).join(","),De=ya.prototype.getTileUrl.call(this,l);return De+y(this.wmsParams,De,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+ne},setParams:function(l,h){return n(this.wmsParams,l),h||this.redraw(),this}});function yb(l,h){return new qr(l,h)}ya.WMS=qr,eh.wms=yb;var Gr=Oo.extend({options:{padding:.1},initialize:function(l){E(this,l),d(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 x=this._map.getZoomScale(h,this._zoom),w=this._map.getSize().multiplyBy(.5+this.options.padding),k=this._map.project(this._center,h),N=w.multiplyBy(-x).add(k).subtract(this._map._getNewPixelOrigin(l,h));xe.any3d?Me(this._container,N,x):Be(this._container,N)},_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(),x=this._map.containerPointToLayerPoint(h.multiplyBy(-l)).round();this._bounds=new pe(x,x.add(h.multiplyBy(1+l*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Mn=Gr.extend({options:{tolerance:0},getEvents:function(){var l=Gr.prototype.getEvents.call(this);return l.viewprereset=this._onViewPreReset,l},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Gr.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var l=this._container=document.createElement("canvas");_t(l,"mousemove",this._onMouseMove,this),_t(l,"click dblclick mousedown mouseup contextmenu",this._onClick,this),_t(l,"mouseout",this._handleMouseOut,this),l._leaflet_disable_events=!0,this._ctx=l.getContext("2d")},_destroyContainer:function(){le(this._redrawRequest),delete this._ctx,he(this._container),wi(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)){Gr.prototype._update.call(this);var l=this._bounds,h=this._container,x=l.getSize(),w=xe.retina?2:1;Be(h,l.min),h.width=w*x.x,h.height=w*x.y,h.style.width=x.x+"px",h.style.height=x.y+"px",xe.retina&&this._ctx.scale(2,2),this._ctx.translate(-l.min.x,-l.min.y),this.fire("update")}},_reset:function(){Gr.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(l){this._updateDashArray(l),this._layers[d(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,x=h.next,w=h.prev;x?x.prev=w:this._drawLast=w,w?w.next=x:this._drawFirst=x,delete l._order,delete this._layers[d(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(/[, ]+/),x=[],w,k;for(k=0;k<h.length;k++){if(w=Number(h[k]),isNaN(w))return;x.push(w)}l.options._dashArray=x}else l.options._dashArray=l.options.dashArray},_requestRedraw:function(l){this._map&&(this._extendRedrawBounds(l),this._redrawRequest=this._redrawRequest||te(this._redraw,this))},_extendRedrawBounds:function(l){if(l._pxBounds){var h=(l.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new pe,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 x=h.getSize();this._ctx.beginPath(),this._ctx.rect(h.min.x,h.min.y,x.x,x.y),this._ctx.clip()}this._drawing=!0;for(var w=this._drawFirst;w;w=w.next)l=w.layer,(!h||l._pxBounds&&l._pxBounds.intersects(h))&&l._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(l,h){if(this._drawing){var x,w,k,N,ne=l._parts,De=ne.length,Ge=this._ctx;if(De){for(Ge.beginPath(),x=0;x<De;x++){for(w=0,k=ne[x].length;w<k;w++)N=ne[x][w],Ge[w?"lineTo":"moveTo"](N.x,N.y);h&&Ge.closePath()}this._fillStroke(Ge,l)}}},_updateCircle:function(l){if(!(!this._drawing||l._empty())){var h=l._point,x=this._ctx,w=Math.max(Math.round(l._radius),1),k=(Math.max(Math.round(l._radiusY),1)||w)/w;k!==1&&(x.save(),x.scale(1,k)),x.beginPath(),x.arc(h.x,h.y/k,w,0,Math.PI*2,!1),k!==1&&x.restore(),this._fillStroke(x,l)}},_fillStroke:function(l,h){var x=h.options;x.fill&&(l.globalAlpha=x.fillOpacity,l.fillStyle=x.fillColor||x.color,l.fill(x.fillRule||"evenodd")),x.stroke&&x.weight!==0&&(l.setLineDash&&l.setLineDash(h.options&&h.options._dashArray||[]),l.globalAlpha=x.opacity,l.lineWidth=x.weight,l.strokeStyle=x.color,l.lineCap=x.lineCap,l.lineJoin=x.lineJoin,l.stroke())},_onClick:function(l){for(var h=this._map.mouseEventToLayerPoint(l),x,w,k=this._drawFirst;k;k=k.next)x=k.layer,x.options.interactive&&x._containsPoint(h)&&(!(l.type==="click"||l.type==="preclick")||!this._map._draggableMoved(x))&&(w=x);this._fireEvent(w?[w]:!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&&(Ee(this._container,"leaflet-interactive"),this._fireEvent([h],l,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(l,h){if(!this._mouseHoverThrottled){for(var x,w,k=this._drawFirst;k;k=k.next)x=k.layer,x.options.interactive&&x._containsPoint(h)&&(w=x);w!==this._hoveredLayer&&(this._handleMouseOut(l),w&&(ge(this._container,"leaflet-interactive"),this._fireEvent([w],l,"mouseover"),this._hoveredLayer=w)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,l),this._mouseHoverThrottled=!0,setTimeout(r(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(l,h,x){this._map._fireDOMEvent(h,x||h.type,l)},_bringToFront:function(l){var h=l._order;if(h){var x=h.next,w=h.prev;if(x)x.prev=w;else return;w?w.next=x:x&&(this._drawFirst=x),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 x=h.next,w=h.prev;if(w)w.next=x;else return;x?x.prev=w:w&&(this._drawLast=w),h.prev=null,h.next=this._drawFirst,this._drawFirst.prev=h,this._drawFirst=h,this._requestRedraw(l)}}});function Zs(l){return xe.canvas?new Mn(l):null}var wa=(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">')}})(),gf={_initContainer:function(){this._container=J("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Gr.prototype._update.call(this),this.fire("update"))},_initPath:function(l){var h=l._container=wa("shape");ge(h,"leaflet-vml-shape "+(this.options.className||"")),h.coordsize="1 1",l._path=wa("path"),h.appendChild(l._path),this._updateStyle(l),this._layers[d(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;he(h),l.removeInteractiveTarget(h),delete this._layers[d(l)]},_updateStyle:function(l){var h=l._stroke,x=l._fill,w=l.options,k=l._container;k.stroked=!!w.stroke,k.filled=!!w.fill,w.stroke?(h||(h=l._stroke=wa("stroke")),k.appendChild(h),h.weight=w.weight+"px",h.color=w.color,h.opacity=w.opacity,w.dashArray?h.dashStyle=M(w.dashArray)?w.dashArray.join(" "):w.dashArray.replace(/( *, *)/g," "):h.dashStyle="",h.endcap=w.lineCap.replace("butt","flat"),h.joinstyle=w.lineJoin):h&&(k.removeChild(h),l._stroke=null),w.fill?(x||(x=l._fill=wa("fill")),k.appendChild(x),x.color=w.fillColor||w.color,x.opacity=w.fillOpacity):x&&(k.removeChild(x),l._fill=null)},_updateCircle:function(l){var h=l._point.round(),x=Math.round(l._radius),w=Math.round(l._radiusY||x);this._setPath(l,l._empty()?"M0 0":"AL "+h.x+","+h.y+" "+x+","+w+" 0,"+65535*360)},_setPath:function(l,h){l._path.v=h},_bringToFront:function(l){ae(l._container)},_bringToBack:function(l){fe(l._container)}},Up=xe.vml?wa:Vt,pf=Gr.extend({_initContainer:function(){this._container=Up("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Up("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){he(this._container),wi(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Gr.prototype._update.call(this);var l=this._bounds,h=l.getSize(),x=this._container;(!this._svgSize||!this._svgSize.equals(h))&&(this._svgSize=h,x.setAttribute("width",h.x),x.setAttribute("height",h.y)),Be(x,l.min),x.setAttribute("viewBox",[l.min.x,l.min.y,h.x,h.y].join(" ")),this.fire("update")}},_initPath:function(l){var h=l._path=Up("path");l.options.className&&ge(h,l.options.className),l.options.interactive&&ge(h,"leaflet-interactive"),this._updateStyle(l),this._layers[d(l)]=l},_addPath:function(l){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(l._path),l.addInteractiveTarget(l._path)},_removePath:function(l){he(l._path),l.removeInteractiveTarget(l._path),delete this._layers[d(l)]},_updatePath:function(l){l._project(),l._update()},_updateStyle:function(l){var h=l._path,x=l.options;h&&(x.stroke?(h.setAttribute("stroke",x.color),h.setAttribute("stroke-opacity",x.opacity),h.setAttribute("stroke-width",x.weight),h.setAttribute("stroke-linecap",x.lineCap),h.setAttribute("stroke-linejoin",x.lineJoin),x.dashArray?h.setAttribute("stroke-dasharray",x.dashArray):h.removeAttribute("stroke-dasharray"),x.dashOffset?h.setAttribute("stroke-dashoffset",x.dashOffset):h.removeAttribute("stroke-dashoffset")):h.setAttribute("stroke","none"),x.fill?(h.setAttribute("fill",x.fillColor||x.color),h.setAttribute("fill-opacity",x.fillOpacity),h.setAttribute("fill-rule",x.fillRule||"evenodd")):h.setAttribute("fill","none"))},_updatePoly:function(l,h){this._setPath(l,zt(l._parts,h))},_updateCircle:function(l){var h=l._point,x=Math.max(Math.round(l._radius),1),w=Math.max(Math.round(l._radiusY),1)||x,k="a"+x+","+w+" 0 1,0 ",N=l._empty()?"M0 0":"M"+(h.x-x)+","+h.y+k+x*2+",0 "+k+-x*2+",0 ";this._setPath(l,N)},_setPath:function(l,h){l._path.setAttribute("d",h)},_bringToFront:function(l){ae(l._path)},_bringToBack:function(l){fe(l._path)}});xe.vml&&pf.include(gf);function tS(l){return xe.svg||xe.vml?new pf(l):null}zi.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&&Zs(l)||tS(l)}});var iS=Wt.extend({initialize:function(l,h){Wt.prototype.initialize.call(this,this._boundsToLatLngs(l),h)},setBounds:function(l){return this.setLatLngs(this._boundsToLatLngs(l))},_boundsToLatLngs:function(l){return l=st(l),[l.getSouthWest(),l.getNorthWest(),l.getNorthEast(),l.getSouthEast()]}});function BF(l,h){return new iS(l,h)}pf.create=Up,pf.pointsToPath=zt,ai.geometryToLayer=en,ai.coordsToLatLng=un,ai.coordsToLatLngs=an,ai.latLngToCoords=yn,ai.latLngsToCoords=mn,ai.getFeature=Bn,ai.asFeature=vn,zi.mergeOptions({boxZoom:!0});var nS=tr.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(){_t(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){wi(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){he(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(),Ct(),Ve(),this._startPoint=this._map.mouseEventToContainerPoint(l),_t(document,{contextmenu:An,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(l){this._moved||(this._moved=!0,this._box=J("div","leaflet-zoom-box",this._container),ge(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(l);var h=new pe(this._point,this._startPoint),x=h.getSize();Be(this._box,h.min),this._box.style.width=x.x+"px",this._box.style.height=x.y+"px"},_finish:function(){this._moved&&(he(this._box),Ee(this._container,"leaflet-crosshair")),Ie(),Xe(),wi(document,{contextmenu:An,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 Rt(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())}});zi.addInitHook("addHandler","boxZoom",nS),zi.mergeOptions({doubleClickZoom:!0});var sS=tr.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,x=h.getZoom(),w=h.options.zoomDelta,k=l.originalEvent.shiftKey?x-w:x+w;h.options.doubleClickZoom==="center"?h.setZoom(k):h.setZoomAround(l.containerPoint,k)}});zi.addInitHook("addHandler","doubleClickZoom",sS),zi.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var oS=tr.extend({addHooks:function(){if(!this._draggable){var l=this._map;this._draggable=new Ur(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(){Ee(this._map._container,"leaflet-grab"),Ee(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=st(this._map.options.maxBounds);this._offsetLimit=ut(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,x=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(x),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),x=this._initialWorldOffset,w=this._draggable._newPos.x,k=(w-h+x)%l+h-x,N=(w+h+x)%l-h-x,ne=Math.abs(k+x)<Math.abs(N+x)?k:N;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=ne},_onDragEnd:function(l){var h=this._map,x=h.options,w=!x.inertia||l.noInertia||this._times.length<2;if(h.fire("dragend",l),w)h.fire("moveend");else{this._prunePositions(+new Date);var k=this._lastPos.subtract(this._positions[0]),N=(this._lastTime-this._times[0])/1e3,ne=x.easeLinearity,De=k.multiplyBy(ne/N),Ge=De.distanceTo([0,0]),Lt=Math.min(x.inertiaMaxSpeed,Ge),Li=De.multiplyBy(Lt/Ge),rn=Lt/(x.inertiaDeceleration*ne),kn=Li.multiplyBy(-rn/2).round();!kn.x&&!kn.y?h.fire("moveend"):(kn=h._limitOffset(kn,h.options.maxBounds),te(function(){h.panBy(kn,{duration:rn,easeLinearity:ne,noMoveStart:!0,animate:!0})}))}}});zi.addInitHook("addHandler","dragging",oS),zi.mergeOptions({keyboard:!0,keyboardPanDelta:80});var rS=tr.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"),_t(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(),wi(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,x=l.scrollTop||h.scrollTop,w=l.scrollLeft||h.scrollLeft;this._map._container.focus(),window.scrollTo(w,x)}},_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={},x=this.keyCodes,w,k;for(w=0,k=x.left.length;w<k;w++)h[x.left[w]]=[-1*l,0];for(w=0,k=x.right.length;w<k;w++)h[x.right[w]]=[l,0];for(w=0,k=x.down.length;w<k;w++)h[x.down[w]]=[0,l];for(w=0,k=x.up.length;w<k;w++)h[x.up[w]]=[0,-1*l]},_setZoomDelta:function(l){var h=this._zoomKeys={},x=this.keyCodes,w,k;for(w=0,k=x.zoomIn.length;w<k;w++)h[x.zoomIn[w]]=l;for(w=0,k=x.zoomOut.length;w<k;w++)h[x.zoomOut[w]]=-l},_addHooks:function(){_t(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){wi(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(l){if(!(l.altKey||l.ctrlKey||l.metaKey)){var h=l.keyCode,x=this._map,w;if(h in this._panKeys){if(!x._panAnim||!x._panAnim._inProgress)if(w=this._panKeys[h],l.shiftKey&&(w=Te(w).multiplyBy(3)),x.options.maxBounds&&(w=x._limitOffset(Te(w),x.options.maxBounds)),x.options.worldCopyJump){var k=x.wrapLatLng(x.unproject(x.project(x.getCenter()).add(w)));x.panTo(k)}else x.panBy(w)}else if(h in this._zoomKeys)x.setZoom(x.getZoom()+(l.shiftKey?3:1)*this._zoomKeys[h]);else if(h===27&&x._popup&&x._popup.options.closeOnEscapeKey)x.closePopup();else return;An(l)}}});zi.addInitHook("addHandler","keyboard",rS),zi.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var aS=tr.extend({addHooks:function(){_t(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){wi(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(l){var h=Bs(l),x=this._map.options.wheelDebounceTime;this._delta+=h,this._lastMousePos=this._map.mouseEventToContainerPoint(l),this._startTime||(this._startTime=+new Date);var w=Math.max(x-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),w),An(l)},_performZoom:function(){var l=this._map,h=l.getZoom(),x=this._map.options.zoomSnap||0;l._stop();var w=this._delta/(this._map.options.wheelPxPerZoomLevel*4),k=4*Math.log(2/(1+Math.exp(-Math.abs(w))))/Math.LN2,N=x?Math.ceil(k/x)*x:k,ne=l._limitZoom(h+(this._delta>0?N:-N))-h;this._delta=0,this._startTime=null,ne&&(l.options.scrollWheelZoom==="center"?l.setZoom(h+ne):l.setZoomAround(this._lastMousePos,h+ne))}});zi.addInitHook("addHandler","scrollWheelZoom",aS);var FF=600;zi.mergeOptions({tapHold:xe.touchNative&&xe.safari&&xe.mobile,tapTolerance:15});var lS=tr.extend({addHooks:function(){_t(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){wi(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 _e(h.clientX,h.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(_t(document,"touchend",Yi),_t(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",h))},this),FF),_t(document,"touchend touchcancel contextmenu",this._cancel,this),_t(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function l(){wi(document,"touchend",Yi),wi(document,"touchend touchcancel",l)},_cancel:function(){clearTimeout(this._holdTimeout),wi(document,"touchend touchcancel contextmenu",this._cancel,this),wi(document,"touchmove",this._onMove,this)},_onMove:function(l){var h=l.touches[0];this._newPos=new _e(h.clientX,h.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(l,h){var x=new MouseEvent(l,{bubbles:!0,cancelable:!0,view:window,screenX:h.screenX,screenY:h.screenY,clientX:h.clientX,clientY:h.clientY});x._simulated=!0,h.target.dispatchEvent(x)}});zi.addInitHook("addHandler","tapHold",lS),zi.mergeOptions({touchZoom:xe.touch,bounceAtZoomLimits:!0});var cS=tr.extend({addHooks:function(){ge(this._map._container,"leaflet-touch-zoom"),_t(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Ee(this._map._container,"leaflet-touch-zoom"),wi(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 x=h.mouseEventToContainerPoint(l.touches[0]),w=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(x.add(w)._divideBy(2))),this._startDist=x.distanceTo(w),this._startZoom=h.getZoom(),this._moved=!1,this._zooming=!0,h._stop(),_t(document,"touchmove",this._onTouchMove,this),_t(document,"touchend touchcancel",this._onTouchEnd,this),Yi(l)}},_onTouchMove:function(l){if(!(!l.touches||l.touches.length!==2||!this._zooming)){var h=this._map,x=h.mouseEventToContainerPoint(l.touches[0]),w=h.mouseEventToContainerPoint(l.touches[1]),k=x.distanceTo(w)/this._startDist;if(this._zoom=h.getScaleZoom(k,this._startZoom),!h.options.bounceAtZoomLimits&&(this._zoom<h.getMinZoom()&&k<1||this._zoom>h.getMaxZoom()&&k>1)&&(this._zoom=h._limitZoom(this._zoom)),h.options.touchZoom==="center"){if(this._center=this._startLatLng,k===1)return}else{var N=x._add(w)._divideBy(2)._subtract(this._centerPoint);if(k===1&&N.x===0&&N.y===0)return;this._center=h.unproject(h.project(this._pinchStartLatLng,this._zoom).subtract(N),this._zoom)}this._moved||(h._moveStart(!0,!1),this._moved=!0),le(this._animRequest);var ne=r(h._move,h,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=te(ne,this,!0),Yi(l)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,le(this._animRequest),wi(document,"touchmove",this._onTouchMove,this),wi(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))}});zi.addInitHook("addHandler","touchZoom",cS),zi.BoxZoom=nS,zi.DoubleClickZoom=sS,zi.Drag=oS,zi.Keyboard=rS,zi.ScrollWheelZoom=aS,zi.TapHold=lS,zi.TouchZoom=cS,t.Bounds=pe,t.Browser=xe,t.CRS=Tt,t.Canvas=Mn,t.Circle=G,t.CircleMarker=Ju,t.Class=oe,t.Control=Hn,t.DivIcon=Ho,t.DivOverlay=gs,t.DomEvent=es,t.DomUtil=Mt,t.Draggable=Ur,t.Evented=ke,t.FeatureGroup=_r,t.GeoJSON=ai,t.GridLayer=br,t.Handler=tr,t.Icon=ol,t.ImageOverlay=Ks,t.LatLng=St,t.LatLngBounds=Rt,t.Layer=Oo,t.LayerGroup=sl,t.LineUtil=xb,t.Map=zi,t.Marker=Qu,t.Mixin=hb,t.Path=Ca,t.Point=_e,t.PolyUtil=Wp,t.Polygon=Wt,t.Polyline=Ze,t.Popup=ir,t.PosAnimation=as,t.Projection=mb,t.Rectangle=iS,t.Renderer=Gr,t.SVG=pf,t.SVGOverlay=vs,t.TileLayer=ya,t.Tooltip=Is,t.Transformation=Ot,t.Util=we,t.VideoOverlay=ws,t.bind=r,t.bounds=ut,t.canvas=Zs,t.circle=ve,t.circleMarker=Eb,t.control=qn,t.divIcon=vr,t.extend=n,t.featureGroup=hf,t.geoJSON=hn,t.geoJson=Fs,t.gridLayer=ff,t.icon=bb,t.imageOverlay=so,t.latLng=be,t.latLngBounds=st,t.layerGroup=vb,t.map=Gs,t.marker=Cb,t.point=Te,t.polygon=oi,t.polyline=We,t.popup=Ea,t.rectangle=BF,t.setOptions=E,t.stamp=d,t.svg=tS,t.svgOverlay=Ls,t.tileLayer=eh,t.tooltip=Fn,t.transformation=di,t.version=i,t.videoOverlay=_s;var LF=window.L;t.noConflict=function(){return window.L=LF,this},window.L=t}))})($f,$f.exports)),$f.exports}var zK=WK();const Df=W9(zK),VK="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=",jK="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==",$K="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",Wn=(o,e=Rv)=>{var t=UK(),i=_(v(t),2),n=v(i);j(()=>W(n,e())),A(o,t)};var UK=F('<span class="tip svelte-767znw"><span class="tip-icon svelte-767znw">ℹ</span> <span class="tip-box svelte-767znw"> </span></span>'),qK=F("<button> </button>"),GK=F('<span class="err svelte-767znw"> </span>'),KK=F('<span class="ok svelte-767znw"> </span>'),ZK=F('<div class="loading svelte-767znw">Loading…</div>'),XK=F('<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>'),YK=F('<div class="field svelte-767znw"><label class="svelte-767znw">CA certificate <!></label> <textarea rows="4" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" spellcheck="false" class="svelte-767znw"></textarea></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client certificate <!></label> <textarea rows="4" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" spellcheck="false" class="svelte-767znw"></textarea></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client private key <!></label> <textarea rows="4" placeholder="-----BEGIN PRIVATE KEY----- … -----END PRIVATE KEY-----" spellcheck="false" class="svelte-767znw"></textarea></div>',1),QK=F('<section id="sec-mqtt" class="svelte-767znw"><h3 class="svelte-767znw">MQTT</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Protocol <!></label> <select class="svelte-767znw"><option>mqtt (plain TCP)</option><option>mqtts (TLS)</option><option>ws (WebSocket)</option><option>wss (WebSocket + TLS)</option></select></div> <div class="field svelte-767znw"><label class="svelte-767znw">Broker address <!></label> <input type="text" placeholder="localhost:1883" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Username <!></label> <input type="text" placeholder="(optional)" autocomplete="off" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Password <!></label> <input type="password" placeholder="(optional)" autocomplete="new-password" class="svelte-767znw"/></div> <!> <div class="field svelte-767znw"><label class="svelte-767znw">MQTT protocol version <!></label> <select class="svelte-767znw"><option>3.1.1 (default)</option><option>5.0</option></select></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client name <!></label> <input type="text" placeholder="she" 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>'),JK=F('<div class="field svelte-767znw"><label class="svelte-767znw"> <!></label> <input type="password" placeholder="Enter new password" autocomplete="new-password" class="svelte-767znw"/></div>'),eZ=F('<div class="field svelte-767znw"><label class="svelte-767znw">Proxy user header <!></label> <input type="text" placeholder="X-Remote-User" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Logout URL <!></label> <input type="text" placeholder="https://auth.example.com/…/end-session/" class="svelte-767znw"/></div>',1),tZ=F('<div class="field-error svelte-767znw"> </div>'),iZ=F('<div class="field-ok svelte-767znw"> </div>'),nZ=F('<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>'),sZ=F('<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>'),oZ=F('<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" 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>'),rZ=F('<section id="sec-git" class="svelte-767znw"><h3 class="svelte-767znw">Git</h3> <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> Auto-commit on save <!></label></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> Auto-push after commit <!></label></div></section>'),bA=F("<option> </option>"),aZ=F('<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>'),lZ=F('<section id="sec-solar" class="svelte-767znw"><h3 class="svelte-767znw">Location</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Timezone <!></label> <input type="text" list="tz-list" placeholder="(system default)" autocomplete="off" spellcheck="false" class="svelte-767znw"/> <datalist id="tz-list"></datalist></div> <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>'),cZ=F('<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>'),dZ=F('<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>'),uZ=F('<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" 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>'),hZ=F('<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>'),fZ=F('<span class="free-badge svelte-767znw">FREE</span> ',1),gZ=F('&nbsp;— <a target="_blank" rel="noreferrer" class="svelte-767znw">Get API key ↗</a>',1),pZ=F("<div><!> <!></div>"),xZ=F('<div class="field svelte-767znw"><label class="svelte-767znw">Base URL <!></label> <input type="text" class="svelte-767znw"/></div>'),mZ=F('<div class="field svelte-767znw"><label class="svelte-767znw">API key <!></label> <input type="password" placeholder="sk-…" autocomplete="off" class="svelte-767znw"/></div>'),_Z=F('<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>'),vZ=F('<div class="config-form svelte-767znw"><!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!></div>'),bZ=F('<!> <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>',1);function CZ(o,e){Os(e,!0),delete Df.Icon.Default.prototype._getIconUrl,Df.Icon.Default.mergeOptions({iconUrl:VK,iconRetinaUrl:jK,shadowUrl:$K});let t=P(Di(NK())),i=P("~/.she"),n=P("mqtt"),s=P(""),r=P(""),a=P(""),d=P(""),u=P(""),f=P(""),g=P("logic"),p=P("var"),C=P(""),b=P(!1),E=P(8080),y=P(""),D=P("none"),I=P(""),M=P("X-Remote-User"),R=P(""),T=P(!1),V=P(""),O=P(""),Q=P(""),ie=P(!1),de=P(!1),te=P(!1),le=P(""),we=P(48.7408),oe=P(9.1778),ye=P(!1),Re=P(void 0),ke=P(!1),_e=P(null),lt=P("info"),Te=P(""),pe=P(""),ut=P(!1),Rt=P(!1),st=P("");const St=[{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 be=P("ollama"),Tt=P("ollama"),xt=P(""),at=P(""),et=P("");const Ot={};let di="ollama";function dt(se,me){return se==="anthropic"?"anthropic":se==="ollama"?"ollama":me?me.includes("localhost:1234")?"lmstudio":me.includes("groq.com")?"groq":me.includes("googleapis.com")?"gemini":"openai":"openai"}function Ft(){Ot[di]={baseUrl:c(xt),model:c(at),apiKey:c(et)};const se=St.find(Ne=>Ne.id===c(be));if(!se)return;m(Tt,se.provider,!0);const me=Ot[c(be)];m(xt,(me==null?void 0:me.baseUrl)??se.baseUrl,!0),m(at,(me==null?void 0:me.model)??se.defaultModel,!0),m(et,(me==null?void 0:me.apiKey)??"",!0),di=c(be)}const Vt=It(()=>St.find(se=>se.id===c(be)));let zt=P(Di({}));const Qt=new Set(["url","name","variablePrefix","disableVariables","mqttUsername","mqttPassword","mqttCa","mqttCert","mqttKey","mqttVersion","port","bindAddress","auth","password","proxyHeader","proxyLogoutUrl","dir","disableWatch","gitAutoCommit","gitAutoPush","latitude","longitude","timezone","verbosity","dbPath","dbPrefix","dbPublish","dbRetain","redis","ai"]);zn(()=>{if(!c(Re))return;const se=typeof c(we)=="number"?c(we):48.7408,me=typeof c(oe)=="number"?c(oe):9.1778,Ne=Df.map(c(Re)).setView([se,me],10);Df.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(Ne);const Y=Df.marker([se,me],{draggable:!0}).addTo(Ne);m(_e,Y,!0);const ze=He=>{m(we,+He.lat.toFixed(6)),m(oe,+He.lng.toFixed(6))};return Y.on("dragend",()=>ze(Y.getLatLng())),Ne.on("click",He=>{Y.setLatLng(He.latlng),ze(He.latlng)}),()=>{m(_e,null),Ne.remove()}}),zn(()=>{!c(_e)||c(we)===""||c(oe)===""||c(_e).setLatLng([Number(c(we)),Number(c(oe))])});let vt;function Pi(){if(!navigator.geolocation){vt.show("Geolocation is not supported by this browser.",{alert:!0});return}m(ke,!0),navigator.geolocation.getCurrentPosition(se=>{m(we,+se.coords.latitude.toFixed(6)),m(oe,+se.coords.longitude.toFixed(6)),m(ke,!1)},()=>{m(ke,!1)})}let Ai=P(!0),hi=P(!1),$i=P(""),Mi=P(""),Ci=P(""),Ji=P("appearance");const Ki=[{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","protocol","version","mqtt5"]},{id:"webserver",label:"Web server",terms:["port","http","server","bind","address"]},{id:"scripts",label:"Scripts",terms:["directory","watch","hot reload","dir"]},{id:"git",label:"Git",terms:["git","auto commit","auto push","commit","push","repository"]},{id:"solar",label:"Location",terms:["latitude","longitude","sunrise","sunset","geo","timezone","time zone","iana","schedule"]},{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 Ri=It(()=>Ki.filter(se=>{const me=c(Ci).trim().toLowerCase();return!me||se.label.toLowerCase().includes(me)||se.terms.some(Ne=>Ne.includes(me))}));function cn(se){var me;m(Ji,se,!0),(me=document.getElementById("sec-"+se))==null||me.scrollIntoView({behavior:"smooth",block:"start"})}$s(async()=>{try{const se=await Vf();se.dataDir&&m(i,se.dataDir,!0)}catch{}try{const se=await Nl();if(typeof se.url=="string"&&se.url)try{const Y=new URL(se.url);m(n,Y.protocol.replace(":",""),!0),m(s,Y.host,!0)}catch{m(s,se.url,!0)}typeof se.mqttUsername=="string"&&m(r,se.mqttUsername,!0),typeof se.mqttPassword=="string"&&m(a,se.mqttPassword,!0),typeof se.mqttCa=="string"&&m(d,se.mqttCa,!0),typeof se.mqttCert=="string"&&m(u,se.mqttCert,!0),typeof se.mqttKey=="string"&&m(f,se.mqttKey,!0),typeof se.mqttVersion=="string"&&m(C,se.mqttVersion,!0),typeof se.name=="string"&&m(g,se.name,!0),typeof se.variablePrefix=="string"&&m(p,se.variablePrefix,!0),typeof se.disableVariables=="boolean"&&m(b,se.disableVariables,!0),typeof se.port=="number"&&m(E,se.port,!0),typeof se.bindAddress=="string"&&m(y,se.bindAddress,!0),typeof se.auth=="string"&&m(D,se.auth,!0),typeof se.proxyHeader=="string"&&m(M,se.proxyHeader,!0),typeof se.proxyLogoutUrl=="string"&&m(R,se.proxyLogoutUrl,!0),typeof se.dir=="string"&&m(Q,se.dir,!0),typeof se.disableWatch=="boolean"&&m(ie,se.disableWatch,!0),typeof se.gitAutoCommit=="boolean"&&m(de,se.gitAutoCommit,!0),typeof se.gitAutoPush=="boolean"&&m(te,se.gitAutoPush,!0),typeof se.latitude=="number"&&m(we,se.latitude,!0),typeof se.longitude=="number"&&m(oe,se.longitude,!0),typeof se.timezone=="string"&&m(le,se.timezone,!0),typeof se.verbosity=="string"&&m(lt,se.verbosity,!0),typeof se.dbPath=="string"&&m(Te,se.dbPath,!0),typeof se.dbPrefix=="string"&&m(pe,se.dbPrefix,!0),typeof se.dbPublish=="boolean"&&m(ut,se.dbPublish,!0),typeof se.dbRetain=="boolean"&&m(Rt,se.dbRetain,!0);const me=se.redis;me!=null&&me.url&&m(st,me.url,!0);const Ne=se.ai;Ne!=null&&Ne.provider&&m(Tt,Ne.provider,!0),Ne!=null&&Ne.baseUrl&&m(xt,Ne.baseUrl,!0),Ne!=null&&Ne.model&&m(at,Ne.model,!0),Ne!=null&&Ne.apiKey&&m(et,Ne.apiKey,!0),m(be,dt(c(Tt),c(xt)),!0),di=c(be),m(zt,Object.fromEntries(Object.entries(se).filter(([Y])=>!Qt.has(Y))),!0)}catch(se){m(Mi,se.message,!0)}finally{m(Ai,!1)}});async function ft(){if(m(O,""),m(V,""),c(D)==="password"&&!c(I)){m(O,"A password is required to enable password authentication.");return}m(T,!0);try{await B$(c(D),c(D)==="password"?c(I):void 0,c(D)==="proxy"?c(M):void 0,c(D)==="proxy"?c(R):void 0),m(I,""),m(V,"Authentication settings saved.")}catch(se){m(O,se.message,!0)}finally{m(T,!1)}}async function Zt(){m(Mi,""),m($i,"");const se={...c(zt)};c(s)&&(se.url=`${c(n)}://${c(s)}`),se.name=c(g),se.variablePrefix=c(p),c(C)&&(se.mqttVersion=c(C)),c(b)&&(se.disableVariables=!0),c(r)&&(se.mqttUsername=c(r)),c(a)&&(se.mqttPassword=c(a)),c(d)&&(se.mqttCa=c(d)),c(u)&&(se.mqttCert=c(u)),c(f)&&(se.mqttKey=c(f)),c(E)!==""&&(se.port=Number(c(E))),c(y)&&(se.bindAddress=c(y)),c(Q)&&(se.dir=c(Q)),c(ie)&&(se.disableWatch=!0),c(de)&&(se.gitAutoCommit=!0),c(te)&&(se.gitAutoPush=!0),c(we)!==""&&(se.latitude=Number(c(we))),c(oe)!==""&&(se.longitude=Number(c(oe))),c(le)&&(se.timezone=c(le)),se.verbosity=c(lt),c(Te)&&(se.dbPath=c(Te),c(pe)&&(se.dbPrefix=c(pe)),c(ut)&&(se.dbPublish=!0,c(Rt)&&(se.dbRetain=!0))),c(st)&&(se.redis={url:c(st)}),c(Tt)&&(se.ai={provider:c(Tt),...c(xt)?{baseUrl:c(xt)}:{},...c(at)?{model:c(at)}:{},...c(et)?{apiKey:c(et)}:{}}),m(hi,!0);try{const me=await Jg(se);window.dispatchEvent(new CustomEvent("she:config-changed")),m($i,me.restartRequired?"Saved — restart required to apply changes.":"Saved.",!0)}catch(me){m(Mi,me.message,!0)}finally{m(hi,!1)}}var fi=bZ(),Ni=wt(fi);cs(Zc(Ni,{}),se=>vt=se,()=>vt);var Ii=_(Ni,2),Bi=v(Ii),Wi=v(Bi),Zi=_(v(Wi),2),mi=_(Wi,2);si(mi,21,()=>Ki,se=>se.id,(se,me)=>{var Ne=Ts(),Y=wt(Ne);{var ze=xe=>{var bt=qK();let Ht;var ri=v(bt);j(()=>{Ht=kt(bt,1,"section-link svelte-767znw",null,Ht,{active:c(Ji)===c(me).id}),W(ri,c(me).label)}),$("click",bt,()=>cn(c(me).id)),A(xe,bt)},He=It(()=>c(Ri).some(xe=>xe.id===c(me).id));z(Y,xe=>{c(He)&&xe(ze)})}A(se,Ne)});var Ke=_(Bi,2),Nt=v(Ke),Fi=_(v(Nt),2);{var ki=se=>{var me=GK(),Ne=v(me);j(()=>W(Ne,c(Mi))),A(se,me)};z(Fi,se=>{c(Mi)&&se(ki)})}var _i=_(Fi,2);{var Ti=se=>{var me=KK(),Ne=v(me);j(()=>W(Ne,c($i))),A(se,me)};z(_i,se=>{c($i)&&se(Ti)})}var Z=_(_i,2),Se=v(Z),Ye=_(Nt,2);{var rt=se=>{var me=ZK();A(se,me)},Ut=se=>{var me=vZ(),Ne=v(me);{var Y=ae=>{var fe=XK(),Fe=_(v(fe),2),ge=_(v(Fe),2),Ee=v(ge);Ee.value=Ee.__value="dark";var ct=_(Ee);ct.value=ct.__value="light";var q=_(ct);q.value=q.__value="system",$("change",ge,()=>OK(c(t))),Ss(ge,()=>c(t),re=>m(t,re)),A(ae,fe)},ze=It(()=>c(Ri).some(ae=>ae.id==="appearance"));z(Ne,ae=>{c(ze)&&ae(Y)})}var He=_(Ne,2);{var xe=ae=>{var fe=QK(),Fe=_(v(fe),2),ge=v(Fe),Ee=_(v(ge));Wn(Ee,()=>"Transport protocol. Use mqtts or wss for TLS encryption.");var ct=_(ge,2),q=v(ct);q.value=q.__value="mqtt";var re=_(q);re.value=re.__value="mqtts";var Le=_(re);Le.value=Le.__value="ws";var tt=_(Le);tt.value=tt.__value="wss";var Me=_(Fe,2),Be=v(Me),Et=_(v(Be));Wn(Et,()=>"Hostname and optional port of the MQTT broker. Example: 192.168.1.1:1883. Leave empty to run without MQTT.");var Ct=_(Be,2),Ie=_(Me,2),Dt=v(Ie),Je=_(v(Dt));Wn(Je,()=>"MQTT broker username. Leave empty if the broker does not require authentication.");var Ve=_(Dt,2),Xe=_(Ie,2),mt=v(Xe),je=_(v(mt));Wn(je,()=>"MQTT broker password. Stored in plain text in config.json.");var yt=_(mt,2),Pe=_(Xe,2);{var nt=Sn=>{var es=YK(),as=wt(es),zi=v(as),Gs=_(v(zi));Wn(Gs,()=>"PEM-encoded CA certificate to verify the broker's TLS certificate. Leave empty to use the system's default CA store.");var Hn=_(zi,2),qn=_(as,2),ys=v(qn),gr=_(v(ys));Wn(gr,()=>"PEM-encoded client certificate for mutual TLS authentication.");var pr=_(ys,2),er=_(qn,2),nl=v(er),xr=_(v(nl));Wn(xr,()=>"PEM-encoded private key matching the client certificate.");var va=_(nl,2);jt(Hn,()=>c(d),mr=>m(d,mr)),jt(pr,()=>c(u),mr=>m(u,mr)),jt(va,()=>c(f),mr=>m(f,mr)),A(Sn,es)};z(Pe,Sn=>{(c(n)==="mqtts"||c(n)==="wss")&&Sn(nt)})}var At=_(Pe,2),Mt=v(At),_t=_(v(Mt));Wn(_t,()=>"MQTT protocol version used when connecting to the broker. Choose 5 only if your broker supports MQTT 5.0. Default: 3.1.1 (mqtt.js default).");var bi=_(Mt,2),wi=v(bi);wi.value=wi.__value="";var qi=_(wi);qi.value=qi.__value="5";var Oi=_(At,2),Gi=v(Oi),Si=_(v(Gi));Wn(Si,()=>'MQTT client ID and topic prefix used for the "connected" status message. Default: she');var ni=_(Gi,2),ei=_(Oi,2),Xi=v(ei),Yi=_(v(Xi));Wn(Yi,()=>"Topic prefix for the variable system (var/set/name → var/status/name). Default: var");var An=_(Xi,2),Qn=_(ei,2),Es=_(v(Qn),2),os=v(Es),Bs=_(os,4);Wn(Bs,()=>"When enabled, var/set/… messages are not processed and no var/status/… retained messages are published."),Ss(ct,()=>c(n),Sn=>m(n,Sn)),jt(Ct,()=>c(s),Sn=>m(s,Sn)),jt(Ve,()=>c(r),Sn=>m(r,Sn)),jt(yt,()=>c(a),Sn=>m(a,Sn)),Ss(bi,()=>c(C),Sn=>m(C,Sn)),jt(ni,()=>c(g),Sn=>m(g,Sn)),jt(An,()=>c(p),Sn=>m(p,Sn)),Cs(os,()=>c(b),Sn=>m(b,Sn)),A(ae,fe)},bt=It(()=>c(Ri).some(ae=>ae.id==="mqtt"));z(He,ae=>{c(bt)&&ae(xe)})}var Ht=_(He,2);{var ri=ae=>{var fe=nZ(),Fe=_(v(fe),2),ge=v(Fe),Ee=_(v(ge));Wn(Ee,()=>"none: no authentication required. password: single-user password login. proxy: trust a header set by nginx/authentik.");var ct=_(ge,2),q=v(ct);q.value=q.__value="none";var re=_(q);re.value=re.__value="password";var Le=_(re);Le.value=Le.__value="proxy";var tt=_(Fe,2);{var Me=je=>{var yt=JK(),Pe=v(yt),nt=v(Pe),At=_(nt);Wn(At,()=>"Set a new password. Leave empty to keep the current password (if already set).");var Mt=_(Pe,2);j(()=>W(nt,`${c(I)?"New password":"Password"} `)),jt(Mt,()=>c(I),_t=>m(I,_t)),A(je,yt)};z(tt,je=>{c(D)==="password"&&je(Me)})}var Be=_(tt,2);{var Et=je=>{var yt=eZ(),Pe=wt(yt),nt=v(Pe),At=_(v(nt));Wn(At,()=>"The HTTP header that nginx/authentik sets after successful authentication. Default: X-Remote-User");var Mt=_(nt,2),_t=_(Pe,2),bi=v(_t),wi=_(v(bi));Wn(wi,()=>"URL to redirect to when the user clicks Logout (e.g. https://auth.example.com/application/o/she/end-session/ for Authentik). Leave empty to do nothing on logout.");var qi=_(bi,2);jt(Mt,()=>c(M),Oi=>m(M,Oi)),jt(qi,()=>c(R),Oi=>m(R,Oi)),A(je,yt)};z(Be,je=>{c(D)==="proxy"&&je(Et)})}var Ct=_(Be,2);{var Ie=je=>{var yt=tZ(),Pe=v(yt);j(()=>W(Pe,c(O))),A(je,yt)};z(Ct,je=>{c(O)&&je(Ie)})}var Dt=_(Ct,2);{var Je=je=>{var yt=iZ(),Pe=v(yt);j(()=>W(Pe,c(V))),A(je,yt)};z(Dt,je=>{c(V)&&je(Je)})}var Ve=_(Dt,2),Xe=_(v(Ve),2),mt=v(Xe);j(()=>{Xe.disabled=c(T)||c(D)==="password"&&!c(I),W(mt,c(T)?"Saving…":"Apply authentication settings")}),Ss(ct,()=>c(D),je=>m(D,je)),$("click",Xe,ft),A(ae,fe)},ii=It(()=>c(Ri).some(ae=>ae.id==="auth"));z(Ht,ae=>{c(ii)&&ae(ri)})}var gi=_(Ht,2);{var qt=ae=>{var fe=sZ(),Fe=_(v(fe),2),ge=v(Fe),Ee=_(v(ge));Wn(Ee,()=>"HTTP server port. Use 0 to let the OS pick a free port. Default: 8080");var ct=_(ge,2),q=_(Fe,2),re=v(q),Le=_(v(re));Wn(Le,()=>"Interface she listens on. Use 127.0.0.1 when running behind nginx (recommended with proxy auth). Default: 0.0.0.0");var tt=_(re,2);jt(ct,()=>c(E),Me=>m(E,Me)),jt(tt,()=>c(y),Me=>m(y,Me)),A(ae,fe)},vi=It(()=>c(Ri).some(ae=>ae.id==="webserver"));z(gi,ae=>{c(vi)&&ae(qt)})}var Oe=_(gi,2);{var Ue=ae=>{var fe=oZ(),Fe=_(v(fe),2),ge=v(Fe),Ee=_(v(ge));Wn(Ee,()=>"Directory that is watched for .js script files. Defaults to {dataDir}/scripts");var ct=_(ge,2),q=_(Fe,2),re=_(v(q),2),Le=v(re),tt=_(Le,4);Wn(tt,()=>"When enabled the daemon will not watch for file changes and will not hot-reload scripts."),j(()=>ln(ct,"placeholder",`${c(i)??""}/scripts (default)`)),jt(ct,()=>c(Q),Me=>m(Q,Me)),Cs(Le,()=>c(ie),Me=>m(ie,Me)),A(ae,fe)},Xt=It(()=>c(Ri).some(ae=>ae.id==="scripts"));z(Oe,ae=>{c(Xt)&&ae(Ue)})}var Gt=_(Oe,2);{var Ei=ae=>{var fe=rZ(),Fe=_(v(fe),2),ge=_(v(Fe),2),Ee=v(ge),ct=_(Ee,4);Wn(ct,()=>"When enabled, saving or renaming/deleting a script automatically creates a git commit. Only effective when the scripts directory is inside a git repository.");var q=_(Fe,2),re=_(v(q),2),Le=v(re),tt=_(Le,4);Wn(tt,()=>"When enabled, every commit (manual or automatic) is immediately pushed to the remote."),Cs(Ee,()=>c(de),Me=>m(de,Me)),Cs(Le,()=>c(te),Me=>m(te,Me)),A(ae,fe)},Kt=It(()=>c(Ri).some(ae=>ae.id==="git"));z(Gt,ae=>{c(Kt)&&ae(Ei)})}var ue=_(Gt,2);{var qe=ae=>{var fe=lZ(),Fe=_(v(fe),2),ge=v(Fe),Ee=_(v(ge));Wn(Ee,()=>"IANA timezone for cron scheduling (e.g. Europe/Berlin). Leave empty to use the system timezone. Requires daemon restart.");var ct=_(ge,2),q=_(ct,2);si(q,20,()=>{var Mt;return((Mt=Intl.supportedValuesOf)==null?void 0:Mt.call(Intl,"timeZone"))??[]},Vi,(Mt,_t)=>{var bi=bA(),wi=v(bi),qi={};j(()=>{W(wi,_t),qi!==(qi=_t)&&(bi.value=(bi.__value=_t)??"")}),A(Mt,bi)});var re=_(Fe,2),Le=v(re),tt=_(v(Le));Wn(tt,()=>"Geographic latitude used for sunrise/sunset calculations. Default: 48.7408 (Stuttgart)");var Me=_(Le,2),Be=_(re,2),Et=v(Be),Ct=_(v(Et));Wn(Ct,()=>"Geographic longitude used for sunrise/sunset calculations. Default: 9.1778 (Stuttgart)");var Ie=_(Et,2),Dt=_(Be,2),Je=_(v(Dt),2),Ve=v(Je),Xe=v(Ve);{var mt=Mt=>{var _t=_o("…");A(Mt,_t)},je=Mt=>{var _t=_o("📍 Use my location");A(Mt,_t)};z(Xe,Mt=>{c(ke)?Mt(mt):Mt(je,-1)})}var yt=_(Ve,2),Pe=v(yt),nt=_(Dt,2);{var At=Mt=>{var _t=aZ(),bi=_(v(_t),2);cs(bi,wi=>m(Re,wi),()=>c(Re)),A(Mt,_t)};z(nt,Mt=>{c(ye)&&Mt(At)})}j(()=>{Ve.disabled=c(ke),W(Pe,c(ye)?"Hide map":"Pick on map")}),jt(ct,()=>c(le),Mt=>m(le,Mt)),jt(Me,()=>c(we),Mt=>m(we,Mt)),jt(Ie,()=>c(oe),Mt=>m(oe,Mt)),$("click",Ve,Pi),$("click",yt,()=>m(ye,!c(ye))),A(ae,fe)},it=It(()=>c(Ri).some(ae=>ae.id==="solar"));z(ue,ae=>{c(it)&&ae(qe)})}var ot=_(ue,2);{var ht=ae=>{var fe=cZ(),Fe=_(v(fe),2),ge=v(Fe),Ee=_(v(ge));Wn(Ee,()=>"Minimum log level. debug shows all messages including MQTT traffic details.");var ct=_(ge,2),q=v(ct);q.value=q.__value="debug";var re=_(q);re.value=re.__value="info";var Le=_(re);Le.value=Le.__value="warn";var tt=_(Le);tt.value=tt.__value="error",Ss(ct,()=>c(lt),Me=>m(lt,Me)),A(ae,fe)},pt=It(()=>c(Ri).some(ae=>ae.id==="logging"));z(ot,ae=>{c(pt)&&ae(ht)})}var Jt=_(ot,2);{var B=ae=>{var fe=uZ(),Fe=_(v(fe),2),ge=v(Fe),Ee=_(v(ge));Wn(Ee,()=>"Path to the sheDB data directory. Defaults to {dataDir}/db. Leave empty to disable sheDB.");var ct=_(ge,2),q=_(Fe,2),re=v(q),Le=_(v(re));Wn(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 tt=_(re,2),Me=_(q,2),Be=_(v(Me),2);let Et;var Ct=v(Be),Ie=_(Ct,4);Wn(Ie,()=>'When enabled, every document change is published to {dbPrefix}doc/{id}. Individual views can publish independently via their own "mqttpub" setting.');var Dt=_(Me,2);{var Je=Ve=>{var Xe=dZ(),mt=_(v(Xe),2);let je;var yt=v(mt),Pe=_(yt,4);Wn(Pe,()=>"When enabled, MQTT messages for document changes are published as retained messages."),j(()=>{je=kt(mt,1,"check-label svelte-767znw",null,je,{muted:!c(Te)}),yt.disabled=!c(Te)}),Cs(yt,()=>c(Rt),nt=>m(Rt,nt)),A(Ve,Xe)};z(Dt,Ve=>{c(ut)&&Ve(Je)})}j(()=>{ln(ct,"placeholder",`defaults to ${c(i)??""}/db`),tt.disabled=!c(Te),Et=kt(Be,1,"check-label svelte-767znw",null,Et,{muted:!c(Te)}),Ct.disabled=!c(Te)}),jt(ct,()=>c(Te),Ve=>m(Te,Ve)),jt(tt,()=>c(pe),Ve=>m(pe,Ve)),Cs(Ct,()=>c(ut),Ve=>m(ut,Ve)),A(ae,fe)},H=It(()=>c(Ri).some(ae=>ae.id==="shedb"));z(Jt,ae=>{c(H)&&ae(B)})}var K=_(Jt,2);{var ce=ae=>{var fe=hZ(),Fe=_(v(fe),2),ge=v(Fe),Ee=_(v(ge));Wn(Ee,()=>"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 ct=_(ge,2);jt(ct,()=>c(st),q=>m(st,q)),A(ae,fe)},X=It(()=>c(Ri).some(ae=>ae.id==="redis"));z(K,ae=>{c(X)&&ae(ce)})}var J=_(K,2);{var he=ae=>{var fe=_Z(),Fe=_(v(fe),2),ge=v(Fe),Ee=_(v(ge));Wn(Ee,()=>"Choose a provider. Free options need a free API key from the provider's website — no credit card required.");var ct=_(ge,2);si(ct,21,()=>St,Vi,(Je,Ve)=>{var Xe=bA(),mt=v(Xe),je={};j(()=>{W(mt,c(Ve).label),je!==(je=c(Ve).id)&&(Xe.value=(Xe.__value=c(Ve).id)??"")}),A(Je,Xe)});var q=_(Fe,2);{var re=Je=>{var Ve=pZ();let Xe;var mt=v(Ve);{var je=nt=>{var At=fZ(),Mt=_(wt(At));j(()=>W(Mt,` ${c(Vt).freeNote??""}`)),A(nt,At)};z(mt,nt=>{c(Vt).freeNote&&nt(je)})}var yt=_(mt,2);{var Pe=nt=>{var At=gZ(),Mt=_(wt(At));j(()=>ln(Mt,"href",c(Vt).apiKeyUrl)),A(nt,At)};z(yt,nt=>{c(Vt).apiKeyUrl&&nt(Pe)})}j(()=>Xe=kt(Ve,1,"preset-note svelte-767znw",null,Xe,{free:!!c(Vt).freeNote})),A(Je,Ve)};z(q,Je=>{var Ve,Xe;((Ve=c(Vt))!=null&&Ve.freeNote||(Xe=c(Vt))!=null&&Xe.apiKeyUrl)&&Je(re)})}var Le=_(q,2);{var tt=Je=>{var Ve=xZ(),Xe=v(Ve),mt=_(v(Xe));Wn(mt,()=>"Base URL of the LLM API. Auto-filled for cloud presets. For Ollama: http://localhost:11434.");var je=_(Xe,2);j(()=>{var yt;return ln(je,"placeholder",c(be)==="ollama"?"http://localhost:11434":c(be)==="lmstudio"?"http://localhost:1234":((yt=c(Vt))==null?void 0:yt.baseUrl)??"")}),jt(je,()=>c(xt),yt=>m(xt,yt)),A(Je,Ve)};z(Le,Je=>{c(be)!=="anthropic"&&Je(tt)})}var Me=_(Le,2),Be=v(Me),Et=_(v(Be));Wn(Et,()=>"Model identifier. Suggested default is filled in when you choose a preset.");var Ct=_(Be,2),Ie=_(Me,2);{var Dt=Je=>{var Ve=mZ(),Xe=v(Ve),mt=_(v(Xe));Wn(mt,()=>"Stored in config.json. Not needed for local providers.");var je=_(Xe,2);jt(je,()=>c(et),yt=>m(et,yt)),A(Je,Ve)};z(Ie,Je=>{c(be)!=="ollama"&&c(be)!=="lmstudio"&&Je(Dt)})}j(()=>{var Je;return ln(Ct,"placeholder",((Je=c(Vt))==null?void 0:Je.defaultModel)||"e.g. llama3.2")}),$("change",ct,Ft),Ss(ct,()=>c(be),Je=>m(be,Je)),jt(Ct,()=>c(at),Je=>m(at,Je)),A(ae,fe)},Qe=It(()=>c(Ri).some(ae=>ae.id==="ai"));z(J,ae=>{c(Qe)&&ae(he)})}A(se,me)};z(Ye,se=>{c(Ai)?se(rt):se(Ut,-1)})}j(()=>{Z.disabled=c(hi),W(Se,c(hi)?"Saving…":"Save")}),jt(Zi,()=>c(Ci),se=>m(Ci,se)),$("click",Z,Zt),A(o,fi),Hs()}Us(["click","change"]);var EZ=F("<option> </option>"),yZ=F('<div><span class="ts svelte-18loop9"> </span> <span class="lvl svelte-18loop9"> </span> <span class="msg svelte-18loop9"> </span></div>'),wZ=F('<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 SZ(o,e){Os(e,!0);let t=P(Di(cF())),i,n=P(!0),s=P("all"),r=P(""),a=P(!1);const d=["all","debug","info","warn","error"],u={debug:0,info:1,warn:2,error:3};H9(O=>{m(t,[...c(t).slice(-1999),O],!0)}),$s(()=>{i&&(i.scrollTop=i.scrollHeight)}),zn(()=>{c(t).length,c(n)&&i&&(i.scrollTop=i.scrollHeight)});function f(){m(t,[],!0)}function g(O){if(c(s)!=="all"&&u[O.level]<u[c(s)])return!1;if(!c(r))return!0;if(c(a))try{return new RegExp(c(r),"i").test(O.msg)}catch{}return O.msg.toLowerCase().includes(c(r).toLowerCase())}function p(O){return new Date(O).toLocaleTimeString()}var C=wZ(),b=v(C),E=_(v(b),2);si(E,21,()=>d,Vi,(O,Q)=>{var ie=EZ(),de=v(ie),te={};j(()=>{W(de,c(Q)),te!==(te=c(Q))&&(ie.value=(ie.__value=c(Q))??"")}),A(O,ie)});var y=_(E,2),D=_(y,2),I=v(D),M=_(D,2),R=v(M),T=_(M,2),V=_(b,2);si(V,21,()=>c(t).filter(g),O=>O.ts+O.msg,(O,Q)=>{var ie=yZ(),de=v(ie),te=v(de),le=_(de,2),we=v(le),oe=_(le,2),ye=v(oe);j((Re,ke)=>{kt(ie,1,`line ${c(Q).level??""}`,"svelte-18loop9"),W(te,Re),W(we,ke),W(ye,c(Q).msg)},[()=>p(c(Q).ts),()=>c(Q).level.toUpperCase()]),A(O,ie)}),cs(V,O=>i=O,()=>i),Ss(E,()=>c(s),O=>m(s,O)),jt(y,()=>c(r),O=>m(r,O)),Cs(I,()=>c(a),O=>m(a,O)),Cs(R,()=>c(n),O=>m(n,O)),$("click",T,f),A(o,C),Hs()}Us(["click"]);var DZ=F('<span class="chat-model svelte-1twuiul"><!></span>'),AZ=F('<button class="clear-btn svelte-1twuiul" title="Clear conversation">✕</button>'),kZ=F('<div class="unconfigured svelte-1twuiul">Configure an AI provider in the <strong class="svelte-1twuiul">Config</strong> tab to use the AI assistant.</div>'),BZ=F('Working on view <code class="svelte-1twuiul"> </code>',1),FZ=F('<button class="chip svelte-1twuiul"> </button>'),LZ=F('<div class="suggestions svelte-1twuiul"><p class="suggestions-hint svelte-1twuiul"><!></p> <!></div>'),IZ=F('<div class="msg-content user-text svelte-1twuiul"> </div>'),CA=F('<div class="tool-event tool-call svelte-1twuiul"><span class="tool-icon svelte-1twuiul">🔧</span><span class="tool-name svelte-1twuiul"> </span></div>'),EA=F('<div class="tool-event tool-result svelte-1twuiul"><span class="tool-icon svelte-1twuiul">✓</span><span class="tool-name svelte-1twuiul"> </span></div>'),yA=F('<div class="tool-events svelte-1twuiul"></div>'),wA=F('<div class="text-block svelte-1twuiul"></div>'),PZ=F('<button class="expand-btn svelte-1twuiul"> </button>'),TZ=F('<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>'),MZ=F('<div class="apply-view-row svelte-1twuiul"><button class="apply-view-btn svelte-1twuiul"> </button></div>'),RZ=F('<!> <div class="msg-content svelte-1twuiul"><!> <!></div>',1),NZ=F("<div><!></div>"),OZ=F('<div class="message assistant svelte-1twuiul"><div class="msg-content svelte-1twuiul"><span class="status-shimmer svelte-1twuiul"> </span></div></div>'),HZ=F('<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>'),WZ=F('<div class="message assistant streaming svelte-1twuiul"><div class="msg-content svelte-1twuiul"></div></div>'),zZ=F('<div class="chat-error svelte-1twuiul"> </div>'),VZ=F('<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>'),jZ=F('<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>'),$Z=F('<button class="stop-btn svelte-1twuiul" title="Stop generation">■</button>'),UZ=F('<button class="send-btn svelte-1twuiul">↑</button>'),qZ=F('<option class="svelte-1twuiul"> </option>'),GZ=F('<select class="model-select svelte-1twuiul"></select>'),KZ=F('<span class="model-name svelte-1twuiul"> </span>'),ZZ=F('<button class="info-btn svelte-1twuiul" title="Model info">ℹ</button>'),XZ=F('<div class="model-bar svelte-1twuiul"><span class="model-provider svelte-1twuiul"> </span> <!> <!></div>'),YZ=F('<p class="info-status svelte-1twuiul">Loading…</p>'),QZ=F('<p class="info-status info-err svelte-1twuiul"> </p>'),JZ=F('<dt class="svelte-1twuiul">Ollama version</dt><dd class="svelte-1twuiul"> </dd>',1),eX=F('<dt class="svelte-1twuiul">Family</dt><dd class="svelte-1twuiul"> </dd>',1),tX=F('<dt class="svelte-1twuiul">Parameters</dt><dd class="svelte-1twuiul"> </dd>',1),iX=F('<dt class="svelte-1twuiul">Quantization</dt><dd class="svelte-1twuiul"> </dd>',1),nX=F('<div class="running-model svelte-1twuiul"> </div>'),sX=F('<dt class="svelte-1twuiul">Loaded</dt> <dd class="svelte-1twuiul"></dd>',1),oX=F('<dt class="svelte-1twuiul">Loaded</dt><dd class="dim svelte-1twuiul">Not in memory</dd>',1),rX=F('<dl class="svelte-1twuiul"><!> <!> <!> <!> <!></dl>'),aX=F('<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>'),lX=F('<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 cX(o,e){Os(e,!0),m_.registerLanguage("javascript",gF),Jn.use({breaks:!0,gfm:!0});let t=wu(e,"currentView",3,null);const i="she:viewchat:messages";let n=P(Di(JSON.parse(localStorage.getItem(i)??"[]"))),s=P(null),r=P(""),a=P(!1),d=P(""),u=P(null),f=P(Di([])),g=P(Di(localStorage.getItem("she:selectedModel")??""));zn(()=>{localStorage.setItem(i,JSON.stringify(c(n)))});let p=P(Di(new Set)),C=P(!1),b=P(null),E=P(!1),y=P(""),D=null,I=P(0);const M=["[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 R=P(!0),T=P(!0),V=P(!0),O=P(Di([])),Q=P(!0),ie=P(!1),de,te=P(Di([])),le=P(0),we,oe;const ye=It(()=>({apiref:!1,shedb:c(R),sampleDocs:c(T),tools:c(V)})),Re=It(()=>{var B;return((B=c(u))==null?void 0:B.configured)??!1}),ke=It(()=>c(le)+new TextEncoder().encode(c(r)).length),_e=It(()=>c(Q)?t():null);async function lt(){try{const B=await iF();m(u,B,!0),B.configured&&!c(g)&&m(g,B.model,!0)}catch{}}zn(()=>(window.addEventListener("she:config-changed",lt),()=>window.removeEventListener("she:config-changed",lt))),$s(()=>{lt()}),zn(()=>{c(g)&&localStorage.setItem("she:selectedModel",c(g))}),zn(()=>{var B;(B=c(u))!=null&&B.provider&&nF().then(H=>{m(f,H.models,!0),!c(g)&&H.models.length>0&&m(g,H.models[0],!0)}).catch(()=>{})}),zn(()=>{c(g),m(b,null),m(y,"")}),zn(()=>{const B=c(ye),H=c(_e),K=c(O);c(Re)&&sF({context:B,currentView:H??null,extraFiles:K.length>0?K:void 0}).then(ce=>{m(le,new TextEncoder().encode(ce.prompt).length,!0)}).catch(()=>{})}),zn(()=>{if(!c(a))return;m(I,Math.floor(Math.random()*M.length),!0);const B=setInterval(()=>{m(I,(c(I)+1)%M.length)},1e4);return()=>clearInterval(B)}),zn(()=>{var B;oe&&(c(n).length+(((B=c(s))==null?void 0:B.length)??0),requestAnimationFrame(()=>{oe&&(oe.scrollTop=oe.scrollHeight)}))});function Te(B){const H=[],K=/```(\w*)\n([\s\S]*?)```/g;let ce=0,X;for(;(X=K.exec(B))!==null;)X.index>ce&&H.push({type:"text",text:B.slice(ce,X.index)}),H.push({type:"code",lang:X[1]||"text",text:X[2].trimEnd()}),ce=X.index+X[0].length;return ce<B.length&&H.push({type:"text",text:B.slice(ce)}),H}function pe(B){const H=[],K=/```(\w*)\n([\s\S]*?)```/g;let ce=0,X;for(;(X=K.exec(B))!==null;)X.index>ce&&H.push({type:"text",text:B.slice(ce,X.index)}),H.push({type:"code",lang:X[1]||"text",text:X[2].trimEnd()}),ce=X.index+X[0].length;const J=B.slice(ce),he=J.match(/```(\w*)\n([\s\S]*)$/);return he?(he.index>0&&H.push({type:"text",text:J.slice(0,he.index)}),H.push({type:"code",lang:he[1]||"text",text:he[2]})):J&&H.push({type:"text",text:J}),H}function ut(B){const H={};for(const K of B)if(K.type==="code"){if(K.lang==="filter")H.filter=K.text.trim();else if(et(K.lang)){const ce=K.text.split(`
223
+ `)[0].trim();ce==="// @view-map"?H.map=K.text.split(`
224
+ `).slice(1).join(`
225
+ `).trim():ce==="// @view-reduce"&&(H.reduce=K.text.split(`
226
+ `).slice(1).join(`
227
+ `).trim())}}return H}function Rt(B){return B.filter!==void 0||B.map!==void 0||B.reduce!==void 0}function st(B){const H=[];return B.filter!==void 0&&H.push("filter"),B.map!==void 0&&H.push("map"),B.reduce!==void 0&&H.push("reduce"),`Apply ${H.join(" + ")}`}const St=15;function be(B){return B.split(`
228
+ `).length>St}function Tt(B){const H=new Set(c(p));H.has(B)?H.delete(B):H.add(B),m(p,H,!0)}function xt(B,H){if(et(H))try{return m_.highlight(B,{language:"javascript"}).value}catch{}return B.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function at(B){return Jn.parse(B)}function et(B){return!B||B==="js"||B==="javascript"}function Ot(B){navigator.clipboard.writeText(B).catch(()=>{})}async function di(){if(m(C,!0),!(c(b)||c(E))){m(E,!0),m(y,"");try{m(b,await $y(c(g)||c(u).model),!0)}catch(B){m(y,B.message,!0)}m(E,!1)}}function dt(B){return B>=1e9?`${(B/1e9).toFixed(1)} GB`:B>=1e6?`${(B/1e6).toFixed(0)} MB`:`${B} B`}function Ft(B){const H=B.match(/\.([^.]+)$/);return H?H[1].toUpperCase():"?"}function Vt(B){switch(B){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"↓";case"JSON":case"JSONC":return"{}";default:return B}}function zt(B){m(O,c(O).filter((H,K)=>K!==B),!0)}function Qt(){de.click()}async function vt(B){if(!(!B||B.length===0))for(const H of Array.from(B)){const K=await H.text();m(O,[...c(O),{name:H.name,content:K}],!0)}}function Pi(B){const H=B.target;vt(H.files),H.value=""}function Ai(B){var H;B.preventDefault(),m(ie,!1),vt(((H=B.dataTransfer)==null?void 0:H.files)??null)}function hi(B){var H;(H=B.dataTransfer)!=null&&H.types.includes("Files")&&(B.preventDefault(),m(ie,!0))}function $i(){m(ie,!1)}async function Mi(){const B=c(r).trim();if(!(!B||c(a))){m(r,""),m(d,""),m(a,!0),m(n,[...c(n),{role:"user",content:B}],!0),D=new AbortController,m(te,[],!0);try{await oF({messages:c(n),currentView:c(_e),context:c(ye),modelOverride:c(g)||void 0,extraFiles:c(O).length>0?c(O):void 0},H=>{m(s,(c(s)??"")+H)},D.signal,H=>{m(te,[...c(te),H],!0)}),m(n,[...c(n),{role:"assistant",content:c(s)??"",toolEvents:c(te).length>0?[...c(te)]:void 0}],!0),m(te,[],!0)}catch(H){if(H.name==="AbortError"){const K=c(s);K!=null&&K.trim()&&m(n,[...c(n),{role:"assistant",content:K+`
229
+
230
+ *[stopped]*`,toolEvents:c(te).length>0?[...c(te)]:void 0}],!0)}else m(d,H.message,!0)}finally{D=null,m(s,null),m(te,[],!0),m(a,!1)}}}function Ci(){D==null||D.abort()}function Ji(B){B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),Mi())}function Ki(){m(n,[],!0),m(d,"")}const Ri=["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 cn(B){m(r,B,!0),we==null||we.focus()}var ft=lX(),Zt=wt(ft),fi=v(Zt),Ni=_(v(fi),2);{var Ii=B=>{var H=DZ(),K=v(H);{var ce=J=>{var he=_o();j(()=>W(he,`${c(u).provider??""} · ${(c(g)||c(u).model)??""}`)),A(J,he)},X=J=>{var he=_o("Not configured");A(J,he)};z(K,J=>{c(Re)?J(ce):J(X,-1)})}j(()=>ln(H,"title",`Provider: ${c(u).provider??""}`)),A(B,H)};z(Ni,B=>{c(u)&&B(Ii)})}var Bi=_(Ni,2);{var Wi=B=>{var H=AZ();$("click",H,Ki),A(B,H)};z(Bi,B=>{c(n).length>0&&B(Wi)})}var Zi=_(fi,2),mi=v(Zi);{var Ke=B=>{var H=kZ();A(B,H)},Nt=B=>{var H=LZ(),K=v(H),ce=v(K);{var X=Qe=>{var ae=BZ(),fe=_(wt(ae)),Fe=v(fe);j(()=>W(Fe,t().id)),A(Qe,ae)},J=Qe=>{var ae=_o("No view selected. Ask a general sheDB view question.");A(Qe,ae)};z(ce,Qe=>{t()?Qe(X):Qe(J,-1)})}var he=_(K,2);si(he,17,()=>Ri,Vi,(Qe,ae)=>{var fe=FZ(),Fe=v(fe);j(()=>W(Fe,c(ae))),$("click",fe,()=>cn(c(ae))),A(Qe,fe)}),A(B,H)};z(mi,B=>{c(Re)?c(n).length===0&&c(s)===null&&B(Nt,1):B(Ke)})}var Fi=_(mi,2);si(Fi,17,()=>c(n),Vi,(B,H,K)=>{var ce=NZ(),X=v(ce);{var J=Qe=>{var ae=IZ(),fe=v(ae);j(()=>W(fe,c(H).content)),A(Qe,ae)},he=Qe=>{const ae=It(()=>Te(c(H).content)),fe=It(()=>ut(c(ae)));var Fe=RZ(),ge=wt(Fe);{var Ee=Me=>{var Be=yA();si(Be,21,()=>c(H).toolEvents,Vi,(Et,Ct)=>{var Ie=Ts(),Dt=wt(Ie);{var Je=Xe=>{var mt=CA(),je=_(v(mt)),yt=v(je);j(Pe=>W(yt,Pe),[()=>c(Ct).name.replace(/_/g," ")]),A(Xe,mt)},Ve=Xe=>{var mt=EA(),je=_(v(mt)),yt=v(je);j(Pe=>W(yt,Pe),[()=>c(Ct).name.replace(/_/g," ")]),A(Xe,mt)};z(Dt,Xe=>{c(Ct).type==="tool_call"?Xe(Je):Xe(Ve,-1)})}A(Et,Ie)}),A(Me,Be)};z(ge,Me=>{var Be;(Be=c(H).toolEvents)!=null&&Be.length&&Me(Ee)})}var ct=_(ge,2),q=v(ct);si(q,17,()=>c(ae),Vi,(Me,Be,Et)=>{var Ct=Ts(),Ie=wt(Ct);{var Dt=Ve=>{var Xe=wA();dc(Xe,()=>at(c(Be).text),!0),A(Ve,Xe)},Je=Ve=>{const Xe=It(()=>`${K}:${Et}`),mt=It(()=>be(c(Be).text)),je=It(()=>c(p).has(c(Xe))),yt=It(()=>c(Be).lang==="filter");var Pe=TZ(),nt=v(Pe),At=v(nt),Mt=v(At),_t=_(At,2),bi=v(_t),wi=_(nt,2);let qi;var Oi=v(wi),Gi=v(Oi);dc(Gi,()=>xt(c(Be).text,c(Be).lang??""),!0);var Si=_(Oi,2);{var ni=ei=>{var Xi=PZ(),Yi=v(Xi);j(()=>W(Yi,c(je)?"▲ collapse":"▼ expand")),$("click",Xi,()=>Tt(c(Xe))),A(ei,Xi)};z(Si,ei=>{c(mt)&&ei(ni)})}j(()=>{W(Mt,c(yt)?"filter":c(Be).lang),qi=kt(wi,1,"code-body svelte-1twuiul",null,qi,{collapsed:c(mt)&&!c(je)})}),$("click",bi,()=>Ot(c(Be).text)),A(Ve,Pe)};z(Ie,Ve=>{c(Be).type==="text"?Ve(Dt):Ve(Je,-1)})}A(Me,Ct)});var re=_(q,2);{var Le=Me=>{var Be=MZ(),Et=v(Be),Ct=v(Et);j(Ie=>W(Ct,Ie),[()=>st(c(fe))]),$("click",Et,()=>e.onApplyView(c(fe))),A(Me,Be)},tt=It(()=>Rt(c(fe))&&e.onApplyView);z(re,Me=>{c(tt)&&Me(Le)})}A(Qe,Fe)};z(X,Qe=>{c(H).role==="user"?Qe(J):Qe(he,-1)})}j(()=>kt(ce,1,`message ${c(H).role??""}`,"svelte-1twuiul")),A(B,ce)});var ki=_(Fi,2);{var _i=B=>{var H=yA();si(H,21,()=>c(te),Vi,(K,ce)=>{var X=Ts(),J=wt(X);{var he=ae=>{var fe=CA(),Fe=_(v(fe)),ge=v(Fe);j(Ee=>W(ge,Ee),[()=>c(ce).name.replace(/_/g," ")]),A(ae,fe)},Qe=ae=>{var fe=EA(),Fe=_(v(fe)),ge=v(Fe);j(Ee=>W(ge,Ee),[()=>c(ce).name.replace(/_/g," ")]),A(ae,fe)};z(J,ae=>{c(ce).type==="tool_call"?ae(he):ae(Qe,-1)})}A(K,X)}),A(B,H)};z(ki,B=>{c(te).length>0&&B(_i)})}var Ti=_(ki,2);{var Z=B=>{var H=OZ(),K=v(H),ce=v(K),X=v(ce);j(()=>W(X,M[c(I)])),A(B,H)};z(Ti,B=>{c(a)&&c(s)===null&&c(te).length===0&&B(Z)})}var Se=_(Ti,2);{var Ye=B=>{var H=WZ(),K=v(H);si(K,21,()=>pe(c(s)),Vi,(ce,X)=>{var J=Ts(),he=wt(J);{var Qe=fe=>{var Fe=wA();dc(Fe,()=>at(c(X).text),!0),A(fe,Fe)},ae=fe=>{var Fe=HZ(),ge=v(Fe),Ee=v(ge),ct=v(Ee),q=_(ge,2),re=v(q);dc(re,()=>xt(c(X).text,c(X).lang??""),!0),j(()=>W(ct,c(X).lang)),A(fe,Fe)};z(he,fe=>{c(X).type==="text"?fe(Qe):fe(ae,-1)})}A(ce,J)}),A(B,H)};z(Se,B=>{c(s)!==null&&B(Ye)})}cs(Zi,B=>oe=B,()=>oe);var rt=_(Zi,2);{var Ut=B=>{var H=zZ(),K=v(H);j(()=>W(K,c(d))),A(B,H)};z(rt,B=>{c(d)&&B(Ut)})}var se=_(rt,2),me=v(se),Ne=v(me),Y=_(me,2),ze=v(Y),He=_(Y,2),xe=v(He),bt=_(He,2),Ht=v(bt),ri=_(se,2),ii=v(ri);{var gi=B=>{var H=VZ();let K;var ce=_(v(H),2),X=v(ce),J=_(ce,2),he=v(J);j(()=>{K=kt(H,1,"file-chip svelte-1twuiul",null,K,{inactive:!c(Q)}),W(X,t().id),ln(J,"title",c(Q)?"Remove from context":"Re-add to context"),W(he,c(Q)?"×":"+")}),$("click",J,()=>m(Q,!c(Q))),A(B,H)};z(ii,B=>{t()&&B(gi)})}var qt=_(ii,2);si(qt,17,()=>c(O),Vi,(B,H,K)=>{const ce=It(()=>Ft(c(H).name));var X=jZ(),J=v(X),he=v(J),Qe=_(J,2),ae=v(Qe),fe=_(Qe,2);j((Fe,ge)=>{kt(J,1,`badge badge-${Fe??""}`,"svelte-1twuiul"),W(he,ge),W(ae,c(H).name)},[()=>c(ce).toLowerCase(),()=>Vt(c(ce))]),$("click",fe,()=>zt(K)),A(B,X)});var vi=_(qt,2),Oe=_(vi,2);cs(Oe,B=>de=B,()=>de);var Ue=_(ri,2);let Xt;var Gt=v(Ue);let Ei;var Kt=v(Gt);cs(Kt,B=>we=B,()=>we);var ue=_(Gt,2);{var qe=B=>{var H=$Z();$("click",H,Ci),A(B,H)},it=B=>{var H=UZ();j(K=>H.disabled=K,[()=>!c(r).trim()||!c(Re)]),$("click",H,Mi),A(B,H)};z(ue,B=>{c(a)?B(qe):B(it,-1)})}var ot=_(Ue,2);{var ht=B=>{var H=XZ(),K=v(H),ce=v(K),X=_(K,2);{var J=fe=>{var Fe=GZ();si(Fe,21,()=>c(f),Vi,(ge,Ee)=>{var ct=qZ(),q=v(ct),re={};j(()=>{W(q,c(Ee)),re!==(re=c(Ee))&&(ct.value=(ct.__value=c(Ee))??"")}),A(ge,ct)}),j(()=>Fe.disabled=c(a)),Ss(Fe,()=>c(g),ge=>m(g,ge)),A(fe,Fe)},he=fe=>{var Fe=KZ(),ge=v(Fe);j(()=>W(ge,c(g)||c(u).model)),A(fe,Fe)};z(X,fe=>{c(f).length>0?fe(J):fe(he,-1)})}var Qe=_(X,2);{var ae=fe=>{var Fe=ZZ();$("click",Fe,di),A(fe,Fe)};z(Qe,fe=>{c(u).provider==="ollama"&&fe(ae)})}j(()=>W(ce,c(u).provider)),A(B,H)};z(ot,B=>{c(Re)&&c(u)&&B(ht)})}var pt=_(Zt,2);{var Jt=B=>{var H=aX(),K=v(H),ce=v(K),X=v(ce),J=v(X),he=_(X,2),Qe=_(ce,2),ae=v(Qe);{var fe=Ee=>{var ct=YZ();A(Ee,ct)},Fe=Ee=>{var ct=QZ(),q=v(ct);j(()=>W(q,c(y))),A(Ee,ct)},ge=Ee=>{var ct=rX(),q=v(ct);{var re=Ve=>{var Xe=JZ(),mt=_(wt(Xe)),je=v(mt);j(()=>W(je,c(b).version)),A(Ve,Xe)};z(q,Ve=>{c(b).version&&Ve(re)})}var Le=_(q,2);{var tt=Ve=>{var Xe=eX(),mt=_(wt(Xe)),je=v(mt);j(()=>W(je,c(b).details.family)),A(Ve,Xe)};z(Le,Ve=>{var Xe;(Xe=c(b).details)!=null&&Xe.family&&Ve(tt)})}var Me=_(Le,2);{var Be=Ve=>{var Xe=tX(),mt=_(wt(Xe)),je=v(mt);j(()=>W(je,c(b).details.parameter_size)),A(Ve,Xe)};z(Me,Ve=>{var Xe;(Xe=c(b).details)!=null&&Xe.parameter_size&&Ve(Be)})}var Et=_(Me,2);{var Ct=Ve=>{var Xe=iX(),mt=_(wt(Xe)),je=v(mt);j(()=>W(je,c(b).details.quantization_level)),A(Ve,Xe)};z(Et,Ve=>{var Xe;(Xe=c(b).details)!=null&&Xe.quantization_level&&Ve(Ct)})}var Ie=_(Et,2);{var Dt=Ve=>{var Xe=sX(),mt=_(wt(Xe),2);si(mt,21,()=>c(b).running,Vi,(je,yt)=>{var Pe=nX(),nt=v(Pe);j(At=>W(nt,`${c(yt).name??""} · ${At??""} VRAM`),[()=>dt(c(yt).size_vram)]),A(je,Pe)}),A(Ve,Xe)},Je=Ve=>{var Xe=oX();A(Ve,Xe)};z(Ie,Ve=>{c(b).running&&c(b).running.length>0?Ve(Dt):c(b).running!==null&&Ve(Je,1)})}A(Ee,ct)};z(ae,Ee=>{c(E)?Ee(fe):c(y)?Ee(Fe,1):c(b)&&Ee(ge,2)})}j(()=>{var Ee;return W(J,`Ollama · ${(c(g)||((Ee=c(u))==null?void 0:Ee.model))??""}`)}),$("click",H,()=>m(C,!1)),$("click",K,Ee=>Ee.stopPropagation()),$("click",he,()=>m(C,!1)),A(B,H)};z(pt,B=>{c(C)&&B(Jt)})}j(B=>{W(Ht,B),Xt=kt(Ue,1,"input-row svelte-1twuiul",null,Xt,{"drag-over":c(ie)}),Ei=kt(Gt,1,"textarea-wrap svelte-1twuiul",null,Ei,{loading:c(a)}),ln(Kt,"placeholder",c(Re)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),Kt.disabled=c(a)||!c(Re)},[()=>dt(c(ke))]),Cs(Ne,()=>c(R),B=>m(R,B)),Cs(ze,()=>c(T),B=>m(T,B)),Cs(xe,()=>c(V),B=>m(V,B)),$("click",vi,Qt),$("change",Oe,Pi),ls("dragover",Ue,hi),ls("dragleave",Ue,$i),ls("drop",Ue,Ai),$("keydown",Kt,Ji),jt(Kt,()=>c(r),B=>m(r,B)),A(o,ft),Hs()}Us(["click","change","keydown"]);var dX=F('<div class="me svelte-1pxdb1"></div>');function yC(o,e){Os(e,!0);let t=wu(e,"value",15,""),i=wu(e,"language",3,"javascript"),n,s,r=!1;$s(()=>{const d=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=yr.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},...d}),s.onDidChangeModelContent(()=>{r||t(s.getValue())})}),Dp(()=>s==null?void 0:s.dispose()),zn(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var a=dX();cs(a,d=>n=d,()=>n),A(o,a),Hs()}var uX=F('<!> <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 &mdash; 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>',1),hX=F('<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>'),SA=F('<div class="form-error svelte-rrt0o"> </div>'),fX=F('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),DA=F("<li> </li>"),AA=F('<div class="error-bar svelte-rrt0o"> </div>'),kA=F('<div class="loading svelte-rrt0o">Loading…</div>'),gX=F('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),pX=F('<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),xX=F('<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>'),mX=F('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),_X=F('<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>'),vX=F('<span class="badge-error svelte-rrt0o">error</span>'),bX=F('<span class="badge-ok svelte-rrt0o"> </span>'),CX=F('<pre class="result-error svelte-rrt0o"> </pre>'),EX=F('<pre class="result-json svelte-rrt0o"> </pre>'),yX=F('<div class="view-result svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),wX=F('<div class="view-sections svelte-rrt0o"><div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Description <span class="section-hint svelte-rrt0o">— optional, shown in sidebar</span></div> <div class="section-body svelte-rrt0o"><input class="filter-input svelte-rrt0o" placeholder="(optional description)"/></div></div> <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 &nbsp;·&nbsp; 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>'),SX=F('<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),DX=F('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),AX=F('<div class="panel svelte-rrt0o"><aside class="sidebar svelte-rrt0o"><div class="toolbar svelte-rrt0o"><button class="svelte-rrt0o">+ View</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>'),kX=F('<div class="db-root svelte-rrt0o" role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button> <!></div> <!></div>');function BX(o,e){Os(e,!0);const t=Ke=>{var Nt=uX(),Fi=wt(Nt);cs(Zc(Fi,{}),ki=>Vt=ki,()=>Vt),A(Ke,Nt)};let i=P(Di([])),n=P(null),s=P("{}"),r=P(!1),a=P(null);const d="she-db-selected-view";let u=P(Di([])),f=P(Di(localStorage.getItem(d))),g=P("#"),p=P("// emit(this.someProperty)"),C=P(""),b=P(""),E=P(!1),y=P(!1),D=P(null),I=P(!1),M=P(null),R=P("she/db/view/");const T="she-db-panel";let V=P(Di(localStorage.getItem(T)??"docs")),O=P(""),Q=P(!1),ie=P(null),de=P(""),te=P(!1),le=P(null);const we="she-db-sidebar-width";let oe=P(Di(parseInt(localStorage.getItem(we)??"220",10))),ye=!1,Re=0,ke=0;const _e="she-db-chat-width",lt="she-db-chat-open";let Te=P(localStorage.getItem(lt)==="true"),pe=P(Di(parseInt(localStorage.getItem(_e)??"320",10))),ut=!1,Rt=0,st=0;const St=It(()=>c(f)?{id:c(f),filter:c(g),map:c(p),reduce:c(C)}:null);function be(Ke){Ke.filter!==void 0&&m(g,Ke.filter,!0),Ke.map!==void 0&&m(p,Ke.map,!0),Ke.reduce!==void 0&&m(C,Ke.reduce,!0)}zn(()=>{localStorage.setItem(lt,String(c(Te)))}),zn(()=>{localStorage.setItem(T,c(V))}),zn(()=>{c(f)?localStorage.setItem(d,c(f)):localStorage.removeItem(d)});function Tt(Ke){ye=!0,Re=Ke.clientX,ke=c(oe),Ke.preventDefault()}function xt(Ke){ye&&m(oe,Math.max(140,Math.min(500,ke+Ke.clientX-Re)),!0),ut&&m(pe,Math.max(240,Math.min(600,st-(Ke.clientX-Rt))),!0)}function at(){ye&&(ye=!1,localStorage.setItem(we,String(c(oe)))),ut&&(ut=!1,localStorage.setItem(_e,String(c(pe))))}function et(Ke){ut=!0,Rt=Ke.clientX,st=c(pe),Ke.preventDefault()}async function Ot(){try{m(i,await YB(),!0)}catch{}}async function di(){try{m(u,await QB(),!0)}catch{}}async function dt(Ke){m(n,Ke,!0),m(a,null),m(r,!0);try{const Nt=await O$(Ke);m(s,JSON.stringify(Nt,null,2),!0)}catch(Nt){m(a,Nt instanceof Error?Nt.message:String(Nt),!0)}finally{m(r,!1)}}async function Ft(){if(c(n)){m(a,null);try{const Ke=JSON.parse(c(s));await GD(c(n),Ke)}catch(Ke){m(a,Ke instanceof Error?Ke.message:String(Ke),!0)}}}let Vt;async function zt(){if(c(n)&&await Vt.show(`Delete document "${c(n)}"?`,{confirm:"Delete",danger:!0}))try{await H$(c(n)),m(n,null),m(s,"{}")}catch(Ke){m(a,Ke instanceof Error?Ke.message:String(Ke),!0)}}async function Qt(){const Ke=c(O).trim();if(Ke){m(ie,null);try{await GD(Ke,{}),m(Q,!1),m(O,""),await dt(Ke)}catch(Nt){m(ie,Nt instanceof Error?Nt.message:String(Nt),!0)}}}async function vt(Ke){m(f,Ke,!0),m(M,null),m(I,!0),m(D,null);try{const Nt=await W$(Ke);m(g,Nt.filter??"",!0),m(p,Nt.map,!0),m(C,Nt.reduce??"",!0),m(b,Nt.description??"",!0),m(E,Nt.mqttpub??!1,!0),m(y,Nt.retain??!1,!0),m(D,await bC(Ke).catch(()=>null),!0)}catch(Nt){m(M,Nt instanceof Error?Nt.message:String(Nt),!0)}finally{m(I,!1)}}async function Pi(){if(c(f)){m(M,null);try{const Ke={map:c(p)};c(g).trim()&&(Ke.filter=c(g).trim()),c(C).trim()&&(Ke.reduce=c(C).trim()),c(b).trim()&&(Ke.description=c(b).trim()),c(E)&&(Ke.mqttpub=!0),c(y)&&(Ke.retain=!0),await KD(c(f),Ke)}catch(Ke){m(M,Ke instanceof Error?Ke.message:String(Ke),!0)}}}async function Ai(){if(c(f))try{m(D,await bC(c(f)),!0)}catch(Ke){m(M,Ke instanceof Error?Ke.message:String(Ke),!0)}}async function hi(){if(c(f)&&await Vt.show(`Delete view "${c(f)}"?`,{confirm:"Delete",danger:!0}))try{await z$(c(f)),m(f,null),m(g,""),m(p,"// emit(this.someProperty)"),m(C,""),m(b,""),m(E,!1),m(y,!1),m(D,null)}catch(Ke){m(M,Ke instanceof Error?Ke.message:String(Ke),!0)}}async function $i(){if(!c(de).trim())return;const Ke=c(de).trim();m(le,null);try{await KD(Ke,{map:"// emit(this.someProperty)"}),m(te,!1),m(de,""),await di(),await vt(Ke)}catch(Nt){m(le,Nt instanceof Error?Nt.message:String(Nt),!0)}}let Mi=P(""),Ci=P(""),Ji=It(()=>[...c(i)].filter(Ke=>!c(Mi)||Ke.toLowerCase().includes(c(Mi).toLowerCase())).sort()),Ki=It(()=>[...c(u)].filter(Ke=>!c(Ci)||Ke.toLowerCase().includes(c(Ci).toLowerCase())).sort());$s(()=>{Ot(),di().then(()=>{c(f)&&c(u).includes(c(f))?vt(c(f)):m(f,null)}),Nl().then(_i=>{const Ti=_i.dbPrefix||"she/db/",Z=Ti.endsWith("/")?Ti:Ti+"/";m(R,Z+"view/")}).catch(()=>{});const Ke=ur("db:ids",_i=>{m(i,_i.ids??[],!0)}),Nt=ur("db:viewIds",_i=>{m(u,_i.ids??[],!0)}),Fi=ur("db:change",async _i=>{const Ti=_i.id;c(n)===Ti&&(_i.doc===null?(m(n,null),m(s,"{}")):m(s,JSON.stringify(_i.doc,null,2),!0))}),ki=ur("db:viewUpdate",async _i=>{const Ti=_i.id;c(f)===Ti&&m(D,await bC(Ti).catch(()=>null),!0)});return()=>{Ke(),Nt(),Fi(),ki()}});var Ri=kX(),cn=v(Ri),ft=v(cn);let Zt;var fi=_(ft,2);let Ni;var Ii=_(fi,2);{var Bi=Ke=>{var Nt=hX();let Fi;j(()=>{Fi=kt(Nt,1,"ai-toggle svelte-rrt0o",null,Fi,{"ai-open":c(Te)}),ln(Nt,"title",c(Te)?"Close AI assistant":"Open AI assistant")}),$("click",Nt,()=>m(Te,!c(Te))),A(Ke,Nt)};z(Ii,Ke=>{c(V)==="views"&&Ke(Bi)})}var Wi=_(cn,2);{var Zi=Ke=>{var Nt=xX(),Fi=v(Nt);let ki;var _i=v(Fi),Ti=v(_i),Z=_(_i,2);{var Se=He=>{var xe=fX(),bt=wt(xe),Ht=v(bt),ri=_(Ht,2),ii=_(bt,2);{var gi=qt=>{var vi=SA(),Oe=v(vi);j(()=>W(Oe,c(ie))),A(qt,vi)};z(ii,qt=>{c(ie)&&qt(gi)})}$("keydown",Ht,qt=>qt.key==="Enter"&&Qt()),jt(Ht,()=>c(O),qt=>m(O,qt)),$("click",ri,Qt),A(He,xe)};z(Z,He=>{c(Q)&&He(Se)})}var Ye=_(Z,2),rt=v(Ye),Ut=_(Ye,2);si(Ut,20,()=>c(Ji),He=>He,(He,xe)=>{var bt=DA();let Ht;var ri=v(bt);j(()=>{Ht=kt(bt,1,"flat-item svelte-rrt0o",null,Ht,{"active-item":c(n)===xe}),W(ri,xe)}),$("click",bt,()=>dt(xe)),A(He,bt)});var se=_(Fi,2),me=_(se,2),Ne=v(me);{var Y=He=>{var xe=pX(),bt=wt(xe),Ht=v(bt),ri=v(Ht),ii=_(Ht,2),gi=_(ii,2),qt=_(bt,2);{var vi=Gt=>{var Ei=AA(),Kt=v(Ei);j(()=>W(Kt,c(a))),A(Gt,Ei)};z(qt,Gt=>{c(a)&&Gt(vi)})}var Oe=_(qt,2);{var Ue=Gt=>{var Ei=kA();A(Gt,Ei)},Xt=Gt=>{var Ei=gX(),Kt=v(Ei);yC(Kt,{language:"json",get value(){return c(s)},set value(ue){m(s,ue,!0)}}),A(Gt,Ei)};z(Oe,Gt=>{c(r)?Gt(Ue):Gt(Xt,-1)})}j(()=>W(ri,c(n))),$("click",ii,Ft),$("click",gi,zt),A(He,xe)},ze=He=>{t(He)};z(Ne,He=>{c(n)?He(Y):He(ze,-1)})}j(()=>ki=qo(Fi,"",ki,{width:`${c(oe)??""}px`})),$("click",Ti,()=>{m(Q,!c(Q)),m(ie,null)}),jt(rt,()=>c(Mi),He=>m(Mi,He)),$("mousedown",se,Tt),A(Ke,Nt)},mi=Ke=>{var Nt=AX(),Fi=v(Nt);let ki;var _i=v(Fi),Ti=v(_i),Z=_(_i,2);{var Se=bt=>{var Ht=mX(),ri=wt(Ht),ii=v(ri),gi=_(ii,2),qt=_(ri,2);{var vi=Oe=>{var Ue=SA(),Xt=v(Ue);j(()=>W(Xt,c(le))),A(Oe,Ue)};z(qt,Oe=>{c(le)&&Oe(vi)})}$("keydown",ii,Oe=>Oe.key==="Enter"&&$i()),jt(ii,()=>c(de),Oe=>m(de,Oe)),$("click",gi,$i),A(bt,Ht)};z(Z,bt=>{c(te)&&bt(Se)})}var Ye=_(Z,2),rt=v(Ye),Ut=_(Ye,2);si(Ut,20,()=>c(Ki),bt=>bt,(bt,Ht)=>{var ri=DA();let ii;var gi=v(ri);j(()=>{ii=kt(ri,1,"flat-item svelte-rrt0o",null,ii,{"active-item":c(f)===Ht}),W(gi,Ht)}),$("click",ri,()=>vt(Ht)),A(bt,ri)});var se=_(Fi,2),me=_(se,2),Ne=v(me);{var Y=bt=>{var Ht=SX(),ri=wt(Ht),ii=v(ri),gi=v(ii),qt=_(ii,2),vi=_(qt,2),Oe=_(vi,2),Ue=_(ri,2);{var Xt=ue=>{var qe=AA(),it=v(qe);j(()=>W(it,c(M))),A(ue,qe)};z(Ue,ue=>{c(M)&&ue(Xt)})}var Gt=_(Ue,2);{var Ei=ue=>{var qe=kA();A(ue,qe)},Kt=ue=>{var qe=wX(),it=v(qe),ot=_(v(it),2),ht=v(ot),pt=_(it,2),Jt=_(v(pt),2),B=v(Jt),H=_(pt,2),K=_(v(H),2),ce=v(K);yC(ce,{language:"javascript",get value(){return c(p)},set value(tt){m(p,tt,!0)}});var X=_(H,2),J=_(v(X),2),he=v(J);yC(he,{language:"javascript",get value(){return c(C)},set value(tt){m(C,tt,!0)}});var Qe=_(X,2),ae=v(Qe),fe=v(ae),Fe=_(fe,4),ge=_(v(Fe)),Ee=v(ge),ct=_(ae,2);{var q=tt=>{var Me=_X(),Be=v(Me);Cs(Be,()=>c(y),Et=>m(y,Et)),A(tt,Me)};z(ct,tt=>{c(E)&&tt(q)})}var re=_(Qe,2);{var Le=tt=>{var Me=yX(),Be=v(Me),Et=_(v(Be));{var Ct=Xe=>{var mt=vX();A(Xe,mt)},Ie=Xe=>{var mt=bX(),je=v(mt);j(()=>W(je,`${c(D).length??0??""} items · rev ${c(D)._rev??""}`)),A(Xe,mt)};z(Et,Xe=>{c(D).error?Xe(Ct):Xe(Ie,-1)})}var Dt=_(Be,2);{var Je=Xe=>{var mt=CX(),je=v(mt);j(()=>W(je,c(D).error)),A(Xe,mt)},Ve=Xe=>{var mt=EX(),je=v(mt);j(yt=>W(je,yt),[()=>JSON.stringify(c(D).result,null,2)]),A(Xe,mt)};z(Dt,Xe=>{c(D).error?Xe(Je):Xe(Ve,-1)})}A(tt,Me)};z(re,tt=>{c(D)&&tt(Le)})}j(()=>W(Ee,`${c(R)??""}${c(f)??""} on every update`)),jt(ht,()=>c(b),tt=>m(b,tt)),jt(B,()=>c(g),tt=>m(g,tt)),Cs(fe,()=>c(E),tt=>m(E,tt)),A(ue,qe)};z(Gt,ue=>{c(I)?ue(Ei):ue(Kt,-1)})}j(()=>W(gi,c(f))),$("click",qt,Pi),$("click",vi,Ai),$("click",Oe,hi),A(bt,Ht)},ze=bt=>{t(bt)};z(Ne,bt=>{c(f)?bt(Y):bt(ze,-1)})}var He=_(me,2);{var xe=bt=>{var Ht=DX(),ri=wt(Ht),ii=_(ri,2);let gi;var qt=v(ii);cX(qt,{get currentView(){return c(St)},onApplyView:be}),j(()=>gi=qo(ii,"",gi,{width:`${c(pe)??""}px`})),$("mousedown",ri,et),A(bt,Ht)};z(He,bt=>{c(Te)&&bt(xe)})}j(()=>ki=qo(Fi,"",ki,{width:`${c(oe)??""}px`})),$("click",Ti,()=>{m(te,!c(te)),m(le,null)}),jt(rt,()=>c(Ci),bt=>m(Ci,bt)),$("mousedown",se,Tt),A(Ke,Nt)};z(Wi,Ke=>{c(V)==="docs"?Ke(Zi):Ke(mi,-1)})}j(()=>{Zt=kt(ft,1,"svelte-rrt0o",null,Zt,{active:c(V)==="docs"}),Ni=kt(fi,1,"svelte-rrt0o",null,Ni,{active:c(V)==="views"})}),$("mousemove",Ri,xt),$("mouseup",Ri,at),ls("mouseleave",Ri,at),$("click",ft,()=>m(V,"docs")),$("click",fi,()=>m(V,"views")),A(o,Ri),Hs()}Us(["mousemove","mouseup","click","keydown","mousedown"]);var Qx={exports:{}},FX=Qx.exports,BA;function LX(){return BA||(BA=1,(function(o,e){(function(i,n){o.exports=n()})(typeof self<"u"?self:FX,function(){return(function(t){var i={};function n(s){if(i[s])return i[s].exports;var r=i[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=i,n.d=function(s,r,a){n.o(s,r)||Object.defineProperty(s,r,{configurable:!1,enumerable:!0,get:a})},n.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(r,"a",r),r},n.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},n.p="",n(n.s=3)})([(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=(function(){function r(a,d){this.width=d,this.height=a.length/d,this.data=a}return r.createEmpty=function(a,d){return new r(new Uint8ClampedArray(a*d),a)},r.prototype.get=function(a,d){return a<0||a>=this.width||d<0||d>=this.height?!1:!!this.data[d*this.width+a]},r.prototype.set=function(a,d,u){this.data[d*this.width+a]=u?1:0},r.prototype.setRegion=function(a,d,u,f,g){for(var p=d;p<d+f;p++)for(var C=a;C<a+u;C++)this.set(C,p,!!g)},r})();i.BitMatrix=s}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(2);function r(d,u){return d^u}i.addOrSubtractGF=r;var a=(function(){function d(u,f,g){this.primitive=u,this.size=f,this.generatorBase=g,this.expTable=new Array(this.size),this.logTable=new Array(this.size);for(var p=1,C=0;C<this.size;C++)this.expTable[C]=p,p=p*2,p>=this.size&&(p=(p^this.primitive)&this.size-1);for(var C=0;C<this.size-1;C++)this.logTable[this.expTable[C]]=C;this.zero=new s.default(this,Uint8ClampedArray.from([0])),this.one=new s.default(this,Uint8ClampedArray.from([1]))}return d.prototype.multiply=function(u,f){return u===0||f===0?0:this.expTable[(this.logTable[u]+this.logTable[f])%(this.size-1)]},d.prototype.inverse=function(u){if(u===0)throw new Error("Can't invert 0");return this.expTable[this.size-this.logTable[u]-1]},d.prototype.buildMonomial=function(u,f){if(u<0)throw new Error("Invalid monomial degree less than 0");if(f===0)return this.zero;var g=new Uint8ClampedArray(u+1);return g[0]=f,new s.default(this,g)},d.prototype.log=function(u){if(u===0)throw new Error("Can't take log(0)");return this.logTable[u]},d.prototype.exp=function(u){return this.expTable[u]},d})();i.default=a}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(1),r=(function(){function a(d,u){if(u.length===0)throw new Error("No coefficients.");this.field=d;var f=u.length;if(f>1&&u[0]===0){for(var g=1;g<f&&u[g]===0;)g++;if(g===f)this.coefficients=d.zero.coefficients;else{this.coefficients=new Uint8ClampedArray(f-g);for(var p=0;p<this.coefficients.length;p++)this.coefficients[p]=u[g+p]}}else this.coefficients=u}return a.prototype.degree=function(){return this.coefficients.length-1},a.prototype.isZero=function(){return this.coefficients[0]===0},a.prototype.getCoefficient=function(d){return this.coefficients[this.coefficients.length-1-d]},a.prototype.addOrSubtract=function(d){var u;if(this.isZero())return d;if(d.isZero())return this;var f=this.coefficients,g=d.coefficients;f.length>g.length&&(u=[g,f],f=u[0],g=u[1]);for(var p=new Uint8ClampedArray(g.length),C=g.length-f.length,b=0;b<C;b++)p[b]=g[b];for(var b=C;b<g.length;b++)p[b]=s.addOrSubtractGF(f[b-C],g[b]);return new a(this.field,p)},a.prototype.multiply=function(d){if(d===0)return this.field.zero;if(d===1)return this;for(var u=this.coefficients.length,f=new Uint8ClampedArray(u),g=0;g<u;g++)f[g]=this.field.multiply(this.coefficients[g],d);return new a(this.field,f)},a.prototype.multiplyPoly=function(d){if(this.isZero()||d.isZero())return this.field.zero;for(var u=this.coefficients,f=u.length,g=d.coefficients,p=g.length,C=new Uint8ClampedArray(f+p-1),b=0;b<f;b++)for(var E=u[b],y=0;y<p;y++)C[b+y]=s.addOrSubtractGF(C[b+y],this.field.multiply(E,g[y]));return new a(this.field,C)},a.prototype.multiplyByMonomial=function(d,u){if(d<0)throw new Error("Invalid degree less than 0");if(u===0)return this.field.zero;for(var f=this.coefficients.length,g=new Uint8ClampedArray(f+d),p=0;p<f;p++)g[p]=this.field.multiply(this.coefficients[p],u);return new a(this.field,g)},a.prototype.evaluateAt=function(d){var u=0;if(d===0)return this.getCoefficient(0);var f=this.coefficients.length;if(d===1)return this.coefficients.forEach(function(p){u=s.addOrSubtractGF(u,p)}),u;u=this.coefficients[0];for(var g=1;g<f;g++)u=s.addOrSubtractGF(this.field.multiply(d,u),this.coefficients[g]);return u},a})();i.default=r}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(4),r=n(5),a=n(11),d=n(12);function u(p){var C=d.locate(p);if(!C)return null;for(var b=0,E=C;b<E.length;b++){var y=E[b],D=a.extract(p,y),I=r.decode(D.matrix);if(I)return{binaryData:I.bytes,data:I.text,chunks:I.chunks,version:I.version,location:{topRightCorner:D.mappingFunction(y.dimension,0),topLeftCorner:D.mappingFunction(0,0),bottomRightCorner:D.mappingFunction(y.dimension,y.dimension),bottomLeftCorner:D.mappingFunction(0,y.dimension),topRightFinderPattern:y.topRight,topLeftFinderPattern:y.topLeft,bottomLeftFinderPattern:y.bottomLeft,bottomRightAlignmentPattern:y.alignmentPattern}}}return null}var f={inversionAttempts:"attemptBoth"};function g(p,C,b,E){E===void 0&&(E={});var y=f;Object.keys(y||{}).forEach(function(O){y[O]=E[O]||y[O]});var D=y.inversionAttempts==="attemptBoth"||y.inversionAttempts==="invertFirst",I=y.inversionAttempts==="onlyInvert"||y.inversionAttempts==="invertFirst",M=s.binarize(p,C,b,D),R=M.binarized,T=M.inverted,V=u(I?T:R);return!V&&(y.inversionAttempts==="attemptBoth"||y.inversionAttempts==="invertFirst")&&(V=u(I?R:T)),V}g.default=g,i.default=g}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(0),r=8,a=24;function d(g,p,C){return g<p?p:g>C?C:g}var u=(function(){function g(p,C){this.width=p,this.data=new Uint8ClampedArray(p*C)}return g.prototype.get=function(p,C){return this.data[C*this.width+p]},g.prototype.set=function(p,C,b){this.data[C*this.width+p]=b},g})();function f(g,p,C,b){if(g.length!==p*C*4)throw new Error("Malformed data passed to binarizer.");for(var E=new u(p,C),y=0;y<p;y++)for(var D=0;D<C;D++){var I=g[(D*p+y)*4+0],M=g[(D*p+y)*4+1],R=g[(D*p+y)*4+2];E.set(y,D,.2126*I+.7152*M+.0722*R)}for(var T=Math.ceil(p/r),V=Math.ceil(C/r),O=new u(T,V),Q=0;Q<V;Q++)for(var ie=0;ie<T;ie++){for(var de=0,te=1/0,le=0,D=0;D<r;D++)for(var y=0;y<r;y++){var we=E.get(ie*r+y,Q*r+D);de+=we,te=Math.min(te,we),le=Math.max(le,we)}var oe=de/Math.pow(r,2);if(le-te<=a&&(oe=te/2,Q>0&&ie>0)){var ye=(O.get(ie,Q-1)+2*O.get(ie-1,Q)+O.get(ie-1,Q-1))/4;te<ye&&(oe=ye)}O.set(ie,Q,oe)}var Re=s.BitMatrix.createEmpty(p,C),ke=null;b&&(ke=s.BitMatrix.createEmpty(p,C));for(var Q=0;Q<V;Q++)for(var ie=0;ie<T;ie++){for(var _e=d(ie,2,T-3),lt=d(Q,2,V-3),de=0,Te=-2;Te<=2;Te++)for(var pe=-2;pe<=2;pe++)de+=O.get(_e+Te,lt+pe);for(var ut=de/25,Te=0;Te<r;Te++)for(var pe=0;pe<r;pe++){var y=ie*r+Te,D=Q*r+pe,Rt=E.get(y,D);Re.set(y,D,Rt<=ut),b&&ke.set(y,D,!(Rt<=ut))}}return b?{binarized:Re,inverted:ke}:{binarized:Re}}i.binarize=f}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(0),r=n(6),a=n(9),d=n(10);function u(R,T){for(var V=R^T,O=0;V;)O++,V&=V-1;return O}function f(R,T){return T<<1|R}var g=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,dataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,formatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,dataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,dataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],p=[function(R){return(R.y+R.x)%2===0},function(R){return R.y%2===0},function(R){return R.x%3===0},function(R){return(R.y+R.x)%3===0},function(R){return(Math.floor(R.y/2)+Math.floor(R.x/3))%2===0},function(R){return R.x*R.y%2+R.x*R.y%3===0},function(R){return(R.y*R.x%2+R.y*R.x%3)%2===0},function(R){return((R.y+R.x)%2+R.y*R.x%3)%2===0}];function C(R){var T=17+4*R.versionNumber,V=s.BitMatrix.createEmpty(T,T);V.setRegion(0,0,9,9,!0),V.setRegion(T-8,0,8,9,!0),V.setRegion(0,T-8,9,8,!0);for(var O=0,Q=R.alignmentPatternCenters;O<Q.length;O++)for(var ie=Q[O],de=0,te=R.alignmentPatternCenters;de<te.length;de++){var le=te[de];ie===6&&le===6||ie===6&&le===T-7||ie===T-7&&le===6||V.setRegion(ie-2,le-2,5,5,!0)}return V.setRegion(6,9,1,T-17,!0),V.setRegion(9,6,T-17,1,!0),R.versionNumber>6&&(V.setRegion(T-11,0,3,6,!0),V.setRegion(0,T-11,6,3,!0)),V}function b(R,T,V){for(var O=p[V.dataMask],Q=R.height,ie=C(T),de=[],te=0,le=0,we=!0,oe=Q-1;oe>0;oe-=2){oe===6&&oe--;for(var ye=0;ye<Q;ye++)for(var Re=we?Q-1-ye:ye,ke=0;ke<2;ke++){var _e=oe-ke;if(!ie.get(_e,Re)){le++;var lt=R.get(_e,Re);O({y:Re,x:_e})&&(lt=!lt),te=f(lt,te),le===8&&(de.push(te),le=0,te=0)}}we=!we}return de}function E(R){var T=R.height,V=Math.floor((T-17)/4);if(V<=6)return d.VERSIONS[V-1];for(var O=0,Q=5;Q>=0;Q--)for(var ie=T-9;ie>=T-11;ie--)O=f(R.get(ie,Q),O);for(var de=0,ie=5;ie>=0;ie--)for(var Q=T-9;Q>=T-11;Q--)de=f(R.get(ie,Q),de);for(var te=1/0,le,we=0,oe=d.VERSIONS;we<oe.length;we++){var ye=oe[we];if(ye.infoBits===O||ye.infoBits===de)return ye;var Re=u(O,ye.infoBits);Re<te&&(le=ye,te=Re),Re=u(de,ye.infoBits),Re<te&&(le=ye,te=Re)}if(te<=3)return le}function y(R){for(var T=0,V=0;V<=8;V++)V!==6&&(T=f(R.get(V,8),T));for(var O=7;O>=0;O--)O!==6&&(T=f(R.get(8,O),T));for(var Q=R.height,ie=0,O=Q-1;O>=Q-7;O--)ie=f(R.get(8,O),ie);for(var V=Q-8;V<Q;V++)ie=f(R.get(V,8),ie);for(var de=1/0,te=null,le=0,we=g;le<we.length;le++){var oe=we[le],ye=oe.bits,Re=oe.formatInfo;if(ye===T||ye===ie)return Re;var ke=u(T,ye);ke<de&&(te=Re,de=ke),T!==ie&&(ke=u(ie,ye),ke<de&&(te=Re,de=ke))}return de<=3?te:null}function D(R,T,V){var O=T.errorCorrectionLevels[V],Q=[],ie=0;if(O.ecBlocks.forEach(function(lt){for(var Te=0;Te<lt.numBlocks;Te++)Q.push({numDataCodewords:lt.dataCodewordsPerBlock,codewords:[]}),ie+=lt.dataCodewordsPerBlock+O.ecCodewordsPerBlock}),R.length<ie)return null;R=R.slice(0,ie);for(var de=O.ecBlocks[0].dataCodewordsPerBlock,te=0;te<de;te++)for(var le=0,we=Q;le<we.length;le++){var oe=we[le];oe.codewords.push(R.shift())}if(O.ecBlocks.length>1)for(var ye=O.ecBlocks[0].numBlocks,Re=O.ecBlocks[1].numBlocks,te=0;te<Re;te++)Q[ye+te].codewords.push(R.shift());for(;R.length>0;)for(var ke=0,_e=Q;ke<_e.length;ke++){var oe=_e[ke];oe.codewords.push(R.shift())}return Q}function I(R){var T=E(R);if(!T)return null;var V=y(R);if(!V)return null;var O=b(R,T,V),Q=D(O,T,V.errorCorrectionLevel);if(!Q)return null;for(var ie=Q.reduce(function(ke,_e){return ke+_e.numDataCodewords},0),de=new Uint8ClampedArray(ie),te=0,le=0,we=Q;le<we.length;le++){var oe=we[le],ye=a.decode(oe.codewords,oe.codewords.length-oe.numDataCodewords);if(!ye)return null;for(var Re=0;Re<oe.numDataCodewords;Re++)de[te++]=ye[Re]}try{return r.decode(de,T.versionNumber)}catch{return null}}function M(R){if(R==null)return null;var T=I(R);if(T)return T;for(var V=0;V<R.width;V++)for(var O=V+1;O<R.height;O++)R.get(V,O)!==R.get(O,V)&&(R.set(V,O,!R.get(V,O)),R.set(O,V,!R.get(O,V)));return I(R)}i.decode=M}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(7),r=n(8),a;(function(E){E.Numeric="numeric",E.Alphanumeric="alphanumeric",E.Byte="byte",E.Kanji="kanji",E.ECI="eci"})(a=i.Mode||(i.Mode={}));var d;(function(E){E[E.Terminator=0]="Terminator",E[E.Numeric=1]="Numeric",E[E.Alphanumeric=2]="Alphanumeric",E[E.Byte=4]="Byte",E[E.Kanji=8]="Kanji",E[E.ECI=7]="ECI"})(d||(d={}));function u(E,y){for(var D=[],I="",M=[10,12,14][y],R=E.readBits(M);R>=3;){var T=E.readBits(10);if(T>=1e3)throw new Error("Invalid numeric value above 999");var V=Math.floor(T/100),O=Math.floor(T/10)%10,Q=T%10;D.push(48+V,48+O,48+Q),I+=V.toString()+O.toString()+Q.toString(),R-=3}if(R===2){var T=E.readBits(7);if(T>=100)throw new Error("Invalid numeric value above 99");var V=Math.floor(T/10),O=T%10;D.push(48+V,48+O),I+=V.toString()+O.toString()}else if(R===1){var T=E.readBits(4);if(T>=10)throw new Error("Invalid numeric value above 9");D.push(48+T),I+=T.toString()}return{bytes:D,text:I}}var f=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function g(E,y){for(var D=[],I="",M=[9,11,13][y],R=E.readBits(M);R>=2;){var T=E.readBits(11),V=Math.floor(T/45),O=T%45;D.push(f[V].charCodeAt(0),f[O].charCodeAt(0)),I+=f[V]+f[O],R-=2}if(R===1){var V=E.readBits(6);D.push(f[V].charCodeAt(0)),I+=f[V]}return{bytes:D,text:I}}function p(E,y){for(var D=[],I="",M=[8,16,16][y],R=E.readBits(M),T=0;T<R;T++){var V=E.readBits(8);D.push(V)}try{I+=decodeURIComponent(D.map(function(O){return"%"+("0"+O.toString(16)).substr(-2)}).join(""))}catch{}return{bytes:D,text:I}}function C(E,y){for(var D=[],I="",M=[8,10,12][y],R=E.readBits(M),T=0;T<R;T++){var V=E.readBits(13),O=Math.floor(V/192)<<8|V%192;O<7936?O+=33088:O+=49472,D.push(O>>8,O&255),I+=String.fromCharCode(r.shiftJISTable[O])}return{bytes:D,text:I}}function b(E,y){for(var D,I,M,R,T=new s.BitStream(E),V=y<=9?0:y<=26?1:2,O={text:"",bytes:[],chunks:[],version:y};T.available()>=4;){var Q=T.readBits(4);if(Q===d.Terminator)return O;if(Q===d.ECI)T.readBits(1)===0?O.chunks.push({type:a.ECI,assignmentNumber:T.readBits(7)}):T.readBits(1)===0?O.chunks.push({type:a.ECI,assignmentNumber:T.readBits(14)}):T.readBits(1)===0?O.chunks.push({type:a.ECI,assignmentNumber:T.readBits(21)}):O.chunks.push({type:a.ECI,assignmentNumber:-1});else if(Q===d.Numeric){var ie=u(T,V);O.text+=ie.text,(D=O.bytes).push.apply(D,ie.bytes),O.chunks.push({type:a.Numeric,text:ie.text})}else if(Q===d.Alphanumeric){var de=g(T,V);O.text+=de.text,(I=O.bytes).push.apply(I,de.bytes),O.chunks.push({type:a.Alphanumeric,text:de.text})}else if(Q===d.Byte){var te=p(T,V);O.text+=te.text,(M=O.bytes).push.apply(M,te.bytes),O.chunks.push({type:a.Byte,bytes:te.bytes,text:te.text})}else if(Q===d.Kanji){var le=C(T,V);O.text+=le.text,(R=O.bytes).push.apply(R,le.bytes),O.chunks.push({type:a.Kanji,bytes:le.bytes,text:le.text})}}if(T.available()===0||T.readBits(T.available())===0)return O}i.decode=b}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=(function(){function r(a){this.byteOffset=0,this.bitOffset=0,this.bytes=a}return r.prototype.readBits=function(a){if(a<1||a>32||a>this.available())throw new Error("Cannot read "+a.toString()+" bits");var d=0;if(this.bitOffset>0){var u=8-this.bitOffset,f=a<u?a:u,g=u-f,p=255>>8-f<<g;d=(this.bytes[this.byteOffset]&p)>>g,a-=f,this.bitOffset+=f,this.bitOffset===8&&(this.bitOffset=0,this.byteOffset++)}if(a>0){for(;a>=8;)d=d<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;if(a>0){var g=8-a,p=255>>g<<g;d=d<<a|(this.bytes[this.byteOffset]&p)>>g,this.bitOffset+=a}}return d},r.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},r})();i.BitStream=s}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.shiftJISTable={32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:165,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:8254,33088:12288,33089:12289,33090:12290,33091:65292,33092:65294,33093:12539,33094:65306,33095:65307,33096:65311,33097:65281,33098:12443,33099:12444,33100:180,33101:65344,33102:168,33103:65342,33104:65507,33105:65343,33106:12541,33107:12542,33108:12445,33109:12446,33110:12291,33111:20189,33112:12293,33113:12294,33114:12295,33115:12540,33116:8213,33117:8208,33118:65295,33119:92,33120:12316,33121:8214,33122:65372,33123:8230,33124:8229,33125:8216,33126:8217,33127:8220,33128:8221,33129:65288,33130:65289,33131:12308,33132:12309,33133:65339,33134:65341,33135:65371,33136:65373,33137:12296,33138:12297,33139:12298,33140:12299,33141:12300,33142:12301,33143:12302,33144:12303,33145:12304,33146:12305,33147:65291,33148:8722,33149:177,33150:215,33152:247,33153:65309,33154:8800,33155:65308,33156:65310,33157:8806,33158:8807,33159:8734,33160:8756,33161:9794,33162:9792,33163:176,33164:8242,33165:8243,33166:8451,33167:65509,33168:65284,33169:162,33170:163,33171:65285,33172:65283,33173:65286,33174:65290,33175:65312,33176:167,33177:9734,33178:9733,33179:9675,33180:9679,33181:9678,33182:9671,33183:9670,33184:9633,33185:9632,33186:9651,33187:9650,33188:9661,33189:9660,33190:8251,33191:12306,33192:8594,33193:8592,33194:8593,33195:8595,33196:12307,33208:8712,33209:8715,33210:8838,33211:8839,33212:8834,33213:8835,33214:8746,33215:8745,33224:8743,33225:8744,33226:172,33227:8658,33228:8660,33229:8704,33230:8707,33242:8736,33243:8869,33244:8978,33245:8706,33246:8711,33247:8801,33248:8786,33249:8810,33250:8811,33251:8730,33252:8765,33253:8733,33254:8757,33255:8747,33256:8748,33264:8491,33265:8240,33266:9839,33267:9837,33268:9834,33269:8224,33270:8225,33271:182,33276:9711,33359:65296,33360:65297,33361:65298,33362:65299,33363:65300,33364:65301,33365:65302,33366:65303,33367:65304,33368:65305,33376:65313,33377:65314,33378:65315,33379:65316,33380:65317,33381:65318,33382:65319,33383:65320,33384:65321,33385:65322,33386:65323,33387:65324,33388:65325,33389:65326,33390:65327,33391:65328,33392:65329,33393:65330,33394:65331,33395:65332,33396:65333,33397:65334,33398:65335,33399:65336,33400:65337,33401:65338,33409:65345,33410:65346,33411:65347,33412:65348,33413:65349,33414:65350,33415:65351,33416:65352,33417:65353,33418:65354,33419:65355,33420:65356,33421:65357,33422:65358,33423:65359,33424:65360,33425:65361,33426:65362,33427:65363,33428:65364,33429:65365,33430:65366,33431:65367,33432:65368,33433:65369,33434:65370,33439:12353,33440:12354,33441:12355,33442:12356,33443:12357,33444:12358,33445:12359,33446:12360,33447:12361,33448:12362,33449:12363,33450:12364,33451:12365,33452:12366,33453:12367,33454:12368,33455:12369,33456:12370,33457:12371,33458:12372,33459:12373,33460:12374,33461:12375,33462:12376,33463:12377,33464:12378,33465:12379,33466:12380,33467:12381,33468:12382,33469:12383,33470:12384,33471:12385,33472:12386,33473:12387,33474:12388,33475:12389,33476:12390,33477:12391,33478:12392,33479:12393,33480:12394,33481:12395,33482:12396,33483:12397,33484:12398,33485:12399,33486:12400,33487:12401,33488:12402,33489:12403,33490:12404,33491:12405,33492:12406,33493:12407,33494:12408,33495:12409,33496:12410,33497:12411,33498:12412,33499:12413,33500:12414,33501:12415,33502:12416,33503:12417,33504:12418,33505:12419,33506:12420,33507:12421,33508:12422,33509:12423,33510:12424,33511:12425,33512:12426,33513:12427,33514:12428,33515:12429,33516:12430,33517:12431,33518:12432,33519:12433,33520:12434,33521:12435,33600:12449,33601:12450,33602:12451,33603:12452,33604:12453,33605:12454,33606:12455,33607:12456,33608:12457,33609:12458,33610:12459,33611:12460,33612:12461,33613:12462,33614:12463,33615:12464,33616:12465,33617:12466,33618:12467,33619:12468,33620:12469,33621:12470,33622:12471,33623:12472,33624:12473,33625:12474,33626:12475,33627:12476,33628:12477,33629:12478,33630:12479,33631:12480,33632:12481,33633:12482,33634:12483,33635:12484,33636:12485,33637:12486,33638:12487,33639:12488,33640:12489,33641:12490,33642:12491,33643:12492,33644:12493,33645:12494,33646:12495,33647:12496,33648:12497,33649:12498,33650:12499,33651:12500,33652:12501,33653:12502,33654:12503,33655:12504,33656:12505,33657:12506,33658:12507,33659:12508,33660:12509,33661:12510,33662:12511,33664:12512,33665:12513,33666:12514,33667:12515,33668:12516,33669:12517,33670:12518,33671:12519,33672:12520,33673:12521,33674:12522,33675:12523,33676:12524,33677:12525,33678:12526,33679:12527,33680:12528,33681:12529,33682:12530,33683:12531,33684:12532,33685:12533,33686:12534,33695:913,33696:914,33697:915,33698:916,33699:917,33700:918,33701:919,33702:920,33703:921,33704:922,33705:923,33706:924,33707:925,33708:926,33709:927,33710:928,33711:929,33712:931,33713:932,33714:933,33715:934,33716:935,33717:936,33718:937,33727:945,33728:946,33729:947,33730:948,33731:949,33732:950,33733:951,33734:952,33735:953,33736:954,33737:955,33738:956,33739:957,33740:958,33741:959,33742:960,33743:961,33744:963,33745:964,33746:965,33747:966,33748:967,33749:968,33750:969,33856:1040,33857:1041,33858:1042,33859:1043,33860:1044,33861:1045,33862:1025,33863:1046,33864:1047,33865:1048,33866:1049,33867:1050,33868:1051,33869:1052,33870:1053,33871:1054,33872:1055,33873:1056,33874:1057,33875:1058,33876:1059,33877:1060,33878:1061,33879:1062,33880:1063,33881:1064,33882:1065,33883:1066,33884:1067,33885:1068,33886:1069,33887:1070,33888:1071,33904:1072,33905:1073,33906:1074,33907:1075,33908:1076,33909:1077,33910:1105,33911:1078,33912:1079,33913:1080,33914:1081,33915:1082,33916:1083,33917:1084,33918:1085,33920:1086,33921:1087,33922:1088,33923:1089,33924:1090,33925:1091,33926:1092,33927:1093,33928:1094,33929:1095,33930:1096,33931:1097,33932:1098,33933:1099,33934:1100,33935:1101,33936:1102,33937:1103,33951:9472,33952:9474,33953:9484,33954:9488,33955:9496,33956:9492,33957:9500,33958:9516,33959:9508,33960:9524,33961:9532,33962:9473,33963:9475,33964:9487,33965:9491,33966:9499,33967:9495,33968:9507,33969:9523,33970:9515,33971:9531,33972:9547,33973:9504,33974:9519,33975:9512,33976:9527,33977:9535,33978:9501,33979:9520,33980:9509,33981:9528,33982:9538,34975:20124,34976:21782,34977:23043,34978:38463,34979:21696,34980:24859,34981:25384,34982:23030,34983:36898,34984:33909,34985:33564,34986:31312,34987:24746,34988:25569,34989:28197,34990:26093,34991:33894,34992:33446,34993:39925,34994:26771,34995:22311,34996:26017,34997:25201,34998:23451,34999:22992,35e3:34427,35001:39156,35002:32098,35003:32190,35004:39822,35005:25110,35006:31903,35007:34999,35008:23433,35009:24245,35010:25353,35011:26263,35012:26696,35013:38343,35014:38797,35015:26447,35016:20197,35017:20234,35018:20301,35019:20381,35020:20553,35021:22258,35022:22839,35023:22996,35024:23041,35025:23561,35026:24799,35027:24847,35028:24944,35029:26131,35030:26885,35031:28858,35032:30031,35033:30064,35034:31227,35035:32173,35036:32239,35037:32963,35038:33806,35039:34915,35040:35586,35041:36949,35042:36986,35043:21307,35044:20117,35045:20133,35046:22495,35047:32946,35048:37057,35049:30959,35050:19968,35051:22769,35052:28322,35053:36920,35054:31282,35055:33576,35056:33419,35057:39983,35058:20801,35059:21360,35060:21693,35061:21729,35062:22240,35063:23035,35064:24341,35065:39154,35066:28139,35067:32996,35068:34093,35136:38498,35137:38512,35138:38560,35139:38907,35140:21515,35141:21491,35142:23431,35143:28879,35144:32701,35145:36802,35146:38632,35147:21359,35148:40284,35149:31418,35150:19985,35151:30867,35152:33276,35153:28198,35154:22040,35155:21764,35156:27421,35157:34074,35158:39995,35159:23013,35160:21417,35161:28006,35162:29916,35163:38287,35164:22082,35165:20113,35166:36939,35167:38642,35168:33615,35169:39180,35170:21473,35171:21942,35172:23344,35173:24433,35174:26144,35175:26355,35176:26628,35177:27704,35178:27891,35179:27945,35180:29787,35181:30408,35182:31310,35183:38964,35184:33521,35185:34907,35186:35424,35187:37613,35188:28082,35189:30123,35190:30410,35191:39365,35192:24742,35193:35585,35194:36234,35195:38322,35196:27022,35197:21421,35198:20870,35200:22290,35201:22576,35202:22852,35203:23476,35204:24310,35205:24616,35206:25513,35207:25588,35208:27839,35209:28436,35210:28814,35211:28948,35212:29017,35213:29141,35214:29503,35215:32257,35216:33398,35217:33489,35218:34199,35219:36960,35220:37467,35221:40219,35222:22633,35223:26044,35224:27738,35225:29989,35226:20985,35227:22830,35228:22885,35229:24448,35230:24540,35231:25276,35232:26106,35233:27178,35234:27431,35235:27572,35236:29579,35237:32705,35238:35158,35239:40236,35240:40206,35241:40644,35242:23713,35243:27798,35244:33659,35245:20740,35246:23627,35247:25014,35248:33222,35249:26742,35250:29281,35251:20057,35252:20474,35253:21368,35254:24681,35255:28201,35256:31311,35257:38899,35258:19979,35259:21270,35260:20206,35261:20309,35262:20285,35263:20385,35264:20339,35265:21152,35266:21487,35267:22025,35268:22799,35269:23233,35270:23478,35271:23521,35272:31185,35273:26247,35274:26524,35275:26550,35276:27468,35277:27827,35278:28779,35279:29634,35280:31117,35281:31166,35282:31292,35283:31623,35284:33457,35285:33499,35286:33540,35287:33655,35288:33775,35289:33747,35290:34662,35291:35506,35292:22057,35293:36008,35294:36838,35295:36942,35296:38686,35297:34442,35298:20420,35299:23784,35300:25105,35301:29273,35302:30011,35303:33253,35304:33469,35305:34558,35306:36032,35307:38597,35308:39187,35309:39381,35310:20171,35311:20250,35312:35299,35313:22238,35314:22602,35315:22730,35316:24315,35317:24555,35318:24618,35319:24724,35320:24674,35321:25040,35322:25106,35323:25296,35324:25913,35392:39745,35393:26214,35394:26800,35395:28023,35396:28784,35397:30028,35398:30342,35399:32117,35400:33445,35401:34809,35402:38283,35403:38542,35404:35997,35405:20977,35406:21182,35407:22806,35408:21683,35409:23475,35410:23830,35411:24936,35412:27010,35413:28079,35414:30861,35415:33995,35416:34903,35417:35442,35418:37799,35419:39608,35420:28012,35421:39336,35422:34521,35423:22435,35424:26623,35425:34510,35426:37390,35427:21123,35428:22151,35429:21508,35430:24275,35431:25313,35432:25785,35433:26684,35434:26680,35435:27579,35436:29554,35437:30906,35438:31339,35439:35226,35440:35282,35441:36203,35442:36611,35443:37101,35444:38307,35445:38548,35446:38761,35447:23398,35448:23731,35449:27005,35450:38989,35451:38990,35452:25499,35453:31520,35454:27179,35456:27263,35457:26806,35458:39949,35459:28511,35460:21106,35461:21917,35462:24688,35463:25324,35464:27963,35465:28167,35466:28369,35467:33883,35468:35088,35469:36676,35470:19988,35471:39993,35472:21494,35473:26907,35474:27194,35475:38788,35476:26666,35477:20828,35478:31427,35479:33970,35480:37340,35481:37772,35482:22107,35483:40232,35484:26658,35485:33541,35486:33841,35487:31909,35488:21e3,35489:33477,35490:29926,35491:20094,35492:20355,35493:20896,35494:23506,35495:21002,35496:21208,35497:21223,35498:24059,35499:21914,35500:22570,35501:23014,35502:23436,35503:23448,35504:23515,35505:24178,35506:24185,35507:24739,35508:24863,35509:24931,35510:25022,35511:25563,35512:25954,35513:26577,35514:26707,35515:26874,35516:27454,35517:27475,35518:27735,35519:28450,35520:28567,35521:28485,35522:29872,35523:29976,35524:30435,35525:30475,35526:31487,35527:31649,35528:31777,35529:32233,35530:32566,35531:32752,35532:32925,35533:33382,35534:33694,35535:35251,35536:35532,35537:36011,35538:36996,35539:37969,35540:38291,35541:38289,35542:38306,35543:38501,35544:38867,35545:39208,35546:33304,35547:20024,35548:21547,35549:23736,35550:24012,35551:29609,35552:30284,35553:30524,35554:23721,35555:32747,35556:36107,35557:38593,35558:38929,35559:38996,35560:39e3,35561:20225,35562:20238,35563:21361,35564:21916,35565:22120,35566:22522,35567:22855,35568:23305,35569:23492,35570:23696,35571:24076,35572:24190,35573:24524,35574:25582,35575:26426,35576:26071,35577:26082,35578:26399,35579:26827,35580:26820,35648:27231,35649:24112,35650:27589,35651:27671,35652:27773,35653:30079,35654:31048,35655:23395,35656:31232,35657:32e3,35658:24509,35659:35215,35660:35352,35661:36020,35662:36215,35663:36556,35664:36637,35665:39138,35666:39438,35667:39740,35668:20096,35669:20605,35670:20736,35671:22931,35672:23452,35673:25135,35674:25216,35675:25836,35676:27450,35677:29344,35678:30097,35679:31047,35680:32681,35681:34811,35682:35516,35683:35696,35684:25516,35685:33738,35686:38816,35687:21513,35688:21507,35689:21931,35690:26708,35691:27224,35692:35440,35693:30759,35694:26485,35695:40653,35696:21364,35697:23458,35698:33050,35699:34384,35700:36870,35701:19992,35702:20037,35703:20167,35704:20241,35705:21450,35706:21560,35707:23470,35708:24339,35709:24613,35710:25937,35712:26429,35713:27714,35714:27762,35715:27875,35716:28792,35717:29699,35718:31350,35719:31406,35720:31496,35721:32026,35722:31998,35723:32102,35724:26087,35725:29275,35726:21435,35727:23621,35728:24040,35729:25298,35730:25312,35731:25369,35732:28192,35733:34394,35734:35377,35735:36317,35736:37624,35737:28417,35738:31142,35739:39770,35740:20136,35741:20139,35742:20140,35743:20379,35744:20384,35745:20689,35746:20807,35747:31478,35748:20849,35749:20982,35750:21332,35751:21281,35752:21375,35753:21483,35754:21932,35755:22659,35756:23777,35757:24375,35758:24394,35759:24623,35760:24656,35761:24685,35762:25375,35763:25945,35764:27211,35765:27841,35766:29378,35767:29421,35768:30703,35769:33016,35770:33029,35771:33288,35772:34126,35773:37111,35774:37857,35775:38911,35776:39255,35777:39514,35778:20208,35779:20957,35780:23597,35781:26241,35782:26989,35783:23616,35784:26354,35785:26997,35786:29577,35787:26704,35788:31873,35789:20677,35790:21220,35791:22343,35792:24062,35793:37670,35794:26020,35795:27427,35796:27453,35797:29748,35798:31105,35799:31165,35800:31563,35801:32202,35802:33465,35803:33740,35804:34943,35805:35167,35806:35641,35807:36817,35808:37329,35809:21535,35810:37504,35811:20061,35812:20534,35813:21477,35814:21306,35815:29399,35816:29590,35817:30697,35818:33510,35819:36527,35820:39366,35821:39368,35822:39378,35823:20855,35824:24858,35825:34398,35826:21936,35827:31354,35828:20598,35829:23507,35830:36935,35831:38533,35832:20018,35833:27355,35834:37351,35835:23633,35836:23624,35904:25496,35905:31391,35906:27795,35907:38772,35908:36705,35909:31402,35910:29066,35911:38536,35912:31874,35913:26647,35914:32368,35915:26705,35916:37740,35917:21234,35918:21531,35919:34219,35920:35347,35921:32676,35922:36557,35923:37089,35924:21350,35925:34952,35926:31041,35927:20418,35928:20670,35929:21009,35930:20804,35931:21843,35932:22317,35933:29674,35934:22411,35935:22865,35936:24418,35937:24452,35938:24693,35939:24950,35940:24935,35941:25001,35942:25522,35943:25658,35944:25964,35945:26223,35946:26690,35947:28179,35948:30054,35949:31293,35950:31995,35951:32076,35952:32153,35953:32331,35954:32619,35955:33550,35956:33610,35957:34509,35958:35336,35959:35427,35960:35686,35961:36605,35962:38938,35963:40335,35964:33464,35965:36814,35966:39912,35968:21127,35969:25119,35970:25731,35971:28608,35972:38553,35973:26689,35974:20625,35975:27424,35976:27770,35977:28500,35978:31348,35979:32080,35980:34880,35981:35363,35982:26376,35983:20214,35984:20537,35985:20518,35986:20581,35987:20860,35988:21048,35989:21091,35990:21927,35991:22287,35992:22533,35993:23244,35994:24314,35995:25010,35996:25080,35997:25331,35998:25458,35999:26908,36e3:27177,36001:29309,36002:29356,36003:29486,36004:30740,36005:30831,36006:32121,36007:30476,36008:32937,36009:35211,36010:35609,36011:36066,36012:36562,36013:36963,36014:37749,36015:38522,36016:38997,36017:39443,36018:40568,36019:20803,36020:21407,36021:21427,36022:24187,36023:24358,36024:28187,36025:28304,36026:29572,36027:29694,36028:32067,36029:33335,36030:35328,36031:35578,36032:38480,36033:20046,36034:20491,36035:21476,36036:21628,36037:22266,36038:22993,36039:23396,36040:24049,36041:24235,36042:24359,36043:25144,36044:25925,36045:26543,36046:28246,36047:29392,36048:31946,36049:34996,36050:32929,36051:32993,36052:33776,36053:34382,36054:35463,36055:36328,36056:37431,36057:38599,36058:39015,36059:40723,36060:20116,36061:20114,36062:20237,36063:21320,36064:21577,36065:21566,36066:23087,36067:24460,36068:24481,36069:24735,36070:26791,36071:27278,36072:29786,36073:30849,36074:35486,36075:35492,36076:35703,36077:37264,36078:20062,36079:39881,36080:20132,36081:20348,36082:20399,36083:20505,36084:20502,36085:20809,36086:20844,36087:21151,36088:21177,36089:21246,36090:21402,36091:21475,36092:21521,36160:21518,36161:21897,36162:22353,36163:22434,36164:22909,36165:23380,36166:23389,36167:23439,36168:24037,36169:24039,36170:24055,36171:24184,36172:24195,36173:24218,36174:24247,36175:24344,36176:24658,36177:24908,36178:25239,36179:25304,36180:25511,36181:25915,36182:26114,36183:26179,36184:26356,36185:26477,36186:26657,36187:26775,36188:27083,36189:27743,36190:27946,36191:28009,36192:28207,36193:28317,36194:30002,36195:30343,36196:30828,36197:31295,36198:31968,36199:32005,36200:32024,36201:32094,36202:32177,36203:32789,36204:32771,36205:32943,36206:32945,36207:33108,36208:33167,36209:33322,36210:33618,36211:34892,36212:34913,36213:35611,36214:36002,36215:36092,36216:37066,36217:37237,36218:37489,36219:30783,36220:37628,36221:38308,36222:38477,36224:38917,36225:39321,36226:39640,36227:40251,36228:21083,36229:21163,36230:21495,36231:21512,36232:22741,36233:25335,36234:28640,36235:35946,36236:36703,36237:40633,36238:20811,36239:21051,36240:21578,36241:22269,36242:31296,36243:37239,36244:40288,36245:40658,36246:29508,36247:28425,36248:33136,36249:29969,36250:24573,36251:24794,36252:39592,36253:29403,36254:36796,36255:27492,36256:38915,36257:20170,36258:22256,36259:22372,36260:22718,36261:23130,36262:24680,36263:25031,36264:26127,36265:26118,36266:26681,36267:26801,36268:28151,36269:30165,36270:32058,36271:33390,36272:39746,36273:20123,36274:20304,36275:21449,36276:21766,36277:23919,36278:24038,36279:24046,36280:26619,36281:27801,36282:29811,36283:30722,36284:35408,36285:37782,36286:35039,36287:22352,36288:24231,36289:25387,36290:20661,36291:20652,36292:20877,36293:26368,36294:21705,36295:22622,36296:22971,36297:23472,36298:24425,36299:25165,36300:25505,36301:26685,36302:27507,36303:28168,36304:28797,36305:37319,36306:29312,36307:30741,36308:30758,36309:31085,36310:25998,36311:32048,36312:33756,36313:35009,36314:36617,36315:38555,36316:21092,36317:22312,36318:26448,36319:32618,36320:36001,36321:20916,36322:22338,36323:38442,36324:22586,36325:27018,36326:32948,36327:21682,36328:23822,36329:22524,36330:30869,36331:40442,36332:20316,36333:21066,36334:21643,36335:25662,36336:26152,36337:26388,36338:26613,36339:31364,36340:31574,36341:32034,36342:37679,36343:26716,36344:39853,36345:31545,36346:21273,36347:20874,36348:21047,36416:23519,36417:25334,36418:25774,36419:25830,36420:26413,36421:27578,36422:34217,36423:38609,36424:30352,36425:39894,36426:25420,36427:37638,36428:39851,36429:30399,36430:26194,36431:19977,36432:20632,36433:21442,36434:23665,36435:24808,36436:25746,36437:25955,36438:26719,36439:29158,36440:29642,36441:29987,36442:31639,36443:32386,36444:34453,36445:35715,36446:36059,36447:37240,36448:39184,36449:26028,36450:26283,36451:27531,36452:20181,36453:20180,36454:20282,36455:20351,36456:21050,36457:21496,36458:21490,36459:21987,36460:22235,36461:22763,36462:22987,36463:22985,36464:23039,36465:23376,36466:23629,36467:24066,36468:24107,36469:24535,36470:24605,36471:25351,36472:25903,36473:23388,36474:26031,36475:26045,36476:26088,36477:26525,36478:27490,36480:27515,36481:27663,36482:29509,36483:31049,36484:31169,36485:31992,36486:32025,36487:32043,36488:32930,36489:33026,36490:33267,36491:35222,36492:35422,36493:35433,36494:35430,36495:35468,36496:35566,36497:36039,36498:36060,36499:38604,36500:39164,36501:27503,36502:20107,36503:20284,36504:20365,36505:20816,36506:23383,36507:23546,36508:24904,36509:25345,36510:26178,36511:27425,36512:28363,36513:27835,36514:29246,36515:29885,36516:30164,36517:30913,36518:31034,36519:32780,36520:32819,36521:33258,36522:33940,36523:36766,36524:27728,36525:40575,36526:24335,36527:35672,36528:40235,36529:31482,36530:36600,36531:23437,36532:38635,36533:19971,36534:21489,36535:22519,36536:22833,36537:23241,36538:23460,36539:24713,36540:28287,36541:28422,36542:30142,36543:36074,36544:23455,36545:34048,36546:31712,36547:20594,36548:26612,36549:33437,36550:23649,36551:34122,36552:32286,36553:33294,36554:20889,36555:23556,36556:25448,36557:36198,36558:26012,36559:29038,36560:31038,36561:32023,36562:32773,36563:35613,36564:36554,36565:36974,36566:34503,36567:37034,36568:20511,36569:21242,36570:23610,36571:26451,36572:28796,36573:29237,36574:37196,36575:37320,36576:37675,36577:33509,36578:23490,36579:24369,36580:24825,36581:20027,36582:21462,36583:23432,36584:25163,36585:26417,36586:27530,36587:29417,36588:29664,36589:31278,36590:33131,36591:36259,36592:37202,36593:39318,36594:20754,36595:21463,36596:21610,36597:23551,36598:25480,36599:27193,36600:32172,36601:38656,36602:22234,36603:21454,36604:21608,36672:23447,36673:23601,36674:24030,36675:20462,36676:24833,36677:25342,36678:27954,36679:31168,36680:31179,36681:32066,36682:32333,36683:32722,36684:33261,36685:33311,36686:33936,36687:34886,36688:35186,36689:35728,36690:36468,36691:36655,36692:36913,36693:37195,36694:37228,36695:38598,36696:37276,36697:20160,36698:20303,36699:20805,36700:21313,36701:24467,36702:25102,36703:26580,36704:27713,36705:28171,36706:29539,36707:32294,36708:37325,36709:37507,36710:21460,36711:22809,36712:23487,36713:28113,36714:31069,36715:32302,36716:31899,36717:22654,36718:29087,36719:20986,36720:34899,36721:36848,36722:20426,36723:23803,36724:26149,36725:30636,36726:31459,36727:33308,36728:39423,36729:20934,36730:24490,36731:26092,36732:26991,36733:27529,36734:28147,36736:28310,36737:28516,36738:30462,36739:32020,36740:24033,36741:36981,36742:37255,36743:38918,36744:20966,36745:21021,36746:25152,36747:26257,36748:26329,36749:28186,36750:24246,36751:32210,36752:32626,36753:26360,36754:34223,36755:34295,36756:35576,36757:21161,36758:21465,36759:22899,36760:24207,36761:24464,36762:24661,36763:37604,36764:38500,36765:20663,36766:20767,36767:21213,36768:21280,36769:21319,36770:21484,36771:21736,36772:21830,36773:21809,36774:22039,36775:22888,36776:22974,36777:23100,36778:23477,36779:23558,36780:23567,36781:23569,36782:23578,36783:24196,36784:24202,36785:24288,36786:24432,36787:25215,36788:25220,36789:25307,36790:25484,36791:25463,36792:26119,36793:26124,36794:26157,36795:26230,36796:26494,36797:26786,36798:27167,36799:27189,36800:27836,36801:28040,36802:28169,36803:28248,36804:28988,36805:28966,36806:29031,36807:30151,36808:30465,36809:30813,36810:30977,36811:31077,36812:31216,36813:31456,36814:31505,36815:31911,36816:32057,36817:32918,36818:33750,36819:33931,36820:34121,36821:34909,36822:35059,36823:35359,36824:35388,36825:35412,36826:35443,36827:35937,36828:36062,36829:37284,36830:37478,36831:37758,36832:37912,36833:38556,36834:38808,36835:19978,36836:19976,36837:19998,36838:20055,36839:20887,36840:21104,36841:22478,36842:22580,36843:22732,36844:23330,36845:24120,36846:24773,36847:25854,36848:26465,36849:26454,36850:27972,36851:29366,36852:30067,36853:31331,36854:33976,36855:35698,36856:37304,36857:37664,36858:22065,36859:22516,36860:39166,36928:25325,36929:26893,36930:27542,36931:29165,36932:32340,36933:32887,36934:33394,36935:35302,36936:39135,36937:34645,36938:36785,36939:23611,36940:20280,36941:20449,36942:20405,36943:21767,36944:23072,36945:23517,36946:23529,36947:24515,36948:24910,36949:25391,36950:26032,36951:26187,36952:26862,36953:27035,36954:28024,36955:28145,36956:30003,36957:30137,36958:30495,36959:31070,36960:31206,36961:32051,36962:33251,36963:33455,36964:34218,36965:35242,36966:35386,36967:36523,36968:36763,36969:36914,36970:37341,36971:38663,36972:20154,36973:20161,36974:20995,36975:22645,36976:22764,36977:23563,36978:29978,36979:23613,36980:33102,36981:35338,36982:36805,36983:38499,36984:38765,36985:31525,36986:35535,36987:38920,36988:37218,36989:22259,36990:21416,36992:36887,36993:21561,36994:22402,36995:24101,36996:25512,36997:27700,36998:28810,36999:30561,37e3:31883,37001:32736,37002:34928,37003:36930,37004:37204,37005:37648,37006:37656,37007:38543,37008:29790,37009:39620,37010:23815,37011:23913,37012:25968,37013:26530,37014:36264,37015:38619,37016:25454,37017:26441,37018:26905,37019:33733,37020:38935,37021:38592,37022:35070,37023:28548,37024:25722,37025:23544,37026:19990,37027:28716,37028:30045,37029:26159,37030:20932,37031:21046,37032:21218,37033:22995,37034:24449,37035:24615,37036:25104,37037:25919,37038:25972,37039:26143,37040:26228,37041:26866,37042:26646,37043:27491,37044:28165,37045:29298,37046:29983,37047:30427,37048:31934,37049:32854,37050:22768,37051:35069,37052:35199,37053:35488,37054:35475,37055:35531,37056:36893,37057:37266,37058:38738,37059:38745,37060:25993,37061:31246,37062:33030,37063:38587,37064:24109,37065:24796,37066:25114,37067:26021,37068:26132,37069:26512,37070:30707,37071:31309,37072:31821,37073:32318,37074:33034,37075:36012,37076:36196,37077:36321,37078:36447,37079:30889,37080:20999,37081:25305,37082:25509,37083:25666,37084:25240,37085:35373,37086:31363,37087:31680,37088:35500,37089:38634,37090:32118,37091:33292,37092:34633,37093:20185,37094:20808,37095:21315,37096:21344,37097:23459,37098:23554,37099:23574,37100:24029,37101:25126,37102:25159,37103:25776,37104:26643,37105:26676,37106:27849,37107:27973,37108:27927,37109:26579,37110:28508,37111:29006,37112:29053,37113:26059,37114:31359,37115:31661,37116:32218,37184:32330,37185:32680,37186:33146,37187:33307,37188:33337,37189:34214,37190:35438,37191:36046,37192:36341,37193:36984,37194:36983,37195:37549,37196:37521,37197:38275,37198:39854,37199:21069,37200:21892,37201:28472,37202:28982,37203:20840,37204:31109,37205:32341,37206:33203,37207:31950,37208:22092,37209:22609,37210:23720,37211:25514,37212:26366,37213:26365,37214:26970,37215:29401,37216:30095,37217:30094,37218:30990,37219:31062,37220:31199,37221:31895,37222:32032,37223:32068,37224:34311,37225:35380,37226:38459,37227:36961,37228:40736,37229:20711,37230:21109,37231:21452,37232:21474,37233:20489,37234:21930,37235:22766,37236:22863,37237:29245,37238:23435,37239:23652,37240:21277,37241:24803,37242:24819,37243:25436,37244:25475,37245:25407,37246:25531,37248:25805,37249:26089,37250:26361,37251:24035,37252:27085,37253:27133,37254:28437,37255:29157,37256:20105,37257:30185,37258:30456,37259:31379,37260:31967,37261:32207,37262:32156,37263:32865,37264:33609,37265:33624,37266:33900,37267:33980,37268:34299,37269:35013,37270:36208,37271:36865,37272:36973,37273:37783,37274:38684,37275:39442,37276:20687,37277:22679,37278:24974,37279:33235,37280:34101,37281:36104,37282:36896,37283:20419,37284:20596,37285:21063,37286:21363,37287:24687,37288:25417,37289:26463,37290:28204,37291:36275,37292:36895,37293:20439,37294:23646,37295:36042,37296:26063,37297:32154,37298:21330,37299:34966,37300:20854,37301:25539,37302:23384,37303:23403,37304:23562,37305:25613,37306:26449,37307:36956,37308:20182,37309:22810,37310:22826,37311:27760,37312:35409,37313:21822,37314:22549,37315:22949,37316:24816,37317:25171,37318:26561,37319:33333,37320:26965,37321:38464,37322:39364,37323:39464,37324:20307,37325:22534,37326:23550,37327:32784,37328:23729,37329:24111,37330:24453,37331:24608,37332:24907,37333:25140,37334:26367,37335:27888,37336:28382,37337:32974,37338:33151,37339:33492,37340:34955,37341:36024,37342:36864,37343:36910,37344:38538,37345:40667,37346:39899,37347:20195,37348:21488,37349:22823,37350:31532,37351:37261,37352:38988,37353:40441,37354:28381,37355:28711,37356:21331,37357:21828,37358:23429,37359:25176,37360:25246,37361:25299,37362:27810,37363:28655,37364:29730,37365:35351,37366:37944,37367:28609,37368:35582,37369:33592,37370:20967,37371:34552,37372:21482,37440:21481,37441:20294,37442:36948,37443:36784,37444:22890,37445:33073,37446:24061,37447:31466,37448:36799,37449:26842,37450:35895,37451:29432,37452:40008,37453:27197,37454:35504,37455:20025,37456:21336,37457:22022,37458:22374,37459:25285,37460:25506,37461:26086,37462:27470,37463:28129,37464:28251,37465:28845,37466:30701,37467:31471,37468:31658,37469:32187,37470:32829,37471:32966,37472:34507,37473:35477,37474:37723,37475:22243,37476:22727,37477:24382,37478:26029,37479:26262,37480:27264,37481:27573,37482:30007,37483:35527,37484:20516,37485:30693,37486:22320,37487:24347,37488:24677,37489:26234,37490:27744,37491:30196,37492:31258,37493:32622,37494:33268,37495:34584,37496:36933,37497:39347,37498:31689,37499:30044,37500:31481,37501:31569,37502:33988,37504:36880,37505:31209,37506:31378,37507:33590,37508:23265,37509:30528,37510:20013,37511:20210,37512:23449,37513:24544,37514:25277,37515:26172,37516:26609,37517:27880,37518:34411,37519:34935,37520:35387,37521:37198,37522:37619,37523:39376,37524:27159,37525:28710,37526:29482,37527:33511,37528:33879,37529:36015,37530:19969,37531:20806,37532:20939,37533:21899,37534:23541,37535:24086,37536:24115,37537:24193,37538:24340,37539:24373,37540:24427,37541:24500,37542:25074,37543:25361,37544:26274,37545:26397,37546:28526,37547:29266,37548:30010,37549:30522,37550:32884,37551:33081,37552:33144,37553:34678,37554:35519,37555:35548,37556:36229,37557:36339,37558:37530,37559:38263,37560:38914,37561:40165,37562:21189,37563:25431,37564:30452,37565:26389,37566:27784,37567:29645,37568:36035,37569:37806,37570:38515,37571:27941,37572:22684,37573:26894,37574:27084,37575:36861,37576:37786,37577:30171,37578:36890,37579:22618,37580:26626,37581:25524,37582:27131,37583:20291,37584:28460,37585:26584,37586:36795,37587:34086,37588:32180,37589:37716,37590:26943,37591:28528,37592:22378,37593:22775,37594:23340,37595:32044,37596:29226,37597:21514,37598:37347,37599:40372,37600:20141,37601:20302,37602:20572,37603:20597,37604:21059,37605:35998,37606:21576,37607:22564,37608:23450,37609:24093,37610:24213,37611:24237,37612:24311,37613:24351,37614:24716,37615:25269,37616:25402,37617:25552,37618:26799,37619:27712,37620:30855,37621:31118,37622:31243,37623:32224,37624:33351,37625:35330,37626:35558,37627:36420,37628:36883,37696:37048,37697:37165,37698:37336,37699:40718,37700:27877,37701:25688,37702:25826,37703:25973,37704:28404,37705:30340,37706:31515,37707:36969,37708:37841,37709:28346,37710:21746,37711:24505,37712:25764,37713:36685,37714:36845,37715:37444,37716:20856,37717:22635,37718:22825,37719:23637,37720:24215,37721:28155,37722:32399,37723:29980,37724:36028,37725:36578,37726:39003,37727:28857,37728:20253,37729:27583,37730:28593,37731:3e4,37732:38651,37733:20814,37734:21520,37735:22581,37736:22615,37737:22956,37738:23648,37739:24466,37740:26007,37741:26460,37742:28193,37743:30331,37744:33759,37745:36077,37746:36884,37747:37117,37748:37709,37749:30757,37750:30778,37751:21162,37752:24230,37753:22303,37754:22900,37755:24594,37756:20498,37757:20826,37758:20908,37760:20941,37761:20992,37762:21776,37763:22612,37764:22616,37765:22871,37766:23445,37767:23798,37768:23947,37769:24764,37770:25237,37771:25645,37772:26481,37773:26691,37774:26812,37775:26847,37776:30423,37777:28120,37778:28271,37779:28059,37780:28783,37781:29128,37782:24403,37783:30168,37784:31095,37785:31561,37786:31572,37787:31570,37788:31958,37789:32113,37790:21040,37791:33891,37792:34153,37793:34276,37794:35342,37795:35588,37796:35910,37797:36367,37798:36867,37799:36879,37800:37913,37801:38518,37802:38957,37803:39472,37804:38360,37805:20685,37806:21205,37807:21516,37808:22530,37809:23566,37810:24999,37811:25758,37812:27934,37813:30643,37814:31461,37815:33012,37816:33796,37817:36947,37818:37509,37819:23776,37820:40199,37821:21311,37822:24471,37823:24499,37824:28060,37825:29305,37826:30563,37827:31167,37828:31716,37829:27602,37830:29420,37831:35501,37832:26627,37833:27233,37834:20984,37835:31361,37836:26932,37837:23626,37838:40182,37839:33515,37840:23493,37841:37193,37842:28702,37843:22136,37844:23663,37845:24775,37846:25958,37847:27788,37848:35930,37849:36929,37850:38931,37851:21585,37852:26311,37853:37389,37854:22856,37855:37027,37856:20869,37857:20045,37858:20970,37859:34201,37860:35598,37861:28760,37862:25466,37863:37707,37864:26978,37865:39348,37866:32260,37867:30071,37868:21335,37869:26976,37870:36575,37871:38627,37872:27741,37873:20108,37874:23612,37875:24336,37876:36841,37877:21250,37878:36049,37879:32905,37880:34425,37881:24319,37882:26085,37883:20083,37884:20837,37952:22914,37953:23615,37954:38894,37955:20219,37956:22922,37957:24525,37958:35469,37959:28641,37960:31152,37961:31074,37962:23527,37963:33905,37964:29483,37965:29105,37966:24180,37967:24565,37968:25467,37969:25754,37970:29123,37971:31896,37972:20035,37973:24316,37974:20043,37975:22492,37976:22178,37977:24745,37978:28611,37979:32013,37980:33021,37981:33075,37982:33215,37983:36786,37984:35223,37985:34468,37986:24052,37987:25226,37988:25773,37989:35207,37990:26487,37991:27874,37992:27966,37993:29750,37994:30772,37995:23110,37996:32629,37997:33453,37998:39340,37999:20467,38e3:24259,38001:25309,38002:25490,38003:25943,38004:26479,38005:30403,38006:29260,38007:32972,38008:32954,38009:36649,38010:37197,38011:20493,38012:22521,38013:23186,38014:26757,38016:26995,38017:29028,38018:29437,38019:36023,38020:22770,38021:36064,38022:38506,38023:36889,38024:34687,38025:31204,38026:30695,38027:33833,38028:20271,38029:21093,38030:21338,38031:25293,38032:26575,38033:27850,38034:30333,38035:31636,38036:31893,38037:33334,38038:34180,38039:36843,38040:26333,38041:28448,38042:29190,38043:32283,38044:33707,38045:39361,38046:40614,38047:20989,38048:31665,38049:30834,38050:31672,38051:32903,38052:31560,38053:27368,38054:24161,38055:32908,38056:30033,38057:30048,38058:20843,38059:37474,38060:28300,38061:30330,38062:37271,38063:39658,38064:20240,38065:32624,38066:25244,38067:31567,38068:38309,38069:40169,38070:22138,38071:22617,38072:34532,38073:38588,38074:20276,38075:21028,38076:21322,38077:21453,38078:21467,38079:24070,38080:25644,38081:26001,38082:26495,38083:27710,38084:27726,38085:29256,38086:29359,38087:29677,38088:30036,38089:32321,38090:33324,38091:34281,38092:36009,38093:31684,38094:37318,38095:29033,38096:38930,38097:39151,38098:25405,38099:26217,38100:30058,38101:30436,38102:30928,38103:34115,38104:34542,38105:21290,38106:21329,38107:21542,38108:22915,38109:24199,38110:24444,38111:24754,38112:25161,38113:25209,38114:25259,38115:26e3,38116:27604,38117:27852,38118:30130,38119:30382,38120:30865,38121:31192,38122:32203,38123:32631,38124:32933,38125:34987,38126:35513,38127:36027,38128:36991,38129:38750,38130:39131,38131:27147,38132:31800,38133:20633,38134:23614,38135:24494,38136:26503,38137:27608,38138:29749,38139:30473,38140:32654,38208:40763,38209:26570,38210:31255,38211:21305,38212:30091,38213:39661,38214:24422,38215:33181,38216:33777,38217:32920,38218:24380,38219:24517,38220:30050,38221:31558,38222:36924,38223:26727,38224:23019,38225:23195,38226:32016,38227:30334,38228:35628,38229:20469,38230:24426,38231:27161,38232:27703,38233:28418,38234:29922,38235:31080,38236:34920,38237:35413,38238:35961,38239:24287,38240:25551,38241:30149,38242:31186,38243:33495,38244:37672,38245:37618,38246:33948,38247:34541,38248:39981,38249:21697,38250:24428,38251:25996,38252:27996,38253:28693,38254:36007,38255:36051,38256:38971,38257:25935,38258:29942,38259:19981,38260:20184,38261:22496,38262:22827,38263:23142,38264:23500,38265:20904,38266:24067,38267:24220,38268:24598,38269:25206,38270:25975,38272:26023,38273:26222,38274:28014,38275:29238,38276:31526,38277:33104,38278:33178,38279:33433,38280:35676,38281:36e3,38282:36070,38283:36212,38284:38428,38285:38468,38286:20398,38287:25771,38288:27494,38289:33310,38290:33889,38291:34154,38292:37096,38293:23553,38294:26963,38295:39080,38296:33914,38297:34135,38298:20239,38299:21103,38300:24489,38301:24133,38302:26381,38303:31119,38304:33145,38305:35079,38306:35206,38307:28149,38308:24343,38309:25173,38310:27832,38311:20175,38312:29289,38313:39826,38314:20998,38315:21563,38316:22132,38317:22707,38318:24996,38319:25198,38320:28954,38321:22894,38322:31881,38323:31966,38324:32027,38325:38640,38326:25991,38327:32862,38328:19993,38329:20341,38330:20853,38331:22592,38332:24163,38333:24179,38334:24330,38335:26564,38336:20006,38337:34109,38338:38281,38339:38491,38340:31859,38341:38913,38342:20731,38343:22721,38344:30294,38345:30887,38346:21029,38347:30629,38348:34065,38349:31622,38350:20559,38351:22793,38352:29255,38353:31687,38354:32232,38355:36794,38356:36820,38357:36941,38358:20415,38359:21193,38360:23081,38361:24321,38362:38829,38363:20445,38364:33303,38365:37610,38366:22275,38367:25429,38368:27497,38369:29995,38370:35036,38371:36628,38372:31298,38373:21215,38374:22675,38375:24917,38376:25098,38377:26286,38378:27597,38379:31807,38380:33769,38381:20515,38382:20472,38383:21253,38384:21574,38385:22577,38386:22857,38387:23453,38388:23792,38389:23791,38390:23849,38391:24214,38392:25265,38393:25447,38394:25918,38395:26041,38396:26379,38464:27861,38465:27873,38466:28921,38467:30770,38468:32299,38469:32990,38470:33459,38471:33804,38472:34028,38473:34562,38474:35090,38475:35370,38476:35914,38477:37030,38478:37586,38479:39165,38480:40179,38481:40300,38482:20047,38483:20129,38484:20621,38485:21078,38486:22346,38487:22952,38488:24125,38489:24536,38490:24537,38491:25151,38492:26292,38493:26395,38494:26576,38495:26834,38496:20882,38497:32033,38498:32938,38499:33192,38500:35584,38501:35980,38502:36031,38503:37502,38504:38450,38505:21536,38506:38956,38507:21271,38508:20693,38509:21340,38510:22696,38511:25778,38512:26420,38513:29287,38514:30566,38515:31302,38516:37350,38517:21187,38518:27809,38519:27526,38520:22528,38521:24140,38522:22868,38523:26412,38524:32763,38525:20961,38526:30406,38528:25705,38529:30952,38530:39764,38531:40635,38532:22475,38533:22969,38534:26151,38535:26522,38536:27598,38537:21737,38538:27097,38539:24149,38540:33180,38541:26517,38542:39850,38543:26622,38544:40018,38545:26717,38546:20134,38547:20451,38548:21448,38549:25273,38550:26411,38551:27819,38552:36804,38553:20397,38554:32365,38555:40639,38556:19975,38557:24930,38558:28288,38559:28459,38560:34067,38561:21619,38562:26410,38563:39749,38564:24051,38565:31637,38566:23724,38567:23494,38568:34588,38569:28234,38570:34001,38571:31252,38572:33032,38573:22937,38574:31885,38575:27665,38576:30496,38577:21209,38578:22818,38579:28961,38580:29279,38581:30683,38582:38695,38583:40289,38584:26891,38585:23167,38586:23064,38587:20901,38588:21517,38589:21629,38590:26126,38591:30431,38592:36855,38593:37528,38594:40180,38595:23018,38596:29277,38597:28357,38598:20813,38599:26825,38600:32191,38601:32236,38602:38754,38603:40634,38604:25720,38605:27169,38606:33538,38607:22916,38608:23391,38609:27611,38610:29467,38611:30450,38612:32178,38613:32791,38614:33945,38615:20786,38616:26408,38617:40665,38618:30446,38619:26466,38620:21247,38621:39173,38622:23588,38623:25147,38624:31870,38625:36016,38626:21839,38627:24758,38628:32011,38629:38272,38630:21249,38631:20063,38632:20918,38633:22812,38634:29242,38635:32822,38636:37326,38637:24357,38638:30690,38639:21380,38640:24441,38641:32004,38642:34220,38643:35379,38644:36493,38645:38742,38646:26611,38647:34222,38648:37971,38649:24841,38650:24840,38651:27833,38652:30290,38720:35565,38721:36664,38722:21807,38723:20305,38724:20778,38725:21191,38726:21451,38727:23461,38728:24189,38729:24736,38730:24962,38731:25558,38732:26377,38733:26586,38734:28263,38735:28044,38736:29494,38737:29495,38738:30001,38739:31056,38740:35029,38741:35480,38742:36938,38743:37009,38744:37109,38745:38596,38746:34701,38747:22805,38748:20104,38749:20313,38750:19982,38751:35465,38752:36671,38753:38928,38754:20653,38755:24188,38756:22934,38757:23481,38758:24248,38759:25562,38760:25594,38761:25793,38762:26332,38763:26954,38764:27096,38765:27915,38766:28342,38767:29076,38768:29992,38769:31407,38770:32650,38771:32768,38772:33865,38773:33993,38774:35201,38775:35617,38776:36362,38777:36965,38778:38525,38779:39178,38780:24958,38781:25233,38782:27442,38784:27779,38785:28020,38786:32716,38787:32764,38788:28096,38789:32645,38790:34746,38791:35064,38792:26469,38793:33713,38794:38972,38795:38647,38796:27931,38797:32097,38798:33853,38799:37226,38800:20081,38801:21365,38802:23888,38803:27396,38804:28651,38805:34253,38806:34349,38807:35239,38808:21033,38809:21519,38810:23653,38811:26446,38812:26792,38813:29702,38814:29827,38815:30178,38816:35023,38817:35041,38818:37324,38819:38626,38820:38520,38821:24459,38822:29575,38823:31435,38824:33870,38825:25504,38826:30053,38827:21129,38828:27969,38829:28316,38830:29705,38831:30041,38832:30827,38833:31890,38834:38534,38835:31452,38836:40845,38837:20406,38838:24942,38839:26053,38840:34396,38841:20102,38842:20142,38843:20698,38844:20001,38845:20940,38846:23534,38847:26009,38848:26753,38849:28092,38850:29471,38851:30274,38852:30637,38853:31260,38854:31975,38855:33391,38856:35538,38857:36988,38858:37327,38859:38517,38860:38936,38861:21147,38862:32209,38863:20523,38864:21400,38865:26519,38866:28107,38867:29136,38868:29747,38869:33256,38870:36650,38871:38563,38872:40023,38873:40607,38874:29792,38875:22593,38876:28057,38877:32047,38878:39006,38879:20196,38880:20278,38881:20363,38882:20919,38883:21169,38884:23994,38885:24604,38886:29618,38887:31036,38888:33491,38889:37428,38890:38583,38891:38646,38892:38666,38893:40599,38894:40802,38895:26278,38896:27508,38897:21015,38898:21155,38899:28872,38900:35010,38901:24265,38902:24651,38903:24976,38904:28451,38905:29001,38906:31806,38907:32244,38908:32879,38976:34030,38977:36899,38978:37676,38979:21570,38980:39791,38981:27347,38982:28809,38983:36034,38984:36335,38985:38706,38986:21172,38987:23105,38988:24266,38989:24324,38990:26391,38991:27004,38992:27028,38993:28010,38994:28431,38995:29282,38996:29436,38997:31725,38998:32769,38999:32894,39e3:34635,39001:37070,39002:20845,39003:40595,39004:31108,39005:32907,39006:37682,39007:35542,39008:20525,39009:21644,39010:35441,39011:27498,39012:36036,39013:33031,39014:24785,39015:26528,39016:40434,39017:20121,39018:20120,39019:39952,39020:35435,39021:34241,39022:34152,39023:26880,39024:28286,39025:30871,39026:33109,39071:24332,39072:19984,39073:19989,39074:20010,39075:20017,39076:20022,39077:20028,39078:20031,39079:20034,39080:20054,39081:20056,39082:20098,39083:20101,39084:35947,39085:20106,39086:33298,39087:24333,39088:20110,39089:20126,39090:20127,39091:20128,39092:20130,39093:20144,39094:20147,39095:20150,39096:20174,39097:20173,39098:20164,39099:20166,39100:20162,39101:20183,39102:20190,39103:20205,39104:20191,39105:20215,39106:20233,39107:20314,39108:20272,39109:20315,39110:20317,39111:20311,39112:20295,39113:20342,39114:20360,39115:20367,39116:20376,39117:20347,39118:20329,39119:20336,39120:20369,39121:20335,39122:20358,39123:20374,39124:20760,39125:20436,39126:20447,39127:20430,39128:20440,39129:20443,39130:20433,39131:20442,39132:20432,39133:20452,39134:20453,39135:20506,39136:20520,39137:20500,39138:20522,39139:20517,39140:20485,39141:20252,39142:20470,39143:20513,39144:20521,39145:20524,39146:20478,39147:20463,39148:20497,39149:20486,39150:20547,39151:20551,39152:26371,39153:20565,39154:20560,39155:20552,39156:20570,39157:20566,39158:20588,39159:20600,39160:20608,39161:20634,39162:20613,39163:20660,39164:20658,39232:20681,39233:20682,39234:20659,39235:20674,39236:20694,39237:20702,39238:20709,39239:20717,39240:20707,39241:20718,39242:20729,39243:20725,39244:20745,39245:20737,39246:20738,39247:20758,39248:20757,39249:20756,39250:20762,39251:20769,39252:20794,39253:20791,39254:20796,39255:20795,39256:20799,39257:20800,39258:20818,39259:20812,39260:20820,39261:20834,39262:31480,39263:20841,39264:20842,39265:20846,39266:20864,39267:20866,39268:22232,39269:20876,39270:20873,39271:20879,39272:20881,39273:20883,39274:20885,39275:20886,39276:20900,39277:20902,39278:20898,39279:20905,39280:20906,39281:20907,39282:20915,39283:20913,39284:20914,39285:20912,39286:20917,39287:20925,39288:20933,39289:20937,39290:20955,39291:20960,39292:34389,39293:20969,39294:20973,39296:20976,39297:20981,39298:20990,39299:20996,39300:21003,39301:21012,39302:21006,39303:21031,39304:21034,39305:21038,39306:21043,39307:21049,39308:21071,39309:21060,39310:21067,39311:21068,39312:21086,39313:21076,39314:21098,39315:21108,39316:21097,39317:21107,39318:21119,39319:21117,39320:21133,39321:21140,39322:21138,39323:21105,39324:21128,39325:21137,39326:36776,39327:36775,39328:21164,39329:21165,39330:21180,39331:21173,39332:21185,39333:21197,39334:21207,39335:21214,39336:21219,39337:21222,39338:39149,39339:21216,39340:21235,39341:21237,39342:21240,39343:21241,39344:21254,39345:21256,39346:30008,39347:21261,39348:21264,39349:21263,39350:21269,39351:21274,39352:21283,39353:21295,39354:21297,39355:21299,39356:21304,39357:21312,39358:21318,39359:21317,39360:19991,39361:21321,39362:21325,39363:20950,39364:21342,39365:21353,39366:21358,39367:22808,39368:21371,39369:21367,39370:21378,39371:21398,39372:21408,39373:21414,39374:21413,39375:21422,39376:21424,39377:21430,39378:21443,39379:31762,39380:38617,39381:21471,39382:26364,39383:29166,39384:21486,39385:21480,39386:21485,39387:21498,39388:21505,39389:21565,39390:21568,39391:21548,39392:21549,39393:21564,39394:21550,39395:21558,39396:21545,39397:21533,39398:21582,39399:21647,39400:21621,39401:21646,39402:21599,39403:21617,39404:21623,39405:21616,39406:21650,39407:21627,39408:21632,39409:21622,39410:21636,39411:21648,39412:21638,39413:21703,39414:21666,39415:21688,39416:21669,39417:21676,39418:21700,39419:21704,39420:21672,39488:21675,39489:21698,39490:21668,39491:21694,39492:21692,39493:21720,39494:21733,39495:21734,39496:21775,39497:21780,39498:21757,39499:21742,39500:21741,39501:21754,39502:21730,39503:21817,39504:21824,39505:21859,39506:21836,39507:21806,39508:21852,39509:21829,39510:21846,39511:21847,39512:21816,39513:21811,39514:21853,39515:21913,39516:21888,39517:21679,39518:21898,39519:21919,39520:21883,39521:21886,39522:21912,39523:21918,39524:21934,39525:21884,39526:21891,39527:21929,39528:21895,39529:21928,39530:21978,39531:21957,39532:21983,39533:21956,39534:21980,39535:21988,39536:21972,39537:22036,39538:22007,39539:22038,39540:22014,39541:22013,39542:22043,39543:22009,39544:22094,39545:22096,39546:29151,39547:22068,39548:22070,39549:22066,39550:22072,39552:22123,39553:22116,39554:22063,39555:22124,39556:22122,39557:22150,39558:22144,39559:22154,39560:22176,39561:22164,39562:22159,39563:22181,39564:22190,39565:22198,39566:22196,39567:22210,39568:22204,39569:22209,39570:22211,39571:22208,39572:22216,39573:22222,39574:22225,39575:22227,39576:22231,39577:22254,39578:22265,39579:22272,39580:22271,39581:22276,39582:22281,39583:22280,39584:22283,39585:22285,39586:22291,39587:22296,39588:22294,39589:21959,39590:22300,39591:22310,39592:22327,39593:22328,39594:22350,39595:22331,39596:22336,39597:22351,39598:22377,39599:22464,39600:22408,39601:22369,39602:22399,39603:22409,39604:22419,39605:22432,39606:22451,39607:22436,39608:22442,39609:22448,39610:22467,39611:22470,39612:22484,39613:22482,39614:22483,39615:22538,39616:22486,39617:22499,39618:22539,39619:22553,39620:22557,39621:22642,39622:22561,39623:22626,39624:22603,39625:22640,39626:27584,39627:22610,39628:22589,39629:22649,39630:22661,39631:22713,39632:22687,39633:22699,39634:22714,39635:22750,39636:22715,39637:22712,39638:22702,39639:22725,39640:22739,39641:22737,39642:22743,39643:22745,39644:22744,39645:22757,39646:22748,39647:22756,39648:22751,39649:22767,39650:22778,39651:22777,39652:22779,39653:22780,39654:22781,39655:22786,39656:22794,39657:22800,39658:22811,39659:26790,39660:22821,39661:22828,39662:22829,39663:22834,39664:22840,39665:22846,39666:31442,39667:22869,39668:22864,39669:22862,39670:22874,39671:22872,39672:22882,39673:22880,39674:22887,39675:22892,39676:22889,39744:22904,39745:22913,39746:22941,39747:20318,39748:20395,39749:22947,39750:22962,39751:22982,39752:23016,39753:23004,39754:22925,39755:23001,39756:23002,39757:23077,39758:23071,39759:23057,39760:23068,39761:23049,39762:23066,39763:23104,39764:23148,39765:23113,39766:23093,39767:23094,39768:23138,39769:23146,39770:23194,39771:23228,39772:23230,39773:23243,39774:23234,39775:23229,39776:23267,39777:23255,39778:23270,39779:23273,39780:23254,39781:23290,39782:23291,39783:23308,39784:23307,39785:23318,39786:23346,39787:23248,39788:23338,39789:23350,39790:23358,39791:23363,39792:23365,39793:23360,39794:23377,39795:23381,39796:23386,39797:23387,39798:23397,39799:23401,39800:23408,39801:23411,39802:23413,39803:23416,39804:25992,39805:23418,39806:23424,39808:23427,39809:23462,39810:23480,39811:23491,39812:23495,39813:23497,39814:23508,39815:23504,39816:23524,39817:23526,39818:23522,39819:23518,39820:23525,39821:23531,39822:23536,39823:23542,39824:23539,39825:23557,39826:23559,39827:23560,39828:23565,39829:23571,39830:23584,39831:23586,39832:23592,39833:23608,39834:23609,39835:23617,39836:23622,39837:23630,39838:23635,39839:23632,39840:23631,39841:23409,39842:23660,39843:23662,39844:20066,39845:23670,39846:23673,39847:23692,39848:23697,39849:23700,39850:22939,39851:23723,39852:23739,39853:23734,39854:23740,39855:23735,39856:23749,39857:23742,39858:23751,39859:23769,39860:23785,39861:23805,39862:23802,39863:23789,39864:23948,39865:23786,39866:23819,39867:23829,39868:23831,39869:23900,39870:23839,39871:23835,39872:23825,39873:23828,39874:23842,39875:23834,39876:23833,39877:23832,39878:23884,39879:23890,39880:23886,39881:23883,39882:23916,39883:23923,39884:23926,39885:23943,39886:23940,39887:23938,39888:23970,39889:23965,39890:23980,39891:23982,39892:23997,39893:23952,39894:23991,39895:23996,39896:24009,39897:24013,39898:24019,39899:24018,39900:24022,39901:24027,39902:24043,39903:24050,39904:24053,39905:24075,39906:24090,39907:24089,39908:24081,39909:24091,39910:24118,39911:24119,39912:24132,39913:24131,39914:24128,39915:24142,39916:24151,39917:24148,39918:24159,39919:24162,39920:24164,39921:24135,39922:24181,39923:24182,39924:24186,39925:40636,39926:24191,39927:24224,39928:24257,39929:24258,39930:24264,39931:24272,39932:24271,4e4:24278,40001:24291,40002:24285,40003:24282,40004:24283,40005:24290,40006:24289,40007:24296,40008:24297,40009:24300,40010:24305,40011:24307,40012:24304,40013:24308,40014:24312,40015:24318,40016:24323,40017:24329,40018:24413,40019:24412,40020:24331,40021:24337,40022:24342,40023:24361,40024:24365,40025:24376,40026:24385,40027:24392,40028:24396,40029:24398,40030:24367,40031:24401,40032:24406,40033:24407,40034:24409,40035:24417,40036:24429,40037:24435,40038:24439,40039:24451,40040:24450,40041:24447,40042:24458,40043:24456,40044:24465,40045:24455,40046:24478,40047:24473,40048:24472,40049:24480,40050:24488,40051:24493,40052:24508,40053:24534,40054:24571,40055:24548,40056:24568,40057:24561,40058:24541,40059:24755,40060:24575,40061:24609,40062:24672,40064:24601,40065:24592,40066:24617,40067:24590,40068:24625,40069:24603,40070:24597,40071:24619,40072:24614,40073:24591,40074:24634,40075:24666,40076:24641,40077:24682,40078:24695,40079:24671,40080:24650,40081:24646,40082:24653,40083:24675,40084:24643,40085:24676,40086:24642,40087:24684,40088:24683,40089:24665,40090:24705,40091:24717,40092:24807,40093:24707,40094:24730,40095:24708,40096:24731,40097:24726,40098:24727,40099:24722,40100:24743,40101:24715,40102:24801,40103:24760,40104:24800,40105:24787,40106:24756,40107:24560,40108:24765,40109:24774,40110:24757,40111:24792,40112:24909,40113:24853,40114:24838,40115:24822,40116:24823,40117:24832,40118:24820,40119:24826,40120:24835,40121:24865,40122:24827,40123:24817,40124:24845,40125:24846,40126:24903,40127:24894,40128:24872,40129:24871,40130:24906,40131:24895,40132:24892,40133:24876,40134:24884,40135:24893,40136:24898,40137:24900,40138:24947,40139:24951,40140:24920,40141:24921,40142:24922,40143:24939,40144:24948,40145:24943,40146:24933,40147:24945,40148:24927,40149:24925,40150:24915,40151:24949,40152:24985,40153:24982,40154:24967,40155:25004,40156:24980,40157:24986,40158:24970,40159:24977,40160:25003,40161:25006,40162:25036,40163:25034,40164:25033,40165:25079,40166:25032,40167:25027,40168:25030,40169:25018,40170:25035,40171:32633,40172:25037,40173:25062,40174:25059,40175:25078,40176:25082,40177:25076,40178:25087,40179:25085,40180:25084,40181:25086,40182:25088,40183:25096,40184:25097,40185:25101,40186:25100,40187:25108,40188:25115,40256:25118,40257:25121,40258:25130,40259:25134,40260:25136,40261:25138,40262:25139,40263:25153,40264:25166,40265:25182,40266:25187,40267:25179,40268:25184,40269:25192,40270:25212,40271:25218,40272:25225,40273:25214,40274:25234,40275:25235,40276:25238,40277:25300,40278:25219,40279:25236,40280:25303,40281:25297,40282:25275,40283:25295,40284:25343,40285:25286,40286:25812,40287:25288,40288:25308,40289:25292,40290:25290,40291:25282,40292:25287,40293:25243,40294:25289,40295:25356,40296:25326,40297:25329,40298:25383,40299:25346,40300:25352,40301:25327,40302:25333,40303:25424,40304:25406,40305:25421,40306:25628,40307:25423,40308:25494,40309:25486,40310:25472,40311:25515,40312:25462,40313:25507,40314:25487,40315:25481,40316:25503,40317:25525,40318:25451,40320:25449,40321:25534,40322:25577,40323:25536,40324:25542,40325:25571,40326:25545,40327:25554,40328:25590,40329:25540,40330:25622,40331:25652,40332:25606,40333:25619,40334:25638,40335:25654,40336:25885,40337:25623,40338:25640,40339:25615,40340:25703,40341:25711,40342:25718,40343:25678,40344:25898,40345:25749,40346:25747,40347:25765,40348:25769,40349:25736,40350:25788,40351:25818,40352:25810,40353:25797,40354:25799,40355:25787,40356:25816,40357:25794,40358:25841,40359:25831,40360:33289,40361:25824,40362:25825,40363:25260,40364:25827,40365:25839,40366:25900,40367:25846,40368:25844,40369:25842,40370:25850,40371:25856,40372:25853,40373:25880,40374:25884,40375:25861,40376:25892,40377:25891,40378:25899,40379:25908,40380:25909,40381:25911,40382:25910,40383:25912,40384:30027,40385:25928,40386:25942,40387:25941,40388:25933,40389:25944,40390:25950,40391:25949,40392:25970,40393:25976,40394:25986,40395:25987,40396:35722,40397:26011,40398:26015,40399:26027,40400:26039,40401:26051,40402:26054,40403:26049,40404:26052,40405:26060,40406:26066,40407:26075,40408:26073,40409:26080,40410:26081,40411:26097,40412:26482,40413:26122,40414:26115,40415:26107,40416:26483,40417:26165,40418:26166,40419:26164,40420:26140,40421:26191,40422:26180,40423:26185,40424:26177,40425:26206,40426:26205,40427:26212,40428:26215,40429:26216,40430:26207,40431:26210,40432:26224,40433:26243,40434:26248,40435:26254,40436:26249,40437:26244,40438:26264,40439:26269,40440:26305,40441:26297,40442:26313,40443:26302,40444:26300,40512:26308,40513:26296,40514:26326,40515:26330,40516:26336,40517:26175,40518:26342,40519:26345,40520:26352,40521:26357,40522:26359,40523:26383,40524:26390,40525:26398,40526:26406,40527:26407,40528:38712,40529:26414,40530:26431,40531:26422,40532:26433,40533:26424,40534:26423,40535:26438,40536:26462,40537:26464,40538:26457,40539:26467,40540:26468,40541:26505,40542:26480,40543:26537,40544:26492,40545:26474,40546:26508,40547:26507,40548:26534,40549:26529,40550:26501,40551:26551,40552:26607,40553:26548,40554:26604,40555:26547,40556:26601,40557:26552,40558:26596,40559:26590,40560:26589,40561:26594,40562:26606,40563:26553,40564:26574,40565:26566,40566:26599,40567:27292,40568:26654,40569:26694,40570:26665,40571:26688,40572:26701,40573:26674,40574:26702,40576:26803,40577:26667,40578:26713,40579:26723,40580:26743,40581:26751,40582:26783,40583:26767,40584:26797,40585:26772,40586:26781,40587:26779,40588:26755,40589:27310,40590:26809,40591:26740,40592:26805,40593:26784,40594:26810,40595:26895,40596:26765,40597:26750,40598:26881,40599:26826,40600:26888,40601:26840,40602:26914,40603:26918,40604:26849,40605:26892,40606:26829,40607:26836,40608:26855,40609:26837,40610:26934,40611:26898,40612:26884,40613:26839,40614:26851,40615:26917,40616:26873,40617:26848,40618:26863,40619:26920,40620:26922,40621:26906,40622:26915,40623:26913,40624:26822,40625:27001,40626:26999,40627:26972,40628:27e3,40629:26987,40630:26964,40631:27006,40632:26990,40633:26937,40634:26996,40635:26941,40636:26969,40637:26928,40638:26977,40639:26974,40640:26973,40641:27009,40642:26986,40643:27058,40644:27054,40645:27088,40646:27071,40647:27073,40648:27091,40649:27070,40650:27086,40651:23528,40652:27082,40653:27101,40654:27067,40655:27075,40656:27047,40657:27182,40658:27025,40659:27040,40660:27036,40661:27029,40662:27060,40663:27102,40664:27112,40665:27138,40666:27163,40667:27135,40668:27402,40669:27129,40670:27122,40671:27111,40672:27141,40673:27057,40674:27166,40675:27117,40676:27156,40677:27115,40678:27146,40679:27154,40680:27329,40681:27171,40682:27155,40683:27204,40684:27148,40685:27250,40686:27190,40687:27256,40688:27207,40689:27234,40690:27225,40691:27238,40692:27208,40693:27192,40694:27170,40695:27280,40696:27277,40697:27296,40698:27268,40699:27298,40700:27299,40768:27287,40769:34327,40770:27323,40771:27331,40772:27330,40773:27320,40774:27315,40775:27308,40776:27358,40777:27345,40778:27359,40779:27306,40780:27354,40781:27370,40782:27387,40783:27397,40784:34326,40785:27386,40786:27410,40787:27414,40788:39729,40789:27423,40790:27448,40791:27447,40792:30428,40793:27449,40794:39150,40795:27463,40796:27459,40797:27465,40798:27472,40799:27481,40800:27476,40801:27483,40802:27487,40803:27489,40804:27512,40805:27513,40806:27519,40807:27520,40808:27524,40809:27523,40810:27533,40811:27544,40812:27541,40813:27550,40814:27556,40815:27562,40816:27563,40817:27567,40818:27570,40819:27569,40820:27571,40821:27575,40822:27580,40823:27590,40824:27595,40825:27603,40826:27615,40827:27628,40828:27627,40829:27635,40830:27631,40832:40638,40833:27656,40834:27667,40835:27668,40836:27675,40837:27684,40838:27683,40839:27742,40840:27733,40841:27746,40842:27754,40843:27778,40844:27789,40845:27802,40846:27777,40847:27803,40848:27774,40849:27752,40850:27763,40851:27794,40852:27792,40853:27844,40854:27889,40855:27859,40856:27837,40857:27863,40858:27845,40859:27869,40860:27822,40861:27825,40862:27838,40863:27834,40864:27867,40865:27887,40866:27865,40867:27882,40868:27935,40869:34893,40870:27958,40871:27947,40872:27965,40873:27960,40874:27929,40875:27957,40876:27955,40877:27922,40878:27916,40879:28003,40880:28051,40881:28004,40882:27994,40883:28025,40884:27993,40885:28046,40886:28053,40887:28644,40888:28037,40889:28153,40890:28181,40891:28170,40892:28085,40893:28103,40894:28134,40895:28088,40896:28102,40897:28140,40898:28126,40899:28108,40900:28136,40901:28114,40902:28101,40903:28154,40904:28121,40905:28132,40906:28117,40907:28138,40908:28142,40909:28205,40910:28270,40911:28206,40912:28185,40913:28274,40914:28255,40915:28222,40916:28195,40917:28267,40918:28203,40919:28278,40920:28237,40921:28191,40922:28227,40923:28218,40924:28238,40925:28196,40926:28415,40927:28189,40928:28216,40929:28290,40930:28330,40931:28312,40932:28361,40933:28343,40934:28371,40935:28349,40936:28335,40937:28356,40938:28338,40939:28372,40940:28373,40941:28303,40942:28325,40943:28354,40944:28319,40945:28481,40946:28433,40947:28748,40948:28396,40949:28408,40950:28414,40951:28479,40952:28402,40953:28465,40954:28399,40955:28466,40956:28364,161:65377,162:65378,163:65379,164:65380,165:65381,166:65382,167:65383,168:65384,169:65385,170:65386,171:65387,172:65388,173:65389,174:65390,175:65391,176:65392,177:65393,178:65394,179:65395,180:65396,181:65397,182:65398,183:65399,184:65400,185:65401,186:65402,187:65403,188:65404,189:65405,190:65406,191:65407,192:65408,193:65409,194:65410,195:65411,196:65412,197:65413,198:65414,199:65415,200:65416,201:65417,202:65418,203:65419,204:65420,205:65421,206:65422,207:65423,208:65424,209:65425,210:65426,211:65427,212:65428,213:65429,214:65430,215:65431,216:65432,217:65433,218:65434,219:65435,220:65436,221:65437,222:65438,223:65439,57408:28478,57409:28435,57410:28407,57411:28550,57412:28538,57413:28536,57414:28545,57415:28544,57416:28527,57417:28507,57418:28659,57419:28525,57420:28546,57421:28540,57422:28504,57423:28558,57424:28561,57425:28610,57426:28518,57427:28595,57428:28579,57429:28577,57430:28580,57431:28601,57432:28614,57433:28586,57434:28639,57435:28629,57436:28652,57437:28628,57438:28632,57439:28657,57440:28654,57441:28635,57442:28681,57443:28683,57444:28666,57445:28689,57446:28673,57447:28687,57448:28670,57449:28699,57450:28698,57451:28532,57452:28701,57453:28696,57454:28703,57455:28720,57456:28734,57457:28722,57458:28753,57459:28771,57460:28825,57461:28818,57462:28847,57463:28913,57464:28844,57465:28856,57466:28851,57467:28846,57468:28895,57469:28875,57470:28893,57472:28889,57473:28937,57474:28925,57475:28956,57476:28953,57477:29029,57478:29013,57479:29064,57480:29030,57481:29026,57482:29004,57483:29014,57484:29036,57485:29071,57486:29179,57487:29060,57488:29077,57489:29096,57490:29100,57491:29143,57492:29113,57493:29118,57494:29138,57495:29129,57496:29140,57497:29134,57498:29152,57499:29164,57500:29159,57501:29173,57502:29180,57503:29177,57504:29183,57505:29197,57506:29200,57507:29211,57508:29224,57509:29229,57510:29228,57511:29232,57512:29234,57513:29243,57514:29244,57515:29247,57516:29248,57517:29254,57518:29259,57519:29272,57520:29300,57521:29310,57522:29314,57523:29313,57524:29319,57525:29330,57526:29334,57527:29346,57528:29351,57529:29369,57530:29362,57531:29379,57532:29382,57533:29380,57534:29390,57535:29394,57536:29410,57537:29408,57538:29409,57539:29433,57540:29431,57541:20495,57542:29463,57543:29450,57544:29468,57545:29462,57546:29469,57547:29492,57548:29487,57549:29481,57550:29477,57551:29502,57552:29518,57553:29519,57554:40664,57555:29527,57556:29546,57557:29544,57558:29552,57559:29560,57560:29557,57561:29563,57562:29562,57563:29640,57564:29619,57565:29646,57566:29627,57567:29632,57568:29669,57569:29678,57570:29662,57571:29858,57572:29701,57573:29807,57574:29733,57575:29688,57576:29746,57577:29754,57578:29781,57579:29759,57580:29791,57581:29785,57582:29761,57583:29788,57584:29801,57585:29808,57586:29795,57587:29802,57588:29814,57589:29822,57590:29835,57591:29854,57592:29863,57593:29898,57594:29903,57595:29908,57596:29681,57664:29920,57665:29923,57666:29927,57667:29929,57668:29934,57669:29938,57670:29936,57671:29937,57672:29944,57673:29943,57674:29956,57675:29955,57676:29957,57677:29964,57678:29966,57679:29965,57680:29973,57681:29971,57682:29982,57683:29990,57684:29996,57685:30012,57686:30020,57687:30029,57688:30026,57689:30025,57690:30043,57691:30022,57692:30042,57693:30057,57694:30052,57695:30055,57696:30059,57697:30061,57698:30072,57699:30070,57700:30086,57701:30087,57702:30068,57703:30090,57704:30089,57705:30082,57706:30100,57707:30106,57708:30109,57709:30117,57710:30115,57711:30146,57712:30131,57713:30147,57714:30133,57715:30141,57716:30136,57717:30140,57718:30129,57719:30157,57720:30154,57721:30162,57722:30169,57723:30179,57724:30174,57725:30206,57726:30207,57728:30204,57729:30209,57730:30192,57731:30202,57732:30194,57733:30195,57734:30219,57735:30221,57736:30217,57737:30239,57738:30247,57739:30240,57740:30241,57741:30242,57742:30244,57743:30260,57744:30256,57745:30267,57746:30279,57747:30280,57748:30278,57749:30300,57750:30296,57751:30305,57752:30306,57753:30312,57754:30313,57755:30314,57756:30311,57757:30316,57758:30320,57759:30322,57760:30326,57761:30328,57762:30332,57763:30336,57764:30339,57765:30344,57766:30347,57767:30350,57768:30358,57769:30355,57770:30361,57771:30362,57772:30384,57773:30388,57774:30392,57775:30393,57776:30394,57777:30402,57778:30413,57779:30422,57780:30418,57781:30430,57782:30433,57783:30437,57784:30439,57785:30442,57786:34351,57787:30459,57788:30472,57789:30471,57790:30468,57791:30505,57792:30500,57793:30494,57794:30501,57795:30502,57796:30491,57797:30519,57798:30520,57799:30535,57800:30554,57801:30568,57802:30571,57803:30555,57804:30565,57805:30591,57806:30590,57807:30585,57808:30606,57809:30603,57810:30609,57811:30624,57812:30622,57813:30640,57814:30646,57815:30649,57816:30655,57817:30652,57818:30653,57819:30651,57820:30663,57821:30669,57822:30679,57823:30682,57824:30684,57825:30691,57826:30702,57827:30716,57828:30732,57829:30738,57830:31014,57831:30752,57832:31018,57833:30789,57834:30862,57835:30836,57836:30854,57837:30844,57838:30874,57839:30860,57840:30883,57841:30901,57842:30890,57843:30895,57844:30929,57845:30918,57846:30923,57847:30932,57848:30910,57849:30908,57850:30917,57851:30922,57852:30956,57920:30951,57921:30938,57922:30973,57923:30964,57924:30983,57925:30994,57926:30993,57927:31001,57928:31020,57929:31019,57930:31040,57931:31072,57932:31063,57933:31071,57934:31066,57935:31061,57936:31059,57937:31098,57938:31103,57939:31114,57940:31133,57941:31143,57942:40779,57943:31146,57944:31150,57945:31155,57946:31161,57947:31162,57948:31177,57949:31189,57950:31207,57951:31212,57952:31201,57953:31203,57954:31240,57955:31245,57956:31256,57957:31257,57958:31264,57959:31263,57960:31104,57961:31281,57962:31291,57963:31294,57964:31287,57965:31299,57966:31319,57967:31305,57968:31329,57969:31330,57970:31337,57971:40861,57972:31344,57973:31353,57974:31357,57975:31368,57976:31383,57977:31381,57978:31384,57979:31382,57980:31401,57981:31432,57982:31408,57984:31414,57985:31429,57986:31428,57987:31423,57988:36995,57989:31431,57990:31434,57991:31437,57992:31439,57993:31445,57994:31443,57995:31449,57996:31450,57997:31453,57998:31457,57999:31458,58e3:31462,58001:31469,58002:31472,58003:31490,58004:31503,58005:31498,58006:31494,58007:31539,58008:31512,58009:31513,58010:31518,58011:31541,58012:31528,58013:31542,58014:31568,58015:31610,58016:31492,58017:31565,58018:31499,58019:31564,58020:31557,58021:31605,58022:31589,58023:31604,58024:31591,58025:31600,58026:31601,58027:31596,58028:31598,58029:31645,58030:31640,58031:31647,58032:31629,58033:31644,58034:31642,58035:31627,58036:31634,58037:31631,58038:31581,58039:31641,58040:31691,58041:31681,58042:31692,58043:31695,58044:31668,58045:31686,58046:31709,58047:31721,58048:31761,58049:31764,58050:31718,58051:31717,58052:31840,58053:31744,58054:31751,58055:31763,58056:31731,58057:31735,58058:31767,58059:31757,58060:31734,58061:31779,58062:31783,58063:31786,58064:31775,58065:31799,58066:31787,58067:31805,58068:31820,58069:31811,58070:31828,58071:31823,58072:31808,58073:31824,58074:31832,58075:31839,58076:31844,58077:31830,58078:31845,58079:31852,58080:31861,58081:31875,58082:31888,58083:31908,58084:31917,58085:31906,58086:31915,58087:31905,58088:31912,58089:31923,58090:31922,58091:31921,58092:31918,58093:31929,58094:31933,58095:31936,58096:31941,58097:31938,58098:31960,58099:31954,58100:31964,58101:31970,58102:39739,58103:31983,58104:31986,58105:31988,58106:31990,58107:31994,58108:32006,58176:32002,58177:32028,58178:32021,58179:32010,58180:32069,58181:32075,58182:32046,58183:32050,58184:32063,58185:32053,58186:32070,58187:32115,58188:32086,58189:32078,58190:32114,58191:32104,58192:32110,58193:32079,58194:32099,58195:32147,58196:32137,58197:32091,58198:32143,58199:32125,58200:32155,58201:32186,58202:32174,58203:32163,58204:32181,58205:32199,58206:32189,58207:32171,58208:32317,58209:32162,58210:32175,58211:32220,58212:32184,58213:32159,58214:32176,58215:32216,58216:32221,58217:32228,58218:32222,58219:32251,58220:32242,58221:32225,58222:32261,58223:32266,58224:32291,58225:32289,58226:32274,58227:32305,58228:32287,58229:32265,58230:32267,58231:32290,58232:32326,58233:32358,58234:32315,58235:32309,58236:32313,58237:32323,58238:32311,58240:32306,58241:32314,58242:32359,58243:32349,58244:32342,58245:32350,58246:32345,58247:32346,58248:32377,58249:32362,58250:32361,58251:32380,58252:32379,58253:32387,58254:32213,58255:32381,58256:36782,58257:32383,58258:32392,58259:32393,58260:32396,58261:32402,58262:32400,58263:32403,58264:32404,58265:32406,58266:32398,58267:32411,58268:32412,58269:32568,58270:32570,58271:32581,58272:32588,58273:32589,58274:32590,58275:32592,58276:32593,58277:32597,58278:32596,58279:32600,58280:32607,58281:32608,58282:32616,58283:32617,58284:32615,58285:32632,58286:32642,58287:32646,58288:32643,58289:32648,58290:32647,58291:32652,58292:32660,58293:32670,58294:32669,58295:32666,58296:32675,58297:32687,58298:32690,58299:32697,58300:32686,58301:32694,58302:32696,58303:35697,58304:32709,58305:32710,58306:32714,58307:32725,58308:32724,58309:32737,58310:32742,58311:32745,58312:32755,58313:32761,58314:39132,58315:32774,58316:32772,58317:32779,58318:32786,58319:32792,58320:32793,58321:32796,58322:32801,58323:32808,58324:32831,58325:32827,58326:32842,58327:32838,58328:32850,58329:32856,58330:32858,58331:32863,58332:32866,58333:32872,58334:32883,58335:32882,58336:32880,58337:32886,58338:32889,58339:32893,58340:32895,58341:32900,58342:32902,58343:32901,58344:32923,58345:32915,58346:32922,58347:32941,58348:20880,58349:32940,58350:32987,58351:32997,58352:32985,58353:32989,58354:32964,58355:32986,58356:32982,58357:33033,58358:33007,58359:33009,58360:33051,58361:33065,58362:33059,58363:33071,58364:33099,58432:38539,58433:33094,58434:33086,58435:33107,58436:33105,58437:33020,58438:33137,58439:33134,58440:33125,58441:33126,58442:33140,58443:33155,58444:33160,58445:33162,58446:33152,58447:33154,58448:33184,58449:33173,58450:33188,58451:33187,58452:33119,58453:33171,58454:33193,58455:33200,58456:33205,58457:33214,58458:33208,58459:33213,58460:33216,58461:33218,58462:33210,58463:33225,58464:33229,58465:33233,58466:33241,58467:33240,58468:33224,58469:33242,58470:33247,58471:33248,58472:33255,58473:33274,58474:33275,58475:33278,58476:33281,58477:33282,58478:33285,58479:33287,58480:33290,58481:33293,58482:33296,58483:33302,58484:33321,58485:33323,58486:33336,58487:33331,58488:33344,58489:33369,58490:33368,58491:33373,58492:33370,58493:33375,58494:33380,58496:33378,58497:33384,58498:33386,58499:33387,58500:33326,58501:33393,58502:33399,58503:33400,58504:33406,58505:33421,58506:33426,58507:33451,58508:33439,58509:33467,58510:33452,58511:33505,58512:33507,58513:33503,58514:33490,58515:33524,58516:33523,58517:33530,58518:33683,58519:33539,58520:33531,58521:33529,58522:33502,58523:33542,58524:33500,58525:33545,58526:33497,58527:33589,58528:33588,58529:33558,58530:33586,58531:33585,58532:33600,58533:33593,58534:33616,58535:33605,58536:33583,58537:33579,58538:33559,58539:33560,58540:33669,58541:33690,58542:33706,58543:33695,58544:33698,58545:33686,58546:33571,58547:33678,58548:33671,58549:33674,58550:33660,58551:33717,58552:33651,58553:33653,58554:33696,58555:33673,58556:33704,58557:33780,58558:33811,58559:33771,58560:33742,58561:33789,58562:33795,58563:33752,58564:33803,58565:33729,58566:33783,58567:33799,58568:33760,58569:33778,58570:33805,58571:33826,58572:33824,58573:33725,58574:33848,58575:34054,58576:33787,58577:33901,58578:33834,58579:33852,58580:34138,58581:33924,58582:33911,58583:33899,58584:33965,58585:33902,58586:33922,58587:33897,58588:33862,58589:33836,58590:33903,58591:33913,58592:33845,58593:33994,58594:33890,58595:33977,58596:33983,58597:33951,58598:34009,58599:33997,58600:33979,58601:34010,58602:34e3,58603:33985,58604:33990,58605:34006,58606:33953,58607:34081,58608:34047,58609:34036,58610:34071,58611:34072,58612:34092,58613:34079,58614:34069,58615:34068,58616:34044,58617:34112,58618:34147,58619:34136,58620:34120,58688:34113,58689:34306,58690:34123,58691:34133,58692:34176,58693:34212,58694:34184,58695:34193,58696:34186,58697:34216,58698:34157,58699:34196,58700:34203,58701:34282,58702:34183,58703:34204,58704:34167,58705:34174,58706:34192,58707:34249,58708:34234,58709:34255,58710:34233,58711:34256,58712:34261,58713:34269,58714:34277,58715:34268,58716:34297,58717:34314,58718:34323,58719:34315,58720:34302,58721:34298,58722:34310,58723:34338,58724:34330,58725:34352,58726:34367,58727:34381,58728:20053,58729:34388,58730:34399,58731:34407,58732:34417,58733:34451,58734:34467,58735:34473,58736:34474,58737:34443,58738:34444,58739:34486,58740:34479,58741:34500,58742:34502,58743:34480,58744:34505,58745:34851,58746:34475,58747:34516,58748:34526,58749:34537,58750:34540,58752:34527,58753:34523,58754:34543,58755:34578,58756:34566,58757:34568,58758:34560,58759:34563,58760:34555,58761:34577,58762:34569,58763:34573,58764:34553,58765:34570,58766:34612,58767:34623,58768:34615,58769:34619,58770:34597,58771:34601,58772:34586,58773:34656,58774:34655,58775:34680,58776:34636,58777:34638,58778:34676,58779:34647,58780:34664,58781:34670,58782:34649,58783:34643,58784:34659,58785:34666,58786:34821,58787:34722,58788:34719,58789:34690,58790:34735,58791:34763,58792:34749,58793:34752,58794:34768,58795:38614,58796:34731,58797:34756,58798:34739,58799:34759,58800:34758,58801:34747,58802:34799,58803:34802,58804:34784,58805:34831,58806:34829,58807:34814,58808:34806,58809:34807,58810:34830,58811:34770,58812:34833,58813:34838,58814:34837,58815:34850,58816:34849,58817:34865,58818:34870,58819:34873,58820:34855,58821:34875,58822:34884,58823:34882,58824:34898,58825:34905,58826:34910,58827:34914,58828:34923,58829:34945,58830:34942,58831:34974,58832:34933,58833:34941,58834:34997,58835:34930,58836:34946,58837:34967,58838:34962,58839:34990,58840:34969,58841:34978,58842:34957,58843:34980,58844:34992,58845:35007,58846:34993,58847:35011,58848:35012,58849:35028,58850:35032,58851:35033,58852:35037,58853:35065,58854:35074,58855:35068,58856:35060,58857:35048,58858:35058,58859:35076,58860:35084,58861:35082,58862:35091,58863:35139,58864:35102,58865:35109,58866:35114,58867:35115,58868:35137,58869:35140,58870:35131,58871:35126,58872:35128,58873:35148,58874:35101,58875:35168,58876:35166,58944:35174,58945:35172,58946:35181,58947:35178,58948:35183,58949:35188,58950:35191,58951:35198,58952:35203,58953:35208,58954:35210,58955:35219,58956:35224,58957:35233,58958:35241,58959:35238,58960:35244,58961:35247,58962:35250,58963:35258,58964:35261,58965:35263,58966:35264,58967:35290,58968:35292,58969:35293,58970:35303,58971:35316,58972:35320,58973:35331,58974:35350,58975:35344,58976:35340,58977:35355,58978:35357,58979:35365,58980:35382,58981:35393,58982:35419,58983:35410,58984:35398,58985:35400,58986:35452,58987:35437,58988:35436,58989:35426,58990:35461,58991:35458,58992:35460,58993:35496,58994:35489,58995:35473,58996:35493,58997:35494,58998:35482,58999:35491,59e3:35524,59001:35533,59002:35522,59003:35546,59004:35563,59005:35571,59006:35559,59008:35556,59009:35569,59010:35604,59011:35552,59012:35554,59013:35575,59014:35550,59015:35547,59016:35596,59017:35591,59018:35610,59019:35553,59020:35606,59021:35600,59022:35607,59023:35616,59024:35635,59025:38827,59026:35622,59027:35627,59028:35646,59029:35624,59030:35649,59031:35660,59032:35663,59033:35662,59034:35657,59035:35670,59036:35675,59037:35674,59038:35691,59039:35679,59040:35692,59041:35695,59042:35700,59043:35709,59044:35712,59045:35724,59046:35726,59047:35730,59048:35731,59049:35734,59050:35737,59051:35738,59052:35898,59053:35905,59054:35903,59055:35912,59056:35916,59057:35918,59058:35920,59059:35925,59060:35938,59061:35948,59062:35960,59063:35962,59064:35970,59065:35977,59066:35973,59067:35978,59068:35981,59069:35982,59070:35988,59071:35964,59072:35992,59073:25117,59074:36013,59075:36010,59076:36029,59077:36018,59078:36019,59079:36014,59080:36022,59081:36040,59082:36033,59083:36068,59084:36067,59085:36058,59086:36093,59087:36090,59088:36091,59089:36100,59090:36101,59091:36106,59092:36103,59093:36111,59094:36109,59095:36112,59096:40782,59097:36115,59098:36045,59099:36116,59100:36118,59101:36199,59102:36205,59103:36209,59104:36211,59105:36225,59106:36249,59107:36290,59108:36286,59109:36282,59110:36303,59111:36314,59112:36310,59113:36300,59114:36315,59115:36299,59116:36330,59117:36331,59118:36319,59119:36323,59120:36348,59121:36360,59122:36361,59123:36351,59124:36381,59125:36382,59126:36368,59127:36383,59128:36418,59129:36405,59130:36400,59131:36404,59132:36426,59200:36423,59201:36425,59202:36428,59203:36432,59204:36424,59205:36441,59206:36452,59207:36448,59208:36394,59209:36451,59210:36437,59211:36470,59212:36466,59213:36476,59214:36481,59215:36487,59216:36485,59217:36484,59218:36491,59219:36490,59220:36499,59221:36497,59222:36500,59223:36505,59224:36522,59225:36513,59226:36524,59227:36528,59228:36550,59229:36529,59230:36542,59231:36549,59232:36552,59233:36555,59234:36571,59235:36579,59236:36604,59237:36603,59238:36587,59239:36606,59240:36618,59241:36613,59242:36629,59243:36626,59244:36633,59245:36627,59246:36636,59247:36639,59248:36635,59249:36620,59250:36646,59251:36659,59252:36667,59253:36665,59254:36677,59255:36674,59256:36670,59257:36684,59258:36681,59259:36678,59260:36686,59261:36695,59262:36700,59264:36706,59265:36707,59266:36708,59267:36764,59268:36767,59269:36771,59270:36781,59271:36783,59272:36791,59273:36826,59274:36837,59275:36834,59276:36842,59277:36847,59278:36999,59279:36852,59280:36869,59281:36857,59282:36858,59283:36881,59284:36885,59285:36897,59286:36877,59287:36894,59288:36886,59289:36875,59290:36903,59291:36918,59292:36917,59293:36921,59294:36856,59295:36943,59296:36944,59297:36945,59298:36946,59299:36878,59300:36937,59301:36926,59302:36950,59303:36952,59304:36958,59305:36968,59306:36975,59307:36982,59308:38568,59309:36978,59310:36994,59311:36989,59312:36993,59313:36992,59314:37002,59315:37001,59316:37007,59317:37032,59318:37039,59319:37041,59320:37045,59321:37090,59322:37092,59323:25160,59324:37083,59325:37122,59326:37138,59327:37145,59328:37170,59329:37168,59330:37194,59331:37206,59332:37208,59333:37219,59334:37221,59335:37225,59336:37235,59337:37234,59338:37259,59339:37257,59340:37250,59341:37282,59342:37291,59343:37295,59344:37290,59345:37301,59346:37300,59347:37306,59348:37312,59349:37313,59350:37321,59351:37323,59352:37328,59353:37334,59354:37343,59355:37345,59356:37339,59357:37372,59358:37365,59359:37366,59360:37406,59361:37375,59362:37396,59363:37420,59364:37397,59365:37393,59366:37470,59367:37463,59368:37445,59369:37449,59370:37476,59371:37448,59372:37525,59373:37439,59374:37451,59375:37456,59376:37532,59377:37526,59378:37523,59379:37531,59380:37466,59381:37583,59382:37561,59383:37559,59384:37609,59385:37647,59386:37626,59387:37700,59388:37678,59456:37657,59457:37666,59458:37658,59459:37667,59460:37690,59461:37685,59462:37691,59463:37724,59464:37728,59465:37756,59466:37742,59467:37718,59468:37808,59469:37804,59470:37805,59471:37780,59472:37817,59473:37846,59474:37847,59475:37864,59476:37861,59477:37848,59478:37827,59479:37853,59480:37840,59481:37832,59482:37860,59483:37914,59484:37908,59485:37907,59486:37891,59487:37895,59488:37904,59489:37942,59490:37931,59491:37941,59492:37921,59493:37946,59494:37953,59495:37970,59496:37956,59497:37979,59498:37984,59499:37986,59500:37982,59501:37994,59502:37417,59503:38e3,59504:38005,59505:38007,59506:38013,59507:37978,59508:38012,59509:38014,59510:38017,59511:38015,59512:38274,59513:38279,59514:38282,59515:38292,59516:38294,59517:38296,59518:38297,59520:38304,59521:38312,59522:38311,59523:38317,59524:38332,59525:38331,59526:38329,59527:38334,59528:38346,59529:28662,59530:38339,59531:38349,59532:38348,59533:38357,59534:38356,59535:38358,59536:38364,59537:38369,59538:38373,59539:38370,59540:38433,59541:38440,59542:38446,59543:38447,59544:38466,59545:38476,59546:38479,59547:38475,59548:38519,59549:38492,59550:38494,59551:38493,59552:38495,59553:38502,59554:38514,59555:38508,59556:38541,59557:38552,59558:38549,59559:38551,59560:38570,59561:38567,59562:38577,59563:38578,59564:38576,59565:38580,59566:38582,59567:38584,59568:38585,59569:38606,59570:38603,59571:38601,59572:38605,59573:35149,59574:38620,59575:38669,59576:38613,59577:38649,59578:38660,59579:38662,59580:38664,59581:38675,59582:38670,59583:38673,59584:38671,59585:38678,59586:38681,59587:38692,59588:38698,59589:38704,59590:38713,59591:38717,59592:38718,59593:38724,59594:38726,59595:38728,59596:38722,59597:38729,59598:38748,59599:38752,59600:38756,59601:38758,59602:38760,59603:21202,59604:38763,59605:38769,59606:38777,59607:38789,59608:38780,59609:38785,59610:38778,59611:38790,59612:38795,59613:38799,59614:38800,59615:38812,59616:38824,59617:38822,59618:38819,59619:38835,59620:38836,59621:38851,59622:38854,59623:38856,59624:38859,59625:38876,59626:38893,59627:40783,59628:38898,59629:31455,59630:38902,59631:38901,59632:38927,59633:38924,59634:38968,59635:38948,59636:38945,59637:38967,59638:38973,59639:38982,59640:38991,59641:38987,59642:39019,59643:39023,59644:39024,59712:39025,59713:39028,59714:39027,59715:39082,59716:39087,59717:39089,59718:39094,59719:39108,59720:39107,59721:39110,59722:39145,59723:39147,59724:39171,59725:39177,59726:39186,59727:39188,59728:39192,59729:39201,59730:39197,59731:39198,59732:39204,59733:39200,59734:39212,59735:39214,59736:39229,59737:39230,59738:39234,59739:39241,59740:39237,59741:39248,59742:39243,59743:39249,59744:39250,59745:39244,59746:39253,59747:39319,59748:39320,59749:39333,59750:39341,59751:39342,59752:39356,59753:39391,59754:39387,59755:39389,59756:39384,59757:39377,59758:39405,59759:39406,59760:39409,59761:39410,59762:39419,59763:39416,59764:39425,59765:39439,59766:39429,59767:39394,59768:39449,59769:39467,59770:39479,59771:39493,59772:39490,59773:39488,59774:39491,59776:39486,59777:39509,59778:39501,59779:39515,59780:39511,59781:39519,59782:39522,59783:39525,59784:39524,59785:39529,59786:39531,59787:39530,59788:39597,59789:39600,59790:39612,59791:39616,59792:39631,59793:39633,59794:39635,59795:39636,59796:39646,59797:39647,59798:39650,59799:39651,59800:39654,59801:39663,59802:39659,59803:39662,59804:39668,59805:39665,59806:39671,59807:39675,59808:39686,59809:39704,59810:39706,59811:39711,59812:39714,59813:39715,59814:39717,59815:39719,59816:39720,59817:39721,59818:39722,59819:39726,59820:39727,59821:39730,59822:39748,59823:39747,59824:39759,59825:39757,59826:39758,59827:39761,59828:39768,59829:39796,59830:39827,59831:39811,59832:39825,59833:39830,59834:39831,59835:39839,59836:39840,59837:39848,59838:39860,59839:39872,59840:39882,59841:39865,59842:39878,59843:39887,59844:39889,59845:39890,59846:39907,59847:39906,59848:39908,59849:39892,59850:39905,59851:39994,59852:39922,59853:39921,59854:39920,59855:39957,59856:39956,59857:39945,59858:39955,59859:39948,59860:39942,59861:39944,59862:39954,59863:39946,59864:39940,59865:39982,59866:39963,59867:39973,59868:39972,59869:39969,59870:39984,59871:40007,59872:39986,59873:40006,59874:39998,59875:40026,59876:40032,59877:40039,59878:40054,59879:40056,59880:40167,59881:40172,59882:40176,59883:40201,59884:40200,59885:40171,59886:40195,59887:40198,59888:40234,59889:40230,59890:40367,59891:40227,59892:40223,59893:40260,59894:40213,59895:40210,59896:40257,59897:40255,59898:40254,59899:40262,59900:40264,59968:40285,59969:40286,59970:40292,59971:40273,59972:40272,59973:40281,59974:40306,59975:40329,59976:40327,59977:40363,59978:40303,59979:40314,59980:40346,59981:40356,59982:40361,59983:40370,59984:40388,59985:40385,59986:40379,59987:40376,59988:40378,59989:40390,59990:40399,59991:40386,59992:40409,59993:40403,59994:40440,59995:40422,59996:40429,59997:40431,59998:40445,59999:40474,6e4:40475,60001:40478,60002:40565,60003:40569,60004:40573,60005:40577,60006:40584,60007:40587,60008:40588,60009:40594,60010:40597,60011:40593,60012:40605,60013:40613,60014:40617,60015:40632,60016:40618,60017:40621,60018:38753,60019:40652,60020:40654,60021:40655,60022:40656,60023:40660,60024:40668,60025:40670,60026:40669,60027:40672,60028:40677,60029:40680,60030:40687,60032:40692,60033:40694,60034:40695,60035:40697,60036:40699,60037:40700,60038:40701,60039:40711,60040:40712,60041:30391,60042:40725,60043:40737,60044:40748,60045:40766,60046:40778,60047:40786,60048:40788,60049:40803,60050:40799,60051:40800,60052:40801,60053:40806,60054:40807,60055:40812,60056:40810,60057:40823,60058:40818,60059:40822,60060:40853,60061:40860,60062:40864,60063:22575,60064:27079,60065:36953,60066:29796,60067:20956,60068:29081}}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(1),r=n(2);function a(g,p,C,b){var E;p.degree()<C.degree()&&(E=[C,p],p=E[0],C=E[1]);for(var y=p,D=C,I=g.zero,M=g.one;D.degree()>=b/2;){var R=y,T=I;if(y=D,I=M,y.isZero())return null;D=R;for(var V=g.zero,O=y.getCoefficient(y.degree()),Q=g.inverse(O);D.degree()>=y.degree()&&!D.isZero();){var ie=D.degree()-y.degree(),de=g.multiply(D.getCoefficient(D.degree()),Q);V=V.addOrSubtract(g.buildMonomial(ie,de)),D=D.addOrSubtract(y.multiplyByMonomial(ie,de))}if(M=V.multiplyPoly(I).addOrSubtract(T),D.degree()>=y.degree())return null}var te=M.getCoefficient(0);if(te===0)return null;var le=g.inverse(te);return[M.multiply(le),D.multiply(le)]}function d(g,p){var C=p.degree();if(C===1)return[p.getCoefficient(1)];for(var b=new Array(C),E=0,y=1;y<g.size&&E<C;y++)p.evaluateAt(y)===0&&(b[E]=g.inverse(y),E++);return E!==C?null:b}function u(g,p,C){for(var b=C.length,E=new Array(b),y=0;y<b;y++){for(var D=g.inverse(C[y]),I=1,M=0;M<b;M++)y!==M&&(I=g.multiply(I,s.addOrSubtractGF(1,g.multiply(C[M],D))));E[y]=g.multiply(p.evaluateAt(D),g.inverse(I)),g.generatorBase!==0&&(E[y]=g.multiply(E[y],D))}return E}function f(g,p){var C=new Uint8ClampedArray(g.length);C.set(g);for(var b=new s.default(285,256,0),E=new r.default(b,C),y=new Uint8ClampedArray(p),D=!1,I=0;I<p;I++){var M=E.evaluateAt(b.exp(I+b.generatorBase));y[y.length-1-I]=M,M!==0&&(D=!0)}if(!D)return C;var R=new r.default(b,y),T=a(b,b.buildMonomial(p,1),R,p);if(T===null)return null;var V=d(b,T[0]);if(V==null)return null;for(var O=u(b,T[1],V),Q=0;Q<V.length;Q++){var ie=C.length-1-b.log(V[Q]);if(ie<0)return null;C[ie]=s.addOrSubtractGF(C[ie],O[Q])}return C}i.decode=f}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.VERSIONS=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}]}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(0);function r(f,g,p,C){var b=f.x-g.x+p.x-C.x,E=f.y-g.y+p.y-C.y;if(b===0&&E===0)return{a11:g.x-f.x,a12:g.y-f.y,a13:0,a21:p.x-g.x,a22:p.y-g.y,a23:0,a31:f.x,a32:f.y,a33:1};var y=g.x-p.x,D=C.x-p.x,I=g.y-p.y,M=C.y-p.y,R=y*M-D*I,T=(b*M-D*E)/R,V=(y*E-b*I)/R;return{a11:g.x-f.x+T*g.x,a12:g.y-f.y+T*g.y,a13:T,a21:C.x-f.x+V*C.x,a22:C.y-f.y+V*C.y,a23:V,a31:f.x,a32:f.y,a33:1}}function a(f,g,p,C){var b=r(f,g,p,C);return{a11:b.a22*b.a33-b.a23*b.a32,a12:b.a13*b.a32-b.a12*b.a33,a13:b.a12*b.a23-b.a13*b.a22,a21:b.a23*b.a31-b.a21*b.a33,a22:b.a11*b.a33-b.a13*b.a31,a23:b.a13*b.a21-b.a11*b.a23,a31:b.a21*b.a32-b.a22*b.a31,a32:b.a12*b.a31-b.a11*b.a32,a33:b.a11*b.a22-b.a12*b.a21}}function d(f,g){return{a11:f.a11*g.a11+f.a21*g.a12+f.a31*g.a13,a12:f.a12*g.a11+f.a22*g.a12+f.a32*g.a13,a13:f.a13*g.a11+f.a23*g.a12+f.a33*g.a13,a21:f.a11*g.a21+f.a21*g.a22+f.a31*g.a23,a22:f.a12*g.a21+f.a22*g.a22+f.a32*g.a23,a23:f.a13*g.a21+f.a23*g.a22+f.a33*g.a23,a31:f.a11*g.a31+f.a21*g.a32+f.a31*g.a33,a32:f.a12*g.a31+f.a22*g.a32+f.a32*g.a33,a33:f.a13*g.a31+f.a23*g.a32+f.a33*g.a33}}function u(f,g){for(var p=a({x:3.5,y:3.5},{x:g.dimension-3.5,y:3.5},{x:g.dimension-6.5,y:g.dimension-6.5},{x:3.5,y:g.dimension-3.5}),C=r(g.topLeft,g.topRight,g.alignmentPattern,g.bottomLeft),b=d(C,p),E=s.BitMatrix.createEmpty(g.dimension,g.dimension),y=function(V,O){var Q=b.a13*V+b.a23*O+b.a33;return{x:(b.a11*V+b.a21*O+b.a31)/Q,y:(b.a12*V+b.a22*O+b.a32)/Q}},D=0;D<g.dimension;D++)for(var I=0;I<g.dimension;I++){var M=I+.5,R=D+.5,T=y(M,R);E.set(I,D,f.get(Math.floor(T.x),Math.floor(T.y)))}return{matrix:E,mappingFunction:y}}i.extract=u}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=4,r=.5,a=1.5,d=function(M,R){return Math.sqrt(Math.pow(R.x-M.x,2)+Math.pow(R.y-M.y,2))};function u(M){return M.reduce(function(R,T){return R+T})}function f(M,R,T){var V,O,Q,ie,de=d(M,R),te=d(R,T),le=d(M,T),we,oe,ye;return te>=de&&te>=le?(V=[R,M,T],we=V[0],oe=V[1],ye=V[2]):le>=te&&le>=de?(O=[M,R,T],we=O[0],oe=O[1],ye=O[2]):(Q=[M,T,R],we=Q[0],oe=Q[1],ye=Q[2]),(ye.x-oe.x)*(we.y-oe.y)-(ye.y-oe.y)*(we.x-oe.x)<0&&(ie=[ye,we],we=ie[0],ye=ie[1]),{bottomLeft:we,topLeft:oe,topRight:ye}}function g(M,R,T,V){var O=(u(C(M,T,V,5))/7+u(C(M,R,V,5))/7+u(C(T,M,V,5))/7+u(C(R,M,V,5))/7)/4;if(O<1)throw new Error("Invalid module size");var Q=Math.round(d(M,R)/O),ie=Math.round(d(M,T)/O),de=Math.floor((Q+ie)/2)+7;switch(de%4){case 0:de++;break;case 2:de--;break}return{dimension:de,moduleSize:O}}function p(M,R,T,V){var O=[{x:Math.floor(M.x),y:Math.floor(M.y)}],Q=Math.abs(R.y-M.y)>Math.abs(R.x-M.x),ie,de,te,le;Q?(ie=Math.floor(M.y),de=Math.floor(M.x),te=Math.floor(R.y),le=Math.floor(R.x)):(ie=Math.floor(M.x),de=Math.floor(M.y),te=Math.floor(R.x),le=Math.floor(R.y));for(var we=Math.abs(te-ie),oe=Math.abs(le-de),ye=Math.floor(-we/2),Re=ie<te?1:-1,ke=de<le?1:-1,_e=!0,lt=ie,Te=de;lt!==te+Re;lt+=Re){var pe=Q?Te:lt,ut=Q?lt:Te;if(T.get(pe,ut)!==_e&&(_e=!_e,O.push({x:pe,y:ut}),O.length===V+1))break;if(ye+=oe,ye>0){if(Te===le)break;Te+=ke,ye-=we}}for(var Rt=[],st=0;st<V;st++)O[st]&&O[st+1]?Rt.push(d(O[st],O[st+1])):Rt.push(0);return Rt}function C(M,R,T,V){var O,Q=R.y-M.y,ie=R.x-M.x,de=p(M,R,T,Math.ceil(V/2)),te=p(M,{x:M.x-ie,y:M.y-Q},T,Math.ceil(V/2)),le=de.shift()+te.shift()-1;return(O=te.concat(le)).concat.apply(O,de)}function b(M,R){var T=u(M)/u(R),V=0;return R.forEach(function(O,Q){V+=Math.pow(M[Q]-O*T,2)}),{averageSize:T,error:V}}function E(M,R,T){try{var V=C(M,{x:-1,y:M.y},T,R.length),O=C(M,{x:M.x,y:-1},T,R.length),Q={x:Math.max(0,M.x-M.y)-1,y:Math.max(0,M.y-M.x)-1},ie=C(M,Q,T,R.length),de={x:Math.min(T.width,M.x+M.y)+1,y:Math.min(T.height,M.y+M.x)+1},te=C(M,de,T,R.length),le=b(V,R),we=b(O,R),oe=b(ie,R),ye=b(te,R),Re=Math.sqrt(le.error*le.error+we.error*we.error+oe.error*oe.error+ye.error*ye.error),ke=(le.averageSize+we.averageSize+oe.averageSize+ye.averageSize)/4,_e=(Math.pow(le.averageSize-ke,2)+Math.pow(we.averageSize-ke,2)+Math.pow(oe.averageSize-ke,2)+Math.pow(ye.averageSize-ke,2))/ke;return Re+_e}catch{return 1/0}}function y(M,R){for(var T=Math.round(R.x);M.get(T,Math.round(R.y));)T--;for(var V=Math.round(R.x);M.get(V,Math.round(R.y));)V++;for(var O=(T+V)/2,Q=Math.round(R.y);M.get(Math.round(O),Q);)Q--;for(var ie=Math.round(R.y);M.get(Math.round(O),ie);)ie++;var de=(Q+ie)/2;return{x:O,y:de}}function D(M){for(var R=[],T=[],V=[],O=[],Q=function(pe){for(var ut=0,Rt=!1,st=[0,0,0,0,0],St=function(Tt){var xt=M.get(Tt,pe);if(xt===Rt)ut++;else{st=[st[1],st[2],st[3],st[4],ut],ut=1,Rt=xt;var at=u(st)/7,et=Math.abs(st[0]-at)<at&&Math.abs(st[1]-at)<at&&Math.abs(st[2]-3*at)<3*at&&Math.abs(st[3]-at)<at&&Math.abs(st[4]-at)<at&&!xt,Ot=u(st.slice(-3))/3,di=Math.abs(st[2]-Ot)<Ot&&Math.abs(st[3]-Ot)<Ot&&Math.abs(st[4]-Ot)<Ot&&xt;if(et){var dt=Tt-st[3]-st[4],Ft=dt-st[2],Vt={startX:Ft,endX:dt,y:pe},zt=T.filter(function(Pi){return Ft>=Pi.bottom.startX&&Ft<=Pi.bottom.endX||dt>=Pi.bottom.startX&&Ft<=Pi.bottom.endX||Ft<=Pi.bottom.startX&&dt>=Pi.bottom.endX&&st[2]/(Pi.bottom.endX-Pi.bottom.startX)<a&&st[2]/(Pi.bottom.endX-Pi.bottom.startX)>r});zt.length>0?zt[0].bottom=Vt:T.push({top:Vt,bottom:Vt})}if(di){var Qt=Tt-st[4],vt=Qt-st[3],Vt={startX:vt,y:pe,endX:Qt},zt=O.filter(function(hi){return vt>=hi.bottom.startX&&vt<=hi.bottom.endX||Qt>=hi.bottom.startX&&vt<=hi.bottom.endX||vt<=hi.bottom.startX&&Qt>=hi.bottom.endX&&st[2]/(hi.bottom.endX-hi.bottom.startX)<a&&st[2]/(hi.bottom.endX-hi.bottom.startX)>r});zt.length>0?zt[0].bottom=Vt:O.push({top:Vt,bottom:Vt})}}},be=-1;be<=M.width;be++)St(be);R.push.apply(R,T.filter(function(Tt){return Tt.bottom.y!==pe&&Tt.bottom.y-Tt.top.y>=2})),T=T.filter(function(Tt){return Tt.bottom.y===pe}),V.push.apply(V,O.filter(function(Tt){return Tt.bottom.y!==pe})),O=O.filter(function(Tt){return Tt.bottom.y===pe})},ie=0;ie<=M.height;ie++)Q(ie);R.push.apply(R,T.filter(function(pe){return pe.bottom.y-pe.top.y>=2})),V.push.apply(V,O);var de=R.filter(function(pe){return pe.bottom.y-pe.top.y>=2}).map(function(pe){var ut=(pe.top.startX+pe.top.endX+pe.bottom.startX+pe.bottom.endX)/4,Rt=(pe.top.y+pe.bottom.y+1)/2;if(M.get(Math.round(ut),Math.round(Rt))){var st=[pe.top.endX-pe.top.startX,pe.bottom.endX-pe.bottom.startX,pe.bottom.y-pe.top.y+1],St=u(st)/st.length,be=E({x:Math.round(ut),y:Math.round(Rt)},[1,1,3,1,1],M);return{score:be,x:ut,y:Rt,size:St}}}).filter(function(pe){return!!pe}).sort(function(pe,ut){return pe.score-ut.score}).map(function(pe,ut,Rt){if(ut>s)return null;var st=Rt.filter(function(be,Tt){return ut!==Tt}).map(function(be){return{x:be.x,y:be.y,score:be.score+Math.pow(be.size-pe.size,2)/pe.size,size:be.size}}).sort(function(be,Tt){return be.score-Tt.score});if(st.length<2)return null;var St=pe.score+st[0].score+st[1].score;return{points:[pe].concat(st.slice(0,2)),score:St}}).filter(function(pe){return!!pe}).sort(function(pe,ut){return pe.score-ut.score});if(de.length===0)return null;var te=f(de[0].points[0],de[0].points[1],de[0].points[2]),le=te.topRight,we=te.topLeft,oe=te.bottomLeft,ye=I(M,V,le,we,oe),Re=[];ye&&Re.push({alignmentPattern:{x:ye.alignmentPattern.x,y:ye.alignmentPattern.y},bottomLeft:{x:oe.x,y:oe.y},dimension:ye.dimension,topLeft:{x:we.x,y:we.y},topRight:{x:le.x,y:le.y}});var ke=y(M,le),_e=y(M,we),lt=y(M,oe),Te=I(M,V,ke,_e,lt);return Te&&Re.push({alignmentPattern:{x:Te.alignmentPattern.x,y:Te.alignmentPattern.y},bottomLeft:{x:lt.x,y:lt.y},topLeft:{x:_e.x,y:_e.y},topRight:{x:ke.x,y:ke.y},dimension:Te.dimension}),Re.length===0?null:Re}i.locate=D;function I(M,R,T,V,O){var Q,ie,de;try{Q=g(V,T,O,M),ie=Q.dimension,de=Q.moduleSize}catch{return null}var te={x:T.x-V.x+O.x,y:T.y-V.y+O.y},le=(d(V,O)+d(V,T))/2/de,we=1-3/le,oe={x:V.x+we*(te.x-V.x),y:V.y+we*(te.y-V.y)},ye=R.map(function(ke){var _e=(ke.top.startX+ke.top.endX+ke.bottom.startX+ke.bottom.endX)/4,lt=(ke.top.y+ke.bottom.y+1)/2;if(M.get(Math.floor(_e),Math.floor(lt))){var Te=[ke.top.endX-ke.top.startX,ke.bottom.endX-ke.bottom.startX,ke.bottom.y-ke.top.y+1];u(Te)/Te.length;var pe=E({x:Math.floor(_e),y:Math.floor(lt)},[1,1,1],M),ut=pe+d({x:_e,y:lt},oe);return{x:_e,y:lt,score:ut}}}).filter(function(ke){return!!ke}).sort(function(ke,_e){return ke.score-_e.score}),Re=le>=15&&ye.length?ye[0]:oe;return{alignmentPattern:Re,dimension:ie}}})]).default})})(Qx)),Qx.exports}var IX=LX();const PX=W9(IX);var TX=F('<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),MX=F('<label class="svelte-1ua3isv">Pairing Code / QR <input type="text" placeholder="MT:..." class="svelte-1ua3isv"/></label> <div class="scan-row svelte-1ua3isv"><button class="scan-btn svelte-1ua3isv" title="Scan QR code with camera"><svg width="13" height="13" viewBox="0 0 16 16" fill="currentColor"><path d="M1 1h5v5H1V1zm1 1v3h3V2H2zm7-1h5v5h-5V1zm1 1v3h3V2h-3zM1 9h5v5H1V9zm1 1v3h3v-3H2zm7 0h2v2H9v-2zm2 0h2v2h-2v-2zm0 2h2v2h-2v-2zm-2 2h2v2H9v-2zm2 0h2v2h-2v-2z"></path></svg> Camera</button> <label class="scan-btn scan-file-btn svelte-1ua3isv" title="Decode QR from image file"><svg width="13" height="13" viewBox="0 0 16 16" fill="currentColor"><path d="M13 4H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1zM3 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H3zm5 2.5a.5.5 0 0 1 .5.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1V6a.5.5 0 0 1 .5-.5z"></path></svg> Image… <input type="file" accept="image/*" style="display:none" class="svelte-1ua3isv"/></label></div>',1),FA=F('<p class="err svelte-1ua3isv"> </p>'),RX=F('<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>'),NX=F('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),OX=F('<span class="device-name svelte-1ua3isv"> </span>'),HX=F('<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>'),WX=F('<li class="empty svelte-1ua3isv">No paired devices</li>'),zX=F('<p class="info svelte-1ua3isv">Loading…</p>'),VX=F('<p class="device-subtitle svelte-1ua3isv"> </p>'),jX=F('<span class="ep-chip svelte-1ua3isv"> </span>'),$X=F('<span class="attr-id svelte-1ua3isv"> </span>'),UX=F('<button class="attr-action-btn svelte-1ua3isv"> </button>'),qX=F('<div class="attr-actions svelte-1ua3isv"></div>'),GX=F('<span class="cmd-sep svelte-1ua3isv">,</span>'),KX=F('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),ZX=F('<span class="cmd-id svelte-1ua3isv"> </span>'),XX=F("<!> <!>",1),YX=F('<span class="cmd-list svelte-1ua3isv"></span>'),QX=F(' <span class="cmd-id svelte-1ua3isv"> </span>',1),JX=F('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),eY=F('<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>'),tY=F('<th class="svelte-1ua3isv"> </th>'),iY=F('<td class="svelte-1ua3isv"> </td>'),nY=F('<tr class="svelte-1ua3isv"></tr>'),sY=F('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),oY=F('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),rY=F('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),aY=F('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),lY=F('<span class="attr-val svelte-1ua3isv"> </span>'),cY=F('<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>'),dY=F('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),uY=F('<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>'),hY=F('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),fY=F('<details class="svelte-1ua3isv"><summary class="svelte-1ua3isv"> <span class="ep-id svelte-1ua3isv"> </span> <span class="ep-chips svelte-1ua3isv"></span></summary> <!></details>'),gY=F('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),pY=F('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),xY=F('<span class="stream-badge svelte-1ua3isv"> </span>'),mY=F('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),wC=F('&nbsp;<span class="e-sub svelte-1ua3isv"> </span>',1),_Y=F('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),vY=F('<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),bY=F('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),CY=F('<div class="stream-body svelte-1ua3isv"><!></div>'),EY=F('<p class="scan-err svelte-1ua3isv"> </p>'),yY=F('<div class="scan-preview svelte-1ua3isv"><video playsinline="" class="scan-video svelte-1ua3isv"></video> <div class="scan-reticle svelte-1ua3isv"></div></div> <p class="scan-hint svelte-1ua3isv">Point camera at the QR code on the device</p>',3),wY=F('<div class="scan-backdrop svelte-1ua3isv"></div> <div class="scan-modal svelte-1ua3isv"><div class="scan-modal-hdr svelte-1ua3isv"><span>Scan Matter QR Code</span> <button class="scan-close svelte-1ua3isv">✕</button></div> <!> <canvas style="display:none"></canvas></div>',1),SY=F('<!> <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> <!>',1);function DY(o,e){Os(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(Y,ze,He,xe,bt){try{await J$(Y,ze,He,xe,bt)}catch(Ht){console.error("matter command failed",Ht)}}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(Y,ze){const He=n[Y];return ze.map(xe=>{const bt=typeof xe=="number"?xe:Number(xe);return{id:bt,name:(He==null?void 0:He[bt])??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},d={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 u(Y){return"0x"+Y.toString(16).toUpperCase().padStart(4,"0")}let f=P(Di([])),g=Di(new Map);function p(Y){if(Y==null)return"—";if(typeof Y=="boolean"||typeof Y=="number")return String(Y);if(typeof Y=="string")return Y.length>50?Y.slice(0,47)+"…":Y;const ze=JSON.stringify(Y);return ze.length>60?ze.slice(0,57)+"…":ze}function C(Y){return Y==null?"—":typeof Y=="boolean"||typeof Y=="number"?String(Y):typeof Y=="string"?Y:JSON.stringify(Y)}function b(Y){return Y!==null&&typeof Y=="object"&&!Array.isArray(Y)}function E(Y){return Array.isArray(Y)&&Y.length>0&&Y.every(b)}function y(Y,ze){return!!(ze==="attributeList"||Array.isArray(Y)&&Y.length===0||b(Y)&&Object.keys(Y).length===0)}function D(Y){return new Date(Y).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}const I=500,M=20,R=32;let T=0,V=P(Di([])),O=P(!0),Q=P(180),ie=It(()=>{const Y=Math.max(1,Math.floor((c(Q)-R)/M)+1);return c(V).slice(0,Y)});function de(Y){Y.preventDefault();const ze=Y.clientY,He=c(Q);function xe(Ht){m(Q,Math.max(60,Math.min(600,He+ze-Ht.clientY)),!0)}function bt(){document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",bt)}document.addEventListener("mousemove",xe),document.addEventListener("mouseup",bt)}let te=P(null),le=P(!1),we=P(null),oe=P(!1),ye=P("passcode"),Re=P(""),ke=P(""),_e=P(""),lt=P(!1),Te=P(null),pe=P(""),ut=P(!1),Rt=P(""),st=P(void 0),St=P(void 0),be=null,Tt=null;function xt(){Tt!==null&&(cancelAnimationFrame(Tt),Tt=null),be&&(be.getTracks().forEach(Y=>Y.stop()),be=null),m(ut,!1),m(Rt,"")}function at(Y){xt(),m(ye,"pairingCode"),m(_e,Y,!0)}function et(){if(!c(St))return null;const Y=c(St).getContext("2d",{willReadFrequently:!0}),{width:ze,height:He}=c(St);if(!ze||!He)return null;const xe=Y.getImageData(0,0,ze,He);return PX(xe.data,xe.width,xe.height,{inversionAttempts:"dontInvert"})}async function Ot(){if(m(ut,!0),m(Rt,""),await fd(),!c(st)||!c(St))return;try{be=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}),c(st).srcObject=be,await c(st).play()}catch(ze){m(Rt,"Camera unavailable: "+(ze instanceof Error?ze.message:String(ze)));return}const Y=()=>{var ze;if(!(!c(st)||!c(St)||!be)){if(c(st).readyState===c(st).HAVE_ENOUGH_DATA){c(St).width=c(st).videoWidth,c(St).height=c(st).videoHeight,c(St).getContext("2d",{willReadFrequently:!0}).drawImage(c(st),0,0);const xe=et();if((ze=xe==null?void 0:xe.data)!=null&&ze.startsWith("MT:")){at(xe.data);return}}Tt=requestAnimationFrame(Y)}};Tt=requestAnimationFrame(Y)}function di(Y){var xe;const ze=(xe=Y.target.files)==null?void 0:xe[0];if(!ze)return;const He=new FileReader;He.onload=bt=>{const Ht=new Image;Ht.onload=()=>{var gi;if(!c(St))return;c(St).width=Ht.width,c(St).height=Ht.height,c(St).getContext("2d",{willReadFrequently:!0}).drawImage(Ht,0,0);const ii=et();(gi=ii==null?void 0:ii.data)!=null&&gi.startsWith("MT:")?at(ii.data):m(Rt,"No Matter QR code found in image.")},Ht.src=bt.target.result},He.readAsDataURL(ze)}const dt="she:matter:selectedNodeId";async function Ft(){try{m(f,await eF(),!0);for(const Y of c(f))Xx(Y.nodeId).then(ze=>{g.set(Y.nodeId,ze)}).catch(()=>{});if(c(f).length>0&&!c(te)){const Y=localStorage.getItem(dt),ze=Y&&c(f).find(He=>He.nodeId===Y)?Y:c(f)[0].nodeId;Vt(ze)}}catch{m(f,[],!0)}}async function Vt(Y){m(le,!0),m(we,null);try{m(te,await Xx(Y),!0),g.set(Y,c(te)),localStorage.setItem(dt,Y)}catch(ze){m(we,ze instanceof Error?ze.message:String(ze),!0)}finally{m(le,!1)}}let zt;async function Qt(Y){var ze;if(await zt.show(`Unpair device ${Y}?`,{confirm:"Unpair",danger:!0}))try{await Q$(Y),((ze=c(te))==null?void 0:ze.nodeId)===Y&&m(te,null),await Ft()}catch(He){m(we,He instanceof Error?He.message:String(He),!0)}}async function vt(){m(lt,!0),m(Te,null);try{let Y;c(ye)==="passcode"?(Y={passcode:Number(c(Re))},c(ke)&&(Y={...Y,discriminator:Number(c(ke))})):Y={pairingCode:c(_e).trim()},c(pe).trim()&&(Y={...Y,discoveryAddress:c(pe).trim()}),await Y$(Y),m(oe,!1),m(Re,""),m(ke,""),m(_e,""),m(pe,""),await Ft()}catch(Y){m(Te,Y instanceof Error?Y.message:String(Y),!0)}finally{m(lt,!1)}}$s(()=>{Ft()});const Pi=ur("matter:deviceList",Y=>{if(!Array.isArray(Y.devices))return;const ze=Y.devices;for(const He of ze)g.has(He.nodeId)||Xx(He.nodeId).then(xe=>{g.set(He.nodeId,xe)}).catch(()=>{});m(f,ze,!0)}),Ai=ur("matter:deviceStatus",Y=>{if(Y.nodeId===void 0)return;const ze=String(Y.nodeId),He=!!Y.online;m(f,c(f).map(xe=>xe.nodeId===ze?{...xe,online:He}:xe),!0),m(V,[{id:T++,kind:"status",nodeId:ze,online:He,ts:Date.now()},...c(V).slice(0,I-1)],!0)}),hi=ur("matter:attr",Y=>{const ze=String(Y.nodeId),He=Y.endpointId,xe=String(Y.clusterName),bt=String(Y.attrName),Ht=Y.value;if(c(te)&&c(te).nodeId===ze){const ii=c(te).endpoints.find(qt=>qt.endpointId===He),gi=ii==null?void 0:ii.clusters.find(qt=>qt.name===xe);gi&&(gi.attrs[bt]=Ht)}const ri=g.get(ze);if(ri){const ii=ri.endpoints.find(qt=>qt.endpointId===He),gi=ii==null?void 0:ii.clusters.find(qt=>qt.name===xe);gi&&(gi.attrs[bt]=Ht)}m(V,[{id:T++,kind:"attr",nodeId:ze,endpointId:He,clusterName:xe,attrName:bt,value:Ht,ts:Y.ts??Date.now()},...c(V).slice(0,I-1)],!0)});Dp(()=>{Pi(),Ai(),hi(),xt()});var $i=SY(),Mi=wt($i);cs(Zc(Mi,{}),Y=>zt=Y,()=>zt);var Ci=_(Mi,2),Ji=v(Ci),Ki=v(Ji),Ri=v(Ki),cn=_(v(Ri),2),ft=_(Ri,2);{var Zt=Y=>{var ze=RX(),He=v(ze),xe=v(He);let bt;var Ht=_(xe,2);let ri;var ii=_(He,2);{var gi=Kt=>{var ue=TX(),qe=wt(ue),it=_(v(qe)),ot=_(qe,2),ht=_(v(ot));jt(it,()=>c(Re),pt=>m(Re,pt)),jt(ht,()=>c(ke),pt=>m(ke,pt)),A(Kt,ue)},qt=Kt=>{var ue=MX(),qe=wt(ue),it=_(v(qe)),ot=_(qe,2),ht=v(ot),pt=_(ht,2),Jt=_(v(pt),2);jt(it,()=>c(_e),B=>m(_e,B)),$("click",ht,Ot),$("change",Jt,di),A(Kt,ue)};z(ii,Kt=>{c(ye)==="passcode"?Kt(gi):Kt(qt,-1)})}var vi=_(ii,2),Oe=_(v(vi)),Ue=_(vi,2);{var Xt=Kt=>{var ue=FA(),qe=v(ue);j(()=>W(qe,c(Te))),A(Kt,ue)};z(Ue,Kt=>{c(Te)&&Kt(Xt)})}var Gt=_(Ue,2),Ei=v(Gt);j(()=>{bt=kt(xe,1,"svelte-1ua3isv",null,bt,{active:c(ye)==="passcode"}),ri=kt(Ht,1,"svelte-1ua3isv",null,ri,{active:c(ye)==="pairingCode"}),Gt.disabled=c(lt),W(Ei,c(lt)?"Commissioning…":"Commission")}),$("click",xe,()=>m(ye,"passcode")),$("click",Ht,()=>m(ye,"pairingCode")),jt(Oe,()=>c(pe),Kt=>m(pe,Kt)),$("click",Gt,vt),A(Y,ze)};z(ft,Y=>{c(oe)&&Y(Zt)})}var fi=_(ft,2),Ni=v(fi);si(Ni,17,()=>c(f),Y=>Y.nodeId,(Y,ze)=>{var He=HX();let xe;var bt=v(He),Ht=v(bt);let ri;var ii=_(Ht,2),gi=v(ii);{var qt=Ue=>{var Xt=NX(),Gt=wt(Xt),Ei=v(Gt),Kt=_(Gt,2),ue=v(Kt);j(()=>{W(Ei,c(ze).name),W(ue,`#${c(ze).nodeId??""}`)}),A(Ue,Xt)},vi=Ue=>{var Xt=OX(),Gt=v(Xt);j(()=>W(Gt,`Node ${c(ze).nodeId??""}`)),A(Ue,Xt)};z(gi,Ue=>{c(ze).name?Ue(qt):Ue(vi,-1)})}var Oe=_(bt,2);j(()=>{var Ue;xe=kt(He,1,"svelte-1ua3isv",null,xe,{selected:((Ue=c(te))==null?void 0:Ue.nodeId)===c(ze).nodeId}),ri=kt(Ht,1,"status-dot svelte-1ua3isv",null,ri,{online:c(ze).online})}),$("click",bt,()=>Vt(c(ze).nodeId)),$("click",Oe,()=>Qt(c(ze).nodeId)),A(Y,He)});var Ii=_(Ni,2);{var Bi=Y=>{var ze=WX();A(Y,ze)};z(Ii,Y=>{c(f).length===0&&Y(Bi)})}var Wi=_(Ki,2),Zi=v(Wi);{var mi=Y=>{var ze=zX();A(Y,ze)},Ke=Y=>{var ze=FA(),He=v(ze);j(()=>W(He,c(we))),A(Y,ze)},Nt=Y=>{var ze=gY(),He=wt(ze),xe=v(He),bt=v(xe),Ht=_(xe,2);{var ri=vi=>{var Oe=VX(),Ue=v(Oe);j(()=>W(Ue,c(te).subtitle)),A(vi,Oe)};z(Ht,vi=>{c(te).subtitle&&vi(ri)})}var ii=_(Ht,2),gi=v(ii),qt=_(He,2);si(qt,17,()=>c(te).endpoints,vi=>vi.endpointId,(vi,Oe)=>{var Ue=fY(),Xt=v(Ue),Gt=v(Xt),Ei=_(Gt),Kt=v(Ei),ue=_(Ei,2);si(ue,21,()=>c(Oe).clusters,Vi,(ht,pt)=>{var Jt=jX(),B=v(Jt);j(()=>W(B,c(pt).name)),A(ht,Jt)});var qe=_(Xt,2);{var it=ht=>{var pt=uY(),Jt=_(v(pt));si(Jt,21,()=>c(Oe).clusters,Vi,(B,H)=>{var K=dY(),ce=wt(K),X=v(ce),J=v(X),he=_(ce,2);si(he,17,()=>Object.entries(c(H).attrs),Vi,(Qe,ae)=>{var fe=It(()=>qS(c(ae),2));let Fe=()=>c(fe)[0],ge=()=>c(fe)[1];var Ee=Ts(),ct=wt(Ee);{var q=Le=>{const tt=It(()=>{var Si;return(Si=t[c(H).name])==null?void 0:Si[Fe()]}),Me=It(()=>(Fe()==="acceptedCommandList"||Fe()==="generatedCommandList")&&Array.isArray(ge())),Be=It(()=>{var Si;return((Si=d[c(H).name])==null?void 0:Si[Fe()])??a[Fe()]});var Et=cY(),Ct=v(Et),Ie=v(Ct),Dt=v(Ie),Je=_(Ie);{var Ve=Si=>{var ni=$X(),ei=v(ni);j(Xi=>W(ei,`(${Xi??""})`),[()=>u(c(Be))]),A(Si,ni)};z(Je,Si=>{c(Be)!==void 0&&Si(Ve)})}var Xe=_(Ct),mt=v(Xe);{var je=Si=>{var ni=qX();si(ni,21,()=>c(tt),Vi,(ei,Xi)=>{var Yi=UX(),An=v(Yi);j(()=>W(An,c(Xi).label)),$("click",Yi,()=>i(c(te).nodeId,c(Oe).endpointId,c(H).name,c(Xi).command,c(Xi).args)),A(ei,Yi)}),A(Si,ni)};z(mt,Si=>{c(tt)&&Si(je)})}var yt=_(Xe),Pe=v(yt);{var nt=Si=>{var ni=YX();si(ni,21,()=>s(c(H).name,ge()),Vi,(ei,Xi,Yi)=>{var An=XX(),Qn=wt(An);{var Es=es=>{var as=GX();A(es,as)};z(Qn,es=>{Yi>0&&es(Es)})}var os=_(Qn,2);{var Bs=es=>{var as=KX(),zi=wt(as),Gs=v(zi),Hn=_(zi),qn=v(Hn);j(()=>{W(Gs,c(Xi).name),W(qn,`(${c(Xi).id??""})`)}),A(es,as)},Sn=es=>{var as=ZX(),zi=v(as);j(()=>W(zi,c(Xi).id)),A(es,as)};z(os,es=>{c(Xi).name?es(Bs):es(Sn,-1)})}A(ei,An)}),A(Si,ni)},At=Si=>{var ni=eY(),ei=_(v(ni));si(ei,21,ge,Vi,(Xi,Yi)=>{const An=It(()=>c(Yi)),Qn=It(()=>c(An).deviceType),Es=It(()=>r[c(Qn)]);var os=JX(),Bs=v(os),Sn=v(Bs);{var es=Hn=>{var qn=QX(),ys=wt(qn),gr=_(ys),pr=v(gr);j(er=>{W(ys,`${c(Es)??""} `),W(pr,`(${er??""})`)},[()=>u(c(Qn))]),A(Hn,qn)},as=Hn=>{var qn=_o();j(ys=>W(qn,ys),[()=>u(c(Qn))]),A(Hn,qn)};z(Sn,Hn=>{c(Es)?Hn(es):Hn(as,-1)})}var zi=_(Bs),Gs=v(zi);j(Hn=>W(Gs,Hn),[()=>C(c(An).revision)]),A(Xi,os)}),A(Si,ni)},Mt=It(()=>Fe()==="deviceTypeList"&&Array.isArray(ge())),_t=Si=>{const ni=It(()=>[...new Set(ge().flatMap(Qn=>Object.keys(Qn)))]);var ei=sY(),Xi=v(ei),Yi=v(Xi);si(Yi,21,()=>c(ni),Vi,(Qn,Es)=>{var os=tY(),Bs=v(os);j(()=>W(Bs,c(Es))),A(Qn,os)});var An=_(Xi);si(An,21,ge,Vi,(Qn,Es)=>{var os=nY();si(os,21,()=>c(ni),Vi,(Bs,Sn)=>{var es=iY(),as=v(es);j(zi=>W(as,zi),[()=>C(c(Es)[c(Sn)])]),A(Bs,es)}),A(Qn,os)}),A(Si,ei)},bi=It(()=>E(ge())),wi=Si=>{var ni=rY(),ei=v(ni);si(ei,21,()=>Object.entries(ge()),Vi,(Xi,Yi)=>{var An=It(()=>qS(c(Yi),2));let Qn=()=>c(An)[0],Es=()=>c(An)[1];var os=oY(),Bs=v(os),Sn=v(Bs),es=_(Bs),as=v(es);j(zi=>{W(Sn,Qn()),W(as,zi)},[()=>C(Es())]),A(Xi,os)}),A(Si,ni)},qi=It(()=>b(ge())),Oi=Si=>{var ni=aY(),ei=v(ni);j(()=>{ln(ni,"href",ge()),W(ei,ge())}),A(Si,ni)},Gi=Si=>{var ni=lY(),ei=v(ni);j(Xi=>W(ei,Xi),[()=>C(ge())]),A(Si,ni)};z(Pe,Si=>{c(Me)?Si(nt):c(Mt)?Si(At,1):c(bi)?Si(_t,2):c(qi)?Si(wi,3):(Fe()==="productUrl"||Fe()==="productURL")&&typeof ge()=="string"?Si(Oi,4):Si(Gi,-1)})}j(()=>{ln(Ct,"title",Fe()),W(Dt,Fe())}),A(Le,Et)},re=It(()=>!y(ge(),Fe()));z(ct,Le=>{c(re)&&Le(q)})}A(Qe,Ee)}),j(()=>W(J,c(H).name)),A(B,K)}),A(ht,pt)},ot=ht=>{var pt=hY();A(ht,pt)};z(qe,ht=>{c(Oe).clusters.length>0?ht(it):ht(ot,-1)})}j(()=>{W(Gt,`${c(Oe).name??`Endpoint ${c(Oe).endpointId}`??""} `),W(Kt,`ep${c(Oe).endpointId??""}`)}),A(vi,Ue)}),j(()=>{W(bt,c(te).name??`Node ${c(te).nodeId}`),W(gi,`Node ID: ${c(te).nodeId??""}`)}),A(Y,ze)},Fi=Y=>{var ze=pY();A(Y,ze)};z(Zi,Y=>{c(le)?Y(mi):c(we)?Y(Ke,1):c(te)?Y(Nt,2):Y(Fi,-1)})}var ki=_(Ji,2),_i=v(ki),Ti=_(_i,2),Z=_(v(Ti),2);{var Se=Y=>{var ze=xY(),He=v(ze);j(()=>W(He,c(V).length)),A(Y,ze)};z(Z,Y=>{!c(O)&&c(V).length>0&&Y(Se)})}var Ye=_(Z,2),rt=v(Ye),Ut=_(Ti,2);{var se=Y=>{var ze=CY(),He=v(ze);{var xe=Ht=>{var ri=mY();A(Ht,ri)},bt=Ht=>{var ri=Ts(),ii=wt(ri);si(ii,17,()=>c(ie),gi=>gi.id,(gi,qt)=>{const vi=It(()=>{var it,ot;return((it=g.get(c(qt).nodeId))==null?void 0:it.name)??((ot=c(f).find(ht=>ht.nodeId===c(qt).nodeId))==null?void 0:ot.name)??null}),Oe=It(()=>{var it,ot;return c(qt).endpointId!==void 0?((ot=(it=g.get(c(qt).nodeId))==null?void 0:it.endpoints.find(ht=>ht.endpointId===c(qt).endpointId))==null?void 0:ot.name)??null:null}),Ue=It(()=>c(qt).attrName??c(qt).clusterName);var Xt=bY(),Gt=v(Xt),Ei=v(Gt),Kt=_(Gt,2);{var ue=it=>{var ot=_Y(),ht=_(wt(ot),2),pt=v(ht),Jt=_(pt);{var B=X=>{var J=wC(),he=_(wt(J)),Qe=v(he);j(()=>W(Qe,`(#${c(qt).nodeId??""})`)),A(X,J)};z(Jt,X=>{c(vi)&&X(B)})}var H=_(ht,2);let K;var ce=v(H);j(()=>{W(pt,c(vi)??`#${c(qt).nodeId}`),K=kt(H,1,"e-val svelte-1ua3isv",null,K,{"e-online":c(qt).online,"e-offline":!c(qt).online}),W(ce,c(qt).online?"online":"offline")}),A(it,ot)},qe=it=>{var ot=vY(),ht=_(wt(ot),2),pt=v(ht),Jt=_(pt);{var B=ge=>{var Ee=wC(),ct=_(wt(Ee)),q=v(ct);j(()=>W(q,`(#${c(qt).nodeId??""})`)),A(ge,Ee)};z(Jt,ge=>{c(vi)&&ge(B)})}var H=_(ht,2),K=v(H),ce=_(K);{var X=ge=>{var Ee=wC(),ct=_(wt(Ee)),q=v(ct);j(()=>W(q,`(ep ${c(qt).endpointId??""})`)),A(ge,Ee)};z(ce,ge=>{c(Oe)&&ge(X)})}var J=_(H,2),he=v(J),Qe=_(J,2),ae=v(Qe),fe=_(Qe,2),Fe=v(fe);j(ge=>{W(pt,c(vi)??`#${c(qt).nodeId}`),W(K,c(Oe)??`ep${c(qt).endpointId}`),W(he,c(qt).clusterName),W(ae,c(Ue)),W(Fe,ge)},[()=>p(c(qt).value)]),A(it,ot)};z(Kt,it=>{c(qt).kind==="status"?it(ue):it(qe,-1)})}j(it=>W(Ei,it),[()=>D(c(qt).ts)]),A(gi,Xt)}),A(Ht,ri)};z(He,Ht=>{c(ie).length===0?Ht(xe):Ht(bt,-1)})}A(Y,ze)};z(Ut,Y=>{c(O)&&Y(se)})}var me=_(Ci,2);{var Ne=Y=>{var ze=wY(),He=wt(ze),xe=_(He,2),bt=v(xe),Ht=_(v(bt),2),ri=_(bt,2);{var ii=vi=>{var Oe=EY(),Ue=v(Oe);j(()=>W(Ue,c(Rt))),A(vi,Oe)},gi=vi=>{var Oe=yY(),Ue=wt(Oe),Xt=v(Ue);cs(Xt,Gt=>m(st,Gt),()=>c(st)),A(vi,Oe)};z(ri,vi=>{c(Rt)?vi(ii):vi(gi,-1)})}var qt=_(ri,2);cs(qt,vi=>m(St,vi),()=>c(St)),$("click",He,xt),$("click",Ht,xt),A(Y,ze)};z(me,Y=>{c(ut)&&Y(Ne)})}j(()=>{qo(ki,c(O)?`height: ${c(Q)}px;`:""),W(rt,c(O)?"▾":"▸")}),$("click",cn,()=>m(oe,!c(oe))),$("mousedown",_i,de),$("click",Ye,()=>{m(O,!c(O))}),A(o,$i),Hs()}Us(["click","change","mousedown"]);var AY=F("<button>›</button>"),kY=F('<span class="chev-ph svelte-1vejtrc"></span>'),BY=F('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),FY=F("<button>🔒</button>"),LY=F('<span class="acl-loading">Loading…</span>'),IY=F("<span> </span>"),PY=F('<span class="acl-dyn svelte-1vejtrc" title="per-user/client pattern — cannot evaluate statically">⚠%u/%c</span>'),TY=F('<span class="acl-members svelte-1vejtrc"> </span>'),MY=F('<span class="acl-group svelte-1vejtrc"> </span>'),RY=F('<span> <strong class="svelte-1vejtrc"> </strong> <!> <!> <!></span>'),NY=F('<div class="acl-sec svelte-1vejtrc"><span class="acl-sec-hdr svelte-1vejtrc"> </span> <!></div>'),OY=F('<div class="acl-panel svelte-1vejtrc"><!></div>'),HY=F('<div class="tc svelte-1vejtrc"></div>'),WY=F('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!> <!></div> <!> <!></div>'),zY=F('<button class="acl-refresh svelte-1vejtrc" title="Refresh ACL data">↺</button>'),VY=F('<button title="Show ACL coverage for topics"><svg width="11" height="11" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><rect x="3" y="7" width="10" height="8" rx="1.5"></rect><path d="M5 7V5a3 3 0 0 1 6 0v2" fill="none" stroke="currentColor" stroke-width="1.8"></path></svg> ACL<!></button> <!>',1),jY=F("<option></option>"),$Y=F('<span class="pub-ok svelte-1vejtrc">✓</span>'),UY=F('<span class="pub-err svelte-1vejtrc"> </span>'),qY=F('<div class="info svelte-1vejtrc">Loading…</div>'),GY=F('<div class="info err svelte-1vejtrc"> </div>'),KY=F('<div class="info svelte-1vejtrc">No topics match.</div>'),ZY=F('<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>'),XY=F('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),YY=F('<div class="info svelte-1vejtrc">No topics yet.</div>'),QY=F('<div class="tree-wrap svelte-1vejtrc"><!></div>'),JY=F('<span class="stream-badge"> </span>'),eQ=F('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),tQ=F('<span class="s-ret svelte-1vejtrc" title="retained snapshot">&#x229B;</span>'),iQ=F('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),nQ=F('<div class="stream-body svelte-1vejtrc"><!></div>'),sQ=F('<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),oQ=F('<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>'),rQ=F('<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),aQ=F('<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 lQ(o,e){Os(e,!0);const t=(B,H=Rv)=>{const K=It(()=>c(g).has(H().path)),ce=It(()=>c(a)>=0&&H().children.size>0),X=It(()=>c(a)>=0&&H().isLeaf&&!n.has(H().path));var J=WY(),he=v(J);let Qe;var ae=v(he);{var fe=Ie=>{var Dt=AY();let Je;j(()=>{Je=kt(Dt,1,"chev svelte-1vejtrc",null,Je,{open:c(K)}),ln(Dt,"aria-label",c(K)?"Collapse":"Expand")}),$("click",Dt,()=>p(H().path)),A(Ie,Dt)},Fe=Ie=>{var Dt=kY();A(Ie,Dt)};z(ae,Ie=>{c(ce)?Ie(fe):Ie(Fe,-1)})}var ge=_(ae,2),Ee=v(ge),ct=_(ge,2);{var q=Ie=>{var Dt=BY(),Je=wt(Dt),Ve=v(Je),Xe=_(Je,2),mt=v(Xe);j((je,yt,Pe)=>{ln(Je,"title",je),W(Ve,yt),W(mt,Pe)},[()=>{var je;return dt((je=zt(H().path))==null?void 0:je.val)},()=>{var je;return dt((je=zt(H().path))==null?void 0:je.val)},()=>{var je;return((je=zt(H().path))==null?void 0:je.ts)!=null?Ft(zt(H().path).ts):""}]),A(Ie,Dt)},re=It(()=>H().isLeaf&&i.has(H().path));z(ct,Ie=>{c(re)&&Ie(q)})}var Le=_(ct,2);{var tt=Ie=>{const Dt=It(()=>!!c($i)&&Ri(H().path));var Je=FY();let Ve;j(()=>{Ve=kt(Je,1,"acl-badge svelte-1vejtrc",null,Ve,{matched:c(Dt)}),ln(Je,"title",c(Dt)?"Has explicit ACL — click to inspect":"No explicit ACL — click to inspect defaults")}),$("click",Je,Xe=>{Xe.stopPropagation(),ft(H().path)}),A(Ie,Je)};z(Le,Ie=>{c(Ai)&&H().isLeaf&&Ie(tt)})}var Me=_(he,2);{var Be=Ie=>{var Dt=OY(),Je=v(Dt);{var Ve=mt=>{var je=LY();A(mt,je)},Xe=mt=>{var je=Ts(),yt=wt(je);si(yt,17,()=>[{label:"Send",section:c(Ci).send},{label:"Subscribe",section:c(Ci).subscribe},{label:"Receive",section:c(Ci).receive}],Vi,(Pe,nt)=>{var At=NY(),Mt=v(At),_t=v(Mt),bi=_(Mt,2);{var wi=Oi=>{var Gi=IY();let Si;var ni=v(Gi);j(()=>{Si=kt(Gi,1,"acl-def svelte-1vejtrc",null,Si,{allow:c(nt).section.default,deny:!c(nt).section.default}),W(ni,`${c(nt).section.default?"allow":"deny"} (default)`)}),A(Oi,Gi)},qi=Oi=>{var Gi=Ts(),Si=wt(Gi);si(Si,17,()=>c(nt).section.roles,Vi,(ni,ei)=>{var Xi=RY();let Yi;var An=v(Xi),Qn=_(An),Es=v(Qn),os=_(Qn,2);{var Bs=zi=>{var Gs=PY();A(zi,Gs)};z(os,zi=>{c(ei).dynamic&&zi(Bs)})}var Sn=_(os,2);{var es=zi=>{var Gs=TY(),Hn=v(Gs);j(qn=>W(Hn,qn),[()=>c(ei).users.join(", ")]),A(zi,Gs)};z(Sn,zi=>{c(ei).users.length>0&&zi(es)})}var as=_(Sn,2);si(as,17,()=>c(ei).groups,Vi,(zi,Gs)=>{var Hn=MY(),qn=v(Hn);j(()=>W(qn,c(Gs).groupname)),A(zi,Hn)}),j(()=>{Yi=kt(Xi,1,"acl-role svelte-1vejtrc",null,Yi,{allow:c(ei).allow,deny:!c(ei).allow}),W(An,`${c(ei).allow?"✓":"✗"} `),W(Es,c(ei).rolename)}),A(ni,Xi)}),A(Oi,Gi)};z(bi,Oi=>{c(nt).section.roles.length===0?Oi(wi):Oi(qi,-1)})}j(()=>W(_t,c(nt).label)),A(Pe,At)}),A(mt,je)};z(Je,mt=>{c(Ji)?mt(Ve):c(Ci)&&mt(Xe,1)})}A(Ie,Dt)};z(Me,Ie=>{c(Ai)&&H().isLeaf&&c(Mi)===H().path&&Ie(Be)})}var Et=_(Me,2);{var Ct=Ie=>{var Dt=HY();si(Dt,21,()=>[...H().children.values()].sort((Je,Ve)=>Je.seg.localeCompare(Ve.seg)),Je=>Je.path,(Je,Ve)=>{t(Je,()=>c(Ve))}),A(Ie,Dt)};z(Et,Ie=>{c(ce)&&c(K)&&Ie(Ct)})}j(()=>{Qe=kt(he,1,"tr svelte-1vejtrc",null,Qe,{stale:c(X)}),W(Ee,H().seg)}),$("click",he,()=>{m(le,H().path+"/#")}),$("contextmenu",he,Ie=>{Ie.preventDefault(),m(pe,{x:Ie.clientX,y:Ie.clientY,topic:H().path},!0)}),A(B,J)},i=new Map,n=new Set,s=new Set;let r=null,a=P(0);function d(){r===null&&(r=requestAnimationFrame(()=>{r=null;for(const B of s)f(B);s.clear(),ZS(a)}))}const u=new Map;function f(B){const H=B.split("/");let K=u,ce="";for(let X=0;X<H.length;X++){const J=H[X];ce=X===0?J:`${ce}/${J}`,K.has(J)||K.set(J,{seg:J,path:ce,children:new Map,isLeaf:!1});const he=K.get(J);X===H.length-1&&(he.isLeaf=!0),K=he.children}}let g=P(Di(new Set));function p(B){const H=new Set(c(g));H.has(B)?H.delete(B):H.add(B),m(g,H,!0)}let C=P("");const b=24,E=5;let y=P(0),D=P(300),I=It(()=>{if(c(a),!c(C))return[];const B=c(C).toLowerCase().split(/\s+/).filter(Boolean),H=[];for(const[K,ce]of i){const X=K.toLowerCase();B.every(J=>X.includes(J))&&H.push({topic:K,...ce})}return H.sort((K,ce)=>K.topic.localeCompare(ce.topic))}),M=It(()=>{const B=c(I).length,H=Math.max(0,Math.floor(c(y)/b)-E),K=Math.min(B,Math.ceil((c(y)+c(D))/b)+E);return{start:H,end:K,totalH:B*b,top:H*b}});const R=1e3,T=200,V=20,O=36;let Q=0,ie=P(Di([])),de=P(Di([])),te=P(!0),le=P("#"),we=P(200);zn(()=>{const B=c(le).trim(),H=jl(()=>c(ie)),K=!B||B==="#"?H.slice(0,T):H.filter(ce=>oe(B,ce.topic)).slice(0,T);if(B&&B!=="#"){const ce=new Set(K.map(J=>J.topic)),X=[];for(const[J,he]of i)ce.has(J)||oe(B,J)&&X.push({id:-(X.length+1),topic:J,val:he.val,ts:he.ts,retained:!0});X.sort((J,he)=>J.topic.localeCompare(he.topic)),m(de,[...K,...X],!0)}else m(de,K,!0)});function oe(B,H){if(B==="#")return!0;const K=B.split("/"),ce=H.split("/");for(let X=0;X<K.length;X++){if(K[X]==="#")return!0;if(X>=ce.length||K[X]!=="+"&&K[X]!==ce[X])return!1}return K.length===ce.length}function ye(B){B.preventDefault();const H=B.clientY,K=c(we);function ce(J){m(we,Math.max(60,Math.min(800,K+H-J.clientY)),!0)}function X(){document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",X)}document.addEventListener("mousemove",ce),document.addEventListener("mouseup",X)}let Re=It(()=>{const B=Math.max(1,Math.floor((c(we)-O)/V)+1);return c(de).slice(0,B)}),ke=P(!0),_e=P(null);async function lt(){m(ke,!0),m(_e,null);try{const B=await tF();for(const H of B)i.set(H.topic,{val:H.val,ts:H.ts}),f(H.topic)}catch(B){m(_e,B instanceof Error?B.message:String(B),!0)}finally{m(ke,!1),ZS(a)}}const Te=ur("mqtt",B=>{const{topic:H,val:K,ts:ce}=B;i.set(H,{val:K,ts:ce}),n.add(H),s.add(H),d();const X={id:Q++,topic:H,val:K,ts:ce};m(ie,[X,...c(ie).slice(0,R-1)],!0);const J=c(le).trim();(!J||J==="#"||oe(J,H))&&m(de,[X,...c(de).filter(he=>!(he.retained&&he.topic===H)).slice(0,T-1)],!0)});let pe=P(null),ut=P(null);async function Rt(B,H){const K=[B];if(H){const ce=B+"/";for(const X of i.keys())X.startsWith(ce)&&K.push(X)}for(const ce of K)await XD(ce,"",!0,0)}let st=It(()=>(c(a),[...i.keys()].sort())),St=P(""),be=P(""),Tt=P(!1),xt=P(0),at=P(!1),et=P(null),Ot=P(!1);async function di(){if(c(St)){m(at,!0),m(et,null),m(Ot,!1);try{await XD(c(St),c(be),c(Tt),c(xt)),m(Ot,!0),setTimeout(()=>{m(Ot,!1)},2e3)}catch(B){m(et,B instanceof Error?B.message:String(B),!0)}finally{m(at,!1)}}}function dt(B){return B==null?"":typeof B=="object"?JSON.stringify(B):String(B)}function Ft(B){return new Date(B).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Vt(B){return new Date(B).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function zt(B){return c(a),i.get(B)}let Qt=It(()=>(c(a),[...u.values()].sort((B,H)=>B.seg.localeCompare(H.seg)))),vt=It(()=>(c(a),i.size)),Pi=P(!1),Ai=P(!1),hi=P(!1),$i=P(null),Mi=P(null),Ci=P(null),Ji=P(!1);function Ki(B,H,K){return H.includes("%u")||H.includes("%c")?"dynamic":B==="subscribeLiteral"||B==="unsubscribeLiteral"?H===K?"match":"no-match":oe(H,K)?"match":"no-match"}function Ri(B){if(!c($i))return!1;for(const H of c($i).roles)if(H.acls){for(const K of H.acls)if(Ki(K.acltype,K.topic,B)!=="no-match")return!0}return!1}async function cn(){m(hi,!0);try{const B=await lF();m($i,{roles:B.roles},!0)}catch{m($i,null),m(Ai,!1)}finally{m(hi,!1)}}async function ft(B){if(c(Mi)===B){m(Mi,null),m(Ci,null);return}m(Mi,B,!0),m(Ci,null),m(Ji,!0);try{m(Ci,await yU(B),!0)}catch{m(Ci,null)}finally{m(Ji,!1)}}async function Zt(){c(Ai)?(m(Ai,!1),m(Mi,null),m(Ci,null)):(m(Ai,!0),m(Mi,null),m(Ci,null),c($i)||await cn())}$s(lt),$s(async()=>{var B;try{const H=await R9();m(Pi,!!((B=H.dynsec)!=null&&B.dynsecReady),!0)}catch{m(Pi,!1)}}),Dp(()=>{Te(),r!==null&&cancelAnimationFrame(r)});var fi=aQ(),Ni=v(fi),Ii=_(v(Ni),2);{var Bi=B=>{var H=VY(),K=wt(H);let ce;var X=_(v(K),2);{var J=ae=>{var fe=_o("…");A(ae,fe)};z(X,ae=>{c(hi)&&ae(J)})}var he=_(K,2);{var Qe=ae=>{var fe=zY();j(()=>fe.disabled=c(hi)),$("click",fe,cn),A(ae,fe)};z(he,ae=>{c(Ai)&&ae(Qe)})}j(()=>{ce=kt(K,1,"acl-btn svelte-1vejtrc",null,ce,{active:c(Ai)}),K.disabled=c(hi)}),$("click",K,Zt),A(B,H)};z(Ii,B=>{c(Pi)&&B(Bi)})}var Wi=_(Ni,2),Zi=v(Wi),mi=v(Zi),Ke=_(mi,2);si(Ke,20,()=>c(st),B=>B,(B,H)=>{var K=jY(),ce={};j(()=>{ce!==(ce=H)&&(K.value=(K.__value=H)??"")}),A(B,K)});var Nt=_(Ke,2),Fi=_(Nt,2),ki=v(Fi),_i=_(Fi,2),Ti=v(_i);Ti.value=Ti.__value=0;var Z=_(Ti);Z.value=Z.__value=1;var Se=_(Z);Se.value=Se.__value=2;var Ye=_(_i,2),rt=_(Ye,2);{var Ut=B=>{var H=$Y();A(B,H)};z(rt,B=>{c(Ot)&&B(Ut)})}var se=_(rt,2);{var me=B=>{var H=UY(),K=v(H);j(()=>W(K,c(et))),A(B,H)};z(se,B=>{c(et)&&B(me)})}var Ne=_(Zi,2),Y=v(Ne),ze=_(Y,2),He=v(ze);{var xe=B=>{var H=_o();j(()=>W(H,`${c(I).length??""} /`)),A(B,H)};z(He,B=>{c(C)&&B(xe)})}var bt=_(He),Ht=_(Ne,2);{var ri=B=>{var H=qY();A(B,H)},ii=B=>{var H=GY(),K=v(H);j(()=>W(K,c(_e))),A(B,H)},gi=B=>{var H=Ts(),K=wt(H);{var ce=J=>{var he=KY();A(J,he)},X=J=>{var he=XY(),Qe=v(he),ae=v(Qe);si(ae,21,()=>c(I).slice(c(M).start,c(M).end),fe=>fe.topic,(fe,Fe)=>{var ge=ZY(),Ee=v(ge),ct=v(Ee),q=_(Ee,2),re=v(q),Le=_(q,2),tt=v(Le);j((Me,Be,Et)=>{W(ct,c(Fe).topic),ln(q,"title",Me),W(re,Be),W(tt,Et)},[()=>dt(c(Fe).val),()=>dt(c(Fe).val),()=>Ft(c(Fe).ts)]),A(fe,ge)}),j(()=>{qo(Qe,`height: ${c(M).totalH??""}px; position: relative;`),qo(ae,`top: ${c(M).top??""}px;`)}),ls("scroll",he,fe=>{m(y,fe.currentTarget.scrollTop,!0)}),oP(he,"clientHeight",fe=>m(D,fe)),A(J,he)};z(K,J=>{c(I).length===0?J(ce):J(X,-1)})}A(B,H)},qt=B=>{var H=QY(),K=v(H);{var ce=J=>{var he=YY();A(J,he)},X=J=>{var he=Ts(),Qe=wt(he);si(Qe,17,()=>c(Qt),ae=>ae.path,(ae,fe)=>{t(ae,()=>c(fe))}),A(J,he)};z(K,J=>{c(Qt).length===0?J(ce):J(X,-1)})}A(B,H)};z(Ht,B=>{c(ke)?B(ri):c(_e)?B(ii,1):c(C)?B(gi,2):B(qt,-1)})}var vi=_(Wi,2),Oe=v(vi),Ue=_(Oe,2),Xt=v(Ue),Gt=_(Xt,2);{var Ei=B=>{var H=JY(),K=v(H);j(()=>W(K,c(de).length)),A(B,H)};z(Gt,B=>{!c(te)&&c(de).length>0&&B(Ei)})}var Kt=_(Gt,2),ue=v(Kt),qe=_(Ue,2);{var it=B=>{var H=nQ(),K=v(H);{var ce=J=>{var he=eQ();A(J,he)},X=J=>{var he=Ts(),Qe=wt(he);si(Qe,17,()=>c(Re),ae=>ae.id,(ae,fe)=>{var Fe=iQ();let ge;var Ee=v(Fe),ct=v(Ee),q=_(Ee,2);{var re=Et=>{var Ct=tQ();A(Et,Ct)};z(q,Et=>{c(fe).retained&&Et(re)})}var Le=_(q,2),tt=v(Le),Me=_(Le,2),Be=v(Me);j((Et,Ct,Ie)=>{ge=kt(Fe,1,"sr svelte-1vejtrc",null,ge,{retained:c(fe).retained}),W(ct,Et),W(tt,c(fe).topic),ln(Me,"title",Ct),W(Be,Ie)},[()=>Vt(c(fe).ts),()=>dt(c(fe).val),()=>dt(c(fe).val)]),A(ae,Fe)}),A(J,he)};z(K,J=>{c(Re).length===0?J(ce):J(X,-1)})}A(B,H)};z(qe,B=>{c(te)&&B(it)})}var ot=_(vi,2);{var ht=B=>{var H=sQ(),K=wt(H),ce=_(K,2);let X;var J=v(ce),he=_(J,2);j(()=>X=qo(ce,"",X,{left:`${c(pe).x??""}px`,top:`${c(pe).y??""}px`})),$("click",K,()=>m(pe,null)),$("contextmenu",K,Qe=>{Qe.preventDefault(),m(pe,null)}),$("click",J,()=>{navigator.clipboard.writeText(c(pe).topic),m(pe,null)}),$("click",he,()=>{const Qe=c(pe).topic,ae=Qe+"/",fe=[...i.keys()].some(Fe=>Fe.startsWith(ae));m(ut,{topic:Qe,hasChildren:fe,recursive:!1},!0),m(pe,null)}),A(B,H)};z(ot,B=>{c(pe)&&B(ht)})}var pt=_(ot,2);{var Jt=B=>{var H=rQ(),K=wt(H),ce=_(K,2),X=_(v(ce),2),J=v(X),he=_(v(J)),Qe=v(he),ae=_(J,2);{var fe=ct=>{var q=oQ(),re=v(q);Cs(re,()=>c(ut).recursive,Le=>c(ut).recursive=Le),A(ct,q)};z(ae,ct=>{c(ut).hasChildren&&ct(fe)})}var Fe=_(X,2),ge=v(Fe),Ee=_(ge,2);j(()=>W(Qe,c(ut).topic)),$("click",K,()=>m(ut,null)),$("click",ge,()=>m(ut,null)),$("click",Ee,()=>{const{topic:ct,recursive:q}=c(ut);m(ut,null),Rt(ct,q)}),A(B,H)};z(pt,B=>{c(ut)&&B(Jt)})}j(()=>{Ye.disabled=c(at)||!c(St),W(bt,` ${c(vt)??""}`),qo(vi,c(te)?`height: ${c(we)}px;`:""),W(ue,c(te)?"▾":"▸")}),jt(mi,()=>c(St),B=>m(St,B)),jt(Nt,()=>c(be),B=>m(be,B)),Cs(ki,()=>c(Tt),B=>m(Tt,B)),Ss(_i,()=>c(xt),B=>m(xt,B)),$("click",Ye,di),jt(Y,()=>c(C),B=>m(C,B)),$("mousedown",Oe,ye),jt(Xt,()=>c(le),B=>m(le,B)),$("click",Kt,()=>{m(te,!c(te))}),A(o,fi),Hs()}Us(["click","contextmenu","mousedown"]);var cQ=F('<div class="restart-banner restart-banner--restarting svelte-twakcj">Restarting daemon…</div>'),dQ=F('<div class="restart-banner svelte-twakcj">⚠ Package changes require a daemon restart to take effect. <button class="restart-btn svelte-twakcj">Restart now</button></div>'),uQ=F('<div class="err svelte-twakcj"> </div>'),hQ=F('<span class="pane-count pane-count--warn svelte-twakcj"> </span>'),fQ=F('<p class="empty svelte-twakcj">No packages installed.</p>'),gQ=F('<p class="empty svelte-twakcj">No match.</p>'),pQ=F("<span> </span>"),xQ=r6('<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>'),mQ=r6('<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>'),_Q=F('<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><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4"></path><line x1="9" y1="15" x2="4.5" y2="19.5"></line><line x1="14.5" y1="4" x2="20" y2="9.5"></line></svg></button> <button><!></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>'),vQ=F('<span class="result-author svelte-twakcj"> </span>'),bQ=F('<span class="result-date svelte-twakcj"> </span>'),CQ=F('<span class="result-desc svelte-twakcj"> </span>'),EQ=F('<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>'),yQ=F('<div class="results-list svelte-twakcj"></div>'),wQ=F('<pre class="npm-output svelte-twakcj"> </pre>'),SQ=F(`<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>`),DQ=F('<!> <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> <!> <button class="icon-btn check-outdated-btn svelte-twakcj" title="Check for package updates"><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></button></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>',1);function AQ(o,e){Os(e,!0);let t=P(Di([])),i=P(""),n=P(Di({})),s=P(Di([])),r=P(!1),a=P(""),d=P(Di([])),u=P(!1),f=P(!1),g=P(!1),p=P(""),C=P(""),b=Di({});const E=It(()=>c(i).trim()?c(t).filter(ft=>ft.name.toLowerCase().includes(c(i).toLowerCase())):c(t)),y=It(()=>Object.keys(c(n)).filter(ft=>!c(s).includes(ft)).length);$s(async()=>{await Promise.all([D(),I(),M()])});async function D(){try{m(t,await V$(),!0),m(p,"")}catch(ft){m(p,ft.message,!0)}}async function I(){try{m(n,await JB(),!0)}catch{}}async function M(){try{const ft=await Nl();m(s,Array.isArray(ft.pinnedPackages)?ft.pinnedPackages:[],!0)}catch{}}async function R(ft){const Zt=c(s).includes(ft)?c(s).filter(fi=>fi!==ft):[...c(s),ft];m(s,Zt,!0);try{const fi=await Nl();await Jg({...fi,pinnedPackages:Zt})}catch{}}async function T(){m(r,!0);try{m(n,await G$(),!0)}catch{}finally{m(r,!1)}}async function V(){const ft=c(a).trim();if(!ft){m(d,[],!0);return}m(g,!0),m(p,"");try{m(d,await j$(ft),!0)}catch(Zt){m(p,Zt.message,!0)}finally{m(g,!1)}}function O(ft){if(!ft)return"";try{return new Date(ft).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}async function Q(ft,Zt){b[ft]=!0,m(p,""),m(C,"");try{const fi=await $$(ft,Zt);m(C,fi.stdout||fi.stderr||"Done.",!0),m(u,!0),await D()}catch(fi){m(p,fi.message,!0)}finally{b[ft]=!1}}async function ie(ft){b[ft]=!0,m(p,""),m(C,"");try{const Zt=await U$(ft);m(C,Zt.stdout||Zt.stderr||"Done.",!0),m(u,!0);const fi={...c(n)};delete fi[ft],m(n,fi,!0),await D()}catch(Zt){m(p,Zt.message,!0)}finally{b[ft]=!1}}async function de(ft){b[ft]=!0,m(p,""),m(C,"");try{const Zt=await q$(ft);m(C,Zt.stdout||Zt.stderr||"Done.",!0),m(u,!0);const fi={...c(n)};delete fi[ft],m(n,fi,!0),await D()}catch(Zt){m(p,Zt.message,!0)}finally{b[ft]=!1}}let te;async function le(){if(await te.show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"})){m(f,!0);try{await XB()}catch{}setTimeout(()=>{window.location.reload()},3e3)}}var we=DQ(),oe=wt(we);cs(Zc(oe,{}),ft=>te=ft,()=>te);var ye=_(oe,2),Re=v(ye);{var ke=ft=>{var Zt=cQ();A(ft,Zt)},_e=ft=>{var Zt=dQ(),fi=_(v(Zt));$("click",fi,le),A(ft,Zt)};z(Re,ft=>{c(f)?ft(ke):c(u)&&ft(_e,1)})}var lt=_(Re,2);{var Te=ft=>{var Zt=uQ(),fi=v(Zt);j(()=>W(fi,c(p))),A(ft,Zt)};z(lt,ft=>{c(p)&&ft(Te)})}var pe=_(lt,2),ut=v(pe),Rt=v(ut),st=_(v(Rt),2),St=v(st),be=_(st,2);{var Tt=ft=>{var Zt=hQ(),fi=v(Zt);j(()=>W(fi,`${c(y)??""} outdated`)),A(ft,Zt)};z(be,ft=>{c(y)>0&&ft(Tt)})}var xt=_(be,2),at=v(xt);let et;var Ot=_(Rt,2),di=v(Ot),dt=_(Ot,2),Ft=v(dt);{var Vt=ft=>{var Zt=fQ();A(ft,Zt)},zt=ft=>{var Zt=gQ();A(ft,Zt)},Qt=ft=>{var Zt=Ts(),fi=wt(Zt);si(fi,17,()=>c(E),Ni=>Ni.name,(Ni,Ii)=>{var Bi=_Q();let Wi;var Zi=v(Bi),mi=v(Zi),Ke=v(mi),Nt=_(mi,2),Fi=v(Nt),ki=_(Nt,2);{var _i=Y=>{var ze=pQ();let He;var xe=v(ze);j(bt=>{He=kt(ze,1,"dep-latest svelte-twakcj",null,He,bt),W(xe,`→ v${c(n)[c(Ii).name].latest??""}`)},[()=>({"dep-latest--pinned":c(s).includes(c(Ii).name)})]),A(Y,ze)};z(ki,Y=>{c(n)[c(Ii).name]&&Y(_i)})}var Ti=_(Zi,2),Z=v(Ti);let Se;var Ye=_(Z,2);let rt;var Ut=v(Ye);{var se=Y=>{var ze=xQ();A(Y,ze)},me=Y=>{var ze=mQ();A(Y,ze)};z(Ut,Y=>{b[c(Ii).name]?Y(se):Y(me,-1)})}var Ne=_(Ye,2);j((Y,ze,He)=>{Wi=kt(Bi,1,"dep-row svelte-twakcj",null,Wi,{"dep-busy":!!b[c(Ii).name]}),ln(mi,"href",c(Ii).url??`https://www.npmjs.com/package/${c(Ii).name}`),W(Ke,c(Ii).name),W(Fi,c(Ii).installedVersion??c(Ii).version),Se=kt(Z,1,"icon-btn svelte-twakcj",null,Se,Y),ln(Z,"title",ze),rt=kt(Ye,1,"icon-btn svelte-twakcj",null,rt,He),Ye.disabled=!!b[c(Ii).name],ln(Ye,"title",c(n)[c(Ii).name]?`Update to v${c(n)[c(Ii).name].latest}`:"Update to latest"),Ne.disabled=!!b[c(Ii).name]},[()=>({"icon-btn--pinned":c(s).includes(c(Ii).name)}),()=>c(s).includes(c(Ii).name)?"Unpin package":"Pin package (suppress update dot)",()=>({"icon-btn--update":!!c(n)[c(Ii).name]&&!c(s).includes(c(Ii).name)})]),$("click",Z,()=>R(c(Ii).name)),$("click",Ye,()=>de(c(Ii).name)),$("click",Ne,()=>ie(c(Ii).name)),A(Ni,Bi)}),A(ft,Zt)};z(Ft,ft=>{c(t).length===0?ft(Vt):c(E).length===0?ft(zt,1):ft(Qt,-1)})}var vt=_(ut,2),Pi=_(v(vt),2),Ai=v(Pi),hi=_(Ai,2),$i=v(hi),Mi=_(Pi,2);{var Ci=ft=>{var Zt=yQ();si(Zt,21,()=>c(d),fi=>fi.name,(fi,Ni)=>{var Ii=EQ(),Bi=v(Ii),Wi=v(Bi),Zi=v(Wi),mi=_(Wi,2),Ke=v(mi),Nt=_(mi,2);{var Fi=rt=>{var Ut=vQ(),se=v(Ut);j(()=>W(se,c(Ni).author)),A(rt,Ut)};z(Nt,rt=>{c(Ni).author&&rt(Fi)})}var ki=_(Nt,2);{var _i=rt=>{var Ut=bQ(),se=v(Ut);j(me=>{ln(Ut,"title",c(Ni).date),W(se,me)},[()=>O(c(Ni).date)]),A(rt,Ut)};z(ki,rt=>{c(Ni).date&&rt(_i)})}var Ti=_(ki,2);{var Z=rt=>{var Ut=CQ(),se=v(Ut);j(()=>W(se,c(Ni).description)),A(rt,Ut)};z(Ti,rt=>{c(Ni).description&&rt(Z)})}var Se=_(Bi,2),Ye=v(Se);j(()=>{ln(Wi,"href",c(Ni).url??`https://www.npmjs.com/package/${c(Ni).name}`),W(Zi,c(Ni).name),W(Ke,c(Ni).version),Se.disabled=!!b[c(Ni).name],W(Ye,b[c(Ni).name]?"Installing…":"Install")}),$("click",Se,()=>Q(c(Ni).name)),A(fi,Ii)}),A(ft,Zt)};z(Mi,ft=>{c(d).length>0&&ft(Ci)})}var Ji=_(Mi,2);{var Ki=ft=>{var Zt=wQ(),fi=v(Zt);j(()=>W(fi,c(C))),A(ft,Zt)};z(Ji,ft=>{c(C)&&ft(Ki)})}var Ri=_(Ji,2);{var cn=ft=>{var Zt=SQ();A(ft,Zt)};z(Ri,ft=>{!c(d).length&&!c(C)&&ft(cn)})}j(()=>{W(St,c(t).length),xt.disabled=c(r),et=kt(at,0,"svelte-twakcj",null,et,{spinning:c(r)}),hi.disabled=c(g),W($i,c(g)?"Searching…":"Search")}),$("click",xt,T),jt(di,()=>c(i),ft=>m(i,ft)),$("keydown",Ai,ft=>ft.key==="Enter"&&V()),jt(Ai,()=>c(a),ft=>m(a,ft)),$("click",hi,V),A(o,we),Hs()}Us(["click","keydown"]);var kQ=F('<div class="plugin-warning svelte-3itf14">⚠ The dynamic-security plugin is not responding. Add <code class="svelte-3itf14">plugin …/mosquitto_dynamic_security.so</code> and <code class="svelte-3itf14">plugin_opt_config_file …/dynamic-security.json</code> to your mosquitto.conf and restart mosquitto. Operations below will time out until the plugin is active.</div>'),ka=F('<div class="err svelte-3itf14"> </div>'),BQ=F('<div class="empty svelte-3itf14">No users found.</div>'),FQ=F('<span class="tag svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove role">×</button></span>'),_h=F("<option> </option>"),yx=F('<div class="inline-err svelte-3itf14"> </div>'),LA=F('<div class="inline-add svelte-3itf14"><select class="svelte-3itf14"><option>— role —</option><!></select> <button class="inline-confirm svelte-3itf14">Add</button> <button class="inline-cancel svelte-3itf14">×</button></div> <!>',1),LQ=F('<span class="tag tag--group svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove from group">×</button></span>'),IQ=F('<div class="inline-add svelte-3itf14"><select class="svelte-3itf14"><option>— group —</option><!></select> <button class="inline-confirm svelte-3itf14">Add</button> <button class="inline-cancel svelte-3itf14">×</button></div> <!>',1),PQ=F('<tr class="svelte-3itf14"><td class="mono svelte-3itf14"> </td><td class="svelte-3itf14"><div class="tags-cell svelte-3itf14"><div class="tags svelte-3itf14"><!> <button class="tag-plus svelte-3itf14" title="Add role">+</button></div> <!></div></td><td class="svelte-3itf14"><div class="tags-cell svelte-3itf14"><div class="tags svelte-3itf14"><!> <button class="tag-plus tag-plus--group svelte-3itf14" title="Add to group">+</button></div> <!></div></td><td class="cell-actions svelte-3itf14"><div class="actions svelte-3itf14"><button title="Set password" class="svelte-3itf14">🔑</button> <button class="danger svelte-3itf14" title="Delete">✕</button></div></td></tr>'),TQ=F('<table class="svelte-3itf14"><thead><tr><th class="svelte-3itf14">Username</th><th class="svelte-3itf14">Roles</th><th class="svelte-3itf14">Groups</th><th class="svelte-3itf14"></th></tr></thead><tbody></tbody></table>'),MQ=F('<div class="panel svelte-3itf14"><div class="panel-header svelte-3itf14"><h3 class="svelte-3itf14">Users</h3> <button class="btn-add svelte-3itf14">+ Add user</button></div> <!> <!></div>'),RQ=F('<div class="empty svelte-3itf14">No roles found.</div>'),NQ=F('<tr class="svelte-3itf14"><td class="mono svelte-3itf14"> </td><td class="svelte-3itf14"> </td><td class="cell-actions svelte-3itf14"><div class="actions svelte-3itf14"><button title="Edit ACLs" class="svelte-3itf14">Edit ACLs</button> <button class="danger svelte-3itf14" title="Delete">✕</button></div></td></tr>'),OQ=F('<table class="svelte-3itf14"><thead><tr><th class="svelte-3itf14">Role</th><th class="svelte-3itf14">ACLs</th><th class="svelte-3itf14"></th></tr></thead><tbody></tbody></table>'),HQ=F('<div class="panel svelte-3itf14"><div class="panel-header svelte-3itf14"><h3 class="svelte-3itf14">Roles</h3> <button class="btn-add svelte-3itf14">+ Add role</button></div> <!> <!></div>'),WQ=F('<div class="empty svelte-3itf14">No groups found.</div>'),zQ=F('<span class="tag svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove member">×</button></span>'),VQ=F('<div class="inline-add svelte-3itf14"><select class="svelte-3itf14"><option>— user —</option><!></select> <button class="inline-confirm svelte-3itf14">Add</button> <button class="inline-cancel svelte-3itf14">×</button></div> <!>',1),jQ=F('<span class="tag tag--group svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove role">×</button></span>'),$Q=F('<tr class="svelte-3itf14"><td class="mono svelte-3itf14"> </td><td class="svelte-3itf14"><div class="tags-cell svelte-3itf14"><div class="tags svelte-3itf14"><!> <button class="tag-plus svelte-3itf14" title="Add member">+</button></div> <!></div></td><td class="svelte-3itf14"><div class="tags-cell svelte-3itf14"><div class="tags svelte-3itf14"><!> <button class="tag-plus tag-plus--group svelte-3itf14" title="Add role">+</button></div> <!></div></td><td class="cell-actions svelte-3itf14"><div class="actions svelte-3itf14"><button class="danger svelte-3itf14" title="Delete">✕</button></div></td></tr>'),UQ=F('<table class="svelte-3itf14"><thead><tr><th class="svelte-3itf14">Group</th><th class="svelte-3itf14">Members</th><th class="svelte-3itf14">Roles</th><th class="svelte-3itf14"></th></tr></thead><tbody></tbody></table>'),qQ=F('<div class="panel svelte-3itf14"><div class="panel-header svelte-3itf14"><h3 class="svelte-3itf14">Groups</h3> <button class="btn-add svelte-3itf14">+ Add group</button></div> <!> <!></div>'),IA=F('<div class="empty svelte-3itf14">Loading…</div>'),GQ=F('<tr><td class="mono small svelte-3itf14"> </td><td class="acl-radio svelte-3itf14"><input type="radio" value="allow"/></td><td class="acl-radio svelte-3itf14"><input type="radio" value="deny"/></td></tr>'),KQ=F('<table class="acl-defaults-table svelte-3itf14"><thead><tr><th class="svelte-3itf14">Operation</th><th class="svelte-3itf14">Allow</th><th class="svelte-3itf14">Deny</th></tr></thead><tbody></tbody></table>'),ZQ=F('<div class="anon-current svelte-3itf14">Current: <span class="mono svelte-3itf14"> </span></div>'),XQ=F('<div class="anon-current muted svelte-3itf14">No anonymous group configured.</div>'),YQ=F('<div class="anon-row svelte-3itf14"><select class="svelte-3itf14"><option>— none —</option><!></select> <button class="svelte-3itf14"> </button></div> <!>',1),QQ=F('<div class="panel svelte-3itf14"><div class="settings-section svelte-3itf14"><h3 class="settings-heading svelte-3itf14">Default ACL Access</h3> <p class="settings-hint svelte-3itf14">Broker-wide defaults applied when no role ACL matches. Role ACLs always take precedence over these defaults.</p> <!> <!></div> <div class="settings-section svelte-3itf14"><h3 class="settings-heading svelte-3itf14">Anonymous Group</h3> <p class="settings-hint svelte-3itf14">Clients connecting without credentials are treated as members of this group. Requires <code class="svelte-3itf14">allow_anonymous true</code> in mosquitto.conf.</p> <!> <!></div></div>'),JQ=F('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal svelte-3itf14"><h3 class="svelte-3itf14">Add user</h3> <label class="svelte-3itf14">Username<input autocomplete="off" class="svelte-3itf14"/></label> <label class="svelte-3itf14">Password <div class="pw-row svelte-3itf14"><input autocomplete="new-password" class="svelte-3itf14"/> <button class="toggle-pw svelte-3itf14"> </button></div></label> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Cancel</button> <button class="btn-primary svelte-3itf14"> </button></div></div></div>'),eJ=F('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal svelte-3itf14"><h3 class="svelte-3itf14">Set password for <em class="svelte-3itf14"> </em></h3> <label class="svelte-3itf14">New password <input type="password" autocomplete="new-password" class="svelte-3itf14"/></label> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Cancel</button> <button class="btn-primary svelte-3itf14"> </button></div></div></div>'),tJ=F('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal svelte-3itf14"><h3 class="svelte-3itf14">Add role</h3> <label class="svelte-3itf14">Role name<input autocomplete="off" class="svelte-3itf14"/></label> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Cancel</button> <button class="btn-primary svelte-3itf14"> </button></div></div></div>'),iJ=F('<tr class="svelte-3itf14"><td class="mono small svelte-3itf14"> </td><td class="mono svelte-3itf14"> </td><td class="svelte-3itf14"> </td><td class="svelte-3itf14"><button class="danger">✕</button></td></tr>'),nJ=F('<table class="acl-table svelte-3itf14"><thead><tr><th class="svelte-3itf14">Type</th><th class="svelte-3itf14">Topic</th><th class="svelte-3itf14">Allow</th><th class="svelte-3itf14"></th></tr></thead><tbody></tbody></table>'),sJ=F('<div class="empty svelte-3itf14">No ACL rules yet.</div>'),oJ=F('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-3itf14"><h3 class="svelte-3itf14">ACLs for role <em class="svelte-3itf14"> </em></h3> <!> <div class="acl-add-row svelte-3itf14"><select class="svelte-3itf14"></select> <input placeholder="topic or pattern" class="svelte-3itf14"/> <label class="allow-toggle svelte-3itf14"><input type="checkbox" class="svelte-3itf14"/> Allow</label> <button class="svelte-3itf14">Add</button></div> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Close</button></div></div></div>'),rJ=F('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal svelte-3itf14"><h3 class="svelte-3itf14">Add group</h3> <label class="svelte-3itf14">Group name<input autocomplete="off" class="svelte-3itf14"/></label> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Cancel</button> <button class="btn-primary svelte-3itf14"> </button></div></div></div>'),aJ=F('<div class="users-page svelte-3itf14"><!> <div class="panel-tabs svelte-3itf14"><button>Users</button> <button>Roles</button> <button>Groups</button> <button>Settings</button> <button class="reload-btn svelte-3itf14" title="Refresh">↺</button></div> <!> <!> <!> <!></div> <!> <!> <!> <!> <!> <!>',1);function lJ(o,e){Os(e,!0);let t=wu(e,"dynsecReady",3,!1),i,n=P(Di([])),s=P(Di([])),r=P(Di([])),a=P(""),d=P(""),u=P(""),f=P("users"),g=P(null),p=P(""),C=P(""),b=P(!1);const E=It(()=>c(g)?c(g).kind==="user-roles"?c(s).map(ue=>ue.rolename).filter(ue=>{var qe,it;return!((it=(qe=c(n).find(ot=>ot.username===c(g).target))==null?void 0:qe.roles)!=null&&it.some(ot=>ot.rolename===ue))}):c(g).kind==="user-groups"?c(r).map(ue=>ue.groupname).filter(ue=>{var qe,it;return!((it=(qe=c(n).find(ot=>ot.username===c(g).target))==null?void 0:qe.groups)!=null&&it.some(ot=>ot.groupname===ue))}):c(g).kind==="group-members"?c(n).map(ue=>ue.username).filter(ue=>{var qe,it;return!((it=(qe=c(r).find(ot=>ot.groupname===c(g).target))==null?void 0:qe.clients)!=null&&it.some(ot=>ot.username===ue))}):c(s).map(ue=>ue.rolename).filter(ue=>{var qe,it;return!((it=(qe=c(r).find(ot=>ot.groupname===c(g).target))==null?void 0:qe.roles)!=null&&it.some(ot=>ot.rolename===ue))}):[]);function y(ue,qe){m(g,{kind:ue,target:qe},!0),m(p,""),m(C,"")}async function D(){if(!(!c(g)||!c(p))){m(b,!0),m(C,"");try{const{kind:ue,target:qe}=c(g);ue==="user-roles"?await dU(qe,c(p)):ue==="user-groups"?await YD(c(p),qe):ue==="group-members"?await YD(qe,c(p)):await vU(qe,c(p)),m(g,null),m(p,""),await Ci()}catch(ue){m(C,ue.message,!0)}finally{m(b,!1)}}}async function I(ue,qe){try{await uU(ue,qe),await Ci()}catch(it){m(a,it.message,!0)}}async function M(ue,qe){try{await QD(qe,ue),await Ci()}catch(it){m(a,it.message,!0)}}async function R(ue,qe){try{await QD(ue,qe),await Ci()}catch(it){m(u,it.message,!0)}}async function T(ue,qe){try{await bU(ue,qe),await Ci()}catch(it){m(u,it.message,!0)}}let V=P(!1),O=P(""),Q=P(""),ie=P(!1),de=P(""),te=P(!1),le=P(!1),we=P(""),oe=P(""),ye=P(""),Re=P(!1),ke=P(!1),_e=P(""),lt=P(""),Te=P(!1),pe=P(null),ut=P(!1),Rt=P("publishClientSend"),st=P(""),St=P(!0),be=P(""),Tt=P(!1),xt=P(""),at=P(""),et=P(!1),Ot=P(Di([])),di=P(""),dt=P(!1),Ft=P(null),Vt=P(""),zt=P(""),Qt=P(!1),vt=P(!1);const Pi=[{acltype:"publishClientSend",label:"Publish (send)"},{acltype:"publishClientReceive",label:"Publish (receive)"},{acltype:"subscribe",label:"Subscribe"},{acltype:"unsubscribe",label:"Unsubscribe"}];async function Ai(){var ue,qe;m(vt,!1),m(di,""),m(zt,"");try{const[it,ot]=await Promise.allSettled([CU(),wU()]);if(it.status==="fulfilled"){const ht=Object.fromEntries(it.value.acls.map(pt=>[pt.acltype,pt.allow]));m(Ot,Pi.map(({acltype:pt})=>({acltype:pt,allow:ht[pt]??(pt==="publishClientReceive"||pt==="unsubscribe")})),!0)}else m(di,((ue=it.reason)==null?void 0:ue.message)??"Failed to load default ACLs",!0);ot.status==="fulfilled"?(m(Ft,ot.value.group,!0),m(Vt,ot.value.group??"",!0)):m(zt,((qe=ot.reason)==null?void 0:qe.message)??"Failed to load anonymous group",!0)}finally{m(vt,!0)}}async function hi(ue,qe){m(Ot,c(Ot).map(it=>it.acltype===ue?{...it,allow:qe}:it),!0),m(dt,!0),m(di,"");try{await EU(c(Ot))}catch(it){m(di,it.message,!0)}finally{m(dt,!1)}}async function $i(){m(Qt,!0),m(zt,"");try{await SU(c(Vt)||null),m(Ft,c(Vt)||null,!0)}catch(ue){m(zt,ue.message,!0)}finally{m(Qt,!1)}}const Mi=["publishClientSend","publishClientReceive","subscribeLiteral","subscribePattern","unsubscribeLiteral","unsubscribePattern"];async function Ci(){var ue,qe,it;try{const[ot,ht,pt]=await Promise.allSettled([rU(),lF(),xU()]);ot.status==="fulfilled"?(m(n,ot.value.users,!0),m(a,"")):m(a,((ue=ot.reason)==null?void 0:ue.message)??"Failed to load users",!0),ht.status==="fulfilled"?(m(s,ht.value.roles,!0),m(d,"")):m(d,((qe=ht.reason)==null?void 0:qe.message)??"Failed to load roles",!0),pt.status==="fulfilled"?(m(r,pt.value.groups,!0),m(u,"")):m(u,((it=pt.reason)==null?void 0:it.message)??"Failed to load groups",!0)}catch{}}$s(()=>{Ci()});async function Ji(){m(de,""),m(te,!0);try{await aU(c(O),c(Q)),m(O,""),m(Q,""),m(V,!1),await Ci()}catch(ue){m(de,ue.message??"Failed to create user",!0)}finally{m(te,!1)}}async function Ki(ue){if(await i.show(`Delete user “${ue}”?`,{confirm:"Delete",danger:!0}))try{await lU(ue),await Ci()}catch(qe){m(a,qe.message,!0)}}async function Ri(ue){m(we,ue,!0),m(oe,""),m(ye,""),m(le,!0)}async function cn(){m(ye,""),m(Re,!0);try{await cU(c(we),c(oe)),m(le,!1)}catch(ue){m(ye,ue.message,!0)}finally{m(Re,!1)}}async function ft(){m(lt,""),m(Te,!0);try{await hU(c(_e)),m(_e,""),m(ke,!1),await Ci()}catch(ue){m(lt,ue.message??"Failed to create role",!0)}finally{m(Te,!1)}}async function Zt(ue){var qe;if(await i.show(`Delete role “${ue}”?`,{confirm:"Delete",danger:!0}))try{await fU(ue),((qe=c(pe))==null?void 0:qe.rolename)===ue&&(m(pe,null),m(ut,!1)),await Ci()}catch(it){m(d,it.message,!0)}}function fi(ue){m(pe,ue,!0),m(ut,!0),m(Rt,"publishClientSend"),m(st,""),m(St,!0),m(be,"")}async function Ni(){if(c(pe)){m(be,"");try{await gU(c(pe).rolename,{acltype:c(Rt),topic:c(st),allow:c(St)}),m(st,""),await Ci(),m(pe,c(s).find(ue=>ue.rolename===c(pe).rolename)??c(pe),!0)}catch(ue){m(be,ue.message,!0)}}}async function Ii(ue,qe,it){try{await pU(ue,qe,it),await Ci(),m(pe,c(s).find(ot=>ot.rolename===ue)??c(pe),!0)}catch(ot){m(be,ot.message,!0)}}async function Bi(){m(at,""),m(et,!0);try{await mU(c(xt)),m(xt,""),m(Tt,!1),await Ci()}catch(ue){m(at,ue.message??"Failed to create group",!0)}finally{m(et,!1)}}async function Wi(ue){if(await i.show(`Delete group “${ue}”?`,{confirm:"Delete",danger:!0}))try{await _U(ue),await Ci()}catch(qe){m(u,qe.message,!0)}}var Zi=aJ(),mi=wt(Zi),Ke=v(mi);{var Nt=ue=>{var qe=kQ();A(ue,qe)};z(Ke,ue=>{t()||ue(Nt)})}var Fi=_(Ke,2),ki=v(Fi);let _i;var Ti=_(ki,2);let Z;var Se=_(Ti,2);let Ye;var rt=_(Se,2);let Ut;var se=_(rt,2),me=_(Fi,2);{var Ne=ue=>{var qe=MQ(),it=v(qe),ot=_(v(it),2),ht=_(it,2);{var pt=K=>{var ce=ka(),X=v(ce);j(()=>W(X,c(a))),A(K,ce)};z(ht,K=>{c(a)&&K(pt)})}var Jt=_(ht,2);{var B=K=>{var ce=BQ();A(K,ce)},H=K=>{var ce=TQ(),X=_(v(ce));si(X,21,()=>c(n),Vi,(J,he)=>{var Qe=PQ(),ae=v(Qe),fe=v(ae),Fe=_(ae),ge=v(Fe),Ee=v(ge),ct=v(Ee);si(ct,17,()=>c(he).roles??[],Vi,(je,yt)=>{var Pe=FQ(),nt=v(Pe),At=_(nt);j(()=>W(nt,c(yt).rolename)),$("click",At,()=>I(c(he).username,c(yt).rolename)),A(je,Pe)});var q=_(ct,2),re=_(Ee,2);{var Le=je=>{var yt=LA(),Pe=wt(yt),nt=v(Pe),At=v(nt);At.value=At.__value="";var Mt=_(At);si(Mt,17,()=>c(E),Vi,(Oi,Gi)=>{var Si=_h(),ni=v(Si),ei={};j(()=>{W(ni,c(Gi)),ei!==(ei=c(Gi))&&(Si.value=(Si.__value=c(Gi))??"")}),A(Oi,Si)});var _t=_(nt,2),bi=_(_t,2),wi=_(Pe,2);{var qi=Oi=>{var Gi=yx(),Si=v(Gi);j(()=>W(Si,c(C))),A(Oi,Gi)};z(wi,Oi=>{c(C)&&Oi(qi)})}j(()=>_t.disabled=!c(p)||c(b)),Ss(nt,()=>c(p),Oi=>m(p,Oi)),$("click",_t,D),$("click",bi,()=>m(g,null)),A(je,yt)};z(re,je=>{var yt;((yt=c(g))==null?void 0:yt.kind)==="user-roles"&&c(g).target===c(he).username&&je(Le)})}var tt=_(Fe),Me=v(tt),Be=v(Me),Et=v(Be);si(Et,17,()=>c(he).groups??[],Vi,(je,yt)=>{var Pe=LQ(),nt=v(Pe),At=_(nt);j(()=>W(nt,c(yt).groupname)),$("click",At,()=>M(c(he).username,c(yt).groupname)),A(je,Pe)});var Ct=_(Et,2),Ie=_(Be,2);{var Dt=je=>{var yt=IQ(),Pe=wt(yt),nt=v(Pe),At=v(nt);At.value=At.__value="";var Mt=_(At);si(Mt,17,()=>c(E),Vi,(Oi,Gi)=>{var Si=_h(),ni=v(Si),ei={};j(()=>{W(ni,c(Gi)),ei!==(ei=c(Gi))&&(Si.value=(Si.__value=c(Gi))??"")}),A(Oi,Si)});var _t=_(nt,2),bi=_(_t,2),wi=_(Pe,2);{var qi=Oi=>{var Gi=yx(),Si=v(Gi);j(()=>W(Si,c(C))),A(Oi,Gi)};z(wi,Oi=>{c(C)&&Oi(qi)})}j(()=>_t.disabled=!c(p)||c(b)),Ss(nt,()=>c(p),Oi=>m(p,Oi)),$("click",_t,D),$("click",bi,()=>m(g,null)),A(je,yt)};z(Ie,je=>{var yt;((yt=c(g))==null?void 0:yt.kind)==="user-groups"&&c(g).target===c(he).username&&je(Dt)})}var Je=_(tt),Ve=v(Je),Xe=v(Ve),mt=_(Xe,2);j(()=>W(fe,c(he).username)),$("click",q,()=>y("user-roles",c(he).username)),$("click",Ct,()=>y("user-groups",c(he).username)),$("click",Xe,()=>Ri(c(he).username)),$("click",mt,()=>Ki(c(he).username)),A(J,Qe)}),A(K,ce)};z(Jt,K=>{c(n).length===0?K(B):K(H,-1)})}$("click",ot,()=>{m(V,!0),m(de,"")}),A(ue,qe)};z(me,ue=>{c(f)==="users"&&ue(Ne)})}var Y=_(me,2);{var ze=ue=>{var qe=HQ(),it=v(qe),ot=_(v(it),2),ht=_(it,2);{var pt=K=>{var ce=ka(),X=v(ce);j(()=>W(X,c(d))),A(K,ce)};z(ht,K=>{c(d)&&K(pt)})}var Jt=_(ht,2);{var B=K=>{var ce=RQ();A(K,ce)},H=K=>{var ce=OQ(),X=_(v(ce));si(X,21,()=>c(s),Vi,(J,he)=>{var Qe=NQ(),ae=v(Qe),fe=v(ae),Fe=_(ae),ge=v(Fe),Ee=_(Fe),ct=v(Ee),q=v(ct),re=_(q,2);j(()=>{var Le;W(fe,c(he).rolename),W(ge,((Le=c(he).acls)==null?void 0:Le.length)??0)}),$("click",q,()=>fi(c(he))),$("click",re,()=>Zt(c(he).rolename)),A(J,Qe)}),A(K,ce)};z(Jt,K=>{c(s).length===0?K(B):K(H,-1)})}$("click",ot,()=>{m(ke,!0),m(lt,""),m(_e,"")}),A(ue,qe)};z(Y,ue=>{c(f)==="roles"&&ue(ze)})}var He=_(Y,2);{var xe=ue=>{var qe=qQ(),it=v(qe),ot=_(v(it),2),ht=_(it,2);{var pt=K=>{var ce=ka(),X=v(ce);j(()=>W(X,c(u))),A(K,ce)};z(ht,K=>{c(u)&&K(pt)})}var Jt=_(ht,2);{var B=K=>{var ce=WQ();A(K,ce)},H=K=>{var ce=UQ(),X=_(v(ce));si(X,21,()=>c(r),Vi,(J,he)=>{var Qe=$Q(),ae=v(Qe),fe=v(ae),Fe=_(ae),ge=v(Fe),Ee=v(ge),ct=v(Ee);si(ct,17,()=>c(he).clients??[],Vi,(mt,je)=>{var yt=zQ(),Pe=v(yt),nt=_(Pe);j(()=>W(Pe,c(je).username)),$("click",nt,()=>R(c(he).groupname,c(je).username)),A(mt,yt)});var q=_(ct,2),re=_(Ee,2);{var Le=mt=>{var je=VQ(),yt=wt(je),Pe=v(yt),nt=v(Pe);nt.value=nt.__value="";var At=_(nt);si(At,17,()=>c(E),Vi,(qi,Oi)=>{var Gi=_h(),Si=v(Gi),ni={};j(()=>{W(Si,c(Oi)),ni!==(ni=c(Oi))&&(Gi.value=(Gi.__value=c(Oi))??"")}),A(qi,Gi)});var Mt=_(Pe,2),_t=_(Mt,2),bi=_(yt,2);{var wi=qi=>{var Oi=yx(),Gi=v(Oi);j(()=>W(Gi,c(C))),A(qi,Oi)};z(bi,qi=>{c(C)&&qi(wi)})}j(()=>Mt.disabled=!c(p)||c(b)),Ss(Pe,()=>c(p),qi=>m(p,qi)),$("click",Mt,D),$("click",_t,()=>m(g,null)),A(mt,je)};z(re,mt=>{var je;((je=c(g))==null?void 0:je.kind)==="group-members"&&c(g).target===c(he).groupname&&mt(Le)})}var tt=_(Fe),Me=v(tt),Be=v(Me),Et=v(Be);si(Et,17,()=>c(he).roles??[],Vi,(mt,je)=>{var yt=jQ(),Pe=v(yt),nt=_(Pe);j(()=>W(Pe,c(je).rolename)),$("click",nt,()=>T(c(he).groupname,c(je).rolename)),A(mt,yt)});var Ct=_(Et,2),Ie=_(Be,2);{var Dt=mt=>{var je=LA(),yt=wt(je),Pe=v(yt),nt=v(Pe);nt.value=nt.__value="";var At=_(nt);si(At,17,()=>c(E),Vi,(qi,Oi)=>{var Gi=_h(),Si=v(Gi),ni={};j(()=>{W(Si,c(Oi)),ni!==(ni=c(Oi))&&(Gi.value=(Gi.__value=c(Oi))??"")}),A(qi,Gi)});var Mt=_(Pe,2),_t=_(Mt,2),bi=_(yt,2);{var wi=qi=>{var Oi=yx(),Gi=v(Oi);j(()=>W(Gi,c(C))),A(qi,Oi)};z(bi,qi=>{c(C)&&qi(wi)})}j(()=>Mt.disabled=!c(p)||c(b)),Ss(Pe,()=>c(p),qi=>m(p,qi)),$("click",Mt,D),$("click",_t,()=>m(g,null)),A(mt,je)};z(Ie,mt=>{var je;((je=c(g))==null?void 0:je.kind)==="group-roles"&&c(g).target===c(he).groupname&&mt(Dt)})}var Je=_(tt),Ve=v(Je),Xe=v(Ve);j(()=>W(fe,c(he).groupname)),$("click",q,()=>y("group-members",c(he).groupname)),$("click",Ct,()=>y("group-roles",c(he).groupname)),$("click",Xe,()=>Wi(c(he).groupname)),A(J,Qe)}),A(K,ce)};z(Jt,K=>{c(r).length===0?K(B):K(H,-1)})}$("click",ot,()=>{m(Tt,!0),m(at,""),m(xt,"")}),A(ue,qe)};z(He,ue=>{c(f)==="groups"&&ue(xe)})}var bt=_(He,2);{var Ht=ue=>{var qe=QQ(),it=v(qe),ot=_(v(it),4);{var ht=Qe=>{var ae=ka(),fe=v(ae);j(()=>W(fe,c(di))),A(Qe,ae)};z(ot,Qe=>{c(di)&&Qe(ht)})}var pt=_(ot,2);{var Jt=Qe=>{var ae=IA();A(Qe,ae)},B=Qe=>{var ae=KQ(),fe=_(v(ae));si(fe,21,()=>Pi,Vi,(Fe,ge)=>{let Ee=()=>c(ge).acltype,ct=()=>c(ge).label;const q=It(()=>c(Ot).find(Dt=>Dt.acltype===Ee()));var re=GQ();let Le;var tt=v(re),Me=v(tt),Be=_(tt),Et=v(Be),Ct=_(Be),Ie=v(Ct);j(()=>{var Dt,Je;Le=kt(re,1,"svelte-3itf14",null,Le,{saving:c(dt)}),W(Me,ct()),ln(Et,"name",Ee()),da(Et,((Dt=c(q))==null?void 0:Dt.allow)===!0),ln(Ie,"name",Ee()),da(Ie,((Je=c(q))==null?void 0:Je.allow)===!1)}),$("change",Et,()=>hi(Ee(),!0)),$("change",Ie,()=>hi(Ee(),!1)),A(Fe,re)}),A(Qe,ae)};z(pt,Qe=>{c(vt)?Qe(B,-1):Qe(Jt)})}var H=_(it,2),K=_(v(H),4);{var ce=Qe=>{var ae=ka(),fe=v(ae);j(()=>W(fe,c(zt))),A(Qe,ae)};z(K,Qe=>{c(zt)&&Qe(ce)})}var X=_(K,2);{var J=Qe=>{var ae=IA();A(Qe,ae)},he=Qe=>{var ae=YQ(),fe=wt(ae),Fe=v(fe),ge=v(Fe);ge.value=ge.__value="";var Ee=_(ge);si(Ee,17,()=>c(r),Vi,(Me,Be)=>{var Et=_h(),Ct=v(Et),Ie={};j(()=>{W(Ct,c(Be).groupname),Ie!==(Ie=c(Be).groupname)&&(Et.value=(Et.__value=c(Be).groupname)??"")}),A(Me,Et)});var ct=_(Fe,2),q=v(ct),re=_(fe,2);{var Le=Me=>{var Be=ZQ(),Et=_(v(Be)),Ct=v(Et);j(()=>W(Ct,c(Ft))),A(Me,Be)},tt=Me=>{var Be=XQ();A(Me,Be)};z(re,Me=>{c(Ft)?Me(Le):Me(tt,-1)})}j(()=>{ct.disabled=c(Qt)||c(Vt)===(c(Ft)??""),W(q,c(Qt)?"Saving…":"Save")}),Ss(Fe,()=>c(Vt),Me=>m(Vt,Me)),$("click",ct,$i),A(Qe,ae)};z(X,Qe=>{c(vt)?Qe(he,-1):Qe(J)})}A(ue,qe)};z(bt,ue=>{c(f)==="settings"&&ue(Ht)})}var ri=_(mi,2);{var ii=ue=>{var qe=JQ(),it=v(qe),ot=_(v(it),2),ht=_(v(ot)),pt=_(ot,2),Jt=_(v(pt)),B=v(Jt),H=_(B,2),K=v(H),ce=_(pt,2);{var X=fe=>{var Fe=ka(),ge=v(Fe);j(()=>W(ge,c(de))),A(fe,Fe)};z(ce,fe=>{c(de)&&fe(X)})}var J=_(ce,2),he=v(J),Qe=_(he,2),ae=v(Qe);j(()=>{ln(B,"type",c(ie)?"text":"password"),W(K,c(ie)?"Hide":"Show"),Qe.disabled=c(te)||!c(O)||!c(Q),W(ae,c(te)?"Creating…":"Create")}),jt(ht,()=>c(O),fe=>m(O,fe)),jt(B,()=>c(Q),fe=>m(Q,fe)),$("click",H,()=>m(ie,!c(ie))),$("click",he,()=>m(V,!1)),$("click",Qe,Ji),A(ue,qe)};z(ri,ue=>{c(V)&&ue(ii)})}var gi=_(ri,2);{var qt=ue=>{var qe=eJ(),it=v(qe),ot=v(it),ht=_(v(ot)),pt=v(ht),Jt=_(ot,2),B=_(v(Jt)),H=_(Jt,2);{var K=Qe=>{var ae=ka(),fe=v(ae);j(()=>W(fe,c(ye))),A(Qe,ae)};z(H,Qe=>{c(ye)&&Qe(K)})}var ce=_(H,2),X=v(ce),J=_(X,2),he=v(J);j(()=>{W(pt,c(we)),J.disabled=c(Re)||!c(oe),W(he,c(Re)?"Saving…":"Set password")}),jt(B,()=>c(oe),Qe=>m(oe,Qe)),$("click",X,()=>m(le,!1)),$("click",J,cn),A(ue,qe)};z(gi,ue=>{c(le)&&ue(qt)})}var vi=_(gi,2);{var Oe=ue=>{var qe=tJ(),it=v(qe),ot=_(v(it),2),ht=_(v(ot)),pt=_(ot,2);{var Jt=X=>{var J=ka(),he=v(J);j(()=>W(he,c(lt))),A(X,J)};z(pt,X=>{c(lt)&&X(Jt)})}var B=_(pt,2),H=v(B),K=_(H,2),ce=v(K);j(()=>{K.disabled=c(Te)||!c(_e),W(ce,c(Te)?"Creating…":"Create")}),jt(ht,()=>c(_e),X=>m(_e,X)),$("click",H,()=>m(ke,!1)),$("click",K,ft),A(ue,qe)};z(vi,ue=>{c(ke)&&ue(Oe)})}var Ue=_(vi,2);{var Xt=ue=>{var qe=oJ(),it=v(qe),ot=v(it),ht=_(v(ot)),pt=v(ht),Jt=_(ot,2);{var B=Ee=>{var ct=nJ(),q=_(v(ct));si(q,21,()=>c(pe).acls??[],Vi,(re,Le)=>{var tt=iJ(),Me=v(tt),Be=v(Me),Et=_(Me),Ct=v(Et),Ie=_(Et),Dt=v(Ie),Je=_(Ie),Ve=v(Je);j(()=>{W(Be,c(Le).acltype),W(Ct,c(Le).topic),W(Dt,c(Le).allow?"✓":"✗")}),$("click",Ve,()=>Ii(c(pe).rolename,c(Le).acltype,c(Le).topic)),A(re,tt)}),A(Ee,ct)},H=Ee=>{var ct=sJ();A(Ee,ct)};z(Jt,Ee=>{var ct;(((ct=c(pe).acls)==null?void 0:ct.length)??0)>0?Ee(B):Ee(H,-1)})}var K=_(Jt,2),ce=v(K);si(ce,21,()=>Mi,Vi,(Ee,ct)=>{var q=_h(),re=v(q),Le={};j(()=>{W(re,c(ct)),Le!==(Le=c(ct))&&(q.value=(q.__value=c(ct))??"")}),A(Ee,q)});var X=_(ce,2),J=_(X,2),he=v(J),Qe=_(J,2),ae=_(K,2);{var fe=Ee=>{var ct=ka(),q=v(ct);j(()=>W(q,c(be))),A(Ee,ct)};z(ae,Ee=>{c(be)&&Ee(fe)})}var Fe=_(ae,2),ge=v(Fe);j(()=>{W(pt,c(pe).rolename),Qe.disabled=!c(st)}),Ss(ce,()=>c(Rt),Ee=>m(Rt,Ee)),jt(X,()=>c(st),Ee=>m(st,Ee)),Cs(he,()=>c(St),Ee=>m(St,Ee)),$("click",Qe,Ni),$("click",ge,()=>m(ut,!1)),A(ue,qe)};z(Ue,ue=>{c(ut)&&c(pe)&&ue(Xt)})}var Gt=_(Ue,2);{var Ei=ue=>{var qe=rJ(),it=v(qe),ot=_(v(it),2),ht=_(v(ot)),pt=_(ot,2);{var Jt=X=>{var J=ka(),he=v(J);j(()=>W(he,c(at))),A(X,J)};z(pt,X=>{c(at)&&X(Jt)})}var B=_(pt,2),H=v(B),K=_(H,2),ce=v(K);j(()=>{K.disabled=c(et)||!c(xt),W(ce,c(et)?"Creating…":"Create")}),jt(ht,()=>c(xt),X=>m(xt,X)),$("click",H,()=>m(Tt,!1)),$("click",K,Bi),A(ue,qe)};z(Gt,ue=>{c(Tt)&&ue(Ei)})}var Kt=_(Gt,2);cs(Zc(Kt,{}),ue=>i=ue,()=>i),j(()=>{_i=kt(ki,1,"svelte-3itf14",null,_i,{active:c(f)==="users"}),Z=kt(Ti,1,"svelte-3itf14",null,Z,{active:c(f)==="roles"}),Ye=kt(Se,1,"svelte-3itf14",null,Ye,{active:c(f)==="groups"}),Ut=kt(rt,1,"svelte-3itf14",null,Ut,{active:c(f)==="settings"})}),$("click",ki,()=>m(f,"users")),$("click",Ti,()=>m(f,"roles")),$("click",Se,()=>m(f,"groups")),$("click",rt,()=>{m(f,"settings"),c(vt)||Ai()}),$("click",se,Ci),A(o,Zi),Hs()}Us(["click","change"]);var PA=F('<div class="err svelte-9i68x"> </div>'),cJ=F('<div class="ok svelte-9i68x">Saved.</div>'),dJ=F('<div class="reload-msg svelte-9i68x"> </div>'),uJ=F('<div class="loading svelte-9i68x">Loading…</div>'),hJ=F('<div class="anon-row svelte-9i68x"><span class="field-label svelte-9i68x"><code class="svelte-9i68x">allow_anonymous</code></span> <select class="svelte-9i68x"><option>auto (broker default)</option><option>true — allow unauthenticated clients</option><option>false — require authentication</option></select></div>'),fJ=F("<option></option>"),gJ=F('<div class="tls-section svelte-9i68x"><div class="field-row svelte-9i68x"><label class="svelte-9i68x">Certificate file (certfile) <input placeholder="/etc/mosquitto/certs/server.crt" class="svelte-9i68x"/></label> <label class="svelte-9i68x">Key file (keyfile) <input placeholder="/etc/mosquitto/certs/server.key" class="svelte-9i68x"/></label></div> <div class="field-row svelte-9i68x"><label class="svelte-9i68x">CA file (cafile) — single CA cert <input placeholder="/etc/mosquitto/ca.crt" class="svelte-9i68x"/></label> <label class="svelte-9i68x">CA path (capath) — CA cert directory <input placeholder="/etc/mosquitto/ca-certs/" class="svelte-9i68x"/></label></div> <div class="field-row svelte-9i68x"><label class="svelte-9i68x">CRL file (crlfile) <input placeholder="/etc/mosquitto/crl.pem" class="svelte-9i68x"/></label> <label class="svelte-9i68x">TLS version <select class="svelte-9i68x"><option>Default</option><option>tlsv1.3</option><option>tlsv1.2</option></select></label></div> <div class="field-row svelte-9i68x"><label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> Require client certificate (require_certificate)</label> <label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> Use cert CN as username (use_identity_as_username)</label></div></div>'),pJ=F('<div class="field-row svelte-9i68x"><label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> Use cert Subject as username (use_subject_as_username)</label></div>'),xJ=F('<div class="advanced-section svelte-9i68x"><div class="field-row svelte-9i68x"><label class="svelte-9i68x">Mount point <input placeholder="(none)" class="svelte-9i68x"/></label> <label class="svelte-9i68x">Max connections <input type="number" min="-1" placeholder="-1 (unlimited)" class="svelte-9i68x"/></label> <label class="svelte-9i68x">Max QoS <select class="svelte-9i68x"><option>default</option><option>0 — fire and forget</option><option>1 — at least once</option><option>2 — exactly once</option></select></label></div> <!></div>'),mJ=F('<div class="auth-section svelte-9i68x"><div class="auth-section-title svelte-9i68x">Authentication</div> <div class="field-row svelte-9i68x"><label class="svelte-9i68x">allow_anonymous <select class="svelte-9i68x"><option>auto (broker default)</option><option>true — allow unauthenticated</option><option>false — require auth</option></select></label> <label class="svelte-9i68x">password_file <input placeholder="/etc/mosquitto/passwd" class="svelte-9i68x"/></label> <label class="svelte-9i68x">acl_file <input placeholder="/etc/mosquitto/acl" class="svelte-9i68x"/></label></div></div>'),_J=F('<div class="listener-card svelte-9i68x"><div class="card-title svelte-9i68x"><span> </span> <button class="remove-btn svelte-9i68x" title="Remove listener">✕</button></div> <div class="field-row svelte-9i68x"><label class="svelte-9i68x">Port <input type="number" min="1" max="65535" class="svelte-9i68x"/></label> <label class="svelte-9i68x">Protocol <select class="svelte-9i68x"><option>mqtt</option><option>websockets</option></select></label> <label class="svelte-9i68x">Bind address <input placeholder="(all interfaces)" class="svelte-9i68x"/></label> <label class="toggle-label tls-inline svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> TLS</label></div> <datalist></datalist> <!> <button class="advanced-btn svelte-9i68x"> </button> <!> <!></div>'),vJ=F('<div class="empty svelte-9i68x">No listeners configured. Click "+ Add listener" to create one.</div>'),bJ=F('<div class="global-settings svelte-9i68x"><label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> <span><code>per_listener_settings</code> — independent auth per listener</span> <span class="info-icon svelte-9i68x" title="Not recommended when using the dynamic-security plugin — dynsec credentials only apply to the default listener. See mosquitto documentation.">ℹ</span></label> <!></div> <div class="cards svelte-9i68x"><!> <!></div>',1),CJ=F('<div class="listeners-page svelte-9i68x"><div class="page-header svelte-9i68x"><h3 class="svelte-9i68x">Listeners</h3> <div class="header-actions svelte-9i68x"><button class="svelte-9i68x">+ Add listener</button> <button class="btn-save svelte-9i68x"> </button> <button class="btn-reload svelte-9i68x" title="Apply &amp; Reload mosquitto"> </button></div></div> <!> <!> <!> <!> <!></div>');function EJ(o,e){Os(e,!0);let t=P(null),i=P(""),n=P(!1),s=P(""),r=P(!1),a=P(!1),d=P(""),u=P(Di([])),f=P(null),g=P(!1),p=P(""),C=P(Di([])),b=P(Di(new Set));$s(()=>{E(),tU().then(be=>{m(C,be.addresses,!0)}).catch(()=>{})});async function E(){try{m(t,await N9(),!0),m(u,JSON.parse(JSON.stringify(c(t).listeners)),!0),m(f,c(t).checksum,!0);const be=c(t).managed.allow_anonymous;m(p,be==="true"||be==="false"?be:"",!0),m(g,c(t).managed.per_listener_settings==="true"),m(i,"")}catch(be){m(i,be.message??"Failed to load broker config",!0)}}function y(){m(u,[...c(u),{port:1883,bindAddress:"",protocol:"mqtt",tls:{}}],!0),m(b,new Set(c(b)),!0)}function D(be){const Tt=new Set(c(b));Tt.has(be)?Tt.delete(be):Tt.add(be),m(b,Tt,!0)}function I(be){m(u,c(u).filter((Tt,xt)=>xt!==be),!0)}async function M(){if(c(t)){m(n,!0),m(s,""),m(r,!1);try{const be={...c(t).managed};c(g)?(be.per_listener_settings="true",delete be.allow_anonymous):(delete be.per_listener_settings,c(p)?be.allow_anonymous=c(p):delete be.allow_anonymous),await rF({listeners:c(u),managed:be,passthrough:c(t).passthrough,checksum:c(f)}),m(r,!0),setTimeout(()=>m(r,!1),3e3),await E()}catch(be){m(s,be.message??"Save failed",!0)}finally{m(n,!1)}}}async function R(){m(a,!0),m(d,"");try{const be=await aF();m(d,be.stderr||be.stdout||"Reloaded",!0)}catch(be){m(d,"Error: "+(be.message??"reload failed"))}finally{m(a,!1)}}function T(be){var Tt,xt,at,et;return!!((Tt=be.tls)!=null&&Tt.certfile||(xt=be.tls)!=null&&xt.keyfile||(at=be.tls)!=null&&at.capath||(et=be.tls)!=null&&et.cafile)}function V(be,Tt){Tt||(be.tls={}),m(u,[...c(u)],!0)}var O=CJ(),Q=v(O),ie=_(v(Q),2),de=v(ie),te=_(de,2),le=v(te),we=_(te,2),oe=v(we),ye=_(Q,2);{var Re=be=>{var Tt=PA(),xt=v(Tt);j(()=>W(xt,c(i))),A(be,Tt)};z(ye,be=>{c(i)&&be(Re)})}var ke=_(ye,2);{var _e=be=>{var Tt=PA(),xt=v(Tt);j(()=>W(xt,c(s))),A(be,Tt)};z(ke,be=>{c(s)&&be(_e)})}var lt=_(ke,2);{var Te=be=>{var Tt=cJ();A(be,Tt)};z(lt,be=>{c(r)&&be(Te)})}var pe=_(lt,2);{var ut=be=>{var Tt=dJ(),xt=v(Tt);j(()=>W(xt,c(d))),A(be,Tt)};z(pe,be=>{c(d)&&be(ut)})}var Rt=_(pe,2);{var st=be=>{var Tt=uJ();A(be,Tt)},St=be=>{var Tt=bJ(),xt=wt(Tt),at=v(xt),et=v(at),Ot=_(at,2);{var di=Qt=>{var vt=hJ(),Pi=_(v(vt),2),Ai=v(Pi);Ai.value=Ai.__value="";var hi=_(Ai);hi.value=hi.__value="true";var $i=_(hi);$i.value=$i.__value="false",Ss(Pi,()=>c(p),Mi=>m(p,Mi)),A(Qt,vt)};z(Ot,Qt=>{c(g)||Qt(di)})}var dt=_(xt,2),Ft=v(dt);si(Ft,17,()=>c(u),Vi,(Qt,vt,Pi)=>{var Ai=_J(),hi=v(Ai),$i=v(hi),Mi=v($i),Ci=_($i,2),Ji=_(hi,2),Ki=v(Ji),Ri=_(v(Ki)),cn=_(Ki,2),ft=_(v(cn)),Zt=v(ft);Zt.value=Zt.__value="mqtt";var fi=_(Zt);fi.value=fi.__value="websockets";var Ni=_(cn,2),Ii=_(v(Ni));ln(Ii,"list",`bind-addr-list-${Pi}`);var Bi=_(Ni,2),Wi=v(Bi),Zi=_(Ji,2);ln(Zi,"id",`bind-addr-list-${Pi}`),si(Zi,21,()=>c(C),Vi,(rt,Ut)=>{var se=fJ(),me={};j(()=>{me!==(me=c(Ut))&&(se.value=(se.__value=c(Ut))??"")}),A(rt,se)});var mi=_(Zi,2);{var Ke=rt=>{var Ut=gJ(),se=v(Ut),me=v(se),Ne=_(v(me)),Y=_(me,2),ze=_(v(Y)),He=_(se,2),xe=v(He),bt=_(v(xe)),Ht=_(xe,2),ri=_(v(Ht)),ii=_(He,2),gi=v(ii),qt=_(v(gi)),vi=_(gi,2),Oe=_(v(vi)),Ue=v(Oe);Ue.value=Ue.__value="";var Xt=_(Ue);Xt.value=Xt.__value="tlsv1.3";var Gt=_(Xt);Gt.value=Gt.__value="tlsv1.2";var Ei=_(ii,2),Kt=v(Ei),ue=v(Kt),qe=_(Kt,2),it=v(qe);jt(Ne,()=>c(vt).tls.certfile,ot=>c(vt).tls.certfile=ot),jt(ze,()=>c(vt).tls.keyfile,ot=>c(vt).tls.keyfile=ot),jt(bt,()=>c(vt).tls.cafile,ot=>c(vt).tls.cafile=ot),jt(ri,()=>c(vt).tls.capath,ot=>c(vt).tls.capath=ot),jt(qt,()=>c(vt).tls.crlfile,ot=>c(vt).tls.crlfile=ot),Ss(Oe,()=>c(vt).tls.tls_version,ot=>c(vt).tls.tls_version=ot),Cs(ue,()=>c(vt).tls.require_certificate,ot=>c(vt).tls.require_certificate=ot),Cs(it,()=>c(vt).tls.use_identity_as_username,ot=>c(vt).tls.use_identity_as_username=ot),A(rt,Ut)},Nt=It(()=>T(c(vt)));z(mi,rt=>{c(Nt)&&rt(Ke)})}var Fi=_(mi,2),ki=v(Fi),_i=_(Fi,2);{var Ti=rt=>{var Ut=xJ(),se=v(Ut),me=v(se),Ne=_(v(me)),Y=_(me,2),ze=_(v(Y)),He=_(Y,2),xe=_(v(He)),bt=v(xe);bt.value=bt.__value="";var Ht=_(bt);Ht.value=Ht.__value="0";var ri=_(Ht);ri.value=ri.__value="1";var ii=_(ri);ii.value=ii.__value="2";var gi;t1(xe);var qt=_(se,2);{var vi=Ue=>{var Xt=pJ(),Gt=v(Xt),Ei=v(Gt);Cs(Ei,()=>c(vt).tls.use_subject_as_username,Kt=>c(vt).tls.use_subject_as_username=Kt),A(Ue,Xt)},Oe=It(()=>T(c(vt)));z(qt,Ue=>{c(Oe)&&Ue(vi)})}j(Ue=>{gi!==(gi=Ue)&&(xe.value=(xe.__value=Ue)??"",pm(xe,Ue))},[()=>c(vt).max_qos!==void 0?String(c(vt).max_qos):""]),jt(Ne,()=>c(vt).mount_point,Ue=>c(vt).mount_point=Ue),jt(ze,()=>c(vt).max_connections,Ue=>c(vt).max_connections=Ue),$("change",xe,Ue=>{const Xt=Ue.target.value;c(vt).max_qos=Xt===""?void 0:Number(Xt),m(u,[...c(u)],!0)}),A(rt,Ut)},Z=It(()=>c(b).has(Pi));z(_i,rt=>{c(Z)&&rt(Ti)})}var Se=_(_i,2);{var Ye=rt=>{var Ut=mJ(),se=_(v(Ut),2),me=v(se),Ne=_(v(me)),Y=v(Ne);Y.value=Y.__value="";var ze=_(Y);ze.value=ze.__value="true";var He=_(ze);He.value=He.__value="false";var xe;t1(Ne);var bt=_(me,2),Ht=_(v(bt)),ri=_(bt,2),ii=_(v(ri));j(()=>{xe!==(xe=c(vt).allow_anonymous===void 0?"":c(vt).allow_anonymous?"true":"false")&&(Ne.value=Ne.__value=c(vt).allow_anonymous===void 0?"":c(vt).allow_anonymous?"true":"false",pm(Ne,c(vt).allow_anonymous===void 0?"":c(vt).allow_anonymous?"true":"false"))}),$("change",Ne,gi=>{const qt=gi.target.value;c(vt).allow_anonymous=qt===""?void 0:qt==="true",m(u,[...c(u)],!0)}),jt(Ht,()=>c(vt).password_file,gi=>c(vt).password_file=gi),jt(ii,()=>c(vt).acl_file,gi=>c(vt).acl_file=gi),A(rt,Ut)};z(Se,rt=>{c(g)&&rt(Ye)})}j((rt,Ut)=>{W(Mi,`Port ${c(vt).port??""}`),da(Wi,rt),W(ki,`${Ut??""} Advanced`)},[()=>T(c(vt)),()=>c(b).has(Pi)?"▾":"▸"]),$("click",Ci,()=>I(Pi)),jt(Ri,()=>c(vt).port,rt=>c(vt).port=rt),Ss(ft,()=>c(vt).protocol,rt=>c(vt).protocol=rt),jt(Ii,()=>c(vt).bindAddress,rt=>c(vt).bindAddress=rt),$("change",Wi,rt=>V(c(vt),rt.target.checked)),$("click",Fi,()=>D(Pi)),A(Qt,Ai)});var Vt=_(Ft,2);{var zt=Qt=>{var vt=vJ();A(Qt,vt)};z(Vt,Qt=>{c(u).length===0&&Qt(zt)})}Cs(et,()=>c(g),Qt=>m(g,Qt)),A(be,Tt)};z(Rt,be=>{c(t)===null&&!c(i)?be(st):be(St,-1)})}j(()=>{te.disabled=c(n),W(le,c(n)?"Saving…":"Save"),we.disabled=c(a),W(oe,c(a)?"Reloading…":"Apply & Reload")}),$("click",de,y),$("click",te,M),$("click",we,R),A(o,O),Hs()}Us(["click","change"]);var TA=F('<div class="err svelte-1by6o5t"> </div>'),yJ=F('<div class="ok svelte-1by6o5t">Saved.</div>'),wJ=F('<div class="reload-msg svelte-1by6o5t"> </div>'),SC=F('<label class="check-label svelte-1by6o5t"><input type="checkbox" class="svelte-1by6o5t"/> </label>'),SJ=F('<label class="check-label svelte-1by6o5t"><input type="checkbox" class="svelte-1by6o5t"/> <strong> </strong></label>'),DJ=F(`<div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Logging</h4> <div class="field svelte-1by6o5t"><span class="field-key svelte-1by6o5t">log_dest</span> <div class="checkbox-group svelte-1by6o5t"></div> <p class="hint svelte-1by6o5t">Log destinations. Enable <code class="svelte-1by6o5t">topic</code> to stream logs to <code class="svelte-1by6o5t">$SYS/broker/log/*</code> and view them in the Logs tab. <code class="svelte-1by6o5t">none</code> disables logging entirely.</p></div> <div class="field svelte-1by6o5t"><span class="field-key svelte-1by6o5t">log_type</span> <div class="log-type-grid svelte-1by6o5t"><div class="log-type-group svelte-1by6o5t"><span class="log-type-group-label svelte-1by6o5t">Severity</span> <!></div> <div class="log-type-group svelte-1by6o5t"><span class="log-type-group-label svelte-1by6o5t">Events</span> <!></div> <div class="log-type-group log-type-group--other svelte-1by6o5t"><!> <span class="all-hint svelte-1by6o5t">enables all types above</span></div></div> <p class="hint svelte-1by6o5t">Types of messages to log. Leave all unchecked to use the broker default.</p></div></div> <div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Connection limits</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_connections</span> <input placeholder="−1 (unlimited)" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Maximum simultaneous client connections. <code class="svelte-1by6o5t">-1</code> = unlimited.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_keepalive</span> <input placeholder="65535" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Maximum keepalive value (seconds) a client may request. <code class="svelte-1by6o5t">0</code> = unlimited.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_inflight_messages</span> <input placeholder="20" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Max simultaneous unacknowledged QoS 1/2 messages per client.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_queued_messages</span> <input placeholder="100" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Max messages queued for a disconnected persistent client.</p></div></div></div> <div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Packet &amp; payload size</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_packet_size</span> <input placeholder="0 (no limit)" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Maximum MQTT packet size in bytes (MQTT v5 only). <code class="svelte-1by6o5t">0</code> = no limit.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">message_size_limit</span> <input placeholder="0 (no limit)" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Maximum payload size in bytes for published messages. <code class="svelte-1by6o5t">0</code> = no limit.</p></div></div></div> <div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Sessions &amp; persistence</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">persistent_client_expiration</span> <input placeholder="e.g. 7d, 2h, 30m" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Expire persistent sessions after this duration. Suffix: <code class="svelte-1by6o5t">d</code>/<code class="svelte-1by6o5t">h</code>/<code class="svelte-1by6o5t">m</code>/<code class="svelte-1by6o5t">s</code>. Empty = never expire.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">retain_available</span> <select class="svelte-1by6o5t"><option>auto (broker default)</option><option>true — allow retained messages</option><option>false — disable retained messages globally</option></select></label> <p class="hint svelte-1by6o5t">Disable retained messages broker-wide.</p></div></div></div> <div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Performance</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">set_tcp_nodelay</span> <select class="svelte-1by6o5t"><option>auto (broker default)</option><option>true — disable Nagle (lower latency)</option><option>false — enable Nagle</option></select></label> <p class="hint svelte-1by6o5t">Disable Nagle's algorithm to reduce latency at the cost of slightly more packets.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">connection_messages</span> <select class="svelte-1by6o5t"><option>auto (broker default)</option><option>true — log connect/disconnect</option><option>false — suppress</option></select></label> <p class="hint svelte-1by6o5t">Log a message on every client connect and disconnect.</p></div></div></div>`,1),AJ=F('<div class="config-page svelte-1by6o5t"><div class="page-header svelte-1by6o5t"><h3 class="svelte-1by6o5t">Global config</h3> <div class="header-actions svelte-1by6o5t"><button class="btn-save svelte-1by6o5t"> </button> <button class="btn-reload svelte-1by6o5t"> </button></div></div> <!> <!> <!> <!> <!></div>');function kJ(o,e){Os(e,!0);let t=P(null),i=P(""),n=P(!1),s=P(""),r=P(!1),a=P(!1),d=P(""),u=P(null),f=P(""),g=P(""),p=P(""),C=P(""),b=P(""),E=P(""),y=P(""),D=P(""),I=P(""),M=P("");const R=["file","stdout","stderr","syslog","topic","none"],T=["error","warning","notice","information","debug"],V=["connect","disconnect","subscribe","unsubscribe","publish","receive","websockets"],O=["all"];[...T,...V,...O];let Q=P(Di(new Set)),ie=P(Di(new Set));function de(dt,Ft){const Vt=new Set(dt);return Vt.has(Ft)?Vt.delete(Ft):Vt.add(Ft),Vt}function te(dt){if(!c(t))return"";const Ft=c(t).managed[dt];return Array.isArray(Ft)?Ft[0]:Ft??""}function le(dt){if(!c(t))return new Set;const Ft=c(t).managed[dt];return Ft?new Set(Array.isArray(Ft)?Ft:[Ft]):new Set}$s(()=>we());async function we(){try{m(t,await N9(),!0),m(u,c(t).checksum,!0),m(f,te("max_connections"),!0),m(g,te("max_inflight_messages"),!0),m(p,te("max_queued_messages"),!0),m(C,te("max_packet_size"),!0),m(b,te("message_size_limit"),!0),m(E,te("max_keepalive"),!0),m(y,te("persistent_client_expiration"),!0),m(D,te("retain_available"),!0),m(I,te("set_tcp_nodelay"),!0),m(M,te("connection_messages"),!0),m(Q,le("log_dest"),!0),m(ie,le("log_type"),!0),m(i,"")}catch(dt){m(i,dt.message??"Failed to load config",!0)}}async function oe(){if(c(t)){m(n,!0),m(s,""),m(r,!1);try{let Ft=function(Vt,zt){zt!==""?dt[Vt]=zt:delete dt[Vt]};const dt={...c(t).managed};Ft("max_connections",c(f)),Ft("max_inflight_messages",c(g)),Ft("max_queued_messages",c(p)),Ft("max_packet_size",c(C)),Ft("message_size_limit",c(b)),Ft("max_keepalive",c(E)),Ft("persistent_client_expiration",c(y)),Ft("retain_available",c(D)),Ft("set_tcp_nodelay",c(I)),Ft("connection_messages",c(M)),c(Q).size>0?dt.log_dest=c(Q).size===1?[...c(Q)][0]:[...c(Q)]:delete dt.log_dest,c(ie).size>0?dt.log_type=c(ie).size===1?[...c(ie)][0]:[...c(ie)]:delete dt.log_type,await rF({listeners:c(t).listeners,managed:dt,passthrough:c(t).passthrough,checksum:c(u)}),m(r,!0),setTimeout(()=>m(r,!1),3e3),await we()}catch(dt){m(s,dt.message??"Save failed",!0)}finally{m(n,!1)}}}async function ye(){m(a,!0),m(d,"");try{const dt=await aF();m(d,dt.stderr||dt.stdout||"Reloaded",!0)}catch(dt){m(d,"Error: "+(dt.message??"reload failed"))}finally{m(a,!1)}}var Re=AJ(),ke=v(Re),_e=_(v(ke),2),lt=v(_e),Te=v(lt),pe=_(lt,2),ut=v(pe),Rt=_(ke,2);{var st=dt=>{var Ft=TA(),Vt=v(Ft);j(()=>W(Vt,c(i))),A(dt,Ft)};z(Rt,dt=>{c(i)&&dt(st)})}var St=_(Rt,2);{var be=dt=>{var Ft=TA(),Vt=v(Ft);j(()=>W(Vt,c(s))),A(dt,Ft)};z(St,dt=>{c(s)&&dt(be)})}var Tt=_(St,2);{var xt=dt=>{var Ft=yJ();A(dt,Ft)};z(Tt,dt=>{c(r)&&dt(xt)})}var at=_(Tt,2);{var et=dt=>{var Ft=wJ(),Vt=v(Ft);j(()=>W(Vt,c(d))),A(dt,Ft)};z(at,dt=>{c(d)&&dt(et)})}var Ot=_(at,2);{var di=dt=>{var Ft=DJ(),Vt=wt(Ft),zt=_(v(Vt),2),Qt=_(v(zt),2);si(Qt,21,()=>R,Vi,(ht,pt)=>{var Jt=SC(),B=v(Jt),H=_(B);j(K=>{da(B,K),W(H,` ${c(pt)??""}`)},[()=>c(Q).has(c(pt))]),$("change",B,()=>{m(Q,de(c(Q),c(pt)),!0)}),A(ht,Jt)});var vt=_(zt,2),Pi=_(v(vt),2),Ai=v(Pi),hi=_(v(Ai),2);si(hi,17,()=>T,Vi,(ht,pt)=>{var Jt=SC(),B=v(Jt),H=_(B);j(K=>{da(B,K),W(H,` ${c(pt)??""}`)},[()=>c(ie).has(c(pt))]),$("change",B,()=>{m(ie,de(c(ie),c(pt)),!0)}),A(ht,Jt)});var $i=_(Ai,2),Mi=_(v($i),2);si(Mi,17,()=>V,Vi,(ht,pt)=>{var Jt=SC(),B=v(Jt),H=_(B);j(K=>{da(B,K),W(H,` ${c(pt)??""}`)},[()=>c(ie).has(c(pt))]),$("change",B,()=>{m(ie,de(c(ie),c(pt)),!0)}),A(ht,Jt)});var Ci=_($i,2),Ji=v(Ci);si(Ji,17,()=>O,Vi,(ht,pt)=>{var Jt=SJ(),B=v(Jt),H=_(B,2),K=v(H);j(ce=>{da(B,ce),W(K,c(pt))},[()=>c(ie).has(c(pt))]),$("change",B,()=>{m(ie,de(c(ie),c(pt)),!0)}),A(ht,Jt)});var Ki=_(Vt,2),Ri=_(v(Ki),2),cn=v(Ri),ft=v(cn),Zt=_(v(ft),2),fi=_(cn,2),Ni=v(fi),Ii=_(v(Ni),2),Bi=_(fi,2),Wi=v(Bi),Zi=_(v(Wi),2),mi=_(Bi,2),Ke=v(mi),Nt=_(v(Ke),2),Fi=_(Ki,2),ki=_(v(Fi),2),_i=v(ki),Ti=v(_i),Z=_(v(Ti),2),Se=_(_i,2),Ye=v(Se),rt=_(v(Ye),2),Ut=_(Fi,2),se=_(v(Ut),2),me=v(se),Ne=v(me),Y=_(v(Ne),2),ze=_(me,2),He=v(ze),xe=_(v(He),2),bt=v(xe);bt.value=bt.__value="";var Ht=_(bt);Ht.value=Ht.__value="true";var ri=_(Ht);ri.value=ri.__value="false";var ii=_(Ut,2),gi=_(v(ii),2),qt=v(gi),vi=v(qt),Oe=_(v(vi),2),Ue=v(Oe);Ue.value=Ue.__value="";var Xt=_(Ue);Xt.value=Xt.__value="true";var Gt=_(Xt);Gt.value=Gt.__value="false";var Ei=_(qt,2),Kt=v(Ei),ue=_(v(Kt),2),qe=v(ue);qe.value=qe.__value="";var it=_(qe);it.value=it.__value="true";var ot=_(it);ot.value=ot.__value="false",jt(Zt,()=>c(f),ht=>m(f,ht)),jt(Ii,()=>c(E),ht=>m(E,ht)),jt(Zi,()=>c(g),ht=>m(g,ht)),jt(Nt,()=>c(p),ht=>m(p,ht)),jt(Z,()=>c(C),ht=>m(C,ht)),jt(rt,()=>c(b),ht=>m(b,ht)),jt(Y,()=>c(y),ht=>m(y,ht)),Ss(xe,()=>c(D),ht=>m(D,ht)),Ss(Oe,()=>c(I),ht=>m(I,ht)),Ss(ue,()=>c(M),ht=>m(M,ht)),A(dt,Ft)};z(Ot,dt=>{c(t)&&dt(di)})}j(()=>{lt.disabled=c(n),W(Te,c(n)?"Saving…":"Save"),pe.disabled=c(a),W(ut,c(a)?"Reloading…":"Apply & Reload")}),$("click",lt,oe),$("click",pe,ye),A(o,Re),Hs()}Us(["click","change"]);var ll=F('<div class="err svelte-9auejo"> </div>'),BJ=F('<div class="info-card svelte-9auejo"><dl class="svelte-9auejo"><dt class="svelte-9auejo">CN</dt><dd class="svelte-9auejo"> </dd> <dt class="svelte-9auejo">Fingerprint (SHA-256)</dt><dd class="mono small svelte-9auejo"> </dd> <dt class="svelte-9auejo">Expires</dt><dd> </dd></dl></div>'),FJ=F('<div class="empty svelte-9auejo">No managed server certificate. Use one of the options above, or configure <code>certfile</code>/<code>keyfile</code> manually in the Listeners tab.</div>'),LJ=F('<div class="empty svelte-9auejo">No trusted CA certs. Add one to enable client certificate authentication.</div>'),IJ=F('<tr><td class="mono svelte-9auejo"> </td><td class="mono small svelte-9auejo"> </td><td> </td><td class="actions svelte-9auejo"><button class="danger svelte-9auejo">✕</button></td></tr>'),PJ=F('<table class="svelte-9auejo"><thead><tr><th class="svelte-9auejo">CN</th><th class="svelte-9auejo">Fingerprint</th><th class="svelte-9auejo">Expires</th><th class="svelte-9auejo"></th></tr></thead><tbody></tbody></table>'),TJ=F('<div class="result-box svelte-9auejo"><p class="svelte-9auejo">✓ Certificate installed.</p> <dl class="svelte-9auejo"><dt class="svelte-9auejo">Fingerprint</dt><dd class="mono small svelte-9auejo"> </dd><dt class="svelte-9auejo">Expires</dt><dd class="svelte-9auejo"> </dd></dl></div>'),MA=F('<button class="btn-primary svelte-9auejo"> </button>'),MJ=F('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal svelte-9auejo"><h3 class="svelte-9auejo">Generate self-signed server certificate</h3> <label class="svelte-9auejo">Common Name (hostname / IP)<input placeholder="e.g. mqtt.home.arpa" class="svelte-9auejo"/></label> <label class="svelte-9auejo">Subject Alternative Names (comma-separated, optional)<input placeholder="192.168.1.10, mqtt.local" class="svelte-9auejo"/></label> <label class="svelte-9auejo">Validity (days)<input type="number" min="1" max="3650" class="svelte-9auejo"/></label> <!> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Close</button> <!></div></div></div>'),RJ=F('<label class="svelte-9auejo">Common Name (hostname / IP)<input placeholder="e.g. mqtt.home.arpa" class="svelte-9auejo"/></label> <label class="svelte-9auejo">Subject Alternative Names (comma-separated, optional)<input placeholder="192.168.1.10, mqtt.local" class="svelte-9auejo"/></label> <p class="hint svelte-9auejo">A private key and CSR are generated on the server. Copy the CSR, have it signed by your CA, then paste the signed cert below.</p> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div>',1),NJ=F('<div class="ok svelte-9auejo">✓ Certificate installed.</div>'),OJ=F('<p class="hint svelte-9auejo">Key stored on server. Copy the CSR, get it signed, then paste the signed certificate to complete installation.</p> <label class="svelte-9auejo">Certificate Signing Request<textarea readonly="" rows="8" class="svelte-9auejo"></textarea></label> <div class="csr-actions svelte-9auejo"><button class="svelte-9auejo">Copy CSR</button> <a class="btn-download svelte-9auejo" download="server.csr">Download .csr</a></div> <hr class="svelte-9auejo"/> <label class="svelte-9auejo">Upload signed certificate (PEM)<textarea rows="6" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" class="svelte-9auejo"></textarea></label> <!> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Close</button> <!></div>',1),HJ=F('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-9auejo"><h3 class="svelte-9auejo">Generate key + CSR for server certificate</h3> <!></div></div>'),WJ=F('<label class="svelte-9auejo">Certificate (PEM)<textarea rows="5" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" class="svelte-9auejo"></textarea></label> <label class="svelte-9auejo">Private key (PEM — leave blank if key is already on disk from a prior CSR)<textarea rows="4" placeholder="-----BEGIN PRIVATE KEY----- … -----END PRIVATE KEY-----" class="svelte-9auejo"></textarea></label>',1),zJ=F('<span class="file-name mono small svelte-9auejo"> </span>'),VJ=F('<label class="svelte-9auejo">PKCS#12 file <div class="file-row svelte-9auejo"><input type="file" accept=".p12,.pfx" class="svelte-9auejo"/> <!></div></label> <label class="svelte-9auejo">Passphrase <div class="pw-row svelte-9auejo"><input autocomplete="off" class="svelte-9auejo"/> <button class="toggle-pw svelte-9auejo"> </button></div></label>',1),jJ=F('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-9auejo"><h3 class="svelte-9auejo">Import server certificate</h3> <div class="import-mode-tabs svelte-9auejo"><button>PEM files</button> <button>PKCS#12 (.p12 / .pfx)</button></div> <!> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div></div></div>'),DC=F("<option></option>"),$J=F('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-9auejo"><h3 class="svelte-9auejo">Use existing certificate files</h3> <p class="hint svelte-9auejo">Enter absolute paths on the broker host. Tab-completion is available for paths starting with /.</p> <label class="svelte-9auejo">Certificate file path <input list="set-cert-path-list" placeholder="/etc/letsencrypt/live/mqtt.example.com/fullchain.pem" class="svelte-9auejo"/> <datalist id="set-cert-path-list"></datalist></label> <label class="svelte-9auejo">Private key file path <input list="set-key-path-list" placeholder="/etc/letsencrypt/live/mqtt.example.com/privkey.pem" class="svelte-9auejo"/> <datalist id="set-key-path-list"></datalist></label> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div></div></div>'),UJ=F('<label class="svelte-9auejo">CA certificate (PEM)<textarea rows="8" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" class="svelte-9auejo"></textarea></label> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div>',1),qJ=F('<p class="hint svelte-9auejo">Enter the absolute path to the CA certificate file on the broker host.</p> <label class="svelte-9auejo">CA certificate path <input list="trusted-path-list" placeholder="/etc/ssl/certs/my-ca.pem" class="svelte-9auejo"/> <datalist id="trusted-path-list"></datalist></label> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div>',1),GJ=F('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-9auejo"><h3 class="svelte-9auejo">Add trusted CA certificate</h3> <div class="import-mode-tabs svelte-9auejo"><button>Paste PEM</button> <button>From path</button></div> <!></div></div>'),KJ=F('<div class="certs-page svelte-9auejo"><div class="page-toolbar svelte-9auejo"><button class="reload-btn svelte-9auejo" title="Refresh">↺</button></div> <!> <!> <div class="section svelte-9auejo"><div class="section-header svelte-9auejo"><h3 class="svelte-9auejo">Server Certificate</h3> <button class="svelte-9auejo">Self-signed</button> <button class="svelte-9auejo">Generate CSR</button> <button class="svelte-9auejo">Import cert</button> <button class="svelte-9auejo">Use path</button></div> <!></div> <div class="section svelte-9auejo"><div class="section-header svelte-9auejo"><h3 class="svelte-9auejo">Trusted CA Certificates</h3> <button class="svelte-9auejo">+ Add CA cert</button></div> <!></div></div> <!> <!> <!> <!> <!>',1);function ZJ(o,e){Os(e,!0);let t=P(null),i=P(Di([])),n=P(""),s=P(""),r=P(!1),a=P(""),d=P(""),u=P(365),f=P(!1),g=P(""),p=P(null),C=P(!1),b=P(""),E=P(""),y=P(!1),D=P(""),I=P(""),M=P(""),R=P(!1),T=P(""),V=P(!1),O=P(!1),Q=P("pem"),ie=P(""),de=P(""),te=P(""),le=P(""),we=P(""),oe=P(!1),ye=P(!1),Re=P(""),ke=P(!1),_e=P(""),lt=P(""),Te=P(!1),pe=P(""),ut=P(Di([])),Rt=P(Di([])),st=P(!1),St=P("pem"),be=P(""),Tt=P(!1),xt=P(""),at=P(""),et=P(Di([])),Ot=P(!1),di=P("");async function dt(){try{const[Oe,Ue]=await Promise.allSettled([DU(),BU()]);Oe.status==="fulfilled"&&m(t,Oe.value.server,!0),Ue.status==="fulfilled"&&m(i,Ue.value.certs,!0),m(n,"")}catch(Oe){m(n,Oe.message,!0)}}$s(()=>{dt()});async function Ft(){m(g,""),m(f,!0),m(p,null);try{const Oe=c(d).split(",").map(Xt=>Xt.trim()).filter(Boolean),Ue=await AU({cn:c(a),san:Oe,days:c(u)});m(p,{fingerprint:Ue.fingerprint,expires:Ue.expires},!0),await dt()}catch(Oe){m(g,Oe.message,!0)}finally{m(f,!1)}}async function Vt(){m(D,""),m(y,!0),m(I,"");try{const Oe=c(E).split(",").map(Xt=>Xt.trim()).filter(Boolean),Ue=await kU({cn:c(b),san:Oe});m(I,Ue.csrPem,!0)}catch(Oe){m(D,Oe.message,!0)}finally{m(y,!1)}}async function zt(){m(T,""),m(R,!0),m(V,!1);try{if(!c(M).trim())throw new Error("Paste the signed certificate PEM");await CC({cert:c(M)}),m(V,!0),await dt()}catch(Oe){m(T,Oe.message,!0)}finally{m(R,!1)}}function Qt(){navigator.clipboard.writeText(c(I)).catch(()=>{})}function vt(Oe){var Gt;const Ue=(Gt=Oe.target.files)==null?void 0:Gt[0];if(!Ue)return;m(le,Ue.name,!0);const Xt=new FileReader;Xt.onload=()=>{const Ei=Xt.result;m(te,btoa(String.fromCharCode(...new Uint8Array(Ei))),!0)},Xt.readAsArrayBuffer(Ue)}async function Pi(){m(Re,""),m(ye,!0);try{if(c(Q)==="p12"){if(!c(te))throw new Error("Select a .p12 / .pfx file");await CC({p12base64:c(te),passphrase:c(we)})}else{if(!c(ie).trim())throw new Error("Certificate PEM is required");await CC({cert:c(ie),key:c(de)||void 0})}m(O,!1),await dt()}catch(Oe){m(Re,Oe.message,!0)}finally{m(ye,!1)}}function Ai(Oe){let Ue;return Xt=>{const Gt=Xt.target.value;clearTimeout(Ue),Ue=setTimeout(async()=>{if(!Gt.startsWith("/")||Gt.length<2){Oe([]);return}try{Oe((await IU(Gt)).suggestions)}catch{Oe([])}},280)}}const hi=Ai(Oe=>{m(ut,Oe,!0)}),$i=Ai(Oe=>{m(Rt,Oe,!0)}),Mi=Ai(Oe=>{m(et,Oe,!0)});async function Ci(){m(pe,""),m(Te,!0);try{await PU({certPath:c(_e),keyPath:c(lt)}),m(ke,!1),await dt()}catch(Oe){m(pe,Oe.message,!0)}finally{m(Te,!1)}}async function Ji(){m(xt,""),m(Tt,!0);try{await FU(c(be)),m(be,""),m(st,!1),await dt()}catch(Oe){m(xt,Oe.message,!0)}finally{m(Tt,!1)}}async function Ki(){m(di,""),m(Ot,!0);try{await TU(c(at)),m(at,""),m(st,!1),await dt()}catch(Oe){m(di,Oe.message,!0)}finally{m(Ot,!1)}}async function Ri(Oe){if(confirm("Remove this trusted CA cert?"))try{await LU(Oe),await dt()}catch(Ue){m(s,Ue.message,!0)}}function cn(Oe){const Ue=new Date(Oe).getTime()-Date.now();return Ue<0?"expired":Ue<30*864e5?"expiring":""}function ft(Oe){return new Date(Oe).toLocaleDateString()}var Zt=KJ(),fi=wt(Zt),Ni=v(fi),Ii=v(Ni),Bi=_(Ni,2);{var Wi=Oe=>{var Ue=ll(),Xt=v(Ue);j(()=>W(Xt,c(n))),A(Oe,Ue)};z(Bi,Oe=>{c(n)&&Oe(Wi)})}var Zi=_(Bi,2);{var mi=Oe=>{var Ue=ll(),Xt=v(Ue);j(()=>W(Xt,c(s))),A(Oe,Ue)};z(Zi,Oe=>{c(s)&&Oe(mi)})}var Ke=_(Zi,2),Nt=v(Ke),Fi=_(v(Nt),2),ki=_(Fi,2),_i=_(ki,2),Ti=_(_i,2),Z=_(Nt,2);{var Se=Oe=>{var Ue=BJ(),Xt=v(Ue),Gt=_(v(Xt)),Ei=v(Gt),Kt=_(Gt,3),ue=v(Kt),qe=_(Kt,3),it=v(qe);j((ot,ht)=>{W(Ei,c(t).cn),W(ue,c(t).fingerprint),kt(qe,1,ot,"svelte-9auejo"),W(it,ht)},[()=>Xf(cn(c(t).expires)),()=>ft(c(t).expires)]),A(Oe,Ue)},Ye=Oe=>{var Ue=FJ();A(Oe,Ue)};z(Z,Oe=>{c(t)?Oe(Se):Oe(Ye,-1)})}var rt=_(Ke,2),Ut=v(rt),se=_(v(Ut),2),me=_(Ut,2);{var Ne=Oe=>{var Ue=LJ();A(Oe,Ue)},Y=Oe=>{var Ue=PJ(),Xt=_(v(Ue));si(Xt,21,()=>c(i),Vi,(Gt,Ei)=>{var Kt=IJ(),ue=v(Kt),qe=v(ue),it=_(ue),ot=v(it),ht=_(it),pt=v(ht),Jt=_(ht),B=v(Jt);j((H,K,ce)=>{W(qe,c(Ei).cn),W(ot,`${H??""}…`),kt(ht,1,K,"svelte-9auejo"),W(pt,ce)},[()=>c(Ei).fingerprint.slice(0,29),()=>Xf(cn(c(Ei).expires)),()=>ft(c(Ei).expires)]),$("click",B,()=>Ri(c(Ei).fingerprint)),A(Gt,Kt)}),A(Oe,Ue)};z(me,Oe=>{c(i).length===0?Oe(Ne):Oe(Y,-1)})}var ze=_(fi,2);{var He=Oe=>{var Ue=MJ(),Xt=v(Ue),Gt=_(v(Xt),2),Ei=_(v(Gt)),Kt=_(Gt,2),ue=_(v(Kt)),qe=_(Kt,2),it=_(v(qe)),ot=_(qe,2);{var ht=X=>{var J=ll(),he=v(J);j(()=>W(he,c(g))),A(X,J)};z(ot,X=>{c(g)&&X(ht)})}var pt=_(ot,2);{var Jt=X=>{var J=TJ(),he=_(v(J),2),Qe=_(v(he)),ae=v(Qe),fe=_(Qe,2),Fe=v(fe);j(ge=>{W(ae,c(p).fingerprint),W(Fe,ge)},[()=>ft(c(p).expires)]),A(X,J)};z(pt,X=>{c(p)&&X(Jt)})}var B=_(pt,2),H=v(B),K=_(H,2);{var ce=X=>{var J=MA(),he=v(J);j(()=>{J.disabled=c(f),W(he,c(f)?"Generating…":"Generate")}),$("click",J,Ft),A(X,J)};z(K,X=>{c(p)||X(ce)})}jt(Ei,()=>c(a),X=>m(a,X)),jt(ue,()=>c(d),X=>m(d,X)),jt(it,()=>c(u),X=>m(u,X)),$("click",H,()=>m(r,!1)),A(Oe,Ue)};z(ze,Oe=>{c(r)&&Oe(He)})}var xe=_(ze,2);{var bt=Oe=>{var Ue=HJ(),Xt=v(Ue),Gt=_(v(Xt),2);{var Ei=ue=>{var qe=RJ(),it=wt(qe),ot=_(v(it)),ht=_(it,2),pt=_(v(ht)),Jt=_(ht,4);{var B=J=>{var he=ll(),Qe=v(he);j(()=>W(Qe,c(D))),A(J,he)};z(Jt,J=>{c(D)&&J(B)})}var H=_(Jt,2),K=v(H),ce=_(K,2),X=v(ce);j(()=>{ce.disabled=c(y),W(X,c(y)?"Generating…":"Generate key + CSR")}),jt(ot,()=>c(b),J=>m(b,J)),jt(pt,()=>c(E),J=>m(E,J)),$("click",K,()=>m(C,!1)),$("click",ce,Vt),A(ue,qe)},Kt=ue=>{var qe=OJ(),it=_(wt(qe),2),ot=_(v(it)),ht=_(it,2),pt=v(ht),Jt=_(pt,2),B=_(ht,4),H=_(v(B)),K=_(B,2);{var ce=Fe=>{var ge=ll(),Ee=v(ge);j(()=>W(Ee,c(T))),A(Fe,ge)};z(K,Fe=>{c(T)&&Fe(ce)})}var X=_(K,2);{var J=Fe=>{var ge=NJ();A(Fe,ge)};z(X,Fe=>{c(V)&&Fe(J)})}var he=_(X,2),Qe=v(he),ae=_(Qe,2);{var fe=Fe=>{var ge=MA(),Ee=v(ge);j(ct=>{ge.disabled=ct,W(Ee,c(R)?"Uploading…":"Upload signed cert")},[()=>c(R)||!c(M).trim()]),$("click",ge,zt),A(Fe,ge)};z(ae,Fe=>{c(V)||Fe(fe)})}j(Fe=>{i1(ot,c(I)),ln(Jt,"href",`data:application/pkcs10;charset=utf-8,${Fe??""}`)},[()=>encodeURIComponent(c(I))]),$("click",pt,Qt),jt(H,()=>c(M),Fe=>m(M,Fe)),$("click",Qe,()=>m(C,!1)),A(ue,qe)};z(Gt,ue=>{c(I)?ue(Kt,-1):ue(Ei)})}A(Oe,Ue)};z(xe,Oe=>{c(C)&&Oe(bt)})}var Ht=_(xe,2);{var ri=Oe=>{var Ue=jJ(),Xt=v(Ue),Gt=_(v(Xt),2),Ei=v(Gt);let Kt;var ue=_(Ei,2);let qe;var it=_(Gt,2);{var ot=X=>{var J=WJ(),he=wt(J),Qe=_(v(he)),ae=_(he,2),fe=_(v(ae));jt(Qe,()=>c(ie),Fe=>m(ie,Fe)),jt(fe,()=>c(de),Fe=>m(de,Fe)),A(X,J)},ht=X=>{var J=VJ(),he=wt(J),Qe=_(v(he)),ae=v(Qe),fe=_(ae,2);{var Fe=Le=>{var tt=zJ(),Me=v(tt);j(()=>W(Me,c(le))),A(Le,tt)};z(fe,Le=>{c(le)&&Le(Fe)})}var ge=_(he,2),Ee=_(v(ge)),ct=v(Ee),q=_(ct,2),re=v(q);j(()=>{ln(ct,"type",c(oe)?"text":"password"),W(re,c(oe)?"Hide":"Show")}),$("change",ae,vt),jt(ct,()=>c(we),Le=>m(we,Le)),$("click",q,()=>m(oe,!c(oe))),A(X,J)};z(it,X=>{c(Q)==="pem"?X(ot):X(ht,-1)})}var pt=_(it,2);{var Jt=X=>{var J=ll(),he=v(J);j(()=>W(he,c(Re))),A(X,J)};z(pt,X=>{c(Re)&&X(Jt)})}var B=_(pt,2),H=v(B),K=_(H,2),ce=v(K);j(()=>{Kt=kt(Ei,1,"svelte-9auejo",null,Kt,{active:c(Q)==="pem"}),qe=kt(ue,1,"svelte-9auejo",null,qe,{active:c(Q)==="p12"}),K.disabled=c(ye),W(ce,c(ye)?"Importing…":"Import")}),$("click",Ei,()=>m(Q,"pem")),$("click",ue,()=>m(Q,"p12")),$("click",H,()=>m(O,!1)),$("click",K,Pi),A(Oe,Ue)};z(Ht,Oe=>{c(O)&&Oe(ri)})}var ii=_(Ht,2);{var gi=Oe=>{var Ue=$J(),Xt=v(Ue),Gt=_(v(Xt),4),Ei=_(v(Gt)),Kt=_(Ei,2);si(Kt,21,()=>c(ut),Vi,(K,ce)=>{var X=DC(),J={};j(()=>{J!==(J=c(ce))&&(X.value=(X.__value=c(ce))??"")}),A(K,X)});var ue=_(Gt,2),qe=_(v(ue)),it=_(qe,2);si(it,21,()=>c(Rt),Vi,(K,ce)=>{var X=DC(),J={};j(()=>{J!==(J=c(ce))&&(X.value=(X.__value=c(ce))??"")}),A(K,X)});var ot=_(ue,2);{var ht=K=>{var ce=ll(),X=v(ce);j(()=>W(X,c(pe))),A(K,ce)};z(ot,K=>{c(pe)&&K(ht)})}var pt=_(ot,2),Jt=v(pt),B=_(Jt,2),H=v(B);j(K=>{B.disabled=K,W(H,c(Te)?"Installing…":"Install")},[()=>c(Te)||!c(_e).trim()||!c(lt).trim()]),$("input",Ei,hi),jt(Ei,()=>c(_e),K=>m(_e,K)),$("input",qe,$i),jt(qe,()=>c(lt),K=>m(lt,K)),$("click",Jt,()=>m(ke,!1)),$("click",B,Ci),A(Oe,Ue)};z(ii,Oe=>{c(ke)&&Oe(gi)})}var qt=_(ii,2);{var vi=Oe=>{var Ue=GJ(),Xt=v(Ue),Gt=_(v(Xt),2),Ei=v(Gt);let Kt;var ue=_(Ei,2);let qe;var it=_(Gt,2);{var ot=pt=>{var Jt=UJ(),B=wt(Jt),H=_(v(B)),K=_(B,2);{var ce=ae=>{var fe=ll(),Fe=v(fe);j(()=>W(Fe,c(xt))),A(ae,fe)};z(K,ae=>{c(xt)&&ae(ce)})}var X=_(K,2),J=v(X),he=_(J,2),Qe=v(he);j(ae=>{he.disabled=ae,W(Qe,c(Tt)?"Adding…":"Add CA cert")},[()=>c(Tt)||!c(be).trim()]),jt(H,()=>c(be),ae=>m(be,ae)),$("click",J,()=>m(st,!1)),$("click",he,Ji),A(pt,Jt)},ht=pt=>{var Jt=qJ(),B=_(wt(Jt),2),H=_(v(B)),K=_(H,2);si(K,21,()=>c(et),Vi,(fe,Fe)=>{var ge=DC(),Ee={};j(()=>{Ee!==(Ee=c(Fe))&&(ge.value=(ge.__value=c(Fe))??"")}),A(fe,ge)});var ce=_(B,2);{var X=fe=>{var Fe=ll(),ge=v(Fe);j(()=>W(ge,c(di))),A(fe,Fe)};z(ce,fe=>{c(di)&&fe(X)})}var J=_(ce,2),he=v(J),Qe=_(he,2),ae=v(Qe);j(fe=>{Qe.disabled=fe,W(ae,c(Ot)?"Adding…":"Add CA cert")},[()=>c(Ot)||!c(at).trim()]),$("input",H,Mi),jt(H,()=>c(at),fe=>m(at,fe)),$("click",he,()=>m(st,!1)),$("click",Qe,Ki),A(pt,Jt)};z(it,pt=>{c(St)==="pem"?pt(ot):pt(ht,-1)})}j(()=>{Kt=kt(Ei,1,"svelte-9auejo",null,Kt,{active:c(St)==="pem"}),qe=kt(ue,1,"svelte-9auejo",null,qe,{active:c(St)==="path"})}),$("click",Ei,()=>m(St,"pem")),$("click",ue,()=>m(St,"path")),A(Oe,Ue)};z(qt,Oe=>{c(st)&&Oe(vi)})}$("click",Ii,dt),$("click",Fi,()=>{m(r,!0),m(g,""),m(p,null)}),$("click",ki,()=>{m(C,!0),m(D,""),m(I,""),m(M,""),m(V,!1),m(T,"")}),$("click",_i,()=>{m(O,!0),m(Re,""),m(Q,"pem"),m(ie,""),m(de,""),m(te,""),m(le,""),m(we,""),m(oe,!1)}),$("click",Ti,()=>{m(ke,!0),m(pe,""),m(_e,""),m(lt,""),m(ut,[],!0),m(Rt,[],!0)}),$("click",se,()=>{m(st,!0),m(xt,""),m(be,""),m(St,"pem"),m(di,""),m(at,""),m(et,[],!0)}),A(o,Zt),Hs()}Us(["click","change","input"]);var wx=F('<div class="err svelte-17yczfe"> </div>'),XJ=F('<div class="check-list svelte-17yczfe"><div class="check-row svelte-17yczfe"><span> </span> <code class="svelte-17yczfe">mosquitto_ctrl</code> <span> </span></div> <div class="check-row svelte-17yczfe"><span> </span> <code class="svelte-17yczfe">mosquitto</code> <span> </span></div></div>'),YJ=F('<div class="checking svelte-17yczfe">Checking…</div>'),QJ=F('<div class="section svelte-17yczfe"><h3 class="svelte-17yczfe">Tool availability</h3> <p class="hint svelte-17yczfe">These tools must be installed and in the PATH of the she process. They are used by the Setup Wizard and cert installation.</p> <!> <!> <div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button></div></div>'),JJ=F('<label class="svelte-17yczfe">Install command (run locally) <div class="pubkey-row svelte-17yczfe"><input readonly="" class="svelte-17yczfe"/> <button class="copy-btn svelte-17yczfe">Copy</button></div></label>'),eee=F('<label class="svelte-17yczfe">Public key <div class="pubkey-row svelte-17yczfe"><textarea readonly="" rows="3" class="svelte-17yczfe"></textarea> <button class="copy-btn svelte-17yczfe">Copy</button></div></label> <!> <div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button></div>',1),tee=F('<div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button></div>'),iee=F("<span> </span>"),nee=F('<div class="section svelte-17yczfe"><h3 class="svelte-17yczfe">SSH connection</h3> <p class="hint svelte-17yczfe">Used for file operations: reading/writing mosquitto.conf and installing certificates on the broker host. User/ACL management always uses the MQTT port directly.</p> <div class="fields svelte-17yczfe"><label class="svelte-17yczfe">Host<input placeholder="192.168.1.10 or broker.local" class="svelte-17yczfe"/></label> <label class="svelte-17yczfe">Port<input type="number" min="1" max="65535" class="svelte-17yczfe"/></label> <label class="svelte-17yczfe">SSH user<input placeholder="root" class="svelte-17yczfe"/></label> <label class="svelte-17yczfe">Identity file (private key)<input class="svelte-17yczfe"/></label></div></div> <div class="section svelte-17yczfe"><h3 class="svelte-17yczfe">SSH keypair</h3> <p class="hint svelte-17yczfe">Dedicated Ed25519 keypair for she to authenticate to the broker host. Private key stored at <code class="svelte-17yczfe"> </code>.</p> <!> <!></div> <div class="section svelte-17yczfe"><h3 class="svelte-17yczfe">Test connection</h3> <div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button> <!></div></div>',1),see=F('<div class="ok svelte-17yczfe">Saved.</div>'),oee=F('<div class="mosquitto-page svelte-17yczfe"><!> <div class="mode-bar svelte-17yczfe"><span class="mode-label svelte-17yczfe">Connection mode</span> <div class="mode-toggle svelte-17yczfe"><button>Local</button> <button>SSH / Remote</button></div> <span class="mode-desc svelte-17yczfe"> </span></div> <!> <!> <!> <!> <div class="row svelte-17yczfe"><button class="btn-primary svelte-17yczfe"> </button></div></div>');function ree(o,e){Os(e,!0);let t=P(Di({})),i=P(""),n=P(!1),s=P(!1),r=P(""),a=P("~/.she/ssh/broker_id_ed25519"),d=P("local"),u=P(null),f=P(!1),g=P(""),p=P(""),C=P(!1),b=P(""),E=P(!1),y=P(""),D=P(Di({}));$s(async()=>{try{const[et,Ot,di]=await Promise.all([Nl(),R9(),fetch("/she/broker/ssh/pubkey").then(Ft=>Ft.json()).catch(()=>({publicKey:null}))]);m(D,et,!0),Ot.sshKeyDefault&&m(a,Ot.sshKeyDefault,!0);const dt=c(D).broker??{};m(t,dt.ssh??{},!0),c(t).port||(c(t).port=22),c(t).identityFile||(c(t).identityFile=c(a)),di.publicKey&&m(p,di.publicKey,!0),m(d,c(t).host?"ssh":"local",!0),c(d)==="local"&&I()}catch(et){m(i,et.message,!0)}});async function I(){m(f,!0),m(g,"");try{m(u,await eU(),!0)}catch(et){m(g,et.message??"Check failed",!0)}finally{m(f,!1)}}async function M(){m(n,!0),m(r,""),m(s,!1);try{const et=c(D).broker??{},Ot=c(d)==="local"?{...c(t),host:""}:c(t),di={...c(D),broker:{...et,ssh:Ot}};await Jg(di),m(s,!0),setTimeout(()=>m(s,!1),3e3)}catch(et){m(r,et.message,!0)}finally{m(n,!1)}}async function R(){m(C,!0),m(b,"");try{const et=await fetch("/she/broker/ssh/keygen",{method:"POST",headers:{"Content-Type":"application/json"}}),Ot=await et.json();if(!et.ok)throw new Error(Ot.error??et.statusText);m(p,Ot.publicKey,!0)}catch(et){m(b,et.message,!0)}finally{m(C,!1)}}async function T(){m(E,!0),m(y,"");try{const et=await fetch("/she/broker/ssh/test",{method:"POST",headers:{"Content-Type":"application/json"}}),Ot=await et.json();if(!et.ok)throw new Error(Ot.error??et.statusText);m(y,Ot.ok?"✓ Connection successful":"✗ "+(Ot.error??"Failed"),!0)}catch(et){m(y,"✗ "+et.message)}finally{m(E,!1)}}function V(et){navigator.clipboard.writeText(et).catch(()=>{})}const O=It(()=>c(t).identityFile&&c(t).user&&c(t).host?`ssh-copy-id -i ${c(t).identityFile}.pub ${c(t).user}@${c(t).host}`:"");var Q=oee(),ie=v(Q);{var de=et=>{var Ot=wx(),di=v(Ot);j(()=>W(di,c(i))),A(et,Ot)};z(ie,et=>{c(i)&&et(de)})}var te=_(ie,2),le=_(v(te),2),we=v(le);let oe;var ye=_(we,2);let Re;var ke=_(le,2),_e=v(ke),lt=_(te,2);{var Te=et=>{var Ot=QJ(),di=_(v(Ot),4);{var dt=Ai=>{var hi=wx(),$i=v(hi);j(()=>W($i,c(g))),A(Ai,hi)};z(di,Ai=>{c(g)&&Ai(dt)})}var Ft=_(di,2);{var Vt=Ai=>{var hi=XJ(),$i=v(hi),Mi=v($i);let Ci;var Ji=v(Mi),Ki=_(Mi,4);let Ri;var cn=v(Ki),ft=_($i,2),Zt=v(ft);let fi;var Ni=v(Zt),Ii=_(Zt,4);let Bi;var Wi=v(Ii);j(()=>{Ci=kt(Mi,1,"check-icon svelte-17yczfe",null,Ci,{ok:c(u).mosquittoCtrl,fail:!c(u).mosquittoCtrl}),W(Ji,c(u).mosquittoCtrl?"✓":"✗"),Ri=kt(Ki,1,"check-note svelte-17yczfe",null,Ri,{ok:c(u).mosquittoCtrl,fail:!c(u).mosquittoCtrl}),W(cn,c(u).mosquittoCtrl?"found in PATH":"not found — install the mosquitto or mosquitto-clients package"),fi=kt(Zt,1,"check-icon svelte-17yczfe",null,fi,{ok:c(u).mosquitto,fail:!c(u).mosquitto}),W(Ni,c(u).mosquitto?"✓":"✗"),Bi=kt(Ii,1,"check-note svelte-17yczfe",null,Bi,{ok:c(u).mosquitto,fail:!c(u).mosquitto}),W(Wi,c(u).mosquitto?"found in PATH":"not found — install the mosquitto package")}),A(Ai,hi)},zt=Ai=>{var hi=YJ();A(Ai,hi)};z(Ft,Ai=>{c(u)?Ai(Vt):c(f)&&Ai(zt,1)})}var Qt=_(Ft,2),vt=v(Qt),Pi=v(vt);j(()=>{vt.disabled=c(f),W(Pi,c(f)?"Checking…":c(u)?"Re-check":"Check tools")}),$("click",vt,I),A(et,Ot)};z(lt,et=>{c(d)==="local"&&et(Te)})}var pe=_(lt,2);{var ut=et=>{var Ot=nee(),di=wt(Ot),dt=_(v(di),4),Ft=v(dt),Vt=_(v(Ft)),zt=_(Ft,2),Qt=_(v(zt)),vt=_(zt,2),Pi=_(v(vt)),Ai=_(vt,2),hi=_(v(Ai)),$i=_(di,2),Mi=_(v($i),2),Ci=_(v(Mi)),Ji=v(Ci),Ki=_(Mi,2);{var Ri=mi=>{var Ke=eee(),Nt=wt(Ke),Fi=_(v(Nt)),ki=v(Fi),_i=_(ki,2),Ti=_(Nt,2);{var Z=Ut=>{var se=JJ(),me=_(v(se)),Ne=v(me),Y=_(Ne,2);j(()=>i1(Ne,c(O))),$("click",Y,()=>V(c(O))),A(Ut,se)};z(Ti,Ut=>{c(O)&&Ut(Z)})}var Se=_(Ti,2),Ye=v(Se),rt=v(Ye);j(()=>{i1(ki,c(p)),Ye.disabled=c(C),W(rt,c(C)?"Generating…":"Regenerate keypair")}),$("click",_i,()=>V(c(p))),$("click",Ye,R),A(mi,Ke)},cn=mi=>{var Ke=tee(),Nt=v(Ke),Fi=v(Nt);j(()=>{Nt.disabled=c(C),W(Fi,c(C)?"Generating…":"Generate keypair")}),$("click",Nt,R),A(mi,Ke)};z(Ki,mi=>{c(p)?mi(Ri):mi(cn,-1)})}var ft=_(Ki,2);{var Zt=mi=>{var Ke=wx(),Nt=v(Ke);j(()=>W(Nt,c(b))),A(mi,Ke)};z(ft,mi=>{c(b)&&mi(Zt)})}var fi=_($i,2),Ni=_(v(fi),2),Ii=v(Ni),Bi=v(Ii),Wi=_(Ii,2);{var Zi=mi=>{var Ke=iee();let Nt;var Fi=v(Ke);j(ki=>{Nt=kt(Ke,1,"test-result svelte-17yczfe",null,Nt,ki),W(Fi,c(y))},[()=>({ok:c(y).startsWith("✓"),fail:c(y).startsWith("✗")})]),A(mi,Ke)};z(Wi,mi=>{c(y)&&mi(Zi)})}j(()=>{ln(hi,"placeholder",c(a)),W(Ji,c(t).identityFile||c(a)),Ii.disabled=c(E)||!c(t).host,W(Bi,c(E)?"Testing…":"Test SSH connection")}),jt(Vt,()=>c(t).host,mi=>c(t).host=mi),jt(Qt,()=>c(t).port,mi=>c(t).port=mi),jt(Pi,()=>c(t).user,mi=>c(t).user=mi),jt(hi,()=>c(t).identityFile,mi=>c(t).identityFile=mi),$("click",Ii,T),A(et,Ot)};z(pe,et=>{c(d)==="ssh"&&et(ut)})}var Rt=_(pe,2);{var st=et=>{var Ot=wx(),di=v(Ot);j(()=>W(di,c(r))),A(et,Ot)};z(Rt,et=>{c(r)&&et(st)})}var St=_(Rt,2);{var be=et=>{var Ot=see();A(et,Ot)};z(St,et=>{c(s)&&et(be)})}var Tt=_(St,2),xt=v(Tt),at=v(xt);j(()=>{oe=kt(we,1,"svelte-17yczfe",null,oe,{active:c(d)==="local"}),Re=kt(ye,1,"svelte-17yczfe",null,Re,{active:c(d)==="ssh"}),W(_e,c(d)==="local"?"she and mosquitto run on the same machine — local filesystem access":"mosquitto runs on a remote host — file operations go through SSH"),xt.disabled=c(n),W(at,c(n)?"Saving…":"Save")}),$("click",we,()=>{m(d,"local"),c(u)||I()}),$("click",ye,()=>m(d,"ssh")),$("click",xt,M),A(o,Q),Hs()}Us(["click"]);var aee=F("<button> </button>"),lee=F('<code>log_dest topic</code> is not enabled in mosquitto.conf.<br/> <span class="hint svelte-1yc29ow">Enable it in the <strong>Config</strong> tab, then click <em>Apply &amp; Reload</em>.</span>',1),cee=F('<code>log_dest topic</code> is configured — waiting for messages&hellip;<br/> <span class="hint svelte-1yc29ow">If nothing appears, mosquitto may need a full restart for the change to take effect.</span>',1),dee=F('Waiting for log messages&hellip;<br/> <span class="hint svelte-1yc29ow">Make sure <code class="svelte-1yc29ow">log_dest topic</code> is set in mosquitto.conf.</span>',1),uee=F('<div class="empty svelte-1yc29ow"><!></div>'),hee=F('<div class="entry svelte-1yc29ow"><span class="ts svelte-1yc29ow"> </span> <span> </span> <span class="msg svelte-1yc29ow"> </span></div>'),fee=F('<div class="logs-page svelte-1yc29ow"><div class="toolbar svelte-1yc29ow"><div class="level-filters svelte-1yc29ow"></div> <div class="spacer svelte-1yc29ow"></div> <label class="autoscroll-label svelte-1yc29ow"><input type="checkbox" class="svelte-1yc29ow"/> Auto-scroll</label> <button class="btn-clear svelte-1yc29ow">Clear</button></div> <div class="log-container svelte-1yc29ow"><!></div></div>');function gee(o,e){Os(e,!0);const t={D:"DBG",I:"INF",N:"NTC",W:"WRN",E:"ERR"},i={D:"lvl-d",I:"lvl-i",N:"lvl-n",W:"lvl-w",E:"lvl-e"};function n(te){const le=te.slice(16);return le==="D"?"D":le==="I"?"I":le==="N"?"N":le==="W"?"W":le==="E"?"E":null}let s=P(Di([])),r=P(!0),a=P(Di(new Set(["D","I","N","W","E"]))),d=P(void 0),u=P(!1),f=P(null),g=null;$s(()=>{g=ur("mqtt",te=>{if(!te.topic.startsWith("$SYS/broker/log/"))return;const le=n(te.topic);le&&(m(u,!0),m(s,[...c(s).slice(-499),{ts:te.ts,level:le,msg:te.val}],!0),c(r)&&fd().then(p))}),N9().then(te=>{const le=te.managed.log_dest,we=Array.isArray(le)?le:le?[le]:[];m(f,we.includes("topic"),!0)}).catch(()=>{m(f,null)})}),Dp(()=>{g==null||g()});function p(){c(d)&&(c(d).scrollTop=c(d).scrollHeight)}function C(te){const le=new Set(c(a));le.has(te)?le.delete(te):le.add(te),m(a,le,!0)}function b(){m(s,[],!0),m(u,!1)}let E=It(()=>c(s).filter(te=>c(a).has(te.level)));function y(te){const le=new Date(te);return le.toTimeString().slice(0,8)+"."+String(le.getMilliseconds()).padStart(3,"0")}var D=fee(),I=v(D),M=v(I);si(M,20,()=>["D","I","N","W","E"],Vi,(te,le)=>{var we=aee();let oe;var ye=v(we);j(Re=>{oe=kt(we,1,`lvl-btn ${i[le]??""}`,"svelte-1yc29ow",oe,Re),ln(we,"title",`Toggle ${le??""} messages`),W(ye,t[le])},[()=>({active:c(a).has(le)})]),$("click",we,()=>C(le)),A(te,we)});var R=_(M,4),T=v(R),V=_(R,2),O=_(I,2),Q=v(O);{var ie=te=>{var le=uee(),we=v(le);{var oe=Re=>{var ke=Ts(),_e=wt(ke);{var lt=ut=>{var Rt=lee();A(ut,Rt)},Te=ut=>{var Rt=cee();A(ut,Rt)},pe=ut=>{var Rt=dee();A(ut,Rt)};z(_e,ut=>{c(f)===!1?ut(lt):c(f)===!0?ut(Te,1):ut(pe,-1)})}A(Re,ke)},ye=Re=>{var ke=_o("No messages match the current filter.");A(Re,ke)};z(we,Re=>{c(u)?Re(ye,-1):Re(oe)})}A(te,le)},de=te=>{var le=Ts(),we=wt(le);si(we,17,()=>c(E),oe=>oe.ts+oe.msg,(oe,ye)=>{var Re=hee(),ke=v(Re),_e=v(ke),lt=_(ke,2),Te=v(lt),pe=_(lt,2),ut=v(pe);j(Rt=>{W(_e,Rt),kt(lt,1,`badge ${i[c(ye).level]??""}`,"svelte-1yc29ow"),W(Te,t[c(ye).level]),W(ut,c(ye).msg)},[()=>y(c(ye).ts)]),A(oe,Re)}),A(te,le)};z(Q,te=>{c(E).length===0?te(ie):te(de,-1)})}cs(O,te=>m(d,te),()=>c(d)),Cs(T,()=>c(r),te=>m(r,te)),$("click",V,b),A(o,D),Hs()}Us(["click"]);var pee=F('<div class="err svelte-d31be1"> </div>'),xee=F('<div class="step svelte-d31be1"><p class="svelte-d31be1">This wizard will configure the <strong>Mosquitto Dynamic Security plugin</strong> for use with she. It will:</p> <ul class="svelte-d31be1"><li>Create a <code class="svelte-d31be1">she-admin</code> service account with a random strong password.</li> <li>Write <code class="svelte-d31be1">dynamic-security.json</code> to your mosquitto config directory.</li> <li>Add the <code class="svelte-d31be1">plugin</code> line to <code class="svelte-d31be1">mosquitto.conf</code>.</li> <li>Ask you to restart mosquitto to activate the plugin.</li></ul> <p class="hint svelte-d31be1">In <strong>remote mode</strong> (SSH host configured), <code class="svelte-d31be1">mosquitto_ctrl</code> is invoked on the broker host via SSH. In local mode, it must be installed on this machine. <code class="svelte-d31be1">mosquitto_ctrl</code> is part of the <code class="svelte-d31be1">mosquitto</code> package.</p> <div class="actions svelte-d31be1"><button class="svelte-d31be1">Start</button></div></div>'),mee=F('<div class="step svelte-d31be1"><p class="svelte-d31be1"> </p></div>'),_ee=F('<div class="step svelte-d31be1"><p class="svelte-d31be1">dynsec is not yet active. Configure bootstrap settings:</p> <label class="svelte-d31be1">Admin username<input class="svelte-d31be1"/></label> <label class="svelte-d31be1">Admin password<input type="password" placeholder="(leave blank to auto-generate)" class="svelte-d31be1"/></label> <label class="svelte-d31be1">Mosquitto config directory<input class="svelte-d31be1"/></label> <div class="actions svelte-d31be1"><button class="svelte-d31be1"> </button></div></div>'),vee=F('<p class="hint svelte-d31be1">Restarting mosquitto… this may take a few seconds.</p>'),bee=F(`<div class="step svelte-d31be1"><div class="ok-banner svelte-d31be1">✓ dynsec files written and credentials saved.</div> <p class="svelte-d31be1">The <code class="svelte-d31be1">plugin</code> line has been added to <code class="svelte-d31be1"> </code>.</p> <p class="svelte-d31be1">Enabling a new plugin requires a <strong>full mosquitto restart</strong> (not just SIGHUP):</p> <div class="actions svelte-d31be1"><button class="btn-warn svelte-d31be1"> </button> <button class="skip-step svelte-d31be1">Skip (I'll restart manually)</button></div> <!></div>`),Cee=F('<div class="step svelte-d31be1"><div class="ok-banner svelte-d31be1">✓ dynsec is configured and connected.</div> <p class="svelte-d31be1">she is now managing broker users and ACLs via the Dynamic Security plugin. You can use the <strong>Users & Roles</strong> tab to add users, create roles, and define ACL rules.</p> <div class="actions svelte-d31be1"><button class="btn-primary svelte-d31be1">Done</button></div></div>'),Eee=F('<div class="step svelte-d31be1"><p class="svelte-d31be1">Enter the credentials of an existing dynsec admin account:</p> <label class="svelte-d31be1">Admin username<input class="svelte-d31be1"/></label> <label class="svelte-d31be1">Admin password<input type="password" class="svelte-d31be1"/></label> <div class="actions svelte-d31be1"><button class="svelte-d31be1">Back</button> <button class="btn-primary svelte-d31be1"> </button></div></div>'),yee=F('<div class="wizard svelte-d31be1"><div class="wizard-header svelte-d31be1"><h3 class="svelte-d31be1">dynsec Setup Wizard</h3> <button class="skip-btn svelte-d31be1">Manual setup instead</button></div> <!> <!></div>');function wee(o,e){Os(e,!0);let t=P("intro"),i=P(""),n=P(!1),s=P("she-admin"),r=P(""),a=P("/etc/mosquitto"),d=P(null),u=P(!1),f=P(!1),g=P("she-admin"),p=P(""),C=P(!1);async function b(){m(n,!0),m(i,"");try{(await(await fetch("/she/broker/wizard/probe",{method:"POST",headers:{"Content-Type":"application/json"}})).json()).active?m(t,"done"):m(t,"config")}catch(oe){m(i,oe.message,!0)}finally{m(n,!1)}}async function E(){m(n,!0),m(i,"");try{const oe=await fetch("/she/broker/wizard/bootstrap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adminUsername:c(s),adminPassword:c(r)||void 0,configDir:c(a)})}),ye=await oe.json();if(!oe.ok||!ye.ok)throw new Error(ye.error??"Bootstrap failed");m(d,ye,!0);const Re=await Nl(),ke=Re.broker??{};await Jg({...Re,broker:{...ke,dynsec:{adminUsername:ye.adminUsername,adminPassword:ye.adminPassword}}}),await sU().catch(()=>{}),m(t,"restart")}catch(oe){m(i,oe.message,!0)}finally{m(n,!1)}}async function y(){m(f,!0),m(i,"");try{await iU(),await new Promise(oe=>setTimeout(oe,2e3)),m(u,!0),m(t,"done")}catch(oe){m(i,oe.message,!0)}finally{m(f,!1)}}async function D(){m(C,!0),m(i,"");try{const oe=await Nl(),ye=oe.broker??{};await Jg({...oe,broker:{...ye,dynsec:{adminUsername:c(g),adminPassword:c(p)}}}),m(t,"done")}catch(oe){m(i,oe.message,!0)}finally{m(C,!1)}}var I=yee(),M=v(I),R=_(v(M),2),T=_(M,2);{var V=oe=>{var ye=pee(),Re=v(ye);j(()=>W(Re,c(i))),A(oe,ye)};z(T,oe=>{c(i)&&oe(V)})}var O=_(T,2);{var Q=oe=>{var ye=xee(),Re=_(v(ye),6),ke=v(Re);j(()=>ke.disabled=c(n)),$("click",ke,()=>{m(t,"probe"),b()}),A(oe,ye)},ie=oe=>{var ye=mee(),Re=v(ye),ke=v(Re);j(()=>W(ke,c(n)?"Probing dynsec…":"Checking dynsec status…")),A(oe,ye)},de=oe=>{var ye=_ee(),Re=_(v(ye),2),ke=_(v(Re)),_e=_(Re,2),lt=_(v(_e)),Te=_(_e,2),pe=_(v(Te)),ut=_(Te,2),Rt=v(ut),st=v(Rt);j(()=>{Rt.disabled=c(n)||!c(s),W(st,c(n)?"Bootstrapping…":"Bootstrap dynsec")}),jt(ke,()=>c(s),St=>m(s,St)),jt(lt,()=>c(r),St=>m(r,St)),jt(pe,()=>c(a),St=>m(a,St)),$("click",Rt,E),A(oe,ye)},te=oe=>{var ye=bee(),Re=_(v(ye),2),ke=_(v(Re),3),_e=v(ke),lt=_(Re,4),Te=v(lt),pe=v(Te),ut=_(Te,2),Rt=_(lt,2);{var st=St=>{var be=vee();A(St,be)};z(Rt,St=>{c(f)&&St(st)})}j(()=>{W(_e,c(d).confFilePath),Te.disabled=c(f),W(pe,c(f)?"Restarting…":"Restart mosquitto now")}),$("click",Te,y),$("click",ut,()=>{m(t,"done")}),A(oe,ye)},le=oe=>{var ye=Cee(),Re=_(v(ye),4),ke=v(Re);$("click",ke,function(..._e){var lt;(lt=e.onDone)==null||lt.apply(this,_e)}),A(oe,ye)},we=oe=>{var ye=Eee(),Re=_(v(ye),2),ke=_(v(Re)),_e=_(Re,2),lt=_(v(_e)),Te=_(_e,2),pe=v(Te),ut=_(pe,2),Rt=v(ut);j(()=>{ut.disabled=c(C)||!c(g)||!c(p),W(Rt,c(C)?"Saving…":"Save credentials")}),jt(ke,()=>c(g),st=>m(g,st)),jt(lt,()=>c(p),st=>m(p,st)),$("click",pe,()=>m(t,"intro")),$("click",ut,D),A(oe,ye)};z(O,oe=>{c(t)==="intro"?oe(Q):c(t)==="probe"?oe(ie,1):c(t)==="config"?oe(de,2):c(t)==="restart"&&c(d)?oe(te,3):c(t)==="done"?oe(le,4):c(t)==="manual"&&oe(we,5)})}$("click",R,()=>m(t,"manual")),A(o,I),Hs()}Us(["click"]);var See=F('<div class="loading svelte-zuhcpo">Loading…</div>'),Dee=F('<div class="error-banner svelte-zuhcpo"> </div>'),Aee=F('<div class="conn-row svelte-zuhcpo"><span></span> <span class="conn-name svelte-zuhcpo">dynamic security</span> <span><!></span> <button class="btn-deactivate svelte-zuhcpo"> </button></div>'),kee=F('<button class="btn-wizard-inline svelte-zuhcpo">Setup Wizard ↗</button>'),Bee=F('<div class="conn-row svelte-zuhcpo"><span class="dot dot-off svelte-zuhcpo"></span> <span class="conn-name svelte-zuhcpo">dynamic security</span> <span class="conn-detail muted svelte-zuhcpo">not configured</span> <!></div>'),Fee=F('<div class="error-inline svelte-zuhcpo"> </div>'),Lee=F('<button class="diag-btn svelte-zuhcpo"> </button>'),RA=F('<p class="diag-issue svelte-zuhcpo"> </p>'),Iee=F('<p class="diag-ok-msg svelte-zuhcpo">✓ dynamic-security.json looks correct. Verify mosquitto restarted with the plugin loaded.</p>'),Pee=F('<p class="diag-row svelte-zuhcpo"><span class="svelte-zuhcpo">File</span><code class="svelte-zuhcpo"> </code></p> <p class="diag-row svelte-zuhcpo"><span class="svelte-zuhcpo">Admin user exists</span><span> </span></p> <p class="diag-row svelte-zuhcpo"><span class="svelte-zuhcpo">Has admin role</span><span> </span></p> <p class="diag-row svelte-zuhcpo"><span class="svelte-zuhcpo">$CONTROL publish ACL</span><span> </span></p> <!> <!>',1),Tee=F('<div><!></div> <button class="diag-btn svelte-zuhcpo" style="margin-top:6px"> </button>',1),Mee=F('<button class="wizard-btn svelte-zuhcpo">Run Setup Wizard</button>'),Ree=F('<div class="diag-area svelte-zuhcpo"><!> <!></div>'),Nee=F('<div class="stats-block svelte-zuhcpo"><dl class="svelte-zuhcpo"><dt class="svelte-zuhcpo">Version</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Uptime</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Clients</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Messages</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Topics</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Traffic</dt><dd class="svelte-zuhcpo"> </dd></dl></div>'),Oee=F('<div style="margin-top: 20px;"><!></div>'),Hee=F('<div class="status-layout svelte-zuhcpo"><div class="conn-block svelte-zuhcpo"><div class="conn-row svelte-zuhcpo"><span class="dot ok svelte-zuhcpo"></span> <span class="conn-name svelte-zuhcpo">mosquitto</span> <span class="conn-detail svelte-zuhcpo"> </span></div> <!> <!></div> <!> <!></div> <!>',1),Wee=F('<div class="tab-content svelte-zuhcpo"><!></div>'),zee=F('<div class="broker-page svelte-zuhcpo"><div class="sub-nav svelte-zuhcpo"><button>Status</button> <button>Directory</button> <button>Config</button> <button>Listeners</button> <button>Certificates</button> <button>Connection</button> <button>Logs</button></div> <!></div> <!>',1);function Vee(o,e){Os(e,!0);let t=P(!1),i,n=P(!1),s=P(""),r=P(!1),a=P(null);const d="she-broker-tab";let u=P(Di(localStorage.getItem(d)??"status"));zn(()=>{localStorage.setItem(d,c(u))});let f=P(null),g=P(""),p=P(!0);async function C(){try{m(f,await R9(),!0),m(g,"")}catch(at){m(g,at.message??"Failed to load broker status",!0)}finally{m(p,!1)}}$s(()=>{C();const at=setInterval(C,1e4);return()=>clearInterval(at)});async function b(){m(r,!0),m(a,null);try{m(a,await oU(),!0)}catch(at){m(a,{ok:!1,dynSecPath:"",issues:[at.message??"Diagnose request failed"]},!0)}finally{m(r,!1)}}async function E(){if(await i.show("Remove dynsec plugin lines from mosquitto.conf and clear credentials? You will need to restart mosquitto afterwards.",{confirm:"Deactivate",danger:!0})){m(n,!0),m(s,"");try{await nU(),await C()}catch(at){m(s,at.message??"Deactivate failed",!0)}finally{m(n,!1)}}}function y(at){var Ot;if(!((Ot=c(f))!=null&&Ot.sys))return"—";const et=c(f).sys[at];return et?String(et.val??"—"):"—"}function D(at){if(at==="—")return at;const et=at.match(/^(\d+)/),Ot=et?parseInt(et[1]):NaN;if(isNaN(Ot))return at;const di=Math.floor(Ot/86400),dt=Math.floor(Ot%86400/3600),Ft=Math.floor(Ot%3600/60),Vt=Ot%60,zt=Qt=>String(Qt).padStart(2,"0");return di>0?`${di}d ${zt(dt)}:${zt(Ft)}:${zt(Vt)}`:`${zt(dt)}:${zt(Ft)}:${zt(Vt)}`}function I(at){if(at==="—")return at;const et=parseInt(at);return isNaN(et)?at:et<1024?`${et} B`:et<1048576?`${(et/1024).toFixed(1)} KB`:et<1073741824?`${(et/1048576).toFixed(1)} MB`:`${(et/1073741824).toFixed(1)} GB`}var M=zee(),R=wt(M),T=v(R),V=v(T);let O;var Q=_(V,2);let ie;var de=_(Q,2);let te;var le=_(de,2);let we;var oe=_(le,2);let ye;var Re=_(oe,2);let ke;var _e=_(Re,2);let lt;var Te=_(T,2);{var pe=at=>{var et=Wee(),Ot=v(et);{var di=Vt=>{var zt=See();A(Vt,zt)},dt=Vt=>{var zt=Dee(),Qt=v(zt);j(()=>W(Qt,c(g))),A(Vt,zt)},Ft=Vt=>{var zt=Hee(),Qt=wt(zt),vt=v(Qt),Pi=v(vt),Ai=_(v(Pi),4),hi=v(Ai),$i=_(Pi,2);{var Mi=Bi=>{var Wi=Aee(),Zi=v(Wi);let mi;var Ke=_(Zi,4);let Nt;var Fi=v(Ke);{var ki=Ye=>{var rt=_o("plugin active");A(Ye,rt)},_i=Ye=>{var rt=_o("connected — plugin not responding");A(Ye,rt)},Ti=Ye=>{var rt=_o("disconnected");A(Ye,rt)};z(Fi,Ye=>{c(f).dynsec.dynsecReady?Ye(ki):c(f).dynsec.connected?Ye(_i,1):Ye(Ti,-1)})}var Z=_(Ke,2),Se=v(Z);j(()=>{mi=kt(Zi,1,"dot svelte-zuhcpo",null,mi,{ok:c(f).dynsec.dynsecReady,warn:c(f).dynsec.connected&&!c(f).dynsec.dynsecReady,"dot-err":!c(f).dynsec.connected}),Nt=kt(Ke,1,"conn-detail svelte-zuhcpo",null,Nt,{ok:c(f).dynsec.dynsecReady,warn:c(f).dynsec.connected&&!c(f).dynsec.dynsecReady,err:!c(f).dynsec.connected}),Z.disabled=c(n),W(Se,c(n)?"…":"deactivate")}),$("click",Z,E),A(Bi,Wi)},Ci=Bi=>{var Wi=Bee(),Zi=_(v(Wi),6);{var mi=Ke=>{var Nt=kee();$("click",Nt,()=>m(t,!0)),A(Ke,Nt)};z(Zi,Ke=>{c(t)||Ke(mi)})}A(Bi,Wi)};z($i,Bi=>{c(f).dynsec.configured?Bi(Mi):Bi(Ci,-1)})}var Ji=_($i,2);{var Ki=Bi=>{var Wi=Fee(),Zi=v(Wi);j(()=>W(Zi,c(s))),A(Bi,Wi)};z(Ji,Bi=>{c(s)&&Bi(Ki)})}var Ri=_(vt,2);{var cn=Bi=>{var Wi=Ree(),Zi=v(Wi);{var mi=ki=>{var _i=Lee(),Ti=v(_i);j(()=>{_i.disabled=c(r),W(Ti,c(r)?"Running diagnostics…":"Run diagnostics")}),$("click",_i,b),A(ki,_i)},Ke=ki=>{var _i=Tee(),Ti=wt(_i);let Z;var Se=v(Ti);{var Ye=me=>{var Ne=RA(),Y=v(Ne);j(()=>W(Y,`⚠ ${c(a).error??""}`)),A(me,Ne)},rt=me=>{var Ne=Pee(),Y=wt(Ne),ze=_(v(Y)),He=v(ze),xe=_(Y,2),bt=_(v(xe)),Ht=v(bt),ri=_(xe,2),ii=_(v(ri)),gi=v(ii),qt=_(ri,2),vi=_(v(qt)),Oe=v(vi),Ue=_(qt,2);si(Ue,17,()=>c(a).issues,Vi,(Ei,Kt)=>{var ue=RA(),qe=v(ue);j(()=>W(qe,`⚠ ${c(Kt)??""}`)),A(Ei,ue)});var Xt=_(Ue,2);{var Gt=Ei=>{var Kt=Iee();A(Ei,Kt)};z(Xt,Ei=>{c(a).ok&&Ei(Gt)})}j(()=>{W(He,c(a).dynSecPath),kt(bt,1,Xf(c(a).adminClientExists?"ok":"fail"),"svelte-zuhcpo"),W(Ht,c(a).adminClientExists?"✓ yes":"✗ no"),kt(ii,1,Xf(c(a).hasAdminRole?"ok":"fail"),"svelte-zuhcpo"),W(gi,c(a).hasAdminRole?"✓ yes":"✗ no"),kt(vi,1,Xf(c(a).hasControlSendAcl?"ok":"fail"),"svelte-zuhcpo"),W(Oe,c(a).hasControlSendAcl?"✓ present":"✗ missing")}),A(me,Ne)};z(Se,me=>{c(a).error?me(Ye):me(rt,-1)})}var Ut=_(Ti,2),se=v(Ut);j(()=>{Z=kt(Ti,1,"diag-card svelte-zuhcpo",null,Z,{"diag-ok":c(a).ok,"diag-fail":!c(a).ok}),Ut.disabled=c(r),W(se,c(r)?"Running…":"Re-run")}),$("click",Ut,b),A(ki,_i)};z(Zi,ki=>{c(a)?ki(Ke,-1):ki(mi)})}var Nt=_(Zi,2);{var Fi=ki=>{var _i=Mee();$("click",_i,()=>m(t,!0)),A(ki,_i)};z(Nt,ki=>{c(t)||ki(Fi)})}A(Bi,Wi)};z(Ri,Bi=>{c(f).dynsec.configured&&c(f).dynsec.connected&&!c(f).dynsec.dynsecReady&&Bi(cn)})}var ft=_(Ri,2);{var Zt=Bi=>{var Wi=Nee(),Zi=v(Wi),mi=_(v(Zi)),Ke=v(mi),Nt=_(mi,3),Fi=v(Nt),ki=_(Nt,3),_i=v(ki),Ti=_(ki,3),Z=v(Ti),Se=_(Ti,3),Ye=v(Se),rt=_(Se,3),Ut=v(rt);j((se,me,Ne,Y,ze,He,xe,bt,Ht,ri,ii,gi)=>{W(Ke,se),W(Fi,me),W(_i,`${Ne??""} connected · ${Y??""} max · ${ze??""} total`),W(Z,`${He??""} rcv · ${xe??""} sent · ${bt??""} stored`),W(Ye,`${Ht??""} retained · ${ri??""} subscriptions`),W(Ut,`${ii??""} in · ${gi??""} out`)},[()=>y("$SYS/broker/version"),()=>D(y("$SYS/broker/uptime")),()=>y("$SYS/broker/clients/connected"),()=>y("$SYS/broker/clients/maximum"),()=>y("$SYS/broker/clients/total"),()=>y("$SYS/broker/messages/received"),()=>y("$SYS/broker/messages/sent"),()=>y("$SYS/broker/messages/stored"),()=>y("$SYS/broker/retained messages/count"),()=>y("$SYS/broker/subscriptions/count"),()=>I(y("$SYS/broker/bytes/received")),()=>I(y("$SYS/broker/bytes/sent"))]),A(Bi,Wi)},fi=It(()=>Object.keys(c(f).sys).length>0);z(ft,Bi=>{c(fi)&&Bi(Zt)})}var Ni=_(Qt,2);{var Ii=Bi=>{var Wi=Oee(),Zi=v(Wi);wee(Zi,{onDone:()=>{m(t,!1),C()}}),A(Bi,Wi)};z(Ni,Bi=>{c(t)&&(!c(f).dynsec.configured||!c(f).dynsec.dynsecReady)&&Bi(Ii)})}j(()=>W(hi,c(f).sshConfigured?`ssh — ${c(f).sshHost}`:"local")),A(Vt,zt)};z(Ot,Vt=>{c(p)?Vt(di):c(g)?Vt(dt,1):c(f)&&Vt(Ft,2)})}A(at,et)},ut=at=>{{let et=It(()=>{var Ot;return((Ot=c(f))==null?void 0:Ot.dynsec.dynsecReady)??!1});lJ(at,{get dynsecReady(){return c(et)}})}},Rt=at=>{kJ(at,{})},st=at=>{EJ(at,{})},St=at=>{ZJ(at,{})},be=at=>{ree(at,{})},Tt=at=>{gee(at,{})};z(Te,at=>{c(u)==="status"?at(pe):c(u)==="users"?at(ut,1):c(u)==="brokerconfig"?at(Rt,2):c(u)==="listeners"?at(st,3):c(u)==="certs"?at(St,4):c(u)==="ssh"?at(be,5):c(u)==="logs"&&at(Tt,6)})}var xt=_(R,2);cs(Zc(xt,{}),at=>i=at,()=>i),j(()=>{O=kt(V,1,"svelte-zuhcpo",null,O,{active:c(u)==="status"}),ie=kt(Q,1,"svelte-zuhcpo",null,ie,{active:c(u)==="users"}),te=kt(de,1,"svelte-zuhcpo",null,te,{active:c(u)==="brokerconfig"}),we=kt(le,1,"svelte-zuhcpo",null,we,{active:c(u)==="listeners"}),ye=kt(oe,1,"svelte-zuhcpo",null,ye,{active:c(u)==="certs"}),ke=kt(Re,1,"svelte-zuhcpo",null,ke,{active:c(u)==="ssh"}),lt=kt(_e,1,"svelte-zuhcpo",null,lt,{active:c(u)==="logs"})}),$("click",V,()=>m(u,"status")),$("click",Q,()=>m(u,"users")),$("click",de,()=>m(u,"brokerconfig")),$("click",le,()=>m(u,"listeners")),$("click",oe,()=>m(u,"certs")),$("click",Re,()=>m(u,"ssh")),$("click",_e,()=>m(u,"logs")),A(o,M),Hs()}Us(["click"]);var jee=F('<span class="nav-dot nav-dot--warn svelte-1n46o8q"></span>'),$ee=F('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="MQTT broker not connected"></span>'),Uee=F('<span class="nav-dot nav-dot--warn nav-dot--blink svelte-1n46o8q" title="Waiting for retained MQTT state"></span>'),qee=F('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="MQTT connected"></span>'),Gee=F('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="All Matter devices online"></span>'),Kee=F('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Some Matter devices offline"></span>'),Zee=F('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="No Matter devices online"></span>'),Xee=F('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="Errors in recent logs"></span>'),Yee=F('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Warnings in recent logs"></span>'),Qee=F('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),Jee=F('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),ete=F('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),tte=F('<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" class="svelte-1n46o8q"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> </button>'),ite=F('<div class="version-popup svelte-1n46o8q"><dl class="svelte-1n46o8q"><dt class="svelte-1n46o8q">Installed</dt><dd class="svelte-1n46o8q"></dd> <!></dl> <div class="version-actions svelte-1n46o8q"><!> <button class="check-btn svelte-1n46o8q" title="Check for updates now"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> </button></div></div>'),nte=F('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),ste=F('<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),ote=F('<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),rte=F('<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>'),ate=F('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),lte=F('<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" class="svelte-1n46o8q"><path d="M18.36 6.64a9 9 0 1 1-12.73 0" class="svelte-1n46o8q"></path><line x1="12" y1="2" x2="12" y2="12" class="svelte-1n46o8q"></line></svg> Restart daemon</button>'),cte=F('<div class="stats-popup svelte-1n46o8q"><!> <div class="stats-actions svelte-1n46o8q"><!></div></div>'),dte=F('<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" class="svelte-1n46o8q"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" class="svelte-1n46o8q"></path><polyline points="16 17 21 12 16 7" class="svelte-1n46o8q"></polyline><line x1="21" y1="12" x2="9" y2="12" class="svelte-1n46o8q"></line></svg></button>'),ute=F('<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" class="svelte-1n46o8q"><polyline points="5,3 1,8 5,13" class="svelte-1n46o8q"></polyline><polyline points="11,3 15,8 11,13" class="svelte-1n46o8q"></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" class="svelte-1n46o8q"><rect x="0.75" y="0.75" width="14.5" height="14.5" rx="1" class="svelte-1n46o8q"></rect><path d="M2,11 V5 H5 V11" class="svelte-1n46o8q"></path><path d="M6,12 V5 H9 V8 H6" class="svelte-1n46o8q"></path><path d="M10,11 V5 H15 V11" class="svelte-1n46o8q"></path><line x1="12.5" y1="5" x2="12.5" y2="11" class="svelte-1n46o8q"></line></svg> Packages <!></button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" stroke="none" style="vertical-align: middle" class="svelte-1n46o8q"><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" class="svelte-1n46o8q"></path></svg> MQTT <!></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" class="svelte-1n46o8q"><circle cx="8" cy="10" r="2" class="svelte-1n46o8q"></circle><path d="M5,7 A4,4 0,0,1 11,7" class="svelte-1n46o8q"></path><path d="M3,5 A6.5,6.5 0,0,1 13,5" class="svelte-1n46o8q"></path><line x1="8" y1="12" x2="8" y2="15" class="svelte-1n46o8q"></line></svg> Broker</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" class="svelte-1n46o8q"><path d="M8,2 L8,7" class="svelte-1n46o8q"></path><path d="M6,5 L8,7.5 L10,5" class="svelte-1n46o8q"></path><path d="M2.5,14 L6,10" class="svelte-1n46o8q"></path><path d="M6.2,12.8 L6,10 L3.2,10.2" class="svelte-1n46o8q"></path><path d="M13.5,14 L10,10" class="svelte-1n46o8q"></path><path d="M9.8,12.8 L10,10 L12.8,10.2" class="svelte-1n46o8q"></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" class="svelte-1n46o8q"><ellipse cx="8" cy="4.5" rx="5" ry="1.8" class="svelte-1n46o8q"></ellipse><path d="M3,4.5 v7 a5,1.8 0,0,0 10,0 v-7" class="svelte-1n46o8q"></path><path d="M3,8 a5,1.8 0,0,0 10,0" class="svelte-1n46o8q"></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" class="svelte-1n46o8q"><line x1="2" y1="5" x2="14" y2="5" class="svelte-1n46o8q"></line><line x1="2" y1="8" x2="14" y2="8" class="svelte-1n46o8q"></line><line x1="2" y1="11" x2="9" y2="11" class="svelte-1n46o8q"></line></svg> Logs <!></button> <div class="nav-spacer svelte-1n46o8q"></div> <div class="nav-right svelte-1n46o8q"><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" class="svelte-1n46o8q"><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" class="svelte-1n46o8q"></path></svg></a> <div class="version-wrap svelte-1n46o8q"><button class="version svelte-1n46o8q"> <!></button> <!></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" class="svelte-1n46o8q"><line x1="18" y1="20" x2="18" y2="10" class="svelte-1n46o8q"></line><line x1="12" y1="20" x2="12" y2="4" class="svelte-1n46o8q"></line><line x1="6" y1="20" x2="6" y2="14" class="svelte-1n46o8q"></line></svg></button> <!></div> <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" class="svelte-1n46o8q"><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" class="svelte-1n46o8q"></path><circle cx="12" cy="12" r="3" class="svelte-1n46o8q"></circle></svg></button> <!></div></nav> <main class="svelte-1n46o8q"><!> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div></main></div>'),hte=F('<div class="login-error svelte-1n46o8q"> </div>'),fte=F('<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>'),gte=F('<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" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> Restarting smart-home-engine…</div></div>'),pte=F('<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" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> Updating smart-home-engine…</div></div>'),xte=F("<!> <!> <!> <!>",1);function mte(o,e){Os(e,!0);const t=["scripts","mqtt","matter","security","db","logs","config","packages"];function i(){const xt=location.hash.slice(1);return t.includes(xt)?xt:"scripts"}let n=P(Di(i())),s=P(null),r=P(!1),a=P(!1),d=P(!1),u=P(!1),f=P("none"),g=P(""),p=P(!1),C=P(""),b=P(""),E=P(!1),y=P(!1);w$(()=>{m(p,!0)});async function D(){m(b,""),m(E,!0);try{await A$(c(C)),m(C,""),m(p,!1)}catch(xt){m(b,xt.message??"Login failed",!0)}finally{m(E,!1)}}async function I(){if(c(f)==="proxy"&&c(g)){window.location.href=c(g);return}await k$(),m(p,!0)}let M=P(null),R=P(!1),T=P(!1),V=P(!1),O=P(!1),Q=P(Di([])),ie=P(0),de=P(Di([]));const te=It(()=>c(de).filter(xt=>xt.online).length),le=It(()=>c(de).length===0?"none":c(te)===c(de).length?"all":c(te)>0?"some":"offline");let we=P(!1),oe=P(!1);async function ye(){if(!await c(M).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;m(R,!0);let xt;try{xt=(await Vf()).startedAt}catch{}try{await XB()}catch{}const at=Date.now()+6e4;for(;Date.now()<at;){await new Promise(et=>setTimeout(et,250));try{const et=await Vf();if(xt===void 0||et.startedAt!==xt){location.reload();return}}catch{}}location.reload()}async function Re(){m(d,!0);try{const xt=await T$();c(s)&&m(s,{...c(s),latestVersion:xt.latestVersion??void 0},!0)}catch{}finally{m(d,!1)}}async function ke(){var et,Ot;if(!await c(M).show(`Update to v${(et=c(s))==null?void 0:et.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;m(a,!1),m(u,!0);const xt=(Ot=c(s))==null?void 0:Ot.startedAt;try{await P$()}catch{}const at=Date.now()+18e4;for(;Date.now()<at;){await new Promise(di=>setTimeout(di,1e3));try{const di=await Vf();if(xt===void 0||di.startedAt!==xt){location.reload();return}}catch{m(u,!1),m(R,!0)}}location.reload()}function _e(xt){m(n,xt,!0),location.hash=xt}$s(async()=>{location.hash||(location.hash=c(n));const xt=()=>{m(n,i(),!0)};window.addEventListener("hashchange",xt);try{const zt=await D$();m(f,zt.mode,!0),m(g,zt.proxyLogoutUrl??"",!0),c(f)==="password"&&(await fetch("/she/scripts")).status===401&&m(p,!0)}catch{}m(y,!0);async function at(){try{m(s,await Vf(),!0)}catch{}try{const[zt,Qt]=await Promise.all([JB(),Nl()]);m(Q,Array.isArray(Qt.pinnedPackages)?Qt.pinnedPackages:[],!0),m(ie,Object.keys(zt).filter(vt=>!c(Q).includes(vt)).length,!0)}catch{}}at();const et=setInterval(at,5e3),Ot=ur("mqtt:status",zt=>{zt.connected===!1?(m(O,!0),m(T,!1),m(V,!1)):(m(O,!1),m(T,zt.ready===!1),m(V,zt.ready===!0))}),di=ur("matter:deviceList",zt=>{Array.isArray(zt.devices)&&m(de,zt.devices.map(Qt=>({nodeId:String(Qt.nodeId),online:!!Qt.online})),!0)}),dt=ur("matter:deviceStatus",zt=>{if(zt.nodeId===void 0)return;const Qt=String(zt.nodeId),vt=!!zt.online;m(de,c(de).map(Pi=>Pi.nodeId===Qt?{...Pi,online:vt}:Pi),!0)}),Ft=cF();m(we,Ft.some(zt=>zt.level==="error"),!0),m(oe,!c(we)&&Ft.some(zt=>zt.level==="warn"),!0);const Vt=H9(zt=>{zt.level==="error"?(m(we,!0),m(oe,!1)):zt.level==="warn"&&!c(we)&&m(oe,!0)});return()=>{window.removeEventListener("hashchange",xt),clearInterval(et),Ot(),di(),dt(),Vt()}});var lt=xte();ls("click",Hk,()=>{c(r)&&m(r,!1),c(a)&&m(a,!1)});var Te=wt(lt);{var pe=xt=>{var at=ute(),et=v(at),Ot=_(v(et),2);let di;var dt=_(Ot,2);let Ft;var Vt=_(v(dt),2);{var zt=X=>{var J=jee();j(()=>ln(J,"title",`${c(ie)??""} package update${c(ie)===1?"":"s"} available`)),A(X,J)};z(Vt,X=>{c(ie)>0&&X(zt)})}var Qt=_(dt,2);let vt;var Pi=_(v(Qt),2);{var Ai=X=>{var J=$ee();A(X,J)},hi=X=>{var J=Uee();A(X,J)},$i=X=>{var J=qee();A(X,J)};z(Pi,X=>{c(O)?X(Ai):c(T)?X(hi,1):c(V)&&X($i,2)})}var Mi=_(Qt,2);let Ci;var Ji=_(Mi,2);let Ki;var Ri=_(v(Ji),2);{var cn=X=>{var J=Gee();A(X,J)},ft=X=>{var J=Kee();A(X,J)},Zt=X=>{var J=Zee();A(X,J)};z(Ri,X=>{c(le)==="all"?X(cn):c(le)==="some"?X(ft,1):c(le)==="offline"&&X(Zt,2)})}var fi=_(Ji,2);let Ni;var Ii=_(fi,2);let Bi;var Wi=_(v(Ii),2);{var Zi=X=>{var J=Xee();A(X,J)},mi=X=>{var J=Yee();A(X,J)};z(Wi,X=>{c(we)?X(Zi):c(oe)&&X(mi,1)})}var Ke=_(Ii,4),Nt=_(v(Ke),2),Fi=v(Nt),ki=v(Fi);ki.nodeValue="v1.9.0 ";var _i=_(ki);{var Ti=X=>{var J=Qee();A(X,J)};z(_i,X=>{var J,he;(J=c(s))!=null&&J.latestVersion&&!((he=c(s))!=null&&he.docker)&&X(Ti)})}var Z=_(Fi,2);{var Se=X=>{var J=ite(),he=v(J),Qe=_(v(he));Qe.textContent="v1.9.0";var ae=_(Qe,2);{var fe=Me=>{var Be=Jee(),Et=_(wt(Be)),Ct=v(Et);j(()=>W(Ct,`v${c(s).latestVersion??""}`)),A(Me,Be)},Fe=Me=>{var Be=ete();A(Me,Be)};z(ae,Me=>{var Be;(Be=c(s))!=null&&Be.latestVersion?Me(fe):Me(Fe,-1)})}var ge=_(he,2),Ee=v(ge);{var ct=Me=>{var Be=tte(),Et=_(v(Be));j(()=>W(Et,` Update to v${c(s).latestVersion??""}`)),$("click",Be,ke),A(Me,Be)};z(Ee,Me=>{var Be;(Be=c(s))!=null&&Be.latestVersion&&Me(ct)})}var q=_(Ee,2),re=v(q);let Le;var tt=_(re);j(()=>{q.disabled=c(d),Le=kt(re,0,"svelte-1n46o8q",null,Le,{spinning:c(d)}),W(tt,` ${c(d)?"Checking…":"Check for updates"}`)}),$("click",J,Me=>Me.stopPropagation()),$("click",q,Re),A(X,J)};z(Z,X=>{var J;c(a)&&!((J=c(s))!=null&&J.docker)&&X(Se)})}var Ye=_(Nt,2),rt=v(Ye),Ut=_(rt,2);{var se=X=>{var J=cte(),he=v(J);{var Qe=Ee=>{var ct=rte(),q=v(ct);{var re=At=>{const Mt=It(()=>Math.floor((Date.now()-c(s).startedAt)/1e3)),_t=It(()=>Math.floor(c(Mt)/86400)),bi=It(()=>Math.floor(c(Mt)%86400/3600)),wi=It(()=>Math.floor(c(Mt)%3600/60));var qi=nte(),Oi=_(wt(qi)),Gi=v(Oi);j(()=>W(Gi,`${c(_t)>0?c(_t)+"d ":""}${c(bi)>0||c(_t)>0?c(bi)+"h ":""}${c(wi)??""}m`)),A(At,qi)};z(q,At=>{c(s).startedAt&&At(re)})}var Le=_(q,3),tt=v(Le),Me=_(Le,3),Be=v(Me),Et=_(Me,3),Ct=v(Et),Ie=_(Et,2);{var Dt=At=>{var Mt=ste(),_t=_(wt(Mt)),bi=v(_t),wi=_(_t,3),qi=v(wi);j(()=>{W(bi,c(s).matterNodes??0),W(qi,c(s).matterEndpoints??0)}),A(At,Mt)};z(Ie,At=>{c(s).matterEnabled&&At(Dt)})}var Je=_(Ie,2);{var Ve=At=>{var Mt=ote(),_t=_(wt(Mt)),bi=v(_t),wi=_(_t,3),qi=v(wi);j(()=>{W(bi,c(s).dbDocs??"—"),W(qi,c(s).dbViews??"—")}),A(At,Mt)};z(Je,At=>{c(s).dbEnabled&&At(Ve)})}var Xe=_(Je,3),mt=v(Xe),je=_(Xe,3),yt=v(je),Pe=_(je,3),nt=v(Pe);j(()=>{W(tt,c(s).scripts),W(Be,c(s).topics),W(Ct,c(s).mqttMsgPerSec??"—"),W(mt,c(s).handlers??"—"),W(yt,c(s).memMb!=null?c(s).memMb+" MB":"—"),W(nt,c(s).cpuPercent!=null?c(s).cpuPercent+" %":"—")}),A(Ee,ct)},ae=Ee=>{var ct=ate();A(Ee,ct)};z(he,Ee=>{c(s)?Ee(Qe):Ee(ae,-1)})}var fe=_(he,2),Fe=v(fe);{var ge=Ee=>{var ct=lte();$("click",ct,()=>{m(r,!1),ye()}),A(Ee,ct)};z(Fe,Ee=>{var ct;(ct=c(s))!=null&&ct.docker||Ee(ge)})}$("click",J,Ee=>Ee.stopPropagation()),A(X,J)};z(Ut,X=>{c(r)&&X(se)})}var me=_(Ye,2);let Ne;var Y=_(me,2);{var ze=X=>{var J=dte();$("click",J,I),A(X,J)};z(Y,X=>{c(f)==="password"&&X(ze)})}var He=_(et,2),xe=v(He);cs(Zc(xe,{}),X=>m(M,X,!0),()=>c(M));var bt=_(xe,2);let Ht;var ri=v(bt);{let X=It(()=>c(n)==="scripts");RK(ri,{get active(){return c(X)}})}var ii=_(bt,2);let gi;var qt=v(ii);AQ(qt,{});var vi=_(ii,2);let Oe;var Ue=v(vi);lQ(Ue,{});var Xt=_(vi,2);let Gt;var Ei=v(Xt);DY(Ei,{});var Kt=_(Xt,2);let ue;var qe=v(Kt);Vee(qe,{});var it=_(Kt,2);let ot;var ht=v(it);BX(ht,{});var pt=_(it,2);let Jt;var B=v(pt);CZ(B,{});var H=_(pt,2);let K;var ce=v(H);SZ(ce,{}),j(()=>{di=kt(Ot,1,"svelte-1n46o8q",null,di,{active:c(n)==="scripts"}),Ft=kt(dt,1,"svelte-1n46o8q",null,Ft,{active:c(n)==="packages"}),vt=kt(Qt,1,"svelte-1n46o8q",null,vt,{active:c(n)==="mqtt"}),Ci=kt(Mi,1,"svelte-1n46o8q",null,Ci,{active:c(n)==="security"}),Ki=kt(Ji,1,"svelte-1n46o8q",null,Ki,{active:c(n)==="matter"}),Ni=kt(fi,1,"svelte-1n46o8q",null,Ni,{active:c(n)==="db"}),Bi=kt(Ii,1,"svelte-1n46o8q",null,Bi,{active:c(n)==="logs"}),Ne=kt(me,1,"nav-settings svelte-1n46o8q",null,Ne,{active:c(n)==="config"}),Ht=kt(bt,1,"page-wrap svelte-1n46o8q",null,Ht,{hidden:c(n)!=="scripts"}),gi=kt(ii,1,"page-wrap svelte-1n46o8q",null,gi,{hidden:c(n)!=="packages"}),Oe=kt(vi,1,"page-wrap svelte-1n46o8q",null,Oe,{hidden:c(n)!=="mqtt"}),Gt=kt(Xt,1,"page-wrap svelte-1n46o8q",null,Gt,{hidden:c(n)!=="matter"}),ue=kt(Kt,1,"page-wrap svelte-1n46o8q",null,ue,{hidden:c(n)!=="security"}),ot=kt(it,1,"page-wrap svelte-1n46o8q",null,ot,{hidden:c(n)!=="db"}),Jt=kt(pt,1,"page-wrap svelte-1n46o8q",null,Jt,{hidden:c(n)!=="config"}),K=kt(H,1,"page-wrap svelte-1n46o8q",null,K,{hidden:c(n)!=="logs"})}),$("click",Ot,()=>_e("scripts")),$("click",dt,()=>_e("packages")),$("click",Qt,()=>_e("mqtt")),$("click",Mi,()=>_e("security")),$("click",Ji,()=>_e("matter")),$("click",fi,()=>_e("db")),$("click",Ii,()=>{_e("logs"),m(we,!1),m(oe,!1)}),$("click",Fi,X=>{X.stopPropagation(),m(a,!c(a)),m(r,!1)}),$("click",rt,X=>{X.stopPropagation(),m(r,!c(r)),m(a,!1)}),$("click",me,()=>_e("config")),A(xt,at)};z(Te,xt=>{c(y)&&!c(p)&&xt(pe)})}var ut=_(Te,2);{var Rt=xt=>{var at=fte(),et=v(at),Ot=_(v(et),4),di=_(v(Ot),2),dt=_(Ot,2);{var Ft=Qt=>{var vt=hte(),Pi=v(vt);j(()=>W(Pi,c(b))),A(Qt,vt)};z(dt,Qt=>{c(b)&&Qt(Ft)})}var Vt=_(dt,2),zt=v(Vt);j(()=>{di.disabled=c(E),Vt.disabled=c(E)||!c(C),W(zt,c(E)?"Signing in…":"Sign in")}),ls("submit",et,Qt=>{Qt.preventDefault(),D()}),jt(di,()=>c(C),Qt=>m(C,Qt)),A(xt,at)};z(ut,xt=>{c(p)&&xt(Rt)})}var st=_(ut,2);{var St=xt=>{var at=gte();A(xt,at)};z(st,xt=>{c(R)&&xt(St)})}var be=_(st,2);{var Tt=xt=>{var at=pte();A(xt,at)};z(be,xt=>{c(u)&&xt(Tt)})}A(o,lt),Hs()}Us(["click"]);$I(mte,{target:document.getElementById("app")});export{_6 as t};